From christopher.lamb at gmail.com Mon Dec 10 01:24:07 2007 From: christopher.lamb at gmail.com (Christopher Lamb) Date: Mon, 10 Dec 2007 07:24:07 -0000 Subject: [llvm-commits] [llvm] r44785 - in /llvm/trunk: lib/CodeGen/BranchFolding.cpp test/CodeGen/X86/2007-06-14-branchfold.ll Message-ID: <200712100724.lBA7O7da007280@zion.cs.uiuc.edu> Author: clamb Date: Mon Dec 10 01:24:06 2007 New Revision: 44785 URL: http://llvm.org/viewvc/llvm-project?rev=44785&view=rev Log: Improve branch folding by recgonizing that explict successor relationships impact the value of fall-through choices. Modified: llvm/trunk/lib/CodeGen/BranchFolding.cpp llvm/trunk/test/CodeGen/X86/2007-06-14-branchfold.ll Modified: llvm/trunk/lib/CodeGen/BranchFolding.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/BranchFolding.cpp?rev=44785&r1=44784&r2=44785&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/BranchFolding.cpp (original) +++ llvm/trunk/lib/CodeGen/BranchFolding.cpp Mon Dec 10 01:24:06 2007 @@ -775,6 +775,11 @@ // optimize branches that branch to either a return block or an assert block // into a fallthrough to the return. if (MBB1->empty() || MBB2->empty()) return false; + + // If there is a clear successor ordering we make sure that one block + // will fall through to the next + if (MBB1->isSuccessor(MBB2)) return true; + if (MBB2->isSuccessor(MBB1)) return false; MachineInstr *MBB1I = --MBB1->end(); MachineInstr *MBB2I = --MBB2->end(); Modified: llvm/trunk/test/CodeGen/X86/2007-06-14-branchfold.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-06-14-branchfold.ll?rev=44785&r1=44784&r2=44785&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/2007-06-14-branchfold.ll (original) +++ llvm/trunk/test/CodeGen/X86/2007-06-14-branchfold.ll Mon Dec 10 01:24:06 2007 @@ -1,7 +1,5 @@ -; RUN: llvm-as < %s | llc -mcpu=i686 | grep jmp | count 1 +; RUN: llvm-as < %s | llc -mcpu=i686 | not grep jmp ; check that branch folding understands FP_REG_KILL is not a branch -; the remaining jmp can be removed if we take advantage of knowing -; abort does not return ; ModuleID = 'g.bc' target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64" From resistor at mac.com Mon Dec 10 02:07:09 2007 From: resistor at mac.com (Owen Anderson) Date: Mon, 10 Dec 2007 08:07:09 -0000 Subject: [llvm-commits] [llvm] r44786 - /llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Message-ID: <200712100807.lBA87903011985@zion.cs.uiuc.edu> Author: resistor Date: Mon Dec 10 02:07:09 2007 New Revision: 44786 URL: http://llvm.org/viewvc/llvm-project?rev=44786&view=rev Log: A little more progress on StrongPHIElimination, now that I have a better sense of how the CodeGen machinery works. Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=44786&r1=44785&r2=44786&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original) +++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Mon Dec 10 02:07:09 2007 @@ -39,6 +39,9 @@ static char ID; // Pass identification, replacement for typeid StrongPHIElimination() : MachineFunctionPass((intptr_t)&ID) {} + DenseMap, 2> > Waiting; + bool runOnMachineFunction(MachineFunction &Fn); virtual void getAnalysisUsage(AnalysisUsage &AU) const { @@ -263,6 +266,8 @@ while (P->getOpcode() == TargetInstrInfo::PHI) { LiveVariables::VarInfo& PHIInfo = LV.getVarInfo(P->getOperand(0).getReg()); + unsigned DestReg = P->getOperand(0).getReg(); + // Hold the names that are currently in the candidate set. std::set PHIUnion; std::set UnionedBlocks; @@ -271,17 +276,17 @@ unsigned SrcReg = P->getOperand(i-1).getReg(); LiveVariables::VarInfo& SrcInfo = LV.getVarInfo(SrcReg); - if (isLiveIn(SrcInfo, P->getParent())) { + // Check for trivial interferences + if (isLiveIn(SrcInfo, P->getParent()) || + isLiveOut(PHIInfo, SrcInfo.DefInst->getParent()) || + ( PHIInfo.DefInst->getOpcode() == TargetInstrInfo::PHI && + isLiveIn(PHIInfo, SrcInfo.DefInst->getParent()) ) || + ProcessedNames.count(SrcReg) || + UnionedBlocks.count(SrcInfo.DefInst->getParent())) { + // add a copy from a_i to p in Waiting[From[a_i]] - } else if (isLiveOut(PHIInfo, SrcInfo.DefInst->getParent())) { - // add a copy to Waiting[From[a_i]] - } else if (PHIInfo.DefInst->getOpcode() == TargetInstrInfo::PHI && - isLiveIn(PHIInfo, SrcInfo.DefInst->getParent())) { - // add a copy to Waiting[From[a_i]] - } else if (ProcessedNames.count(SrcReg)) { - // add a copy to Waiting[From[a_i]] - } else if (UnionedBlocks.count(SrcInfo.DefInst->getParent())) { - // add a copy to Waiting[From[a_i]] + MachineBasicBlock* From = P->getOperand(i).getMachineBasicBlock(); + Waiting[From].push_back(std::make_pair(SrcReg, DestReg)); } else { PHIUnion.insert(SrcReg); UnionedBlocks.insert(SrcInfo.DefInst->getParent()); @@ -291,7 +296,7 @@ std::vector DF = computeDomForest(PHIUnion); - // DO STUFF HERE + // Walk DomForest to resolve interferences ProcessedNames.insert(PHIUnion.begin(), PHIUnion.end()); ++P; From baldrick at free.fr Mon Dec 10 08:43:13 2007 From: baldrick at free.fr (Duncan Sands) Date: Mon, 10 Dec 2007 14:43:13 -0000 Subject: [llvm-commits] [llvm] r44791 - /llvm/trunk/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp Message-ID: <200712101443.lBAEhDCM016253@zion.cs.uiuc.edu> Author: baldrick Date: Mon Dec 10 08:43:10 2007 New Revision: 44791 URL: http://llvm.org/viewvc/llvm-project?rev=44791&view=rev Log: It looks like this has been broken for some time - get it to compile. Modified: llvm/trunk/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp Modified: llvm/trunk/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp?rev=44791&r1=44790&r2=44791&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp Mon Dec 10 08:43:10 2007 @@ -246,14 +246,14 @@ GenericValue lle_X_lrand48(FunctionType *FT, const vector &Args) { assert(Args.size() == 0); GenericValue GV; - GV.Int32Val = lrand48(); + GV.IntVal = APInt(32, lrand48()); return GV; } // void srand48(long) GenericValue lle_X_srand48(FunctionType *FT, const vector &Args) { assert(Args.size() == 1); - srand48(Args[0].Int32Val); + srand48(Args[0].IntVal.getZExtValue()); return GenericValue(); } From djg at cray.com Mon Dec 10 08:47:41 2007 From: djg at cray.com (Dan Gohman) Date: Mon, 10 Dec 2007 08:47:41 -0600 Subject: [llvm-commits] [llvm] r44687 - in /llvm/trunk: include/llvm/CodeGen/Passes.h lib/CodeGen/LLVMTargetMachine.cpp lib/CodeGen/MachineLICM.cpp lib/Target/PowerPC/PPCInstrInfo.td Message-ID: <20071210144741.GX26680@gold.us.cray.com> > Thanks for pointing this out. I'll go over it when I'm doing the load/ > store instructions in my pass. Hi Bill, How involved will MachineLICM be? After LLVM's main LICM pass runs, it seems all that's left for MachineLICM to do are just the constant-pool loads, immediates, etc. that aren't exposed in the main LLVM IR, things that don't require alias analysis. And if that's all it's doing, MachineLICM's traversal could be simplified a little. Instead of visiting each loop individually, taking care to avoid revisiting to blocks within inner loops, the pass could just traverse entire outer-most loops, which will implicitly include the blocks of any inner loops. Instructions nested deep in inner loops can then be hoisted all the way out of the outer-most loop in a single step instead of being hoisted out one loop at a time. Dan -- Dan Gohman, Cray Inc. From asl at math.spbu.ru Mon Dec 10 08:54:44 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Mon, 10 Dec 2007 14:54:44 -0000 Subject: [llvm-commits] [llvm] r44792 - /llvm/trunk/lib/Target/X86/X86JITInfo.cpp Message-ID: <200712101454.lBAEsjug017174@zion.cs.uiuc.edu> Author: asl Date: Mon Dec 10 08:54:42 2007 New Revision: 44792 URL: http://llvm.org/viewvc/llvm-project?rev=44792&view=rev Log: Annotate JIT callback function with call frame infromation. This will allow us (theoretically) to unwind through JITer. The code wasn't verified, so I'm pretty sure offsets are wrong :) Modified: llvm/trunk/lib/Target/X86/X86JITInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86JITInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86JITInfo.cpp?rev=44792&r1=44791&r2=44792&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86JITInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86JITInfo.cpp Mon Dec 10 08:54:42 2007 @@ -116,11 +116,18 @@ ".align 8\n" ".globl " ASMPREFIX "X86CompilationCallback\n" ASMPREFIX "X86CompilationCallback:\n" + ".cfi_startproc\n" "pushl %ebp\n" + ".cfi_def_cfa_offset 8\n" + ".cfi_offset ebp, -8\n" "movl %esp, %ebp\n" // Standard prologue + ".cfi_def_cfa_register ebp\n" "pushl %eax\n" + ".cfi_rel_offset eax, 0\n" "pushl %edx\n" // Save EAX/EDX/ECX + ".cfi_rel_offset edx, 4\n" "pushl %ecx\n" + ".cfi_rel_offset ecx, 8\n" #if defined(__APPLE__) "andl $-16, %esp\n" // Align ESP on 16-byte boundary #endif @@ -130,12 +137,23 @@ "movl %ebp, (%esp)\n" "call " ASMPREFIX "X86CompilationCallback2\n" "movl %ebp, %esp\n" // Restore ESP + ".cfi_def_cfa_register esp\n" "subl $12, %esp\n" + ".cfi_adjust_cfa_offset 12\n" "popl %ecx\n" + ".cfi_adjust_cfa_offset -4\n" + ".cfi_restore ecx\n" "popl %edx\n" + ".cfi_adjust_cfa_offset -4\n" + ".cfi_restore edx\n" "popl %eax\n" + ".cfi_adjust_cfa_offset -4\n" + ".cfi_restore eax\n" "popl %ebp\n" - "ret\n"); + ".cfi_adjust_cfa_offset -4\n" + ".cfi_restore ebp\n" + "ret\n" + ".cfi_endproc\n"); // Same as X86CompilationCallback but also saves XMM argument registers. void X86CompilationCallback_SSE(void); From asl at math.spbu.ru Mon Dec 10 09:13:57 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Mon, 10 Dec 2007 15:13:57 -0000 Subject: [llvm-commits] [llvm] r44793 - /llvm/trunk/lib/Target/X86/X86JITInfo.cpp Message-ID: <200712101513.lBAFDvAS018462@zion.cs.uiuc.edu> Author: asl Date: Mon Dec 10 09:13:55 2007 New Revision: 44793 URL: http://llvm.org/viewvc/llvm-project?rev=44793&view=rev Log: Provide annotation for SSE version of callback. It's even more broken, because doesn't mark xmm regs properly Modified: llvm/trunk/lib/Target/X86/X86JITInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86JITInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86JITInfo.cpp?rev=44793&r1=44792&r2=44793&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86JITInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86JITInfo.cpp Mon Dec 10 09:13:55 2007 @@ -162,14 +162,24 @@ ".align 8\n" ".globl " ASMPREFIX "X86CompilationCallback_SSE\n" ASMPREFIX "X86CompilationCallback_SSE:\n" + ".cfi_startproc\n" "pushl %ebp\n" + ".cfi_def_cfa_offset 8\n" + ".cfi_offset ebp, -8\n" "movl %esp, %ebp\n" // Standard prologue + ".cfi_def_cfa_register ebp\n" "pushl %eax\n" + ".cfi_rel_offset eax, 0\n" "pushl %edx\n" // Save EAX/EDX/ECX + ".cfi_rel_offset edx, 4\n" "pushl %ecx\n" + ".cfi_rel_offset ecx, 8\n" "andl $-16, %esp\n" // Align ESP on 16-byte boundary // Save all XMM arg registers "subl $64, %esp\n" + // FIXME: provide frame move information for xmm registers. + // This can be tricky, because CFA register is ebp (unaligned) + // and we need to produce offsets relative to it. "movaps %xmm0, (%esp)\n" "movaps %xmm1, 16(%esp)\n" "movaps %xmm2, 32(%esp)\n" @@ -181,16 +191,31 @@ "call " ASMPREFIX "X86CompilationCallback2\n" "addl $16, %esp\n" "movaps 48(%esp), %xmm3\n" + ".cfi_restore xmm3\n" "movaps 32(%esp), %xmm2\n" + ".cfi_restore xmm2\n" "movaps 16(%esp), %xmm1\n" + ".cfi_restore xmm1\n" "movaps (%esp), %xmm0\n" + ".cfi_restore xmm0\n" "movl %ebp, %esp\n" // Restore ESP + ".cfi_def_cfa_register esp\n" "subl $12, %esp\n" + ".cfi_adjust_cfa_offset 12\n" "popl %ecx\n" + ".cfi_adjust_cfa_offset -4\n" + ".cfi_restore ecx\n" "popl %edx\n" + ".cfi_adjust_cfa_offset -4\n" + ".cfi_restore edx\n" "popl %eax\n" + ".cfi_adjust_cfa_offset -4\n" + ".cfi_restore eax\n" "popl %ebp\n" - "ret\n"); + ".cfi_adjust_cfa_offset -4\n" + ".cfi_restore ebp\n" + "ret\n" + ".cfi_endproc\n"); #else void X86CompilationCallback2(void); From asl at math.spbu.ru Mon Dec 10 09:27:09 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Mon, 10 Dec 2007 15:27:09 -0000 Subject: [llvm-commits] [llvm] r44794 - /llvm/trunk/lib/Target/X86/X86JITInfo.cpp Message-ID: <200712101527.lBAFR9pD019396@zion.cs.uiuc.edu> Author: asl Date: Mon Dec 10 09:27:07 2007 New Revision: 44794 URL: http://llvm.org/viewvc/llvm-project?rev=44794&view=rev Log: And finally annotate X86-64 version of callback. All bad stuff from SSE version is implicitely inherited :) Modified: llvm/trunk/lib/Target/X86/X86JITInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86JITInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86JITInfo.cpp?rev=44794&r1=44793&r2=44794&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86JITInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86JITInfo.cpp Mon Dec 10 09:27:07 2007 @@ -58,17 +58,27 @@ ".align 8\n" ".globl " ASMPREFIX "X86CompilationCallback\n" ASMPREFIX "X86CompilationCallback:\n" + ".cfi_startproc\n" // Save RBP "pushq %rbp\n" + ".cfi_def_cfa_offset 16\n" + ".cfi_offset %rbp, -16\n" // Save RSP "movq %rsp, %rbp\n" + ".cfi_def_cfa_register %rbp\n" // Save all int arg registers "pushq %rdi\n" + ".cfi_rel_offset %rdi, 0\n" "pushq %rsi\n" + ".cfi_rel_offset %rsi, 8\n" "pushq %rdx\n" + ".cfi_rel_offset %rdx, 16\n" "pushq %rcx\n" + ".cfi_rel_offset %rcx, 24\n" "pushq %r8\n" + ".cfi_rel_offset %r8, 32\n" "pushq %r9\n" + ".cfi_rel_offset %r9, 40\n" // Align stack on 16-byte boundary. ESP might not be properly aligned // (8 byte) if this is called from an indirect stub. "andq $-16, %rsp\n" @@ -97,17 +107,34 @@ "movaps (%rsp), %xmm0\n" // Restore RSP "movq %rbp, %rsp\n" + ".cfi_def_cfa_register esp\n" // Restore all int arg registers "subq $48, %rsp\n" + ".cfi_adjust_cfa_offset 48\n" "popq %r9\n" + ".cfi_adjust_cfa_offset -8\n" + ".cfi_restore %r9\n" "popq %r8\n" + ".cfi_adjust_cfa_offset -8\n" + ".cfi_restore %r8\n" "popq %rcx\n" + ".cfi_adjust_cfa_offset -8\n" + ".cfi_restore %rcx\n" "popq %rdx\n" + ".cfi_adjust_cfa_offset -8\n" + ".cfi_restore %rdx\n" "popq %rsi\n" + ".cfi_adjust_cfa_offset -8\n" + ".cfi_restore %rsi\n" "popq %rdi\n" + ".cfi_adjust_cfa_offset -8\n" + ".cfi_restore %rdi\n" // Restore RBP "popq %rbp\n" - "ret\n"); + ".cfi_adjust_cfa_offset -8\n" + ".cfi_restore %rbp\n" + "ret\n" + ".cfi_endproc\n"); #elif defined(__i386__) || defined(i386) || defined(_M_IX86) #ifndef _MSC_VER void X86CompilationCallback(void); @@ -119,15 +146,15 @@ ".cfi_startproc\n" "pushl %ebp\n" ".cfi_def_cfa_offset 8\n" - ".cfi_offset ebp, -8\n" + ".cfi_offset %ebp, -8\n" "movl %esp, %ebp\n" // Standard prologue - ".cfi_def_cfa_register ebp\n" + ".cfi_def_cfa_register %ebp\n" "pushl %eax\n" - ".cfi_rel_offset eax, 0\n" + ".cfi_rel_offset %eax, 0\n" "pushl %edx\n" // Save EAX/EDX/ECX - ".cfi_rel_offset edx, 4\n" + ".cfi_rel_offset %edx, 4\n" "pushl %ecx\n" - ".cfi_rel_offset ecx, 8\n" + ".cfi_rel_offset %ecx, 8\n" #if defined(__APPLE__) "andl $-16, %esp\n" // Align ESP on 16-byte boundary #endif @@ -137,21 +164,21 @@ "movl %ebp, (%esp)\n" "call " ASMPREFIX "X86CompilationCallback2\n" "movl %ebp, %esp\n" // Restore ESP - ".cfi_def_cfa_register esp\n" + ".cfi_def_cfa_register %esp\n" "subl $12, %esp\n" ".cfi_adjust_cfa_offset 12\n" "popl %ecx\n" ".cfi_adjust_cfa_offset -4\n" - ".cfi_restore ecx\n" + ".cfi_restore %ecx\n" "popl %edx\n" ".cfi_adjust_cfa_offset -4\n" - ".cfi_restore edx\n" + ".cfi_restore %edx\n" "popl %eax\n" ".cfi_adjust_cfa_offset -4\n" - ".cfi_restore eax\n" + ".cfi_restore %eax\n" "popl %ebp\n" ".cfi_adjust_cfa_offset -4\n" - ".cfi_restore ebp\n" + ".cfi_restore %ebp\n" "ret\n" ".cfi_endproc\n"); @@ -165,15 +192,15 @@ ".cfi_startproc\n" "pushl %ebp\n" ".cfi_def_cfa_offset 8\n" - ".cfi_offset ebp, -8\n" + ".cfi_offset %ebp, -8\n" "movl %esp, %ebp\n" // Standard prologue - ".cfi_def_cfa_register ebp\n" + ".cfi_def_cfa_register %ebp\n" "pushl %eax\n" - ".cfi_rel_offset eax, 0\n" + ".cfi_rel_offset %eax, 0\n" "pushl %edx\n" // Save EAX/EDX/ECX - ".cfi_rel_offset edx, 4\n" + ".cfi_rel_offset %edx, 4\n" "pushl %ecx\n" - ".cfi_rel_offset ecx, 8\n" + ".cfi_rel_offset %ecx, 8\n" "andl $-16, %esp\n" // Align ESP on 16-byte boundary // Save all XMM arg registers "subl $64, %esp\n" @@ -191,29 +218,29 @@ "call " ASMPREFIX "X86CompilationCallback2\n" "addl $16, %esp\n" "movaps 48(%esp), %xmm3\n" - ".cfi_restore xmm3\n" + ".cfi_restore %xmm3\n" "movaps 32(%esp), %xmm2\n" - ".cfi_restore xmm2\n" + ".cfi_restore %xmm2\n" "movaps 16(%esp), %xmm1\n" - ".cfi_restore xmm1\n" + ".cfi_restore %xmm1\n" "movaps (%esp), %xmm0\n" - ".cfi_restore xmm0\n" + ".cfi_restore %xmm0\n" "movl %ebp, %esp\n" // Restore ESP ".cfi_def_cfa_register esp\n" "subl $12, %esp\n" ".cfi_adjust_cfa_offset 12\n" "popl %ecx\n" ".cfi_adjust_cfa_offset -4\n" - ".cfi_restore ecx\n" + ".cfi_restore %ecx\n" "popl %edx\n" ".cfi_adjust_cfa_offset -4\n" - ".cfi_restore edx\n" + ".cfi_restore %edx\n" "popl %eax\n" ".cfi_adjust_cfa_offset -4\n" - ".cfi_restore eax\n" + ".cfi_restore %eax\n" "popl %ebp\n" ".cfi_adjust_cfa_offset -4\n" - ".cfi_restore ebp\n" + ".cfi_restore %ebp\n" "ret\n" ".cfi_endproc\n"); #else From baldrick at free.fr Mon Dec 10 11:43:13 2007 From: baldrick at free.fr (Duncan Sands) Date: Mon, 10 Dec 2007 17:43:13 -0000 Subject: [llvm-commits] [llvm] r44796 - in /llvm/trunk: autoconf/configure.ac configure include/llvm/Config/config.h.in include/llvm/Target/TargetData.h lib/ExecutionEngine/ExecutionEngine.cpp test/ExecutionEngine/2007-12-10-APIntLoadStore.ll Message-ID: <200712101743.lBAHhEvb027331@zion.cs.uiuc.edu> Author: baldrick Date: Mon Dec 10 11:43:13 2007 New Revision: 44796 URL: http://llvm.org/viewvc/llvm-project?rev=44796&view=rev Log: Fix PR1836: in the interpreter, read and write apints using the minimum possible number of bytes. For little endian targets run on little endian machines, apints are stored in memory from LSB to MSB as before. For big endian targets on big endian machines they are stored from MSB to LSB which wasn't always the case before (if the target and host endianness doesn't match values are stored according to the host's endianness). Doing this requires knowing the endianness of the host, which is determined when configuring - thanks go to Anton for this. Only having access to little endian machines I was unable to properly test the big endian part, which is also the most complicated... Added: llvm/trunk/test/ExecutionEngine/2007-12-10-APIntLoadStore.ll Modified: llvm/trunk/autoconf/configure.ac llvm/trunk/configure llvm/trunk/include/llvm/Config/config.h.in llvm/trunk/include/llvm/Target/TargetData.h llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Modified: llvm/trunk/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=44796&r1=44795&r2=44796&view=diff ============================================================================== --- llvm/trunk/autoconf/configure.ac (original) +++ llvm/trunk/autoconf/configure.ac Mon Dec 10 11:43:13 2007 @@ -227,7 +227,10 @@ AC_SUBST(ARCH,$llvm_cv_target_arch) dnl Check for the endianness of the target -AC_C_BIGENDIAN(AC_SUBST([ENDIAN],[big]),AC_SUBST([ENDIAN],[little])) +AC_C_BIGENDIAN([AC_SUBST([ENDIAN],[big]), + AC_DEFINE([MSB_FIRST], [1], [Define if this target is big endian])], + [AC_SUBST([ENDIAN],[little]), + AC_DEFINE([LSB_FIRST], [1], [Define if this target is little endian])]) dnl Check for build platform executable suffix if we're crosscompiling if test "$cross_compiling" = yes; then Modified: llvm/trunk/configure URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=44796&r1=44795&r2=44796&view=diff ============================================================================== --- llvm/trunk/configure (original) +++ llvm/trunk/configure Mon Dec 10 11:43:13 2007 @@ -828,7 +828,6 @@ LLVM_ON_UNIX LLVM_ON_WIN32 ARCH -ENDIAN CC CFLAGS LDFLAGS @@ -839,6 +838,7 @@ CPP GREP EGREP +ENDIAN LLVM_CROSS_COMPILING BUILD_CC BUILD_EXEEXT @@ -4183,9 +4183,19 @@ case $ac_cv_c_bigendian in yes) ENDIAN=big +, + +cat >>confdefs.h <<\_ACEOF +#define MSB_FIRST 1 +_ACEOF ;; no) ENDIAN=little +, + +cat >>confdefs.h <<\_ACEOF +#define LSB_FIRST 1 +_ACEOF ;; *) { { echo "$as_me:$LINENO: error: unknown endianness @@ -8220,7 +8230,9 @@ fi - if test x"${enable_ltdl_install-no}" != xno; then + + +if test x"${enable_ltdl_install-no}" != xno; then INSTALL_LTDL_TRUE= INSTALL_LTDL_FALSE='#' else @@ -8228,7 +8240,9 @@ INSTALL_LTDL_FALSE= fi - if test x"${enable_ltdl_convenience-no}" != xno; then + + +if test x"${enable_ltdl_convenience-no}" != xno; then CONVENIENCE_LTDL_TRUE= CONVENIENCE_LTDL_FALSE='#' else @@ -9867,7 +9881,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext + echo '#line 11819 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -13442,11 +13456,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13445: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13459: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13449: \$? = $ac_status" >&5 + echo "$as_me:13463: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -13710,11 +13724,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13713: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13727: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13717: \$? = $ac_status" >&5 + echo "$as_me:13731: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -13814,11 +13828,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13817: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13831: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13821: \$? = $ac_status" >&5 + echo "$as_me:13835: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -16122,7 +16136,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:18575: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:18565: \$? = $ac_status" >&5 + echo "$as_me:18579: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -18662,11 +18676,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:18665: $lt_compile\"" >&5) + (eval echo "\"\$as_me:18679: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:18669: \$? = $ac_status" >&5 + echo "$as_me:18683: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -20232,11 +20246,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:20235: $lt_compile\"" >&5) + (eval echo "\"\$as_me:20249: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:20239: \$? = $ac_status" >&5 + echo "$as_me:20253: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -20336,11 +20350,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:20339: $lt_compile\"" >&5) + (eval echo "\"\$as_me:20353: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:20343: \$? = $ac_status" >&5 + echo "$as_me:20357: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -22539,11 +22553,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:22542: $lt_compile\"" >&5) + (eval echo "\"\$as_me:22556: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:22546: \$? = $ac_status" >&5 + echo "$as_me:22560: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -22807,11 +22821,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:22810: $lt_compile\"" >&5) + (eval echo "\"\$as_me:22824: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:22814: \$? = $ac_status" >&5 + echo "$as_me:22828: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -22911,11 +22925,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:22914: $lt_compile\"" >&5) + (eval echo "\"\$as_me:22928: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:22918: \$? = $ac_status" >&5 + echo "$as_me:22932: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -32755,7 +32769,6 @@ LLVM_ON_UNIX!$LLVM_ON_UNIX$ac_delim LLVM_ON_WIN32!$LLVM_ON_WIN32$ac_delim ARCH!$ARCH$ac_delim -ENDIAN!$ENDIAN$ac_delim CC!$CC$ac_delim CFLAGS!$CFLAGS$ac_delim LDFLAGS!$LDFLAGS$ac_delim @@ -32766,6 +32779,7 @@ CPP!$CPP$ac_delim GREP!$GREP$ac_delim EGREP!$EGREP$ac_delim +ENDIAN!$ENDIAN$ac_delim LLVM_CROSS_COMPILING!$LLVM_CROSS_COMPILING$ac_delim BUILD_CC!$BUILD_CC$ac_delim BUILD_EXEEXT!$BUILD_EXEEXT$ac_delim Modified: llvm/trunk/include/llvm/Config/config.h.in URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/config.h.in?rev=44796&r1=44795&r2=44796&view=diff ============================================================================== --- llvm/trunk/include/llvm/Config/config.h.in (original) +++ llvm/trunk/include/llvm/Config/config.h.in Mon Dec 10 11:43:13 2007 @@ -494,6 +494,9 @@ /* Installation prefix directory */ #undef LLVM_PREFIX +/* Define if this target is little endian */ +#undef LSB_FIRST + /* Define if the OS needs help to load dependent libraries for dlopen(). */ #undef LTDL_DLOPEN_DEPLIBS @@ -511,6 +514,9 @@ /* Define to the system default library search path. */ #undef LTDL_SYSSEARCHPATH +/* Define if this target is big endian */ +#undef MSB_FIRST + /* Define if /dev/zero should be used when mapping RWX memory, or undefine if its not necessary */ #undef NEED_DEV_ZERO_FOR_MMAP Modified: llvm/trunk/include/llvm/Target/TargetData.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetData.h?rev=44796&r1=44795&r2=44796&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetData.h (original) +++ llvm/trunk/include/llvm/Target/TargetData.h Mon Dec 10 11:43:13 2007 @@ -23,6 +23,7 @@ #include "llvm/Pass.h" #include "llvm/Support/DataTypes.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/Config/config.h" #include namespace llvm { @@ -142,6 +143,16 @@ bool isLittleEndian() const { return LittleEndian; } bool isBigEndian() const { return !LittleEndian; } + /// Host endianness... + bool hostIsLittleEndian() const { +#ifdef LSB_FIRST + return true; +#else + return false; +#endif + } + bool hostIsBigEndian() const { return !hostIsLittleEndian(); } + /// getStringRepresentation - Return the string representation of the /// TargetData. This representation is in the same format accepted by the /// string constructor above. Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=44796&r1=44795&r2=44796&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Mon Dec 10 11:43:13 2007 @@ -633,20 +633,27 @@ switch (Ty->getTypeID()) { case Type::IntegerTyID: { unsigned BitWidth = cast(Ty)->getBitWidth(); - GenericValue TmpVal = Val; - if (BitWidth <= 8) - *((uint8_t*)Ptr) = uint8_t(Val.IntVal.getZExtValue()); - else if (BitWidth <= 16) { - *((uint16_t*)Ptr) = uint16_t(Val.IntVal.getZExtValue()); - } else if (BitWidth <= 32) { - *((uint32_t*)Ptr) = uint32_t(Val.IntVal.getZExtValue()); - } else if (BitWidth <= 64) { - *((uint64_t*)Ptr) = uint64_t(Val.IntVal.getZExtValue()); - } else { - uint64_t *Dest = (uint64_t*)Ptr; - const uint64_t *Src = Val.IntVal.getRawData(); - for (uint32_t i = 0; i < Val.IntVal.getNumWords(); ++i) - Dest[i] = Src[i]; + unsigned StoreBytes = (BitWidth + 7)/8; + uint8_t *Src = (uint8_t *)Val.IntVal.getRawData(); + uint8_t *Dst = (uint8_t *)Ptr; + + if (getTargetData()->hostIsLittleEndian()) + // Little-endian host - the source is ordered from LSB to MSB. + // Order the destination from LSB to MSB: Do a straight copy. + memcpy(Dst, Src, StoreBytes); + else { + // Big-endian host - the source is an array of 64 bit words ordered from + // LSW to MSW. Each word is ordered from MSB to LSB. + // Order the destination from MSB to LSB: Reverse the word order, but not + // the bytes in a word. + while (StoreBytes > sizeof(uint64_t)) { + StoreBytes -= sizeof(uint64_t); + // May not be aligned so use memcpy. + memcpy(Dst + StoreBytes, Src, sizeof(uint64_t)); + Src += sizeof(uint64_t); + } + + memcpy(Dst, Src + sizeof(uint64_t) - StoreBytes, StoreBytes); } break; } @@ -683,16 +690,32 @@ switch (Ty->getTypeID()) { case Type::IntegerTyID: { unsigned BitWidth = cast(Ty)->getBitWidth(); - if (BitWidth <= 8) - Result.IntVal = APInt(BitWidth, *((uint8_t*)Ptr)); - else if (BitWidth <= 16) { - Result.IntVal = APInt(BitWidth, *((uint16_t*)Ptr)); - } else if (BitWidth <= 32) { - Result.IntVal = APInt(BitWidth, *((uint32_t*)Ptr)); - } else if (BitWidth <= 64) { - Result.IntVal = APInt(BitWidth, *((uint64_t*)Ptr)); - } else - Result.IntVal = APInt(BitWidth, (BitWidth+63)/64, (uint64_t*)Ptr); + unsigned LoadBytes = (BitWidth + 7)/8; + + // An APInt with all words initially zero. + Result.IntVal = APInt(BitWidth, 0); + + uint8_t *Src = (uint8_t *)Ptr; + uint8_t *Dst = (uint8_t *)Result.IntVal.getRawData(); + + if (getTargetData()->hostIsLittleEndian()) + // Little-endian host - the destination must be ordered from LSB to MSB. + // The source is ordered from LSB to MSB: Do a straight copy. + memcpy(Dst, Src, LoadBytes); + else { + // Big-endian - the destination is an array of 64 bit words ordered from + // LSW to MSW. Each word must be ordered from MSB to LSB. The source is + // ordered from MSB to LSB: Reverse the word order, but not the bytes in + // a word. + while (LoadBytes > sizeof(uint64_t)) { + LoadBytes -= sizeof(uint64_t); + // May not be aligned so use memcpy. + memcpy(Dst, Src + LoadBytes, sizeof(uint64_t)); + Dst += sizeof(uint64_t); + } + + memcpy(Dst + sizeof(uint64_t) - LoadBytes, Src, LoadBytes); + } break; } case Type::FloatTyID: Added: llvm/trunk/test/ExecutionEngine/2007-12-10-APIntLoadStore.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/2007-12-10-APIntLoadStore.ll?rev=44796&view=auto ============================================================================== --- llvm/trunk/test/ExecutionEngine/2007-12-10-APIntLoadStore.ll (added) +++ llvm/trunk/test/ExecutionEngine/2007-12-10-APIntLoadStore.ll Mon Dec 10 11:43:13 2007 @@ -0,0 +1,19 @@ +; RUN: llvm-as < %s -o - | lli -force-interpreter +; PR1836 + +define i32 @main() { +entry: + %retval = alloca i32 ; [#uses=2] + %tmp = alloca i32 ; [#uses=2] + %x = alloca i75, align 16 ; [#uses=1] + %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] + store i75 999, i75* %x, align 16 + store i32 0, i32* %tmp, align 4 + %tmp1 = load i32* %tmp, align 4 ; [#uses=1] + store i32 %tmp1, i32* %retval, align 4 + br label %return + +return: ; preds = %entry + %retval2 = load i32* %retval ; [#uses=1] + ret i32 %retval2 +} From baldrick at free.fr Mon Dec 10 13:09:41 2007 From: baldrick at free.fr (Duncan Sands) Date: Mon, 10 Dec 2007 19:09:41 -0000 Subject: [llvm-commits] [llvm] r44802 - in /llvm/trunk: include/llvm/Function.h include/llvm/Instructions.h lib/Transforms/IPO/PruneEH.cpp lib/Transforms/Scalar/SimplifyCFG.cpp test/Transforms/PruneEH/simplenoreturntest.ll test/Transforms/PruneEH/simpletest.ll test/Transforms/PruneEH/simpletest.llx Message-ID: <200712101909.lBAJ9f8Z031718@zion.cs.uiuc.edu> Author: baldrick Date: Mon Dec 10 13:09:40 2007 New Revision: 44802 URL: http://llvm.org/viewvc/llvm-project?rev=44802&view=rev Log: Make PruneEH update the nounwind/noreturn attributes on functions as it calculates them. Added: llvm/trunk/test/Transforms/PruneEH/simpletest.ll Removed: llvm/trunk/test/Transforms/PruneEH/simpletest.llx Modified: llvm/trunk/include/llvm/Function.h llvm/trunk/include/llvm/Instructions.h llvm/trunk/lib/Transforms/IPO/PruneEH.cpp llvm/trunk/lib/Transforms/Scalar/SimplifyCFG.cpp llvm/trunk/test/Transforms/PruneEH/simplenoreturntest.ll Modified: llvm/trunk/include/llvm/Function.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Function.h?rev=44802&r1=44801&r2=44802&view=diff ============================================================================== --- llvm/trunk/include/llvm/Function.h (original) +++ llvm/trunk/include/llvm/Function.h Mon Dec 10 13:09:40 2007 @@ -165,6 +165,16 @@ return ParamAttrs && ParamAttrs->paramHasAttr(i, attr); } + /// @brief Determine if the function cannot return. + bool isNoReturn() const { + return paramHasAttr(0, ParamAttr::NoReturn); + } + + /// @brief Determine if the function cannot unwind. + bool isNoUnwind() const { + return paramHasAttr(0, ParamAttr::NoUnwind); + } + /// @brief Determine if the function does not access memory. bool doesNotAccessMemory() const { return paramHasAttr(0, ParamAttr::ReadNone); Modified: llvm/trunk/include/llvm/Instructions.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=44802&r1=44801&r2=44802&view=diff ============================================================================== --- llvm/trunk/include/llvm/Instructions.h (original) +++ llvm/trunk/include/llvm/Instructions.h Mon Dec 10 13:09:40 2007 @@ -937,6 +937,11 @@ return doesNotAccessMemory() || paramHasAttr(0, ParamAttr::ReadOnly); } + /// @brief Determine if the call cannot return. + bool isNoReturn() const { + return paramHasAttr(0, ParamAttr::NoReturn); + } + /// @brief Determine if the call cannot unwind. bool isNoUnwind() const { return paramHasAttr(0, ParamAttr::NoUnwind); @@ -1736,6 +1741,11 @@ return doesNotAccessMemory() || paramHasAttr(0, ParamAttr::ReadOnly); } + /// @brief Determine if the call cannot return. + bool isNoReturn() const { + return paramHasAttr(0, ParamAttr::NoReturn); + } + /// @brief Determine if the call cannot unwind. bool isNoUnwind() const { return paramHasAttr(0, ParamAttr::NoUnwind); Modified: llvm/trunk/lib/Transforms/IPO/PruneEH.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/PruneEH.cpp?rev=44802&r1=44801&r2=44802&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/PruneEH.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/PruneEH.cpp Mon Dec 10 13:09:40 2007 @@ -9,8 +9,8 @@ // // This file implements a simple interprocedural pass which walks the // call-graph, turning invoke instructions into calls, iff the callee cannot -// throw an exception. It implements this as a bottom-up traversal of the -// call-graph. +// throw an exception, and marking functions 'nounwind' if they cannot throw. +// It implements this as a bottom-up traversal of the call-graph. // //===----------------------------------------------------------------------===// @@ -19,7 +19,6 @@ #include "llvm/CallGraphSCCPass.h" #include "llvm/Constants.h" #include "llvm/Function.h" -#include "llvm/Intrinsics.h" #include "llvm/Instructions.h" #include "llvm/Analysis/CallGraph.h" #include "llvm/ADT/SmallVector.h" @@ -38,14 +37,6 @@ static char ID; // Pass identification, replacement for typeid PruneEH() : CallGraphSCCPass((intptr_t)&ID) {} - /// DoesNotUnwind - This set contains all of the functions which we have - /// determined cannot unwind. - std::set DoesNotUnwind; - - /// DoesNotReturn - This set contains all of the functions which we have - /// determined cannot return normally (but might unwind). - std::set DoesNotReturn; - // runOnSCC - Analyze the SCC, performing the transformation if possible. bool runOnSCC(const std::vector &SCC); @@ -79,33 +70,41 @@ for (unsigned i = 0, e = SCC.size(); (!SCCMightUnwind || !SCCMightReturn) && i != e; ++i) { Function *F = SCC[i]->getFunction(); - if (F == 0 || (F->isDeclaration() && !F->getIntrinsicID())) { + if (F == 0) { SCCMightUnwind = true; SCCMightReturn = true; + } else if (F->isDeclaration()) { + SCCMightUnwind |= !F->isNoUnwind(); + SCCMightReturn |= !F->isNoReturn(); } else { - if (F->isDeclaration()) - SCCMightReturn = true; + bool CheckUnwind = !SCCMightUnwind && !F->isNoUnwind(); + bool CheckReturn = !SCCMightReturn && !F->isNoReturn(); + + if (!CheckUnwind && !CheckReturn) + continue; // Check to see if this function performs an unwind or calls an // unwinding function. for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) { - if (isa(BB->getTerminator())) { // Uses unwind! + if (CheckUnwind && isa(BB->getTerminator())) { + // Uses unwind! SCCMightUnwind = true; - } else if (isa(BB->getTerminator())) { + } else if (CheckReturn && isa(BB->getTerminator())) { SCCMightReturn = true; } // Invoke instructions don't allow unwinding to continue, so we are // only interested in call instructions. - if (!SCCMightUnwind) + if (CheckUnwind && !SCCMightUnwind) for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) if (CallInst *CI = dyn_cast(I)) { - if (Function *Callee = CI->getCalledFunction()) { + if (CI->isNoUnwind()) { + // This call cannot throw. + } else if (Function *Callee = CI->getCalledFunction()) { CallGraphNode *CalleeNode = CG[Callee]; - // If the callee is outside our current SCC, or if it is not - // known to throw, then we might throw also. - if (std::find(SCC.begin(), SCC.end(), CalleeNode) == SCC.end()&& - !DoesNotUnwind.count(CalleeNode)) { + // If the callee is outside our current SCC then we may + // throw because it might. + if (std::find(SCC.begin(), SCC.end(), CalleeNode) == SCC.end()){ SCCMightUnwind = true; break; } @@ -121,12 +120,21 @@ } // If the SCC doesn't unwind or doesn't throw, note this fact. - if (!SCCMightUnwind) - for (unsigned i = 0, e = SCC.size(); i != e; ++i) - DoesNotUnwind.insert(SCC[i]); - if (!SCCMightReturn) - for (unsigned i = 0, e = SCC.size(); i != e; ++i) - DoesNotReturn.insert(SCC[i]); + if (!SCCMightUnwind || !SCCMightReturn) + for (unsigned i = 0, e = SCC.size(); i != e; ++i) { + const ParamAttrsList *PAL = SCC[i]->getFunction()->getParamAttrs(); + uint16_t RAttributes = PAL ? PAL->getParamAttrs(0) : 0; + + if (!SCCMightUnwind) + RAttributes |= ParamAttr::NoUnwind; + if (!SCCMightReturn) + RAttributes |= ParamAttr::NoReturn; + + ParamAttrsVector modVec; + modVec.push_back(ParamAttrsWithIndex::get(0, RAttributes)); + PAL = ParamAttrsList::getModified(PAL, modVec); + SCC[i]->getFunction()->setParamAttrs(PAL); + } for (unsigned i = 0, e = SCC.size(); i != e; ++i) { // Convert any invoke instructions to non-throwing functions in this node @@ -144,61 +152,58 @@ // function if we have invokes to non-unwinding functions or code after calls to // no-return functions. bool PruneEH::SimplifyFunction(Function *F) { - CallGraph &CG = getAnalysis(); bool MadeChange = false; for (Function::iterator BB = F->begin(), E = F->end(); BB != E; ++BB) { if (InvokeInst *II = dyn_cast(BB->getTerminator())) - if (Function *F = II->getCalledFunction()) - if (DoesNotUnwind.count(CG[F])) { - SmallVector Args(II->op_begin()+3, II->op_end()); - // Insert a call instruction before the invoke. - CallInst *Call = new CallInst(II->getCalledValue(), - Args.begin(), Args.end(), "", II); - Call->takeName(II); - Call->setCallingConv(II->getCallingConv()); - Call->setParamAttrs(II->getParamAttrs()); - - // Anything that used the value produced by the invoke instruction - // now uses the value produced by the call instruction. - II->replaceAllUsesWith(Call); - BasicBlock *UnwindBlock = II->getUnwindDest(); - UnwindBlock->removePredecessor(II->getParent()); - - // Insert a branch to the normal destination right before the - // invoke. - new BranchInst(II->getNormalDest(), II); + if (II->isNoUnwind()) { + SmallVector Args(II->op_begin()+3, II->op_end()); + // Insert a call instruction before the invoke. + CallInst *Call = new CallInst(II->getCalledValue(), + Args.begin(), Args.end(), "", II); + Call->takeName(II); + Call->setCallingConv(II->getCallingConv()); + Call->setParamAttrs(II->getParamAttrs()); + + // Anything that used the value produced by the invoke instruction + // now uses the value produced by the call instruction. + II->replaceAllUsesWith(Call); + BasicBlock *UnwindBlock = II->getUnwindDest(); + UnwindBlock->removePredecessor(II->getParent()); + + // Insert a branch to the normal destination right before the + // invoke. + new BranchInst(II->getNormalDest(), II); + + // Finally, delete the invoke instruction! + BB->getInstList().pop_back(); + + // If the unwind block is now dead, nuke it. + if (pred_begin(UnwindBlock) == pred_end(UnwindBlock)) + DeleteBasicBlock(UnwindBlock); // Delete the new BB. - // Finally, delete the invoke instruction! - BB->getInstList().pop_back(); + ++NumRemoved; + MadeChange = true; + } - // If the unwind block is now dead, nuke it. - if (pred_begin(UnwindBlock) == pred_end(UnwindBlock)) - DeleteBasicBlock(UnwindBlock); // Delete the new BB. + for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ) + if (CallInst *CI = dyn_cast(I++)) + if (CI->isNoReturn() && !isa(I)) { + // This call calls a function that cannot return. Insert an + // unreachable instruction after it and simplify the code. Do this + // by splitting the BB, adding the unreachable, then deleting the + // new BB. + BasicBlock *New = BB->splitBasicBlock(I); + + // Remove the uncond branch and add an unreachable. + BB->getInstList().pop_back(); + new UnreachableInst(BB); - ++NumRemoved; + DeleteBasicBlock(New); // Delete the new BB. MadeChange = true; + ++NumUnreach; + break; } - for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ) - if (CallInst *CI = dyn_cast(I++)) - if (Function *Callee = CI->getCalledFunction()) - if (DoesNotReturn.count(CG[Callee]) && !isa(I)) { - // This call calls a function that cannot return. Insert an - // unreachable instruction after it and simplify the code. Do this - // by splitting the BB, adding the unreachable, then deleting the - // new BB. - BasicBlock *New = BB->splitBasicBlock(I); - - // Remove the uncond branch and add an unreachable. - BB->getInstList().pop_back(); - new UnreachableInst(BB); - - DeleteBasicBlock(New); // Delete the new BB. - MadeChange = true; - ++NumUnreach; - break; - } - } return MadeChange; } Modified: llvm/trunk/lib/Transforms/Scalar/SimplifyCFG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SimplifyCFG.cpp?rev=44802&r1=44801&r2=44802&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/SimplifyCFG.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/SimplifyCFG.cpp Mon Dec 10 13:09:40 2007 @@ -111,7 +111,7 @@ // canonicalizes unreachable insts into stores to null or undef. for (BasicBlock::iterator BBI = BB->begin(), E = BB->end(); BBI != E;++BBI){ if (CallInst *CI = dyn_cast(BBI)) { - if (CI->paramHasAttr(0, ParamAttr::NoReturn)) { + if (CI->isNoReturn()) { // If we found a call to a no-return function, insert an unreachable // instruction after it. Make sure there isn't *already* one there // though. Modified: llvm/trunk/test/Transforms/PruneEH/simplenoreturntest.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/PruneEH/simplenoreturntest.ll?rev=44802&r1=44801&r2=44802&view=diff ============================================================================== --- llvm/trunk/test/Transforms/PruneEH/simplenoreturntest.ll (original) +++ llvm/trunk/test/Transforms/PruneEH/simplenoreturntest.ll Mon Dec 10 13:09:40 2007 @@ -1,17 +1,13 @@ -; RUN: llvm-upgrade < %s | llvm-as | opt -prune-eh | llvm-dis | \ -; RUN: not grep {ret i32} +; RUN: llvm-as < %s | opt -prune-eh | llvm-dis | not grep {ret i32} -void %noreturn() { - unwind -} +declare void @noreturn() noreturn; -int %caller() { - ; noreturn never returns, so the ret is unreachable. - call void %noreturn() - ret int 17 +define i32 @caller() { + call void @noreturn( ) + ret i32 17 } -int %caller2() { - %T = call int %caller() - ret int %T ;; this is also unreachable! +define i32 @caller2() { + %T = call i32 @caller( ) ; [#uses=1] + ret i32 %T } Added: llvm/trunk/test/Transforms/PruneEH/simpletest.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/PruneEH/simpletest.ll?rev=44802&view=auto ============================================================================== --- llvm/trunk/test/Transforms/PruneEH/simpletest.ll (added) +++ llvm/trunk/test/Transforms/PruneEH/simpletest.ll Mon Dec 10 13:09:40 2007 @@ -0,0 +1,19 @@ +; RUN: llvm-as < %s | opt -prune-eh | llvm-dis | not grep invoke + +declare void @nounwind() nounwind + +define internal void @foo() { + call void @nounwind() + ret void +} + +define i32 @caller() { + invoke void @foo( ) + to label %Normal unwind label %Except + +Normal: ; preds = %0 + ret i32 0 + +Except: ; preds = %0 + ret i32 1 +} Removed: llvm/trunk/test/Transforms/PruneEH/simpletest.llx URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/PruneEH/simpletest.llx?rev=44801&view=auto ============================================================================== --- llvm/trunk/test/Transforms/PruneEH/simpletest.llx (original) +++ llvm/trunk/test/Transforms/PruneEH/simpletest.llx (removed) @@ -1,15 +0,0 @@ -; RUN: llvm-upgrade < %s | llvm-as | opt -prune-eh | llvm-dis | not grep invoke - -implementation - -internal void %foo() { - ret void ; does not throw -} - -int %caller() { - invoke void %foo() to label %Normal except label %Except -Normal: - ret int 0 -Except: - ret int 1 -} From sabre at nondot.org Mon Dec 10 13:10:18 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 10 Dec 2007 19:10:18 -0000 Subject: [llvm-commits] [llvm] r44803 - /llvm/trunk/lib/Target/X86/X86JITInfo.cpp Message-ID: <200712101910.lBAJAIe7031771@zion.cs.uiuc.edu> Author: lattner Date: Mon Dec 10 13:10:18 2007 New Revision: 44803 URL: http://llvm.org/viewvc/llvm-project?rev=44803&view=rev Log: Disable cfi directives for now, darwin does't support them. These should probably be something like: CFI(".cfi_def_cfa_offset 16\n") where CFI is defined to a noop on darwin and other platforms that don't support those directives. Modified: llvm/trunk/lib/Target/X86/X86JITInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86JITInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86JITInfo.cpp?rev=44803&r1=44802&r2=44803&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86JITInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86JITInfo.cpp Mon Dec 10 13:10:18 2007 @@ -58,27 +58,27 @@ ".align 8\n" ".globl " ASMPREFIX "X86CompilationCallback\n" ASMPREFIX "X86CompilationCallback:\n" - ".cfi_startproc\n" +// ".cfi_startproc\n" // Save RBP "pushq %rbp\n" - ".cfi_def_cfa_offset 16\n" - ".cfi_offset %rbp, -16\n" +// ".cfi_def_cfa_offset 16\n" +// ".cfi_offset %rbp, -16\n" // Save RSP "movq %rsp, %rbp\n" - ".cfi_def_cfa_register %rbp\n" +// ".cfi_def_cfa_register %rbp\n" // Save all int arg registers "pushq %rdi\n" - ".cfi_rel_offset %rdi, 0\n" +// ".cfi_rel_offset %rdi, 0\n" "pushq %rsi\n" - ".cfi_rel_offset %rsi, 8\n" +// ".cfi_rel_offset %rsi, 8\n" "pushq %rdx\n" - ".cfi_rel_offset %rdx, 16\n" +// ".cfi_rel_offset %rdx, 16\n" "pushq %rcx\n" - ".cfi_rel_offset %rcx, 24\n" +// ".cfi_rel_offset %rcx, 24\n" "pushq %r8\n" - ".cfi_rel_offset %r8, 32\n" +// ".cfi_rel_offset %r8, 32\n" "pushq %r9\n" - ".cfi_rel_offset %r9, 40\n" +// ".cfi_rel_offset %r9, 40\n" // Align stack on 16-byte boundary. ESP might not be properly aligned // (8 byte) if this is called from an indirect stub. "andq $-16, %rsp\n" @@ -107,34 +107,35 @@ "movaps (%rsp), %xmm0\n" // Restore RSP "movq %rbp, %rsp\n" - ".cfi_def_cfa_register esp\n" +// ".cfi_def_cfa_register esp\n" // Restore all int arg registers "subq $48, %rsp\n" - ".cfi_adjust_cfa_offset 48\n" +// ".cfi_adjust_cfa_offset 48\n" "popq %r9\n" - ".cfi_adjust_cfa_offset -8\n" - ".cfi_restore %r9\n" +// ".cfi_adjust_cfa_offset -8\n" +// ".cfi_restore %r9\n" "popq %r8\n" - ".cfi_adjust_cfa_offset -8\n" - ".cfi_restore %r8\n" +// ".cfi_adjust_cfa_offset -8\n" +// ".cfi_restore %r8\n" "popq %rcx\n" - ".cfi_adjust_cfa_offset -8\n" - ".cfi_restore %rcx\n" +// ".cfi_adjust_cfa_offset -8\n" +// ".cfi_restore %rcx\n" "popq %rdx\n" - ".cfi_adjust_cfa_offset -8\n" - ".cfi_restore %rdx\n" +// ".cfi_adjust_cfa_offset -8\n" +// ".cfi_restore %rdx\n" "popq %rsi\n" - ".cfi_adjust_cfa_offset -8\n" - ".cfi_restore %rsi\n" +// ".cfi_adjust_cfa_offset -8\n" +// ".cfi_restore %rsi\n" "popq %rdi\n" - ".cfi_adjust_cfa_offset -8\n" - ".cfi_restore %rdi\n" +// ".cfi_adjust_cfa_offset -8\n" +// ".cfi_restore %rdi\n" // Restore RBP "popq %rbp\n" - ".cfi_adjust_cfa_offset -8\n" - ".cfi_restore %rbp\n" +// ".cfi_adjust_cfa_offset -8\n" +// ".cfi_restore %rbp\n" "ret\n" - ".cfi_endproc\n"); +// ".cfi_endproc\n" + ); #elif defined(__i386__) || defined(i386) || defined(_M_IX86) #ifndef _MSC_VER void X86CompilationCallback(void); @@ -143,18 +144,18 @@ ".align 8\n" ".globl " ASMPREFIX "X86CompilationCallback\n" ASMPREFIX "X86CompilationCallback:\n" - ".cfi_startproc\n" +// ".cfi_startproc\n" "pushl %ebp\n" - ".cfi_def_cfa_offset 8\n" - ".cfi_offset %ebp, -8\n" +// ".cfi_def_cfa_offset 8\n" +// ".cfi_offset %ebp, -8\n" "movl %esp, %ebp\n" // Standard prologue - ".cfi_def_cfa_register %ebp\n" +// ".cfi_def_cfa_register %ebp\n" "pushl %eax\n" - ".cfi_rel_offset %eax, 0\n" +// ".cfi_rel_offset %eax, 0\n" "pushl %edx\n" // Save EAX/EDX/ECX - ".cfi_rel_offset %edx, 4\n" +// ".cfi_rel_offset %edx, 4\n" "pushl %ecx\n" - ".cfi_rel_offset %ecx, 8\n" +// ".cfi_rel_offset %ecx, 8\n" #if defined(__APPLE__) "andl $-16, %esp\n" // Align ESP on 16-byte boundary #endif @@ -164,23 +165,24 @@ "movl %ebp, (%esp)\n" "call " ASMPREFIX "X86CompilationCallback2\n" "movl %ebp, %esp\n" // Restore ESP - ".cfi_def_cfa_register %esp\n" +// ".cfi_def_cfa_register %esp\n" "subl $12, %esp\n" - ".cfi_adjust_cfa_offset 12\n" +// ".cfi_adjust_cfa_offset 12\n" "popl %ecx\n" - ".cfi_adjust_cfa_offset -4\n" - ".cfi_restore %ecx\n" +// ".cfi_adjust_cfa_offset -4\n" +// ".cfi_restore %ecx\n" "popl %edx\n" - ".cfi_adjust_cfa_offset -4\n" - ".cfi_restore %edx\n" +// ".cfi_adjust_cfa_offset -4\n" +// ".cfi_restore %edx\n" "popl %eax\n" - ".cfi_adjust_cfa_offset -4\n" - ".cfi_restore %eax\n" +// ".cfi_adjust_cfa_offset -4\n" +// ".cfi_restore %eax\n" "popl %ebp\n" - ".cfi_adjust_cfa_offset -4\n" - ".cfi_restore %ebp\n" +// ".cfi_adjust_cfa_offset -4\n" +// ".cfi_restore %ebp\n" "ret\n" - ".cfi_endproc\n"); +// ".cfi_endproc\n" + ); // Same as X86CompilationCallback but also saves XMM argument registers. void X86CompilationCallback_SSE(void); @@ -189,18 +191,18 @@ ".align 8\n" ".globl " ASMPREFIX "X86CompilationCallback_SSE\n" ASMPREFIX "X86CompilationCallback_SSE:\n" - ".cfi_startproc\n" +// ".cfi_startproc\n" "pushl %ebp\n" - ".cfi_def_cfa_offset 8\n" - ".cfi_offset %ebp, -8\n" +// ".cfi_def_cfa_offset 8\n" +// ".cfi_offset %ebp, -8\n" "movl %esp, %ebp\n" // Standard prologue - ".cfi_def_cfa_register %ebp\n" +// ".cfi_def_cfa_register %ebp\n" "pushl %eax\n" - ".cfi_rel_offset %eax, 0\n" +// ".cfi_rel_offset %eax, 0\n" "pushl %edx\n" // Save EAX/EDX/ECX - ".cfi_rel_offset %edx, 4\n" +// ".cfi_rel_offset %edx, 4\n" "pushl %ecx\n" - ".cfi_rel_offset %ecx, 8\n" +// ".cfi_rel_offset %ecx, 8\n" "andl $-16, %esp\n" // Align ESP on 16-byte boundary // Save all XMM arg registers "subl $64, %esp\n" @@ -218,31 +220,32 @@ "call " ASMPREFIX "X86CompilationCallback2\n" "addl $16, %esp\n" "movaps 48(%esp), %xmm3\n" - ".cfi_restore %xmm3\n" +// ".cfi_restore %xmm3\n" "movaps 32(%esp), %xmm2\n" - ".cfi_restore %xmm2\n" +// ".cfi_restore %xmm2\n" "movaps 16(%esp), %xmm1\n" - ".cfi_restore %xmm1\n" +// ".cfi_restore %xmm1\n" "movaps (%esp), %xmm0\n" - ".cfi_restore %xmm0\n" +// ".cfi_restore %xmm0\n" "movl %ebp, %esp\n" // Restore ESP - ".cfi_def_cfa_register esp\n" +// ".cfi_def_cfa_register esp\n" "subl $12, %esp\n" - ".cfi_adjust_cfa_offset 12\n" +// ".cfi_adjust_cfa_offset 12\n" "popl %ecx\n" - ".cfi_adjust_cfa_offset -4\n" - ".cfi_restore %ecx\n" +// ".cfi_adjust_cfa_offset -4\n" +// ".cfi_restore %ecx\n" "popl %edx\n" - ".cfi_adjust_cfa_offset -4\n" - ".cfi_restore %edx\n" +// ".cfi_adjust_cfa_offset -4\n" +// ".cfi_restore %edx\n" "popl %eax\n" - ".cfi_adjust_cfa_offset -4\n" - ".cfi_restore %eax\n" +// ".cfi_adjust_cfa_offset -4\n" +// ".cfi_restore %eax\n" "popl %ebp\n" - ".cfi_adjust_cfa_offset -4\n" - ".cfi_restore %ebp\n" +// ".cfi_adjust_cfa_offset -4\n" +// ".cfi_restore %ebp\n" "ret\n" - ".cfi_endproc\n"); +// ".cfi_endproc\n" + ); #else void X86CompilationCallback2(void); From cfr at adobe.com Mon Dec 10 13:31:09 2007 From: cfr at adobe.com (Chuck Rose III) Date: Mon, 10 Dec 2007 19:31:09 -0000 Subject: [llvm-commits] [llvm] r44805 - in /llvm/trunk/win32: CodeGen/CodeGen.vcproj Support/Support.vcproj Message-ID: <200712101931.lBAJV9sm000840@zion.cs.uiuc.edu> Author: cfr Date: Mon Dec 10 13:31:09 2007 New Revision: 44805 URL: http://llvm.org/viewvc/llvm-project?rev=44805&view=rev Log: Add StringPool + new CodeGen files to win32 build Modified: llvm/trunk/win32/CodeGen/CodeGen.vcproj llvm/trunk/win32/Support/Support.vcproj Modified: llvm/trunk/win32/CodeGen/CodeGen.vcproj URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/win32/CodeGen/CodeGen.vcproj?rev=44805&r1=44804&r2=44805&view=diff ============================================================================== --- llvm/trunk/win32/CodeGen/CodeGen.vcproj (original) +++ llvm/trunk/win32/CodeGen/CodeGen.vcproj Mon Dec 10 13:31:09 2007 @@ -476,6 +476,26 @@ > + + + + + + + + + + @@ -551,6 +571,10 @@ > + + Modified: llvm/trunk/win32/Support/Support.vcproj URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/win32/Support/Support.vcproj?rev=44805&r1=44804&r2=44805&view=diff ============================================================================== --- llvm/trunk/win32/Support/Support.vcproj (original) +++ llvm/trunk/win32/Support/Support.vcproj Mon Dec 10 13:31:09 2007 @@ -409,6 +409,10 @@ > + + @@ -567,6 +571,10 @@ > + + From evan.cheng at apple.com Mon Dec 10 13:36:47 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 10 Dec 2007 11:36:47 -0800 Subject: [llvm-commits] [llvm] r44687 - in /llvm/trunk: include/llvm/CodeGen/Passes.h lib/CodeGen/LLVMTargetMachine.cpp lib/CodeGen/MachineLICM.cpp lib/Target/PowerPC/PPCInstrInfo.td In-Reply-To: <20071210144741.GX26680@gold.us.cray.com> References: <20071210144741.GX26680@gold.us.cray.com> Message-ID: <5BD5B624-4DF2-4547-A2EC-A06D261D70DE@apple.com> On Dec 10, 2007, at 6:47 AM, Dan Gohman wrote: >> Thanks for pointing this out. I'll go over it when I'm doing the >> load/ >> store instructions in my pass. > > Hi Bill, > > How involved will MachineLICM be? After LLVM's main LICM pass runs, it > seems all that's left for MachineLICM to do are just the constant-pool > loads, immediates, etc. that aren't exposed in the main LLVM IR, > things > that don't require alias analysis. I think this is probably true. I'd be surprised if machine level LICM would require alias analysis. > > > And if that's all it's doing, MachineLICM's traversal could be > simplified > a little. Instead of visiting each loop individually, taking care to > avoid > revisiting to blocks within inner loops, the pass could just traverse > entire outer-most loops, which will implicitly include the blocks of > any > inner loops. Instructions nested deep in inner loops can then be > hoisted > all the way out of the outer-most loop in a single step instead of > being > hoisted out one loop at a time. I don't think lifting loop invariant from inner loop all the way out of outer-most loop is a good idea. That will increase register pressure in basic blocks where it is not used. Evan > > > Dan > > -- > Dan Gohman, Cray Inc. > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From criswell at uiuc.edu Mon Dec 10 14:26:31 2007 From: criswell at uiuc.edu (John Criswell) Date: Mon, 10 Dec 2007 20:26:31 -0000 Subject: [llvm-commits] [llvm] r44810 - /llvm/trunk/docs/WritingAnLLVMPass.html Message-ID: <200712102026.lBAKQVo2003732@zion.cs.uiuc.edu> Author: criswell Date: Mon Dec 10 14:26:29 2007 New Revision: 44810 URL: http://llvm.org/viewvc/llvm-project?rev=44810&view=rev Log: Fix some wording. Modified: llvm/trunk/docs/WritingAnLLVMPass.html Modified: llvm/trunk/docs/WritingAnLLVMPass.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/WritingAnLLVMPass.html?rev=44810&r1=44809&r2=44810&view=diff ============================================================================== --- llvm/trunk/docs/WritingAnLLVMPass.html (original) +++ llvm/trunk/docs/WritingAnLLVMPass.html Mon Dec 10 14:26:29 2007 @@ -1376,7 +1376,8 @@ traversing the entire program. It reduces the memory consumption of compiler, because, for example, only one DominatorSet -needs to be calculated at a time. This also makes it possible some interesting enhancements in the future.

From isanbard at gmail.com Mon Dec 10 15:20:48 2007 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 10 Dec 2007 13:20:48 -0800 Subject: [llvm-commits] [llvm] r44687 - in /llvm/trunk: include/llvm/CodeGen/Passes.h lib/CodeGen/LLVMTargetMachine.cpp lib/CodeGen/MachineLICM.cpp lib/Target/PowerPC/PPCInstrInfo.td In-Reply-To: <20071210144741.GX26680@gold.us.cray.com> References: <20071210144741.GX26680@gold.us.cray.com> Message-ID: <16e5fdf90712101320h1132aa1dg5e86bf4d9b5c53be@mail.gmail.com> On Dec 10, 2007 6:47 AM, Dan Gohman wrote: > > Thanks for pointing this out. I'll go over it when I'm doing the load/ > > store instructions in my pass. > > Hi Bill, > > How involved will MachineLICM be? After LLVM's main LICM pass runs, it > seems all that's left for MachineLICM to do are just the constant-pool > loads, immediates, etc. that aren't exposed in the main LLVM IR, things > that don't require alias analysis. > Good point. I was just leaving the option of needing AA open just in case. But I won't use it if not needed, of course. > And if that's all it's doing, MachineLICM's traversal could be simplified > a little. Instead of visiting each loop individually, taking care to avoid > revisiting to blocks within inner loops, the pass could just traverse > entire outer-most loops, which will implicitly include the blocks of any > inner loops. Instructions nested deep in inner loops can then be hoisted > all the way out of the outer-most loop in a single step instead of being > hoisted out one loop at a time. > I just want to make sure we're visiting all defs before uses. This way, we won't be hoisting things that shouldn't be, and, of course, that we hoist things which we should be hoisting. Take, for example, an invariant in a subloop that is itself part of the body of a conditional statement. Of course, we want to hoist the instruction to the pre-header of the subloop, but not to the pre-header of the outer loop. To make sure we do this without visiting the subloops first, I think we would have to have a lot more checking. -bw From isanbard at gmail.com Mon Dec 10 15:23:39 2007 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 10 Dec 2007 13:23:39 -0800 Subject: [llvm-commits] [llvm] r44687 - in /llvm/trunk: include/llvm/CodeGen/Passes.h lib/CodeGen/LLVMTargetMachine.cpp lib/CodeGen/MachineLICM.cpp lib/Target/PowerPC/PPCInstrInfo.td In-Reply-To: <5BD5B624-4DF2-4547-A2EC-A06D261D70DE@apple.com> References: <20071210144741.GX26680@gold.us.cray.com> <5BD5B624-4DF2-4547-A2EC-A06D261D70DE@apple.com> Message-ID: <16e5fdf90712101323m635126f8o30aa7fb98f4d77a0@mail.gmail.com> On Dec 10, 2007 11:36 AM, Evan Cheng wrote: > On Dec 10, 2007, at 6:47 AM, Dan Gohman wrote: > > And if that's all it's doing, MachineLICM's traversal could be > > simplified > > a little. Instead of visiting each loop individually, taking care to > > avoid > > revisiting to blocks within inner loops, the pass could just traverse > > entire outer-most loops, which will implicitly include the blocks of > > any > > inner loops. Instructions nested deep in inner loops can then be > > hoisted > > all the way out of the outer-most loop in a single step instead of > > being > > hoisted out one loop at a time. > > I don't think lifting loop invariant from inner loop all the way out > of outer-most loop is a good idea. That will increase register > pressure in basic blocks where it is not used. > This is going to happen with the current pass, though. Each loop is going to see the hoisted instructions from the previous iteration and try to re-hoist them. Is there some heuristic we should apply to prevent it from hoisting instructions too far? -bw From isanbard at gmail.com Mon Dec 10 15:49:17 2007 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 10 Dec 2007 21:49:17 -0000 Subject: [llvm-commits] [llvm] r44811 - /llvm/tags/Apple/llvmCore-2003/ Message-ID: <200712102149.lBALnHlF007823@zion.cs.uiuc.edu> Author: void Date: Mon Dec 10 15:49:16 2007 New Revision: 44811 URL: http://llvm.org/viewvc/llvm-project?rev=44811&view=rev Log: Creating llvmCore-2003. Added: llvm/tags/Apple/llvmCore-2003/ - copied from r44810, llvm/trunk/ From isanbard at gmail.com Mon Dec 10 15:50:12 2007 From: isanbard at gmail.com (Bill Wendling) Date: Mon, 10 Dec 2007 21:50:12 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r44812 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2002/ Message-ID: <200712102150.lBALoCwE007875@zion.cs.uiuc.edu> Author: void Date: Mon Dec 10 15:50:11 2007 New Revision: 44812 URL: http://llvm.org/viewvc/llvm-project?rev=44812&view=rev Log: Creating llvmgcc42-2002 Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2002/ - copied from r44811, llvm-gcc-4.2/trunk/ From sabre at nondot.org Mon Dec 10 16:18:53 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 10 Dec 2007 22:18:53 -0000 Subject: [llvm-commits] [llvm] r44814 - /llvm/trunk/include/llvm/Instruction.h Message-ID: <200712102218.lBAMIreq009162@zion.cs.uiuc.edu> Author: lattner Date: Mon Dec 10 16:18:53 2007 New Revision: 44814 URL: http://llvm.org/viewvc/llvm-project?rev=44814&view=rev Log: split isBinaryOp into a static and member version. Modified: llvm/trunk/include/llvm/Instruction.h Modified: llvm/trunk/include/llvm/Instruction.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instruction.h?rev=44814&r1=44813&r2=44814&view=diff ============================================================================== --- llvm/trunk/include/llvm/Instruction.h (original) +++ llvm/trunk/include/llvm/Instruction.h Mon Dec 10 16:18:53 2007 @@ -102,21 +102,22 @@ /// one of the enums that is coming soon (down below)... /// unsigned getOpcode() const { return getValueID() - InstructionVal; } - const char *getOpcodeName() const { - return getOpcodeName(getOpcode()); - } + const char *getOpcodeName() const { return getOpcodeName(getOpcode()); } + bool isTerminator() const { return isTerminator(getOpcode()); } + bool isBinaryOp() const { return isBinaryOp(getOpcode()); } + bool isShift() { return isShift(getOpcode()); } + bool isCast() const { return isCast(getOpcode()); } + + + static const char* getOpcodeName(unsigned OpCode); static inline bool isTerminator(unsigned OpCode) { return OpCode >= TermOpsBegin && OpCode < TermOpsEnd; } - inline bool isTerminator() const { // Instance of TerminatorInst? - return isTerminator(getOpcode()); - } - - inline bool isBinaryOp() const { - return getOpcode() >= BinaryOpsBegin && getOpcode() < BinaryOpsEnd; + static inline bool isBinaryOp(unsigned Opcode) { + return Opcode >= BinaryOpsBegin && Opcode < BinaryOpsEnd; } /// @brief Determine if the Opcode is one of the shift instructions. @@ -124,10 +125,6 @@ return Opcode >= Shl && Opcode <= AShr; } - /// @brief Determine if the instruction's opcode is one of the shift - /// instructions. - inline bool isShift() { return isShift(getOpcode()); } - /// isLogicalShift - Return true if this is a logical shift left or a logical /// shift right. inline bool isLogicalShift() { @@ -145,11 +142,6 @@ return OpCode >= CastOpsBegin && OpCode < CastOpsEnd; } - /// @brief Determine if this is one of the CastInst instructions. - inline bool isCast() const { - return isCast(getOpcode()); - } - /// isAssociative - Return true if the instruction is associative: /// /// Associative operators satisfy: x op (y op z) === (x op y) op z From kremenek at apple.com Mon Dec 10 16:28:35 2007 From: kremenek at apple.com (Ted Kremenek) Date: Mon, 10 Dec 2007 22:28:35 -0000 Subject: [llvm-commits] [llvm] r44815 - /llvm/trunk/include/llvm/ADT/BitVector.h Message-ID: <200712102228.lBAMSZk3009796@zion.cs.uiuc.edu> Author: kremenek Date: Mon Dec 10 16:28:35 2007 New Revision: 44815 URL: http://llvm.org/viewvc/llvm-project?rev=44815&view=rev Log: Added two bounds checks to the BitVector class to detect out-of-bounds bit accesses. The checks are only performed in a Debug build. Modified: llvm/trunk/include/llvm/ADT/BitVector.h Modified: llvm/trunk/include/llvm/ADT/BitVector.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/BitVector.h?rev=44815&r1=44814&r2=44815&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/BitVector.h (original) +++ llvm/trunk/include/llvm/ADT/BitVector.h Mon Dec 10 16:28:35 2007 @@ -245,10 +245,12 @@ // Indexing. reference operator[](unsigned Idx) { + assert (Idx < Size && "Out-of-bounds Bit access."); return reference(*this, Idx); } bool operator[](unsigned Idx) const { + assert (Idx < Size && "Out-of-bounds Bit access."); BitWord Mask = 1L << (Idx % BITWORD_SIZE); return (Bits[Idx / BITWORD_SIZE] & Mask) != 0; } @@ -375,6 +377,8 @@ // Destroy the old bits. delete[] Bits; Bits = NewBits; + + clear_unused_bits(); } void init_words(BitWord *B, unsigned NumWords, bool t) { From sabre at nondot.org Mon Dec 10 16:53:04 2007 From: sabre at nondot.org (Chris Lattner) Date: Mon, 10 Dec 2007 22:53:04 -0000 Subject: [llvm-commits] [llvm] r44817 - in /llvm/trunk: include/llvm/Analysis/ConstantFolding.h lib/Analysis/ConstantFolding.cpp lib/Analysis/ScalarEvolution.cpp lib/Transforms/Utils/CloneFunction.cpp lib/VMCore/ConstantFold.cpp test/Assembler/ConstantExprFold.llx test/Transforms/InstCombine/2007-12-10-ConstFoldCompare.ll Message-ID: <200712102253.lBAMr5EA011211@zion.cs.uiuc.edu> Author: lattner Date: Mon Dec 10 16:53:04 2007 New Revision: 44817 URL: http://llvm.org/viewvc/llvm-project?rev=44817&view=rev Log: Fix PR1850 by removing an unsafe transformation from VMCore/ConstantFold.cpp. Reimplement the xform in Analysis/ConstantFolding.cpp where we can use targetdata to validate that it is safe. While I'm in there, fix some const correctness issues and generalize the interface to the "operand folder". Added: llvm/trunk/test/Transforms/InstCombine/2007-12-10-ConstFoldCompare.ll Modified: llvm/trunk/include/llvm/Analysis/ConstantFolding.h llvm/trunk/lib/Analysis/ConstantFolding.cpp llvm/trunk/lib/Analysis/ScalarEvolution.cpp llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp llvm/trunk/lib/VMCore/ConstantFold.cpp llvm/trunk/test/Assembler/ConstantExprFold.llx Modified: llvm/trunk/include/llvm/Analysis/ConstantFolding.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ConstantFolding.h?rev=44817&r1=44816&r2=44817&view=diff ============================================================================== --- llvm/trunk/include/llvm/Analysis/ConstantFolding.h (original) +++ llvm/trunk/include/llvm/Analysis/ConstantFolding.h Mon Dec 10 16:53:04 2007 @@ -21,6 +21,7 @@ class Instruction; class TargetData; class Function; + class Type; /// ConstantFoldInstruction - Attempt to constant fold the specified /// instruction. If successful, the constant result is returned, if not, null @@ -35,12 +36,17 @@ /// fold instructions like loads and stores, which have no constant expression /// form. /// -Constant *ConstantFoldInstOperands( - const Instruction *I, ///< The model instruction - Constant** Ops, ///< The array of constant operands to use. - unsigned NumOps, ///< The number of operands provided. - const TargetData *TD = 0 ///< Optional target information. -); +Constant *ConstantFoldInstOperands(unsigned Opcode, const Type *DestTy, + Constant*const * Ops, unsigned NumOps, + const TargetData *TD = 0); + +/// ConstantFoldCompareInstOperands - Attempt to constant fold a compare +/// instruction (icmp/fcmp) with the specified operands. If it fails, it +/// returns a constant expression of the specified operands. +/// +Constant *ConstantFoldCompareInstOperands(unsigned Predicate, + Constant*const * Ops, unsigned NumOps, + const TargetData *TD = 0); /// ConstantFoldLoadThroughGEPConstantExpr - Given a constant and a @@ -55,7 +61,7 @@ /// ConstantFoldCall - Attempt to constant fold a call to the specified function /// with the specified arguments, returning null if unsuccessful. Constant * -ConstantFoldCall(Function *F, Constant** Operands, unsigned NumOperands); +ConstantFoldCall(Function *F, Constant* const* Operands, unsigned NumOperands); } #endif Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ConstantFolding.cpp?rev=44817&r1=44816&r2=44817&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ConstantFolding.cpp (original) +++ llvm/trunk/lib/Analysis/ConstantFolding.cpp Mon Dec 10 16:53:04 2007 @@ -55,7 +55,8 @@ if (CE->getOpcode() == Instruction::GetElementPtr) { // Cannot compute this if the element type of the pointer is missing size // info. - if (!cast(CE->getOperand(0)->getType())->getElementType()->isSized()) + if (!cast(CE->getOperand(0)->getType()) + ->getElementType()->isSized()) return false; // If the base isn't a global+constant, we aren't either. @@ -117,7 +118,7 @@ /// SymbolicallyEvaluateGEP - If we can symbolically evaluate the specified GEP /// constant expression, do so. -static Constant *SymbolicallyEvaluateGEP(Constant** Ops, unsigned NumOps, +static Constant *SymbolicallyEvaluateGEP(Constant* const* Ops, unsigned NumOps, const Type *ResultTy, const TargetData *TD) { Constant *Ptr = Ops[0]; @@ -181,7 +182,12 @@ else return 0; // All operands not constant! - return ConstantFoldInstOperands(I, &Ops[0], Ops.size(), TD); + if (const CmpInst *CI = dyn_cast(I)) + return ConstantFoldCompareInstOperands(CI->getPredicate(), + &Ops[0], Ops.size(), TD); + else + return ConstantFoldInstOperands(I->getOpcode(), I->getType(), + &Ops[0], Ops.size(), TD); } /// ConstantFoldInstOperands - Attempt to constant fold an instruction with the @@ -190,23 +196,19 @@ /// attempting to fold instructions like loads and stores, which have no /// constant expression form. /// -Constant *llvm::ConstantFoldInstOperands(const Instruction* I, - Constant** Ops, unsigned NumOps, +Constant *llvm::ConstantFoldInstOperands(unsigned Opcode, const Type *DestTy, + Constant* const* Ops, unsigned NumOps, const TargetData *TD) { - unsigned Opc = I->getOpcode(); - const Type *DestTy = I->getType(); - // Handle easy binops first. - if (isa(I)) { + if (Instruction::isBinaryOp(Opcode)) { if (isa(Ops[0]) || isa(Ops[1])) - if (Constant *C = SymbolicallyEvaluateBinop(I->getOpcode(), Ops[0], - Ops[1], TD)) + if (Constant *C = SymbolicallyEvaluateBinop(Opcode, Ops[0], Ops[1], TD)) return C; - return ConstantExpr::get(Opc, Ops[0], Ops[1]); + return ConstantExpr::get(Opcode, Ops[0], Ops[1]); } - switch (Opc) { + switch (Opcode) { default: return 0; case Instruction::Call: if (Function *F = dyn_cast(Ops[0])) @@ -215,8 +217,7 @@ return 0; case Instruction::ICmp: case Instruction::FCmp: - return ConstantExpr::getCompare(cast(I)->getPredicate(), Ops[0], - Ops[1]); + assert(0 &&"This function is invalid for compares: no predicate specified"); case Instruction::PtrToInt: // If the input is a inttoptr, eliminate the pair. This requires knowing // the width of a pointer, so it can't be done in ConstantExpr::getCast. @@ -229,7 +230,7 @@ TD->getPointerSizeInBits())); Input = ConstantExpr::getAnd(Input, Mask); // Do a zext or trunc to get to the dest size. - return ConstantExpr::getIntegerCast(Input, I->getType(), false); + return ConstantExpr::getIntegerCast(Input, DestTy, false); } } // FALL THROUGH. @@ -244,7 +245,7 @@ case Instruction::FPToUI: case Instruction::FPToSI: case Instruction::BitCast: - return ConstantExpr::getCast(Opc, Ops[0], DestTy); + return ConstantExpr::getCast(Opcode, Ops[0], DestTy); case Instruction::Select: return ConstantExpr::getSelect(Ops[0], Ops[1], Ops[2]); case Instruction::ExtractElement: @@ -254,13 +255,73 @@ case Instruction::ShuffleVector: return ConstantExpr::getShuffleVector(Ops[0], Ops[1], Ops[2]); case Instruction::GetElementPtr: - if (Constant *C = SymbolicallyEvaluateGEP(Ops, NumOps, I->getType(), TD)) + if (Constant *C = SymbolicallyEvaluateGEP(Ops, NumOps, DestTy, TD)) return C; return ConstantExpr::getGetElementPtr(Ops[0], Ops+1, NumOps-1); } } +/// ConstantFoldCompareInstOperands - Attempt to constant fold a compare +/// instruction (icmp/fcmp) with the specified operands. If it fails, it +/// returns a constant expression of the specified operands. +/// +Constant *llvm::ConstantFoldCompareInstOperands(unsigned Predicate, + Constant*const * Ops, + unsigned NumOps, + const TargetData *TD) { + // fold: icmp (inttoptr x), null -> icmp x, 0 + // fold: icmp (ptrtoint x), 0 -> icmp x, null + // fold: icmp (inttoptr x), (inttoptr y) -> icmp x, y + // fold: icmp (ptrtoint x), (ptrtoint y) -> icmp x, y + // + // ConstantExpr::getCompare cannot do this, because it doesn't have TD + // around to know if bit truncation is happening. + if (ConstantExpr *CE0 = dyn_cast(Ops[0])) { + if (TD && Ops[1]->isNullValue()) { + const Type *IntPtrTy = TD->getIntPtrType(); + if (CE0->getOpcode() == Instruction::IntToPtr) { + // Convert the integer value to the right size to ensure we get the + // proper extension or truncation. + Constant *C = ConstantExpr::getIntegerCast(CE0->getOperand(0), + IntPtrTy, false); + Constant *NewOps[] = { C, Constant::getNullValue(C->getType()) }; + return ConstantFoldCompareInstOperands(Predicate, NewOps, 2, TD); + } + + // Only do this transformation if the int is intptrty in size, otherwise + // there is a truncation or extension that we aren't modeling. + if (CE0->getOpcode() == Instruction::PtrToInt && + CE0->getType() == IntPtrTy) { + Constant *C = CE0->getOperand(0); + Constant *NewOps[] = { C, Constant::getNullValue(C->getType()) }; + // FIXME! + return ConstantFoldCompareInstOperands(Predicate, NewOps, 2, TD); + } + } + + if (TD && isa(Ops[1]) && + cast(Ops[1])->getOpcode() == CE0->getOpcode()) { + const Type *IntPtrTy = TD->getIntPtrType(); + // Only do this transformation if the int is intptrty in size, otherwise + // there is a truncation or extension that we aren't modeling. + if ((CE0->getOpcode() == Instruction::IntToPtr && + CE0->getOperand(0)->getType() == IntPtrTy && + CE0->getOperand(1)->getType() == IntPtrTy) || + (CE0->getOpcode() == Instruction::PtrToInt && + CE0->getType() == IntPtrTy && + CE0->getOperand(0)->getType() == CE0->getOperand(1)->getType())) { + Constant *NewOps[] = { + CE0->getOperand(0), cast(Ops[1])->getOperand(0) + }; + return ConstantFoldCompareInstOperands(Predicate, NewOps, 2, TD); + } + } + } + return ConstantExpr::getCompare(Predicate, Ops[0], Ops[1]); +} + + /// ConstantFoldLoadThroughGEPConstantExpr - Given a constant and a /// getelementptr constantexpr, return the constant value being addressed by the /// constant expression, or null if something is funny and we can't decide. @@ -438,7 +499,8 @@ /// with the specified arguments, returning null if unsuccessful. Constant * -llvm::ConstantFoldCall(Function *F, Constant** Operands, unsigned NumOperands) { +llvm::ConstantFoldCall(Function *F, + Constant* const* Operands, unsigned NumOperands) { const ValueName *NameVal = F->getValueName(); if (NameVal == 0) return 0; const char *Str = NameVal->getKeyData(); Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=44817&r1=44816&r2=44817&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original) +++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Mon Dec 10 16:53:04 2007 @@ -2043,7 +2043,12 @@ if (Operands[i] == 0) return 0; } - return ConstantFoldInstOperands(I, &Operands[0], Operands.size()); + if (const CmpInst *CI = dyn_cast(I)) + return ConstantFoldCompareInstOperands(CI->getPredicate(), + &Operands[0], Operands.size()); + else + return ConstantFoldInstOperands(I->getOpcode(), I->getType(), + &Operands[0], Operands.size()); } /// getConstantEvolutionLoopExitValue - If we know that the specified Phi is @@ -2213,7 +2218,14 @@ } } } - Constant *C =ConstantFoldInstOperands(I, &Operands[0], Operands.size()); + + Constant *C; + if (const CmpInst *CI = dyn_cast(I)) + C = ConstantFoldCompareInstOperands(CI->getPredicate(), + &Operands[0], Operands.size()); + else + C = ConstantFoldInstOperands(I->getOpcode(), I->getType(), + &Operands[0], Operands.size()); return SE.getUnknown(C); } } Modified: llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp?rev=44817&r1=44816&r2=44817&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp Mon Dec 10 16:53:04 2007 @@ -299,7 +299,13 @@ else return 0; // All operands not constant! - return ConstantFoldInstOperands(I, &Ops[0], Ops.size(), TD); + + if (const CmpInst *CI = dyn_cast(I)) + return ConstantFoldCompareInstOperands(CI->getPredicate(), + &Ops[0], Ops.size(), TD); + else + return ConstantFoldInstOperands(I->getOpcode(), I->getType(), + &Ops[0], Ops.size(), TD); } /// CloneAndPruneFunctionInto - This works exactly like CloneFunctionInto, Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=44817&r1=44816&r2=44817&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/ConstantFold.cpp (original) +++ llvm/trunk/lib/VMCore/ConstantFold.cpp Mon Dec 10 16:53:04 2007 @@ -985,20 +985,19 @@ case Instruction::UIToFP: case Instruction::SIToFP: - case Instruction::IntToPtr: case Instruction::BitCast: case Instruction::ZExt: case Instruction::SExt: - case Instruction::PtrToInt: // If the cast is not actually changing bits, and the second operand is a // null pointer, do the comparison with the pre-casted value. if (V2->isNullValue() && (isa(CE1->getType()) || CE1->getType()->isInteger())) { - bool sgnd = CE1->getOpcode() == Instruction::ZExt ? false : - (CE1->getOpcode() == Instruction::SExt ? true : - (CE1->getOpcode() == Instruction::PtrToInt ? false : isSigned)); - return evaluateICmpRelation( - CE1Op0, Constant::getNullValue(CE1Op0->getType()), sgnd); + bool sgnd = isSigned; + if (CE1->getOpcode() == Instruction::ZExt) isSigned = false; + if (CE1->getOpcode() == Instruction::SExt) isSigned = true; + return evaluateICmpRelation(CE1Op0, + Constant::getNullValue(CE1Op0->getType()), + sgnd); } // If the dest type is a pointer type, and the RHS is a constantexpr cast @@ -1009,11 +1008,11 @@ if (CE2->isCast() && isa(CE1->getType()) && CE1->getOperand(0)->getType() == CE2->getOperand(0)->getType() && CE1->getOperand(0)->getType()->isInteger()) { - bool sgnd = CE1->getOpcode() == Instruction::ZExt ? false : - (CE1->getOpcode() == Instruction::SExt ? true : - (CE1->getOpcode() == Instruction::PtrToInt ? false : isSigned)); + bool sgnd = isSigned; + if (CE1->getOpcode() == Instruction::ZExt) isSigned = false; + if (CE1->getOpcode() == Instruction::SExt) isSigned = true; return evaluateICmpRelation(CE1->getOperand(0), CE2->getOperand(0), - sgnd); + sgnd); } break; Modified: llvm/trunk/test/Assembler/ConstantExprFold.llx URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/ConstantExprFold.llx?rev=44817&r1=44816&r2=44817&view=diff ============================================================================== --- llvm/trunk/test/Assembler/ConstantExprFold.llx (original) +++ llvm/trunk/test/Assembler/ConstantExprFold.llx Mon Dec 10 16:53:04 2007 @@ -24,6 +24,3 @@ int* getelementptr (%Ty* %B, long 0, uint 1)) ; true ;global bool setne (long* %A, long* cast (%Ty* %B to long*)) ; true -global bool seteq ({ short }* cast (int 1 to { short }*), { short }* null) -global bool setlt ({ short }* cast (int 1 to { short }*), { short }* cast (int 2 to { short }*)) - Added: llvm/trunk/test/Transforms/InstCombine/2007-12-10-ConstFoldCompare.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2007-12-10-ConstFoldCompare.ll?rev=44817&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/2007-12-10-ConstFoldCompare.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/2007-12-10-ConstFoldCompare.ll Mon Dec 10 16:53:04 2007 @@ -0,0 +1,9 @@ +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" +target triple = "i686-pc-linux-gnu" +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep {ret i1 0} +; PR1850 + +define i1 @test() { + %cond = icmp ule i8* inttoptr (i64 4294967297 to i8*), inttoptr (i64 5 to i8*) + ret i1 %cond +} From asl at math.spbu.ru Mon Dec 10 17:04:38 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Mon, 10 Dec 2007 23:04:38 -0000 Subject: [llvm-commits] [llvm] r44818 - /llvm/trunk/lib/Target/X86/X86JITInfo.cpp Message-ID: <200712102304.lBAN4cLJ012103@zion.cs.uiuc.edu> Author: asl Date: Mon Dec 10 17:04:38 2007 New Revision: 44818 URL: http://llvm.org/viewvc/llvm-project?rev=44818&view=rev Log: Provide convenient way to disable CFI stuff for old/broken assemblers. Use it for Darwin. Modified: llvm/trunk/lib/Target/X86/X86JITInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86JITInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86JITInfo.cpp?rev=44818&r1=44817&r2=44818&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86JITInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86JITInfo.cpp Mon Dec 10 17:04:38 2007 @@ -47,6 +47,12 @@ #define GETASMPREFIX(X) GETASMPREFIX2(X) #define ASMPREFIX GETASMPREFIX(__USER_LABEL_PREFIX__) +#if defined(__APPLE__) +# define CFI(x) +#else +# define CFI(x) x +#endif + // Provide a wrapper for X86CompilationCallback2 that saves non-traditional // callee saved registers, for the fastcc calling convention. extern "C" { @@ -58,27 +64,27 @@ ".align 8\n" ".globl " ASMPREFIX "X86CompilationCallback\n" ASMPREFIX "X86CompilationCallback:\n" -// ".cfi_startproc\n" + CFI(".cfi_startproc\n") // Save RBP "pushq %rbp\n" -// ".cfi_def_cfa_offset 16\n" -// ".cfi_offset %rbp, -16\n" + CFI(".cfi_def_cfa_offset 16\n") + CFI(".cfi_offset %rbp, -16\n") // Save RSP "movq %rsp, %rbp\n" -// ".cfi_def_cfa_register %rbp\n" + CFI(".cfi_def_cfa_register %rbp\n") // Save all int arg registers "pushq %rdi\n" -// ".cfi_rel_offset %rdi, 0\n" + CFI(".cfi_rel_offset %rdi, 0\n") "pushq %rsi\n" -// ".cfi_rel_offset %rsi, 8\n" + CFI(".cfi_rel_offset %rsi, 8\n") "pushq %rdx\n" -// ".cfi_rel_offset %rdx, 16\n" + CFI(".cfi_rel_offset %rdx, 16\n") "pushq %rcx\n" -// ".cfi_rel_offset %rcx, 24\n" + CFI(".cfi_rel_offset %rcx, 24\n") "pushq %r8\n" -// ".cfi_rel_offset %r8, 32\n" + CFI(".cfi_rel_offset %r8, 32\n") "pushq %r9\n" -// ".cfi_rel_offset %r9, 40\n" + CFI(".cfi_rel_offset %r9, 40\n") // Align stack on 16-byte boundary. ESP might not be properly aligned // (8 byte) if this is called from an indirect stub. "andq $-16, %rsp\n" @@ -107,35 +113,35 @@ "movaps (%rsp), %xmm0\n" // Restore RSP "movq %rbp, %rsp\n" -// ".cfi_def_cfa_register esp\n" + CFI(".cfi_def_cfa_register esp\n") // Restore all int arg registers "subq $48, %rsp\n" -// ".cfi_adjust_cfa_offset 48\n" + CFI(".cfi_adjust_cfa_offset 48\n") "popq %r9\n" -// ".cfi_adjust_cfa_offset -8\n" -// ".cfi_restore %r9\n" + CFI(".cfi_adjust_cfa_offset -8\n") + CFI(".cfi_restore %r9\n") "popq %r8\n" -// ".cfi_adjust_cfa_offset -8\n" -// ".cfi_restore %r8\n" + CFI(".cfi_adjust_cfa_offset -8\n") + CFI(".cfi_restore %r8\n") "popq %rcx\n" -// ".cfi_adjust_cfa_offset -8\n" -// ".cfi_restore %rcx\n" + CFI(".cfi_adjust_cfa_offset -8\n") + CFI(".cfi_restore %rcx\n") "popq %rdx\n" -// ".cfi_adjust_cfa_offset -8\n" -// ".cfi_restore %rdx\n" + CFI(".cfi_adjust_cfa_offset -8\n") + CFI(".cfi_restore %rdx\n") "popq %rsi\n" -// ".cfi_adjust_cfa_offset -8\n" -// ".cfi_restore %rsi\n" + CFI(".cfi_adjust_cfa_offset -8\n") + CFI(".cfi_restore %rsi\n") "popq %rdi\n" -// ".cfi_adjust_cfa_offset -8\n" -// ".cfi_restore %rdi\n" + CFI(".cfi_adjust_cfa_offset -8\n") + CFI(".cfi_restore %rdi\n") // Restore RBP "popq %rbp\n" -// ".cfi_adjust_cfa_offset -8\n" -// ".cfi_restore %rbp\n" + CFI(".cfi_adjust_cfa_offset -8\n") + CFI(".cfi_restore %rbp\n") "ret\n" -// ".cfi_endproc\n" - ); + CFI(".cfi_endproc\n") + ); #elif defined(__i386__) || defined(i386) || defined(_M_IX86) #ifndef _MSC_VER void X86CompilationCallback(void); @@ -144,18 +150,18 @@ ".align 8\n" ".globl " ASMPREFIX "X86CompilationCallback\n" ASMPREFIX "X86CompilationCallback:\n" -// ".cfi_startproc\n" + CFI(".cfi_startproc\n") "pushl %ebp\n" -// ".cfi_def_cfa_offset 8\n" -// ".cfi_offset %ebp, -8\n" + CFI(".cfi_def_cfa_offset 8\n") + CFI(".cfi_offset %ebp, -8\n") "movl %esp, %ebp\n" // Standard prologue -// ".cfi_def_cfa_register %ebp\n" + CFI(".cfi_def_cfa_register %ebp\n") "pushl %eax\n" -// ".cfi_rel_offset %eax, 0\n" + CFI(".cfi_rel_offset %eax, 0\n") "pushl %edx\n" // Save EAX/EDX/ECX -// ".cfi_rel_offset %edx, 4\n" + CFI(".cfi_rel_offset %edx, 4\n") "pushl %ecx\n" -// ".cfi_rel_offset %ecx, 8\n" + CFI(".cfi_rel_offset %ecx, 8\n") #if defined(__APPLE__) "andl $-16, %esp\n" // Align ESP on 16-byte boundary #endif @@ -165,24 +171,24 @@ "movl %ebp, (%esp)\n" "call " ASMPREFIX "X86CompilationCallback2\n" "movl %ebp, %esp\n" // Restore ESP -// ".cfi_def_cfa_register %esp\n" + CFI(".cfi_def_cfa_register %esp\n") "subl $12, %esp\n" -// ".cfi_adjust_cfa_offset 12\n" + CFI(".cfi_adjust_cfa_offset 12\n") "popl %ecx\n" -// ".cfi_adjust_cfa_offset -4\n" -// ".cfi_restore %ecx\n" + CFI(".cfi_adjust_cfa_offset -4\n") + CFI(".cfi_restore %ecx\n") "popl %edx\n" -// ".cfi_adjust_cfa_offset -4\n" -// ".cfi_restore %edx\n" + CFI(".cfi_adjust_cfa_offset -4\n") + CFI(".cfi_restore %edx\n") "popl %eax\n" -// ".cfi_adjust_cfa_offset -4\n" -// ".cfi_restore %eax\n" + CFI(".cfi_adjust_cfa_offset -4\n") + CFI(".cfi_restore %eax\n") "popl %ebp\n" -// ".cfi_adjust_cfa_offset -4\n" -// ".cfi_restore %ebp\n" + CFI(".cfi_adjust_cfa_offset -4\n") + CFI(".cfi_restore %ebp\n") "ret\n" -// ".cfi_endproc\n" - ); + CFI(".cfi_endproc\n") + ); // Same as X86CompilationCallback but also saves XMM argument registers. void X86CompilationCallback_SSE(void); @@ -191,18 +197,18 @@ ".align 8\n" ".globl " ASMPREFIX "X86CompilationCallback_SSE\n" ASMPREFIX "X86CompilationCallback_SSE:\n" -// ".cfi_startproc\n" + CFI(".cfi_startproc\n") "pushl %ebp\n" -// ".cfi_def_cfa_offset 8\n" -// ".cfi_offset %ebp, -8\n" + CFI(".cfi_def_cfa_offset 8\n") + CFI(".cfi_offset %ebp, -8\n") "movl %esp, %ebp\n" // Standard prologue -// ".cfi_def_cfa_register %ebp\n" + CFI(".cfi_def_cfa_register %ebp\n") "pushl %eax\n" -// ".cfi_rel_offset %eax, 0\n" + CFI(".cfi_rel_offset %eax, 0\n") "pushl %edx\n" // Save EAX/EDX/ECX -// ".cfi_rel_offset %edx, 4\n" + CFI(".cfi_rel_offset %edx, 4\n") "pushl %ecx\n" -// ".cfi_rel_offset %ecx, 8\n" + CFI(".cfi_rel_offset %ecx, 8\n") "andl $-16, %esp\n" // Align ESP on 16-byte boundary // Save all XMM arg registers "subl $64, %esp\n" @@ -220,32 +226,32 @@ "call " ASMPREFIX "X86CompilationCallback2\n" "addl $16, %esp\n" "movaps 48(%esp), %xmm3\n" -// ".cfi_restore %xmm3\n" + CFI(".cfi_restore %xmm3\n") "movaps 32(%esp), %xmm2\n" -// ".cfi_restore %xmm2\n" + CFI(".cfi_restore %xmm2\n") "movaps 16(%esp), %xmm1\n" -// ".cfi_restore %xmm1\n" + CFI(".cfi_restore %xmm1\n") "movaps (%esp), %xmm0\n" -// ".cfi_restore %xmm0\n" + CFI(".cfi_restore %xmm0\n") "movl %ebp, %esp\n" // Restore ESP -// ".cfi_def_cfa_register esp\n" + CFI(".cfi_def_cfa_register esp\n") "subl $12, %esp\n" -// ".cfi_adjust_cfa_offset 12\n" + CFI(".cfi_adjust_cfa_offset 12\n") "popl %ecx\n" -// ".cfi_adjust_cfa_offset -4\n" -// ".cfi_restore %ecx\n" + CFI(".cfi_adjust_cfa_offset -4\n") + CFI(".cfi_restore %ecx\n") "popl %edx\n" -// ".cfi_adjust_cfa_offset -4\n" -// ".cfi_restore %edx\n" + CFI(".cfi_adjust_cfa_offset -4\n") + CFI(".cfi_restore %edx\n") "popl %eax\n" -// ".cfi_adjust_cfa_offset -4\n" -// ".cfi_restore %eax\n" + CFI(".cfi_adjust_cfa_offset -4\n") + CFI(".cfi_restore %eax\n") "popl %ebp\n" -// ".cfi_adjust_cfa_offset -4\n" -// ".cfi_restore %ebp\n" + CFI(".cfi_adjust_cfa_offset -4\n") + CFI(".cfi_restore %ebp\n") "ret\n" -// ".cfi_endproc\n" - ); + CFI(".cfi_endproc\n") + ); #else void X86CompilationCallback2(void); From asl at math.spbu.ru Mon Dec 10 17:08:36 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Mon, 10 Dec 2007 23:08:36 -0000 Subject: [llvm-commits] [llvm] r44819 - /llvm/trunk/lib/Target/X86/X86JITInfo.cpp Message-ID: <200712102308.lBAN8aTd012307@zion.cs.uiuc.edu> Author: asl Date: Mon Dec 10 17:08:35 2007 New Revision: 44819 URL: http://llvm.org/viewvc/llvm-project?rev=44819&view=rev Log: Clarify the need of CFI() stuff Modified: llvm/trunk/lib/Target/X86/X86JITInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86JITInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86JITInfo.cpp?rev=44819&r1=44818&r2=44819&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86JITInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86JITInfo.cpp Mon Dec 10 17:08:35 2007 @@ -47,6 +47,9 @@ #define GETASMPREFIX(X) GETASMPREFIX2(X) #define ASMPREFIX GETASMPREFIX(__USER_LABEL_PREFIX__) +// Provide a convenient way for disable usage of CFI directives. +// This is needed for old/broken assemblers (for example, gas on +// Darwin is pretty old and doesn't support these directives) #if defined(__APPLE__) # define CFI(x) #else From asl at math.spbu.ru Mon Dec 10 17:10:21 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Mon, 10 Dec 2007 23:10:21 -0000 Subject: [llvm-commits] [llvm] r44820 - /llvm/trunk/lib/Target/X86/X86JITInfo.cpp Message-ID: <200712102310.lBANALwV012414@zion.cs.uiuc.edu> Author: asl Date: Mon Dec 10 17:10:20 2007 New Revision: 44820 URL: http://llvm.org/viewvc/llvm-project?rev=44820&view=rev Log: Hey, English is not my native language :) Modified: llvm/trunk/lib/Target/X86/X86JITInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86JITInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86JITInfo.cpp?rev=44820&r1=44819&r2=44820&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86JITInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86JITInfo.cpp Mon Dec 10 17:10:20 2007 @@ -47,7 +47,7 @@ #define GETASMPREFIX(X) GETASMPREFIX2(X) #define ASMPREFIX GETASMPREFIX(__USER_LABEL_PREFIX__) -// Provide a convenient way for disable usage of CFI directives. +// Provide a convenient way for disabling usage of CFI directives. // This is needed for old/broken assemblers (for example, gas on // Darwin is pretty old and doesn't support these directives) #if defined(__APPLE__) From clattner at apple.com Mon Dec 10 17:11:52 2007 From: clattner at apple.com (Chris Lattner) Date: Mon, 10 Dec 2007 15:11:52 -0800 Subject: [llvm-commits] Another GC patch for review In-Reply-To: <090728F3-476C-454E-ADA3-93828A7F18A8@carbonite.com> References: <090728F3-476C-454E-ADA3-93828A7F18A8@carbonite.com> Message-ID: <2B993E4A-98F2-4020-A096-79D830AA7301@apple.com> On Dec 9, 2007, at 8:01 PM, Gordon Henriksen wrote: > Here's the next patch. This jiggers around the GC data structures, > but the compiler still doesn't call into them, so they're inert. > > gc-6-redux.patch (+424 -295): > > include/llvm/CodeGen/Passes.h (+18) > include/llvm/CodeGen/Collector.h (+43 -43) > include/llvm/CodeGen/CollectorMetadata.h (+30 -31) > include/llvm/CodeGen/Collectors.h (+3) > lib/CodeGen/Collector.cpp (+125 -80) > lib/CodeGen/CollectorMetadata.cpp (+61 -31) > docs/GarbageCollection.html (+144 -110) > > CollectorMetadata and Collector are rejiggered to get along with > per-function collector model. Collector is now the factory for > CollectorMetadata, so the latter may be subclassed. Looks reasonable to me, please apply, -Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20071210/bd4681d9/attachment.html From evan.cheng at apple.com Mon Dec 10 17:44:54 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 10 Dec 2007 15:44:54 -0800 Subject: [llvm-commits] [llvm] r44687 - in /llvm/trunk: include/llvm/CodeGen/Passes.h lib/CodeGen/LLVMTargetMachine.cpp lib/CodeGen/MachineLICM.cpp lib/Target/PowerPC/PPCInstrInfo.td In-Reply-To: <16e5fdf90712101323m635126f8o30aa7fb98f4d77a0@mail.gmail.com> References: <20071210144741.GX26680@gold.us.cray.com> <5BD5B624-4DF2-4547-A2EC-A06D261D70DE@apple.com> <16e5fdf90712101323m635126f8o30aa7fb98f4d77a0@mail.gmail.com> Message-ID: <4CAE2FC5-85F5-4C02-B7FD-F19F195C6931@apple.com> On Dec 10, 2007, at 1:23 PM, Bill Wendling wrote: > On Dec 10, 2007 11:36 AM, Evan Cheng wrote: >> On Dec 10, 2007, at 6:47 AM, Dan Gohman wrote: >>> And if that's all it's doing, MachineLICM's traversal could be >>> simplified >>> a little. Instead of visiting each loop individually, taking care to >>> avoid >>> revisiting to blocks within inner loops, the pass could just >>> traverse >>> entire outer-most loops, which will implicitly include the blocks of >>> any >>> inner loops. Instructions nested deep in inner loops can then be >>> hoisted >>> all the way out of the outer-most loop in a single step instead of >>> being >>> hoisted out one loop at a time. >> >> I don't think lifting loop invariant from inner loop all the way out >> of outer-most loop is a good idea. That will increase register >> pressure in basic blocks where it is not used. >> > This is going to happen with the current pass, though. Each loop is > going to see the hoisted instructions from the previous iteration and > try to re-hoist them. Is there some heuristic we should apply to > prevent it from hoisting instructions too far? > I am not sure. :-) For innermost loops, hoisting invariants out into the preheader always make sense. Intuitively, hoisting invariants from inner loops out of the outermost loop only makes sense when all (or a lot, whatever that means :-) of the inner loops use it. Or at least the first inner loop use it. What does the LLVM level LICM do? Evan > -bw > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From gordonhenriksen at mac.com Mon Dec 10 18:20:49 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Tue, 11 Dec 2007 00:20:49 -0000 Subject: [llvm-commits] [llvm] r44824 - in /llvm/trunk: bindings/ocaml/Makefile bindings/ocaml/bitreader/ bindings/ocaml/bitreader/Makefile bindings/ocaml/bitreader/bitreader_ocaml.c bindings/ocaml/bitreader/llvm_bitreader.ml bindings/ocaml/bitreader/llvm_bitreader.mli include/llvm-c/BitReader.h lib/Bitcode/Reader/BitReader.cpp test/Bindings/Ocaml/bitreader.ml Message-ID: <200712110020.lBB0KnhD016663@zion.cs.uiuc.edu> Author: gordon Date: Mon Dec 10 18:20:48 2007 New Revision: 44824 URL: http://llvm.org/viewvc/llvm-project?rev=44824&view=rev Log: Adding Ocaml bindings for the bitreader as requested by Sarah Thompson. Usage should be something like this: open Llvm open Llvm_bitreader match read_bitcode_file fn with | Bitreader_failure msg -> prerr_endline msg | Bitreader_success m -> ...; dispose_module m Compile with: ocamlc llvm.cma llvm_bitreader.cma ocamlopt llvm.cmxa llvm_bitreader.cmxa Added: llvm/trunk/bindings/ocaml/bitreader/ (with props) llvm/trunk/bindings/ocaml/bitreader/Makefile llvm/trunk/bindings/ocaml/bitreader/bitreader_ocaml.c llvm/trunk/bindings/ocaml/bitreader/llvm_bitreader.ml llvm/trunk/bindings/ocaml/bitreader/llvm_bitreader.mli llvm/trunk/include/llvm-c/BitReader.h llvm/trunk/lib/Bitcode/Reader/BitReader.cpp llvm/trunk/test/Bindings/Ocaml/bitreader.ml Modified: llvm/trunk/bindings/ocaml/Makefile Modified: llvm/trunk/bindings/ocaml/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/Makefile?rev=44824&r1=44823&r2=44824&view=diff ============================================================================== --- llvm/trunk/bindings/ocaml/Makefile (original) +++ llvm/trunk/bindings/ocaml/Makefile Mon Dec 10 18:20:48 2007 @@ -8,6 +8,6 @@ ##===----------------------------------------------------------------------===## LEVEL := ../.. -DIRS = llvm bitwriter analysis +DIRS = llvm bitreader bitwriter analysis include $(LEVEL)/Makefile.common Propchange: llvm/trunk/bindings/ocaml/bitreader/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Mon Dec 10 18:20:48 2007 @@ -0,0 +1,2 @@ +Debug +Release Added: llvm/trunk/bindings/ocaml/bitreader/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/bitreader/Makefile?rev=44824&view=auto ============================================================================== --- llvm/trunk/bindings/ocaml/bitreader/Makefile (added) +++ llvm/trunk/bindings/ocaml/bitreader/Makefile Mon Dec 10 18:20:48 2007 @@ -0,0 +1,20 @@ +##===- bindings/ocaml/bitreader/Makefile -------------------*- Makefile -*-===## +# +# The LLVM Compiler Infrastructure +# +# This file was developed by Gordon Henriksen and is distributed under the +# University of Illinois Open Source License. See LICENSE.TXT for details. +# +##===----------------------------------------------------------------------===## +# +# This is the makefile for the Objective Caml Llvm_bitreader interface. +# +##===----------------------------------------------------------------------===## + +LEVEL := ../../.. +LIBRARYNAME := llvm_bitreader +DONT_BUILD_RELINKED := 1 +UsedComponents := bitreader +UsedOcamlInterfaces := llvm + +include ../Makefile.ocaml Added: llvm/trunk/bindings/ocaml/bitreader/bitreader_ocaml.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/bitreader/bitreader_ocaml.c?rev=44824&view=auto ============================================================================== --- llvm/trunk/bindings/ocaml/bitreader/bitreader_ocaml.c (added) +++ llvm/trunk/bindings/ocaml/bitreader/bitreader_ocaml.c Mon Dec 10 18:20:48 2007 @@ -0,0 +1,46 @@ +/*===-- bitwriter_ocaml.c - LLVM Ocaml Glue ---------------------*- C++ -*-===*\ +|* *| +|* The LLVM Compiler Infrastructure *| +|* *| +|* This file was developed by Gordon Henriksen and is distributed under the *| +|* University of Illinois Open Source License. See LICENSE.TXT for details. *| +|* *| +|*===----------------------------------------------------------------------===*| +|* *| +|* This file glues LLVM's ocaml interface to its C interface. These functions *| +|* are by and large transparent wrappers to the corresponding C functions. *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#include "llvm-c/BitReader.h" +#include "caml/alloc.h" +#include "caml/mlvalues.h" +#include "caml/memory.h" + +/*===-- Modules -----------------------------------------------------------===*/ + +/* string -> bitreader_result + + type bitreader_result = + | Bitreader_success of Llvm.llmodule + | Bitreader_failure of string + */ +CAMLprim value llvm_read_bitcode_file(value Path) { + LLVMModuleRef M; + char *Message; + CAMLparam1(Path); + CAMLlocal2(Variant, MessageVal); + + if (LLVMReadBitcodeFromFile(String_val(Path), &M, &Message)) { + MessageVal = copy_string(Message); + LLVMDisposeBitcodeReaderMessage(Message); + + Variant = alloc(1, 1); + Field(Variant, 0) = MessageVal; + } else { + Variant = alloc(1, 0); + Field(Variant, 0) = Val_op(M); + } + + CAMLreturn(Variant); +} Added: llvm/trunk/bindings/ocaml/bitreader/llvm_bitreader.ml URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/bitreader/llvm_bitreader.ml?rev=44824&view=auto ============================================================================== --- llvm/trunk/bindings/ocaml/bitreader/llvm_bitreader.ml (added) +++ llvm/trunk/bindings/ocaml/bitreader/llvm_bitreader.ml Mon Dec 10 18:20:48 2007 @@ -0,0 +1,17 @@ +(*===-- llvm_bitreader.ml - LLVM Ocaml Interface ----------------*- C++ -*-===* + * + * The LLVM Compiler Infrastructure + * + * This file was developed by Gordon Henriksen and is distributed under the + * University of Illinois Open Source License. See LICENSE.TXT for details. + * + *===----------------------------------------------------------------------===*) + + +type bitreader_result = +| Bitreader_success of Llvm.llmodule +| Bitreader_failure of string + + +external read_bitcode_file : string -> bitreader_result + = "llvm_read_bitcode_file" Added: llvm/trunk/bindings/ocaml/bitreader/llvm_bitreader.mli URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/bitreader/llvm_bitreader.mli?rev=44824&view=auto ============================================================================== --- llvm/trunk/bindings/ocaml/bitreader/llvm_bitreader.mli (added) +++ llvm/trunk/bindings/ocaml/bitreader/llvm_bitreader.mli Mon Dec 10 18:20:48 2007 @@ -0,0 +1,25 @@ +(*===-- llvm_bitreader.mli - LLVM Ocaml Interface ---------------*- C++ -*-===* + * + * The LLVM Compiler Infrastructure + * + * This file was developed by Gordon Henriksen and is distributed under the + * University of Illinois Open Source License. See LICENSE.TXT for details. + * + *===----------------------------------------------------------------------=== + * + * This interface provides an ocaml API for the LLVM bitcode reader, the + * classes in the Bitreader library. + * + *===----------------------------------------------------------------------===*) + + +type bitreader_result = +| Bitreader_success of Llvm.llmodule +| Bitreader_failure of string + + +(** [read_bitcode_file path] reads the bitcode for module [m] from the file at + [path]. Returns [Reader_success m] if successful, and [Reader_failure msg] + otherwise, where [msg] is a description of the error encountered. **) +external read_bitcode_file : string -> bitreader_result + = "llvm_read_bitcode_file" Added: llvm/trunk/include/llvm-c/BitReader.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/BitReader.h?rev=44824&view=auto ============================================================================== --- llvm/trunk/include/llvm-c/BitReader.h (added) +++ llvm/trunk/include/llvm-c/BitReader.h Mon Dec 10 18:20:48 2007 @@ -0,0 +1,43 @@ +/*===-- llvm-c/BitReader.h - BitReader Library C Interface ------*- C++ -*-===*\ +|* *| +|* The LLVM Compiler Infrastructure *| +|* *| +|* This file was developed by Gordon Henriksen and is distributed under the *| +|* University of Illinois Open Source License. See LICENSE.TXT for details. *| +|* *| +|*===----------------------------------------------------------------------===*| +|* *| +|* This header declares the C interface to libLLVMBitReader.a, which *| +|* implements input of the LLVM bitcode format. *| +|* *| +|* Many exotic languages can interoperate with C code but have a harder time *| +|* with C++ due to name mangling. So in addition to C, this interface enables *| +|* tools written in such languages. *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifndef LLVM_C_BITCODEREADER_H +#define LLVM_C_BITCODEREADER_H + +#include "llvm-c/Core.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Reads a module from the specified path, returning a reference to the module + via the OutModule parameter. Returns 0 on success. Optionally returns a + human-readable error message. */ +int LLVMReadBitcodeFromFile(const char *Path, LLVMModuleRef *OutModule, + char **OutMessage); + +/* Disposes of the message allocated by the bitcode reader, if any. */ +void LLVMDisposeBitcodeReaderMessage(char *Message); + + +#ifdef __cplusplus +} +#endif + +#endif Added: llvm/trunk/lib/Bitcode/Reader/BitReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitReader.cpp?rev=44824&view=auto ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitReader.cpp (added) +++ llvm/trunk/lib/Bitcode/Reader/BitReader.cpp Mon Dec 10 18:20:48 2007 @@ -0,0 +1,42 @@ +//===-- BitReader.cpp -----------------------------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by Gordon Henriksen and is distributed under the +// University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "llvm-c/BitReader.h" +#include "llvm/Bitcode/ReaderWriter.h" +#include "llvm/Support/MemoryBuffer.h" +#include + +using namespace llvm; + + +int LLVMReadBitcodeFromFile(const char *Path, LLVMModuleRef *OutModule, + char **OutMessage) { + std::string Message; + + MemoryBuffer *buf = MemoryBuffer::getFile(Path, strlen(Path), &Message); + if (!buf) { + if (!OutMessage) + *OutMessage = strdup(Message.c_str()); + return 1; + } + + *OutModule = wrap(ParseBitcodeFile(buf, &Message)); + if (!*OutModule) { + if (OutMessage) + *OutMessage = strdup(Message.c_str()); + return 1; + } + + return 0; +} + +void LLVMDisposeBitcodeReaderMessage(char *Message) { + if (Message) + free(Message); +} Added: llvm/trunk/test/Bindings/Ocaml/bitreader.ml URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/Ocaml/bitreader.ml?rev=44824&view=auto ============================================================================== --- llvm/trunk/test/Bindings/Ocaml/bitreader.ml (added) +++ llvm/trunk/test/Bindings/Ocaml/bitreader.ml Mon Dec 10 18:20:48 2007 @@ -0,0 +1,23 @@ +(* RUN: %ocamlc llvm.cma llvm_bitreader.cma llvm_bitwriter.cma %s -o %t + * RUN: ./%t %t.bc + * RUN: llvm-dis < %t.bc | grep caml_int_ty + *) + +(* Note that this takes a moment to link, so it's best to keep the number of + individual tests low. *) + +let test x = if not x then exit 1 else () + +let _ = + let fn = Sys.argv.(1) in + let m = Llvm.create_module "ocaml_test_module" in + + ignore (Llvm.define_type_name "caml_int_ty" Llvm.i32_type m); + + test (Llvm_bitwriter.write_bitcode_file m fn); + + Llvm.dispose_module m; + + test (match Llvm_bitreader.read_bitcode_file fn with + | Llvm_bitreader.Bitreader_success m -> Llvm.dispose_module m; true + | Llvm_bitreader.Bitreader_failure _ -> false) From sabre at nondot.org Mon Dec 10 18:28:59 2007 From: sabre at nondot.org (Chris Lattner) Date: Tue, 11 Dec 2007 00:28:59 -0000 Subject: [llvm-commits] [llvm] r44825 - in /llvm/trunk: include/llvm/Target/TargetData.h lib/Target/TargetData.cpp Message-ID: <200712110028.lBB0Sxth016975@zion.cs.uiuc.edu> Author: lattner Date: Mon Dec 10 18:28:59 2007 New Revision: 44825 URL: http://llvm.org/viewvc/llvm-project?rev=44825&view=rev Log: Move TargetData::hostIsLittleEndian out of line, which means we don't have to #include config.h in it. #including config.h breaks other projects that have their own autoconf stuff and try to #include the llvm headers. One obscure example is llvm-gcc. 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=44825&r1=44824&r2=44825&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetData.h (original) +++ llvm/trunk/include/llvm/Target/TargetData.h Mon Dec 10 18:28:59 2007 @@ -23,7 +23,6 @@ #include "llvm/Pass.h" #include "llvm/Support/DataTypes.h" #include "llvm/ADT/SmallVector.h" -#include "llvm/Config/config.h" #include namespace llvm { @@ -143,14 +142,8 @@ bool isLittleEndian() const { return LittleEndian; } bool isBigEndian() const { return !LittleEndian; } - /// Host endianness... - bool hostIsLittleEndian() const { -#ifdef LSB_FIRST - return true; -#else - return false; -#endif - } + /// Host endianness. + bool hostIsLittleEndian() const; bool hostIsBigEndian() const { return !hostIsLittleEndian(); } /// getStringRepresentation - Return the string representation of the Modified: llvm/trunk/lib/Target/TargetData.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetData.cpp?rev=44825&r1=44824&r2=44825&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetData.cpp (original) +++ llvm/trunk/lib/Target/TargetData.cpp Mon Dec 10 18:28:59 2007 @@ -25,6 +25,7 @@ #include "llvm/Support/ManagedStatic.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/StringExtras.h" +#include "llvm/Config/config.h" #include #include #include @@ -132,6 +133,14 @@ // TargetData Class Implementation //===----------------------------------------------------------------------===// +bool TargetData::hostIsLittleEndian() const { +#ifdef LSB_FIRST + return true; +#else + return false; +#endif +} + /*! A TargetDescription string consists of a sequence of hyphen-delimited specifiers for target endianness, pointer size and alignments, and various From gordonhenriksen at mac.com Mon Dec 10 18:29:16 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Tue, 11 Dec 2007 00:29:16 -0000 Subject: [llvm-commits] [llvm] r44826 - /llvm/trunk/Xcode/LLVM.xcodeproj/project.pbxproj Message-ID: <200712110029.lBB0TGqG016995@zion.cs.uiuc.edu> Author: gordon Date: Mon Dec 10 18:29:16 2007 New Revision: 44826 URL: http://llvm.org/viewvc/llvm-project?rev=44826&view=rev Log: Project file maintenance. Modified: llvm/trunk/Xcode/LLVM.xcodeproj/project.pbxproj Modified: llvm/trunk/Xcode/LLVM.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Xcode/LLVM.xcodeproj/project.pbxproj?rev=44826&r1=44825&r2=44826&view=diff ============================================================================== --- llvm/trunk/Xcode/LLVM.xcodeproj/project.pbxproj (original) +++ llvm/trunk/Xcode/LLVM.xcodeproj/project.pbxproj Mon Dec 10 18:29:16 2007 @@ -79,6 +79,16 @@ 84115FFF0B66D89B00E1293E /* PPCMachOWriterInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = PPCMachOWriterInfo.cpp; sourceTree = ""; }; 841160000B66D8AC00E1293E /* PPCMachOWriterInfo.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PPCMachOWriterInfo.h; sourceTree = ""; }; 8443EF210B66B62D00959964 /* TargetMachOWriterInfo.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = TargetMachOWriterInfo.h; sourceTree = ""; }; + 9F4B0E5E0D0E02580061F270 /* bitreader_ocaml.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bitreader_ocaml.c; sourceTree = ""; }; + 9F4B0E5F0D0E02580061F270 /* llvm_bitreader.ml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = llvm_bitreader.ml; sourceTree = ""; }; + 9F4B0E600D0E02580061F270 /* llvm_bitreader.mli */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = llvm_bitreader.mli; sourceTree = ""; }; + 9F4B0E8C0D0E05ED0061F270 /* BitReader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BitReader.cpp; sourceTree = ""; }; + 9F4B0E8D0D0E05ED0061F270 /* DeserializeAPFloat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeserializeAPFloat.cpp; sourceTree = ""; }; + 9F5B90CB0D0CE87100CDFDEA /* StringPool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StringPool.cpp; sourceTree = ""; }; + 9F5B90CE0D0CE89300CDFDEA /* AlignOf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AlignOf.h; sourceTree = ""; }; + 9F5B90CF0D0CE89300CDFDEA /* Registry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Registry.h; sourceTree = ""; }; + 9F5B90D00D0CE89300CDFDEA /* StringPool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringPool.h; sourceTree = ""; }; + 9F5B90E70D0DF19100CDFDEA /* BitReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BitReader.h; sourceTree = ""; }; 9F68EB010C77AD02004AA152 /* LoopPass.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = LoopPass.cpp; sourceTree = ""; }; 9F68EB020C77AD02004AA152 /* MemoryDependenceAnalysis.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = MemoryDependenceAnalysis.cpp; sourceTree = ""; }; 9F68EB060C77AD2C004AA152 /* BitcodeReader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = BitcodeReader.cpp; sourceTree = ""; }; @@ -1099,6 +1109,16 @@ name = Products; sourceTree = ""; }; + 9F4B0E5D0D0E02580061F270 /* bitreader */ = { + isa = PBXGroup; + children = ( + 9F4B0E5E0D0E02580061F270 /* bitreader_ocaml.c */, + 9F4B0E5F0D0E02580061F270 /* llvm_bitreader.ml */, + 9F4B0E600D0E02580061F270 /* llvm_bitreader.mli */, + ); + path = bitreader; + sourceTree = ""; + }; 9F68EB030C77AD2C004AA152 /* lib/Bitcode */ = { isa = PBXGroup; children = ( @@ -1112,10 +1132,12 @@ 9F68EB050C77AD2C004AA152 /* Reader */ = { isa = PBXGroup; children = ( - 354CF6D10CD299440059AF3E /* DeserializeAPInt.cpp */, 35A9CDF00CD0F6D5008ABC1D /* Deserialize.cpp */, + 9F4B0E8D0D0E05ED0061F270 /* DeserializeAPFloat.cpp */, + 354CF6D10CD299440059AF3E /* DeserializeAPInt.cpp */, 9F68EB060C77AD2C004AA152 /* BitcodeReader.cpp */, 9F68EB070C77AD2C004AA152 /* BitcodeReader.h */, + 9F4B0E8C0D0E05ED0061F270 /* BitReader.cpp */, ); path = Reader; sourceTree = ""; @@ -1245,6 +1267,7 @@ isa = PBXGroup; children = ( 9F7C240B0CB81ECD00498408 /* analysis */, + 9F4B0E5D0D0E02580061F270 /* bitreader */, 9FD3E5700CA0116100E54D15 /* bitwriter */, 9FD3E57A0CA0116100E54D15 /* llvm */, ); @@ -1287,6 +1310,7 @@ isa = PBXGroup; children = ( 9F7C23E50CB81C2100498408 /* Analysis.h */, + 9F5B90E70D0DF19100CDFDEA /* BitReader.h */, 9FD3E58D0CA0125F00E54D15 /* BitWriter.h */, 9FD3E58E0CA0125F00E54D15 /* Core.h */, CF8F1B490B64F7AB00BB4199 /* LinkTimeOptimizer.h */, @@ -1644,6 +1668,7 @@ DE66EE4408ABEDE600323D32 /* Statistic.cpp */, CF8F1B510B64F86A00BB4199 /* Streams.cpp */, DE66EE4508ABEDE700323D32 /* StringExtras.cpp */, + 9F5B90CB0D0CE87100CDFDEA /* StringPool.cpp */, DE66EE4608ABEDE700323D32 /* SystemUtils.cpp */, DE66EE4708ABEDE700323D32 /* Timer.cpp */, ); @@ -2342,6 +2367,7 @@ isa = PBXGroup; children = ( DE66F27008ABF03200323D32 /* AIXDataTypesFix.h */, + 9F5B90CE0D0CE89300CDFDEA /* AlignOf.h */, CF8F1B430B64F74400BB4199 /* Allocator.h */, DE66F27108ABF03200323D32 /* Annotation.h */, DE66F27208ABF03200323D32 /* CallSite.h */, @@ -2373,9 +2399,11 @@ DE66F28708ABF03200323D32 /* PassNameParser.h */, DE66F28808ABF03200323D32 /* PatternMatch.h */, DE66F28908ABF03200323D32 /* PluginLoader.h */, + 9F5B90CF0D0CE89300CDFDEA /* Registry.h */, DE66F28A08ABF03200323D32 /* SlowOperationInformer.h */, DE66F28B08ABF03200323D32 /* StableBasicBlockNumbering.h */, 9F7794890C73D51000551F9C /* Streams.h */, + 9F5B90D00D0CE89300CDFDEA /* StringPool.h */, DE66F28C08ABF03200323D32 /* SystemUtils.h */, DE66F28E08ABF03200323D32 /* Timer.h */, DE66F29008ABF03200323D32 /* type_traits.h */, From gordonhenriksen at mac.com Mon Dec 10 18:30:17 2007 From: gordonhenriksen at mac.com (Gordon Henriksen) Date: Tue, 11 Dec 2007 00:30:17 -0000 Subject: [llvm-commits] [llvm] r44827 - in /llvm/trunk: docs/GarbageCollection.html include/llvm/CodeGen/Collector.h include/llvm/CodeGen/CollectorMetadata.h include/llvm/CodeGen/Collectors.h include/llvm/CodeGen/Passes.h lib/CodeGen/Collector.cpp lib/CodeGen/CollectorMetadata.cpp Message-ID: <200712110030.lBB0UI17017063@zion.cs.uiuc.edu> Author: gordon Date: Mon Dec 10 18:30:17 2007 New Revision: 44827 URL: http://llvm.org/viewvc/llvm-project?rev=44827&view=rev Log: CollectorMetadata and Collector are rejiggered to get along with per-function collector model. Collector is now the factory for CollectorMetadata, so the latter may be subclassed. Modified: llvm/trunk/docs/GarbageCollection.html llvm/trunk/include/llvm/CodeGen/Collector.h llvm/trunk/include/llvm/CodeGen/CollectorMetadata.h llvm/trunk/include/llvm/CodeGen/Collectors.h llvm/trunk/include/llvm/CodeGen/Passes.h llvm/trunk/lib/CodeGen/Collector.cpp llvm/trunk/lib/CodeGen/CollectorMetadata.cpp Modified: llvm/trunk/docs/GarbageCollection.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/GarbageCollection.html?rev=44827&r1=44826&r2=44827&view=diff ============================================================================== --- llvm/trunk/docs/GarbageCollection.html (original) +++ llvm/trunk/docs/GarbageCollection.html Mon Dec 10 18:30:17 2007 @@ -36,8 +36,10 @@ -
  • Collection intrinsics +
  • Core support
      +
    • Specifying GC code generation: + gc "..."
    • Identifying GC roots on the stack: llvm.gcroot
    • Reading and writing references in the heap @@ -198,11 +200,12 @@
      • Emitting compatible code, including initialization in the main - program.
      • + program if necessary.
      • Loading a compiler plugin if the collector is not statically linked with your compiler. For llc, use the -load option.
      • -
      • Selecting the collection algorithm with llc -gc= or by setting - llvm::TheCollector.
      • +
      • Selecting the collection algorithm by applying the gc "..." + attribute to your garbage collected functions, or equivalently with + the setCollector method.
      • Linking your final executable with the garbage collector runtime.
      @@ -211,7 +214,7 @@ - + @@ -219,7 +222,7 @@ - + @@ -227,7 +230,7 @@ - + @@ -252,11 +255,12 @@
      -

      The ShadowStack collector is invoked with llc -gc=shadow-stack. +

      The ShadowStack backend is invoked with the gc "shadow-stack" +function attribute. Unlike many collectors which rely on a cooperative code generator to generate stack maps, this algorithm carefully maintains a linked list of stack root descriptors [Henderson2002]. This so-called "shadow -stack," mirrors the machine stack. Maintaining this data structure is slower +stack" mirrors the machine stack. Maintaining this data structure is slower than using stack maps, but has a significant portability advantage because it requires no special support from the target code generator.

      @@ -264,7 +268,7 @@ program may use load and store instead of llvm.gcread and llvm.gcwrite.

      -

      The ShadowStack collector is a compiler plugin only. It must be paired with a +

      ShadowStack is a code generator plugin only. It must be paired with a compatible runtime.

      @@ -277,8 +281,7 @@

      The SemiSpace runtime implements with the suggested -runtime interface and is compatible the ShadowStack collector's code -generation.

      +runtime interface and is compatible the ShadowStack backend.

      SemiSpace is a very simple copying collector. When it starts up, it allocates two blocks of memory for the heap. It uses a simple bump-pointer @@ -302,7 +305,8 @@

      -

      The ocaml collector is invoked with llc -gc=ocaml. It supports the +

      The ocaml backend is invoked with the gc "ocaml" function attribute. +It supports the Objective Caml language runtime by emitting a type-accurate stack map in the form of an ocaml 3.10.0-compatible frametable. The linkage requirements are satisfied automatically by the ocamlopt @@ -317,7 +321,7 @@

      @@ -337,6 +341,27 @@ + +
      + define ty @name(...) gc "collector" { ... +
      + +
      + +

      The gc function attribute is used to specify the desired collector +algorithm to the compiler. It is equivalent to specify the collector name +programmatically using the setCollector method of +Function.

      + +

      Specifying the collector on a per-function basis allows LLVM to link together +programs which use different garbage collection algorithms.

      + +
      + + + @@ -591,6 +616,10 @@
      +

      User code specifies which collector plugin to use with the gc +function attribute or, equivalently, with the setCollector method of +Function.

      +

      To implement a collector plugin, it is necessary to subclass llvm::Collector, which can be accomplished in a few lines of boilerplate code. LLVM's infrastructure provides access to several important @@ -616,7 +645,7 @@ }; CollectorRegistry::Add<MyCollector> - X("mygc", "My custom garbage collector."); + X("mygc", "My bespoke garbage collector."); }

      Using the LLVM makefiles (like the -

      - -

      Once the plugin is compiled, user code may be compiled using llc --load=MyGC.so -gc=mygc (though MyGC.so may have some -other platform-specific extension).

      - - -

      To use a collector in a tool other than llc, simply assign a -Collector to the llvm::TheCollector variable:

      +

      Once the plugin is compiled, code using it may be compiled using llc +-load=MyGC.so (though MyGC.so may have some other +platform-specific extension):

      TheCollector = new MyGC();
      - +>$ cat sample.ll +define void @f() gc "mygc" { +entry: + ret void +} +$ llvm-as < sample.ll | llc -load=MyGC.so + +

      It is also possible to statically link the collector plugin into tools, such +as a language-specific compiler front-end.

      @@ -956,15 +985,18 @@
      CollectorMetadata &MD = ...;
      -unsigned FrameSize = MD.getFrameSize();
      -size_t RootCount = MD.roots_size();
      -
      -for (CollectorMetadata::roots_iterator RI = MD.roots_begin(),
      -                                       RE = MD.roots_end(); RI != RE; ++RI) {
      -  int RootNum = RI->Num;
      -  int RootStackOffset = RI->StackOffset;
      -  Constant *RootMetadata = RI->Metadata;
      +>for (iterator I = begin(), E = end(); I != E; ++I) {
      +  CollectorMetadata *MD = *I;
      +  unsigned FrameSize = MD->getFrameSize();
      +  size_t RootCount = MD->roots_size();
      +
      +  for (CollectorMetadata::roots_iterator RI = MD->roots_begin(),
      +                                         RE = MD->roots_end();
      +                                         RI != RE; ++RI) {
      +    int RootNum = RI->Num;
      +    int RootStackOffset = RI->StackOffset;
      +    Constant *RootMetadata = RI->Metadata;
      +  }
       }

      LLVM automatically computes a stack map. All a Collector needs to do @@ -1021,10 +1053,8 @@ CustomWriteBarriers = true; } -protected: - virtual Pass *createCustomLoweringPass() const { - return new MyGCLoweringFunctionPass(); - } + virtual bool initializeCustomLowering(Module &M); + virtual bool performCustomLowering(Function &F); };

      If any of these flags are set, then LLVM suppresses its default lowering for @@ -1041,56 +1071,53 @@

      If CustomReadBarriers or CustomWriteBarriers are specified, -the custom lowering pass must eliminate the corresponding -barriers.

      +then performCustomLowering must eliminate the +corresponding barriers.

      -

      This template can be used as a starting point for a lowering pass:

      +

      performCustomLowering, must comply with the same restrictions as runOnFunction, and +that initializeCustomLowering has the same semantics as doInitialization(Module +&).

      + +

      The following can be used as a template:

      #include "llvm/Function.h"
      -#include "llvm/Module.h"
      +>#include "llvm/Module.h"
       #include "llvm/Instructions.h"
       
      -namespace {
      -  class VISIBILITY_HIDDEN MyGCLoweringFunctionPass : public FunctionPass {
      -    static char ID;
      -  public:
      -    MyGCLoweringFunctionPass() : FunctionPass(intptr_t(&ID)) {}
      -    
      -    const char *getPassName() const { return "Lower GC Intrinsics"; }
      -    
      -    bool runOnFunction(Function &F) {
      -      Module *M = F.getParent();
      -      
      -      Function *GCReadInt  = M->getFunction("llvm.gcread"),
      -               *GCWriteInt = M->getFunction("llvm.gcwrite"),
      -               *GCRootInt  = M->getFunction("llvm.gcroot");
      -      
      -      bool MadeChange = false;
      -      
      -      for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
      -        for (BasicBlock::iterator II = BB->begin(), E = BB->end(); II != E;)
      -          if (CallInst *CI = dyn_cast<CallInst>(II++))
      -            if (Function *F = CI->getCalledFunction())
      -              if (F == GCWriteInt) {
      -                // Handle llvm.gcwrite.
      -                CI->eraseFromParent();
      -                MadeChange = true;
      -              } else if (F == GCReadInt) {
      -                // Handle llvm.gcread.
      -                CI->eraseFromParent();
      -                MadeChange = true;
      -              } else if (F == GCRootInt) {
      -                // Handle llvm.gcroot.
      -                CI->eraseFromParent();
      -                MadeChange = true;
      -              }
      -      
      -      return MadeChange;
      -    }
      -  };
      +bool MyCollector::initializeCustomLowering(Module &M) {
      +  return false;
      +}
       
      -  char MyGCLoweringFunctionPass::ID = 0;
      +bool MyCollector::performCustomLowering(Function &F) {
      +  const Module *M = F.getParent();
      +  
      +  Function *GCReadInt  = M->getFunction("llvm.gcread"),
      +           *GCWriteInt = M->getFunction("llvm.gcwrite"),
      +           *GCRootInt  = M->getFunction("llvm.gcroot");
      +  
      +  bool MadeChange = false;
      +  
      +  for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
      +    for (BasicBlock::iterator II = BB->begin(), E = BB->end(); II != E;)
      +      if (CallInst *CI = dyn_cast<CallInst>(II++))
      +        if (Function *F = CI->getCalledFunction())
      +          if (F == GCWriteInt) {
      +            // Handle llvm.gcwrite.
      +            CI->eraseFromParent();
      +            MadeChange = true;
      +          } else if (F == GCReadInt) {
      +            // Handle llvm.gcread.
      +            CI->eraseFromParent();
      +            MadeChange = true;
      +          } else if (F == GCRootInt) {
      +            // Handle llvm.gcroot.
      +            CI->eraseFromParent();
      +            MadeChange = true;
      +          }
      +  
      +  return MadeChange;
       }
      @@ -1130,15 +1157,18 @@

      It can then use the following routines to access safe points.

      -
      -CollectorMetadata &MD = ...;
      -size_t PointCount = MD.size();
      -
      -for (CollectorMetadata::iterator PI = MD.begin(),
      -                                 PE = MD.end(); PI != PE; ++PI) {
      -  GC::PointKind PointKind = PI->Kind;
      -  unsigned PointNum = PI->Num;
      -}
      +
      for (iterator I = begin(), E = end(); I != E; ++I) {
      +  CollectorMetadata *MD = *I;
      +  size_t PointCount = MD->size();
      +
      +  for (CollectorMetadata::iterator PI = MD->begin(),
      +                                   PE = MD->end(); PI != PE; ++PI) {
      +    GC::PointKind PointKind = PI->Kind;
      +    unsigned PointNum = PI->Num;
      +  }
      +}
      +

      Almost every collector requires PostCall safe points, since these correspond to the moments when the function is suspended during a call to a @@ -1167,40 +1197,45 @@

      LLVM allows a collector to print arbitrary assembly code before and after the rest of a module's assembly code. From the latter callback, the collector -can print stack maps from CollectorModuleMetadata populated by the code -generator.

      +can print stack maps built by the code generator.

      -

      Note that LLVM does not currently support garbage collection code generation -in the JIT, nor using the object writers.

      +

      Note that LLVM does not currently have analogous APIs to support code +generation in the JIT, nor using the object writers.

      class MyCollector : public Collector {
      -  virtual void beginAssembly(Module &M, std::ostream &OS, AsmPrinter &AP,
      -                             const TargetAsmInfo &TAI) const;
      +public:
      +  virtual void beginAssembly(std::ostream &OS, AsmPrinter &AP,
      +                             const TargetAsmInfo &TAI);
       
      -  virtual void finishAssembly(Module &M, CollectorModuleMetadata &MMD,
      -                              std::ostream &OS, AsmPrinter &AP,
      -                              const TargetAsmInfo &TAI) const;
      +  virtual void finishAssembly(std::ostream &OS, AsmPrinter &AP,
      +                              const TargetAsmInfo &TAI);
       }

      The collector should use AsmPrinter and TargetAsmInfo to -print portable assembly code to the std::ostream. The collector may -access the stack maps for the entire module using the methods of -CollectorModuleMetadata. Here's a realistic example:

      +print portable assembly code to the std::ostream. The collector itself +contains the stack map for the entire module, and may access the +CollectorMetadata using its own begin() and end() +methods. Here's a realistic example:

      #include "llvm/CodeGen/AsmPrinter.h"
       #include "llvm/Function.h"
      +#include "llvm/Target/TargetMachine.h"
      +#include "llvm/Target/TargetData.h"
       #include "llvm/Target/TargetAsmInfo.h"
       
      -void MyCollector::finishAssembly(Module &M,
      -                                 CollectorModuleMetadata &MMD,
      -                                 std::ostream &OS, AsmPrinter &AP,
      -                                 const TargetAsmInfo &TAI) const {
      +void MyCollector::beginAssembly(std::ostream &OS, AsmPrinter &AP,
      +                                const TargetAsmInfo &TAI) {
      +  // Nothing to do.
      +}
      +
      +void MyCollector::finishAssembly(std::ostream &OS, AsmPrinter &AP,
      +                                 const TargetAsmInfo &TAI) {
         // Set up for emitting addresses.
         const char *AddressDirective;
         int AddressAlignLog;
      -  if (TAI.getAddressSize() == sizeof(int32_t)) {
      +  if (AP.TM.getTargetData()->getPointerSize() == sizeof(int32_t)) {
           AddressDirective = TAI.getData32bitsDirective();
           AddressAlignLog = 2;
         } else {
      @@ -1212,8 +1247,7 @@
         AP.SwitchToDataSection(TAI.getDataSection());
         
         // For each function...
      -  for (CollectorModuleMetadata::iterator FI = MMD.begin(),
      -                                         FE = MMD.end(); FI != FE; ++FI) {
      +  for (iterator FI = begin(), FE = end(); FI != FE; ++FI) {
           CollectorMetadata &MD = **FI;
           
           // Emit this data structure:
      
      Modified: llvm/trunk/include/llvm/CodeGen/Collector.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/Collector.h?rev=44827&r1=44826&r2=44827&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/CodeGen/Collector.h (original)
      +++ llvm/trunk/include/llvm/CodeGen/Collector.h Mon Dec 10 18:30:17 2007
      @@ -7,7 +7,7 @@
       //
       //===----------------------------------------------------------------------===//
       //
      -// GCInfo records sufficient information about a machine function to enable
      +// Collector records sufficient information about a machine function to enable
       // accurate garbage collectors. Specifically:
       // 
       // - Safe points
      @@ -25,8 +25,8 @@
       // This generic information should used by ABI-specific passes to emit support
       // tables for the runtime garbage collector.
       //
      -// GCSafePointPass identifies the GC safe points in the machine code. (Roots are
      -// identified in SelectionDAGISel.)
      +// MachineCodeAnalysis identifies the GC safe points in the machine code. (Roots
      +// are identified in SelectionDAGISel.)
       //
       //===----------------------------------------------------------------------===//
       
      @@ -35,19 +35,25 @@
       
       #include "llvm/CodeGen/CollectorMetadata.h"
       #include 
      +#include 
       
       namespace llvm {
         
      -  class AsmPrinter;
      -  class FunctionPassManager;
      -  class PassManager;
      -  class TargetAsmInfo;
      -  
      -  
         /// Collector describes a garbage collector's code generation requirements,
         /// and provides overridable hooks for those needs which cannot be abstractly
         /// described.
         class Collector {
      +  public:
      +    typedef std::vector list_type;
      +    typedef list_type::iterator iterator;
      +    
      +  private:
      +    friend class CollectorModuleMetadata;
      +    const Module *M;
      +    std::string Name;
      +    
      +    list_type Functions;
      +    
         protected:
           unsigned NeededSafePoints; //< Bitmask of required safe points.
           bool CustomReadBarriers;   //< Default is to insert loads.
      @@ -55,16 +61,20 @@
           bool CustomRoots;          //< Default is to pass through to backend.
           bool InitRoots;            //< If set, roots are nulled during lowering.
           
      -    /// If any of the actions are set to Custom, this is expected to be
      -    /// overriden to create a transform to lower those actions to LLVM IR.
      -    virtual Pass *createCustomLoweringPass() const;
      -    
         public:
           Collector();
           
           virtual ~Collector();
           
           
      +    /// getName - The name of the collector, for debugging.
      +    /// 
      +    const std::string &getName() const { return Name; }
      +
      +    /// getModule - The module upon which the collector is operating.
      +    /// 
      +    const Module &getModule() const { return *M; }
      +
           /// True if this collector requires safe points of any kind. By default,
           /// none are recorded.
           bool needsSafePoints() const { return NeededSafePoints != 0; }
      @@ -94,40 +104,30 @@
           bool initializeRoots() const { return InitRoots; }
           
           
      -    /// Adds LLVM IR transforms to handle collection intrinsics. By default,
      -    /// read- and write barriers are replaced with direct memory accesses, and
      -    /// roots are passed on to the code generator.
      -    void addLoweringPasses(FunctionPassManager &PM) const;
      -    
      -    /// Same as addLoweringPasses(FunctionPassManager &), except uses a
      -    /// PassManager for compatibility with unusual backends (such as MSIL or
      -    /// CBackend).
      -    void addLoweringPasses(PassManager &PM) const;
      -    
      -    /// Adds target-independent MachineFunction pass to mark safe points. This 
      -    /// is added very late during code generation, just prior to output, and
      -    /// importantly after all CFG transformations (like branch folding).
      -    void addGenericMachineCodePass(FunctionPassManager &PM,
      -                                   const TargetMachine &TM, bool Fast) const;
      -    
           /// beginAssembly/finishAssembly - Emit module metadata as assembly code.
      -    virtual void beginAssembly(Module &M, std::ostream &OS, AsmPrinter &AP,
      -                               const TargetAsmInfo &TAI) const;
      -    virtual void finishAssembly(Module &M, CollectorModuleMetadata &CMM,
      -                                std::ostream &OS, AsmPrinter &AP,
      -                                const TargetAsmInfo &TAI) const;
      -    
      -  private:
      -    bool NeedsDefaultLoweringPass() const;
      -    bool NeedsCustomLoweringPass() const;
      -    
      +    virtual void beginAssembly(std::ostream &OS, AsmPrinter &AP,
      +                               const TargetAsmInfo &TAI);
      +    virtual void finishAssembly(std::ostream &OS, AsmPrinter &AP,
      +                                const TargetAsmInfo &TAI);
      +    
      +    /// begin/end - Iterators for function metadata.
      +    /// 
      +    iterator begin() { return Functions.begin(); }
      +    iterator end()   { return Functions.end();   }
      +
      +    /// insertFunctionMetadata - Creates metadata for a function.
      +    /// 
      +    CollectorMetadata *insertFunctionMetadata(const Function &F);
      +
      +    /// initializeCustomLowering/performCustomLowering - If any of the actions
      +    /// are set to custom, performCustomLowering must be overriden to create a
      +    /// transform to lower those actions to LLVM IR. initializeCustomLowering
      +    /// is optional to override. These are the only Collector methods through
      +    /// which the LLVM IR can be modified.
      +    virtual bool initializeCustomLowering(Module &F);
      +    virtual bool performCustomLowering(Function &F);
         };
         
      -  
      -  /// If set, the code generator should generate garbage collection as specified
      -  /// by the collector properties.
      -  extern const Collector *TheCollector;  // FIXME: Find a better home!
      -  
       }
       
       #endif
      
      Modified: llvm/trunk/include/llvm/CodeGen/CollectorMetadata.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/CollectorMetadata.h?rev=44827&r1=44826&r2=44827&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/CodeGen/CollectorMetadata.h (original)
      +++ llvm/trunk/include/llvm/CodeGen/CollectorMetadata.h Mon Dec 10 18:30:17 2007
      @@ -9,7 +9,7 @@
       //
       // This file declares the CollectorMetadata and CollectorModuleMetadata classes,
       // which are used as a communication channel from the target code generator
      -// to the target garbage collector. This interface allows code generators and
      +// to the target garbage collectors. This interface allows code generators and
       // garbage collectors to be developed independently.
       //
       // The CollectorMetadata class records the data necessary to build a type
      @@ -37,19 +37,14 @@
       
       #include "llvm/Pass.h"
       #include "llvm/ADT/DenseMap.h"
      +#include "llvm/ADT/StringMap.h"
       
       namespace llvm {
         
      +  class AsmPrinter;
      +  class Collector;
         class Constant;
      -  
      -  
      -  /// Creates a pass to print collector metadata.
      -  /// 
      -  Pass *createCollectorMetadataPrinter(std::ostream &OS);
      -  
      -  /// Creates a pass to destroy collector metadata.
      -  /// 
      -  Pass *createCollectorMetadataDeleter();
      +  class TargetAsmInfo;
         
         
         namespace GC {
      @@ -77,7 +72,7 @@
         struct GCRoot {
           int Num;            //< Usually a frame index.
           int StackOffset;    //< Offset from the stack pointer.
      -    Constant *Metadata; //< From the call to llvm.gcroot.
      +    Constant *Metadata; //< Metadata straight from the call to llvm.gcroot.
           
           GCRoot(int N, Constant *MD) : Num(N), StackOffset(-1), Metadata(MD) {}
         };
      @@ -93,6 +88,7 @@
           
         private:
           const Function &F;
      +    Collector &C;
           uint64_t FrameSize;
           std::vector Roots;
           std::vector SafePoints;
      @@ -107,14 +103,18 @@
           // The bit vector is the more compact representation where >3.2% of roots
           // are live per safe point (1.5% on 64-bit hosts).
           
      -    friend class CollectorModuleMetadata;
      -    CollectorMetadata(const Function &F);
      -    
         public:
      +    CollectorMetadata(const Function &F, Collector &C);
           ~CollectorMetadata();
           
      +    /// getFunction - Return the function to which this metadata applies.
      +    /// 
           const Function &getFunction() const { return F; }
           
      +    /// getCollector - Return the collector for the function.
      +    /// 
      +    Collector &getCollector() { return C; }
      +    
           /// addStackRoot - Registers a root that lives on the stack. Num is the
           /// stack object ID for the alloca (if the code generator is using 
           /// MachineFrameInfo).
      @@ -157,37 +157,36 @@
         /// CollectorModuleMetadata - Garbage collection metadata for a whole module.
         /// 
         class CollectorModuleMetadata : public ImmutablePass {
      -    typedef std::vector list_type;
      -    typedef DenseMap map_type;
      +    typedef StringMap collector_map_type;
      +    typedef std::vector list_type;
      +    typedef DenseMap function_map_type;
      +    
      +    collector_map_type NameMap;
      +    list_type Collectors;
      +    function_map_type Map;
           
      -    Module *Mod;
      -    list_type Functions;
      -    map_type Map;
      +    Collector *getOrCreateCollector(const Module *M, const std::string &Name);
           
         public:
      -    typedef list_type::iterator iterator;
      +    typedef list_type::const_iterator iterator;
           
           static char ID;
           
           CollectorModuleMetadata();
           ~CollectorModuleMetadata();
           
      -    /// clear - Used to delete module metadata. Collector invokes this as
      -    /// necessary.
      +    /// clear - Used to delete module metadata. The metadata deleter pass calls
      +    /// this.
           void clear();
           
      -    /// begin/end - Iterators for function metadata.
      -    /// 
      -    iterator begin() { return Functions.begin(); }
      -    iterator end()   { return Functions.end();   }
      -    
      -    /// insert - Creates metadata for a function.
      +    /// begin/end - Iterators for collectors.
           /// 
      -    CollectorMetadata& insert(const Function *F);
      +    iterator begin() const { return Collectors.begin(); }
      +    iterator end()   const { return Collectors.end();   }
           
      -    /// get - Looks up existing function metadata.
      +    /// get - Look up function metadata.
           /// 
      -    CollectorMetadata* get(const Function *F) const;
      +    CollectorMetadata &get(const Function &F);
         };
         
       }
      
      Modified: llvm/trunk/include/llvm/CodeGen/Collectors.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/Collectors.h?rev=44827&r1=44826&r2=44827&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/CodeGen/Collectors.h (original)
      +++ llvm/trunk/include/llvm/CodeGen/Collectors.h Mon Dec 10 18:30:17 2007
      @@ -25,6 +25,9 @@
         /// 
         typedef Registry CollectorRegistry;
         
      +  /// FIXME: Collector instances are not useful on their own. These no longer
      +  ///        serve any purpose except to link in the plugins.
      +  
         /// Creates an ocaml-compatible garbage collector.
         Collector *createOcamlCollector();
         
      
      Modified: llvm/trunk/include/llvm/CodeGen/Passes.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/Passes.h?rev=44827&r1=44826&r2=44827&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/CodeGen/Passes.h (original)
      +++ llvm/trunk/include/llvm/CodeGen/Passes.h Mon Dec 10 18:30:17 2007
      @@ -135,6 +135,24 @@
         /// for the Sparc.
         FunctionPass *getRegisterAllocator(TargetMachine &T);
       
      +  /// IntrinsicLowering Pass - Performs target-independent LLVM IR
      +  /// transformations for highly portable collectors.
      +  FunctionPass *createGCLoweringPass();
      +  
      +  /// MachineCodeAnalysis Pass - Target-independent pass to mark safe points in
      +  /// machine code. Must be added very late during code generation, just prior
      +  /// to output, and importantly after all CFG transformations (such as branch
      +  /// folding).
      +  FunctionPass *createGCMachineCodeAnalysisPass();
      +  
      +  /// Deleter Pass - Releases collector metadata.
      +  /// 
      +  FunctionPass *createCollectorMetadataDeleter();
      +  
      +  /// Creates a pass to print collector metadata.
      +  /// 
      +  FunctionPass *createCollectorMetadataPrinter(std::ostream &OS);
      +  
         /// createMachineLICMPass - This pass performs LICM on machine instructions.
         /// 
         FunctionPass *createMachineLICMPass();
      
      Modified: llvm/trunk/lib/CodeGen/Collector.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/Collector.cpp?rev=44827&r1=44826&r2=44827&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/Collector.cpp (original)
      +++ llvm/trunk/lib/CodeGen/Collector.cpp Mon Dec 10 18:30:17 2007
      @@ -13,6 +13,7 @@
       //===----------------------------------------------------------------------===//
       
       #include "llvm/CodeGen/Collector.h"
      +#include "llvm/CodeGen/Passes.h"
       #include "llvm/IntrinsicInst.h"
       #include "llvm/Module.h"
       #include "llvm/PassManager.h"
      @@ -29,38 +30,40 @@
       
       namespace {
         
      -  /// This pass rewrites calls to the llvm.gcread or llvm.gcwrite intrinsics,
      -  /// replacing them with simple loads and stores as directed by the Collector.
      -  /// This is useful for most garbage collectors.
      +  /// LowerIntrinsics - This pass rewrites calls to the llvm.gcread or
      +  /// llvm.gcwrite intrinsics, replacing them with simple loads and stores as 
      +  /// directed by the Collector. It also performs automatic root initialization
      +  /// and custom intrinsic lowering.
         class VISIBILITY_HIDDEN LowerIntrinsics : public FunctionPass {
      -    const Collector &Coll;
      -    
           /// GCRootInt, GCReadInt, GCWriteInt - The function prototypes for the
           /// llvm.gc* intrinsics.
           Function *GCRootInt, *GCReadInt, *GCWriteInt;
           
      +    static bool NeedsDefaultLoweringPass(const Collector &C);
      +    static bool NeedsCustomLoweringPass(const Collector &C);
           static bool CouldBecomeSafePoint(Instruction *I);
      -    static void InsertRootInitializers(Function &F,
      +    bool PerformDefaultLowering(Function &F, Collector &Coll);
      +    static bool InsertRootInitializers(Function &F,
                                              AllocaInst **Roots, unsigned Count);
           
         public:
           static char ID;
           
      -    LowerIntrinsics(const Collector &GC);
      +    LowerIntrinsics();
           const char *getPassName() const;
      +    void getAnalysisUsage(AnalysisUsage &AU) const;
           
           bool doInitialization(Module &M);
           bool runOnFunction(Function &F);
         };
         
         
      -  /// This is a target-independent pass over the machine function representation
      -  /// to identify safe points for the garbage collector in the machine code. It 
      -  /// inserts labels at safe points and populates the GCInfo class.
      +  /// MachineCodeAnalysis - This is a target-independent pass over the machine 
      +  /// function representation to identify safe points for the garbage collector
      +  /// in the machine code. It inserts labels at safe points and populates a
      +  /// CollectorMetadata record for each function.
         class VISIBILITY_HIDDEN MachineCodeAnalysis : public MachineFunctionPass {
      -    const Collector &Coll;
      -    const TargetMachine &Targ;
      -    
      +    const TargetMachine *TM;
           CollectorMetadata *MD;
           MachineModuleInfo *MMI;
           const TargetInstrInfo *TII;
      @@ -76,7 +79,7 @@
         public:
           static char ID;
           
      -    MachineCodeAnalysis(const Collector &C, const TargetMachine &T);
      +    MachineCodeAnalysis();
           const char *getPassName() const;
           void getAnalysisUsage(AnalysisUsage &AU) const;
           
      @@ -87,8 +90,6 @@
       
       // -----------------------------------------------------------------------------
       
      -const Collector *llvm::TheCollector = 0;
      -
       Collector::Collector() :
         NeededSafePoints(0),
         CustomReadBarriers(false),
      @@ -97,85 +98,85 @@
         InitRoots(true)
       {}
       
      -Collector::~Collector() {}
      -
      -void Collector::addLoweringPasses(FunctionPassManager &PM) const {
      -  if (NeedsDefaultLoweringPass())
      -    PM.add(new LowerIntrinsics(*this));
      -
      -  if (NeedsCustomLoweringPass())
      -    PM.add(createCustomLoweringPass());
      -}
      -
      -void Collector::addLoweringPasses(PassManager &PM) const {
      -  if (NeedsDefaultLoweringPass())
      -    PM.add(new LowerIntrinsics(*this));
      -
      -  if (NeedsCustomLoweringPass())
      -    PM.add(createCustomLoweringPass());
      -}
      -
      -void Collector::addGenericMachineCodePass(FunctionPassManager &PM,
      -                                          const TargetMachine &TM,
      -                                          bool Fast) const {
      -  if (needsSafePoints())
      -    PM.add(new MachineCodeAnalysis(*this, TM));
      -}
      -
      -bool Collector::NeedsDefaultLoweringPass() const {
      -  // Default lowering is necessary only if read or write barriers have a default
      -  // action. The default for roots is no action.
      -  return !customWriteBarrier()
      -      || !customReadBarrier()
      -      || initializeRoots();
      -}
      -
      -bool Collector::NeedsCustomLoweringPass() const {
      -  // Custom lowering is only necessary if enabled for some action.
      -  return customWriteBarrier()
      -      || customReadBarrier()
      -      || customRoots();
      -}
      -
      -Pass *Collector::createCustomLoweringPass() const {
      -  cerr << "Collector must override createCustomLoweringPass.\n";
      +Collector::~Collector() {
      +  for (iterator I = begin(), E = end(); I != E; ++I)
      +    delete *I;
      +  
      +  Functions.clear();
      +}
      + 
      +bool Collector::initializeCustomLowering(Module &M) { return false; }
      + 
      +bool Collector::performCustomLowering(Function &F) {
      +  cerr << "gc " << getName() << " must override performCustomLowering.\n";
         abort();
         return 0;
       }
           
      -void Collector::beginAssembly(Module &M, std::ostream &OS, AsmPrinter &AP,
      -                              const TargetAsmInfo &TAI) const {
      +void Collector::beginAssembly(std::ostream &OS, AsmPrinter &AP,
      +                              const TargetAsmInfo &TAI) {
         // Default is no action.
       }
           
      -void Collector::finishAssembly(Module &M, CollectorModuleMetadata &CMM,
      -                               std::ostream &OS, AsmPrinter &AP,
      -                               const TargetAsmInfo &TAI) const {
      +void Collector::finishAssembly(std::ostream &OS, AsmPrinter &AP,
      +                               const TargetAsmInfo &TAI) {
         // Default is no action.
       }
      + 
      +CollectorMetadata *Collector::insertFunctionMetadata(const Function &F) {
      +  CollectorMetadata *CM = new CollectorMetadata(F, *this);
      +  Functions.push_back(CM);
      +  return CM;
      +} 
       
       // -----------------------------------------------------------------------------
       
      +FunctionPass *llvm::createGCLoweringPass() {
      +  return new LowerIntrinsics();
      +}
      + 
       char LowerIntrinsics::ID = 0;
       
      -LowerIntrinsics::LowerIntrinsics(const Collector &C)
      -  : FunctionPass((intptr_t)&ID), Coll(C),
      +LowerIntrinsics::LowerIntrinsics()
      +  : FunctionPass((intptr_t)&ID),
           GCRootInt(0), GCReadInt(0), GCWriteInt(0) {}
       
       const char *LowerIntrinsics::getPassName() const {
         return "Lower Garbage Collection Instructions";
       }
           
      -/// doInitialization - If this module uses the GC intrinsics, find them now. If
      -/// not, this pass does not do anything.
      +void LowerIntrinsics::getAnalysisUsage(AnalysisUsage &AU) const {
      +  FunctionPass::getAnalysisUsage(AU);
      +  AU.addRequired();
      +}
      +
      +/// doInitialization - If this module uses the GC intrinsics, find them now.
       bool LowerIntrinsics::doInitialization(Module &M) {
         GCReadInt  = M.getFunction("llvm.gcread");
         GCWriteInt = M.getFunction("llvm.gcwrite");
         GCRootInt  = M.getFunction("llvm.gcroot");
      -  return false;
      +  
      +  // FIXME: This is rather antisocial in the context of a JIT since it performs
      +  //        work against the entire module. But this cannot be done at
      +  //        runFunction time (initializeCustomLowering likely needs to change
      +  //        the module).
      +  CollectorModuleMetadata *CMM = getAnalysisToUpdate();
      +  assert(CMM && "LowerIntrinsics didn't require CollectorModuleMetadata!?");
      +  for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
      +    if (I->hasCollector())
      +      CMM->get(*I); // Instantiate the Collector.
      +  
      +  bool MadeChange = false;
      +  for (CollectorModuleMetadata::iterator I = CMM->begin(),
      +                                         E = CMM->end(); I != E; ++I)
      +    if (NeedsCustomLoweringPass(**I))
      +      if ((*I)->initializeCustomLowering(M))
      +        MadeChange = true;
      +  
      +  return MadeChange;
       }
       
      -void LowerIntrinsics::InsertRootInitializers(Function &F, AllocaInst **Roots, 
      +bool LowerIntrinsics::InsertRootInitializers(Function &F, AllocaInst **Roots, 
                                                                 unsigned Count) {
         // Scroll past alloca instructions.
         BasicBlock::iterator IP = F.getEntryBlock().begin();
      @@ -190,11 +191,32 @@
               InitedRoots.insert(AI);
         
         // Add root initializers.
      +  bool MadeChange = false;
      +  
         for (AllocaInst **I = Roots, **E = Roots + Count; I != E; ++I)
      -    if (!InitedRoots.count(*I))
      +    if (!InitedRoots.count(*I)) {
             new StoreInst(ConstantPointerNull::get(cast(
                             cast((*I)->getType())->getElementType())),
                           *I, IP);
      +      MadeChange = true;
      +    }
      +  
      +  return MadeChange;
      +}
      +
      +bool LowerIntrinsics::NeedsDefaultLoweringPass(const Collector &C) {
      +  // Default lowering is necessary only if read or write barriers have a default
      +  // action. The default for roots is no action.
      +  return !C.customWriteBarrier()
      +      || !C.customReadBarrier()
      +      || C.initializeRoots();
      +}
      +
      +bool LowerIntrinsics::NeedsCustomLoweringPass(const Collector &C) {
      +  // Custom lowering is only necessary if enabled for some action.
      +  return C.customWriteBarrier()
      +      || C.customReadBarrier()
      +      || C.customRoots();
       }
       
       /// CouldBecomeSafePoint - Predicate to conservatively determine whether the
      @@ -228,9 +250,24 @@
       /// runOnFunction - Replace gcread/gcwrite intrinsics with loads and stores.
       /// Leave gcroot intrinsics; the code generator needs to see those.
       bool LowerIntrinsics::runOnFunction(Function &F) {
      -  // Quick exit for programs that do not declare the intrinsics.
      -  if (!GCReadInt && !GCWriteInt && !GCRootInt) return false;
      +  // Quick exit for functions that do not use GC.
      +  if (!F.hasCollector()) return false;
      +  
      +  CollectorMetadata &MD = getAnalysis().get(F);
      +  Collector &Coll = MD.getCollector();
      +  
      +  bool MadeChange = false;
      +  
      +  if (NeedsDefaultLoweringPass(Coll))
      +    MadeChange |= PerformDefaultLowering(F, Coll);
      +  
      +  if (NeedsCustomLoweringPass(Coll))
      +    MadeChange |= Coll.performCustomLowering(F);
         
      +  return MadeChange;
      +}
      +
      +bool LowerIntrinsics::PerformDefaultLowering(Function &F, Collector &Coll) {
         bool LowerWr = !Coll.customWriteBarrier();
         bool LowerRd = !Coll.customReadBarrier();
         bool InitRoots = Coll.initializeRoots();
      @@ -268,17 +305,21 @@
         }
         
         if (Roots.size())
      -    InsertRootInitializers(F, Roots.begin(), Roots.size());
      +    MadeChange |= InsertRootInitializers(F, Roots.begin(), Roots.size());
         
         return MadeChange;
       }
       
       // -----------------------------------------------------------------------------
       
      +FunctionPass *llvm::createGCMachineCodeAnalysisPass() {
      +  return new MachineCodeAnalysis();
      +}
      +
       char MachineCodeAnalysis::ID = 0;
       
      -MachineCodeAnalysis::MachineCodeAnalysis(const Collector &C, const TargetMachine &T)
      -  : MachineFunctionPass(intptr_t(&ID)), Coll(C), Targ(T) {}
      +MachineCodeAnalysis::MachineCodeAnalysis()
      +  : MachineFunctionPass(intptr_t(&ID)) {}
       
       const char *MachineCodeAnalysis::getPassName() const {
         return "Analyze Machine Code For Garbage Collection";
      @@ -304,10 +345,10 @@
         MachineBasicBlock::iterator RAI = CI; 
         ++RAI;                                
         
      -  if (Coll.needsSafePoint(GC::PreCall))
      +  if (MD->getCollector().needsSafePoint(GC::PreCall))
           MD->addSafePoint(GC::PreCall, InsertLabel(*CI->getParent(), CI));
         
      -  if (Coll.needsSafePoint(GC::PostCall))
      +  if (MD->getCollector().needsSafePoint(GC::PostCall))
           MD->addSafePoint(GC::PostCall, InsertLabel(*CI->getParent(), RAI));
       }
       
      @@ -323,7 +364,7 @@
       void MachineCodeAnalysis::FindStackOffsets(MachineFunction &MF) {
         uint64_t StackSize = MFI->getStackSize();
         uint64_t OffsetAdjustment = MFI->getOffsetAdjustment();
      -  uint64_t OffsetOfLocalArea = Targ.getFrameInfo()->getOffsetOfLocalArea();
      +  uint64_t OffsetOfLocalArea = TM->getFrameInfo()->getOffsetOfLocalArea();
         
         for (CollectorMetadata::roots_iterator RI = MD->roots_begin(),
                                                RE = MD->roots_end(); RI != RE; ++RI)
      @@ -332,12 +373,16 @@
       }
       
       bool MachineCodeAnalysis::runOnMachineFunction(MachineFunction &MF) {
      -  if (!Coll.needsSafePoints())
      +  // Quick exit for functions that do not use GC.
      +  if (!MF.getFunction()->hasCollector()) return false;
      +  
      +  MD = &getAnalysis().get(*MF.getFunction());
      +  if (!MD->getCollector().needsSafePoints())
           return false;
         
      -  MD = getAnalysis().get(MF.getFunction());
      +  TM = &MF.getTarget();
         MMI = &getAnalysis();
      -  TII = MF.getTarget().getInstrInfo();
      +  TII = TM->getInstrInfo();
         MFI = MF.getFrameInfo();
         
         // Find the size of the stack frame.
      
      Modified: llvm/trunk/lib/CodeGen/CollectorMetadata.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CollectorMetadata.cpp?rev=44827&r1=44826&r2=44827&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/CollectorMetadata.cpp (original)
      +++ llvm/trunk/lib/CodeGen/CollectorMetadata.cpp Mon Dec 10 18:30:17 2007
      @@ -13,8 +13,11 @@
       //===----------------------------------------------------------------------===//
       
       #include "llvm/CodeGen/CollectorMetadata.h"
      +#include "llvm/CodeGen/Collector.h"
      +#include "llvm/CodeGen/Collectors.h"
       #include "llvm/CodeGen/MachineFrameInfo.h"
      -#include "llvm/CodeGen/MachineFunctionPass.h"
      +#include "llvm/Pass.h"
      +#include "llvm/CodeGen/Passes.h"
       #include "llvm/Function.h"
       #include "llvm/Support/Compiler.h"
       
      @@ -22,7 +25,7 @@
       
       namespace {
         
      -  class VISIBILITY_HIDDEN Printer : public MachineFunctionPass {
      +  class VISIBILITY_HIDDEN Printer : public FunctionPass {
           static char ID;
           std::ostream &OS;
           
      @@ -32,10 +35,10 @@
           const char *getPassName() const;
           void getAnalysisUsage(AnalysisUsage &AU) const;
           
      -    bool runOnMachineFunction(MachineFunction &MF);
      +    bool runOnFunction(Function &F);
         };
         
      -  class VISIBILITY_HIDDEN Deleter : public MachineFunctionPass {
      +  class VISIBILITY_HIDDEN Deleter : public FunctionPass {
           static char ID;
           
         public:
      @@ -44,7 +47,7 @@
           const char *getPassName() const;
           void getAnalysisUsage(AnalysisUsage &AU) const;
           
      -    bool runOnMachineFunction(MachineFunction &MF);
      +    bool runOnFunction(Function &F);
           bool doFinalization(Module &M);
         };
         
      @@ -55,8 +58,8 @@
       
       // -----------------------------------------------------------------------------
       
      -CollectorMetadata::CollectorMetadata(const Function &F)
      -  : F(F), FrameSize(~0LL) {}
      +CollectorMetadata::CollectorMetadata(const Function &F, Collector &C)
      +  : F(F), C(C), FrameSize(~0LL) {}
       
       CollectorMetadata::~CollectorMetadata() {}
       
      @@ -71,46 +74,71 @@
         clear();
       }
       
      -CollectorMetadata& CollectorModuleMetadata::insert(const Function *F) {
      -  assert(Map.find(F) == Map.end() && "Function GC metadata already exists!");
      -  CollectorMetadata *FMD = new CollectorMetadata(*F);
      -  Functions.push_back(FMD);
      -  Map[F] = FMD;
      -  return *FMD;
      +Collector *CollectorModuleMetadata::
      +getOrCreateCollector(const Module *M, const std::string &Name) {
      +  const char *Start = Name.c_str();
      +  
      +  collector_map_type::iterator NMI = NameMap.find(Start, Start + Name.size());
      +  if (NMI != NameMap.end())
      +    return NMI->getValue();
      +  
      +  for (CollectorRegistry::iterator I = CollectorRegistry::begin(),
      +                                   E = CollectorRegistry::end(); I != E; ++I) {
      +    if (strcmp(Start, I->getName()) == 0) {
      +      Collector *C = I->instantiate();
      +      C->M = M;
      +      C->Name = Name;
      +      NameMap.GetOrCreateValue(Start, Start + Name.size()).setValue(C);
      +      Collectors.push_back(C);
      +      return C;
      +    }
      +  }
      +  
      +  cerr << "unsupported collector: " << Name << "\n";
      +  abort();
       }
       
      -CollectorMetadata* CollectorModuleMetadata::get(const Function *F) const {
      -  map_type::iterator I = Map.find(F);
      -  if (I == Map.end())
      -    return 0;
      -  return I->second;
      +CollectorMetadata &CollectorModuleMetadata::get(const Function &F) {
      +  assert(F.hasCollector());
      +  function_map_type::iterator I = Map.find(&F);
      +  if (I != Map.end())
      +    return *I->second;
      +    
      +  Collector *C = getOrCreateCollector(F.getParent(), F.getCollector());
      +  CollectorMetadata *MD = C->insertFunctionMetadata(F);
      +  Map[&F] = MD;
      +  return *MD;
       }
       
       void CollectorModuleMetadata::clear() {
      +  Map.clear();
      +  
      +  // TODO: StringMap should provide a clear method.
      +  while (!NameMap.empty())
      +    NameMap.erase(NameMap.begin());
      +  
         for (iterator I = begin(), E = end(); I != E; ++I)
           delete *I;
      -  
      -  Functions.clear();
      -  Map.clear();
      +  Collectors.clear();
       }
       
       // -----------------------------------------------------------------------------
       
       char Printer::ID = 0;
       
      -Pass *llvm::createCollectorMetadataPrinter(std::ostream &OS) {
      +FunctionPass *llvm::createCollectorMetadataPrinter(std::ostream &OS) {
         return new Printer(OS);
       }
       
       Printer::Printer(std::ostream &OS)
      -  : MachineFunctionPass(intptr_t(&ID)), OS(OS) {}
      +  : FunctionPass(intptr_t(&ID)), OS(OS) {}
       
       const char *Printer::getPassName() const {
         return "Print Garbage Collector Information";
       }
       
       void Printer::getAnalysisUsage(AnalysisUsage &AU) const {
      -  MachineFunctionPass::getAnalysisUsage(AU);
      +  FunctionPass::getAnalysisUsage(AU);
         AU.setPreservesAll();
         AU.addRequired();
       }
      @@ -125,9 +153,9 @@
         }
       }
       
      -bool Printer::runOnMachineFunction(MachineFunction &MF) {
      -  if (CollectorMetadata *FD =
      -                 getAnalysis().get(MF.getFunction())) {
      +bool Printer::runOnFunction(Function &F) {
      +  if (F.hasCollector()) {
      +    CollectorMetadata *FD = &getAnalysis().get(F);
           
           OS << "GC roots for " << FD->getFunction().getNameStart() << ":\n";
           for (CollectorMetadata::roots_iterator RI = FD->roots_begin(),
      @@ -160,11 +188,11 @@
       
       char Deleter::ID = 0;
       
      -Pass *llvm::createCollectorMetadataDeleter() {
      +FunctionPass *llvm::createCollectorMetadataDeleter() {
         return new Deleter();
       }
       
      -Deleter::Deleter() : MachineFunctionPass(intptr_t(&ID)) {}
      +Deleter::Deleter() : FunctionPass(intptr_t(&ID)) {}
       
       const char *Deleter::getPassName() const {
         return "Delete Garbage Collector Information";
      @@ -175,11 +203,13 @@
         AU.addRequired();
       }
       
      -bool Deleter::runOnMachineFunction(MachineFunction &MF) {
      +bool Deleter::runOnFunction(Function &MF) {
         return false;
       }
       
       bool Deleter::doFinalization(Module &M) {
      -  getAnalysis().clear();
      +  CollectorModuleMetadata *CMM = getAnalysisToUpdate();
      +  assert(CMM && "Deleter didn't require CollectorModuleMetadata?!");
      +  CMM->clear();
         return false;
       }
      
      
      
      
      From isanbard at gmail.com  Mon Dec 10 18:30:57 2007
      From: isanbard at gmail.com (Bill Wendling)
      Date: Mon, 10 Dec 2007 16:30:57 -0800
      Subject: [llvm-commits] [llvm] r44687 - in /llvm/trunk:
      	include/llvm/CodeGen/Passes.h
      	lib/CodeGen/LLVMTargetMachine.cpp lib/CodeGen/MachineLICM.cpp
      	lib/Target/PowerPC/PPCInstrInfo.td
      In-Reply-To: <4CAE2FC5-85F5-4C02-B7FD-F19F195C6931@apple.com>
      References: <20071210144741.GX26680@gold.us.cray.com>
      	<5BD5B624-4DF2-4547-A2EC-A06D261D70DE@apple.com>
      	<16e5fdf90712101323m635126f8o30aa7fb98f4d77a0@mail.gmail.com>
      	<4CAE2FC5-85F5-4C02-B7FD-F19F195C6931@apple.com>
      Message-ID: <16e5fdf90712101630v4a596617y16e1bb8d420e2fa3@mail.gmail.com>
      
      On Dec 10, 2007 3:44 PM, Evan Cheng  wrote:
      > On Dec 10, 2007, at 1:23 PM, Bill Wendling wrote:
      > > On Dec 10, 2007 11:36 AM, Evan Cheng  wrote:
      > >> I don't think lifting loop invariant from inner loop all the way out
      > >> of outer-most loop is a good idea. That will increase register
      > >> pressure in basic blocks where it is not used.
      > >>
      > > This is going to happen with the current pass, though. Each loop is
      > > going to see the hoisted instructions from the previous iteration and
      > > try to re-hoist them. Is there some heuristic we should apply to
      > > prevent it from hoisting instructions too far?
      > >
      >
      > I am not sure. :-)
      >
      > For innermost loops, hoisting invariants out into the preheader always
      > make sense. Intuitively, hoisting invariants from inner loops out of
      > the outermost loop only makes sense when all (or a lot, whatever that
      > means :-) of the inner loops use it. Or at least the first inner loop
      > use it.
      >
      > What does the LLVM level LICM do?
      >
      It does the same thing that Machine LICM does...tries to hoist things
      as far as possible.
      
      -bw
      
      
      From clattner at apple.com  Mon Dec 10 18:33:31 2007
      From: clattner at apple.com (Chris Lattner)
      Date: Mon, 10 Dec 2007 16:33:31 -0800
      Subject: [llvm-commits] [llvm] r44825 - in /llvm/trunk:
      	include/llvm/Target/TargetData.h lib/Target/TargetData.cpp
      In-Reply-To: <200712110028.lBB0Sxth016975@zion.cs.uiuc.edu>
      References: <200712110028.lBB0Sxth016975@zion.cs.uiuc.edu>
      Message-ID: <1EA97F9B-57BF-4D16-B67B-E10E94F93D5C@apple.com>
      
      > URL: http://llvm.org/viewvc/llvm-project?rev=44825&view=rev
      > Log:
      > Move TargetData::hostIsLittleEndian out of line, which means we
      > don't have to #include config.h in it.  #including config.h breaks
      > other projects that have their own autoconf stuff and try to #include
      > the llvm headers.  One obscure example is llvm-gcc.
      
      Duncan, this patch gets llvm-gcc to build, but it still doesn't  
      answer the big question: why does TargetData contain information  
      about the host?  I don't think this is the right approach.  Also, you  
      can get the host endianness without autoconf by using something  
      simple like:
      
      bool islittleendian() {
         union {
           int i;
           char c;
         };
      
         i = 1;
         return c;
      }
      
      -Chris
      
      
      
      
      
      From scottm at aero.org  Mon Dec 10 18:35:46 2007
      From: scottm at aero.org (Scott Michel)
      Date: Tue, 11 Dec 2007 00:35:46 -0000
      Subject: [llvm-commits] [llvm-gcc-4.2] r44828 -
      	/llvm-gcc-4.2/trunk/README.LLVM
      Message-ID: <200712110035.lBB0Zk78017299@zion.cs.uiuc.edu>
      
      Author: pingbak
      Date: Mon Dec 10 18:35:46 2007
      New Revision: 44828
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44828&view=rev
      Log:
      Add a blurb about installing a link to libstdc++.6.dylib so that C++
      executables link correctly when the compiler is installed in a nonstandard
      place.
      
      Modified:
          llvm-gcc-4.2/trunk/README.LLVM
      
      Modified: llvm-gcc-4.2/trunk/README.LLVM
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/README.LLVM?rev=44828&r1=44827&r2=44828&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/README.LLVM (original)
      +++ llvm-gcc-4.2/trunk/README.LLVM Mon Dec 10 18:35:46 2007
      @@ -126,6 +126,11 @@
           --enable-llvm=$LLVMOBJDIR --enable-languages=c,c++$EXTRALANGS $TARGETOPTIONS
       $ make $BUILDOPTIONS
       $ make install
      +$ ln -sf /usr/lib/libstdc++.6.dylib `pwd`/../install/lib
      +
      +That last step, "ln -sf ..." is required so that the linker (collect2) can find
      +libstdc++ ('-lstdc++') and subsequently link C++ executables link correctly.
      +
       
       Note that if you prefer to bootstrap llvm-gcc (so that the final llvm-gcc 
       executables have been compiled with llvm-gcc itself), replace "make" with
      
      
      
      
      From clattner at apple.com  Mon Dec 10 18:38:18 2007
      From: clattner at apple.com (Chris Lattner)
      Date: Mon, 10 Dec 2007 16:38:18 -0800
      Subject: [llvm-commits] [llvm] r44687 - in /llvm/trunk:
      	include/llvm/CodeGen/Passes.h	lib/CodeGen/LLVMTargetMachine.cpp
      	lib/CodeGen/MachineLICM.cpp	lib/Target/PowerPC/PPCInstrInfo.td
      In-Reply-To: <4CAE2FC5-85F5-4C02-B7FD-F19F195C6931@apple.com>
      References: <20071210144741.GX26680@gold.us.cray.com>
      	<5BD5B624-4DF2-4547-A2EC-A06D261D70DE@apple.com>
      	<16e5fdf90712101323m635126f8o30aa7fb98f4d77a0@mail.gmail.com>
      	<4CAE2FC5-85F5-4C02-B7FD-F19F195C6931@apple.com>
      Message-ID: <824E8AB9-8189-44FF-B2B4-538324698B1E@apple.com>
      
      On Dec 10, 2007, at 3:44 PM, Evan Cheng wrote:
      >> This is going to happen with the current pass, though. Each loop is
      >> going to see the hoisted instructions from the previous iteration and
      >> try to re-hoist them. Is there some heuristic we should apply to
      >> prevent it from hoisting instructions too far?
      >>
      >
      > For innermost loops, hoisting invariants out into the preheader always
      > make sense. Intuitively, hoisting invariants from inner loops out of
      > the outermost loop only makes sense when all (or a lot, whatever that
      > means :-) of the inner loops use it. Or at least the first inner loop
      > use it.
      
      We discussed this today: I'm strongly of the opinion that licm should  
      hoist aggressively and not "think" about register pressure.  It  
      should assume that remat is capable of resinking stuff into the loop  
      when possible.  This means that we shouldn't have ad-hoc hacks in  
      LICM to avoid "increasing register pressure", but I'm fine with  
      making LICM aware of what remat is able to sink, and having it not  
      hoist things that it can't handle yet.
      
      
      With that said, licm should hoist things as far out as possible.  The  
      LLVM LICM pass is structured the way it is in order to hoist loads  
      out, which require checking alias information at each level of a loop  
      nest.  We don't have short-term plans to hoist out loops (which will  
      require extensive machine aliasing support), so switching to a model  
      like dan describes (single pass over all bb's in outermost loops,  
      hoisting instructions once instead of iteratively) makes sense to me.
      
      -Chris
      
      
      From scottm at aero.org  Mon Dec 10 18:43:14 2007
      From: scottm at aero.org (Scott Michel)
      Date: Tue, 11 Dec 2007 00:43:14 -0000
      Subject: [llvm-commits] [llvm-gcc-4.2] r44829 -
      	/llvm-gcc-4.2/trunk/README.LLVM
      Message-ID: <200712110043.lBB0hE7b017597@zion.cs.uiuc.edu>
      
      Author: pingbak
      Date: Mon Dec 10 18:43:14 2007
      New Revision: 44829
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44829&view=rev
      Log:
      Fix typo.
      
      Modified:
          llvm-gcc-4.2/trunk/README.LLVM
      
      Modified: llvm-gcc-4.2/trunk/README.LLVM
      URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/README.LLVM?rev=44829&r1=44828&r2=44829&view=diff
      
      ==============================================================================
      --- llvm-gcc-4.2/trunk/README.LLVM (original)
      +++ llvm-gcc-4.2/trunk/README.LLVM Mon Dec 10 18:43:14 2007
      @@ -129,8 +129,7 @@
       $ ln -sf /usr/lib/libstdc++.6.dylib `pwd`/../install/lib
       
       That last step, "ln -sf ..." is required so that the linker (collect2) can find
      -libstdc++ ('-lstdc++') and subsequently link C++ executables link correctly.
      -
      +libstdc++ ('-lstdc++') and subsequently link C++ executables correctly.
       
       Note that if you prefer to bootstrap llvm-gcc (so that the final llvm-gcc 
       executables have been compiled with llvm-gcc itself), replace "make" with
      
      
      
      
      From isanbard at gmail.com  Mon Dec 10 18:50:03 2007
      From: isanbard at gmail.com (Bill Wendling)
      Date: Mon, 10 Dec 2007 16:50:03 -0800
      Subject: [llvm-commits] [llvm] r44687 - in /llvm/trunk:
      	include/llvm/CodeGen/Passes.h
      	lib/CodeGen/LLVMTargetMachine.cpp lib/CodeGen/MachineLICM.cpp
      	lib/Target/PowerPC/PPCInstrInfo.td
      In-Reply-To: <824E8AB9-8189-44FF-B2B4-538324698B1E@apple.com>
      References: <20071210144741.GX26680@gold.us.cray.com>
      	<5BD5B624-4DF2-4547-A2EC-A06D261D70DE@apple.com>
      	<16e5fdf90712101323m635126f8o30aa7fb98f4d77a0@mail.gmail.com>
      	<4CAE2FC5-85F5-4C02-B7FD-F19F195C6931@apple.com>
      	<824E8AB9-8189-44FF-B2B4-538324698B1E@apple.com>
      Message-ID: <16e5fdf90712101650o153eeff5ld780f8ae5f0bbfd3@mail.gmail.com>
      
      On Dec 10, 2007 4:38 PM, Chris Lattner  wrote:
      > With that said, licm should hoist things as far out as possible.  The
      > LLVM LICM pass is structured the way it is in order to hoist loads
      > out, which require checking alias information at each level of a loop
      > nest.  We don't have short-term plans to hoist out loops (which will
      > require extensive machine aliasing support), so switching to a model
      > like dan describes (single pass over all bb's in outermost loops,
      > hoisting instructions once instead of iteratively) makes sense to me.
      >
      I'm confused. If we do that, we won't be able to hoist things in inner
      loops into their pre-header blocks. Or are you suggesting that the
      machine LICM pass looks for loop-invariant instructions. If they can
      be hoisted all of the way out, then do that. Otherwise, find each
      containing loop and try to hoist to that pre-header?
      
      -bw
      
      
      From isanbard at gmail.com  Mon Dec 10 19:04:06 2007
      From: isanbard at gmail.com (Bill Wendling)
      Date: Tue, 11 Dec 2007 01:04:06 -0000
      Subject: [llvm-commits] [llvm] r44832 - /llvm/tags/Apple/llvmCore-2004/
      Message-ID: <200712110104.lBB1463d018608@zion.cs.uiuc.edu>
      
      Author: void
      Date: Mon Dec 10 19:04:05 2007
      New Revision: 44832
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44832&view=rev
      Log:
      Retagging with the config.h fix.
      
      Added:
          llvm/tags/Apple/llvmCore-2004/
            - copied from r44831, llvm/trunk/
      
      
      
      From natebegeman at mac.com  Mon Dec 10 19:41:33 2007
      From: natebegeman at mac.com (Nate Begeman)
      Date: Tue, 11 Dec 2007 01:41:33 -0000
      Subject: [llvm-commits] [llvm] r44835 -
      	/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
      Message-ID: <200712110141.lBB1fXSm021405@zion.cs.uiuc.edu>
      
      Author: sampo
      Date: Mon Dec 10 19:41:33 2007
      New Revision: 44835
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44835&view=rev
      Log:
      x86 doesn't actually want to custom lower v3i32
      
      
      Modified:
          llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
      
      Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=44835&r1=44834&r2=44835&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
      +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Dec 10 19:41:33 2007
      @@ -600,6 +600,9 @@
       
           // Custom lower build_vector, vector_shuffle, and extract_vector_elt.
           for (unsigned VT = (unsigned)MVT::v16i8; VT != (unsigned)MVT::v2i64; VT++) {
      +      // Do not attempt to custom lower non-power-of-2 vectors
      +      if (!isPowerOf2_32(MVT::getVectorNumElements(VT)))
      +        continue;
             setOperationAction(ISD::BUILD_VECTOR,        (MVT::ValueType)VT, Custom);
             setOperationAction(ISD::VECTOR_SHUFFLE,      (MVT::ValueType)VT, Custom);
             setOperationAction(ISD::EXTRACT_VECTOR_ELT,  (MVT::ValueType)VT, Custom);
      
      
      
      
      From evan.cheng at apple.com  Mon Dec 10 19:46:18 2007
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Tue, 11 Dec 2007 01:46:18 -0000
      Subject: [llvm-commits] [llvm] r44836 - in /llvm/trunk:
       lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/vec_shuffle-12.ll
       test/CodeGen/X86/vec_shuffle-13.ll
      Message-ID: <200712110146.lBB1kJJP021643@zion.cs.uiuc.edu>
      
      Author: evancheng
      Date: Mon Dec 10 19:46:18 2007
      New Revision: 44836
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44836&view=rev
      Log:
      - Improved v8i16 shuffle lowering. It now uses pshuflw and pshufhw as much as
      possible before resorting to pextrw and pinsrw.
      - Better codegen for v4i32 shuffles masquerading as v8i16 or v16i8 shuffles.
      - Improves (i16 extract_vector_element 0) codegen by recognizing
        (i32 extract_vector_element 0) does not require a pextrw.
      
      Added:
          llvm/trunk/test/CodeGen/X86/vec_shuffle-13.ll
      Modified:
          llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
          llvm/trunk/test/CodeGen/X86/vec_shuffle-12.ll
      
      Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=44836&r1=44835&r2=44836&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
      +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Mon Dec 10 19:46:18 2007
      @@ -23,6 +23,7 @@
       #include "llvm/GlobalVariable.h"
       #include "llvm/Function.h"
       #include "llvm/Intrinsics.h"
      +#include "llvm/ADT/BitVector.h"
       #include "llvm/ADT/VectorExtras.h"
       #include "llvm/Analysis/ScalarEvolutionExpressions.h"
       #include "llvm/CodeGen/CallingConvLower.h"
      @@ -35,6 +36,7 @@
       #include "llvm/Support/CommandLine.h"
       #include "llvm/Support/Debug.h"
       #include "llvm/Target/TargetOptions.h"
      +#include "llvm/ADT/SmallSet.h"
       #include "llvm/ADT/StringExtras.h"
       #include "llvm/ParameterAttributes.h"
       using namespace llvm;
      @@ -2714,7 +2716,7 @@
           if (Arg.getOpcode() == ISD::UNDEF) continue;
           assert(isa(Arg) && "Invalid VECTOR_SHUFFLE mask!");
           unsigned Val = cast(Arg)->getValue();
      -    if (Val > 4)
      +    if (Val >= 4)
             return false;
         }
       
      @@ -3130,6 +3132,8 @@
         return V;
       }
       
      +/// is4WideVector - Returns true if the specific v8i16 or v16i8 vector is
      +/// actually just a 4 wide vector. e.g. 
       SDOperand
       X86TargetLowering::LowerBUILD_VECTOR(SDOperand Op, SelectionDAG &DAG) {
         // All zero's are handled with pxor, all one's are handled with pcmpeqd.
      @@ -3154,7 +3158,7 @@
         unsigned NumNonZero = 0;
         unsigned NonZeros = 0;
         unsigned NumNonZeroImms = 0;
      -  std::set Values;
      +  SmallSet Values;
         for (unsigned i = 0; i < NumElems; ++i) {
           SDOperand Elt = Op.getOperand(i);
           if (Elt.getOpcode() != ISD::UNDEF) {
      @@ -3314,59 +3318,179 @@
       SDOperand LowerVECTOR_SHUFFLEv8i16(SDOperand V1, SDOperand V2,
                                          SDOperand PermMask, SelectionDAG &DAG,
                                          TargetLowering &TLI) {
      +  SDOperand NewV;
         MVT::ValueType MaskVT = MVT::getIntVectorWithNumElements(8);
         MVT::ValueType MaskEVT = MVT::getVectorElementType(MaskVT);
      -  if (isPSHUFHW_PSHUFLWMask(PermMask.Val)) {
      -    // Handle v8i16 shuffle high / low shuffle node pair.
      +  MVT::ValueType PtrVT = TLI.getPointerTy();
      +  SmallVector MaskElts(PermMask.Val->op_begin(),
      +                                     PermMask.Val->op_end());
      +
      +  // First record which half of which vector the low elements come from.
      +  SmallVector LowQuad(4);
      +  for (unsigned i = 0; i < 4; ++i) {
      +    SDOperand Elt = MaskElts[i];
      +    if (Elt.getOpcode() == ISD::UNDEF)
      +      continue;
      +    unsigned EltIdx = cast(Elt)->getValue();
      +    int QuadIdx = EltIdx / 4;
      +    ++LowQuad[QuadIdx];
      +  }
      +  int BestLowQuad = -1;
      +  unsigned MaxQuad = 1;
      +  for (unsigned i = 0; i < 4; ++i) {
      +    if (LowQuad[i] > MaxQuad) {
      +      BestLowQuad = i;
      +      MaxQuad = LowQuad[i];
      +    }
      +  }
      +
      +  // Record which half of which vector the high elements come from.
      +  SmallVector HighQuad(4);
      +  for (unsigned i = 4; i < 8; ++i) {
      +    SDOperand Elt = MaskElts[i];
      +    if (Elt.getOpcode() == ISD::UNDEF)
      +      continue;
      +    unsigned EltIdx = cast(Elt)->getValue();
      +    int QuadIdx = EltIdx / 4;
      +    ++HighQuad[QuadIdx];
      +  }
      +  int BestHighQuad = -1;
      +  MaxQuad = 1;
      +  for (unsigned i = 0; i < 4; ++i) {
      +    if (HighQuad[i] > MaxQuad) {
      +      BestHighQuad = i;
      +      MaxQuad = HighQuad[i];
      +    }
      +  }
      +
      +  // If it's possible to sort parts of either half with PSHUF{H|L}W, then do it.
      +  if (BestLowQuad != -1 || BestHighQuad != -1) {
      +    // First sort the 4 chunks in order using shufpd.
           SmallVector MaskVec;
      -    for (unsigned i = 0; i != 4; ++i)
      -      MaskVec.push_back(PermMask.getOperand(i));
      -    for (unsigned i = 4; i != 8; ++i)
      -      MaskVec.push_back(DAG.getConstant(i, MaskEVT));
      -    SDOperand Mask = DAG.getNode(ISD::BUILD_VECTOR, MaskVT, &MaskVec[0], 8);
      -    V1 = DAG.getNode(ISD::VECTOR_SHUFFLE, MVT::v8i16, V1, V2, Mask);
      -    MaskVec.clear();
      -    for (unsigned i = 0; i != 4; ++i)
      -      MaskVec.push_back(DAG.getConstant(i, MaskEVT));
      -    for (unsigned i = 4; i != 8; ++i)
      -      MaskVec.push_back(PermMask.getOperand(i));
      -    Mask = DAG.getNode(ISD::BUILD_VECTOR, MaskVT, &MaskVec[0], 8);
      -    return DAG.getNode(ISD::VECTOR_SHUFFLE, MVT::v8i16, V1, V2, Mask);
      +    if (BestLowQuad != -1)
      +      MaskVec.push_back(DAG.getConstant(BestLowQuad, MVT::i32));
      +    else
      +      MaskVec.push_back(DAG.getConstant(0, MVT::i32));
      +    if (BestHighQuad != -1)
      +      MaskVec.push_back(DAG.getConstant(BestHighQuad, MVT::i32));
      +    else
      +      MaskVec.push_back(DAG.getConstant(1, MVT::i32));
      +    SDOperand Mask= DAG.getNode(ISD::BUILD_VECTOR, MVT::v2i32, &MaskVec[0],2);
      +    NewV = DAG.getNode(ISD::VECTOR_SHUFFLE, MVT::v2i64,
      +                       DAG.getNode(ISD::BIT_CONVERT, MVT::v2i64, V1),
      +                       DAG.getNode(ISD::BIT_CONVERT, MVT::v2i64, V2), Mask);
      +    NewV = DAG.getNode(ISD::BIT_CONVERT, MVT::v8i16, NewV);
      +
      +    // Now sort high and low parts separately.
      +    BitVector InOrder(8);
      +    if (BestLowQuad != -1) {
      +      // Sort lower half in order using PSHUFLW.
      +      MaskVec.clear();
      +      bool AnyOutOrder = false;
      +      for (unsigned i = 0; i != 4; ++i) {
      +        SDOperand Elt = MaskElts[i];
      +        if (Elt.getOpcode() == ISD::UNDEF) {
      +          MaskVec.push_back(Elt);
      +          InOrder.set(i);
      +        } else {
      +          unsigned EltIdx = cast(Elt)->getValue();
      +          if (EltIdx != i)
      +            AnyOutOrder = true;
      +          MaskVec.push_back(DAG.getConstant(EltIdx % 4, MaskEVT));
      +          // If this element is in the right place after this shuffle, then
      +          // remember it.
      +          if ((int)(EltIdx / 4) == BestLowQuad)
      +            InOrder.set(i);
      +        }
      +      }
      +      if (AnyOutOrder) {
      +        for (unsigned i = 4; i != 8; ++i)
      +          MaskVec.push_back(DAG.getConstant(i, MaskEVT));
      +        SDOperand Mask = DAG.getNode(ISD::BUILD_VECTOR, MaskVT, &MaskVec[0], 8);
      +        NewV = DAG.getNode(ISD::VECTOR_SHUFFLE, MVT::v8i16, NewV, NewV, Mask);
      +      }
      +    }
      +
      +    if (BestHighQuad != -1) {
      +      // Sort high half in order using PSHUFHW if possible.
      +      MaskVec.clear();
      +      for (unsigned i = 0; i != 4; ++i)
      +        MaskVec.push_back(DAG.getConstant(i, MaskEVT));
      +      bool AnyOutOrder = false;
      +      for (unsigned i = 4; i != 8; ++i) {
      +        SDOperand Elt = MaskElts[i];
      +        if (Elt.getOpcode() == ISD::UNDEF) {
      +          MaskVec.push_back(Elt);
      +          InOrder.set(i);
      +        } else {
      +          unsigned EltIdx = cast(Elt)->getValue();
      +          if (EltIdx != i)
      +            AnyOutOrder = true;
      +          MaskVec.push_back(DAG.getConstant((EltIdx % 4) + 4, MaskEVT));
      +          // If this element is in the right place after this shuffle, then
      +          // remember it.
      +          if ((int)(EltIdx / 4) == BestHighQuad)
      +            InOrder.set(i);
      +        }
      +      }
      +      if (AnyOutOrder) {
      +        SDOperand Mask = DAG.getNode(ISD::BUILD_VECTOR, MaskVT, &MaskVec[0], 8);
      +        NewV = DAG.getNode(ISD::VECTOR_SHUFFLE, MVT::v8i16, NewV, NewV, Mask);
      +      }
      +    }
      +
      +    // The other elements are put in the right place using pextrw and pinsrw.
      +    for (unsigned i = 0; i != 8; ++i) {
      +      if (InOrder[i])
      +        continue;
      +      SDOperand Elt = MaskElts[i];
      +      unsigned EltIdx = cast(Elt)->getValue();
      +      if (EltIdx == i)
      +        continue;
      +      SDOperand ExtOp = (EltIdx < 8)
      +        ? DAG.getNode(ISD::EXTRACT_VECTOR_ELT, MVT::i16, V1,
      +                      DAG.getConstant(EltIdx, PtrVT))
      +        : DAG.getNode(ISD::EXTRACT_VECTOR_ELT, MVT::i16, V2,
      +                      DAG.getConstant(EltIdx - 8, PtrVT));
      +      NewV = DAG.getNode(ISD::INSERT_VECTOR_ELT, MVT::v8i16, NewV, ExtOp,
      +                         DAG.getConstant(i, PtrVT));
      +    }
      +    return NewV;
         }
       
      -  // Lower than into extracts and inserts but try to do as few as possible.
      +  // PSHUF{H|L}W are not used. Lower into extracts and inserts but try to use
      +  ///as few as possible.
         // First, let's find out how many elements are already in the right order.
         unsigned V1InOrder = 0;
         unsigned V1FromV1 = 0;
         unsigned V2InOrder = 0;
         unsigned V2FromV2 = 0;
      -  SmallVector V1Elts;
      -  SmallVector V2Elts;
      +  SmallVector V1Elts;
      +  SmallVector V2Elts;
         for (unsigned i = 0; i < 8; ++i) {
      -    SDOperand Elt = PermMask.getOperand(i);
      +    SDOperand Elt = MaskElts[i];
           if (Elt.getOpcode() == ISD::UNDEF) {
      -      V1Elts.push_back(i);
      -      V2Elts.push_back(i);
      +      V1Elts.push_back(Elt);
      +      V2Elts.push_back(Elt);
             ++V1InOrder;
             ++V2InOrder;
      +      continue;
      +    }
      +    unsigned EltIdx = cast(Elt)->getValue();
      +    if (EltIdx == i) {
      +      V1Elts.push_back(Elt);
      +      V2Elts.push_back(DAG.getConstant(i+8, MaskEVT));
      +      ++V1InOrder;
      +    } else if (EltIdx == i+8) {
      +      V1Elts.push_back(Elt);
      +      V2Elts.push_back(DAG.getConstant(i, MaskEVT));
      +      ++V2InOrder;
      +    } else if (EltIdx < 8) {
      +      V1Elts.push_back(Elt);
      +      ++V1FromV1;
           } else {
      -      unsigned EltIdx = cast(Elt)->getValue();
      -      if (EltIdx == i) {
      -        V1Elts.push_back(i);
      -        V2Elts.push_back(i+8);
      -        ++V1InOrder;
      -      } else if (EltIdx == i+8) {
      -        V1Elts.push_back(i+8);
      -        V2Elts.push_back(i);
      -        ++V2InOrder;
      -      } else {
      -        V1Elts.push_back(EltIdx);
      -        V2Elts.push_back(EltIdx);
      -        if (EltIdx < 8)
      -          ++V1FromV1;
      -        else
      -          ++V2FromV2;
      -      }
      +      V2Elts.push_back(DAG.getConstant(EltIdx-8, MaskEVT));
      +      ++V2FromV2;
           }
         }
       
      @@ -3377,33 +3501,92 @@
           std::swap(V1FromV1, V2FromV2);
         }
       
      -  MVT::ValueType PtrVT = TLI.getPointerTy();
      -  if (V1FromV1) {
      -    // If there are elements that are from V1 but out of place,
      -    // then first sort them in place
      -    SmallVector MaskVec;
      +  if ((V1FromV1 + V1InOrder) != 8) {
      +    // Some elements are from V2.
      +    if (V1FromV1) {
      +      // If there are elements that are from V1 but out of place,
      +      // then first sort them in place
      +      SmallVector MaskVec;
      +      for (unsigned i = 0; i < 8; ++i) {
      +        SDOperand Elt = V1Elts[i];
      +        if (Elt.getOpcode() == ISD::UNDEF) {
      +          MaskVec.push_back(DAG.getNode(ISD::UNDEF, MaskEVT));
      +          continue;
      +        }
      +        unsigned EltIdx = cast(Elt)->getValue();
      +        if (EltIdx >= 8)
      +          MaskVec.push_back(DAG.getNode(ISD::UNDEF, MaskEVT));
      +        else
      +          MaskVec.push_back(DAG.getConstant(EltIdx, MaskEVT));
      +      }
      +      SDOperand Mask = DAG.getNode(ISD::BUILD_VECTOR, MaskVT, &MaskVec[0], 8);
      +      V1 = DAG.getNode(ISD::VECTOR_SHUFFLE, MVT::v8i16, V1, V1, Mask);
      +    }
      +
      +    NewV = V1;
           for (unsigned i = 0; i < 8; ++i) {
      -      unsigned EltIdx = V1Elts[i];
      -      if (EltIdx >= 8)
      -        MaskVec.push_back(DAG.getNode(ISD::UNDEF, MaskEVT));
      -      else
      -        MaskVec.push_back(DAG.getConstant(EltIdx, MaskEVT));
      +      SDOperand Elt = V1Elts[i];
      +      if (Elt.getOpcode() == ISD::UNDEF)
      +        continue;
      +      unsigned EltIdx = cast(Elt)->getValue();
      +      if (EltIdx < 8)
      +        continue;
      +      SDOperand ExtOp = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, MVT::i16, V2,
      +                                    DAG.getConstant(EltIdx - 8, PtrVT));
      +      NewV = DAG.getNode(ISD::INSERT_VECTOR_ELT, MVT::v8i16, NewV, ExtOp,
      +                         DAG.getConstant(i, PtrVT));
           }
      -    SDOperand Mask = DAG.getNode(ISD::BUILD_VECTOR, MaskVT, &MaskVec[0], 8);
      -    V1 = DAG.getNode(ISD::VECTOR_SHUFFLE, MVT::v8i16, V1, V1, Mask);
      +    return NewV;
      +  } else {
      +    // All elements are from V1.
      +    NewV = V1;
      +    for (unsigned i = 0; i < 8; ++i) {
      +      SDOperand Elt = V1Elts[i];
      +      if (Elt.getOpcode() == ISD::UNDEF)
      +        continue;
      +      unsigned EltIdx = cast(Elt)->getValue();
      +      SDOperand ExtOp = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, MVT::i16, V1,
      +                                    DAG.getConstant(EltIdx, PtrVT));
      +      NewV = DAG.getNode(ISD::INSERT_VECTOR_ELT, MVT::v8i16, NewV, ExtOp,
      +                         DAG.getConstant(i, PtrVT));
      +    }
      +    return NewV;
         }
      +}
       
      -  // Now let's insert elements from the other vector.
      -  for (unsigned i = 0; i < 8; ++i) {
      -    unsigned EltIdx = V1Elts[i];
      -    if (EltIdx < 8)
      -      continue;
      -    SDOperand ExtOp = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, MVT::i16, V2,
      -                                  DAG.getConstant(EltIdx - 8, PtrVT));
      -    V1 = DAG.getNode(ISD::INSERT_VECTOR_ELT, MVT::v8i16, V1, ExtOp,
      -                     DAG.getConstant(i, PtrVT));
      +/// RewriteAs4WideShuffle - Try rewriting v8i16 and v16i8 shuffles as 4 wide
      +/// ones if possible. This can be done when every pair / quad of shuffle mask
      +/// elements point to elements in the right sequence. e.g.
      +/// vector_shuffle <>, <>, < 3, 4, | 10, 11, | 0, 1, | 14, 15>
      +static
      +SDOperand RewriteAs4WideShuffle(SDOperand V1, SDOperand V2,
      +                                SDOperand PermMask, SelectionDAG &DAG,
      +                                TargetLowering &TLI) {
      +  unsigned NumElems = PermMask.getNumOperands();
      +  unsigned Scale = NumElems / 4;
      +  SmallVector MaskVec;
      +  for (unsigned i = 0; i < NumElems; i += Scale) {
      +    unsigned StartIdx = ~0U;
      +    for (unsigned j = 0; j < Scale; ++j) {
      +      SDOperand Elt = PermMask.getOperand(i+j);
      +      if (Elt.getOpcode() == ISD::UNDEF)
      +        continue;
      +      unsigned EltIdx = cast(Elt)->getValue();
      +      if (StartIdx == ~0U)
      +        StartIdx = EltIdx - (EltIdx % Scale);
      +      if (EltIdx != StartIdx + j)
      +        return SDOperand();
      +    }
      +    if (StartIdx == ~0U)
      +      MaskVec.push_back(DAG.getNode(ISD::UNDEF, MVT::i32));
      +    else
      +      MaskVec.push_back(DAG.getConstant(StartIdx / Scale, MVT::i32));
         }
      -  return V1;
      +
      +  V1 = DAG.getNode(ISD::BIT_CONVERT, MVT::v4i32, V1);
      +  V2 = DAG.getNode(ISD::BIT_CONVERT, MVT::v4i32, V2);
      +  return DAG.getNode(ISD::VECTOR_SHUFFLE, MVT::v4i32, V1, V2,
      +                     DAG.getNode(ISD::BUILD_VECTOR, MVT::v4i32, &MaskVec[0],4));
       }
       
       SDOperand
      @@ -3544,18 +3727,31 @@
           }
         }
       
      +  // If the shuffle can be rewritten as a 4 wide shuffle, then do it!
      +  if (VT == MVT::v8i16 || VT == MVT::v16i8) {
      +    SDOperand NewOp = RewriteAs4WideShuffle(V1, V2, PermMask, DAG, *this);
      +    if (NewOp.Val)
      +      return DAG.getNode(ISD::BIT_CONVERT, VT, LowerVECTOR_SHUFFLE(NewOp, DAG));
      +  }
      +
         // Handle v8i16 specifically since SSE can do byte extraction and insertion.
      -  if (VT == MVT::v8i16)
      -    return LowerVECTOR_SHUFFLEv8i16(V1, V2, PermMask, DAG, *this);
      +  if (VT == MVT::v8i16) {
      +    SDOperand NewOp = LowerVECTOR_SHUFFLEv8i16(V1, V2, PermMask, DAG, *this);
      +    if (NewOp.Val)
      +      return NewOp;
      +  }
       
      -  if (NumElems == 4 &&  MVT::getSizeInBits(VT) != 64) {
      +  // Handle all 4 wide cases with a number of shuffles.
      +  if (NumElems == 4 && MVT::getSizeInBits(VT) != 64) {
           // Don't do this for MMX.
           MVT::ValueType MaskVT = PermMask.getValueType();
           MVT::ValueType MaskEVT = MVT::getVectorElementType(MaskVT);
           SmallVector, 8> Locs;
           Locs.reserve(NumElems);
      -    SmallVector Mask1(NumElems, DAG.getNode(ISD::UNDEF, MaskEVT));
      -    SmallVector Mask2(NumElems, DAG.getNode(ISD::UNDEF, MaskEVT));
      +    SmallVector Mask1(NumElems,
      +                                    DAG.getNode(ISD::UNDEF, MaskEVT));
      +    SmallVector Mask2(NumElems,
      +                                    DAG.getNode(ISD::UNDEF, MaskEVT));
           unsigned NumHi = 0;
           unsigned NumLo = 0;
           // If no more than two elements come from either vector. This can be
      @@ -3661,6 +3857,13 @@
         MVT::ValueType VT = Op.getValueType();
         // TODO: handle v16i8.
         if (MVT::getSizeInBits(VT) == 16) {
      +    SDOperand Vec = Op.getOperand(0);
      +    unsigned Idx = cast(Op.getOperand(1))->getValue();
      +    if (Idx == 0)
      +      return DAG.getNode(ISD::TRUNCATE, MVT::i16,
      +                         DAG.getNode(ISD::EXTRACT_VECTOR_ELT, MVT::i32,
      +                                 DAG.getNode(ISD::BIT_CONVERT, MVT::v4i32, Vec),
      +                                     Op.getOperand(1)));
           // Transform it so it match pextrw which produces a 32-bit result.
           MVT::ValueType EVT = (MVT::ValueType)(VT+1);
           SDOperand Extract = DAG.getNode(X86ISD::PEXTRW, EVT,
      @@ -3669,7 +3872,6 @@
                                           DAG.getValueType(VT));
           return DAG.getNode(ISD::TRUNCATE, VT, Assert);
         } else if (MVT::getSizeInBits(VT) == 32) {
      -    SDOperand Vec = Op.getOperand(0);
           unsigned Idx = cast(Op.getOperand(1))->getValue();
           if (Idx == 0)
             return Op;
      @@ -3686,12 +3888,12 @@
             push_back(DAG.getNode(ISD::UNDEF, MVT::getVectorElementType(MaskVT)));
           SDOperand Mask = DAG.getNode(ISD::BUILD_VECTOR, MaskVT,
                                        &IdxVec[0], IdxVec.size());
      +    SDOperand Vec = Op.getOperand(0);
           Vec = DAG.getNode(ISD::VECTOR_SHUFFLE, Vec.getValueType(),
                             Vec, DAG.getNode(ISD::UNDEF, Vec.getValueType()), Mask);
           return DAG.getNode(ISD::EXTRACT_VECTOR_ELT, VT, Vec,
                              DAG.getConstant(0, getPointerTy()));
         } else if (MVT::getSizeInBits(VT) == 64) {
      -    SDOperand Vec = Op.getOperand(0);
           unsigned Idx = cast(Op.getOperand(1))->getValue();
           if (Idx == 0)
             return Op;
      @@ -3706,6 +3908,7 @@
             push_back(DAG.getNode(ISD::UNDEF, MVT::getVectorElementType(MaskVT)));
           SDOperand Mask = DAG.getNode(ISD::BUILD_VECTOR, MaskVT,
                                        &IdxVec[0], IdxVec.size());
      +    SDOperand Vec = Op.getOperand(0);
           Vec = DAG.getNode(ISD::VECTOR_SHUFFLE, Vec.getValueType(),
                             Vec, DAG.getNode(ISD::UNDEF, Vec.getValueType()), Mask);
           return DAG.getNode(ISD::EXTRACT_VECTOR_ELT, VT, Vec,
      
      Modified: llvm/trunk/test/CodeGen/X86/vec_shuffle-12.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_shuffle-12.ll?rev=44836&r1=44835&r2=44836&view=diff
      
      ==============================================================================
      --- llvm/trunk/test/CodeGen/X86/vec_shuffle-12.ll (original)
      +++ llvm/trunk/test/CodeGen/X86/vec_shuffle-12.ll Mon Dec 10 19:46:18 2007
      @@ -1,37 +1,28 @@
       ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2
       ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | not grep punpck
      -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep pextrw | count 7
      -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep pinsrw | count 7
      -; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep pshuf | count 2
      +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep pextrw | count 4
      +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep pinsrw | count 6
      +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep pshuflw | count 3
      +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep pshufhw | count 2
       
      -define void @t1(<8 x i16>* %res, <8 x i16>* %A, <8 x i16>* %B) {
      +define <8 x i16> @t1(<8 x i16>* %A, <8 x i16>* %B) {
       	%tmp1 = load <8 x i16>* %A
       	%tmp2 = load <8 x i16>* %B
       	%tmp3 = shufflevector <8 x i16> %tmp1, <8 x i16> %tmp2, <8 x i32> < i32 8, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7 >
      -	store <8 x i16> %tmp3, <8 x i16>* %res
      -	ret void
      +	ret <8 x i16> %tmp3
       }
       
      -define void @t2(<8 x i16>* %res, <8 x i16>* %A, <8 x i16>* %B) {
      -	%tmp1 = load <8 x i16>* %A
      -	%tmp2 = load <8 x i16>* %B
      -	%tmp3 = shufflevector <8 x i16> %tmp1, <8 x i16> %tmp2, <8 x i32> < i32 8, i32 1, i32 2, i32 13, i32 4, i32 5, i32 6, i32 7 >
      -	store <8 x i16> %tmp3, <8 x i16>* %res
      -	ret void
      +define <8 x i16> @t2(<8 x i16> %A, <8 x i16> %B) {
      +	%tmp = shufflevector <8 x i16> %A, <8 x i16> %B, <8 x i32> < i32 9, i32 1, i32 2, i32 9, i32 4, i32 5, i32 6, i32 7 >
      +	ret <8 x i16> %tmp
       }
       
      -define void @t3(<8 x i16>* %res, <8 x i16>* %A, <8 x i16>* %B) {
      -	%tmp1 = load <8 x i16>* %A
      -	%tmp2 = load <8 x i16>* %B
      -	%tmp3 = shufflevector <8 x i16> %tmp1, <8 x i16> %tmp2, <8 x i32> < i32 8, i32 3, i32 2, i32 13, i32 7, i32 6, i32 5, i32 4 >
      -	store <8 x i16> %tmp3, <8 x i16>* %res
      -	ret void
      +define <8 x i16> @t3(<8 x i16> %A, <8 x i16> %B) {
      +	%tmp = shufflevector <8 x i16> %A, <8 x i16> %A, <8 x i32> < i32 8, i32 3, i32 2, i32 13, i32 7, i32 6, i32 5, i32 4 >
      +	ret <8 x i16> %tmp
       }
       
      -define void @t4(<8 x i16>* %res, <8 x i16>* %A, <8 x i16>* %B) {
      -	%tmp1 = load <8 x i16>* %A
      -	%tmp2 = load <8 x i16>* %B
      -	%tmp3 = shufflevector <8 x i16> %tmp1, <8 x i16> %tmp2, <8 x i32> < i32 8, i32 9, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7 >
      -	store <8 x i16> %tmp3, <8 x i16>* %res
      -	ret void
      +define <8 x i16> @t4(<8 x i16> %A, <8 x i16> %B) {
      +	%tmp = shufflevector <8 x i16> %A, <8 x i16> %B, <8 x i32> < i32 0, i32 7, i32 2, i32 3, i32 1, i32 5, i32 6, i32 5 >
      +	ret <8 x i16> %tmp
       }
      
      Added: llvm/trunk/test/CodeGen/X86/vec_shuffle-13.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_shuffle-13.ll?rev=44836&view=auto
      
      ==============================================================================
      --- llvm/trunk/test/CodeGen/X86/vec_shuffle-13.ll (added)
      +++ llvm/trunk/test/CodeGen/X86/vec_shuffle-13.ll Mon Dec 10 19:46:18 2007
      @@ -0,0 +1,21 @@
      +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2
      +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep movlhps | count 1
      +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep movss | count 1
      +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep pshufd | count 1
      +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep pshuflw | count 1
      +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep pshufhw | count 1
      +
      +define <8 x i16> @t1(<8 x i16> %A, <8 x i16> %B) {
      +	%tmp = shufflevector <8 x i16> %A, <8 x i16> %B, <8 x i32> < i32 8, i32 9, i32 0, i32 1, i32 10, i32 11, i32 2, i32 3 >
      +	ret <8 x i16> %tmp
      +}
      +
      +define <8 x i16> @t2(<8 x i16> %A, <8 x i16> %B) {
      +	%tmp = shufflevector <8 x i16> %A, <8 x i16> %B, <8 x i32> < i32 8, i32 9, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7 >
      +	ret <8 x i16> %tmp
      +}
      +
      +define <8 x i16> @t3(<8 x i16> %A, <8 x i16> %B) {
      +	%tmp = shufflevector <8 x i16> %A, <8 x i16> %B, <8 x i32> < i32 0, i32 0, i32 3, i32 2, i32 4, i32 6, i32 4, i32 7 >
      +	ret <8 x i16> %tmp
      +}
      
      
      
      
      From evan.cheng at apple.com  Mon Dec 10 20:08:35 2007
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Tue, 11 Dec 2007 02:08:35 -0000
      Subject: [llvm-commits] [llvm] r44837 -
      	/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
      Message-ID: <200712110208.lBB28ZQa022968@zion.cs.uiuc.edu>
      
      Author: evancheng
      Date: Mon Dec 10 20:08:35 2007
      New Revision: 44837
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44837&view=rev
      Log:
      Pretty print shuffle mask operand.
      
      Modified:
          llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
      
      Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=44837&r1=44836&r2=44837&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
      +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Mon Dec 10 20:08:35 2007
      @@ -3855,6 +3855,19 @@
             cerr << ":" << RN;
         }
       
      +  if (!isTargetOpcode() && getOpcode() == ISD::VECTOR_SHUFFLE) {
      +    SDNode *Mask = getOperand(2).Val;
      +    cerr << "<";
      +    for (unsigned i = 0, e = Mask->getNumOperands(); i != e; ++i) {
      +      if (i) cerr << ",";
      +      if (Mask->getOperand(i).getOpcode() == ISD::UNDEF)
      +        cerr << "u";
      +      else
      +        cerr << cast(Mask->getOperand(i))->getValue();
      +    }
      +    cerr << ">";
      +  }
      +
         if (const ConstantSDNode *CSDN = dyn_cast(this)) {
           cerr << "<" << CSDN->getValue() << ">";
         } else if (const ConstantFPSDNode *CSDN = dyn_cast(this)) {
      
      
      
      
      From evan.cheng at apple.com  Mon Dec 10 20:09:24 2007
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Tue, 11 Dec 2007 02:09:24 -0000
      Subject: [llvm-commits] [llvm] r44838 - in /llvm/trunk:
       include/llvm/CodeGen/LiveIntervalAnalysis.h
       lib/CodeGen/LiveIntervalAnalysis.cpp lib/CodeGen/RegAllocLinearScan.cpp
       lib/CodeGen/SimpleRegisterCoalescing.cpp
       lib/CodeGen/SimpleRegisterCoalescing.h
      Message-ID: <200712110209.lBB29OCo023089@zion.cs.uiuc.edu>
      
      Author: evancheng
      Date: Mon Dec 10 20:09:15 2007
      New Revision: 44838
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44838&view=rev
      Log:
      Switch over to MachineLoopInfo.
      
      Modified:
          llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h
          llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
          llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp
          llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
          llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.h
      
      Modified: llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h?rev=44838&r1=44837&r2=44838&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h (original)
      +++ llvm/trunk/include/llvm/CodeGen/LiveIntervalAnalysis.h Mon Dec 10 20:09:15 2007
      @@ -32,7 +32,7 @@
       namespace llvm {
       
         class LiveVariables;
      -  class LoopInfo;
      +  class MachineLoopInfo;
         class MRegisterInfo;
         class SSARegMap;
         class TargetInstrInfo;
      @@ -231,7 +231,7 @@
           /// the given interval.
           std::vector
           addIntervalsForSpills(const LiveInterval& i,
      -                          const LoopInfo *loopInfo, VirtRegMap& vrm);
      +                          const MachineLoopInfo *loopInfo, VirtRegMap& vrm);
       
           /// isReMaterializable - Returns true if every definition of MI of every
           /// val# of the specified interval is re-materializable. Also returns true
      @@ -321,7 +321,8 @@
               bool isLoad, bool isLoadSS, bool DefIsReMat, bool CanDelete,
               VirtRegMap &vrm, SSARegMap *RegMap, const TargetRegisterClass* rc,
               SmallVector &ReMatIds,
      -        unsigned &NewVReg, bool &HasDef, bool &HasUse, const LoopInfo *loopInfo,
      +        unsigned &NewVReg, bool &HasDef, bool &HasUse,
      +        const MachineLoopInfo *loopInfo,
               std::map &MBBVRegsMap,
               std::vector &NewLIs);
           void rewriteInstructionsForSpills(const LiveInterval &li, bool TrySplit,
      @@ -329,7 +330,7 @@
               MachineInstr *OrigDefMI, MachineInstr *DefMI, unsigned Slot, int LdSlot,
               bool isLoad, bool isLoadSS, bool DefIsReMat, bool CanDelete,
               VirtRegMap &vrm, SSARegMap *RegMap, const TargetRegisterClass* rc,
      -        SmallVector &ReMatIds, const LoopInfo *loopInfo,
      +        SmallVector &ReMatIds, const MachineLoopInfo *loopInfo,
               BitVector &SpillMBBs,
               std::map > &SpillIdxes,
               BitVector &RestoreMBBs,
      
      Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=44838&r1=44837&r2=44838&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original)
      +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Mon Dec 10 20:09:15 2007
      @@ -19,10 +19,10 @@
       #include "llvm/CodeGen/LiveIntervalAnalysis.h"
       #include "VirtRegMap.h"
       #include "llvm/Value.h"
      -#include "llvm/Analysis/LoopInfo.h"
       #include "llvm/CodeGen/LiveVariables.h"
       #include "llvm/CodeGen/MachineFrameInfo.h"
       #include "llvm/CodeGen/MachineInstr.h"
      +#include "llvm/CodeGen/MachineLoopInfo.h"
       #include "llvm/CodeGen/Passes.h"
       #include "llvm/CodeGen/SSARegMap.h"
       #include "llvm/Target/MRegisterInfo.h"
      @@ -765,7 +765,7 @@
                        const TargetRegisterClass* rc,
                        SmallVector &ReMatIds,
                        unsigned &NewVReg, bool &HasDef, bool &HasUse,
      -                 const LoopInfo *loopInfo,
      +                 const MachineLoopInfo *loopInfo,
                        std::map &MBBVRegsMap,
                        std::vector &NewLIs) {
         bool CanFold = false;
      @@ -962,7 +962,7 @@
                           VirtRegMap &vrm, SSARegMap *RegMap,
                           const TargetRegisterClass* rc,
                           SmallVector &ReMatIds,
      -                    const LoopInfo *loopInfo,
      +                    const MachineLoopInfo *loopInfo,
                           BitVector &SpillMBBs,
                           std::map > &SpillIdxes,
                           BitVector &RestoreMBBs,
      @@ -1119,7 +1119,7 @@
           }
       
           // Update spill weight.
      -    unsigned loopDepth = loopInfo->getLoopDepth(MBB->getBasicBlock());
      +    unsigned loopDepth = loopInfo->getLoopDepth(MBB);
           nI.weight += getSpillWeight(HasDef, HasUse, loopDepth);
         }
       
      @@ -1158,7 +1158,7 @@
       
       std::vector LiveIntervals::
       addIntervalsForSpills(const LiveInterval &li,
      -                      const LoopInfo *loopInfo, VirtRegMap &vrm) {
      +                      const MachineLoopInfo *loopInfo, VirtRegMap &vrm) {
         // Since this is called after the analysis is done we don't know if
         // LiveVariables is available
         lv_ = getAnalysisToUpdate();
      
      Modified: llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp?rev=44838&r1=44837&r2=44838&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp (original)
      +++ llvm/trunk/lib/CodeGen/RegAllocLinearScan.cpp Mon Dec 10 20:09:15 2007
      @@ -16,9 +16,9 @@
       #include "PhysRegTracker.h"
       #include "VirtRegMap.h"
       #include "llvm/Function.h"
      -#include "llvm/Analysis/LoopInfo.h"
       #include "llvm/CodeGen/MachineFunctionPass.h"
       #include "llvm/CodeGen/MachineInstr.h"
      +#include "llvm/CodeGen/MachineLoopInfo.h"
       #include "llvm/CodeGen/Passes.h"
       #include "llvm/CodeGen/RegAllocRegistry.h"
       #include "llvm/CodeGen/RegisterCoalescer.h"
      @@ -67,7 +67,7 @@
           SSARegMap *regmap_;
           BitVector allocatableRegs_;
           LiveIntervals* li_;
      -    const LoopInfo *loopInfo;
      +    const MachineLoopInfo *loopInfo;
       
           /// handled_ - Intervals are added to the handled_ set in the order of their
           /// start value.  This is uses for backtracking.
      @@ -103,7 +103,7 @@
             // Make sure PassManager knows which analyses to make available
             // to coalescing and which analyses coalescing invalidates.
             AU.addRequiredTransitive();
      -      AU.addRequired();
      +      AU.addRequired();
             MachineFunctionPass::getAnalysisUsage(AU);
           }
       
      @@ -254,7 +254,7 @@
         regmap_ = mf_->getSSARegMap();
         allocatableRegs_ = mri_->getAllocatableSet(fn);
         li_ = &getAnalysis();
      -  loopInfo = &getAnalysis();
      +  loopInfo = &getAnalysis();
       
         // We don't run the coalescer here because we have no reason to
         // interact with it.  If the coalescer requires interaction, it
      
      Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp?rev=44838&r1=44837&r2=44838&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp (original)
      +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.cpp Mon Dec 10 20:09:15 2007
      @@ -17,10 +17,10 @@
       #include "VirtRegMap.h"
       #include "llvm/CodeGen/LiveIntervalAnalysis.h"
       #include "llvm/Value.h"
      -#include "llvm/Analysis/LoopInfo.h"
       #include "llvm/CodeGen/LiveVariables.h"
       #include "llvm/CodeGen/MachineFrameInfo.h"
       #include "llvm/CodeGen/MachineInstr.h"
      +#include "llvm/CodeGen/MachineLoopInfo.h"
       #include "llvm/CodeGen/Passes.h"
       #include "llvm/CodeGen/SSARegMap.h"
       #include "llvm/CodeGen/RegisterCoalescer.h"
      @@ -72,7 +72,7 @@
         AU.addPreservedID(TwoAddressInstructionPassID);
         AU.addRequired();
         AU.addRequired();
      -  AU.addRequired();
      +  AU.addRequired();
         MachineFunctionPass::getAnalysisUsage(AU);
       }
       
      @@ -207,11 +207,10 @@
       bool SimpleRegisterCoalescing::isBackEdgeCopy(MachineInstr *CopyMI,
                                                     unsigned DstReg) {
         MachineBasicBlock *MBB = CopyMI->getParent();
      -  const BasicBlock *BB = MBB->getBasicBlock();
      -  const Loop *L = loopInfo->getLoopFor(BB);
      +  const MachineLoop *L = loopInfo->getLoopFor(MBB);
         if (!L)
           return false;
      -  if (BB != L->getLoopLatch())
      +  if (MBB != L->getLoopLatch())
           return false;
       
         DstReg = rep(DstReg);
      @@ -540,8 +539,7 @@
               unsigned SrcReg, DstReg;
               if (CopyMI && tii_->isMoveInstr(*CopyMI, SrcReg, DstReg) &&
                   JoinedCopies.count(CopyMI) == 0) {
      -          unsigned LoopDepth =
      -            loopInfo->getLoopDepth(CopyMI->getParent()->getBasicBlock());
      +          unsigned LoopDepth = loopInfo->getLoopDepth(CopyMI->getParent());
                 JoinQueue->push(CopyRec(CopyMI, SrcReg, DstReg, LoopDepth,
                                         isBackEdgeCopy(CopyMI, DstReg)));
               }
      @@ -1072,7 +1070,7 @@
       
         std::vector VirtCopies;
         std::vector PhysCopies;
      -  unsigned LoopDepth = loopInfo->getLoopDepth(MBB->getBasicBlock());
      +  unsigned LoopDepth = loopInfo->getLoopDepth(MBB);
         for (MachineBasicBlock::iterator MII = MBB->begin(), E = MBB->end();
              MII != E;) {
           MachineInstr *Inst = MII++;
      @@ -1143,9 +1141,10 @@
           // Join intervals in the function prolog first. We want to join physical
           // registers with virtual registers before the intervals got too long.
           std::vector > MBBs;
      -    for (MachineFunction::iterator I = mf_->begin(), E = mf_->end(); I != E;++I)
      -      MBBs.push_back(std::make_pair(loopInfo->
      -                                    getLoopDepth(I->getBasicBlock()), I));
      +    for (MachineFunction::iterator I = mf_->begin(), E = mf_->end();I != E;++I){
      +      MachineBasicBlock *MBB = I;
      +      MBBs.push_back(std::make_pair(loopInfo->getLoopDepth(MBB), I));
      +    }
       
           // Sort by loop depth.
           std::sort(MBBs.begin(), MBBs.end(), DepthMBBCompare());
      @@ -1380,7 +1379,7 @@
         tii_ = tm_->getInstrInfo();
         li_ = &getAnalysis();
         lv_ = &getAnalysis();
      -  loopInfo = &getAnalysis();
      +  loopInfo = &getAnalysis();
       
         DOUT << "********** SIMPLE REGISTER COALESCING **********\n"
              << "********** Function: "
      @@ -1427,7 +1426,7 @@
         for (MachineFunction::iterator mbbi = mf_->begin(), mbbe = mf_->end();
              mbbi != mbbe; ++mbbi) {
           MachineBasicBlock* mbb = mbbi;
      -    unsigned loopDepth = loopInfo->getLoopDepth(mbb->getBasicBlock());
      +    unsigned loopDepth = loopInfo->getLoopDepth(mbb);
       
           for (MachineBasicBlock::iterator mii = mbb->begin(), mie = mbb->end();
                mii != mie; ) {
      
      Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.h?rev=44838&r1=44837&r2=44838&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.h (original)
      +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.h Mon Dec 10 20:09:15 2007
      @@ -28,7 +28,7 @@
         class MRegisterInfo;
         class TargetInstrInfo;
         class VirtRegMap;
      -  class LoopInfo;
      +  class MachineLoopInfo;
       
         /// CopyRec - Representation for copy instructions in coalescer queue.
         ///
      @@ -84,7 +84,7 @@
           const TargetInstrInfo* tii_;
           LiveIntervals *li_;
           LiveVariables *lv_;
      -    const LoopInfo* loopInfo;
      +    const MachineLoopInfo* loopInfo;
           
           BitVector allocatableRegs_;
           DenseMap allocatableRCRegs_;
      
      
      
      
      From rspencer at reidspencer.com  Mon Dec 10 23:27:47 2007
      From: rspencer at reidspencer.com (Reid Spencer)
      Date: Tue, 11 Dec 2007 05:27:47 -0000
      Subject: [llvm-commits] [support] r44846 -
      	/support/trunk/autoconf/m4/want_level.m4
      Message-ID: <200712110527.lBB5RllS004837@zion.cs.uiuc.edu>
      
      Author: reid
      Date: Mon Dec 10 23:27:47 2007
      New Revision: 44846
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44846&view=rev
      Log:
      Allow some additional values for levels that are non-numeric.
      
      Modified:
          support/trunk/autoconf/m4/want_level.m4
      
      Modified: support/trunk/autoconf/m4/want_level.m4
      URL: http://llvm.org/viewvc/llvm-project/support/trunk/autoconf/m4/want_level.m4?rev=44846&r1=44845&r2=44846&view=diff
      
      ==============================================================================
      --- support/trunk/autoconf/m4/want_level.m4 (original)
      +++ support/trunk/autoconf/m4/want_level.m4 Mon Dec 10 23:27:47 2007
      @@ -9,6 +9,12 @@
         m4_define([allcapsname],translit($1,a-z-,A-Z_))
         AC_ARG_ENABLE([$1],
           AS_HELP_STRING([--enable-$1],[$2 ($3)]),,enableval="$3")
      +  case "$enableval" in
      +    yes) enableval="1" ;;
      +    no)  enableval="0" ;;
      +    [0-9]*) ;;
      +    *)   enableval="0" ;;
      +  esac
         digits=`echo "$enableval" | sed 's/[^0-9]//'`
         if test -z "$digits" ; then
           AC_MSG_ERROR([Expected numeric value for --enable-$1.])
      
      
      
      
      From rspencer at reidspencer.com  Mon Dec 10 23:33:05 2007
      From: rspencer at reidspencer.com (Reid Spencer)
      Date: Tue, 11 Dec 2007 05:33:05 -0000
      Subject: [llvm-commits] [support] r44847 - /support/trunk/include/llvm/ADT/
      Message-ID: <200712110533.lBB5X5MM005131@zion.cs.uiuc.edu>
      
      Author: reid
      Date: Mon Dec 10 23:33:05 2007
      New Revision: 44847
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44847&view=rev
      Log:
      Prepare for update by deleting everything.
      
      Removed:
          support/trunk/include/llvm/ADT/
      
      
      
      From rspencer at reidspencer.com  Mon Dec 10 23:36:40 2007
      From: rspencer at reidspencer.com (Reid Spencer)
      Date: Tue, 11 Dec 2007 05:36:40 -0000
      Subject: [llvm-commits] [support] r44848 - /support/trunk/include/llvm/ADT/
      Message-ID: <200712110536.lBB5aefd005266@zion.cs.uiuc.edu>
      
      Author: reid
      Date: Mon Dec 10 23:36:40 2007
      New Revision: 44848
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44848&view=rev
      Log:
      Add latest ADT header from llvm module to support module.
      
      Added:
          support/trunk/include/llvm/ADT/
            - copied from r44847, llvm/trunk/include/llvm/ADT/
      
      
      
      From sabre at nondot.org  Mon Dec 10 23:55:02 2007
      From: sabre at nondot.org (Chris Lattner)
      Date: Tue, 11 Dec 2007 05:55:02 -0000
      Subject: [llvm-commits] [llvm] r44849 -
      	/llvm/trunk/lib/VMCore/ConstantFold.cpp
      Message-ID: <200712110555.lBB5t2dT006304@zion.cs.uiuc.edu>
      
      Author: lattner
      Date: Mon Dec 10 23:55:02 2007
      New Revision: 44849
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44849&view=rev
      Log:
      refactor some code, no functionality change.
      
      Modified:
          llvm/trunk/lib/VMCore/ConstantFold.cpp
      
      Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=44849&r1=44848&r2=44849&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/VMCore/ConstantFold.cpp (original)
      +++ llvm/trunk/lib/VMCore/ConstantFold.cpp Mon Dec 10 23:55:02 2007
      @@ -138,6 +138,101 @@
                                               Type::Int64Ty);
       }
       
      +static Constant *FoldBitCast(Constant *V, const Type *DestTy) {
      +  const Type *SrcTy = V->getType();
      +  if (SrcTy == DestTy)
      +    return V; // no-op cast
      +  
      +  // Check to see if we are casting a pointer to an aggregate to a pointer to
      +  // the first element.  If so, return the appropriate GEP instruction.
      +  if (const PointerType *PTy = dyn_cast(V->getType()))
      +    if (const PointerType *DPTy = dyn_cast(DestTy)) {
      +      SmallVector IdxList;
      +      IdxList.push_back(Constant::getNullValue(Type::Int32Ty));
      +      const Type *ElTy = PTy->getElementType();
      +      while (ElTy != DPTy->getElementType()) {
      +        if (const StructType *STy = dyn_cast(ElTy)) {
      +          if (STy->getNumElements() == 0) break;
      +          ElTy = STy->getElementType(0);
      +          IdxList.push_back(Constant::getNullValue(Type::Int32Ty));
      +        } else if (const SequentialType *STy = dyn_cast(ElTy)) {
      +          if (isa(ElTy)) break;  // Can't index into pointers!
      +          ElTy = STy->getElementType();
      +          IdxList.push_back(IdxList[0]);
      +        } else {
      +          break;
      +        }
      +      }
      +      
      +      if (ElTy == DPTy->getElementType())
      +        return ConstantExpr::getGetElementPtr(V, &IdxList[0], IdxList.size());
      +    }
      +  
      +  // Handle casts from one vector constant to another.  We know that the src 
      +  // and dest type have the same size (otherwise its an illegal cast).
      +  if (const VectorType *DestPTy = dyn_cast(DestTy)) {
      +    if (const VectorType *SrcTy = dyn_cast(V->getType())) {
      +      assert(DestPTy->getBitWidth() == SrcTy->getBitWidth() &&
      +             "Not cast between same sized vectors!");
      +      // First, check for null.  Undef is already handled.
      +      if (isa(V))
      +        return Constant::getNullValue(DestTy);
      +      
      +      if (const ConstantVector *CV = dyn_cast(V)) {
      +        // This is a cast from a ConstantVector of one type to a 
      +        // ConstantVector of another type.  Check to see if all elements of 
      +        // the input are simple.
      +        bool AllSimpleConstants = true;
      +        for (unsigned i = 0, e = CV->getNumOperands(); i != e; ++i) {
      +          if (!isa(CV->getOperand(i)) &&
      +              !isa(CV->getOperand(i))) {
      +            AllSimpleConstants = false;
      +            break;
      +          }
      +        }
      +        
      +        // If all of the elements are simple constants, we can fold this.
      +        if (AllSimpleConstants)
      +          return CastConstantVector(const_cast(CV), DestPTy);
      +      }
      +    }
      +  }
      +  
      +  // Finally, implement bitcast folding now.   The code below doesn't handle
      +  // bitcast right.
      +  if (isa(V))  // ptr->ptr cast.
      +    return ConstantPointerNull::get(cast(DestTy));
      +  
      +  // Handle integral constant input.
      +  if (const ConstantInt *CI = dyn_cast(V)) {
      +    if (DestTy->isInteger())
      +      // Integral -> Integral. This is a no-op because the bit widths must
      +      // be the same. Consequently, we just fold to V.
      +      return V;
      +    
      +    if (DestTy->isFloatingPoint()) {
      +      assert((DestTy == Type::DoubleTy || DestTy == Type::FloatTy) && 
      +             "Unknown FP type!");
      +      return ConstantFP::get(DestTy, APFloat(CI->getValue()));
      +    }
      +    // Otherwise, can't fold this (vector?)
      +    return 0;
      +  }
      +  
      +  // Handle ConstantFP input.
      +  if (const ConstantFP *FP = dyn_cast(V)) {
      +    // FP -> Integral.
      +    if (DestTy == Type::Int32Ty) {
      +      return ConstantInt::get(FP->getValueAPF().convertToAPInt());
      +    } else {
      +      assert(DestTy == Type::Int64Ty && "only support f32/f64 for now!");
      +      return ConstantInt::get(FP->getValueAPF().convertToAPInt());
      +    }
      +  }
      +  return 0;
      +}
      +
      +
       Constant *llvm::ConstantFoldCastInstruction(unsigned opc, const Constant *V,
                                                   const Type *DestTy) {
         const Type *SrcTy = V->getType();
      @@ -268,100 +363,7 @@
           }
           return 0;
         case Instruction::BitCast:
      -    if (SrcTy == DestTy) 
      -      return (Constant*)V; // no-op cast
      -    
      -    // Check to see if we are casting a pointer to an aggregate to a pointer to
      -    // the first element.  If so, return the appropriate GEP instruction.
      -    if (const PointerType *PTy = dyn_cast(V->getType()))
      -      if (const PointerType *DPTy = dyn_cast(DestTy)) {
      -        SmallVector IdxList;
      -        IdxList.push_back(Constant::getNullValue(Type::Int32Ty));
      -        const Type *ElTy = PTy->getElementType();
      -        while (ElTy != DPTy->getElementType()) {
      -          if (const StructType *STy = dyn_cast(ElTy)) {
      -            if (STy->getNumElements() == 0) break;
      -            ElTy = STy->getElementType(0);
      -            IdxList.push_back(Constant::getNullValue(Type::Int32Ty));
      -          } else if (const SequentialType *STy = 
      -                     dyn_cast(ElTy)) {
      -            if (isa(ElTy)) break;  // Can't index into pointers!
      -            ElTy = STy->getElementType();
      -            IdxList.push_back(IdxList[0]);
      -          } else {
      -            break;
      -          }
      -        }
      -
      -        if (ElTy == DPTy->getElementType())
      -          return ConstantExpr::getGetElementPtr(
      -              const_cast(V), &IdxList[0], IdxList.size());
      -      }
      -        
      -    // Handle casts from one vector constant to another.  We know that the src 
      -    // and dest type have the same size (otherwise its an illegal cast).
      -    if (const VectorType *DestPTy = dyn_cast(DestTy)) {
      -      if (const VectorType *SrcTy = dyn_cast(V->getType())) {
      -        assert(DestPTy->getBitWidth() == SrcTy->getBitWidth() &&
      -               "Not cast between same sized vectors!");
      -        // First, check for null and undef
      -        if (isa(V))
      -          return Constant::getNullValue(DestTy);
      -        if (isa(V))
      -          return UndefValue::get(DestTy);
      -
      -        if (const ConstantVector *CV = dyn_cast(V)) {
      -          // This is a cast from a ConstantVector of one type to a 
      -          // ConstantVector of another type.  Check to see if all elements of 
      -          // the input are simple.
      -          bool AllSimpleConstants = true;
      -          for (unsigned i = 0, e = CV->getNumOperands(); i != e; ++i) {
      -            if (!isa(CV->getOperand(i)) &&
      -                !isa(CV->getOperand(i))) {
      -              AllSimpleConstants = false;
      -              break;
      -            }
      -          }
      -              
      -          // If all of the elements are simple constants, we can fold this.
      -          if (AllSimpleConstants)
      -            return CastConstantVector(const_cast(CV), DestPTy);
      -        }
      -      }
      -    }
      -
      -    // Finally, implement bitcast folding now.   The code below doesn't handle
      -    // bitcast right.
      -    if (isa(V))  // ptr->ptr cast.
      -      return ConstantPointerNull::get(cast(DestTy));
      -
      -    // Handle integral constant input.
      -    if (const ConstantInt *CI = dyn_cast(V)) {
      -      if (DestTy->isInteger())
      -        // Integral -> Integral. This is a no-op because the bit widths must
      -        // be the same. Consequently, we just fold to V.
      -        return const_cast(V);
      -
      -      if (DestTy->isFloatingPoint()) {
      -        assert((DestTy == Type::DoubleTy || DestTy == Type::FloatTy) && 
      -               "Unknown FP type!");
      -        return ConstantFP::get(DestTy, APFloat(CI->getValue()));
      -      }
      -      // Otherwise, can't fold this (vector?)
      -      return 0;
      -    }
      -      
      -    // Handle ConstantFP input.
      -    if (const ConstantFP *FP = dyn_cast(V)) {
      -      // FP -> Integral.
      -      if (DestTy == Type::Int32Ty) {
      -        return ConstantInt::get(FP->getValueAPF().convertToAPInt());
      -      } else {
      -        assert(DestTy == Type::Int64Ty && "only support f32/f64 for now!");
      -        return ConstantInt::get(FP->getValueAPF().convertToAPInt());
      -      }
      -    }
      -    return 0;
      +    return FoldBitCast(const_cast(V), DestTy);
         default:
           assert(!"Invalid CE CastInst opcode");
           break;
      
      
      
      
      From sabre at nondot.org  Tue Dec 11 00:07:40 2007
      From: sabre at nondot.org (Chris Lattner)
      Date: Tue, 11 Dec 2007 06:07:40 -0000
      Subject: [llvm-commits] [llvm] r44850 -
      	/llvm/trunk/lib/VMCore/ConstantFold.cpp
      Message-ID: <200712110607.lBB67ew1006983@zion.cs.uiuc.edu>
      
      Author: lattner
      Date: Tue Dec 11 00:07:39 2007
      New Revision: 44850
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44850&view=rev
      Log:
      significantly simplify some code, no functionality change.
      
      Modified:
          llvm/trunk/lib/VMCore/ConstantFold.cpp
      
      Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=44850&r1=44849&r2=44850&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/VMCore/ConstantFold.cpp (original)
      +++ llvm/trunk/lib/VMCore/ConstantFold.cpp Tue Dec 11 00:07:39 2007
      @@ -36,81 +36,31 @@
       //                ConstantFold*Instruction Implementations
       //===----------------------------------------------------------------------===//
       
      -/// CastConstantVector - Convert the specified ConstantVector node to the
      +/// BitCastConstantVector - Convert the specified ConstantVector node to the
       /// specified vector type.  At this point, we know that the elements of the
       /// input vector constant are all simple integer or FP values.
      -static Constant *CastConstantVector(ConstantVector *CV,
      -                                    const VectorType *DstTy) {
      -  unsigned SrcNumElts = CV->getType()->getNumElements();
      -  unsigned DstNumElts = DstTy->getNumElements();
      -  const Type *SrcEltTy = CV->getType()->getElementType();
      -  const Type *DstEltTy = DstTy->getElementType();
      +static Constant *BitCastConstantVector(ConstantVector *CV,
      +                                       const VectorType *DstTy) {
      +  // If this cast changes element count then we can't handle it here:
      +  // doing so requires endianness information.  This should be handled by
      +  // Analysis/ConstantFolding.cpp
      +  unsigned NumElts = DstTy->getNumElements();
      +  if (NumElts != CV->getNumOperands())
      +    return 0;
         
      -  // If both vectors have the same number of elements (thus, the elements
      -  // are the same size), perform the conversion now.
      -  if (SrcNumElts == DstNumElts) {
      -    std::vector Result;
      -    
      -    // If the src and dest elements are both integers, or both floats, we can 
      -    // just BitCast each element because the elements are the same size.
      -    if ((SrcEltTy->isInteger() && DstEltTy->isInteger()) ||
      -        (SrcEltTy->isFloatingPoint() && DstEltTy->isFloatingPoint())) {
      -      for (unsigned i = 0; i != SrcNumElts; ++i)
      -        Result.push_back(
      -          ConstantExpr::getBitCast(CV->getOperand(i), DstEltTy));
      -      return ConstantVector::get(Result);
      -    }
      -    
      -    // If this is an int-to-fp cast ..
      -    if (SrcEltTy->isInteger()) {
      -      // Ensure that it is int-to-fp cast
      -      assert(DstEltTy->isFloatingPoint());
      -      if (DstEltTy->getTypeID() == Type::DoubleTyID) {
      -        for (unsigned i = 0; i != SrcNumElts; ++i) {
      -          ConstantInt *CI = cast(CV->getOperand(i));
      -          double V = CI->getValue().bitsToDouble();
      -          Result.push_back(ConstantFP::get(Type::DoubleTy, APFloat(V)));
      -        }
      -        return ConstantVector::get(Result);
      -      }
      -      assert(DstEltTy == Type::FloatTy && "Unknown fp type!");
      -      for (unsigned i = 0; i != SrcNumElts; ++i) {
      -        ConstantInt *CI = cast(CV->getOperand(i));
      -        float V = CI->getValue().bitsToFloat();
      -        Result.push_back(ConstantFP::get(Type::FloatTy, APFloat(V)));
      -      }
      -      return ConstantVector::get(Result);
      -    }
      -    
      -    // Otherwise, this is an fp-to-int cast.
      -    assert(SrcEltTy->isFloatingPoint() && DstEltTy->isInteger());
      -    
      -    if (SrcEltTy->getTypeID() == Type::DoubleTyID) {
      -      for (unsigned i = 0; i != SrcNumElts; ++i) {
      -        uint64_t V = cast(CV->getOperand(i))->
      -                       getValueAPF().convertToAPInt().getZExtValue();
      -        Constant *C = ConstantInt::get(Type::Int64Ty, V);
      -        Result.push_back(ConstantExpr::getBitCast(C, DstEltTy ));
      -      }
      -      return ConstantVector::get(Result);
      -    }
      -
      -    assert(SrcEltTy->getTypeID() == Type::FloatTyID);
      -    for (unsigned i = 0; i != SrcNumElts; ++i) {
      -      uint32_t V = (uint32_t)cast(CV->getOperand(i))->
      -                               getValueAPF().convertToAPInt().getZExtValue();
      -      Constant *C = ConstantInt::get(Type::Int32Ty, V);
      -      Result.push_back(ConstantExpr::getBitCast(C, DstEltTy));
      -    }
      -    return ConstantVector::get(Result);
      +  // Check to verify that all elements of the input are simple.
      +  for (unsigned i = 0; i != NumElts; ++i) {
      +    if (!isa(CV->getOperand(i)) &&
      +        !isa(CV->getOperand(i)))
      +      return 0;
         }
      -  
      -  // Otherwise, this is a cast that changes element count and size.  Handle
      -  // casts which shrink the elements here.
      -  
      -  // FIXME: We need to know endianness to do this!
      -  
      -  return 0;
      +
      +  // Bitcast each element now.
      +  std::vector Result;
      +  const Type *DstEltTy = DstTy->getElementType();
      +  for (unsigned i = 0; i != NumElts; ++i)
      +    Result.push_back(ConstantExpr::getBitCast(CV->getOperand(i), DstEltTy));
      +  return ConstantVector::get(Result);
       }
       
       /// This function determines which opcode to use to fold two constant cast 
      @@ -178,23 +128,8 @@
             if (isa(V))
               return Constant::getNullValue(DestTy);
             
      -      if (const ConstantVector *CV = dyn_cast(V)) {
      -        // This is a cast from a ConstantVector of one type to a 
      -        // ConstantVector of another type.  Check to see if all elements of 
      -        // the input are simple.
      -        bool AllSimpleConstants = true;
      -        for (unsigned i = 0, e = CV->getNumOperands(); i != e; ++i) {
      -          if (!isa(CV->getOperand(i)) &&
      -              !isa(CV->getOperand(i))) {
      -            AllSimpleConstants = false;
      -            break;
      -          }
      -        }
      -        
      -        // If all of the elements are simple constants, we can fold this.
      -        if (AllSimpleConstants)
      -          return CastConstantVector(const_cast(CV), DestPTy);
      -      }
      +      if (ConstantVector *CV = dyn_cast(V))
      +        return BitCastConstantVector(CV, DestPTy);
           }
         }
         
      
      
      
      
      From asl at math.spbu.ru  Tue Dec 11 00:53:44 2007
      From: asl at math.spbu.ru (Anton Korobeynikov)
      Date: Tue, 11 Dec 2007 06:53:44 -0000
      Subject: [llvm-commits] [llvm] r44851 - /llvm/trunk/include/llvm/ADT/Trie.h
      Message-ID: <200712110653.lBB6ri8c010340@zion.cs.uiuc.edu>
      
      Author: asl
      Date: Tue Dec 11 00:53:44 2007
      New Revision: 44851
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44851&view=rev
      Log:
      Add first and really dirty version of generic Trie structure
      
      Added:
          llvm/trunk/include/llvm/ADT/Trie.h
      
      Added: llvm/trunk/include/llvm/ADT/Trie.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Trie.h?rev=44851&view=auto
      
      ==============================================================================
      --- llvm/trunk/include/llvm/ADT/Trie.h (added)
      +++ llvm/trunk/include/llvm/ADT/Trie.h Tue Dec 11 00:53:44 2007
      @@ -0,0 +1,223 @@
      +//===- llvm/ADT/Trie.h ---- Generic trie structure --------------*- C++ -*-===//
      +//
      +//                     The LLVM Compiler Infrastructure
      +//
      +// This file was developed by Anton Korobeynikov and is distributed under
      +// the University of Illinois Open Source License. See LICENSE.TXT for details.
      +//
      +//===----------------------------------------------------------------------===//
      +//
      +// This class defines a generic trie structure. The trie structure
      +// is immutable after creation, but the payload contained within it is not.
      +//
      +//===----------------------------------------------------------------------===//
      +
      +#ifndef LLVM_ADT_TRIE_H
      +#define LLVM_ADT_TRIE_H
      +
      +#include 
      +#include 
      +
      +namespace llvm {
      +
      +// FIXME:
      +// - Labels are usually small, maybe it's better to use SmallString
      +// - Something efficient for child storage
      +// - Should we use char* during construction?
      +// - GraphTraits interface
      +// - Eliminate Edge class, which is ok for debugging, but not for end code
      +
      +template
      +class Trie {
      +  class Edge;
      +  class Node;
      +
      +  class Edge {
      +    std::string Label;
      +    Node *Parent, *Child;
      +
      +  public:
      +    typedef enum {
      +      Same           = -3,
      +      StringIsPrefix = -2,
      +      LabelIsPrefix  = -1,
      +      DontMatch      = 0,
      +      HaveCommonPart
      +    } QueryResult;
      +
      +    inline explicit Edge(std::string label = "",
      +                         Node* parent = NULL, Node* child = NULL):
      +      Label(label), Parent(parent), Child(child) { }
      +
      +    inline void setParent(Node* parent) { Parent = parent; }
      +    inline Node* getParent() const { return Parent; }
      +    inline void setChild(Node* child) { Child = child; }
      +    inline Node* getChild() const { return Child; }
      +    inline void setLabel(const std::string& label) { Label = label; }
      +    inline const std::string& getLabel() const { return Label; }
      +
      +    QueryResult query(const std::string& string) const {
      +      unsigned i, l;
      +      unsigned l1 = string.length();
      +      unsigned l2 = Label.length();
      +
      +      // Find the length of common part
      +      l = std::min(l1, l2);
      +      i = 0;
      +      while ((i < l) && (string[i] == Label[i]))
      +        ++i;
      +
      +      if (i == l) { // One is prefix of another, find who is who
      +        if (l1 == l2)
      +          return Same;
      +        else if (i == l1)
      +          return StringIsPrefix;
      +        else
      +          return LabelIsPrefix;
      +      } else // String and Label just have common part, return its length
      +        return (QueryResult)i;
      +    }
      +  };
      +
      +  class Node {
      +    friend class Trie;
      +
      +    std::map Edges;
      +    Payload Data;
      +  public:
      +    inline explicit Node(const Payload& data):Data(data) { }
      +    inline Node(const Node& n) {
      +      Data = n.Data;
      +      Edges = n.Edges;
      +    }
      +    inline Node& operator=(const Node& n) {
      +      if (&n != this) {
      +        Data = n.Data;
      +        Edges = n.Edges;
      +      }
      +
      +      return *this;
      +    }
      +
      +    inline bool isLeaf() const { return Edges.empty(); }
      +
      +    inline const Payload& getData() const { return Data; }
      +    inline void setData(const Payload& data) { Data = data; }
      +
      +    inline Edge* addEdge(const std::string& Label) {
      +      if (!Edges.insert(std::make_pair(Label[0],
      +                                       Edge(Label, this))).second) {
      +        assert(0 && "Edge already exists!");
      +        return NULL;
      +      } else
      +        return &Edges[Label[0]];
      +    }
      +  };
      +
      +  std::vector Nodes;
      +  Payload Empty;
      +
      +  inline Node* addNode(const Payload& data) {
      +    Node* N = new Node(data);
      +    Nodes.push_back(N);
      +    return N;
      +  }
      +
      +  inline Node* splitEdge(Edge& cEdge, size_t index) {
      +    const std::string& l = cEdge.getLabel();
      +    assert(index < l.length() && "Trying to split too far!");
      +
      +    std::string l1 = l.substr(0, index);
      +    std::string l2 = l.substr(index);
      +
      +    Node* nNode = addNode(Empty);
      +    Edge* nEdge = nNode->addEdge(l2);
      +    nEdge->setChild(cEdge.getChild());
      +    cEdge.setChild(nNode);
      +    cEdge.setLabel(l1);
      +
      +    return nNode;
      +  }
      +
      +public:
      +  inline explicit Trie(const Payload& empty):Empty(empty) {
      +    addNode(Empty);
      +  }
      +  inline ~Trie() {
      +    for (unsigned i = 0, e = Nodes.size(); i != e; ++i)
      +      delete Nodes[i];
      +  }
      +
      +  inline Node* getRoot() const { return Nodes[0]; }
      +
      +  bool addString(const std::string& s, const Payload& data) {
      +    Node* cNode = getRoot();
      +    Edge* nEdge = NULL;
      +    std::string s1(s);
      +
      +    while (nEdge == NULL) {
      +      if (cNode->Edges.count(s1[0])) {
      +        Edge& cEdge = cNode->Edges[s1[0]];
      +        typename Edge::QueryResult r = cEdge.query(s1);
      +
      +        switch (r) {
      +        case Edge::Same:
      +        case Edge::StringIsPrefix:
      +        case Edge::DontMatch:
      +          assert(0 && "Impossible!");
      +          return false;
      +        case Edge::LabelIsPrefix:
      +          s1 = s1.substr(cEdge.getLabel().length());
      +          cNode = cEdge.getChild();
      +          break;
      +        default:
      +          nEdge = splitEdge(cEdge, r)->addEdge(s1.substr(r));
      +        }
      +      } else
      +        nEdge = cNode->addEdge(s1);
      +    }
      +
      +    Node* tNode = addNode(data);
      +    nEdge->setChild(tNode);
      +
      +    return true;
      +  }
      +
      +  const Payload& lookup(const std::string& s) const {
      +    Node* cNode = getRoot();
      +    Node* tNode = NULL;
      +    std::string s1(s);
      +
      +    while (tNode == NULL) {
      +      if (cNode->Edges.count(s1[0])) {
      +        Edge& cEdge = cNode->Edges[s1[0]];
      +        typename Edge::QueryResult r = cEdge.query(s1);
      +
      +        switch (r) {
      +        case Edge::Same:
      +          tNode = cEdge.getChild();
      +          break;
      +        case Edge::StringIsPrefix:
      +          return Empty;
      +        case Edge::DontMatch:
      +          assert(0 && "Impossible!");
      +          return Empty;
      +        case Edge::LabelIsPrefix:
      +          s1 = s1.substr(cEdge.getLabel().length());
      +          cNode = cEdge.getChild();
      +          break;
      +        default:
      +          return Empty;
      +        }
      +      } else
      +        return Empty;
      +    }
      +
      +    return tNode->getData();
      +  }
      +
      +};
      +
      +}
      +
      +#endif // LLVM_ADT_TRIE_H
      
      
      
      
      From rspencer at reidspencer.com  Tue Dec 11 00:53:58 2007
      From: rspencer at reidspencer.com (Reid Spencer)
      Date: Tue, 11 Dec 2007 06:53:58 -0000
      Subject: [llvm-commits] [llvm] r44852 - /llvm/trunk/lib/Support/APInt.cpp
      Message-ID: <200712110653.lBB6rwvZ010375@zion.cs.uiuc.edu>
      
      Author: reid
      Date: Tue Dec 11 00:53:58 2007
      New Revision: 44852
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44852&view=rev
      Log:
      Don't have APInt.cpp depend upon DerivedTypes.h. This helps with splitting the
      Support libraries separately into their own module.
      
      Modified:
          llvm/trunk/lib/Support/APInt.cpp
      
      Modified: llvm/trunk/lib/Support/APInt.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APInt.cpp?rev=44852&r1=44851&r2=44852&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Support/APInt.cpp (original)
      +++ llvm/trunk/lib/Support/APInt.cpp Tue Dec 11 00:53:58 2007
      @@ -14,7 +14,6 @@
       
       #define DEBUG_TYPE "apint"
       #include "llvm/ADT/APInt.h"
      -#include "llvm/DerivedTypes.h"
       #include "llvm/Support/Debug.h"
       #include "llvm/Support/MathExtras.h"
       #include 
      @@ -25,6 +24,16 @@
       
       using namespace llvm;
       
      +
      +/// This enumeration just provides for internal constants used in this
      +/// translation unit. 
      +enum {
      +  MIN_INT_BITS = 1,        ///< Minimum number of bits that can be specified
      +  ///< Note that this must remain synchronized with IntegerType::MIN_INT_BITS
      +  MAX_INT_BITS = (1<<23)-1 ///< Maximum number of bits that can be specified
      +  ///< Note that this must remain synchronized with IntegerType::MAX_INT_BITS
      +};
      +
       /// A utility function for allocating memory, checking for allocation failures,
       /// and ensuring the contents are zeroed.
       inline static uint64_t* getClearedMemory(uint32_t numWords) {
      @@ -44,8 +53,8 @@
       
       APInt::APInt(uint32_t numBits, uint64_t val, bool isSigned) 
         : BitWidth(numBits), VAL(0) {
      -  assert(BitWidth >= IntegerType::MIN_INT_BITS && "bitwidth too small");
      -  assert(BitWidth <= IntegerType::MAX_INT_BITS && "bitwidth too large");
      +  assert(BitWidth >= MIN_INT_BITS && "bitwidth too small");
      +  assert(BitWidth <= MAX_INT_BITS && "bitwidth too large");
         if (isSingleWord())
           VAL = val;
         else {
      @@ -60,8 +69,8 @@
       
       APInt::APInt(uint32_t numBits, uint32_t numWords, const uint64_t bigVal[])
         : BitWidth(numBits), VAL(0)  {
      -  assert(BitWidth >= IntegerType::MIN_INT_BITS && "bitwidth too small");
      -  assert(BitWidth <= IntegerType::MAX_INT_BITS && "bitwidth too large");
      +  assert(BitWidth >= MIN_INT_BITS && "bitwidth too small");
      +  assert(BitWidth <= MAX_INT_BITS && "bitwidth too large");
         assert(bigVal && "Null pointer detected!");
         if (isSingleWord())
           VAL = bigVal[0];
      @@ -80,23 +89,23 @@
       APInt::APInt(uint32_t numbits, const char StrStart[], uint32_t slen, 
                    uint8_t radix) 
         : BitWidth(numbits), VAL(0) {
      -  assert(BitWidth >= IntegerType::MIN_INT_BITS && "bitwidth too small");
      -  assert(BitWidth <= IntegerType::MAX_INT_BITS && "bitwidth too large");
      +  assert(BitWidth >= MIN_INT_BITS && "bitwidth too small");
      +  assert(BitWidth <= MAX_INT_BITS && "bitwidth too large");
         fromString(numbits, StrStart, slen, radix);
       }
       
       APInt::APInt(uint32_t numbits, const std::string& Val, uint8_t radix)
         : BitWidth(numbits), VAL(0) {
      -  assert(BitWidth >= IntegerType::MIN_INT_BITS && "bitwidth too small");
      -  assert(BitWidth <= IntegerType::MAX_INT_BITS && "bitwidth too large");
      +  assert(BitWidth >= MIN_INT_BITS && "bitwidth too small");
      +  assert(BitWidth <= MAX_INT_BITS && "bitwidth too large");
         assert(!Val.empty() && "String empty?");
         fromString(numbits, Val.c_str(), Val.size(), radix);
       }
       
       APInt::APInt(const APInt& that)
         : BitWidth(that.BitWidth), VAL(0) {
      -  assert(BitWidth >= IntegerType::MIN_INT_BITS && "bitwidth too small");
      -  assert(BitWidth <= IntegerType::MAX_INT_BITS && "bitwidth too large");
      +  assert(BitWidth >= MIN_INT_BITS && "bitwidth too small");
      +  assert(BitWidth <= MAX_INT_BITS && "bitwidth too large");
         if (isSingleWord()) 
           VAL = that.VAL;
         else {
      @@ -943,7 +952,7 @@
       // Truncate to new width.
       APInt &APInt::trunc(uint32_t width) {
         assert(width < BitWidth && "Invalid APInt Truncate request");
      -  assert(width >= IntegerType::MIN_INT_BITS && "Can't truncate to 0 bits");
      +  assert(width >= MIN_INT_BITS && "Can't truncate to 0 bits");
         uint32_t wordsBefore = getNumWords();
         BitWidth = width;
         uint32_t wordsAfter = getNumWords();
      @@ -966,7 +975,7 @@
       // Sign extend to a new width.
       APInt &APInt::sext(uint32_t width) {
         assert(width > BitWidth && "Invalid APInt SignExtend request");
      -  assert(width <= IntegerType::MAX_INT_BITS && "Too many bits");
      +  assert(width <= MAX_INT_BITS && "Too many bits");
         // If the sign bit isn't set, this is the same as zext.
         if (!isNegative()) {
           zext(width);
      @@ -1014,7 +1023,7 @@
       //  Zero extend to a new width.
       APInt &APInt::zext(uint32_t width) {
         assert(width > BitWidth && "Invalid APInt ZeroExtend request");
      -  assert(width <= IntegerType::MAX_INT_BITS && "Too many bits");
      +  assert(width <= MAX_INT_BITS && "Too many bits");
         uint32_t wordsBefore = getNumWords();
         BitWidth = width;
         uint32_t wordsAfter = getNumWords();
      
      
      
      
      From rspencer at reidspencer.com  Tue Dec 11 00:57:04 2007
      From: rspencer at reidspencer.com (Reid Spencer)
      Date: Tue, 11 Dec 2007 06:57:04 -0000
      Subject: [llvm-commits] [support] r44853 -
      	/support/trunk/lib/Support/APInt.cpp
      Message-ID: <200712110657.lBB6v44I010518@zion.cs.uiuc.edu>
      
      Author: reid
      Date: Tue Dec 11 00:57:03 2007
      New Revision: 44853
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44853&view=rev
      Log:
      Remove APInt.cpp in preparation for update.
      
      Removed:
          support/trunk/lib/Support/APInt.cpp
      
      Removed: support/trunk/lib/Support/APInt.cpp
      URL: http://llvm.org/viewvc/llvm-project/support/trunk/lib/Support/APInt.cpp?rev=44852&view=auto
      
      ==============================================================================
      --- support/trunk/lib/Support/APInt.cpp (original)
      +++ support/trunk/lib/Support/APInt.cpp (removed)
      @@ -1,2646 +0,0 @@
      -//===-- APInt.cpp - Implement APInt class ---------------------------------===//
      -//
      -//                     The LLVM Compiler Infrastructure
      -//
      -// This file was developed by Sheng Zhou and is distributed under the 
      -// University of Illinois Open Source License. See LICENSE.TXT for details.
      -//
      -//===----------------------------------------------------------------------===//
      -//
      -// This file implements a class to represent arbitrary precision integer
      -// constant values and provide a variety of arithmetic operations on them.
      -//
      -//===----------------------------------------------------------------------===//
      -
      -#define DEBUG_TYPE "apint"
      -#include "llvm/ADT/APInt.h"
      -#include "llvm/DerivedTypes.h"
      -#include "llvm/Support/Debug.h"
      -#include "llvm/Support/MathExtras.h"
      -#include 
      -#include 
      -#include 
      -#include 
      -#include 
      -
      -using namespace llvm;
      -
      -/// A utility function for allocating memory, checking for allocation failures,
      -/// and ensuring the contents are zeroed.
      -inline static uint64_t* getClearedMemory(uint32_t numWords) {
      -  uint64_t * result = new uint64_t[numWords];
      -  assert(result && "APInt memory allocation fails!");
      -  memset(result, 0, numWords * sizeof(uint64_t));
      -  return result;
      -}
      -
      -/// A utility function for allocating memory and checking for allocation 
      -/// failure.  The content is not zeroed.
      -inline static uint64_t* getMemory(uint32_t numWords) {
      -  uint64_t * result = new uint64_t[numWords];
      -  assert(result && "APInt memory allocation fails!");
      -  return result;
      -}
      -
      -APInt::APInt(uint32_t numBits, uint64_t val, bool isSigned) 
      -  : BitWidth(numBits), VAL(0) {
      -  assert(BitWidth >= IntegerType::MIN_INT_BITS && "bitwidth too small");
      -  assert(BitWidth <= IntegerType::MAX_INT_BITS && "bitwidth too large");
      -  if (isSingleWord())
      -    VAL = val;
      -  else {
      -    pVal = getClearedMemory(getNumWords());
      -    pVal[0] = val;
      -    if (isSigned && int64_t(val) < 0) 
      -      for (unsigned i = 1; i < getNumWords(); ++i)
      -        pVal[i] = -1ULL;
      -  }
      -  clearUnusedBits();
      -}
      -
      -APInt::APInt(uint32_t numBits, uint32_t numWords, const uint64_t bigVal[])
      -  : BitWidth(numBits), VAL(0)  {
      -  assert(BitWidth >= IntegerType::MIN_INT_BITS && "bitwidth too small");
      -  assert(BitWidth <= IntegerType::MAX_INT_BITS && "bitwidth too large");
      -  assert(bigVal && "Null pointer detected!");
      -  if (isSingleWord())
      -    VAL = bigVal[0];
      -  else {
      -    // Get memory, cleared to 0
      -    pVal = getClearedMemory(getNumWords());
      -    // Calculate the number of words to copy
      -    uint32_t words = std::min(numWords, getNumWords());
      -    // Copy the words from bigVal to pVal
      -    memcpy(pVal, bigVal, words * APINT_WORD_SIZE);
      -  }
      -  // Make sure unused high bits are cleared
      -  clearUnusedBits();
      -}
      -
      -APInt::APInt(uint32_t numbits, const char StrStart[], uint32_t slen, 
      -             uint8_t radix) 
      -  : BitWidth(numbits), VAL(0) {
      -  assert(BitWidth >= IntegerType::MIN_INT_BITS && "bitwidth too small");
      -  assert(BitWidth <= IntegerType::MAX_INT_BITS && "bitwidth too large");
      -  fromString(numbits, StrStart, slen, radix);
      -}
      -
      -APInt::APInt(uint32_t numbits, const std::string& Val, uint8_t radix)
      -  : BitWidth(numbits), VAL(0) {
      -  assert(BitWidth >= IntegerType::MIN_INT_BITS && "bitwidth too small");
      -  assert(BitWidth <= IntegerType::MAX_INT_BITS && "bitwidth too large");
      -  assert(!Val.empty() && "String empty?");
      -  fromString(numbits, Val.c_str(), Val.size(), radix);
      -}
      -
      -APInt::APInt(const APInt& that)
      -  : BitWidth(that.BitWidth), VAL(0) {
      -  assert(BitWidth >= IntegerType::MIN_INT_BITS && "bitwidth too small");
      -  assert(BitWidth <= IntegerType::MAX_INT_BITS && "bitwidth too large");
      -  if (isSingleWord()) 
      -    VAL = that.VAL;
      -  else {
      -    pVal = getMemory(getNumWords());
      -    memcpy(pVal, that.pVal, getNumWords() * APINT_WORD_SIZE);
      -  }
      -}
      -
      -APInt::~APInt() {
      -  if (!isSingleWord() && pVal) 
      -    delete [] pVal;
      -}
      -
      -APInt& APInt::operator=(const APInt& RHS) {
      -  // Don't do anything for X = X
      -  if (this == &RHS)
      -    return *this;
      -
      -  // If the bitwidths are the same, we can avoid mucking with memory
      -  if (BitWidth == RHS.getBitWidth()) {
      -    if (isSingleWord()) 
      -      VAL = RHS.VAL;
      -    else
      -      memcpy(pVal, RHS.pVal, getNumWords() * APINT_WORD_SIZE);
      -    return *this;
      -  }
      -
      -  if (isSingleWord())
      -    if (RHS.isSingleWord())
      -      VAL = RHS.VAL;
      -    else {
      -      VAL = 0;
      -      pVal = getMemory(RHS.getNumWords());
      -      memcpy(pVal, RHS.pVal, RHS.getNumWords() * APINT_WORD_SIZE);
      -    }
      -  else if (getNumWords() == RHS.getNumWords()) 
      -    memcpy(pVal, RHS.pVal, RHS.getNumWords() * APINT_WORD_SIZE);
      -  else if (RHS.isSingleWord()) {
      -    delete [] pVal;
      -    VAL = RHS.VAL;
      -  } else {
      -    delete [] pVal;
      -    pVal = getMemory(RHS.getNumWords());
      -    memcpy(pVal, RHS.pVal, RHS.getNumWords() * APINT_WORD_SIZE);
      -  }
      -  BitWidth = RHS.BitWidth;
      -  return clearUnusedBits();
      -}
      -
      -APInt& APInt::operator=(uint64_t RHS) {
      -  if (isSingleWord()) 
      -    VAL = RHS;
      -  else {
      -    pVal[0] = RHS;
      -    memset(pVal+1, 0, (getNumWords() - 1) * APINT_WORD_SIZE);
      -  }
      -  return clearUnusedBits();
      -}
      -
      -/// add_1 - This function adds a single "digit" integer, y, to the multiple 
      -/// "digit" integer array,  x[]. x[] is modified to reflect the addition and
      -/// 1 is returned if there is a carry out, otherwise 0 is returned.
      -/// @returns the carry of the addition.
      -static bool add_1(uint64_t dest[], uint64_t x[], uint32_t len, uint64_t y) {
      -  for (uint32_t i = 0; i < len; ++i) {
      -    dest[i] = y + x[i];
      -    if (dest[i] < y)
      -      y = 1; // Carry one to next digit.
      -    else {
      -      y = 0; // No need to carry so exit early
      -      break;
      -    }
      -  }
      -  return y;
      -}
      -
      -/// @brief Prefix increment operator. Increments the APInt by one.
      -APInt& APInt::operator++() {
      -  if (isSingleWord()) 
      -    ++VAL;
      -  else
      -    add_1(pVal, pVal, getNumWords(), 1);
      -  return clearUnusedBits();
      -}
      -
      -/// sub_1 - This function subtracts a single "digit" (64-bit word), y, from 
      -/// the multi-digit integer array, x[], propagating the borrowed 1 value until 
      -/// no further borrowing is neeeded or it runs out of "digits" in x.  The result
      -/// is 1 if "borrowing" exhausted the digits in x, or 0 if x was not exhausted.
      -/// In other words, if y > x then this function returns 1, otherwise 0.
      -/// @returns the borrow out of the subtraction
      -static bool sub_1(uint64_t x[], uint32_t len, uint64_t y) {
      -  for (uint32_t i = 0; i < len; ++i) {
      -    uint64_t X = x[i];
      -    x[i] -= y;
      -    if (y > X) 
      -      y = 1;  // We have to "borrow 1" from next "digit"
      -    else {
      -      y = 0;  // No need to borrow
      -      break;  // Remaining digits are unchanged so exit early
      -    }
      -  }
      -  return bool(y);
      -}
      -
      -/// @brief Prefix decrement operator. Decrements the APInt by one.
      -APInt& APInt::operator--() {
      -  if (isSingleWord()) 
      -    --VAL;
      -  else
      -    sub_1(pVal, getNumWords(), 1);
      -  return clearUnusedBits();
      -}
      -
      -/// add - This function adds the integer array x to the integer array Y and
      -/// places the result in dest. 
      -/// @returns the carry out from the addition
      -/// @brief General addition of 64-bit integer arrays
      -static bool add(uint64_t *dest, const uint64_t *x, const uint64_t *y, 
      -                uint32_t len) {
      -  bool carry = false;
      -  for (uint32_t i = 0; i< len; ++i) {
      -    uint64_t limit = std::min(x[i],y[i]); // must come first in case dest == x
      -    dest[i] = x[i] + y[i] + carry;
      -    carry = dest[i] < limit || (carry && dest[i] == limit);
      -  }
      -  return carry;
      -}
      -
      -/// Adds the RHS APint to this APInt.
      -/// @returns this, after addition of RHS.
      -/// @brief Addition assignment operator. 
      -APInt& APInt::operator+=(const APInt& RHS) {
      -  assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
      -  if (isSingleWord()) 
      -    VAL += RHS.VAL;
      -  else {
      -    add(pVal, pVal, RHS.pVal, getNumWords());
      -  }
      -  return clearUnusedBits();
      -}
      -
      -/// Subtracts the integer array y from the integer array x 
      -/// @returns returns the borrow out.
      -/// @brief Generalized subtraction of 64-bit integer arrays.
      -static bool sub(uint64_t *dest, const uint64_t *x, const uint64_t *y, 
      -                uint32_t len) {
      -  bool borrow = false;
      -  for (uint32_t i = 0; i < len; ++i) {
      -    uint64_t x_tmp = borrow ? x[i] - 1 : x[i];
      -    borrow = y[i] > x_tmp || (borrow && x[i] == 0);
      -    dest[i] = x_tmp - y[i];
      -  }
      -  return borrow;
      -}
      -
      -/// Subtracts the RHS APInt from this APInt
      -/// @returns this, after subtraction
      -/// @brief Subtraction assignment operator. 
      -APInt& APInt::operator-=(const APInt& RHS) {
      -  assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
      -  if (isSingleWord()) 
      -    VAL -= RHS.VAL;
      -  else
      -    sub(pVal, pVal, RHS.pVal, getNumWords());
      -  return clearUnusedBits();
      -}
      -
      -/// Multiplies an integer array, x by a a uint64_t integer and places the result
      -/// into dest. 
      -/// @returns the carry out of the multiplication.
      -/// @brief Multiply a multi-digit APInt by a single digit (64-bit) integer.
      -static uint64_t mul_1(uint64_t dest[], uint64_t x[], uint32_t len, uint64_t y) {
      -  // Split y into high 32-bit part (hy)  and low 32-bit part (ly)
      -  uint64_t ly = y & 0xffffffffULL, hy = y >> 32;
      -  uint64_t carry = 0;
      -
      -  // For each digit of x.
      -  for (uint32_t i = 0; i < len; ++i) {
      -    // Split x into high and low words
      -    uint64_t lx = x[i] & 0xffffffffULL;
      -    uint64_t hx = x[i] >> 32;
      -    // hasCarry - A flag to indicate if there is a carry to the next digit.
      -    // hasCarry == 0, no carry
      -    // hasCarry == 1, has carry
      -    // hasCarry == 2, no carry and the calculation result == 0.
      -    uint8_t hasCarry = 0;
      -    dest[i] = carry + lx * ly;
      -    // Determine if the add above introduces carry.
      -    hasCarry = (dest[i] < carry) ? 1 : 0;
      -    carry = hx * ly + (dest[i] >> 32) + (hasCarry ? (1ULL << 32) : 0);
      -    // The upper limit of carry can be (2^32 - 1)(2^32 - 1) + 
      -    // (2^32 - 1) + 2^32 = 2^64.
      -    hasCarry = (!carry && hasCarry) ? 1 : (!carry ? 2 : 0);
      -
      -    carry += (lx * hy) & 0xffffffffULL;
      -    dest[i] = (carry << 32) | (dest[i] & 0xffffffffULL);
      -    carry = (((!carry && hasCarry != 2) || hasCarry == 1) ? (1ULL << 32) : 0) + 
      -            (carry >> 32) + ((lx * hy) >> 32) + hx * hy;
      -  }
      -  return carry;
      -}
      -
      -/// Multiplies integer array x by integer array y and stores the result into 
      -/// the integer array dest. Note that dest's size must be >= xlen + ylen.
      -/// @brief Generalized multiplicate of integer arrays.
      -static void mul(uint64_t dest[], uint64_t x[], uint32_t xlen, uint64_t y[], 
      -                uint32_t ylen) {
      -  dest[xlen] = mul_1(dest, x, xlen, y[0]);
      -  for (uint32_t i = 1; i < ylen; ++i) {
      -    uint64_t ly = y[i] & 0xffffffffULL, hy = y[i] >> 32;
      -    uint64_t carry = 0, lx = 0, hx = 0;
      -    for (uint32_t j = 0; j < xlen; ++j) {
      -      lx = x[j] & 0xffffffffULL;
      -      hx = x[j] >> 32;
      -      // hasCarry - A flag to indicate if has carry.
      -      // hasCarry == 0, no carry
      -      // hasCarry == 1, has carry
      -      // hasCarry == 2, no carry and the calculation result == 0.
      -      uint8_t hasCarry = 0;
      -      uint64_t resul = carry + lx * ly;
      -      hasCarry = (resul < carry) ? 1 : 0;
      -      carry = (hasCarry ? (1ULL << 32) : 0) + hx * ly + (resul >> 32);
      -      hasCarry = (!carry && hasCarry) ? 1 : (!carry ? 2 : 0);
      -
      -      carry += (lx * hy) & 0xffffffffULL;
      -      resul = (carry << 32) | (resul & 0xffffffffULL);
      -      dest[i+j] += resul;
      -      carry = (((!carry && hasCarry != 2) || hasCarry == 1) ? (1ULL << 32) : 0)+
      -              (carry >> 32) + (dest[i+j] < resul ? 1 : 0) + 
      -              ((lx * hy) >> 32) + hx * hy;
      -    }
      -    dest[i+xlen] = carry;
      -  }
      -}
      -
      -APInt& APInt::operator*=(const APInt& RHS) {
      -  assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
      -  if (isSingleWord()) {
      -    VAL *= RHS.VAL;
      -    clearUnusedBits();
      -    return *this;
      -  }
      -
      -  // Get some bit facts about LHS and check for zero
      -  uint32_t lhsBits = getActiveBits();
      -  uint32_t lhsWords = !lhsBits ? 0 : whichWord(lhsBits - 1) + 1;
      -  if (!lhsWords) 
      -    // 0 * X ===> 0
      -    return *this;
      -
      -  // Get some bit facts about RHS and check for zero
      -  uint32_t rhsBits = RHS.getActiveBits();
      -  uint32_t rhsWords = !rhsBits ? 0 : whichWord(rhsBits - 1) + 1;
      -  if (!rhsWords) {
      -    // X * 0 ===> 0
      -    clear();
      -    return *this;
      -  }
      -
      -  // Allocate space for the result
      -  uint32_t destWords = rhsWords + lhsWords;
      -  uint64_t *dest = getMemory(destWords);
      -
      -  // Perform the long multiply
      -  mul(dest, pVal, lhsWords, RHS.pVal, rhsWords);
      -
      -  // Copy result back into *this
      -  clear();
      -  uint32_t wordsToCopy = destWords >= getNumWords() ? getNumWords() : destWords;
      -  memcpy(pVal, dest, wordsToCopy * APINT_WORD_SIZE);
      -
      -  // delete dest array and return
      -  delete[] dest;
      -  return *this;
      -}
      -
      -APInt& APInt::operator&=(const APInt& RHS) {
      -  assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
      -  if (isSingleWord()) {
      -    VAL &= RHS.VAL;
      -    return *this;
      -  }
      -  uint32_t numWords = getNumWords();
      -  for (uint32_t i = 0; i < numWords; ++i)
      -    pVal[i] &= RHS.pVal[i];
      -  return *this;
      -}
      -
      -APInt& APInt::operator|=(const APInt& RHS) {
      -  assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
      -  if (isSingleWord()) {
      -    VAL |= RHS.VAL;
      -    return *this;
      -  }
      -  uint32_t numWords = getNumWords();
      -  for (uint32_t i = 0; i < numWords; ++i)
      -    pVal[i] |= RHS.pVal[i];
      -  return *this;
      -}
      -
      -APInt& APInt::operator^=(const APInt& RHS) {
      -  assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
      -  if (isSingleWord()) {
      -    VAL ^= RHS.VAL;
      -    this->clearUnusedBits();
      -    return *this;
      -  } 
      -  uint32_t numWords = getNumWords();
      -  for (uint32_t i = 0; i < numWords; ++i)
      -    pVal[i] ^= RHS.pVal[i];
      -  return clearUnusedBits();
      -}
      -
      -APInt APInt::operator&(const APInt& RHS) const {
      -  assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
      -  if (isSingleWord())
      -    return APInt(getBitWidth(), VAL & RHS.VAL);
      -
      -  uint32_t numWords = getNumWords();
      -  uint64_t* val = getMemory(numWords);
      -  for (uint32_t i = 0; i < numWords; ++i)
      -    val[i] = pVal[i] & RHS.pVal[i];
      -  return APInt(val, getBitWidth());
      -}
      -
      -APInt APInt::operator|(const APInt& RHS) const {
      -  assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
      -  if (isSingleWord())
      -    return APInt(getBitWidth(), VAL | RHS.VAL);
      -
      -  uint32_t numWords = getNumWords();
      -  uint64_t *val = getMemory(numWords);
      -  for (uint32_t i = 0; i < numWords; ++i)
      -    val[i] = pVal[i] | RHS.pVal[i];
      -  return APInt(val, getBitWidth());
      -}
      -
      -APInt APInt::operator^(const APInt& RHS) const {
      -  assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
      -  if (isSingleWord())
      -    return APInt(BitWidth, VAL ^ RHS.VAL);
      -
      -  uint32_t numWords = getNumWords();
      -  uint64_t *val = getMemory(numWords);
      -  for (uint32_t i = 0; i < numWords; ++i)
      -    val[i] = pVal[i] ^ RHS.pVal[i];
      -
      -  // 0^0==1 so clear the high bits in case they got set.
      -  return APInt(val, getBitWidth()).clearUnusedBits();
      -}
      -
      -bool APInt::operator !() const {
      -  if (isSingleWord())
      -    return !VAL;
      -
      -  for (uint32_t i = 0; i < getNumWords(); ++i)
      -    if (pVal[i]) 
      -      return false;
      -  return true;
      -}
      -
      -APInt APInt::operator*(const APInt& RHS) const {
      -  assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
      -  if (isSingleWord())
      -    return APInt(BitWidth, VAL * RHS.VAL);
      -  APInt Result(*this);
      -  Result *= RHS;
      -  return Result.clearUnusedBits();
      -}
      -
      -APInt APInt::operator+(const APInt& RHS) const {
      -  assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
      -  if (isSingleWord())
      -    return APInt(BitWidth, VAL + RHS.VAL);
      -  APInt Result(BitWidth, 0);
      -  add(Result.pVal, this->pVal, RHS.pVal, getNumWords());
      -  return Result.clearUnusedBits();
      -}
      -
      -APInt APInt::operator-(const APInt& RHS) const {
      -  assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
      -  if (isSingleWord())
      -    return APInt(BitWidth, VAL - RHS.VAL);
      -  APInt Result(BitWidth, 0);
      -  sub(Result.pVal, this->pVal, RHS.pVal, getNumWords());
      -  return Result.clearUnusedBits();
      -}
      -
      -bool APInt::operator[](uint32_t bitPosition) const {
      -  return (maskBit(bitPosition) & 
      -          (isSingleWord() ?  VAL : pVal[whichWord(bitPosition)])) != 0;
      -}
      -
      -bool APInt::operator==(const APInt& RHS) const {
      -  assert(BitWidth == RHS.BitWidth && "Comparison requires equal bit widths");
      -  if (isSingleWord())
      -    return VAL == RHS.VAL;
      -
      -  // Get some facts about the number of bits used in the two operands.
      -  uint32_t n1 = getActiveBits();
      -  uint32_t n2 = RHS.getActiveBits();
      -
      -  // If the number of bits isn't the same, they aren't equal
      -  if (n1 != n2) 
      -    return false;
      -
      -  // If the number of bits fits in a word, we only need to compare the low word.
      -  if (n1 <= APINT_BITS_PER_WORD)
      -    return pVal[0] == RHS.pVal[0];
      -
      -  // Otherwise, compare everything
      -  for (int i = whichWord(n1 - 1); i >= 0; --i)
      -    if (pVal[i] != RHS.pVal[i]) 
      -      return false;
      -  return true;
      -}
      -
      -bool APInt::operator==(uint64_t Val) const {
      -  if (isSingleWord())
      -    return VAL == Val;
      -
      -  uint32_t n = getActiveBits(); 
      -  if (n <= APINT_BITS_PER_WORD)
      -    return pVal[0] == Val;
      -  else
      -    return false;
      -}
      -
      -bool APInt::ult(const APInt& RHS) const {
      -  assert(BitWidth == RHS.BitWidth && "Bit widths must be same for comparison");
      -  if (isSingleWord())
      -    return VAL < RHS.VAL;
      -
      -  // Get active bit length of both operands
      -  uint32_t n1 = getActiveBits();
      -  uint32_t n2 = RHS.getActiveBits();
      -
      -  // If magnitude of LHS is less than RHS, return true.
      -  if (n1 < n2)
      -    return true;
      -
      -  // If magnitude of RHS is greather than LHS, return false.
      -  if (n2 < n1)
      -    return false;
      -
      -  // If they bot fit in a word, just compare the low order word
      -  if (n1 <= APINT_BITS_PER_WORD && n2 <= APINT_BITS_PER_WORD)
      -    return pVal[0] < RHS.pVal[0];
      -
      -  // Otherwise, compare all words
      -  uint32_t topWord = whichWord(std::max(n1,n2)-1);
      -  for (int i = topWord; i >= 0; --i) {
      -    if (pVal[i] > RHS.pVal[i]) 
      -      return false;
      -    if (pVal[i] < RHS.pVal[i]) 
      -      return true;
      -  }
      -  return false;
      -}
      -
      -bool APInt::slt(const APInt& RHS) const {
      -  assert(BitWidth == RHS.BitWidth && "Bit widths must be same for comparison");
      -  if (isSingleWord()) {
      -    int64_t lhsSext = (int64_t(VAL) << (64-BitWidth)) >> (64-BitWidth);
      -    int64_t rhsSext = (int64_t(RHS.VAL) << (64-BitWidth)) >> (64-BitWidth);
      -    return lhsSext < rhsSext;
      -  }
      -
      -  APInt lhs(*this);
      -  APInt rhs(RHS);
      -  bool lhsNeg = isNegative();
      -  bool rhsNeg = rhs.isNegative();
      -  if (lhsNeg) {
      -    // Sign bit is set so perform two's complement to make it positive
      -    lhs.flip();
      -    lhs++;
      -  }
      -  if (rhsNeg) {
      -    // Sign bit is set so perform two's complement to make it positive
      -    rhs.flip();
      -    rhs++;
      -  }
      -
      -  // Now we have unsigned values to compare so do the comparison if necessary
      -  // based on the negativeness of the values.
      -  if (lhsNeg)
      -    if (rhsNeg)
      -      return lhs.ugt(rhs);
      -    else
      -      return true;
      -  else if (rhsNeg)
      -    return false;
      -  else 
      -    return lhs.ult(rhs);
      -}
      -
      -APInt& APInt::set(uint32_t bitPosition) {
      -  if (isSingleWord()) 
      -    VAL |= maskBit(bitPosition);
      -  else 
      -    pVal[whichWord(bitPosition)] |= maskBit(bitPosition);
      -  return *this;
      -}
      -
      -APInt& APInt::set() {
      -  if (isSingleWord()) {
      -    VAL = -1ULL;
      -    return clearUnusedBits();
      -  }
      -
      -  // Set all the bits in all the words.
      -  for (uint32_t i = 0; i < getNumWords(); ++i)
      -    pVal[i] = -1ULL;
      -  // Clear the unused ones
      -  return clearUnusedBits();
      -}
      -
      -/// Set the given bit to 0 whose position is given as "bitPosition".
      -/// @brief Set a given bit to 0.
      -APInt& APInt::clear(uint32_t bitPosition) {
      -  if (isSingleWord()) 
      -    VAL &= ~maskBit(bitPosition);
      -  else 
      -    pVal[whichWord(bitPosition)] &= ~maskBit(bitPosition);
      -  return *this;
      -}
      -
      -/// @brief Set every bit to 0.
      -APInt& APInt::clear() {
      -  if (isSingleWord()) 
      -    VAL = 0;
      -  else 
      -    memset(pVal, 0, getNumWords() * APINT_WORD_SIZE);
      -  return *this;
      -}
      -
      -/// @brief Bitwise NOT operator. Performs a bitwise logical NOT operation on
      -/// this APInt.
      -APInt APInt::operator~() const {
      -  APInt Result(*this);
      -  Result.flip();
      -  return Result;
      -}
      -
      -/// @brief Toggle every bit to its opposite value.
      -APInt& APInt::flip() {
      -  if (isSingleWord()) {
      -    VAL ^= -1ULL;
      -    return clearUnusedBits();
      -  }
      -  for (uint32_t i = 0; i < getNumWords(); ++i)
      -    pVal[i] ^= -1ULL;
      -  return clearUnusedBits();
      -}
      -
      -/// Toggle a given bit to its opposite value whose position is given 
      -/// as "bitPosition".
      -/// @brief Toggles a given bit to its opposite value.
      -APInt& APInt::flip(uint32_t bitPosition) {
      -  assert(bitPosition < BitWidth && "Out of the bit-width range!");
      -  if ((*this)[bitPosition]) clear(bitPosition);
      -  else set(bitPosition);
      -  return *this;
      -}
      -
      -uint32_t APInt::getBitsNeeded(const char* str, uint32_t slen, uint8_t radix) {
      -  assert(str != 0 && "Invalid value string");
      -  assert(slen > 0 && "Invalid string length");
      -
      -  // Each computation below needs to know if its negative
      -  uint32_t isNegative = str[0] == '-';
      -  if (isNegative) {
      -    slen--;
      -    str++;
      -  }
      -  // For radixes of power-of-two values, the bits required is accurately and
      -  // easily computed
      -  if (radix == 2)
      -    return slen + isNegative;
      -  if (radix == 8)
      -    return slen * 3 + isNegative;
      -  if (radix == 16)
      -    return slen * 4 + isNegative;
      -
      -  // Otherwise it must be radix == 10, the hard case
      -  assert(radix == 10 && "Invalid radix");
      -
      -  // This is grossly inefficient but accurate. We could probably do something
      -  // with a computation of roughly slen*64/20 and then adjust by the value of
      -  // the first few digits. But, I'm not sure how accurate that could be.
      -
      -  // Compute a sufficient number of bits that is always large enough but might
      -  // be too large. This avoids the assertion in the constructor.
      -  uint32_t sufficient = slen*64/18;
      -
      -  // Convert to the actual binary value.
      -  APInt tmp(sufficient, str, slen, radix);
      -
      -  // Compute how many bits are required.
      -  return isNegative + tmp.logBase2() + 1;
      -}
      -
      -uint64_t APInt::getHashValue() const {
      -  // Put the bit width into the low order bits.
      -  uint64_t hash = BitWidth;
      -
      -  // Add the sum of the words to the hash.
      -  if (isSingleWord())
      -    hash += VAL << 6; // clear separation of up to 64 bits
      -  else
      -    for (uint32_t i = 0; i < getNumWords(); ++i)
      -      hash += pVal[i] << 6; // clear sepration of up to 64 bits
      -  return hash;
      -}
      -
      -/// HiBits - This function returns the high "numBits" bits of this APInt.
      -APInt APInt::getHiBits(uint32_t numBits) const {
      -  return APIntOps::lshr(*this, BitWidth - numBits);
      -}
      -
      -/// LoBits - This function returns the low "numBits" bits of this APInt.
      -APInt APInt::getLoBits(uint32_t numBits) const {
      -  return APIntOps::lshr(APIntOps::shl(*this, BitWidth - numBits), 
      -                        BitWidth - numBits);
      -}
      -
      -bool APInt::isPowerOf2() const {
      -  return (!!*this) && !(*this & (*this - APInt(BitWidth,1)));
      -}
      -
      -uint32_t APInt::countLeadingZeros() const {
      -  uint32_t Count = 0;
      -  if (isSingleWord())
      -    Count = CountLeadingZeros_64(VAL);
      -  else {
      -    for (uint32_t i = getNumWords(); i > 0u; --i) {
      -      if (pVal[i-1] == 0)
      -        Count += APINT_BITS_PER_WORD;
      -      else {
      -        Count += CountLeadingZeros_64(pVal[i-1]);
      -        break;
      -      }
      -    }
      -  }
      -  uint32_t remainder = BitWidth % APINT_BITS_PER_WORD;
      -  if (remainder)
      -    Count -= APINT_BITS_PER_WORD - remainder;
      -  return std::min(Count, BitWidth);
      -}
      -
      -static uint32_t countLeadingOnes_64(uint64_t V, uint32_t skip) {
      -  uint32_t Count = 0;
      -  if (skip)
      -    V <<= skip;
      -  while (V && (V & (1ULL << 63))) {
      -    Count++;
      -    V <<= 1;
      -  }
      -  return Count;
      -}
      -
      -uint32_t APInt::countLeadingOnes() const {
      -  if (isSingleWord())
      -    return countLeadingOnes_64(VAL, APINT_BITS_PER_WORD - BitWidth);
      -
      -  uint32_t highWordBits = BitWidth % APINT_BITS_PER_WORD;
      -  uint32_t shift = (highWordBits == 0 ? 0 : APINT_BITS_PER_WORD - highWordBits);
      -  int i = getNumWords() - 1;
      -  uint32_t Count = countLeadingOnes_64(pVal[i], shift);
      -  if (Count == highWordBits) {
      -    for (i--; i >= 0; --i) {
      -      if (pVal[i] == -1ULL)
      -        Count += APINT_BITS_PER_WORD;
      -      else {
      -        Count += countLeadingOnes_64(pVal[i], 0);
      -        break;
      -      }
      -    }
      -  }
      -  return Count;
      -}
      -
      -uint32_t APInt::countTrailingZeros() const {
      -  if (isSingleWord())
      -    return std::min(CountTrailingZeros_64(VAL), BitWidth);
      -  uint32_t Count = 0;
      -  uint32_t i = 0;
      -  for (; i < getNumWords() && pVal[i] == 0; ++i)
      -    Count += APINT_BITS_PER_WORD;
      -  if (i < getNumWords())
      -    Count += CountTrailingZeros_64(pVal[i]);
      -  return std::min(Count, BitWidth);
      -}
      -
      -uint32_t APInt::countPopulation() const {
      -  if (isSingleWord())
      -    return CountPopulation_64(VAL);
      -  uint32_t Count = 0;
      -  for (uint32_t i = 0; i < getNumWords(); ++i)
      -    Count += CountPopulation_64(pVal[i]);
      -  return Count;
      -}
      -
      -APInt APInt::byteSwap() const {
      -  assert(BitWidth >= 16 && BitWidth % 16 == 0 && "Cannot byteswap!");
      -  if (BitWidth == 16)
      -    return APInt(BitWidth, ByteSwap_16(uint16_t(VAL)));
      -  else if (BitWidth == 32)
      -    return APInt(BitWidth, ByteSwap_32(uint32_t(VAL)));
      -  else if (BitWidth == 48) {
      -    uint32_t Tmp1 = uint32_t(VAL >> 16);
      -    Tmp1 = ByteSwap_32(Tmp1);
      -    uint16_t Tmp2 = uint16_t(VAL);
      -    Tmp2 = ByteSwap_16(Tmp2);
      -    return APInt(BitWidth, (uint64_t(Tmp2) << 32) | Tmp1);
      -  } else if (BitWidth == 64)
      -    return APInt(BitWidth, ByteSwap_64(VAL));
      -  else {
      -    APInt Result(BitWidth, 0);
      -    char *pByte = (char*)Result.pVal;
      -    for (uint32_t i = 0; i < BitWidth / APINT_WORD_SIZE / 2; ++i) {
      -      char Tmp = pByte[i];
      -      pByte[i] = pByte[BitWidth / APINT_WORD_SIZE - 1 - i];
      -      pByte[BitWidth / APINT_WORD_SIZE - i - 1] = Tmp;
      -    }
      -    return Result;
      -  }
      -}
      -
      -APInt llvm::APIntOps::GreatestCommonDivisor(const APInt& API1, 
      -                                            const APInt& API2) {
      -  APInt A = API1, B = API2;
      -  while (!!B) {
      -    APInt T = B;
      -    B = APIntOps::urem(A, B);
      -    A = T;
      -  }
      -  return A;
      -}
      -
      -APInt llvm::APIntOps::RoundDoubleToAPInt(double Double, uint32_t width) {
      -  union {
      -    double D;
      -    uint64_t I;
      -  } T;
      -  T.D = Double;
      -
      -  // Get the sign bit from the highest order bit
      -  bool isNeg = T.I >> 63;
      -
      -  // Get the 11-bit exponent and adjust for the 1023 bit bias
      -  int64_t exp = ((T.I >> 52) & 0x7ff) - 1023;
      -
      -  // If the exponent is negative, the value is < 0 so just return 0.
      -  if (exp < 0)
      -    return APInt(width, 0u);
      -
      -  // Extract the mantissa by clearing the top 12 bits (sign + exponent).
      -  uint64_t mantissa = (T.I & (~0ULL >> 12)) | 1ULL << 52;
      -
      -  // If the exponent doesn't shift all bits out of the mantissa
      -  if (exp < 52)
      -    return isNeg ? -APInt(width, mantissa >> (52 - exp)) : 
      -                    APInt(width, mantissa >> (52 - exp));
      -
      -  // If the client didn't provide enough bits for us to shift the mantissa into
      -  // then the result is undefined, just return 0
      -  if (width <= exp - 52)
      -    return APInt(width, 0);
      -
      -  // Otherwise, we have to shift the mantissa bits up to the right location
      -  APInt Tmp(width, mantissa);
      -  Tmp = Tmp.shl(exp - 52);
      -  return isNeg ? -Tmp : Tmp;
      -}
      -
      -/// RoundToDouble - This function convert this APInt to a double.
      -/// The layout for double is as following (IEEE Standard 754):
      -///  --------------------------------------
      -/// |  Sign    Exponent    Fraction    Bias |
      -/// |-------------------------------------- |
      -/// |  1[63]   11[62-52]   52[51-00]   1023 |
      -///  -------------------------------------- 
      -double APInt::roundToDouble(bool isSigned) const {
      -
      -  // Handle the simple case where the value is contained in one uint64_t.
      -  if (isSingleWord() || getActiveBits() <= APINT_BITS_PER_WORD) {
      -    if (isSigned) {
      -      int64_t sext = (int64_t(VAL) << (64-BitWidth)) >> (64-BitWidth);
      -      return double(sext);
      -    } else
      -      return double(VAL);
      -  }
      -
      -  // Determine if the value is negative.
      -  bool isNeg = isSigned ? (*this)[BitWidth-1] : false;
      -
      -  // Construct the absolute value if we're negative.
      -  APInt Tmp(isNeg ? -(*this) : (*this));
      -
      -  // Figure out how many bits we're using.
      -  uint32_t n = Tmp.getActiveBits();
      -
      -  // The exponent (without bias normalization) is just the number of bits
      -  // we are using. Note that the sign bit is gone since we constructed the
      -  // absolute value.
      -  uint64_t exp = n;
      -
      -  // Return infinity for exponent overflow
      -  if (exp > 1023) {
      -    if (!isSigned || !isNeg)
      -      return std::numeric_limits::infinity();
      -    else 
      -      return -std::numeric_limits::infinity();
      -  }
      -  exp += 1023; // Increment for 1023 bias
      -
      -  // Number of bits in mantissa is 52. To obtain the mantissa value, we must
      -  // extract the high 52 bits from the correct words in pVal.
      -  uint64_t mantissa;
      -  unsigned hiWord = whichWord(n-1);
      -  if (hiWord == 0) {
      -    mantissa = Tmp.pVal[0];
      -    if (n > 52)
      -      mantissa >>= n - 52; // shift down, we want the top 52 bits.
      -  } else {
      -    assert(hiWord > 0 && "huh?");
      -    uint64_t hibits = Tmp.pVal[hiWord] << (52 - n % APINT_BITS_PER_WORD);
      -    uint64_t lobits = Tmp.pVal[hiWord-1] >> (11 + n % APINT_BITS_PER_WORD);
      -    mantissa = hibits | lobits;
      -  }
      -
      -  // The leading bit of mantissa is implicit, so get rid of it.
      -  uint64_t sign = isNeg ? (1ULL << (APINT_BITS_PER_WORD - 1)) : 0;
      -  union {
      -    double D;
      -    uint64_t I;
      -  } T;
      -  T.I = sign | (exp << 52) | mantissa;
      -  return T.D;
      -}
      -
      -// Truncate to new width.
      -APInt &APInt::trunc(uint32_t width) {
      -  assert(width < BitWidth && "Invalid APInt Truncate request");
      -  assert(width >= IntegerType::MIN_INT_BITS && "Can't truncate to 0 bits");
      -  uint32_t wordsBefore = getNumWords();
      -  BitWidth = width;
      -  uint32_t wordsAfter = getNumWords();
      -  if (wordsBefore != wordsAfter) {
      -    if (wordsAfter == 1) {
      -      uint64_t *tmp = pVal;
      -      VAL = pVal[0];
      -      delete [] tmp;
      -    } else {
      -      uint64_t *newVal = getClearedMemory(wordsAfter);
      -      for (uint32_t i = 0; i < wordsAfter; ++i)
      -        newVal[i] = pVal[i];
      -      delete [] pVal;
      -      pVal = newVal;
      -    }
      -  }
      -  return clearUnusedBits();
      -}
      -
      -// Sign extend to a new width.
      -APInt &APInt::sext(uint32_t width) {
      -  assert(width > BitWidth && "Invalid APInt SignExtend request");
      -  assert(width <= IntegerType::MAX_INT_BITS && "Too many bits");
      -  // If the sign bit isn't set, this is the same as zext.
      -  if (!isNegative()) {
      -    zext(width);
      -    return *this;
      -  }
      -
      -  // The sign bit is set. First, get some facts
      -  uint32_t wordsBefore = getNumWords();
      -  uint32_t wordBits = BitWidth % APINT_BITS_PER_WORD;
      -  BitWidth = width;
      -  uint32_t wordsAfter = getNumWords();
      -
      -  // Mask the high order word appropriately
      -  if (wordsBefore == wordsAfter) {
      -    uint32_t newWordBits = width % APINT_BITS_PER_WORD;
      -    // The extension is contained to the wordsBefore-1th word.
      -    uint64_t mask = ~0ULL;
      -    if (newWordBits)
      -      mask >>= APINT_BITS_PER_WORD - newWordBits;
      -    mask <<= wordBits;
      -    if (wordsBefore == 1)
      -      VAL |= mask;
      -    else
      -      pVal[wordsBefore-1] |= mask;
      -    return clearUnusedBits();
      -  }
      -
      -  uint64_t mask = wordBits == 0 ? 0 : ~0ULL << wordBits;
      -  uint64_t *newVal = getMemory(wordsAfter);
      -  if (wordsBefore == 1)
      -    newVal[0] = VAL | mask;
      -  else {
      -    for (uint32_t i = 0; i < wordsBefore; ++i)
      -      newVal[i] = pVal[i];
      -    newVal[wordsBefore-1] |= mask;
      -  }
      -  for (uint32_t i = wordsBefore; i < wordsAfter; i++)
      -    newVal[i] = -1ULL;
      -  if (wordsBefore != 1)
      -    delete [] pVal;
      -  pVal = newVal;
      -  return clearUnusedBits();
      -}
      -
      -//  Zero extend to a new width.
      -APInt &APInt::zext(uint32_t width) {
      -  assert(width > BitWidth && "Invalid APInt ZeroExtend request");
      -  assert(width <= IntegerType::MAX_INT_BITS && "Too many bits");
      -  uint32_t wordsBefore = getNumWords();
      -  BitWidth = width;
      -  uint32_t wordsAfter = getNumWords();
      -  if (wordsBefore != wordsAfter) {
      -    uint64_t *newVal = getClearedMemory(wordsAfter);
      -    if (wordsBefore == 1)
      -      newVal[0] = VAL;
      -    else 
      -      for (uint32_t i = 0; i < wordsBefore; ++i)
      -        newVal[i] = pVal[i];
      -    if (wordsBefore != 1)
      -      delete [] pVal;
      -    pVal = newVal;
      -  }
      -  return *this;
      -}
      -
      -APInt &APInt::zextOrTrunc(uint32_t width) {
      -  if (BitWidth < width)
      -    return zext(width);
      -  if (BitWidth > width)
      -    return trunc(width);
      -  return *this;
      -}
      -
      -APInt &APInt::sextOrTrunc(uint32_t width) {
      -  if (BitWidth < width)
      -    return sext(width);
      -  if (BitWidth > width)
      -    return trunc(width);
      -  return *this;
      -}
      -
      -/// Arithmetic right-shift this APInt by shiftAmt.
      -/// @brief Arithmetic right-shift function.
      -APInt APInt::ashr(uint32_t shiftAmt) const {
      -  assert(shiftAmt <= BitWidth && "Invalid shift amount");
      -  // Handle a degenerate case
      -  if (shiftAmt == 0)
      -    return *this;
      -
      -  // Handle single word shifts with built-in ashr
      -  if (isSingleWord()) {
      -    if (shiftAmt == BitWidth)
      -      return APInt(BitWidth, 0); // undefined
      -    else {
      -      uint32_t SignBit = APINT_BITS_PER_WORD - BitWidth;
      -      return APInt(BitWidth, 
      -        (((int64_t(VAL) << SignBit) >> SignBit) >> shiftAmt));
      -    }
      -  }
      -
      -  // If all the bits were shifted out, the result is, technically, undefined.
      -  // We return -1 if it was negative, 0 otherwise. We check this early to avoid
      -  // issues in the algorithm below.
      -  if (shiftAmt == BitWidth) {
      -    if (isNegative())
      -      return APInt(BitWidth, -1ULL);
      -    else
      -      return APInt(BitWidth, 0);
      -  }
      -
      -  // Create some space for the result.
      -  uint64_t * val = new uint64_t[getNumWords()];
      -
      -  // Compute some values needed by the following shift algorithms
      -  uint32_t wordShift = shiftAmt % APINT_BITS_PER_WORD; // bits to shift per word
      -  uint32_t offset = shiftAmt / APINT_BITS_PER_WORD; // word offset for shift
      -  uint32_t breakWord = getNumWords() - 1 - offset; // last word affected
      -  uint32_t bitsInWord = whichBit(BitWidth); // how many bits in last word?
      -  if (bitsInWord == 0)
      -    bitsInWord = APINT_BITS_PER_WORD;
      -
      -  // If we are shifting whole words, just move whole words
      -  if (wordShift == 0) {
      -    // Move the words containing significant bits
      -    for (uint32_t i = 0; i <= breakWord; ++i) 
      -      val[i] = pVal[i+offset]; // move whole word
      -
      -    // Adjust the top significant word for sign bit fill, if negative
      -    if (isNegative())
      -      if (bitsInWord < APINT_BITS_PER_WORD)
      -        val[breakWord] |= ~0ULL << bitsInWord; // set high bits
      -  } else {
      -    // Shift the low order words 
      -    for (uint32_t i = 0; i < breakWord; ++i) {
      -      // This combines the shifted corresponding word with the low bits from
      -      // the next word (shifted into this word's high bits).
      -      val[i] = (pVal[i+offset] >> wordShift) | 
      -               (pVal[i+offset+1] << (APINT_BITS_PER_WORD - wordShift));
      -    }
      -
      -    // Shift the break word. In this case there are no bits from the next word
      -    // to include in this word.
      -    val[breakWord] = pVal[breakWord+offset] >> wordShift;
      -
      -    // Deal with sign extenstion in the break word, and possibly the word before
      -    // it.
      -    if (isNegative()) {
      -      if (wordShift > bitsInWord) {
      -        if (breakWord > 0)
      -          val[breakWord-1] |= 
      -            ~0ULL << (APINT_BITS_PER_WORD - (wordShift - bitsInWord));
      -        val[breakWord] |= ~0ULL;
      -      } else 
      -        val[breakWord] |= (~0ULL << (bitsInWord - wordShift));
      -    }
      -  }
      -
      -  // Remaining words are 0 or -1, just assign them.
      -  uint64_t fillValue = (isNegative() ? -1ULL : 0);
      -  for (uint32_t i = breakWord+1; i < getNumWords(); ++i)
      -    val[i] = fillValue;
      -  return APInt(val, BitWidth).clearUnusedBits();
      -}
      -
      -/// Logical right-shift this APInt by shiftAmt.
      -/// @brief Logical right-shift function.
      -APInt APInt::lshr(uint32_t shiftAmt) const {
      -  if (isSingleWord()) {
      -    if (shiftAmt == BitWidth)
      -      return APInt(BitWidth, 0);
      -    else 
      -      return APInt(BitWidth, this->VAL >> shiftAmt);
      -  }
      -
      -  // If all the bits were shifted out, the result is 0. This avoids issues
      -  // with shifting by the size of the integer type, which produces undefined
      -  // results. We define these "undefined results" to always be 0.
      -  if (shiftAmt == BitWidth)
      -    return APInt(BitWidth, 0);
      -
      -  // If none of the bits are shifted out, the result is *this. This avoids
      -  // issues with shifting byt he size of the integer type, which produces 
      -  // undefined results in the code below. This is also an optimization.
      -  if (shiftAmt == 0)
      -    return *this;
      -
      -  // Create some space for the result.
      -  uint64_t * val = new uint64_t[getNumWords()];
      -
      -  // If we are shifting less than a word, compute the shift with a simple carry
      -  if (shiftAmt < APINT_BITS_PER_WORD) {
      -    uint64_t carry = 0;
      -    for (int i = getNumWords()-1; i >= 0; --i) {
      -      val[i] = (pVal[i] >> shiftAmt) | carry;
      -      carry = pVal[i] << (APINT_BITS_PER_WORD - shiftAmt);
      -    }
      -    return APInt(val, BitWidth).clearUnusedBits();
      -  }
      -
      -  // Compute some values needed by the remaining shift algorithms
      -  uint32_t wordShift = shiftAmt % APINT_BITS_PER_WORD;
      -  uint32_t offset = shiftAmt / APINT_BITS_PER_WORD;
      -
      -  // If we are shifting whole words, just move whole words
      -  if (wordShift == 0) {
      -    for (uint32_t i = 0; i < getNumWords() - offset; ++i) 
      -      val[i] = pVal[i+offset];
      -    for (uint32_t i = getNumWords()-offset; i < getNumWords(); i++)
      -      val[i] = 0;
      -    return APInt(val,BitWidth).clearUnusedBits();
      -  }
      -
      -  // Shift the low order words 
      -  uint32_t breakWord = getNumWords() - offset -1;
      -  for (uint32_t i = 0; i < breakWord; ++i)
      -    val[i] = (pVal[i+offset] >> wordShift) |
      -             (pVal[i+offset+1] << (APINT_BITS_PER_WORD - wordShift));
      -  // Shift the break word.
      -  val[breakWord] = pVal[breakWord+offset] >> wordShift;
      -
      -  // Remaining words are 0
      -  for (uint32_t i = breakWord+1; i < getNumWords(); ++i)
      -    val[i] = 0;
      -  return APInt(val, BitWidth).clearUnusedBits();
      -}
      -
      -/// Left-shift this APInt by shiftAmt.
      -/// @brief Left-shift function.
      -APInt APInt::shl(uint32_t shiftAmt) const {
      -  assert(shiftAmt <= BitWidth && "Invalid shift amount");
      -  if (isSingleWord()) {
      -    if (shiftAmt == BitWidth)
      -      return APInt(BitWidth, 0); // avoid undefined shift results
      -    return APInt(BitWidth, VAL << shiftAmt);
      -  }
      -
      -  // If all the bits were shifted out, the result is 0. This avoids issues
      -  // with shifting by the size of the integer type, which produces undefined
      -  // results. We define these "undefined results" to always be 0.
      -  if (shiftAmt == BitWidth)
      -    return APInt(BitWidth, 0);
      -
      -  // If none of the bits are shifted out, the result is *this. This avoids a
      -  // lshr by the words size in the loop below which can produce incorrect
      -  // results. It also avoids the expensive computation below for a common case.
      -  if (shiftAmt == 0)
      -    return *this;
      -
      -  // Create some space for the result.
      -  uint64_t * val = new uint64_t[getNumWords()];
      -
      -  // If we are shifting less than a word, do it the easy way
      -  if (shiftAmt < APINT_BITS_PER_WORD) {
      -    uint64_t carry = 0;
      -    for (uint32_t i = 0; i < getNumWords(); i++) {
      -      val[i] = pVal[i] << shiftAmt | carry;
      -      carry = pVal[i] >> (APINT_BITS_PER_WORD - shiftAmt);
      -    }
      -    return APInt(val, BitWidth).clearUnusedBits();
      -  }
      -
      -  // Compute some values needed by the remaining shift algorithms
      -  uint32_t wordShift = shiftAmt % APINT_BITS_PER_WORD;
      -  uint32_t offset = shiftAmt / APINT_BITS_PER_WORD;
      -
      -  // If we are shifting whole words, just move whole words
      -  if (wordShift == 0) {
      -    for (uint32_t i = 0; i < offset; i++) 
      -      val[i] = 0;
      -    for (uint32_t i = offset; i < getNumWords(); i++)
      -      val[i] = pVal[i-offset];
      -    return APInt(val,BitWidth).clearUnusedBits();
      -  }
      -
      -  // Copy whole words from this to Result.
      -  uint32_t i = getNumWords() - 1;
      -  for (; i > offset; --i)
      -    val[i] = pVal[i-offset] << wordShift |
      -             pVal[i-offset-1] >> (APINT_BITS_PER_WORD - wordShift);
      -  val[offset] = pVal[0] << wordShift;
      -  for (i = 0; i < offset; ++i)
      -    val[i] = 0;
      -  return APInt(val, BitWidth).clearUnusedBits();
      -}
      -
      -APInt APInt::rotl(uint32_t rotateAmt) const {
      -  if (rotateAmt == 0)
      -    return *this;
      -  // Don't get too fancy, just use existing shift/or facilities
      -  APInt hi(*this);
      -  APInt lo(*this);
      -  hi.shl(rotateAmt);
      -  lo.lshr(BitWidth - rotateAmt);
      -  return hi | lo;
      -}
      -
      -APInt APInt::rotr(uint32_t rotateAmt) const {
      -  if (rotateAmt == 0)
      -    return *this;
      -  // Don't get too fancy, just use existing shift/or facilities
      -  APInt hi(*this);
      -  APInt lo(*this);
      -  lo.lshr(rotateAmt);
      -  hi.shl(BitWidth - rotateAmt);
      -  return hi | lo;
      -}
      -
      -// Square Root - this method computes and returns the square root of "this".
      -// Three mechanisms are used for computation. For small values (<= 5 bits),
      -// a table lookup is done. This gets some performance for common cases. For
      -// values using less than 52 bits, the value is converted to double and then
      -// the libc sqrt function is called. The result is rounded and then converted
      -// back to a uint64_t which is then used to construct the result. Finally,
      -// the Babylonian method for computing square roots is used. 
      -APInt APInt::sqrt() const {
      -
      -  // Determine the magnitude of the value.
      -  uint32_t magnitude = getActiveBits();
      -
      -  // Use a fast table for some small values. This also gets rid of some
      -  // rounding errors in libc sqrt for small values.
      -  if (magnitude <= 5) {
      -    static const uint8_t results[32] = {
      -      /*     0 */ 0,
      -      /*  1- 2 */ 1, 1,
      -      /*  3- 6 */ 2, 2, 2, 2, 
      -      /*  7-12 */ 3, 3, 3, 3, 3, 3,
      -      /* 13-20 */ 4, 4, 4, 4, 4, 4, 4, 4,
      -      /* 21-30 */ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
      -      /*    31 */ 6
      -    };
      -    return APInt(BitWidth, results[ (isSingleWord() ? VAL : pVal[0]) ]);
      -  }
      -
      -  // If the magnitude of the value fits in less than 52 bits (the precision of
      -  // an IEEE double precision floating point value), then we can use the
      -  // libc sqrt function which will probably use a hardware sqrt computation.
      -  // This should be faster than the algorithm below.
      -  if (magnitude < 52) {
      -#ifdef _MSC_VER
      -    // Amazingly, VC++ doesn't have round().
      -    return APInt(BitWidth, 
      -                 uint64_t(::sqrt(double(isSingleWord()?VAL:pVal[0]))) + 0.5);
      -#else
      -    return APInt(BitWidth, 
      -                 uint64_t(::round(::sqrt(double(isSingleWord()?VAL:pVal[0])))));
      -#endif
      -  }
      -
      -  // Okay, all the short cuts are exhausted. We must compute it. The following
      -  // is a classical Babylonian method for computing the square root. This code
      -  // was adapted to APINt from a wikipedia article on such computations.
      -  // See http://www.wikipedia.org/ and go to the page named
      -  // Calculate_an_integer_square_root. 
      -  uint32_t nbits = BitWidth, i = 4;
      -  APInt testy(BitWidth, 16);
      -  APInt x_old(BitWidth, 1);
      -  APInt x_new(BitWidth, 0);
      -  APInt two(BitWidth, 2);
      -
      -  // Select a good starting value using binary logarithms.
      -  for (;; i += 2, testy = testy.shl(2)) 
      -    if (i >= nbits || this->ule(testy)) {
      -      x_old = x_old.shl(i / 2);
      -      break;
      -    }
      -
      -  // Use the Babylonian method to arrive at the integer square root: 
      -  for (;;) {
      -    x_new = (this->udiv(x_old) + x_old).udiv(two);
      -    if (x_old.ule(x_new))
      -      break;
      -    x_old = x_new;
      -  }
      -
      -  // Make sure we return the closest approximation
      -  // NOTE: The rounding calculation below is correct. It will produce an 
      -  // off-by-one discrepancy with results from pari/gp. That discrepancy has been
      -  // determined to be a rounding issue with pari/gp as it begins to use a 
      -  // floating point representation after 192 bits. There are no discrepancies
      -  // between this algorithm and pari/gp for bit widths < 192 bits.
      -  APInt square(x_old * x_old);
      -  APInt nextSquare((x_old + 1) * (x_old +1));
      -  if (this->ult(square))
      -    return x_old;
      -  else if (this->ule(nextSquare)) {
      -    APInt midpoint((nextSquare - square).udiv(two));
      -    APInt offset(*this - square);
      -    if (offset.ult(midpoint))
      -      return x_old;
      -    else
      -      return x_old + 1;
      -  } else
      -    assert(0 && "Error in APInt::sqrt computation");
      -  return x_old + 1;
      -}
      -
      -/// Implementation of Knuth's Algorithm D (Division of nonnegative integers)
      -/// from "Art of Computer Programming, Volume 2", section 4.3.1, p. 272. The
      -/// variables here have the same names as in the algorithm. Comments explain
      -/// the algorithm and any deviation from it.
      -static void KnuthDiv(uint32_t *u, uint32_t *v, uint32_t *q, uint32_t* r, 
      -                     uint32_t m, uint32_t n) {
      -  assert(u && "Must provide dividend");
      -  assert(v && "Must provide divisor");
      -  assert(q && "Must provide quotient");
      -  assert(u != v && u != q && v != q && "Must us different memory");
      -  assert(n>1 && "n must be > 1");
      -
      -  // Knuth uses the value b as the base of the number system. In our case b
      -  // is 2^31 so we just set it to -1u.
      -  uint64_t b = uint64_t(1) << 32;
      -
      -  DEBUG(cerr << "KnuthDiv: m=" << m << " n=" << n << '\n');
      -  DEBUG(cerr << "KnuthDiv: original:");
      -  DEBUG(for (int i = m+n; i >=0; i--) cerr << " " << std::setbase(16) << u[i]);
      -  DEBUG(cerr << " by");
      -  DEBUG(for (int i = n; i >0; i--) cerr << " " << std::setbase(16) << v[i-1]);
      -  DEBUG(cerr << '\n');
      -  // D1. [Normalize.] Set d = b / (v[n-1] + 1) and multiply all the digits of 
      -  // u and v by d. Note that we have taken Knuth's advice here to use a power 
      -  // of 2 value for d such that d * v[n-1] >= b/2 (b is the base). A power of 
      -  // 2 allows us to shift instead of multiply and it is easy to determine the 
      -  // shift amount from the leading zeros.  We are basically normalizing the u
      -  // and v so that its high bits are shifted to the top of v's range without
      -  // overflow. Note that this can require an extra word in u so that u must
      -  // be of length m+n+1.
      -  uint32_t shift = CountLeadingZeros_32(v[n-1]);
      -  uint32_t v_carry = 0;
      -  uint32_t u_carry = 0;
      -  if (shift) {
      -    for (uint32_t i = 0; i < m+n; ++i) {
      -      uint32_t u_tmp = u[i] >> (32 - shift);
      -      u[i] = (u[i] << shift) | u_carry;
      -      u_carry = u_tmp;
      -    }
      -    for (uint32_t i = 0; i < n; ++i) {
      -      uint32_t v_tmp = v[i] >> (32 - shift);
      -      v[i] = (v[i] << shift) | v_carry;
      -      v_carry = v_tmp;
      -    }
      -  }
      -  u[m+n] = u_carry;
      -  DEBUG(cerr << "KnuthDiv:   normal:");
      -  DEBUG(for (int i = m+n; i >=0; i--) cerr << " " << std::setbase(16) << u[i]);
      -  DEBUG(cerr << " by");
      -  DEBUG(for (int i = n; i >0; i--) cerr << " " << std::setbase(16) << v[i-1]);
      -  DEBUG(cerr << '\n');
      -
      -  // D2. [Initialize j.]  Set j to m. This is the loop counter over the places.
      -  int j = m;
      -  do {
      -    DEBUG(cerr << "KnuthDiv: quotient digit #" << j << '\n');
      -    // D3. [Calculate q'.]. 
      -    //     Set qp = (u[j+n]*b + u[j+n-1]) / v[n-1]. (qp=qprime=q')
      -    //     Set rp = (u[j+n]*b + u[j+n-1]) % v[n-1]. (rp=rprime=r')
      -    // Now test if qp == b or qp*v[n-2] > b*rp + u[j+n-2]; if so, decrease
      -    // qp by 1, inrease rp by v[n-1], and repeat this test if rp < b. The test
      -    // on v[n-2] determines at high speed most of the cases in which the trial
      -    // value qp is one too large, and it eliminates all cases where qp is two 
      -    // too large. 
      -    uint64_t dividend = ((uint64_t(u[j+n]) << 32) + u[j+n-1]);
      -    DEBUG(cerr << "KnuthDiv: dividend == " << dividend << '\n');
      -    uint64_t qp = dividend / v[n-1];
      -    uint64_t rp = dividend % v[n-1];
      -    if (qp == b || qp*v[n-2] > b*rp + u[j+n-2]) {
      -      qp--;
      -      rp += v[n-1];
      -      if (rp < b && (qp == b || qp*v[n-2] > b*rp + u[j+n-2]))
      -        qp--;
      -    }
      -    DEBUG(cerr << "KnuthDiv: qp == " << qp << ", rp == " << rp << '\n');
      -
      -    // D4. [Multiply and subtract.] Replace (u[j+n]u[j+n-1]...u[j]) with
      -    // (u[j+n]u[j+n-1]..u[j]) - qp * (v[n-1]...v[1]v[0]). This computation
      -    // consists of a simple multiplication by a one-place number, combined with
      -    // a subtraction. 
      -    bool isNeg = false;
      -    for (uint32_t i = 0; i < n; ++i) {
      -      uint64_t u_tmp = uint64_t(u[j+i]) | (uint64_t(u[j+i+1]) << 32);
      -      uint64_t subtrahend = uint64_t(qp) * uint64_t(v[i]);
      -      bool borrow = subtrahend > u_tmp;
      -      DEBUG(cerr << "KnuthDiv: u_tmp == " << u_tmp 
      -                 << ", subtrahend == " << subtrahend
      -                 << ", borrow = " << borrow << '\n');
      -
      -      uint64_t result = u_tmp - subtrahend;
      -      uint32_t k = j + i;
      -      u[k++] = result & (b-1); // subtract low word
      -      u[k++] = result >> 32;   // subtract high word
      -      while (borrow && k <= m+n) { // deal with borrow to the left
      -        borrow = u[k] == 0;
      -        u[k]--;
      -        k++;
      -      }
      -      isNeg |= borrow;
      -      DEBUG(cerr << "KnuthDiv: u[j+i] == " << u[j+i] << ",  u[j+i+1] == " << 
      -                    u[j+i+1] << '\n'); 
      -    }
      -    DEBUG(cerr << "KnuthDiv: after subtraction:");
      -    DEBUG(for (int i = m+n; i >=0; i--) cerr << " " << u[i]);
      -    DEBUG(cerr << '\n');
      -    // The digits (u[j+n]...u[j]) should be kept positive; if the result of 
      -    // this step is actually negative, (u[j+n]...u[j]) should be left as the 
      -    // true value plus b**(n+1), namely as the b's complement of
      -    // the true value, and a "borrow" to the left should be remembered.
      -    //
      -    if (isNeg) {
      -      bool carry = true;  // true because b's complement is "complement + 1"
      -      for (uint32_t i = 0; i <= m+n; ++i) {
      -        u[i] = ~u[i] + carry; // b's complement
      -        carry = carry && u[i] == 0;
      -      }
      -    }
      -    DEBUG(cerr << "KnuthDiv: after complement:");
      -    DEBUG(for (int i = m+n; i >=0; i--) cerr << " " << u[i]);
      -    DEBUG(cerr << '\n');
      -
      -    // D5. [Test remainder.] Set q[j] = qp. If the result of step D4 was 
      -    // negative, go to step D6; otherwise go on to step D7.
      -    q[j] = qp;
      -    if (isNeg) {
      -      // D6. [Add back]. The probability that this step is necessary is very 
      -      // small, on the order of only 2/b. Make sure that test data accounts for
      -      // this possibility. Decrease q[j] by 1 
      -      q[j]--;
      -      // and add (0v[n-1]...v[1]v[0]) to (u[j+n]u[j+n-1]...u[j+1]u[j]). 
      -      // A carry will occur to the left of u[j+n], and it should be ignored 
      -      // since it cancels with the borrow that occurred in D4.
      -      bool carry = false;
      -      for (uint32_t i = 0; i < n; i++) {
      -        uint32_t limit = std::min(u[j+i],v[i]);
      -        u[j+i] += v[i] + carry;
      -        carry = u[j+i] < limit || (carry && u[j+i] == limit);
      -      }
      -      u[j+n] += carry;
      -    }
      -    DEBUG(cerr << "KnuthDiv: after correction:");
      -    DEBUG(for (int i = m+n; i >=0; i--) cerr <<" " << u[i]);
      -    DEBUG(cerr << "\nKnuthDiv: digit result = " << q[j] << '\n');
      -
      -  // D7. [Loop on j.]  Decrease j by one. Now if j >= 0, go back to D3.
      -  } while (--j >= 0);
      -
      -  DEBUG(cerr << "KnuthDiv: quotient:");
      -  DEBUG(for (int i = m; i >=0; i--) cerr <<" " << q[i]);
      -  DEBUG(cerr << '\n');
      -
      -  // D8. [Unnormalize]. Now q[...] is the desired quotient, and the desired
      -  // remainder may be obtained by dividing u[...] by d. If r is non-null we
      -  // compute the remainder (urem uses this).
      -  if (r) {
      -    // The value d is expressed by the "shift" value above since we avoided
      -    // multiplication by d by using a shift left. So, all we have to do is
      -    // shift right here. In order to mak
      -    if (shift) {
      -      uint32_t carry = 0;
      -      DEBUG(cerr << "KnuthDiv: remainder:");
      -      for (int i = n-1; i >= 0; i--) {
      -        r[i] = (u[i] >> shift) | carry;
      -        carry = u[i] << (32 - shift);
      -        DEBUG(cerr << " " << r[i]);
      -      }
      -    } else {
      -      for (int i = n-1; i >= 0; i--) {
      -        r[i] = u[i];
      -        DEBUG(cerr << " " << r[i]);
      -      }
      -    }
      -    DEBUG(cerr << '\n');
      -  }
      -  DEBUG(cerr << std::setbase(10) << '\n');
      -}
      -
      -void APInt::divide(const APInt LHS, uint32_t lhsWords, 
      -                   const APInt &RHS, uint32_t rhsWords,
      -                   APInt *Quotient, APInt *Remainder)
      -{
      -  assert(lhsWords >= rhsWords && "Fractional result");
      -
      -  // First, compose the values into an array of 32-bit words instead of 
      -  // 64-bit words. This is a necessity of both the "short division" algorithm
      -  // and the the Knuth "classical algorithm" which requires there to be native 
      -  // operations for +, -, and * on an m bit value with an m*2 bit result. We 
      -  // can't use 64-bit operands here because we don't have native results of 
      -  // 128-bits. Furthremore, casting the 64-bit values to 32-bit values won't 
      -  // work on large-endian machines.
      -  uint64_t mask = ~0ull >> (sizeof(uint32_t)*8);
      -  uint32_t n = rhsWords * 2;
      -  uint32_t m = (lhsWords * 2) - n;
      -
      -  // Allocate space for the temporary values we need either on the stack, if
      -  // it will fit, or on the heap if it won't.
      -  uint32_t SPACE[128];
      -  uint32_t *U = 0;
      -  uint32_t *V = 0;
      -  uint32_t *Q = 0;
      -  uint32_t *R = 0;
      -  if ((Remainder?4:3)*n+2*m+1 <= 128) {
      -    U = &SPACE[0];
      -    V = &SPACE[m+n+1];
      -    Q = &SPACE[(m+n+1) + n];
      -    if (Remainder)
      -      R = &SPACE[(m+n+1) + n + (m+n)];
      -  } else {
      -    U = new uint32_t[m + n + 1];
      -    V = new uint32_t[n];
      -    Q = new uint32_t[m+n];
      -    if (Remainder)
      -      R = new uint32_t[n];
      -  }
      -
      -  // Initialize the dividend
      -  memset(U, 0, (m+n+1)*sizeof(uint32_t));
      -  for (unsigned i = 0; i < lhsWords; ++i) {
      -    uint64_t tmp = (LHS.getNumWords() == 1 ? LHS.VAL : LHS.pVal[i]);
      -    U[i * 2] = tmp & mask;
      -    U[i * 2 + 1] = tmp >> (sizeof(uint32_t)*8);
      -  }
      -  U[m+n] = 0; // this extra word is for "spill" in the Knuth algorithm.
      -
      -  // Initialize the divisor
      -  memset(V, 0, (n)*sizeof(uint32_t));
      -  for (unsigned i = 0; i < rhsWords; ++i) {
      -    uint64_t tmp = (RHS.getNumWords() == 1 ? RHS.VAL : RHS.pVal[i]);
      -    V[i * 2] = tmp & mask;
      -    V[i * 2 + 1] = tmp >> (sizeof(uint32_t)*8);
      -  }
      -
      -  // initialize the quotient and remainder
      -  memset(Q, 0, (m+n) * sizeof(uint32_t));
      -  if (Remainder)
      -    memset(R, 0, n * sizeof(uint32_t));
      -
      -  // Now, adjust m and n for the Knuth division. n is the number of words in 
      -  // the divisor. m is the number of words by which the dividend exceeds the
      -  // divisor (i.e. m+n is the length of the dividend). These sizes must not 
      -  // contain any zero words or the Knuth algorithm fails.
      -  for (unsigned i = n; i > 0 && V[i-1] == 0; i--) {
      -    n--;
      -    m++;
      -  }
      -  for (unsigned i = m+n; i > 0 && U[i-1] == 0; i--)
      -    m--;
      -
      -  // If we're left with only a single word for the divisor, Knuth doesn't work
      -  // so we implement the short division algorithm here. This is much simpler
      -  // and faster because we are certain that we can divide a 64-bit quantity
      -  // by a 32-bit quantity at hardware speed and short division is simply a
      -  // series of such operations. This is just like doing short division but we
      -  // are using base 2^32 instead of base 10.
      -  assert(n != 0 && "Divide by zero?");
      -  if (n == 1) {
      -    uint32_t divisor = V[0];
      -    uint32_t remainder = 0;
      -    for (int i = m+n-1; i >= 0; i--) {
      -      uint64_t partial_dividend = uint64_t(remainder) << 32 | U[i];
      -      if (partial_dividend == 0) {
      -        Q[i] = 0;
      -        remainder = 0;
      -      } else if (partial_dividend < divisor) {
      -        Q[i] = 0;
      -        remainder = partial_dividend;
      -      } else if (partial_dividend == divisor) {
      -        Q[i] = 1;
      -        remainder = 0;
      -      } else {
      -        Q[i] = partial_dividend / divisor;
      -        remainder = partial_dividend - (Q[i] * divisor);
      -      }
      -    }
      -    if (R)
      -      R[0] = remainder;
      -  } else {
      -    // Now we're ready to invoke the Knuth classical divide algorithm. In this
      -    // case n > 1.
      -    KnuthDiv(U, V, Q, R, m, n);
      -  }
      -
      -  // If the caller wants the quotient
      -  if (Quotient) {
      -    // Set up the Quotient value's memory.
      -    if (Quotient->BitWidth != LHS.BitWidth) {
      -      if (Quotient->isSingleWord())
      -        Quotient->VAL = 0;
      -      else
      -        delete [] Quotient->pVal;
      -      Quotient->BitWidth = LHS.BitWidth;
      -      if (!Quotient->isSingleWord())
      -        Quotient->pVal = getClearedMemory(Quotient->getNumWords());
      -    } else
      -      Quotient->clear();
      -
      -    // The quotient is in Q. Reconstitute the quotient into Quotient's low 
      -    // order words.
      -    if (lhsWords == 1) {
      -      uint64_t tmp = 
      -        uint64_t(Q[0]) | (uint64_t(Q[1]) << (APINT_BITS_PER_WORD / 2));
      -      if (Quotient->isSingleWord())
      -        Quotient->VAL = tmp;
      -      else
      -        Quotient->pVal[0] = tmp;
      -    } else {
      -      assert(!Quotient->isSingleWord() && "Quotient APInt not large enough");
      -      for (unsigned i = 0; i < lhsWords; ++i)
      -        Quotient->pVal[i] = 
      -          uint64_t(Q[i*2]) | (uint64_t(Q[i*2+1]) << (APINT_BITS_PER_WORD / 2));
      -    }
      -  }
      -
      -  // If the caller wants the remainder
      -  if (Remainder) {
      -    // Set up the Remainder value's memory.
      -    if (Remainder->BitWidth != RHS.BitWidth) {
      -      if (Remainder->isSingleWord())
      -        Remainder->VAL = 0;
      -      else
      -        delete [] Remainder->pVal;
      -      Remainder->BitWidth = RHS.BitWidth;
      -      if (!Remainder->isSingleWord())
      -        Remainder->pVal = getClearedMemory(Remainder->getNumWords());
      -    } else
      -      Remainder->clear();
      -
      -    // The remainder is in R. Reconstitute the remainder into Remainder's low
      -    // order words.
      -    if (rhsWords == 1) {
      -      uint64_t tmp = 
      -        uint64_t(R[0]) | (uint64_t(R[1]) << (APINT_BITS_PER_WORD / 2));
      -      if (Remainder->isSingleWord())
      -        Remainder->VAL = tmp;
      -      else
      -        Remainder->pVal[0] = tmp;
      -    } else {
      -      assert(!Remainder->isSingleWord() && "Remainder APInt not large enough");
      -      for (unsigned i = 0; i < rhsWords; ++i)
      -        Remainder->pVal[i] = 
      -          uint64_t(R[i*2]) | (uint64_t(R[i*2+1]) << (APINT_BITS_PER_WORD / 2));
      -    }
      -  }
      -
      -  // Clean up the memory we allocated.
      -  if (U != &SPACE[0]) {
      -    delete [] U;
      -    delete [] V;
      -    delete [] Q;
      -    delete [] R;
      -  }
      -}
      -
      -APInt APInt::udiv(const APInt& RHS) const {
      -  assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
      -
      -  // First, deal with the easy case
      -  if (isSingleWord()) {
      -    assert(RHS.VAL != 0 && "Divide by zero?");
      -    return APInt(BitWidth, VAL / RHS.VAL);
      -  }
      -
      -  // Get some facts about the LHS and RHS number of bits and words
      -  uint32_t rhsBits = RHS.getActiveBits();
      -  uint32_t rhsWords = !rhsBits ? 0 : (APInt::whichWord(rhsBits - 1) + 1);
      -  assert(rhsWords && "Divided by zero???");
      -  uint32_t lhsBits = this->getActiveBits();
      -  uint32_t lhsWords = !lhsBits ? 0 : (APInt::whichWord(lhsBits - 1) + 1);
      -
      -  // Deal with some degenerate cases
      -  if (!lhsWords) 
      -    // 0 / X ===> 0
      -    return APInt(BitWidth, 0); 
      -  else if (lhsWords < rhsWords || this->ult(RHS)) {
      -    // X / Y ===> 0, iff X < Y
      -    return APInt(BitWidth, 0);
      -  } else if (*this == RHS) {
      -    // X / X ===> 1
      -    return APInt(BitWidth, 1);
      -  } else if (lhsWords == 1 && rhsWords == 1) {
      -    // All high words are zero, just use native divide
      -    return APInt(BitWidth, this->pVal[0] / RHS.pVal[0]);
      -  }
      -
      -  // We have to compute it the hard way. Invoke the Knuth divide algorithm.
      -  APInt Quotient(1,0); // to hold result.
      -  divide(*this, lhsWords, RHS, rhsWords, &Quotient, 0);
      -  return Quotient;
      -}
      -
      -APInt APInt::urem(const APInt& RHS) const {
      -  assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
      -  if (isSingleWord()) {
      -    assert(RHS.VAL != 0 && "Remainder by zero?");
      -    return APInt(BitWidth, VAL % RHS.VAL);
      -  }
      -
      -  // Get some facts about the LHS
      -  uint32_t lhsBits = getActiveBits();
      -  uint32_t lhsWords = !lhsBits ? 0 : (whichWord(lhsBits - 1) + 1);
      -
      -  // Get some facts about the RHS
      -  uint32_t rhsBits = RHS.getActiveBits();
      -  uint32_t rhsWords = !rhsBits ? 0 : (APInt::whichWord(rhsBits - 1) + 1);
      -  assert(rhsWords && "Performing remainder operation by zero ???");
      -
      -  // Check the degenerate cases
      -  if (lhsWords == 0) {
      -    // 0 % Y ===> 0
      -    return APInt(BitWidth, 0);
      -  } else if (lhsWords < rhsWords || this->ult(RHS)) {
      -    // X % Y ===> X, iff X < Y
      -    return *this;
      -  } else if (*this == RHS) {
      -    // X % X == 0;
      -    return APInt(BitWidth, 0);
      -  } else if (lhsWords == 1) {
      -    // All high words are zero, just use native remainder
      -    return APInt(BitWidth, pVal[0] % RHS.pVal[0]);
      -  }
      -
      -  // We have to compute it the hard way. Invoke the Knuth divide algorithm.
      -  APInt Remainder(1,0);
      -  divide(*this, lhsWords, RHS, rhsWords, 0, &Remainder);
      -  return Remainder;
      -}
      -
      -void APInt::udivrem(const APInt &LHS, const APInt &RHS, 
      -                    APInt &Quotient, APInt &Remainder) {
      -  // Get some size facts about the dividend and divisor
      -  uint32_t lhsBits  = LHS.getActiveBits();
      -  uint32_t lhsWords = !lhsBits ? 0 : (APInt::whichWord(lhsBits - 1) + 1);
      -  uint32_t rhsBits  = RHS.getActiveBits();
      -  uint32_t rhsWords = !rhsBits ? 0 : (APInt::whichWord(rhsBits - 1) + 1);
      -
      -  // Check the degenerate cases
      -  if (lhsWords == 0) {              
      -    Quotient = 0;                // 0 / Y ===> 0
      -    Remainder = 0;               // 0 % Y ===> 0
      -    return;
      -  } 
      -  
      -  if (lhsWords < rhsWords || LHS.ult(RHS)) { 
      -    Quotient = 0;               // X / Y ===> 0, iff X < Y
      -    Remainder = LHS;            // X % Y ===> X, iff X < Y
      -    return;
      -  } 
      -  
      -  if (LHS == RHS) {
      -    Quotient  = 1;              // X / X ===> 1
      -    Remainder = 0;              // X % X ===> 0;
      -    return;
      -  } 
      -  
      -  if (lhsWords == 1 && rhsWords == 1) {
      -    // There is only one word to consider so use the native versions.
      -    if (LHS.isSingleWord()) {
      -      Quotient = APInt(LHS.getBitWidth(), LHS.VAL / RHS.VAL);
      -      Remainder = APInt(LHS.getBitWidth(), LHS.VAL % RHS.VAL);
      -    } else {
      -      Quotient = APInt(LHS.getBitWidth(), LHS.pVal[0] / RHS.pVal[0]);
      -      Remainder = APInt(LHS.getBitWidth(), LHS.pVal[0] % RHS.pVal[0]);
      -    }
      -    return;
      -  }
      -
      -  // Okay, lets do it the long way
      -  divide(LHS, lhsWords, RHS, rhsWords, &Quotient, &Remainder);
      -}
      -
      -void APInt::fromString(uint32_t numbits, const char *str, uint32_t slen, 
      -                       uint8_t radix) {
      -  // Check our assumptions here
      -  assert((radix == 10 || radix == 8 || radix == 16 || radix == 2) &&
      -         "Radix should be 2, 8, 10, or 16!");
      -  assert(str && "String is null?");
      -  bool isNeg = str[0] == '-';
      -  if (isNeg)
      -    str++, slen--;
      -  assert((slen <= numbits || radix != 2) && "Insufficient bit width");
      -  assert((slen*3 <= numbits || radix != 8) && "Insufficient bit width");
      -  assert((slen*4 <= numbits || radix != 16) && "Insufficient bit width");
      -  assert(((slen*64)/22 <= numbits || radix != 10) && "Insufficient bit width");
      -
      -  // Allocate memory
      -  if (!isSingleWord())
      -    pVal = getClearedMemory(getNumWords());
      -
      -  // Figure out if we can shift instead of multiply
      -  uint32_t shift = (radix == 16 ? 4 : radix == 8 ? 3 : radix == 2 ? 1 : 0);
      -
      -  // Set up an APInt for the digit to add outside the loop so we don't
      -  // constantly construct/destruct it.
      -  APInt apdigit(getBitWidth(), 0);
      -  APInt apradix(getBitWidth(), radix);
      -
      -  // Enter digit traversal loop
      -  for (unsigned i = 0; i < slen; i++) {
      -    // Get a digit
      -    uint32_t digit = 0;
      -    char cdigit = str[i];
      -    if (radix == 16) {
      -      if (!isxdigit(cdigit))
      -        assert(0 && "Invalid hex digit in string");
      -      if (isdigit(cdigit))
      -        digit = cdigit - '0';
      -      else if (cdigit >= 'a')
      -        digit = cdigit - 'a' + 10;
      -      else if (cdigit >= 'A')
      -        digit = cdigit - 'A' + 10;
      -      else
      -        assert(0 && "huh? we shouldn't get here");
      -    } else if (isdigit(cdigit)) {
      -      digit = cdigit - '0';
      -    } else {
      -      assert(0 && "Invalid character in digit string");
      -    }
      -
      -    // Shift or multiply the value by the radix
      -    if (shift)
      -      *this <<= shift;
      -    else
      -      *this *= apradix;
      -
      -    // Add in the digit we just interpreted
      -    if (apdigit.isSingleWord())
      -      apdigit.VAL = digit;
      -    else
      -      apdigit.pVal[0] = digit;
      -    *this += apdigit;
      -  }
      -  // If its negative, put it in two's complement form
      -  if (isNeg) {
      -    (*this)--;
      -    this->flip();
      -  }
      -}
      -
      -std::string APInt::toString(uint8_t radix, bool wantSigned) const {
      -  assert((radix == 10 || radix == 8 || radix == 16 || radix == 2) &&
      -         "Radix should be 2, 8, 10, or 16!");
      -  static const char *digits[] = { 
      -    "0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F" 
      -  };
      -  std::string result;
      -  uint32_t bits_used = getActiveBits();
      -  if (isSingleWord()) {
      -    char buf[65];
      -    const char *format = (radix == 10 ? (wantSigned ? "%lld" : "%llu") :
      -       (radix == 16 ? "%llX" : (radix == 8 ? "%llo" : 0)));
      -    if (format) {
      -      if (wantSigned) {
      -        int64_t sextVal = (int64_t(VAL) << (APINT_BITS_PER_WORD-BitWidth)) >> 
      -                           (APINT_BITS_PER_WORD-BitWidth);
      -        sprintf(buf, format, sextVal);
      -      } else 
      -        sprintf(buf, format, VAL);
      -    } else {
      -      memset(buf, 0, 65);
      -      uint64_t v = VAL;
      -      while (bits_used) {
      -        uint32_t bit = v & 1;
      -        bits_used--;
      -        buf[bits_used] = digits[bit][0];
      -        v >>=1;
      -      }
      -    }
      -    result = buf;
      -    return result;
      -  }
      -
      -  if (radix != 10) {
      -    // For the 2, 8 and 16 bit cases, we can just shift instead of divide 
      -    // because the number of bits per digit (1,3 and 4 respectively) divides 
      -    // equaly. We just shift until there value is zero.
      -
      -    // First, check for a zero value and just short circuit the logic below.
      -    if (*this == 0)
      -      result = "0";
      -    else {
      -      APInt tmp(*this);
      -      size_t insert_at = 0;
      -      if (wantSigned && this->isNegative()) {
      -        // They want to print the signed version and it is a negative value
      -        // Flip the bits and add one to turn it into the equivalent positive
      -        // value and put a '-' in the result.
      -        tmp.flip();
      -        tmp++;
      -        result = "-";
      -        insert_at = 1;
      -      }
      -      // Just shift tmp right for each digit width until it becomes zero
      -      uint32_t shift = (radix == 16 ? 4 : (radix == 8 ? 3 : 1));
      -      uint64_t mask = radix - 1;
      -      APInt zero(tmp.getBitWidth(), 0);
      -      while (tmp.ne(zero)) {
      -        unsigned digit = (tmp.isSingleWord() ? tmp.VAL : tmp.pVal[0]) & mask;
      -        result.insert(insert_at, digits[digit]);
      -        tmp = tmp.lshr(shift);
      -      }
      -    }
      -    return result;
      -  }
      -
      -  APInt tmp(*this);
      -  APInt divisor(4, radix);
      -  APInt zero(tmp.getBitWidth(), 0);
      -  size_t insert_at = 0;
      -  if (wantSigned && tmp[BitWidth-1]) {
      -    // They want to print the signed version and it is a negative value
      -    // Flip the bits and add one to turn it into the equivalent positive
      -    // value and put a '-' in the result.
      -    tmp.flip();
      -    tmp++;
      -    result = "-";
      -    insert_at = 1;
      -  }
      -  if (tmp == APInt(tmp.getBitWidth(), 0))
      -    result = "0";
      -  else while (tmp.ne(zero)) {
      -    APInt APdigit(1,0);
      -    APInt tmp2(tmp.getBitWidth(), 0);
      -    divide(tmp, tmp.getNumWords(), divisor, divisor.getNumWords(), &tmp2, 
      -           &APdigit);
      -    uint32_t digit = APdigit.getZExtValue();
      -    assert(digit < radix && "divide failed");
      -    result.insert(insert_at,digits[digit]);
      -    tmp = tmp2;
      -  }
      -
      -  return result;
      -}
      -
      -void APInt::dump() const
      -{
      -  cerr << "APInt(" << BitWidth << ")=" << std::setbase(16);
      -  if (isSingleWord())
      -    cerr << VAL;
      -  else for (unsigned i = getNumWords(); i > 0; i--) {
      -    cerr << pVal[i-1] << " ";
      -  }
      -  cerr << " U(" << this->toStringUnsigned(10) << ") S("
      -       << this->toStringSigned(10) << ")" << std::setbase(10);
      -}
      -
      -// This implements a variety of operations on a representation of
      -// arbitrary precision, two's-complement, bignum integer values.
      -
      -/* Assumed by lowHalf, highHalf, partMSB and partLSB.  A fairly safe
      -   and unrestricting assumption.  */
      -COMPILE_TIME_ASSERT(integerPartWidth % 2 == 0);
      -
      -/* Some handy functions local to this file.  */
      -namespace {
      -
      -  /* Returns the integer part with the least significant BITS set.
      -     BITS cannot be zero.  */
      -  inline integerPart
      -  lowBitMask(unsigned int bits)
      -  {
      -    assert (bits != 0 && bits <= integerPartWidth);
      -
      -    return ~(integerPart) 0 >> (integerPartWidth - bits);
      -  }
      -
      -  /* Returns the value of the lower half of PART.  */
      -  inline integerPart
      -  lowHalf(integerPart part)
      -  {
      -    return part & lowBitMask(integerPartWidth / 2);
      -  }
      -
      -  /* Returns the value of the upper half of PART.  */
      -  inline integerPart
      -  highHalf(integerPart part)
      -  {
      -    return part >> (integerPartWidth / 2);
      -  }
      -
      -  /* Returns the bit number of the most significant set bit of a part.
      -     If the input number has no bits set -1U is returned.  */
      -  unsigned int
      -  partMSB(integerPart value)
      -  {
      -    unsigned int n, msb;
      -
      -    if (value == 0)
      -      return -1U;
      -
      -    n = integerPartWidth / 2;
      -
      -    msb = 0;
      -    do {
      -      if (value >> n) {
      -        value >>= n;
      -        msb += n;
      -      }
      -
      -      n >>= 1;
      -    } while (n);
      -
      -    return msb;
      -  }
      -
      -  /* Returns the bit number of the least significant set bit of a
      -     part.  If the input number has no bits set -1U is returned.  */
      -  unsigned int
      -  partLSB(integerPart value)
      -  {
      -    unsigned int n, lsb;
      -
      -    if (value == 0)
      -      return -1U;
      -
      -    lsb = integerPartWidth - 1;
      -    n = integerPartWidth / 2;
      -
      -    do {
      -      if (value << n) {
      -        value <<= n;
      -        lsb -= n;
      -      }
      -
      -      n >>= 1;
      -    } while (n);
      -
      -    return lsb;
      -  }
      -}
      -
      -/* Sets the least significant part of a bignum to the input value, and
      -   zeroes out higher parts.  */
      -void
      -APInt::tcSet(integerPart *dst, integerPart part, unsigned int parts)
      -{
      -  unsigned int i;
      -
      -  assert (parts > 0);
      -
      -  dst[0] = part;
      -  for(i = 1; i < parts; i++)
      -    dst[i] = 0;
      -}
      -
      -/* Assign one bignum to another.  */
      -void
      -APInt::tcAssign(integerPart *dst, const integerPart *src, unsigned int parts)
      -{
      -  unsigned int i;
      -
      -  for(i = 0; i < parts; i++)
      -    dst[i] = src[i];
      -}
      -
      -/* Returns true if a bignum is zero, false otherwise.  */
      -bool
      -APInt::tcIsZero(const integerPart *src, unsigned int parts)
      -{
      -  unsigned int i;
      -
      -  for(i = 0; i < parts; i++)
      -    if (src[i])
      -      return false;
      -
      -  return true;
      -}
      -
      -/* Extract the given bit of a bignum; returns 0 or 1.  */
      -int
      -APInt::tcExtractBit(const integerPart *parts, unsigned int bit)
      -{
      -  return(parts[bit / integerPartWidth]
      -         & ((integerPart) 1 << bit % integerPartWidth)) != 0;
      -}
      -
      -/* Set the given bit of a bignum.  */
      -void
      -APInt::tcSetBit(integerPart *parts, unsigned int bit)
      -{
      -  parts[bit / integerPartWidth] |= (integerPart) 1 << (bit % integerPartWidth);
      -}
      -
      -/* Returns the bit number of the least significant set bit of a
      -   number.  If the input number has no bits set -1U is returned.  */
      -unsigned int
      -APInt::tcLSB(const integerPart *parts, unsigned int n)
      -{
      -  unsigned int i, lsb;
      -
      -  for(i = 0; i < n; i++) {
      -      if (parts[i] != 0) {
      -          lsb = partLSB(parts[i]);
      -
      -          return lsb + i * integerPartWidth;
      -      }
      -  }
      -
      -  return -1U;
      -}
      -
      -/* Returns the bit number of the most significant set bit of a number.
      -   If the input number has no bits set -1U is returned.  */
      -unsigned int
      -APInt::tcMSB(const integerPart *parts, unsigned int n)
      -{
      -  unsigned int msb;
      -
      -  do {
      -      --n;
      -
      -      if (parts[n] != 0) {
      -          msb = partMSB(parts[n]);
      -
      -          return msb + n * integerPartWidth;
      -      }
      -  } while (n);
      -
      -  return -1U;
      -}
      -
      -/* Copy the bit vector of width srcBITS from SRC, starting at bit
      -   srcLSB, to DST, of dstCOUNT parts, such that the bit srcLSB becomes
      -   the least significant bit of DST.  All high bits above srcBITS in
      -   DST are zero-filled.  */
      -void
      -APInt::tcExtract(integerPart *dst, unsigned int dstCount, const integerPart *src,
      -                 unsigned int srcBits, unsigned int srcLSB)
      -{
      -  unsigned int firstSrcPart, dstParts, shift, n;
      -
      -  dstParts = (srcBits + integerPartWidth - 1) / integerPartWidth;
      -  assert (dstParts <= dstCount);
      -
      -  firstSrcPart = srcLSB / integerPartWidth;
      -  tcAssign (dst, src + firstSrcPart, dstParts);
      -
      -  shift = srcLSB % integerPartWidth;
      -  tcShiftRight (dst, dstParts, shift);
      -
      -  /* We now have (dstParts * integerPartWidth - shift) bits from SRC
      -     in DST.  If this is less that srcBits, append the rest, else
      -     clear the high bits.  */
      -  n = dstParts * integerPartWidth - shift;
      -  if (n < srcBits) {
      -    integerPart mask = lowBitMask (srcBits - n);
      -    dst[dstParts - 1] |= ((src[firstSrcPart + dstParts] & mask)
      -                          << n % integerPartWidth);
      -  } else if (n > srcBits) {
      -    if (srcBits % integerPartWidth)
      -      dst[dstParts - 1] &= lowBitMask (srcBits % integerPartWidth);
      -  }
      -
      -  /* Clear high parts.  */
      -  while (dstParts < dstCount)
      -    dst[dstParts++] = 0;
      -}
      -
      -/* DST += RHS + C where C is zero or one.  Returns the carry flag.  */
      -integerPart
      -APInt::tcAdd(integerPart *dst, const integerPart *rhs,
      -             integerPart c, unsigned int parts)
      -{
      -  unsigned int i;
      -
      -  assert(c <= 1);
      -
      -  for(i = 0; i < parts; i++) {
      -    integerPart l;
      -
      -    l = dst[i];
      -    if (c) {
      -      dst[i] += rhs[i] + 1;
      -      c = (dst[i] <= l);
      -    } else {
      -      dst[i] += rhs[i];
      -      c = (dst[i] < l);
      -    }
      -  }
      -
      -  return c;
      -}
      -
      -/* DST -= RHS + C where C is zero or one.  Returns the carry flag.  */
      -integerPart
      -APInt::tcSubtract(integerPart *dst, const integerPart *rhs,
      -                  integerPart c, unsigned int parts)
      -{
      -  unsigned int i;
      -
      -  assert(c <= 1);
      -
      -  for(i = 0; i < parts; i++) {
      -    integerPart l;
      -
      -    l = dst[i];
      -    if (c) {
      -      dst[i] -= rhs[i] + 1;
      -      c = (dst[i] >= l);
      -    } else {
      -      dst[i] -= rhs[i];
      -      c = (dst[i] > l);
      -    }
      -  }
      -
      -  return c;
      -}
      -
      -/* Negate a bignum in-place.  */
      -void
      -APInt::tcNegate(integerPart *dst, unsigned int parts)
      -{
      -  tcComplement(dst, parts);
      -  tcIncrement(dst, parts);
      -}
      -
      -/*  DST += SRC * MULTIPLIER + CARRY   if add is true
      -    DST  = SRC * MULTIPLIER + CARRY   if add is false
      -
      -    Requires 0 <= DSTPARTS <= SRCPARTS + 1.  If DST overlaps SRC
      -    they must start at the same point, i.e. DST == SRC.
      -
      -    If DSTPARTS == SRCPARTS + 1 no overflow occurs and zero is
      -    returned.  Otherwise DST is filled with the least significant
      -    DSTPARTS parts of the result, and if all of the omitted higher
      -    parts were zero return zero, otherwise overflow occurred and
      -    return one.  */
      -int
      -APInt::tcMultiplyPart(integerPart *dst, const integerPart *src,
      -                      integerPart multiplier, integerPart carry,
      -                      unsigned int srcParts, unsigned int dstParts,
      -                      bool add)
      -{
      -  unsigned int i, n;
      -
      -  /* Otherwise our writes of DST kill our later reads of SRC.  */
      -  assert(dst <= src || dst >= src + srcParts);
      -  assert(dstParts <= srcParts + 1);
      -
      -  /* N loops; minimum of dstParts and srcParts.  */
      -  n = dstParts < srcParts ? dstParts: srcParts;
      -
      -  for(i = 0; i < n; i++) {
      -    integerPart low, mid, high, srcPart;
      -
      -      /* [ LOW, HIGH ] = MULTIPLIER * SRC[i] + DST[i] + CARRY.
      -
      -         This cannot overflow, because
      -
      -         (n - 1) * (n - 1) + 2 (n - 1) = (n - 1) * (n + 1)
      -
      -         which is less than n^2.  */
      -
      -    srcPart = src[i];
      -
      -    if (multiplier == 0 || srcPart == 0)        {
      -      low = carry;
      -      high = 0;
      -    } else {
      -      low = lowHalf(srcPart) * lowHalf(multiplier);
      -      high = highHalf(srcPart) * highHalf(multiplier);
      -
      -      mid = lowHalf(srcPart) * highHalf(multiplier);
      -      high += highHalf(mid);
      -      mid <<= integerPartWidth / 2;
      -      if (low + mid < low)
      -        high++;
      -      low += mid;
      -
      -      mid = highHalf(srcPart) * lowHalf(multiplier);
      -      high += highHalf(mid);
      -      mid <<= integerPartWidth / 2;
      -      if (low + mid < low)
      -        high++;
      -      low += mid;
      -
      -      /* Now add carry.  */
      -      if (low + carry < low)
      -        high++;
      -      low += carry;
      -    }
      -
      -    if (add) {
      -      /* And now DST[i], and store the new low part there.  */
      -      if (low + dst[i] < low)
      -        high++;
      -      dst[i] += low;
      -    } else
      -      dst[i] = low;
      -
      -    carry = high;
      -  }
      -
      -  if (i < dstParts) {
      -    /* Full multiplication, there is no overflow.  */
      -    assert(i + 1 == dstParts);
      -    dst[i] = carry;
      -    return 0;
      -  } else {
      -    /* We overflowed if there is carry.  */
      -    if (carry)
      -      return 1;
      -
      -    /* We would overflow if any significant unwritten parts would be
      -       non-zero.  This is true if any remaining src parts are non-zero
      -       and the multiplier is non-zero.  */
      -    if (multiplier)
      -      for(; i < srcParts; i++)
      -        if (src[i])
      -          return 1;
      -
      -    /* We fitted in the narrow destination.  */
      -    return 0;
      -  }
      -}
      -
      -/* DST = LHS * RHS, where DST has the same width as the operands and
      -   is filled with the least significant parts of the result.  Returns
      -   one if overflow occurred, otherwise zero.  DST must be disjoint
      -   from both operands.  */
      -int
      -APInt::tcMultiply(integerPart *dst, const integerPart *lhs,
      -                  const integerPart *rhs, unsigned int parts)
      -{
      -  unsigned int i;
      -  int overflow;
      -
      -  assert(dst != lhs && dst != rhs);
      -
      -  overflow = 0;
      -  tcSet(dst, 0, parts);
      -
      -  for(i = 0; i < parts; i++)
      -    overflow |= tcMultiplyPart(&dst[i], lhs, rhs[i], 0, parts,
      -                               parts - i, true);
      -
      -  return overflow;
      -}
      -
      -/* DST = LHS * RHS, where DST has width the sum of the widths of the
      -   operands.  No overflow occurs.  DST must be disjoint from both
      -   operands.  Returns the number of parts required to hold the
      -   result.  */
      -unsigned int
      -APInt::tcFullMultiply(integerPart *dst, const integerPart *lhs,
      -                      const integerPart *rhs, unsigned int lhsParts,
      -                      unsigned int rhsParts)
      -{
      -  /* Put the narrower number on the LHS for less loops below.  */
      -  if (lhsParts > rhsParts) {
      -    return tcFullMultiply (dst, rhs, lhs, rhsParts, lhsParts);
      -  } else {
      -    unsigned int n;
      -
      -    assert(dst != lhs && dst != rhs);
      -
      -    tcSet(dst, 0, rhsParts);
      -
      -    for(n = 0; n < lhsParts; n++)
      -      tcMultiplyPart(&dst[n], rhs, lhs[n], 0, rhsParts, rhsParts + 1, true);
      -
      -    n = lhsParts + rhsParts;
      -
      -    return n - (dst[n - 1] == 0);
      -  }
      -}
      -
      -/* If RHS is zero LHS and REMAINDER are left unchanged, return one.
      -   Otherwise set LHS to LHS / RHS with the fractional part discarded,
      -   set REMAINDER to the remainder, return zero.  i.e.
      -
      -   OLD_LHS = RHS * LHS + REMAINDER
      -
      -   SCRATCH is a bignum of the same size as the operands and result for
      -   use by the routine; its contents need not be initialized and are
      -   destroyed.  LHS, REMAINDER and SCRATCH must be distinct.
      -*/
      -int
      -APInt::tcDivide(integerPart *lhs, const integerPart *rhs,
      -                integerPart *remainder, integerPart *srhs,
      -                unsigned int parts)
      -{
      -  unsigned int n, shiftCount;
      -  integerPart mask;
      -
      -  assert(lhs != remainder && lhs != srhs && remainder != srhs);
      -
      -  shiftCount = tcMSB(rhs, parts) + 1;
      -  if (shiftCount == 0)
      -    return true;
      -
      -  shiftCount = parts * integerPartWidth - shiftCount;
      -  n = shiftCount / integerPartWidth;
      -  mask = (integerPart) 1 << (shiftCount % integerPartWidth);
      -
      -  tcAssign(srhs, rhs, parts);
      -  tcShiftLeft(srhs, parts, shiftCount);
      -  tcAssign(remainder, lhs, parts);
      -  tcSet(lhs, 0, parts);
      -
      -  /* Loop, subtracting SRHS if REMAINDER is greater and adding that to
      -     the total.  */
      -  for(;;) {
      -      int compare;
      -
      -      compare = tcCompare(remainder, srhs, parts);
      -      if (compare >= 0) {
      -        tcSubtract(remainder, srhs, 0, parts);
      -        lhs[n] |= mask;
      -      }
      -
      -      if (shiftCount == 0)
      -        break;
      -      shiftCount--;
      -      tcShiftRight(srhs, parts, 1);
      -      if ((mask >>= 1) == 0)
      -        mask = (integerPart) 1 << (integerPartWidth - 1), n--;
      -  }
      -
      -  return false;
      -}
      -
      -/* Shift a bignum left COUNT bits in-place.  Shifted in bits are zero.
      -   There are no restrictions on COUNT.  */
      -void
      -APInt::tcShiftLeft(integerPart *dst, unsigned int parts, unsigned int count)
      -{
      -  if (count) {
      -    unsigned int jump, shift;
      -
      -    /* Jump is the inter-part jump; shift is is intra-part shift.  */
      -    jump = count / integerPartWidth;
      -    shift = count % integerPartWidth;
      -
      -    while (parts > jump) {
      -      integerPart part;
      -
      -      parts--;
      -
      -      /* dst[i] comes from the two parts src[i - jump] and, if we have
      -         an intra-part shift, src[i - jump - 1].  */
      -      part = dst[parts - jump];
      -      if (shift) {
      -        part <<= shift;
      -        if (parts >= jump + 1)
      -          part |= dst[parts - jump - 1] >> (integerPartWidth - shift);
      -      }
      -
      -      dst[parts] = part;
      -    }
      -
      -    while (parts > 0)
      -      dst[--parts] = 0;
      -  }
      -}
      -
      -/* Shift a bignum right COUNT bits in-place.  Shifted in bits are
      -   zero.  There are no restrictions on COUNT.  */
      -void
      -APInt::tcShiftRight(integerPart *dst, unsigned int parts, unsigned int count)
      -{
      -  if (count) {
      -    unsigned int i, jump, shift;
      -
      -    /* Jump is the inter-part jump; shift is is intra-part shift.  */
      -    jump = count / integerPartWidth;
      -    shift = count % integerPartWidth;
      -
      -    /* Perform the shift.  This leaves the most significant COUNT bits
      -       of the result at zero.  */
      -    for(i = 0; i < parts; i++) {
      -      integerPart part;
      -
      -      if (i + jump >= parts) {
      -        part = 0;
      -      } else {
      -        part = dst[i + jump];
      -        if (shift) {
      -          part >>= shift;
      -          if (i + jump + 1 < parts)
      -            part |= dst[i + jump + 1] << (integerPartWidth - shift);
      -        }
      -      }
      -
      -      dst[i] = part;
      -    }
      -  }
      -}
      -
      -/* Bitwise and of two bignums.  */
      -void
      -APInt::tcAnd(integerPart *dst, const integerPart *rhs, unsigned int parts)
      -{
      -  unsigned int i;
      -
      -  for(i = 0; i < parts; i++)
      -    dst[i] &= rhs[i];
      -}
      -
      -/* Bitwise inclusive or of two bignums.  */
      -void
      -APInt::tcOr(integerPart *dst, const integerPart *rhs, unsigned int parts)
      -{
      -  unsigned int i;
      -
      -  for(i = 0; i < parts; i++)
      -    dst[i] |= rhs[i];
      -}
      -
      -/* Bitwise exclusive or of two bignums.  */
      -void
      -APInt::tcXor(integerPart *dst, const integerPart *rhs, unsigned int parts)
      -{
      -  unsigned int i;
      -
      -  for(i = 0; i < parts; i++)
      -    dst[i] ^= rhs[i];
      -}
      -
      -/* Complement a bignum in-place.  */
      -void
      -APInt::tcComplement(integerPart *dst, unsigned int parts)
      -{
      -  unsigned int i;
      -
      -  for(i = 0; i < parts; i++)
      -    dst[i] = ~dst[i];
      -}
      -
      -/* Comparison (unsigned) of two bignums.  */
      -int
      -APInt::tcCompare(const integerPart *lhs, const integerPart *rhs,
      -                 unsigned int parts)
      -{
      -  while (parts) {
      -      parts--;
      -      if (lhs[parts] == rhs[parts])
      -        continue;
      -
      -      if (lhs[parts] > rhs[parts])
      -        return 1;
      -      else
      -        return -1;
      -    }
      -
      -  return 0;
      -}
      -
      -/* Increment a bignum in-place, return the carry flag.  */
      -integerPart
      -APInt::tcIncrement(integerPart *dst, unsigned int parts)
      -{
      -  unsigned int i;
      -
      -  for(i = 0; i < parts; i++)
      -    if (++dst[i] != 0)
      -      break;
      -
      -  return i == parts;
      -}
      -
      -/* Set the least significant BITS bits of a bignum, clear the
      -   rest.  */
      -void
      -APInt::tcSetLeastSignificantBits(integerPart *dst, unsigned int parts,
      -                                 unsigned int bits)
      -{
      -  unsigned int i;
      -
      -  i = 0;
      -  while (bits > integerPartWidth) {
      -    dst[i++] = ~(integerPart) 0;
      -    bits -= integerPartWidth;
      -  }
      -
      -  if (bits)
      -    dst[i++] = ~(integerPart) 0 >> (integerPartWidth - bits);
      -
      -  while (i < parts)
      -    dst[i++] = 0;
      -}
      
      
      
      
      From rspencer at reidspencer.com  Tue Dec 11 00:59:17 2007
      From: rspencer at reidspencer.com (Reid Spencer)
      Date: Tue, 11 Dec 2007 06:59:17 -0000
      Subject: [llvm-commits] [support] r44854 -
      	/support/trunk/lib/Support/APInt.cpp
      Message-ID: <200712110659.lBB6xHlv010644@zion.cs.uiuc.edu>
      
      Author: reid
      Date: Tue Dec 11 00:59:17 2007
      New Revision: 44854
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44854&view=rev
      Log:
      Update new version of APInt.cpp.
      
      Added:
          support/trunk/lib/Support/APInt.cpp
            - copied unchanged from r44853, llvm/trunk/lib/Support/APInt.cpp
      
      
      
      From sabre at nondot.org  Tue Dec 11 01:29:44 2007
      From: sabre at nondot.org (Chris Lattner)
      Date: Tue, 11 Dec 2007 07:29:44 -0000
      Subject: [llvm-commits] [llvm] r44855 - in /llvm/trunk:
       lib/Analysis/ConstantFolding.cpp
       test/Transforms/InstCombine/bitcast-vector-fold.ll
      Message-ID: <200712110729.lBB7TiCj012230@zion.cs.uiuc.edu>
      
      Author: lattner
      Date: Tue Dec 11 01:29:44 2007
      New Revision: 44855
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44855&view=rev
      Log:
      Implement constant folding if vector<->vector bitcasts where the number
      of source/dest elements changes.  This implements
      test/Transforms/InstCombine/bitcast-vector-fold.ll
      
      Added:
          llvm/trunk/test/Transforms/InstCombine/bitcast-vector-fold.ll
      Modified:
          llvm/trunk/lib/Analysis/ConstantFolding.cpp
      
      Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ConstantFolding.cpp?rev=44855&r1=44854&r2=44855&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Analysis/ConstantFolding.cpp (original)
      +++ llvm/trunk/lib/Analysis/ConstantFolding.cpp Tue Dec 11 01:29:44 2007
      @@ -145,6 +145,122 @@
         return 0;
       }
       
      +/// FoldBitCast - Constant fold bitcast, symbolically evaluating it with 
      +/// targetdata.  Return 0 if unfoldable.
      +static Constant *FoldBitCast(Constant *C, const Type *DestTy,
      +                             const TargetData &TD) {
      +  // If this is a bitcast from constant vector -> vector, fold it.
      +  if (ConstantVector *CV = dyn_cast(C)) {
      +    if (const VectorType *DestVTy = dyn_cast(DestTy)) {
      +      // If the element types match, VMCore can fold it.
      +      unsigned NumDstElt = DestVTy->getNumElements();
      +      unsigned NumSrcElt = CV->getNumOperands();
      +      if (NumDstElt == NumSrcElt)
      +        return 0;
      +      
      +      const Type *SrcEltTy = CV->getType()->getElementType();
      +      const Type *DstEltTy = DestVTy->getElementType();
      +      
      +      // Otherwise, we're changing the number of elements in a vector, which 
      +      // requires endianness information to do the right thing.  For example,
      +      //    bitcast (<2 x i64>  to <4 x i32>)
      +      // folds to (little endian):
      +      //    <4 x i32> 
      +      // and to (big endian):
      +      //    <4 x i32> 
      +      
      +      // First thing is first.  We only want to think about integer here, so if
      +      // we have something in FP form, recast it as integer.
      +      if (DstEltTy->isFloatingPoint()) {
      +        // Fold to an vector of integers with same size as our FP type.
      +        unsigned FPWidth = DstEltTy->getPrimitiveSizeInBits();
      +        const Type *DestIVTy = VectorType::get(IntegerType::get(FPWidth),
      +                                               NumDstElt);
      +        // Recursively handle this integer conversion, if possible.
      +        C = FoldBitCast(C, DestIVTy, TD);
      +        if (!C) return 0;
      +        
      +        // Finally, VMCore can handle this now that #elts line up.
      +        return ConstantExpr::getBitCast(C, DestTy);
      +      }
      +      
      +      // Okay, we know the destination is integer, if the input is FP, convert
      +      // it to integer first.
      +      if (SrcEltTy->isFloatingPoint()) {
      +        unsigned FPWidth = SrcEltTy->getPrimitiveSizeInBits();
      +        const Type *SrcIVTy = VectorType::get(IntegerType::get(FPWidth),
      +                                              NumSrcElt);
      +        // Ask VMCore to do the conversion now that #elts line up.
      +        C = ConstantExpr::getBitCast(C, SrcIVTy);
      +        CV = dyn_cast(C);
      +        if (!CV) return 0;  // If VMCore wasn't able to fold it, bail out.
      +      }
      +      
      +      // Now we know that the input and output vectors are both integer vectors
      +      // of the same size, and that their #elements is not the same.  Do the
      +      // conversion here, which depends on whether the input or output has
      +      // more elements.
      +      bool isLittleEndian = TD.isLittleEndian();
      +      
      +      SmallVector Result;
      +      if (NumDstElt < NumSrcElt) {
      +        // Handle: bitcast (<4 x i32>  to <2 x i64>)
      +        Constant *Zero = Constant::getNullValue(DstEltTy);
      +        unsigned Ratio = NumSrcElt/NumDstElt;
      +        unsigned SrcBitSize = SrcEltTy->getPrimitiveSizeInBits();
      +        unsigned SrcElt = 0;
      +        for (unsigned i = 0; i != NumDstElt; ++i) {
      +          // Build each element of the result.
      +          Constant *Elt = Zero;
      +          unsigned ShiftAmt = isLittleEndian ? 0 : SrcBitSize*(Ratio-1);
      +          for (unsigned j = 0; j != Ratio; ++j) {
      +            Constant *Src = dyn_cast(CV->getOperand(SrcElt++));
      +            if (!Src) return 0;  // Reject constantexpr elements.
      +            
      +            // Zero extend the element to the right size.
      +            Src = ConstantExpr::getZExt(Src, Elt->getType());
      +            
      +            // Shift it to the right place, depending on endianness.
      +            Src = ConstantExpr::getShl(Src, 
      +                                    ConstantInt::get(Src->getType(), ShiftAmt));
      +            ShiftAmt += isLittleEndian ? SrcBitSize : -SrcBitSize;
      +            
      +            // Mix it in.
      +            Elt = ConstantExpr::getOr(Elt, Src);
      +          }
      +          Result.push_back(Elt);
      +        }
      +      } else {
      +        // Handle: bitcast (<2 x i64>  to <4 x i32>)
      +        unsigned Ratio = NumDstElt/NumSrcElt;
      +        unsigned DstBitSize = DstEltTy->getPrimitiveSizeInBits();
      +        
      +        // Loop over each source value, expanding into multiple results.
      +        for (unsigned i = 0; i != NumSrcElt; ++i) {
      +          Constant *Src = dyn_cast(CV->getOperand(i));
      +          if (!Src) return 0;  // Reject constantexpr elements.
      +
      +          unsigned ShiftAmt = isLittleEndian ? 0 : DstBitSize*(Ratio-1);
      +          for (unsigned j = 0; j != Ratio; ++j) {
      +            // Shift the piece of the value into the right place, depending on
      +            // endianness.
      +            Constant *Elt = ConstantExpr::getLShr(Src, 
      +                                ConstantInt::get(Src->getType(), ShiftAmt));
      +            ShiftAmt += isLittleEndian ? DstBitSize : -DstBitSize;
      +
      +            // Truncate and remember this piece.
      +            Result.push_back(ConstantExpr::getTrunc(Elt, DstEltTy));
      +          }
      +        }
      +      }
      +      
      +      return ConstantVector::get(&Result[0], Result.size());
      +    }
      +  }
      +  
      +  return 0;
      +}
      +
       
       //===----------------------------------------------------------------------===//
       // Constant Folding public APIs
      @@ -233,7 +349,7 @@
               return ConstantExpr::getIntegerCast(Input, DestTy, false);
             }
           }
      -    // FALL THROUGH.
      +    return ConstantExpr::getCast(Opcode, Ops[0], DestTy);
         case Instruction::IntToPtr:
         case Instruction::Trunc:
         case Instruction::ZExt:
      @@ -244,8 +360,12 @@
         case Instruction::SIToFP:
         case Instruction::FPToUI:
         case Instruction::FPToSI:
      +      return ConstantExpr::getCast(Opcode, Ops[0], DestTy);
         case Instruction::BitCast:
      -    return ConstantExpr::getCast(Opcode, Ops[0], DestTy);
      +    if (TD)
      +      if (Constant *C = FoldBitCast(Ops[0], DestTy, *TD))
      +        return C;
      +    return ConstantExpr::getBitCast(Ops[0], DestTy);
         case Instruction::Select:
           return ConstantExpr::getSelect(Ops[0], Ops[1], Ops[2]);
         case Instruction::ExtractElement:
      
      Added: llvm/trunk/test/Transforms/InstCombine/bitcast-vector-fold.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/bitcast-vector-fold.ll?rev=44855&view=auto
      
      ==============================================================================
      --- llvm/trunk/test/Transforms/InstCombine/bitcast-vector-fold.ll (added)
      +++ llvm/trunk/test/Transforms/InstCombine/bitcast-vector-fold.ll Tue Dec 11 01:29:44 2007
      @@ -0,0 +1,33 @@
      +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep bitcast
      +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
      +target triple = "i686-apple-darwin8"
      +
      +define <2 x i64> @test1() {
      +	%tmp3 = bitcast <4 x i32> < i32 0, i32 1, i32 2, i32 3 > to <2 x i64>
      +	ret <2 x i64> %tmp3
      +}
      +
      +define <4 x i32> @test2() {
      +	%tmp3 = bitcast <2 x i64> < i64 0, i64 1 > to <4 x i32>
      +	ret <4 x i32> %tmp3
      +}
      +
      +define <2 x double> @test3() {
      +	%tmp3 = bitcast <4 x i32> < i32 0, i32 1, i32 2, i32 3 > to <2 x double>
      +	ret <2 x double> %tmp3
      +}
      +
      +define <4 x float> @test4() {
      +	%tmp3 = bitcast <2 x i64> < i64 0, i64 1 > to <4 x float>
      +	ret <4 x float> %tmp3
      +}
      +
      +define <2 x i64> @test5() {
      +	%tmp3 = bitcast <4 x float>  to <2 x i64>
      +	ret <2 x i64> %tmp3
      +}
      +
      +define <4 x i32> @test6() {
      +	%tmp3 = bitcast <2 x double>  to <4 x i32>
      +	ret <4 x i32> %tmp3
      +}
      
      
      
      
      From sabre at nondot.org  Tue Dec 11 01:49:41 2007
      From: sabre at nondot.org (Chris Lattner)
      Date: Tue, 11 Dec 2007 07:49:41 -0000
      Subject: [llvm-commits] [llvm] r44856 -
      	/llvm/trunk/lib/VMCore/ConstantFold.cpp
      Message-ID: <200712110749.lBB7nfmM013706@zion.cs.uiuc.edu>
      
      Author: lattner
      Date: Tue Dec 11 01:49:37 2007
      New Revision: 44856
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44856&view=rev
      Log:
      Teach VMCore to constant fold shufflevectors with constant operands.
      This allows us to compile:
      
      #include 
      typedef __m128i VSInt16;
      typedef short vSInt16 __attribute__ ((__vector_size__ (16)));
      VSInt16 t3() {
        return (VSInt16)((vSInt16)_mm_set1_epi16(6518));
      }
      
      into:
      
      _t3:
      	movaps	LCPI1_0, %xmm0
      	ret
      
      instead of:
      _t3:
      	movl	$6518, %eax
      	movd	%eax, %xmm0
      	pextrw	$0, %xmm0, %eax
      	xorps	%xmm0, %xmm0
      	pinsrw	$0, %eax, %xmm0
      	punpcklwd	%xmm0, %xmm0
      	pshufd	$0, %xmm0, %xmm0
      	ret
      
      
      Modified:
          llvm/trunk/lib/VMCore/ConstantFold.cpp
      
      Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=44856&r1=44855&r2=44856&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/VMCore/ConstantFold.cpp (original)
      +++ llvm/trunk/lib/VMCore/ConstantFold.cpp Tue Dec 11 01:49:37 2007
      @@ -396,11 +396,54 @@
         return 0;
       }
       
      +/// GetVectorElement - If C is a ConstantVector, ConstantAggregateZero or Undef
      +/// return the specified element value.  Otherwise return null.
      +static Constant *GetVectorElement(const Constant *C, unsigned EltNo) {
      +  if (const ConstantVector *CV = dyn_cast(C))
      +    return const_cast(CV->getOperand(EltNo));
      +  
      +  const Type *EltTy = cast(C->getType())->getElementType();
      +  if (isa(C))
      +    return Constant::getNullValue(EltTy);
      +  if (isa(C))
      +    return UndefValue::get(EltTy);
      +  return 0;
      +}
      +
       Constant *llvm::ConstantFoldShuffleVectorInstruction(const Constant *V1,
                                                            const Constant *V2,
                                                            const Constant *Mask) {
      -  // TODO:
      -  return 0;
      +  // Undefined shuffle mask -> undefined value.
      +  if (isa(Mask)) return UndefValue::get(V1->getType());
      +  
      +  unsigned NumElts = cast(V1->getType())->getNumElements();
      +  const Type *EltTy = cast(V1->getType())->getElementType();
      +  
      +  // Loop over the shuffle mask, evaluating each element.
      +  SmallVector Result;
      +  for (unsigned i = 0; i != NumElts; ++i) {
      +    Constant *InElt = GetVectorElement(Mask, i);
      +    if (InElt == 0) return 0;
      +    
      +    if (isa(InElt))
      +      InElt = UndefValue::get(EltTy);
      +    else if (ConstantInt *CI = dyn_cast(InElt)) {
      +      unsigned Elt = CI->getZExtValue();
      +      if (Elt >= NumElts*2)
      +        InElt = UndefValue::get(EltTy);
      +      else if (Elt >= NumElts)
      +        InElt = GetVectorElement(V2, Elt-NumElts);
      +      else
      +        InElt = GetVectorElement(V1, Elt);
      +      if (InElt == 0) return 0;
      +    } else {
      +      // Unknown value.
      +      return 0;
      +    }
      +    Result.push_back(InElt);
      +  }
      +  
      +  return ConstantVector::get(&Result[0], Result.size());
       }
       
       /// EvalVectorOp - Given two vector constants and a function pointer, apply the
      
      
      
      
      From christopher.lamb at gmail.com  Tue Dec 11 02:59:06 2007
      From: christopher.lamb at gmail.com (Christopher Lamb)
      Date: Tue, 11 Dec 2007 08:59:06 -0000
      Subject: [llvm-commits] [llvm] r44858 - in /llvm/trunk:
       include/llvm/Bitcode/LLVMBitCodes.h include/llvm/DerivedTypes.h
       include/llvm/GlobalVariable.h include/llvm/Instructions.h
       lib/AsmParser/LLLexer.cpp lib/AsmParser/llvmAsmParser.y
       lib/Bitcode/Reader/BitcodeReader.cpp lib/Bitcode/Writer/BitcodeWriter.cpp
       lib/VMCore/AsmWriter.cpp lib/VMCore/Constants.cpp lib/VMCore/Globals.cpp
       lib/VMCore/Instructions.cpp lib/VMCore/Type.cpp
       test/Assembler/2007-12-11-AddressSpaces.ll
       tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
      Message-ID: <200712110859.lBB8x7Sj025775@zion.cs.uiuc.edu>
      
      Author: clamb
      Date: Tue Dec 11 02:59:05 2007
      New Revision: 44858
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44858&view=rev
      Log:
      Implement address space attribute for LLVM pointer types. Address spaces are 
      regions of memory that have a target specific relationship, as described in the 
      Embedded C Technical Report. 
      
      This also implements the 2007-12-11-AddressSpaces test, 
      which demonstrates how address space attributes can be used in LLVM IR.
      
      In addition, this patch changes the bitcode signature for stores (in a backwards 
      compatible manner), such that the pointer type, rather than the pointee type, is 
      encoded. This permits type information in the pointer (e.g. address space) to be 
      preserved for stores.
      
      LangRef updates are forthcoming.
      
      Added:
          llvm/trunk/test/Assembler/2007-12-11-AddressSpaces.ll
      Modified:
          llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h
          llvm/trunk/include/llvm/DerivedTypes.h
          llvm/trunk/include/llvm/GlobalVariable.h
          llvm/trunk/include/llvm/Instructions.h
          llvm/trunk/lib/AsmParser/LLLexer.cpp
          llvm/trunk/lib/AsmParser/llvmAsmParser.y
          llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
          llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
          llvm/trunk/lib/VMCore/AsmWriter.cpp
          llvm/trunk/lib/VMCore/Constants.cpp
          llvm/trunk/lib/VMCore/Globals.cpp
          llvm/trunk/lib/VMCore/Instructions.cpp
          llvm/trunk/lib/VMCore/Type.cpp
          llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
      
      Modified: llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h?rev=44858&r1=44857&r2=44858&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h (original)
      +++ llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h Tue Dec 11 02:59:05 2007
      @@ -46,7 +46,7 @@
           MODULE_CODE_SECTIONNAME = 5,    // SECTIONNAME: [strchr x N]
           MODULE_CODE_DEPLIB      = 6,    // DEPLIB:      [strchr x N]
       
      -    // GLOBALVAR: [type, isconst, initid, 
      +    // GLOBALVAR: [pointer type, isconst, initid, 
           //             linkage, alignment, section, visibility, threadlocal]
           MODULE_CODE_GLOBALVAR   = 7,
       
      @@ -194,9 +194,13 @@
           FUNC_CODE_INST_FREE        = 18, // FREE:       [opty, op]
           FUNC_CODE_INST_ALLOCA      = 19, // ALLOCA:     [instty, op, align]
           FUNC_CODE_INST_LOAD        = 20, // LOAD:       [opty, op, align, vol]
      -    FUNC_CODE_INST_STORE       = 21, // STORE:      [ptrty,val,ptr, align, vol]
      +    FUNC_CODE_INST_STORE       = 21, // STORE:      [valty,val,ptr, align, vol]
           FUNC_CODE_INST_CALL        = 22, // CALL:       [attr, fnty, fnid, args...]
      -    FUNC_CODE_INST_VAARG       = 23  // VAARG:      [valistty, valist, instty]
      +    FUNC_CODE_INST_VAARG       = 23, // VAARG:      [valistty, valist, instty]
      +    // This store code encodes the pointer type, rather than the value type
      +    // this is so information only available in the pointer type (e.g. address
      +    // spaces) is retained.
      +    FUNC_CODE_INST_STORE2      = 24 // STORE:      [ptrty,ptr,val, align, vol]
         };
       } // End bitc namespace
       } // End llvm namespace
      
      Modified: llvm/trunk/include/llvm/DerivedTypes.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DerivedTypes.h?rev=44858&r1=44857&r2=44858&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/DerivedTypes.h (original)
      +++ llvm/trunk/include/llvm/DerivedTypes.h Tue Dec 11 02:59:05 2007
      @@ -363,12 +363,17 @@
       ///
       class PointerType : public SequentialType {
         friend class TypeMap;
      +  unsigned AddressSpace;
      +  
         PointerType(const PointerType &);                   // Do not implement
         const PointerType &operator=(const PointerType &);  // Do not implement
      -  explicit PointerType(const Type *ElType);
      +  explicit PointerType(const Type *ElType, unsigned AddrSpace);
       public:
         /// PointerType::get - This is the only way to construct a new pointer type.
      -  static PointerType *get(const Type *ElementType);
      +  static PointerType *get(const Type *ElementType, unsigned AddressSpace = 0);
      +  
      +  /// @brief Return the address space of the Pointer type.
      +  inline unsigned getAddressSpace() const { return AddressSpace; }
       
         // Implement the AbstractTypeUser interface.
         virtual void refineAbstractType(const DerivedType *OldTy, const Type *NewTy);
      
      Modified: llvm/trunk/include/llvm/GlobalVariable.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/GlobalVariable.h?rev=44858&r1=44857&r2=44858&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/GlobalVariable.h (original)
      +++ llvm/trunk/include/llvm/GlobalVariable.h Tue Dec 11 02:59:05 2007
      @@ -50,12 +50,14 @@
         /// automatically inserted into the end of the specified modules global list.
         GlobalVariable(const Type *Ty, bool isConstant, LinkageTypes Linkage,
                        Constant *Initializer = 0, const std::string &Name = "",
      -                 Module *Parent = 0, bool ThreadLocal = false);
      +                 Module *Parent = 0, bool ThreadLocal = false, 
      +                 unsigned AddressSpace = 0);
         /// GlobalVariable ctor - This creates a global and inserts it before the
         /// specified other global.
         GlobalVariable(const Type *Ty, bool isConstant, LinkageTypes Linkage,
                        Constant *Initializer, const std::string &Name,
      -                 GlobalVariable *InsertBefore, bool ThreadLocal = false);
      +                 GlobalVariable *InsertBefore, bool ThreadLocal = false, 
      +                 unsigned AddressSpace = 0);
         
         /// isDeclaration - Is this global variable lacking an initializer?  If so, 
         /// the global variable is defined in some other translation unit, and is thus
      
      Modified: llvm/trunk/include/llvm/Instructions.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Instructions.h?rev=44858&r1=44857&r2=44858&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/Instructions.h (original)
      +++ llvm/trunk/include/llvm/Instructions.h Tue Dec 11 02:59:05 2007
      @@ -455,7 +455,8 @@
                           Instruction *InsertBefore =0)
             : Instruction(PointerType::get(
                             checkType(getIndexedType(Ptr->getType(),
      -                                               IdxBegin, IdxEnd, true))),
      +                                               IdxBegin, IdxEnd, true)),
      +                      cast(Ptr->getType())->getAddressSpace()),
                           GetElementPtr, 0, 0, InsertBefore) {
           init(Ptr, IdxBegin, IdxEnd, Name,
                typename std::iterator_traits::iterator_category());
      @@ -465,7 +466,8 @@
                           const std::string &Name, BasicBlock *InsertAtEnd)
             : Instruction(PointerType::get(
                             checkType(getIndexedType(Ptr->getType(),
      -                                               IdxBegin, IdxEnd, true))),
      +                                               IdxBegin, IdxEnd, true)),
      +                      cast(Ptr->getType())->getAddressSpace()),
                           GetElementPtr, 0, 0, InsertAtEnd) {
           init(Ptr, IdxBegin, IdxEnd, Name,
                typename std::iterator_traits::iterator_category());
      
      Modified: llvm/trunk/lib/AsmParser/LLLexer.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLLexer.cpp?rev=44858&r1=44857&r2=44858&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/AsmParser/LLLexer.cpp (original)
      +++ llvm/trunk/lib/AsmParser/LLLexer.cpp Tue Dec 11 02:59:05 2007
      @@ -463,6 +463,7 @@
         KEYWORD("datalayout", DATALAYOUT);
         KEYWORD("volatile", VOLATILE);
         KEYWORD("align", ALIGN);
      +  KEYWORD("addrspace", ADDRSPACE);
         KEYWORD("section", SECTION);
         KEYWORD("alias", ALIAS);
         KEYWORD("module", MODULE);
      
      Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y?rev=44858&r1=44857&r2=44858&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/AsmParser/llvmAsmParser.y (original)
      +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y Tue Dec 11 02:59:05 2007
      @@ -491,7 +491,8 @@
          if (const FunctionType *FTy = dyn_cast(ElTy))
            V = new Function(FTy, GlobalValue::ExternalLinkage);
          else
      -     V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage);
      +     V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
      +                            (Module*)0, false, PTy->getAddressSpace());
          break;
         }
         default:
      @@ -722,13 +723,14 @@
                           GlobalValue::LinkageTypes Linkage,
                           GlobalValue::VisibilityTypes Visibility,
                           bool isConstantGlobal, const Type *Ty,
      -                    Constant *Initializer, bool IsThreadLocal) {
      +                    Constant *Initializer, bool IsThreadLocal,
      +                    unsigned AddressSpace = 0) {
         if (isa(Ty)) {
           GenerateError("Cannot declare global vars of function type");
           return 0;
         }
       
      -  const PointerType *PTy = PointerType::get(Ty);
      +  const PointerType *PTy = PointerType::get(Ty, AddressSpace);
       
         std::string Name;
         if (NameStr) {
      @@ -780,7 +782,7 @@
         // Otherwise there is no existing GV to use, create one now.
         GlobalVariable *GV =
           new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
      -                       CurModule.CurrentModule, IsThreadLocal);
      +                       CurModule.CurrentModule, IsThreadLocal, AddressSpace);
         GV->setVisibility(Visibility);
         InsertValue(GV, CurModule.Values);
         return GV;
      @@ -1054,7 +1056,7 @@
       %token DECLARE DEFINE GLOBAL CONSTANT SECTION ALIAS VOLATILE THREAD_LOCAL
       %token TO DOTDOTDOT NULL_TOK UNDEF INTERNAL LINKONCE WEAK APPENDING
       %token DLLIMPORT DLLEXPORT EXTERN_WEAK
      -%token OPAQUE EXTERNAL TARGET TRIPLE ALIGN
      +%token OPAQUE EXTERNAL TARGET TRIPLE ALIGN ADDRSPACE
       %token DEPLIBS CALL TAIL ASM_TOK MODULE SIDEEFFECT
       %token CC_TOK CCC_TOK FASTCC_TOK COLDCC_TOK X86_STDCALLCC_TOK X86_FASTCALLCC_TOK
       %token DATALAYOUT
      @@ -1268,6 +1270,7 @@
       };
       
       
      +
       SectionString : SECTION STRINGCONSTANT {
         for (unsigned i = 0, e = $2->length(); i != e; ++i)
           if ((*$2)[i] == '"' || (*$2)[i] == '\\')
      @@ -1320,6 +1323,13 @@
           delete $1;
           CHECK_FOR_ERROR
         }
      +  | Types ADDRSPACE '(' EUINT64VAL ')' '*' {             // Pointer type?
      +    if (*$1 == Type::LabelTy)
      +      GEN_ERROR("Cannot form a pointer to a basic block");
      +    $$ = new PATypeHolder(HandleUpRefs(PointerType::get(*$1, $4)));
      +    delete $1;
      +    CHECK_FOR_ERROR
      +  }
         | SymbolicValueRef {            // Named types are also simple types...
           const Type* tmp = getTypeVal($1);
           CHECK_FOR_ERROR
      @@ -2073,6 +2083,17 @@
         } GlobalVarAttributes {
           CurGV = 0;
         }
      +  | OptGlobalAssign GVVisibilityStyle ThreadLocal GlobalType ConstVal
      +    ADDRSPACE '(' EUINT64VAL ')' { 
      +    /* "Externally Visible" Linkage with address space qualifier */
      +    if ($5 == 0) 
      +      GEN_ERROR("Global value initializer is not a constant");
      +    CurGV = ParseGlobalVariable($1, GlobalValue::ExternalLinkage,
      +                                $2, $4, $5->getType(), $5, $3, $8);
      +    CHECK_FOR_ERROR
      +  } GlobalVarAttributes {
      +    CurGV = 0;
      +  }
         | OptGlobalAssign GVInternalLinkage GVVisibilityStyle ThreadLocal GlobalType
           ConstVal {
           if ($6 == 0) 
      
      Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=44858&r1=44857&r2=44858&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
      +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Tue Dec 11 02:59:05 2007
      @@ -323,11 +323,16 @@
             
             ResultTy = IntegerType::get(Record[0]);
             break;
      -    case bitc::TYPE_CODE_POINTER:   // POINTER: [pointee type]
      +    case bitc::TYPE_CODE_POINTER: { // POINTER: [pointee type] or 
      +                                    //          [pointee type, address space]
             if (Record.size() < 1)
               return Error("Invalid POINTER type record");
      -      ResultTy = PointerType::get(getTypeByID(Record[0], true));
      +      unsigned AddressSpace = 0;
      +      if (Record.size() == 2)
      +        AddressSpace = Record[1];
      +      ResultTy = PointerType::get(getTypeByID(Record[0], true), AddressSpace);
             break;
      +    }
           case bitc::TYPE_CODE_FUNCTION: {
             // FIXME: attrid is dead, remove it in LLVM 3.0
             // FUNCTION: [vararg, attrid, retty, paramty x N]
      @@ -982,7 +987,7 @@
             CollectorTable.push_back(S);
             break;
           }
      -    // GLOBALVAR: [type, isconst, initid, 
      +    // GLOBALVAR: [pointer type, isconst, initid,
           //             linkage, alignment, section, visibility, threadlocal]
           case bitc::MODULE_CODE_GLOBALVAR: {
             if (Record.size() < 6)
      @@ -990,6 +995,7 @@
             const Type *Ty = getTypeByID(Record[0]);
             if (!isa(Ty))
               return Error("Global not a pointer type!");
      +      unsigned AddressSpace = cast(Ty)->getAddressSpace();
             Ty = cast(Ty)->getElementType();
             
             bool isConstant = Record[1];
      @@ -1009,7 +1015,8 @@
               isThreadLocal = Record[7];
       
             GlobalVariable *NewGV =
      -        new GlobalVariable(Ty, isConstant, Linkage, 0, "", TheModule);
      +        new GlobalVariable(Ty, isConstant, Linkage, 0, "", TheModule, 
      +                           isThreadLocal, AddressSpace);
             NewGV->setAlignment(Alignment);
             if (!Section.empty())
               NewGV->setSection(Section);
      @@ -1485,7 +1492,20 @@
             I = new LoadInst(Op, "", Record[OpNum+1], (1 << Record[OpNum]) >> 1);
             break;
           }
      +    case bitc::FUNC_CODE_INST_STORE2: { // STORE2:[ptrty, ptr, val, align, vol]
      +      unsigned OpNum = 0;
      +      Value *Val, *Ptr;
      +      if (getValueTypePair(Record, OpNum, NextValueNo, Ptr) ||
      +          getValue(Record, OpNum, 
      +                    cast(Ptr->getType())->getElementType(), Val) ||
      +          OpNum+2 != Record.size())
      +        return Error("Invalid STORE record");
      +      
      +      I = new StoreInst(Val, Ptr, Record[OpNum+1], (1 << Record[OpNum]) >> 1);
      +      break;
      +    }
           case bitc::FUNC_CODE_INST_STORE: { // STORE:[val, valty, ptr, align, vol]
      +      // FIXME: Legacy form of store instruction. Should be removed in LLVM 3.0.
             unsigned OpNum = 0;
             Value *Val, *Ptr;
             if (getValueTypePair(Record, OpNum, NextValueNo, Val) ||
      
      Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=44858&r1=44857&r2=44858&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
      +++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Tue Dec 11 02:59:05 2007
      @@ -197,10 +197,14 @@
             TypeVals.push_back(cast(T)->getBitWidth());
             break;
           case Type::PointerTyID:
      -      // POINTER: [pointee type]
      +      const PointerType *PTy = cast(T);
      +      // POINTER: [pointee type] or [pointee type, address space]
             Code = bitc::TYPE_CODE_POINTER;
      -      TypeVals.push_back(VE.getTypeID(cast(T)->getElementType()));
      -      AbbrevToUse = PtrAbbrev;
      +      TypeVals.push_back(VE.getTypeID(PTy->getElementType()));
      +      if (unsigned AddressSpace = PTy->getAddressSpace())
      +        TypeVals.push_back(AddressSpace);
      +      else
      +        AbbrevToUse = PtrAbbrev;
             break;
       
           case Type::FunctionTyID: {
      @@ -829,9 +833,9 @@
           Vals.push_back(cast(I).isVolatile());
           break;
         case Instruction::Store:
      -    Code = bitc::FUNC_CODE_INST_STORE;
      -    PushValueAndType(I.getOperand(0), InstID, Vals, VE);  // val.
      -    Vals.push_back(VE.getValueID(I.getOperand(1)));       // ptr.
      +    Code = bitc::FUNC_CODE_INST_STORE2;
      +    PushValueAndType(I.getOperand(1), InstID, Vals, VE);  // ptrty + ptr
      +    Vals.push_back(VE.getValueID(I.getOperand(0)));       // val.
           Vals.push_back(Log2_32(cast(I).getAlignment())+1);
           Vals.push_back(cast(I).isVolatile());
           break;
      
      Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AsmWriter.cpp?rev=44858&r1=44857&r2=44858&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
      +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Tue Dec 11 02:59:05 2007
      @@ -334,11 +334,15 @@
             Result += '>';
           break;
         }
      -  case Type::PointerTyID:
      -    calcTypeName(cast(Ty)->getElementType(),
      +  case Type::PointerTyID: {
      +    const PointerType *PTy = cast(Ty);
      +    calcTypeName(PTy->getElementType(),
                                 TypeStack, TypeNames, Result);
      +    if (unsigned AddressSpace = PTy->getAddressSpace())
      +      Result += " addrspace(" + utostr(AddressSpace) + ")";
           Result += "*";
           break;
      +  }
         case Type::ArrayTyID: {
           const ArrayType *ATy = cast(Ty);
           Result += "[" + utostr(ATy->getNumElements()) + " x ";
      @@ -951,6 +955,9 @@
           writeOperand(GV->getInitializer(), false);
         }
       
      +  if (unsigned AddressSpace = GV->getType()->getAddressSpace())
      +    Out << " addrspace(" << AddressSpace << ") ";
      +    
         if (GV->hasSection())
           Out << ", section \"" << GV->getSection() << '"';
         if (GV->getAlignment())
      
      Modified: llvm/trunk/lib/VMCore/Constants.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=44858&r1=44857&r2=44858&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/VMCore/Constants.cpp (original)
      +++ llvm/trunk/lib/VMCore/Constants.cpp Tue Dec 11 02:59:05 2007
      @@ -1860,7 +1860,8 @@
         const Type *Ty = 
           GetElementPtrInst::getIndexedType(C->getType(), Idxs, Idxs+NumIdx, true);
         assert(Ty && "GEP indices invalid!");
      -  return getGetElementPtrTy(PointerType::get(Ty), C, Idxs, NumIdx);
      +  unsigned As = cast(C->getType())->getAddressSpace();
      +  return getGetElementPtrTy(PointerType::get(Ty, As), C, Idxs, NumIdx);
       }
       
       Constant *ConstantExpr::getGetElementPtr(Constant *C, Constant* const *Idxs,
      
      Modified: llvm/trunk/lib/VMCore/Globals.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Globals.cpp?rev=44858&r1=44857&r2=44858&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/VMCore/Globals.cpp (original)
      +++ llvm/trunk/lib/VMCore/Globals.cpp Tue Dec 11 02:59:05 2007
      @@ -85,8 +85,9 @@
       
       GlobalVariable::GlobalVariable(const Type *Ty, bool constant, LinkageTypes Link,
                                      Constant *InitVal, const std::string &Name,
      -                               Module *ParentModule, bool ThreadLocal)
      -  : GlobalValue(PointerType::get(Ty), Value::GlobalVariableVal,
      +                               Module *ParentModule, bool ThreadLocal, 
      +                               unsigned AddressSpace)
      +  : GlobalValue(PointerType::get(Ty, AddressSpace), Value::GlobalVariableVal,
                       &Initializer, InitVal != 0, Link, Name),
           isConstantGlobal(constant), isThreadLocalSymbol(ThreadLocal) {
         if (InitVal) {
      @@ -105,8 +106,9 @@
       
       GlobalVariable::GlobalVariable(const Type *Ty, bool constant, LinkageTypes Link,
                                      Constant *InitVal, const std::string &Name,
      -                               GlobalVariable *Before, bool ThreadLocal)
      -  : GlobalValue(PointerType::get(Ty), Value::GlobalVariableVal,
      +                               GlobalVariable *Before, bool ThreadLocal,
      +                               unsigned AddressSpace)
      +  : GlobalValue(PointerType::get(Ty, AddressSpace), Value::GlobalVariableVal,
                       &Initializer, InitVal != 0, Link, Name), 
           isConstantGlobal(constant), isThreadLocalSymbol(ThreadLocal) {
         if (InitVal) {
      
      Modified: llvm/trunk/lib/VMCore/Instructions.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=44858&r1=44857&r2=44858&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/VMCore/Instructions.cpp (original)
      +++ llvm/trunk/lib/VMCore/Instructions.cpp Tue Dec 11 02:59:05 2007
      @@ -937,7 +937,8 @@
       
       GetElementPtrInst::GetElementPtrInst(Value *Ptr, Value *Idx,
                                            const std::string &Name, Instruction *InBe)
      -  : Instruction(PointerType::get(checkType(getIndexedType(Ptr->getType(),Idx))),
      +  : Instruction(PointerType::get(checkType(getIndexedType(Ptr->getType(),Idx)),
      +                      cast(Ptr->getType())->getAddressSpace()),
                       GetElementPtr, 0, 0, InBe) {
         init(Ptr, Idx);
         setName(Name);
      @@ -945,7 +946,8 @@
       
       GetElementPtrInst::GetElementPtrInst(Value *Ptr, Value *Idx,
                                            const std::string &Name, BasicBlock *IAE)
      -  : Instruction(PointerType::get(checkType(getIndexedType(Ptr->getType(),Idx))),
      +  : Instruction(PointerType::get(checkType(getIndexedType(Ptr->getType(),Idx)),
      +                      cast(Ptr->getType())->getAddressSpace()),
                       GetElementPtr, 0, 0, IAE) {
         init(Ptr, Idx);
         setName(Name);
      
      Modified: llvm/trunk/lib/VMCore/Type.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Type.cpp?rev=44858&r1=44857&r2=44858&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/VMCore/Type.cpp (original)
      +++ llvm/trunk/lib/VMCore/Type.cpp Tue Dec 11 02:59:05 2007
      @@ -338,7 +338,10 @@
         }
         case Type::PointerTyID: {
           const PointerType *PTy = cast(Ty);
      -    Result = getTypeDescription(PTy->getElementType(), TypeStack) + " *";
      +    Result = getTypeDescription(PTy->getElementType(), TypeStack);
      +    if (unsigned AddressSpace = PTy->getAddressSpace())
      +      Result += " addrspace(" + utostr(AddressSpace) + ")";
      +    Result += " *";
           break;
         }
         case Type::ArrayTyID: {
      @@ -492,7 +495,9 @@
       }
       
       
      -PointerType::PointerType(const Type *E) : SequentialType(PointerTyID, E) {
      +PointerType::PointerType(const Type *E, unsigned AddrSpace)
      +  : SequentialType(PointerTyID, E) {
      +  AddressSpace = AddrSpace;
         // Calculate whether or not this type is abstract
         setAbstract(E->isAbstract());
       }
      @@ -634,8 +639,9 @@
           const IntegerType *ITy2 = cast(Ty2);
           return ITy->getBitWidth() == ITy2->getBitWidth();
         } else if (const PointerType *PTy = dyn_cast(Ty)) {
      -    return TypesEqual(PTy->getElementType(),
      -                      cast(Ty2)->getElementType(), EqTypes);
      +    const PointerType *PTy2 = cast(Ty2);
      +    return PTy->getAddressSpace() == PTy2->getAddressSpace() &&
      +           TypesEqual(PTy->getElementType(), PTy2->getElementType(), EqTypes);
         } else if (const StructType *STy = dyn_cast(Ty)) {
           const StructType *STy2 = cast(Ty2);
           if (STy->getNumElements() != STy2->getNumElements()) return false;
      @@ -756,6 +762,9 @@
           case Type::StructTyID:
             HashVal ^= cast(SubTy)->getNumElements();
             break;
      +    case Type::PointerTyID:
      +      HashVal ^= cast(SubTy)->getAddressSpace();
      +      break;
           }
         }
         return HashVal ? HashVal : 1;  // Do not return zero unless opaque subty.
      @@ -1251,11 +1260,12 @@
       namespace llvm {
       class PointerValType {
         const Type *ValTy;
      +  unsigned AddressSpace;
       public:
      -  PointerValType(const Type *val) : ValTy(val) {}
      +  PointerValType(const Type *val, unsigned as) : ValTy(val), AddressSpace(as) {}
       
         static PointerValType get(const PointerType *PT) {
      -    return PointerValType(PT->getElementType());
      +    return PointerValType(PT->getElementType(), PT->getAddressSpace());
         }
       
         static unsigned hashTypeStructure(const PointerType *PT) {
      @@ -1263,25 +1273,26 @@
         }
       
         bool operator<(const PointerValType &MTV) const {
      -    return ValTy < MTV.ValTy;
      +    if (AddressSpace < MTV.AddressSpace) return true;
      +    return AddressSpace == MTV.AddressSpace && ValTy < MTV.ValTy;
         }
       };
       }
       
       static ManagedStatic > PointerTypes;
       
      -PointerType *PointerType::get(const Type *ValueType) {
      +PointerType *PointerType::get(const Type *ValueType, unsigned AddressSpace) {
         assert(ValueType && "Can't get a pointer to  type!");
         assert(ValueType != Type::VoidTy &&
                "Pointer to void is not valid, use sbyte* instead!");
         assert(ValueType != Type::LabelTy && "Pointer to label is not valid!");
      -  PointerValType PVT(ValueType);
      +  PointerValType PVT(ValueType, AddressSpace);
       
         PointerType *PT = PointerTypes->get(PVT);
         if (PT) return PT;
       
         // Value not found.  Derive a new type!
      -  PointerTypes->add(PVT, PT = new PointerType(ValueType));
      +  PointerTypes->add(PVT, PT = new PointerType(ValueType, AddressSpace));
       
       #ifdef DEBUG_MERGE_TYPES
         DOUT << "Derived new type: " << *PT << "\n";
      
      Added: llvm/trunk/test/Assembler/2007-12-11-AddressSpaces.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/2007-12-11-AddressSpaces.ll?rev=44858&view=auto
      
      ==============================================================================
      --- llvm/trunk/test/Assembler/2007-12-11-AddressSpaces.ll (added)
      +++ llvm/trunk/test/Assembler/2007-12-11-AddressSpaces.ll Tue Dec 11 02:59:05 2007
      @@ -0,0 +1,25 @@
      +; RUN: llvm-as < %s | llvm-dis |& grep {addrspace(33)} | count 7
      +; RUN: llvm-as < %s | llvm-dis |& grep {addrspace(42)} | count 2
      +; RUN: llvm-as < %s | llvm-dis |& grep {addrspace(66)} | count 2
      +; RUN: llvm-as < %s | llvm-dis |& grep {addrspace(11)} | count 6
      +; RUN: llvm-as < %s | llvm-dis |& grep {addrspace(22)} | count 5
      +
      +	%struct.mystruct = type { i32, i32 addrspace(33)*, i32, i32 addrspace(33)* }
      + at input = global %struct.mystruct zeroinitializer addrspace(42) 		; <%struct.mystruct addrspace(42)*> [#uses=1]
      + at output = global %struct.mystruct zeroinitializer addrspace(66) 		; <%struct.mystruct addrspace(66)*> [#uses=1]
      + at y = global i32 addrspace(11)* addrspace(22)* null addrspace(33) 		;  [#uses=1]
      +
      +define void @foo() {
      +entry:
      +	%tmp1 = load i32 addrspace(33)* addrspace(42)* getelementptr (%struct.mystruct addrspace(42)* @input, i32 0, i32 3), align 4		;  [#uses=1]
      +	store i32 addrspace(33)* %tmp1, i32 addrspace(33)* addrspace(66)* getelementptr (%struct.mystruct addrspace(66)* @output, i32 0, i32 1), align 4
      +	ret void
      +}
      +
      +define i32 addrspace(11)* @bar(i32 addrspace(11)* addrspace(22)* addrspace(33)* %x) {
      +entry:
      +	%tmp1 = load i32 addrspace(11)* addrspace(22)* addrspace(33)* @y, align 4		;  [#uses=2]
      +	store i32 addrspace(11)* addrspace(22)* %tmp1, i32 addrspace(11)* addrspace(22)* addrspace(33)* %x, align 4
      +	%tmp5 = load i32 addrspace(11)* addrspace(22)* %tmp1, align 4		;  [#uses=1]
      +	ret i32 addrspace(11)* %tmp5
      +}
      
      Modified: llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp?rev=44858&r1=44857&r2=44858&view=diff
      
      ==============================================================================
      --- llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp (original)
      +++ llvm/trunk/tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp Tue Dec 11 02:59:05 2007
      @@ -197,6 +197,7 @@
           case bitc::FUNC_CODE_INST_STORE:       return "INST_STORE";
           case bitc::FUNC_CODE_INST_CALL:        return "INST_CALL";
           case bitc::FUNC_CODE_INST_VAARG:       return "INST_VAARG";
      +    case bitc::FUNC_CODE_INST_STORE2:      return "INST_STORE2";
           }
         case bitc::TYPE_SYMTAB_BLOCK_ID:
           switch (CodeID) {
      
      
      
      
      From christopher.lamb at gmail.com  Tue Dec 11 03:02:09 2007
      From: christopher.lamb at gmail.com (Christopher Lamb)
      Date: Tue, 11 Dec 2007 09:02:09 -0000
      Subject: [llvm-commits] [llvm] r44859 - in /llvm/trunk/lib/AsmParser:
       llvmAsmParser.cpp.cvs llvmAsmParser.h.cvs llvmAsmParser.y.cvs
      Message-ID: <200712110902.lBB92ANJ026092@zion.cs.uiuc.edu>
      
      Author: clamb
      Date: Tue Dec 11 03:02:08 2007
      New Revision: 44859
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44859&view=rev
      Log:
      Regenerate.
      
      Modified:
          llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs
          llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs
          llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs
      
      Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs?rev=44859&r1=44858&r2=44859&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs (original)
      +++ llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs Tue Dec 11 03:02:08 2007
      @@ -1,380 +1,165 @@
      -/* A Bison parser, made by GNU Bison 2.3.  */
       
      -/* Skeleton implementation for Bison's Yacc-like parsers in C
      +/*  A Bison parser, made from /Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y
      +    by GNU Bison version 1.28  */
       
      -   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
      -   Free Software Foundation, Inc.
      +#define YYBISON 1  /* Identify Bison output.  */
       
      -   This program is free software; you can redistribute it and/or modify
      -   it under the terms of the GNU General Public License as published by
      -   the Free Software Foundation; either version 2, or (at your option)
      -   any later version.
      -
      -   This program is distributed in the hope that it will be useful,
      -   but WITHOUT ANY WARRANTY; without even the implied warranty of
      -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      -   GNU General Public License for more details.
      -
      -   You should have received a copy of the GNU General Public License
      -   along with this program; if not, write to the Free Software
      -   Foundation, Inc., 51 Franklin Street, Fifth Floor,
      -   Boston, MA 02110-1301, USA.  */
      -
      -/* As a special exception, you may create a larger work that contains
      -   part or all of the Bison parser skeleton and distribute that work
      -   under terms of your choice, so long as that work isn't itself a
      -   parser generator using the skeleton or a modified version thereof
      -   as a parser skeleton.  Alternatively, if you modify or redistribute
      -   the parser skeleton itself, you may (at your option) remove this
      -   special exception, which will cause the skeleton and the resulting
      -   Bison output files to be licensed under the GNU General Public
      -   License without this special exception.
      -
      -   This special exception was added by the Free Software Foundation in
      -   version 2.2 of Bison.  */
      -
      -/* C LALR(1) parser skeleton written by Richard Stallman, by
      -   simplifying the original so-called "semantic" parser.  */
      -
      -/* All symbols defined below should begin with yy or YY, to avoid
      -   infringing on user name space.  This should be done even for local
      -   variables, as they might otherwise be expanded by user macros.
      -   There are some unavoidable exceptions within include files to
      -   define necessary library symbols; they are noted "INFRINGES ON
      -   USER NAME SPACE" below.  */
      -
      -/* Identify Bison output.  */
      -#define YYBISON 1
      -
      -/* Bison version.  */
      -#define YYBISON_VERSION "2.3"
      -
      -/* Skeleton name.  */
      -#define YYSKELETON_NAME "yacc.c"
      -
      -/* Pure parsers.  */
      -#define YYPURE 0
      -
      -/* Using locations.  */
      -#define YYLSP_NEEDED 0
      -
      -/* Substitute the variable and function names.  */
       #define yyparse llvmAsmparse
      -#define yylex   llvmAsmlex
      +#define yylex llvmAsmlex
       #define yyerror llvmAsmerror
      -#define yylval  llvmAsmlval
      -#define yychar  llvmAsmchar
      +#define yylval llvmAsmlval
      +#define yychar llvmAsmchar
       #define yydebug llvmAsmdebug
       #define yynerrs llvmAsmnerrs
      +#define	ESINT64VAL	257
      +#define	EUINT64VAL	258
      +#define	ESAPINTVAL	259
      +#define	EUAPINTVAL	260
      +#define	LOCALVAL_ID	261
      +#define	GLOBALVAL_ID	262
      +#define	FPVAL	263
      +#define	VOID	264
      +#define	INTTYPE	265
      +#define	FLOAT	266
      +#define	DOUBLE	267
      +#define	X86_FP80	268
      +#define	FP128	269
      +#define	PPC_FP128	270
      +#define	LABEL	271
      +#define	TYPE	272
      +#define	LOCALVAR	273
      +#define	GLOBALVAR	274
      +#define	LABELSTR	275
      +#define	STRINGCONSTANT	276
      +#define	ATSTRINGCONSTANT	277
      +#define	PCTSTRINGCONSTANT	278
      +#define	ZEROINITIALIZER	279
      +#define	TRUETOK	280
      +#define	FALSETOK	281
      +#define	BEGINTOK	282
      +#define	ENDTOK	283
      +#define	DECLARE	284
      +#define	DEFINE	285
      +#define	GLOBAL	286
      +#define	CONSTANT	287
      +#define	SECTION	288
      +#define	ALIAS	289
      +#define	VOLATILE	290
      +#define	THREAD_LOCAL	291
      +#define	TO	292
      +#define	DOTDOTDOT	293
      +#define	NULL_TOK	294
      +#define	UNDEF	295
      +#define	INTERNAL	296
      +#define	LINKONCE	297
      +#define	WEAK	298
      +#define	APPENDING	299
      +#define	DLLIMPORT	300
      +#define	DLLEXPORT	301
      +#define	EXTERN_WEAK	302
      +#define	OPAQUE	303
      +#define	EXTERNAL	304
      +#define	TARGET	305
      +#define	TRIPLE	306
      +#define	ALIGN	307
      +#define	ADDRSPACE	308
      +#define	DEPLIBS	309
      +#define	CALL	310
      +#define	TAIL	311
      +#define	ASM_TOK	312
      +#define	MODULE	313
      +#define	SIDEEFFECT	314
      +#define	CC_TOK	315
      +#define	CCC_TOK	316
      +#define	FASTCC_TOK	317
      +#define	COLDCC_TOK	318
      +#define	X86_STDCALLCC_TOK	319
      +#define	X86_FASTCALLCC_TOK	320
      +#define	DATALAYOUT	321
      +#define	RET	322
      +#define	BR	323
      +#define	SWITCH	324
      +#define	INVOKE	325
      +#define	UNWIND	326
      +#define	UNREACHABLE	327
      +#define	ADD	328
      +#define	SUB	329
      +#define	MUL	330
      +#define	UDIV	331
      +#define	SDIV	332
      +#define	FDIV	333
      +#define	UREM	334
      +#define	SREM	335
      +#define	FREM	336
      +#define	AND	337
      +#define	OR	338
      +#define	XOR	339
      +#define	SHL	340
      +#define	LSHR	341
      +#define	ASHR	342
      +#define	ICMP	343
      +#define	FCMP	344
      +#define	EQ	345
      +#define	NE	346
      +#define	SLT	347
      +#define	SGT	348
      +#define	SLE	349
      +#define	SGE	350
      +#define	ULT	351
      +#define	UGT	352
      +#define	ULE	353
      +#define	UGE	354
      +#define	OEQ	355
      +#define	ONE	356
      +#define	OLT	357
      +#define	OGT	358
      +#define	OLE	359
      +#define	OGE	360
      +#define	ORD	361
      +#define	UNO	362
      +#define	UEQ	363
      +#define	UNE	364
      +#define	MALLOC	365
      +#define	ALLOCA	366
      +#define	FREE	367
      +#define	LOAD	368
      +#define	STORE	369
      +#define	GETELEMENTPTR	370
      +#define	TRUNC	371
      +#define	ZEXT	372
      +#define	SEXT	373
      +#define	FPTRUNC	374
      +#define	FPEXT	375
      +#define	BITCAST	376
      +#define	UITOFP	377
      +#define	SITOFP	378
      +#define	FPTOUI	379
      +#define	FPTOSI	380
      +#define	INTTOPTR	381
      +#define	PTRTOINT	382
      +#define	PHI_TOK	383
      +#define	SELECT	384
      +#define	VAARG	385
      +#define	EXTRACTELEMENT	386
      +#define	INSERTELEMENT	387
      +#define	SHUFFLEVECTOR	388
      +#define	SIGNEXT	389
      +#define	ZEROEXT	390
      +#define	NORETURN	391
      +#define	INREG	392
      +#define	SRET	393
      +#define	NOUNWIND	394
      +#define	NOALIAS	395
      +#define	BYVAL	396
      +#define	NEST	397
      +#define	READNONE	398
      +#define	READONLY	399
      +#define	GC	400
      +#define	DEFAULT	401
      +#define	HIDDEN	402
      +#define	PROTECTED	403
       
      -
      -/* Tokens.  */
      -#ifndef YYTOKENTYPE
      -# define YYTOKENTYPE
      -   /* Put the tokens into the symbol table, so that GDB and other debuggers
      -      know about them.  */
      -   enum yytokentype {
      -     ESINT64VAL = 258,
      -     EUINT64VAL = 259,
      -     ESAPINTVAL = 260,
      -     EUAPINTVAL = 261,
      -     LOCALVAL_ID = 262,
      -     GLOBALVAL_ID = 263,
      -     FPVAL = 264,
      -     VOID = 265,
      -     INTTYPE = 266,
      -     FLOAT = 267,
      -     DOUBLE = 268,
      -     X86_FP80 = 269,
      -     FP128 = 270,
      -     PPC_FP128 = 271,
      -     LABEL = 272,
      -     TYPE = 273,
      -     LOCALVAR = 274,
      -     GLOBALVAR = 275,
      -     LABELSTR = 276,
      -     STRINGCONSTANT = 277,
      -     ATSTRINGCONSTANT = 278,
      -     PCTSTRINGCONSTANT = 279,
      -     ZEROINITIALIZER = 280,
      -     TRUETOK = 281,
      -     FALSETOK = 282,
      -     BEGINTOK = 283,
      -     ENDTOK = 284,
      -     DECLARE = 285,
      -     DEFINE = 286,
      -     GLOBAL = 287,
      -     CONSTANT = 288,
      -     SECTION = 289,
      -     ALIAS = 290,
      -     VOLATILE = 291,
      -     THREAD_LOCAL = 292,
      -     TO = 293,
      -     DOTDOTDOT = 294,
      -     NULL_TOK = 295,
      -     UNDEF = 296,
      -     INTERNAL = 297,
      -     LINKONCE = 298,
      -     WEAK = 299,
      -     APPENDING = 300,
      -     DLLIMPORT = 301,
      -     DLLEXPORT = 302,
      -     EXTERN_WEAK = 303,
      -     OPAQUE = 304,
      -     EXTERNAL = 305,
      -     TARGET = 306,
      -     TRIPLE = 307,
      -     ALIGN = 308,
      -     DEPLIBS = 309,
      -     CALL = 310,
      -     TAIL = 311,
      -     ASM_TOK = 312,
      -     MODULE = 313,
      -     SIDEEFFECT = 314,
      -     CC_TOK = 315,
      -     CCC_TOK = 316,
      -     FASTCC_TOK = 317,
      -     COLDCC_TOK = 318,
      -     X86_STDCALLCC_TOK = 319,
      -     X86_FASTCALLCC_TOK = 320,
      -     DATALAYOUT = 321,
      -     RET = 322,
      -     BR = 323,
      -     SWITCH = 324,
      -     INVOKE = 325,
      -     UNWIND = 326,
      -     UNREACHABLE = 327,
      -     ADD = 328,
      -     SUB = 329,
      -     MUL = 330,
      -     UDIV = 331,
      -     SDIV = 332,
      -     FDIV = 333,
      -     UREM = 334,
      -     SREM = 335,
      -     FREM = 336,
      -     AND = 337,
      -     OR = 338,
      -     XOR = 339,
      -     SHL = 340,
      -     LSHR = 341,
      -     ASHR = 342,
      -     ICMP = 343,
      -     FCMP = 344,
      -     EQ = 345,
      -     NE = 346,
      -     SLT = 347,
      -     SGT = 348,
      -     SLE = 349,
      -     SGE = 350,
      -     ULT = 351,
      -     UGT = 352,
      -     ULE = 353,
      -     UGE = 354,
      -     OEQ = 355,
      -     ONE = 356,
      -     OLT = 357,
      -     OGT = 358,
      -     OLE = 359,
      -     OGE = 360,
      -     ORD = 361,
      -     UNO = 362,
      -     UEQ = 363,
      -     UNE = 364,
      -     MALLOC = 365,
      -     ALLOCA = 366,
      -     FREE = 367,
      -     LOAD = 368,
      -     STORE = 369,
      -     GETELEMENTPTR = 370,
      -     TRUNC = 371,
      -     ZEXT = 372,
      -     SEXT = 373,
      -     FPTRUNC = 374,
      -     FPEXT = 375,
      -     BITCAST = 376,
      -     UITOFP = 377,
      -     SITOFP = 378,
      -     FPTOUI = 379,
      -     FPTOSI = 380,
      -     INTTOPTR = 381,
      -     PTRTOINT = 382,
      -     PHI_TOK = 383,
      -     SELECT = 384,
      -     VAARG = 385,
      -     EXTRACTELEMENT = 386,
      -     INSERTELEMENT = 387,
      -     SHUFFLEVECTOR = 388,
      -     SIGNEXT = 389,
      -     ZEROEXT = 390,
      -     NORETURN = 391,
      -     INREG = 392,
      -     SRET = 393,
      -     NOUNWIND = 394,
      -     NOALIAS = 395,
      -     BYVAL = 396,
      -     NEST = 397,
      -     READNONE = 398,
      -     READONLY = 399,
      -     GC = 400,
      -     DEFAULT = 401,
      -     HIDDEN = 402,
      -     PROTECTED = 403
      -   };
      -#endif
      -/* Tokens.  */
      -#define ESINT64VAL 258
      -#define EUINT64VAL 259
      -#define ESAPINTVAL 260
      -#define EUAPINTVAL 261
      -#define LOCALVAL_ID 262
      -#define GLOBALVAL_ID 263
      -#define FPVAL 264
      -#define VOID 265
      -#define INTTYPE 266
      -#define FLOAT 267
      -#define DOUBLE 268
      -#define X86_FP80 269
      -#define FP128 270
      -#define PPC_FP128 271
      -#define LABEL 272
      -#define TYPE 273
      -#define LOCALVAR 274
      -#define GLOBALVAR 275
      -#define LABELSTR 276
      -#define STRINGCONSTANT 277
      -#define ATSTRINGCONSTANT 278
      -#define PCTSTRINGCONSTANT 279
      -#define ZEROINITIALIZER 280
      -#define TRUETOK 281
      -#define FALSETOK 282
      -#define BEGINTOK 283
      -#define ENDTOK 284
      -#define DECLARE 285
      -#define DEFINE 286
      -#define GLOBAL 287
      -#define CONSTANT 288
      -#define SECTION 289
      -#define ALIAS 290
      -#define VOLATILE 291
      -#define THREAD_LOCAL 292
      -#define TO 293
      -#define DOTDOTDOT 294
      -#define NULL_TOK 295
      -#define UNDEF 296
      -#define INTERNAL 297
      -#define LINKONCE 298
      -#define WEAK 299
      -#define APPENDING 300
      -#define DLLIMPORT 301
      -#define DLLEXPORT 302
      -#define EXTERN_WEAK 303
      -#define OPAQUE 304
      -#define EXTERNAL 305
      -#define TARGET 306
      -#define TRIPLE 307
      -#define ALIGN 308
      -#define DEPLIBS 309
      -#define CALL 310
      -#define TAIL 311
      -#define ASM_TOK 312
      -#define MODULE 313
      -#define SIDEEFFECT 314
      -#define CC_TOK 315
      -#define CCC_TOK 316
      -#define FASTCC_TOK 317
      -#define COLDCC_TOK 318
      -#define X86_STDCALLCC_TOK 319
      -#define X86_FASTCALLCC_TOK 320
      -#define DATALAYOUT 321
      -#define RET 322
      -#define BR 323
      -#define SWITCH 324
      -#define INVOKE 325
      -#define UNWIND 326
      -#define UNREACHABLE 327
      -#define ADD 328
      -#define SUB 329
      -#define MUL 330
      -#define UDIV 331
      -#define SDIV 332
      -#define FDIV 333
      -#define UREM 334
      -#define SREM 335
      -#define FREM 336
      -#define AND 337
      -#define OR 338
      -#define XOR 339
      -#define SHL 340
      -#define LSHR 341
      -#define ASHR 342
      -#define ICMP 343
      -#define FCMP 344
      -#define EQ 345
      -#define NE 346
      -#define SLT 347
      -#define SGT 348
      -#define SLE 349
      -#define SGE 350
      -#define ULT 351
      -#define UGT 352
      -#define ULE 353
      -#define UGE 354
      -#define OEQ 355
      -#define ONE 356
      -#define OLT 357
      -#define OGT 358
      -#define OLE 359
      -#define OGE 360
      -#define ORD 361
      -#define UNO 362
      -#define UEQ 363
      -#define UNE 364
      -#define MALLOC 365
      -#define ALLOCA 366
      -#define FREE 367
      -#define LOAD 368
      -#define STORE 369
      -#define GETELEMENTPTR 370
      -#define TRUNC 371
      -#define ZEXT 372
      -#define SEXT 373
      -#define FPTRUNC 374
      -#define FPEXT 375
      -#define BITCAST 376
      -#define UITOFP 377
      -#define SITOFP 378
      -#define FPTOUI 379
      -#define FPTOSI 380
      -#define INTTOPTR 381
      -#define PTRTOINT 382
      -#define PHI_TOK 383
      -#define SELECT 384
      -#define VAARG 385
      -#define EXTRACTELEMENT 386
      -#define INSERTELEMENT 387
      -#define SHUFFLEVECTOR 388
      -#define SIGNEXT 389
      -#define ZEROEXT 390
      -#define NORETURN 391
      -#define INREG 392
      -#define SRET 393
      -#define NOUNWIND 394
      -#define NOALIAS 395
      -#define BYVAL 396
      -#define NEST 397
      -#define READNONE 398
      -#define READONLY 399
      -#define GC 400
      -#define DEFAULT 401
      -#define HIDDEN 402
      -#define PROTECTED 403
      -
      -
      -
      -
      -/* Copy the first part of user declarations.  */
      -#line 14 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      +#line 14 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
       
       #include "ParserInternals.h"
       #include "llvm/CallingConv.h"
      @@ -855,7 +640,8 @@
          if (const FunctionType *FTy = dyn_cast(ElTy))
            V = new Function(FTy, GlobalValue::ExternalLinkage);
          else
      -     V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage);
      +     V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
      +                            (Module*)0, false, PTy->getAddressSpace());
          break;
         }
         default:
      @@ -1086,13 +872,14 @@
                           GlobalValue::LinkageTypes Linkage,
                           GlobalValue::VisibilityTypes Visibility,
                           bool isConstantGlobal, const Type *Ty,
      -                    Constant *Initializer, bool IsThreadLocal) {
      +                    Constant *Initializer, bool IsThreadLocal,
      +                    unsigned AddressSpace = 0) {
         if (isa(Ty)) {
           GenerateError("Cannot declare global vars of function type");
           return 0;
         }
       
      -  const PointerType *PTy = PointerType::get(Ty);
      +  const PointerType *PTy = PointerType::get(Ty, AddressSpace);
       
         std::string Name;
         if (NameStr) {
      @@ -1144,7 +931,7 @@
         // Otherwise there is no existing GV to use, create one now.
         GlobalVariable *GV =
           new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
      -                       CurModule.CurrentModule, IsThreadLocal);
      +                       CurModule.CurrentModule, IsThreadLocal, AddressSpace);
         GV->setVisibility(Visibility);
         InsertValue(GV, CurModule.Values);
         return GV;
      @@ -1305,29 +1092,8 @@
       }
       
       
      -
      -/* Enabling traces.  */
      -#ifndef YYDEBUG
      -# define YYDEBUG 0
      -#endif
      -
      -/* Enabling verbose error messages.  */
      -#ifdef YYERROR_VERBOSE
      -# undef YYERROR_VERBOSE
      -# define YYERROR_VERBOSE 1
      -#else
      -# define YYERROR_VERBOSE 0
      -#endif
      -
      -/* Enabling the token table.  */
      -#ifndef YYTOKEN_TABLE
      -# define YYTOKEN_TABLE 0
      -#endif
      -
      -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
      -typedef union YYSTYPE
      -#line 945 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -{
      +#line 947 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +typedef union {
         llvm::Module                           *ModuleVal;
         llvm::Function                         *FunctionVal;
         llvm::BasicBlock                       *BasicBlockVal;
      @@ -1372,1861 +1138,1194 @@
         llvm::Instruction::OtherOps       OtherOpVal;
         llvm::ICmpInst::Predicate         IPredicate;
         llvm::FCmpInst::Predicate         FPredicate;
      -}
      -/* Line 193 of yacc.c.  */
      -#line 1378 "llvmAsmParser.tab.c"
      -	YYSTYPE;
      -# define yystype YYSTYPE /* obsolescent; will be withdrawn */
      -# define YYSTYPE_IS_DECLARED 1
      -# define YYSTYPE_IS_TRIVIAL 1
      -#endif
      -
      +} YYSTYPE;
      +#include 
       
      +#ifndef __cplusplus
      +#ifndef __STDC__
      +#define const
      +#endif
      +#endif
       
      -/* Copy the second part of user declarations.  */
       
       
      -/* Line 216 of yacc.c.  */
      -#line 1391 "llvmAsmParser.tab.c"
      +#define	YYFINAL		622
      +#define	YYFLAG		-32768
      +#define	YYNTBASE	164
      +
      +#define YYTRANSLATE(x) ((unsigned)(x) <= 403 ? yytranslate[x] : 247)
      +
      +static const short yytranslate[] = {     0,
      +     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      +     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      +     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      +     2,     2,     2,     2,     2,     2,     2,     2,     2,   153,
      +   154,   152,     2,   151,     2,     2,     2,     2,     2,     2,
      +     2,     2,     2,     2,     2,     2,     2,     2,     2,   159,
      +   150,   160,     2,     2,     2,     2,     2,     2,     2,     2,
      +     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      +     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      +   156,   155,   158,     2,     2,     2,     2,     2,   163,     2,
      +     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      +     2,     2,     2,     2,     2,     2,     2,     2,     2,   157,
      +     2,     2,   161,     2,   162,     2,     2,     2,     2,     2,
      +     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      +     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      +     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      +     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      +     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      +     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      +     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      +     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      +     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      +     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      +     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      +     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      +     2,     2,     2,     2,     2,     1,     3,     4,     5,     6,
      +     7,     8,     9,    10,    11,    12,    13,    14,    15,    16,
      +    17,    18,    19,    20,    21,    22,    23,    24,    25,    26,
      +    27,    28,    29,    30,    31,    32,    33,    34,    35,    36,
      +    37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
      +    47,    48,    49,    50,    51,    52,    53,    54,    55,    56,
      +    57,    58,    59,    60,    61,    62,    63,    64,    65,    66,
      +    67,    68,    69,    70,    71,    72,    73,    74,    75,    76,
      +    77,    78,    79,    80,    81,    82,    83,    84,    85,    86,
      +    87,    88,    89,    90,    91,    92,    93,    94,    95,    96,
      +    97,    98,    99,   100,   101,   102,   103,   104,   105,   106,
      +   107,   108,   109,   110,   111,   112,   113,   114,   115,   116,
      +   117,   118,   119,   120,   121,   122,   123,   124,   125,   126,
      +   127,   128,   129,   130,   131,   132,   133,   134,   135,   136,
      +   137,   138,   139,   140,   141,   142,   143,   144,   145,   146,
      +   147,   148,   149
      +};
       
      -#ifdef short
      -# undef short
      -#endif
      +#if YYDEBUG != 0
      +static const short yyprhs[] = {     0,
      +     0,     2,     4,     6,     8,    10,    12,    14,    16,    18,
      +    20,    22,    24,    26,    28,    30,    32,    34,    36,    38,
      +    40,    42,    44,    46,    48,    50,    52,    54,    56,    58,
      +    60,    62,    64,    66,    68,    70,    72,    74,    76,    78,
      +    80,    82,    84,    86,    88,    90,    92,    94,    96,    98,
      +   100,   102,   104,   106,   108,   110,   112,   114,   116,   118,
      +   120,   122,   124,   126,   127,   130,   131,   133,   135,   137,
      +   138,   141,   143,   145,   147,   149,   151,   153,   155,   157,
      +   158,   160,   162,   164,   165,   167,   169,   170,   172,   174,
      +   176,   178,   179,   181,   183,   184,   186,   188,   190,   192,
      +   194,   197,   199,   201,   203,   205,   207,   209,   211,   213,
      +   215,   216,   219,   221,   223,   225,   227,   229,   231,   232,
      +   235,   236,   239,   240,   243,   244,   248,   251,   252,   254,
      +   255,   259,   261,   264,   266,   268,   270,   272,   274,   276,
      +   278,   280,   282,   285,   292,   294,   297,   303,   309,   315,
      +   321,   325,   328,   334,   339,   342,   344,   346,   348,   352,
      +   354,   358,   360,   361,   363,   367,   372,   376,   380,   385,
      +   390,   394,   401,   407,   410,   413,   416,   419,   422,   425,
      +   428,   431,   434,   437,   440,   443,   450,   456,   465,   472,
      +   479,   487,   495,   502,   511,   520,   524,   526,   528,   530,
      +   532,   533,   536,   543,   545,   546,   548,   551,   552,   556,
      +   557,   561,   565,   569,   573,   574,   582,   583,   595,   596,
      +   605,   606,   615,   621,   624,   628,   630,   634,   638,   642,
      +   646,   648,   649,   655,   659,   661,   665,   667,   668,   679,
      +   681,   683,   688,   690,   692,   695,   699,   700,   702,   704,
      +   706,   708,   710,   712,   714,   716,   718,   722,   724,   730,
      +   732,   734,   736,   738,   740,   742,   745,   748,   751,   755,
      +   758,   759,   761,   764,   767,   771,   781,   791,   800,   815,
      +   817,   819,   826,   832,   835,   842,   850,   855,   860,   867,
      +   874,   875,   876,   880,   883,   885,   891,   897,   904,   911,
      +   916,   923,   928,   933,   940,   947,   950,   959,   961,   963,
      +   964,   968,   975,   979,   986,   989,   995,  1003
      +};
       
      -#ifdef YYTYPE_UINT8
      -typedef YYTYPE_UINT8 yytype_uint8;
      -#else
      -typedef unsigned char yytype_uint8;
      -#endif
      +static const short yyrhs[] = {    74,
      +     0,    75,     0,    76,     0,    77,     0,    78,     0,    79,
      +     0,    80,     0,    81,     0,    82,     0,    86,     0,    87,
      +     0,    88,     0,    83,     0,    84,     0,    85,     0,   117,
      +     0,   118,     0,   119,     0,   120,     0,   121,     0,   122,
      +     0,   123,     0,   124,     0,   125,     0,   126,     0,   127,
      +     0,   128,     0,    91,     0,    92,     0,    93,     0,    94,
      +     0,    95,     0,    96,     0,    97,     0,    98,     0,    99,
      +     0,   100,     0,   101,     0,   102,     0,   103,     0,   104,
      +     0,   105,     0,   106,     0,   107,     0,   108,     0,   109,
      +     0,   110,     0,    97,     0,    98,     0,    99,     0,   100,
      +     0,    26,     0,    27,     0,    11,     0,    12,     0,    13,
      +     0,    16,     0,    15,     0,    14,     0,    19,     0,    22,
      +     0,    24,     0,   171,     0,     0,   171,   150,     0,     0,
      +    20,     0,    23,     0,   176,     0,     0,   174,   150,     0,
      +    42,     0,    44,     0,    43,     0,    45,     0,    47,     0,
      +    46,     0,    48,     0,    50,     0,     0,   147,     0,   148,
      +     0,   149,     0,     0,    46,     0,    48,     0,     0,    42,
      +     0,    43,     0,    44,     0,    47,     0,     0,    44,     0,
      +    42,     0,     0,    62,     0,    63,     0,    64,     0,    65,
      +     0,    66,     0,    61,     4,     0,   136,     0,   118,     0,
      +   135,     0,   119,     0,   138,     0,   139,     0,   141,     0,
      +   142,     0,   143,     0,     0,   185,   184,     0,   137,     0,
      +   140,     0,   136,     0,   135,     0,   144,     0,   145,     0,
      +     0,   187,   186,     0,     0,   146,    22,     0,     0,    53,
      +     4,     0,     0,   151,    53,     4,     0,    34,    22,     0,
      +     0,   191,     0,     0,   151,   194,   193,     0,   191,     0,
      +    53,     4,     0,    11,     0,    12,     0,    13,     0,    16,
      +     0,    15,     0,    14,     0,    17,     0,    49,     0,   195,
      +     0,   196,   152,     0,   196,    54,   153,     4,   154,   152,
      +     0,   231,     0,   155,     4,     0,   196,   153,   200,   154,
      +   187,     0,    10,   153,   200,   154,   187,     0,   156,     4,
      +   157,   196,   158,     0,   159,     4,   157,   196,   160,     0,
      +   161,   201,   162,     0,   161,   162,     0,   159,   161,   201,
      +   162,   160,     0,   159,   161,   162,   160,     0,   196,   185,
      +     0,   196,     0,    10,     0,   197,     0,   199,   151,   197,
      +     0,   199,     0,   199,   151,    39,     0,    39,     0,     0,
      +   196,     0,   201,   151,   196,     0,   196,   156,   204,   158,
      +     0,   196,   156,   158,     0,   196,   163,    22,     0,   196,
      +   159,   204,   160,     0,   196,   161,   204,   162,     0,   196,
      +   161,   162,     0,   196,   159,   161,   204,   162,   160,     0,
      +   196,   159,   161,   162,   160,     0,   196,    40,     0,   196,
      +    41,     0,   196,   231,     0,   196,   203,     0,   196,    25,
      +     0,   169,     3,     0,   169,     5,     0,   169,     4,     0,
      +   169,     6,     0,    11,    26,     0,    11,    27,     0,   170,
      +     9,     0,   166,   153,   202,    38,   196,   154,     0,   116,
      +   153,   202,   242,   154,     0,   130,   153,   202,   151,   202,
      +   151,   202,   154,     0,   164,   153,   202,   151,   202,   154,
      +     0,   165,   153,   202,   151,   202,   154,     0,    89,   167,
      +   153,   202,   151,   202,   154,     0,    90,   168,   153,   202,
      +   151,   202,   154,     0,   132,   153,   202,   151,   202,   154,
      +     0,   133,   153,   202,   151,   202,   151,   202,   154,     0,
      +   134,   153,   202,   151,   202,   151,   202,   154,     0,   204,
      +   151,   202,     0,   202,     0,    32,     0,    33,     0,    37,
      +     0,     0,   198,   231,     0,   122,   153,   207,    38,   196,
      +   154,     0,   209,     0,     0,   210,     0,   209,   210,     0,
      +     0,    31,   211,   227,     0,     0,    30,   212,   228,     0,
      +    59,    58,   217,     0,   173,    18,   196,     0,   173,    18,
      +    10,     0,     0,   175,   179,   206,   205,   202,   213,   193,
      +     0,     0,   175,   179,   206,   205,   202,    54,   153,     4,
      +   154,   214,   193,     0,     0,   175,   177,   179,   206,   205,
      +   202,   215,   193,     0,     0,   175,   178,   179,   206,   205,
      +   196,   216,   193,     0,   175,   179,    35,   182,   207,     0,
      +    51,   218,     0,    55,   150,   219,     0,    22,     0,    52,
      +   150,    22,     0,    67,   150,    22,     0,   156,   220,   158,
      +     0,   220,   151,    22,     0,    22,     0,     0,   221,   151,
      +   196,   185,   172,     0,   196,   185,   172,     0,   221,     0,
      +   221,   151,    39,     0,    39,     0,     0,   183,   198,   174,
      +   153,   222,   154,   187,   192,   189,   188,     0,    28,     0,
      +   161,     0,   181,   179,   223,   224,     0,    29,     0,   162,
      +     0,   234,   226,     0,   180,   179,   223,     0,     0,    60,
      +     0,     3,     0,     4,     0,     9,     0,    26,     0,    27,
      +     0,    40,     0,    41,     0,    25,     0,   159,   204,   160,
      +     0,   203,     0,    58,   229,    22,   151,    22,     0,     7,
      +     0,     8,     0,   171,     0,   174,     0,   231,     0,   230,
      +     0,   196,   232,     0,   234,   235,     0,   225,   235,     0,
      +   236,   173,   237,     0,   236,   239,     0,     0,    21,     0,
      +    68,   233,     0,    68,    10,     0,    69,    17,   232,     0,
      +    69,    11,   232,   151,    17,   232,   151,    17,   232,     0,
      +    70,   169,   232,   151,    17,   232,   156,   238,   158,     0,
      +    70,   169,   232,   151,    17,   232,   156,   158,     0,    71,
      +   183,   198,   232,   153,   241,   154,   187,    38,    17,   232,
      +    72,    17,   232,     0,    72,     0,    73,     0,   238,   169,
      +   230,   151,    17,   232,     0,   169,   230,   151,    17,   232,
      +     0,   173,   244,     0,   196,   156,   232,   151,   232,   158,
      +     0,   240,   151,   156,   232,   151,   232,   158,     0,   196,
      +   185,   232,   185,     0,    17,   185,   232,   185,     0,   241,
      +   151,   196,   185,   232,   185,     0,   241,   151,    17,   185,
      +   232,   185,     0,     0,     0,   242,   151,   233,     0,    57,
      +    56,     0,    56,     0,   164,   196,   232,   151,   232,     0,
      +   165,   196,   232,   151,   232,     0,    89,   167,   196,   232,
      +   151,   232,     0,    90,   168,   196,   232,   151,   232,     0,
      +   166,   233,    38,   196,     0,   130,   233,   151,   233,   151,
      +   233,     0,   131,   233,   151,   196,     0,   132,   233,   151,
      +   233,     0,   133,   233,   151,   233,   151,   233,     0,   134,
      +   233,   151,   233,   151,   233,     0,   129,   240,     0,   243,
      +   183,   198,   232,   153,   241,   154,   187,     0,   246,     0,
      +    36,     0,     0,   111,   196,   190,     0,   111,   196,   151,
      +    11,   232,   190,     0,   112,   196,   190,     0,   112,   196,
      +   151,    11,   232,   190,     0,   113,   233,     0,   245,   114,
      +   196,   232,   190,     0,   245,   115,   233,   151,   196,   232,
      +   190,     0,   116,   196,   232,   242,     0
      +};
       
      -#ifdef YYTYPE_INT8
      -typedef YYTYPE_INT8 yytype_int8;
      -#elif (defined __STDC__ || defined __C99__FUNC__ \
      -     || defined __cplusplus || defined _MSC_VER)
      -typedef signed char yytype_int8;
      -#else
      -typedef short int yytype_int8;
       #endif
       
      -#ifdef YYTYPE_UINT16
      -typedef YYTYPE_UINT16 yytype_uint16;
      -#else
      -typedef unsigned short int yytype_uint16;
      +#if YYDEBUG != 0
      +static const short yyrline[] = { 0,
      +  1107,  1107,  1107,  1107,  1107,  1107,  1107,  1107,  1107,  1108,
      +  1108,  1108,  1108,  1108,  1108,  1109,  1109,  1109,  1109,  1109,
      +  1109,  1109,  1110,  1110,  1110,  1110,  1110,  1113,  1113,  1114,
      +  1114,  1115,  1115,  1116,  1116,  1117,  1117,  1121,  1121,  1122,
      +  1122,  1123,  1123,  1124,  1124,  1125,  1125,  1126,  1126,  1127,
      +  1127,  1128,  1129,  1134,  1135,  1135,  1135,  1135,  1135,  1137,
      +  1137,  1137,  1138,  1138,  1142,  1146,  1151,  1151,  1153,  1154,
      +  1159,  1165,  1166,  1167,  1168,  1169,  1173,  1174,  1175,  1179,
      +  1180,  1181,  1182,  1186,  1187,  1188,  1192,  1193,  1194,  1195,
      +  1196,  1200,  1201,  1202,  1205,  1205,  1206,  1207,  1208,  1209,
      +  1210,  1218,  1219,  1220,  1221,  1222,  1223,  1224,  1225,  1226,
      +  1229,  1230,  1235,  1236,  1237,  1238,  1239,  1240,  1243,  1244,
      +  1249,  1250,  1257,  1257,  1264,  1264,  1274,  1282,  1282,  1288,
      +  1288,  1290,  1295,  1308,  1308,  1308,  1308,  1308,  1308,  1308,
      +  1311,  1315,  1319,  1326,  1333,  1338,  1346,  1376,  1401,  1406,
      +  1416,  1426,  1430,  1440,  1447,  1456,  1463,  1468,  1473,  1480,
      +  1481,  1488,  1495,  1503,  1509,  1521,  1549,  1565,  1592,  1620,
      +  1646,  1666,  1692,  1712,  1724,  1731,  1797,  1807,  1817,  1823,
      +  1833,  1839,  1849,  1854,  1859,  1872,  1884,  1906,  1914,  1920,
      +  1931,  1936,  1941,  1947,  1953,  1962,  1966,  1974,  1974,  1977,
      +  1977,  1980,  1992,  2013,  2018,  2026,  2027,  2031,  2031,  2035,
      +  2035,  2038,  2041,  2065,  2076,  2083,  2086,  2094,  2097,  2103,
      +  2106,  2113,  2117,  2157,  2160,  2166,  2176,  2180,  2185,  2187,
      +  2192,  2197,  2206,  2216,  2227,  2231,  2240,  2249,  2254,  2388,
      +  2388,  2390,  2399,  2399,  2401,  2406,  2418,  2422,  2427,  2431,
      +  2435,  2439,  2443,  2447,  2451,  2455,  2459,  2484,  2488,  2498,
      +  2502,  2506,  2511,  2518,  2518,  2524,  2533,  2537,  2546,  2555,
      +  2564,  2568,  2575,  2579,  2583,  2588,  2598,  2617,  2626,  2710,
      +  2714,  2721,  2732,  2745,  2755,  2766,  2776,  2787,  2795,  2805,
      +  2812,  2815,  2816,  2823,  2827,  2832,  2848,  2865,  2879,  2893,
      +  2905,  2913,  2920,  2926,  2932,  2938,  2953,  3044,  3049,  3053,
      +  3060,  3067,  3075,  3082,  3090,  3098,  3112,  3129
      +};
       #endif
       
      -#ifdef YYTYPE_INT16
      -typedef YYTYPE_INT16 yytype_int16;
      -#else
      -typedef short int yytype_int16;
      -#endif
       
      -#ifndef YYSIZE_T
      -# ifdef __SIZE_TYPE__
      -#  define YYSIZE_T __SIZE_TYPE__
      -# elif defined size_t
      -#  define YYSIZE_T size_t
      -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
      -     || defined __cplusplus || defined _MSC_VER)
      -#  include  /* INFRINGES ON USER NAME SPACE */
      -#  define YYSIZE_T size_t
      -# else
      -#  define YYSIZE_T unsigned int
      -# endif
      -#endif
      -
      -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
      -
      -#ifndef YY_
      -# if defined YYENABLE_NLS && YYENABLE_NLS
      -#  if ENABLE_NLS
      -#   include  /* INFRINGES ON USER NAME SPACE */
      -#   define YY_(msgid) dgettext ("bison-runtime", msgid)
      -#  endif
      -# endif
      -# ifndef YY_
      -#  define YY_(msgid) msgid
      -# endif
      -#endif
      -
      -/* Suppress unused-variable warnings by "using" E.  */
      -#if ! defined lint || defined __GNUC__
      -# define YYUSE(e) ((void) (e))
      -#else
      -# define YYUSE(e) /* empty */
      -#endif
      +#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
       
      -/* Identity function, used to suppress warnings about constant conditions.  */
      -#ifndef lint
      -# define YYID(n) (n)
      -#else
      -#if (defined __STDC__ || defined __C99__FUNC__ \
      -     || defined __cplusplus || defined _MSC_VER)
      -static int
      -YYID (int i)
      -#else
      -static int
      -YYID (i)
      -    int i;
      -#endif
      -{
      -  return i;
      -}
      +static const char * const yytname[] = {   "$","error","$undefined.","ESINT64VAL",
      +"EUINT64VAL","ESAPINTVAL","EUAPINTVAL","LOCALVAL_ID","GLOBALVAL_ID","FPVAL",
      +"VOID","INTTYPE","FLOAT","DOUBLE","X86_FP80","FP128","PPC_FP128","LABEL","TYPE",
      +"LOCALVAR","GLOBALVAR","LABELSTR","STRINGCONSTANT","ATSTRINGCONSTANT","PCTSTRINGCONSTANT",
      +"ZEROINITIALIZER","TRUETOK","FALSETOK","BEGINTOK","ENDTOK","DECLARE","DEFINE",
      +"GLOBAL","CONSTANT","SECTION","ALIAS","VOLATILE","THREAD_LOCAL","TO","DOTDOTDOT",
      +"NULL_TOK","UNDEF","INTERNAL","LINKONCE","WEAK","APPENDING","DLLIMPORT","DLLEXPORT",
      +"EXTERN_WEAK","OPAQUE","EXTERNAL","TARGET","TRIPLE","ALIGN","ADDRSPACE","DEPLIBS",
      +"CALL","TAIL","ASM_TOK","MODULE","SIDEEFFECT","CC_TOK","CCC_TOK","FASTCC_TOK",
      +"COLDCC_TOK","X86_STDCALLCC_TOK","X86_FASTCALLCC_TOK","DATALAYOUT","RET","BR",
      +"SWITCH","INVOKE","UNWIND","UNREACHABLE","ADD","SUB","MUL","UDIV","SDIV","FDIV",
      +"UREM","SREM","FREM","AND","OR","XOR","SHL","LSHR","ASHR","ICMP","FCMP","EQ",
      +"NE","SLT","SGT","SLE","SGE","ULT","UGT","ULE","UGE","OEQ","ONE","OLT","OGT",
      +"OLE","OGE","ORD","UNO","UEQ","UNE","MALLOC","ALLOCA","FREE","LOAD","STORE",
      +"GETELEMENTPTR","TRUNC","ZEXT","SEXT","FPTRUNC","FPEXT","BITCAST","UITOFP","SITOFP",
      +"FPTOUI","FPTOSI","INTTOPTR","PTRTOINT","PHI_TOK","SELECT","VAARG","EXTRACTELEMENT",
      +"INSERTELEMENT","SHUFFLEVECTOR","SIGNEXT","ZEROEXT","NORETURN","INREG","SRET",
      +"NOUNWIND","NOALIAS","BYVAL","NEST","READNONE","READONLY","GC","DEFAULT","HIDDEN",
      +"PROTECTED","'='","','","'*'","'('","')'","'\\\\'","'['","'x'","']'","'<'","'>'",
      +"'{'","'}'","'c'","ArithmeticOps","LogicalOps","CastOps","IPredicates","FPredicates",
      +"IntType","FPType","LocalName","OptLocalName","OptLocalAssign","GlobalName",
      +"OptGlobalAssign","GlobalAssign","GVInternalLinkage","GVExternalLinkage","GVVisibilityStyle",
      +"FunctionDeclareLinkage","FunctionDefineLinkage","AliasLinkage","OptCallingConv",
      +"ParamAttr","OptParamAttrs","FuncAttr","OptFuncAttrs","OptGC","OptAlign","OptCAlign",
      +"SectionString","OptSection","GlobalVarAttributes","GlobalVarAttribute","PrimType",
      +"Types","ArgType","ResultTypes","ArgTypeList","ArgTypeListI","TypeListI","ConstVal",
      +"ConstExpr","ConstVector","GlobalType","ThreadLocal","AliaseeRef","Module","DefinitionList",
      +"Definition","@1","@2","@3","@4","@5","@6","AsmBlock","TargetDefinition","LibrariesDefinition",
      +"LibList","ArgListH","ArgList","FunctionHeaderH","BEGIN","FunctionHeader","END",
      +"Function","FunctionProto","OptSideEffect","ConstValueRef","SymbolicValueRef",
      +"ValueRef","ResolvedVal","BasicBlockList","BasicBlock","InstructionList","BBTerminatorInst",
      +"JumpTable","Inst","PHIList","ParamList","IndexList","OptTailCall","InstVal",
      +"OptVolatile","MemoryInst", NULL
      +};
       #endif
       
      -#if ! defined yyoverflow || YYERROR_VERBOSE
      -
      -/* The parser invokes alloca or malloc; define the necessary symbols.  */
      -
      -# ifdef YYSTACK_USE_ALLOCA
      -#  if YYSTACK_USE_ALLOCA
      -#   ifdef __GNUC__
      -#    define YYSTACK_ALLOC __builtin_alloca
      -#   elif defined __BUILTIN_VA_ARG_INCR
      -#    include  /* INFRINGES ON USER NAME SPACE */
      -#   elif defined _AIX
      -#    define YYSTACK_ALLOC __alloca
      -#   elif defined _MSC_VER
      -#    include  /* INFRINGES ON USER NAME SPACE */
      -#    define alloca _alloca
      -#   else
      -#    define YYSTACK_ALLOC alloca
      -#    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
      -     || defined __cplusplus || defined _MSC_VER)
      -#     include  /* INFRINGES ON USER NAME SPACE */
      -#     ifndef _STDLIB_H
      -#      define _STDLIB_H 1
      -#     endif
      -#    endif
      -#   endif
      -#  endif
      -# endif
      -
      -# ifdef YYSTACK_ALLOC
      -   /* Pacify GCC's `empty if-body' warning.  */
      -#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
      -#  ifndef YYSTACK_ALLOC_MAXIMUM
      -    /* The OS might guarantee only one guard page at the bottom of the stack,
      -       and a page size can be as small as 4096 bytes.  So we cannot safely
      -       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
      -       to allow for a few compiler-allocated temporary stack slots.  */
      -#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
      -#  endif
      -# else
      -#  define YYSTACK_ALLOC YYMALLOC
      -#  define YYSTACK_FREE YYFREE
      -#  ifndef YYSTACK_ALLOC_MAXIMUM
      -#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
      -#  endif
      -#  if (defined __cplusplus && ! defined _STDLIB_H \
      -       && ! ((defined YYMALLOC || defined malloc) \
      -	     && (defined YYFREE || defined free)))
      -#   include  /* INFRINGES ON USER NAME SPACE */
      -#   ifndef _STDLIB_H
      -#    define _STDLIB_H 1
      -#   endif
      -#  endif
      -#  ifndef YYMALLOC
      -#   define YYMALLOC malloc
      -#   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
      -     || defined __cplusplus || defined _MSC_VER)
      -void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
      -#   endif
      -#  endif
      -#  ifndef YYFREE
      -#   define YYFREE free
      -#   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
      -     || defined __cplusplus || defined _MSC_VER)
      -void free (void *); /* INFRINGES ON USER NAME SPACE */
      -#   endif
      -#  endif
      -# endif
      -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
      -
      -
      -#if (! defined yyoverflow \
      -     && (! defined __cplusplus \
      -	 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
      -
      -/* A type that is properly aligned for any stack member.  */
      -union yyalloc
      -{
      -  yytype_int16 yyss;
      -  YYSTYPE yyvs;
      -  };
      -
      -/* The size of the maximum gap between one aligned stack and the next.  */
      -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
      -
      -/* The size of an array large to enough to hold all stacks, each with
      -   N elements.  */
      -# define YYSTACK_BYTES(N) \
      -     ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
      -      + YYSTACK_GAP_MAXIMUM)
      -
      -/* Copy COUNT objects from FROM to TO.  The source and destination do
      -   not overlap.  */
      -# ifndef YYCOPY
      -#  if defined __GNUC__ && 1 < __GNUC__
      -#   define YYCOPY(To, From, Count) \
      -      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
      -#  else
      -#   define YYCOPY(To, From, Count)		\
      -      do					\
      -	{					\
      -	  YYSIZE_T yyi;				\
      -	  for (yyi = 0; yyi < (Count); yyi++)	\
      -	    (To)[yyi] = (From)[yyi];		\
      -	}					\
      -      while (YYID (0))
      -#  endif
      -# endif
      -
      -/* Relocate STACK from its old location to the new one.  The
      -   local variables YYSIZE and YYSTACKSIZE give the old and new number of
      -   elements in the stack, and YYPTR gives the new location of the
      -   stack.  Advance YYPTR to a properly aligned location for the next
      -   stack.  */
      -# define YYSTACK_RELOCATE(Stack)					\
      -    do									\
      -      {									\
      -	YYSIZE_T yynewbytes;						\
      -	YYCOPY (&yyptr->Stack, Stack, yysize);				\
      -	Stack = &yyptr->Stack;						\
      -	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
      -	yyptr += yynewbytes / sizeof (*yyptr);				\
      -      }									\
      -    while (YYID (0))
      -
      -#endif
      -
      -/* YYFINAL -- State number of the termination state.  */
      -#define YYFINAL  43
      -/* YYLAST -- Last index in YYTABLE.  */
      -#define YYLAST   1820
      -
      -/* YYNTOKENS -- Number of terminals.  */
      -#define YYNTOKENS  163
      -/* YYNNTS -- Number of nonterminals.  */
      -#define YYNNTS  83
      -/* YYNRULES -- Number of rules.  */
      -#define YYNRULES  316
      -/* YYNRULES -- Number of states.  */
      -#define YYNSTATES  611
      -
      -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
      -#define YYUNDEFTOK  2
      -#define YYMAXUTOK   403
      -
      -#define YYTRANSLATE(YYX)						\
      -  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
      -
      -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
      -static const yytype_uint8 yytranslate[] =
      -{
      -       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      -       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      -       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      -       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      -     153,   154,   151,     2,   150,     2,     2,     2,     2,     2,
      -       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      -     158,   149,   159,     2,     2,     2,     2,     2,     2,     2,
      -       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      -       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      -       2,   155,   152,   157,     2,     2,     2,     2,     2,   162,
      -       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      -       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      -     156,     2,     2,   160,     2,   161,     2,     2,     2,     2,
      -       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      -       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      -       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      -       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      -       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      -       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      -       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      -       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      -       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      -       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      -       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      -       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
      -       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
      -       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
      -      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
      -      25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
      -      35,    36,    37,    38,    39,    40,    41,    42,    43,    44,
      -      45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
      -      55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
      -      65,    66,    67,    68,    69,    70,    71,    72,    73,    74,
      -      75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
      -      85,    86,    87,    88,    89,    90,    91,    92,    93,    94,
      -      95,    96,    97,    98,    99,   100,   101,   102,   103,   104,
      -     105,   106,   107,   108,   109,   110,   111,   112,   113,   114,
      -     115,   116,   117,   118,   119,   120,   121,   122,   123,   124,
      -     125,   126,   127,   128,   129,   130,   131,   132,   133,   134,
      -     135,   136,   137,   138,   139,   140,   141,   142,   143,   144,
      -     145,   146,   147,   148
      +static const short yyr1[] = {     0,
      +   164,   164,   164,   164,   164,   164,   164,   164,   164,   165,
      +   165,   165,   165,   165,   165,   166,   166,   166,   166,   166,
      +   166,   166,   166,   166,   166,   166,   166,   167,   167,   167,
      +   167,   167,   167,   167,   167,   167,   167,   168,   168,   168,
      +   168,   168,   168,   168,   168,   168,   168,   168,   168,   168,
      +   168,   168,   168,   169,   170,   170,   170,   170,   170,   171,
      +   171,   171,   172,   172,   173,   173,   174,   174,   175,   175,
      +   176,   177,   177,   177,   177,   177,   178,   178,   178,   179,
      +   179,   179,   179,   180,   180,   180,   181,   181,   181,   181,
      +   181,   182,   182,   182,   183,   183,   183,   183,   183,   183,
      +   183,   184,   184,   184,   184,   184,   184,   184,   184,   184,
      +   185,   185,   186,   186,   186,   186,   186,   186,   187,   187,
      +   188,   188,   189,   189,   190,   190,   191,   192,   192,   193,
      +   193,   194,   194,   195,   195,   195,   195,   195,   195,   195,
      +   196,   196,   196,   196,   196,   196,   196,   196,   196,   196,
      +   196,   196,   196,   196,   197,   198,   198,   199,   199,   200,
      +   200,   200,   200,   201,   201,   202,   202,   202,   202,   202,
      +   202,   202,   202,   202,   202,   202,   202,   202,   202,   202,
      +   202,   202,   202,   202,   202,   203,   203,   203,   203,   203,
      +   203,   203,   203,   203,   203,   204,   204,   205,   205,   206,
      +   206,   207,   207,   208,   208,   209,   209,   211,   210,   212,
      +   210,   210,   210,   210,   213,   210,   214,   210,   215,   210,
      +   216,   210,   210,   210,   210,   217,   218,   218,   219,   220,
      +   220,   220,   221,   221,   222,   222,   222,   222,   223,   224,
      +   224,   225,   226,   226,   227,   228,   229,   229,   230,   230,
      +   230,   230,   230,   230,   230,   230,   230,   230,   230,   231,
      +   231,   231,   231,   232,   232,   233,   234,   234,   235,   236,
      +   236,   236,   237,   237,   237,   237,   237,   237,   237,   237,
      +   237,   238,   238,   239,   240,   240,   241,   241,   241,   241,
      +   241,   242,   242,   243,   243,   244,   244,   244,   244,   244,
      +   244,   244,   244,   244,   244,   244,   244,   244,   245,   245,
      +   246,   246,   246,   246,   246,   246,   246,   246
       };
       
      -#if YYDEBUG
      -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
      -   YYRHS.  */
      -static const yytype_uint16 yyprhs[] =
      -{
      -       0,     0,     3,     5,     7,     9,    11,    13,    15,    17,
      -      19,    21,    23,    25,    27,    29,    31,    33,    35,    37,
      -      39,    41,    43,    45,    47,    49,    51,    53,    55,    57,
      -      59,    61,    63,    65,    67,    69,    71,    73,    75,    77,
      -      79,    81,    83,    85,    87,    89,    91,    93,    95,    97,
      -      99,   101,   103,   105,   107,   109,   111,   113,   115,   117,
      -     119,   121,   123,   125,   127,   129,   130,   133,   134,   136,
      -     138,   140,   141,   144,   146,   148,   150,   152,   154,   156,
      -     158,   160,   161,   163,   165,   167,   168,   170,   172,   173,
      -     175,   177,   179,   181,   182,   184,   186,   187,   189,   191,
      -     193,   195,   197,   200,   202,   204,   206,   208,   210,   212,
      -     214,   216,   218,   219,   222,   224,   226,   228,   230,   232,
      -     234,   235,   238,   239,   242,   243,   246,   247,   251,   254,
      -     255,   257,   258,   262,   264,   267,   269,   271,   273,   275,
      -     277,   279,   281,   283,   285,   288,   290,   293,   299,   305,
      -     311,   317,   321,   324,   330,   335,   338,   340,   342,   344,
      -     348,   350,   354,   356,   357,   359,   363,   368,   372,   376,
      -     381,   386,   390,   397,   403,   406,   409,   412,   415,   418,
      -     421,   424,   427,   430,   433,   436,   439,   446,   452,   461,
      -     468,   475,   483,   491,   498,   507,   516,   520,   522,   524,
      -     526,   528,   529,   532,   539,   541,   542,   544,   547,   548,
      -     552,   553,   557,   561,   565,   569,   570,   578,   579,   588,
      -     589,   598,   604,   607,   611,   613,   617,   621,   625,   629,
      -     631,   632,   638,   642,   644,   648,   650,   651,   662,   664,
      -     666,   671,   673,   675,   678,   682,   683,   685,   687,   689,
      -     691,   693,   695,   697,   699,   701,   705,   707,   713,   715,
      -     717,   719,   721,   723,   725,   728,   731,   734,   738,   741,
      -     742,   744,   747,   750,   754,   764,   774,   783,   798,   800,
      -     802,   809,   815,   818,   825,   833,   838,   843,   850,   857,
      -     858,   859,   863,   866,   868,   874,   880,   887,   894,   899,
      -     906,   911,   916,   923,   930,   933,   942,   944,   946,   947,
      -     951,   958,   962,   969,   972,   978,   986
      +static const short yyr2[] = {     0,
      +     1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
      +     1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
      +     1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
      +     1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
      +     1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
      +     1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
      +     1,     1,     1,     0,     2,     0,     1,     1,     1,     0,
      +     2,     1,     1,     1,     1,     1,     1,     1,     1,     0,
      +     1,     1,     1,     0,     1,     1,     0,     1,     1,     1,
      +     1,     0,     1,     1,     0,     1,     1,     1,     1,     1,
      +     2,     1,     1,     1,     1,     1,     1,     1,     1,     1,
      +     0,     2,     1,     1,     1,     1,     1,     1,     0,     2,
      +     0,     2,     0,     2,     0,     3,     2,     0,     1,     0,
      +     3,     1,     2,     1,     1,     1,     1,     1,     1,     1,
      +     1,     1,     2,     6,     1,     2,     5,     5,     5,     5,
      +     3,     2,     5,     4,     2,     1,     1,     1,     3,     1,
      +     3,     1,     0,     1,     3,     4,     3,     3,     4,     4,
      +     3,     6,     5,     2,     2,     2,     2,     2,     2,     2,
      +     2,     2,     2,     2,     2,     6,     5,     8,     6,     6,
      +     7,     7,     6,     8,     8,     3,     1,     1,     1,     1,
      +     0,     2,     6,     1,     0,     1,     2,     0,     3,     0,
      +     3,     3,     3,     3,     0,     7,     0,    11,     0,     8,
      +     0,     8,     5,     2,     3,     1,     3,     3,     3,     3,
      +     1,     0,     5,     3,     1,     3,     1,     0,    10,     1,
      +     1,     4,     1,     1,     2,     3,     0,     1,     1,     1,
      +     1,     1,     1,     1,     1,     1,     3,     1,     5,     1,
      +     1,     1,     1,     1,     1,     2,     2,     2,     3,     2,
      +     0,     1,     2,     2,     3,     9,     9,     8,    14,     1,
      +     1,     6,     5,     2,     6,     7,     4,     4,     6,     6,
      +     0,     0,     3,     2,     1,     5,     5,     6,     6,     4,
      +     6,     4,     4,     6,     6,     2,     8,     1,     1,     0,
      +     3,     6,     3,     6,     2,     5,     7,     4
       };
       
      -/* YYRHS -- A `-1'-separated list of the rules' RHS.  */
      -static const yytype_int16 yyrhs[] =
      -{
      -     208,     0,    -1,    73,    -1,    74,    -1,    75,    -1,    76,
      -      -1,    77,    -1,    78,    -1,    79,    -1,    80,    -1,    81,
      -      -1,    85,    -1,    86,    -1,    87,    -1,    82,    -1,    83,
      -      -1,    84,    -1,   116,    -1,   117,    -1,   118,    -1,   119,
      -      -1,   120,    -1,   121,    -1,   122,    -1,   123,    -1,   124,
      -      -1,   125,    -1,   126,    -1,   127,    -1,    90,    -1,    91,
      -      -1,    92,    -1,    93,    -1,    94,    -1,    95,    -1,    96,
      -      -1,    97,    -1,    98,    -1,    99,    -1,   100,    -1,   101,
      -      -1,   102,    -1,   103,    -1,   104,    -1,   105,    -1,   106,
      -      -1,   107,    -1,   108,    -1,   109,    -1,    96,    -1,    97,
      -      -1,    98,    -1,    99,    -1,    26,    -1,    27,    -1,    11,
      -      -1,    12,    -1,    13,    -1,    16,    -1,    15,    -1,    14,
      -      -1,    19,    -1,    22,    -1,    24,    -1,   171,    -1,    -1,
      -     171,   149,    -1,    -1,    20,    -1,    23,    -1,   176,    -1,
      -      -1,   174,   149,    -1,    42,    -1,    44,    -1,    43,    -1,
      -      45,    -1,    47,    -1,    46,    -1,    48,    -1,    50,    -1,
      -      -1,   146,    -1,   147,    -1,   148,    -1,    -1,    46,    -1,
      -      48,    -1,    -1,    42,    -1,    43,    -1,    44,    -1,    47,
      -      -1,    -1,    44,    -1,    42,    -1,    -1,    61,    -1,    62,
      -      -1,    63,    -1,    64,    -1,    65,    -1,    60,     4,    -1,
      -     135,    -1,   117,    -1,   134,    -1,   118,    -1,   137,    -1,
      -     138,    -1,   140,    -1,   141,    -1,   142,    -1,    -1,   185,
      -     184,    -1,   136,    -1,   139,    -1,   135,    -1,   134,    -1,
      -     143,    -1,   144,    -1,    -1,   187,   186,    -1,    -1,   145,
      -      22,    -1,    -1,    53,     4,    -1,    -1,   150,    53,     4,
      -      -1,    34,    22,    -1,    -1,   191,    -1,    -1,   150,   194,
      -     193,    -1,   191,    -1,    53,     4,    -1,    11,    -1,    12,
      -      -1,    13,    -1,    16,    -1,    15,    -1,    14,    -1,    17,
      -      -1,    49,    -1,   195,    -1,   196,   151,    -1,   230,    -1,
      -     152,     4,    -1,   196,   153,   200,   154,   187,    -1,    10,
      -     153,   200,   154,   187,    -1,   155,     4,   156,   196,   157,
      -      -1,   158,     4,   156,   196,   159,    -1,   160,   201,   161,
      -      -1,   160,   161,    -1,   158,   160,   201,   161,   159,    -1,
      -     158,   160,   161,   159,    -1,   196,   185,    -1,   196,    -1,
      -      10,    -1,   197,    -1,   199,   150,   197,    -1,   199,    -1,
      -     199,   150,    39,    -1,    39,    -1,    -1,   196,    -1,   201,
      -     150,   196,    -1,   196,   155,   204,   157,    -1,   196,   155,
      -     157,    -1,   196,   162,    22,    -1,   196,   158,   204,   159,
      -      -1,   196,   160,   204,   161,    -1,   196,   160,   161,    -1,
      -     196,   158,   160,   204,   161,   159,    -1,   196,   158,   160,
      -     161,   159,    -1,   196,    40,    -1,   196,    41,    -1,   196,
      -     230,    -1,   196,   203,    -1,   196,    25,    -1,   169,     3,
      -      -1,   169,     5,    -1,   169,     4,    -1,   169,     6,    -1,
      -      11,    26,    -1,    11,    27,    -1,   170,     9,    -1,   166,
      -     153,   202,    38,   196,   154,    -1,   115,   153,   202,   241,
      -     154,    -1,   129,   153,   202,   150,   202,   150,   202,   154,
      -      -1,   164,   153,   202,   150,   202,   154,    -1,   165,   153,
      -     202,   150,   202,   154,    -1,    88,   167,   153,   202,   150,
      -     202,   154,    -1,    89,   168,   153,   202,   150,   202,   154,
      -      -1,   131,   153,   202,   150,   202,   154,    -1,   132,   153,
      -     202,   150,   202,   150,   202,   154,    -1,   133,   153,   202,
      -     150,   202,   150,   202,   154,    -1,   204,   150,   202,    -1,
      -     202,    -1,    32,    -1,    33,    -1,    37,    -1,    -1,   198,
      -     230,    -1,   121,   153,   207,    38,   196,   154,    -1,   209,
      -      -1,    -1,   210,    -1,   209,   210,    -1,    -1,    31,   211,
      -     226,    -1,    -1,    30,   212,   227,    -1,    58,    57,   216,
      -      -1,   173,    18,   196,    -1,   173,    18,    10,    -1,    -1,
      -     175,   179,   206,   205,   202,   213,   193,    -1,    -1,   175,
      -     177,   179,   206,   205,   202,   214,   193,    -1,    -1,   175,
      -     178,   179,   206,   205,   196,   215,   193,    -1,   175,   179,
      -      35,   182,   207,    -1,    51,   217,    -1,    54,   149,   218,
      -      -1,    22,    -1,    52,   149,    22,    -1,    66,   149,    22,
      -      -1,   155,   219,   157,    -1,   219,   150,    22,    -1,    22,
      -      -1,    -1,   220,   150,   196,   185,   172,    -1,   196,   185,
      -     172,    -1,   220,    -1,   220,   150,    39,    -1,    39,    -1,
      -      -1,   183,   198,   174,   153,   221,   154,   187,   192,   189,
      -     188,    -1,    28,    -1,   160,    -1,   181,   179,   222,   223,
      -      -1,    29,    -1,   161,    -1,   233,   225,    -1,   180,   179,
      -     222,    -1,    -1,    59,    -1,     3,    -1,     4,    -1,     9,
      -      -1,    26,    -1,    27,    -1,    40,    -1,    41,    -1,    25,
      -      -1,   158,   204,   159,    -1,   203,    -1,    57,   228,    22,
      -     150,    22,    -1,     7,    -1,     8,    -1,   171,    -1,   174,
      -      -1,   230,    -1,   229,    -1,   196,   231,    -1,   233,   234,
      -      -1,   224,   234,    -1,   235,   173,   236,    -1,   235,   238,
      -      -1,    -1,    21,    -1,    67,   232,    -1,    67,    10,    -1,
      -      68,    17,   231,    -1,    68,    11,   231,   150,    17,   231,
      -     150,    17,   231,    -1,    69,   169,   231,   150,    17,   231,
      -     155,   237,   157,    -1,    69,   169,   231,   150,    17,   231,
      -     155,   157,    -1,    70,   183,   198,   231,   153,   240,   154,
      -     187,    38,    17,   231,    71,    17,   231,    -1,    71,    -1,
      -      72,    -1,   237,   169,   229,   150,    17,   231,    -1,   169,
      -     229,   150,    17,   231,    -1,   173,   243,    -1,   196,   155,
      -     231,   150,   231,   157,    -1,   239,   150,   155,   231,   150,
      -     231,   157,    -1,   196,   185,   231,   185,    -1,    17,   185,
      -     231,   185,    -1,   240,   150,   196,   185,   231,   185,    -1,
      -     240,   150,    17,   185,   231,   185,    -1,    -1,    -1,   241,
      -     150,   232,    -1,    56,    55,    -1,    55,    -1,   164,   196,
      -     231,   150,   231,    -1,   165,   196,   231,   150,   231,    -1,
      -      88,   167,   196,   231,   150,   231,    -1,    89,   168,   196,
      -     231,   150,   231,    -1,   166,   232,    38,   196,    -1,   129,
      -     232,   150,   232,   150,   232,    -1,   130,   232,   150,   196,
      -      -1,   131,   232,   150,   232,    -1,   132,   232,   150,   232,
      -     150,   232,    -1,   133,   232,   150,   232,   150,   232,    -1,
      -     128,   239,    -1,   242,   183,   198,   231,   153,   240,   154,
      -     187,    -1,   245,    -1,    36,    -1,    -1,   110,   196,   190,
      -      -1,   110,   196,   150,    11,   231,   190,    -1,   111,   196,
      -     190,    -1,   111,   196,   150,    11,   231,   190,    -1,   112,
      -     232,    -1,   244,   113,   196,   231,   190,    -1,   244,   114,
      -     232,   150,   196,   231,   190,    -1,   115,   196,   231,   241,
      -      -1
      +static const short yydefact[] = {    70,
      +    60,    67,    61,    68,    62,   210,   208,     0,     0,     0,
      +     0,     0,     0,    80,    69,    70,   206,    84,    87,     0,
      +     0,   224,     0,     0,    65,     0,    71,    72,    74,    73,
      +    75,    77,    76,    78,    79,    81,    82,    83,    80,    80,
      +   201,   207,    85,    86,    80,   211,    88,    89,    90,    91,
      +    80,   271,   209,   271,     0,     0,   232,   225,   226,   212,
      +   260,   261,   214,   134,   135,   136,   139,   138,   137,   140,
      +   141,     0,     0,     0,     0,   262,   263,   142,   213,   145,
      +   201,   201,    92,   200,     0,    95,    95,   272,   268,    66,
      +   243,   244,   245,   267,   227,   228,   231,     0,   163,   146,
      +     0,     0,     0,     0,   152,   164,     0,     0,   143,   163,
      +     0,     0,    94,    93,     0,   198,   199,     0,     0,    96,
      +    97,    98,    99,   100,     0,   246,     0,   310,   270,     0,
      +   229,   162,   111,   158,   160,     0,     0,     0,     0,     0,
      +     0,   151,     0,     0,     0,     0,   157,     0,   156,     0,
      +   223,   134,   135,   136,   139,   138,   137,     0,     0,     0,
      +   215,   101,     0,   240,   241,   242,   309,   295,     0,     0,
      +     0,     0,    95,   280,   281,     1,     2,     3,     4,     5,
      +     6,     7,     8,     9,    13,    14,    15,    10,    11,    12,
      +     0,     0,     0,     0,     0,     0,    16,    17,    18,    19,
      +    20,    21,    22,    23,    24,    25,    26,    27,     0,     0,
      +     0,     0,     0,     0,     0,     0,     0,   269,    95,   284,
      +     0,   308,   230,   155,     0,   119,     0,     0,   154,     0,
      +   165,     0,   119,   219,   221,     0,   202,   183,   184,   179,
      +   181,   180,   182,   185,   178,   174,   175,     0,     0,     0,
      +     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
      +     0,   177,   176,     0,   130,     0,   294,   274,     0,   273,
      +     0,     0,    54,     0,     0,    28,    29,    30,    31,    32,
      +    33,    34,    35,    36,    37,     0,    52,    53,    48,    49,
      +    50,    51,    38,    39,    40,    41,    42,    43,    44,    45,
      +    46,    47,     0,   125,   125,   315,     0,     0,   306,     0,
      +     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
      +   103,   105,   104,   102,   106,   107,   108,   109,   110,   112,
      +   161,   159,   148,   149,   150,   153,     0,   147,   130,   130,
      +     0,     0,     0,     0,     0,     0,     0,     0,   167,   197,
      +     0,     0,     0,   171,     0,   168,     0,     0,     0,     0,
      +     0,   216,   238,   249,   250,   251,   256,   252,   253,   254,
      +   255,   247,     0,   258,   265,   264,   266,     0,   275,     0,
      +     0,     0,     0,     0,   311,     0,   313,   292,     0,     0,
      +     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
      +     0,   116,   115,   113,   114,   117,   118,   120,   144,   220,
      +   222,     0,     0,     0,   292,     0,     0,     0,     0,     0,
      +   166,   152,   164,     0,   169,   170,     0,     0,     0,     0,
      +     0,     0,   132,   130,   237,   111,   235,     0,   248,     0,
      +     0,     0,     0,     0,     0,     0,     0,     0,     0,   318,
      +     0,     0,     0,   302,   303,     0,     0,     0,     0,   300,
      +     0,   125,     0,     0,     0,     0,     0,     0,     0,     0,
      +     0,   196,   173,     0,     0,     0,     0,   217,   127,   133,
      +   131,    64,     0,   119,     0,   257,     0,     0,   291,     0,
      +     0,   125,   126,   125,     0,     0,     0,     0,     0,     0,
      +   296,   297,   291,     0,   316,     0,   203,     0,     0,   187,
      +     0,     0,     0,     0,   172,     0,     0,     0,   130,    63,
      +   234,   236,   111,   128,     0,     0,     0,   111,   111,     0,
      +   298,   299,   312,   314,   293,     0,     0,   301,   304,   305,
      +     0,   125,     0,     0,     0,   193,     0,     0,   189,   190,
      +   186,   218,    64,   129,   123,   259,     0,     0,     0,     0,
      +     0,   119,   285,     0,   119,   317,   191,   192,     0,     0,
      +     0,   233,     0,   121,     0,   278,     0,     0,   103,   105,
      +   111,   111,   111,   111,     0,   286,   307,   188,   194,   195,
      +   124,     0,   239,   276,     0,   277,     0,   288,   287,     0,
      +     0,     0,   122,     0,     0,   111,   111,     0,     0,     0,
      +   290,   289,     0,   283,     0,     0,   282,     0,   279,     0,
      +     0,     0
       };
       
      -/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
      -static const yytype_uint16 yyrline[] =
      -{
      -       0,  1105,  1105,  1105,  1105,  1105,  1105,  1105,  1105,  1105,
      -    1105,  1106,  1106,  1106,  1106,  1106,  1106,  1107,  1107,  1107,
      -    1107,  1107,  1107,  1108,  1108,  1108,  1108,  1108,  1108,  1111,
      -    1111,  1112,  1112,  1113,  1113,  1114,  1114,  1115,  1115,  1119,
      -    1119,  1120,  1120,  1121,  1121,  1122,  1122,  1123,  1123,  1124,
      -    1124,  1125,  1125,  1126,  1127,  1132,  1133,  1133,  1133,  1133,
      -    1133,  1135,  1135,  1135,  1136,  1136,  1140,  1144,  1149,  1149,
      -    1151,  1152,  1157,  1163,  1164,  1165,  1166,  1167,  1171,  1172,
      -    1173,  1177,  1178,  1179,  1180,  1184,  1185,  1186,  1190,  1191,
      -    1192,  1193,  1194,  1198,  1199,  1200,  1203,  1204,  1205,  1206,
      -    1207,  1208,  1209,  1216,  1217,  1218,  1219,  1220,  1221,  1222,
      -    1223,  1224,  1227,  1228,  1233,  1234,  1235,  1236,  1237,  1238,
      -    1241,  1242,  1247,  1248,  1255,  1256,  1262,  1263,  1271,  1279,
      -    1280,  1285,  1286,  1287,  1292,  1305,  1305,  1305,  1305,  1305,
      -    1305,  1305,  1308,  1312,  1316,  1323,  1328,  1336,  1366,  1391,
      -    1396,  1406,  1416,  1420,  1430,  1437,  1446,  1453,  1458,  1463,
      -    1470,  1471,  1478,  1485,  1493,  1499,  1511,  1539,  1555,  1582,
      -    1610,  1636,  1656,  1682,  1702,  1714,  1721,  1787,  1797,  1807,
      -    1813,  1823,  1829,  1839,  1844,  1849,  1862,  1874,  1896,  1904,
      -    1910,  1921,  1926,  1931,  1937,  1943,  1952,  1956,  1964,  1964,
      -    1967,  1967,  1970,  1982,  2003,  2008,  2016,  2017,  2021,  2021,
      -    2025,  2025,  2028,  2031,  2055,  2066,  2066,  2077,  2076,  2086,
      -    2085,  2096,  2136,  2139,  2145,  2155,  2159,  2164,  2166,  2171,
      -    2176,  2185,  2195,  2206,  2210,  2219,  2228,  2233,  2367,  2367,
      -    2369,  2378,  2378,  2380,  2385,  2397,  2401,  2406,  2410,  2414,
      -    2418,  2422,  2426,  2430,  2434,  2438,  2463,  2467,  2477,  2481,
      -    2485,  2490,  2497,  2497,  2503,  2512,  2516,  2525,  2534,  2543,
      -    2547,  2554,  2558,  2562,  2567,  2577,  2596,  2605,  2689,  2693,
      -    2700,  2711,  2724,  2734,  2745,  2755,  2766,  2774,  2784,  2791,
      -    2794,  2795,  2802,  2806,  2811,  2827,  2844,  2858,  2872,  2884,
      -    2892,  2899,  2905,  2911,  2917,  2932,  3023,  3028,  3032,  3039,
      -    3046,  3054,  3061,  3069,  3077,  3091,  3108
      +static const short yydefgoto[] = {   259,
      +   260,   261,   286,   303,   158,   159,    76,   521,    12,    77,
      +    14,    15,    39,    40,    41,    45,    51,   115,   125,   330,
      +   224,   408,   333,   593,   574,   385,   433,   555,   362,   434,
      +    78,   160,   134,   150,   135,   136,   107,   350,   374,   351,
      +   118,    85,   151,   620,    16,    17,    19,    18,   265,   519,
      +   339,   340,    60,    22,    58,    98,   437,   438,   126,   166,
      +    52,    93,    53,    46,   440,   375,    80,   377,   270,    54,
      +    89,    90,   218,   578,   129,   309,   530,   450,   219,   220,
      +   221,   222
       };
      -#endif
       
      -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
      -/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
      -   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
      -static const char *const yytname[] =
      -{
      -  "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "ESAPINTVAL",
      -  "EUAPINTVAL", "LOCALVAL_ID", "GLOBALVAL_ID", "FPVAL", "VOID", "INTTYPE",
      -  "FLOAT", "DOUBLE", "X86_FP80", "FP128", "PPC_FP128", "LABEL", "TYPE",
      -  "LOCALVAR", "GLOBALVAR", "LABELSTR", "STRINGCONSTANT",
      -  "ATSTRINGCONSTANT", "PCTSTRINGCONSTANT", "ZEROINITIALIZER", "TRUETOK",
      -  "FALSETOK", "BEGINTOK", "ENDTOK", "DECLARE", "DEFINE", "GLOBAL",
      -  "CONSTANT", "SECTION", "ALIAS", "VOLATILE", "THREAD_LOCAL", "TO",
      -  "DOTDOTDOT", "NULL_TOK", "UNDEF", "INTERNAL", "LINKONCE", "WEAK",
      -  "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE",
      -  "EXTERNAL", "TARGET", "TRIPLE", "ALIGN", "DEPLIBS", "CALL", "TAIL",
      -  "ASM_TOK", "MODULE", "SIDEEFFECT", "CC_TOK", "CCC_TOK", "FASTCC_TOK",
      -  "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT",
      -  "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB",
      -  "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR",
      -  "XOR", "SHL", "LSHR", "ASHR", "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT",
      -  "SLE", "SGE", "ULT", "UGT", "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT",
      -  "OLE", "OGE", "ORD", "UNO", "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE",
      -  "LOAD", "STORE", "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC",
      -  "FPEXT", "BITCAST", "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR",
      -  "PTRTOINT", "PHI_TOK", "SELECT", "VAARG", "EXTRACTELEMENT",
      -  "INSERTELEMENT", "SHUFFLEVECTOR", "SIGNEXT", "ZEROEXT", "NORETURN",
      -  "INREG", "SRET", "NOUNWIND", "NOALIAS", "BYVAL", "NEST", "READNONE",
      -  "READONLY", "GC", "DEFAULT", "HIDDEN", "PROTECTED", "'='", "','", "'*'",
      -  "'\\\\'", "'('", "')'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'",
      -  "'c'", "$accept", "ArithmeticOps", "LogicalOps", "CastOps",
      -  "IPredicates", "FPredicates", "IntType", "FPType", "LocalName",
      -  "OptLocalName", "OptLocalAssign", "GlobalName", "OptGlobalAssign",
      -  "GlobalAssign", "GVInternalLinkage", "GVExternalLinkage",
      -  "GVVisibilityStyle", "FunctionDeclareLinkage", "FunctionDefineLinkage",
      -  "AliasLinkage", "OptCallingConv", "ParamAttr", "OptParamAttrs",
      -  "FuncAttr", "OptFuncAttrs", "OptGC", "OptAlign", "OptCAlign",
      -  "SectionString", "OptSection", "GlobalVarAttributes",
      -  "GlobalVarAttribute", "PrimType", "Types", "ArgType", "ResultTypes",
      -  "ArgTypeList", "ArgTypeListI", "TypeListI", "ConstVal", "ConstExpr",
      -  "ConstVector", "GlobalType", "ThreadLocal", "AliaseeRef", "Module",
      -  "DefinitionList", "Definition", "@1", "@2", "@3", "@4", "@5", "AsmBlock",
      -  "TargetDefinition", "LibrariesDefinition", "LibList", "ArgListH",
      -  "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", "END",
      -  "Function", "FunctionProto", "OptSideEffect", "ConstValueRef",
      -  "SymbolicValueRef", "ValueRef", "ResolvedVal", "BasicBlockList",
      -  "BasicBlock", "InstructionList", "BBTerminatorInst", "JumpTable", "Inst",
      -  "PHIList", "ParamList", "IndexList", "OptTailCall", "InstVal",
      -  "OptVolatile", "MemoryInst", 0
      +static const short yypact[] = {    37,
      +-32768,-32768,-32768,-32768,-32768,-32768,-32768,    20,  -137,    -8,
      +   -61,    79,   -48,   496,-32768,  1067,-32768,    36,    61,   -26,
      +    15,-32768,     2,   151,-32768,  1438,-32768,-32768,-32768,-32768,
      +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   142,   142,
      +   161,-32768,-32768,-32768,   142,-32768,-32768,-32768,-32768,-32768,
      +   142,   185,-32768,     1,   188,   202,   221,-32768,-32768,-32768,
      +-32768,-32768,    77,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
      +-32768,   248,   252,     3,   505,-32768,-32768,-32768,    75,-32768,
      +   228,   228,   158,-32768,    83,   469,   469,-32768,-32768,   101,
      +-32768,-32768,-32768,-32768,-32768,-32768,-32768,  -106,  1280,-32768,
      +   119,   128,   566,    77,-32768,    75,  -115,   129,-32768,  1280,
      +    83,    83,-32768,-32768,  1320,-32768,-32768,  1495,   288,-32768,
      +-32768,-32768,-32768,-32768,  1553,-32768,    -5,  1763,-32768,   271,
      +-32768,-32768,    75,-32768,   146,   144,  1593,  1593,   139,   -89,
      +  1593,-32768,   298,   152,  1495,  1593,    77,   155,    75,   296,
      +-32768,    38,   301,   308,   313,   314,   316,   233,   318,   894,
      +   251,-32768,   230,-32768,-32768,-32768,-32768,-32768,   273,  1611,
      +    59,   319,   469,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
      +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
      +   317,   823,  1593,  1593,  1593,  1593,-32768,-32768,-32768,-32768,
      +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,  1593,  1593,
      +  1593,  1593,  1593,  1593,  1593,  1593,  1593,-32768,   469,-32768,
      +    -4,-32768,-32768,   262,  1340,-32768,    26,   -34,-32768,   171,
      +    75,   178,-32768,-32768,    75,  1320,-32768,-32768,-32768,-32768,
      +-32768,-32768,-32768,-32768,-32768,-32768,-32768,   317,   823,   181,
      +   189,   196,   197,   198,   125,  1651,   805,   332,   206,   207,
      +   211,-32768,-32768,   212,   187,   213,-32768,    77,   756,-32768,
      +  1055,  1055,-32768,  1055,  1553,-32768,-32768,-32768,-32768,-32768,
      +-32768,-32768,-32768,-32768,-32768,  1593,-32768,-32768,-32768,-32768,
      +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
      +-32768,-32768,  1593,    89,   121,-32768,   756,    73,   190,   210,
      +   222,   226,   235,   238,   756,   756,   334,  1553,  1593,  1593,
      +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
      +-32768,-32768,   208,-32768,-32768,-32768,   239,   208,   187,   187,
      +   352,   240,   246,  1495,  1495,  1495,  1495,  1495,-32768,-32768,
      +  -105,   845,  -111,-32768,   -85,-32768,  1495,  1495,  1495,   388,
      +     5,-32768,  1380,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
      +-32768,   342,  1495,-32768,-32768,-32768,-32768,   255,-32768,   268,
      +  1055,   756,   756,    10,-32768,    18,-32768,-32768,  1055,   266,
      +  1593,  1593,  1593,  1593,  1593,   272,   277,  1593,  1055,   756,
      +   278,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
      +-32768,  1593,  1495,  1495,-32768,   279,   280,   282,   285,  1495,
      +-32768,   264,   894,   -77,-32768,-32768,   291,   295,   411,   297,
      +   428,   448,-32768,   187,-32768,    75,   303,   304,-32768,   433,
      +   -82,   439,   440,   307,   310,   311,  1055,   460,  1055,   315,
      +   321,  1055,   322,    75,-32768,   326,   327,  1055,  1055,    75,
      +   328,   329,  1593,    29,   333,   335,   103,  1495,  1495,  1495,
      +  1495,-32768,-32768,   309,  1495,  1495,  1593,-32768,-32768,-32768,
      +-32768,   302,  1398,-32768,   336,-32768,  1055,  1055,  1669,  1055,
      +  1055,   329,-32768,   329,  1593,  1055,   339,  1593,  1593,  1593,
      +-32768,-32768,  1669,   414,-32768,   756,-32768,  1495,  1495,-32768,
      +   340,   331,   344,   347,-32768,   345,   348,    67,   187,-32768,
      +-32768,-32768,    75,    78,   446,   350,   349,    96,    75,   110,
      +-32768,-32768,-32768,-32768,-32768,   312,  1055,-32768,-32768,-32768,
      +   124,   329,   353,   354,  1495,-32768,  1495,  1495,-32768,-32768,
      +-32768,-32768,   302,-32768,   430,-32768,   487,    -3,   615,   615,
      +  1709,-32768,-32768,   351,-32768,-32768,-32768,-32768,   360,   369,
      +   372,-32768,   532,   399,  1055,-32768,  1190,     8,   394,   395,
      +-32768,-32768,    96,    75,   123,-32768,   208,-32768,-32768,-32768,
      +-32768,   527,-32768,-32768,   400,-32768,  1190,   262,   262,   615,
      +   615,   533,-32768,   535,   404,-32768,-32768,  1055,  1055,   539,
      +   262,   262,   485,-32768,  1055,   542,-32768,  1055,-32768,   561,
      +   562,-32768
       };
      -#endif
       
      -# ifdef YYPRINT
      -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
      -   token YYLEX-NUM.  */
      -static const yytype_uint16 yytoknum[] =
      -{
      -       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
      -     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
      -     275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
      -     285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
      -     295,   296,   297,   298,   299,   300,   301,   302,   303,   304,
      -     305,   306,   307,   308,   309,   310,   311,   312,   313,   314,
      -     315,   316,   317,   318,   319,   320,   321,   322,   323,   324,
      -     325,   326,   327,   328,   329,   330,   331,   332,   333,   334,
      -     335,   336,   337,   338,   339,   340,   341,   342,   343,   344,
      -     345,   346,   347,   348,   349,   350,   351,   352,   353,   354,
      -     355,   356,   357,   358,   359,   360,   361,   362,   363,   364,
      -     365,   366,   367,   368,   369,   370,   371,   372,   373,   374,
      -     375,   376,   377,   378,   379,   380,   381,   382,   383,   384,
      -     385,   386,   387,   388,   389,   390,   391,   392,   393,   394,
      -     395,   396,   397,   398,   399,   400,   401,   402,   403,    61,
      -      44,    42,    92,    40,    41,    91,   120,    93,    60,    62,
      -     123,   125,    99
      +static const short yypgoto[] = {   436,
      +   437,   438,   320,   323,  -171,-32768,     0,    14,   481,    17,
      +-32768,-32768,-32768,-32768,    55,-32768,-32768,-32768,  -138,-32768,
      +  -430,-32768,  -229,-32768,-32768,  -295,    51,-32768,  -325,-32768,
      +-32768,   -24,   359,  -107,-32768,   477,   488,  -113,  -157,  -245,
      +    19,   135,   356,-32768,-32768,   577,-32768,-32768,-32768,-32768,
      +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   507,-32768,
      +-32768,-32768,-32768,-32768,-32768,  -543,  -112,   111,  -186,-32768,
      +   541,-32768,-32768,-32768,-32768,-32768,    93,   182,-32768,-32768,
      +-32768,-32768
       };
      -# endif
       
      -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
      -static const yytype_uint8 yyr1[] =
      -{
      -       0,   163,   164,   164,   164,   164,   164,   164,   164,   164,
      -     164,   165,   165,   165,   165,   165,   165,   166,   166,   166,
      -     166,   166,   166,   166,   166,   166,   166,   166,   166,   167,
      -     167,   167,   167,   167,   167,   167,   167,   167,   167,   168,
      -     168,   168,   168,   168,   168,   168,   168,   168,   168,   168,
      -     168,   168,   168,   168,   168,   169,   170,   170,   170,   170,
      -     170,   171,   171,   171,   172,   172,   173,   173,   174,   174,
      -     175,   175,   176,   177,   177,   177,   177,   177,   178,   178,
      -     178,   179,   179,   179,   179,   180,   180,   180,   181,   181,
      -     181,   181,   181,   182,   182,   182,   183,   183,   183,   183,
      -     183,   183,   183,   184,   184,   184,   184,   184,   184,   184,
      -     184,   184,   185,   185,   186,   186,   186,   186,   186,   186,
      -     187,   187,   188,   188,   189,   189,   190,   190,   191,   192,
      -     192,   193,   193,   194,   194,   195,   195,   195,   195,   195,
      -     195,   195,   196,   196,   196,   196,   196,   196,   196,   196,
      -     196,   196,   196,   196,   196,   197,   198,   198,   199,   199,
      -     200,   200,   200,   200,   201,   201,   202,   202,   202,   202,
      -     202,   202,   202,   202,   202,   202,   202,   202,   202,   202,
      -     202,   202,   202,   202,   202,   202,   203,   203,   203,   203,
      -     203,   203,   203,   203,   203,   203,   204,   204,   205,   205,
      -     206,   206,   207,   207,   208,   208,   209,   209,   211,   210,
      -     212,   210,   210,   210,   210,   213,   210,   214,   210,   215,
      -     210,   210,   210,   210,   216,   217,   217,   218,   219,   219,
      -     219,   220,   220,   221,   221,   221,   221,   222,   223,   223,
      -     224,   225,   225,   226,   227,   228,   228,   229,   229,   229,
      -     229,   229,   229,   229,   229,   229,   229,   229,   230,   230,
      -     230,   230,   231,   231,   232,   233,   233,   234,   235,   235,
      -     235,   236,   236,   236,   236,   236,   236,   236,   236,   236,
      -     237,   237,   238,   239,   239,   240,   240,   240,   240,   240,
      -     241,   241,   242,   242,   243,   243,   243,   243,   243,   243,
      -     243,   243,   243,   243,   243,   243,   243,   244,   244,   245,
      -     245,   245,   245,   245,   245,   245,   245
      -};
       
      -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
      -static const yytype_uint8 yyr2[] =
      -{
      -       0,     2,     1,     1,     1,     1,     1,     1,     1,     1,
      -       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
      -       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
      -       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
      -       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
      -       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
      -       1,     1,     1,     1,     1,     0,     2,     0,     1,     1,
      -       1,     0,     2,     1,     1,     1,     1,     1,     1,     1,
      -       1,     0,     1,     1,     1,     0,     1,     1,     0,     1,
      -       1,     1,     1,     0,     1,     1,     0,     1,     1,     1,
      -       1,     1,     2,     1,     1,     1,     1,     1,     1,     1,
      -       1,     1,     0,     2,     1,     1,     1,     1,     1,     1,
      -       0,     2,     0,     2,     0,     2,     0,     3,     2,     0,
      -       1,     0,     3,     1,     2,     1,     1,     1,     1,     1,
      -       1,     1,     1,     1,     2,     1,     2,     5,     5,     5,
      -       5,     3,     2,     5,     4,     2,     1,     1,     1,     3,
      -       1,     3,     1,     0,     1,     3,     4,     3,     3,     4,
      -       4,     3,     6,     5,     2,     2,     2,     2,     2,     2,
      -       2,     2,     2,     2,     2,     2,     6,     5,     8,     6,
      -       6,     7,     7,     6,     8,     8,     3,     1,     1,     1,
      -       1,     0,     2,     6,     1,     0,     1,     2,     0,     3,
      -       0,     3,     3,     3,     3,     0,     7,     0,     8,     0,
      -       8,     5,     2,     3,     1,     3,     3,     3,     3,     1,
      -       0,     5,     3,     1,     3,     1,     0,    10,     1,     1,
      -       4,     1,     1,     2,     3,     0,     1,     1,     1,     1,
      -       1,     1,     1,     1,     1,     3,     1,     5,     1,     1,
      -       1,     1,     1,     1,     2,     2,     2,     3,     2,     0,
      -       1,     2,     2,     3,     9,     9,     8,    14,     1,     1,
      -       6,     5,     2,     6,     7,     4,     4,     6,     6,     0,
      -       0,     3,     2,     1,     5,     5,     6,     6,     4,     6,
      -       4,     4,     6,     6,     2,     8,     1,     1,     0,     3,
      -       6,     3,     6,     2,     5,     7,     4
      -};
      +#define	YYLAST		1897
       
      -/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
      -   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
      -   means the default is an error.  */
      -static const yytype_uint16 yydefact[] =
      -{
      -      71,    61,    68,    62,    69,    63,   210,   208,     0,     0,
      -       0,     0,     0,     0,    81,    70,     0,    71,   206,    85,
      -      88,     0,     0,   222,     0,     0,    66,     0,    72,    73,
      -      75,    74,    76,    78,    77,    79,    80,    82,    83,    84,
      -      81,    81,   201,     1,   207,    86,    87,    81,   211,    89,
      -      90,    91,    92,    81,   269,   209,   269,     0,     0,   230,
      -     223,   224,   212,   258,   259,   214,   135,   136,   137,   140,
      -     139,   138,   141,   142,     0,     0,     0,     0,   260,   261,
      -     143,   213,   145,   201,   201,    93,   200,     0,    96,    96,
      -     270,   266,    67,   241,   242,   243,   265,   225,   226,   229,
      -       0,   163,   146,     0,     0,     0,     0,   152,   164,     0,
      -     144,   163,     0,     0,    95,    94,     0,   198,   199,     0,
      -       0,    97,    98,    99,   100,   101,     0,   244,     0,   308,
      -     268,     0,   227,   162,   112,   158,   160,     0,     0,     0,
      -       0,     0,     0,   151,     0,     0,     0,   157,     0,   156,
      -       0,   221,   135,   136,   137,   140,   139,   138,     0,     0,
      -       0,   215,   102,     0,   238,   239,   240,   307,   293,     0,
      -       0,     0,     0,    96,   278,   279,     2,     3,     4,     5,
      -       6,     7,     8,     9,    10,    14,    15,    16,    11,    12,
      -      13,     0,     0,     0,     0,     0,     0,    17,    18,    19,
      -      20,    21,    22,    23,    24,    25,    26,    27,    28,     0,
      -       0,     0,     0,     0,     0,     0,     0,     0,   267,    96,
      -     282,     0,   306,   228,   155,     0,   120,     0,     0,   154,
      -       0,   165,   120,   217,   219,     0,   202,   183,   184,   179,
      -     181,   180,   182,   185,   178,   174,   175,     0,     0,     0,
      -       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
      -       0,   177,   176,   131,     0,   292,   272,     0,   271,     0,
      -       0,    55,     0,     0,    29,    30,    31,    32,    33,    34,
      -      35,    36,    37,    38,     0,    53,    54,    49,    50,    51,
      -      52,    39,    40,    41,    42,    43,    44,    45,    46,    47,
      -      48,     0,   126,   126,   313,     0,     0,   304,     0,     0,
      -       0,     0,     0,     0,     0,     0,     0,     0,     0,   104,
      -     106,   105,   103,   107,   108,   109,   110,   111,   113,   161,
      -     159,   148,   149,   150,   153,   147,   131,   131,     0,     0,
      -       0,     0,     0,     0,     0,     0,   167,   197,     0,     0,
      -       0,   171,     0,   168,     0,     0,     0,     0,   216,   236,
      -     247,   248,   249,   254,   250,   251,   252,   253,   245,     0,
      -     256,   263,   262,   264,     0,   273,     0,     0,     0,     0,
      -       0,   309,     0,   311,   290,     0,     0,     0,     0,     0,
      -       0,     0,     0,     0,     0,     0,     0,     0,   117,   116,
      -     114,   115,   118,   119,   121,   218,   220,     0,     0,     0,
      -     290,     0,     0,     0,     0,     0,   166,   152,   164,     0,
      -     169,   170,     0,     0,     0,     0,     0,   133,   131,   235,
      -     112,   233,     0,   246,     0,     0,     0,     0,     0,     0,
      -       0,     0,     0,     0,   316,     0,     0,     0,   300,   301,
      -       0,     0,     0,     0,   298,     0,   126,     0,     0,     0,
      -       0,     0,     0,     0,     0,     0,   196,   173,     0,     0,
      -       0,     0,   128,   134,   132,    65,     0,   120,     0,   255,
      -       0,     0,   289,     0,     0,   126,   127,   126,     0,     0,
      -       0,     0,     0,     0,   294,   295,   289,     0,   314,     0,
      -     203,     0,     0,   187,     0,     0,     0,     0,   172,     0,
      -       0,     0,    64,   232,   234,   112,   129,     0,     0,     0,
      -     112,   112,     0,   296,   297,   310,   312,   291,     0,     0,
      -     299,   302,   303,     0,   126,     0,     0,     0,   193,     0,
      -       0,   189,   190,   186,    65,   130,   124,   257,     0,     0,
      -       0,     0,     0,   120,   283,     0,   120,   315,   191,   192,
      -       0,     0,     0,   231,     0,   122,     0,   276,     0,     0,
      -     104,   106,   112,   112,   112,   112,     0,   284,   305,   188,
      -     194,   195,   125,     0,   237,   274,     0,   275,     0,   286,
      -     285,     0,     0,     0,   123,     0,     0,   112,   112,     0,
      -       0,     0,   288,   287,     0,   281,     0,     0,   280,     0,
      -     277
      -};
       
      -/* YYDEFGOTO[NTERM-NUM].  */
      -static const yytype_int16 yydefgoto[] =
      -{
      -      -1,   258,   259,   260,   284,   301,   158,   159,    78,   513,
      -      12,    79,    14,    15,    40,    41,    42,    47,    53,   116,
      -     126,   328,   224,   404,   331,   584,   565,   381,   427,   546,
      -     358,   428,    80,   160,   135,   150,   136,   137,   109,   347,
      -     370,   348,   119,    87,   151,    16,    17,    18,    20,    19,
      -     263,   336,   337,    62,    23,    60,   100,   431,   432,   127,
      -     166,    54,    95,    55,    48,   434,   371,    82,   373,   268,
      -      56,    91,    92,   218,   569,   130,   307,   522,   444,   219,
      -     220,   221,   222
      +static const short yytable[] = {    11,
      +   274,    79,   262,   338,   161,   482,   102,   273,   306,   387,
      +   353,   355,    23,   410,   411,    11,    13,   163,   273,   108,
      +   447,    88,   164,   310,   311,   312,   313,   314,   449,    91,
      +   317,   234,    13,   595,   275,   141,  -205,   237,   431,   420,
      +   -54,   -54,   -54,   -54,   130,   420,   142,   263,   425,    24,
      +   106,   131,   421,   605,   -66,     1,     2,   432,     3,     4,
      +     5,   141,   448,   238,   239,   420,     6,     7,   420,   271,
      +   448,    20,   230,   420,   133,   272,   426,   486,   106,   108,
      +   318,    43,   108,    44,   474,   133,    21,     8,    25,    11,
      +   149,     9,   553,    81,    82,    10,    26,   559,   560,    86,
      +   149,    27,    47,    48,    49,    87,   424,    50,   481,   319,
      +   320,   431,   227,   228,   116,   117,   231,   109,   110,     1,
      +   108,   235,     3,    55,     5,   335,   108,   441,   108,   145,
      +   146,    61,    62,   401,   104,   152,   153,   154,   155,   156,
      +   157,    70,   108,     1,     2,   269,     3,     4,     5,  -140,
      +   598,   599,   600,   601,   576,   165,   376,    57,   376,   376,
      +   602,   376,    92,   103,    56,   596,   505,   381,   304,   305,
      +   269,   307,    59,    71,   108,   611,   612,   109,   110,   266,
      +   109,   110,   507,   334,   308,   269,   269,   269,   269,   269,
      +   315,   316,   269,   552,   376,    83,   533,    84,   534,   113,
      +   133,   114,   376,   376,   453,    88,   455,   456,   457,    95,
      +   399,   149,   402,   403,   404,   111,   112,   405,   109,   110,
      +   551,   406,   407,    96,   109,   110,   109,   110,   389,    99,
      +   415,   416,   417,   418,   419,   240,   241,   242,   243,   384,
      +   109,   110,    97,   427,   428,   429,   566,  -140,  -140,     2,
      +   149,   100,     4,   495,   524,   101,   510,   402,   403,   404,
      +   561,   382,   405,   562,    84,   262,   406,   407,   376,   376,
      +   376,   386,   109,   110,   561,   137,   376,   565,   383,    72,
      +    73,   143,   349,    74,   138,    75,   376,   376,    36,    37,
      +    38,   162,   223,   149,   400,   269,   225,   226,   229,   465,
      +   466,   232,    61,    62,   264,   233,   472,   236,   535,   -55,
      +   263,   538,   539,   540,     1,     2,   -56,     3,     4,     5,
      +     1,   -59,   -58,     3,   -57,     5,   244,   423,   267,   273,
      +   336,   337,   585,   344,   376,   587,   376,   361,   436,   376,
      +   390,   345,   402,   403,   404,   376,   376,   405,   346,   347,
      +   348,   406,   407,   356,   511,   512,   513,   514,   357,   358,
      +   391,   516,   517,   359,   360,   363,   269,   454,   269,   269,
      +   269,   398,   392,   460,   376,   376,   393,   376,   376,   321,
      +   322,   378,   379,   376,   380,   394,   577,   464,   395,   412,
      +   409,   430,   413,   376,   543,   544,   323,   324,   414,   325,
      +   326,   439,   327,   328,   329,   442,   597,   276,   277,   278,
      +   279,   280,   281,   282,   283,   284,   285,   388,   443,   321,
      +   322,   452,   458,   473,   376,   396,   397,   459,   463,   468,
      +   469,   569,   470,   570,   571,   471,   323,   324,   506,   325,
      +   326,   475,   327,   328,   329,   476,   376,   376,   477,   479,
      +   478,   480,   518,   483,   485,   487,   488,   484,   523,   489,
      +   490,   491,   376,   493,   529,   495,   448,   556,   515,   563,
      +   269,   496,   498,   269,   269,   269,   499,   500,   529,   504,
      +   503,   520,   573,   508,   546,   509,   525,   376,   376,   537,
      +   545,   444,   445,   446,   547,   376,   376,   548,   549,   451,
      +   557,   550,   376,   575,   558,   376,   567,   568,   586,   461,
      +   462,    61,    62,   588,   104,    64,    65,    66,    67,    68,
      +    69,    70,   589,     1,     2,   590,     3,     4,     5,   119,
      +   120,   121,   122,   123,   124,   591,   584,    28,    29,    30,
      +    31,    32,    33,    34,   592,    35,   -17,   -18,   603,   608,
      +   604,   609,   520,    71,   610,   615,   616,   492,   618,   494,
      +   621,   622,   497,   215,   216,   217,   572,   342,   501,   502,
      +   128,   343,    61,    62,   554,   104,    64,    65,    66,    67,
      +    68,    69,    70,   332,     1,     2,   144,     3,     4,     5,
      +   140,   341,    42,   127,    94,   541,   467,   526,   527,     0,
      +   531,   532,     0,     0,     0,     0,   536,     0,     0,     0,
      +     0,     0,     0,     0,    71,     0,   542,   364,   365,     0,
      +     0,    61,    62,   366,     0,     0,     0,     0,     0,     0,
      +     0,     0,     0,     1,     2,     0,     3,     4,     5,   367,
      +   368,   369,    36,    37,    38,     0,     0,   564,     0,     0,
      +     0,     0,     0,     0,   370,   371,     0,     0,     0,    72,
      +    73,     0,     0,    74,     0,    75,   105,     0,     0,   581,
      +   582,     0,   372,     0,     0,     0,     0,     0,     0,     0,
      +     0,     0,     0,     0,     0,   594,     0,     0,   176,   177,
      +   178,   179,   180,   181,   182,   183,   184,   185,   186,   187,
      +   188,   189,   190,   248,   249,     0,     0,     0,     0,     0,
      +   606,   607,     0,     0,     0,     0,     0,     0,   613,   614,
      +    72,    73,     0,     0,    74,   617,    75,   139,   619,     0,
      +   250,   197,   579,   580,   200,   201,   202,   203,   204,   205,
      +   206,   207,   208,     0,   251,     0,   252,   253,   254,   323,
      +   324,     0,   325,   326,     0,   327,   328,   329,   364,   365,
      +     0,     0,    61,    62,   366,     0,     0,     0,     0,     0,
      +     0,     0,     0,   373,     1,     2,     0,     3,     4,     5,
      +   367,   368,   369,     0,     0,     0,     0,     0,     0,     0,
      +     0,     0,     0,     0,     0,   370,   371,     0,     0,     0,
      +     0,     0,     0,     0,     0,     0,     0,     0,     0,   108,
      +     0,    61,    62,   372,   104,   152,   153,   154,   155,   156,
      +   157,    70,     0,     1,     2,     0,     3,     4,     5,   176,
      +   177,   178,   179,   180,   181,   182,   183,   184,   185,   186,
      +   187,   188,   189,   190,   248,   249,     0,     0,   287,   288,
      +     0,    61,    62,    71,   104,   152,   153,   154,   155,   156,
      +   157,    70,     0,     1,     2,     0,     3,     4,     5,     0,
      +     0,   250,   197,   198,   199,   200,   201,   202,   203,   204,
      +   205,   206,   207,   208,     0,   251,     0,   252,   253,   254,
      +     0,     0,     0,    71,     0,     0,     0,     0,     0,     0,
      +    61,    62,     0,     0,     0,     0,     0,   109,   110,     0,
      +     0,     0,     1,     2,   373,     3,     4,     5,   245,   289,
      +   290,   291,   292,   293,   294,   295,   296,   297,   298,   299,
      +   300,   301,   302,   246,   247,     0,     0,     0,     0,     0,
      +     0,     0,     0,     0,     0,     0,     0,   108,     0,     0,
      +     0,     0,     0,     0,     0,     0,     0,     0,     0,    72,
      +    73,     0,     0,    74,     0,    75,   354,   176,   177,   178,
      +   179,   180,   181,   182,   183,   184,   185,   186,   187,   188,
      +   189,   190,   248,   249,     0,     0,     0,     0,     0,     0,
      +     0,     0,     0,     0,     0,     0,     0,     0,     0,    72,
      +    73,     0,     0,    74,     0,    75,   422,     0,     0,   250,
      +   197,   198,   199,   200,   201,   202,   203,   204,   205,   206,
      +   207,   208,     0,   251,     0,   252,   253,   254,     0,     0,
      +     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
      +     0,     0,     0,     0,     0,   109,   110,     0,     0,   255,
      +     0,     0,   256,     0,   257,     0,   258,   364,   365,     0,
      +     0,    61,    62,   366,     0,     0,  -204,     0,     0,     0,
      +     0,     0,     0,     1,     2,     0,     3,     4,     5,   367,
      +   368,   369,     0,     0,   -66,     1,     2,     0,     3,     4,
      +     5,     0,     0,     0,   370,   371,     6,     7,     0,     0,
      +     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
      +     0,     0,   372,     0,     0,     0,     0,     8,     0,     0,
      +     0,     9,     0,     0,     0,    10,     0,     0,   176,   177,
      +   178,   179,   180,   181,   182,   183,   184,   185,   186,   187,
      +   188,   189,   190,   248,   249,     0,     0,     0,     0,     0,
      +     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
      +     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
      +   250,   197,   198,   199,   200,   201,   202,   203,   204,   205,
      +   206,   207,   208,     0,   251,     0,   252,   253,   254,     0,
      +     0,     0,   364,   365,     0,     0,     0,     0,   366,     0,
      +     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
      +     0,     0,     0,   373,   367,   368,   369,     0,     0,     0,
      +     0,     0,     0,     0,     0,     0,     0,     0,     0,   370,
      +   371,     0,     0,     0,     0,     0,     0,     0,     0,     0,
      +     0,     0,     0,     0,     0,     0,     0,   372,     0,     0,
      +     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
      +     0,     0,     0,   176,   177,   178,   179,   180,   181,   182,
      +   183,   184,   185,   186,   187,   188,   189,   190,   248,   249,
      +     0,     0,     0,     0,     0,     0,    61,    62,     0,   104,
      +    64,    65,    66,    67,    68,    69,    70,     0,     1,     2,
      +     0,     3,     4,     5,     0,   250,   197,   198,   199,   200,
      +   201,   202,   203,   204,   205,   206,   207,   208,   132,   251,
      +     0,   252,   253,   254,     0,     0,    61,    62,    71,   147,
      +    64,    65,    66,    67,    68,    69,    70,     0,     1,     2,
      +     0,     3,     4,     5,     0,     0,    61,    62,   373,   104,
      +    64,    65,    66,    67,    68,    69,    70,     0,     1,     2,
      +     0,     3,     4,     5,     0,     0,     0,     0,    71,     0,
      +     0,     0,     0,     0,     0,     0,     0,     0,   331,     0,
      +     0,     0,     0,     0,     0,     0,    61,    62,    71,   104,
      +    64,    65,    66,    67,    68,    69,    70,     0,     1,     2,
      +     0,     3,     4,     5,    61,    62,     0,   104,    64,    65,
      +    66,    67,    68,    69,    70,     0,     1,     2,   435,     3,
      +     4,     5,     0,     0,     0,     0,     0,     0,    71,     0,
      +     0,     0,     0,     0,    72,    73,   522,     0,    74,     0,
      +    75,   148,     0,     0,    61,    62,    71,    63,    64,    65,
      +    66,    67,    68,    69,    70,     0,     1,     2,     0,     3,
      +     4,     5,     0,     0,     0,     0,     0,     0,     0,     0,
      +     0,     0,     0,     0,    72,    73,     0,     0,    74,     0,
      +    75,     0,     0,     0,     0,     0,    71,     0,     0,     0,
      +     0,     0,     0,     0,    72,    73,     0,     0,    74,     0,
      +    75,    61,    62,     0,   104,   152,   153,   154,   155,   156,
      +   157,    70,     0,     1,     2,     0,     3,     4,     5,     0,
      +     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
      +     0,     0,     0,     0,    72,    73,     0,     0,    74,     0,
      +    75,     0,     0,    71,     0,     0,     0,     0,     0,     0,
      +     0,     0,    72,    73,     0,     0,    74,     0,    75,    61,
      +    62,     0,   147,    64,    65,    66,    67,    68,    69,    70,
      +     0,     1,     2,     0,     3,     4,     5,     0,     0,     0,
      +     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
      +     0,     0,    72,    73,     0,     0,    74,     0,    75,    61,
      +    62,    71,   104,    64,    65,    66,    67,    68,    69,    70,
      +     0,     1,     2,     0,     3,     4,     5,    61,    62,     0,
      +   268,    64,    65,    66,    67,    68,    69,    70,     0,     1,
      +     2,     0,     3,     4,     5,     0,     0,     0,     0,     0,
      +     0,    71,     0,     0,     0,     0,     0,     0,     0,    72,
      +    73,     0,     0,    74,     0,    75,     0,    61,    62,    71,
      +   104,   152,   153,   154,   155,   156,   157,    70,     0,     1,
      +     2,     0,     3,     4,     5,    61,    62,     0,   104,    64,
      +    65,    66,    67,    68,    69,   528,     0,     1,     2,     0,
      +     3,     4,     5,     0,     0,     0,     0,     0,     0,    71,
      +     0,     0,     0,     0,     0,     0,     0,    72,    73,     0,
      +     0,    74,     0,    75,     0,    61,    62,    71,   104,    64,
      +    65,    66,    67,    68,    69,   583,     0,     1,     2,     0,
      +     3,     4,     5,     0,     0,     0,     0,     0,     0,     0,
      +     0,     0,     0,     0,     0,     0,     0,    72,    73,     0,
      +     0,    74,     0,    75,     0,     0,     0,    71,     0,     0,
      +     0,     0,     0,     0,     0,    72,    73,     0,     0,    74,
      +     0,    75,     0,     0,     0,     0,     0,     0,     0,     0,
      +     0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
      +     0,     0,     0,     0,     0,     0,     0,     0,   167,     0,
      +     0,     0,     0,     0,     0,    72,    73,     0,     0,    74,
      +     0,   352,     0,     0,     0,     0,     0,     0,   168,   169,
      +     0,     0,     0,    72,    73,     0,     0,    74,     0,    75,
      +   170,   171,   172,   173,   174,   175,   176,   177,   178,   179,
      +   180,   181,   182,   183,   184,   185,   186,   187,   188,   189,
      +   190,   191,   192,     0,     0,     0,     0,     0,     0,     0,
      +     0,     0,     0,    72,    73,     0,     0,    74,     0,    75,
      +     0,     0,     0,   193,   194,   195,     0,     0,   196,   197,
      +   198,   199,   200,   201,   202,   203,   204,   205,   206,   207,
      +   208,   209,   210,   211,   212,   213,   214
       };
       
      -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
      -   STATE-NUM.  */
      -#define YYPACT_NINF -541
      -static const yytype_int16 yypact[] =
      -{
      -     658,  -541,  -541,  -541,  -541,  -541,  -541,  -541,   -12,  -135,
      -     -38,  -125,   106,   -69,    26,  -541,    29,  1762,  -541,    14,
      -      88,    43,    49,  -541,    45,   127,  -541,  1344,  -541,  -541,
      -    -541,  -541,  -541,  -541,  -541,  -541,  -541,  -541,  -541,  -541,
      -     131,   131,    73,  -541,  -541,  -541,  -541,   131,  -541,  -541,
      -    -541,  -541,  -541,   131,   201,  -541,   -11,   135,   215,   216,
      -    -541,  -541,  -541,  -541,  -541,    70,  -541,  -541,  -541,  -541,
      -    -541,  -541,  -541,  -541,   245,   247,     3,   553,  -541,  -541,
      -    -541,   -34,  -541,   219,   219,   110,  -541,    62,   171,   171,
      -    -541,  -541,   124,  -541,  -541,  -541,  -541,  -541,  -541,  -541,
      -     -66,  1092,  -541,   108,   114,   991,    70,  -541,   -34,  -109,
      -    -541,  1092,    62,    62,  -541,  -541,  1146,  -541,  -541,  1362,
      -     261,  -541,  -541,  -541,  -541,  -541,  1418,  -541,   -15,  1628,
      -    -541,   260,  -541,  -541,   -34,  -541,   119,   129,  1458,  1458,
      -     147,  -108,  1458,  -541,   134,  1362,  1458,    70,   142,   -34,
      -     118,  -541,    40,   306,   307,   308,   309,   310,   172,   311,
      -     805,  -541,  -541,   113,  -541,  -541,  -541,  -541,  -541,   266,
      -    1516,    72,   314,   171,  -541,  -541,  -541,  -541,  -541,  -541,
      -    -541,  -541,  -541,  -541,  -541,  -541,  -541,  -541,  -541,  -541,
      -    -541,   313,   507,  1458,  1458,  1458,  1458,  -541,  -541,  -541,
      -    -541,  -541,  -541,  -541,  -541,  -541,  -541,  -541,  -541,  1458,
      -    1458,  1458,  1458,  1458,  1458,  1458,  1458,  1458,  -541,   171,
      -    -541,    52,  -541,  -541,   -36,  1186,  -541,   -94,   -30,  -541,
      -     163,   -34,  -541,  -541,   -34,  1146,  -541,  -541,  -541,  -541,
      -    -541,  -541,  -541,  -541,  -541,  -541,  -541,   313,   507,   176,
      -     178,   184,   185,   187,  1246,  1534,  1031,   302,   190,   193,
      -     198,  -541,  -541,   202,   200,  -541,    70,   645,  -541,   782,
      -     782,  -541,   782,  1418,  -541,  -541,  -541,  -541,  -541,  -541,
      -    -541,  -541,  -541,  -541,  1458,  -541,  -541,  -541,  -541,  -541,
      -    -541,  -541,  -541,  -541,  -541,  -541,  -541,  -541,  -541,  -541,
      -    -541,  1458,   136,   146,  -541,   645,   104,   206,   207,   208,
      -     209,   210,   217,   645,   645,   328,  1418,  1458,  1458,  -541,
      -    -541,  -541,  -541,  -541,  -541,  -541,  -541,  -541,  -541,  -541,
      -    -541,   137,  -541,  -541,  -541,   137,   202,   202,   333,   221,
      -     222,  1362,  1362,  1362,  1362,  1362,  -541,  -541,   -64,  1071,
      -    -103,  -541,  -100,  -541,  1362,  1362,  1362,     2,  -541,  1264,
      -    -541,  -541,  -541,  -541,  -541,  -541,  -541,  -541,   317,  1362,
      -    -541,  -541,  -541,  -541,   227,  -541,   230,   782,   645,   645,
      -      11,  -541,    12,  -541,  -541,   782,   228,  1458,  1458,  1458,
      -    1458,  1458,   232,   234,  1458,   782,   645,   235,  -541,  -541,
      -    -541,  -541,  -541,  -541,  -541,  -541,  -541,  1458,  1362,  1362,
      -    -541,   239,   241,   243,   244,  1362,  -541,   256,   805,   -73,
      -    -541,  -541,   248,   250,   385,   404,   423,  -541,   202,  -541,
      -     -34,   278,   280,  -541,   413,   -72,   419,   420,   288,   292,
      -     293,   782,   440,   782,   296,   297,   782,   299,   -34,  -541,
      -     301,   303,   782,   782,   -34,   304,   318,  1458,   151,   319,
      -     321,   -43,  1362,  1362,  1362,  1362,  -541,  -541,   295,  1362,
      -    1362,  1458,  -541,  -541,  -541,   279,  1304,  -541,   322,  -541,
      -     782,   782,  1574,   782,   782,   318,  -541,   318,  1458,   782,
      -     323,  1458,  1458,  1458,  -541,  -541,  1574,   399,  -541,   645,
      -    -541,  1362,  1362,  -541,   324,   305,   326,   327,  -541,   325,
      -     329,   157,  -541,  -541,  -541,   -34,    81,   436,   332,   330,
      -       9,   -34,    47,  -541,  -541,  -541,  -541,  -541,   334,   782,
      -    -541,  -541,  -541,    96,   318,   336,   338,  1362,  -541,  1362,
      -    1362,  -541,  -541,  -541,   279,  -541,   407,  -541,   444,    -6,
      -     505,   505,  1614,  -541,  -541,   337,  -541,  -541,  -541,  -541,
      -     339,   342,   343,  -541,   459,   341,   782,  -541,   943,    -2,
      -     331,   348,  -541,  -541,     9,   -34,   109,  -541,   137,  -541,
      -    -541,  -541,  -541,   442,  -541,  -541,   352,  -541,   943,   -36,
      -     -36,   505,   505,   470,  -541,   486,   354,  -541,  -541,   782,
      -     782,   488,   -36,   -36,   435,  -541,   782,   490,  -541,   782,
      -    -541
      +static const short yycheck[] = {     0,
      +   172,    26,   160,   233,   118,   436,     4,    11,   195,   305,
      +   256,   257,   150,   339,   340,    16,     0,   125,    11,    54,
      +    11,    21,    28,   210,   211,   212,   213,   214,    11,    29,
      +   217,   145,    16,   577,   173,   151,     0,   150,    34,   151,
      +     3,     4,     5,     6,   151,   151,   162,   160,   160,    58,
      +    75,   158,   158,   597,    18,    19,    20,    53,    22,    23,
      +    24,   151,    53,    26,    27,   151,    30,    31,   151,    11,
      +    53,    52,   162,   151,    99,    17,   162,   160,   103,    54,
      +   219,    46,    54,    48,   162,   110,    67,    51,   150,    90,
      +   115,    55,   523,    39,    40,    59,    18,   528,   529,    45,
      +   125,   150,    42,    43,    44,    51,   352,    47,   434,   114,
      +   115,    34,   137,   138,    32,    33,   141,   152,   153,    19,
      +    54,   146,    22,   150,    24,   160,    54,   373,    54,   111,
      +   112,     7,     8,   320,    10,    11,    12,    13,    14,    15,
      +    16,    17,    54,    19,    20,   170,    22,    23,    24,    54,
      +   581,   582,   583,   584,   158,   161,   269,   156,   271,   272,
      +    38,   274,   162,   161,   150,   158,   462,   275,   193,   194,
      +   195,   196,    22,    49,    54,   606,   607,   152,   153,   163,
      +   152,   153,   154,   158,   209,   210,   211,   212,   213,   214,
      +   215,   216,   217,   519,   307,    35,   492,    37,   494,    42,
      +   225,    44,   315,   316,   391,    21,   393,   394,   395,    22,
      +   318,   236,   135,   136,   137,    81,    82,   140,   152,   153,
      +   154,   144,   145,    22,   152,   153,   152,   153,   156,   153,
      +   344,   345,   346,   347,   348,     3,     4,     5,     6,   151,
      +   152,   153,    22,   357,   358,   359,   542,   152,   153,    20,
      +   275,     4,    23,   151,   484,     4,   154,   135,   136,   137,
      +   151,   286,   140,   154,    37,   423,   144,   145,   381,   382,
      +   383,   151,   152,   153,   151,   157,   389,   154,   303,   155,
      +   156,   153,   158,   159,   157,   161,   399,   400,   147,   148,
      +   149,     4,    22,   318,   319,   320,   151,   154,   160,   413,
      +   414,     4,     7,     8,    54,   154,   420,   153,   495,     9,
      +   423,   498,   499,   500,    19,    20,     9,    22,    23,    24,
      +    19,     9,     9,    22,     9,    24,     9,   352,    56,    11,
      +   160,   154,   562,   153,   447,   565,   449,   151,   363,   452,
      +   151,   153,   135,   136,   137,   458,   459,   140,   153,   153,
      +   153,   144,   145,    22,   468,   469,   470,   471,   153,   153,
      +   151,   475,   476,   153,   153,   153,   391,   392,   393,   394,
      +   395,    38,   151,   398,   487,   488,   151,   490,   491,   118,
      +   119,   271,   272,   496,   274,   151,   558,   412,   151,    38,
      +   152,     4,   153,   506,   508,   509,   135,   136,   153,   138,
      +   139,    60,   141,   142,   143,   151,   578,    91,    92,    93,
      +    94,    95,    96,    97,    98,    99,   100,   307,   151,   118,
      +   119,   156,   151,   160,   537,   315,   316,   151,   151,   151,
      +   151,   545,   151,   547,   548,   151,   135,   136,   463,   138,
      +   139,   151,   141,   142,   143,   151,   559,   560,    38,    22,
      +   154,     4,   477,   151,    22,    17,    17,   154,   483,   153,
      +   151,   151,   575,     4,   489,   151,    53,    22,   160,   158,
      +   495,   151,   151,   498,   499,   500,   151,   151,   503,   151,
      +   153,   482,    53,   151,   154,   151,   151,   600,   601,   151,
      +   151,   381,   382,   383,   151,   608,   609,   151,   154,   389,
      +   151,   154,   615,    17,   156,   618,   154,   154,   158,   399,
      +   400,     7,     8,   154,    10,    11,    12,    13,    14,    15,
      +    16,    17,   154,    19,    20,   154,    22,    23,    24,    61,
      +    62,    63,    64,    65,    66,     4,   561,    42,    43,    44,
      +    45,    46,    47,    48,   146,    50,   153,   153,    22,    17,
      +   151,    17,   553,    49,   151,    17,    72,   447,    17,   449,
      +     0,     0,   452,   128,   128,   128,   553,   248,   458,   459,
      +    90,   249,     7,     8,   524,    10,    11,    12,    13,    14,
      +    15,    16,    17,   225,    19,    20,   110,    22,    23,    24,
      +   103,   236,    16,    87,    54,   503,   415,   487,   488,    -1,
      +   490,   491,    -1,    -1,    -1,    -1,   496,    -1,    -1,    -1,
      +    -1,    -1,    -1,    -1,    49,    -1,   506,     3,     4,    -1,
      +    -1,     7,     8,     9,    -1,    -1,    -1,    -1,    -1,    -1,
      +    -1,    -1,    -1,    19,    20,    -1,    22,    23,    24,    25,
      +    26,    27,   147,   148,   149,    -1,    -1,   537,    -1,    -1,
      +    -1,    -1,    -1,    -1,    40,    41,    -1,    -1,    -1,   155,
      +   156,    -1,    -1,   159,    -1,   161,   162,    -1,    -1,   559,
      +   560,    -1,    58,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      +    -1,    -1,    -1,    -1,    -1,   575,    -1,    -1,    74,    75,
      +    76,    77,    78,    79,    80,    81,    82,    83,    84,    85,
      +    86,    87,    88,    89,    90,    -1,    -1,    -1,    -1,    -1,
      +   600,   601,    -1,    -1,    -1,    -1,    -1,    -1,   608,   609,
      +   155,   156,    -1,    -1,   159,   615,   161,   162,   618,    -1,
      +   116,   117,   118,   119,   120,   121,   122,   123,   124,   125,
      +   126,   127,   128,    -1,   130,    -1,   132,   133,   134,   135,
      +   136,    -1,   138,   139,    -1,   141,   142,   143,     3,     4,
      +    -1,    -1,     7,     8,     9,    -1,    -1,    -1,    -1,    -1,
      +    -1,    -1,    -1,   159,    19,    20,    -1,    22,    23,    24,
      +    25,    26,    27,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      +    -1,    -1,    -1,    -1,    -1,    40,    41,    -1,    -1,    -1,
      +    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    54,
      +    -1,     7,     8,    58,    10,    11,    12,    13,    14,    15,
      +    16,    17,    -1,    19,    20,    -1,    22,    23,    24,    74,
      +    75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
      +    85,    86,    87,    88,    89,    90,    -1,    -1,    26,    27,
      +    -1,     7,     8,    49,    10,    11,    12,    13,    14,    15,
      +    16,    17,    -1,    19,    20,    -1,    22,    23,    24,    -1,
      +    -1,   116,   117,   118,   119,   120,   121,   122,   123,   124,
      +   125,   126,   127,   128,    -1,   130,    -1,   132,   133,   134,
      +    -1,    -1,    -1,    49,    -1,    -1,    -1,    -1,    -1,    -1,
      +     7,     8,    -1,    -1,    -1,    -1,    -1,   152,   153,    -1,
      +    -1,    -1,    19,    20,   159,    22,    23,    24,    25,    97,
      +    98,    99,   100,   101,   102,   103,   104,   105,   106,   107,
      +   108,   109,   110,    40,    41,    -1,    -1,    -1,    -1,    -1,
      +    -1,    -1,    -1,    -1,    -1,    -1,    -1,    54,    -1,    -1,
      +    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   155,
      +   156,    -1,    -1,   159,    -1,   161,   162,    74,    75,    76,
      +    77,    78,    79,    80,    81,    82,    83,    84,    85,    86,
      +    87,    88,    89,    90,    -1,    -1,    -1,    -1,    -1,    -1,
      +    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   155,
      +   156,    -1,    -1,   159,    -1,   161,   162,    -1,    -1,   116,
      +   117,   118,   119,   120,   121,   122,   123,   124,   125,   126,
      +   127,   128,    -1,   130,    -1,   132,   133,   134,    -1,    -1,
      +    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      +    -1,    -1,    -1,    -1,    -1,   152,   153,    -1,    -1,   156,
      +    -1,    -1,   159,    -1,   161,    -1,   163,     3,     4,    -1,
      +    -1,     7,     8,     9,    -1,    -1,     0,    -1,    -1,    -1,
      +    -1,    -1,    -1,    19,    20,    -1,    22,    23,    24,    25,
      +    26,    27,    -1,    -1,    18,    19,    20,    -1,    22,    23,
      +    24,    -1,    -1,    -1,    40,    41,    30,    31,    -1,    -1,
      +    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      +    -1,    -1,    58,    -1,    -1,    -1,    -1,    51,    -1,    -1,
      +    -1,    55,    -1,    -1,    -1,    59,    -1,    -1,    74,    75,
      +    76,    77,    78,    79,    80,    81,    82,    83,    84,    85,
      +    86,    87,    88,    89,    90,    -1,    -1,    -1,    -1,    -1,
      +    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      +    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      +   116,   117,   118,   119,   120,   121,   122,   123,   124,   125,
      +   126,   127,   128,    -1,   130,    -1,   132,   133,   134,    -1,
      +    -1,    -1,     3,     4,    -1,    -1,    -1,    -1,     9,    -1,
      +    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      +    -1,    -1,    -1,   159,    25,    26,    27,    -1,    -1,    -1,
      +    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    40,
      +    41,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      +    -1,    -1,    -1,    -1,    -1,    -1,    -1,    58,    -1,    -1,
      +    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      +    -1,    -1,    -1,    74,    75,    76,    77,    78,    79,    80,
      +    81,    82,    83,    84,    85,    86,    87,    88,    89,    90,
      +    -1,    -1,    -1,    -1,    -1,    -1,     7,     8,    -1,    10,
      +    11,    12,    13,    14,    15,    16,    17,    -1,    19,    20,
      +    -1,    22,    23,    24,    -1,   116,   117,   118,   119,   120,
      +   121,   122,   123,   124,   125,   126,   127,   128,    39,   130,
      +    -1,   132,   133,   134,    -1,    -1,     7,     8,    49,    10,
      +    11,    12,    13,    14,    15,    16,    17,    -1,    19,    20,
      +    -1,    22,    23,    24,    -1,    -1,     7,     8,   159,    10,
      +    11,    12,    13,    14,    15,    16,    17,    -1,    19,    20,
      +    -1,    22,    23,    24,    -1,    -1,    -1,    -1,    49,    -1,
      +    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    39,    -1,
      +    -1,    -1,    -1,    -1,    -1,    -1,     7,     8,    49,    10,
      +    11,    12,    13,    14,    15,    16,    17,    -1,    19,    20,
      +    -1,    22,    23,    24,     7,     8,    -1,    10,    11,    12,
      +    13,    14,    15,    16,    17,    -1,    19,    20,    39,    22,
      +    23,    24,    -1,    -1,    -1,    -1,    -1,    -1,    49,    -1,
      +    -1,    -1,    -1,    -1,   155,   156,    39,    -1,   159,    -1,
      +   161,   122,    -1,    -1,     7,     8,    49,    10,    11,    12,
      +    13,    14,    15,    16,    17,    -1,    19,    20,    -1,    22,
      +    23,    24,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      +    -1,    -1,    -1,    -1,   155,   156,    -1,    -1,   159,    -1,
      +   161,    -1,    -1,    -1,    -1,    -1,    49,    -1,    -1,    -1,
      +    -1,    -1,    -1,    -1,   155,   156,    -1,    -1,   159,    -1,
      +   161,     7,     8,    -1,    10,    11,    12,    13,    14,    15,
      +    16,    17,    -1,    19,    20,    -1,    22,    23,    24,    -1,
      +    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      +    -1,    -1,    -1,    -1,   155,   156,    -1,    -1,   159,    -1,
      +   161,    -1,    -1,    49,    -1,    -1,    -1,    -1,    -1,    -1,
      +    -1,    -1,   155,   156,    -1,    -1,   159,    -1,   161,     7,
      +     8,    -1,    10,    11,    12,    13,    14,    15,    16,    17,
      +    -1,    19,    20,    -1,    22,    23,    24,    -1,    -1,    -1,
      +    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      +    -1,    -1,   155,   156,    -1,    -1,   159,    -1,   161,     7,
      +     8,    49,    10,    11,    12,    13,    14,    15,    16,    17,
      +    -1,    19,    20,    -1,    22,    23,    24,     7,     8,    -1,
      +    10,    11,    12,    13,    14,    15,    16,    17,    -1,    19,
      +    20,    -1,    22,    23,    24,    -1,    -1,    -1,    -1,    -1,
      +    -1,    49,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   155,
      +   156,    -1,    -1,   159,    -1,   161,    -1,     7,     8,    49,
      +    10,    11,    12,    13,    14,    15,    16,    17,    -1,    19,
      +    20,    -1,    22,    23,    24,     7,     8,    -1,    10,    11,
      +    12,    13,    14,    15,    16,    17,    -1,    19,    20,    -1,
      +    22,    23,    24,    -1,    -1,    -1,    -1,    -1,    -1,    49,
      +    -1,    -1,    -1,    -1,    -1,    -1,    -1,   155,   156,    -1,
      +    -1,   159,    -1,   161,    -1,     7,     8,    49,    10,    11,
      +    12,    13,    14,    15,    16,    17,    -1,    19,    20,    -1,
      +    22,    23,    24,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      +    -1,    -1,    -1,    -1,    -1,    -1,    -1,   155,   156,    -1,
      +    -1,   159,    -1,   161,    -1,    -1,    -1,    49,    -1,    -1,
      +    -1,    -1,    -1,    -1,    -1,   155,   156,    -1,    -1,   159,
      +    -1,   161,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      +    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      +    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    36,    -1,
      +    -1,    -1,    -1,    -1,    -1,   155,   156,    -1,    -1,   159,
      +    -1,   161,    -1,    -1,    -1,    -1,    -1,    -1,    56,    57,
      +    -1,    -1,    -1,   155,   156,    -1,    -1,   159,    -1,   161,
      +    68,    69,    70,    71,    72,    73,    74,    75,    76,    77,
      +    78,    79,    80,    81,    82,    83,    84,    85,    86,    87,
      +    88,    89,    90,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      +    -1,    -1,    -1,   155,   156,    -1,    -1,   159,    -1,   161,
      +    -1,    -1,    -1,   111,   112,   113,    -1,    -1,   116,   117,
      +   118,   119,   120,   121,   122,   123,   124,   125,   126,   127,
      +   128,   129,   130,   131,   132,   133,   134
       };
      +/* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
      +#line 3 "/usr/share/bison.simple"
      +/* This file comes from bison-1.28.  */
       
      -/* YYPGOTO[NTERM-NUM].  */
      -static const yytype_int16 yypgoto[] =
      -{
      -    -541,   381,   382,   387,   270,   271,  -170,  -541,     0,   -24,
      -     426,     8,  -541,  -541,  -541,  -541,    56,  -541,  -541,  -541,
      -    -161,  -541,  -393,  -541,  -217,  -541,  -541,  -292,     5,  -541,
      -    -310,  -541,  -541,   -26,   298,  -120,  -541,   411,   430,  -115,
      -    -157,  -235,    94,   130,   312,  -541,  -541,   519,  -541,  -541,
      -    -541,  -541,  -541,  -541,  -541,  -541,  -541,  -541,  -541,   448,
      -    -541,  -541,  -541,  -541,  -541,  -541,  -540,  -111,   -51,  -179,
      -    -541,   482,  -541,  -541,  -541,  -541,  -541,    46,   133,  -541,
      -    -541,  -541,  -541
      -};
      +/* Skeleton output parser for bison,
      +   Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
       
      -/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
      -   positive, shift that token.  If negative, reduce the rule which
      -   number is the opposite.  If zero, do what YYDEFACT says.
      -   If YYTABLE_NINF, syntax error.  */
      -#define YYTABLE_NINF -206
      -static const yytype_int16 yytable[] =
      -{
      -      11,    81,   272,   261,   161,   271,   163,   104,    13,   271,
      -      90,   383,   273,   164,    24,   335,   304,    11,    93,    25,
      -     350,   352,   441,   443,    26,    13,   405,   406,   586,    43,
      -     233,   308,   309,   310,   311,   312,   425,   475,   315,   236,
      -      21,   142,   142,   -55,   -55,   -55,   -55,   415,   596,   262,
      -     415,   108,   143,   230,    22,   426,   420,   110,   316,   111,
      -      45,   421,    46,   332,   442,   442,   237,   238,    29,    30,
      -      31,    32,    33,    34,    35,   134,    36,   415,   415,   108,
      -      28,   319,   320,   269,   131,   134,   415,   479,   468,   270,
      -     149,   132,    11,   416,   117,   118,    83,    84,   321,   322,
      -     149,   323,   324,    88,   325,   326,   327,   488,    85,    89,
      -      86,   503,   227,   228,   419,   425,   231,   110,   474,   111,
      -     234,   110,   544,   111,    27,    63,    64,   550,   551,   333,
      -      49,    50,    51,     2,   435,    52,     4,     1,     2,   397,
      -       3,     4,     5,     1,   267,   165,     3,   593,     5,    61,
      -      94,   567,   114,   377,   115,   587,   372,    97,   372,   372,
      -    -141,   372,  -141,   105,   498,   317,   318,   302,   303,   267,
      -     305,   264,    37,    38,    39,   239,   240,   241,   242,   589,
      -     590,   591,   592,   306,   267,   267,   267,   267,   267,   313,
      -     314,   267,    57,   525,   372,   526,   395,   552,    58,   134,
      -      59,   553,   372,   372,   602,   603,   145,   146,   447,   149,
      -     449,   450,   451,   112,   113,   398,   399,   400,   374,   375,
      -     401,   376,    90,   101,   402,   403,   410,   411,   412,   413,
      -     414,   120,   121,   122,   123,   124,   125,    98,    99,   422,
      -     423,   424,   557,   398,   399,   400,   552,   149,   401,   102,
      -     556,   103,   402,   403,   384,   110,    86,   111,   378,   385,
      -     516,   261,   392,   393,   138,   162,   372,   372,   372,   225,
      -     139,   398,   399,   400,   372,   379,   401,    37,    38,    39,
      -     402,   403,   223,   226,   372,   372,   380,   110,   232,   111,
      -     149,   396,   267,   459,   460,   235,   382,   110,     1,   111,
      -     466,     3,   110,     5,   111,   500,   229,   262,   110,   527,
      -     111,   543,   530,   531,   532,   -56,   -57,   -60,   -59,   -58,
      -     243,   265,   334,   418,   353,   271,   438,   439,   440,   341,
      -     372,   342,   372,   430,   445,   372,   576,   343,   344,   578,
      -     345,   372,   372,   354,   455,   456,   355,   504,   505,   506,
      -     507,   356,   357,   359,   509,   510,   386,   387,   388,   389,
      -     390,   267,   448,   267,   267,   267,   394,   391,   454,   372,
      -     372,   407,   372,   372,   408,   409,   433,   436,   372,   568,
      -     437,   458,   452,   446,   453,   457,   535,   536,   372,   462,
      -     485,   463,   487,   464,   465,   490,   319,   320,   469,   588,
      -     470,   494,   495,   274,   275,   276,   277,   278,   279,   280,
      -     281,   282,   283,   321,   322,   467,   323,   324,   372,   325,
      -     326,   327,   560,   471,   561,   562,   472,   473,   476,   518,
      -     519,   499,   523,   524,   477,   478,   480,   481,   528,   372,
      -     372,   482,   483,   484,   486,   511,   488,   489,   534,   491,
      -     515,   492,   442,   493,   508,   372,   521,   496,   547,   538,
      -     564,   566,   267,   582,   594,   267,   267,   267,   497,   501,
      -     521,   502,   517,   529,   537,   512,   539,   540,   555,   541,
      -     372,   372,   548,   542,   -18,   549,   583,   599,   372,   372,
      -     558,   554,   559,   579,   577,   372,   580,   581,   372,   572,
      -     573,   -19,   595,   600,   601,   606,   607,   609,   360,   361,
      -     215,   216,    63,    64,   362,   585,   217,   339,   129,   340,
      -     563,   545,   144,   330,     1,     2,   575,     3,     4,     5,
      -     363,   364,   365,   285,   286,   141,    44,   128,    96,     0,
      -     597,   598,   533,   461,   512,   366,   367,   338,   604,   605,
      -       0,     0,     0,     0,     0,   608,     0,     0,   610,     0,
      -      63,    64,   368,   106,    66,    67,    68,    69,    70,    71,
      -      72,     0,     1,     2,     0,     3,     4,     5,   176,   177,
      -     178,   179,   180,   181,   182,   183,   184,   185,   186,   187,
      -     188,   189,   190,   247,   248,     0,     0,     0,     0,     0,
      -       0,     0,    73,   287,   288,   289,   290,   291,   292,   293,
      -     294,   295,   296,   297,   298,   299,   300,     0,     0,     0,
      -     249,   197,   570,   571,   200,   201,   202,   203,   204,   205,
      -     206,   207,   208,     0,   250,     0,   251,   252,   253,   321,
      -     322,     0,   323,   324,     0,   325,   326,   327,   360,   361,
      -       0,     0,    63,    64,   362,     0,     0,     0,  -205,     0,
      -       0,     0,     0,   369,     1,     2,     0,     3,     4,     5,
      -     363,   364,   365,     0,     0,     0,   -67,     1,     2,     0,
      -       3,     4,     5,     0,     0,   366,   367,     0,     6,     7,
      -       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
      -       0,     0,   368,     0,     0,    74,     0,     0,    75,     8,
      -       0,    76,     9,    77,   107,     0,    10,     0,   176,   177,
      -     178,   179,   180,   181,   182,   183,   184,   185,   186,   187,
      -     188,   189,   190,   247,   248,     0,     0,     0,     0,     0,
      -       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
      -       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
      -     249,   197,   198,   199,   200,   201,   202,   203,   204,   205,
      -     206,   207,   208,     0,   250,     0,   251,   252,   253,     0,
      -       0,     0,     0,     0,     0,   360,   361,     0,     0,    63,
      -      64,   362,     0,     0,     0,     0,   110,     0,   111,     0,
      -       0,     1,     2,   369,     3,     4,     5,   363,   364,   365,
      -       0,     0,    63,    64,     0,     0,     0,     0,     0,     0,
      -       0,     0,   366,   367,     1,     2,     0,     3,     4,     5,
      -     244,     0,     0,     0,     0,     0,     0,     0,     0,   368,
      -       0,     0,     0,     0,     0,   245,   246,     0,     0,     0,
      -       0,     0,     0,     0,     0,   176,   177,   178,   179,   180,
      -     181,   182,   183,   184,   185,   186,   187,   188,   189,   190,
      -     247,   248,     0,     0,     0,     0,     0,     0,   176,   177,
      -     178,   179,   180,   181,   182,   183,   184,   185,   186,   187,
      -     188,   189,   190,   247,   248,     0,     0,   249,   197,   198,
      -     199,   200,   201,   202,   203,   204,   205,   206,   207,   208,
      -       0,   250,     0,   251,   252,   253,     0,     0,     0,     0,
      -     249,   197,   198,   199,   200,   201,   202,   203,   204,   205,
      -     206,   207,   208,     0,   250,     0,   251,   252,   253,     0,
      -     369,     0,     0,     0,     0,     0,   360,   361,     0,     0,
      -       0,     0,   362,     0,     0,     0,   110,     0,   111,     0,
      -     254,     0,     0,   255,     0,   256,     0,   257,   363,   364,
      -     365,     0,     0,     0,     0,     0,     0,     0,     0,     0,
      -       0,     0,     0,   366,   367,     0,     0,     0,     0,     0,
      -       0,     0,     0,     0,     0,     0,     0,     0,    63,    64,
      -     368,   106,    66,    67,    68,    69,    70,    71,    72,     0,
      -       1,     2,     0,     3,     4,     5,   176,   177,   178,   179,
      -     180,   181,   182,   183,   184,   185,   186,   187,   188,   189,
      -     190,   247,   248,     0,     0,     0,     0,     0,    63,    64,
      -      73,   106,   152,   153,   154,   155,   156,   157,    72,     0,
      -       1,     2,     0,     3,     4,     5,     0,     0,   249,   197,
      -     198,   199,   200,   201,   202,   203,   204,   205,   206,   207,
      -     208,     0,   250,     0,   251,   252,   253,     0,    63,    64,
      -      73,   106,   152,   153,   154,   155,   156,   157,    72,     0,
      -       1,     2,     0,     3,     4,     5,     0,     0,     0,    63,
      -      64,   369,   106,    66,    67,    68,    69,    70,    71,    72,
      -       0,     1,     2,     0,     3,     4,     5,     0,     0,     0,
      -      73,     0,     0,     0,     0,     0,     0,     0,     0,     0,
      -       0,   133,     0,     0,     0,     0,     0,     0,     0,     0,
      -       0,    73,     0,    74,     0,     0,    75,     0,     0,    76,
      -       0,    77,   140,    63,    64,     0,   147,    66,    67,    68,
      -      69,    70,    71,    72,     0,     1,     2,     0,     3,     4,
      -       5,     0,     0,     0,     0,     0,     0,     0,     0,     0,
      -       0,     0,     0,    74,     0,     0,    75,     0,     0,    76,
      -       0,    77,   351,    63,    64,    73,   106,    66,    67,    68,
      -      69,    70,    71,    72,     0,     1,     2,     0,     3,     4,
      -       5,     0,     0,     0,     0,     0,     0,     0,     0,     0,
      -       0,     0,     0,    74,     0,   329,    75,     0,     0,    76,
      -       0,    77,   417,     0,     0,    73,     0,     0,     0,     0,
      -       0,     0,     0,     0,    74,     0,     0,    75,     0,     0,
      -      76,     0,    77,    63,    64,     0,   106,   152,   153,   154,
      -     155,   156,   157,    72,     0,     1,     2,   148,     3,     4,
      -       5,    63,    64,     0,   106,    66,    67,    68,    69,    70,
      -      71,    72,     0,     1,     2,     0,     3,     4,     5,     0,
      -       0,     0,     0,     0,     0,    73,     0,     0,    74,     0,
      -       0,    75,     0,   429,    76,     0,    77,     0,     0,     0,
      -       0,    63,    64,    73,   106,    66,    67,    68,    69,    70,
      -      71,    72,     0,     1,     2,     0,     3,     4,     5,     0,
      -       0,     0,     0,     0,     0,     0,     0,     0,    74,     0,
      -       0,    75,     0,   514,    76,     0,    77,     0,     0,     0,
      -       0,    63,    64,    73,    65,    66,    67,    68,    69,    70,
      -      71,    72,     0,     1,     2,     0,     3,     4,     5,    63,
      -      64,     0,   106,   152,   153,   154,   155,   156,   157,    72,
      -       0,     1,     2,     0,     3,     4,     5,     0,     0,     0,
      -       0,     0,     0,    73,     0,     0,     0,     0,    74,     0,
      -       0,    75,     0,   346,    76,     0,    77,     0,     0,     0,
      -       0,    73,     0,     0,     0,     0,    74,     0,     0,    75,
      -       0,     0,    76,     0,    77,    63,    64,     0,   147,    66,
      -      67,    68,    69,    70,    71,    72,     0,     1,     2,     0,
      -       3,     4,     5,     0,     0,     0,     0,     0,     0,     0,
      -       0,     0,     0,     0,     0,     0,    74,     0,     0,    75,
      -       0,     0,    76,     0,    77,    63,    64,    73,   106,    66,
      -      67,    68,    69,    70,    71,    72,     0,     1,     2,     0,
      -       3,     4,     5,     0,     0,     0,     0,     0,     0,     0,
      -       0,     0,     0,     0,     0,     0,    74,     0,     0,    75,
      -       0,     0,    76,     0,    77,     0,     0,    73,     0,     0,
      -       0,     0,     0,     0,    74,     0,     0,    75,     0,     0,
      -      76,     0,    77,    63,    64,     0,   266,    66,    67,    68,
      -      69,    70,    71,    72,     0,     1,     2,     0,     3,     4,
      -       5,    63,    64,     0,   106,   152,   153,   154,   155,   156,
      -     157,    72,     0,     1,     2,     0,     3,     4,     5,     0,
      -       0,     0,     0,     0,     0,    73,     0,     0,     0,     0,
      -      74,     0,     0,    75,     0,     0,    76,     0,    77,     0,
      -       0,    63,    64,    73,   106,    66,    67,    68,    69,    70,
      -      71,   520,     0,     1,     2,     0,     3,     4,     5,     0,
      -       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
      -      74,     0,     0,    75,     0,     0,    76,     0,    77,     0,
      -       0,    63,    64,    73,   106,    66,    67,    68,    69,    70,
      -      71,   574,     0,     1,     2,     0,     3,     4,     5,     0,
      -       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
      -       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
      -       0,     0,     0,    73,   167,     0,     0,     0,    74,     0,
      -       0,    75,     0,     0,    76,     0,    77,     0,     0,     0,
      -       0,     0,     0,   168,   169,     0,    74,     0,     0,    75,
      -       0,     0,    76,     0,   349,   170,   171,   172,   173,   174,
      -     175,   176,   177,   178,   179,   180,   181,   182,   183,   184,
      -     185,   186,   187,   188,   189,   190,   191,   192,     0,     0,
      -       0,     0,     0,     0,     0,     0,    74,     0,     0,    75,
      -       0,     0,    76,     0,    77,     0,     0,     0,   193,   194,
      -     195,     0,     0,   196,   197,   198,   199,   200,   201,   202,
      -     203,   204,   205,   206,   207,   208,   209,   210,   211,   212,
      -     213,   214,  -204,     0,     0,     0,    74,     0,     0,    75,
      -       0,     0,    76,     0,    77,     0,     0,     0,     0,     0,
      -     -67,     1,     2,     0,     3,     4,     5,     0,     0,     0,
      -       0,     0,     6,     7,     0,     0,     0,     0,     0,     0,
      -       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
      -       0,     0,     0,     8,     0,     0,     9,     0,     0,     0,
      -      10
      -};
      +   This program is free software; you can redistribute it and/or modify
      +   it under the terms of the GNU General Public License as published by
      +   the Free Software Foundation; either version 2, or (at your option)
      +   any later version.
       
      -static const yytype_int16 yycheck[] =
      -{
      -       0,    27,   172,   160,   119,    11,   126,     4,     0,    11,
      -      21,   303,   173,    28,   149,   232,   195,    17,    29,    57,
      -     255,   256,    11,    11,   149,    17,   336,   337,   568,     0,
      -     145,   210,   211,   212,   213,   214,    34,   430,   217,   150,
      -      52,   150,   150,     3,     4,     5,     6,   150,   588,   160,
      -     150,    77,   161,   161,    66,    53,   159,   151,   219,   153,
      -      46,   161,    48,   157,    53,    53,    26,    27,    42,    43,
      -      44,    45,    46,    47,    48,   101,    50,   150,   150,   105,
      -     149,   117,   118,    11,   150,   111,   150,   159,   161,    17,
      -     116,   157,    92,   157,    32,    33,    40,    41,   134,   135,
      -     126,   137,   138,    47,   140,   141,   142,   150,    35,    53,
      -      37,   154,   138,   139,   349,    34,   142,   151,   428,   153,
      -     146,   151,   515,   153,    18,     7,     8,   520,   521,   159,
      -      42,    43,    44,    20,   369,    47,    23,    19,    20,   318,
      -      22,    23,    24,    19,   170,   160,    22,    38,    24,    22,
      -     161,   157,    42,   273,    44,   157,   267,    22,   269,   270,
      -     151,   272,   153,   160,   456,   113,   114,   193,   194,   195,
      -     196,   163,   146,   147,   148,     3,     4,     5,     6,   572,
      -     573,   574,   575,   209,   210,   211,   212,   213,   214,   215,
      -     216,   217,   149,   485,   305,   487,   316,   150,   149,   225,
      -     155,   154,   313,   314,   597,   598,   112,   113,   387,   235,
      -     389,   390,   391,    83,    84,   134,   135,   136,   269,   270,
      -     139,   272,    21,   153,   143,   144,   341,   342,   343,   344,
      -     345,    60,    61,    62,    63,    64,    65,    22,    22,   354,
      -     355,   356,   534,   134,   135,   136,   150,   273,   139,     4,
      -     154,     4,   143,   144,   305,   151,    37,   153,   284,   155,
      -     477,   418,   313,   314,   156,     4,   377,   378,   379,   150,
      -     156,   134,   135,   136,   385,   301,   139,   146,   147,   148,
      -     143,   144,    22,   154,   395,   396,   150,   151,   154,   153,
      -     316,   317,   318,   408,   409,   153,   150,   151,    19,   153,
      -     415,    22,   151,    24,   153,   154,   159,   418,   151,   488,
      -     153,   154,   491,   492,   493,     9,     9,     9,     9,     9,
      -       9,    55,   159,   349,    22,    11,   377,   378,   379,   153,
      -     441,   153,   443,   359,   385,   446,   553,   153,   153,   556,
      -     153,   452,   453,   153,   395,   396,   153,   462,   463,   464,
      -     465,   153,   150,   153,   469,   470,   150,   150,   150,   150,
      -     150,   387,   388,   389,   390,   391,    38,   150,   394,   480,
      -     481,    38,   483,   484,   153,   153,    59,   150,   489,   549,
      -     150,   407,   150,   155,   150,   150,   501,   502,   499,   150,
      -     441,   150,   443,   150,   150,   446,   117,   118,   150,   569,
      -     150,   452,   453,    90,    91,    92,    93,    94,    95,    96,
      -      97,    98,    99,   134,   135,   159,   137,   138,   529,   140,
      -     141,   142,   537,    38,   539,   540,    22,     4,   150,   480,
      -     481,   457,   483,   484,   154,    22,    17,    17,   489,   550,
      -     551,   153,   150,   150,     4,   471,   150,   150,   499,   150,
      -     476,   150,    53,   150,   159,   566,   482,   153,    22,   154,
      -      53,    17,   488,     4,    22,   491,   492,   493,   150,   150,
      -     496,   150,   150,   150,   150,   475,   150,   150,   529,   154,
      -     591,   592,   150,   154,   153,   155,   145,    17,   599,   600,
      -     154,   157,   154,   154,   157,   606,   154,   154,   609,   550,
      -     551,   153,   150,    17,   150,    17,    71,    17,     3,     4,
      -     129,   129,     7,     8,     9,   566,   129,   247,    92,   248,
      -     544,   516,   111,   225,    19,    20,   552,    22,    23,    24,
      -      25,    26,    27,    26,    27,   105,    17,    89,    56,    -1,
      -     591,   592,   496,   410,   544,    40,    41,   235,   599,   600,
      -      -1,    -1,    -1,    -1,    -1,   606,    -1,    -1,   609,    -1,
      -       7,     8,    57,    10,    11,    12,    13,    14,    15,    16,
      -      17,    -1,    19,    20,    -1,    22,    23,    24,    73,    74,
      -      75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
      -      85,    86,    87,    88,    89,    -1,    -1,    -1,    -1,    -1,
      -      -1,    -1,    49,    96,    97,    98,    99,   100,   101,   102,
      -     103,   104,   105,   106,   107,   108,   109,    -1,    -1,    -1,
      -     115,   116,   117,   118,   119,   120,   121,   122,   123,   124,
      -     125,   126,   127,    -1,   129,    -1,   131,   132,   133,   134,
      -     135,    -1,   137,   138,    -1,   140,   141,   142,     3,     4,
      -      -1,    -1,     7,     8,     9,    -1,    -1,    -1,     0,    -1,
      -      -1,    -1,    -1,   158,    19,    20,    -1,    22,    23,    24,
      -      25,    26,    27,    -1,    -1,    -1,    18,    19,    20,    -1,
      -      22,    23,    24,    -1,    -1,    40,    41,    -1,    30,    31,
      -      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -      -1,    -1,    57,    -1,    -1,   152,    -1,    -1,   155,    51,
      -      -1,   158,    54,   160,   161,    -1,    58,    -1,    73,    74,
      -      75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
      -      85,    86,    87,    88,    89,    -1,    -1,    -1,    -1,    -1,
      -      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -     115,   116,   117,   118,   119,   120,   121,   122,   123,   124,
      -     125,   126,   127,    -1,   129,    -1,   131,   132,   133,    -1,
      -      -1,    -1,    -1,    -1,    -1,     3,     4,    -1,    -1,     7,
      -       8,     9,    -1,    -1,    -1,    -1,   151,    -1,   153,    -1,
      -      -1,    19,    20,   158,    22,    23,    24,    25,    26,    27,
      -      -1,    -1,     7,     8,    -1,    -1,    -1,    -1,    -1,    -1,
      -      -1,    -1,    40,    41,    19,    20,    -1,    22,    23,    24,
      -      25,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    57,
      -      -1,    -1,    -1,    -1,    -1,    40,    41,    -1,    -1,    -1,
      -      -1,    -1,    -1,    -1,    -1,    73,    74,    75,    76,    77,
      -      78,    79,    80,    81,    82,    83,    84,    85,    86,    87,
      -      88,    89,    -1,    -1,    -1,    -1,    -1,    -1,    73,    74,
      -      75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
      -      85,    86,    87,    88,    89,    -1,    -1,   115,   116,   117,
      -     118,   119,   120,   121,   122,   123,   124,   125,   126,   127,
      -      -1,   129,    -1,   131,   132,   133,    -1,    -1,    -1,    -1,
      -     115,   116,   117,   118,   119,   120,   121,   122,   123,   124,
      -     125,   126,   127,    -1,   129,    -1,   131,   132,   133,    -1,
      -     158,    -1,    -1,    -1,    -1,    -1,     3,     4,    -1,    -1,
      -      -1,    -1,     9,    -1,    -1,    -1,   151,    -1,   153,    -1,
      -     155,    -1,    -1,   158,    -1,   160,    -1,   162,    25,    26,
      -      27,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -      -1,    -1,    -1,    40,    41,    -1,    -1,    -1,    -1,    -1,
      -      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,     7,     8,
      -      57,    10,    11,    12,    13,    14,    15,    16,    17,    -1,
      -      19,    20,    -1,    22,    23,    24,    73,    74,    75,    76,
      -      77,    78,    79,    80,    81,    82,    83,    84,    85,    86,
      -      87,    88,    89,    -1,    -1,    -1,    -1,    -1,     7,     8,
      -      49,    10,    11,    12,    13,    14,    15,    16,    17,    -1,
      -      19,    20,    -1,    22,    23,    24,    -1,    -1,   115,   116,
      -     117,   118,   119,   120,   121,   122,   123,   124,   125,   126,
      -     127,    -1,   129,    -1,   131,   132,   133,    -1,     7,     8,
      -      49,    10,    11,    12,    13,    14,    15,    16,    17,    -1,
      -      19,    20,    -1,    22,    23,    24,    -1,    -1,    -1,     7,
      -       8,   158,    10,    11,    12,    13,    14,    15,    16,    17,
      -      -1,    19,    20,    -1,    22,    23,    24,    -1,    -1,    -1,
      -      49,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -      -1,    39,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -      -1,    49,    -1,   152,    -1,    -1,   155,    -1,    -1,   158,
      -      -1,   160,   161,     7,     8,    -1,    10,    11,    12,    13,
      -      14,    15,    16,    17,    -1,    19,    20,    -1,    22,    23,
      -      24,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -      -1,    -1,    -1,   152,    -1,    -1,   155,    -1,    -1,   158,
      -      -1,   160,   161,     7,     8,    49,    10,    11,    12,    13,
      -      14,    15,    16,    17,    -1,    19,    20,    -1,    22,    23,
      -      24,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -      -1,    -1,    -1,   152,    -1,    39,   155,    -1,    -1,   158,
      -      -1,   160,   161,    -1,    -1,    49,    -1,    -1,    -1,    -1,
      -      -1,    -1,    -1,    -1,   152,    -1,    -1,   155,    -1,    -1,
      -     158,    -1,   160,     7,     8,    -1,    10,    11,    12,    13,
      -      14,    15,    16,    17,    -1,    19,    20,   121,    22,    23,
      -      24,     7,     8,    -1,    10,    11,    12,    13,    14,    15,
      -      16,    17,    -1,    19,    20,    -1,    22,    23,    24,    -1,
      -      -1,    -1,    -1,    -1,    -1,    49,    -1,    -1,   152,    -1,
      -      -1,   155,    -1,    39,   158,    -1,   160,    -1,    -1,    -1,
      -      -1,     7,     8,    49,    10,    11,    12,    13,    14,    15,
      -      16,    17,    -1,    19,    20,    -1,    22,    23,    24,    -1,
      -      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   152,    -1,
      -      -1,   155,    -1,    39,   158,    -1,   160,    -1,    -1,    -1,
      -      -1,     7,     8,    49,    10,    11,    12,    13,    14,    15,
      -      16,    17,    -1,    19,    20,    -1,    22,    23,    24,     7,
      -       8,    -1,    10,    11,    12,    13,    14,    15,    16,    17,
      -      -1,    19,    20,    -1,    22,    23,    24,    -1,    -1,    -1,
      -      -1,    -1,    -1,    49,    -1,    -1,    -1,    -1,   152,    -1,
      -      -1,   155,    -1,   157,   158,    -1,   160,    -1,    -1,    -1,
      -      -1,    49,    -1,    -1,    -1,    -1,   152,    -1,    -1,   155,
      -      -1,    -1,   158,    -1,   160,     7,     8,    -1,    10,    11,
      -      12,    13,    14,    15,    16,    17,    -1,    19,    20,    -1,
      -      22,    23,    24,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -      -1,    -1,    -1,    -1,    -1,    -1,   152,    -1,    -1,   155,
      -      -1,    -1,   158,    -1,   160,     7,     8,    49,    10,    11,
      -      12,    13,    14,    15,    16,    17,    -1,    19,    20,    -1,
      -      22,    23,    24,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -      -1,    -1,    -1,    -1,    -1,    -1,   152,    -1,    -1,   155,
      -      -1,    -1,   158,    -1,   160,    -1,    -1,    49,    -1,    -1,
      -      -1,    -1,    -1,    -1,   152,    -1,    -1,   155,    -1,    -1,
      -     158,    -1,   160,     7,     8,    -1,    10,    11,    12,    13,
      -      14,    15,    16,    17,    -1,    19,    20,    -1,    22,    23,
      -      24,     7,     8,    -1,    10,    11,    12,    13,    14,    15,
      -      16,    17,    -1,    19,    20,    -1,    22,    23,    24,    -1,
      -      -1,    -1,    -1,    -1,    -1,    49,    -1,    -1,    -1,    -1,
      -     152,    -1,    -1,   155,    -1,    -1,   158,    -1,   160,    -1,
      -      -1,     7,     8,    49,    10,    11,    12,    13,    14,    15,
      -      16,    17,    -1,    19,    20,    -1,    22,    23,    24,    -1,
      -      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -     152,    -1,    -1,   155,    -1,    -1,   158,    -1,   160,    -1,
      -      -1,     7,     8,    49,    10,    11,    12,    13,    14,    15,
      -      16,    17,    -1,    19,    20,    -1,    22,    23,    24,    -1,
      -      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -      -1,    -1,    -1,    49,    36,    -1,    -1,    -1,   152,    -1,
      -      -1,   155,    -1,    -1,   158,    -1,   160,    -1,    -1,    -1,
      -      -1,    -1,    -1,    55,    56,    -1,   152,    -1,    -1,   155,
      -      -1,    -1,   158,    -1,   160,    67,    68,    69,    70,    71,
      -      72,    73,    74,    75,    76,    77,    78,    79,    80,    81,
      -      82,    83,    84,    85,    86,    87,    88,    89,    -1,    -1,
      -      -1,    -1,    -1,    -1,    -1,    -1,   152,    -1,    -1,   155,
      -      -1,    -1,   158,    -1,   160,    -1,    -1,    -1,   110,   111,
      -     112,    -1,    -1,   115,   116,   117,   118,   119,   120,   121,
      -     122,   123,   124,   125,   126,   127,   128,   129,   130,   131,
      -     132,   133,     0,    -1,    -1,    -1,   152,    -1,    -1,   155,
      -      -1,    -1,   158,    -1,   160,    -1,    -1,    -1,    -1,    -1,
      -      18,    19,    20,    -1,    22,    23,    24,    -1,    -1,    -1,
      -      -1,    -1,    30,    31,    -1,    -1,    -1,    -1,    -1,    -1,
      -      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -      -1,    -1,    -1,    51,    -1,    -1,    54,    -1,    -1,    -1,
      -      58
      -};
      +   This program is distributed in the hope that it will be useful,
      +   but WITHOUT ANY WARRANTY; without even the implied warranty of
      +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      +   GNU General Public License for more details.
       
      -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
      -   symbol of state STATE-NUM.  */
      -static const yytype_uint8 yystos[] =
      -{
      -       0,    19,    20,    22,    23,    24,    30,    31,    51,    54,
      -      58,   171,   173,   174,   175,   176,   208,   209,   210,   212,
      -     211,    52,    66,   217,   149,    57,   149,    18,   149,    42,
      -      43,    44,    45,    46,    47,    48,    50,   146,   147,   148,
      -     177,   178,   179,     0,   210,    46,    48,   180,   227,    42,
      -      43,    44,    47,   181,   224,   226,   233,   149,   149,   155,
      -     218,    22,   216,     7,     8,    10,    11,    12,    13,    14,
      -      15,    16,    17,    49,   152,   155,   158,   160,   171,   174,
      -     195,   196,   230,   179,   179,    35,    37,   206,   179,   179,
      -      21,   234,   235,    29,   161,   225,   234,    22,    22,    22,
      -     219,   153,     4,     4,     4,   160,    10,   161,   196,   201,
      -     151,   153,   206,   206,    42,    44,   182,    32,    33,   205,
      -      60,    61,    62,    63,    64,    65,   183,   222,   222,   173,
      -     238,   150,   157,    39,   196,   197,   199,   200,   156,   156,
      -     161,   201,   150,   161,   200,   205,   205,    10,   121,   196,
      -     198,   207,    11,    12,    13,    14,    15,    16,   169,   170,
      -     196,   202,     4,   198,    28,   160,   223,    36,    55,    56,
      -      67,    68,    69,    70,    71,    72,    73,    74,    75,    76,
      -      77,    78,    79,    80,    81,    82,    83,    84,    85,    86,
      -      87,    88,    89,   110,   111,   112,   115,   116,   117,   118,
      -     119,   120,   121,   122,   123,   124,   125,   126,   127,   128,
      -     129,   130,   131,   132,   133,   164,   165,   166,   236,   242,
      -     243,   244,   245,    22,   185,   150,   154,   196,   196,   159,
      -     161,   196,   154,   202,   196,   153,   230,    26,    27,     3,
      -       4,     5,     6,     9,    25,    40,    41,    88,    89,   115,
      -     129,   131,   132,   133,   155,   158,   160,   162,   164,   165,
      -     166,   203,   230,   213,   174,    55,    10,   196,   232,    11,
      -      17,    11,   169,   183,    90,    91,    92,    93,    94,    95,
      -      96,    97,    98,    99,   167,    26,    27,    96,    97,    98,
      -      99,   100,   101,   102,   103,   104,   105,   106,   107,   108,
      -     109,   168,   196,   196,   232,   196,   196,   239,   232,   232,
      -     232,   232,   232,   196,   196,   232,   183,   113,   114,   117,
      -     118,   134,   135,   137,   138,   140,   141,   142,   184,    39,
      -     197,   187,   157,   159,   159,   187,   214,   215,   207,   167,
      -     168,   153,   153,   153,   153,   153,   157,   202,   204,   160,
      -     204,   161,   204,    22,   153,   153,   153,   150,   193,   153,
      -       3,     4,     9,    25,    26,    27,    40,    41,    57,   158,
      -     203,   229,   230,   231,   231,   231,   231,   198,   196,   196,
      -     150,   190,   150,   190,   231,   155,   150,   150,   150,   150,
      -     150,   150,   231,   231,    38,   198,   196,   232,   134,   135,
      -     136,   139,   143,   144,   186,   193,   193,    38,   153,   153,
      -     202,   202,   202,   202,   202,   150,   157,   161,   196,   204,
      -     159,   161,   202,   202,   202,    34,    53,   191,   194,    39,
      -     196,   220,   221,    59,   228,   204,   150,   150,   231,   231,
      -     231,    11,    53,    11,   241,   231,   155,   232,   196,   232,
      -     232,   232,   150,   150,   196,   231,   231,   150,   196,   202,
      -     202,   241,   150,   150,   150,   150,   202,   159,   161,   150,
      -     150,    38,    22,     4,   193,   185,   150,   154,    22,   159,
      -      17,    17,   153,   150,   150,   231,     4,   231,   150,   150,
      -     231,   150,   150,   150,   231,   231,   153,   150,   190,   196,
      -     154,   150,   150,   154,   202,   202,   202,   202,   159,   202,
      -     202,   196,   171,   172,    39,   196,   187,   150,   231,   231,
      -      17,   196,   240,   231,   231,   190,   190,   232,   231,   150,
      -     232,   232,   232,   240,   231,   202,   202,   150,   154,   150,
      -     150,   154,   154,   154,   185,   191,   192,    22,   150,   155,
      -     185,   185,   150,   154,   157,   231,   154,   190,   154,   154,
      -     202,   202,   202,   172,    53,   189,    17,   157,   169,   237,
      -     117,   118,   231,   231,    17,   196,   187,   157,   187,   154,
      -     154,   154,     4,   145,   188,   231,   229,   157,   169,   185,
      -     185,   185,   185,    38,    22,   150,   229,   231,   231,    17,
      -      17,   150,   185,   185,   231,   231,    17,    71,   231,    17,
      -     231
      -};
      +   You should have received a copy of the GNU General Public License
      +   along with this program; if not, write to the Free Software
      +   Foundation, Inc., 59 Temple Place - Suite 330,
      +   Boston, MA 02111-1307, USA.  */
      +
      +/* As a special exception, when this file is copied by Bison into a
      +   Bison output file, you may use that output file without restriction.
      +   This special exception was added by the Free Software Foundation
      +   in version 1.24 of Bison.  */
      +
      +/* This is the parser code that is written into each bison parser
      +  when the %semantic_parser declaration is not specified in the grammar.
      +  It was written by Richard Stallman by simplifying the hairy parser
      +  used when %semantic_parser is specified.  */
      +
      +#ifndef YYSTACK_USE_ALLOCA
      +#ifdef alloca
      +#define YYSTACK_USE_ALLOCA
      +#else /* alloca not defined */
      +#ifdef __GNUC__
      +#define YYSTACK_USE_ALLOCA
      +#define alloca __builtin_alloca
      +#else /* not GNU C.  */
      +#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
      +#define YYSTACK_USE_ALLOCA
      +#include 
      +#else /* not sparc */
      +/* We think this test detects Watcom and Microsoft C.  */
      +/* This used to test MSDOS, but that is a bad idea
      +   since that symbol is in the user namespace.  */
      +#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
      +#if 0 /* No need for malloc.h, which pollutes the namespace;
      +	 instead, just don't use alloca.  */
      +#include 
      +#endif
      +#else /* not MSDOS, or __TURBOC__ */
      +#if defined(_AIX)
      +/* I don't know what this was needed for, but it pollutes the namespace.
      +   So I turned it off.   rms, 2 May 1997.  */
      +/* #include   */
      + #pragma alloca
      +#define YYSTACK_USE_ALLOCA
      +#else /* not MSDOS, or __TURBOC__, or _AIX */
      +#if 0
      +#ifdef __hpux /* haible at ilog.fr says this works for HPUX 9.05 and up,
      +		 and on HPUX 10.  Eventually we can turn this on.  */
      +#define YYSTACK_USE_ALLOCA
      +#define alloca __builtin_alloca
      +#endif /* __hpux */
      +#endif
      +#endif /* not _AIX */
      +#endif /* not MSDOS, or __TURBOC__ */
      +#endif /* not sparc */
      +#endif /* not GNU C */
      +#endif /* alloca not defined */
      +#endif /* YYSTACK_USE_ALLOCA not defined */
      +
      +#ifdef YYSTACK_USE_ALLOCA
      +#define YYSTACK_ALLOC alloca
      +#else
      +#define YYSTACK_ALLOC malloc
      +#endif
      +
      +/* Note: there must be only one dollar sign in this file.
      +   It is replaced by the list of actions, each action
      +   as one case of the switch.  */
       
       #define yyerrok		(yyerrstatus = 0)
       #define yyclearin	(yychar = YYEMPTY)
      -#define YYEMPTY		(-2)
      +#define YYEMPTY		-2
       #define YYEOF		0
      -
       #define YYACCEPT	goto yyacceptlab
      -#define YYABORT		goto yyabortlab
      -#define YYERROR		goto yyerrorlab
      -
      -
      -/* Like YYERROR except do call yyerror.  This remains here temporarily
      -   to ease the transition to the new meaning of YYERROR, for GCC.
      +#define YYABORT 	goto yyabortlab
      +#define YYERROR		goto yyerrlab1
      +/* Like YYERROR except do call yyerror.
      +   This remains here temporarily to ease the
      +   transition to the new meaning of YYERROR, for GCC.
          Once GCC version 2 has supplanted version 1, this can go.  */
      -
       #define YYFAIL		goto yyerrlab
      -
       #define YYRECOVERING()  (!!yyerrstatus)
      -
      -#define YYBACKUP(Token, Value)					\
      +#define YYBACKUP(token, value) \
       do								\
         if (yychar == YYEMPTY && yylen == 1)				\
      -    {								\
      -      yychar = (Token);						\
      -      yylval = (Value);						\
      -      yytoken = YYTRANSLATE (yychar);				\
      -      YYPOPSTACK (1);						\
      +    { yychar = (token), yylval = (value);			\
      +      yychar1 = YYTRANSLATE (yychar);				\
      +      YYPOPSTACK;						\
             goto yybackup;						\
           }								\
         else								\
      -    {								\
      -      yyerror (YY_("syntax error: cannot back up")); \
      -      YYERROR;							\
      -    }								\
      -while (YYID (0))
      -
      +    { yyerror ("syntax error: cannot back up"); YYERROR; }	\
      +while (0)
       
       #define YYTERROR	1
       #define YYERRCODE	256
       
      -
      -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
      -   If N is 0, then set CURRENT to the empty location which ends
      -   the previous symbol: RHS[0] (always defined).  */
      -
      -#define YYRHSLOC(Rhs, K) ((Rhs)[K])
      -#ifndef YYLLOC_DEFAULT
      -# define YYLLOC_DEFAULT(Current, Rhs, N)				\
      -    do									\
      -      if (YYID (N))                                                    \
      -	{								\
      -	  (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;	\
      -	  (Current).first_column = YYRHSLOC (Rhs, 1).first_column;	\
      -	  (Current).last_line    = YYRHSLOC (Rhs, N).last_line;		\
      -	  (Current).last_column  = YYRHSLOC (Rhs, N).last_column;	\
      -	}								\
      -      else								\
      -	{								\
      -	  (Current).first_line   = (Current).last_line   =		\
      -	    YYRHSLOC (Rhs, 0).last_line;				\
      -	  (Current).first_column = (Current).last_column =		\
      -	    YYRHSLOC (Rhs, 0).last_column;				\
      -	}								\
      -    while (YYID (0))
      -#endif
      -
      -
      -/* YY_LOCATION_PRINT -- Print the location on the stream.
      -   This macro was not mandated originally: define only if we know
      -   we won't break user code: when these are the locations we know.  */
      -
      -#ifndef YY_LOCATION_PRINT
      -# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
      -#  define YY_LOCATION_PRINT(File, Loc)			\
      -     fprintf (File, "%d.%d-%d.%d",			\
      -	      (Loc).first_line, (Loc).first_column,	\
      -	      (Loc).last_line,  (Loc).last_column)
      -# else
      -#  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
      -# endif
      +#ifndef YYPURE
      +#define YYLEX		yylex()
       #endif
       
      -
      -/* YYLEX -- calling `yylex' with the right arguments.  */
      -
      +#ifdef YYPURE
      +#ifdef YYLSP_NEEDED
       #ifdef YYLEX_PARAM
      -# define YYLEX yylex (YYLEX_PARAM)
      +#define YYLEX		yylex(&yylval, &yylloc, YYLEX_PARAM)
       #else
      -# define YYLEX yylex ()
      +#define YYLEX		yylex(&yylval, &yylloc)
       #endif
      -
      -/* Enable debugging if requested.  */
      -#if YYDEBUG
      -
      -# ifndef YYFPRINTF
      -#  include  /* INFRINGES ON USER NAME SPACE */
      -#  define YYFPRINTF fprintf
      -# endif
      -
      -# define YYDPRINTF(Args)			\
      -do {						\
      -  if (yydebug)					\
      -    YYFPRINTF Args;				\
      -} while (YYID (0))
      -
      -# define YY_SYMBOL_PRINT(Title, Type, Value, Location)			  \
      -do {									  \
      -  if (yydebug)								  \
      -    {									  \
      -      YYFPRINTF (stderr, "%s ", Title);					  \
      -      yy_symbol_print (stderr,						  \
      -		  Type, Value); \
      -      YYFPRINTF (stderr, "\n");						  \
      -    }									  \
      -} while (YYID (0))
      -
      -
      -/*--------------------------------.
      -| Print this symbol on YYOUTPUT.  |
      -`--------------------------------*/
      -
      -/*ARGSUSED*/
      -#if (defined __STDC__ || defined __C99__FUNC__ \
      -     || defined __cplusplus || defined _MSC_VER)
      -static void
      -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
      +#else /* not YYLSP_NEEDED */
      +#ifdef YYLEX_PARAM
      +#define YYLEX		yylex(&yylval, YYLEX_PARAM)
       #else
      -static void
      -yy_symbol_value_print (yyoutput, yytype, yyvaluep)
      -    FILE *yyoutput;
      -    int yytype;
      -    YYSTYPE const * const yyvaluep;
      +#define YYLEX		yylex(&yylval)
       #endif
      -{
      -  if (!yyvaluep)
      -    return;
      -# ifdef YYPRINT
      -  if (yytype < YYNTOKENS)
      -    YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
      -# else
      -  YYUSE (yyoutput);
      -# endif
      -  switch (yytype)
      -    {
      -      default:
      -	break;
      -    }
      -}
      -
      -
      -/*--------------------------------.
      -| Print this symbol on YYOUTPUT.  |
      -`--------------------------------*/
      -
      -#if (defined __STDC__ || defined __C99__FUNC__ \
      -     || defined __cplusplus || defined _MSC_VER)
      -static void
      -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
      -#else
      -static void
      -yy_symbol_print (yyoutput, yytype, yyvaluep)
      -    FILE *yyoutput;
      -    int yytype;
      -    YYSTYPE const * const yyvaluep;
      +#endif /* not YYLSP_NEEDED */
       #endif
      -{
      -  if (yytype < YYNTOKENS)
      -    YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
      -  else
      -    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
      -
      -  yy_symbol_value_print (yyoutput, yytype, yyvaluep);
      -  YYFPRINTF (yyoutput, ")");
      -}
       
      -/*------------------------------------------------------------------.
      -| yy_stack_print -- Print the state stack from its BOTTOM up to its |
      -| TOP (included).                                                   |
      -`------------------------------------------------------------------*/
      +/* If nonreentrant, generate the variables here */
       
      -#if (defined __STDC__ || defined __C99__FUNC__ \
      -     || defined __cplusplus || defined _MSC_VER)
      -static void
      -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
      -#else
      -static void
      -yy_stack_print (bottom, top)
      -    yytype_int16 *bottom;
      -    yytype_int16 *top;
      -#endif
      -{
      -  YYFPRINTF (stderr, "Stack now");
      -  for (; bottom <= top; ++bottom)
      -    YYFPRINTF (stderr, " %d", *bottom);
      -  YYFPRINTF (stderr, "\n");
      -}
      +#ifndef YYPURE
       
      -# define YY_STACK_PRINT(Bottom, Top)				\
      -do {								\
      -  if (yydebug)							\
      -    yy_stack_print ((Bottom), (Top));				\
      -} while (YYID (0))
      +int	yychar;			/*  the lookahead symbol		*/
      +YYSTYPE	yylval;			/*  the semantic value of the		*/
      +				/*  lookahead symbol			*/
       
      +#ifdef YYLSP_NEEDED
      +YYLTYPE yylloc;			/*  location data for the lookahead	*/
      +				/*  symbol				*/
      +#endif
       
      -/*------------------------------------------------.
      -| Report that the YYRULE is going to be reduced.  |
      -`------------------------------------------------*/
      +int yynerrs;			/*  number of parse errors so far       */
      +#endif  /* not YYPURE */
       
      -#if (defined __STDC__ || defined __C99__FUNC__ \
      -     || defined __cplusplus || defined _MSC_VER)
      -static void
      -yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
      -#else
      -static void
      -yy_reduce_print (yyvsp, yyrule)
      -    YYSTYPE *yyvsp;
      -    int yyrule;
      +#if YYDEBUG != 0
      +int yydebug;			/*  nonzero means print parse trace	*/
      +/* Since this is uninitialized, it does not stop multiple parsers
      +   from coexisting.  */
       #endif
      -{
      -  int yynrhs = yyr2[yyrule];
      -  int yyi;
      -  unsigned long int yylno = yyrline[yyrule];
      -  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
      -	     yyrule - 1, yylno);
      -  /* The symbols being reduced.  */
      -  for (yyi = 0; yyi < yynrhs; yyi++)
      -    {
      -      fprintf (stderr, "   $%d = ", yyi + 1);
      -      yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
      -		       &(yyvsp[(yyi + 1) - (yynrhs)])
      -		       		       );
      -      fprintf (stderr, "\n");
      -    }
      -}
       
      -# define YY_REDUCE_PRINT(Rule)		\
      -do {					\
      -  if (yydebug)				\
      -    yy_reduce_print (yyvsp, Rule); \
      -} while (YYID (0))
      -
      -/* Nonzero means print parse trace.  It is left uninitialized so that
      -   multiple parsers can coexist.  */
      -int yydebug;
      -#else /* !YYDEBUG */
      -# define YYDPRINTF(Args)
      -# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
      -# define YY_STACK_PRINT(Bottom, Top)
      -# define YY_REDUCE_PRINT(Rule)
      -#endif /* !YYDEBUG */
      +/*  YYINITDEPTH indicates the initial size of the parser's stacks	*/
       
      -
      -/* YYINITDEPTH -- initial size of the parser's stacks.  */
       #ifndef	YYINITDEPTH
      -# define YYINITDEPTH 200
      +#define YYINITDEPTH 200
       #endif
       
      -/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
      -   if the built-in stack extension method is used).
      +/*  YYMAXDEPTH is the maximum size the stacks can grow to
      +    (effective only if the built-in stack extension method is used).  */
       
      -   Do not make this value too large; the results are undefined if
      -   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
      -   evaluated with infinite-precision integer arithmetic.  */
      +#if YYMAXDEPTH == 0
      +#undef YYMAXDEPTH
      +#endif
       
       #ifndef YYMAXDEPTH
      -# define YYMAXDEPTH 10000
      +#define YYMAXDEPTH 10000
       #endif
      -
       
      +/* Define __yy_memcpy.  Note that the size argument
      +   should be passed with type unsigned int, because that is what the non-GCC
      +   definitions require.  With GCC, __builtin_memcpy takes an arg
      +   of type size_t, but it can handle unsigned int.  */
      +
      +#if __GNUC__ > 1		/* GNU C and GNU C++ define this.  */
      +#define __yy_memcpy(TO,FROM,COUNT)	__builtin_memcpy(TO,FROM,COUNT)
      +#else				/* not GNU C or C++ */
      +#ifndef __cplusplus
       
      -#if YYERROR_VERBOSE
      -
      -# ifndef yystrlen
      -#  if defined __GLIBC__ && defined _STRING_H
      -#   define yystrlen strlen
      -#  else
      -/* Return the length of YYSTR.  */
      -#if (defined __STDC__ || defined __C99__FUNC__ \
      -     || defined __cplusplus || defined _MSC_VER)
      -static YYSIZE_T
      -yystrlen (const char *yystr)
      -#else
      -static YYSIZE_T
      -yystrlen (yystr)
      -    const char *yystr;
      -#endif
      -{
      -  YYSIZE_T yylen;
      -  for (yylen = 0; yystr[yylen]; yylen++)
      -    continue;
      -  return yylen;
      -}
      -#  endif
      -# endif
      -
      -# ifndef yystpcpy
      -#  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
      -#   define yystpcpy stpcpy
      -#  else
      -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
      -   YYDEST.  */
      -#if (defined __STDC__ || defined __C99__FUNC__ \
      -     || defined __cplusplus || defined _MSC_VER)
      -static char *
      -yystpcpy (char *yydest, const char *yysrc)
      -#else
      -static char *
      -yystpcpy (yydest, yysrc)
      -    char *yydest;
      -    const char *yysrc;
      -#endif
      +/* This is the most reliable way to avoid incompatibilities
      +   in available built-in functions on various systems.  */
      +static void
      +__yy_memcpy (to, from, count)
      +     char *to;
      +     char *from;
      +     unsigned int count;
       {
      -  char *yyd = yydest;
      -  const char *yys = yysrc;
      +  register char *f = from;
      +  register char *t = to;
      +  register int i = count;
       
      -  while ((*yyd++ = *yys++) != '\0')
      -    continue;
      -
      -  return yyd - 1;
      +  while (i-- > 0)
      +    *t++ = *f++;
       }
      -#  endif
      -# endif
      -
      -# ifndef yytnamerr
      -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
      -   quotes and backslashes, so that it's suitable for yyerror.  The
      -   heuristic is that double-quoting is unnecessary unless the string
      -   contains an apostrophe, a comma, or backslash (other than
      -   backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
      -   null, do not copy; instead, return the length of what the result
      -   would have been.  */
      -static YYSIZE_T
      -yytnamerr (char *yyres, const char *yystr)
      -{
      -  if (*yystr == '"')
      -    {
      -      YYSIZE_T yyn = 0;
      -      char const *yyp = yystr;
      -
      -      for (;;)
      -	switch (*++yyp)
      -	  {
      -	  case '\'':
      -	  case ',':
      -	    goto do_not_strip_quotes;
      -
      -	  case '\\':
      -	    if (*++yyp != '\\')
      -	      goto do_not_strip_quotes;
      -	    /* Fall through.  */
      -	  default:
      -	    if (yyres)
      -	      yyres[yyn] = *yyp;
      -	    yyn++;
      -	    break;
      -
      -	  case '"':
      -	    if (yyres)
      -	      yyres[yyn] = '\0';
      -	    return yyn;
      -	  }
      -    do_not_strip_quotes: ;
      -    }
       
      -  if (! yyres)
      -    return yystrlen (yystr);
      +#else /* __cplusplus */
       
      -  return yystpcpy (yyres, yystr) - yyres;
      -}
      -# endif
      -
      -/* Copy into YYRESULT an error message about the unexpected token
      -   YYCHAR while in state YYSTATE.  Return the number of bytes copied,
      -   including the terminating null byte.  If YYRESULT is null, do not
      -   copy anything; just return the number of bytes that would be
      -   copied.  As a special case, return 0 if an ordinary "syntax error"
      -   message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
      -   size calculation.  */
      -static YYSIZE_T
      -yysyntax_error (char *yyresult, int yystate, int yychar)
      +/* This is the most reliable way to avoid incompatibilities
      +   in available built-in functions on various systems.  */
      +static void
      +__yy_memcpy (char *to, char *from, unsigned int count)
       {
      -  int yyn = yypact[yystate];
      -
      -  if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
      -    return 0;
      -  else
      -    {
      -      int yytype = YYTRANSLATE (yychar);
      -      YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
      -      YYSIZE_T yysize = yysize0;
      -      YYSIZE_T yysize1;
      -      int yysize_overflow = 0;
      -      enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
      -      char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
      -      int yyx;
      -
      -# if 0
      -      /* This is so xgettext sees the translatable formats that are
      -	 constructed on the fly.  */
      -      YY_("syntax error, unexpected %s");
      -      YY_("syntax error, unexpected %s, expecting %s");
      -      YY_("syntax error, unexpected %s, expecting %s or %s");
      -      YY_("syntax error, unexpected %s, expecting %s or %s or %s");
      -      YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
      -# endif
      -      char *yyfmt;
      -      char const *yyf;
      -      static char const yyunexpected[] = "syntax error, unexpected %s";
      -      static char const yyexpecting[] = ", expecting %s";
      -      static char const yyor[] = " or %s";
      -      char yyformat[sizeof yyunexpected
      -		    + sizeof yyexpecting - 1
      -		    + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
      -		       * (sizeof yyor - 1))];
      -      char const *yyprefix = yyexpecting;
      -
      -      /* Start YYX at -YYN if negative to avoid negative indexes in
      -	 YYCHECK.  */
      -      int yyxbegin = yyn < 0 ? -yyn : 0;
      -
      -      /* Stay within bounds of both yycheck and yytname.  */
      -      int yychecklim = YYLAST - yyn + 1;
      -      int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
      -      int yycount = 1;
      -
      -      yyarg[0] = yytname[yytype];
      -      yyfmt = yystpcpy (yyformat, yyunexpected);
      -
      -      for (yyx = yyxbegin; yyx < yyxend; ++yyx)
      -	if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
      -	  {
      -	    if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
      -	      {
      -		yycount = 1;
      -		yysize = yysize0;
      -		yyformat[sizeof yyunexpected - 1] = '\0';
      -		break;
      -	      }
      -	    yyarg[yycount++] = yytname[yyx];
      -	    yysize1 = yysize + yytnamerr (0, yytname[yyx]);
      -	    yysize_overflow |= (yysize1 < yysize);
      -	    yysize = yysize1;
      -	    yyfmt = yystpcpy (yyfmt, yyprefix);
      -	    yyprefix = yyor;
      -	  }
      -
      -      yyf = YY_(yyformat);
      -      yysize1 = yysize + yystrlen (yyf);
      -      yysize_overflow |= (yysize1 < yysize);
      -      yysize = yysize1;
      -
      -      if (yysize_overflow)
      -	return YYSIZE_MAXIMUM;
      +  register char *t = to;
      +  register char *f = from;
      +  register int i = count;
       
      -      if (yyresult)
      -	{
      -	  /* Avoid sprintf, as that infringes on the user's name space.
      -	     Don't have undefined behavior even if the translation
      -	     produced a string with the wrong number of "%s"s.  */
      -	  char *yyp = yyresult;
      -	  int yyi = 0;
      -	  while ((*yyp = *yyf) != '\0')
      -	    {
      -	      if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
      -		{
      -		  yyp += yytnamerr (yyp, yyarg[yyi++]);
      -		  yyf += 2;
      -		}
      -	      else
      -		{
      -		  yyp++;
      -		  yyf++;
      -		}
      -	    }
      -	}
      -      return yysize;
      -    }
      +  while (i-- > 0)
      +    *t++ = *f++;
       }
      -#endif /* YYERROR_VERBOSE */
      -
       
      -/*-----------------------------------------------.
      -| Release the memory associated to this symbol.  |
      -`-----------------------------------------------*/
      -
      -/*ARGSUSED*/
      -#if (defined __STDC__ || defined __C99__FUNC__ \
      -     || defined __cplusplus || defined _MSC_VER)
      -static void
      -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
      -#else
      -static void
      -yydestruct (yymsg, yytype, yyvaluep)
      -    const char *yymsg;
      -    int yytype;
      -    YYSTYPE *yyvaluep;
       #endif
      -{
      -  YYUSE (yyvaluep);
      -
      -  if (!yymsg)
      -    yymsg = "Deleting";
      -  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
      -
      -  switch (yytype)
      -    {
      -
      -      default:
      -	break;
      -    }
      -}
      +#endif
       
      +#line 217 "/usr/share/bison.simple"
       
      -/* Prevent warnings from -Wmissing-prototypes.  */
      +/* The user can define YYPARSE_PARAM as the name of an argument to be passed
      +   into yyparse.  The argument should have type void *.
      +   It should actually point to an object.
      +   Grammar actions can access the variable by casting it
      +   to the proper pointer type.  */
      +
      +#ifdef YYPARSE_PARAM
      +#ifdef __cplusplus
      +#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
      +#define YYPARSE_PARAM_DECL
      +#else /* not __cplusplus */
      +#define YYPARSE_PARAM_ARG YYPARSE_PARAM
      +#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
      +#endif /* not __cplusplus */
      +#else /* not YYPARSE_PARAM */
      +#define YYPARSE_PARAM_ARG
      +#define YYPARSE_PARAM_DECL
      +#endif /* not YYPARSE_PARAM */
       
      +/* Prevent warning if -Wstrict-prototypes.  */
      +#ifdef __GNUC__
       #ifdef YYPARSE_PARAM
      -#if defined __STDC__ || defined __cplusplus
      -int yyparse (void *YYPARSE_PARAM);
      +int yyparse (void *);
       #else
      -int yyparse ();
      -#endif
      -#else /* ! YYPARSE_PARAM */
      -#if defined __STDC__ || defined __cplusplus
       int yyparse (void);
      -#else
      -int yyparse ();
       #endif
      -#endif /* ! YYPARSE_PARAM */
      -
      -
      -
      -/* The look-ahead symbol.  */
      -int yychar;
      -
      -/* The semantic value of the look-ahead symbol.  */
      -YYSTYPE yylval;
      -
      -/* Number of syntax errors so far.  */
      -int yynerrs;
      -
      -
      -
      -/*----------.
      -| yyparse.  |
      -`----------*/
      +#endif
       
      -#ifdef YYPARSE_PARAM
      -#if (defined __STDC__ || defined __C99__FUNC__ \
      -     || defined __cplusplus || defined _MSC_VER)
       int
      -yyparse (void *YYPARSE_PARAM)
      +yyparse(YYPARSE_PARAM_ARG)
      +     YYPARSE_PARAM_DECL
      +{
      +  register int yystate;
      +  register int yyn;
      +  register short *yyssp;
      +  register YYSTYPE *yyvsp;
      +  int yyerrstatus;	/*  number of tokens to shift before error messages enabled */
      +  int yychar1 = 0;		/*  lookahead token as an internal (translated) token number */
      +
      +  short	yyssa[YYINITDEPTH];	/*  the state stack			*/
      +  YYSTYPE yyvsa[YYINITDEPTH];	/*  the semantic value stack		*/
      +
      +  short *yyss = yyssa;		/*  refer to the stacks thru separate pointers */
      +  YYSTYPE *yyvs = yyvsa;	/*  to allow yyoverflow to reallocate them elsewhere */
      +
      +#ifdef YYLSP_NEEDED
      +  YYLTYPE yylsa[YYINITDEPTH];	/*  the location stack			*/
      +  YYLTYPE *yyls = yylsa;
      +  YYLTYPE *yylsp;
      +
      +#define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
       #else
      -int
      -yyparse (YYPARSE_PARAM)
      -    void *YYPARSE_PARAM;
      +#define YYPOPSTACK   (yyvsp--, yyssp--)
       #endif
      -#else /* ! YYPARSE_PARAM */
      -#if (defined __STDC__ || defined __C99__FUNC__ \
      -     || defined __cplusplus || defined _MSC_VER)
      -int
      -yyparse (void)
      -#else
      -int
      -yyparse ()
       
      +  int yystacksize = YYINITDEPTH;
      +  int yyfree_stacks = 0;
      +
      +#ifdef YYPURE
      +  int yychar;
      +  YYSTYPE yylval;
      +  int yynerrs;
      +#ifdef YYLSP_NEEDED
      +  YYLTYPE yylloc;
       #endif
       #endif
      -{
      -  
      -  int yystate;
      -  int yyn;
      -  int yyresult;
      -  /* Number of tokens to shift before error messages enabled.  */
      -  int yyerrstatus;
      -  /* Look-ahead token as an internal (translated) token number.  */
      -  int yytoken = 0;
      -#if YYERROR_VERBOSE
      -  /* Buffer for error messages, and its allocated size.  */
      -  char yymsgbuf[128];
      -  char *yymsg = yymsgbuf;
      -  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
      -#endif
      -
      -  /* Three stacks and their tools:
      -     `yyss': related to states,
      -     `yyvs': related to semantic values,
      -     `yyls': related to locations.
      -
      -     Refer to the stacks thru separate pointers, to allow yyoverflow
      -     to reallocate them elsewhere.  */
       
      -  /* The state stack.  */
      -  yytype_int16 yyssa[YYINITDEPTH];
      -  yytype_int16 *yyss = yyssa;
      -  yytype_int16 *yyssp;
      +  YYSTYPE yyval;		/*  the variable used to return		*/
      +				/*  semantic values from the action	*/
      +				/*  routines				*/
       
      -  /* The semantic value stack.  */
      -  YYSTYPE yyvsa[YYINITDEPTH];
      -  YYSTYPE *yyvs = yyvsa;
      -  YYSTYPE *yyvsp;
      +  int yylen;
       
      -
      -
      -#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
      -
      -  YYSIZE_T yystacksize = YYINITDEPTH;
      -
      -  /* The variables used to return semantic value and location from the
      -     action routines.  */
      -  YYSTYPE yyval;
      -
      -
      -  /* The number of symbols on the RHS of the reduced rule.
      -     Keep to zero when no symbol should be popped.  */
      -  int yylen = 0;
      -
      -  YYDPRINTF ((stderr, "Starting parse\n"));
      +#if YYDEBUG != 0
      +  if (yydebug)
      +    fprintf(stderr, "Starting parse\n");
      +#endif
       
         yystate = 0;
         yyerrstatus = 0;
      @@ -3238,763 +2337,729 @@
            so that they stay on the same level as the state stack.
            The wasted elements are never initialized.  */
       
      -  yyssp = yyss;
      +  yyssp = yyss - 1;
         yyvsp = yyvs;
      +#ifdef YYLSP_NEEDED
      +  yylsp = yyls;
      +#endif
       
      -  goto yysetstate;
      -
      -/*------------------------------------------------------------.
      -| yynewstate -- Push a new state, which is found in yystate.  |
      -`------------------------------------------------------------*/
      - yynewstate:
      -  /* In all cases, when you get here, the value and location stacks
      -     have just been pushed.  So pushing a state here evens the stacks.  */
      -  yyssp++;
      +/* Push a new state, which is found in  yystate  .  */
      +/* In all cases, when you get here, the value and location stacks
      +   have just been pushed. so pushing a state here evens the stacks.  */
      +yynewstate:
       
      - yysetstate:
      -  *yyssp = yystate;
      +  *++yyssp = yystate;
       
      -  if (yyss + yystacksize - 1 <= yyssp)
      +  if (yyssp >= yyss + yystacksize - 1)
           {
      +      /* Give user a chance to reallocate the stack */
      +      /* Use copies of these so that the &'s don't force the real ones into memory. */
      +      YYSTYPE *yyvs1 = yyvs;
      +      short *yyss1 = yyss;
      +#ifdef YYLSP_NEEDED
      +      YYLTYPE *yyls1 = yyls;
      +#endif
      +
             /* Get the current used size of the three stacks, in elements.  */
      -      YYSIZE_T yysize = yyssp - yyss + 1;
      +      int size = yyssp - yyss + 1;
       
       #ifdef yyoverflow
      -      {
      -	/* Give user a chance to reallocate the stack.  Use copies of
      -	   these so that the &'s don't force the real ones into
      -	   memory.  */
      -	YYSTYPE *yyvs1 = yyvs;
      -	yytype_int16 *yyss1 = yyss;
      -
      -
      -	/* Each stack pointer address is followed by the size of the
      -	   data in use in that stack, in bytes.  This used to be a
      -	   conditional around just the two extra args, but that might
      -	   be undefined if yyoverflow is a macro.  */
      -	yyoverflow (YY_("memory exhausted"),
      -		    &yyss1, yysize * sizeof (*yyssp),
      -		    &yyvs1, yysize * sizeof (*yyvsp),
      -
      -		    &yystacksize);
      +      /* Each stack pointer address is followed by the size of
      +	 the data in use in that stack, in bytes.  */
      +#ifdef YYLSP_NEEDED
      +      /* This used to be a conditional around just the two extra args,
      +	 but that might be undefined if yyoverflow is a macro.  */
      +      yyoverflow("parser stack overflow",
      +		 &yyss1, size * sizeof (*yyssp),
      +		 &yyvs1, size * sizeof (*yyvsp),
      +		 &yyls1, size * sizeof (*yylsp),
      +		 &yystacksize);
      +#else
      +      yyoverflow("parser stack overflow",
      +		 &yyss1, size * sizeof (*yyssp),
      +		 &yyvs1, size * sizeof (*yyvsp),
      +		 &yystacksize);
      +#endif
       
      -	yyss = yyss1;
      -	yyvs = yyvs1;
      -      }
      +      yyss = yyss1; yyvs = yyvs1;
      +#ifdef YYLSP_NEEDED
      +      yyls = yyls1;
      +#endif
       #else /* no yyoverflow */
      -# ifndef YYSTACK_RELOCATE
      -      goto yyexhaustedlab;
      -# else
             /* Extend the stack our own way.  */
      -      if (YYMAXDEPTH <= yystacksize)
      -	goto yyexhaustedlab;
      +      if (yystacksize >= YYMAXDEPTH)
      +	{
      +	  yyerror("parser stack overflow");
      +	  if (yyfree_stacks)
      +	    {
      +	      free (yyss);
      +	      free (yyvs);
      +#ifdef YYLSP_NEEDED
      +	      free (yyls);
      +#endif
      +	    }
      +	  return 2;
      +	}
             yystacksize *= 2;
      -      if (YYMAXDEPTH < yystacksize)
      +      if (yystacksize > YYMAXDEPTH)
       	yystacksize = YYMAXDEPTH;
      -
      -      {
      -	yytype_int16 *yyss1 = yyss;
      -	union yyalloc *yyptr =
      -	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
      -	if (! yyptr)
      -	  goto yyexhaustedlab;
      -	YYSTACK_RELOCATE (yyss);
      -	YYSTACK_RELOCATE (yyvs);
      -
      -#  undef YYSTACK_RELOCATE
      -	if (yyss1 != yyssa)
      -	  YYSTACK_FREE (yyss1);
      -      }
      -# endif
      +#ifndef YYSTACK_USE_ALLOCA
      +      yyfree_stacks = 1;
      +#endif
      +      yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
      +      __yy_memcpy ((char *)yyss, (char *)yyss1,
      +		   size * (unsigned int) sizeof (*yyssp));
      +      yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
      +      __yy_memcpy ((char *)yyvs, (char *)yyvs1,
      +		   size * (unsigned int) sizeof (*yyvsp));
      +#ifdef YYLSP_NEEDED
      +      yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
      +      __yy_memcpy ((char *)yyls, (char *)yyls1,
      +		   size * (unsigned int) sizeof (*yylsp));
      +#endif
       #endif /* no yyoverflow */
       
      -      yyssp = yyss + yysize - 1;
      -      yyvsp = yyvs + yysize - 1;
      -
      +      yyssp = yyss + size - 1;
      +      yyvsp = yyvs + size - 1;
      +#ifdef YYLSP_NEEDED
      +      yylsp = yyls + size - 1;
      +#endif
       
      -      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
      -		  (unsigned long int) yystacksize));
      +#if YYDEBUG != 0
      +      if (yydebug)
      +	fprintf(stderr, "Stack size increased to %d\n", yystacksize);
      +#endif
       
      -      if (yyss + yystacksize - 1 <= yyssp)
      +      if (yyssp >= yyss + yystacksize - 1)
       	YYABORT;
           }
       
      -  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
      +#if YYDEBUG != 0
      +  if (yydebug)
      +    fprintf(stderr, "Entering state %d\n", yystate);
      +#endif
       
         goto yybackup;
      + yybackup:
       
      -/*-----------.
      -| yybackup.  |
      -`-----------*/
      -yybackup:
      +/* Do appropriate processing given the current state.  */
      +/* Read a lookahead token if we need one and don't already have one.  */
      +/* yyresume: */
       
      -  /* Do appropriate processing given the current state.  Read a
      -     look-ahead token if we need one and don't already have one.  */
      +  /* First try to decide what to do without reference to lookahead token.  */
       
      -  /* First try to decide what to do without reference to look-ahead token.  */
         yyn = yypact[yystate];
      -  if (yyn == YYPACT_NINF)
      +  if (yyn == YYFLAG)
           goto yydefault;
       
      -  /* Not known => get a look-ahead token if don't already have one.  */
      +  /* Not known => get a lookahead token if don't already have one.  */
      +
      +  /* yychar is either YYEMPTY or YYEOF
      +     or a valid token in external form.  */
       
      -  /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
         if (yychar == YYEMPTY)
           {
      -      YYDPRINTF ((stderr, "Reading a token: "));
      +#if YYDEBUG != 0
      +      if (yydebug)
      +	fprintf(stderr, "Reading a token: ");
      +#endif
             yychar = YYLEX;
           }
       
      -  if (yychar <= YYEOF)
      +  /* Convert token to internal form (in yychar1) for indexing tables with */
      +
      +  if (yychar <= 0)		/* This means end of input. */
           {
      -      yychar = yytoken = YYEOF;
      -      YYDPRINTF ((stderr, "Now at end of input.\n"));
      +      yychar1 = 0;
      +      yychar = YYEOF;		/* Don't call YYLEX any more */
      +
      +#if YYDEBUG != 0
      +      if (yydebug)
      +	fprintf(stderr, "Now at end of input.\n");
      +#endif
           }
         else
           {
      -      yytoken = YYTRANSLATE (yychar);
      -      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
      +      yychar1 = YYTRANSLATE(yychar);
      +
      +#if YYDEBUG != 0
      +      if (yydebug)
      +	{
      +	  fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
      +	  /* Give the individual parser a way to print the precise meaning
      +	     of a token, for further debugging info.  */
      +#ifdef YYPRINT
      +	  YYPRINT (stderr, yychar, yylval);
      +#endif
      +	  fprintf (stderr, ")\n");
      +	}
      +#endif
           }
       
      -  /* If the proper action on seeing token YYTOKEN is to reduce or to
      -     detect an error, take that action.  */
      -  yyn += yytoken;
      -  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
      +  yyn += yychar1;
      +  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
           goto yydefault;
      +
         yyn = yytable[yyn];
      -  if (yyn <= 0)
      +
      +  /* yyn is what to do for this token type in this state.
      +     Negative => reduce, -yyn is rule number.
      +     Positive => shift, yyn is new state.
      +       New state is final state => don't bother to shift,
      +       just return success.
      +     0, or most negative number => error.  */
      +
      +  if (yyn < 0)
           {
      -      if (yyn == 0 || yyn == YYTABLE_NINF)
      +      if (yyn == YYFLAG)
       	goto yyerrlab;
             yyn = -yyn;
             goto yyreduce;
           }
      +  else if (yyn == 0)
      +    goto yyerrlab;
       
         if (yyn == YYFINAL)
           YYACCEPT;
       
      -  /* Count tokens shifted since error; after three, turn off error
      -     status.  */
      -  if (yyerrstatus)
      -    yyerrstatus--;
      +  /* Shift the lookahead token.  */
       
      -  /* Shift the look-ahead token.  */
      -  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
      +#if YYDEBUG != 0
      +  if (yydebug)
      +    fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
      +#endif
       
      -  /* Discard the shifted token unless it is eof.  */
      +  /* Discard the token being shifted unless it is eof.  */
         if (yychar != YYEOF)
           yychar = YYEMPTY;
       
      -  yystate = yyn;
         *++yyvsp = yylval;
      +#ifdef YYLSP_NEEDED
      +  *++yylsp = yylloc;
      +#endif
       
      -  goto yynewstate;
      +  /* count tokens shifted since error; after three, turn off error status.  */
      +  if (yyerrstatus) yyerrstatus--;
       
      +  yystate = yyn;
      +  goto yynewstate;
       
      -/*-----------------------------------------------------------.
      -| yydefault -- do the default action for the current state.  |
      -`-----------------------------------------------------------*/
      +/* Do the default action for the current state.  */
       yydefault:
      +
         yyn = yydefact[yystate];
         if (yyn == 0)
           goto yyerrlab;
      -  goto yyreduce;
       
      -
      -/*-----------------------------.
      -| yyreduce -- Do a reduction.  |
      -`-----------------------------*/
      +/* Do a reduction.  yyn is the number of a rule to reduce with.  */
       yyreduce:
      -  /* yyn is the number of a rule to reduce with.  */
         yylen = yyr2[yyn];
      +  if (yylen > 0)
      +    yyval = yyvsp[1-yylen]; /* implement default value of the action */
       
      -  /* If YYLEN is nonzero, implement the default value of the action:
      -     `$$ = $1'.
      -
      -     Otherwise, the following line sets YYVAL to garbage.
      -     This behavior is undocumented and Bison
      -     users should not rely upon it.  Assigning to YYVAL
      -     unconditionally makes the parser a bit smaller, and it avoids a
      -     GCC warning that YYVAL may be used uninitialized.  */
      -  yyval = yyvsp[1-yylen];
      -
      -
      -  YY_REDUCE_PRINT (yyn);
      -  switch (yyn)
      +#if YYDEBUG != 0
      +  if (yydebug)
           {
      -        case 29:
      -#line 1111 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
      -    break;
      -
      -  case 30:
      -#line 1111 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
      -    break;
      -
      -  case 31:
      -#line 1112 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
      -    break;
      -
      -  case 32:
      -#line 1112 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
      -    break;
      -
      -  case 33:
      -#line 1113 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
      -    break;
      -
      -  case 34:
      -#line 1113 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
      -    break;
      -
      -  case 35:
      -#line 1114 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
      -    break;
      -
      -  case 36:
      -#line 1114 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
      -    break;
      -
      -  case 37:
      -#line 1115 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
      -    break;
      -
      -  case 38:
      -#line 1115 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
      -    break;
      -
      -  case 39:
      -#line 1119 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
      -    break;
      -
      -  case 40:
      -#line 1119 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
      -    break;
      -
      -  case 41:
      -#line 1120 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
      -    break;
      -
      -  case 42:
      -#line 1120 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
      -    break;
      -
      -  case 43:
      -#line 1121 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
      -    break;
      -
      -  case 44:
      -#line 1121 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
      -    break;
      -
      -  case 45:
      -#line 1122 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
      -    break;
      -
      -  case 46:
      -#line 1122 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
      -    break;
      -
      -  case 47:
      -#line 1123 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
      -    break;
      -
      -  case 48:
      -#line 1123 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
      -    break;
      -
      -  case 49:
      -#line 1124 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
      -    break;
      -
      -  case 50:
      -#line 1124 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
      -    break;
      -
      -  case 51:
      -#line 1125 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
      -    break;
      +      int i;
       
      -  case 52:
      -#line 1125 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
      -    break;
      -
      -  case 53:
      -#line 1126 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
      -    break;
      -
      -  case 54:
      -#line 1127 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
      -    break;
      -
      -  case 65:
      -#line 1136 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.StrVal) = 0; ;}
      -    break;
      -
      -  case 66:
      -#line 1140 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
      +      fprintf (stderr, "Reducing via rule %d (line %d), ",
      +	       yyn, yyrline[yyn]);
      +
      +      /* Print the symbols being reduced, and their result.  */
      +      for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
      +	fprintf (stderr, "%s ", yytname[yyrhs[i]]);
      +      fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
      +    }
      +#endif
      +
      +
      +  switch (yyn) {
      +
      +case 28:
      +#line 1113 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.IPredicate = ICmpInst::ICMP_EQ; ;
      +    break;}
      +case 29:
      +#line 1113 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.IPredicate = ICmpInst::ICMP_NE; ;
      +    break;}
      +case 30:
      +#line 1114 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.IPredicate = ICmpInst::ICMP_SLT; ;
      +    break;}
      +case 31:
      +#line 1114 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.IPredicate = ICmpInst::ICMP_SGT; ;
      +    break;}
      +case 32:
      +#line 1115 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.IPredicate = ICmpInst::ICMP_SLE; ;
      +    break;}
      +case 33:
      +#line 1115 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.IPredicate = ICmpInst::ICMP_SGE; ;
      +    break;}
      +case 34:
      +#line 1116 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.IPredicate = ICmpInst::ICMP_ULT; ;
      +    break;}
      +case 35:
      +#line 1116 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.IPredicate = ICmpInst::ICMP_UGT; ;
      +    break;}
      +case 36:
      +#line 1117 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.IPredicate = ICmpInst::ICMP_ULE; ;
      +    break;}
      +case 37:
      +#line 1117 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.IPredicate = ICmpInst::ICMP_UGE; ;
      +    break;}
      +case 38:
      +#line 1121 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.FPredicate = FCmpInst::FCMP_OEQ; ;
      +    break;}
      +case 39:
      +#line 1121 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.FPredicate = FCmpInst::FCMP_ONE; ;
      +    break;}
      +case 40:
      +#line 1122 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.FPredicate = FCmpInst::FCMP_OLT; ;
      +    break;}
      +case 41:
      +#line 1122 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.FPredicate = FCmpInst::FCMP_OGT; ;
      +    break;}
      +case 42:
      +#line 1123 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.FPredicate = FCmpInst::FCMP_OLE; ;
      +    break;}
      +case 43:
      +#line 1123 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.FPredicate = FCmpInst::FCMP_OGE; ;
      +    break;}
      +case 44:
      +#line 1124 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.FPredicate = FCmpInst::FCMP_ORD; ;
      +    break;}
      +case 45:
      +#line 1124 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.FPredicate = FCmpInst::FCMP_UNO; ;
      +    break;}
      +case 46:
      +#line 1125 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.FPredicate = FCmpInst::FCMP_UEQ; ;
      +    break;}
      +case 47:
      +#line 1125 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.FPredicate = FCmpInst::FCMP_UNE; ;
      +    break;}
      +case 48:
      +#line 1126 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.FPredicate = FCmpInst::FCMP_ULT; ;
      +    break;}
      +case 49:
      +#line 1126 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.FPredicate = FCmpInst::FCMP_UGT; ;
      +    break;}
      +case 50:
      +#line 1127 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.FPredicate = FCmpInst::FCMP_ULE; ;
      +    break;}
      +case 51:
      +#line 1127 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.FPredicate = FCmpInst::FCMP_UGE; ;
      +    break;}
      +case 52:
      +#line 1128 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.FPredicate = FCmpInst::FCMP_TRUE; ;
      +    break;}
      +case 53:
      +#line 1129 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.FPredicate = FCmpInst::FCMP_FALSE; ;
      +    break;}
      +case 64:
      +#line 1138 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.StrVal = 0; ;
      +    break;}
      +case 65:
      +#line 1142 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.StrVal = yyvsp[-1].StrVal;
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 67:
      -#line 1144 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.StrVal) = 0;
      +  ;
      +    break;}
      +case 66:
      +#line 1146 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.StrVal = 0;
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 71:
      -#line 1152 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.StrVal) = 0;
      +  ;
      +    break;}
      +case 70:
      +#line 1154 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.StrVal = 0;
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 72:
      -#line 1157 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal);
      +  ;
      +    break;}
      +case 71:
      +#line 1159 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.StrVal = yyvsp[-1].StrVal;
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 73:
      -#line 1163 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
      -    break;
      -
      -  case 74:
      -#line 1164 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
      -    break;
      -
      -  case 75:
      -#line 1165 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
      -    break;
      -
      -  case 76:
      -#line 1166 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
      -    break;
      -
      -  case 77:
      -#line 1167 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
      -    break;
      -
      -  case 78:
      -#line 1171 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
      -    break;
      -
      -  case 79:
      -#line 1172 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
      -    break;
      -
      -  case 80:
      -#line 1173 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
      -    break;
      -
      -  case 81:
      -#line 1177 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.Visibility) = GlobalValue::DefaultVisibility;   ;}
      -    break;
      -
      -  case 82:
      -#line 1178 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.Visibility) = GlobalValue::DefaultVisibility;   ;}
      -    break;
      -
      -  case 83:
      -#line 1179 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.Visibility) = GlobalValue::HiddenVisibility;    ;}
      -    break;
      -
      -  case 84:
      -#line 1180 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.Visibility) = GlobalValue::ProtectedVisibility; ;}
      -    break;
      -
      -  case 85:
      -#line 1184 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
      -    break;
      -
      -  case 86:
      -#line 1185 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
      -    break;
      -
      -  case 87:
      -#line 1186 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
      -    break;
      -
      -  case 88:
      -#line 1190 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
      -    break;
      -
      -  case 89:
      -#line 1191 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
      -    break;
      -
      -  case 90:
      -#line 1192 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
      -    break;
      -
      -  case 91:
      -#line 1193 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
      -    break;
      -
      -  case 92:
      -#line 1194 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
      -    break;
      -
      -  case 93:
      -#line 1198 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
      -    break;
      -
      -  case 94:
      -#line 1199 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
      -    break;
      -
      -  case 95:
      -#line 1200 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
      -    break;
      -
      -  case 96:
      -#line 1203 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.UIntVal) = CallingConv::C; ;}
      -    break;
      -
      -  case 97:
      -#line 1204 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.UIntVal) = CallingConv::C; ;}
      -    break;
      -
      -  case 98:
      -#line 1205 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.UIntVal) = CallingConv::Fast; ;}
      -    break;
      -
      -  case 99:
      -#line 1206 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.UIntVal) = CallingConv::Cold; ;}
      -    break;
      -
      -  case 100:
      -#line 1207 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
      -    break;
      -
      -  case 101:
      -#line 1208 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
      -    break;
      -
      -  case 102:
      -#line 1209 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -                   if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val))
      +  ;
      +    break;}
      +case 72:
      +#line 1165 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.Linkage = GlobalValue::InternalLinkage; ;
      +    break;}
      +case 73:
      +#line 1166 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.Linkage = GlobalValue::WeakLinkage; ;
      +    break;}
      +case 74:
      +#line 1167 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.Linkage = GlobalValue::LinkOnceLinkage; ;
      +    break;}
      +case 75:
      +#line 1168 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.Linkage = GlobalValue::AppendingLinkage; ;
      +    break;}
      +case 76:
      +#line 1169 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.Linkage = GlobalValue::DLLExportLinkage; ;
      +    break;}
      +case 77:
      +#line 1173 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.Linkage = GlobalValue::DLLImportLinkage; ;
      +    break;}
      +case 78:
      +#line 1174 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.Linkage = GlobalValue::ExternalWeakLinkage; ;
      +    break;}
      +case 79:
      +#line 1175 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.Linkage = GlobalValue::ExternalLinkage; ;
      +    break;}
      +case 80:
      +#line 1179 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.Visibility = GlobalValue::DefaultVisibility;   ;
      +    break;}
      +case 81:
      +#line 1180 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.Visibility = GlobalValue::DefaultVisibility;   ;
      +    break;}
      +case 82:
      +#line 1181 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.Visibility = GlobalValue::HiddenVisibility;    ;
      +    break;}
      +case 83:
      +#line 1182 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.Visibility = GlobalValue::ProtectedVisibility; ;
      +    break;}
      +case 84:
      +#line 1186 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.Linkage = GlobalValue::ExternalLinkage; ;
      +    break;}
      +case 85:
      +#line 1187 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.Linkage = GlobalValue::DLLImportLinkage; ;
      +    break;}
      +case 86:
      +#line 1188 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.Linkage = GlobalValue::ExternalWeakLinkage; ;
      +    break;}
      +case 87:
      +#line 1192 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.Linkage = GlobalValue::ExternalLinkage; ;
      +    break;}
      +case 88:
      +#line 1193 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.Linkage = GlobalValue::InternalLinkage; ;
      +    break;}
      +case 89:
      +#line 1194 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.Linkage = GlobalValue::LinkOnceLinkage; ;
      +    break;}
      +case 90:
      +#line 1195 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.Linkage = GlobalValue::WeakLinkage; ;
      +    break;}
      +case 91:
      +#line 1196 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.Linkage = GlobalValue::DLLExportLinkage; ;
      +    break;}
      +case 92:
      +#line 1200 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.Linkage = GlobalValue::ExternalLinkage; ;
      +    break;}
      +case 93:
      +#line 1201 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.Linkage = GlobalValue::WeakLinkage; ;
      +    break;}
      +case 94:
      +#line 1202 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.Linkage = GlobalValue::InternalLinkage; ;
      +    break;}
      +case 95:
      +#line 1205 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.UIntVal = CallingConv::C; ;
      +    break;}
      +case 96:
      +#line 1206 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.UIntVal = CallingConv::C; ;
      +    break;}
      +case 97:
      +#line 1207 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.UIntVal = CallingConv::Fast; ;
      +    break;}
      +case 98:
      +#line 1208 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.UIntVal = CallingConv::Cold; ;
      +    break;}
      +case 99:
      +#line 1209 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.UIntVal = CallingConv::X86_StdCall; ;
      +    break;}
      +case 100:
      +#line 1210 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.UIntVal = CallingConv::X86_FastCall; ;
      +    break;}
      +case 101:
      +#line 1211 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +                   if ((unsigned)yyvsp[0].UInt64Val != yyvsp[0].UInt64Val)
                            GEN_ERROR("Calling conv too large");
      -                   (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
      +                   yyval.UIntVal = yyvsp[0].UInt64Val;
                         CHECK_FOR_ERROR
      -                 ;}
      -    break;
      -
      -  case 103:
      -#line 1216 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.ParamAttrs) = ParamAttr::ZExt;      ;}
      -    break;
      -
      -  case 104:
      -#line 1217 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.ParamAttrs) = ParamAttr::ZExt;      ;}
      -    break;
      -
      -  case 105:
      -#line 1218 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.ParamAttrs) = ParamAttr::SExt;      ;}
      -    break;
      -
      -  case 106:
      -#line 1219 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.ParamAttrs) = ParamAttr::SExt;      ;}
      -    break;
      -
      -  case 107:
      -#line 1220 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.ParamAttrs) = ParamAttr::InReg;     ;}
      -    break;
      -
      -  case 108:
      -#line 1221 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.ParamAttrs) = ParamAttr::StructRet; ;}
      -    break;
      -
      -  case 109:
      -#line 1222 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.ParamAttrs) = ParamAttr::NoAlias;   ;}
      -    break;
      -
      -  case 110:
      -#line 1223 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.ParamAttrs) = ParamAttr::ByVal;     ;}
      -    break;
      -
      -  case 111:
      -#line 1224 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.ParamAttrs) = ParamAttr::Nest;      ;}
      -    break;
      -
      -  case 112:
      -#line 1227 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.ParamAttrs) = ParamAttr::None; ;}
      -    break;
      -
      -  case 113:
      -#line 1228 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -                (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
      -              ;}
      -    break;
      -
      -  case 114:
      -#line 1233 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.ParamAttrs) = ParamAttr::NoReturn; ;}
      -    break;
      -
      -  case 115:
      -#line 1234 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.ParamAttrs) = ParamAttr::NoUnwind; ;}
      -    break;
      -
      -  case 116:
      -#line 1235 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.ParamAttrs) = ParamAttr::ZExt;     ;}
      -    break;
      -
      -  case 117:
      -#line 1236 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.ParamAttrs) = ParamAttr::SExt;     ;}
      -    break;
      -
      -  case 118:
      -#line 1237 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.ParamAttrs) = ParamAttr::ReadNone; ;}
      -    break;
      -
      -  case 119:
      -#line 1238 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.ParamAttrs) = ParamAttr::ReadOnly; ;}
      -    break;
      -
      -  case 120:
      -#line 1241 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.ParamAttrs) = ParamAttr::None; ;}
      -    break;
      -
      -  case 121:
      -#line 1242 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -                (yyval.ParamAttrs) = (yyvsp[(1) - (2)].ParamAttrs) | (yyvsp[(2) - (2)].ParamAttrs);
      -              ;}
      -    break;
      -
      -  case 122:
      -#line 1247 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.StrVal) = 0; ;}
      -    break;
      -
      -  case 123:
      -#line 1248 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -                (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
      -              ;}
      -    break;
      -
      -  case 124:
      -#line 1255 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.UIntVal) = 0; ;}
      -    break;
      -
      -  case 125:
      -#line 1256 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -  (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val);
      -  if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
      +                 ;
      +    break;}
      +case 102:
      +#line 1218 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.ParamAttrs = ParamAttr::ZExt;      ;
      +    break;}
      +case 103:
      +#line 1219 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.ParamAttrs = ParamAttr::ZExt;      ;
      +    break;}
      +case 104:
      +#line 1220 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.ParamAttrs = ParamAttr::SExt;      ;
      +    break;}
      +case 105:
      +#line 1221 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.ParamAttrs = ParamAttr::SExt;      ;
      +    break;}
      +case 106:
      +#line 1222 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.ParamAttrs = ParamAttr::InReg;     ;
      +    break;}
      +case 107:
      +#line 1223 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.ParamAttrs = ParamAttr::StructRet; ;
      +    break;}
      +case 108:
      +#line 1224 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.ParamAttrs = ParamAttr::NoAlias;   ;
      +    break;}
      +case 109:
      +#line 1225 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.ParamAttrs = ParamAttr::ByVal;     ;
      +    break;}
      +case 110:
      +#line 1226 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.ParamAttrs = ParamAttr::Nest;      ;
      +    break;}
      +case 111:
      +#line 1229 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.ParamAttrs = ParamAttr::None; ;
      +    break;}
      +case 112:
      +#line 1230 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +                yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs;
      +              ;
      +    break;}
      +case 113:
      +#line 1235 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.ParamAttrs = ParamAttr::NoReturn; ;
      +    break;}
      +case 114:
      +#line 1236 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.ParamAttrs = ParamAttr::NoUnwind; ;
      +    break;}
      +case 115:
      +#line 1237 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.ParamAttrs = ParamAttr::ZExt;     ;
      +    break;}
      +case 116:
      +#line 1238 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.ParamAttrs = ParamAttr::SExt;     ;
      +    break;}
      +case 117:
      +#line 1239 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.ParamAttrs = ParamAttr::ReadNone; ;
      +    break;}
      +case 118:
      +#line 1240 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.ParamAttrs = ParamAttr::ReadOnly; ;
      +    break;}
      +case 119:
      +#line 1243 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.ParamAttrs = ParamAttr::None; ;
      +    break;}
      +case 120:
      +#line 1244 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +                yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs;
      +              ;
      +    break;}
      +case 121:
      +#line 1249 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.StrVal = 0; ;
      +    break;}
      +case 122:
      +#line 1250 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +                yyval.StrVal = yyvsp[0].StrVal;
      +              ;
      +    break;}
      +case 123:
      +#line 1257 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.UIntVal = 0; ;
      +    break;}
      +case 124:
      +#line 1258 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +  yyval.UIntVal = yyvsp[0].UInt64Val;
      +  if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
           GEN_ERROR("Alignment must be a power of two");
         CHECK_FOR_ERROR
      -;}
      -    break;
      -
      -  case 126:
      -#line 1262 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.UIntVal) = 0; ;}
      -    break;
      -
      -  case 127:
      -#line 1263 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -  (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val);
      -  if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal)))
      +;
      +    break;}
      +case 125:
      +#line 1264 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.UIntVal = 0; ;
      +    break;}
      +case 126:
      +#line 1265 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +  yyval.UIntVal = yyvsp[0].UInt64Val;
      +  if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
           GEN_ERROR("Alignment must be a power of two");
         CHECK_FOR_ERROR
      -;}
      -    break;
      -
      -  case 128:
      -#line 1271 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -  for (unsigned i = 0, e = (yyvsp[(2) - (2)].StrVal)->length(); i != e; ++i)
      -    if ((*(yyvsp[(2) - (2)].StrVal))[i] == '"' || (*(yyvsp[(2) - (2)].StrVal))[i] == '\\')
      +;
      +    break;}
      +case 127:
      +#line 1274 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +  for (unsigned i = 0, e = yyvsp[0].StrVal->length(); i != e; ++i)
      +    if ((*yyvsp[0].StrVal)[i] == '"' || (*yyvsp[0].StrVal)[i] == '\\')
             GEN_ERROR("Invalid character in section name");
      -  (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal);
      +  yyval.StrVal = yyvsp[0].StrVal;
         CHECK_FOR_ERROR
      -;}
      -    break;
      -
      -  case 129:
      -#line 1279 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.StrVal) = 0; ;}
      -    break;
      -
      -  case 130:
      -#line 1280 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;}
      -    break;
      -
      -  case 131:
      -#line 1285 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {;}
      -    break;
      -
      -  case 132:
      -#line 1286 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {;}
      -    break;
      -
      -  case 133:
      -#line 1287 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    CurGV->setSection(*(yyvsp[(1) - (1)].StrVal));
      -    delete (yyvsp[(1) - (1)].StrVal);
      +;
      +    break;}
      +case 128:
      +#line 1282 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.StrVal = 0; ;
      +    break;}
      +case 129:
      +#line 1283 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.StrVal = yyvsp[0].StrVal; ;
      +    break;}
      +case 130:
      +#line 1288 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{;
      +    break;}
      +case 131:
      +#line 1289 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{;
      +    break;}
      +case 132:
      +#line 1290 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    CurGV->setSection(*yyvsp[0].StrVal);
      +    delete yyvsp[0].StrVal;
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 134:
      -#line 1292 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val)))
      +  ;
      +    break;}
      +case 133:
      +#line 1295 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    if (yyvsp[0].UInt64Val != 0 && !isPowerOf2_32(yyvsp[0].UInt64Val))
             GEN_ERROR("Alignment must be a power of two");
      -    CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val));
      +    CurGV->setAlignment(yyvsp[0].UInt64Val);
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 142:
      -#line 1308 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
      +  ;
      +    break;}
      +case 141:
      +#line 1311 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.TypeVal = new PATypeHolder(OpaqueType::get());
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 143:
      -#line 1312 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType));
      +  ;
      +    break;}
      +case 142:
      +#line 1315 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType);
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 144:
      -#line 1316 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {                             // Pointer type?
      -    if (*(yyvsp[(1) - (2)].TypeVal) == Type::LabelTy)
      +  ;
      +    break;}
      +case 143:
      +#line 1319 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{                             // Pointer type?
      +    if (*yyvsp[-1].TypeVal == Type::LabelTy)
             GEN_ERROR("Cannot form a pointer to a basic block");
      -    (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (2)].TypeVal))));
      -    delete (yyvsp[(1) - (2)].TypeVal);
      +    yyval.TypeVal = new PATypeHolder(HandleUpRefs(PointerType::get(*yyvsp[-1].TypeVal)));
      +    delete yyvsp[-1].TypeVal;
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 145:
      -#line 1323 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {            // Named types are also simple types...
      -    const Type* tmp = getTypeVal((yyvsp[(1) - (1)].ValIDVal));
      +  ;
      +    break;}
      +case 144:
      +#line 1326 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{             // Pointer type?
      +    if (*yyvsp[-5].TypeVal == Type::LabelTy)
      +      GEN_ERROR("Cannot form a pointer to a basic block");
      +    yyval.TypeVal = new PATypeHolder(HandleUpRefs(PointerType::get(*yyvsp[-5].TypeVal, yyvsp[-2].UInt64Val)));
      +    delete yyvsp[-5].TypeVal;
           CHECK_FOR_ERROR
      -    (yyval.TypeVal) = new PATypeHolder(tmp);
      -  ;}
      -    break;
      -
      -  case 146:
      -#line 1328 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {                   // Type UpReference
      -    if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range");
      +  ;
      +    break;}
      +case 145:
      +#line 1333 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{            // Named types are also simple types...
      +    const Type* tmp = getTypeVal(yyvsp[0].ValIDVal);
      +    CHECK_FOR_ERROR
      +    yyval.TypeVal = new PATypeHolder(tmp);
      +  ;
      +    break;}
      +case 146:
      +#line 1338 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{                   // Type UpReference
      +    if (yyvsp[0].UInt64Val > (uint64_t)~0U) GEN_ERROR("Value out of range");
           OpaqueType *OT = OpaqueType::get();        // Use temporary placeholder
      -    UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT));  // Add to vector...
      -    (yyval.TypeVal) = new PATypeHolder(OT);
      +    UpRefs.push_back(UpRefRecord((unsigned)yyvsp[0].UInt64Val, OT));  // Add to vector...
      +    yyval.TypeVal = new PATypeHolder(OT);
           UR_OUT("New Upreference!\n");
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 147:
      -#line 1336 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +  ;
      +    break;}
      +case 147:
      +#line 1346 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           // Allow but ignore attributes on function types; this permits auto-upgrade.
           // FIXME: remove in LLVM 3.0.
      -    const Type* RetTy = *(yyvsp[(1) - (5)].TypeVal);
      +    const Type* RetTy = *yyvsp[-4].TypeVal;
           if (!(RetTy->isFirstClassType() || RetTy == Type::VoidTy ||
                 isa(RetTy)))
             GEN_ERROR("LLVM Functions cannot return aggregates");
       
           std::vector Params;
      -    TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
      +    TypeWithAttrsList::iterator I = yyvsp[-2].TypeWithAttrsList->begin(), E = yyvsp[-2].TypeWithAttrsList->end();
           for (; I != E; ++I ) {
             const Type *Ty = I->Ty->get();
             Params.push_back(Ty);
      @@ -4010,20 +3075,19 @@
           CHECK_FOR_ERROR
       
           FunctionType *FT = FunctionType::get(RetTy, Params, isVarArg);
      -    delete (yyvsp[(3) - (5)].TypeWithAttrsList);   // Delete the argument list
      -    delete (yyvsp[(1) - (5)].TypeVal);   // Delete the return type handle
      -    (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); 
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 148:
      -#line 1366 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +    delete yyvsp[-2].TypeWithAttrsList;   // Delete the argument list
      +    delete yyvsp[-4].TypeVal;   // Delete the return type handle
      +    yyval.TypeVal = new PATypeHolder(HandleUpRefs(FT)); 
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 148:
      +#line 1376 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           // Allow but ignore attributes on function types; this permits auto-upgrade.
           // FIXME: remove in LLVM 3.0.
           std::vector Params;
      -    TypeWithAttrsList::iterator I = (yyvsp[(3) - (5)].TypeWithAttrsList)->begin(), E = (yyvsp[(3) - (5)].TypeWithAttrsList)->end();
      +    TypeWithAttrsList::iterator I = yyvsp[-2].TypeWithAttrsList->begin(), E = yyvsp[-2].TypeWithAttrsList->end();
           for ( ; I != E; ++I ) {
             const Type* Ty = I->Ty->get();
             Params.push_back(Ty);
      @@ -4038,303 +3102,282 @@
       
           CHECK_FOR_ERROR
       
      -    FunctionType *FT = FunctionType::get((yyvsp[(1) - (5)].PrimType), Params, isVarArg);
      -    delete (yyvsp[(3) - (5)].TypeWithAttrsList);      // Delete the argument list
      -    (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FT)); 
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 149:
      -#line 1391 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {          // Sized array type?
      -    (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
      -    delete (yyvsp[(4) - (5)].TypeVal);
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 150:
      -#line 1396 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {          // Vector type?
      -     const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get();
      -     if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val))
      +    FunctionType *FT = FunctionType::get(yyvsp[-4].PrimType, Params, isVarArg);
      +    delete yyvsp[-2].TypeWithAttrsList;      // Delete the argument list
      +    yyval.TypeVal = new PATypeHolder(HandleUpRefs(FT)); 
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 149:
      +#line 1401 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{          // Sized array type?
      +    yyval.TypeVal = new PATypeHolder(HandleUpRefs(ArrayType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
      +    delete yyvsp[-1].TypeVal;
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 150:
      +#line 1406 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{          // Vector type?
      +     const llvm::Type* ElemTy = yyvsp[-1].TypeVal->get();
      +     if ((unsigned)yyvsp[-3].UInt64Val != yyvsp[-3].UInt64Val)
               GEN_ERROR("Unsigned result not equal to signed result");
            if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
               GEN_ERROR("Element type of a VectorType must be primitive");
      -     (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(VectorType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val))));
      -     delete (yyvsp[(4) - (5)].TypeVal);
      +     yyval.TypeVal = new PATypeHolder(HandleUpRefs(VectorType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val)));
      +     delete yyvsp[-1].TypeVal;
            CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 151:
      -#line 1406 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {                        // Structure type?
      +  ;
      +    break;}
      +case 151:
      +#line 1416 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{                        // Structure type?
           std::vector Elements;
      -    for (std::list::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(),
      -           E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I)
      +    for (std::list::iterator I = yyvsp[-1].TypeList->begin(),
      +           E = yyvsp[-1].TypeList->end(); I != E; ++I)
             Elements.push_back(*I);
       
      -    (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
      -    delete (yyvsp[(2) - (3)].TypeList);
      +    yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements)));
      +    delete yyvsp[-1].TypeList;
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 152:
      -#line 1416 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {                                  // Empty structure type?
      -    (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector()));
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 153:
      -#line 1420 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +  ;
      +    break;}
      +case 152:
      +#line 1426 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{                                  // Empty structure type?
      +    yyval.TypeVal = new PATypeHolder(StructType::get(std::vector()));
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 153:
      +#line 1430 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           std::vector Elements;
      -    for (std::list::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(),
      -           E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I)
      +    for (std::list::iterator I = yyvsp[-2].TypeList->begin(),
      +           E = yyvsp[-2].TypeList->end(); I != E; ++I)
             Elements.push_back(*I);
       
      -    (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
      -    delete (yyvsp[(3) - (5)].TypeList);
      +    yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
      +    delete yyvsp[-2].TypeList;
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 154:
      -#line 1430 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {                         // Empty structure type?
      -    (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector(), true));
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 155:
      -#line 1437 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +  ;
      +    break;}
      +case 154:
      +#line 1440 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{                         // Empty structure type?
      +    yyval.TypeVal = new PATypeHolder(StructType::get(std::vector(), true));
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 155:
      +#line 1447 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           // Allow but ignore attributes on function types; this permits auto-upgrade.
           // FIXME: remove in LLVM 3.0.
      -    (yyval.TypeWithAttrs).Ty = (yyvsp[(1) - (2)].TypeVal); 
      -    (yyval.TypeWithAttrs).Attrs = ParamAttr::None;
      -  ;}
      -    break;
      -
      -  case 156:
      -#line 1446 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +    yyval.TypeWithAttrs.Ty = yyvsp[-1].TypeVal; 
      +    yyval.TypeWithAttrs.Attrs = ParamAttr::None;
      +  ;
      +    break;}
      +case 156:
      +#line 1456 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           if (!UpRefs.empty())
      -      GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription());
      -    if (!(*(yyvsp[(1) - (1)].TypeVal))->isFirstClassType())
      +      GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
      +    if (!(*yyvsp[0].TypeVal)->isFirstClassType())
             GEN_ERROR("LLVM functions cannot return aggregate types");
      -    (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal);
      -  ;}
      -    break;
      -
      -  case 157:
      -#line 1453 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.TypeVal) = new PATypeHolder(Type::VoidTy);
      -  ;}
      -    break;
      -
      -  case 158:
      -#line 1458 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
      -    (yyval.TypeWithAttrsList)->push_back((yyvsp[(1) - (1)].TypeWithAttrs));
      +    yyval.TypeVal = yyvsp[0].TypeVal;
      +  ;
      +    break;}
      +case 157:
      +#line 1463 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.TypeVal = new PATypeHolder(Type::VoidTy);
      +  ;
      +    break;}
      +case 158:
      +#line 1468 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.TypeWithAttrsList = new TypeWithAttrsList();
      +    yyval.TypeWithAttrsList->push_back(yyvsp[0].TypeWithAttrs);
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 159:
      -#line 1463 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    ((yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList))->push_back((yyvsp[(3) - (3)].TypeWithAttrs));
      +  ;
      +    break;}
      +case 159:
      +#line 1473 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    (yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList)->push_back(yyvsp[0].TypeWithAttrs);
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 161:
      -#line 1471 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.TypeWithAttrsList)=(yyvsp[(1) - (3)].TypeWithAttrsList);
      +  ;
      +    break;}
      +case 161:
      +#line 1481 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList;
           TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
           TWA.Ty = new PATypeHolder(Type::VoidTy);
      -    (yyval.TypeWithAttrsList)->push_back(TWA);
      +    yyval.TypeWithAttrsList->push_back(TWA);
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 162:
      -#line 1478 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.TypeWithAttrsList) = new TypeWithAttrsList;
      +  ;
      +    break;}
      +case 162:
      +#line 1488 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.TypeWithAttrsList = new TypeWithAttrsList;
           TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None;
           TWA.Ty = new PATypeHolder(Type::VoidTy);
      -    (yyval.TypeWithAttrsList)->push_back(TWA);
      +    yyval.TypeWithAttrsList->push_back(TWA);
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 163:
      -#line 1485 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.TypeWithAttrsList) = new TypeWithAttrsList();
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 164:
      -#line 1493 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.TypeList) = new std::list();
      -    (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal)); 
      -    delete (yyvsp[(1) - (1)].TypeVal);
      +  ;
      +    break;}
      +case 163:
      +#line 1495 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.TypeWithAttrsList = new TypeWithAttrsList();
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 165:
      -#line 1499 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal)); 
      -    delete (yyvsp[(3) - (3)].TypeVal);
      +  ;
      +    break;}
      +case 164:
      +#line 1503 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.TypeList = new std::list();
      +    yyval.TypeList->push_back(*yyvsp[0].TypeVal); 
      +    delete yyvsp[0].TypeVal;
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 165:
      +#line 1509 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    (yyval.TypeList=yyvsp[-2].TypeList)->push_back(*yyvsp[0].TypeVal); 
      +    delete yyvsp[0].TypeVal;
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 166:
      -#line 1511 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { // Nonempty unsized arr
      +  ;
      +    break;}
      +case 166:
      +#line 1521 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ // Nonempty unsized arr
           if (!UpRefs.empty())
      -      GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
      -    const ArrayType *ATy = dyn_cast((yyvsp[(1) - (4)].TypeVal)->get());
      +      GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
      +    const ArrayType *ATy = dyn_cast(yyvsp[-3].TypeVal->get());
           if (ATy == 0)
             GEN_ERROR("Cannot make array constant with type: '" + 
      -                     (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
      +                     (*yyvsp[-3].TypeVal)->getDescription() + "'");
           const Type *ETy = ATy->getElementType();
           int NumElements = ATy->getNumElements();
       
           // Verify that we have the correct size...
      -    if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
      +    if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
             GEN_ERROR("Type mismatch: constant sized array initialized with " +
      -                     utostr((yyvsp[(3) - (4)].ConstVector)->size()) +  " arguments, but has size of " + 
      +                     utostr(yyvsp[-1].ConstVector->size()) +  " arguments, but has size of " + 
                            itostr(NumElements) + "");
       
           // Verify all elements are correct type!
      -    for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
      -      if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
      +    for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
      +      if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
               GEN_ERROR("Element #" + utostr(i) + " is not of type '" + 
                              ETy->getDescription() +"' as required!\nIt is of type '"+
      -                       (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
      +                       (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
           }
       
      -    (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector));
      -    delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
      +    yyval.ConstVal = ConstantArray::get(ATy, *yyvsp[-1].ConstVector);
      +    delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 167:
      -#line 1539 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +  ;
      +    break;}
      +case 167:
      +#line 1549 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           if (!UpRefs.empty())
      -      GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
      -    const ArrayType *ATy = dyn_cast((yyvsp[(1) - (3)].TypeVal)->get());
      +      GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
      +    const ArrayType *ATy = dyn_cast(yyvsp[-2].TypeVal->get());
           if (ATy == 0)
             GEN_ERROR("Cannot make array constant with type: '" + 
      -                     (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
      +                     (*yyvsp[-2].TypeVal)->getDescription() + "'");
       
           int NumElements = ATy->getNumElements();
           if (NumElements != -1 && NumElements != 0) 
             GEN_ERROR("Type mismatch: constant sized array initialized with 0"
                            " arguments, but has size of " + itostr(NumElements) +"");
      -    (yyval.ConstVal) = ConstantArray::get(ATy, std::vector());
      -    delete (yyvsp[(1) - (3)].TypeVal);
      +    yyval.ConstVal = ConstantArray::get(ATy, std::vector());
      +    delete yyvsp[-2].TypeVal;
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 168:
      -#line 1555 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +  ;
      +    break;}
      +case 168:
      +#line 1565 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           if (!UpRefs.empty())
      -      GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
      -    const ArrayType *ATy = dyn_cast((yyvsp[(1) - (3)].TypeVal)->get());
      +      GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
      +    const ArrayType *ATy = dyn_cast(yyvsp[-2].TypeVal->get());
           if (ATy == 0)
             GEN_ERROR("Cannot make array constant with type: '" + 
      -                     (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
      +                     (*yyvsp[-2].TypeVal)->getDescription() + "'");
       
           int NumElements = ATy->getNumElements();
           const Type *ETy = ATy->getElementType();
      -    if (NumElements != -1 && NumElements != int((yyvsp[(3) - (3)].StrVal)->length()))
      +    if (NumElements != -1 && NumElements != int(yyvsp[0].StrVal->length()))
             GEN_ERROR("Can't build string constant of size " + 
      -                     itostr((int)((yyvsp[(3) - (3)].StrVal)->length())) +
      +                     itostr((int)(yyvsp[0].StrVal->length())) +
                            " when array has size " + itostr(NumElements) + "");
           std::vector Vals;
           if (ETy == Type::Int8Ty) {
      -      for (unsigned i = 0; i < (yyvsp[(3) - (3)].StrVal)->length(); ++i)
      -        Vals.push_back(ConstantInt::get(ETy, (*(yyvsp[(3) - (3)].StrVal))[i]));
      +      for (unsigned i = 0; i < yyvsp[0].StrVal->length(); ++i)
      +        Vals.push_back(ConstantInt::get(ETy, (*yyvsp[0].StrVal)[i]));
           } else {
      -      delete (yyvsp[(3) - (3)].StrVal);
      +      delete yyvsp[0].StrVal;
             GEN_ERROR("Cannot build string arrays of non byte sized elements");
           }
      -    delete (yyvsp[(3) - (3)].StrVal);
      -    (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
      -    delete (yyvsp[(1) - (3)].TypeVal);
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 169:
      -#line 1582 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { // Nonempty unsized arr
      +    delete yyvsp[0].StrVal;
      +    yyval.ConstVal = ConstantArray::get(ATy, Vals);
      +    delete yyvsp[-2].TypeVal;
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 169:
      +#line 1592 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ // Nonempty unsized arr
           if (!UpRefs.empty())
      -      GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
      -    const VectorType *PTy = dyn_cast((yyvsp[(1) - (4)].TypeVal)->get());
      +      GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
      +    const VectorType *PTy = dyn_cast(yyvsp[-3].TypeVal->get());
           if (PTy == 0)
             GEN_ERROR("Cannot make packed constant with type: '" + 
      -                     (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
      +                     (*yyvsp[-3].TypeVal)->getDescription() + "'");
           const Type *ETy = PTy->getElementType();
           int NumElements = PTy->getNumElements();
       
           // Verify that we have the correct size...
      -    if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size())
      +    if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size())
             GEN_ERROR("Type mismatch: constant sized packed initialized with " +
      -                     utostr((yyvsp[(3) - (4)].ConstVector)->size()) +  " arguments, but has size of " + 
      +                     utostr(yyvsp[-1].ConstVector->size()) +  " arguments, but has size of " + 
                            itostr(NumElements) + "");
       
           // Verify all elements are correct type!
      -    for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) {
      -      if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType())
      +    for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
      +      if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
               GEN_ERROR("Element #" + utostr(i) + " is not of type '" + 
                  ETy->getDescription() +"' as required!\nIt is of type '"+
      -           (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'.");
      +           (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
           }
       
      -    (yyval.ConstVal) = ConstantVector::get(PTy, *(yyvsp[(3) - (4)].ConstVector));
      -    delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
      +    yyval.ConstVal = ConstantVector::get(PTy, *yyvsp[-1].ConstVector);
      +    delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 170:
      -#line 1610 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    const StructType *STy = dyn_cast((yyvsp[(1) - (4)].TypeVal)->get());
      +  ;
      +    break;}
      +case 170:
      +#line 1620 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    const StructType *STy = dyn_cast(yyvsp[-3].TypeVal->get());
           if (STy == 0)
             GEN_ERROR("Cannot make struct constant with type: '" + 
      -                     (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'");
      +                     (*yyvsp[-3].TypeVal)->getDescription() + "'");
       
      -    if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes())
      +    if (yyvsp[-1].ConstVector->size() != STy->getNumContainedTypes())
             GEN_ERROR("Illegal number of initializers for structure type");
       
           // Check to ensure that constants are compatible with the type initializer!
      -    for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i)
      -      if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i))
      +    for (unsigned i = 0, e = yyvsp[-1].ConstVector->size(); i != e; ++i)
      +      if ((*yyvsp[-1].ConstVector)[i]->getType() != STy->getElementType(i))
               GEN_ERROR("Expected type '" +
                              STy->getElementType(i)->getDescription() +
                              "' for element #" + utostr(i) +
      @@ -4345,21 +3388,20 @@
             GEN_ERROR("Unpacked Initializer to vector type '" +
                       STy->getDescription() + "'");
       
      -    (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector));
      -    delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector);
      +    yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-1].ConstVector);
      +    delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector;
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 171:
      -#line 1636 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +  ;
      +    break;}
      +case 171:
      +#line 1646 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           if (!UpRefs.empty())
      -      GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
      -    const StructType *STy = dyn_cast((yyvsp[(1) - (3)].TypeVal)->get());
      +      GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
      +    const StructType *STy = dyn_cast(yyvsp[-2].TypeVal->get());
           if (STy == 0)
             GEN_ERROR("Cannot make struct constant with type: '" + 
      -                     (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'");
      +                     (*yyvsp[-2].TypeVal)->getDescription() + "'");
       
           if (STy->getNumContainedTypes() != 0)
             GEN_ERROR("Illegal number of initializers for structure type");
      @@ -4369,26 +3411,25 @@
             GEN_ERROR("Unpacked Initializer to vector type '" +
                       STy->getDescription() + "'");
       
      -    (yyval.ConstVal) = ConstantStruct::get(STy, std::vector());
      -    delete (yyvsp[(1) - (3)].TypeVal);
      +    yyval.ConstVal = ConstantStruct::get(STy, std::vector());
      +    delete yyvsp[-2].TypeVal;
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 172:
      -#line 1656 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    const StructType *STy = dyn_cast((yyvsp[(1) - (6)].TypeVal)->get());
      +  ;
      +    break;}
      +case 172:
      +#line 1666 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    const StructType *STy = dyn_cast(yyvsp[-5].TypeVal->get());
           if (STy == 0)
             GEN_ERROR("Cannot make struct constant with type: '" + 
      -                     (*(yyvsp[(1) - (6)].TypeVal))->getDescription() + "'");
      +                     (*yyvsp[-5].TypeVal)->getDescription() + "'");
       
      -    if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes())
      +    if (yyvsp[-2].ConstVector->size() != STy->getNumContainedTypes())
             GEN_ERROR("Illegal number of initializers for structure type");
       
           // Check to ensure that constants are compatible with the type initializer!
      -    for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i)
      -      if ((*(yyvsp[(4) - (6)].ConstVector))[i]->getType() != STy->getElementType(i))
      +    for (unsigned i = 0, e = yyvsp[-2].ConstVector->size(); i != e; ++i)
      +      if ((*yyvsp[-2].ConstVector)[i]->getType() != STy->getElementType(i))
               GEN_ERROR("Expected type '" +
                              STy->getElementType(i)->getDescription() +
                              "' for element #" + utostr(i) +
      @@ -4399,21 +3440,20 @@
             GEN_ERROR("Vector initializer to non-vector type '" + 
                       STy->getDescription() + "'");
       
      -    (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(4) - (6)].ConstVector));
      -    delete (yyvsp[(1) - (6)].TypeVal); delete (yyvsp[(4) - (6)].ConstVector);
      +    yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-2].ConstVector);
      +    delete yyvsp[-5].TypeVal; delete yyvsp[-2].ConstVector;
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 173:
      -#line 1682 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +  ;
      +    break;}
      +case 173:
      +#line 1692 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           if (!UpRefs.empty())
      -      GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (5)].TypeVal))->getDescription());
      -    const StructType *STy = dyn_cast((yyvsp[(1) - (5)].TypeVal)->get());
      +      GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
      +    const StructType *STy = dyn_cast(yyvsp[-4].TypeVal->get());
           if (STy == 0)
             GEN_ERROR("Cannot make struct constant with type: '" + 
      -                     (*(yyvsp[(1) - (5)].TypeVal))->getDescription() + "'");
      +                     (*yyvsp[-4].TypeVal)->getDescription() + "'");
       
           if (STy->getNumContainedTypes() != 0)
             GEN_ERROR("Illegal number of initializers for structure type");
      @@ -4423,45 +3463,42 @@
             GEN_ERROR("Vector initializer to non-vector type '" + 
                       STy->getDescription() + "'");
       
      -    (yyval.ConstVal) = ConstantStruct::get(STy, std::vector());
      -    delete (yyvsp[(1) - (5)].TypeVal);
      +    yyval.ConstVal = ConstantStruct::get(STy, std::vector());
      +    delete yyvsp[-4].TypeVal;
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 174:
      -#line 1702 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +  ;
      +    break;}
      +case 174:
      +#line 1712 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           if (!UpRefs.empty())
      -      GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
      -    const PointerType *PTy = dyn_cast((yyvsp[(1) - (2)].TypeVal)->get());
      +      GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
      +    const PointerType *PTy = dyn_cast(yyvsp[-1].TypeVal->get());
           if (PTy == 0)
             GEN_ERROR("Cannot make null pointer constant with type: '" + 
      -                     (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'");
      +                     (*yyvsp[-1].TypeVal)->getDescription() + "'");
       
      -    (yyval.ConstVal) = ConstantPointerNull::get(PTy);
      -    delete (yyvsp[(1) - (2)].TypeVal);
      +    yyval.ConstVal = ConstantPointerNull::get(PTy);
      +    delete yyvsp[-1].TypeVal;
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 175:
      -#line 1714 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +  ;
      +    break;}
      +case 175:
      +#line 1724 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           if (!UpRefs.empty())
      -      GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
      -    (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get());
      -    delete (yyvsp[(1) - (2)].TypeVal);
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 176:
      -#line 1721 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +      GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
      +    yyval.ConstVal = UndefValue::get(yyvsp[-1].TypeVal->get());
      +    delete yyvsp[-1].TypeVal;
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 176:
      +#line 1731 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           if (!UpRefs.empty())
      -      GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
      -    const PointerType *Ty = dyn_cast((yyvsp[(1) - (2)].TypeVal)->get());
      +      GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
      +    const PointerType *Ty = dyn_cast(yyvsp[-1].TypeVal->get());
           if (Ty == 0)
             GEN_ERROR("Global const reference must be a pointer type");
       
      @@ -4475,7 +3512,7 @@
           Function *SavedCurFn = CurFun.CurrentFunction;
           CurFun.CurrentFunction = 0;
       
      -    Value *V = getExistingVal(Ty, (yyvsp[(2) - (2)].ValIDVal));
      +    Value *V = getExistingVal(Ty, yyvsp[0].ValIDVal);
           CHECK_FOR_ERROR
       
           CurFun.CurrentFunction = SavedCurFn;
      @@ -4490,16 +3527,16 @@
       
             // First check to see if the forward references value is already created!
             PerModuleInfo::GlobalRefsType::iterator I =
      -        CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)));
      +        CurModule.GlobalRefs.find(std::make_pair(PT, yyvsp[0].ValIDVal));
           
             if (I != CurModule.GlobalRefs.end()) {
               V = I->second;             // Placeholder already exists, use it...
      -        (yyvsp[(2) - (2)].ValIDVal).destroy();
      +        yyvsp[0].ValIDVal.destroy();
             } else {
               std::string Name;
      -        if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::GlobalName)
      -          Name = (yyvsp[(2) - (2)].ValIDVal).getName();
      -        else if ((yyvsp[(2) - (2)].ValIDVal).Type != ValID::GlobalID)
      +        if (yyvsp[0].ValIDVal.Type == ValID::GlobalName)
      +          Name = yyvsp[0].ValIDVal.getName();
      +        else if (yyvsp[0].ValIDVal.Type != ValID::GlobalID)
                 GEN_ERROR("Invalid reference to global");
       
               // Create the forward referenced global.
      @@ -4515,377 +3552,342 @@
               }
       
               // Keep track of the fact that we have a forward ref to recycle it
      -        CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV));
      +        CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, yyvsp[0].ValIDVal), GV));
               V = GV;
             }
           }
       
      -    (yyval.ConstVal) = cast(V);
      -    delete (yyvsp[(1) - (2)].TypeVal);            // Free the type handle
      +    yyval.ConstVal = cast(V);
      +    delete yyvsp[-1].TypeVal;            // Free the type handle
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 177:
      -#line 1787 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +  ;
      +    break;}
      +case 177:
      +#line 1797 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           if (!UpRefs.empty())
      -      GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
      -    if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType())
      +      GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
      +    if (yyvsp[-1].TypeVal->get() != yyvsp[0].ConstVal->getType())
             GEN_ERROR("Mismatched types for constant expression: " + 
      -        (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + " and " + (yyvsp[(2) - (2)].ConstVal)->getType()->getDescription());
      -    (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal);
      -    delete (yyvsp[(1) - (2)].TypeVal);
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 178:
      -#line 1797 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +        (*yyvsp[-1].TypeVal)->getDescription() + " and " + yyvsp[0].ConstVal->getType()->getDescription());
      +    yyval.ConstVal = yyvsp[0].ConstVal;
      +    delete yyvsp[-1].TypeVal;
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 178:
      +#line 1807 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           if (!UpRefs.empty())
      -      GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
      -    const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get();
      +      GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
      +    const Type *Ty = yyvsp[-1].TypeVal->get();
           if (isa(Ty) || Ty == Type::LabelTy || isa(Ty))
             GEN_ERROR("Cannot create a null initialized value of this type");
      -    (yyval.ConstVal) = Constant::getNullValue(Ty);
      -    delete (yyvsp[(1) - (2)].TypeVal);
      +    yyval.ConstVal = Constant::getNullValue(Ty);
      +    delete yyvsp[-1].TypeVal;
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 179:
      -#line 1807 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {      // integral constants
      -    if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)))
      +  ;
      +    break;}
      +case 179:
      +#line 1817 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{      // integral constants
      +    if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].SInt64Val))
             GEN_ERROR("Constant value doesn't fit in type");
      -    (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val), true);
      +    yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].SInt64Val, true);
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 180:
      -#line 1813 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {      // arbitrary precision integer constants
      -    uint32_t BitWidth = cast((yyvsp[(1) - (2)].PrimType))->getBitWidth();
      -    if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
      +  ;
      +    break;}
      +case 180:
      +#line 1823 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{      // arbitrary precision integer constants
      +    uint32_t BitWidth = cast(yyvsp[-1].PrimType)->getBitWidth();
      +    if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) {
             GEN_ERROR("Constant value does not fit in type");
           }
      -    (yyvsp[(2) - (2)].APIntVal)->sextOrTrunc(BitWidth);
      -    (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
      -    delete (yyvsp[(2) - (2)].APIntVal);
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 181:
      -#line 1823 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {      // integral constants
      -    if (!ConstantInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)))
      +    yyvsp[0].APIntVal->sextOrTrunc(BitWidth);
      +    yyval.ConstVal = ConstantInt::get(*yyvsp[0].APIntVal);
      +    delete yyvsp[0].APIntVal;
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 181:
      +#line 1833 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{      // integral constants
      +    if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].UInt64Val))
             GEN_ERROR("Constant value doesn't fit in type");
      -    (yyval.ConstVal) = ConstantInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val), false);
      +    yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].UInt64Val, false);
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 182:
      -#line 1829 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {      // arbitrary precision integer constants
      -    uint32_t BitWidth = cast((yyvsp[(1) - (2)].PrimType))->getBitWidth();
      -    if ((yyvsp[(2) - (2)].APIntVal)->getBitWidth() > BitWidth) {
      +  ;
      +    break;}
      +case 182:
      +#line 1839 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{      // arbitrary precision integer constants
      +    uint32_t BitWidth = cast(yyvsp[-1].PrimType)->getBitWidth();
      +    if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) {
             GEN_ERROR("Constant value does not fit in type");
           } 
      -    (yyvsp[(2) - (2)].APIntVal)->zextOrTrunc(BitWidth);
      -    (yyval.ConstVal) = ConstantInt::get(*(yyvsp[(2) - (2)].APIntVal));
      -    delete (yyvsp[(2) - (2)].APIntVal);
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 183:
      -#line 1839 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {                      // Boolean constants
      -    assert(cast((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
      -    (yyval.ConstVal) = ConstantInt::getTrue();
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 184:
      -#line 1844 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {                     // Boolean constants
      -    assert(cast((yyvsp[(1) - (2)].PrimType))->getBitWidth() == 1 && "Not Bool?");
      -    (yyval.ConstVal) = ConstantInt::getFalse();
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 185:
      -#line 1849 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {                   // Floating point constants
      -    if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal)))
      +    yyvsp[0].APIntVal->zextOrTrunc(BitWidth);
      +    yyval.ConstVal = ConstantInt::get(*yyvsp[0].APIntVal);
      +    delete yyvsp[0].APIntVal;
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 183:
      +#line 1849 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{                      // Boolean constants
      +    assert(cast(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?");
      +    yyval.ConstVal = ConstantInt::getTrue();
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 184:
      +#line 1854 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{                     // Boolean constants
      +    assert(cast(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?");
      +    yyval.ConstVal = ConstantInt::getFalse();
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 185:
      +#line 1859 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{                   // Floating point constants
      +    if (!ConstantFP::isValueValidForType(yyvsp[-1].PrimType, *yyvsp[0].FPVal))
             GEN_ERROR("Floating point constant invalid for type");
           // Lexer has no type info, so builds all float and double FP constants 
           // as double.  Fix this here.  Long double is done right.
      -    if (&(yyvsp[(2) - (2)].FPVal)->getSemantics()==&APFloat::IEEEdouble && (yyvsp[(1) - (2)].PrimType)==Type::FloatTy)
      -      (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
      -    (yyval.ConstVal) = ConstantFP::get((yyvsp[(1) - (2)].PrimType), *(yyvsp[(2) - (2)].FPVal));
      -    delete (yyvsp[(2) - (2)].FPVal);
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 186:
      -#line 1862 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +    if (&yyvsp[0].FPVal->getSemantics()==&APFloat::IEEEdouble && yyvsp[-1].PrimType==Type::FloatTy)
      +      yyvsp[0].FPVal->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven);
      +    yyval.ConstVal = ConstantFP::get(yyvsp[-1].PrimType, *yyvsp[0].FPVal);
      +    delete yyvsp[0].FPVal;
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 186:
      +#line 1872 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           if (!UpRefs.empty())
      -      GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (6)].TypeVal))->getDescription());
      -    Constant *Val = (yyvsp[(3) - (6)].ConstVal);
      -    const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
      -    if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
      +      GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
      +    Constant *Val = yyvsp[-3].ConstVal;
      +    const Type *DestTy = yyvsp[-1].TypeVal->get();
      +    if (!CastInst::castIsValid(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy))
             GEN_ERROR("invalid cast opcode for cast from '" +
                       Val->getType()->getDescription() + "' to '" +
                       DestTy->getDescription() + "'"); 
      -    (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
      -    delete (yyvsp[(5) - (6)].TypeVal);
      -  ;}
      -    break;
      -
      -  case 187:
      -#line 1874 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    if (!isa((yyvsp[(3) - (5)].ConstVal)->getType()))
      +    yyval.ConstVal = ConstantExpr::getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy);
      +    delete yyvsp[-1].TypeVal;
      +  ;
      +    break;}
      +case 187:
      +#line 1884 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    if (!isa(yyvsp[-2].ConstVal->getType()))
             GEN_ERROR("GetElementPtr requires a pointer operand");
       
           const Type *IdxTy =
      -      GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end(),
      +      GetElementPtrInst::getIndexedType(yyvsp[-2].ConstVal->getType(), yyvsp[-1].ValueList->begin(), yyvsp[-1].ValueList->end(),
                                               true);
           if (!IdxTy)
             GEN_ERROR("Index list invalid for constant getelementptr");
       
           SmallVector IdxVec;
      -    for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i)
      -      if (Constant *C = dyn_cast((*(yyvsp[(4) - (5)].ValueList))[i]))
      +    for (unsigned i = 0, e = yyvsp[-1].ValueList->size(); i != e; ++i)
      +      if (Constant *C = dyn_cast((*yyvsp[-1].ValueList)[i]))
               IdxVec.push_back(C);
             else
               GEN_ERROR("Indices to constant getelementptr must be constants");
       
      -    delete (yyvsp[(4) - (5)].ValueList);
      +    delete yyvsp[-1].ValueList;
       
      -    (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), &IdxVec[0], IdxVec.size());
      +    yyval.ConstVal = ConstantExpr::getGetElementPtr(yyvsp[-2].ConstVal, &IdxVec[0], IdxVec.size());
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 188:
      -#line 1896 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::Int1Ty)
      +  ;
      +    break;}
      +case 188:
      +#line 1906 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    if (yyvsp[-5].ConstVal->getType() != Type::Int1Ty)
             GEN_ERROR("Select condition must be of boolean type");
      -    if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType())
      +    if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
             GEN_ERROR("Select operand types must match");
      -    (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
      +    yyval.ConstVal = ConstantExpr::getSelect(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 189:
      -#line 1904 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
      +  ;
      +    break;}
      +case 189:
      +#line 1914 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
             GEN_ERROR("Binary operator types must match");
           CHECK_FOR_ERROR;
      -    (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
      -  ;}
      -    break;
      -
      -  case 190:
      -#line 1910 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType())
      +    yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
      +  ;
      +    break;}
      +case 190:
      +#line 1920 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
             GEN_ERROR("Logical operator types must match");
      -    if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) {
      -      if (Instruction::isShift((yyvsp[(1) - (6)].BinaryOpVal)) || !isa((yyvsp[(3) - (6)].ConstVal)->getType()) || 
      -          !cast((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isInteger())
      +    if (!yyvsp[-3].ConstVal->getType()->isInteger()) {
      +      if (Instruction::isShift(yyvsp[-5].BinaryOpVal) || !isa(yyvsp[-3].ConstVal->getType()) || 
      +          !cast(yyvsp[-3].ConstVal->getType())->getElementType()->isInteger())
               GEN_ERROR("Logical operator requires integral operands");
           }
      -    (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
      +    yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 191:
      -#line 1921 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
      +  ;
      +    break;}
      +case 191:
      +#line 1931 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
             GEN_ERROR("icmp operand types must match");
      -    (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[(2) - (7)].IPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
      -  ;}
      -    break;
      -
      -  case 192:
      -#line 1926 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    if ((yyvsp[(4) - (7)].ConstVal)->getType() != (yyvsp[(6) - (7)].ConstVal)->getType())
      +    yyval.ConstVal = ConstantExpr::getICmp(yyvsp[-5].IPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
      +  ;
      +    break;}
      +case 192:
      +#line 1936 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
             GEN_ERROR("fcmp operand types must match");
      -    (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[(2) - (7)].FPredicate), (yyvsp[(4) - (7)].ConstVal), (yyvsp[(6) - (7)].ConstVal));
      -  ;}
      -    break;
      -
      -  case 193:
      -#line 1931 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)))
      +    yyval.ConstVal = ConstantExpr::getFCmp(yyvsp[-5].FPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
      +  ;
      +    break;}
      +case 193:
      +#line 1941 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    if (!ExtractElementInst::isValidOperands(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
             GEN_ERROR("Invalid extractelement operands");
      -    (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal));
      +    yyval.ConstVal = ConstantExpr::getExtractElement(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 194:
      -#line 1937 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
      +  ;
      +    break;}
      +case 194:
      +#line 1947 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    if (!InsertElementInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
             GEN_ERROR("Invalid insertelement operands");
      -    (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
      +    yyval.ConstVal = ConstantExpr::getInsertElement(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 195:
      -#line 1943 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)))
      +  ;
      +    break;}
      +case 195:
      +#line 1953 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    if (!ShuffleVectorInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
             GEN_ERROR("Invalid shufflevector operands");
      -    (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal));
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 196:
      -#line 1952 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal));
      +    yyval.ConstVal = ConstantExpr::getShuffleVector(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 197:
      -#line 1956 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.ConstVector) = new std::vector();
      -    (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal));
      +  ;
      +    break;}
      +case 196:
      +#line 1962 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(yyvsp[0].ConstVal);
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 198:
      -#line 1964 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.BoolVal) = false; ;}
      -    break;
      -
      -  case 199:
      -#line 1964 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.BoolVal) = true; ;}
      -    break;
      -
      -  case 200:
      -#line 1967 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.BoolVal) = true; ;}
      -    break;
      -
      -  case 201:
      -#line 1967 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.BoolVal) = false; ;}
      -    break;
      -
      -  case 202:
      -#line 1970 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    const Type* VTy = (yyvsp[(1) - (2)].TypeVal)->get();
      -    Value *V = getVal(VTy, (yyvsp[(2) - (2)].ValIDVal));
      +  ;
      +    break;}
      +case 197:
      +#line 1966 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.ConstVector = new std::vector();
      +    yyval.ConstVector->push_back(yyvsp[0].ConstVal);
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 198:
      +#line 1974 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.BoolVal = false; ;
      +    break;}
      +case 199:
      +#line 1974 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.BoolVal = true; ;
      +    break;}
      +case 200:
      +#line 1977 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.BoolVal = true; ;
      +    break;}
      +case 201:
      +#line 1977 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.BoolVal = false; ;
      +    break;}
      +case 202:
      +#line 1980 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    const Type* VTy = yyvsp[-1].TypeVal->get();
      +    Value *V = getVal(VTy, yyvsp[0].ValIDVal);
           CHECK_FOR_ERROR
           GlobalValue* Aliasee = dyn_cast(V);
           if (!Aliasee)
             GEN_ERROR("Aliases can be created only to global values");
       
      -    (yyval.ConstVal) = Aliasee;
      +    yyval.ConstVal = Aliasee;
           CHECK_FOR_ERROR
      -    delete (yyvsp[(1) - (2)].TypeVal);
      -   ;}
      -    break;
      -
      -  case 203:
      -#line 1982 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    Constant *Val = (yyvsp[(3) - (6)].ConstVal);
      -    const Type *DestTy = (yyvsp[(5) - (6)].TypeVal)->get();
      -    if (!CastInst::castIsValid((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy))
      +    delete yyvsp[-1].TypeVal;
      +   ;
      +    break;}
      +case 203:
      +#line 1992 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    Constant *Val = yyvsp[-3].ConstVal;
      +    const Type *DestTy = yyvsp[-1].TypeVal->get();
      +    if (!CastInst::castIsValid(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy))
             GEN_ERROR("invalid cast opcode for cast from '" +
                       Val->getType()->getDescription() + "' to '" +
                       DestTy->getDescription() + "'");
           
      -    (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal), DestTy);
      +    yyval.ConstVal = ConstantExpr::getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, DestTy);
           CHECK_FOR_ERROR
      -    delete (yyvsp[(5) - (6)].TypeVal);
      -   ;}
      -    break;
      -
      -  case 204:
      -#line 2003 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
      +    delete yyvsp[-1].TypeVal;
      +   ;
      +    break;}
      +case 204:
      +#line 2013 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.ModuleVal = ParserResult = CurModule.CurrentModule;
           CurModule.ModuleDone();
           CHECK_FOR_ERROR;
      -  ;}
      -    break;
      -
      -  case 205:
      -#line 2008 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.ModuleVal) = ParserResult = CurModule.CurrentModule;
      +  ;
      +    break;}
      +case 205:
      +#line 2018 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.ModuleVal = ParserResult = CurModule.CurrentModule;
           CurModule.ModuleDone();
           CHECK_FOR_ERROR;
      -  ;}
      -    break;
      -
      -  case 208:
      -#line 2021 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { CurFun.isDeclare = false; ;}
      -    break;
      -
      -  case 209:
      -#line 2021 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +  ;
      +    break;}
      +case 208:
      +#line 2031 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ CurFun.isDeclare = false; ;
      +    break;}
      +case 209:
      +#line 2031 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           CurFun.FunctionDone();
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 210:
      -#line 2025 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { CurFun.isDeclare = true; ;}
      -    break;
      -
      -  case 211:
      -#line 2025 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +  ;
      +    break;}
      +case 210:
      +#line 2035 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ CurFun.isDeclare = true; ;
      +    break;}
      +case 211:
      +#line 2035 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 212:
      -#line 2028 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +  ;
      +    break;}
      +case 212:
      +#line 2038 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 213:
      -#line 2031 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +  ;
      +    break;}
      +case 213:
      +#line 2041 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           if (!UpRefs.empty())
      -      GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (3)].TypeVal))->getDescription());
      +      GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
           // Eagerly resolve types.  This is not an optimization, this is a
           // requirement that is due to the fact that we could have this:
           //
      @@ -4895,108 +3897,117 @@
           // If types are not resolved eagerly, then the two types will not be
           // determined to be the same type!
           //
      -    ResolveTypeTo((yyvsp[(1) - (3)].StrVal), *(yyvsp[(3) - (3)].TypeVal));
      +    ResolveTypeTo(yyvsp[-2].StrVal, *yyvsp[0].TypeVal);
       
      -    if (!setTypeName(*(yyvsp[(3) - (3)].TypeVal), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
      +    if (!setTypeName(*yyvsp[0].TypeVal, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) {
             CHECK_FOR_ERROR
             // If this is a named type that is not a redefinition, add it to the slot
             // table.
      -      CurModule.Types.push_back(*(yyvsp[(3) - (3)].TypeVal));
      +      CurModule.Types.push_back(*yyvsp[0].TypeVal);
           }
       
      -    delete (yyvsp[(3) - (3)].TypeVal);
      +    delete yyvsp[0].TypeVal;
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 214:
      -#line 2055 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    ResolveTypeTo((yyvsp[(1) - (3)].StrVal), (yyvsp[(3) - (3)].PrimType));
      +  ;
      +    break;}
      +case 214:
      +#line 2065 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    ResolveTypeTo(yyvsp[-2].StrVal, yyvsp[0].PrimType);
       
      -    if (!setTypeName((yyvsp[(3) - (3)].PrimType), (yyvsp[(1) - (3)].StrVal)) && !(yyvsp[(1) - (3)].StrVal)) {
      +    if (!setTypeName(yyvsp[0].PrimType, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) {
             CHECK_FOR_ERROR
             // If this is a named type that is not a redefinition, add it to the slot
             // table.
      -      CurModule.Types.push_back((yyvsp[(3) - (3)].PrimType));
      +      CurModule.Types.push_back(yyvsp[0].PrimType);
           }
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 215:
      -#line 2066 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { 
      +  ;
      +    break;}
      +case 215:
      +#line 2076 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ 
           /* "Externally Visible" Linkage */
      -    if ((yyvsp[(5) - (5)].ConstVal) == 0) 
      +    if (yyvsp[0].ConstVal == 0) 
             GEN_ERROR("Global value initializer is not a constant");
      -    CurGV = ParseGlobalVariable((yyvsp[(1) - (5)].StrVal), GlobalValue::ExternalLinkage,
      -                                (yyvsp[(2) - (5)].Visibility), (yyvsp[(4) - (5)].BoolVal), (yyvsp[(5) - (5)].ConstVal)->getType(), (yyvsp[(5) - (5)].ConstVal), (yyvsp[(3) - (5)].BoolVal));
      +    CurGV = ParseGlobalVariable(yyvsp[-4].StrVal, GlobalValue::ExternalLinkage,
      +                                yyvsp[-3].Visibility, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal, yyvsp[-2].BoolVal);
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 216:
      -#line 2073 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +  ;
      +    break;}
      +case 216:
      +#line 2083 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           CurGV = 0;
      -  ;}
      -    break;
      -
      -  case 217:
      -#line 2077 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    if ((yyvsp[(6) - (6)].ConstVal) == 0) 
      +  ;
      +    break;}
      +case 217:
      +#line 2087 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ 
      +    /* "Externally Visible" Linkage with address space qualifier */
      +    if (yyvsp[-4].ConstVal == 0) 
             GEN_ERROR("Global value initializer is not a constant");
      -    CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), (yyvsp[(2) - (6)].Linkage), (yyvsp[(3) - (6)].Visibility), (yyvsp[(5) - (6)].BoolVal), (yyvsp[(6) - (6)].ConstVal)->getType(), (yyvsp[(6) - (6)].ConstVal), (yyvsp[(4) - (6)].BoolVal));
      +    CurGV = ParseGlobalVariable(yyvsp[-8].StrVal, GlobalValue::ExternalLinkage,
      +                                yyvsp[-7].Visibility, yyvsp[-5].BoolVal, yyvsp[-4].ConstVal->getType(), yyvsp[-4].ConstVal, yyvsp[-6].BoolVal, yyvsp[-1].UInt64Val);
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 218:
      -#line 2082 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +  ;
      +    break;}
      +case 218:
      +#line 2094 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           CurGV = 0;
      -  ;}
      -    break;
      -
      -  case 219:
      -#line 2086 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +  ;
      +    break;}
      +case 219:
      +#line 2098 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    if (yyvsp[0].ConstVal == 0) 
      +      GEN_ERROR("Global value initializer is not a constant");
      +    CurGV = ParseGlobalVariable(yyvsp[-5].StrVal, yyvsp[-4].Linkage, yyvsp[-3].Visibility, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal, yyvsp[-2].BoolVal);
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 220:
      +#line 2103 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    CurGV = 0;
      +  ;
      +    break;}
      +case 221:
      +#line 2107 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           if (!UpRefs.empty())
      -      GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(6) - (6)].TypeVal))->getDescription());
      -    CurGV = ParseGlobalVariable((yyvsp[(1) - (6)].StrVal), (yyvsp[(2) - (6)].Linkage), (yyvsp[(3) - (6)].Visibility), (yyvsp[(5) - (6)].BoolVal), *(yyvsp[(6) - (6)].TypeVal), 0, (yyvsp[(4) - (6)].BoolVal));
      +      GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
      +    CurGV = ParseGlobalVariable(yyvsp[-5].StrVal, yyvsp[-4].Linkage, yyvsp[-3].Visibility, yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0, yyvsp[-2].BoolVal);
           CHECK_FOR_ERROR
      -    delete (yyvsp[(6) - (6)].TypeVal);
      -  ;}
      -    break;
      -
      -  case 220:
      -#line 2092 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +    delete yyvsp[0].TypeVal;
      +  ;
      +    break;}
      +case 222:
      +#line 2113 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           CurGV = 0;
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 221:
      -#line 2096 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +  ;
      +    break;}
      +case 223:
      +#line 2117 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           std::string Name;
      -    if ((yyvsp[(1) - (5)].StrVal)) {
      -      Name = *(yyvsp[(1) - (5)].StrVal);
      -      delete (yyvsp[(1) - (5)].StrVal);
      +    if (yyvsp[-4].StrVal) {
      +      Name = *yyvsp[-4].StrVal;
      +      delete yyvsp[-4].StrVal;
           }
           if (Name.empty())
             GEN_ERROR("Alias name cannot be empty");
           
      -    Constant* Aliasee = (yyvsp[(5) - (5)].ConstVal);
      +    Constant* Aliasee = yyvsp[0].ConstVal;
           if (Aliasee == 0)
             GEN_ERROR(std::string("Invalid aliasee for alias: ") + Name);
       
      -    GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), (yyvsp[(4) - (5)].Linkage), Name, Aliasee,
      +    GlobalAlias* GA = new GlobalAlias(Aliasee->getType(), yyvsp[-1].Linkage, Name, Aliasee,
                                             CurModule.CurrentModule);
      -    GA->setVisibility((yyvsp[(2) - (5)].Visibility));
      +    GA->setVisibility(yyvsp[-3].Visibility);
           InsertValue(GA, CurModule.Values);
           
           
      @@ -5020,169 +4031,154 @@
           ID.destroy();
           
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 222:
      -#line 2136 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { 
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 223:
      -#line 2139 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +  ;
      +    break;}
      +case 224:
      +#line 2157 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ 
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 225:
      +#line 2160 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 224:
      -#line 2145 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +  ;
      +    break;}
      +case 226:
      +#line 2166 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
         const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm();
         if (AsmSoFar.empty())
      -    CurModule.CurrentModule->setModuleInlineAsm(*(yyvsp[(1) - (1)].StrVal));
      +    CurModule.CurrentModule->setModuleInlineAsm(*yyvsp[0].StrVal);
         else
      -    CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*(yyvsp[(1) - (1)].StrVal));
      -  delete (yyvsp[(1) - (1)].StrVal);
      +    CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+*yyvsp[0].StrVal);
      +  delete yyvsp[0].StrVal;
         CHECK_FOR_ERROR
      -;}
      -    break;
      -
      -  case 225:
      -#line 2155 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    CurModule.CurrentModule->setTargetTriple(*(yyvsp[(3) - (3)].StrVal));
      -    delete (yyvsp[(3) - (3)].StrVal);
      -  ;}
      -    break;
      -
      -  case 226:
      -#line 2159 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    CurModule.CurrentModule->setDataLayout(*(yyvsp[(3) - (3)].StrVal));
      -    delete (yyvsp[(3) - (3)].StrVal);
      -  ;}
      -    break;
      -
      -  case 228:
      -#line 2166 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -          CurModule.CurrentModule->addLibrary(*(yyvsp[(3) - (3)].StrVal));
      -          delete (yyvsp[(3) - (3)].StrVal);
      +;
      +    break;}
      +case 227:
      +#line 2176 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    CurModule.CurrentModule->setTargetTriple(*yyvsp[0].StrVal);
      +    delete yyvsp[0].StrVal;
      +  ;
      +    break;}
      +case 228:
      +#line 2180 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    CurModule.CurrentModule->setDataLayout(*yyvsp[0].StrVal);
      +    delete yyvsp[0].StrVal;
      +  ;
      +    break;}
      +case 230:
      +#line 2187 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +          CurModule.CurrentModule->addLibrary(*yyvsp[0].StrVal);
      +          delete yyvsp[0].StrVal;
                 CHECK_FOR_ERROR
      -        ;}
      -    break;
      -
      -  case 229:
      -#line 2171 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -          CurModule.CurrentModule->addLibrary(*(yyvsp[(1) - (1)].StrVal));
      -          delete (yyvsp[(1) - (1)].StrVal);
      +        ;
      +    break;}
      +case 231:
      +#line 2192 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +          CurModule.CurrentModule->addLibrary(*yyvsp[0].StrVal);
      +          delete yyvsp[0].StrVal;
                 CHECK_FOR_ERROR
      -        ;}
      -    break;
      -
      -  case 230:
      -#line 2176 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +        ;
      +    break;}
      +case 232:
      +#line 2197 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
                 CHECK_FOR_ERROR
      -        ;}
      -    break;
      -
      -  case 231:
      -#line 2185 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +        ;
      +    break;}
      +case 233:
      +#line 2206 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           if (!UpRefs.empty())
      -      GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
      -    if (*(yyvsp[(3) - (5)].TypeVal) == Type::VoidTy)
      +      GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
      +    if (*yyvsp[-2].TypeVal == Type::VoidTy)
             GEN_ERROR("void typed arguments are invalid");
      -    ArgListEntry E; E.Attrs = (yyvsp[(4) - (5)].ParamAttrs); E.Ty = (yyvsp[(3) - (5)].TypeVal); E.Name = (yyvsp[(5) - (5)].StrVal);
      -    (yyval.ArgList) = (yyvsp[(1) - (5)].ArgList);
      -    (yyvsp[(1) - (5)].ArgList)->push_back(E);
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 232:
      -#line 2195 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +    ArgListEntry E; E.Attrs = yyvsp[-1].ParamAttrs; E.Ty = yyvsp[-2].TypeVal; E.Name = yyvsp[0].StrVal;
      +    yyval.ArgList = yyvsp[-4].ArgList;
      +    yyvsp[-4].ArgList->push_back(E);
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 234:
      +#line 2216 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           if (!UpRefs.empty())
      -      GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (3)].TypeVal))->getDescription());
      -    if (*(yyvsp[(1) - (3)].TypeVal) == Type::VoidTy)
      +      GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
      +    if (*yyvsp[-2].TypeVal == Type::VoidTy)
             GEN_ERROR("void typed arguments are invalid");
      -    ArgListEntry E; E.Attrs = (yyvsp[(2) - (3)].ParamAttrs); E.Ty = (yyvsp[(1) - (3)].TypeVal); E.Name = (yyvsp[(3) - (3)].StrVal);
      -    (yyval.ArgList) = new ArgListType;
      -    (yyval.ArgList)->push_back(E);
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 233:
      -#line 2206 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList);
      +    ArgListEntry E; E.Attrs = yyvsp[-1].ParamAttrs; E.Ty = yyvsp[-2].TypeVal; E.Name = yyvsp[0].StrVal;
      +    yyval.ArgList = new ArgListType;
      +    yyval.ArgList->push_back(E);
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 235:
      +#line 2227 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.ArgList = yyvsp[0].ArgList;
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 234:
      -#line 2210 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList);
      +  ;
      +    break;}
      +case 236:
      +#line 2231 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.ArgList = yyvsp[-2].ArgList;
           struct ArgListEntry E;
           E.Ty = new PATypeHolder(Type::VoidTy);
           E.Name = 0;
           E.Attrs = ParamAttr::None;
      -    (yyval.ArgList)->push_back(E);
      +    yyval.ArgList->push_back(E);
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 235:
      -#line 2219 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.ArgList) = new ArgListType;
      +  ;
      +    break;}
      +case 237:
      +#line 2240 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.ArgList = new ArgListType;
           struct ArgListEntry E;
           E.Ty = new PATypeHolder(Type::VoidTy);
           E.Name = 0;
           E.Attrs = ParamAttr::None;
      -    (yyval.ArgList)->push_back(E);
      +    yyval.ArgList->push_back(E);
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 236:
      -#line 2228 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.ArgList) = 0;
      +  ;
      +    break;}
      +case 238:
      +#line 2249 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.ArgList = 0;
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 237:
      -#line 2234 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -  std::string FunctionName(*(yyvsp[(3) - (10)].StrVal));
      -  delete (yyvsp[(3) - (10)].StrVal);  // Free strdup'd memory!
      +  ;
      +    break;}
      +case 239:
      +#line 2255 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +  std::string FunctionName(*yyvsp[-7].StrVal);
      +  delete yyvsp[-7].StrVal;  // Free strdup'd memory!
         
         // Check the function result for abstractness if this is a define. We should
         // have no abstract types at this point
      -  if (!CurFun.isDeclare && CurModule.TypeIsUnresolved((yyvsp[(2) - (10)].TypeVal)))
      -    GEN_ERROR("Reference to abstract result: "+ (yyvsp[(2) - (10)].TypeVal)->get()->getDescription());
      +  if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(yyvsp[-8].TypeVal))
      +    GEN_ERROR("Reference to abstract result: "+ yyvsp[-8].TypeVal->get()->getDescription());
       
         std::vector ParamTypeList;
         ParamAttrsVector Attrs;
      -  if ((yyvsp[(7) - (10)].ParamAttrs) != ParamAttr::None) {
      +  if (yyvsp[-3].ParamAttrs != ParamAttr::None) {
           ParamAttrsWithIndex PAWI;
           PAWI.index = 0;
      -    PAWI.attrs = (yyvsp[(7) - (10)].ParamAttrs);
      +    PAWI.attrs = yyvsp[-3].ParamAttrs;
           Attrs.push_back(PAWI);
         }
      -  if ((yyvsp[(5) - (10)].ArgList)) {   // If there are arguments...
      +  if (yyvsp[-5].ArgList) {   // If there are arguments...
           unsigned index = 1;
      -    for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); I != (yyvsp[(5) - (10)].ArgList)->end(); ++I, ++index) {
      +    for (ArgListType::iterator I = yyvsp[-5].ArgList->begin(); I != yyvsp[-5].ArgList->end(); ++I, ++index) {
             const Type* Ty = I->Ty->get();
             if (!CurFun.isDeclare && CurModule.TypeIsUnresolved(I->Ty))
               GEN_ERROR("Reference to abstract argument: " + Ty->getDescription());
      @@ -5204,9 +4200,9 @@
         if (!Attrs.empty())
           PAL = ParamAttrsList::get(Attrs);
       
      -  FunctionType *FT = FunctionType::get(*(yyvsp[(2) - (10)].TypeVal), ParamTypeList, isVarArg);
      +  FunctionType *FT = FunctionType::get(*yyvsp[-8].TypeVal, ParamTypeList, isVarArg);
         const PointerType *PFT = PointerType::get(FT);
      -  delete (yyvsp[(2) - (10)].TypeVal);
      +  delete yyvsp[-8].TypeVal;
       
         ValID ID;
         if (!FunctionName.empty()) {
      @@ -5259,31 +4255,31 @@
           Fn->setLinkage(CurFun.Linkage);
           Fn->setVisibility(CurFun.Visibility);
         }
      -  Fn->setCallingConv((yyvsp[(1) - (10)].UIntVal));
      +  Fn->setCallingConv(yyvsp[-9].UIntVal);
         Fn->setParamAttrs(PAL);
      -  Fn->setAlignment((yyvsp[(9) - (10)].UIntVal));
      -  if ((yyvsp[(8) - (10)].StrVal)) {
      -    Fn->setSection(*(yyvsp[(8) - (10)].StrVal));
      -    delete (yyvsp[(8) - (10)].StrVal);
      -  }
      -  if ((yyvsp[(10) - (10)].StrVal)) {
      -    Fn->setCollector((yyvsp[(10) - (10)].StrVal)->c_str());
      -    delete (yyvsp[(10) - (10)].StrVal);
      +  Fn->setAlignment(yyvsp[-1].UIntVal);
      +  if (yyvsp[-2].StrVal) {
      +    Fn->setSection(*yyvsp[-2].StrVal);
      +    delete yyvsp[-2].StrVal;
      +  }
      +  if (yyvsp[0].StrVal) {
      +    Fn->setCollector(yyvsp[0].StrVal->c_str());
      +    delete yyvsp[0].StrVal;
         }
       
         // Add all of the arguments we parsed to the function...
      -  if ((yyvsp[(5) - (10)].ArgList)) {                     // Is null if empty...
      +  if (yyvsp[-5].ArgList) {                     // Is null if empty...
           if (isVarArg) {  // Nuke the last entry
      -      assert((yyvsp[(5) - (10)].ArgList)->back().Ty->get() == Type::VoidTy && (yyvsp[(5) - (10)].ArgList)->back().Name == 0 &&
      +      assert(yyvsp[-5].ArgList->back().Ty->get() == Type::VoidTy && yyvsp[-5].ArgList->back().Name == 0 &&
                    "Not a varargs marker!");
      -      delete (yyvsp[(5) - (10)].ArgList)->back().Ty;
      -      (yyvsp[(5) - (10)].ArgList)->pop_back();  // Delete the last entry
      +      delete yyvsp[-5].ArgList->back().Ty;
      +      yyvsp[-5].ArgList->pop_back();  // Delete the last entry
           }
           Function::arg_iterator ArgIt = Fn->arg_begin();
           Function::arg_iterator ArgEnd = Fn->arg_end();
           unsigned Idx = 1;
      -    for (ArgListType::iterator I = (yyvsp[(5) - (10)].ArgList)->begin(); 
      -         I != (yyvsp[(5) - (10)].ArgList)->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
      +    for (ArgListType::iterator I = yyvsp[-5].ArgList->begin(); 
      +         I != yyvsp[-5].ArgList->end() && ArgIt != ArgEnd; ++I, ++ArgIt) {
             delete I->Ty;                          // Delete the typeholder...
             setValueName(ArgIt, I->Name);       // Insert arg into symtab...
             CHECK_FOR_ERROR
      @@ -5291,128 +4287,114 @@
             Idx++;
           }
       
      -    delete (yyvsp[(5) - (10)].ArgList);                     // We're now done with the argument list
      +    delete yyvsp[-5].ArgList;                     // We're now done with the argument list
         }
         CHECK_FOR_ERROR
      -;}
      -    break;
      -
      -  case 240:
      -#line 2369 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -  (yyval.FunctionVal) = CurFun.CurrentFunction;
      +;
      +    break;}
      +case 242:
      +#line 2390 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +  yyval.FunctionVal = CurFun.CurrentFunction;
       
         // Make sure that we keep track of the linkage type even if there was a
         // previous "declare".
      -  (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage));
      -  (yyval.FunctionVal)->setVisibility((yyvsp[(2) - (4)].Visibility));
      -;}
      -    break;
      -
      -  case 243:
      -#line 2380 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -  (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
      +  yyval.FunctionVal->setLinkage(yyvsp[-3].Linkage);
      +  yyval.FunctionVal->setVisibility(yyvsp[-2].Visibility);
      +;
      +    break;}
      +case 245:
      +#line 2401 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +  yyval.FunctionVal = yyvsp[-1].FunctionVal;
         CHECK_FOR_ERROR
      -;}
      -    break;
      -
      -  case 244:
      -#line 2385 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    CurFun.CurrentFunction->setLinkage((yyvsp[(1) - (3)].Linkage));
      -    CurFun.CurrentFunction->setVisibility((yyvsp[(2) - (3)].Visibility));
      -    (yyval.FunctionVal) = CurFun.CurrentFunction;
      +;
      +    break;}
      +case 246:
      +#line 2406 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    CurFun.CurrentFunction->setLinkage(yyvsp[-2].Linkage);
      +    CurFun.CurrentFunction->setVisibility(yyvsp[-1].Visibility);
      +    yyval.FunctionVal = CurFun.CurrentFunction;
           CurFun.FunctionDone();
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 245:
      -#line 2397 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.BoolVal) = false;
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 246:
      -#line 2401 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.BoolVal) = true;
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 247:
      -#line 2406 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {    // A reference to a direct constant
      -    (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val));
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 248:
      -#line 2410 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val));
      +  ;
      +    break;}
      +case 247:
      +#line 2418 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.BoolVal = false;
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 249:
      -#line 2414 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {                     // Perhaps it's an FP constant?
      -    (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal));
      +  ;
      +    break;}
      +case 248:
      +#line 2422 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.BoolVal = true;
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 250:
      -#line 2418 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.ValIDVal) = ValID::create(ConstantInt::getTrue());
      +  ;
      +    break;}
      +case 249:
      +#line 2427 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{    // A reference to a direct constant
      +    yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val);
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 250:
      +#line 2431 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val);
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 251:
      -#line 2422 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.ValIDVal) = ValID::create(ConstantInt::getFalse());
      +  ;
      +    break;}
      +case 251:
      +#line 2435 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{                     // Perhaps it's an FP constant?
      +    yyval.ValIDVal = ValID::create(yyvsp[0].FPVal);
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 252:
      +#line 2439 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.ValIDVal = ValID::create(ConstantInt::getTrue());
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 252:
      -#line 2426 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.ValIDVal) = ValID::createNull();
      +  ;
      +    break;}
      +case 253:
      +#line 2443 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.ValIDVal = ValID::create(ConstantInt::getFalse());
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 253:
      -#line 2430 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.ValIDVal) = ValID::createUndef();
      +  ;
      +    break;}
      +case 254:
      +#line 2447 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.ValIDVal = ValID::createNull();
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 254:
      -#line 2434 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {     // A vector zero constant.
      -    (yyval.ValIDVal) = ValID::createZeroInit();
      +  ;
      +    break;}
      +case 255:
      +#line 2451 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.ValIDVal = ValID::createUndef();
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 255:
      -#line 2438 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { // Nonempty unsized packed vector
      -    const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType();
      -    int NumElements = (yyvsp[(2) - (3)].ConstVector)->size(); 
      +  ;
      +    break;}
      +case 256:
      +#line 2455 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{     // A vector zero constant.
      +    yyval.ValIDVal = ValID::createZeroInit();
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 257:
      +#line 2459 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ // Nonempty unsized packed vector
      +    const Type *ETy = (*yyvsp[-1].ConstVector)[0]->getType();
      +    int NumElements = yyvsp[-1].ConstVector->size(); 
           
           VectorType* pt = VectorType::get(ETy, NumElements);
           PATypeHolder* PTy = new PATypeHolder(
      @@ -5424,256 +4406,236 @@
                                                );
           
           // Verify all elements are correct type!
      -    for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) {
      -      if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType())
      +    for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) {
      +      if (ETy != (*yyvsp[-1].ConstVector)[i]->getType())
               GEN_ERROR("Element #" + utostr(i) + " is not of type '" + 
                            ETy->getDescription() +"' as required!\nIt is of type '" +
      -                     (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'.");
      +                     (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'.");
           }
       
      -    (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, *(yyvsp[(2) - (3)].ConstVector)));
      -    delete PTy; delete (yyvsp[(2) - (3)].ConstVector);
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 256:
      -#line 2463 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal));
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 257:
      -#line 2467 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.ValIDVal) = ValID::createInlineAsm(*(yyvsp[(3) - (5)].StrVal), *(yyvsp[(5) - (5)].StrVal), (yyvsp[(2) - (5)].BoolVal));
      -    delete (yyvsp[(3) - (5)].StrVal);
      -    delete (yyvsp[(5) - (5)].StrVal);
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 258:
      -#line 2477 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {  // Is it an integer reference...?
      -    (yyval.ValIDVal) = ValID::createLocalID((yyvsp[(1) - (1)].UIntVal));
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 259:
      -#line 2481 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.ValIDVal) = ValID::createGlobalID((yyvsp[(1) - (1)].UIntVal));
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 260:
      -#line 2485 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {                   // Is it a named reference...?
      -    (yyval.ValIDVal) = ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal));
      -    delete (yyvsp[(1) - (1)].StrVal);
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 261:
      -#line 2490 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {                   // Is it a named reference...?
      -    (yyval.ValIDVal) = ValID::createGlobalName(*(yyvsp[(1) - (1)].StrVal));
      -    delete (yyvsp[(1) - (1)].StrVal);
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 264:
      -#line 2503 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    if (!UpRefs.empty())
      -      GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (2)].TypeVal))->getDescription());
      -    (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal)); 
      -    delete (yyvsp[(1) - (2)].TypeVal);
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 265:
      -#line 2512 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 266:
      -#line 2516 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { // Do not allow functions with 0 basic blocks   
      -    (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal);
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 267:
      -#line 2525 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal));
      -    CHECK_FOR_ERROR
      -    InsertValue((yyvsp[(3) - (3)].TermInstVal));
      -    (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal));
      -    (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal);
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 268:
      -#line 2534 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    if (CastInst *CI1 = dyn_cast((yyvsp[(2) - (2)].InstVal)))
      -      if (CastInst *CI2 = dyn_cast(CI1->getOperand(0)))
      -        if (CI2->getParent() == 0)
      -          (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back(CI2);
      -    (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal));
      -    (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal);
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 269:
      -#line 2543 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {          // Empty space between instruction lists
      -    (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 270:
      -#line 2547 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {             // Labelled (named) basic block
      -    (yyval.BasicBlockVal) = defineBBVal(ValID::createLocalName(*(yyvsp[(1) - (1)].StrVal)));
      -    delete (yyvsp[(1) - (1)].StrVal);
      -    CHECK_FOR_ERROR
      -
      -  ;}
      -    break;
      -
      -  case 271:
      -#line 2554 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {              // Return with a result...
      -    (yyval.TermInstVal) = new ReturnInst((yyvsp[(2) - (2)].ValueVal));
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 272:
      -#line 2558 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {                                    // Return with no result...
      -    (yyval.TermInstVal) = new ReturnInst();
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 273:
      -#line 2562 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {                           // Unconditional Branch...
      -    BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal));
      +    yyval.ValIDVal = ValID::create(ConstantVector::get(pt, *yyvsp[-1].ConstVector));
      +    delete PTy; delete yyvsp[-1].ConstVector;
           CHECK_FOR_ERROR
      -    (yyval.TermInstVal) = new BranchInst(tmpBB);
      -  ;}
      -    break;
      -
      -  case 274:
      -#line 2567 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {  
      -    assert(cast((yyvsp[(2) - (9)].PrimType))->getBitWidth() == 1 && "Not Bool?");
      -    BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal));
      +  ;
      +    break;}
      +case 258:
      +#line 2484 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.ValIDVal = ValID::create(yyvsp[0].ConstVal);
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 259:
      +#line 2488 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.ValIDVal = ValID::createInlineAsm(*yyvsp[-2].StrVal, *yyvsp[0].StrVal, yyvsp[-3].BoolVal);
      +    delete yyvsp[-2].StrVal;
      +    delete yyvsp[0].StrVal;
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 260:
      +#line 2498 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{  // Is it an integer reference...?
      +    yyval.ValIDVal = ValID::createLocalID(yyvsp[0].UIntVal);
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 261:
      +#line 2502 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.ValIDVal = ValID::createGlobalID(yyvsp[0].UIntVal);
           CHECK_FOR_ERROR
      -    BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal));
      +  ;
      +    break;}
      +case 262:
      +#line 2506 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{                   // Is it a named reference...?
      +    yyval.ValIDVal = ValID::createLocalName(*yyvsp[0].StrVal);
      +    delete yyvsp[0].StrVal;
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 263:
      +#line 2511 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{                   // Is it a named reference...?
      +    yyval.ValIDVal = ValID::createGlobalName(*yyvsp[0].StrVal);
      +    delete yyvsp[0].StrVal;
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 266:
      +#line 2524 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    if (!UpRefs.empty())
      +      GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
      +    yyval.ValueVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal); 
      +    delete yyvsp[-1].TypeVal;
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 267:
      +#line 2533 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.FunctionVal = yyvsp[-1].FunctionVal;
           CHECK_FOR_ERROR
      -    Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal));
      +  ;
      +    break;}
      +case 268:
      +#line 2537 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ // Do not allow functions with 0 basic blocks   
      +    yyval.FunctionVal = yyvsp[-1].FunctionVal;
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 269:
      +#line 2546 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    setValueName(yyvsp[0].TermInstVal, yyvsp[-1].StrVal);
           CHECK_FOR_ERROR
      -    (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
      -  ;}
      -    break;
      -
      -  case 275:
      -#line 2577 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal));
      +    InsertValue(yyvsp[0].TermInstVal);
      +    yyvsp[-2].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal);
      +    yyval.BasicBlockVal = yyvsp[-2].BasicBlockVal;
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 270:
      +#line 2555 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    if (CastInst *CI1 = dyn_cast(yyvsp[0].InstVal))
      +      if (CastInst *CI2 = dyn_cast(CI1->getOperand(0)))
      +        if (CI2->getParent() == 0)
      +          yyvsp[-1].BasicBlockVal->getInstList().push_back(CI2);
      +    yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal);
      +    yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal;
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 271:
      +#line 2564 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{          // Empty space between instruction lists
      +    yyval.BasicBlockVal = defineBBVal(ValID::createLocalID(CurFun.NextValNum));
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 272:
      +#line 2568 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{             // Labelled (named) basic block
      +    yyval.BasicBlockVal = defineBBVal(ValID::createLocalName(*yyvsp[0].StrVal));
      +    delete yyvsp[0].StrVal;
      +    CHECK_FOR_ERROR
      +
      +  ;
      +    break;}
      +case 273:
      +#line 2575 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{              // Return with a result...
      +    yyval.TermInstVal = new ReturnInst(yyvsp[0].ValueVal);
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 274:
      +#line 2579 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{                                    // Return with no result...
      +    yyval.TermInstVal = new ReturnInst();
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 275:
      +#line 2583 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{                           // Unconditional Branch...
      +    BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
      +    CHECK_FOR_ERROR
      +    yyval.TermInstVal = new BranchInst(tmpBB);
      +  ;
      +    break;}
      +case 276:
      +#line 2588 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{  
      +    assert(cast(yyvsp[-7].PrimType)->getBitWidth() == 1 && "Not Bool?");
      +    BasicBlock* tmpBBA = getBBVal(yyvsp[-3].ValIDVal);
      +    CHECK_FOR_ERROR
      +    BasicBlock* tmpBBB = getBBVal(yyvsp[0].ValIDVal);
      +    CHECK_FOR_ERROR
      +    Value* tmpVal = getVal(Type::Int1Ty, yyvsp[-6].ValIDVal);
      +    CHECK_FOR_ERROR
      +    yyval.TermInstVal = new BranchInst(tmpBBA, tmpBBB, tmpVal);
      +  ;
      +    break;}
      +case 277:
      +#line 2598 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    Value* tmpVal = getVal(yyvsp[-7].PrimType, yyvsp[-6].ValIDVal);
           CHECK_FOR_ERROR
      -    BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal));
      +    BasicBlock* tmpBB = getBBVal(yyvsp[-3].ValIDVal);
           CHECK_FOR_ERROR
      -    SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size());
      -    (yyval.TermInstVal) = S;
      +    SwitchInst *S = new SwitchInst(tmpVal, tmpBB, yyvsp[-1].JumpTable->size());
      +    yyval.TermInstVal = S;
       
      -    std::vector >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(),
      -      E = (yyvsp[(8) - (9)].JumpTable)->end();
      +    std::vector >::iterator I = yyvsp[-1].JumpTable->begin(),
      +      E = yyvsp[-1].JumpTable->end();
           for (; I != E; ++I) {
             if (ConstantInt *CI = dyn_cast(I->first))
                 S->addCase(CI, I->second);
             else
               GEN_ERROR("Switch case is constant, but not a simple integer");
           }
      -    delete (yyvsp[(8) - (9)].JumpTable);
      +    delete yyvsp[-1].JumpTable;
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 276:
      -#line 2596 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal));
      +  ;
      +    break;}
      +case 278:
      +#line 2617 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    Value* tmpVal = getVal(yyvsp[-6].PrimType, yyvsp[-5].ValIDVal);
           CHECK_FOR_ERROR
      -    BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal));
      +    BasicBlock* tmpBB = getBBVal(yyvsp[-2].ValIDVal);
           CHECK_FOR_ERROR
           SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0);
      -    (yyval.TermInstVal) = S;
      +    yyval.TermInstVal = S;
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 277:
      -#line 2606 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +  ;
      +    break;}
      +case 279:
      +#line 2627 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
       
           // Handle the short syntax
           const PointerType *PFTy = 0;
           const FunctionType *Ty = 0;
      -    if (!(PFTy = dyn_cast((yyvsp[(3) - (14)].TypeVal)->get())) ||
      +    if (!(PFTy = dyn_cast(yyvsp[-11].TypeVal->get())) ||
               !(Ty = dyn_cast(PFTy->getElementType()))) {
             // Pull out the types of all of the arguments...
             std::vector ParamTypes;
      -      ParamList::iterator I = (yyvsp[(6) - (14)].ParamList)->begin(), E = (yyvsp[(6) - (14)].ParamList)->end();
      +      ParamList::iterator I = yyvsp[-8].ParamList->begin(), E = yyvsp[-8].ParamList->end();
             for (; I != E; ++I) {
               const Type *Ty = I->Val->getType();
               if (Ty == Type::VoidTy)
                 GEN_ERROR("Short call syntax cannot be used with varargs");
               ParamTypes.push_back(Ty);
             }
      -      Ty = FunctionType::get((yyvsp[(3) - (14)].TypeVal)->get(), ParamTypes, false);
      +      Ty = FunctionType::get(yyvsp[-11].TypeVal->get(), ParamTypes, false);
             PFTy = PointerType::get(Ty);
           }
       
      -    delete (yyvsp[(3) - (14)].TypeVal);
      +    delete yyvsp[-11].TypeVal;
       
      -    Value *V = getVal(PFTy, (yyvsp[(4) - (14)].ValIDVal));   // Get the function we're calling...
      +    Value *V = getVal(PFTy, yyvsp[-10].ValIDVal);   // Get the function we're calling...
           CHECK_FOR_ERROR
      -    BasicBlock *Normal = getBBVal((yyvsp[(11) - (14)].ValIDVal));
      +    BasicBlock *Normal = getBBVal(yyvsp[-3].ValIDVal);
           CHECK_FOR_ERROR
      -    BasicBlock *Except = getBBVal((yyvsp[(14) - (14)].ValIDVal));
      +    BasicBlock *Except = getBBVal(yyvsp[0].ValIDVal);
           CHECK_FOR_ERROR
       
           ParamAttrsVector Attrs;
      -    if ((yyvsp[(8) - (14)].ParamAttrs) != ParamAttr::None) {
      -      ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = (yyvsp[(8) - (14)].ParamAttrs);
      +    if (yyvsp[-6].ParamAttrs != ParamAttr::None) {
      +      ParamAttrsWithIndex PAWI; PAWI.index = 0; PAWI.attrs = yyvsp[-6].ParamAttrs;
             Attrs.push_back(PAWI);
           }
       
           // Check the arguments
           ValueList Args;
      -    if ((yyvsp[(6) - (14)].ParamList)->empty()) {                                   // Has no arguments?
      +    if (yyvsp[-8].ParamList->empty()) {                                   // Has no arguments?
             // Make sure no arguments is a good thing!
             if (Ty->getNumParams() != 0)
               GEN_ERROR("No arguments passed to a function that "
      @@ -5683,7 +4645,7 @@
             // correctly!
             FunctionType::param_iterator I = Ty->param_begin();
             FunctionType::param_iterator E = Ty->param_end();
      -      ParamList::iterator ArgI = (yyvsp[(6) - (14)].ParamList)->begin(), ArgE = (yyvsp[(6) - (14)].ParamList)->end();
      +      ParamList::iterator ArgI = yyvsp[-8].ParamList->begin(), ArgE = yyvsp[-8].ParamList->end();
             unsigned index = 1;
       
             for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
      @@ -5713,375 +4675,347 @@
       
           // Create the InvokeInst
           InvokeInst *II = new InvokeInst(V, Normal, Except, Args.begin(), Args.end());
      -    II->setCallingConv((yyvsp[(2) - (14)].UIntVal));
      +    II->setCallingConv(yyvsp[-12].UIntVal);
           II->setParamAttrs(PAL);
      -    (yyval.TermInstVal) = II;
      -    delete (yyvsp[(6) - (14)].ParamList);
      +    yyval.TermInstVal = II;
      +    delete yyvsp[-8].ParamList;
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 278:
      -#line 2689 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.TermInstVal) = new UnwindInst();
      +  ;
      +    break;}
      +case 280:
      +#line 2710 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.TermInstVal = new UnwindInst();
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 279:
      -#line 2693 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.TermInstVal) = new UnreachableInst();
      +  ;
      +    break;}
      +case 281:
      +#line 2714 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.TermInstVal = new UnreachableInst();
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 280:
      -#line 2700 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable);
      -    Constant *V = cast(getExistingVal((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal)));
      +  ;
      +    break;}
      +case 282:
      +#line 2721 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.JumpTable = yyvsp[-5].JumpTable;
      +    Constant *V = cast(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
           CHECK_FOR_ERROR
           if (V == 0)
             GEN_ERROR("May only switch on a constant pool value");
       
      -    BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal));
      +    BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
           CHECK_FOR_ERROR
      -    (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
      -  ;}
      -    break;
      -
      -  case 281:
      -#line 2711 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.JumpTable) = new std::vector >();
      -    Constant *V = cast(getExistingVal((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal)));
      +    yyval.JumpTable->push_back(std::make_pair(V, tmpBB));
      +  ;
      +    break;}
      +case 283:
      +#line 2732 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.JumpTable = new std::vector >();
      +    Constant *V = cast(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
           CHECK_FOR_ERROR
       
           if (V == 0)
             GEN_ERROR("May only switch on a constant pool value");
       
      -    BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal));
      +    BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
           CHECK_FOR_ERROR
      -    (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); 
      -  ;}
      -    break;
      -
      -  case 282:
      -#line 2724 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +    yyval.JumpTable->push_back(std::make_pair(V, tmpBB)); 
      +  ;
      +    break;}
      +case 284:
      +#line 2745 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           // Is this definition named?? if so, assign the name...
      -    setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal));
      +    setValueName(yyvsp[0].InstVal, yyvsp[-1].StrVal);
           CHECK_FOR_ERROR
      -    InsertValue((yyvsp[(2) - (2)].InstVal));
      -    (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal);
      +    InsertValue(yyvsp[0].InstVal);
      +    yyval.InstVal = yyvsp[0].InstVal;
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 283:
      -#line 2734 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {    // Used for PHI nodes
      +  ;
      +    break;}
      +case 285:
      +#line 2755 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{    // Used for PHI nodes
           if (!UpRefs.empty())
      -      GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (6)].TypeVal))->getDescription());
      -    (yyval.PHIList) = new std::list >();
      -    Value* tmpVal = getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal));
      -    CHECK_FOR_ERROR
      -    BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal));
      -    CHECK_FOR_ERROR
      -    (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
      -    delete (yyvsp[(1) - (6)].TypeVal);
      -  ;}
      -    break;
      -
      -  case 284:
      -#line 2745 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList);
      -    Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal));
      +      GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-5].TypeVal)->getDescription());
      +    yyval.PHIList = new std::list >();
      +    Value* tmpVal = getVal(*yyvsp[-5].TypeVal, yyvsp[-3].ValIDVal);
      +    CHECK_FOR_ERROR
      +    BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal);
      +    CHECK_FOR_ERROR
      +    yyval.PHIList->push_back(std::make_pair(tmpVal, tmpBB));
      +    delete yyvsp[-5].TypeVal;
      +  ;
      +    break;}
      +case 286:
      +#line 2766 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.PHIList = yyvsp[-6].PHIList;
      +    Value* tmpVal = getVal(yyvsp[-6].PHIList->front().first->getType(), yyvsp[-3].ValIDVal);
           CHECK_FOR_ERROR
      -    BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal));
      +    BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal);
           CHECK_FOR_ERROR
      -    (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
      -  ;}
      -    break;
      -
      -  case 285:
      -#line 2755 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +    yyvsp[-6].PHIList->push_back(std::make_pair(tmpVal, tmpBB));
      +  ;
      +    break;}
      +case 287:
      +#line 2776 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
           if (!UpRefs.empty())
      -      GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (4)].TypeVal))->getDescription());
      +      GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
           // Used for call and invoke instructions
      -    (yyval.ParamList) = new ParamList();
      -    ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getVal((yyvsp[(1) - (4)].TypeVal)->get(), (yyvsp[(3) - (4)].ValIDVal));
      -    (yyval.ParamList)->push_back(E);
      -    delete (yyvsp[(1) - (4)].TypeVal);
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 286:
      -#line 2766 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +    yyval.ParamList = new ParamList();
      +    ParamListEntry E; E.Attrs = yyvsp[-2].ParamAttrs | yyvsp[0].ParamAttrs; E.Val = getVal(yyvsp[-3].TypeVal->get(), yyvsp[-1].ValIDVal);
      +    yyval.ParamList->push_back(E);
      +    delete yyvsp[-3].TypeVal;
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 288:
      +#line 2787 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
           // Labels are only valid in ASMs
      -    (yyval.ParamList) = new ParamList();
      -    ParamListEntry E; E.Attrs = (yyvsp[(2) - (4)].ParamAttrs) | (yyvsp[(4) - (4)].ParamAttrs); E.Val = getBBVal((yyvsp[(3) - (4)].ValIDVal));
      -    (yyval.ParamList)->push_back(E);
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 287:
      -#line 2774 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +    yyval.ParamList = new ParamList();
      +    ParamListEntry E; E.Attrs = yyvsp[-2].ParamAttrs | yyvsp[0].ParamAttrs; E.Val = getBBVal(yyvsp[-1].ValIDVal);
      +    yyval.ParamList->push_back(E);
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 289:
      +#line 2795 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
           if (!UpRefs.empty())
      -      GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
      -    (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
      -    ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getVal((yyvsp[(3) - (6)].TypeVal)->get(), (yyvsp[(5) - (6)].ValIDVal));
      -    (yyval.ParamList)->push_back(E);
      -    delete (yyvsp[(3) - (6)].TypeVal);
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 288:
      -#line 2784 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +      GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
      +    yyval.ParamList = yyvsp[-5].ParamList;
      +    ParamListEntry E; E.Attrs = yyvsp[-2].ParamAttrs | yyvsp[0].ParamAttrs; E.Val = getVal(yyvsp[-3].TypeVal->get(), yyvsp[-1].ValIDVal);
      +    yyval.ParamList->push_back(E);
      +    delete yyvsp[-3].TypeVal;
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 290:
      +#line 2805 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0
      -    (yyval.ParamList) = (yyvsp[(1) - (6)].ParamList);
      -    ParamListEntry E; E.Attrs = (yyvsp[(4) - (6)].ParamAttrs) | (yyvsp[(6) - (6)].ParamAttrs); E.Val = getBBVal((yyvsp[(5) - (6)].ValIDVal));
      -    (yyval.ParamList)->push_back(E);
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 289:
      -#line 2791 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.ParamList) = new ParamList(); ;}
      -    break;
      -
      -  case 290:
      -#line 2794 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    { (yyval.ValueList) = new std::vector(); ;}
      -    break;
      -
      -  case 291:
      -#line 2795 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList);
      -    (yyval.ValueList)->push_back((yyvsp[(3) - (3)].ValueVal));
      +    yyval.ParamList = yyvsp[-5].ParamList;
      +    ParamListEntry E; E.Attrs = yyvsp[-2].ParamAttrs | yyvsp[0].ParamAttrs; E.Val = getBBVal(yyvsp[-1].ValIDVal);
      +    yyval.ParamList->push_back(E);
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 291:
      +#line 2812 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.ParamList = new ParamList(); ;
      +    break;}
      +case 292:
      +#line 2815 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{ yyval.ValueList = new std::vector(); ;
      +    break;}
      +case 293:
      +#line 2816 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.ValueList = yyvsp[-2].ValueList;
      +    yyval.ValueList->push_back(yyvsp[0].ValueVal);
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 292:
      -#line 2802 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.BoolVal) = true;
      +  ;
      +    break;}
      +case 294:
      +#line 2823 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.BoolVal = true;
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 293:
      -#line 2806 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.BoolVal) = false;
      +  ;
      +    break;}
      +case 295:
      +#line 2827 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.BoolVal = false;
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 294:
      -#line 2811 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +  ;
      +    break;}
      +case 296:
      +#line 2832 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           if (!UpRefs.empty())
      -      GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
      -    if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() && 
      -        !isa((*(yyvsp[(2) - (5)].TypeVal)).get()))
      +      GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
      +    if (!(*yyvsp[-3].TypeVal)->isInteger() && !(*yyvsp[-3].TypeVal)->isFloatingPoint() && 
      +        !isa((*yyvsp[-3].TypeVal).get()))
             GEN_ERROR(
               "Arithmetic operator requires integer, FP, or packed operands");
      -    Value* val1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal)); 
      +    Value* val1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal); 
           CHECK_FOR_ERROR
      -    Value* val2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
      +    Value* val2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
           CHECK_FOR_ERROR
      -    (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), val1, val2);
      -    if ((yyval.InstVal) == 0)
      +    yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, val1, val2);
      +    if (yyval.InstVal == 0)
             GEN_ERROR("binary operator returned null");
      -    delete (yyvsp[(2) - (5)].TypeVal);
      -  ;}
      -    break;
      -
      -  case 295:
      -#line 2827 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +    delete yyvsp[-3].TypeVal;
      +  ;
      +    break;}
      +case 297:
      +#line 2848 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           if (!UpRefs.empty())
      -      GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (5)].TypeVal))->getDescription());
      -    if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger()) {
      -      if (Instruction::isShift((yyvsp[(1) - (5)].BinaryOpVal)) || !isa((yyvsp[(2) - (5)].TypeVal)->get()) ||
      -          !cast((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isInteger())
      +      GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
      +    if (!(*yyvsp[-3].TypeVal)->isInteger()) {
      +      if (Instruction::isShift(yyvsp[-4].BinaryOpVal) || !isa(yyvsp[-3].TypeVal->get()) ||
      +          !cast(yyvsp[-3].TypeVal->get())->getElementType()->isInteger())
               GEN_ERROR("Logical operator requires integral operands");
           }
      -    Value* tmpVal1 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal));
      +    Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
           CHECK_FOR_ERROR
      -    Value* tmpVal2 = getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal));
      +    Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
           CHECK_FOR_ERROR
      -    (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), tmpVal1, tmpVal2);
      -    if ((yyval.InstVal) == 0)
      +    yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, tmpVal1, tmpVal2);
      +    if (yyval.InstVal == 0)
             GEN_ERROR("binary operator returned null");
      -    delete (yyvsp[(2) - (5)].TypeVal);
      -  ;}
      -    break;
      -
      -  case 296:
      -#line 2844 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +    delete yyvsp[-3].TypeVal;
      +  ;
      +    break;}
      +case 298:
      +#line 2865 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           if (!UpRefs.empty())
      -      GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
      -    if (isa((*(yyvsp[(3) - (6)].TypeVal)).get()))
      +      GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
      +    if (isa((*yyvsp[-3].TypeVal).get()))
             GEN_ERROR("Vector types not supported by icmp instruction");
      -    Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
      +    Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
           CHECK_FOR_ERROR
      -    Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
      +    Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
           CHECK_FOR_ERROR
      -    (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].IPredicate), tmpVal1, tmpVal2);
      -    if ((yyval.InstVal) == 0)
      +    yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].IPredicate, tmpVal1, tmpVal2);
      +    if (yyval.InstVal == 0)
             GEN_ERROR("icmp operator returned null");
      -    delete (yyvsp[(3) - (6)].TypeVal);
      -  ;}
      -    break;
      -
      -  case 297:
      -#line 2858 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +    delete yyvsp[-3].TypeVal;
      +  ;
      +    break;}
      +case 299:
      +#line 2879 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           if (!UpRefs.empty())
      -      GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (6)].TypeVal))->getDescription());
      -    if (isa((*(yyvsp[(3) - (6)].TypeVal)).get()))
      +      GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription());
      +    if (isa((*yyvsp[-3].TypeVal).get()))
             GEN_ERROR("Vector types not supported by fcmp instruction");
      -    Value* tmpVal1 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(4) - (6)].ValIDVal));
      +    Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
           CHECK_FOR_ERROR
      -    Value* tmpVal2 = getVal(*(yyvsp[(3) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal));
      +    Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
           CHECK_FOR_ERROR
      -    (yyval.InstVal) = CmpInst::create((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(2) - (6)].FPredicate), tmpVal1, tmpVal2);
      -    if ((yyval.InstVal) == 0)
      +    yyval.InstVal = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].FPredicate, tmpVal1, tmpVal2);
      +    if (yyval.InstVal == 0)
             GEN_ERROR("fcmp operator returned null");
      -    delete (yyvsp[(3) - (6)].TypeVal);
      -  ;}
      -    break;
      -
      -  case 298:
      -#line 2872 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +    delete yyvsp[-3].TypeVal;
      +  ;
      +    break;}
      +case 300:
      +#line 2893 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           if (!UpRefs.empty())
      -      GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
      -    Value* Val = (yyvsp[(2) - (4)].ValueVal);
      -    const Type* DestTy = (yyvsp[(4) - (4)].TypeVal)->get();
      -    if (!CastInst::castIsValid((yyvsp[(1) - (4)].CastOpVal), Val, DestTy))
      +      GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
      +    Value* Val = yyvsp[-2].ValueVal;
      +    const Type* DestTy = yyvsp[0].TypeVal->get();
      +    if (!CastInst::castIsValid(yyvsp[-3].CastOpVal, Val, DestTy))
             GEN_ERROR("invalid cast opcode for cast from '" +
                       Val->getType()->getDescription() + "' to '" +
                       DestTy->getDescription() + "'"); 
      -    (yyval.InstVal) = CastInst::create((yyvsp[(1) - (4)].CastOpVal), Val, DestTy);
      -    delete (yyvsp[(4) - (4)].TypeVal);
      -  ;}
      -    break;
      -
      -  case 299:
      -#line 2884 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::Int1Ty)
      +    yyval.InstVal = CastInst::create(yyvsp[-3].CastOpVal, Val, DestTy);
      +    delete yyvsp[0].TypeVal;
      +  ;
      +    break;}
      +case 301:
      +#line 2905 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    if (yyvsp[-4].ValueVal->getType() != Type::Int1Ty)
             GEN_ERROR("select condition must be boolean");
      -    if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType())
      +    if (yyvsp[-2].ValueVal->getType() != yyvsp[0].ValueVal->getType())
             GEN_ERROR("select value types should match");
      -    (yyval.InstVal) = new SelectInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
      +    yyval.InstVal = new SelectInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 300:
      -#line 2892 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +  ;
      +    break;}
      +case 302:
      +#line 2913 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           if (!UpRefs.empty())
      -      GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(4) - (4)].TypeVal))->getDescription());
      -    (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal));
      -    delete (yyvsp[(4) - (4)].TypeVal);
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 301:
      -#line 2899 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)))
      +      GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription());
      +    yyval.InstVal = new VAArgInst(yyvsp[-2].ValueVal, *yyvsp[0].TypeVal);
      +    delete yyvsp[0].TypeVal;
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 303:
      +#line 2920 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    if (!ExtractElementInst::isValidOperands(yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
             GEN_ERROR("Invalid extractelement operands");
      -    (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal));
      +    yyval.InstVal = new ExtractElementInst(yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 302:
      -#line 2905 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
      +  ;
      +    break;}
      +case 304:
      +#line 2926 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    if (!InsertElementInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
             GEN_ERROR("Invalid insertelement operands");
      -    (yyval.InstVal) = new InsertElementInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
      +    yyval.InstVal = new InsertElementInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 303:
      -#line 2911 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)))
      +  ;
      +    break;}
      +case 305:
      +#line 2932 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    if (!ShuffleVectorInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
             GEN_ERROR("Invalid shufflevector operands");
      -    (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal));
      +    yyval.InstVal = new ShuffleVectorInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 304:
      -#line 2917 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType();
      +  ;
      +    break;}
      +case 306:
      +#line 2938 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    const Type *Ty = yyvsp[0].PHIList->front().first->getType();
           if (!Ty->isFirstClassType())
             GEN_ERROR("PHI node operands must be of first class type");
      -    (yyval.InstVal) = new PHINode(Ty);
      -    ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size());
      -    while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) {
      -      if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty) 
      +    yyval.InstVal = new PHINode(Ty);
      +    ((PHINode*)yyval.InstVal)->reserveOperandSpace(yyvsp[0].PHIList->size());
      +    while (yyvsp[0].PHIList->begin() != yyvsp[0].PHIList->end()) {
      +      if (yyvsp[0].PHIList->front().first->getType() != Ty) 
               GEN_ERROR("All elements of a PHI node must be of the same type");
      -      cast((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second);
      -      (yyvsp[(2) - (2)].PHIList)->pop_front();
      +      cast(yyval.InstVal)->addIncoming(yyvsp[0].PHIList->front().first, yyvsp[0].PHIList->front().second);
      +      yyvsp[0].PHIList->pop_front();
           }
      -    delete (yyvsp[(2) - (2)].PHIList);  // Free the list...
      +    delete yyvsp[0].PHIList;  // Free the list...
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 305:
      -#line 2933 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +  ;
      +    break;}
      +case 307:
      +#line 2954 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
       
           // Handle the short syntax
           const PointerType *PFTy = 0;
           const FunctionType *Ty = 0;
      -    if (!(PFTy = dyn_cast((yyvsp[(3) - (8)].TypeVal)->get())) ||
      +    if (!(PFTy = dyn_cast(yyvsp[-5].TypeVal->get())) ||
               !(Ty = dyn_cast(PFTy->getElementType()))) {
             // Pull out the types of all of the arguments...
             std::vector ParamTypes;
      -      ParamList::iterator I = (yyvsp[(6) - (8)].ParamList)->begin(), E = (yyvsp[(6) - (8)].ParamList)->end();
      +      ParamList::iterator I = yyvsp[-2].ParamList->begin(), E = yyvsp[-2].ParamList->end();
             for (; I != E; ++I) {
               const Type *Ty = I->Val->getType();
               if (Ty == Type::VoidTy)
                 GEN_ERROR("Short call syntax cannot be used with varargs");
               ParamTypes.push_back(Ty);
             }
      -      Ty = FunctionType::get((yyvsp[(3) - (8)].TypeVal)->get(), ParamTypes, false);
      +      Ty = FunctionType::get(yyvsp[-5].TypeVal->get(), ParamTypes, false);
             PFTy = PointerType::get(Ty);
           }
       
      -    Value *V = getVal(PFTy, (yyvsp[(4) - (8)].ValIDVal));   // Get the function we're calling...
      +    Value *V = getVal(PFTy, yyvsp[-4].ValIDVal);   // Get the function we're calling...
           CHECK_FOR_ERROR
       
           // Check for call to invalid intrinsic to avoid crashing later.
      @@ -6095,15 +5029,15 @@
       
           // Set up the ParamAttrs for the function
           ParamAttrsVector Attrs;
      -    if ((yyvsp[(8) - (8)].ParamAttrs) != ParamAttr::None) {
      +    if (yyvsp[0].ParamAttrs != ParamAttr::None) {
             ParamAttrsWithIndex PAWI;
             PAWI.index = 0;
      -      PAWI.attrs = (yyvsp[(8) - (8)].ParamAttrs);
      +      PAWI.attrs = yyvsp[0].ParamAttrs;
             Attrs.push_back(PAWI);
           }
           // Check the arguments 
           ValueList Args;
      -    if ((yyvsp[(6) - (8)].ParamList)->empty()) {                                   // Has no arguments?
      +    if (yyvsp[-2].ParamList->empty()) {                                   // Has no arguments?
             // Make sure no arguments is a good thing!
             if (Ty->getNumParams() != 0)
               GEN_ERROR("No arguments passed to a function that "
      @@ -6113,7 +5047,7 @@
             // correctly.  Also, gather any parameter attributes.
             FunctionType::param_iterator I = Ty->param_begin();
             FunctionType::param_iterator E = Ty->param_end();
      -      ParamList::iterator ArgI = (yyvsp[(6) - (8)].ParamList)->begin(), ArgE = (yyvsp[(6) - (8)].ParamList)->end();
      +      ParamList::iterator ArgI = yyvsp[-2].ParamList->begin(), ArgE = yyvsp[-2].ParamList->end();
             unsigned index = 1;
       
             for (; ArgI != ArgE && I != E; ++ArgI, ++I, ++index) {
      @@ -6143,372 +5077,366 @@
       
           // Create the call node
           CallInst *CI = new CallInst(V, Args.begin(), Args.end());
      -    CI->setTailCall((yyvsp[(1) - (8)].BoolVal));
      -    CI->setCallingConv((yyvsp[(2) - (8)].UIntVal));
      +    CI->setTailCall(yyvsp[-7].BoolVal);
      +    CI->setCallingConv(yyvsp[-6].UIntVal);
           CI->setParamAttrs(PAL);
      -    (yyval.InstVal) = CI;
      -    delete (yyvsp[(6) - (8)].ParamList);
      -    delete (yyvsp[(3) - (8)].TypeVal);
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 306:
      -#line 3023 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal);
      +    yyval.InstVal = CI;
      +    delete yyvsp[-2].ParamList;
      +    delete yyvsp[-5].TypeVal;
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 308:
      +#line 3044 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.InstVal = yyvsp[0].InstVal;
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 307:
      -#line 3028 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.BoolVal) = true;
      +  ;
      +    break;}
      +case 309:
      +#line 3049 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.BoolVal = true;
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 308:
      -#line 3032 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    (yyval.BoolVal) = false;
      +  ;
      +    break;}
      +case 310:
      +#line 3053 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    yyval.BoolVal = false;
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 309:
      -#line 3039 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +  ;
      +    break;}
      +case 311:
      +#line 3060 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           if (!UpRefs.empty())
      -      GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
      -    (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
      -    delete (yyvsp[(2) - (3)].TypeVal);
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 310:
      -#line 3046 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +      GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
      +    yyval.InstVal = new MallocInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
      +    delete yyvsp[-1].TypeVal;
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 312:
      +#line 3067 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           if (!UpRefs.empty())
      -      GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
      -    Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
      +      GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
      +    Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal);
           CHECK_FOR_ERROR
      -    (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
      -    delete (yyvsp[(2) - (6)].TypeVal);
      -  ;}
      -    break;
      -
      -  case 311:
      -#line 3054 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +    yyval.InstVal = new MallocInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal);
      +    delete yyvsp[-4].TypeVal;
      +  ;
      +    break;}
      +case 313:
      +#line 3075 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           if (!UpRefs.empty())
      -      GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (3)].TypeVal))->getDescription());
      -    (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal));
      -    delete (yyvsp[(2) - (3)].TypeVal);
      -    CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 312:
      -#line 3061 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +      GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription());
      +    yyval.InstVal = new AllocaInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
      +    delete yyvsp[-1].TypeVal;
      +    CHECK_FOR_ERROR
      +  ;
      +    break;}
      +case 314:
      +#line 3082 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           if (!UpRefs.empty())
      -      GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (6)].TypeVal))->getDescription());
      -    Value* tmpVal = getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal));
      +      GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription());
      +    Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal);
           CHECK_FOR_ERROR
      -    (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), tmpVal, (yyvsp[(6) - (6)].UIntVal));
      -    delete (yyvsp[(2) - (6)].TypeVal);
      -  ;}
      -    break;
      -
      -  case 313:
      -#line 3069 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      -    if (!isa((yyvsp[(2) - (2)].ValueVal)->getType()))
      +    yyval.InstVal = new AllocaInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal);
      +    delete yyvsp[-4].TypeVal;
      +  ;
      +    break;}
      +case 315:
      +#line 3090 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
      +    if (!isa(yyvsp[0].ValueVal->getType()))
             GEN_ERROR("Trying to free nonpointer type " + 
      -                     (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "");
      -    (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal));
      +                     yyvsp[0].ValueVal->getType()->getDescription() + "");
      +    yyval.InstVal = new FreeInst(yyvsp[0].ValueVal);
           CHECK_FOR_ERROR
      -  ;}
      -    break;
      -
      -  case 314:
      -#line 3077 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +  ;
      +    break;}
      +case 316:
      +#line 3098 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           if (!UpRefs.empty())
      -      GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
      -    if (!isa((yyvsp[(3) - (5)].TypeVal)->get()))
      +      GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
      +    if (!isa(yyvsp[-2].TypeVal->get()))
             GEN_ERROR("Can't load from nonpointer type: " +
      -                     (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
      -    if (!cast((yyvsp[(3) - (5)].TypeVal)->get())->getElementType()->isFirstClassType())
      +                     (*yyvsp[-2].TypeVal)->getDescription());
      +    if (!cast(yyvsp[-2].TypeVal->get())->getElementType()->isFirstClassType())
             GEN_ERROR("Can't load from pointer of non-first-class type: " +
      -                     (*(yyvsp[(3) - (5)].TypeVal))->getDescription());
      -    Value* tmpVal = getVal(*(yyvsp[(3) - (5)].TypeVal), (yyvsp[(4) - (5)].ValIDVal));
      +                     (*yyvsp[-2].TypeVal)->getDescription());
      +    Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
           CHECK_FOR_ERROR
      -    (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[(1) - (5)].BoolVal), (yyvsp[(5) - (5)].UIntVal));
      -    delete (yyvsp[(3) - (5)].TypeVal);
      -  ;}
      -    break;
      -
      -  case 315:
      -#line 3091 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +    yyval.InstVal = new LoadInst(tmpVal, "", yyvsp[-4].BoolVal, yyvsp[0].UIntVal);
      +    delete yyvsp[-2].TypeVal;
      +  ;
      +    break;}
      +case 317:
      +#line 3112 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           if (!UpRefs.empty())
      -      GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
      -    const PointerType *PT = dyn_cast((yyvsp[(5) - (7)].TypeVal)->get());
      +      GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
      +    const PointerType *PT = dyn_cast(yyvsp[-2].TypeVal->get());
           if (!PT)
             GEN_ERROR("Can't store to a nonpointer type: " +
      -                     (*(yyvsp[(5) - (7)].TypeVal))->getDescription());
      +                     (*yyvsp[-2].TypeVal)->getDescription());
           const Type *ElTy = PT->getElementType();
      -    if (ElTy != (yyvsp[(3) - (7)].ValueVal)->getType())
      -      GEN_ERROR("Can't store '" + (yyvsp[(3) - (7)].ValueVal)->getType()->getDescription() +
      +    if (ElTy != yyvsp[-4].ValueVal->getType())
      +      GEN_ERROR("Can't store '" + yyvsp[-4].ValueVal->getType()->getDescription() +
                            "' into space of type '" + ElTy->getDescription() + "'");
       
      -    Value* tmpVal = getVal(*(yyvsp[(5) - (7)].TypeVal), (yyvsp[(6) - (7)].ValIDVal));
      +    Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
           CHECK_FOR_ERROR
      -    (yyval.InstVal) = new StoreInst((yyvsp[(3) - (7)].ValueVal), tmpVal, (yyvsp[(1) - (7)].BoolVal), (yyvsp[(7) - (7)].UIntVal));
      -    delete (yyvsp[(5) - (7)].TypeVal);
      -  ;}
      -    break;
      -
      -  case 316:
      -#line 3108 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -    {
      +    yyval.InstVal = new StoreInst(yyvsp[-4].ValueVal, tmpVal, yyvsp[-6].BoolVal, yyvsp[0].UIntVal);
      +    delete yyvsp[-2].TypeVal;
      +  ;
      +    break;}
      +case 318:
      +#line 3129 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
      +{
           if (!UpRefs.empty())
      -      GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(2) - (4)].TypeVal))->getDescription());
      -    if (!isa((yyvsp[(2) - (4)].TypeVal)->get()))
      +      GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription());
      +    if (!isa(yyvsp[-2].TypeVal->get()))
             GEN_ERROR("getelementptr insn requires pointer operand");
       
      -    if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end(), true))
      +    if (!GetElementPtrInst::getIndexedType(*yyvsp[-2].TypeVal, yyvsp[0].ValueList->begin(), yyvsp[0].ValueList->end(), true))
             GEN_ERROR("Invalid getelementptr indices for type '" +
      -                     (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'");
      -    Value* tmpVal = getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal));
      +                     (*yyvsp[-2].TypeVal)->getDescription()+ "'");
      +    Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal);
           CHECK_FOR_ERROR
      -    (yyval.InstVal) = new GetElementPtrInst(tmpVal, (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end());
      -    delete (yyvsp[(2) - (4)].TypeVal); 
      -    delete (yyvsp[(4) - (4)].ValueList);
      -  ;}
      -    break;
      -
      +    yyval.InstVal = new GetElementPtrInst(tmpVal, yyvsp[0].ValueList->begin(), yyvsp[0].ValueList->end());
      +    delete yyvsp[-2].TypeVal; 
      +    delete yyvsp[0].ValueList;
      +  ;
      +    break;}
      +}
      +   /* the action file gets copied in in place of this dollarsign */
      +#line 543 "/usr/share/bison.simple"
      +
      +  yyvsp -= yylen;
      +  yyssp -= yylen;
      +#ifdef YYLSP_NEEDED
      +  yylsp -= yylen;
      +#endif
       
      -/* Line 1267 of yacc.c.  */
      -#line 6298 "llvmAsmParser.tab.c"
      -      default: break;
      -    }
      -  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
      -
      -  YYPOPSTACK (yylen);
      -  yylen = 0;
      -  YY_STACK_PRINT (yyss, yyssp);
      +#if YYDEBUG != 0
      +  if (yydebug)
      +    {
      +      short *ssp1 = yyss - 1;
      +      fprintf (stderr, "state stack now");
      +      while (ssp1 != yyssp)
      +	fprintf (stderr, " %d", *++ssp1);
      +      fprintf (stderr, "\n");
      +    }
      +#endif
       
         *++yyvsp = yyval;
       
      +#ifdef YYLSP_NEEDED
      +  yylsp++;
      +  if (yylen == 0)
      +    {
      +      yylsp->first_line = yylloc.first_line;
      +      yylsp->first_column = yylloc.first_column;
      +      yylsp->last_line = (yylsp-1)->last_line;
      +      yylsp->last_column = (yylsp-1)->last_column;
      +      yylsp->text = 0;
      +    }
      +  else
      +    {
      +      yylsp->last_line = (yylsp+yylen-1)->last_line;
      +      yylsp->last_column = (yylsp+yylen-1)->last_column;
      +    }
      +#endif
       
      -  /* Now `shift' the result of the reduction.  Determine what state
      -     that goes to, based on the state we popped back to and the rule
      -     number reduced by.  */
      +  /* Now "shift" the result of the reduction.
      +     Determine what state that goes to,
      +     based on the state we popped back to
      +     and the rule number reduced by.  */
       
         yyn = yyr1[yyn];
       
      -  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
      -  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
      +  yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
      +  if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
           yystate = yytable[yystate];
         else
      -    yystate = yydefgoto[yyn - YYNTOKENS];
      +    yystate = yydefgoto[yyn - YYNTBASE];
       
         goto yynewstate;
       
      +yyerrlab:   /* here on detecting error */
       
      -/*------------------------------------.
      -| yyerrlab -- here on detecting error |
      -`------------------------------------*/
      -yyerrlab:
      -  /* If not already recovering from an error, report this error.  */
      -  if (!yyerrstatus)
      +  if (! yyerrstatus)
      +    /* If not already recovering from an error, report this error.  */
           {
             ++yynerrs;
      -#if ! YYERROR_VERBOSE
      -      yyerror (YY_("syntax error"));
      -#else
      -      {
      -	YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
      -	if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
      -	  {
      -	    YYSIZE_T yyalloc = 2 * yysize;
      -	    if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
      -	      yyalloc = YYSTACK_ALLOC_MAXIMUM;
      -	    if (yymsg != yymsgbuf)
      -	      YYSTACK_FREE (yymsg);
      -	    yymsg = (char *) YYSTACK_ALLOC (yyalloc);
      -	    if (yymsg)
      -	      yymsg_alloc = yyalloc;
      -	    else
      -	      {
      -		yymsg = yymsgbuf;
      -		yymsg_alloc = sizeof yymsgbuf;
      -	      }
      -	  }
      -
      -	if (0 < yysize && yysize <= yymsg_alloc)
      -	  {
      -	    (void) yysyntax_error (yymsg, yystate, yychar);
      -	    yyerror (yymsg);
      -	  }
      -	else
      -	  {
      -	    yyerror (YY_("syntax error"));
      -	    if (yysize != 0)
      -	      goto yyexhaustedlab;
      -	  }
      -      }
      -#endif
      -    }
       
      +#ifdef YYERROR_VERBOSE
      +      yyn = yypact[yystate];
       
      -
      -  if (yyerrstatus == 3)
      -    {
      -      /* If just tried and failed to reuse look-ahead token after an
      -	 error, discard it.  */
      -
      -      if (yychar <= YYEOF)
      +      if (yyn > YYFLAG && yyn < YYLAST)
       	{
      -	  /* Return failure if at end of input.  */
      -	  if (yychar == YYEOF)
      -	    YYABORT;
      +	  int size = 0;
      +	  char *msg;
      +	  int x, count;
      +
      +	  count = 0;
      +	  /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
      +	  for (x = (yyn < 0 ? -yyn : 0);
      +	       x < (sizeof(yytname) / sizeof(char *)); x++)
      +	    if (yycheck[x + yyn] == x)
      +	      size += strlen(yytname[x]) + 15, count++;
      +	  msg = (char *) malloc(size + 15);
      +	  if (msg != 0)
      +	    {
      +	      strcpy(msg, "parse error");
      +
      +	      if (count < 5)
      +		{
      +		  count = 0;
      +		  for (x = (yyn < 0 ? -yyn : 0);
      +		       x < (sizeof(yytname) / sizeof(char *)); x++)
      +		    if (yycheck[x + yyn] == x)
      +		      {
      +			strcat(msg, count == 0 ? ", expecting `" : " or `");
      +			strcat(msg, yytname[x]);
      +			strcat(msg, "'");
      +			count++;
      +		      }
      +		}
      +	      yyerror(msg);
      +	      free(msg);
      +	    }
      +	  else
      +	    yyerror ("parse error; also virtual memory exceeded");
       	}
             else
      -	{
      -	  yydestruct ("Error: discarding",
      -		      yytoken, &yylval);
      -	  yychar = YYEMPTY;
      -	}
      +#endif /* YYERROR_VERBOSE */
      +	yyerror("parse error");
           }
       
      -  /* Else will try to reuse look-ahead token after shifting the error
      -     token.  */
         goto yyerrlab1;
      +yyerrlab1:   /* here on error raised explicitly by an action */
      +
      +  if (yyerrstatus == 3)
      +    {
      +      /* if just tried and failed to reuse lookahead token after an error, discard it.  */
       
      +      /* return failure if at end of input */
      +      if (yychar == YYEOF)
      +	YYABORT;
       
      -/*---------------------------------------------------.
      -| yyerrorlab -- error raised explicitly by YYERROR.  |
      -`---------------------------------------------------*/
      -yyerrorlab:
      -
      -  /* Pacify compilers like GCC when the user code never invokes
      -     YYERROR and the label yyerrorlab therefore never appears in user
      -     code.  */
      -  if (/*CONSTCOND*/ 0)
      -     goto yyerrorlab;
      -
      -  /* Do not reclaim the symbols of the rule which action triggered
      -     this YYERROR.  */
      -  YYPOPSTACK (yylen);
      -  yylen = 0;
      -  YY_STACK_PRINT (yyss, yyssp);
      -  yystate = *yyssp;
      -  goto yyerrlab1;
      +#if YYDEBUG != 0
      +      if (yydebug)
      +	fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
      +#endif
      +
      +      yychar = YYEMPTY;
      +    }
      +
      +  /* Else will try to reuse lookahead token
      +     after shifting the error token.  */
      +
      +  yyerrstatus = 3;		/* Each real token shifted decrements this */
       
      +  goto yyerrhandle;
       
      -/*-------------------------------------------------------------.
      -| yyerrlab1 -- common code for both syntax error and YYERROR.  |
      -`-------------------------------------------------------------*/
      -yyerrlab1:
      -  yyerrstatus = 3;	/* Each real token shifted decrements this.  */
      +yyerrdefault:  /* current state does not do anything special for the error token. */
       
      -  for (;;)
      +#if 0
      +  /* This is wrong; only states that explicitly want error tokens
      +     should shift them.  */
      +  yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
      +  if (yyn) goto yydefault;
      +#endif
      +
      +yyerrpop:   /* pop the current state because it cannot handle the error token */
      +
      +  if (yyssp == yyss) YYABORT;
      +  yyvsp--;
      +  yystate = *--yyssp;
      +#ifdef YYLSP_NEEDED
      +  yylsp--;
      +#endif
      +
      +#if YYDEBUG != 0
      +  if (yydebug)
           {
      -      yyn = yypact[yystate];
      -      if (yyn != YYPACT_NINF)
      -	{
      -	  yyn += YYTERROR;
      -	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
      -	    {
      -	      yyn = yytable[yyn];
      -	      if (0 < yyn)
      -		break;
      -	    }
      -	}
      +      short *ssp1 = yyss - 1;
      +      fprintf (stderr, "Error: state stack now");
      +      while (ssp1 != yyssp)
      +	fprintf (stderr, " %d", *++ssp1);
      +      fprintf (stderr, "\n");
      +    }
      +#endif
       
      -      /* Pop the current state because it cannot handle the error token.  */
      -      if (yyssp == yyss)
      -	YYABORT;
      +yyerrhandle:
      +
      +  yyn = yypact[yystate];
      +  if (yyn == YYFLAG)
      +    goto yyerrdefault;
       
      +  yyn += YYTERROR;
      +  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
      +    goto yyerrdefault;
       
      -      yydestruct ("Error: popping",
      -		  yystos[yystate], yyvsp);
      -      YYPOPSTACK (1);
      -      yystate = *yyssp;
      -      YY_STACK_PRINT (yyss, yyssp);
      +  yyn = yytable[yyn];
      +  if (yyn < 0)
      +    {
      +      if (yyn == YYFLAG)
      +	goto yyerrpop;
      +      yyn = -yyn;
      +      goto yyreduce;
           }
      +  else if (yyn == 0)
      +    goto yyerrpop;
       
         if (yyn == YYFINAL)
           YYACCEPT;
       
      -  *++yyvsp = yylval;
      -
      +#if YYDEBUG != 0
      +  if (yydebug)
      +    fprintf(stderr, "Shifting error token, ");
      +#endif
       
      -  /* Shift the error token.  */
      -  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
      +  *++yyvsp = yylval;
      +#ifdef YYLSP_NEEDED
      +  *++yylsp = yylloc;
      +#endif
       
         yystate = yyn;
         goto yynewstate;
       
      + yyacceptlab:
      +  /* YYACCEPT comes here.  */
      +  if (yyfree_stacks)
      +    {
      +      free (yyss);
      +      free (yyvs);
      +#ifdef YYLSP_NEEDED
      +      free (yyls);
      +#endif
      +    }
      +  return 0;
       
      -/*-------------------------------------.
      -| yyacceptlab -- YYACCEPT comes here.  |
      -`-------------------------------------*/
      -yyacceptlab:
      -  yyresult = 0;
      -  goto yyreturn;
      -
      -/*-----------------------------------.
      -| yyabortlab -- YYABORT comes here.  |
      -`-----------------------------------*/
      -yyabortlab:
      -  yyresult = 1;
      -  goto yyreturn;
      -
      -#ifndef yyoverflow
      -/*-------------------------------------------------.
      -| yyexhaustedlab -- memory exhaustion comes here.  |
      -`-------------------------------------------------*/
      -yyexhaustedlab:
      -  yyerror (YY_("memory exhausted"));
      -  yyresult = 2;
      -  /* Fall through.  */
      -#endif
      -
      -yyreturn:
      -  if (yychar != YYEOF && yychar != YYEMPTY)
      -     yydestruct ("Cleanup: discarding lookahead",
      -		 yytoken, &yylval);
      -  /* Do not reclaim the symbols of the rule which action triggered
      -     this YYABORT or YYACCEPT.  */
      -  YYPOPSTACK (yylen);
      -  YY_STACK_PRINT (yyss, yyssp);
      -  while (yyssp != yyss)
      + yyabortlab:
      +  /* YYABORT comes here.  */
      +  if (yyfree_stacks)
           {
      -      yydestruct ("Cleanup: popping",
      -		  yystos[*yyssp], yyvsp);
      -      YYPOPSTACK (1);
      -    }
      -#ifndef yyoverflow
      -  if (yyss != yyssa)
      -    YYSTACK_FREE (yyss);
      -#endif
      -#if YYERROR_VERBOSE
      -  if (yymsg != yymsgbuf)
      -    YYSTACK_FREE (yymsg);
      +      free (yyss);
      +      free (yyvs);
      +#ifdef YYLSP_NEEDED
      +      free (yyls);
       #endif
      -  /* Make sure YYID is used.  */
      -  return YYID (yyresult);
      +    }
      +  return 1;
       }
      -
      -
      -#line 3125 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      +#line 3146 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y"
       
       
       // common code from the two 'RunVMAsmParser' functions
      @@ -6583,4 +5511,3 @@
         GenerateError(errMsg);
         return 0;
       }
      -
      
      Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs?rev=44859&r1=44858&r2=44859&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs (original)
      +++ llvm/trunk/lib/AsmParser/llvmAsmParser.h.cvs Tue Dec 11 03:02:08 2007
      @@ -1,347 +1,4 @@
      -/* A Bison parser, made by GNU Bison 2.3.  */
      -
      -/* Skeleton interface for Bison's Yacc-like parsers in C
      -
      -   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
      -   Free Software Foundation, Inc.
      -
      -   This program is free software; you can redistribute it and/or modify
      -   it under the terms of the GNU General Public License as published by
      -   the Free Software Foundation; either version 2, or (at your option)
      -   any later version.
      -
      -   This program is distributed in the hope that it will be useful,
      -   but WITHOUT ANY WARRANTY; without even the implied warranty of
      -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      -   GNU General Public License for more details.
      -
      -   You should have received a copy of the GNU General Public License
      -   along with this program; if not, write to the Free Software
      -   Foundation, Inc., 51 Franklin Street, Fifth Floor,
      -   Boston, MA 02110-1301, USA.  */
      -
      -/* As a special exception, you may create a larger work that contains
      -   part or all of the Bison parser skeleton and distribute that work
      -   under terms of your choice, so long as that work isn't itself a
      -   parser generator using the skeleton or a modified version thereof
      -   as a parser skeleton.  Alternatively, if you modify or redistribute
      -   the parser skeleton itself, you may (at your option) remove this
      -   special exception, which will cause the skeleton and the resulting
      -   Bison output files to be licensed under the GNU General Public
      -   License without this special exception.
      -
      -   This special exception was added by the Free Software Foundation in
      -   version 2.2 of Bison.  */
      -
      -/* Tokens.  */
      -#ifndef YYTOKENTYPE
      -# define YYTOKENTYPE
      -   /* Put the tokens into the symbol table, so that GDB and other debuggers
      -      know about them.  */
      -   enum yytokentype {
      -     ESINT64VAL = 258,
      -     EUINT64VAL = 259,
      -     ESAPINTVAL = 260,
      -     EUAPINTVAL = 261,
      -     LOCALVAL_ID = 262,
      -     GLOBALVAL_ID = 263,
      -     FPVAL = 264,
      -     VOID = 265,
      -     INTTYPE = 266,
      -     FLOAT = 267,
      -     DOUBLE = 268,
      -     X86_FP80 = 269,
      -     FP128 = 270,
      -     PPC_FP128 = 271,
      -     LABEL = 272,
      -     TYPE = 273,
      -     LOCALVAR = 274,
      -     GLOBALVAR = 275,
      -     LABELSTR = 276,
      -     STRINGCONSTANT = 277,
      -     ATSTRINGCONSTANT = 278,
      -     PCTSTRINGCONSTANT = 279,
      -     ZEROINITIALIZER = 280,
      -     TRUETOK = 281,
      -     FALSETOK = 282,
      -     BEGINTOK = 283,
      -     ENDTOK = 284,
      -     DECLARE = 285,
      -     DEFINE = 286,
      -     GLOBAL = 287,
      -     CONSTANT = 288,
      -     SECTION = 289,
      -     ALIAS = 290,
      -     VOLATILE = 291,
      -     THREAD_LOCAL = 292,
      -     TO = 293,
      -     DOTDOTDOT = 294,
      -     NULL_TOK = 295,
      -     UNDEF = 296,
      -     INTERNAL = 297,
      -     LINKONCE = 298,
      -     WEAK = 299,
      -     APPENDING = 300,
      -     DLLIMPORT = 301,
      -     DLLEXPORT = 302,
      -     EXTERN_WEAK = 303,
      -     OPAQUE = 304,
      -     EXTERNAL = 305,
      -     TARGET = 306,
      -     TRIPLE = 307,
      -     ALIGN = 308,
      -     DEPLIBS = 309,
      -     CALL = 310,
      -     TAIL = 311,
      -     ASM_TOK = 312,
      -     MODULE = 313,
      -     SIDEEFFECT = 314,
      -     CC_TOK = 315,
      -     CCC_TOK = 316,
      -     FASTCC_TOK = 317,
      -     COLDCC_TOK = 318,
      -     X86_STDCALLCC_TOK = 319,
      -     X86_FASTCALLCC_TOK = 320,
      -     DATALAYOUT = 321,
      -     RET = 322,
      -     BR = 323,
      -     SWITCH = 324,
      -     INVOKE = 325,
      -     UNWIND = 326,
      -     UNREACHABLE = 327,
      -     ADD = 328,
      -     SUB = 329,
      -     MUL = 330,
      -     UDIV = 331,
      -     SDIV = 332,
      -     FDIV = 333,
      -     UREM = 334,
      -     SREM = 335,
      -     FREM = 336,
      -     AND = 337,
      -     OR = 338,
      -     XOR = 339,
      -     SHL = 340,
      -     LSHR = 341,
      -     ASHR = 342,
      -     ICMP = 343,
      -     FCMP = 344,
      -     EQ = 345,
      -     NE = 346,
      -     SLT = 347,
      -     SGT = 348,
      -     SLE = 349,
      -     SGE = 350,
      -     ULT = 351,
      -     UGT = 352,
      -     ULE = 353,
      -     UGE = 354,
      -     OEQ = 355,
      -     ONE = 356,
      -     OLT = 357,
      -     OGT = 358,
      -     OLE = 359,
      -     OGE = 360,
      -     ORD = 361,
      -     UNO = 362,
      -     UEQ = 363,
      -     UNE = 364,
      -     MALLOC = 365,
      -     ALLOCA = 366,
      -     FREE = 367,
      -     LOAD = 368,
      -     STORE = 369,
      -     GETELEMENTPTR = 370,
      -     TRUNC = 371,
      -     ZEXT = 372,
      -     SEXT = 373,
      -     FPTRUNC = 374,
      -     FPEXT = 375,
      -     BITCAST = 376,
      -     UITOFP = 377,
      -     SITOFP = 378,
      -     FPTOUI = 379,
      -     FPTOSI = 380,
      -     INTTOPTR = 381,
      -     PTRTOINT = 382,
      -     PHI_TOK = 383,
      -     SELECT = 384,
      -     VAARG = 385,
      -     EXTRACTELEMENT = 386,
      -     INSERTELEMENT = 387,
      -     SHUFFLEVECTOR = 388,
      -     SIGNEXT = 389,
      -     ZEROEXT = 390,
      -     NORETURN = 391,
      -     INREG = 392,
      -     SRET = 393,
      -     NOUNWIND = 394,
      -     NOALIAS = 395,
      -     BYVAL = 396,
      -     NEST = 397,
      -     READNONE = 398,
      -     READONLY = 399,
      -     GC = 400,
      -     DEFAULT = 401,
      -     HIDDEN = 402,
      -     PROTECTED = 403
      -   };
      -#endif
      -/* Tokens.  */
      -#define ESINT64VAL 258
      -#define EUINT64VAL 259
      -#define ESAPINTVAL 260
      -#define EUAPINTVAL 261
      -#define LOCALVAL_ID 262
      -#define GLOBALVAL_ID 263
      -#define FPVAL 264
      -#define VOID 265
      -#define INTTYPE 266
      -#define FLOAT 267
      -#define DOUBLE 268
      -#define X86_FP80 269
      -#define FP128 270
      -#define PPC_FP128 271
      -#define LABEL 272
      -#define TYPE 273
      -#define LOCALVAR 274
      -#define GLOBALVAR 275
      -#define LABELSTR 276
      -#define STRINGCONSTANT 277
      -#define ATSTRINGCONSTANT 278
      -#define PCTSTRINGCONSTANT 279
      -#define ZEROINITIALIZER 280
      -#define TRUETOK 281
      -#define FALSETOK 282
      -#define BEGINTOK 283
      -#define ENDTOK 284
      -#define DECLARE 285
      -#define DEFINE 286
      -#define GLOBAL 287
      -#define CONSTANT 288
      -#define SECTION 289
      -#define ALIAS 290
      -#define VOLATILE 291
      -#define THREAD_LOCAL 292
      -#define TO 293
      -#define DOTDOTDOT 294
      -#define NULL_TOK 295
      -#define UNDEF 296
      -#define INTERNAL 297
      -#define LINKONCE 298
      -#define WEAK 299
      -#define APPENDING 300
      -#define DLLIMPORT 301
      -#define DLLEXPORT 302
      -#define EXTERN_WEAK 303
      -#define OPAQUE 304
      -#define EXTERNAL 305
      -#define TARGET 306
      -#define TRIPLE 307
      -#define ALIGN 308
      -#define DEPLIBS 309
      -#define CALL 310
      -#define TAIL 311
      -#define ASM_TOK 312
      -#define MODULE 313
      -#define SIDEEFFECT 314
      -#define CC_TOK 315
      -#define CCC_TOK 316
      -#define FASTCC_TOK 317
      -#define COLDCC_TOK 318
      -#define X86_STDCALLCC_TOK 319
      -#define X86_FASTCALLCC_TOK 320
      -#define DATALAYOUT 321
      -#define RET 322
      -#define BR 323
      -#define SWITCH 324
      -#define INVOKE 325
      -#define UNWIND 326
      -#define UNREACHABLE 327
      -#define ADD 328
      -#define SUB 329
      -#define MUL 330
      -#define UDIV 331
      -#define SDIV 332
      -#define FDIV 333
      -#define UREM 334
      -#define SREM 335
      -#define FREM 336
      -#define AND 337
      -#define OR 338
      -#define XOR 339
      -#define SHL 340
      -#define LSHR 341
      -#define ASHR 342
      -#define ICMP 343
      -#define FCMP 344
      -#define EQ 345
      -#define NE 346
      -#define SLT 347
      -#define SGT 348
      -#define SLE 349
      -#define SGE 350
      -#define ULT 351
      -#define UGT 352
      -#define ULE 353
      -#define UGE 354
      -#define OEQ 355
      -#define ONE 356
      -#define OLT 357
      -#define OGT 358
      -#define OLE 359
      -#define OGE 360
      -#define ORD 361
      -#define UNO 362
      -#define UEQ 363
      -#define UNE 364
      -#define MALLOC 365
      -#define ALLOCA 366
      -#define FREE 367
      -#define LOAD 368
      -#define STORE 369
      -#define GETELEMENTPTR 370
      -#define TRUNC 371
      -#define ZEXT 372
      -#define SEXT 373
      -#define FPTRUNC 374
      -#define FPEXT 375
      -#define BITCAST 376
      -#define UITOFP 377
      -#define SITOFP 378
      -#define FPTOUI 379
      -#define FPTOSI 380
      -#define INTTOPTR 381
      -#define PTRTOINT 382
      -#define PHI_TOK 383
      -#define SELECT 384
      -#define VAARG 385
      -#define EXTRACTELEMENT 386
      -#define INSERTELEMENT 387
      -#define SHUFFLEVECTOR 388
      -#define SIGNEXT 389
      -#define ZEROEXT 390
      -#define NORETURN 391
      -#define INREG 392
      -#define SRET 393
      -#define NOUNWIND 394
      -#define NOALIAS 395
      -#define BYVAL 396
      -#define NEST 397
      -#define READNONE 398
      -#define READONLY 399
      -#define GC 400
      -#define DEFAULT 401
      -#define HIDDEN 402
      -#define PROTECTED 403
      -
      -
      -
      -
      -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
      -typedef union YYSTYPE
      -#line 945 "/Users/malichus/Source/llvm/src/llvm/lib/AsmParser/llvmAsmParser.y"
      -{
      +typedef union {
         llvm::Module                           *ModuleVal;
         llvm::Function                         *FunctionVal;
         llvm::BasicBlock                       *BasicBlockVal;
      @@ -386,14 +43,154 @@
         llvm::Instruction::OtherOps       OtherOpVal;
         llvm::ICmpInst::Predicate         IPredicate;
         llvm::FCmpInst::Predicate         FPredicate;
      -}
      -/* Line 1529 of yacc.c.  */
      -#line 392 "llvmAsmParser.tab.h"
      -	YYSTYPE;
      -# define yystype YYSTYPE /* obsolescent; will be withdrawn */
      -# define YYSTYPE_IS_DECLARED 1
      -# define YYSTYPE_IS_TRIVIAL 1
      -#endif
      +} YYSTYPE;
      +#define	ESINT64VAL	257
      +#define	EUINT64VAL	258
      +#define	ESAPINTVAL	259
      +#define	EUAPINTVAL	260
      +#define	LOCALVAL_ID	261
      +#define	GLOBALVAL_ID	262
      +#define	FPVAL	263
      +#define	VOID	264
      +#define	INTTYPE	265
      +#define	FLOAT	266
      +#define	DOUBLE	267
      +#define	X86_FP80	268
      +#define	FP128	269
      +#define	PPC_FP128	270
      +#define	LABEL	271
      +#define	TYPE	272
      +#define	LOCALVAR	273
      +#define	GLOBALVAR	274
      +#define	LABELSTR	275
      +#define	STRINGCONSTANT	276
      +#define	ATSTRINGCONSTANT	277
      +#define	PCTSTRINGCONSTANT	278
      +#define	ZEROINITIALIZER	279
      +#define	TRUETOK	280
      +#define	FALSETOK	281
      +#define	BEGINTOK	282
      +#define	ENDTOK	283
      +#define	DECLARE	284
      +#define	DEFINE	285
      +#define	GLOBAL	286
      +#define	CONSTANT	287
      +#define	SECTION	288
      +#define	ALIAS	289
      +#define	VOLATILE	290
      +#define	THREAD_LOCAL	291
      +#define	TO	292
      +#define	DOTDOTDOT	293
      +#define	NULL_TOK	294
      +#define	UNDEF	295
      +#define	INTERNAL	296
      +#define	LINKONCE	297
      +#define	WEAK	298
      +#define	APPENDING	299
      +#define	DLLIMPORT	300
      +#define	DLLEXPORT	301
      +#define	EXTERN_WEAK	302
      +#define	OPAQUE	303
      +#define	EXTERNAL	304
      +#define	TARGET	305
      +#define	TRIPLE	306
      +#define	ALIGN	307
      +#define	ADDRSPACE	308
      +#define	DEPLIBS	309
      +#define	CALL	310
      +#define	TAIL	311
      +#define	ASM_TOK	312
      +#define	MODULE	313
      +#define	SIDEEFFECT	314
      +#define	CC_TOK	315
      +#define	CCC_TOK	316
      +#define	FASTCC_TOK	317
      +#define	COLDCC_TOK	318
      +#define	X86_STDCALLCC_TOK	319
      +#define	X86_FASTCALLCC_TOK	320
      +#define	DATALAYOUT	321
      +#define	RET	322
      +#define	BR	323
      +#define	SWITCH	324
      +#define	INVOKE	325
      +#define	UNWIND	326
      +#define	UNREACHABLE	327
      +#define	ADD	328
      +#define	SUB	329
      +#define	MUL	330
      +#define	UDIV	331
      +#define	SDIV	332
      +#define	FDIV	333
      +#define	UREM	334
      +#define	SREM	335
      +#define	FREM	336
      +#define	AND	337
      +#define	OR	338
      +#define	XOR	339
      +#define	SHL	340
      +#define	LSHR	341
      +#define	ASHR	342
      +#define	ICMP	343
      +#define	FCMP	344
      +#define	EQ	345
      +#define	NE	346
      +#define	SLT	347
      +#define	SGT	348
      +#define	SLE	349
      +#define	SGE	350
      +#define	ULT	351
      +#define	UGT	352
      +#define	ULE	353
      +#define	UGE	354
      +#define	OEQ	355
      +#define	ONE	356
      +#define	OLT	357
      +#define	OGT	358
      +#define	OLE	359
      +#define	OGE	360
      +#define	ORD	361
      +#define	UNO	362
      +#define	UEQ	363
      +#define	UNE	364
      +#define	MALLOC	365
      +#define	ALLOCA	366
      +#define	FREE	367
      +#define	LOAD	368
      +#define	STORE	369
      +#define	GETELEMENTPTR	370
      +#define	TRUNC	371
      +#define	ZEXT	372
      +#define	SEXT	373
      +#define	FPTRUNC	374
      +#define	FPEXT	375
      +#define	BITCAST	376
      +#define	UITOFP	377
      +#define	SITOFP	378
      +#define	FPTOUI	379
      +#define	FPTOSI	380
      +#define	INTTOPTR	381
      +#define	PTRTOINT	382
      +#define	PHI_TOK	383
      +#define	SELECT	384
      +#define	VAARG	385
      +#define	EXTRACTELEMENT	386
      +#define	INSERTELEMENT	387
      +#define	SHUFFLEVECTOR	388
      +#define	SIGNEXT	389
      +#define	ZEROEXT	390
      +#define	NORETURN	391
      +#define	INREG	392
      +#define	SRET	393
      +#define	NOUNWIND	394
      +#define	NOALIAS	395
      +#define	BYVAL	396
      +#define	NEST	397
      +#define	READNONE	398
      +#define	READONLY	399
      +#define	GC	400
      +#define	DEFAULT	401
      +#define	HIDDEN	402
      +#define	PROTECTED	403
       
      -extern YYSTYPE llvmAsmlval;
       
      +extern YYSTYPE llvmAsmlval;
      
      Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs?rev=44859&r1=44858&r2=44859&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs (original)
      +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs Tue Dec 11 03:02:08 2007
      @@ -491,7 +491,8 @@
          if (const FunctionType *FTy = dyn_cast(ElTy))
            V = new Function(FTy, GlobalValue::ExternalLinkage);
          else
      -     V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage);
      +     V = new GlobalVariable(ElTy, false, GlobalValue::ExternalLinkage, 0, "",
      +                            (Module*)0, false, PTy->getAddressSpace());
          break;
         }
         default:
      @@ -722,13 +723,14 @@
                           GlobalValue::LinkageTypes Linkage,
                           GlobalValue::VisibilityTypes Visibility,
                           bool isConstantGlobal, const Type *Ty,
      -                    Constant *Initializer, bool IsThreadLocal) {
      +                    Constant *Initializer, bool IsThreadLocal,
      +                    unsigned AddressSpace = 0) {
         if (isa(Ty)) {
           GenerateError("Cannot declare global vars of function type");
           return 0;
         }
       
      -  const PointerType *PTy = PointerType::get(Ty);
      +  const PointerType *PTy = PointerType::get(Ty, AddressSpace);
       
         std::string Name;
         if (NameStr) {
      @@ -780,7 +782,7 @@
         // Otherwise there is no existing GV to use, create one now.
         GlobalVariable *GV =
           new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name,
      -                       CurModule.CurrentModule, IsThreadLocal);
      +                       CurModule.CurrentModule, IsThreadLocal, AddressSpace);
         GV->setVisibility(Visibility);
         InsertValue(GV, CurModule.Values);
         return GV;
      @@ -1054,7 +1056,7 @@
       %token DECLARE DEFINE GLOBAL CONSTANT SECTION ALIAS VOLATILE THREAD_LOCAL
       %token TO DOTDOTDOT NULL_TOK UNDEF INTERNAL LINKONCE WEAK APPENDING
       %token DLLIMPORT DLLEXPORT EXTERN_WEAK
      -%token OPAQUE EXTERNAL TARGET TRIPLE ALIGN
      +%token OPAQUE EXTERNAL TARGET TRIPLE ALIGN ADDRSPACE
       %token DEPLIBS CALL TAIL ASM_TOK MODULE SIDEEFFECT
       %token CC_TOK CCC_TOK FASTCC_TOK COLDCC_TOK X86_STDCALLCC_TOK X86_FASTCALLCC_TOK
       %token DATALAYOUT
      @@ -1268,6 +1270,7 @@
       };
       
       
      +
       SectionString : SECTION STRINGCONSTANT {
         for (unsigned i = 0, e = $2->length(); i != e; ++i)
           if ((*$2)[i] == '"' || (*$2)[i] == '\\')
      @@ -1320,6 +1323,13 @@
           delete $1;
           CHECK_FOR_ERROR
         }
      +  | Types ADDRSPACE '(' EUINT64VAL ')' '*' {             // Pointer type?
      +    if (*$1 == Type::LabelTy)
      +      GEN_ERROR("Cannot form a pointer to a basic block");
      +    $$ = new PATypeHolder(HandleUpRefs(PointerType::get(*$1, $4)));
      +    delete $1;
      +    CHECK_FOR_ERROR
      +  }
         | SymbolicValueRef {            // Named types are also simple types...
           const Type* tmp = getTypeVal($1);
           CHECK_FOR_ERROR
      @@ -2073,6 +2083,17 @@
         } GlobalVarAttributes {
           CurGV = 0;
         }
      +  | OptGlobalAssign GVVisibilityStyle ThreadLocal GlobalType ConstVal
      +    ADDRSPACE '(' EUINT64VAL ')' { 
      +    /* "Externally Visible" Linkage with address space qualifier */
      +    if ($5 == 0) 
      +      GEN_ERROR("Global value initializer is not a constant");
      +    CurGV = ParseGlobalVariable($1, GlobalValue::ExternalLinkage,
      +                                $2, $4, $5->getType(), $5, $3, $8);
      +    CHECK_FOR_ERROR
      +  } GlobalVarAttributes {
      +    CurGV = 0;
      +  }
         | OptGlobalAssign GVInternalLinkage GVVisibilityStyle ThreadLocal GlobalType
           ConstVal {
           if ($6 == 0) 
      
      
      
      
      From baldrick at free.fr  Tue Dec 11 03:25:28 2007
      From: baldrick at free.fr (Duncan Sands)
      Date: Tue, 11 Dec 2007 10:25:28 +0100
      Subject: [llvm-commits] [llvm] r44825 - in /llvm/trunk:
      	include/llvm/Target/TargetData.h lib/Target/TargetData.cpp
      In-Reply-To: <1EA97F9B-57BF-4D16-B67B-E10E94F93D5C@apple.com>
      References: <200712110028.lBB0Sxth016975@zion.cs.uiuc.edu>
      	<1EA97F9B-57BF-4D16-B67B-E10E94F93D5C@apple.com>
      Message-ID: <200712111025.29794.baldrick@free.fr>
      
      Hi Chris,
      
      > Duncan, this patch gets llvm-gcc to build, but it still doesn't  
      > answer the big question: why does TargetData contain information  
      > about the host?
      
      well, it needed to go somewhere.  Any suggestions for a better place?
      Another possibility is to have a function isWrongEndian in target data,
      which tells you if the target has opposite endianness to the host.
      
      > I don't think this is the right approach.  Also, you   
      > can get the host endianness without autoconf by using something  
      > simple like:
      > 
      > bool islittleendian() {
      >    union {
      >      int i;
      >      char c;
      >    };
      > 
      >    i = 1;
      >    return c;
      > }
      
      I have no particular opinion on this (except that it's amazing to me
      that there's no standard way to query the compiler for this in C++ :) ).
      Presumably the compiler will reduce this function to: return true; (or false)
      at compile time, so there's no cost to your approach.  I suppose that plenty
      of things that autoconf does could also be done in a special function like this,
      yet they are left to autoconf - I have no idea what the criteria are for doing
      something via autoconf or via a runtime test.  Having the function inline in a
      header would have the advantage that the compiler would eliminate a bunch of code
      in ExecutionEngine at runtime.  Since it seems that the autoconf solution is not
      compatible with being exposed in a header, that suggests your solution is the way
      to go.
      
      Ciao,
      
      Duncan.
      
      
      From christopher.lamb at gmail.com  Tue Dec 11 03:31:00 2007
      From: christopher.lamb at gmail.com (Christopher Lamb)
      Date: Tue, 11 Dec 2007 09:31:00 -0000
      Subject: [llvm-commits] [llvm] r44860 - /llvm/trunk/docs/LangRef.html
      Message-ID: <200712110931.lBB9V14g027958@zion.cs.uiuc.edu>
      
      Author: clamb
      Date: Tue Dec 11 03:31:00 2007
      New Revision: 44860
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44860&view=rev
      Log:
      Add information on address space qualifiers for pointer types and global 
      declarations to the LangRef.
      
      Modified:
          llvm/trunk/docs/LangRef.html
      
      Modified: llvm/trunk/docs/LangRef.html
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=44860&r1=44859&r2=44860&view=diff
      
      ==============================================================================
      --- llvm/trunk/docs/LangRef.html (original)
      +++ llvm/trunk/docs/LangRef.html Tue Dec 11 03:31:00 2007
      @@ -668,6 +668,11 @@
       describe a region of memory, and all memory objects in LLVM are
       accessed through pointers.

      +

      A global variable may be declared to reside in a target-specifc numbered +address space. For targets that support them, address spaces may affect how +optimizations are performed and/or what target instructions are used to access +the variable. The default address space is zero.

      +

      LLVM allows an explicit section to be specified for globals. If the target supports it, it will emit globals to the section specified.

      @@ -677,12 +682,12 @@ global is forced to have at least that much alignment. All alignments must be a power of 2.

      -

      For example, the following defines a global with an initializer, section, - and alignment:

      +

      For example, the following defines a global in a numbered address space with +an initializer, section, and alignment:

      - at G = constant float 1.0, section "foo", align 4
      + at G = constant float 1.0 addrspace(5), section "foo", align 4
       
      @@ -1256,7 +1261,10 @@
      Overview:

      As in many languages, the pointer type represents a pointer or -reference to another object, which must live in memory.

      +reference to another object, which must live in memory. Pointer types may have +an optional address space attribute defining the target-specific numbered +address space where the pointed-to object resides. The default address space is +zero.

      Syntax:
        <type> *
      Examples:
      @@ -1265,6 +1273,7 @@
      Collectorllc argumentsgc attribute Linkage gcroot gcread
      SemiSpace-gc=shadow-stackgc "shadow-stack" TODO FIXME required optional
      Ocaml-gc=ocamlgc "ocaml" provided by ocamlopt required optional [4x i32]*
      i32 (i32 *) *
      + i32 addrspace(5)*
      A pointer to array of @@ -1272,6 +1281,8 @@ A pointer to a function that takes an i32*, returning an i32.
      + A pointer to an i32 value that resides + in address space 5.
      From christopher.lamb at gmail.com Tue Dec 11 03:32:08 2007 From: christopher.lamb at gmail.com (Christopher Lamb) Date: Tue, 11 Dec 2007 09:32:08 -0000 Subject: [llvm-commits] [llvm] r44861 - /llvm/trunk/CREDITS.TXT Message-ID: <200712110932.lBB9W8fo028022@zion.cs.uiuc.edu> Author: clamb Date: Tue Dec 11 03:32:07 2007 New Revision: 44861 URL: http://llvm.org/viewvc/llvm-project?rev=44861&view=rev Log: Update credits. Modified: llvm/trunk/CREDITS.TXT Modified: llvm/trunk/CREDITS.TXT URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CREDITS.TXT?rev=44861&r1=44860&r2=44861&view=diff ============================================================================== --- llvm/trunk/CREDITS.TXT (original) +++ llvm/trunk/CREDITS.TXT Tue Dec 11 03:32:07 2007 @@ -154,6 +154,7 @@ E: christopher.lamb at gmail.com D: aligned load/store support, parts of noalias and restrict support D: vreg subreg infrastructure, X86 codegen improvements based on subregs +D: address spaces N: Jim Laskey E: jlaskey at apple.com From rspencer at reidspencer.com Tue Dec 11 03:51:24 2007 From: rspencer at reidspencer.com (Reid Spencer) Date: Tue, 11 Dec 2007 09:51:24 -0000 Subject: [llvm-commits] [support] r44862 - /support/trunk/include/llvm/Support/StringPool.h Message-ID: <200712110951.lBB9pODR028823@zion.cs.uiuc.edu> Author: reid Date: Tue Dec 11 03:51:22 2007 New Revision: 44862 URL: http://llvm.org/viewvc/llvm-project?rev=44862&view=rev Log: Add a missing file to the support module. Added: support/trunk/include/llvm/Support/StringPool.h - copied unchanged from r44861, llvm/trunk/include/llvm/Support/StringPool.h From rspencer at reidspencer.com Tue Dec 11 03:54:38 2007 From: rspencer at reidspencer.com (Reid Spencer) Date: Tue, 11 Dec 2007 09:54:38 -0000 Subject: [llvm-commits] [support] r44863 - /support/trunk/lib/Support/StringPool.cpp Message-ID: <200712110954.lBB9scCn028958@zion.cs.uiuc.edu> Author: reid Date: Tue Dec 11 03:54:37 2007 New Revision: 44863 URL: http://llvm.org/viewvc/llvm-project?rev=44863&view=rev Log: Add a missing file to the support module. Added: support/trunk/lib/Support/StringPool.cpp - copied unchanged from r44862, llvm/trunk/lib/Support/StringPool.cpp From baldrick at free.fr Tue Dec 11 06:20:49 2007 From: baldrick at free.fr (Duncan Sands) Date: Tue, 11 Dec 2007 12:20:49 -0000 Subject: [llvm-commits] [llvm] r44864 - /llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Message-ID: <200712111220.lBBCKpbi004603@zion.cs.uiuc.edu> Author: baldrick Date: Tue Dec 11 06:20:47 2007 New Revision: 44864 URL: http://llvm.org/viewvc/llvm-project?rev=44864&view=rev Log: Fix compilation. Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=44864&r1=44863&r2=44864&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original) +++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Tue Dec 11 06:20:47 2007 @@ -196,7 +196,7 @@ Code = bitc::TYPE_CODE_INTEGER; TypeVals.push_back(cast(T)->getBitWidth()); break; - case Type::PointerTyID: + case Type::PointerTyID: { const PointerType *PTy = cast(T); // POINTER: [pointee type] or [pointee type, address space] Code = bitc::TYPE_CODE_POINTER; @@ -206,6 +206,7 @@ else AbbrevToUse = PtrAbbrev; break; + } case Type::FunctionTyID: { const FunctionType *FT = cast(T); From wmatyjewicz at fastmail.fm Tue Dec 11 07:45:43 2007 From: wmatyjewicz at fastmail.fm (Wojciech Matyjewicz) Date: Tue, 11 Dec 2007 14:45:43 +0100 Subject: [llvm-commits] [llvm] r44851 - /llvm/trunk/include/llvm/ADT/Trie.h In-Reply-To: <200712110653.lBB6ri8c010340@zion.cs.uiuc.edu> References: <200712110653.lBB6ri8c010340@zion.cs.uiuc.edu> Message-ID: <475E9487.3070408@fastmail.fm> Anton Korobeynikov wrote: > +template > +class Trie { > + class Edge; > + class Node; > + > + class Edge { > + std::string Label; > + Node *Parent, *Child; The Parent field seems to be unused internally by the Trie implementation. Assuming the Edge interface is invisible for Trie clients, may this field be removed? > + std::vector Nodes; I guess this vector is purely for destruction purposes... Have you considered storing a root node only and performing destruction by postorder trie traversal? > + inline Node* getRoot() const { return Nodes[0]; } I'm not familiar what Trie structure will be used for, but shouldn't this method be private? Currently, it exposes a way to call most of the Node's (and indirectly Edge's) methods, which I suppose, should be inaccessible to clients. > + bool addString(const std::string& s, const Payload& data) { > + Node* cNode = getRoot(); > + Edge* nEdge = NULL; > + std::string s1(s); > + > + while (nEdge == NULL) { > + if (cNode->Edges.count(s1[0])) { > + Edge& cEdge = cNode->Edges[s1[0]]; > + typename Edge::QueryResult r = cEdge.query(s1); > + > + switch (r) { > + case Edge::Same: Do we really want to hit the assert here, and not only return false? > + case Edge::StringIsPrefix: Shouldn't the edge be splitted in this case and the payload be attached to the new node? -Wojtek From djg at cray.com Tue Dec 11 09:41:12 2007 From: djg at cray.com (Dan Gohman) Date: Tue, 11 Dec 2007 15:41:12 -0000 Subject: [llvm-commits] [llvm] r44865 - in /llvm/trunk/test/Assembler: 2007-04-20-AlignedLoad.ll 2007-04-20-AlignedStore.ll Message-ID: <200712111541.lBBFfCFO014391@zion.cs.uiuc.edu> Author: djg Date: Tue Dec 11 09:41:11 2007 New Revision: 44865 URL: http://llvm.org/viewvc/llvm-project?rev=44865&view=rev Log: Don't redirect stderr when it isn't needed. Modified: llvm/trunk/test/Assembler/2007-04-20-AlignedLoad.ll llvm/trunk/test/Assembler/2007-04-20-AlignedStore.ll Modified: llvm/trunk/test/Assembler/2007-04-20-AlignedLoad.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/2007-04-20-AlignedLoad.ll?rev=44865&r1=44864&r2=44865&view=diff ============================================================================== --- llvm/trunk/test/Assembler/2007-04-20-AlignedLoad.ll (original) +++ llvm/trunk/test/Assembler/2007-04-20-AlignedLoad.ll Tue Dec 11 09:41:11 2007 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llvm-dis |& grep {align 1024} +; RUN: llvm-as < %s | llvm-dis | grep {align 1024} define i32 @test(i32* %arg) { entry: Modified: llvm/trunk/test/Assembler/2007-04-20-AlignedStore.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/2007-04-20-AlignedStore.ll?rev=44865&r1=44864&r2=44865&view=diff ============================================================================== --- llvm/trunk/test/Assembler/2007-04-20-AlignedStore.ll (original) +++ llvm/trunk/test/Assembler/2007-04-20-AlignedStore.ll Tue Dec 11 09:41:11 2007 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s |& llvm-dis | grep {align 1024} +; RUN: llvm-as < %s | llvm-dis | grep {align 1024} define void @test(i32* %arg) { entry: From djg at cray.com Tue Dec 11 09:50:23 2007 From: djg at cray.com (Dan Gohman) Date: Tue, 11 Dec 2007 15:50:23 -0000 Subject: [llvm-commits] [llvm] r44866 - in /llvm/trunk/test: Assembler/2004-11-28-InvalidTypeCrash.ll Assembler/2005-01-31-CallingAggregateFunction.ll CFrontend/2006-09-25-DebugFilename.c Feature/globalredefinition3.ll Linker/link-messages.ll Linker/redefinition.ll Verifier/2006-10-15-AddrLabel.ll Message-ID: <200712111550.lBBFoOUn014857@zion.cs.uiuc.edu> Author: djg Date: Tue Dec 11 09:50:23 2007 New Revision: 44866 URL: http://llvm.org/viewvc/llvm-project?rev=44866&view=rev Log: Use not instead of ignore when an exit status is expected to always be non-zero. Modified: llvm/trunk/test/Assembler/2004-11-28-InvalidTypeCrash.ll llvm/trunk/test/Assembler/2005-01-31-CallingAggregateFunction.ll llvm/trunk/test/CFrontend/2006-09-25-DebugFilename.c llvm/trunk/test/Feature/globalredefinition3.ll llvm/trunk/test/Linker/link-messages.ll llvm/trunk/test/Linker/redefinition.ll llvm/trunk/test/Verifier/2006-10-15-AddrLabel.ll Modified: llvm/trunk/test/Assembler/2004-11-28-InvalidTypeCrash.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/2004-11-28-InvalidTypeCrash.ll?rev=44866&r1=44865&r2=44866&view=diff ============================================================================== --- llvm/trunk/test/Assembler/2004-11-28-InvalidTypeCrash.ll (original) +++ llvm/trunk/test/Assembler/2004-11-28-InvalidTypeCrash.ll Tue Dec 11 09:50:23 2007 @@ -1,5 +1,5 @@ ; Test for PR463. This program is erroneous, but should not crash llvm-as. -; RUN: ignore llvm-as < %s -o /dev/null -f |& \ +; RUN: not llvm-as < %s -o /dev/null -f |& \ ; RUN: grep {Cannot create a null initialized value of this type} @.FOO = internal global %struct.none zeroinitializer Modified: llvm/trunk/test/Assembler/2005-01-31-CallingAggregateFunction.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/2005-01-31-CallingAggregateFunction.ll?rev=44866&r1=44865&r2=44866&view=diff ============================================================================== --- llvm/trunk/test/Assembler/2005-01-31-CallingAggregateFunction.ll (original) +++ llvm/trunk/test/Assembler/2005-01-31-CallingAggregateFunction.ll Tue Dec 11 09:50:23 2007 @@ -1,4 +1,4 @@ -; RUN: ignore llvm-as < %s -o /dev/null -f |& \ +; RUN: not llvm-as < %s -o /dev/null -f |& \ ; RUN: grep {LLVM functions cannot return aggregate types} define void @test() { Modified: llvm/trunk/test/CFrontend/2006-09-25-DebugFilename.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CFrontend/2006-09-25-DebugFilename.c?rev=44866&r1=44865&r2=44866&view=diff ============================================================================== --- llvm/trunk/test/CFrontend/2006-09-25-DebugFilename.c (original) +++ llvm/trunk/test/CFrontend/2006-09-25-DebugFilename.c Tue Dec 11 09:50:23 2007 @@ -1,4 +1,4 @@ -// RUN: ignore %llvmgcc -xc %s -S -o /dev/null |& \ +// RUN: not %llvmgcc -xc %s -S -o /dev/null |& \ // RUN: grep fluffy | grep 2006-09-25-DebugFilename.c #include "2006-09-25-DebugFilename.h" int func1() { return hfunc1(); } Modified: llvm/trunk/test/Feature/globalredefinition3.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Feature/globalredefinition3.ll?rev=44866&r1=44865&r2=44866&view=diff ============================================================================== --- llvm/trunk/test/Feature/globalredefinition3.ll (original) +++ llvm/trunk/test/Feature/globalredefinition3.ll Tue Dec 11 09:50:23 2007 @@ -1,4 +1,4 @@ -; RUN: ignore llvm-as < %s -o /dev/null -f |& grep \ +; RUN: not llvm-as < %s -o /dev/null -f |& grep \ ; RUN: "Redefinition of global variable named 'B'" ; END. Modified: llvm/trunk/test/Linker/link-messages.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/link-messages.ll?rev=44866&r1=44865&r2=44866&view=diff ============================================================================== --- llvm/trunk/test/Linker/link-messages.ll (original) +++ llvm/trunk/test/Linker/link-messages.ll Tue Dec 11 09:50:23 2007 @@ -2,7 +2,7 @@ ; that error is printed out. ; RUN: llvm-as %s -o %t.one.bc -f ; RUN: llvm-as %s -o %t.two.bc -f -; RUN: ignore llvm-ld -disable-opt -link-as-library %t.one.bc %t.two.bc \ +; RUN: not llvm-ld -disable-opt -link-as-library %t.one.bc %t.two.bc \ ; RUN: -o %t.bc 2>%t.err ; RUN: grep "Function is already defined" %t.err Modified: llvm/trunk/test/Linker/redefinition.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Linker/redefinition.ll?rev=44866&r1=44865&r2=44866&view=diff ============================================================================== --- llvm/trunk/test/Linker/redefinition.ll (original) +++ llvm/trunk/test/Linker/redefinition.ll Tue Dec 11 09:50:23 2007 @@ -3,8 +3,8 @@ ; RUN: llvm-as %s -o %t.foo1.bc -f ; RUN: llvm-as %s -o %t.foo2.bc -f ; RUN: echo {define void @foo(i32 %x) { ret void }} | llvm-as -o %t.foo3.bc -f -; RUN: ignore llvm-link %t.foo1.bc %t.foo2.bc -o %t.bc |& \ +; RUN: not llvm-link %t.foo1.bc %t.foo2.bc -o %t.bc |& \ ; RUN: grep {Function is already defined} -; RUN: ignore llvm-link %t.foo1.bc %t.foo3.bc -o %t.bc |& \ +; RUN: not llvm-link %t.foo1.bc %t.foo3.bc -o %t.bc |& \ ; RUN: grep {Function 'foo' defined as both} define void @foo() { ret void } Modified: llvm/trunk/test/Verifier/2006-10-15-AddrLabel.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Verifier/2006-10-15-AddrLabel.ll?rev=44866&r1=44865&r2=44866&view=diff ============================================================================== --- llvm/trunk/test/Verifier/2006-10-15-AddrLabel.ll (original) +++ llvm/trunk/test/Verifier/2006-10-15-AddrLabel.ll Tue Dec 11 09:50:23 2007 @@ -1,4 +1,4 @@ -; RUN: ignore llvm-as < %s > /dev/null |& \ +; RUN: not llvm-as < %s > /dev/null |& \ ; RUN: grep {Cannot form a pointer to a basic block} define i32 @main() { From djg at cray.com Tue Dec 11 09:55:52 2007 From: djg at cray.com (Dan Gohman) Date: Tue, 11 Dec 2007 15:55:52 -0000 Subject: [llvm-commits] [llvm] r44867 - in /llvm/trunk/test: C++Frontend/2007-10-01-StructResize.cpp C++Frontend/2007-10-01-StructResize.ll FrontendObjC/2007-10-18-ProDescriptor.ll FrontendObjC/2007-10-18-ProDescriptor.m Message-ID: <200712111555.lBBFtqlf015189@zion.cs.uiuc.edu> Author: djg Date: Tue Dec 11 09:55:52 2007 New Revision: 44867 URL: http://llvm.org/viewvc/llvm-project?rev=44867&view=rev Log: Rename these tests to use the appropriate suffixes. Added: llvm/trunk/test/C++Frontend/2007-10-01-StructResize.cpp - copied unchanged from r44792, llvm/trunk/test/C++Frontend/2007-10-01-StructResize.ll llvm/trunk/test/FrontendObjC/2007-10-18-ProDescriptor.m - copied unchanged from r44792, llvm/trunk/test/FrontendObjC/2007-10-18-ProDescriptor.ll Removed: llvm/trunk/test/C++Frontend/2007-10-01-StructResize.ll llvm/trunk/test/FrontendObjC/2007-10-18-ProDescriptor.ll Removed: llvm/trunk/test/C++Frontend/2007-10-01-StructResize.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/C%2B%2BFrontend/2007-10-01-StructResize.ll?rev=44866&view=auto ============================================================================== --- llvm/trunk/test/C++Frontend/2007-10-01-StructResize.ll (original) +++ llvm/trunk/test/C++Frontend/2007-10-01-StructResize.ll (removed) @@ -1,14 +0,0 @@ -// RUN: %llvmgxx -c %s -o /dev/null - -#pragma pack(4) - -struct Bork { - unsigned int f1 : 3; - unsigned int f2 : 30; -}; - -int Foo(Bork *hdr) { - hdr->f1 = 7; - hdr->f2 = 927; -} - Removed: llvm/trunk/test/FrontendObjC/2007-10-18-ProDescriptor.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendObjC/2007-10-18-ProDescriptor.ll?rev=44866&view=auto ============================================================================== --- llvm/trunk/test/FrontendObjC/2007-10-18-ProDescriptor.ll (original) +++ llvm/trunk/test/FrontendObjC/2007-10-18-ProDescriptor.ll (removed) @@ -1,19 +0,0 @@ -// RUN: %llvmgcc -x objective-c -c %s -o /dev/null - at protocol O - at end - at interface O < O > { -} - at end -struct A { -}; - at protocol AB -- (unsigned) ver; - at end - at interface AGy:O < AB > { -} - at end - at implementation AGy -- (unsigned) ver { -} - at end - From clattner at apple.com Tue Dec 11 11:19:53 2007 From: clattner at apple.com (Chris Lattner) Date: Tue, 11 Dec 2007 09:19:53 -0800 Subject: [llvm-commits] [llvm] r44825 - in /llvm/trunk: include/llvm/Target/TargetData.h lib/Target/TargetData.cpp In-Reply-To: <200712111025.29794.baldrick@free.fr> References: <200712110028.lBB0Sxth016975@zion.cs.uiuc.edu> <1EA97F9B-57BF-4D16-B67B-E10E94F93D5C@apple.com> <200712111025.29794.baldrick@free.fr> Message-ID: On Dec 11, 2007, at 1:25 AM, Duncan Sands wrote: > Hi Chris, > >> Duncan, this patch gets llvm-gcc to build, but it still doesn't >> answer the big question: why does TargetData contain information >> about the host? > > well, it needed to go somewhere. Any suggestions for a better place? > Another possibility is to have a function isWrongEndian in target > data, > which tells you if the target has opposite endianness to the host. How about a static function in ExecutionEngine.cpp that takes a TargetData& ? >> I don't think this is the right approach. Also, you >> can get the host endianness without autoconf by using something >> simple like: >> >> bool islittleendian() { >> union { >> int i; >> char c; >> }; >> >> i = 1; >> return c; >> } > > I have no particular opinion on this (except that it's amazing to me > that there's no standard way to query the compiler for this in C+ > + :) ). Ah, but no "well defined" code should depend on endianness. :) Ah the differences in reality between standards and actual usage. > Presumably the compiler will reduce this function to: return true; > (or false) > at compile time, so there's no cost to your approach. Right. > I suppose that plenty > of things that autoconf does could also be done in a special > function like this, > yet they are left to autoconf - I have no idea what the criteria > are for doing > something via autoconf or via a runtime test. A lot of things can't be done that way, for example finding the path to an external tool, checking to see if your assembler has some feature (e.g. .cfi support), etc. > Having the function inline in a > header would have the advantage that the compiler would eliminate a > bunch of code > in ExecutionEngine at runtime. Since it seems that the autoconf > solution is not > compatible with being exposed in a header, that suggests your > solution is the way > to go. Thanks! -Chris From dalej at apple.com Tue Dec 11 11:37:35 2007 From: dalej at apple.com (Dale Johannesen) Date: Tue, 11 Dec 2007 09:37:35 -0800 Subject: [llvm-commits] [llvm] r44825 - in /llvm/trunk: include/llvm/Target/TargetData.h lib/Target/TargetData.cpp In-Reply-To: References: <200712110028.lBB0Sxth016975@zion.cs.uiuc.edu> <1EA97F9B-57BF-4D16-B67B-E10E94F93D5C@apple.com> <200712111025.29794.baldrick@free.fr> Message-ID: <7BBA62BF-70BB-41A9-802E-37100D366F01@apple.com> On Dec 11, 2007, at 9:19 AM, Chris Lattner wrote: > >> I suppose that plenty >> of things that autoconf does could also be done in a special >> function like this, >> yet they are left to autoconf - I have no idea what the criteria >> are for doing >> something via autoconf or via a runtime test. > > A lot of things can't be done that way, for example finding the path > to an external tool, checking to see if your assembler has some > feature (e.g. .cfi support), etc. gcc's configure script has examples of both of these. Not that I am holding this up as something to imitate. From wmatyjewicz at fastmail.fm Tue Dec 11 11:46:29 2007 From: wmatyjewicz at fastmail.fm (Wojciech Matyjewicz) Date: Tue, 11 Dec 2007 17:46:29 -0000 Subject: [llvm-commits] [llvm] r44868 - /llvm/trunk/include/llvm/ADT/GraphTraits.h Message-ID: <200712111746.lBBHkTXL020353@zion.cs.uiuc.edu> Author: wmat Date: Tue Dec 11 11:46:25 2007 New Revision: 44868 URL: http://llvm.org/viewvc/llvm-project?rev=44868&view=rev Log: Use correct member access operator. (my test commit as well) Modified: llvm/trunk/include/llvm/ADT/GraphTraits.h Modified: llvm/trunk/include/llvm/ADT/GraphTraits.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/GraphTraits.h?rev=44868&r1=44867&r2=44868&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/GraphTraits.h (original) +++ llvm/trunk/include/llvm/ADT/GraphTraits.h Tue Dec 11 11:46:25 2007 @@ -86,7 +86,7 @@ typedef typename GraphTraits::ChildIteratorType ChildIteratorType; static NodeType *getEntryNode(Inverse > *G) { - return GraphTraits::getEntryNode(G.Graph.Graph); + return GraphTraits::getEntryNode(G->Graph.Graph); } static ChildIteratorType child_begin(NodeType* N) { From natebegeman at mac.com Tue Dec 11 12:06:16 2007 From: natebegeman at mac.com (Nate Begeman) Date: Tue, 11 Dec 2007 18:06:16 -0000 Subject: [llvm-commits] [llvm] r44869 - /llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Message-ID: <200712111806.lBBI6Gd0021406@zion.cs.uiuc.edu> Author: sampo Date: Tue Dec 11 12:06:14 2007 New Revision: 44869 URL: http://llvm.org/viewvc/llvm-project?rev=44869&view=rev Log: Allow the JIT to encode MMX instructions Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=44869&r1=44868&r2=44869&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Tue Dec 11 12:06:14 2007 @@ -713,21 +713,21 @@ case X86::ST4: case X86::ST5: case X86::ST6: case X86::ST7: return RegNo-X86::ST0; - case X86::XMM0: case X86::XMM8: + case X86::XMM0: case X86::XMM8: case X86::MM0: return 0; - case X86::XMM1: case X86::XMM9: + case X86::XMM1: case X86::XMM9: case X86::MM1: return 1; - case X86::XMM2: case X86::XMM10: + case X86::XMM2: case X86::XMM10: case X86::MM2: return 2; - case X86::XMM3: case X86::XMM11: + case X86::XMM3: case X86::XMM11: case X86::MM3: return 3; - case X86::XMM4: case X86::XMM12: + case X86::XMM4: case X86::XMM12: case X86::MM4: return 4; - case X86::XMM5: case X86::XMM13: + case X86::XMM5: case X86::XMM13: case X86::MM5: return 5; - case X86::XMM6: case X86::XMM14: + case X86::XMM6: case X86::XMM14: case X86::MM6: return 6; - case X86::XMM7: case X86::XMM15: + case X86::XMM7: case X86::XMM15: case X86::MM7: return 7; default: From asl at math.spbu.ru Tue Dec 11 12:25:04 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 11 Dec 2007 21:25:04 +0300 Subject: [llvm-commits] [llvm] r44851 - /llvm/trunk/include/llvm/ADT/Trie.h In-Reply-To: <475E9487.3070408.SS1576SS@fastmail.fm> References: <200712110653.lBB6ri8c010340@zion.cs.uiuc.edu> <475E9487.3070408.SS1576SS@fastmail.fm> Message-ID: <1197397504.14044.90.camel@asl.dorms.spbu.ru> Hello, Wojciech. > The Parent field seems to be unused internally by the Trie > implementation. Assuming the Edge interface is invisible for Trie > clients, may this field be removed? The whole Edge is not needed actually. See a list of FIXMEs in the beginning :) > I'm not familiar what Trie structure will be used for, but shouldn't > this method be private? Currently, it exposes a way to call most of the > Node's (and indirectly Edge's) methods, which I suppose, should be > inaccessible to clients. This will be needed for GraphTraits stuff. In the future I will want to iterate over nodes. > Do we really want to hit the assert here, and not only return false? Right. It's here just for debugging purposes. I'll clean most of asserts. > > + case Edge::StringIsPrefix: > > Shouldn't the edge be splitted in this case and the payload be attached > to the new node? Current implementation doesn't allow to have two strings in the trie, one being a prefix of another. I will remove this requirement soon. This will beed to introduce splitting here and some more bookkeeping in another place. -- With best regards, Anton Korobeynikov. Faculty of Mathematics & Mechanics, Saint Petersburg State University. From isanbard at gmail.com Tue Dec 11 12:45:11 2007 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 11 Dec 2007 18:45:11 -0000 Subject: [llvm-commits] [llvm] r44871 - /llvm/trunk/lib/CodeGen/MachineLICM.cpp Message-ID: <200712111845.lBBIjBVJ023081@zion.cs.uiuc.edu> Author: void Date: Tue Dec 11 12:45:11 2007 New Revision: 44871 URL: http://llvm.org/viewvc/llvm-project?rev=44871&view=rev Log: Checking for "zero operands" during the "CanHoistInst()" method isn't necessary because those with side effects will be caught by other checks in here. Also, simplify the check for a BB in a sub loop. Modified: llvm/trunk/lib/CodeGen/MachineLICM.cpp Modified: llvm/trunk/lib/CodeGen/MachineLICM.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineLICM.cpp?rev=44871&r1=44870&r2=44871&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineLICM.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineLICM.cpp Tue Dec 11 12:45:11 2007 @@ -99,13 +99,7 @@ /// bool IsInSubLoop(MachineBasicBlock *BB) { assert(CurLoop->contains(BB) && "Only valid if BB is IN the loop"); - - for (MachineLoop::iterator - I = CurLoop->begin(), E = CurLoop->end(); I != E; ++I) - if ((*I)->contains(BB)) - return true; // A subloop actually contains this block! - - return false; + return LI->getLoopFor(BB) != CurLoop; } /// CanHoistInst - Checks that this instructions is one that can be hoisted @@ -115,9 +109,8 @@ bool CanHoistInst(MachineInstr &I) const { const TargetInstrDescriptor *TID = I.getInstrDescriptor(); - // Don't hoist if this instruction implicitly reads physical registers or - // doesn't take any operands. - if (TID->ImplicitUses || !I.getNumOperands()) return false; + // Don't hoist if this instruction implicitly reads physical registers. + if (TID->ImplicitUses) return false; MachineOpCode Opcode = TID->Opcode; return TII->isTriviallyReMaterializable(&I) && @@ -142,7 +135,7 @@ /// FindPredecessors - Get all of the predecessors of the loop that are not /// back-edges. /// - void FindPredecessors(std::vector &Preds){ + void FindPredecessors(std::vector &Preds) { const MachineBasicBlock *Header = CurLoop->getHeader(); for (MachineBasicBlock::const_pred_iterator From isanbard at gmail.com Tue Dec 11 13:17:04 2007 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 11 Dec 2007 19:17:04 -0000 Subject: [llvm-commits] [llvm] r44873 - /llvm/trunk/lib/CodeGen/MachineLICM.cpp Message-ID: <200712111917.lBBJH45F025129@zion.cs.uiuc.edu> Author: void Date: Tue Dec 11 13:17:04 2007 New Revision: 44873 URL: http://llvm.org/viewvc/llvm-project?rev=44873&view=rev Log: - Update the virtual reg to machine instruction map when hoisting. - Fix subtle bug when creating initially creating this map. Modified: llvm/trunk/lib/CodeGen/MachineLICM.cpp Modified: llvm/trunk/lib/CodeGen/MachineLICM.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineLICM.cpp?rev=44873&r1=44872&r2=44873&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineLICM.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineLICM.cpp Tue Dec 11 13:17:04 2007 @@ -215,7 +215,7 @@ const MachineInstr &MI = *II; for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) { - const MachineOperand &MO = MI.getOperand(0); + const MachineOperand &MO = MI.getOperand(i); if (MO.isRegister() && MO.isDef() && MRegisterInfo::isVirtualRegister(MO.getReg())) @@ -317,7 +317,17 @@ "The predecessor doesn't feed directly into the loop header!"); // Now move the instructions to the predecessor. - MoveInstToEndOfBlock(MBB, MI.clone()); + MachineInstr *NewMI = MI.clone(); + MoveInstToEndOfBlock(MBB, NewMI); + + // Update VRegDefs. + for (unsigned i = 0, e = NewMI->getNumOperands(); i != e; ++i) { + const MachineOperand &MO = NewMI->getOperand(i); + + if (MO.isRegister() && MO.isDef() && + MRegisterInfo::isVirtualRegister(MO.getReg())) + VRegDefs[MO.getReg()] = NewMI; + } // Hoisting was successful! Remove bothersome instruction now. MI.getParent()->remove(&MI); From isanbard at gmail.com Tue Dec 11 13:40:06 2007 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 11 Dec 2007 19:40:06 -0000 Subject: [llvm-commits] [llvm] r44874 - /llvm/trunk/lib/CodeGen/MachineLICM.cpp Message-ID: <200712111940.lBBJe6M9026673@zion.cs.uiuc.edu> Author: void Date: Tue Dec 11 13:40:06 2007 New Revision: 44874 URL: http://llvm.org/viewvc/llvm-project?rev=44874&view=rev Log: Blark! How in the world did this work without this?! Modified: llvm/trunk/lib/CodeGen/MachineLICM.cpp Modified: llvm/trunk/lib/CodeGen/MachineLICM.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineLICM.cpp?rev=44874&r1=44873&r2=44874&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineLICM.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineLICM.cpp Tue Dec 11 13:40:06 2007 @@ -43,6 +43,8 @@ namespace { class VISIBILITY_HIDDEN MachineLICM : public MachineFunctionPass { + MachineFunction *CurMF;// Current MachineFunction + // Various analyses that we use... MachineLoopInfo *LI; // Current MachineLoopInfo MachineDominatorTree *DT; // Machine dominator tree for the current Loop @@ -91,7 +93,7 @@ /// MapVirtualRegisterDefs - Create a map of which machine instruction /// defines a virtual register. /// - void MapVirtualRegisterDefs(const MachineFunction &MF); + void MapVirtualRegisterDefs(); /// IsInSubLoop - A little predicate that returns true if the specified /// basic block is in a subloop of the current one, not the current one @@ -182,12 +184,15 @@ if (!PerformLICM) return false; // For debugging. Changed = false; - TII = MF.getTarget().getInstrInfo(); + CurMF = &MF; + TII = CurMF->getTarget().getInstrInfo(); // Get our Loop information... LI = &getAnalysis(); DT = &getAnalysis(); + MapVirtualRegisterDefs(); + for (MachineLoopInfo::iterator I = LI->begin(), E = LI->end(); I != E; ++I) { MachineLoop *L = *I; @@ -205,9 +210,9 @@ /// MapVirtualRegisterDefs - Create a map of which machine instruction defines a /// virtual register. /// -void MachineLICM::MapVirtualRegisterDefs(const MachineFunction &MF) { +void MachineLICM::MapVirtualRegisterDefs() { for (MachineFunction::const_iterator - I = MF.begin(), E = MF.end(); I != E; ++I) { + I = CurMF->begin(), E = CurMF->end(); I != E; ++I) { const MachineBasicBlock &MBB = *I; for (MachineBasicBlock::const_iterator From resistor at mac.com Tue Dec 11 14:12:12 2007 From: resistor at mac.com (Owen Anderson) Date: Tue, 11 Dec 2007 20:12:12 -0000 Subject: [llvm-commits] [llvm] r44877 - /llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Message-ID: <200712112012.lBBKCCLQ029004@zion.cs.uiuc.edu> Author: resistor Date: Tue Dec 11 14:12:11 2007 New Revision: 44877 URL: http://llvm.org/viewvc/llvm-project?rev=44877&view=rev Log: More progress on StrongPHIElimination. Now we actually USE the DomForest! Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=44877&r1=44876&r2=44877&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original) +++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Tue Dec 11 14:12:11 2007 @@ -97,6 +97,9 @@ void processBlock(MachineBasicBlock* MBB); std::vector computeDomForest(std::set& instrs); + void processPHIUnion(MachineInstr* Inst, + std::set& PHIUnion, + std::vector& DF); void breakCriticalEdges(MachineFunction &Fn); }; @@ -303,6 +306,92 @@ } } +void StrongPHIElimination::processPHIUnion(MachineInstr* Inst, + std::set& PHIUnion, + std::vector& DF) { + + std::vector worklist(DF.begin(), DF.end()); + SmallPtrSet visited; + + LiveVariables& LV = getAnalysis(); + unsigned DestReg = Inst->getOperand(0).getReg(); + + while (!worklist.empty()) { + DomForestNode* DFNode = worklist.back(); + + LiveVariables::VarInfo& Info = LV.getVarInfo(DFNode->getReg()); + visited.insert(DFNode); + + bool inserted = false; + SmallPtrSet interferences; + for (DomForestNode::iterator CI = DFNode->begin(), CE = DFNode->end(); + CI != CE; ++CI) { + DomForestNode* child = *CI; + LiveVariables::VarInfo& CInfo = LV.getVarInfo(child->getReg()); + + if (isLiveOut(Info, CInfo.DefInst->getParent())) { + interferences.insert(child); + } else if (isLiveIn(Info, CInfo.DefInst->getParent()) || + Info.DefInst->getParent() == CInfo.DefInst->getParent()) { + // FIXME: Add (p, c) to possible local interferences + } + + if (!visited.count(child)) { + worklist.push_back(child); + inserted = true; + } + } + + if (interferences.size() == 1) { + DomForestNode* child = *interferences.begin(); + + unsigned numParentCopies = 0; + unsigned numChildCopies = 0; + for (int i = Inst->getNumOperands() - 1; i >= 2; i-=2) { + unsigned SrcReg = Inst->getOperand(i-1).getReg(); + if (SrcReg == DFNode->getReg()) numParentCopies++; + else if (SrcReg == child->getReg()) numChildCopies++; + } + + if (numParentCopies < numChildCopies) { + // Insert copies for child + for (int i = Inst->getNumOperands() - 1; i >= 2; i-=2) { + if (Inst->getOperand(i-1).getReg() == child->getReg()) { + unsigned SrcReg = Inst->getOperand(i-1).getReg(); + MachineBasicBlock* From = Inst->getOperand(i).getMBB(); + + Waiting[From].push_back(std::make_pair(SrcReg, DestReg)); + } + } + + // FIXME: Make child's children parent's children + } else { + // Insert copies for parent + for (int i = Inst->getNumOperands() - 1; i >= 2; i-=2) { + if (Inst->getOperand(i-1).getReg() == DFNode->getReg()) { + unsigned SrcReg = Inst->getOperand(i-1).getReg(); + MachineBasicBlock* From = Inst->getOperand(i).getMBB(); + + Waiting[From].push_back(std::make_pair(SrcReg, DestReg)); + } + } + } + } else if (interferences.size() > 1) { + // Insert copies for parent + for (int i = Inst->getNumOperands() - 1; i >= 2; i-=2) { + if (Inst->getOperand(i-1).getReg() == DFNode->getReg()) { + unsigned SrcReg = Inst->getOperand(i-1).getReg(); + MachineBasicBlock* From = Inst->getOperand(i).getMBB(); + + Waiting[From].push_back(std::make_pair(SrcReg, DestReg)); + } + } + } + + if (!inserted) worklist.pop_back(); + } +} + /// breakCriticalEdges - Break critical edges coming into blocks with PHI /// nodes, preserving dominator and livevariable info. void StrongPHIElimination::breakCriticalEdges(MachineFunction &Fn) { From asl at math.spbu.ru Tue Dec 11 15:55:39 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Tue, 11 Dec 2007 21:55:39 -0000 Subject: [llvm-commits] [llvm] r44880 - /llvm/trunk/include/llvm/ADT/Trie.h Message-ID: <200712112155.lBBLtdGD018850@zion.cs.uiuc.edu> Author: asl Date: Tue Dec 11 15:55:38 2007 New Revision: 44880 URL: http://llvm.org/viewvc/llvm-project?rev=44880&view=rev Log: Remove Trie::Edge class. Now edge labels are stored into nodes itself. Modified: llvm/trunk/include/llvm/ADT/Trie.h Modified: llvm/trunk/include/llvm/ADT/Trie.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Trie.h?rev=44880&r1=44879&r2=44880&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/Trie.h (original) +++ llvm/trunk/include/llvm/ADT/Trie.h Tue Dec 11 15:55:38 2007 @@ -24,19 +24,14 @@ // - Labels are usually small, maybe it's better to use SmallString // - Something efficient for child storage // - Should we use char* during construction? +// - Should we templatize Empty with traits-like interface? // - GraphTraits interface -// - Eliminate Edge class, which is ok for debugging, but not for end code template class Trie { - class Edge; - class Node; - - class Edge { - std::string Label; - Node *Parent, *Child; + class Node { + friend class Trie; - public: typedef enum { Same = -3, StringIsPrefix = -2, @@ -45,26 +40,50 @@ HaveCommonPart } QueryResult; - inline explicit Edge(std::string label = "", - Node* parent = NULL, Node* child = NULL): - Label(label), Parent(parent), Child(child) { } - - inline void setParent(Node* parent) { Parent = parent; } - inline Node* getParent() const { return Parent; } - inline void setChild(Node* child) { Child = child; } - inline Node* getChild() const { return Child; } + std::string Label; + Payload Data; + std::map Children; + public: + inline explicit Node(const Payload& data, const std::string& label = ""): + Label(label), Data(data) { } + + inline Node(const Node& n) { + Data = n.Data; + Children = n.Children; + Label = n.Label; + } + inline Node& operator=(const Node& n) { + if (&n != this) { + Data = n.Data; + Children = n.Children; + Label = n.Label; + } + + return *this; + } + + inline bool isLeaf() const { return Children.empty(); } + + inline const Payload& getData() const { return Data; } + inline void setData(const Payload& data) { Data = data; } + inline void setLabel(const std::string& label) { Label = label; } inline const std::string& getLabel() const { return Label; } - QueryResult query(const std::string& string) const { + inline bool addEdge(Node* N) { + const std::string& Label = N->getLabel(); + return Children.insert(std::make_pair(Label[0], N)).second; + } + + QueryResult query(const std::string& s) const { unsigned i, l; - unsigned l1 = string.length(); + unsigned l1 = s.length(); unsigned l2 = Label.length(); // Find the length of common part l = std::min(l1, l2); i = 0; - while ((i < l) && (string[i] == Label[i])) + while ((i < l) && (s[i] == Label[i])) ++i; if (i == l) { // One is prefix of another, find who is who @@ -74,67 +93,36 @@ return StringIsPrefix; else return LabelIsPrefix; - } else // String and Label just have common part, return its length + } else // s and Label have common (possible empty) part, return its length return (QueryResult)i; } }; - class Node { - friend class Trie; - - std::map Edges; - Payload Data; - public: - inline explicit Node(const Payload& data):Data(data) { } - inline Node(const Node& n) { - Data = n.Data; - Edges = n.Edges; - } - inline Node& operator=(const Node& n) { - if (&n != this) { - Data = n.Data; - Edges = n.Edges; - } - - return *this; - } - - inline bool isLeaf() const { return Edges.empty(); } - - inline const Payload& getData() const { return Data; } - inline void setData(const Payload& data) { Data = data; } - - inline Edge* addEdge(const std::string& Label) { - if (!Edges.insert(std::make_pair(Label[0], - Edge(Label, this))).second) { - assert(0 && "Edge already exists!"); - return NULL; - } else - return &Edges[Label[0]]; - } - }; - std::vector Nodes; Payload Empty; - inline Node* addNode(const Payload& data) { - Node* N = new Node(data); + inline Node* addNode(const Payload& data, const std::string label = "") { + Node* N = new Node(data, label); Nodes.push_back(N); return N; } - inline Node* splitEdge(Edge& cEdge, size_t index) { - const std::string& l = cEdge.getLabel(); - assert(index < l.length() && "Trying to split too far!"); + inline Node* splitEdge(Node* N, char Id, size_t index) { + assert(N->Children.count(Id) && "Node doesn't exist"); + + Node* eNode = N->Children[Id]; + const std::string &l = eNode->Label; + assert(index > 0 && index < l.length() && "Trying to split too far!"); std::string l1 = l.substr(0, index); std::string l2 = l.substr(index); - Node* nNode = addNode(Empty); - Edge* nEdge = nNode->addEdge(l2); - nEdge->setChild(cEdge.getChild()); - cEdge.setChild(nNode); - cEdge.setLabel(l1); + eNode->Label = l2; + + Node* nNode = addNode(Empty, l1); + nNode->addEdge(eNode); + + N->Children[Id] = nNode; return nNode; } @@ -152,34 +140,40 @@ bool addString(const std::string& s, const Payload& data) { Node* cNode = getRoot(); - Edge* nEdge = NULL; + Node* tNode = NULL; std::string s1(s); - while (nEdge == NULL) { - if (cNode->Edges.count(s1[0])) { - Edge& cEdge = cNode->Edges[s1[0]]; - typename Edge::QueryResult r = cEdge.query(s1); + while (tNode == NULL) { + char Id = s1[0]; + if (cNode->Children.count(Id)) { + Node* nNode = cNode->Children[Id]; + typename Node::QueryResult r = nNode->query(s1); switch (r) { - case Edge::Same: - case Edge::StringIsPrefix: - case Edge::DontMatch: + case Node::Same: + case Node::StringIsPrefix: + // Currently we don't allow to have two strings in the trie one + // being a prefix of another. This should be fixed. + assert(0 && "FIXME!"); + return false; + case Node::DontMatch: assert(0 && "Impossible!"); return false; - case Edge::LabelIsPrefix: - s1 = s1.substr(cEdge.getLabel().length()); - cNode = cEdge.getChild(); + case Node::LabelIsPrefix: + s1 = s1.substr(nNode->getLabel().length()); + cNode = nNode; break; default: - nEdge = splitEdge(cEdge, r)->addEdge(s1.substr(r)); + nNode = splitEdge(cNode, Id, r); + tNode = addNode(data, s1.substr(r)); + nNode->addEdge(tNode); } - } else - nEdge = cNode->addEdge(s1); + } else { + tNode = addNode(data, s1); + cNode->addEdge(tNode); + } } - Node* tNode = addNode(data); - nEdge->setChild(tNode); - return true; } @@ -189,22 +183,22 @@ std::string s1(s); while (tNode == NULL) { - if (cNode->Edges.count(s1[0])) { - Edge& cEdge = cNode->Edges[s1[0]]; - typename Edge::QueryResult r = cEdge.query(s1); + if (cNode->Children.count(s1[0])) { + Node* nNode = cNode->Children[s1[0]]; + typename Node::QueryResult r = nNode->query(s1); switch (r) { - case Edge::Same: - tNode = cEdge.getChild(); + case Node::Same: + tNode = nNode; break; - case Edge::StringIsPrefix: + case Node::StringIsPrefix: return Empty; - case Edge::DontMatch: + case Node::DontMatch: assert(0 && "Impossible!"); return Empty; - case Edge::LabelIsPrefix: - s1 = s1.substr(cEdge.getLabel().length()); - cNode = cEdge.getChild(); + case Node::LabelIsPrefix: + s1 = s1.substr(nNode->getLabel().length()); + cNode = nNode; break; default: return Empty; From dpatel at apple.com Tue Dec 11 17:17:57 2007 From: dpatel at apple.com (Devang Patel) Date: Tue, 11 Dec 2007 23:17:57 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r44891 - in /llvm-gcc-4.2/trunk/gcc: llvm-backend.cpp testsuite/g++.dg/init/llvm-convert-1.C Message-ID: <200712112317.lBBNHvI7002564@zion.cs.uiuc.edu> Author: dpatel Date: Tue Dec 11 17:17:57 2007 New Revision: 44891 URL: http://llvm.org/viewvc/llvm-project?rev=44891&view=rev Log: Do not emit pending decls twice. This fixes PR1805. Added: llvm-gcc-4.2/trunk/gcc/testsuite/g++.dg/init/llvm-convert-1.C Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=44891&r1=44890&r2=44891&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Tue Dec 11 17:17:57 2007 @@ -897,7 +897,8 @@ } if (TheDebugInfo) TheDebugInfo->EmitGlobalVariable(GV, decl); - + + TREE_ASM_WRITTEN(decl) = 1; timevar_pop(TV_LLVM_GLOBALS); } Added: llvm-gcc-4.2/trunk/gcc/testsuite/g++.dg/init/llvm-convert-1.C URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/g%2B%2B.dg/init/llvm-convert-1.C?rev=44891&view=auto ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/g++.dg/init/llvm-convert-1.C (added) +++ llvm-gcc-4.2/trunk/gcc/testsuite/g++.dg/init/llvm-convert-1.C Tue Dec 11 17:17:57 2007 @@ -0,0 +1,21 @@ +// LLVM LOCAL file +// { dg-do compile } +// { dg-options "" } +// PR 1805 + +int baz(void*); + +int foo() { + static void* bar[] = { &&bb1, &&bb2, &&bb3 }; + switch (baz(bar)) { + case 1: + goto bb1; + case 2: + goto bb2; + default: + goto bb3; + } + bb1: return 1; + bb2: return 2; + bb3: return 3; +} From isanbard at gmail.com Tue Dec 11 17:27:51 2007 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 11 Dec 2007 23:27:51 -0000 Subject: [llvm-commits] [llvm] r44892 - /llvm/trunk/lib/CodeGen/MachineLICM.cpp Message-ID: <200712112327.lBBNRpMQ003449@zion.cs.uiuc.edu> Author: void Date: Tue Dec 11 17:27:51 2007 New Revision: 44892 URL: http://llvm.org/viewvc/llvm-project?rev=44892&view=rev Log: Need to grow the indexed map. Added debug statements. Modified: llvm/trunk/lib/CodeGen/MachineLICM.cpp Modified: llvm/trunk/lib/CodeGen/MachineLICM.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineLICM.cpp?rev=44892&r1=44891&r2=44892&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineLICM.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineLICM.cpp Tue Dec 11 17:27:51 2007 @@ -21,12 +21,12 @@ #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineLoopInfo.h" #include "llvm/CodeGen/Passes.h" -#include "llvm/Target/TargetInstrInfo.h" #include "llvm/Support/CFG.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/Debug.h" #include "llvm/Target/MRegisterInfo.h" +#include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/TargetMachine.h" using namespace llvm; @@ -43,14 +43,13 @@ namespace { class VISIBILITY_HIDDEN MachineLICM : public MachineFunctionPass { - MachineFunction *CurMF;// Current MachineFunction + const TargetInstrInfo *TII; + MachineFunction *CurMF; // Current MachineFunction // Various analyses that we use... MachineLoopInfo *LI; // Current MachineLoopInfo MachineDominatorTree *DT; // Machine dominator tree for the current Loop - const TargetInstrInfo *TII; - // State that is updated as we process loops bool Changed; // True if a loop is changed. MachineLoop *CurLoop; // The current loop we are working on. @@ -109,22 +108,18 @@ /// instr, etc. /// bool CanHoistInst(MachineInstr &I) const { - const TargetInstrDescriptor *TID = I.getInstrDescriptor(); - +#ifndef NDEBUG + DEBUG({ + DOUT << "--- Checking if we can hoist " << I << "\n"; + if (I.getInstrDescriptor()->ImplicitUses) + DOUT << " * Instruction has implicit uses.\n"; + else if (!TII->isTriviallyReMaterializable(&I)) + DOUT << " * Instruction has side effects.\n"; + }); +#endif // Don't hoist if this instruction implicitly reads physical registers. - if (TID->ImplicitUses) return false; - - MachineOpCode Opcode = TID->Opcode; - return TII->isTriviallyReMaterializable(&I) && - // FIXME: Below necessary? - !(TII->isReturn(Opcode) || - TII->isTerminatorInstr(Opcode) || - TII->isBranch(Opcode) || - TII->isIndirectBranch(Opcode) || - TII->isBarrier(Opcode) || - TII->isCall(Opcode) || - TII->isLoad(Opcode) || // TODO: Do loads and stores. - TII->isStore(Opcode)); + if (I.getInstrDescriptor()->ImplicitUses) return false; + return TII->isTriviallyReMaterializable(&I); } /// IsLoopInvariantInst - Returns true if the instruction is loop @@ -150,6 +145,13 @@ /// the predecessor basic block (but before the terminator instructions). /// void MoveInstToEndOfBlock(MachineBasicBlock *MBB, MachineInstr *MI) { + DEBUG({ + DOUT << "Hoisting " << *MI; + if (MBB->getBasicBlock()) + DOUT << " to MachineBasicBlock " + << MBB->getBasicBlock()->getName(); + DOUT << "\n"; + }); MachineBasicBlock::iterator Iter = MBB->getFirstTerminator(); MBB->insert(Iter, MI); ++NumHoisted; @@ -224,8 +226,10 @@ const MachineOperand &MO = MI.getOperand(i); if (MO.isRegister() && MO.isDef() && - MRegisterInfo::isVirtualRegister(MO.getReg())) + MRegisterInfo::isVirtualRegister(MO.getReg())) { + VRegDefs.grow(MO.getReg()); VRegDefs[MO.getReg()] = &MI; + } } } } @@ -331,8 +335,10 @@ const MachineOperand &MO = NewMI->getOperand(i); if (MO.isRegister() && MO.isDef() && - MRegisterInfo::isVirtualRegister(MO.getReg())) + MRegisterInfo::isVirtualRegister(MO.getReg())) { + VRegDefs.grow(MO.getReg()); VRegDefs[MO.getReg()] = NewMI; + } } // Hoisting was successful! Remove bothersome instruction now. From isanbard at gmail.com Tue Dec 11 16:22:25 2007 From: isanbard at gmail.com (Bill Wendling) Date: Tue, 11 Dec 2007 22:22:25 -0000 Subject: [llvm-commits] [llvm] r44881 - /llvm/trunk/lib/CodeGen/MachineLICM.cpp Message-ID: <200712112222.lBBMMRDC022769@zion.cs.uiuc.edu> Author: void Date: Tue Dec 11 16:22:22 2007 New Revision: 44881 URL: http://llvm.org/viewvc/llvm-project?rev=44881&view=rev Log: Simplify slightly. Modified: llvm/trunk/lib/CodeGen/MachineLICM.cpp Modified: llvm/trunk/lib/CodeGen/MachineLICM.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineLICM.cpp?rev=44881&r1=44880&r2=44881&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineLICM.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineLICM.cpp Tue Dec 11 16:22:22 2007 @@ -183,6 +183,8 @@ bool MachineLICM::runOnMachineFunction(MachineFunction &MF) { if (!PerformLICM) return false; // For debugging. + DOUT << "******** Machine LICM ********\n"; + Changed = false; CurMF = &MF; TII = CurMF->getTarget().getInstrInfo(); @@ -195,13 +197,12 @@ for (MachineLoopInfo::iterator I = LI->begin(), E = LI->end(); I != E; ++I) { - MachineLoop *L = *I; - CurLoop = L; + CurLoop = *I; // Visit all of the instructions of the loop. We want to visit the subloops // first, though, so that we can hoist their invariants first into their // containing loop before we process that loop. - VisitAllLoops(L); + VisitAllLoops(CurLoop); } return Changed; From evan.cheng at apple.com Tue Dec 11 17:36:57 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 11 Dec 2007 23:36:57 -0000 Subject: [llvm-commits] [llvm] r44894 - /llvm/trunk/lib/CodeGen/VirtRegMap.cpp Message-ID: <200712112336.lBBNav7C004165@zion.cs.uiuc.edu> Author: evancheng Date: Tue Dec 11 17:36:57 2007 New Revision: 44894 URL: http://llvm.org/viewvc/llvm-project?rev=44894&view=rev Log: If deleting a reload instruction due to reuse (value is available in register R and reload is targeting R), make sure to invalidate the kill information of the last kill. Modified: llvm/trunk/lib/CodeGen/VirtRegMap.cpp Modified: llvm/trunk/lib/CodeGen/VirtRegMap.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/VirtRegMap.cpp?rev=44894&r1=44893&r2=44894&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/VirtRegMap.cpp (original) +++ llvm/trunk/lib/CodeGen/VirtRegMap.cpp Tue Dec 11 17:36:57 2007 @@ -474,6 +474,17 @@ } } +/// InvalidateKill - A MI that defines the specified register is being deleted, +/// invalidate the register kill information. +static void InvalidateKill(unsigned Reg, BitVector &RegKills, + std::vector &KillOps) { + if (RegKills[Reg]) { + KillOps[Reg]->unsetIsKill(); + KillOps[Reg] = NULL; + RegKills.reset(Reg); + } +} + /// InvalidateRegDef - If the def operand of the specified def MI is now dead /// (since it's spill instruction is removed), mark it isDead. Also checks if /// the def MI has other definition operands that are not dead. Returns it by @@ -537,12 +548,13 @@ // That can't be right. Register is killed but not re-defined and it's // being reused. Let's fix that. KillOps[Reg]->unsetIsKill(); + KillOps[Reg] = NULL; + RegKills.reset(Reg); if (i < TID->numOperands && TID->getOperandConstraint(i, TOI::TIED_TO) == -1) // Unless it's a two-address operand, this is the new kill. MO.setIsKill(); } - if (MO.isKill()) { RegKills.set(Reg); KillOps[Reg] = &MO; @@ -1261,8 +1273,11 @@ NextMII = &MI; --NextMII; // backtrack to the copy. BackTracked = true; - } else + } else { DOUT << "Removing now-noop copy: " << MI; + // Unset last kill since it's being reused. + InvalidateKill(InReg, RegKills, KillOps); + } VRM.RemoveMachineInstrFromMaps(&MI); MBB.erase(&MI); @@ -1298,6 +1313,7 @@ // the value and there isn't an earlier def that has already clobbered the // physreg. if (PhysReg && + !TII->isStoreToStackSlot(&MI, SS) && // Not profitable! DeadStore->findRegisterUseOperandIdx(PhysReg, true) != -1 && MRI->unfoldMemoryOperand(MF, &MI, PhysReg, false, true, NewMIs)) { MBB.insert(MII, NewMIs[0]); From clattner at apple.com Tue Dec 11 17:54:10 2007 From: clattner at apple.com (Chris Lattner) Date: Tue, 11 Dec 2007 15:54:10 -0800 Subject: [llvm-commits] [llvm] r44860 - /llvm/trunk/docs/LangRef.html In-Reply-To: <200712110931.lBB9V14g027958@zion.cs.uiuc.edu> References: <200712110931.lBB9V14g027958@zion.cs.uiuc.edu> Message-ID: On Dec 11, 2007, at 1:31 AM, Christopher Lamb wrote: > Add information on address space qualifiers for pointer types and > global > declarations to the LangRef. Nice! >
      >
      > + at G = constant float 1.0 addrspace(5), section "foo", align 4
      
      Is there a comma after 1.0?
      
      -Chris
      
      
      From clattner at apple.com  Tue Dec 11 18:12:15 2007
      From: clattner at apple.com (Chris Lattner)
      Date: Tue, 11 Dec 2007 16:12:15 -0800
      Subject: [llvm-commits] [llvm] r44858 - in /llvm/trunk:
      	include/llvm/Bitcode/LLVMBitCodes.h
      	include/llvm/DerivedTypes.h include/llvm/GlobalVariable.h
      	include/llvm/Instructions.h lib/AsmParser/LLLexer.cpp
      	lib/AsmParser/llvmAsmParser.y lib/Bitcode/Reader/BitcodeReader.cpp
      	lib/Bitcode/Writer/BitcodeWriter.cpp lib/VMCore/AsmWriter.cpp
      	lib/VMCore/Constants.cpp lib/VMCore/Globals.cpp
      	lib/VMCore/Instructions.cpp lib/VMCore/Type.cpp
      	test/Assembler/2007-12-11-AddressSpaces.ll
      	tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
      In-Reply-To: <200712110859.lBB8x7Sj025775@zion.cs.uiuc.edu>
      References: <200712110859.lBB8x7Sj025775@zion.cs.uiuc.edu>
      Message-ID: <6E1DAB22-449F-4C35-9AF2-E209CE95B361@apple.com>
      
      On Dec 11, 2007, at 12:59 AM, Christopher Lamb wrote:
      > URL: http://llvm.org/viewvc/llvm-project?rev=44858&view=rev
      > Log:
      > Implement address space attribute for LLVM pointer types. Address  
      > spaces are
      > regions of memory that have a target specific relationship, as  
      > described in the
      > Embedded C Technical Report.
      
      Woohoo!    Minor stuff:
      
      > +++ llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h Tue Dec 11  
      > 02:59:05 2007
      > @@ -194,9 +194,13 @@
      >      FUNC_CODE_INST_FREE        = 18, // FREE:       [opty, op]
      >      FUNC_CODE_INST_ALLOCA      = 19, // ALLOCA:     [instty, op,  
      > align]
      >      FUNC_CODE_INST_LOAD        = 20, // LOAD:       [opty, op,  
      > align, vol]
      > -    FUNC_CODE_INST_STORE       = 21, // STORE:       
      > [ptrty,val,ptr, align, vol]
      > +    FUNC_CODE_INST_STORE       = 21, // STORE:       
      > [valty,val,ptr, align, vol]
      >      FUNC_CODE_INST_CALL        = 22, // CALL:       [attr, fnty,  
      > fnid, args...]
      > -    FUNC_CODE_INST_VAARG       = 23  // VAARG:      [valistty,  
      > valist, instty]
      > +    FUNC_CODE_INST_VAARG       = 23, // VAARG:      [valistty,  
      > valist, instty]
      > +    // This store code encodes the pointer type, rather than the  
      > value type
      > +    // this is so information only available in the pointer type  
      > (e.g. address
      > +    // spaces) is retained.
      
      Please add a "FIXME: Remove this in LLVM 3.0" to FUNC_CODE_INST_STORE.
      
      > +++ llvm/trunk/include/llvm/DerivedTypes.h Tue Dec 11 02:59:05 2007
      > @@ -363,12 +363,17 @@
      >  ///
      >  class PointerType : public SequentialType {
      >    friend class TypeMap;
      > +  unsigned AddressSpace;
      > +
      >    PointerType(const PointerType &);                   // Do not  
      > implement
      >    const PointerType &operator=(const PointerType &);  // Do not  
      > implement
      > -  explicit PointerType(const Type *ElType);
      > +  explicit PointerType(const Type *ElType, unsigned AddrSpace);
      >  public:
      >    /// PointerType::get - This is the only way to construct a new  
      > pointer type.
      > -  static PointerType *get(const Type *ElementType);
      > +  static PointerType *get(const Type *ElementType, unsigned  
      > AddressSpace = 0);
      
      Making the address space default to zero is convenient, but  
      dangerous.  This means that xforms that play with pointers need to be  
      very careful to propagate this info in some cases.  Do you think this  
      is the best way to go?  Do many clients of PointerType::get need to  
      be aware of addr spaces?
      
      > ====================================================================== 
      > ========
      > --- llvm/trunk/lib/AsmParser/llvmAsmParser.y (original)
      > +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y Tue Dec 11 02:59:05 2007
      > @@ -1320,6 +1323,13 @@
      >      delete $1;
      >      CHECK_FOR_ERROR
      >    }
      > +  | Types ADDRSPACE '(' EUINT64VAL ')' '*' {             //  
      > Pointer type?
      > +    if (*$1 == Type::LabelTy)
      > +      GEN_ERROR("Cannot form a pointer to a basic block");
      > +    $$ = new PATypeHolder(HandleUpRefs(PointerType::get(*$1, $4)));
      > +    delete $1;
      > +    CHECK_FOR_ERROR
      > +  }
      
      It would probably be better to factor this as an new production:
      
      OptAddrSpace ::= ADDRSPACE '(' EUINT64VAL ')' { $$=$3; }
      OptAddrSpace ::= /*empty*/ { $$ = 0; }
      
      Which thing allows you to change the current pointer production to:
      
         | Types OptAddrSpace '*' {                             // Pointer  
      type?
           if (*$1 == Type::LabelTy)
             GEN_ERROR("Cannot form a pointer to a basic block");
           $$ = new PATypeHolder(HandleUpRefs(PointerType::get(*$1, $2)));
           delete $1;
           CHECK_FOR_ERROR
      
      This becomes useful later when:
      
      > @@ -2073,6 +2083,17 @@
      >    } GlobalVarAttributes {
      >      CurGV = 0;
      >    }
      > +  | OptGlobalAssign GVVisibilityStyle ThreadLocal GlobalType ConstVal
      > +    ADDRSPACE '(' EUINT64VAL ')' {
      > +    /* "Externally Visible" Linkage with address space qualifier */
      > +    if ($5 == 0)
      > +      GEN_ERROR("Global value initializer is not a constant");
      > +    CurGV = ParseGlobalVariable($1, GlobalValue::ExternalLinkage,
      > +                                $2, $4, $5->getType(), $5, $3, $8);
      > +    CHECK_FOR_ERROR
      > +  } GlobalVarAttributes {
      > +    CurGV = 0;
      > +  }
      
      It would be nice to use the above stuff to avoid duplicating this  
      production.  Maybe it would need to be:
      
      OptCommaAddrSpace ::= ',' ADDRSPACE '(' EUINT64VAL ')' { $$=$4; }
      OptCommaAddrSpace ::= /*empty*/ { $$ = 0; }
      
      And then just add OptCommaAddrSpace to the existing production.  What  
      do you think?
      
      Also, should it be possible to place a function in an address space?   
      Does the embedded C spec allow this?
      
      
      > ====================================================================== 
      > ========
      > --- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
      > +++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Tue Dec 11  
      > 02:59:05 2007
      > @@ -197,10 +197,14 @@
      >        TypeVals.push_back(cast(T)->getBitWidth());
      >        break;
      >      case Type::PointerTyID:
      > +      const PointerType *PTy = cast(T);
      > +      // POINTER: [pointee type] or [pointee type, address space]
      >        Code = bitc::TYPE_CODE_POINTER;
      > +      TypeVals.push_back(VE.getTypeID(PTy->getElementType()));
      > +      if (unsigned AddressSpace = PTy->getAddressSpace())
      > +        TypeVals.push_back(AddressSpace);
      > +      else
      > +        AbbrevToUse = PtrAbbrev;
      >        break;
      
      This can be simplified.  In this code, I'd just unconditionally emit it:
      
      >      case Type::PointerTyID:
      > +      const PointerType *PTy = cast(T);
      > +      // POINTER: [pointee type] or [pointee type, address space]
      >        Code = bitc::TYPE_CODE_POINTER;
      > +      TypeVals.push_back(VE.getTypeID(PTy->getElementType()));
      >        TypeVals.push_back(PTy->getAddressSpace());
      >        AbbrevToUse = PtrAbbrev;
      >        break;
      
      And change the abbreviation to match, which would apply only if the  
      addrspace is zero (and thus not encode it at all):
      
         // Abbrev for TYPE_CODE_POINTER.
         BitCodeAbbrev *Abbv = new BitCodeAbbrev();
         Abbv->Add(BitCodeAbbrevOp(bitc::TYPE_CODE_POINTER));
         Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
                                   Log2_32_Ceil(VE.getTypes().size()+1)));
         Abbv->Add(BitCodeAbbrevOp(0));  // Addr space = 0.
         unsigned PtrAbbrev = Stream.EmitAbbrev(Abbv);
      
      The presence of the abbreviation means that any pointers with  
      addrspace 0 will not need per-instance space to represent this.
      
      > Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp
      > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ 
      > AsmWriter.cpp?rev=44858&r1=44857&r2=44858&view=diff
      >
      > ====================================================================== 
      > ========
      > --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
      > +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Tue Dec 11 02:59:05 2007
      > @@ -951,6 +955,9 @@
      >      writeOperand(GV->getInitializer(), false);
      >    }
      >
      > +  if (unsigned AddressSpace = GV->getType()->getAddressSpace())
      > +    Out << " addrspace(" << AddressSpace << ") ";
      
      Comma please.
      
      Overall, very very nice Christopher, thanks for tackling this!
      
      -Chris
      
      
      
      From dberlin at dberlin.org  Tue Dec 11 18:37:07 2007
      From: dberlin at dberlin.org (Daniel Berlin)
      Date: Wed, 12 Dec 2007 00:37:07 -0000
      Subject: [llvm-commits] [llvm] r44895 -
      	/llvm/trunk/lib/Analysis/IPA/Andersens.cpp
      Message-ID: <200712120037.lBC0b7OH012406@zion.cs.uiuc.edu>
      
      Author: dannyb
      Date: Tue Dec 11 18:37:04 2007
      New Revision: 44895
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44895&view=rev
      Log:
      Changes from Curtis Dunham implementing lazy cycle detection algorithm.
      Changes from me implementing different way of representing points-to anything.
      Changes from me that improve slightly on LCD.
      
      Modified:
          llvm/trunk/lib/Analysis/IPA/Andersens.cpp
      
      Modified: llvm/trunk/lib/Analysis/IPA/Andersens.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/Andersens.cpp?rev=44895&r1=44894&r2=44895&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Analysis/IPA/Andersens.cpp (original)
      +++ llvm/trunk/lib/Analysis/IPA/Andersens.cpp Tue Dec 11 18:37:04 2007
      @@ -71,12 +71,20 @@
       #include 
       #include 
       #include 
      +#include 
      +
      +// Determining the actual set of nodes the universal set can consist of is very
      +// expensive because it means propagating around very large sets.  We rely on
      +// other analysis being able to determine which nodes can never be pointed to in
      +// order to disambiguate further than "points-to anything".
      +#define FULL_UNIVERSAL 0
       
       using namespace llvm;
       STATISTIC(NumIters      , "Number of iterations to reach convergence");
       STATISTIC(NumConstraints, "Number of constraints");
       STATISTIC(NumNodes      , "Number of nodes");
       STATISTIC(NumUnified    , "Number of variables unified");
      +STATISTIC(NumErased     , "Number of redundant constraints erased");
       
       namespace {
         const unsigned SelfRep = (unsigned)-1;
      @@ -157,6 +165,24 @@
             }
           };
       
      +    // Information DenseSet requires implemented in order to be able to do
      +    // it's thing
      +    struct PairKeyInfo {
      +      static inline std::pair getEmptyKey() {
      +        return std::make_pair(~0UL, ~0UL);
      +      }
      +      static inline std::pair getTombstoneKey() {
      +        return std::make_pair(~0UL - 1, ~0UL - 1);
      +      }
      +      static unsigned getHashValue(const std::pair &P) {
      +        return P.first ^ P.second;
      +      }
      +      static unsigned isEqual(const std::pair &LHS,
      +                              const std::pair &RHS) {
      +        return LHS == RHS;
      +      }
      +    };
      +    
           struct ConstraintKeyInfo {
             static inline Constraint getEmptyKey() {
               return Constraint(Constraint::Copy, ~0UL, ~0UL, ~0UL);
      @@ -180,11 +206,14 @@
           // artificial Node's that represent the set of pointed-to variables shared
           // for each location equivalent Node.
           struct Node {
      +    private:
      +      static unsigned Counter;
      +
      +    public:
             Value *Val;
             SparseBitVector<> *Edges;
             SparseBitVector<> *PointsTo;
             SparseBitVector<> *OldPointsTo;
      -      bool Changed;
             std::list Constraints;
       
             // Pointer and location equivalence labels
      @@ -212,14 +241,17 @@
             // standard union-find representation with path compression.  NodeRep
             // gives the index into GraphNodes for the representative Node.
             unsigned NodeRep;
      -    public:
      +
      +      // Modification timestamp.  Assigned from Counter.
      +      // Used for work list prioritization.
      +      unsigned Timestamp;
       
             Node(bool direct = true) :
      -        Val(0), Edges(0), PointsTo(0), OldPointsTo(0), Changed(false),
      +        Val(0), Edges(0), PointsTo(0), OldPointsTo(0), 
               PointerEquivLabel(0), LocationEquivLabel(0), PredEdges(0),
               ImplicitPredEdges(0), PointedToBy(0), NumInEdges(0),
               StoredInHash(false), Direct(direct), AddressTaken(false),
      -        NodeRep(SelfRep) { }
      +        NodeRep(SelfRep), Timestamp(0) { }
       
             Node *setValue(Value *V) {
               assert(Val == 0 && "Value already set for this node!");
      @@ -246,6 +278,60 @@
             /// intersects with the points-to set of the specified node on any nodes
             /// except for the specified node to ignore.
             bool intersectsIgnoring(Node *N, unsigned) const;
      +
      +      // Timestamp a node (used for work list prioritization)
      +      void Stamp() {
      +        Timestamp = Counter++;
      +      }
      +
      +      bool isRep() {
      +        return( (int) NodeRep < 0 );
      +      }
      +    };
      +
      +    struct WorkListElement {
      +      Node* node;
      +      unsigned Timestamp;
      +      WorkListElement(Node* n, unsigned t) : node(n), Timestamp(t) {}
      +
      +      // Note that we reverse the sense of the comparison because we
      +      // actually want to give low timestamps the priority over high,
      +      // whereas priority is typically interpreted as a greater value is
      +      // given high priority.
      +      bool operator<(const WorkListElement& that) const {
      +        return( this->Timestamp > that.Timestamp );
      +      }
      +    };
      +
      +    // Priority-queue based work list specialized for Nodes.
      +    class WorkList {
      +      std::priority_queue Q;
      +
      +    public:
      +      void insert(Node* n) {
      +        Q.push( WorkListElement(n, n->Timestamp) );
      +      }
      +
      +      // We automatically discard non-representative nodes and nodes
      +      // that were in the work list twice (we keep a copy of the
      +      // timestamp in the work list so we can detect this situation by
      +      // comparing against the node's current timestamp).
      +      Node* pop() {
      +        while( !Q.empty() ) {
      +          WorkListElement x = Q.top(); Q.pop();
      +          Node* INode = x.node;
      +
      +          if( INode->isRep() &&
      +              INode->Timestamp == x.Timestamp ) {
      +            return(x.node);
      +          }
      +        }
      +        return(0);
      +      }
      +
      +      bool empty() {
      +        return Q.empty();
      +      }
           };
       
           /// GraphNodes - This vector is populated as part of the object
      @@ -290,17 +376,20 @@
           };
           // Stack for Tarjan's
           std::stack SCCStack;
      -    // Topological Index -> Graph node
      -    std::vector Topo2Node;
      -    // Graph Node -> Topological Index;
      -    std::vector Node2Topo;
           // Map from Graph Node to DFS number
           std::vector Node2DFS;
           // Map from Graph Node to Deleted from graph.
           std::vector Node2Deleted;
      -    // Current DFS and RPO numbers
      +    // Same as Node Maps, but implemented as std::map because it is faster to
      +    // clear 
      +    std::map Tarjan2DFS;
      +    std::map Tarjan2Deleted;
      +    // Current DFS number
           unsigned DFSNumber;
      -    unsigned RPONumber;
      +
      +    // Work lists.
      +    WorkList w1, w2;
      +    WorkList *CurrWL, *NextWL; // "current" and "next" work lists
       
           // Offline variable substitution related things
       
      @@ -443,7 +532,8 @@
             return Index;
           }
       
      -    unsigned UniteNodes(unsigned First, unsigned Second);
      +    unsigned UniteNodes(unsigned First, unsigned Second,
      +                        bool UnionByRank = true);
           unsigned FindNode(unsigned Node);
       
           void IdentifyObjects(Module &M);
      @@ -458,7 +548,7 @@
           void HVN();
           void UnitePointerEquivalences();
           void SolveConstraints();
      -    void QueryNode(unsigned Node);
      +    bool QueryNode(unsigned Node);
           void Condense(unsigned Node);
           void HUValNum(unsigned Node);
           void HVNValNum(unsigned Node);
      @@ -503,6 +593,9 @@
         RegisterPass X("anders-aa",
                                   "Andersen's Interprocedural Alias Analysis");
         RegisterAnalysisGroup Y(X);
      +
      +  // Initialize Timestamp Counter (static).
      +  unsigned Andersens::Node::Counter = 0;
       }
       
       ModulePass *llvm::createAndersensPass() { return new Andersens(); }
      @@ -981,9 +1074,15 @@
                                                  UniversalSet));
                 // Memory objects passed into external function calls can have the
                 // universal set point to them.
      +#if FULL_UNIVERSAL
                 Constraints.push_back(Constraint(Constraint::Copy,
                                                  UniversalSet,
                                                  getNode(I)));
      +#else
      +          Constraints.push_back(Constraint(Constraint::Copy,
      +                                           getNode(I),
      +                                           UniversalSet));
      +#endif
               }
       
             // If this is an external varargs function, it can also store pointers
      @@ -1139,9 +1238,17 @@
                                              UniversalSet));
           }
         } else if (F && isa(F->getFunctionType()->getReturnType())) {
      +#if FULL_UNIVERSAL
           Constraints.push_back(Constraint(Constraint::Copy,
                                            UniversalSet,
                                            getNode(CallValue) + CallReturnPos));
      +#else
      +    Constraints.push_back(Constraint(Constraint::Copy,
      +                                      getNode(CallValue) + CallReturnPos,
      +                                      UniversalSet));
      +#endif
      +                          
      +    
         }
       
         CallSite::arg_iterator ArgI = CS.arg_begin(), ArgE = CS.arg_end();
      @@ -1159,9 +1266,15 @@
                                                  UniversalSet));
               }
             } else if (isa((*ArgI)->getType())) {
      +#if FULL_UNIVERSAL
               Constraints.push_back(Constraint(Constraint::Copy,
                                                UniversalSet,
                                                getNode(*ArgI)));
      +#else
      +        Constraints.push_back(Constraint(Constraint::Copy,
      +                                         getNode(*ArgI),
      +                                         UniversalSet));
      +#endif
             }
         } else {
           //Indirect Call
      @@ -1837,7 +1950,9 @@
         if (!GraphNodes[NodeIndex].AddressTaken) {
           if (PEClass2Node[NodeLabel] != -1) {
             // We found an existing node with the same pointer label, so unify them.
      -      return UniteNodes(PEClass2Node[NodeLabel], NodeIndex);
      +      // We specifically request that Union-By-Rank not be used so that
      +      // PEClass2Node[NodeLabel] U= NodeIndex and not the other way around.
      +      return UniteNodes(PEClass2Node[NodeLabel], NodeIndex, false);
           } else {
             PEClass2Node[NodeLabel] = NodeIndex;
             PENLEClass2Node[NodeLabel] = NodeIndex;
      @@ -1952,7 +2067,7 @@
       void Andersens::UnitePointerEquivalences() {
         DOUT << "Uniting remaining pointer equivalences\n";
         for (unsigned i = 0; i < GraphNodes.size(); ++i) {
      -    if (GraphNodes[i].AddressTaken && GraphNodes[i].NodeRep == SelfRep) {
      +    if (GraphNodes[i].AddressTaken && GraphNodes[i].isRep()) {
             unsigned Label = GraphNodes[i].PointerEquivLabel;
       
             if (Label && PENLEClass2Node[Label] != -1)
      @@ -1982,37 +2097,43 @@
         }
       }
       
      -// Perform cycle detection, DFS, and RPO finding.
      -void Andersens::QueryNode(unsigned Node) {
      -  assert(GraphNodes[Node].NodeRep == SelfRep && "Querying a non-rep node");
      +// Perform DFS and cycle detection.
      +bool Andersens::QueryNode(unsigned Node) {
      +  assert(GraphNodes[Node].isRep() && "Querying a non-rep node");
         unsigned OurDFS = ++DFSNumber;
         SparseBitVector<> ToErase;
         SparseBitVector<> NewEdges;
      -  Node2DFS[Node] = OurDFS;
      +  Tarjan2DFS[Node] = OurDFS;
      +
      +  // Changed denotes a change from a recursive call that we will bubble up.
      +  // Merged is set if we actually merge a node ourselves.
      +  bool Changed = false, Merged = false;
       
         for (SparseBitVector<>::iterator bi = GraphNodes[Node].Edges->begin();
              bi != GraphNodes[Node].Edges->end();
              ++bi) {
           unsigned RepNode = FindNode(*bi);
      -    // If we are going to add an edge to repnode, we have no need for the edge
      -    // to e anymore.
      +    // If this edge points to a non-representative node but we are
      +    // already planning to add an edge to its representative, we have no
      +    // need for this edge anymore.
           if (RepNode != *bi && NewEdges.test(RepNode)){
             ToErase.set(*bi);
             continue;
           }
       
           // Continue about our DFS.
      -    if (!Node2Deleted[RepNode]){
      -      if (Node2DFS[RepNode] == 0) {
      -        QueryNode(RepNode);
      -        // May have been changed by query
      +    if (!Tarjan2Deleted[RepNode]){
      +      if (Tarjan2DFS[RepNode] == 0) {
      +        Changed |= QueryNode(RepNode);
      +        // May have been changed by QueryNode
               RepNode = FindNode(RepNode);
             }
      -      if (Node2DFS[RepNode] < Node2DFS[Node])
      -        Node2DFS[Node] = Node2DFS[RepNode];
      +      if (Tarjan2DFS[RepNode] < Tarjan2DFS[Node])
      +        Tarjan2DFS[Node] = Tarjan2DFS[RepNode];
           }
      -    // We may have just discovered that e belongs to a cycle, in which case we
      -    // can also erase it.
      +
      +    // We may have just discovered that this node is part of a cycle, in
      +    // which case we can also erase it.
           if (RepNode != *bi) {
             ToErase.set(*bi);
             NewEdges.set(RepNode);
      @@ -2022,36 +2143,46 @@
         GraphNodes[Node].Edges->intersectWithComplement(ToErase);
         GraphNodes[Node].Edges |= NewEdges;
       
      -  // If this node is a root of a non-trivial SCC, place it on our worklist to be
      -  // processed
      -  if (OurDFS == Node2DFS[Node]) {
      -    bool Changed = false;
      -    while (!SCCStack.empty() && Node2DFS[SCCStack.top()] >= OurDFS) {
      -      Node = UniteNodes(Node, FindNode(SCCStack.top()));
      +  // If this node is a root of a non-trivial SCC, place it on our 
      +  // worklist to be processed.
      +  if (OurDFS == Tarjan2DFS[Node]) {
      +    while (!SCCStack.empty() && Tarjan2DFS[SCCStack.top()] >= OurDFS) {
      +      Node = UniteNodes(Node, SCCStack.top());
       
             SCCStack.pop();
      -      Changed = true;
      +      Merged = true;
           }
      -    Node2Deleted[Node] = true;
      -    RPONumber++;
      +    Tarjan2Deleted[Node] = true;
       
      -    Topo2Node.at(GraphNodes.size() - RPONumber) = Node;
      -    Node2Topo[Node] = GraphNodes.size() - RPONumber;
      -    if (Changed)
      -      GraphNodes[Node].Changed = true;
      +    if (Merged)
      +      NextWL->insert(&GraphNodes[Node]);
         } else {
           SCCStack.push(Node);
         }
      -}
       
      +  return(Changed | Merged);
      +}
       
       /// SolveConstraints - This stage iteratively processes the constraints list
       /// propagating constraints (adding edges to the Nodes in the points-to graph)
       /// until a fixed point is reached.
       ///
      +/// We use a variant of the technique called "Lazy Cycle Detection", which is
      +/// described in "The Ant and the Grasshopper: Fast and Accurate Pointer
      +/// Analysis for Millions of Lines of Code. In Programming Language Design and
      +/// Implementation (PLDI), June 2007."
      +/// The paper describes performing cycle detection one node at a time, which can
      +/// be expensive if there are no cycles, but there are long chains of nodes that
      +/// it heuristically believes are cycles (because it will DFS from each node
      +/// without state from previous nodes).
      +/// Instead, we use the heuristic to build a worklist of nodes to check, then
      +/// cycle detect them all at the same time to do this more cheaply.  This
      +/// catches cycles slightly later than the original technique did, but does it
      +/// make significantly cheaper.
      +
       void Andersens::SolveConstraints() {
      -  bool Changed = true;
      -  unsigned Iteration = 0;
      +  CurrWL = &w1;
      +  NextWL = &w2;
       
         OptimizeConstraints();
       #undef DEBUG_TYPE
      @@ -2069,55 +2200,66 @@
         CreateConstraintGraph();
         UnitePointerEquivalences();
         assert(SCCStack.empty() && "SCC Stack should be empty by now!");
      -  Topo2Node.insert(Topo2Node.begin(), GraphNodes.size(), Unvisited);
      -  Node2Topo.insert(Node2Topo.begin(), GraphNodes.size(), Unvisited);
         Node2DFS.clear();
         Node2Deleted.clear();
         Node2DFS.insert(Node2DFS.begin(), GraphNodes.size(), 0);
         Node2Deleted.insert(Node2Deleted.begin(), GraphNodes.size(), false);
         DFSNumber = 0;
      -  RPONumber = 0;
      -  // Order graph and mark starting nodes as changed.
      +  DenseSet Seen;
      +  DenseSet, PairKeyInfo> EdgesChecked;
      +
      +  // Order graph and add initial nodes to work list.
         for (unsigned i = 0; i < GraphNodes.size(); ++i) {
      -    unsigned N = FindNode(i);
           Node *INode = &GraphNodes[i];
      -    if (Node2DFS[N] == 0) {
      -      QueryNode(N);
      -      // Mark as changed if it's a representation and can contribute to the
      -      // calculation right now.
      -      if (INode->NodeRep == SelfRep && !INode->PointsTo->empty()
      -          && (!INode->Edges->empty() || !INode->Constraints.empty()))
      -        INode->Changed = true;
      -    }
      -  }
      -
      -  do {
      -    Changed = false;
      -    ++NumIters;
      -    DOUT << "Starting iteration #" << Iteration++ << "\n";
      -    // TODO: In the microoptimization category, we could just make Topo2Node
      -    // a fast map and thus only contain the visited nodes.
      -    for (unsigned i = 0; i < GraphNodes.size(); ++i) {
      -      unsigned CurrNodeIndex = Topo2Node[i];
      -      Node *CurrNode;
      -
      -      // We may not revisit all nodes on every iteration
      -      if (CurrNodeIndex == Unvisited)
      -        continue;
      -      CurrNode = &GraphNodes[CurrNodeIndex];
      -      // See if this is a node we need to process on this iteration
      -      if (!CurrNode->Changed || CurrNode->NodeRep != SelfRep)
      -        continue;
      -      CurrNode->Changed = false;
       
      +    // Add to work list if it's a representative and can contribute to the
      +    // calculation right now.
      +    if (INode->isRep() && !INode->PointsTo->empty()
      +        && (!INode->Edges->empty() || !INode->Constraints.empty())) {
      +      INode->Stamp();
      +      CurrWL->insert(INode);
      +    }
      +  }
      +  std::queue TarjanWL;
      +  while( !CurrWL->empty() ) {
      +    DOUT << "Starting iteration #" << ++NumIters << "\n";
      +
      +    Node* CurrNode;
      +    unsigned CurrNodeIndex;
      +
      +    // Actual cycle checking code.  We cycle check all of the lazy cycle
      +    // candidates from the last iteration in one go.
      +    if (!TarjanWL.empty()) {
      +      DFSNumber = 0;
      +      
      +      Tarjan2DFS.clear();
      +      Tarjan2Deleted.clear();
      +      while (!TarjanWL.empty()) {
      +        unsigned int ToTarjan = TarjanWL.front();
      +        TarjanWL.pop();
      +        if (!Tarjan2Deleted[ToTarjan]
      +            && GraphNodes[ToTarjan].isRep()
      +            && Tarjan2DFS[ToTarjan] == 0)
      +          QueryNode(ToTarjan);
      +      }
      +    }
      +    
      +    // Add to work list if it's a representative and can contribute to the
      +    // calculation right now.
      +    while( (CurrNode = CurrWL->pop()) != NULL ) {
      +      CurrNodeIndex = CurrNode - &GraphNodes[0];
      +      CurrNode->Stamp();
      +      
      +          
             // Figure out the changed points to bits
             SparseBitVector<> CurrPointsTo;
             CurrPointsTo.intersectWithComplement(CurrNode->PointsTo,
                                                  CurrNode->OldPointsTo);
      -      if (CurrPointsTo.empty()){
      +      if (CurrPointsTo.empty())
               continue;
      -      }
      +
             *(CurrNode->OldPointsTo) |= CurrPointsTo;
      +      Seen.clear();
       
             /* Now process the constraints for this node.  */
             for (std::list::iterator li = CurrNode->Constraints.begin();
      @@ -2125,7 +2267,16 @@
               li->Src = FindNode(li->Src);
               li->Dest = FindNode(li->Dest);
       
      -        // TODO: We could delete redundant constraints here.
      +        // Delete redundant constraints
      +        if( Seen.count(*li) ) {
      +          std::list::iterator lk = li; li++;
      +
      +          CurrNode->Constraints.erase(lk);
      +          ++NumErased;
      +          continue;
      +        }
      +        Seen.insert(*li);
      +
               // Src and Dest will be the vars we are going to process.
               // This may look a bit ugly, but what it does is allow us to process
               // both store and load constraints with the same code.
      @@ -2173,15 +2324,14 @@
       
                 // Add an edge to the graph, so we can just do regular bitmap ior next
                 // time.  It may also let us notice a cycle.
      -          if (GraphNodes[*Src].Edges->test_and_set(*Dest)) {
      -            if (GraphNodes[*Dest].PointsTo |= *(GraphNodes[*Src].PointsTo)) {
      -              GraphNodes[*Dest].Changed = true;
      -              // If we changed a node we've already processed, we need another
      -              // iteration.
      -              if (Node2Topo[*Dest] <= i)
      -                Changed = true;
      -            }
      -          }
      +#if !FULL_UNIVERSAL
      +          if (*Dest < NumberSpecialNodes)
      +            continue;
      +#endif
      +          if (GraphNodes[*Src].Edges->test_and_set(*Dest))
      +            if (GraphNodes[*Dest].PointsTo |= *(GraphNodes[*Src].PointsTo))
      +              NextWL->insert(&GraphNodes[*Dest]);
      +
               }
               li++;
             }
      @@ -2190,8 +2340,6 @@
       
             // Now all we have left to do is propagate points-to info along the
             // edges, erasing the redundant edges.
      -
      -
             for (SparseBitVector<>::iterator bi = CurrNode->Edges->begin();
                  bi != CurrNode->Edges->end();
                  ++bi) {
      @@ -2199,18 +2347,31 @@
               unsigned DestVar = *bi;
               unsigned Rep = FindNode(DestVar);
       
      -        // If we ended up with this node as our destination, or we've already
      -        // got an edge for the representative, delete the current edge.
      -        if (Rep == CurrNodeIndex ||
      -            (Rep != DestVar && NewEdges.test(Rep))) {
      -          ToErase.set(DestVar);
      -          continue;
      +	// If we ended up with this node as our destination, or we've already
      +	// got an edge for the representative, delete the current edge.
      +	if (Rep == CurrNodeIndex ||
      +	    (Rep != DestVar && NewEdges.test(Rep))) {
      +	    ToErase.set(DestVar);
      +	    continue;
      +	}
      +        
      +	std::pair edge(CurrNodeIndex,Rep);
      +        
      +        // This is where we do lazy cycle detection.
      +        // If this is a cycle candidate (equal points-to sets and this
      +        // particular edge has not been cycle-checked previously), add to the
      +        // list to check for cycles on the next iteration.
      +        if (!EdgesChecked.count(edge) &&
      +            *(GraphNodes[Rep].PointsTo) == *(CurrNode->PointsTo)) {
      +          EdgesChecked.insert(edge);
      +          TarjanWL.push(Rep);
               }
               // Union the points-to sets into the dest
      +#if !FULL_UNIVERSAL
      +        if (Rep >= NumberSpecialNodes)
      +#endif
               if (GraphNodes[Rep].PointsTo |= CurrPointsTo) {
      -          GraphNodes[Rep].Changed = true;
      -          if (Node2Topo[Rep] <= i)
      -            Changed = true;
      +          NextWL->insert(&GraphNodes[Rep]);
               }
               // If this edge's destination was collapsed, rewrite the edge.
               if (Rep != DestVar) {
      @@ -2221,28 +2382,12 @@
             CurrNode->Edges->intersectWithComplement(ToErase);
             CurrNode->Edges |= NewEdges;
           }
      -    if (Changed) {
      -      DFSNumber = RPONumber = 0;
      -      Node2Deleted.clear();
      -      Topo2Node.clear();
      -      Node2Topo.clear();
      -      Node2DFS.clear();
      -      Topo2Node.insert(Topo2Node.begin(), GraphNodes.size(), Unvisited);
      -      Node2Topo.insert(Node2Topo.begin(), GraphNodes.size(), Unvisited);
      -      Node2DFS.insert(Node2DFS.begin(), GraphNodes.size(), 0);
      -      Node2Deleted.insert(Node2Deleted.begin(), GraphNodes.size(), false);
      -      // Rediscover the DFS/Topo ordering, and cycle detect.
      -      for (unsigned j = 0; j < GraphNodes.size(); j++) {
      -        unsigned JRep = FindNode(j);
      -        if (Node2DFS[JRep] == 0)
      -          QueryNode(JRep);
      -      }
      -    }
       
      -  } while (Changed);
      +    // Switch to other work list.
      +    WorkList* t = CurrWL; CurrWL = NextWL; NextWL = t;
      +  }
      +
       
      -  Node2Topo.clear();
      -  Topo2Node.clear();
         Node2DFS.clear();
         Node2Deleted.clear();
         for (unsigned i = 0; i < GraphNodes.size(); ++i) {
      @@ -2258,25 +2403,42 @@
       
       // Unite nodes First and Second, returning the one which is now the
       // representative node.  First and Second are indexes into GraphNodes
      -unsigned Andersens::UniteNodes(unsigned First, unsigned Second) {
      +unsigned Andersens::UniteNodes(unsigned First, unsigned Second,
      +                               bool UnionByRank) {
         assert (First < GraphNodes.size() && Second < GraphNodes.size() &&
                 "Attempting to merge nodes that don't exist");
      -  // TODO: implement union by rank
      +
         Node *FirstNode = &GraphNodes[First];
         Node *SecondNode = &GraphNodes[Second];
       
      -  assert (SecondNode->NodeRep == SelfRep && FirstNode->NodeRep == SelfRep &&
      +  assert (SecondNode->isRep() && FirstNode->isRep() &&
                 "Trying to unite two non-representative nodes!");
         if (First == Second)
           return First;
       
      +  if (UnionByRank) {
      +    int RankFirst  = (int) FirstNode ->NodeRep;
      +    int RankSecond = (int) SecondNode->NodeRep;
      +
      +    // Rank starts at -1 and gets decremented as it increases.
      +    // Translation: higher rank, lower NodeRep value, which is always negative.
      +    if (RankFirst > RankSecond) {
      +      unsigned t = First; First = Second; Second = t;
      +      Node* tp = FirstNode; FirstNode = SecondNode; SecondNode = tp;
      +    } else if (RankFirst == RankSecond) {
      +      FirstNode->NodeRep = (unsigned) (RankFirst - 1);
      +    }
      +  }
      +
         SecondNode->NodeRep = First;
      -  FirstNode->Changed |= SecondNode->Changed;
      +#if !FULL_UNIVERSAL
      +  if (First >= NumberSpecialNodes)
      +#endif
         if (FirstNode->PointsTo && SecondNode->PointsTo)
           FirstNode->PointsTo |= *(SecondNode->PointsTo);
         if (FirstNode->Edges && SecondNode->Edges)
           FirstNode->Edges |= *(SecondNode->Edges);
      -  if (!FirstNode->Constraints.empty() && !SecondNode->Constraints.empty())
      +  if (!SecondNode->Constraints.empty())
           FirstNode->Constraints.splice(FirstNode->Constraints.begin(),
                                         SecondNode->Constraints);
         if (FirstNode->OldPointsTo) {
      @@ -2309,7 +2471,7 @@
         assert (NodeIndex < GraphNodes.size()
                 && "Attempting to find a node that can't exist");
         Node *N = &GraphNodes[NodeIndex];
      -  if (N->NodeRep == SelfRep)
      +  if (N->isRep())
           return NodeIndex;
         else
           return (N->NodeRep = FindNode(N->NodeRep));
      
      
      
      
      From evan.cheng at apple.com  Tue Dec 11 18:51:06 2007
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Wed, 12 Dec 2007 00:51:06 -0000
      Subject: [llvm-commits] [llvm] r44896 -
      	/llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp
      Message-ID: <200712120051.lBC0p6Qn013375@zion.cs.uiuc.edu>
      
      Author: evancheng
      Date: Tue Dec 11 18:51:06 2007
      New Revision: 44896
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44896&view=rev
      Log:
      Bug fix. Only safe to perform extension uses optimization if the source of extension is also defined in the same BB as the extension.
      
      Modified:
          llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp
      
      Modified: llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp?rev=44896&r1=44895&r2=44896&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp (original)
      +++ llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp Tue Dec 11 18:51:06 2007
      @@ -929,6 +929,11 @@
         if (Src->hasOneUse())
           return false;
       
      +  // Only safe to perform the optimization if the source is also defined in
      +  // this block. 
      +  if (DefBB != cast(Src)->getParent())
      +    return false;
      +
         bool DefIsLiveOut = false;
         for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); 
              UI != E; ++UI) {
      
      
      
      
      From gordonhenriksen at mac.com  Tue Dec 11 19:04:30 2007
      From: gordonhenriksen at mac.com (Gordon Henriksen)
      Date: Wed, 12 Dec 2007 01:04:30 -0000
      Subject: [llvm-commits] [llvm] r44899 - in /llvm/trunk:
       bindings/ocaml/llvm/llvm.ml bindings/ocaml/llvm/llvm.mli
       bindings/ocaml/llvm/llvm_ocaml.c include/llvm-c/BitReader.h
       include/llvm-c/Core.h lib/VMCore/Core.cpp test/Bindings/Ocaml/vmcore.ml
      Message-ID: <200712120104.lBC14UbZ014237@zion.cs.uiuc.edu>
      
      Author: gordon
      Date: Tue Dec 11 19:04:30 2007
      New Revision: 44899
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44899&view=rev
      Log:
      Add (very basic) bindings for ModuleProvider.
      
      Modified:
          llvm/trunk/bindings/ocaml/llvm/llvm.ml
          llvm/trunk/bindings/ocaml/llvm/llvm.mli
          llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c
          llvm/trunk/include/llvm-c/BitReader.h
          llvm/trunk/include/llvm-c/Core.h
          llvm/trunk/lib/VMCore/Core.cpp
          llvm/trunk/test/Bindings/Ocaml/vmcore.ml
      
      Modified: llvm/trunk/bindings/ocaml/llvm/llvm.ml
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm.ml?rev=44899&r1=44898&r2=44899&view=diff
      
      ==============================================================================
      --- llvm/trunk/bindings/ocaml/llvm/llvm.ml (original)
      +++ llvm/trunk/bindings/ocaml/llvm/llvm.ml Tue Dec 11 19:04:30 2007
      @@ -14,6 +14,7 @@
       type llvalue
       type llbasicblock
       type llbuilder
      +type llmoduleprovider
       
       type type_kind =
         Void_type
      @@ -427,6 +428,13 @@
                                      llbuilder -> llvalue = "llvm_build_shufflevector"
       
       
      +(*===-- Module providers --------------------------------------------------===*)
      +external create_module_provider : llmodule -> llmoduleprovider
      +                                = "LLVMCreateModuleProviderForExistingModule"
      +external dispose_module_provider : llmoduleprovider -> unit
      +                                 = "llvm_dispose_module_provider"
      +
      +
       (*===-- Non-Externs -------------------------------------------------------===*)
       (* These functions are built using the externals, so must be declared late.   *)
       
      
      Modified: llvm/trunk/bindings/ocaml/llvm/llvm.mli
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm.mli?rev=44899&r1=44898&r2=44899&view=diff
      
      ==============================================================================
      --- llvm/trunk/bindings/ocaml/llvm/llvm.mli (original)
      +++ llvm/trunk/bindings/ocaml/llvm/llvm.mli Tue Dec 11 19:04:30 2007
      @@ -40,6 +40,9 @@
           class. **)
       type llbuilder
       
      +(** Used to provide a module to JIT or interpreter. **)
      +type llmoduleprovider
      +
       (** The kind of an [lltype], the result of [classify_type ty]. See the 
           [llvm::Type::TypeID] enumeration. **)
       type type_kind =
      @@ -1217,3 +1220,17 @@
           See the method [llvm::LLVMBuilder::CreateShuffleVector]. **)
       external build_shufflevector : llvalue -> llvalue -> llvalue -> string ->
                                      llbuilder -> llvalue = "llvm_build_shufflevector"
      +
      +
      +(*===-- Module providers --------------------------------------------------===*)
      +
      +(** [create_module_provider m] encapsulates [m] in a module provider and takes
      +    ownership of the module. See the constructor 
      +    [llvm::ExistingModuleProvider::ExistingModuleProvider]. **)
      +external create_module_provider : llmodule -> llmoduleprovider
      +                                = "LLVMCreateModuleProviderForExistingModule"
      +
      +(** [dispose_module_provider mp] destroys the module provider [mp] as well as
      +    the contained module. **)
      +external dispose_module_provider : llmoduleprovider -> unit
      +                                 = "llvm_dispose_module_provider"
      
      Modified: llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c?rev=44899&r1=44898&r2=44899&view=diff
      
      ==============================================================================
      --- llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c (original)
      +++ llvm/trunk/bindings/ocaml/llvm/llvm_ocaml.c Tue Dec 11 19:04:30 2007
      @@ -1047,3 +1047,11 @@
         return LLVMBuildShuffleVector(Builder_val(B), V1, V2, Mask, String_val(Name));
       }
       
      +
      +/*===-- Module Providers --------------------------------------------------===*/
      +
      +/* llmoduleprovider -> unit */
      +CAMLprim value llvm_dispose_module_provider(LLVMModuleProviderRef MP) {
      +  LLVMDisposeModuleProvider(MP);
      +  return Val_unit;
      +}
      
      Modified: llvm/trunk/include/llvm-c/BitReader.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/BitReader.h?rev=44899&r1=44898&r2=44899&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm-c/BitReader.h (original)
      +++ llvm/trunk/include/llvm-c/BitReader.h Tue Dec 11 19:04:30 2007
      @@ -32,6 +32,13 @@
       int LLVMReadBitcodeFromFile(const char *Path, LLVMModuleRef *OutModule,
                                   char **OutMessage);
       
      +/* Reads a module from the specified path, returning a reference to a lazy
      +   module provider via the OutModule parameter. Returns 0 on success. Optionally
      +   returns a human-readable error message. */ 
      +int LLVMCreateModuleProviderFromFile(const char *Path,
      +                                     LLVMModuleProviderRef *OutMP,
      +                                     char **OutMessage);
      +
       /* Disposes of the message allocated by the bitcode reader, if any. */ 
       void LLVMDisposeBitcodeReaderMessage(char *Message);
       
      
      Modified: llvm/trunk/include/llvm-c/Core.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Core.h?rev=44899&r1=44898&r2=44899&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm-c/Core.h (original)
      +++ llvm/trunk/include/llvm-c/Core.h Tue Dec 11 19:04:30 2007
      @@ -51,6 +51,7 @@
       typedef struct LLVMOpaqueValue *LLVMValueRef;
       typedef struct LLVMOpaqueBasicBlock *LLVMBasicBlockRef;
       typedef struct LLVMOpaqueBuilder *LLVMBuilderRef;
      +typedef struct LLVMOpaqueModuleProvider *LLVMModuleProviderRef;
       
       typedef enum {
         LLVMVoidTypeKind,        /* type with no size */
      @@ -489,10 +490,26 @@
                                           LLVMValueRef V2, LLVMValueRef Mask,
                                           const char *Name);
       
      +/*===-- Module providers --------------------------------------------------===*/
      +
      +/* Encapsulates the module M in a module provider, taking ownership of the
      + * module.
      + * See the constructor llvm::ExistingModuleProvider::ExistingModuleProvider.
      + */
      +LLVMModuleProviderRef
      +LLVMCreateModuleProviderForExistingModule(LLVMModuleRef M);
      +
      +/* Destroys the module provider MP as well as the contained module.
      + * See the destructor llvm::ModuleProvider::~ModuleProvider.
      + */
      +void LLVMDisposeModuleProvider(LLVMModuleProviderRef MP);
      +
       #ifdef __cplusplus
       }
       
       namespace llvm {
      +  class ModuleProvider;
      +  
         /* Opaque module conversions
          */ 
         inline Module *unwrap(LLVMModuleRef M) {
      @@ -587,6 +604,16 @@
         inline LLVMTypeHandleRef wrap(PATypeHolder *B) {
           return reinterpret_cast(B);
         }
      +  
      +  /* Opaque module provider conversions.
      +   */ 
      +  inline ModuleProvider *unwrap(LLVMModuleProviderRef P) {
      +    return reinterpret_cast(P);
      +  }
      +  
      +  inline LLVMModuleProviderRef wrap(ModuleProvider *P) {
      +    return reinterpret_cast(P);
      +  }
       }
       
       #endif /* !defined(__cplusplus) */
      
      Modified: llvm/trunk/lib/VMCore/Core.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Core.cpp?rev=44899&r1=44898&r2=44899&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/VMCore/Core.cpp (original)
      +++ llvm/trunk/lib/VMCore/Core.cpp Tue Dec 11 19:04:30 2007
      @@ -18,6 +18,7 @@
       #include "llvm/DerivedTypes.h"
       #include "llvm/GlobalVariable.h"
       #include "llvm/TypeSymbolTable.h"
      +#include "llvm/ModuleProvider.h"
       #include 
       
       using namespace llvm;
      @@ -1030,3 +1031,16 @@
         return wrap(unwrap(B)->CreateShuffleVector(unwrap(V1), unwrap(V2),
                                                    unwrap(Mask), Name));
       }
      +
      +
      +/*===-- Module providers --------------------------------------------------===*/
      +
      +LLVMModuleProviderRef
      +LLVMCreateModuleProviderForExistingModule(LLVMModuleRef M) {
      +  return wrap(new ExistingModuleProvider(unwrap(M)));
      +}
      +
      +void LLVMDisposeModuleProvider(LLVMModuleProviderRef MP) {
      +  delete unwrap(MP);
      +}
      +
      
      Modified: llvm/trunk/test/Bindings/Ocaml/vmcore.ml
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Bindings/Ocaml/vmcore.ml?rev=44899&r1=44898&r2=44899&view=diff
      
      ==============================================================================
      --- llvm/trunk/test/Bindings/Ocaml/vmcore.ml (original)
      +++ llvm/trunk/test/Bindings/Ocaml/vmcore.ml Tue Dec 11 19:04:30 2007
      @@ -790,6 +790,14 @@
         end
       
       
      +(*===-- Module Provider ---------------------------------------------------===*)
      +
      +let test_module_provider () =
      +  let m = create_module "test" in
      +  let mp = create_module_provider m in
      +  dispose_module_provider mp
      +
      +
       (*===-- Writer ------------------------------------------------------------===*)
       
       let test_writer () =
      @@ -814,5 +822,6 @@
         suite "functions"        test_functions;
         suite "basic blocks"     test_basic_blocks;
         suite "builder"          test_builder;
      +  suite "module provider"  test_module_provider;
         suite "writer"           test_writer;
         exit !exit_status
      
      
      
      
      From resistor at mac.com  Tue Dec 11 19:25:08 2007
      From: resistor at mac.com (Owen Anderson)
      Date: Wed, 12 Dec 2007 01:25:08 -0000
      Subject: [llvm-commits] [llvm] r44902 -
      	/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp
      Message-ID: <200712120125.lBC1P9XM015386@zion.cs.uiuc.edu>
      
      Author: resistor
      Date: Tue Dec 11 19:25:08 2007
      New Revision: 44902
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44902&view=rev
      Log:
      Forgot to remove a register from the PHI-union after I'd determined that it
      interfered with other registers.  Seems like that might be a good thing to do. :-)
      
      Modified:
          llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp
      
      Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=44902&r1=44901&r2=44902&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original)
      +++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Tue Dec 11 19:25:08 2007
      @@ -357,10 +357,11 @@
               // Insert copies for child
               for (int i = Inst->getNumOperands() - 1; i >= 2; i-=2) {
                 if (Inst->getOperand(i-1).getReg() == child->getReg()) {
      -            unsigned SrcReg = Inst->getOperand(i-1).getReg();
      +            unsigned SrcReg = child->getReg();
                   MachineBasicBlock* From = Inst->getOperand(i).getMBB();
                   
                   Waiting[From].push_back(std::make_pair(SrcReg, DestReg));
      +            PHIUnion.erase(SrcReg);
                 }
               }
               
      @@ -369,10 +370,11 @@
               // Insert copies for parent
               for (int i = Inst->getNumOperands() - 1; i >= 2; i-=2) {
                 if (Inst->getOperand(i-1).getReg() == DFNode->getReg()) {
      -            unsigned SrcReg = Inst->getOperand(i-1).getReg();
      +            unsigned SrcReg = DFNode->getReg();
                   MachineBasicBlock* From = Inst->getOperand(i).getMBB();
                   
                   Waiting[From].push_back(std::make_pair(SrcReg, DestReg));
      +            PHIUnion.erase(SrcReg);
                 }
               }
             }
      @@ -380,10 +382,11 @@
             // Insert copies for parent
             for (int i = Inst->getNumOperands() - 1; i >= 2; i-=2) {
               if (Inst->getOperand(i-1).getReg() == DFNode->getReg()) {
      -          unsigned SrcReg = Inst->getOperand(i-1).getReg();
      +          unsigned SrcReg = DFNode->getReg();
                 MachineBasicBlock* From = Inst->getOperand(i).getMBB();
                 
                 Waiting[From].push_back(std::make_pair(SrcReg, DestReg));
      +          PHIUnion.erase(SrcReg);
               }
             }
           }
      
      
      
      
      From isanbard at gmail.com  Tue Dec 11 19:51:59 2007
      From: isanbard at gmail.com (Bill Wendling)
      Date: Wed, 12 Dec 2007 01:51:59 -0000
      Subject: [llvm-commits] [llvm] r44903 -
      	/llvm/trunk/include/llvm/Target/TargetInstrInfo.h
      Message-ID: <200712120151.lBC1pxP9016813@zion.cs.uiuc.edu>
      
      Author: void
      Date: Tue Dec 11 19:51:58 2007
      New Revision: 44903
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44903&view=rev
      Log:
      Bit masks conflicted. Needed to bump them by one.
      
      Modified:
          llvm/trunk/include/llvm/Target/TargetInstrInfo.h
      
      Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetInstrInfo.h?rev=44903&r1=44902&r2=44903&view=diff
      
      ==============================================================================
      --- llvm/trunk/include/llvm/Target/TargetInstrInfo.h (original)
      +++ llvm/trunk/include/llvm/Target/TargetInstrInfo.h Tue Dec 11 19:51:58 2007
      @@ -54,42 +54,42 @@
       // changed into a 3-address instruction if the first two operands cannot be
       // assigned to the same register.  The target must implement the
       // TargetInstrInfo::convertToThreeAddress method for this instruction.
      -const unsigned M_CONVERTIBLE_TO_3_ADDR = 1 << 7;
      +const unsigned M_CONVERTIBLE_TO_3_ADDR = 1 << 8;
       
       // This M_COMMUTABLE - is a 2- or 3-address instruction (of the form X = op Y,
       // Z), which produces the same result if Y and Z are exchanged.
      -const unsigned M_COMMUTABLE            = 1 << 8;
      +const unsigned M_COMMUTABLE            = 1 << 9;
       
       // M_TERMINATOR_FLAG - Is this instruction part of the terminator for a basic
       // block?  Typically this is things like return and branch instructions.
       // Various passes use this to insert code into the bottom of a basic block, but
       // before control flow occurs.
      -const unsigned M_TERMINATOR_FLAG       = 1 << 9;
      +const unsigned M_TERMINATOR_FLAG       = 1 << 10;
       
       // M_USES_CUSTOM_DAG_SCHED_INSERTION - Set if this instruction requires custom
       // insertion support when the DAG scheduler is inserting it into a machine basic
       // block.
      -const unsigned M_USES_CUSTOM_DAG_SCHED_INSERTION = 1 << 10;
      +const unsigned M_USES_CUSTOM_DAG_SCHED_INSERTION = 1 << 11;
       
       // M_VARIABLE_OPS - Set if this instruction can have a variable number of extra
       // operands in addition to the minimum number operands specified.
      -const unsigned M_VARIABLE_OPS = 1 << 11;
      +const unsigned M_VARIABLE_OPS          = 1 << 12;
       
       // M_PREDICABLE - Set if this instruction has a predicate operand that
       // controls execution. It may be set to 'always'.
      -const unsigned M_PREDICABLE = 1 << 12;
      +const unsigned M_PREDICABLE            = 1 << 13;
       
       // M_REMATERIALIZIBLE - Set if this instruction can be trivally re-materialized
       // at any time, e.g. constant generation, load from constant pool.
      -const unsigned M_REMATERIALIZIBLE = 1 << 13;
      +const unsigned M_REMATERIALIZIBLE      = 1 << 14;
       
       // M_NOT_DUPLICABLE - Set if this instruction cannot be safely duplicated.
       // (e.g. instructions with unique labels attached).
      -const unsigned M_NOT_DUPLICABLE = 1 << 14;
      +const unsigned M_NOT_DUPLICABLE        = 1 << 15;
       
       // M_HAS_OPTIONAL_DEF - Set if this instruction has an optional definition, e.g.
       // ARM instructions which can set condition code if 's' bit is set.
      -const unsigned M_HAS_OPTIONAL_DEF = 1 << 15;
      +const unsigned M_HAS_OPTIONAL_DEF      = 1 << 16;
       
       // Machine operand flags
       // M_LOOK_UP_PTR_REG_CLASS - Set if this operand is a pointer value and it
      
      
      
      
      From christopher.lamb at gmail.com  Tue Dec 11 19:56:30 2007
      From: christopher.lamb at gmail.com (Christopher Lamb)
      Date: Tue, 11 Dec 2007 17:56:30 -0800
      Subject: [llvm-commits] [llvm] r44860 - /llvm/trunk/docs/LangRef.html
      In-Reply-To: 
      References: <200712110931.lBB9V14g027958@zion.cs.uiuc.edu>
      	
      Message-ID: <22FE997C-5092-4F08-8823-2337C5B99F42@gmail.com>
      
      
      On Dec 11, 2007, at 3:54 PM, Chris Lattner wrote:
      
      > On Dec 11, 2007, at 1:31 AM, Christopher Lamb wrote:
      >> Add information on address space qualifiers for pointer types and
      >> global
      >> declarations to the LangRef.
      >
      > Nice!
      >
      >>  
      >>
      >> + at G = constant float 1.0 addrspace(5), section "foo", align 4
      >
      > Is there a comma after 1.0?
      
      Nope. It's not treated like other attributes as it affects the type  
      of the GlobalVariable that's created, rather than modifying it after  
      the fact. Ideally I would have liked it to be between the type name  
      and the initializer value, but the current Assembly parser made this  
      very yucky. The other option would be to support the addrspace  
      attribute on types other than pointers in the Assembly syntax, but  
      discard them in all cases except  when declaring a global variable,  
      also yucky.
      
      The key here is that the order of asterisks and addrspace()  
      qualifiers are consistent in the global variable declaration and the  
      type name:
      
      @foo = constant float addrspace(1)* 1.0 addrspace(2)
      
      @foo has a type of
      
      float addrspace(1)* addrspace(2)*
      
      --
      Christopher Lamb
      
      
      
      -------------- next part --------------
      An HTML attachment was scrubbed...
      URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20071211/7e071947/attachment.html 
      
      From christopher.lamb at gmail.com  Tue Dec 11 20:09:17 2007
      From: christopher.lamb at gmail.com (Christopher Lamb)
      Date: Tue, 11 Dec 2007 18:09:17 -0800
      Subject: [llvm-commits] [llvm] r44858 - in /llvm/trunk:
      	include/llvm/Bitcode/LLVMBitCodes.h
      	include/llvm/DerivedTypes.h include/llvm/GlobalVariable.h
      	include/llvm/Instructions.h lib/AsmParser/LLLexer.cpp
      	lib/AsmParser/llvmAsmParser.y lib/Bitcode/Reader/BitcodeReader.cpp
      	lib/Bitcode/Writer/BitcodeWriter.cpp lib/VMCore/AsmWriter.cpp
      	lib/VMCore/Constants.cpp lib/VMCore/Globals.cpp
      	lib/VMCore/Instructions.cpp lib/VMCore/Type.cpp
      	test/Assembler/2007-12-11-AddressSpaces.ll
      	tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
      In-Reply-To: <6E1DAB22-449F-4C35-9AF2-E209CE95B361@apple.com>
      References: <200712110859.lBB8x7Sj025775@zion.cs.uiuc.edu>
      	<6E1DAB22-449F-4C35-9AF2-E209CE95B361@apple.com>
      Message-ID: 
      
      
      On Dec 11, 2007, at 4:12 PM, Chris Lattner wrote:
      
      > On Dec 11, 2007, at 12:59 AM, Christopher Lamb wrote:
      >> URL: http://llvm.org/viewvc/llvm-project?rev=44858&view=rev
      >> Log:
      >> Implement address space attribute for LLVM pointer types. Address
      >> spaces are
      >> regions of memory that have a target specific relationship, as
      >> described in the
      >> Embedded C Technical Report.
      >
      > Woohoo!    Minor stuff:
      >
      >> +++ llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h Tue Dec 11
      >> 02:59:05 2007
      >> @@ -194,9 +194,13 @@
      >>      FUNC_CODE_INST_FREE        = 18, // FREE:       [opty, op]
      >>      FUNC_CODE_INST_ALLOCA      = 19, // ALLOCA:     [instty, op,
      >> align]
      >>      FUNC_CODE_INST_LOAD        = 20, // LOAD:       [opty, op,
      >> align, vol]
      >> -    FUNC_CODE_INST_STORE       = 21, // STORE:
      >> [ptrty,val,ptr, align, vol]
      >> +    FUNC_CODE_INST_STORE       = 21, // STORE:
      >> [valty,val,ptr, align, vol]
      >>      FUNC_CODE_INST_CALL        = 22, // CALL:       [attr, fnty,
      >> fnid, args...]
      >> -    FUNC_CODE_INST_VAARG       = 23  // VAARG:      [valistty,
      >> valist, instty]
      >> +    FUNC_CODE_INST_VAARG       = 23, // VAARG:      [valistty,
      >> valist, instty]
      >> +    // This store code encodes the pointer type, rather than the
      >> value type
      >> +    // this is so information only available in the pointer type
      >> (e.g. address
      >> +    // spaces) is retained.
      >
      > Please add a "FIXME: Remove this in LLVM 3.0" to FUNC_CODE_INST_STORE.
      
      Ok.
      
      >> +++ llvm/trunk/include/llvm/DerivedTypes.h Tue Dec 11 02:59:05 2007
      >> @@ -363,12 +363,17 @@
      >>  ///
      >>  class PointerType : public SequentialType {
      >>    friend class TypeMap;
      >> +  unsigned AddressSpace;
      >> +
      >>    PointerType(const PointerType &);                   // Do not
      >> implement
      >>    const PointerType &operator=(const PointerType &);  // Do not
      >> implement
      >> -  explicit PointerType(const Type *ElType);
      >> +  explicit PointerType(const Type *ElType, unsigned AddrSpace);
      >>  public:
      >>    /// PointerType::get - This is the only way to construct a new
      >> pointer type.
      >> -  static PointerType *get(const Type *ElementType);
      >> +  static PointerType *get(const Type *ElementType, unsigned
      >> AddressSpace = 0);
      >
      > Making the address space default to zero is convenient, but
      > dangerous.  This means that xforms that play with pointers need to be
      > very careful to propagate this info in some cases.
      
      This is true.
      
      > Do you think this  is the best way to go?
      
      As opposed to no default value, forcing clients to propagate this  
      information?
      
      > Do many clients of PointerType::get need to  be aware of addr spaces?
      
      Many do. Unfortunately it seems common to simply pass a value's type  
      around and synthesize a pointer when needed. The addition of address  
      spaces means that this approach is no longer equivalent to passing  
      the pointer type, and I expect there will be fixes needed to once a  
      back end depends on this feature.
      
      >> ===================================================================== 
      >> =
      >> ========
      >> --- llvm/trunk/lib/AsmParser/llvmAsmParser.y (original)
      >> +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y Tue Dec 11 02:59:05 2007
      >> @@ -1320,6 +1323,13 @@
      >>      delete $1;
      >>      CHECK_FOR_ERROR
      >>    }
      >> +  | Types ADDRSPACE '(' EUINT64VAL ')' '*' {             //
      >> Pointer type?
      >> +    if (*$1 == Type::LabelTy)
      >> +      GEN_ERROR("Cannot form a pointer to a basic block");
      >> +    $$ = new PATypeHolder(HandleUpRefs(PointerType::get(*$1, $4)));
      >> +    delete $1;
      >> +    CHECK_FOR_ERROR
      >> +  }
      >
      > It would probably be better to factor this as an new production:
      >
      > OptAddrSpace ::= ADDRSPACE '(' EUINT64VAL ')' { $$=$3; }
      > OptAddrSpace ::= /*empty*/ { $$ = 0; }
      >
      > Which thing allows you to change the current pointer production to:
      >
      >    | Types OptAddrSpace '*' {                             // Pointer
      > type?
      >      if (*$1 == Type::LabelTy)
      >        GEN_ERROR("Cannot form a pointer to a basic block");
      >      $$ = new PATypeHolder(HandleUpRefs(PointerType::get(*$1, $2)));
      >      delete $1;
      >      CHECK_FOR_ERROR
      >
      > This becomes useful later when:
      >
      >> @@ -2073,6 +2083,17 @@
      >>    } GlobalVarAttributes {
      >>      CurGV = 0;
      >>    }
      >> +  | OptGlobalAssign GVVisibilityStyle ThreadLocal GlobalType  
      >> ConstVal
      >> +    ADDRSPACE '(' EUINT64VAL ')' {
      >> +    /* "Externally Visible" Linkage with address space qualifier */
      >> +    if ($5 == 0)
      >> +      GEN_ERROR("Global value initializer is not a constant");
      >> +    CurGV = ParseGlobalVariable($1, GlobalValue::ExternalLinkage,
      >> +                                $2, $4, $5->getType(), $5, $3, $8);
      >> +    CHECK_FOR_ERROR
      >> +  } GlobalVarAttributes {
      >> +    CurGV = 0;
      >> +  }
      >
      > It would be nice to use the above stuff to avoid duplicating this
      > production.  Maybe it would need to be:
      >
      > OptCommaAddrSpace ::= ',' ADDRSPACE '(' EUINT64VAL ')' { $$=$4; }
      > OptCommaAddrSpace ::= /*empty*/ { $$ = 0; }
      >
      > And then just add OptCommaAddrSpace to the existing production.  What
      > do you think?
      
      Avoiding the duplicate production is good, but I'm not sure about the  
      comma. The addrspace() qualifier can not be positionally permuted  
      with other attributes, the comma gives the impression that it can be.
      
      >
      > Also, should it be possible to place a function in an address space?
      > Does the embedded C spec allow this?
      
      I will have to check.
      
      >
      >
      >> ===================================================================== 
      >> =
      >> ========
      >> --- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
      >> +++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Tue Dec 11
      >> 02:59:05 2007
      >> @@ -197,10 +197,14 @@
      >>        TypeVals.push_back(cast(T)->getBitWidth());
      >>        break;
      >>      case Type::PointerTyID:
      >> +      const PointerType *PTy = cast(T);
      >> +      // POINTER: [pointee type] or [pointee type, address space]
      >>        Code = bitc::TYPE_CODE_POINTER;
      >> +      TypeVals.push_back(VE.getTypeID(PTy->getElementType()));
      >> +      if (unsigned AddressSpace = PTy->getAddressSpace())
      >> +        TypeVals.push_back(AddressSpace);
      >> +      else
      >> +        AbbrevToUse = PtrAbbrev;
      >>        break;
      >
      > This can be simplified.  In this code, I'd just unconditionally  
      > emit it:
      >
      >>      case Type::PointerTyID:
      >> +      const PointerType *PTy = cast(T);
      >> +      // POINTER: [pointee type] or [pointee type, address space]
      >>        Code = bitc::TYPE_CODE_POINTER;
      >> +      TypeVals.push_back(VE.getTypeID(PTy->getElementType()));
      >>        TypeVals.push_back(PTy->getAddressSpace());
      >>        AbbrevToUse = PtrAbbrev;
      >>        break;
      >
      > And change the abbreviation to match, which would apply only if the
      > addrspace is zero (and thus not encode it at all):
      >
      >    // Abbrev for TYPE_CODE_POINTER.
      >    BitCodeAbbrev *Abbv = new BitCodeAbbrev();
      >    Abbv->Add(BitCodeAbbrevOp(bitc::TYPE_CODE_POINTER));
      >    Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
      >                              Log2_32_Ceil(VE.getTypes().size()+1)));
      >    Abbv->Add(BitCodeAbbrevOp(0));  // Addr space = 0.
      >    unsigned PtrAbbrev = Stream.EmitAbbrev(Abbv);
      >
      > The presence of the abbreviation means that any pointers with
      > addrspace 0 will not need per-instance space to represent this.
      
      Ok.
      
      >
      >> Modified: llvm/trunk/lib/VMCore/AsmWriter.cpp
      >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/
      >> AsmWriter.cpp?rev=44858&r1=44857&r2=44858&view=diff
      >>
      >> ===================================================================== 
      >> =
      >> ========
      >> --- llvm/trunk/lib/VMCore/AsmWriter.cpp (original)
      >> +++ llvm/trunk/lib/VMCore/AsmWriter.cpp Tue Dec 11 02:59:05 2007
      >> @@ -951,6 +955,9 @@
      >>      writeOperand(GV->getInitializer(), false);
      >>    }
      >>
      >> +  if (unsigned AddressSpace = GV->getType()->getAddressSpace())
      >> +    Out << " addrspace(" << AddressSpace << ") ";
      >
      > Comma please.
      >
      > Overall, very very nice Christopher, thanks for tackling this!
      
      This goes back to the point about the comma. The addrspace()  
      qualifier can not be positionally permuted with other attributes.
      
      --
      Christopher Lamb
      
      
      
      -------------- next part --------------
      An HTML attachment was scrubbed...
      URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20071211/a67339ae/attachment.html 
      
      From scottm at aero.org  Tue Dec 11 20:38:28 2007
      From: scottm at aero.org (Scott Michel)
      Date: Wed, 12 Dec 2007 02:38:28 -0000
      Subject: [llvm-commits] [llvm] r44904 -
      	/llvm/trunk/lib/Target/X86/X86JITInfo.cpp
      Message-ID: <200712120238.lBC2cS41021484@zion.cs.uiuc.edu>
      
      Author: pingbak
      Date: Tue Dec 11 20:38:28 2007
      New Revision: 44904
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44904&view=rev
      Log:
      Correct typo for Linux: s/esp/%rsp/
      
      Modified:
          llvm/trunk/lib/Target/X86/X86JITInfo.cpp
      
      Modified: llvm/trunk/lib/Target/X86/X86JITInfo.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86JITInfo.cpp?rev=44904&r1=44903&r2=44904&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/X86JITInfo.cpp (original)
      +++ llvm/trunk/lib/Target/X86/X86JITInfo.cpp Tue Dec 11 20:38:28 2007
      @@ -116,7 +116,7 @@
           "movaps  (%rsp), %xmm0\n"
           // Restore RSP
           "movq    %rbp, %rsp\n"
      -    CFI(".cfi_def_cfa_register esp\n")
      +    CFI(".cfi_def_cfa_register %rsp\n")
           // Restore all int arg registers
           "subq    $48, %rsp\n"
           CFI(".cfi_adjust_cfa_offset 48\n")
      
      
      
      
      From evan.cheng at apple.com  Tue Dec 11 20:53:42 2007
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Wed, 12 Dec 2007 02:53:42 -0000
      Subject: [llvm-commits] [llvm] r44905 -
      	/llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp
      Message-ID: <200712120253.lBC2rgga022200@zion.cs.uiuc.edu>
      
      Author: evancheng
      Date: Tue Dec 11 20:53:41 2007
      New Revision: 44905
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44905&view=rev
      Log:
      Don't muck with phi nodes; bug fixes.
      
      Modified:
          llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp
      
      Modified: llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp?rev=44905&r1=44904&r2=44905&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp (original)
      +++ llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp Tue Dec 11 20:53:41 2007
      @@ -930,8 +930,8 @@
           return false;
       
         // Only safe to perform the optimization if the source is also defined in
      -  // this block. 
      -  if (DefBB != cast(Src)->getParent())
      +  // this block.
      +  if (!isa(Src) || DefBB != cast(Src)->getParent())
           return false;
       
         bool DefIsLiveOut = false;
      @@ -948,6 +948,15 @@
         if (!DefIsLiveOut)
           return false;
       
      +  // Make sure non of the uses are PHI nodes.
      +  for (Value::use_iterator UI = Src->use_begin(), E = Src->use_end(); 
      +       UI != E; ++UI) {
      +    Instruction *User = cast(*UI);
      +    if (User->getParent() == DefBB) continue;
      +    if (isa(User))
      +      return false;
      +  }
      +
         // InsertedTruncs - Only insert one trunc in each block once.
         DenseMap InsertedTruncs;
       
      
      
      
      
      From sabre at nondot.org  Tue Dec 11 21:56:54 2007
      From: sabre at nondot.org (Chris Lattner)
      Date: Wed, 12 Dec 2007 03:56:54 -0000
      Subject: [llvm-commits] [llvm] r44907 -
      	/llvm/trunk/lib/Analysis/ConstantFolding.cpp
      Message-ID: <200712120356.lBC3usgq028626@zion.cs.uiuc.edu>
      
      Author: lattner
      Date: Tue Dec 11 21:56:54 2007
      New Revision: 44907
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44907&view=rev
      Log:
      Fix a bug in my previous patch, thanks to Jay Foad for
      pointing this out and correcting the patch!
      
      Modified:
          llvm/trunk/lib/Analysis/ConstantFolding.cpp
      
      Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ConstantFolding.cpp?rev=44907&r1=44906&r2=44907&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Analysis/ConstantFolding.cpp (original)
      +++ llvm/trunk/lib/Analysis/ConstantFolding.cpp Tue Dec 11 21:56:54 2007
      @@ -427,10 +427,10 @@
             // there is a truncation or extension that we aren't modeling.
             if ((CE0->getOpcode() == Instruction::IntToPtr &&
                  CE0->getOperand(0)->getType() == IntPtrTy &&
      -           CE0->getOperand(1)->getType() == IntPtrTy) ||
      +           Ops[1]->getOperand(0)->getType() == IntPtrTy) ||
                 (CE0->getOpcode() == Instruction::PtrToInt &&
                  CE0->getType() == IntPtrTy &&
      -           CE0->getOperand(0)->getType() == CE0->getOperand(1)->getType())) {
      +           CE0->getOperand(0)->getType() == Ops[1]->getOperand(0)->getType())) {
               Constant *NewOps[] = { 
                 CE0->getOperand(0), cast(Ops[1])->getOperand(0) 
               };
      
      
      
      
      From clattner at apple.com  Tue Dec 11 22:31:45 2007
      From: clattner at apple.com (Chris Lattner)
      Date: Tue, 11 Dec 2007 20:31:45 -0800
      Subject: [llvm-commits] [llvm] r44905 -
      	/llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp
      In-Reply-To: <200712120253.lBC2rgga022200@zion.cs.uiuc.edu>
      References: <200712120253.lBC2rgga022200@zion.cs.uiuc.edu>
      Message-ID: <14F1E068-72CA-4FC5-B8FF-4412476A13F5@apple.com>
      
      
      On Dec 11, 2007, at 6:53 PM, Evan Cheng wrote:
      
      > Author: evancheng
      > Date: Tue Dec 11 20:53:41 2007
      > New Revision: 44905
      >
      > URL: http://llvm.org/viewvc/llvm-project?rev=44905&view=rev
      > Log:
      > Don't muck with phi nodes; bug fixes.
      
      Hey Evan, testcase please :)
      
      -Chris
      
      >
      > Modified:
      >    llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp
      >
      > Modified: llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp
      > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp?rev=44905&r1=44904&r2=44905&view=diff
      >
      > =
      > =
      > =
      > =
      > =
      > =
      > =
      > =
      > ======================================================================
      > --- llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp (original)
      > +++ llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp Tue Dec 11  
      > 20:53:41 2007
      > @@ -930,8 +930,8 @@
      >     return false;
      >
      >   // Only safe to perform the optimization if the source is also  
      > defined in
      > -  // this block.
      > -  if (DefBB != cast(Src)->getParent())
      > +  // this block.
      > +  if (!isa(Src) || DefBB != cast(Src)- 
      > >getParent())
      >     return false;
      >
      >   bool DefIsLiveOut = false;
      > @@ -948,6 +948,15 @@
      >   if (!DefIsLiveOut)
      >     return false;
      >
      > +  // Make sure non of the uses are PHI nodes.
      > +  for (Value::use_iterator UI = Src->use_begin(), E = Src->use_end();
      > +       UI != E; ++UI) {
      > +    Instruction *User = cast(*UI);
      > +    if (User->getParent() == DefBB) continue;
      > +    if (isa(User))
      > +      return false;
      > +  }
      > +
      >   // InsertedTruncs - Only insert one trunc in each block once.
      >   DenseMap InsertedTruncs;
      >
      >
      >
      > _______________________________________________
      > llvm-commits mailing list
      > llvm-commits at cs.uiuc.edu
      > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
      
      
      
      From clattner at apple.com  Tue Dec 11 22:34:01 2007
      From: clattner at apple.com (Chris Lattner)
      Date: Tue, 11 Dec 2007 20:34:01 -0800
      Subject: [llvm-commits] [llvm] r44860 - /llvm/trunk/docs/LangRef.html
      In-Reply-To: <22FE997C-5092-4F08-8823-2337C5B99F42@gmail.com>
      References: <200712110931.lBB9V14g027958@zion.cs.uiuc.edu>
      	
      	<22FE997C-5092-4F08-8823-2337C5B99F42@gmail.com>
      Message-ID: 
      
      
      On Dec 11, 2007, at 5:56 PM, Christopher Lamb wrote:
      
      >
      > On Dec 11, 2007, at 3:54 PM, Chris Lattner wrote:
      >
      >> On Dec 11, 2007, at 1:31 AM, Christopher Lamb wrote:
      >>> Add information on address space qualifiers for pointer types and
      >>> global
      >>> declarations to the LangRef.
      >>
      >> Nice!
      >>
      >>>  
      >>>
      >>> + at G = constant float 1.0 addrspace(5), section "foo", align 4
      >>
      >> Is there a comma after 1.0?
      >
      > Nope. It's not treated like other attributes as it affects the type  
      > of the GlobalVariable that's created, rather than modifying it after  
      > the fact. Ideally I would have liked it to be between the type name  
      > and the initializer value, but the current Assembly parser made this  
      > very yucky. The other option would be to support the addrspace  
      > attribute on types other than pointers in the Assembly syntax, but  
      > discard them in all cases except  when declaring a global variable,  
      > also yucky.
      >
      > The key here is that the order of asterisks and addrspace()  
      > qualifiers are consistent in the global variable declaration and the  
      > type name:
      >
      > @foo = constant float addrspace(1)* 1.0 addrspace(2)
      >
      > @foo has a type of
      >
      > float addrspace(1)* addrspace(2)*
      
      That is a very strong argument to me, but it seems to argue even more  
      strongly for:
      
      @G = constant float addrspace(5) 1.0, section "foo", align 4
      
      Your example above would then be:
      
      > @foo = constant float addrspace(1)* addrspace(2) 1.0
      
      which has type:
      
      > float addrspace(1)* addrspace(2)*
      
      What do you think?  the downside is that this may cause bison to have  
      issues :)
      
      -Chris
      
      
      From clattner at apple.com  Tue Dec 11 22:36:05 2007
      From: clattner at apple.com (Chris Lattner)
      Date: Tue, 11 Dec 2007 20:36:05 -0800
      Subject: [llvm-commits] [llvm] r44858 - in /llvm/trunk:
      	include/llvm/Bitcode/LLVMBitCodes.h	include/llvm/DerivedTypes.h
      	include/llvm/GlobalVariable.h	include/llvm/Instructions.h
      	lib/AsmParser/LLLexer.cpp	lib/AsmParser/llvmAsmParser.y
      	lib/Bitcode/Reader/BitcodeReader.cpp	lib/Bitcode/Writer/BitcodeWriter.cpp
      	lib/VMCore/AsmWriter.cpp	lib/VMCore/Constants.cpp
      	lib/VMCore/Globals.cpp lib/VMCore/Instructions.cpp
      	lib/VMCore/Type.cpp test/Assembler/2007-12-11-AddressSpaces.ll
      	tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
      In-Reply-To: 
      References: <200712110859.lBB8x7Sj025775@zion.cs.uiuc.edu>
      	<6E1DAB22-449F-4C35-9AF2-E209CE95B361@apple.com>
      	
      Message-ID: 
      
      >> Making the address space default to zero is convenient, but
      >> dangerous.  This means that xforms that play with pointers need to be
      >> very careful to propagate this info in some cases.
      >
      > This is true.
      >
      >> Do you think this  is the best way to go?
      >
      > As opposed to no default value, forcing clients to propagate this  
      > information?
      
      Yep.
      
      >> Do many clients of PointerType::get need to  be aware of addr spaces?
      >
      > Many do. Unfortunately it seems common to simply pass a value's type  
      > around and synthesize a pointer when needed. The addition of address  
      > spaces means that this approach is no longer equivalent to passing  
      > the pointer type, and I expect there will be fixes needed to once a  
      > back end depends on this feature.
      
      I think I'd really rather have people have to provide it so that  
      people cons'ing up pointers have to think about alternate address  
      spaces and that all existing code gets updated.  This makes it much  
      less likely that alternate address spaces are a second class feature  
      that is just too buggy to rely on.
      
      >> It would be nice to use the above stuff to avoid duplicating this
      >> production.  Maybe it would need to be:
      >>
      >> OptCommaAddrSpace ::= ',' ADDRSPACE '(' EUINT64VAL ')' { $$=$4; }
      >> OptCommaAddrSpace ::= /*empty*/ { $$ = 0; }
      >>
      >> And then just add OptCommaAddrSpace to the existing production.  What
      >> do you think?
      >
      > Avoiding the duplicate production is good, but I'm not sure about  
      > the comma. The addrspace() qualifier can not be positionally  
      > permuted with other attributes, the comma gives the impression that  
      > it can be.
      
      Good point, but I don't think lack of comma really makes it clear  
      either...
      
      -Chris
      
      
      
      From christopher.lamb at gmail.com  Tue Dec 11 22:41:37 2007
      From: christopher.lamb at gmail.com (Christopher Lamb)
      Date: Tue, 11 Dec 2007 20:41:37 -0800
      Subject: [llvm-commits] [llvm] r44860 - /llvm/trunk/docs/LangRef.html
      In-Reply-To: 
      References: <200712110931.lBB9V14g027958@zion.cs.uiuc.edu>
      	
      	<22FE997C-5092-4F08-8823-2337C5B99F42@gmail.com>
      	
      Message-ID: <7C2240B7-E23F-4C00-9A5F-0F3AFE00C853@gmail.com>
      
      
      On Dec 11, 2007, at 8:34 PM, Chris Lattner wrote:
      
      >
      > On Dec 11, 2007, at 5:56 PM, Christopher Lamb wrote:
      >
      >>
      >> On Dec 11, 2007, at 3:54 PM, Chris Lattner wrote:
      >>
      >>> On Dec 11, 2007, at 1:31 AM, Christopher Lamb wrote:
      >>>> Add information on address space qualifiers for pointer types and
      >>>> global
      >>>> declarations to the LangRef.
      >>>
      >>> Nice!
      >>>
      >>>>  
      >>>>
      >>>> + at G = constant float 1.0 addrspace(5), section "foo", align 4
      >>>
      >>> Is there a comma after 1.0?
      >>
      >> Nope. It's not treated like other attributes as it affects the type
      >> of the GlobalVariable that's created, rather than modifying it after
      >> the fact. Ideally I would have liked it to be between the type name
      >> and the initializer value, but the current Assembly parser made this
      >> very yucky. The other option would be to support the addrspace
      >> attribute on types other than pointers in the Assembly syntax, but
      >> discard them in all cases except  when declaring a global variable,
      >> also yucky.
      >>
      >> The key here is that the order of asterisks and addrspace()
      >> qualifiers are consistent in the global variable declaration and the
      >> type name:
      >>
      >> @foo = constant float addrspace(1)* 1.0 addrspace(2)
      >>
      >> @foo has a type of
      >>
      >> float addrspace(1)* addrspace(2)*
      >
      > That is a very strong argument to me, but it seems to argue even more
      > strongly for:
      >
      > @G = constant float addrspace(5) 1.0, section "foo", align 4
      >
      > Your example above would then be:
      >
      >> @foo = constant float addrspace(1)* addrspace(2) 1.0
      >
      > which has type:
      >
      >> float addrspace(1)* addrspace(2)*
      >
      > What do you think?  the downside is that this may cause bison to have
      > issues :)
      
      This is ideally what I wanted, but it would mean seriously mucking  
      with bison and changing how all CosntVal's are handled. I can give it  
      a try.
      
      --
      Chris
      
      
      
      
      -------------- next part --------------
      An HTML attachment was scrubbed...
      URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20071211/35bbcc2e/attachment.html 
      
      From christopher.lamb at gmail.com  Tue Dec 11 22:43:58 2007
      From: christopher.lamb at gmail.com (Christopher Lamb)
      Date: Tue, 11 Dec 2007 20:43:58 -0800
      Subject: [llvm-commits] [llvm] r44858 - in /llvm/trunk:
      	include/llvm/Bitcode/LLVMBitCodes.h	include/llvm/DerivedTypes.h
      	include/llvm/GlobalVariable.h	include/llvm/Instructions.h
      	lib/AsmParser/LLLexer.cpp	lib/AsmParser/llvmAsmParser.y
      	lib/Bitcode/Reader/BitcodeReader.cpp	lib/Bitcode/Writer/BitcodeWriter.cpp
      	lib/VMCore/AsmWriter.cpp	lib/VMCore/Constants.cpp
      	lib/VMCore/Globals.cpp lib/VMCore/Instructions.cpp
      	lib/VMCore/Type.cpp test/Assembler/2007-12-11-AddressSpaces.ll
      	tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
      In-Reply-To: 
      References: <200712110859.lBB8x7Sj025775@zion.cs.uiuc.edu>
      	<6E1DAB22-449F-4C35-9AF2-E209CE95B361@apple.com>
      	
      	
      Message-ID: <8E27C513-0286-442D-925C-5D8B8E7C9D4C@gmail.com>
      
      
      On Dec 11, 2007, at 8:36 PM, Chris Lattner wrote:
      
      >>> Making the address space default to zero is convenient, but
      >>> dangerous.  This means that xforms that play with pointers need  
      >>> to be
      >>> very careful to propagate this info in some cases.
      >>
      >> This is true.
      >>
      >>> Do you think this  is the best way to go?
      >>
      >> As opposed to no default value, forcing clients to propagate this
      >> information?
      >
      > Yep.
      >
      >>> Do many clients of PointerType::get need to  be aware of addr  
      >>> spaces?
      >>
      >> Many do. Unfortunately it seems common to simply pass a value's type
      >> around and synthesize a pointer when needed. The addition of address
      >> spaces means that this approach is no longer equivalent to passing
      >> the pointer type, and I expect there will be fixes needed to once a
      >> back end depends on this feature.
      >
      > I think I'd really rather have people have to provide it so that
      > people cons'ing up pointers have to think about alternate address
      > spaces and that all existing code gets updated.  This makes it much
      > less likely that alternate address spaces are a second class feature
      > that is just too buggy to rely on.
      
      First class it is, sir.
      
      
      >>> It would be nice to use the above stuff to avoid duplicating this
      >>> production.  Maybe it would need to be:
      >>>
      >>> OptCommaAddrSpace ::= ',' ADDRSPACE '(' EUINT64VAL ')' { $$=$4; }
      >>> OptCommaAddrSpace ::= /*empty*/ { $$ = 0; }
      >>>
      >>> And then just add OptCommaAddrSpace to the existing production.   
      >>> What
      >>> do you think?
      >>
      >> Avoiding the duplicate production is good, but I'm not sure about
      >> the comma. The addrspace() qualifier can not be positionally
      >> permuted with other attributes, the comma gives the impression that
      >> it can be.
      >
      > Good point, but I don't think lack of comma really makes it clear
      > either...
      
      I agree. No compromises. I will improve my bison-fu.
      
      --
      Christopher Lamb
      
      
      
      -------------- next part --------------
      An HTML attachment was scrubbed...
      URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20071211/ab8bba50/attachment.html 
      
      From clattner at apple.com  Tue Dec 11 22:50:39 2007
      From: clattner at apple.com (Chris Lattner)
      Date: Tue, 11 Dec 2007 20:50:39 -0800
      Subject: [llvm-commits] [llvm] r44860 - /llvm/trunk/docs/LangRef.html
      In-Reply-To: <7C2240B7-E23F-4C00-9A5F-0F3AFE00C853@gmail.com>
      References: <200712110931.lBB9V14g027958@zion.cs.uiuc.edu>
      	
      	<22FE997C-5092-4F08-8823-2337C5B99F42@gmail.com>
      	
      	<7C2240B7-E23F-4C00-9A5F-0F3AFE00C853@gmail.com>
      Message-ID: 
      
      >> That is a very strong argument to me, but it seems to argue even more
      >> strongly for:
      >>
      >> @G = constant float addrspace(5) 1.0, section "foo", align 4
      >>
      >> Your example above would then be:
      >>
      >>> @foo = constant float addrspace(1)* addrspace(2) 1.0
      >>
      >> which has type:
      >>
      >>> float addrspace(1)* addrspace(2)*
      >>
      >> What do you think?  the downside is that this may cause bison to have
      >> issues :)
      >
      > This is ideally what I wanted, but it would mean seriously mucking  
      > with bison and changing how all CosntVal's are handled. I can give  
      > it a try.
      
      Hrm, I think bison will get extremely grumpy about this.  Quick  
      question, what is the syntax for an external GV with an ASI?
      
      -Chris
      
      
      From zhousheng00 at gmail.com  Tue Dec 11 22:55:43 2007
      From: zhousheng00 at gmail.com (Zhou Sheng)
      Date: Wed, 12 Dec 2007 04:55:43 -0000
      Subject: [llvm-commits] [llvm] r44910 - in /llvm/trunk:
       lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
       test/ExecutionEngine/2007-12-11-APIntExFuncCall.ll
      Message-ID: <200712120455.lBC4tiJF000621@zion.cs.uiuc.edu>
      
      Author: sheng
      Date: Tue Dec 11 22:55:43 2007
      New Revision: 44910
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44910&view=rev
      Log:
      Fixed PR1629.
      Make lli interpreter correctly call external functions sin()/cos(),
      __cxa_guard_acquire() and __cxa_guard_release().
      
      Added:
          llvm/trunk/test/ExecutionEngine/2007-12-11-APIntExFuncCall.ll
      Modified:
          llvm/trunk/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
      
      Modified: llvm/trunk/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp?rev=44910&r1=44909&r2=44910&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp (original)
      +++ llvm/trunk/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp Tue Dec 11 22:55:43 2007
      @@ -29,6 +29,7 @@
       #include 
       #include 
       #include 
      +#include 
       using std::vector;
       
       using namespace llvm;
      @@ -200,6 +201,22 @@
         return GV;
       }
       
      +// double sin(double)
      +GenericValue lle_X_sin(FunctionType *FT, const vector &Args) {
      +  assert(Args.size() == 1);
      +  GenericValue GV;
      +  GV.DoubleVal = sin(Args[0].DoubleVal);
      +  return GV;
      +}
      +
      +// double cos(double)
      +GenericValue lle_X_cos(FunctionType *FT, const vector &Args) {
      +  assert(Args.size() == 1);
      +  GenericValue GV;
      +  GV.DoubleVal = cos(Args[0].DoubleVal);
      +  return GV;
      +}
      +
       // double exp(double)
       GenericValue lle_X_exp(FunctionType *FT, const vector &Args) {
         assert(Args.size() == 1);
      @@ -705,6 +722,24 @@
         return GV;
       }
       
      +// int __cxa_guard_acquire (__guard *g);
      +GenericValue lle_X___cxa_guard_acquire(FunctionType *FT, 
      +                                       const vector &Args) {
      +  assert(Args.size() == 1);
      +  GenericValue GV;
      +  GV.IntVal = APInt(32, __cxxabiv1::__cxa_guard_acquire (
      +                          (__cxxabiv1::__guard*)GVTOP(Args[0])));
      +  return GV;
      +}
      +
      +// void __cxa_guard_release (__guard *g);
      +GenericValue lle_X___cxa_guard_release(FunctionType *FT, 
      +                                       const vector &Args) {
      +  assert(Args.size() == 1);
      +  __cxxabiv1::__cxa_guard_release ((__cxxabiv1::__guard*)GVTOP(Args[0]));
      +  return GenericValue();
      +}
      +
       } // End extern "C"
       
       
      @@ -719,6 +754,8 @@
         FuncNames["lle_X_free"]         = lle_X_free;
         FuncNames["lle_X_atoi"]         = lle_X_atoi;
         FuncNames["lle_X_pow"]          = lle_X_pow;
      +  FuncNames["lle_X_sin"]          = lle_X_sin;
      +  FuncNames["lle_X_cos"]          = lle_X_cos;
         FuncNames["lle_X_exp"]          = lle_X_exp;
         FuncNames["lle_X_log"]          = lle_X_log;
         FuncNames["lle_X_floor"]        = lle_X_floor;
      @@ -759,5 +796,8 @@
         FuncNames["lle_X_ungetc"]       = lle_X_ungetc;
         FuncNames["lle_X_fprintf"]      = lle_X_fprintf;
         FuncNames["lle_X_freopen"]      = lle_X_freopen;
      +
      +  FuncNames["lle_X___cxa_guard_acquire"] = lle_X___cxa_guard_acquire;
      +  FuncNames["lle_X____cxa_guard_release"] = lle_X___cxa_guard_release;
       }
       
      
      Added: llvm/trunk/test/ExecutionEngine/2007-12-11-APIntExFuncCall.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/2007-12-11-APIntExFuncCall.ll?rev=44910&view=auto
      
      ==============================================================================
      --- llvm/trunk/test/ExecutionEngine/2007-12-11-APIntExFuncCall.ll (added)
      +++ llvm/trunk/test/ExecutionEngine/2007-12-11-APIntExFuncCall.ll Tue Dec 11 22:55:43 2007
      @@ -0,0 +1,54 @@
      +; RUN: llvm-as < %s -o - | lli -force-interpreter
      +; PR1629
      +
      +; ModuleID = ''
      +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32"
      +target triple = "i686-pc-linux-gnu"
      +	%struct.X = type { i32 }
      + at _ZGVZ4mainE1a = internal global i64 0, align 8		;  [#uses=3]
      + at _ZZ4mainE1a = internal global %struct.X zeroinitializer		; <%struct.X*> [#uses=1]
      +
      +define i32 @main() nounwind  {
      +entry:
      +	%"alloca point" = bitcast i32 0 to i32		;  [#uses=0]
      +	%tmp2 = call double @sin( double 1.999000e+00 ) nounwind readonly 		;  [#uses=1]
      +	%tmp3 = call double @cos( double 1.990000e+00 ) nounwind readonly 		;  [#uses=1]
      +	%tmp4 = add double %tmp2, %tmp3		;  [#uses=1]
      +	%tmp5 = load i8* bitcast (i64* @_ZGVZ4mainE1a to i8*), align 1		;  [#uses=1]
      +	%tmp6 = icmp eq i8 %tmp5, 0		;  [#uses=1]
      +	%tmp67 = zext i1 %tmp6 to i8		;  [#uses=1]
      +	%toBool = icmp ne i8 %tmp67, 0		;  [#uses=1]
      +	br i1 %toBool, label %cond_true, label %cond_next14
      +
      +cond_true:		; preds = %entry
      +	%tmp8 = call i32 @__cxa_guard_acquire( i64* @_ZGVZ4mainE1a ) nounwind 		;  [#uses=1]
      +	%tmp9 = icmp ne i32 %tmp8, 0		;  [#uses=1]
      +	%tmp910 = zext i1 %tmp9 to i8		;  [#uses=1]
      +	%toBool12 = icmp ne i8 %tmp910, 0		;  [#uses=1]
      +	br i1 %toBool12, label %cond_true13, label %cond_next14
      +
      +cond_true13:		; preds = %cond_true
      +	call void @_ZN1XC1Ei( %struct.X* @_ZZ4mainE1a, i32 0 ) nounwind 
      +	call void @__cxa_guard_release( i64* @_ZGVZ4mainE1a ) nounwind 
      +	br label %cond_next14
      +
      +cond_next14:		; preds = %cond_true13, %cond_true, %entry
      +	%tmp1516 = fptosi double %tmp4 to i32		;  [#uses=1]
      +	ret i32 %tmp1516
      +}
      +
      +define linkonce void @_ZN1XC1Ei(%struct.X* %this, i32 %val) nounwind  {
      +entry:
      +	%"alloca point" = bitcast i32 0 to i32		;  [#uses=0]
      +	%tmp1 = getelementptr %struct.X* %this, i32 0, i32 0		;  [#uses=1]
      +	store i32 %val, i32* %tmp1, align 4
      +	ret void
      +}
      +
      +declare double @sin(double) nounwind readonly 
      +
      +declare double @cos(double) nounwind readonly 
      +
      +declare i32 @__cxa_guard_acquire(i64*) nounwind 
      +
      +declare void @__cxa_guard_release(i64*) nounwind 
      
      
      
      
      From clattner at apple.com  Tue Dec 11 22:57:22 2007
      From: clattner at apple.com (Chris Lattner)
      Date: Tue, 11 Dec 2007 20:57:22 -0800
      Subject: [llvm-commits] [llvm] r44910 - in /llvm/trunk:
      	lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
      	test/ExecutionEngine/2007-12-11-APIntExFuncCall.ll
      In-Reply-To: <200712120455.lBC4tiJF000621@zion.cs.uiuc.edu>
      References: <200712120455.lBC4tiJF000621@zion.cs.uiuc.edu>
      Message-ID: <8A248E7C-BF4E-4DC0-9304-7D8BEA5EAE92@apple.com>
      
      > URL: http://llvm.org/viewvc/llvm-project?rev=44910&view=rev
      > Log:
      > Fixed PR1629.
      > Make lli interpreter correctly call external functions sin()/cos(),
      > __cxa_guard_acquire() and __cxa_guard_release().
      > #include 
      > +#include 
      > using std::vector;
      
      hi Sheng,
      
      What provides this non-standard header?  I don't know for sure, but I  
      bet you just made our win32 friends very unhappy.
      
      -Chris
      
      
      
      From christopher.lamb at gmail.com  Tue Dec 11 23:08:26 2007
      From: christopher.lamb at gmail.com (Christopher Lamb)
      Date: Tue, 11 Dec 2007 21:08:26 -0800
      Subject: [llvm-commits] [llvm] r44860 - /llvm/trunk/docs/LangRef.html
      In-Reply-To: 
      References: <200712110931.lBB9V14g027958@zion.cs.uiuc.edu>
      	
      	<22FE997C-5092-4F08-8823-2337C5B99F42@gmail.com>
      	
      	<7C2240B7-E23F-4C00-9A5F-0F3AFE00C853@gmail.com>
      	
      Message-ID: <37102E7C-DB6C-428B-90FA-353FE4BB7323@gmail.com>
      
      
      On Dec 11, 2007, at 8:50 PM, Chris Lattner wrote:
      
      >>> That is a very strong argument to me, but it seems to argue even  
      >>> more
      >>> strongly for:
      >>>
      >>> @G = constant float addrspace(5) 1.0, section "foo", align 4
      >>>
      >>> Your example above would then be:
      >>>
      >>>> @foo = constant float addrspace(1)* addrspace(2) 1.0
      >>>
      >>> which has type:
      >>>
      >>>> float addrspace(1)* addrspace(2)*
      >>>
      >>> What do you think?  the downside is that this may cause bison to  
      >>> have
      >>> issues :)
      >>
      >> This is ideally what I wanted, but it would mean seriously mucking
      >> with bison and changing how all CosntVal's are handled. I can give
      >> it a try.
      >
      > Hrm, I think bison will get extremely grumpy about this.
      
      I feared.
      
      > Quick  question, what is the syntax for an external GV with an ASI?
      
      
      Sticky wicket, that. It should be:
      
      @foo = external global i32 addrspace(1)
      
      But that's not working right now....
      
      --
      Christopher Lamb
      
      
      
      -------------- next part --------------
      An HTML attachment was scrubbed...
      URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20071211/b4692c42/attachment.html 
      
      From christopher.lamb at gmail.com  Tue Dec 11 23:16:13 2007
      From: christopher.lamb at gmail.com (Christopher Lamb)
      Date: Tue, 11 Dec 2007 21:16:13 -0800
      Subject: [llvm-commits] [llvm] r44858 - in /llvm/trunk:
      	include/llvm/Bitcode/LLVMBitCodes.h
      	include/llvm/DerivedTypes.h include/llvm/GlobalVariable.h
      	include/llvm/Instructions.h lib/AsmParser/LLLexer.cpp
      	lib/AsmParser/llvmAsmParser.y lib/Bitcode/Reader/BitcodeReader.cpp
      	lib/Bitcode/Writer/BitcodeWriter.cpp lib/VMCore/AsmWriter.cpp
      	lib/VMCore/Constants.cpp lib/VMCore/Globals.cpp
      	lib/VMCore/Instructions.cpp lib/VMCore/Type.cpp
      	test/Assembler/2007-12-11-AddressSpaces.ll
      	tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
      In-Reply-To: <6E1DAB22-449F-4C35-9AF2-E209CE95B361@apple.com>
      References: <200712110859.lBB8x7Sj025775@zion.cs.uiuc.edu>
      	<6E1DAB22-449F-4C35-9AF2-E209CE95B361@apple.com>
      Message-ID: <5AEDE4C7-1724-45E4-99E9-A9D6058615A9@gmail.com>
      
      
      On Dec 11, 2007, at 4:12 PM, Chris Lattner wrote:
      
      > On Dec 11, 2007, at 12:59 AM, Christopher Lamb wrote:
      >
      >> ===================================================================== 
      >> =
      >> ========
      >> --- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
      >> +++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Tue Dec 11
      >> 02:59:05 2007
      >> @@ -197,10 +197,14 @@
      >>        TypeVals.push_back(cast(T)->getBitWidth());
      >>        break;
      >>      case Type::PointerTyID:
      >> +      const PointerType *PTy = cast(T);
      >> +      // POINTER: [pointee type] or [pointee type, address space]
      >>        Code = bitc::TYPE_CODE_POINTER;
      >> +      TypeVals.push_back(VE.getTypeID(PTy->getElementType()));
      >> +      if (unsigned AddressSpace = PTy->getAddressSpace())
      >> +        TypeVals.push_back(AddressSpace);
      >> +      else
      >> +        AbbrevToUse = PtrAbbrev;
      >>        break;
      >
      > This can be simplified.  In this code, I'd just unconditionally  
      > emit it:
      >
      >>      case Type::PointerTyID:
      >> +      const PointerType *PTy = cast(T);
      >> +      // POINTER: [pointee type] or [pointee type, address space]
      >>        Code = bitc::TYPE_CODE_POINTER;
      >> +      TypeVals.push_back(VE.getTypeID(PTy->getElementType()));
      >>        TypeVals.push_back(PTy->getAddressSpace());
      >>        AbbrevToUse = PtrAbbrev;
      >>        break;
      >
      > And change the abbreviation to match, which would apply only if the
      > addrspace is zero (and thus not encode it at all):
      >
      >    // Abbrev for TYPE_CODE_POINTER.
      >    BitCodeAbbrev *Abbv = new BitCodeAbbrev();
      >    Abbv->Add(BitCodeAbbrevOp(bitc::TYPE_CODE_POINTER));
      >    Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
      >                              Log2_32_Ceil(VE.getTypes().size()+1)));
      >    Abbv->Add(BitCodeAbbrevOp(0));  // Addr space = 0.
      >    unsigned PtrAbbrev = Stream.EmitAbbrev(Abbv);
      >
      > The presence of the abbreviation means that any pointers with
      > addrspace 0 will not need per-instance space to represent this.
      
      This means moving the assert conditional into the if conditional and  
      removing the assert in BitstreamWriter.h. Sound OK?
      
         void EmitAbbreviatedField(const BitCodeAbbrevOp &Op, uintty V) {
           if (Op.isLiteral()) {
             // If the abbrev specifies the literal value to use, don't emit
             // anything.
             assert(V == Op.getLiteralValue() &&
                    "Invalid abbrev for record!");
             return;
           }
      
      --
      Christopher Lamb
      
      
      
      -------------- next part --------------
      An HTML attachment was scrubbed...
      URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20071211/2f94307a/attachment.html 
      
      From clattner at apple.com  Tue Dec 11 23:16:26 2007
      From: clattner at apple.com (Chris Lattner)
      Date: Tue, 11 Dec 2007 21:16:26 -0800
      Subject: [llvm-commits] [llvm] r44860 - /llvm/trunk/docs/LangRef.html
      In-Reply-To: <37102E7C-DB6C-428B-90FA-353FE4BB7323@gmail.com>
      References: <200712110931.lBB9V14g027958@zion.cs.uiuc.edu>
      	
      	<22FE997C-5092-4F08-8823-2337C5B99F42@gmail.com>
      	
      	<7C2240B7-E23F-4C00-9A5F-0F3AFE00C853@gmail.com>
      	
      	<37102E7C-DB6C-428B-90FA-353FE4BB7323@gmail.com>
      Message-ID: <91A04793-060B-412D-827A-02CBEB16E7FB@apple.com>
      
      
      On Dec 11, 2007, at 9:08 PM, Christopher Lamb wrote:
      
      >
      > On Dec 11, 2007, at 8:50 PM, Chris Lattner wrote:
      >
      >>>> That is a very strong argument to me, but it seems to argue even  
      >>>> more
      >>>> strongly for:
      >>>>
      >>>> @G = constant float addrspace(5) 1.0, section "foo", align 4
      >>>>
      >>>> Your example above would then be:
      >>>>
      >>>>> @foo = constant float addrspace(1)* addrspace(2) 1.0
      >>>>
      >>>> which has type:
      >>>>
      >>>>> float addrspace(1)* addrspace(2)*
      >>>>
      >>>> What do you think?  the downside is that this may cause bison to  
      >>>> have
      >>>> issues :)
      >>>
      >>> This is ideally what I wanted, but it would mean seriously mucking
      >>> with bison and changing how all CosntVal's are handled. I can give
      >>> it a try.
      >>
      >> Hrm, I think bison will get extremely grumpy about this.
      >
      > I feared.
      >
      >> Quick  question, what is the syntax for an external GV with an ASI?
      >
      >
      > Sticky wicket, that. It should be:
      >
      > @foo = external global i32 addrspace(1)
      >
      > But that's not working right now....
      
      Right, because it would require the same parsing logic as the proposal  
      above :).
      
      How horrible would:
      
      > @foo = addrspace(1) external global i32
      
      be?
      
      -Chris
      
      
      From clattner at apple.com  Tue Dec 11 23:30:52 2007
      From: clattner at apple.com (Chris Lattner)
      Date: Tue, 11 Dec 2007 21:30:52 -0800
      Subject: [llvm-commits] [llvm] r44858 - in /llvm/trunk:
      	include/llvm/Bitcode/LLVMBitCodes.h	include/llvm/DerivedTypes.h
      	include/llvm/GlobalVariable.h	include/llvm/Instructions.h
      	lib/AsmParser/LLLexer.cpp	lib/AsmParser/llvmAsmParser.y
      	lib/Bitcode/Reader/BitcodeReader.cpp	lib/Bitcode/Writer/BitcodeWriter.cpp
      	lib/VMCore/AsmWriter.cpp	lib/VMCore/Constants.cpp
      	lib/VMCore/Globals.cpp lib/VMCore/Instructions.cpp
      	lib/VMCore/Type.cpp test/Assembler/2007-12-11-AddressSpaces.ll
      	tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
      In-Reply-To: <5AEDE4C7-1724-45E4-99E9-A9D6058615A9@gmail.com>
      References: <200712110859.lBB8x7Sj025775@zion.cs.uiuc.edu>
      	<6E1DAB22-449F-4C35-9AF2-E209CE95B361@apple.com>
      	<5AEDE4C7-1724-45E4-99E9-A9D6058615A9@gmail.com>
      Message-ID: 
      
      
      On Dec 11, 2007, at 9:16 PM, Christopher Lamb wrote:
      
      >
      > On Dec 11, 2007, at 4:12 PM, Chris Lattner wrote:
      >
      >> On Dec 11, 2007, at 12:59 AM, Christopher Lamb wrote:
      >>
      >>> =
      >>> =
      >>> ====================================================================
      >>> ========
      >>> --- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
      >>> +++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Tue Dec 11
      >>> 02:59:05 2007
      >>> @@ -197,10 +197,14 @@
      >>>        TypeVals.push_back(cast(T)->getBitWidth());
      >>>        break;
      >>>      case Type::PointerTyID:
      >>> +      const PointerType *PTy = cast(T);
      >>> +      // POINTER: [pointee type] or [pointee type, address space]
      >>>        Code = bitc::TYPE_CODE_POINTER;
      >>> +      TypeVals.push_back(VE.getTypeID(PTy->getElementType()));
      >>> +      if (unsigned AddressSpace = PTy->getAddressSpace())
      >>> +        TypeVals.push_back(AddressSpace);
      >>> +      else
      >>> +        AbbrevToUse = PtrAbbrev;
      >>>        break;
      >>
      >> This can be simplified.  In this code, I'd just unconditionally  
      >> emit it:
      >>
      >>>      case Type::PointerTyID:
      >>> +      const PointerType *PTy = cast(T);
      >>> +      // POINTER: [pointee type] or [pointee type, address space]
      >>>        Code = bitc::TYPE_CODE_POINTER;
      >>> +      TypeVals.push_back(VE.getTypeID(PTy->getElementType()));
      >>>        TypeVals.push_back(PTy->getAddressSpace());
      >>>        AbbrevToUse = PtrAbbrev;
      >>>        break;
      >>
      >> And change the abbreviation to match, which would apply only if the
      >> addrspace is zero (and thus not encode it at all):
      >>
      >>    // Abbrev for TYPE_CODE_POINTER.
      >>    BitCodeAbbrev *Abbv = new BitCodeAbbrev();
      >>    Abbv->Add(BitCodeAbbrevOp(bitc::TYPE_CODE_POINTER));
      >>    Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed,
      >>                              Log2_32_Ceil(VE.getTypes().size()+1)));
      >>    Abbv->Add(BitCodeAbbrevOp(0));  // Addr space = 0.
      >>    unsigned PtrAbbrev = Stream.EmitAbbrev(Abbv);
      >>
      >> The presence of the abbreviation means that any pointers with
      >> addrspace 0 will not need per-instance space to represent this.
      >
      > This means moving the assert conditional into the if conditional and  
      > removing the assert in BitstreamWriter.h. Sound OK?
      
      Ah, right, sorry I misremembered.  In that case, make the PointerTyID  
      handling code do something like:
      
         if (Addrspace == 0) AbbrevToUse = PtrAbbrev;
      
      Thanks!
      
      -Chris
      
      
      From clattner at apple.com  Tue Dec 11 23:32:11 2007
      From: clattner at apple.com (Chris Lattner)
      Date: Tue, 11 Dec 2007 21:32:11 -0800
      Subject: [llvm-commits] RFC: patch for PR1782 (BasicAliasAnalyis)
      In-Reply-To: <475C72D9.9000505@fastmail.fm>
      References: <475B1C30.5020800@fastmail.fm>
      	
      	<475B3DCF.2030706@fastmail.fm>
      	
      	<475B4A51.1070000@fastmail.fm>
      	
      	<475C72D9.9000505@fastmail.fm>
      Message-ID: 
      
      
      On Dec 9, 2007, at 2:57 PM, Wojciech Matyjewicz wrote:
      
      > Chris Lattner wrote:
      >
      >> Yep, it looks Gordon was right :).  Thanks again Wojtek, I applied  
      >> the
      >> patch.  Please close the PR,
      >
      > Before I close the PR, I would like to discuss one more issue  
      > discovered
      > while working on it.
      >
      > Suppose, we have a target with 32-bit pointers and the following
      > instructions:
      >
      > %p = getelementptr i32* %x, i32 -1
      > %q = getelementptr i32* %x, i32 1073741823  ;(1073741823 == 2^30 - 1)
      >
      > TargetData::getIndexedOffset() uses 64-bit arithmetic to perform  
      > offset
      > computation and return 64-bit values. Hence, it will return -4 as an
      > offset for %p, and 2^32 - 4 for %q. Based on these offsets, it may  
      > seem
      > that %p and %q point to different memory objects. However, they don't,
      > taking into account that pointers are 32-bit long.
      
      Ok.
      
      > I guess, such a large positive index in GEP as seen above can be
      > introduced by -instcombine pass.
      
      Ok.  This is somewhat dubious though, as it is wrapping around the end  
      of the address space which is undefined in C.
      
      > BasicAA seems to be affected by the issue. For the attached example  
      > opt
      > -aa-eval says that %p and %q don't alias.
      >
      > I think, the simplest way to fix it is to truncate the computed offset
      > to the target pointer size before returning it in
      > TargetData::getIndexedOffset(). If you think this is the correct
      > approach, I may prepare a patch.
      
      Ah, that does make a lot of sense.  Since the fix is simple, please go  
      for it!
      
      -Chris
      
      
      From zhousheng00 at gmail.com  Wed Dec 12 00:12:31 2007
      From: zhousheng00 at gmail.com (Zhou Sheng)
      Date: Wed, 12 Dec 2007 14:12:31 +0800
      Subject: [llvm-commits] [llvm] r44910 - in /llvm/trunk:
      	lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
      	test/ExecutionEngine/2007-12-11-APIntExFuncCall.ll
      In-Reply-To: <8A248E7C-BF4E-4DC0-9304-7D8BEA5EAE92@apple.com>
      References: <200712120455.lBC4tiJF000621@zion.cs.uiuc.edu>
      	<8A248E7C-BF4E-4DC0-9304-7D8BEA5EAE92@apple.com>
      Message-ID: <8abe0dc60712112212n2d426d88x9aad5525eafc39f8@mail.gmail.com>
      
      Hi Chris,
      
      2007/12/12, Chris Lattner :
      >
      > > URL: http://llvm.org/viewvc/llvm-project?rev=44910&view=rev
      > > Log:
      > > Fixed PR1629.
      > > Make lli interpreter correctly call external functions sin()/cos(),
      > > __cxa_guard_acquire() and __cxa_guard_release().
      > > #include 
      > > +#include 
      > > using std::vector;
      >
      > hi Sheng,
      >
      > What provides this non-standard header?  I don't know for sure, but I
      > bet you just made our win32 friends very unhappy.
      
      
      I added a guard (__linux__) to this for which I'm assuming linux platform
      will provide this header.
      Is this OKay?
      
      Sheng.
      
      
      -Chris
      >
      >
      -------------- next part --------------
      An HTML attachment was scrubbed...
      URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20071212/8da8afb7/attachment.html 
      
      From christopher.lamb at gmail.com  Wed Dec 12 00:12:42 2007
      From: christopher.lamb at gmail.com (Christopher Lamb)
      Date: Tue, 11 Dec 2007 22:12:42 -0800
      Subject: [llvm-commits] [llvm] r44860 - /llvm/trunk/docs/LangRef.html
      In-Reply-To: <91A04793-060B-412D-827A-02CBEB16E7FB@apple.com>
      References: <200712110931.lBB9V14g027958@zion.cs.uiuc.edu>
      	
      	<22FE997C-5092-4F08-8823-2337C5B99F42@gmail.com>
      	
      	<7C2240B7-E23F-4C00-9A5F-0F3AFE00C853@gmail.com>
      	
      	<37102E7C-DB6C-428B-90FA-353FE4BB7323@gmail.com>
      	<91A04793-060B-412D-827A-02CBEB16E7FB@apple.com>
      Message-ID: 
      
      
      On Dec 11, 2007, at 9:16 PM, Chris Lattner wrote:
      
      >
      > On Dec 11, 2007, at 9:08 PM, Christopher Lamb wrote:
      >
      >>
      >> On Dec 11, 2007, at 8:50 PM, Chris Lattner wrote:
      >>
      >>>>> That is a very strong argument to me, but it seems to argue even
      >>>>> more
      >>>>> strongly for:
      >>>>>
      >>>>> @G = constant float addrspace(5) 1.0, section "foo", align 4
      >>>>>
      >>>>> Your example above would then be:
      >>>>>
      >>>>>> @foo = constant float addrspace(1)* addrspace(2) 1.0
      >>>>>
      >>>>> which has type:
      >>>>>
      >>>>>> float addrspace(1)* addrspace(2)*
      >>>>>
      >>>>> What do you think?  the downside is that this may cause bison to
      >>>>> have
      >>>>> issues :)
      >>>>
      >>>> This is ideally what I wanted, but it would mean seriously mucking
      >>>> with bison and changing how all CosntVal's are handled. I can give
      >>>> it a try.
      >>>
      >>> Hrm, I think bison will get extremely grumpy about this.
      >>
      >> I feared.
      >>
      >>> Quick  question, what is the syntax for an external GV with an ASI?
      >>
      >>
      >> Sticky wicket, that. It should be:
      >>
      >> @foo = external global i32 addrspace(1)
      >>
      >> But that's not working right now....
      >
      > Right, because it would require the same parsing logic as the proposal
      > above :).
      
      I don't think so. I think the rules were simply missing the  
      OptAddrSpace.
      
      >
      > How horrible would:
      >
      >> @foo = addrspace(1) external global i32
      >
      > be?
      
      I like that the order in the decl is the order in the type lots.
      
      These now work with the rules being adjusted.
      
      @foo = extern_weak global i32 addrspace(1)
      @foo = external global i32 addrspace(1)
      @foo = dllimport global i32 addrspace(1)
      
      @foo = internal global i32 addrspace(1)
      @foo = weak global i32 addrspace(1)
      @foo = linkonce global i32 addrspace(1)
      @foo = appending global i32 addrspace(1)
      @foo = dllexport global i32 addrspace(1)
      
      --
      Christopher Lamb
      
      
      
      
      
      From christopher.lamb at gmail.com  Wed Dec 12 00:15:49 2007
      From: christopher.lamb at gmail.com (Christopher Lamb)
      Date: Tue, 11 Dec 2007 22:15:49 -0800
      Subject: [llvm-commits] [llvm] r44860 - /llvm/trunk/docs/LangRef.html
      In-Reply-To: 
      References: <200712110931.lBB9V14g027958@zion.cs.uiuc.edu>
      	
      	<22FE997C-5092-4F08-8823-2337C5B99F42@gmail.com>
      	
      	<7C2240B7-E23F-4C00-9A5F-0F3AFE00C853@gmail.com>
      	
      	<37102E7C-DB6C-428B-90FA-353FE4BB7323@gmail.com>
      	<91A04793-060B-412D-827A-02CBEB16E7FB@apple.com>
      	
      Message-ID: <32FF92FF-7183-41A5-BF90-68FB0DADB04F@gmail.com>
      
      
      On Dec 11, 2007, at 10:12 PM, Christopher Lamb wrote:
      
      >
      > On Dec 11, 2007, at 9:16 PM, Chris Lattner wrote:
      >
      >>
      >> On Dec 11, 2007, at 9:08 PM, Christopher Lamb wrote:
      >>
      >>>
      >>> On Dec 11, 2007, at 8:50 PM, Chris Lattner wrote:
      >>>
      >>>>>> That is a very strong argument to me, but it seems to argue even
      >>>>>> more
      >>>>>> strongly for:
      >>>>>>
      >>>>>> @G = constant float addrspace(5) 1.0, section "foo", align 4
      >>>>>>
      >>>>>> Your example above would then be:
      >>>>>>
      >>>>>>> @foo = constant float addrspace(1)* addrspace(2) 1.0
      >>>>>>
      >>>>>> which has type:
      >>>>>>
      >>>>>>> float addrspace(1)* addrspace(2)*
      >>>>>>
      >>>>>> What do you think?  the downside is that this may cause bison to
      >>>>>> have
      >>>>>> issues :)
      >>>>>
      >>>>> This is ideally what I wanted, but it would mean seriously mucking
      >>>>> with bison and changing how all CosntVal's are handled. I can give
      >>>>> it a try.
      >>>>
      >>>> Hrm, I think bison will get extremely grumpy about this.
      >>>
      >>> I feared.
      >>>
      >>>> Quick  question, what is the syntax for an external GV with an ASI?
      >>>
      >>>
      >>> Sticky wicket, that. It should be:
      >>>
      >>> @foo = external global i32 addrspace(1)
      >>>
      >>> But that's not working right now....
      >>
      >> Right, because it would require the same parsing logic as the  
      >> proposal
      >> above :).
      >
      > I don't think so. I think the rules were simply missing the  
      > OptAddrSpace.
      >
      >>
      >> How horrible would:
      >>
      >>> @foo = addrspace(1) external global i32
      >>
      >> be?
      >
      > I like that the order in the decl is the order in the type lots.
      >
      > These now work with the rules being adjusted.
      >
      > @foo = extern_weak global i32 addrspace(1)
      > @foo = external global i32 addrspace(1)
      > @foo = dllimport global i32 addrspace(1)
      >
      rather...
      
      @foo = internal global i32 0 addrspace(1)
      @foo = weak global i32 0 addrspace(1)
      @foo = linkonce global i32 0 addrspace(1)
      @foo = appending global i32 0 addrspace(1)
      @foo = dllexport global i32 0 addrspace(1)
      
      --
      Christopher Lamb
      
      
      
      -------------- next part --------------
      An HTML attachment was scrubbed...
      URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20071211/d07b7a2e/attachment.html 
      
      From zhousheng00 at gmail.com  Wed Dec 12 00:16:47 2007
      From: zhousheng00 at gmail.com (Zhou Sheng)
      Date: Wed, 12 Dec 2007 06:16:47 -0000
      Subject: [llvm-commits] [llvm] r44914 -
       /llvm/trunk/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
      Message-ID: <200712120616.lBC6GlCh008732@zion.cs.uiuc.edu>
      
      Author: sheng
      Date: Wed Dec 12 00:16:47 2007
      New Revision: 44914
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44914&view=rev
      Log:
      Add a guard to cxxabi header as other platform may
      not support it.
      
      Modified:
          llvm/trunk/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
      
      Modified: llvm/trunk/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp?rev=44914&r1=44913&r2=44914&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp (original)
      +++ llvm/trunk/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp Wed Dec 12 00:16:47 2007
      @@ -29,7 +29,11 @@
       #include 
       #include 
       #include 
      +
      +#ifdef __linux__
       #include 
      +#endif
      +
       using std::vector;
       
       using namespace llvm;
      @@ -727,8 +731,12 @@
                                              const vector &Args) {
         assert(Args.size() == 1);
         GenericValue GV;
      +#ifdef __linux__
         GV.IntVal = APInt(32, __cxxabiv1::__cxa_guard_acquire (
                                 (__cxxabiv1::__guard*)GVTOP(Args[0])));
      +#else
      +  assert(0 && "Can't call __cxa_guard_acquire on this platform");
      +#endif
         return GV;
       }
       
      @@ -736,7 +744,11 @@
       GenericValue lle_X___cxa_guard_release(FunctionType *FT, 
                                              const vector &Args) {
         assert(Args.size() == 1);
      +#ifdef __linux__
         __cxxabiv1::__cxa_guard_release ((__cxxabiv1::__guard*)GVTOP(Args[0]));
      +#else
      +  assert(0 && "Can't call __cxa_guard_release on this platform");
      +#endif
         return GenericValue();
       }
       
      
      
      
      
      From clattner at apple.com  Wed Dec 12 00:28:59 2007
      From: clattner at apple.com (Chris Lattner)
      Date: Tue, 11 Dec 2007 22:28:59 -0800
      Subject: [llvm-commits] [llvm] r44910 - in /llvm/trunk:
      	lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp
      	test/ExecutionEngine/2007-12-11-APIntExFuncCall.ll
      In-Reply-To: <8abe0dc60712112212n2d426d88x9aad5525eafc39f8@mail.gmail.com>
      References: <200712120455.lBC4tiJF000621@zion.cs.uiuc.edu>
      	<8A248E7C-BF4E-4DC0-9304-7D8BEA5EAE92@apple.com>
      	<8abe0dc60712112212n2d426d88x9aad5525eafc39f8@mail.gmail.com>
      Message-ID: 
      
      
      On Dec 11, 2007, at 10:12 PM, Zhou Sheng wrote:
      
      > Hi Chris,
      >
      > 2007/12/12, Chris Lattner :
      > > URL: http://llvm.org/viewvc/llvm-project?rev=44910&view=rev
      > > Log:
      > > Fixed PR1629.
      > > Make lli interpreter correctly call external functions sin()/cos(),
      > > __cxa_guard_acquire() and __cxa_guard_release().
      > > #include 
      > > +#include 
      > > using std::vector;
      >
      > hi Sheng,
      >
      > What provides this non-standard header?  I don't know for sure, but I
      > bet you just made our win32 friends very unhappy.
      >
      > I added a guard (__linux__) to this for which I'm assuming linux  
      > platform will provide this header.
      > Is this OKay?
      
      That's fine with me.  The rest of the code in that file is already a  
      gross hack, so this seems reasonable :)
      
      Thanks Sheng,
      
      -Chris
      -------------- next part --------------
      An HTML attachment was scrubbed...
      URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20071211/97ff0062/attachment.html 
      
      From clattner at apple.com  Wed Dec 12 00:30:18 2007
      From: clattner at apple.com (Chris Lattner)
      Date: Tue, 11 Dec 2007 22:30:18 -0800
      Subject: [llvm-commits] [llvm] r44860 - /llvm/trunk/docs/LangRef.html
      In-Reply-To: <32FF92FF-7183-41A5-BF90-68FB0DADB04F@gmail.com>
      References: <200712110931.lBB9V14g027958@zion.cs.uiuc.edu>
      	
      	<22FE997C-5092-4F08-8823-2337C5B99F42@gmail.com>
      	
      	<7C2240B7-E23F-4C00-9A5F-0F3AFE00C853@gmail.com>
      	
      	<37102E7C-DB6C-428B-90FA-353FE4BB7323@gmail.com>
      	<91A04793-060B-412D-827A-02CBEB16E7FB@apple.com>
      	
      	<32FF92FF-7183-41A5-BF90-68FB0DADB04F@gmail.com>
      Message-ID: 
      
      >>> How horrible would:
      >>>
      >>>> @foo = addrspace(1) external global i32
      >>>
      >>> be?
      >>
      >> I like that the order in the decl is the order in the type lots.
      >>
      >> These now work with the rules being adjusted.
      >>
      >> @foo = extern_weak global i32 addrspace(1)
      >> @foo = external global i32 addrspace(1)
      >> @foo = dllimport global i32 addrspace(1)
      >>
      > rather...
      >
      > @foo = internal global i32 0 addrspace(1)
      > @foo = weak global i32 0 addrspace(1)
      > @foo = linkonce global i32 0 addrspace(1)
      > @foo = appending global i32 0 addrspace(1)
      > @foo = dllexport global i32 0 addrspace(1)
      
      I prefer that too, but I don't see how you're going to get bison to  
      accept "external global i32 addrspace(1)".
      
      Please verify that the number of shift/reduce and reduce/reduce  
      conflicts doesn't go up.
      
      -Chris
      
      
      From christopher.lamb at gmail.com  Wed Dec 12 00:39:20 2007
      From: christopher.lamb at gmail.com (Christopher Lamb)
      Date: Tue, 11 Dec 2007 22:39:20 -0800
      Subject: [llvm-commits] [llvm] r44860 - /llvm/trunk/docs/LangRef.html
      In-Reply-To: 
      References: <200712110931.lBB9V14g027958@zion.cs.uiuc.edu>
      	
      	<22FE997C-5092-4F08-8823-2337C5B99F42@gmail.com>
      	
      	<7C2240B7-E23F-4C00-9A5F-0F3AFE00C853@gmail.com>
      	
      	<37102E7C-DB6C-428B-90FA-353FE4BB7323@gmail.com>
      	<91A04793-060B-412D-827A-02CBEB16E7FB@apple.com>
      	
      	<32FF92FF-7183-41A5-BF90-68FB0DADB04F@gmail.com>
      	
      Message-ID: <6CAF36DA-E697-4168-B53E-42E1C4FC3D83@gmail.com>
      
      
      On Dec 11, 2007, at 10:30 PM, Chris Lattner wrote:
      
      >>>> How horrible would:
      >>>>
      >>>>> @foo = addrspace(1) external global i32
      >>>>
      >>>> be?
      >>>
      >>> I like that the order in the decl is the order in the type lots.
      >>>
      >>> These now work with the rules being adjusted.
      >>>
      >>> @foo = extern_weak global i32 addrspace(1)
      >>> @foo = external global i32 addrspace(1)
      >>> @foo = dllimport global i32 addrspace(1)
      >>>
      >> rather...
      >>
      >> @foo = internal global i32 0 addrspace(1)
      >> @foo = weak global i32 0 addrspace(1)
      >> @foo = linkonce global i32 0 addrspace(1)
      >> @foo = appending global i32 0 addrspace(1)
      >> @foo = dllexport global i32 0 addrspace(1)
      >
      > I prefer that too, but I don't see how you're going to get bison to
      > accept "external global i32 addrspace(1)".
      
      The problem is placing the 'addrspace()' betwen the type name and the  
      value of a 'ConstVal'. The pattern for external linkage global  
      variables refers to 'Types' rather than 'ConstVal', so it works just  
      fine.
      
      > Please verify that the number of shift/reduce and reduce/reduce
      > conflicts doesn't go up.
      
      
      They don't.
      
      --
      Christopher Lamb
      
      
      
      -------------- next part --------------
      An HTML attachment was scrubbed...
      URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20071211/0012cf18/attachment.html 
      
      From evan.cheng at apple.com  Wed Dec 12 00:45:40 2007
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Wed, 12 Dec 2007 06:45:40 -0000
      Subject: [llvm-commits] [llvm] r44921 - in /llvm/trunk:
       lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/vec_return.ll
      Message-ID: <200712120645.lBC6je1S012053@zion.cs.uiuc.edu>
      
      Author: evancheng
      Date: Wed Dec 12 00:45:40 2007
      New Revision: 44921
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44921&view=rev
      Log:
      Lower a build_vector with all constants into a constpool load unless it can be done with a move to low part.
      
      Modified:
          llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
          llvm/trunk/test/CodeGen/X86/vec_return.ll
      
      Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=44921&r1=44920&r2=44921&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
      +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Dec 12 00:45:40 2007
      @@ -3157,21 +3157,21 @@
         unsigned NumZero  = 0;
         unsigned NumNonZero = 0;
         unsigned NonZeros = 0;
      -  unsigned NumNonZeroImms = 0;
      +  bool HasNonImms = false;
         SmallSet Values;
         for (unsigned i = 0; i < NumElems; ++i) {
           SDOperand Elt = Op.getOperand(i);
      -    if (Elt.getOpcode() != ISD::UNDEF) {
      -      Values.insert(Elt);
      -      if (isZeroNode(Elt))
      -        NumZero++;
      -      else {
      -        NonZeros |= (1 << i);
      -        NumNonZero++;
      -        if (Elt.getOpcode() == ISD::Constant ||
      -            Elt.getOpcode() == ISD::ConstantFP)
      -          NumNonZeroImms++;
      -      }
      +    if (Elt.getOpcode() == ISD::UNDEF)
      +      continue;
      +    Values.insert(Elt);
      +    if (Elt.getOpcode() != ISD::Constant &&
      +        Elt.getOpcode() != ISD::ConstantFP)
      +      HasNonImms = true;
      +    if (isZeroNode(Elt))
      +      NumZero++;
      +    else {
      +      NonZeros |= (1 << i);
      +      NumNonZero++;
           }
         }
       
      @@ -3185,7 +3185,7 @@
           return SDOperand();
       
         // Special case for single non-zero element.
      -  if (NumNonZero == 1) {
      +  if (NumNonZero == 1 && NumElems <= 4) {
           unsigned Idx = CountTrailingZeros_32(NonZeros);
           SDOperand Item = Op.getOperand(Idx);
           Item = DAG.getNode(ISD::SCALAR_TO_VECTOR, VT, Item);
      @@ -3193,6 +3193,8 @@
             // Turn it into a MOVL (i.e. movss, movsd, or movd) to a zero vector.
             return getShuffleVectorZeroOrUndef(Item, VT, NumElems, Idx,
                                                NumZero > 0, DAG);
      +    else if (!HasNonImms) // Otherwise, it's better to do a constpool load.
      +      return SDOperand();
       
           if (EVTBits == 32) {
             // Turn it into a shuffle of zero and zero-extended scalar to vector.
      @@ -3212,7 +3214,7 @@
       
         // A vector full of immediates; various special cases are already
         // handled, so this is best done with a single constant-pool load.
      -  if (NumNonZero == NumNonZeroImms)
      +  if (!HasNonImms)
           return SDOperand();
       
         // Let legalizer expand 2-wide build_vectors.
      
      Modified: llvm/trunk/test/CodeGen/X86/vec_return.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_return.ll?rev=44921&r1=44920&r2=44921&view=diff
      
      ==============================================================================
      --- llvm/trunk/test/CodeGen/X86/vec_return.ll (original)
      +++ llvm/trunk/test/CodeGen/X86/vec_return.ll Wed Dec 12 00:45:40 2007
      @@ -1,5 +1,12 @@
      -; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mcpu=yonah
      +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2
      +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep xorps | count 1
      +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep movaps | count 1
      +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | not grep shuf
       
      -<2 x double> %test() {
      -	ret <2 x double> 
      +define <2 x double> @test() {
      +	ret <2 x double> zeroinitializer
      +}
      +
      +define <4 x i32> @test2() nounwind  {
      +	ret <4 x i32> < i32 0, i32 0, i32 1, i32 0 >
       }
      
      
      
      
      From clattner at apple.com  Wed Dec 12 00:45:34 2007
      From: clattner at apple.com (Chris Lattner)
      Date: Tue, 11 Dec 2007 22:45:34 -0800
      Subject: [llvm-commits] [llvm] r44860 - /llvm/trunk/docs/LangRef.html
      In-Reply-To: <6CAF36DA-E697-4168-B53E-42E1C4FC3D83@gmail.com>
      References: <200712110931.lBB9V14g027958@zion.cs.uiuc.edu>
      	
      	<22FE997C-5092-4F08-8823-2337C5B99F42@gmail.com>
      	
      	<7C2240B7-E23F-4C00-9A5F-0F3AFE00C853@gmail.com>
      	
      	<37102E7C-DB6C-428B-90FA-353FE4BB7323@gmail.com>
      	<91A04793-060B-412D-827A-02CBEB16E7FB@apple.com>
      	
      	<32FF92FF-7183-41A5-BF90-68FB0DADB04F@gmail.com>
      	
      	<6CAF36DA-E697-4168-B53E-42E1C4FC3D83@gmail.com>
      Message-ID: <484D00A4-61B9-4824-AAEF-70A3BD52CB4F@apple.com>
      
      >>> @foo = internal global i32 0 addrspace(1)
      >>> @foo = weak global i32 0 addrspace(1)
      >>> @foo = linkonce global i32 0 addrspace(1)
      >>> @foo = appending global i32 0 addrspace(1)
      >>> @foo = dllexport global i32 0 addrspace(1)
      >>
      >> I prefer that too, but I don't see how you're going to get bison to
      >> accept "external global i32 addrspace(1)".
      >
      > The problem is placing the 'addrspace()' betwen the type name and  
      > the value of a 'ConstVal'. The pattern for external linkage global  
      > variables refers to 'Types' rather than 'ConstVal', so it works just  
      > fine.
      >
      >> Please verify that the number of shift/reduce and reduce/reduce
      >> conflicts doesn't go up.
      >
      >
      > They don't.
      
      Ok.  It would still be nicer to get to:
      >>> @foo = dllexport global i32 addrspace(1) 0
      
      :)
      
      -Chris
      
      
      From evan.cheng at apple.com  Wed Dec 12 01:54:08 2007
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Wed, 12 Dec 2007 07:54:08 -0000
      Subject: [llvm-commits] [llvm] r44928 -
      	/llvm/trunk/test/CodeGen/X86/opt-ext-uses.ll
      Message-ID: <200712120754.lBC7s9MY016540@zion.cs.uiuc.edu>
      
      Author: evancheng
      Date: Wed Dec 12 01:54:08 2007
      New Revision: 44928
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44928&view=rev
      Log:
      Add a test case for -optimize-ext-uses.
      
      Added:
          llvm/trunk/test/CodeGen/X86/opt-ext-uses.ll
      
      Added: llvm/trunk/test/CodeGen/X86/opt-ext-uses.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/opt-ext-uses.ll?rev=44928&view=auto
      
      ==============================================================================
      --- llvm/trunk/test/CodeGen/X86/opt-ext-uses.ll (added)
      +++ llvm/trunk/test/CodeGen/X86/opt-ext-uses.ll Wed Dec 12 01:54:08 2007
      @@ -0,0 +1,19 @@
      +; RUN: llvm-as < %s | llc -march=x86 -optimize-ext-uses=true | grep movw | count 1
      +
      +define i16 @t() signext  {
      +entry:
      +        %tmp180 = load i16* null, align 2               ;  [#uses=3]
      +        %tmp180181 = sext i16 %tmp180 to i32            ;  [#uses=1]
      +        %tmp182 = add i16 %tmp180, 10
      +        %tmp185 = icmp slt i16 %tmp182, 0               ;  [#uses=1]
      +        br i1 %tmp185, label %cond_true188, label %cond_next245
      +
      +cond_true188:           ; preds = %entry
      +        %tmp195196 = trunc i16 %tmp180 to i8            ;  [#uses=0]
      +        ret i16 %tmp180
      +
      +cond_next245:           ; preds = %entry
      +        %tmp256 = and i32 %tmp180181, 15                ;  [#uses=0]
      +        %tmp3 = trunc i32 %tmp256 to i16
      +        ret i16 %tmp3
      +}
      
      
      
      
      From evan.cheng at apple.com  Wed Dec 12 01:55:36 2007
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Wed, 12 Dec 2007 07:55:36 -0000
      Subject: [llvm-commits] [llvm] r44929 - in /llvm/trunk:
       lib/Target/X86/X86ISelLowering.cpp
       test/CodeGen/X86/2007-07-31-VInsertBug.ll test/CodeGen/X86/vec_insert-2.ll
       test/CodeGen/X86/vec_insert-3.ll test/CodeGen/X86/vec_insert.ll
      Message-ID: <200712120755.lBC7taRX016638@zion.cs.uiuc.edu>
      
      Author: evancheng
      Date: Wed Dec 12 01:55:34 2007
      New Revision: 44929
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44929&view=rev
      Log:
      Use shuffles to implement insert_vector_elt for i32, i64, f32, and f64.
      
      Added:
          llvm/trunk/test/CodeGen/X86/vec_insert-2.ll
          llvm/trunk/test/CodeGen/X86/vec_insert-3.ll
      Removed:
          llvm/trunk/test/CodeGen/X86/2007-07-31-VInsertBug.ll
      Modified:
          llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
          llvm/trunk/test/CodeGen/X86/vec_insert.ll
      
      Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=44929&r1=44928&r2=44929&view=diff
      
      ==============================================================================
      --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
      +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Dec 12 01:55:34 2007
      @@ -3922,53 +3922,35 @@
       
       SDOperand
       X86TargetLowering::LowerINSERT_VECTOR_ELT(SDOperand Op, SelectionDAG &DAG) {
      -  // Transform it so it match pinsrw which expects a 16-bit value in a GR32
      -  // as its second argument.
         MVT::ValueType VT = Op.getValueType();
      -  MVT::ValueType BaseVT = MVT::getVectorElementType(VT);
      +  MVT::ValueType EVT = MVT::getVectorElementType(VT);
      +  if (EVT == MVT::i8)
      +    return SDOperand();
      +
         SDOperand N0 = Op.getOperand(0);
         SDOperand N1 = Op.getOperand(1);
         SDOperand N2 = Op.getOperand(2);
      -  if (MVT::getSizeInBits(BaseVT) == 16) {
      +
      +  if (MVT::getSizeInBits(EVT) == 16) {
      +    // Transform it so it match pinsrw which expects a 16-bit value in a GR32
      +    // as its second argument.
           if (N1.getValueType() != MVT::i32)
             N1 = DAG.getNode(ISD::ANY_EXTEND, MVT::i32, N1);
           if (N2.getValueType() != MVT::i32)
             N2 = DAG.getConstant(cast(N2)->getValue(),getPointerTy());
           return DAG.getNode(X86ISD::PINSRW, VT, N0, N1, N2);
      -  } else if (MVT::getSizeInBits(BaseVT) == 32) {
      -    unsigned Idx = cast(N2)->getValue();
      -    if (Idx == 0) {
      -      // Use a movss.
      -      N1 = DAG.getNode(ISD::SCALAR_TO_VECTOR, VT, N1);
      -      MVT::ValueType MaskVT = MVT::getIntVectorWithNumElements(4);
      -      MVT::ValueType BaseVT = MVT::getVectorElementType(MaskVT);
      -      SmallVector MaskVec;
      -      MaskVec.push_back(DAG.getConstant(4, BaseVT));
      -      for (unsigned i = 1; i <= 3; ++i)
      -        MaskVec.push_back(DAG.getConstant(i, BaseVT));
      -      return DAG.getNode(ISD::VECTOR_SHUFFLE, VT, N0, N1,
      -                         DAG.getNode(ISD::BUILD_VECTOR, MaskVT,
      -                                     &MaskVec[0], MaskVec.size()));
      -    } else {
      -      // Use two pinsrw instructions to insert a 32 bit value.
      -      Idx <<= 1;
      -      if (MVT::isFloatingPoint(N1.getValueType())) {
      -        N1 = DAG.getNode(ISD::SCALAR_TO_VECTOR, MVT::v4f32, N1);
      -        N1 = DAG.getNode(ISD::BIT_CONVERT, MVT::v4i32, N1);
      -        N1 = DAG.getNode(ISD::EXTRACT_VECTOR_ELT, MVT::i32, N1,
      -                         DAG.getConstant(0, getPointerTy()));
      -      }
      -      N0 = DAG.getNode(ISD::BIT_CONVERT, MVT::v8i16, N0);
      -      N0 = DAG.getNode(X86ISD::PINSRW, MVT::v8i16, N0, N1,
      -                       DAG.getConstant(Idx, getPointerTy()));
      -      N1 = DAG.getNode(ISD::SRL, MVT::i32, N1, DAG.getConstant(16, MVT::i8));
      -      N0 = DAG.getNode(X86ISD::PINSRW, MVT::v8i16, N0, N1,
      -                       DAG.getConstant(Idx+1, getPointerTy()));
      -      return DAG.getNode(ISD::BIT_CONVERT, VT, N0);
      -    }
         }
       
      -  return SDOperand();
      +  N1 = DAG.getNode(ISD::SCALAR_TO_VECTOR, VT, N1);
      +  unsigned Idx = cast(N2)->getValue();
      +  MVT::ValueType MaskVT = MVT::getIntVectorWithNumElements(4);
      +  MVT::ValueType MaskEVT = MVT::getVectorElementType(MaskVT);
      +  SmallVector MaskVec;
      +  for (unsigned i = 0; i < 4; ++i)
      +    MaskVec.push_back(DAG.getConstant((i == Idx) ? i+4 : i, MaskEVT));
      +  return DAG.getNode(ISD::VECTOR_SHUFFLE, VT, N0, N1,
      +                     DAG.getNode(ISD::BUILD_VECTOR, MaskVT,
      +                                 &MaskVec[0], MaskVec.size()));
       }
       
       SDOperand
      
      Removed: llvm/trunk/test/CodeGen/X86/2007-07-31-VInsertBug.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-07-31-VInsertBug.ll?rev=44928&view=auto
      
      ==============================================================================
      --- llvm/trunk/test/CodeGen/X86/2007-07-31-VInsertBug.ll (original)
      +++ llvm/trunk/test/CodeGen/X86/2007-07-31-VInsertBug.ll (removed)
      @@ -1,16 +0,0 @@
      -; RUN: llvm-as < %s | llc -mtriple=i686-apple-darwin -mattr=+sse2 | %prcontext {pinsrw \$2} 1 | grep "movl \$1"
      -; RUN: llvm-as < %s | llc -mtriple=i686-apple-darwin -mattr=+sse2 | not grep movss
      -
      - at G = global <4 x float> zeroinitializer
      -
      -define void @test(i32 *%P1, i32* %P2, float *%FP) {
      -        %T = load float* %FP
      -        store i32 0, i32* %P1
      -
      -        %U = load <4 x float>* @G
      -        store i32 1, i32* %P1
      -        %V = insertelement <4 x float> %U, float %T, i32 1
      -        store <4 x float> %V, <4 x float>* @G
      -
      -        ret void
      -}
      
      Added: llvm/trunk/test/CodeGen/X86/vec_insert-2.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_insert-2.ll?rev=44929&view=auto
      
      ==============================================================================
      --- llvm/trunk/test/CodeGen/X86/vec_insert-2.ll (added)
      +++ llvm/trunk/test/CodeGen/X86/vec_insert-2.ll Wed Dec 12 01:55:34 2007
      @@ -0,0 +1,23 @@
      +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep pinsrw | count 1
      +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep movhpd | count 1
      +; RUN: llvm-as < %s | llc -march=x86-64 -mattr=+sse2 | grep unpcklpd | count 1
      +
      +define <4 x float> @t1(float %s, <4 x float> %tmp) {
      +        %tmp1 = insertelement <4 x float> %tmp, float %s, i32 3
      +        ret <4 x float> %tmp1
      +}
      +
      +define <4 x i32> @t2(i32 %s, <4 x i32> %tmp) {
      +        %tmp1 = insertelement <4 x i32> %tmp, i32 %s, i32 3
      +        ret <4 x i32> %tmp1
      +}
      +
      +define <2 x double> @t3(double %s, <2 x double> %tmp) {
      +        %tmp1 = insertelement <2 x double> %tmp, double %s, i32 1
      +        ret <2 x double> %tmp1
      +}
      +
      +define <8 x i16> @t4(i16 %s, <8 x i16> %tmp) {
      +        %tmp1 = insertelement <8 x i16> %tmp, i16 %s, i32 5
      +        ret <8 x i16> %tmp1
      +}
      
      Added: llvm/trunk/test/CodeGen/X86/vec_insert-3.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_insert-3.ll?rev=44929&view=auto
      
      ==============================================================================
      --- llvm/trunk/test/CodeGen/X86/vec_insert-3.ll (added)
      +++ llvm/trunk/test/CodeGen/X86/vec_insert-3.ll Wed Dec 12 01:55:34 2007
      @@ -0,0 +1,6 @@
      +; RUN: llvm-as < %s | llc -march=x86-64 -mattr=+sse2 | grep punpcklqdq | count 1
      +
      +define <2 x i64> @t1(i64 %s, <2 x i64> %tmp) {
      +        %tmp1 = insertelement <2 x i64> %tmp, i64 %s, i32 1
      +        ret <2 x i64> %tmp1
      +}
      
      Modified: llvm/trunk/test/CodeGen/X86/vec_insert.ll
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_insert.ll?rev=44929&r1=44928&r2=44929&view=diff
      
      ==============================================================================
      --- llvm/trunk/test/CodeGen/X86/vec_insert.ll (original)
      +++ llvm/trunk/test/CodeGen/X86/vec_insert.ll Wed Dec 12 01:55:34 2007
      @@ -1,20 +1,19 @@
      -; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 -o %t -f
      -; RUN: grep movss  %t | count 1
      -; RUN: grep pinsrw %t | count 2
      +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep movss | count 1
      +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | not grep pinsrw
       
      -void %test(<4 x float>* %F, int %I) {
      -	%tmp = load <4 x float>* %F
      -	%f = cast int %I to float
      -	%tmp1 = insertelement <4 x float> %tmp, float %f, uint 0
      -	%tmp18 = add <4 x float> %tmp1, %tmp1
      +define void @test(<4 x float>* %F, i32 %I) {
      +	%tmp = load <4 x float>* %F		; <<4 x float>> [#uses=1]
      +	%f = sitofp i32 %I to float		;  [#uses=1]
      +	%tmp1 = insertelement <4 x float> %tmp, float %f, i32 0		; <<4 x float>> [#uses=2]
      +	%tmp18 = add <4 x float> %tmp1, %tmp1		; <<4 x float>> [#uses=1]
       	store <4 x float> %tmp18, <4 x float>* %F
       	ret void
       }
       
      -void %test2(<4 x float>* %F, int %I, float %g) {
      -	%tmp = load <4 x float>* %F
      -	%f = cast int %I to float
      -	%tmp1 = insertelement <4 x float> %tmp, float %f, uint 2
      +define void @test2(<4 x float>* %F, i32 %I, float %g) {
      +	%tmp = load <4 x float>* %F		; <<4 x float>> [#uses=1]
      +	%f = sitofp i32 %I to float		;  [#uses=1]
      +	%tmp1 = insertelement <4 x float> %tmp, float %f, i32 2		; <<4 x float>> [#uses=1]
       	store <4 x float> %tmp1, <4 x float>* %F
       	ret void
       }
      
      
      
      
      From evan.cheng at apple.com  Wed Dec 12 02:05:40 2007
      From: evan.cheng at apple.com (Evan Cheng)
      Date: Wed, 12 Dec 2007 08:05:40 -0000
      Subject: [llvm-commits] [test-suite] r44931 -
      	/test-suite/trunk/Makefile.programs
      Message-ID: <200712120805.lBC85eeY017278@zion.cs.uiuc.edu>
      
      Author: evancheng
      Date: Wed Dec 12 02:05:40 2007
      New Revision: 44931
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44931&view=rev
      Log:
      Test -optimize-ext-uses as x86 llcbeta.
      
      Modified:
          test-suite/trunk/Makefile.programs
      
      Modified: test-suite/trunk/Makefile.programs
      URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.programs?rev=44931&r1=44930&r2=44931&view=diff
      
      ==============================================================================
      --- test-suite/trunk/Makefile.programs (original)
      +++ test-suite/trunk/Makefile.programs Wed Dec 12 02:05:40 2007
      @@ -233,7 +233,8 @@
       LLCBETAOPTION := -enable-sparc-v9-insts
       endif
       ifeq ($(ARCH),ARM)
      -LLCBETAOPTION := -new-coalescer-heuristic=true
      +LLCBETAOPTION := -optimize-ext-uses
      +#-new-coalescer-heuristic=true
       #-disable-rematerialization
       #-march=thumb
       endif
      
      
      
      
      From christopher.lamb at gmail.com  Wed Dec 12 02:16:34 2007
      From: christopher.lamb at gmail.com (Christopher Lamb)
      Date: Wed, 12 Dec 2007 00:16:34 -0800
      Subject: [llvm-commits] [llvm] r44860 - /llvm/trunk/docs/LangRef.html
      In-Reply-To: <484D00A4-61B9-4824-AAEF-70A3BD52CB4F@apple.com>
      References: <200712110931.lBB9V14g027958@zion.cs.uiuc.edu>
      	
      	<22FE997C-5092-4F08-8823-2337C5B99F42@gmail.com>
      	
      	<7C2240B7-E23F-4C00-9A5F-0F3AFE00C853@gmail.com>
      	
      	<37102E7C-DB6C-428B-90FA-353FE4BB7323@gmail.com>
      	<91A04793-060B-412D-827A-02CBEB16E7FB@apple.com>
      	
      	<32FF92FF-7183-41A5-BF90-68FB0DADB04F@gmail.com>
      	
      	<6CAF36DA-E697-4168-B53E-42E1C4FC3D83@gmail.com>
      	<484D00A4-61B9-4824-AAEF-70A3BD52CB4F@apple.com>
      Message-ID: 
      
      
      On Dec 11, 2007, at 10:45 PM, Chris Lattner wrote:
      
      >>>> @foo = internal global i32 0 addrspace(1)
      >>>> @foo = weak global i32 0 addrspace(1)
      >>>> @foo = linkonce global i32 0 addrspace(1)
      >>>> @foo = appending global i32 0 addrspace(1)
      >>>> @foo = dllexport global i32 0 addrspace(1)
      >>>
      >>> I prefer that too, but I don't see how you're going to get bison to
      >>> accept "external global i32 addrspace(1)".
      >>
      >> The problem is placing the 'addrspace()' betwen the type name and
      >> the value of a 'ConstVal'. The pattern for external linkage global
      >> variables refers to 'Types' rather than 'ConstVal', so it works just
      >> fine.
      >>
      >>> Please verify that the number of shift/reduce and reduce/reduce
      >>> conflicts doesn't go up.
      >>
      >>
      >> They don't.
      >
      > Ok.  It would still be nicer to get to:
      >>>> @foo = dllexport global i32 addrspace(1) 0
      >
      > :)
      
      Yes. Bison ate its own head when I tried to do this though. Also  
      there are nasty side affects of allowing addrspace() on types in  
      ConstVals in the parser as it allows addrspace() then on types used  
      in constant expressions. I think the current way really is best right  
      now.
      
      --
      Christopher Lamb
      
      
      
      -------------- next part --------------
      An HTML attachment was scrubbed...
      URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20071212/848f15c3/attachment.html 
      
      From clattner at apple.com  Wed Dec 12 02:18:35 2007
      From: clattner at apple.com (Chris Lattner)
      Date: Wed, 12 Dec 2007 00:18:35 -0800
      Subject: [llvm-commits] [llvm] r44860 - /llvm/trunk/docs/LangRef.html
      In-Reply-To: 
      References: <200712110931.lBB9V14g027958@zion.cs.uiuc.edu>
      	
      	<22FE997C-5092-4F08-8823-2337C5B99F42@gmail.com>
      	
      	<7C2240B7-E23F-4C00-9A5F-0F3AFE00C853@gmail.com>
      	
      	<37102E7C-DB6C-428B-90FA-353FE4BB7323@gmail.com>
      	<91A04793-060B-412D-827A-02CBEB16E7FB@apple.com>
      	
      	<32FF92FF-7183-41A5-BF90-68FB0DADB04F@gmail.com>
      	
      	<6CAF36DA-E697-4168-B53E-42E1C4FC3D83@gmail.com>
      	<484D00A4-61B9-4824-AAEF-70A3BD52CB4F@apple.com>
      	
      Message-ID: <47332102-B78E-4A9F-82FC-537A539AF6F7@apple.com>
      
      
      On Dec 12, 2007, at 12:16 AM, Christopher Lamb wrote:
      
      >>>
      >>>
      >>> They don't.
      >>
      >> Ok.  It would still be nicer to get to:
      >>>>> @foo = dllexport global i32 addrspace(1) 0
      >>
      >> :)
      >
      > Yes. Bison ate its own head when I tried to do this though. Also  
      > there are nasty side affects of allowing addrspace() on types in  
      > ConstVals in the parser as it allows addrspace() then on types used  
      > in constant expressions. I think the current way really is best  
      > right now.
      >
      
      ok
      
      -Chris
      
      
      From christopher.lamb at gmail.com  Wed Dec 12 02:39:22 2007
      From: christopher.lamb at gmail.com (Christopher Lamb)
      Date: Wed, 12 Dec 2007 00:39:22 -0800
      Subject: [llvm-commits] [llvm] r44858 - in /llvm/trunk:
      	include/llvm/Bitcode/LLVMBitCodes.h
      	include/llvm/DerivedTypes.h include/llvm/GlobalVariable.h
      	include/llvm/Instructions.h lib/AsmParser/LLLexer.cpp
      	lib/AsmParser/llvmAsmParser.y lib/Bitcode/Reader/BitcodeReader.cpp
      	lib/Bitcode/Writer/BitcodeWriter.cpp lib/VMCore/AsmWriter.cpp
      	lib/VMCore/Constants.cpp lib/VMCore/Globals.cpp
      	lib/VMCore/Instructions.cpp lib/VMCore/Type.cpp
      	test/Assembler/2007-12-11-AddressSpaces.ll
      	tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp
      In-Reply-To: <6E1DAB22-449F-4C35-9AF2-E209CE95B361@apple.com>
      References: <200712110859.lBB8x7Sj025775@zion.cs.uiuc.edu>
      	<6E1DAB22-449F-4C35-9AF2-E209CE95B361@apple.com>
      Message-ID: <0BE1B1E1-B14C-4481-9C55-E1AB9AF08333@gmail.com>
      
      
      On Dec 11, 2007, at 4:12 PM, Chris Lattner wrote:
      
      > Also, should it be possible to place a function in an address space?
      
      I think probably not...
      
      > Does the embedded C spec allow this?
      
      "A function type shall not be qualified by an address-space qualifier."
      
      I don't think this precludes the compiler from placing all functions  
      in a non-default address space, however I'm not sure what that would  
      get you other than a different way to handle function pointers. I  
      assume you don't need address spaces to deal specially with function  
      pointers in the back end.
      
      --
      Christopher Lamb
      
      
      
      
      
      From christopher.lamb at gmail.com  Wed Dec 12 02:44:39 2007
      From: christopher.lamb at gmail.com (Christopher Lamb)
      Date: Wed, 12 Dec 2007 08:44:39 -0000
      Subject: [llvm-commits] [llvm] r44933 - in /llvm/trunk: docs/LangRef.html
       include/llvm/Bitcode/LLVMBitCodes.h lib/AsmParser/llvmAsmParser.y
       lib/Bitcode/Writer/BitcodeWriter.cpp
       test/Assembler/2007-12-11-AddressSpaces.ll
      Message-ID: <200712120844.lBC8id5p026891@zion.cs.uiuc.edu>
      
      Author: clamb
      Date: Wed Dec 12 02:44:39 2007
      New Revision: 44933
      
      URL: http://llvm.org/viewvc/llvm-project?rev=44933&view=rev
      Log:
      Implement part of review feedback for address spaces.
      
      Modified:
          llvm/trunk/docs/LangRef.html
          llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h
          llvm/trunk/lib/AsmParser/llvmAsmParser.y
          llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
          llvm/trunk/test/Assembler/2007-12-11-AddressSpaces.ll
      
      Modified: llvm/trunk/docs/LangRef.html
      URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=44933&r1=44932&r2=44933&view=diff
      
      ==============================================================================
      --- llvm/trunk/docs/LangRef.html (original)
      +++ llvm/trunk/docs/LangRef.html Wed Dec 12 02:44:39 2007
      @@ -671,7 +671,8 @@
       

      A global variable may be declared to reside in a target-specifc numbered address space. For targets that support them, address spaces may affect how optimizations are performed and/or what target instructions are used to access -the variable. The default address space is zero.

      +the variable. The default address space is zero. The address space qualifier +must precede any other attributes.

      LLVM allows an explicit section to be specified for globals. If the target supports it, it will emit globals to the section specified.

      Modified: llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h?rev=44933&r1=44932&r2=44933&view=diff ============================================================================== --- llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h (original) +++ llvm/trunk/include/llvm/Bitcode/LLVMBitCodes.h Wed Dec 12 02:44:39 2007 @@ -194,6 +194,7 @@ FUNC_CODE_INST_FREE = 18, // FREE: [opty, op] FUNC_CODE_INST_ALLOCA = 19, // ALLOCA: [instty, op, align] FUNC_CODE_INST_LOAD = 20, // LOAD: [opty, op, align, vol] + // FIXME: Remove STORE in favor of STORE2 in LLVM 3.0 FUNC_CODE_INST_STORE = 21, // STORE: [valty,val,ptr, align, vol] FUNC_CODE_INST_CALL = 22, // CALL: [attr, fnty, fnid, args...] FUNC_CODE_INST_VAARG = 23, // VAARG: [valistty, valist, instty] Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y?rev=44933&r1=44932&r2=44933&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.y (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y Wed Dec 12 02:44:39 2007 @@ -1050,7 +1050,7 @@ %type GlobalName OptGlobalAssign GlobalAssign %type OptSection SectionString OptGC -%type OptAlign OptCAlign +%type OptAlign OptCAlign OptAddrSpace %token ZEROINITIALIZER TRUETOK FALSETOK BEGINTOK ENDTOK %token DECLARE DEFINE GLOBAL CONSTANT SECTION ALIAS VOLATILE THREAD_LOCAL @@ -1137,6 +1137,9 @@ LocalName : LOCALVAR | STRINGCONSTANT | PCTSTRINGCONSTANT ; OptLocalName : LocalName | /*empty*/ { $$ = 0; }; +OptAddrSpace : ADDRSPACE '(' EUINT64VAL ')' { $$=$3; } + | /*empty*/ { $$=0; }; + /// OptLocalAssign - Value producing statements have an optional assignment /// component. OptLocalAssign : LocalName '=' { @@ -1316,17 +1319,10 @@ $$ = new PATypeHolder($1); CHECK_FOR_ERROR } - | Types '*' { // Pointer type? + | Types OptAddrSpace '*' { // Pointer type? if (*$1 == Type::LabelTy) GEN_ERROR("Cannot form a pointer to a basic block"); - $$ = new PATypeHolder(HandleUpRefs(PointerType::get(*$1))); - delete $1; - CHECK_FOR_ERROR - } - | Types ADDRSPACE '(' EUINT64VAL ')' '*' { // Pointer type? - if (*$1 == Type::LabelTy) - GEN_ERROR("Cannot form a pointer to a basic block"); - $$ = new PATypeHolder(HandleUpRefs(PointerType::get(*$1, $4))); + $$ = new PATypeHolder(HandleUpRefs(PointerType::get(*$1, $2))); delete $1; CHECK_FOR_ERROR } @@ -2073,41 +2069,31 @@ } CHECK_FOR_ERROR } - | OptGlobalAssign GVVisibilityStyle ThreadLocal GlobalType ConstVal { + | OptGlobalAssign GVVisibilityStyle ThreadLocal GlobalType ConstVal + OptAddrSpace { /* "Externally Visible" Linkage */ if ($5 == 0) GEN_ERROR("Global value initializer is not a constant"); CurGV = ParseGlobalVariable($1, GlobalValue::ExternalLinkage, - $2, $4, $5->getType(), $5, $3); - CHECK_FOR_ERROR - } GlobalVarAttributes { - CurGV = 0; - } - | OptGlobalAssign GVVisibilityStyle ThreadLocal GlobalType ConstVal - ADDRSPACE '(' EUINT64VAL ')' { - /* "Externally Visible" Linkage with address space qualifier */ - if ($5 == 0) - GEN_ERROR("Global value initializer is not a constant"); - CurGV = ParseGlobalVariable($1, GlobalValue::ExternalLinkage, - $2, $4, $5->getType(), $5, $3, $8); + $2, $4, $5->getType(), $5, $3, $6); CHECK_FOR_ERROR } GlobalVarAttributes { CurGV = 0; } | OptGlobalAssign GVInternalLinkage GVVisibilityStyle ThreadLocal GlobalType - ConstVal { + ConstVal OptAddrSpace { if ($6 == 0) GEN_ERROR("Global value initializer is not a constant"); - CurGV = ParseGlobalVariable($1, $2, $3, $5, $6->getType(), $6, $4); + CurGV = ParseGlobalVariable($1, $2, $3, $5, $6->getType(), $6, $4, $7); CHECK_FOR_ERROR } GlobalVarAttributes { CurGV = 0; } | OptGlobalAssign GVExternalLinkage GVVisibilityStyle ThreadLocal GlobalType - Types { + Types OptAddrSpace { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*$6)->getDescription()); - CurGV = ParseGlobalVariable($1, $2, $3, $5, *$6, 0, $4); + CurGV = ParseGlobalVariable($1, $2, $3, $5, *$6, 0, $4, $7); CHECK_FOR_ERROR delete $6; } GlobalVarAttributes { Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=44933&r1=44932&r2=44933&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original) +++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Wed Dec 12 02:44:39 2007 @@ -141,6 +141,7 @@ Abbv->Add(BitCodeAbbrevOp(bitc::TYPE_CODE_POINTER)); Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, Log2_32_Ceil(VE.getTypes().size()+1))); + Abbv->Add(BitCodeAbbrevOp(0)); // Addrspace = 0 unsigned PtrAbbrev = Stream.EmitAbbrev(Abbv); // Abbrev for TYPE_CODE_FUNCTION. @@ -198,16 +199,14 @@ break; case Type::PointerTyID: { const PointerType *PTy = cast(T); - // POINTER: [pointee type] or [pointee type, address space] + // POINTER: [pointee type, address space] Code = bitc::TYPE_CODE_POINTER; TypeVals.push_back(VE.getTypeID(PTy->getElementType())); - if (unsigned AddressSpace = PTy->getAddressSpace()) - TypeVals.push_back(AddressSpace); - else - AbbrevToUse = PtrAbbrev; + unsigned AddressSpace = PTy->getAddressSpace(); + TypeVals.push_back(AddressSpace); + if (AddressSpace == 0) AbbrevToUse = PtrAbbrev; break; } - case Type::FunctionTyID: { const FunctionType *FT = cast(T); // FUNCTION: [isvararg, attrid, retty, paramty x N] Modified: llvm/trunk/test/Assembler/2007-12-11-AddressSpaces.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/2007-12-11-AddressSpaces.ll?rev=44933&r1=44932&r2=44933&view=diff ============================================================================== --- llvm/trunk/test/Assembler/2007-12-11-AddressSpaces.ll (original) +++ llvm/trunk/test/Assembler/2007-12-11-AddressSpaces.ll Wed Dec 12 02:44:39 2007 @@ -5,9 +5,9 @@ ; RUN: llvm-as < %s | llvm-dis |& grep {addrspace(22)} | count 5 %struct.mystruct = type { i32, i32 addrspace(33)*, i32, i32 addrspace(33)* } - at input = global %struct.mystruct zeroinitializer addrspace(42) ; <%struct.mystruct addrspace(42)*> [#uses=1] + at input = weak global %struct.mystruct zeroinitializer addrspace(42) ; <%struct.mystruct addrspace(42)*> [#uses=1] @output = global %struct.mystruct zeroinitializer addrspace(66) ; <%struct.mystruct addrspace(66)*> [#uses=1] - at y = global i32 addrspace(11)* addrspace(22)* null addrspace(33) ; [#uses=1] + at y = external global i32 addrspace(11)* addrspace(22)* addrspace(33) ; [#uses=1] define void @foo() { entry: From christopher.lamb at gmail.com Wed Dec 12 02:45:46 2007 From: christopher.lamb at gmail.com (Christopher Lamb) Date: Wed, 12 Dec 2007 08:45:46 -0000 Subject: [llvm-commits] [llvm] r44934 - in /llvm/trunk/lib/AsmParser: llvmAsmParser.cpp.cvs llvmAsmParser.y.cvs Message-ID: <200712120845.lBC8jkt6026934@zion.cs.uiuc.edu> Author: clamb Date: Wed Dec 12 02:45:45 2007 New Revision: 44934 URL: http://llvm.org/viewvc/llvm-project?rev=44934&view=rev Log: Regenerate. Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs?rev=44934&r1=44933&r2=44934&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs Wed Dec 12 02:45:45 2007 @@ -1149,7 +1149,7 @@ -#define YYFINAL 622 +#define YYFINAL 619 #define YYFLAG -32768 #define YYNTBASE 164 @@ -1159,10 +1159,10 @@ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 153, - 154, 152, 2, 151, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 150, + 151, 154, 2, 153, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 159, - 150, 160, 2, 2, 2, 2, 2, 2, 2, 2, + 152, 160, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 156, 155, 158, 2, 2, 2, 2, 2, 163, 2, @@ -1207,32 +1207,32 @@ 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, - 120, 122, 124, 126, 127, 130, 131, 133, 135, 137, - 138, 141, 143, 145, 147, 149, 151, 153, 155, 157, - 158, 160, 162, 164, 165, 167, 169, 170, 172, 174, - 176, 178, 179, 181, 183, 184, 186, 188, 190, 192, - 194, 197, 199, 201, 203, 205, 207, 209, 211, 213, - 215, 216, 219, 221, 223, 225, 227, 229, 231, 232, - 235, 236, 239, 240, 243, 244, 248, 251, 252, 254, - 255, 259, 261, 264, 266, 268, 270, 272, 274, 276, - 278, 280, 282, 285, 292, 294, 297, 303, 309, 315, - 321, 325, 328, 334, 339, 342, 344, 346, 348, 352, - 354, 358, 360, 361, 363, 367, 372, 376, 380, 385, - 390, 394, 401, 407, 410, 413, 416, 419, 422, 425, - 428, 431, 434, 437, 440, 443, 450, 456, 465, 472, - 479, 487, 495, 502, 511, 520, 524, 526, 528, 530, - 532, 533, 536, 543, 545, 546, 548, 551, 552, 556, - 557, 561, 565, 569, 573, 574, 582, 583, 595, 596, - 605, 606, 615, 621, 624, 628, 630, 634, 638, 642, - 646, 648, 649, 655, 659, 661, 665, 667, 668, 679, - 681, 683, 688, 690, 692, 695, 699, 700, 702, 704, - 706, 708, 710, 712, 714, 716, 718, 722, 724, 730, - 732, 734, 736, 738, 740, 742, 745, 748, 751, 755, - 758, 759, 761, 764, 767, 771, 781, 791, 800, 815, - 817, 819, 826, 832, 835, 842, 850, 855, 860, 867, - 874, 875, 876, 880, 883, 885, 891, 897, 904, 911, - 916, 923, 928, 933, 940, 947, 950, 959, 961, 963, - 964, 968, 975, 979, 986, 989, 995, 1003 + 120, 122, 124, 126, 127, 132, 133, 136, 137, 139, + 141, 143, 144, 147, 149, 151, 153, 155, 157, 159, + 161, 163, 164, 166, 168, 170, 171, 173, 175, 176, + 178, 180, 182, 184, 185, 187, 189, 190, 192, 194, + 196, 198, 200, 203, 205, 207, 209, 211, 213, 215, + 217, 219, 221, 222, 225, 227, 229, 231, 233, 235, + 237, 238, 241, 242, 245, 246, 249, 250, 254, 257, + 258, 260, 261, 265, 267, 270, 272, 274, 276, 278, + 280, 282, 284, 286, 288, 292, 294, 297, 303, 309, + 315, 321, 325, 328, 334, 339, 342, 344, 346, 348, + 352, 354, 358, 360, 361, 363, 367, 372, 376, 380, + 385, 390, 394, 401, 407, 410, 413, 416, 419, 422, + 425, 428, 431, 434, 437, 440, 443, 450, 456, 465, + 472, 479, 487, 495, 502, 511, 520, 524, 526, 528, + 530, 532, 533, 536, 543, 545, 546, 548, 551, 552, + 556, 557, 561, 565, 569, 573, 574, 583, 584, 594, + 595, 605, 611, 614, 618, 620, 624, 628, 632, 636, + 638, 639, 645, 649, 651, 655, 657, 658, 669, 671, + 673, 678, 680, 682, 685, 689, 690, 692, 694, 696, + 698, 700, 702, 704, 706, 708, 712, 714, 720, 722, + 724, 726, 728, 730, 732, 735, 738, 741, 745, 748, + 749, 751, 754, 757, 761, 771, 781, 790, 805, 807, + 809, 816, 822, 825, 832, 840, 845, 850, 857, 864, + 865, 866, 870, 873, 875, 881, 887, 894, 901, 906, + 913, 918, 923, 930, 937, 940, 949, 951, 953, 954, + 958, 965, 969, 976, 979, 985, 993 }; static const short yyrhs[] = { 74, @@ -1248,95 +1248,94 @@ 0, 110, 0, 97, 0, 98, 0, 99, 0, 100, 0, 26, 0, 27, 0, 11, 0, 12, 0, 13, 0, 16, 0, 15, 0, 14, 0, 19, 0, 22, - 0, 24, 0, 171, 0, 0, 171, 150, 0, 0, - 20, 0, 23, 0, 176, 0, 0, 174, 150, 0, - 42, 0, 44, 0, 43, 0, 45, 0, 47, 0, - 46, 0, 48, 0, 50, 0, 0, 147, 0, 148, - 0, 149, 0, 0, 46, 0, 48, 0, 0, 42, - 0, 43, 0, 44, 0, 47, 0, 0, 44, 0, - 42, 0, 0, 62, 0, 63, 0, 64, 0, 65, - 0, 66, 0, 61, 4, 0, 136, 0, 118, 0, - 135, 0, 119, 0, 138, 0, 139, 0, 141, 0, - 142, 0, 143, 0, 0, 185, 184, 0, 137, 0, - 140, 0, 136, 0, 135, 0, 144, 0, 145, 0, - 0, 187, 186, 0, 0, 146, 22, 0, 0, 53, - 4, 0, 0, 151, 53, 4, 0, 34, 22, 0, - 0, 191, 0, 0, 151, 194, 193, 0, 191, 0, - 53, 4, 0, 11, 0, 12, 0, 13, 0, 16, - 0, 15, 0, 14, 0, 17, 0, 49, 0, 195, - 0, 196, 152, 0, 196, 54, 153, 4, 154, 152, - 0, 231, 0, 155, 4, 0, 196, 153, 200, 154, - 187, 0, 10, 153, 200, 154, 187, 0, 156, 4, - 157, 196, 158, 0, 159, 4, 157, 196, 160, 0, - 161, 201, 162, 0, 161, 162, 0, 159, 161, 201, - 162, 160, 0, 159, 161, 162, 160, 0, 196, 185, - 0, 196, 0, 10, 0, 197, 0, 199, 151, 197, - 0, 199, 0, 199, 151, 39, 0, 39, 0, 0, - 196, 0, 201, 151, 196, 0, 196, 156, 204, 158, - 0, 196, 156, 158, 0, 196, 163, 22, 0, 196, - 159, 204, 160, 0, 196, 161, 204, 162, 0, 196, - 161, 162, 0, 196, 159, 161, 204, 162, 160, 0, - 196, 159, 161, 162, 160, 0, 196, 40, 0, 196, - 41, 0, 196, 231, 0, 196, 203, 0, 196, 25, + 0, 24, 0, 171, 0, 0, 54, 150, 4, 151, + 0, 0, 171, 152, 0, 0, 20, 0, 23, 0, + 177, 0, 0, 175, 152, 0, 42, 0, 44, 0, + 43, 0, 45, 0, 47, 0, 46, 0, 48, 0, + 50, 0, 0, 147, 0, 148, 0, 149, 0, 0, + 46, 0, 48, 0, 0, 42, 0, 43, 0, 44, + 0, 47, 0, 0, 44, 0, 42, 0, 0, 62, + 0, 63, 0, 64, 0, 65, 0, 66, 0, 61, + 4, 0, 136, 0, 118, 0, 135, 0, 119, 0, + 138, 0, 139, 0, 141, 0, 142, 0, 143, 0, + 0, 186, 185, 0, 137, 0, 140, 0, 136, 0, + 135, 0, 144, 0, 145, 0, 0, 188, 187, 0, + 0, 146, 22, 0, 0, 53, 4, 0, 0, 153, + 53, 4, 0, 34, 22, 0, 0, 192, 0, 0, + 153, 195, 194, 0, 192, 0, 53, 4, 0, 11, + 0, 12, 0, 13, 0, 16, 0, 15, 0, 14, + 0, 17, 0, 49, 0, 196, 0, 197, 173, 154, + 0, 231, 0, 155, 4, 0, 197, 150, 201, 151, + 188, 0, 10, 150, 201, 151, 188, 0, 156, 4, + 157, 197, 158, 0, 159, 4, 157, 197, 160, 0, + 161, 202, 162, 0, 161, 162, 0, 159, 161, 202, + 162, 160, 0, 159, 161, 162, 160, 0, 197, 186, + 0, 197, 0, 10, 0, 198, 0, 200, 153, 198, + 0, 200, 0, 200, 153, 39, 0, 39, 0, 0, + 197, 0, 202, 153, 197, 0, 197, 156, 205, 158, + 0, 197, 156, 158, 0, 197, 163, 22, 0, 197, + 159, 205, 160, 0, 197, 161, 205, 162, 0, 197, + 161, 162, 0, 197, 159, 161, 205, 162, 160, 0, + 197, 159, 161, 162, 160, 0, 197, 40, 0, 197, + 41, 0, 197, 231, 0, 197, 204, 0, 197, 25, 0, 169, 3, 0, 169, 5, 0, 169, 4, 0, 169, 6, 0, 11, 26, 0, 11, 27, 0, 170, - 9, 0, 166, 153, 202, 38, 196, 154, 0, 116, - 153, 202, 242, 154, 0, 130, 153, 202, 151, 202, - 151, 202, 154, 0, 164, 153, 202, 151, 202, 154, - 0, 165, 153, 202, 151, 202, 154, 0, 89, 167, - 153, 202, 151, 202, 154, 0, 90, 168, 153, 202, - 151, 202, 154, 0, 132, 153, 202, 151, 202, 154, - 0, 133, 153, 202, 151, 202, 151, 202, 154, 0, - 134, 153, 202, 151, 202, 151, 202, 154, 0, 204, - 151, 202, 0, 202, 0, 32, 0, 33, 0, 37, - 0, 0, 198, 231, 0, 122, 153, 207, 38, 196, - 154, 0, 209, 0, 0, 210, 0, 209, 210, 0, - 0, 31, 211, 227, 0, 0, 30, 212, 228, 0, - 59, 58, 217, 0, 173, 18, 196, 0, 173, 18, - 10, 0, 0, 175, 179, 206, 205, 202, 213, 193, - 0, 0, 175, 179, 206, 205, 202, 54, 153, 4, - 154, 214, 193, 0, 0, 175, 177, 179, 206, 205, - 202, 215, 193, 0, 0, 175, 178, 179, 206, 205, - 196, 216, 193, 0, 175, 179, 35, 182, 207, 0, - 51, 218, 0, 55, 150, 219, 0, 22, 0, 52, - 150, 22, 0, 67, 150, 22, 0, 156, 220, 158, - 0, 220, 151, 22, 0, 22, 0, 0, 221, 151, - 196, 185, 172, 0, 196, 185, 172, 0, 221, 0, - 221, 151, 39, 0, 39, 0, 0, 183, 198, 174, - 153, 222, 154, 187, 192, 189, 188, 0, 28, 0, - 161, 0, 181, 179, 223, 224, 0, 29, 0, 162, - 0, 234, 226, 0, 180, 179, 223, 0, 0, 60, + 9, 0, 166, 150, 203, 38, 197, 151, 0, 116, + 150, 203, 242, 151, 0, 130, 150, 203, 153, 203, + 153, 203, 151, 0, 164, 150, 203, 153, 203, 151, + 0, 165, 150, 203, 153, 203, 151, 0, 89, 167, + 150, 203, 153, 203, 151, 0, 90, 168, 150, 203, + 153, 203, 151, 0, 132, 150, 203, 153, 203, 151, + 0, 133, 150, 203, 153, 203, 153, 203, 151, 0, + 134, 150, 203, 153, 203, 153, 203, 151, 0, 205, + 153, 203, 0, 203, 0, 32, 0, 33, 0, 37, + 0, 0, 199, 231, 0, 122, 150, 208, 38, 197, + 151, 0, 210, 0, 0, 211, 0, 210, 211, 0, + 0, 31, 212, 227, 0, 0, 30, 213, 228, 0, + 59, 58, 217, 0, 174, 18, 197, 0, 174, 18, + 10, 0, 0, 176, 180, 207, 206, 203, 173, 214, + 194, 0, 0, 176, 178, 180, 207, 206, 203, 173, + 215, 194, 0, 0, 176, 179, 180, 207, 206, 197, + 173, 216, 194, 0, 176, 180, 35, 183, 208, 0, + 51, 218, 0, 55, 152, 219, 0, 22, 0, 52, + 152, 22, 0, 67, 152, 22, 0, 156, 220, 158, + 0, 220, 153, 22, 0, 22, 0, 0, 221, 153, + 197, 186, 172, 0, 197, 186, 172, 0, 221, 0, + 221, 153, 39, 0, 39, 0, 0, 184, 199, 175, + 150, 222, 151, 188, 193, 190, 189, 0, 28, 0, + 161, 0, 182, 180, 223, 224, 0, 29, 0, 162, + 0, 234, 226, 0, 181, 180, 223, 0, 0, 60, 0, 3, 0, 4, 0, 9, 0, 26, 0, 27, - 0, 40, 0, 41, 0, 25, 0, 159, 204, 160, - 0, 203, 0, 58, 229, 22, 151, 22, 0, 7, - 0, 8, 0, 171, 0, 174, 0, 231, 0, 230, - 0, 196, 232, 0, 234, 235, 0, 225, 235, 0, - 236, 173, 237, 0, 236, 239, 0, 0, 21, 0, + 0, 40, 0, 41, 0, 25, 0, 159, 205, 160, + 0, 204, 0, 58, 229, 22, 153, 22, 0, 7, + 0, 8, 0, 171, 0, 175, 0, 231, 0, 230, + 0, 197, 232, 0, 234, 235, 0, 225, 235, 0, + 236, 174, 237, 0, 236, 239, 0, 0, 21, 0, 68, 233, 0, 68, 10, 0, 69, 17, 232, 0, - 69, 11, 232, 151, 17, 232, 151, 17, 232, 0, - 70, 169, 232, 151, 17, 232, 156, 238, 158, 0, - 70, 169, 232, 151, 17, 232, 156, 158, 0, 71, - 183, 198, 232, 153, 241, 154, 187, 38, 17, 232, + 69, 11, 232, 153, 17, 232, 153, 17, 232, 0, + 70, 169, 232, 153, 17, 232, 156, 238, 158, 0, + 70, 169, 232, 153, 17, 232, 156, 158, 0, 71, + 184, 199, 232, 150, 241, 151, 188, 38, 17, 232, 72, 17, 232, 0, 72, 0, 73, 0, 238, 169, - 230, 151, 17, 232, 0, 169, 230, 151, 17, 232, - 0, 173, 244, 0, 196, 156, 232, 151, 232, 158, - 0, 240, 151, 156, 232, 151, 232, 158, 0, 196, - 185, 232, 185, 0, 17, 185, 232, 185, 0, 241, - 151, 196, 185, 232, 185, 0, 241, 151, 17, 185, - 232, 185, 0, 0, 0, 242, 151, 233, 0, 57, - 56, 0, 56, 0, 164, 196, 232, 151, 232, 0, - 165, 196, 232, 151, 232, 0, 89, 167, 196, 232, - 151, 232, 0, 90, 168, 196, 232, 151, 232, 0, - 166, 233, 38, 196, 0, 130, 233, 151, 233, 151, - 233, 0, 131, 233, 151, 196, 0, 132, 233, 151, - 233, 0, 133, 233, 151, 233, 151, 233, 0, 134, - 233, 151, 233, 151, 233, 0, 129, 240, 0, 243, - 183, 198, 232, 153, 241, 154, 187, 0, 246, 0, - 36, 0, 0, 111, 196, 190, 0, 111, 196, 151, - 11, 232, 190, 0, 112, 196, 190, 0, 112, 196, - 151, 11, 232, 190, 0, 113, 233, 0, 245, 114, - 196, 232, 190, 0, 245, 115, 233, 151, 196, 232, - 190, 0, 116, 196, 232, 242, 0 + 230, 153, 17, 232, 0, 169, 230, 153, 17, 232, + 0, 174, 244, 0, 197, 156, 232, 153, 232, 158, + 0, 240, 153, 156, 232, 153, 232, 158, 0, 197, + 186, 232, 186, 0, 17, 186, 232, 186, 0, 241, + 153, 197, 186, 232, 186, 0, 241, 153, 17, 186, + 232, 186, 0, 0, 0, 242, 153, 233, 0, 57, + 56, 0, 56, 0, 164, 197, 232, 153, 232, 0, + 165, 197, 232, 153, 232, 0, 89, 167, 197, 232, + 153, 232, 0, 90, 168, 197, 232, 153, 232, 0, + 166, 233, 38, 197, 0, 130, 233, 153, 233, 153, + 233, 0, 131, 233, 153, 197, 0, 132, 233, 153, + 233, 0, 133, 233, 153, 233, 153, 233, 0, 134, + 233, 153, 233, 153, 233, 0, 129, 240, 0, 243, + 184, 199, 232, 150, 241, 151, 188, 0, 246, 0, + 36, 0, 0, 111, 197, 191, 0, 111, 197, 153, + 11, 232, 191, 0, 112, 197, 191, 0, 112, 197, + 153, 11, 232, 191, 0, 113, 233, 0, 245, 114, + 197, 232, 191, 0, 245, 115, 233, 153, 197, 232, + 191, 0, 116, 197, 232, 242, 0 }; #endif @@ -1349,32 +1348,32 @@ 1114, 1115, 1115, 1116, 1116, 1117, 1117, 1121, 1121, 1122, 1122, 1123, 1123, 1124, 1124, 1125, 1125, 1126, 1126, 1127, 1127, 1128, 1129, 1134, 1135, 1135, 1135, 1135, 1135, 1137, - 1137, 1137, 1138, 1138, 1142, 1146, 1151, 1151, 1153, 1154, - 1159, 1165, 1166, 1167, 1168, 1169, 1173, 1174, 1175, 1179, - 1180, 1181, 1182, 1186, 1187, 1188, 1192, 1193, 1194, 1195, - 1196, 1200, 1201, 1202, 1205, 1205, 1206, 1207, 1208, 1209, - 1210, 1218, 1219, 1220, 1221, 1222, 1223, 1224, 1225, 1226, - 1229, 1230, 1235, 1236, 1237, 1238, 1239, 1240, 1243, 1244, - 1249, 1250, 1257, 1257, 1264, 1264, 1274, 1282, 1282, 1288, - 1288, 1290, 1295, 1308, 1308, 1308, 1308, 1308, 1308, 1308, - 1311, 1315, 1319, 1326, 1333, 1338, 1346, 1376, 1401, 1406, - 1416, 1426, 1430, 1440, 1447, 1456, 1463, 1468, 1473, 1480, - 1481, 1488, 1495, 1503, 1509, 1521, 1549, 1565, 1592, 1620, - 1646, 1666, 1692, 1712, 1724, 1731, 1797, 1807, 1817, 1823, - 1833, 1839, 1849, 1854, 1859, 1872, 1884, 1906, 1914, 1920, - 1931, 1936, 1941, 1947, 1953, 1962, 1966, 1974, 1974, 1977, - 1977, 1980, 1992, 2013, 2018, 2026, 2027, 2031, 2031, 2035, - 2035, 2038, 2041, 2065, 2076, 2083, 2086, 2094, 2097, 2103, - 2106, 2113, 2117, 2157, 2160, 2166, 2176, 2180, 2185, 2187, - 2192, 2197, 2206, 2216, 2227, 2231, 2240, 2249, 2254, 2388, - 2388, 2390, 2399, 2399, 2401, 2406, 2418, 2422, 2427, 2431, - 2435, 2439, 2443, 2447, 2451, 2455, 2459, 2484, 2488, 2498, - 2502, 2506, 2511, 2518, 2518, 2524, 2533, 2537, 2546, 2555, - 2564, 2568, 2575, 2579, 2583, 2588, 2598, 2617, 2626, 2710, - 2714, 2721, 2732, 2745, 2755, 2766, 2776, 2787, 2795, 2805, - 2812, 2815, 2816, 2823, 2827, 2832, 2848, 2865, 2879, 2893, - 2905, 2913, 2920, 2926, 2932, 2938, 2953, 3044, 3049, 3053, - 3060, 3067, 3075, 3082, 3090, 3098, 3112, 3129 + 1137, 1137, 1138, 1138, 1140, 1141, 1145, 1149, 1154, 1154, + 1156, 1157, 1162, 1168, 1169, 1170, 1171, 1172, 1176, 1177, + 1178, 1182, 1183, 1184, 1185, 1189, 1190, 1191, 1195, 1196, + 1197, 1198, 1199, 1203, 1204, 1205, 1208, 1208, 1209, 1210, + 1211, 1212, 1213, 1221, 1222, 1223, 1224, 1225, 1226, 1227, + 1228, 1229, 1232, 1233, 1238, 1239, 1240, 1241, 1242, 1243, + 1246, 1247, 1252, 1253, 1260, 1260, 1267, 1267, 1277, 1285, + 1285, 1291, 1291, 1293, 1298, 1311, 1311, 1311, 1311, 1311, + 1311, 1311, 1314, 1318, 1322, 1329, 1334, 1342, 1372, 1397, + 1402, 1412, 1422, 1426, 1436, 1443, 1452, 1459, 1464, 1469, + 1476, 1477, 1484, 1491, 1499, 1505, 1517, 1545, 1561, 1588, + 1616, 1642, 1662, 1688, 1708, 1720, 1727, 1793, 1803, 1813, + 1819, 1829, 1835, 1845, 1850, 1855, 1868, 1880, 1902, 1910, + 1916, 1927, 1932, 1937, 1943, 1949, 1958, 1962, 1970, 1970, + 1973, 1973, 1976, 1988, 2009, 2014, 2022, 2023, 2027, 2027, + 2031, 2031, 2034, 2037, 2061, 2072, 2080, 2083, 2089, 2092, + 2099, 2103, 2143, 2146, 2152, 2162, 2166, 2171, 2173, 2178, + 2183, 2192, 2202, 2213, 2217, 2226, 2235, 2240, 2374, 2374, + 2376, 2385, 2385, 2387, 2392, 2404, 2408, 2413, 2417, 2421, + 2425, 2429, 2433, 2437, 2441, 2445, 2470, 2474, 2484, 2488, + 2492, 2497, 2504, 2504, 2510, 2519, 2523, 2532, 2541, 2550, + 2554, 2561, 2565, 2569, 2574, 2584, 2603, 2612, 2696, 2700, + 2707, 2718, 2731, 2741, 2752, 2762, 2773, 2781, 2791, 2798, + 2801, 2802, 2809, 2813, 2818, 2834, 2851, 2865, 2879, 2891, + 2899, 2906, 2912, 2918, 2924, 2939, 3030, 3035, 3039, 3046, + 3053, 3061, 3068, 3076, 3084, 3098, 3115 }; #endif @@ -1399,21 +1398,21 @@ "FPTOUI","FPTOSI","INTTOPTR","PTRTOINT","PHI_TOK","SELECT","VAARG","EXTRACTELEMENT", "INSERTELEMENT","SHUFFLEVECTOR","SIGNEXT","ZEROEXT","NORETURN","INREG","SRET", "NOUNWIND","NOALIAS","BYVAL","NEST","READNONE","READONLY","GC","DEFAULT","HIDDEN", -"PROTECTED","'='","','","'*'","'('","')'","'\\\\'","'['","'x'","']'","'<'","'>'", +"PROTECTED","'('","')'","'='","','","'*'","'\\\\'","'['","'x'","']'","'<'","'>'", "'{'","'}'","'c'","ArithmeticOps","LogicalOps","CastOps","IPredicates","FPredicates", -"IntType","FPType","LocalName","OptLocalName","OptLocalAssign","GlobalName", -"OptGlobalAssign","GlobalAssign","GVInternalLinkage","GVExternalLinkage","GVVisibilityStyle", -"FunctionDeclareLinkage","FunctionDefineLinkage","AliasLinkage","OptCallingConv", -"ParamAttr","OptParamAttrs","FuncAttr","OptFuncAttrs","OptGC","OptAlign","OptCAlign", -"SectionString","OptSection","GlobalVarAttributes","GlobalVarAttribute","PrimType", -"Types","ArgType","ResultTypes","ArgTypeList","ArgTypeListI","TypeListI","ConstVal", -"ConstExpr","ConstVector","GlobalType","ThreadLocal","AliaseeRef","Module","DefinitionList", -"Definition","@1","@2","@3","@4","@5","@6","AsmBlock","TargetDefinition","LibrariesDefinition", -"LibList","ArgListH","ArgList","FunctionHeaderH","BEGIN","FunctionHeader","END", -"Function","FunctionProto","OptSideEffect","ConstValueRef","SymbolicValueRef", -"ValueRef","ResolvedVal","BasicBlockList","BasicBlock","InstructionList","BBTerminatorInst", -"JumpTable","Inst","PHIList","ParamList","IndexList","OptTailCall","InstVal", -"OptVolatile","MemoryInst", NULL +"IntType","FPType","LocalName","OptLocalName","OptAddrSpace","OptLocalAssign", +"GlobalName","OptGlobalAssign","GlobalAssign","GVInternalLinkage","GVExternalLinkage", +"GVVisibilityStyle","FunctionDeclareLinkage","FunctionDefineLinkage","AliasLinkage", +"OptCallingConv","ParamAttr","OptParamAttrs","FuncAttr","OptFuncAttrs","OptGC", +"OptAlign","OptCAlign","SectionString","OptSection","GlobalVarAttributes","GlobalVarAttribute", +"PrimType","Types","ArgType","ResultTypes","ArgTypeList","ArgTypeListI","TypeListI", +"ConstVal","ConstExpr","ConstVector","GlobalType","ThreadLocal","AliaseeRef", +"Module","DefinitionList","Definition","@1","@2","@3","@4","@5","AsmBlock","TargetDefinition", +"LibrariesDefinition","LibList","ArgListH","ArgList","FunctionHeaderH","BEGIN", +"FunctionHeader","END","Function","FunctionProto","OptSideEffect","ConstValueRef", +"SymbolicValueRef","ValueRef","ResolvedVal","BasicBlockList","BasicBlock","InstructionList", +"BBTerminatorInst","JumpTable","Inst","PHIList","ParamList","IndexList","OptTailCall", +"InstVal","OptVolatile","MemoryInst", NULL }; #endif @@ -1425,31 +1424,31 @@ 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 169, 170, 170, 170, 170, 170, 171, 171, 171, 172, 172, 173, 173, 174, 174, 175, 175, - 176, 177, 177, 177, 177, 177, 178, 178, 178, 179, - 179, 179, 179, 180, 180, 180, 181, 181, 181, 181, - 181, 182, 182, 182, 183, 183, 183, 183, 183, 183, - 183, 184, 184, 184, 184, 184, 184, 184, 184, 184, - 185, 185, 186, 186, 186, 186, 186, 186, 187, 187, - 188, 188, 189, 189, 190, 190, 191, 192, 192, 193, - 193, 194, 194, 195, 195, 195, 195, 195, 195, 195, - 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, - 196, 196, 196, 196, 197, 198, 198, 199, 199, 200, - 200, 200, 200, 201, 201, 202, 202, 202, 202, 202, - 202, 202, 202, 202, 202, 202, 202, 202, 202, 202, - 202, 202, 202, 202, 202, 203, 203, 203, 203, 203, - 203, 203, 203, 203, 203, 204, 204, 205, 205, 206, - 206, 207, 207, 208, 208, 209, 209, 211, 210, 212, - 210, 210, 210, 210, 213, 210, 214, 210, 215, 210, - 216, 210, 210, 210, 210, 217, 218, 218, 219, 220, - 220, 220, 221, 221, 222, 222, 222, 222, 223, 224, - 224, 225, 226, 226, 227, 228, 229, 229, 230, 230, - 230, 230, 230, 230, 230, 230, 230, 230, 230, 231, - 231, 231, 231, 232, 232, 233, 234, 234, 235, 236, - 236, 236, 237, 237, 237, 237, 237, 237, 237, 237, - 237, 238, 238, 239, 240, 240, 241, 241, 241, 241, - 241, 242, 242, 243, 243, 244, 244, 244, 244, 244, - 244, 244, 244, 244, 244, 244, 244, 244, 245, 245, - 246, 246, 246, 246, 246, 246, 246, 246 + 176, 176, 177, 178, 178, 178, 178, 178, 179, 179, + 179, 180, 180, 180, 180, 181, 181, 181, 182, 182, + 182, 182, 182, 183, 183, 183, 184, 184, 184, 184, + 184, 184, 184, 185, 185, 185, 185, 185, 185, 185, + 185, 185, 186, 186, 187, 187, 187, 187, 187, 187, + 188, 188, 189, 189, 190, 190, 191, 191, 192, 193, + 193, 194, 194, 195, 195, 196, 196, 196, 196, 196, + 196, 196, 197, 197, 197, 197, 197, 197, 197, 197, + 197, 197, 197, 197, 197, 198, 199, 199, 200, 200, + 201, 201, 201, 201, 202, 202, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, + 203, 203, 203, 203, 203, 203, 204, 204, 204, 204, + 204, 204, 204, 204, 204, 204, 205, 205, 206, 206, + 207, 207, 208, 208, 209, 209, 210, 210, 212, 211, + 213, 211, 211, 211, 211, 214, 211, 215, 211, 216, + 211, 211, 211, 211, 217, 218, 218, 219, 220, 220, + 220, 221, 221, 222, 222, 222, 222, 223, 224, 224, + 225, 226, 226, 227, 228, 229, 229, 230, 230, 230, + 230, 230, 230, 230, 230, 230, 230, 230, 231, 231, + 231, 231, 232, 232, 233, 234, 234, 235, 236, 236, + 236, 237, 237, 237, 237, 237, 237, 237, 237, 237, + 238, 238, 239, 240, 240, 241, 241, 241, 241, 241, + 242, 242, 243, 243, 244, 244, 244, 244, 244, 244, + 244, 244, 244, 244, 244, 244, 244, 245, 245, 246, + 246, 246, 246, 246, 246, 246, 246 }; static const short yyr2[] = { 0, @@ -1459,461 +1458,462 @@ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 0, 2, 0, 1, 1, 1, 0, - 2, 1, 1, 1, 1, 1, 1, 1, 1, 0, + 1, 1, 1, 0, 4, 0, 2, 0, 1, 1, + 1, 0, 2, 1, 1, 1, 1, 1, 1, 1, + 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, - 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, - 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 0, 2, 1, 1, 1, 1, 1, 1, 0, 2, - 0, 2, 0, 2, 0, 3, 2, 0, 1, 0, - 3, 1, 2, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 2, 6, 1, 2, 5, 5, 5, 5, - 3, 2, 5, 4, 2, 1, 1, 1, 3, 1, - 3, 1, 0, 1, 3, 4, 3, 3, 4, 4, - 3, 6, 5, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 6, 5, 8, 6, 6, - 7, 7, 6, 8, 8, 3, 1, 1, 1, 1, - 0, 2, 6, 1, 0, 1, 2, 0, 3, 0, - 3, 3, 3, 3, 0, 7, 0, 11, 0, 8, - 0, 8, 5, 2, 3, 1, 3, 3, 3, 3, - 1, 0, 5, 3, 1, 3, 1, 0, 10, 1, - 1, 4, 1, 1, 2, 3, 0, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 3, 1, 5, 1, - 1, 1, 1, 1, 1, 2, 2, 2, 3, 2, - 0, 1, 2, 2, 3, 9, 9, 8, 14, 1, - 1, 6, 5, 2, 6, 7, 4, 4, 6, 6, - 0, 0, 3, 2, 1, 5, 5, 6, 6, 4, - 6, 4, 4, 6, 6, 2, 8, 1, 1, 0, - 3, 6, 3, 6, 2, 5, 7, 4 + 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 0, 2, 1, 1, 1, 1, 1, 1, + 0, 2, 0, 2, 0, 2, 0, 3, 2, 0, + 1, 0, 3, 1, 2, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 3, 1, 2, 5, 5, 5, + 5, 3, 2, 5, 4, 2, 1, 1, 1, 3, + 1, 3, 1, 0, 1, 3, 4, 3, 3, 4, + 4, 3, 6, 5, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 6, 5, 8, 6, + 6, 7, 7, 6, 8, 8, 3, 1, 1, 1, + 1, 0, 2, 6, 1, 0, 1, 2, 0, 3, + 0, 3, 3, 3, 3, 0, 8, 0, 9, 0, + 9, 5, 2, 3, 1, 3, 3, 3, 3, 1, + 0, 5, 3, 1, 3, 1, 0, 10, 1, 1, + 4, 1, 1, 2, 3, 0, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 3, 1, 5, 1, 1, + 1, 1, 1, 1, 2, 2, 2, 3, 2, 0, + 1, 2, 2, 3, 9, 9, 8, 14, 1, 1, + 6, 5, 2, 6, 7, 4, 4, 6, 6, 0, + 0, 3, 2, 1, 5, 5, 6, 6, 4, 6, + 4, 4, 6, 6, 2, 8, 1, 1, 0, 3, + 6, 3, 6, 2, 5, 7, 4 }; -static const short yydefact[] = { 70, - 60, 67, 61, 68, 62, 210, 208, 0, 0, 0, - 0, 0, 0, 80, 69, 70, 206, 84, 87, 0, - 0, 224, 0, 0, 65, 0, 71, 72, 74, 73, - 75, 77, 76, 78, 79, 81, 82, 83, 80, 80, - 201, 207, 85, 86, 80, 211, 88, 89, 90, 91, - 80, 271, 209, 271, 0, 0, 232, 225, 226, 212, - 260, 261, 214, 134, 135, 136, 139, 138, 137, 140, - 141, 0, 0, 0, 0, 262, 263, 142, 213, 145, - 201, 201, 92, 200, 0, 95, 95, 272, 268, 66, - 243, 244, 245, 267, 227, 228, 231, 0, 163, 146, - 0, 0, 0, 0, 152, 164, 0, 0, 143, 163, - 0, 0, 94, 93, 0, 198, 199, 0, 0, 96, - 97, 98, 99, 100, 0, 246, 0, 310, 270, 0, - 229, 162, 111, 158, 160, 0, 0, 0, 0, 0, - 0, 151, 0, 0, 0, 0, 157, 0, 156, 0, - 223, 134, 135, 136, 139, 138, 137, 0, 0, 0, - 215, 101, 0, 240, 241, 242, 309, 295, 0, 0, - 0, 0, 95, 280, 281, 1, 2, 3, 4, 5, - 6, 7, 8, 9, 13, 14, 15, 10, 11, 12, - 0, 0, 0, 0, 0, 0, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 269, 95, 284, - 0, 308, 230, 155, 0, 119, 0, 0, 154, 0, - 165, 0, 119, 219, 221, 0, 202, 183, 184, 179, - 181, 180, 182, 185, 178, 174, 175, 0, 0, 0, +static const short yydefact[] = { 72, + 60, 69, 61, 70, 62, 211, 209, 0, 0, 0, + 0, 0, 0, 82, 71, 72, 207, 86, 89, 0, + 0, 223, 0, 0, 67, 0, 73, 74, 76, 75, + 77, 79, 78, 80, 81, 83, 84, 85, 82, 82, + 202, 208, 87, 88, 82, 212, 90, 91, 92, 93, + 82, 270, 210, 270, 0, 0, 231, 224, 225, 213, + 259, 260, 215, 136, 137, 138, 141, 140, 139, 142, + 143, 0, 0, 0, 0, 261, 262, 144, 214, 146, + 202, 202, 94, 201, 0, 97, 97, 271, 267, 68, + 242, 243, 244, 266, 226, 227, 230, 0, 164, 147, + 0, 0, 0, 0, 153, 165, 0, 0, 164, 0, + 0, 0, 96, 95, 0, 199, 200, 0, 0, 98, + 99, 100, 101, 102, 0, 245, 0, 309, 269, 0, + 228, 163, 113, 159, 161, 0, 0, 0, 0, 0, + 0, 152, 0, 0, 145, 0, 0, 158, 0, 157, + 0, 222, 136, 137, 138, 141, 140, 139, 0, 0, + 66, 66, 103, 0, 239, 240, 241, 308, 294, 0, + 0, 0, 0, 97, 279, 280, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 13, 14, 15, 10, 11, + 12, 0, 0, 0, 0, 0, 0, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 268, 97, + 283, 0, 307, 229, 156, 0, 121, 66, 66, 155, + 0, 166, 0, 121, 66, 66, 0, 203, 184, 185, + 180, 182, 181, 183, 186, 179, 175, 176, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 177, 176, 0, 130, 0, 294, 274, 0, 273, + 0, 0, 178, 177, 216, 0, 293, 273, 66, 272, 0, 0, 54, 0, 0, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 0, 52, 53, 48, 49, 50, 51, 38, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 0, 125, 125, 315, 0, 0, 306, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 103, 105, 104, 102, 106, 107, 108, 109, 110, 112, - 161, 159, 148, 149, 150, 153, 0, 147, 130, 130, - 0, 0, 0, 0, 0, 0, 0, 0, 167, 197, - 0, 0, 0, 171, 0, 168, 0, 0, 0, 0, - 0, 216, 238, 249, 250, 251, 256, 252, 253, 254, - 255, 247, 0, 258, 265, 264, 266, 0, 275, 0, - 0, 0, 0, 0, 311, 0, 313, 292, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 116, 115, 113, 114, 117, 118, 120, 144, 220, - 222, 0, 0, 0, 292, 0, 0, 0, 0, 0, - 166, 152, 164, 0, 169, 170, 0, 0, 0, 0, - 0, 0, 132, 130, 237, 111, 235, 0, 248, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 318, - 0, 0, 0, 302, 303, 0, 0, 0, 0, 300, - 0, 125, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 196, 173, 0, 0, 0, 0, 217, 127, 133, - 131, 64, 0, 119, 0, 257, 0, 0, 291, 0, - 0, 125, 126, 125, 0, 0, 0, 0, 0, 0, - 296, 297, 291, 0, 316, 0, 203, 0, 0, 187, - 0, 0, 0, 0, 172, 0, 0, 0, 130, 63, - 234, 236, 111, 128, 0, 0, 0, 111, 111, 0, - 298, 299, 312, 314, 293, 0, 0, 301, 304, 305, - 0, 125, 0, 0, 0, 193, 0, 0, 189, 190, - 186, 218, 64, 129, 123, 259, 0, 0, 0, 0, - 0, 119, 285, 0, 119, 317, 191, 192, 0, 0, - 0, 233, 0, 121, 0, 278, 0, 0, 103, 105, - 111, 111, 111, 111, 0, 286, 307, 188, 194, 195, - 124, 0, 239, 276, 0, 277, 0, 288, 287, 0, - 0, 0, 122, 0, 0, 111, 111, 0, 0, 0, - 290, 289, 0, 283, 0, 0, 282, 0, 279, 0, - 0, 0 + 46, 47, 0, 127, 127, 314, 66, 66, 305, 0, + 0, 0, 0, 0, 66, 66, 0, 0, 0, 0, + 105, 107, 106, 104, 108, 109, 110, 111, 112, 114, + 162, 160, 149, 150, 151, 154, 65, 148, 218, 220, + 0, 0, 0, 0, 0, 0, 0, 0, 168, 198, + 0, 0, 0, 172, 0, 169, 0, 0, 0, 132, + 237, 248, 249, 250, 255, 251, 252, 253, 254, 246, + 0, 257, 264, 263, 265, 0, 274, 0, 0, 66, + 66, 0, 310, 0, 312, 291, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 66, 0, 118, + 117, 115, 116, 119, 120, 122, 132, 132, 0, 0, + 0, 291, 0, 0, 0, 0, 0, 167, 153, 165, + 0, 170, 171, 0, 0, 0, 0, 217, 236, 113, + 234, 0, 247, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 317, 0, 0, 0, 301, 302, 0, + 0, 0, 0, 299, 0, 127, 0, 219, 221, 66, + 0, 0, 0, 0, 0, 0, 0, 197, 174, 0, + 0, 0, 0, 0, 0, 134, 132, 64, 0, 121, + 0, 256, 0, 0, 290, 0, 0, 127, 128, 127, + 0, 0, 0, 0, 0, 0, 295, 296, 290, 0, + 315, 66, 204, 0, 0, 188, 0, 0, 0, 0, + 173, 0, 0, 66, 129, 135, 133, 63, 233, 235, + 113, 130, 0, 0, 0, 113, 113, 0, 297, 298, + 311, 313, 292, 0, 0, 300, 303, 304, 0, 127, + 0, 0, 0, 194, 0, 0, 190, 191, 187, 64, + 131, 125, 258, 0, 0, 0, 0, 121, 0, 284, + 0, 121, 316, 192, 193, 0, 0, 0, 232, 0, + 123, 0, 277, 0, 0, 105, 107, 113, 113, 0, + 113, 113, 285, 306, 189, 195, 196, 126, 0, 238, + 275, 0, 276, 0, 287, 286, 0, 0, 0, 124, + 0, 0, 0, 113, 113, 0, 0, 0, 289, 288, + 282, 0, 0, 281, 0, 278, 0, 0, 0 }; -static const short yydefgoto[] = { 259, - 260, 261, 286, 303, 158, 159, 76, 521, 12, 77, - 14, 15, 39, 40, 41, 45, 51, 115, 125, 330, - 224, 408, 333, 593, 574, 385, 433, 555, 362, 434, - 78, 160, 134, 150, 135, 136, 107, 350, 374, 351, - 118, 85, 151, 620, 16, 17, 19, 18, 265, 519, - 339, 340, 60, 22, 58, 98, 437, 438, 126, 166, - 52, 93, 53, 46, 440, 375, 80, 377, 270, 54, - 89, 90, 218, 578, 129, 309, 530, 450, 219, 220, - 221, 222 +static const short yydefgoto[] = { 260, + 261, 262, 286, 303, 159, 160, 76, 519, 110, 12, + 77, 14, 15, 39, 40, 41, 45, 51, 115, 125, + 330, 225, 406, 333, 590, 571, 383, 476, 552, 428, + 477, 78, 161, 134, 151, 135, 136, 107, 350, 372, + 351, 118, 85, 152, 617, 16, 17, 19, 18, 360, + 407, 408, 60, 22, 58, 98, 431, 432, 126, 167, + 52, 93, 53, 46, 434, 373, 80, 375, 270, 54, + 89, 90, 219, 575, 129, 309, 528, 444, 220, 221, + 222, 223 }; -static const short yypact[] = { 37, --32768,-32768,-32768,-32768,-32768,-32768,-32768, 20, -137, -8, - -61, 79, -48, 496,-32768, 1067,-32768, 36, 61, -26, - 15,-32768, 2, 151,-32768, 1438,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 142, 142, - 161,-32768,-32768,-32768, 142,-32768,-32768,-32768,-32768,-32768, - 142, 185,-32768, 1, 188, 202, 221,-32768,-32768,-32768, --32768,-32768, 77,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768, 248, 252, 3, 505,-32768,-32768,-32768, 75,-32768, - 228, 228, 158,-32768, 83, 469, 469,-32768,-32768, 101, --32768,-32768,-32768,-32768,-32768,-32768,-32768, -106, 1280,-32768, - 119, 128, 566, 77,-32768, 75, -115, 129,-32768, 1280, - 83, 83,-32768,-32768, 1320,-32768,-32768, 1495, 288,-32768, --32768,-32768,-32768,-32768, 1553,-32768, -5, 1763,-32768, 271, --32768,-32768, 75,-32768, 146, 144, 1593, 1593, 139, -89, - 1593,-32768, 298, 152, 1495, 1593, 77, 155, 75, 296, --32768, 38, 301, 308, 313, 314, 316, 233, 318, 894, - 251,-32768, 230,-32768,-32768,-32768,-32768,-32768, 273, 1611, - 59, 319, 469,-32768,-32768,-32768,-32768,-32768,-32768,-32768, +static const short yypact[] = { 253, +-32768,-32768,-32768,-32768,-32768,-32768,-32768, -4, -114, -16, + -103, 46, -78, 12,-32768, 392,-32768, 149, 177, -44, + -31,-32768, -1, 154,-32768, 1529,-32768,-32768,-32768,-32768, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -37, -37, + 203,-32768,-32768,-32768, -37,-32768,-32768,-32768,-32768,-32768, + -37, 190,-32768, 2, 195, 217, 245,-32768,-32768,-32768, +-32768,-32768, 124,-32768,-32768,-32768,-32768,-32768,-32768,-32768, +-32768, 274, 278, 1, 505,-32768,-32768,-32768, 62,-32768, + 256, 256, 200,-32768, 119, 224, 224,-32768,-32768, 100, +-32768,-32768,-32768,-32768,-32768,-32768,-32768, 57, 1052,-32768, + 140, 148, 604, 124,-32768, 62, -69, 157, 1052, 155, + 119, 119,-32768,-32768, 1295,-32768,-32768, 1569, 306,-32768, +-32768,-32768,-32768,-32768, 1627,-32768, -17, 1851,-32768, 289, +-32768,-32768, 62,-32768, 163, 166, 1645, 1645, 158, -58, + 1645,-32768, 315, 171,-32768, 1569, 1645, 124, 170, 62, + 58,-32768, 41, 314, 318, 320, 321, 329, 226, 330, + 1107, 270,-32768, 30,-32768,-32768,-32768,-32768,-32768, 288, + 1685, 137, 336, 224,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - 317, 823, 1593, 1593, 1593, 1593,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 1593, 1593, - 1593, 1593, 1593, 1593, 1593, 1593, 1593,-32768, 469,-32768, - -4,-32768,-32768, 262, 1340,-32768, 26, -34,-32768, 171, - 75, 178,-32768,-32768, 75, 1320,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768, 317, 823, 181, - 189, 196, 197, 198, 125, 1651, 805, 332, 206, 207, - 211,-32768,-32768, 212, 187, 213,-32768, 77, 756,-32768, - 1055, 1055,-32768, 1055, 1553,-32768,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768, 1593,-32768,-32768,-32768,-32768, +-32768, 388, 781, 1645, 1645, 1645, 1645,-32768,-32768,-32768, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 1645, + 1645, 1645, 1645, 1645, 1645, 1645, 1645, 1645,-32768, 224, +-32768, 70,-32768,-32768, 207, 1374,-32768, -15, -14,-32768, + 197, 62, 208,-32768, 270, -13, 1295,-32768,-32768,-32768, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 388, 781, + 212, 213, 214, 220, 221, 1414, 1725, 782, 351, 228, + 229, 231,-32768,-32768,-32768, 232,-32768, 124, 696,-32768, + 834, 834,-32768, 834, 1627,-32768,-32768,-32768,-32768,-32768, +-32768,-32768,-32768,-32768,-32768, 1645,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768, 1593, 89, 121,-32768, 756, 73, 190, 210, - 222, 226, 235, 238, 756, 756, 334, 1553, 1593, 1593, +-32768,-32768, 1645, 15, 29,-32768, 696, 7, 205, 223, + 235, 236, 237, 238, 696, 696, 346, 1627, 1645, 1645, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768, 208,-32768,-32768,-32768, 239, 208, 187, 187, - 352, 240, 246, 1495, 1495, 1495, 1495, 1495,-32768,-32768, - -105, 845, -111,-32768, -85,-32768, 1495, 1495, 1495, 388, - 5,-32768, 1380,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768, 342, 1495,-32768,-32768,-32768,-32768, 255,-32768, 268, - 1055, 756, 756, 10,-32768, 18,-32768,-32768, 1055, 266, - 1593, 1593, 1593, 1593, 1593, 272, 277, 1593, 1055, 756, - 278,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768, 1593, 1495, 1495,-32768, 279, 280, 282, 285, 1495, --32768, 264, 894, -77,-32768,-32768, 291, 295, 411, 297, - 428, 448,-32768, 187,-32768, 75, 303, 304,-32768, 433, - -82, 439, 440, 307, 310, 311, 1055, 460, 1055, 315, - 321, 1055, 322, 75,-32768, 326, 327, 1055, 1055, 75, - 328, 329, 1593, 29, 333, 335, 103, 1495, 1495, 1495, - 1495,-32768,-32768, 309, 1495, 1495, 1593,-32768,-32768,-32768, --32768, 302, 1398,-32768, 336,-32768, 1055, 1055, 1669, 1055, - 1055, 329,-32768, 329, 1593, 1055, 339, 1593, 1593, 1593, --32768,-32768, 1669, 414,-32768, 756,-32768, 1495, 1495,-32768, - 340, 331, 344, 347,-32768, 345, 348, 67, 187,-32768, --32768,-32768, 75, 78, 446, 350, 349, 96, 75, 110, --32768,-32768,-32768,-32768,-32768, 312, 1055,-32768,-32768,-32768, - 124, 329, 353, 354, 1495,-32768, 1495, 1495,-32768,-32768, --32768,-32768, 302,-32768, 430,-32768, 487, -3, 615, 615, - 1709,-32768,-32768, 351,-32768,-32768,-32768,-32768, 360, 369, - 372,-32768, 532, 399, 1055,-32768, 1190, 8, 394, 395, --32768,-32768, 96, 75, 123,-32768, 208,-32768,-32768,-32768, --32768, 527,-32768,-32768, 400,-32768, 1190, 262, 262, 615, - 615, 533,-32768, 535, 404,-32768,-32768, 1055, 1055, 539, - 262, 262, 485,-32768, 1055, 542,-32768, 1055,-32768, 561, - 562,-32768 +-32768,-32768, 120,-32768,-32768,-32768,-32768, 120,-32768, 155, + 358, 248, 249, 1569, 1569, 1569, 1569, 1569,-32768,-32768, + 69, 1007, -61,-32768, -56,-32768, 1569, 1569, 1569, 251, + 1454,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 341, + 1569,-32768,-32768,-32768,-32768, 252,-32768, 255, 834, 696, + 696, 19,-32768, 23,-32768,-32768, 834, 246, 1645, 1645, + 1645, 1645, 1645, 260, 266, 1645, 834, 696, 271,-32768, +-32768,-32768,-32768,-32768,-32768,-32768, 251, 251, 1645, 1569, + 1569,-32768, 272, 275, 276, 277, 1569,-32768, 267, 962, + -55,-32768,-32768, 286, 291, 371, 18,-32768,-32768, 62, + 292, 280,-32768, 420, -57, 431, 433, 302, 300, 301, + 834, 453, 834, 305, 307, 834, 309, 62,-32768, 310, + 311, 834, 834, 62, 316, 312, 1645,-32768,-32768, -18, + 323, 324, 92, 1569, 1569, 1569, 1569,-32768,-32768, 299, + 1569, 1569, 1645, 446, 469,-32768, 251, 729, 1472,-32768, + 339,-32768, 834, 834, 1743, 834, 834, 312,-32768, 312, + 1645, 834, 340, 1645, 1645, 1645,-32768,-32768, 1743, 421, +-32768, 696,-32768, 1569, 1569,-32768, 342, 343, 344, 345, +-32768, 348, 349, 16,-32768,-32768,-32768,-32768,-32768,-32768, + 62, -6, 474, 350, 352, 64, 62, 101,-32768,-32768, +-32768,-32768,-32768, 347, 834,-32768,-32768,-32768, 115, 312, + 353, 356, 1569,-32768, 1569, 1569,-32768,-32768,-32768, 729, +-32768, 448,-32768, 485, -5, 555, 555,-32768, 1800,-32768, + 365,-32768,-32768,-32768,-32768, 363, 379, 380,-32768, 530, + 390, 834,-32768, 1246, -2, 359, 389,-32768,-32768, 5, + 64, 62,-32768, 120,-32768,-32768,-32768,-32768, 516,-32768, +-32768, 391,-32768, 1246, 207, 207, 524, 555, 555,-32768, + 525, 394, 834,-32768,-32768, 834, 526, 473, 207, 207, +-32768, 834, 531,-32768, 834,-32768, 551, 556,-32768 }; -static const short yypgoto[] = { 436, - 437, 438, 320, 323, -171,-32768, 0, 14, 481, 17, --32768,-32768,-32768,-32768, 55,-32768,-32768,-32768, -138,-32768, - -430,-32768, -229,-32768,-32768, -295, 51,-32768, -325,-32768, --32768, -24, 359, -107,-32768, 477, 488, -113, -157, -245, - 19, 135, 356,-32768,-32768, 577,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 507,-32768, --32768,-32768,-32768,-32768,-32768, -543, -112, 111, -186,-32768, - 541,-32768,-32768,-32768,-32768,-32768, 93, 182,-32768,-32768, +static const short yypgoto[] = { 427, + 437, 439, 319, 322, -172,-32768, 0, 11, -149, 480, + 10,-32768,-32768,-32768,-32768, 49,-32768,-32768,-32768, -147, +-32768, -401,-32768, -222,-32768,-32768, -281, 51,-32768, -375, +-32768,-32768, -24, 357, -117,-32768, 462, 481, -111, -157, + -243, 169, 210, 354,-32768,-32768, 560,-32768,-32768,-32768, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 498,-32768, +-32768,-32768,-32768,-32768,-32768, -557, -46, -66, -193,-32768, + 532,-32768,-32768,-32768,-32768,-32768, 88, 176,-32768,-32768, -32768,-32768 }; -#define YYLAST 1897 +#define YYLAST 1985 static const short yytable[] = { 11, - 274, 79, 262, 338, 161, 482, 102, 273, 306, 387, - 353, 355, 23, 410, 411, 11, 13, 163, 273, 108, - 447, 88, 164, 310, 311, 312, 313, 314, 449, 91, - 317, 234, 13, 595, 275, 141, -205, 237, 431, 420, - -54, -54, -54, -54, 130, 420, 142, 263, 425, 24, - 106, 131, 421, 605, -66, 1, 2, 432, 3, 4, - 5, 141, 448, 238, 239, 420, 6, 7, 420, 271, - 448, 20, 230, 420, 133, 272, 426, 486, 106, 108, - 318, 43, 108, 44, 474, 133, 21, 8, 25, 11, - 149, 9, 553, 81, 82, 10, 26, 559, 560, 86, - 149, 27, 47, 48, 49, 87, 424, 50, 481, 319, - 320, 431, 227, 228, 116, 117, 231, 109, 110, 1, - 108, 235, 3, 55, 5, 335, 108, 441, 108, 145, - 146, 61, 62, 401, 104, 152, 153, 154, 155, 156, - 157, 70, 108, 1, 2, 269, 3, 4, 5, -140, - 598, 599, 600, 601, 576, 165, 376, 57, 376, 376, - 602, 376, 92, 103, 56, 596, 505, 381, 304, 305, - 269, 307, 59, 71, 108, 611, 612, 109, 110, 266, - 109, 110, 507, 334, 308, 269, 269, 269, 269, 269, - 315, 316, 269, 552, 376, 83, 533, 84, 534, 113, - 133, 114, 376, 376, 453, 88, 455, 456, 457, 95, - 399, 149, 402, 403, 404, 111, 112, 405, 109, 110, - 551, 406, 407, 96, 109, 110, 109, 110, 389, 99, - 415, 416, 417, 418, 419, 240, 241, 242, 243, 384, - 109, 110, 97, 427, 428, 429, 566, -140, -140, 2, - 149, 100, 4, 495, 524, 101, 510, 402, 403, 404, - 561, 382, 405, 562, 84, 262, 406, 407, 376, 376, - 376, 386, 109, 110, 561, 137, 376, 565, 383, 72, - 73, 143, 349, 74, 138, 75, 376, 376, 36, 37, - 38, 162, 223, 149, 400, 269, 225, 226, 229, 465, - 466, 232, 61, 62, 264, 233, 472, 236, 535, -55, - 263, 538, 539, 540, 1, 2, -56, 3, 4, 5, - 1, -59, -58, 3, -57, 5, 244, 423, 267, 273, - 336, 337, 585, 344, 376, 587, 376, 361, 436, 376, - 390, 345, 402, 403, 404, 376, 376, 405, 346, 347, - 348, 406, 407, 356, 511, 512, 513, 514, 357, 358, - 391, 516, 517, 359, 360, 363, 269, 454, 269, 269, - 269, 398, 392, 460, 376, 376, 393, 376, 376, 321, - 322, 378, 379, 376, 380, 394, 577, 464, 395, 412, - 409, 430, 413, 376, 543, 544, 323, 324, 414, 325, - 326, 439, 327, 328, 329, 442, 597, 276, 277, 278, - 279, 280, 281, 282, 283, 284, 285, 388, 443, 321, - 322, 452, 458, 473, 376, 396, 397, 459, 463, 468, - 469, 569, 470, 570, 571, 471, 323, 324, 506, 325, - 326, 475, 327, 328, 329, 476, 376, 376, 477, 479, - 478, 480, 518, 483, 485, 487, 488, 484, 523, 489, - 490, 491, 376, 493, 529, 495, 448, 556, 515, 563, - 269, 496, 498, 269, 269, 269, 499, 500, 529, 504, - 503, 520, 573, 508, 546, 509, 525, 376, 376, 537, - 545, 444, 445, 446, 547, 376, 376, 548, 549, 451, - 557, 550, 376, 575, 558, 376, 567, 568, 586, 461, - 462, 61, 62, 588, 104, 64, 65, 66, 67, 68, - 69, 70, 589, 1, 2, 590, 3, 4, 5, 119, - 120, 121, 122, 123, 124, 591, 584, 28, 29, 30, - 31, 32, 33, 34, 592, 35, -17, -18, 603, 608, - 604, 609, 520, 71, 610, 615, 616, 492, 618, 494, - 621, 622, 497, 215, 216, 217, 572, 342, 501, 502, - 128, 343, 61, 62, 554, 104, 64, 65, 66, 67, - 68, 69, 70, 332, 1, 2, 144, 3, 4, 5, - 140, 341, 42, 127, 94, 541, 467, 526, 527, 0, - 531, 532, 0, 0, 0, 0, 536, 0, 0, 0, - 0, 0, 0, 0, 71, 0, 542, 364, 365, 0, - 0, 61, 62, 366, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 2, 0, 3, 4, 5, 367, - 368, 369, 36, 37, 38, 0, 0, 564, 0, 0, - 0, 0, 0, 0, 370, 371, 0, 0, 0, 72, - 73, 0, 0, 74, 0, 75, 105, 0, 0, 581, - 582, 0, 372, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 594, 0, 0, 176, 177, - 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 248, 249, 0, 0, 0, 0, 0, - 606, 607, 0, 0, 0, 0, 0, 0, 613, 614, - 72, 73, 0, 0, 74, 617, 75, 139, 619, 0, - 250, 197, 579, 580, 200, 201, 202, 203, 204, 205, - 206, 207, 208, 0, 251, 0, 252, 253, 254, 323, - 324, 0, 325, 326, 0, 327, 328, 329, 364, 365, - 0, 0, 61, 62, 366, 0, 0, 0, 0, 0, - 0, 0, 0, 373, 1, 2, 0, 3, 4, 5, - 367, 368, 369, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 370, 371, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 108, - 0, 61, 62, 372, 104, 152, 153, 154, 155, 156, - 157, 70, 0, 1, 2, 0, 3, 4, 5, 176, - 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, - 187, 188, 189, 190, 248, 249, 0, 0, 287, 288, - 0, 61, 62, 71, 104, 152, 153, 154, 155, 156, - 157, 70, 0, 1, 2, 0, 3, 4, 5, 0, - 0, 250, 197, 198, 199, 200, 201, 202, 203, 204, - 205, 206, 207, 208, 0, 251, 0, 252, 253, 254, - 0, 0, 0, 71, 0, 0, 0, 0, 0, 0, - 61, 62, 0, 0, 0, 0, 0, 109, 110, 0, - 0, 0, 1, 2, 373, 3, 4, 5, 245, 289, - 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, - 300, 301, 302, 246, 247, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 108, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 72, - 73, 0, 0, 74, 0, 75, 354, 176, 177, 178, - 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 248, 249, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 72, - 73, 0, 0, 74, 0, 75, 422, 0, 0, 250, - 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, - 207, 208, 0, 251, 0, 252, 253, 254, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 109, 110, 0, 0, 255, - 0, 0, 256, 0, 257, 0, 258, 364, 365, 0, - 0, 61, 62, 366, 0, 0, -204, 0, 0, 0, - 0, 0, 0, 1, 2, 0, 3, 4, 5, 367, - 368, 369, 0, 0, -66, 1, 2, 0, 3, 4, - 5, 0, 0, 0, 370, 371, 6, 7, 0, 0, + 274, 79, 306, 263, 102, 273, 162, 164, 273, 13, + 165, 338, 265, 353, 355, 11, 592, 310, 311, 312, + 313, 314, 88, 385, 317, 13, 275, 474, 478, 441, + 91, 458, 459, 443, 235, 108, 602, 23, 108, 108, + 108, 24, 597, -54, -54, -54, -54, 20, 25, 2, + 106, 474, 4, 28, 29, 30, 31, 32, 33, 34, + 108, 35, 21, 26, 61, 62, 239, 240, 108, 108, + 475, 442, 318, 27, 133, 442, 1, 2, 106, 3, + 4, 5, 108, 141, 133, 339, 340, 81, 82, 11, + 150, 417, 142, 86, 141, 417, 417, 417, 422, 87, + 150, 517, 482, 231, 238, 423, 470, 55, 421, 36, + 37, 38, 228, 229, 264, 108, 232, -142, 1, 550, + 56, 3, 236, 5, 556, 557, 399, 435, 400, 401, + 402, 109, 503, 403, 109, 109, 109, 404, 405, 400, + 401, 402, 334, 166, 403, 335, 269, 271, 404, 405, + 116, 117, 573, 272, 57, 593, 109, 379, 36, 37, + 38, 103, 387, 92, 109, 109, 549, 382, -66, 304, + 305, 269, 307, 266, 501, 59, 595, 596, 109, 598, + 599, 384, -66, 319, 320, 308, 269, 269, 269, 269, + 269, 315, 316, 269, 43, 447, 44, 449, 450, 451, + 397, 133, 609, 610, 376, 377, 531, 378, 532, 130, + 88, 109, 150, -142, 131, -66, 95, -142, 47, 48, + 49, 417, 374, 50, 374, 374, 418, 374, 241, 242, + 243, 244, 412, 413, 414, 415, 416, 83, 96, 84, + 386, 113, 506, 114, 491, 424, 425, 426, 394, 395, + 150, 558, -206, 559, 400, 401, 402, 522, 563, 403, + 374, 380, 263, 404, 405, 562, 97, 559, 374, 374, + -68, 1, 2, 99, 3, 4, 5, 100, 381, 146, + 147, 101, 6, 7, 119, 120, 121, 122, 123, 124, + 111, 112, 84, 150, 398, 269, 137, 533, 461, 462, + 536, 537, 538, 8, 138, 468, 143, 9, 145, 163, + 224, 10, 438, 439, 440, 226, 227, 230, 233, 237, + 445, 234, -55, 108, 321, 322, -56, 420, -59, -58, + 455, 456, 374, 374, 374, 580, 430, -57, 245, 584, + 374, 323, 324, 267, 325, 326, 273, 327, 328, 329, + 374, 374, 507, 508, 509, 510, 336, 388, 337, 512, + 513, 344, 345, 346, 269, 448, 269, 269, 269, 347, + 348, 454, 356, 264, 488, 389, 490, 357, 358, 493, + 359, 361, 574, 396, 460, 497, 498, 390, 391, 392, + 393, -205, 541, 542, 374, 409, 374, 410, 411, 374, + 433, 446, 594, 427, 436, 374, 374, 437, 473, -68, + 1, 2, 452, 3, 4, 5, 524, 525, 453, 529, + 530, 6, 7, 457, 464, 534, 469, 465, 466, 467, + 480, 566, 502, 567, 568, 540, 374, 374, 471, 374, + 374, 481, 8, 472, 479, 374, 9, 483, 514, 484, + 10, 485, 486, 487, 521, 374, 489, 491, 511, 492, + 527, 494, 495, 496, 500, 499, 269, 515, 561, 269, + 269, 269, 516, 442, 527, 504, 505, 518, 276, 277, + 278, 279, 280, 281, 282, 283, 284, 285, 374, 578, + 579, 523, 535, 544, 543, 553, 545, 546, 547, 548, + 570, 572, 554, 564, 560, 591, 565, 555, -17, 374, + 374, 61, 62, 585, 104, 64, 65, 66, 67, 68, + 69, 70, 583, 1, 2, 374, 3, 4, 5, 586, + 587, 604, 605, 588, 582, 589, 608, 600, -18, 611, + 603, 606, 612, 601, 613, 614, 607, 615, 616, 518, + 618, 374, 374, 71, 216, 619, 374, 362, 363, 374, + 569, 61, 62, 364, 217, 374, 218, 342, 374, 128, + 144, 343, 551, 1, 2, 42, 3, 4, 5, 365, + 366, 367, 332, 140, 127, 94, 539, 463, 0, 0, + 341, 0, 0, 0, 368, 369, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 372, 0, 0, 0, 0, 8, 0, 0, - 0, 9, 0, 0, 0, 10, 0, 0, 176, 177, + 61, 62, 370, 104, 64, 65, 66, 67, 68, 69, + 70, 0, 1, 2, 0, 3, 4, 5, 177, 178, + 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 249, 250, 0, 0, 0, 0, 0, + 0, 0, 71, 0, 0, 0, 0, 0, 0, 72, + 73, 0, 0, 74, 0, 75, 105, 0, 0, 0, + 251, 198, 576, 577, 201, 202, 203, 204, 205, 206, + 207, 208, 209, 0, 252, 0, 253, 254, 255, 323, + 324, 0, 325, 326, 0, 327, 328, 329, 362, 363, + 0, 0, 61, 62, 364, 0, 0, 0, 0, 0, + 0, 0, 0, 371, 1, 2, 0, 3, 4, 5, + 365, 366, 367, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 368, 369, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1, 0, 108, + 3, 0, 5, 370, 0, 0, 0, 0, 72, 73, + 0, 0, 74, 0, 75, 139, 0, 0, 0, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 248, 249, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 188, 189, 190, 191, 249, 250, 0, 0, 61, 62, + 0, 104, 153, 154, 155, 156, 157, 158, 70, 0, + 1, 2, 0, 3, 4, 5, 287, 288, 0, 0, + 0, 251, 198, 199, 200, 201, 202, 203, 204, 205, + 206, 207, 208, 209, 0, 252, 0, 253, 254, 255, + 71, 0, 0, 0, 0, 0, 362, 363, 0, 0, + 61, 62, 364, 0, 0, 109, 321, 322, 0, 0, + 0, 0, 1, 2, 371, 3, 4, 5, 365, 366, + 367, 0, 0, 323, 324, 0, 325, 326, 0, 327, + 328, 329, 0, 368, 369, 0, 0, 289, 290, 291, + 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, + 302, 370, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 177, 178, 179, + 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, + 190, 191, 249, 250, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 72, 73, 0, 0, + 74, 0, 75, 354, 0, 0, 0, 0, 0, 251, + 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, + 208, 209, 0, 252, 0, 253, 254, 255, 61, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 250, 197, 198, 199, 200, 201, 202, 203, 204, 205, - 206, 207, 208, 0, 251, 0, 252, 253, 254, 0, - 0, 0, 364, 365, 0, 0, 0, 0, 366, 0, + 1, 2, 0, 3, 4, 5, 246, 0, 0, 0, + 0, 0, 371, 0, 0, 0, 0, 0, 0, 0, + 0, 247, 248, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 61, 62, 108, 104, 153, 154, 155, + 156, 157, 158, 70, 0, 1, 2, 0, 3, 4, + 5, 0, 0, 0, 0, 177, 178, 179, 180, 181, + 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 249, 250, 0, 0, 0, 71, 0, 0, 61, 62, + 0, 104, 64, 65, 66, 67, 68, 69, 70, 0, + 1, 2, 0, 3, 4, 5, 0, 251, 198, 199, + 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, + 132, 252, 0, 253, 254, 255, 0, 0, 0, 0, + 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 109, 0, 61, 62, -66, 0, 256, 0, 0, + 257, 0, 258, 0, 259, 1, 2, 0, 3, 4, + 5, 246, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 247, 248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 373, 367, 368, 369, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 370, - 371, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 372, 0, 0, + 108, 72, 73, 0, 0, 74, 0, 75, 419, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 176, 177, 178, 179, 180, 181, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 248, 249, - 0, 0, 0, 0, 0, 0, 61, 62, 0, 104, - 64, 65, 66, 67, 68, 69, 70, 0, 1, 2, - 0, 3, 4, 5, 0, 250, 197, 198, 199, 200, - 201, 202, 203, 204, 205, 206, 207, 208, 132, 251, - 0, 252, 253, 254, 0, 0, 61, 62, 71, 147, - 64, 65, 66, 67, 68, 69, 70, 0, 1, 2, - 0, 3, 4, 5, 0, 0, 61, 62, 373, 104, - 64, 65, 66, 67, 68, 69, 70, 0, 1, 2, - 0, 3, 4, 5, 0, 0, 0, 0, 71, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 331, 0, - 0, 0, 0, 0, 0, 0, 61, 62, 71, 104, - 64, 65, 66, 67, 68, 69, 70, 0, 1, 2, - 0, 3, 4, 5, 61, 62, 0, 104, 64, 65, - 66, 67, 68, 69, 70, 0, 1, 2, 435, 3, - 4, 5, 0, 0, 0, 0, 0, 0, 71, 0, - 0, 0, 0, 0, 72, 73, 522, 0, 74, 0, - 75, 148, 0, 0, 61, 62, 71, 63, 64, 65, - 66, 67, 68, 69, 70, 0, 1, 2, 0, 3, - 4, 5, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 72, 73, 0, 0, 74, 0, - 75, 0, 0, 0, 0, 0, 71, 0, 0, 0, - 0, 0, 0, 0, 72, 73, 0, 0, 74, 0, - 75, 61, 62, 0, 104, 152, 153, 154, 155, 156, - 157, 70, 0, 1, 2, 0, 3, 4, 5, 0, + 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 249, 250, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 72, 73, 0, 0, + 74, 0, 75, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 251, 198, 199, 200, 201, 202, 203, 204, + 205, 206, 207, 208, 209, 0, 252, 0, 253, 254, + 255, 0, 0, 0, 0, 0, 0, 0, 362, 363, + 0, 0, 0, 0, 364, 0, 109, 0, 0, 0, + 0, 0, 256, 0, 0, 257, 0, 258, 0, 259, + 365, 366, 367, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 368, 369, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 72, 73, 0, 0, 74, 0, - 75, 0, 0, 71, 0, 0, 0, 0, 0, 0, - 0, 0, 72, 73, 0, 0, 74, 0, 75, 61, - 62, 0, 147, 64, 65, 66, 67, 68, 69, 70, - 0, 1, 2, 0, 3, 4, 5, 0, 0, 0, + 0, 61, 62, 370, 148, 64, 65, 66, 67, 68, + 69, 70, 0, 1, 2, 0, 3, 4, 5, 177, + 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, + 188, 189, 190, 191, 249, 250, 0, 0, 0, 0, + 0, 0, 0, 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 72, 73, 0, 0, 74, 0, 75, 61, - 62, 71, 104, 64, 65, 66, 67, 68, 69, 70, - 0, 1, 2, 0, 3, 4, 5, 61, 62, 0, - 268, 64, 65, 66, 67, 68, 69, 70, 0, 1, - 2, 0, 3, 4, 5, 0, 0, 0, 0, 0, - 0, 71, 0, 0, 0, 0, 0, 0, 0, 72, - 73, 0, 0, 74, 0, 75, 0, 61, 62, 71, - 104, 152, 153, 154, 155, 156, 157, 70, 0, 1, - 2, 0, 3, 4, 5, 61, 62, 0, 104, 64, - 65, 66, 67, 68, 69, 528, 0, 1, 2, 0, - 3, 4, 5, 0, 0, 0, 0, 0, 0, 71, - 0, 0, 0, 0, 0, 0, 0, 72, 73, 0, - 0, 74, 0, 75, 0, 61, 62, 71, 104, 64, - 65, 66, 67, 68, 69, 583, 0, 1, 2, 0, + 0, 251, 198, 199, 200, 201, 202, 203, 204, 205, + 206, 207, 208, 209, 0, 252, 0, 253, 254, 255, + 61, 62, 0, 104, 64, 65, 66, 67, 68, 69, + 70, 0, 1, 2, 0, 3, 4, 5, 0, 0, + 0, 0, 0, 0, 371, 0, 0, 0, 0, 0, + 0, 0, 331, 0, 0, 0, 149, 0, 0, 0, + 61, 62, 71, 104, 153, 154, 155, 156, 157, 158, + 70, 0, 1, 2, 0, 3, 4, 5, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 72, + 73, 0, 0, 74, 0, 75, 0, 0, 0, 0, + 61, 62, 71, 104, 64, 65, 66, 67, 68, 69, + 70, 0, 1, 2, 0, 3, 4, 5, 61, 62, + 0, 104, 64, 65, 66, 67, 68, 69, 70, 0, + 1, 2, 429, 3, 4, 5, 0, 0, 0, 0, + 0, 0, 71, 0, 0, 0, 0, 0, 0, 0, + 520, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 71, 0, 0, 0, 0, 0, 0, 0, 72, 73, + 0, 0, 74, 0, 75, 61, 62, 0, 63, 64, + 65, 66, 67, 68, 69, 70, 0, 1, 2, 0, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 72, 73, 0, - 0, 74, 0, 75, 0, 0, 0, 71, 0, 0, - 0, 0, 0, 0, 0, 72, 73, 0, 0, 74, - 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 167, 0, - 0, 0, 0, 0, 0, 72, 73, 0, 0, 74, - 0, 352, 0, 0, 0, 0, 0, 0, 168, 169, + 0, 0, 0, 0, 0, 0, 0, 0, 72, 73, + 0, 349, 74, 0, 75, 61, 62, 71, 104, 153, + 154, 155, 156, 157, 158, 70, 0, 1, 2, 0, + 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 72, 73, + 0, 0, 74, 0, 75, 0, 0, 71, 0, 0, + 0, 0, 0, 0, 0, 0, 72, 73, 0, 0, + 74, 0, 75, 61, 62, 0, 148, 64, 65, 66, + 67, 68, 69, 70, 0, 1, 2, 0, 3, 4, + 5, 61, 62, 0, 104, 64, 65, 66, 67, 68, + 69, 70, 0, 1, 2, 0, 3, 4, 5, 0, + 0, 0, 0, 0, 0, 71, 0, 0, 0, 0, 0, 0, 0, 72, 73, 0, 0, 74, 0, 75, - 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, - 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 192, 0, 0, 0, 0, 0, 0, 0, + 0, 61, 62, 71, 268, 64, 65, 66, 67, 68, + 69, 70, 0, 1, 2, 0, 3, 4, 5, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 72, 73, 0, 0, 74, 0, 75, - 0, 0, 0, 193, 194, 195, 0, 0, 196, 197, - 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 211, 212, 213, 214 + 0, 61, 62, 71, 104, 153, 154, 155, 156, 157, + 158, 70, 0, 1, 2, 0, 3, 4, 5, 61, + 62, 0, 104, 64, 65, 66, 67, 68, 69, 526, + 0, 1, 2, 0, 3, 4, 5, 0, 0, 0, + 0, 0, 0, 71, 0, 0, 0, 0, 0, 0, + 0, 72, 73, 0, 0, 74, 0, 75, 0, 0, + 0, 71, 0, 0, 0, 0, 0, 0, 0, 72, + 73, 0, 0, 74, 0, 75, 61, 62, 0, 104, + 64, 65, 66, 67, 68, 69, 581, 0, 1, 2, + 0, 3, 4, 5, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 72, + 73, 0, 0, 74, 0, 75, 0, 0, 71, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 72, + 73, 0, 0, 74, 0, 352, 168, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 72, 73, 0, + 0, 74, 0, 75, 0, 0, 169, 170, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 171, 172, + 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, + 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, + 193, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 72, 73, 0, 0, 74, 0, + 75, 194, 195, 196, 0, 0, 197, 198, 199, 200, + 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, + 211, 212, 213, 214, 215 }; static const short yycheck[] = { 0, - 172, 26, 160, 233, 118, 436, 4, 11, 195, 305, - 256, 257, 150, 339, 340, 16, 0, 125, 11, 54, - 11, 21, 28, 210, 211, 212, 213, 214, 11, 29, - 217, 145, 16, 577, 173, 151, 0, 150, 34, 151, - 3, 4, 5, 6, 151, 151, 162, 160, 160, 58, - 75, 158, 158, 597, 18, 19, 20, 53, 22, 23, - 24, 151, 53, 26, 27, 151, 30, 31, 151, 11, - 53, 52, 162, 151, 99, 17, 162, 160, 103, 54, - 219, 46, 54, 48, 162, 110, 67, 51, 150, 90, - 115, 55, 523, 39, 40, 59, 18, 528, 529, 45, - 125, 150, 42, 43, 44, 51, 352, 47, 434, 114, - 115, 34, 137, 138, 32, 33, 141, 152, 153, 19, - 54, 146, 22, 150, 24, 160, 54, 373, 54, 111, - 112, 7, 8, 320, 10, 11, 12, 13, 14, 15, - 16, 17, 54, 19, 20, 170, 22, 23, 24, 54, - 581, 582, 583, 584, 158, 161, 269, 156, 271, 272, - 38, 274, 162, 161, 150, 158, 462, 275, 193, 194, - 195, 196, 22, 49, 54, 606, 607, 152, 153, 163, - 152, 153, 154, 158, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 519, 307, 35, 492, 37, 494, 42, - 225, 44, 315, 316, 391, 21, 393, 394, 395, 22, - 318, 236, 135, 136, 137, 81, 82, 140, 152, 153, - 154, 144, 145, 22, 152, 153, 152, 153, 156, 153, - 344, 345, 346, 347, 348, 3, 4, 5, 6, 151, - 152, 153, 22, 357, 358, 359, 542, 152, 153, 20, - 275, 4, 23, 151, 484, 4, 154, 135, 136, 137, - 151, 286, 140, 154, 37, 423, 144, 145, 381, 382, - 383, 151, 152, 153, 151, 157, 389, 154, 303, 155, - 156, 153, 158, 159, 157, 161, 399, 400, 147, 148, - 149, 4, 22, 318, 319, 320, 151, 154, 160, 413, - 414, 4, 7, 8, 54, 154, 420, 153, 495, 9, - 423, 498, 499, 500, 19, 20, 9, 22, 23, 24, - 19, 9, 9, 22, 9, 24, 9, 352, 56, 11, - 160, 154, 562, 153, 447, 565, 449, 151, 363, 452, - 151, 153, 135, 136, 137, 458, 459, 140, 153, 153, - 153, 144, 145, 22, 468, 469, 470, 471, 153, 153, - 151, 475, 476, 153, 153, 153, 391, 392, 393, 394, - 395, 38, 151, 398, 487, 488, 151, 490, 491, 118, - 119, 271, 272, 496, 274, 151, 558, 412, 151, 38, - 152, 4, 153, 506, 508, 509, 135, 136, 153, 138, - 139, 60, 141, 142, 143, 151, 578, 91, 92, 93, - 94, 95, 96, 97, 98, 99, 100, 307, 151, 118, - 119, 156, 151, 160, 537, 315, 316, 151, 151, 151, - 151, 545, 151, 547, 548, 151, 135, 136, 463, 138, - 139, 151, 141, 142, 143, 151, 559, 560, 38, 22, - 154, 4, 477, 151, 22, 17, 17, 154, 483, 153, - 151, 151, 575, 4, 489, 151, 53, 22, 160, 158, - 495, 151, 151, 498, 499, 500, 151, 151, 503, 151, - 153, 482, 53, 151, 154, 151, 151, 600, 601, 151, - 151, 381, 382, 383, 151, 608, 609, 151, 154, 389, - 151, 154, 615, 17, 156, 618, 154, 154, 158, 399, - 400, 7, 8, 154, 10, 11, 12, 13, 14, 15, - 16, 17, 154, 19, 20, 154, 22, 23, 24, 61, - 62, 63, 64, 65, 66, 4, 561, 42, 43, 44, - 45, 46, 47, 48, 146, 50, 153, 153, 22, 17, - 151, 17, 553, 49, 151, 17, 72, 447, 17, 449, - 0, 0, 452, 128, 128, 128, 553, 248, 458, 459, - 90, 249, 7, 8, 524, 10, 11, 12, 13, 14, - 15, 16, 17, 225, 19, 20, 110, 22, 23, 24, - 103, 236, 16, 87, 54, 503, 415, 487, 488, -1, - 490, 491, -1, -1, -1, -1, 496, -1, -1, -1, - -1, -1, -1, -1, 49, -1, 506, 3, 4, -1, - -1, 7, 8, 9, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 19, 20, -1, 22, 23, 24, 25, - 26, 27, 147, 148, 149, -1, -1, 537, -1, -1, - -1, -1, -1, -1, 40, 41, -1, -1, -1, 155, - 156, -1, -1, 159, -1, 161, 162, -1, -1, 559, - 560, -1, 58, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 575, -1, -1, 74, 75, + 173, 26, 196, 161, 4, 11, 118, 125, 11, 0, + 28, 234, 162, 257, 258, 16, 574, 211, 212, 213, + 214, 215, 21, 305, 218, 16, 174, 34, 430, 11, + 29, 407, 408, 11, 146, 54, 594, 152, 54, 54, + 54, 58, 38, 3, 4, 5, 6, 52, 152, 20, + 75, 34, 23, 42, 43, 44, 45, 46, 47, 48, + 54, 50, 67, 18, 7, 8, 26, 27, 54, 54, + 53, 53, 220, 152, 99, 53, 19, 20, 103, 22, + 23, 24, 54, 153, 109, 235, 236, 39, 40, 90, + 115, 153, 162, 45, 153, 153, 153, 153, 160, 51, + 125, 477, 160, 162, 151, 162, 162, 152, 352, 147, + 148, 149, 137, 138, 161, 54, 141, 54, 19, 521, + 152, 22, 147, 24, 526, 527, 320, 371, 135, 136, + 137, 150, 151, 140, 150, 150, 150, 144, 145, 135, + 136, 137, 158, 161, 140, 160, 171, 11, 144, 145, + 32, 33, 158, 17, 156, 158, 150, 275, 147, 148, + 149, 161, 156, 162, 150, 150, 151, 153, 154, 194, + 195, 196, 197, 164, 456, 22, 578, 579, 150, 581, + 582, 153, 154, 114, 115, 210, 211, 212, 213, 214, + 215, 216, 217, 218, 46, 389, 48, 391, 392, 393, + 318, 226, 604, 605, 271, 272, 488, 274, 490, 153, + 21, 150, 237, 150, 158, 154, 22, 154, 42, 43, + 44, 153, 269, 47, 271, 272, 158, 274, 3, 4, + 5, 6, 344, 345, 346, 347, 348, 35, 22, 37, + 307, 42, 151, 44, 153, 357, 358, 359, 315, 316, + 275, 151, 0, 153, 135, 136, 137, 480, 540, 140, + 307, 286, 420, 144, 145, 151, 22, 153, 315, 316, + 18, 19, 20, 150, 22, 23, 24, 4, 303, 111, + 112, 4, 30, 31, 61, 62, 63, 64, 65, 66, + 81, 82, 37, 318, 319, 320, 157, 491, 410, 411, + 494, 495, 496, 51, 157, 417, 150, 55, 154, 4, + 22, 59, 379, 380, 381, 153, 151, 160, 4, 150, + 387, 151, 9, 54, 118, 119, 9, 352, 9, 9, + 397, 398, 379, 380, 381, 558, 361, 9, 9, 562, + 387, 135, 136, 56, 138, 139, 11, 141, 142, 143, + 397, 398, 464, 465, 466, 467, 160, 153, 151, 471, + 472, 150, 150, 150, 389, 390, 391, 392, 393, 150, + 150, 396, 22, 420, 441, 153, 443, 150, 150, 446, + 150, 150, 555, 38, 409, 452, 453, 153, 153, 153, + 153, 0, 504, 505, 441, 38, 443, 150, 150, 446, + 60, 156, 575, 153, 153, 452, 453, 153, 38, 18, + 19, 20, 153, 22, 23, 24, 483, 484, 153, 486, + 487, 30, 31, 153, 153, 492, 160, 153, 153, 153, + 151, 543, 457, 545, 546, 502, 483, 484, 153, 486, + 487, 22, 51, 153, 153, 492, 55, 17, 473, 17, + 59, 150, 153, 153, 479, 502, 4, 153, 160, 153, + 485, 153, 153, 153, 153, 150, 491, 22, 535, 494, + 495, 496, 4, 53, 499, 153, 153, 478, 91, 92, + 93, 94, 95, 96, 97, 98, 99, 100, 535, 556, + 557, 153, 153, 151, 153, 22, 153, 153, 151, 151, + 53, 17, 153, 151, 158, 572, 151, 156, 150, 556, + 557, 7, 8, 151, 10, 11, 12, 13, 14, 15, + 16, 17, 158, 19, 20, 572, 22, 23, 24, 151, + 151, 598, 599, 4, 559, 146, 603, 22, 150, 606, + 17, 17, 17, 153, 72, 612, 153, 17, 615, 550, + 0, 598, 599, 49, 128, 0, 603, 3, 4, 606, + 550, 7, 8, 9, 128, 612, 128, 249, 615, 90, + 109, 250, 522, 19, 20, 16, 22, 23, 24, 25, + 26, 27, 226, 103, 87, 54, 499, 412, -1, -1, + 237, -1, -1, -1, 40, 41, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 7, 8, 58, 10, 11, 12, 13, 14, 15, 16, + 17, -1, 19, 20, -1, 22, 23, 24, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, -1, -1, -1, -1, -1, - 600, 601, -1, -1, -1, -1, -1, -1, 608, 609, - 155, 156, -1, -1, 159, 615, 161, 162, 618, -1, + -1, -1, 49, -1, -1, -1, -1, -1, -1, 155, + 156, -1, -1, 159, -1, 161, 162, -1, -1, -1, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, -1, 130, -1, 132, 133, 134, 135, 136, -1, 138, 139, -1, 141, 142, 143, 3, 4, @@ -1921,116 +1921,131 @@ -1, -1, -1, 159, 19, 20, -1, 22, 23, 24, 25, 26, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, 41, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 54, - -1, 7, 8, 58, 10, 11, 12, 13, 14, 15, - 16, 17, -1, 19, 20, -1, 22, 23, 24, 74, + -1, -1, -1, -1, -1, -1, -1, 19, -1, 54, + 22, -1, 24, 58, -1, -1, -1, -1, 155, 156, + -1, -1, 159, -1, 161, 162, -1, -1, -1, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, -1, -1, 26, 27, - -1, 7, 8, 49, 10, 11, 12, 13, 14, 15, - 16, 17, -1, 19, 20, -1, 22, 23, 24, -1, + 85, 86, 87, 88, 89, 90, -1, -1, 7, 8, + -1, 10, 11, 12, 13, 14, 15, 16, 17, -1, + 19, 20, -1, 22, 23, 24, 26, 27, -1, -1, -1, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, -1, 130, -1, 132, 133, 134, - -1, -1, -1, 49, -1, -1, -1, -1, -1, -1, - 7, 8, -1, -1, -1, -1, -1, 152, 153, -1, - -1, -1, 19, 20, 159, 22, 23, 24, 25, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 40, 41, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 54, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 155, - 156, -1, -1, 159, -1, 161, 162, 74, 75, 76, + 49, -1, -1, -1, -1, -1, 3, 4, -1, -1, + 7, 8, 9, -1, -1, 150, 118, 119, -1, -1, + -1, -1, 19, 20, 159, 22, 23, 24, 25, 26, + 27, -1, -1, 135, 136, -1, 138, 139, -1, 141, + 142, 143, -1, 40, 41, -1, -1, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 58, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 155, - 156, -1, -1, 159, -1, 161, 162, -1, -1, 116, + -1, -1, -1, -1, -1, -1, 155, 156, -1, -1, + 159, -1, 161, 162, -1, -1, -1, -1, -1, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, - 127, 128, -1, 130, -1, 132, 133, 134, -1, -1, + 127, 128, -1, 130, -1, 132, 133, 134, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 152, 153, -1, -1, 156, - -1, -1, 159, -1, 161, -1, 163, 3, 4, -1, - -1, 7, 8, 9, -1, -1, 0, -1, -1, -1, - -1, -1, -1, 19, 20, -1, 22, 23, 24, 25, - 26, 27, -1, -1, 18, 19, 20, -1, 22, 23, - 24, -1, -1, -1, 40, 41, 30, 31, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 58, -1, -1, -1, -1, 51, -1, -1, - -1, 55, -1, -1, -1, 59, -1, -1, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - 86, 87, 88, 89, 90, -1, -1, -1, -1, -1, + 19, 20, -1, 22, 23, 24, 25, -1, -1, -1, + -1, -1, 159, -1, -1, -1, -1, -1, -1, -1, + -1, 40, 41, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 7, 8, 54, 10, 11, 12, 13, + 14, 15, 16, 17, -1, 19, 20, -1, 22, 23, + 24, -1, -1, -1, -1, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, -1, -1, -1, 49, -1, -1, 7, 8, + -1, 10, 11, 12, 13, 14, 15, 16, 17, -1, + 19, 20, -1, 22, 23, 24, -1, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, + 39, 130, -1, 132, 133, 134, -1, -1, -1, -1, + 49, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 150, -1, 7, 8, 154, -1, 156, -1, -1, + 159, -1, 161, -1, 163, 19, 20, -1, 22, 23, + 24, 25, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 40, 41, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 54, 155, 156, -1, -1, 159, -1, 161, 162, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, - 126, 127, 128, -1, 130, -1, 132, 133, 134, -1, - -1, -1, 3, 4, -1, -1, -1, -1, 9, -1, + 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 86, 87, 88, 89, 90, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 155, 156, -1, -1, + 159, -1, 161, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 116, 117, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 127, 128, -1, 130, -1, 132, 133, + 134, -1, -1, -1, -1, -1, -1, -1, 3, 4, + -1, -1, -1, -1, 9, -1, 150, -1, -1, -1, + -1, -1, 156, -1, -1, 159, -1, 161, -1, 163, + 25, 26, 27, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 40, 41, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 159, 25, 26, 27, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, - 41, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 58, -1, -1, + -1, 7, 8, 58, 10, 11, 12, 13, 14, 15, + 16, 17, -1, 19, 20, -1, 22, 23, 24, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 90, -1, -1, -1, -1, + -1, -1, -1, 49, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 74, 75, 76, 77, 78, 79, 80, - 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, - -1, -1, -1, -1, -1, -1, 7, 8, -1, 10, - 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, - -1, 22, 23, 24, -1, 116, 117, 118, 119, 120, - 121, 122, 123, 124, 125, 126, 127, 128, 39, 130, - -1, 132, 133, 134, -1, -1, 7, 8, 49, 10, - 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, - -1, 22, 23, 24, -1, -1, 7, 8, 159, 10, - 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, - -1, 22, 23, 24, -1, -1, -1, -1, 49, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 39, -1, - -1, -1, -1, -1, -1, -1, 7, 8, 49, 10, - 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, - -1, 22, 23, 24, 7, 8, -1, 10, 11, 12, - 13, 14, 15, 16, 17, -1, 19, 20, 39, 22, - 23, 24, -1, -1, -1, -1, -1, -1, 49, -1, - -1, -1, -1, -1, 155, 156, 39, -1, 159, -1, - 161, 122, -1, -1, 7, 8, 49, 10, 11, 12, - 13, 14, 15, 16, 17, -1, 19, 20, -1, 22, - 23, 24, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 155, 156, -1, -1, 159, -1, - 161, -1, -1, -1, -1, -1, 49, -1, -1, -1, - -1, -1, -1, -1, 155, 156, -1, -1, 159, -1, - 161, 7, 8, -1, 10, 11, 12, 13, 14, 15, + -1, 116, 117, 118, 119, 120, 121, 122, 123, 124, + 125, 126, 127, 128, -1, 130, -1, 132, 133, 134, + 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, + 17, -1, 19, 20, -1, 22, 23, 24, -1, -1, + -1, -1, -1, -1, 159, -1, -1, -1, -1, -1, + -1, -1, 39, -1, -1, -1, 122, -1, -1, -1, + 7, 8, 49, 10, 11, 12, 13, 14, 15, 16, + 17, -1, 19, 20, -1, 22, 23, 24, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 155, + 156, -1, -1, 159, -1, 161, -1, -1, -1, -1, + 7, 8, 49, 10, 11, 12, 13, 14, 15, 16, + 17, -1, 19, 20, -1, 22, 23, 24, 7, 8, + -1, 10, 11, 12, 13, 14, 15, 16, 17, -1, + 19, 20, 39, 22, 23, 24, -1, -1, -1, -1, + -1, -1, 49, -1, -1, -1, -1, -1, -1, -1, + 39, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 49, -1, -1, -1, -1, -1, -1, -1, 155, 156, + -1, -1, 159, -1, 161, 7, 8, -1, 10, 11, + 12, 13, 14, 15, 16, 17, -1, 19, 20, -1, + 22, 23, 24, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 155, 156, + -1, 158, 159, -1, 161, 7, 8, 49, 10, 11, + 12, 13, 14, 15, 16, 17, -1, 19, 20, -1, + 22, 23, 24, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 155, 156, + -1, -1, 159, -1, 161, -1, -1, 49, -1, -1, + -1, -1, -1, -1, -1, -1, 155, 156, -1, -1, + 159, -1, 161, 7, 8, -1, 10, 11, 12, 13, + 14, 15, 16, 17, -1, 19, 20, -1, 22, 23, + 24, 7, 8, -1, 10, 11, 12, 13, 14, 15, + 16, 17, -1, 19, 20, -1, 22, 23, 24, -1, + -1, -1, -1, -1, -1, 49, -1, -1, -1, -1, + -1, -1, -1, 155, 156, -1, -1, 159, -1, 161, + -1, 7, 8, 49, 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, -1, 22, 23, 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 155, 156, -1, -1, 159, -1, - 161, -1, -1, 49, -1, -1, -1, -1, -1, -1, - -1, -1, 155, 156, -1, -1, 159, -1, 161, 7, + -1, -1, -1, 155, 156, -1, -1, 159, -1, 161, + -1, 7, 8, 49, 10, 11, 12, 13, 14, 15, + 16, 17, -1, 19, 20, -1, 22, 23, 24, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, -1, 22, 23, 24, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 155, 156, -1, -1, 159, -1, 161, 7, - 8, 49, 10, 11, 12, 13, 14, 15, 16, 17, - -1, 19, 20, -1, 22, 23, 24, 7, 8, -1, - 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, - 20, -1, 22, 23, 24, -1, -1, -1, -1, -1, + -1, -1, -1, 49, -1, -1, -1, -1, -1, -1, + -1, 155, 156, -1, -1, 159, -1, 161, -1, -1, -1, 49, -1, -1, -1, -1, -1, -1, -1, 155, - 156, -1, -1, 159, -1, 161, -1, 7, 8, 49, - 10, 11, 12, 13, 14, 15, 16, 17, -1, 19, - 20, -1, 22, 23, 24, 7, 8, -1, 10, 11, - 12, 13, 14, 15, 16, 17, -1, 19, 20, -1, - 22, 23, 24, -1, -1, -1, -1, -1, -1, 49, - -1, -1, -1, -1, -1, -1, -1, 155, 156, -1, - -1, 159, -1, 161, -1, 7, 8, 49, 10, 11, - 12, 13, 14, 15, 16, 17, -1, 19, 20, -1, - 22, 23, 24, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 155, 156, -1, - -1, 159, -1, 161, -1, -1, -1, 49, -1, -1, - -1, -1, -1, -1, -1, 155, 156, -1, -1, 159, - -1, 161, -1, -1, -1, -1, -1, -1, -1, -1, + 156, -1, -1, 159, -1, 161, 7, 8, -1, 10, + 11, 12, 13, 14, 15, 16, 17, -1, 19, 20, + -1, 22, 23, 24, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 155, + 156, -1, -1, 159, -1, 161, -1, -1, 49, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 36, -1, - -1, -1, -1, -1, -1, 155, 156, -1, -1, 159, - -1, 161, -1, -1, -1, -1, -1, -1, 56, 57, - -1, -1, -1, 155, 156, -1, -1, 159, -1, 161, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 155, 156, -1, -1, 159, -1, 161, - -1, -1, -1, 111, 112, 113, -1, -1, 116, 117, - 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, - 128, 129, 130, 131, 132, 133, 134 + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 155, + 156, -1, -1, 159, -1, 161, 36, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 155, 156, -1, + -1, 159, -1, 161, -1, -1, 56, 57, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 155, 156, -1, -1, 159, -1, + 161, 111, 112, 113, -1, -1, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, + 130, 131, 132, 133, 134 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ #line 3 "/usr/share/bison.simple" @@ -2684,151 +2699,159 @@ { yyval.StrVal = 0; ; break;} case 65: -#line 1142 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1140 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.UIntVal=yyvsp[-1].UInt64Val; ; + break;} +case 66: +#line 1141 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.UIntVal=0; ; + break;} +case 67: +#line 1145 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.StrVal = yyvsp[-1].StrVal; CHECK_FOR_ERROR ; break;} -case 66: -#line 1146 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 68: +#line 1149 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.StrVal = 0; CHECK_FOR_ERROR ; break;} -case 70: -#line 1154 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 72: +#line 1157 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.StrVal = 0; CHECK_FOR_ERROR ; break;} -case 71: -#line 1159 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 73: +#line 1162 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.StrVal = yyvsp[-1].StrVal; CHECK_FOR_ERROR ; break;} -case 72: -#line 1165 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 74: +#line 1168 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::InternalLinkage; ; break;} -case 73: -#line 1166 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 75: +#line 1169 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::WeakLinkage; ; break;} -case 74: -#line 1167 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 76: +#line 1170 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::LinkOnceLinkage; ; break;} -case 75: -#line 1168 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 77: +#line 1171 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::AppendingLinkage; ; break;} -case 76: -#line 1169 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 78: +#line 1172 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::DLLExportLinkage; ; break;} -case 77: -#line 1173 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 79: +#line 1176 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::DLLImportLinkage; ; break;} -case 78: -#line 1174 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 80: +#line 1177 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::ExternalWeakLinkage; ; break;} -case 79: -#line 1175 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 81: +#line 1178 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::ExternalLinkage; ; break;} -case 80: -#line 1179 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 82: +#line 1182 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Visibility = GlobalValue::DefaultVisibility; ; break;} -case 81: -#line 1180 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 83: +#line 1183 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Visibility = GlobalValue::DefaultVisibility; ; break;} -case 82: -#line 1181 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 84: +#line 1184 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Visibility = GlobalValue::HiddenVisibility; ; break;} -case 83: -#line 1182 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 85: +#line 1185 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Visibility = GlobalValue::ProtectedVisibility; ; break;} -case 84: -#line 1186 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 86: +#line 1189 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::ExternalLinkage; ; break;} -case 85: -#line 1187 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 87: +#line 1190 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::DLLImportLinkage; ; break;} -case 86: -#line 1188 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 88: +#line 1191 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::ExternalWeakLinkage; ; break;} -case 87: -#line 1192 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 89: +#line 1195 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::ExternalLinkage; ; break;} -case 88: -#line 1193 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 90: +#line 1196 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::InternalLinkage; ; break;} -case 89: -#line 1194 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 91: +#line 1197 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::LinkOnceLinkage; ; break;} -case 90: -#line 1195 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 92: +#line 1198 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::WeakLinkage; ; break;} -case 91: -#line 1196 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 93: +#line 1199 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::DLLExportLinkage; ; break;} -case 92: -#line 1200 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 94: +#line 1203 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::ExternalLinkage; ; break;} -case 93: -#line 1201 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 95: +#line 1204 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::WeakLinkage; ; break;} -case 94: -#line 1202 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 96: +#line 1205 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.Linkage = GlobalValue::InternalLinkage; ; break;} -case 95: -#line 1205 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 97: +#line 1208 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.UIntVal = CallingConv::C; ; break;} -case 96: -#line 1206 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 98: +#line 1209 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.UIntVal = CallingConv::C; ; break;} -case 97: -#line 1207 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 99: +#line 1210 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.UIntVal = CallingConv::Fast; ; break;} -case 98: -#line 1208 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 100: +#line 1211 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.UIntVal = CallingConv::Cold; ; break;} -case 99: -#line 1209 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 101: +#line 1212 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.UIntVal = CallingConv::X86_StdCall; ; break;} -case 100: -#line 1210 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 102: +#line 1213 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.UIntVal = CallingConv::X86_FastCall; ; break;} -case 101: -#line 1211 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 103: +#line 1214 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if ((unsigned)yyvsp[0].UInt64Val != yyvsp[0].UInt64Val) GEN_ERROR("Calling conv too large"); @@ -2836,102 +2859,102 @@ CHECK_FOR_ERROR ; break;} -case 102: -#line 1218 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 104: +#line 1221 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::ZExt; ; break;} -case 103: -#line 1219 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 105: +#line 1222 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::ZExt; ; break;} -case 104: -#line 1220 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 106: +#line 1223 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::SExt; ; break;} -case 105: -#line 1221 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 107: +#line 1224 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::SExt; ; break;} -case 106: -#line 1222 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 108: +#line 1225 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::InReg; ; break;} -case 107: -#line 1223 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 109: +#line 1226 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::StructRet; ; break;} -case 108: -#line 1224 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 110: +#line 1227 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::NoAlias; ; break;} -case 109: -#line 1225 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 111: +#line 1228 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::ByVal; ; break;} -case 110: -#line 1226 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 112: +#line 1229 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::Nest; ; break;} -case 111: -#line 1229 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 113: +#line 1232 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::None; ; break;} -case 112: -#line 1230 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 114: +#line 1233 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs; ; break;} -case 113: -#line 1235 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 115: +#line 1238 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::NoReturn; ; break;} -case 114: -#line 1236 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 116: +#line 1239 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::NoUnwind; ; break;} -case 115: -#line 1237 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 117: +#line 1240 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::ZExt; ; break;} -case 116: -#line 1238 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 118: +#line 1241 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::SExt; ; break;} -case 117: -#line 1239 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 119: +#line 1242 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::ReadNone; ; break;} -case 118: -#line 1240 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 120: +#line 1243 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::ReadOnly; ; break;} -case 119: -#line 1243 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 121: +#line 1246 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = ParamAttr::None; ; break;} -case 120: -#line 1244 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 122: +#line 1247 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamAttrs = yyvsp[-1].ParamAttrs | yyvsp[0].ParamAttrs; ; break;} -case 121: -#line 1249 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 123: +#line 1252 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.StrVal = 0; ; break;} -case 122: -#line 1250 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 124: +#line 1253 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.StrVal = yyvsp[0].StrVal; ; break;} -case 123: -#line 1257 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 125: +#line 1260 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.UIntVal = 0; ; break;} -case 124: -#line 1258 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 126: +#line 1261 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.UIntVal = yyvsp[0].UInt64Val; if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal)) @@ -2939,12 +2962,12 @@ CHECK_FOR_ERROR ; break;} -case 125: -#line 1264 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 127: +#line 1267 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.UIntVal = 0; ; break;} -case 126: -#line 1265 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 128: +#line 1268 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.UIntVal = yyvsp[0].UInt64Val; if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal)) @@ -2952,8 +2975,8 @@ CHECK_FOR_ERROR ; break;} -case 127: -#line 1274 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 129: +#line 1277 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { for (unsigned i = 0, e = yyvsp[0].StrVal->length(); i != e; ++i) if ((*yyvsp[0].StrVal)[i] == '"' || (*yyvsp[0].StrVal)[i] == '\\') @@ -2962,32 +2985,32 @@ CHECK_FOR_ERROR ; break;} -case 128: -#line 1282 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 130: +#line 1285 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.StrVal = 0; ; break;} -case 129: -#line 1283 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 131: +#line 1286 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.StrVal = yyvsp[0].StrVal; ; break;} -case 130: -#line 1288 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 132: +#line 1291 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" {; break;} -case 131: -#line 1289 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 133: +#line 1292 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" {; break;} -case 132: -#line 1290 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 134: +#line 1293 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV->setSection(*yyvsp[0].StrVal); delete yyvsp[0].StrVal; CHECK_FOR_ERROR ; break;} -case 133: -#line 1295 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 135: +#line 1298 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (yyvsp[0].UInt64Val != 0 && !isPowerOf2_32(yyvsp[0].UInt64Val)) GEN_ERROR("Alignment must be a power of two"); @@ -2995,50 +3018,40 @@ CHECK_FOR_ERROR ; break;} -case 141: -#line 1311 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 143: +#line 1314 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.TypeVal = new PATypeHolder(OpaqueType::get()); CHECK_FOR_ERROR ; break;} -case 142: -#line 1315 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 144: +#line 1318 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); CHECK_FOR_ERROR ; break;} -case 143: -#line 1319 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 145: +#line 1322 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Pointer type? - if (*yyvsp[-1].TypeVal == Type::LabelTy) + if (*yyvsp[-2].TypeVal == Type::LabelTy) GEN_ERROR("Cannot form a pointer to a basic block"); - yyval.TypeVal = new PATypeHolder(HandleUpRefs(PointerType::get(*yyvsp[-1].TypeVal))); - delete yyvsp[-1].TypeVal; - CHECK_FOR_ERROR - ; - break;} -case 144: -#line 1326 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Pointer type? - if (*yyvsp[-5].TypeVal == Type::LabelTy) - GEN_ERROR("Cannot form a pointer to a basic block"); - yyval.TypeVal = new PATypeHolder(HandleUpRefs(PointerType::get(*yyvsp[-5].TypeVal, yyvsp[-2].UInt64Val))); - delete yyvsp[-5].TypeVal; + yyval.TypeVal = new PATypeHolder(HandleUpRefs(PointerType::get(*yyvsp[-2].TypeVal, yyvsp[-1].UIntVal))); + delete yyvsp[-2].TypeVal; CHECK_FOR_ERROR ; break;} -case 145: -#line 1333 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 146: +#line 1329 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Named types are also simple types... const Type* tmp = getTypeVal(yyvsp[0].ValIDVal); CHECK_FOR_ERROR yyval.TypeVal = new PATypeHolder(tmp); ; break;} -case 146: -#line 1338 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 147: +#line 1334 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Type UpReference if (yyvsp[0].UInt64Val > (uint64_t)~0U) GEN_ERROR("Value out of range"); OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder @@ -3048,8 +3061,8 @@ CHECK_FOR_ERROR ; break;} -case 147: -#line 1346 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 148: +#line 1342 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Allow but ignore attributes on function types; this permits auto-upgrade. // FIXME: remove in LLVM 3.0. @@ -3081,8 +3094,8 @@ CHECK_FOR_ERROR ; break;} -case 148: -#line 1376 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 149: +#line 1372 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Allow but ignore attributes on function types; this permits auto-upgrade. // FIXME: remove in LLVM 3.0. @@ -3108,16 +3121,16 @@ CHECK_FOR_ERROR ; break;} -case 149: -#line 1401 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 150: +#line 1397 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Sized array type? yyval.TypeVal = new PATypeHolder(HandleUpRefs(ArrayType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val))); delete yyvsp[-1].TypeVal; CHECK_FOR_ERROR ; break;} -case 150: -#line 1406 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 151: +#line 1402 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Vector type? const llvm::Type* ElemTy = yyvsp[-1].TypeVal->get(); if ((unsigned)yyvsp[-3].UInt64Val != yyvsp[-3].UInt64Val) @@ -3129,8 +3142,8 @@ CHECK_FOR_ERROR ; break;} -case 151: -#line 1416 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 152: +#line 1412 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Structure type? std::vector Elements; for (std::list::iterator I = yyvsp[-1].TypeList->begin(), @@ -3142,15 +3155,15 @@ CHECK_FOR_ERROR ; break;} -case 152: -#line 1426 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 153: +#line 1422 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty structure type? yyval.TypeVal = new PATypeHolder(StructType::get(std::vector())); CHECK_FOR_ERROR ; break;} -case 153: -#line 1430 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 154: +#line 1426 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { std::vector Elements; for (std::list::iterator I = yyvsp[-2].TypeList->begin(), @@ -3162,15 +3175,15 @@ CHECK_FOR_ERROR ; break;} -case 154: -#line 1440 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 155: +#line 1436 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty structure type? yyval.TypeVal = new PATypeHolder(StructType::get(std::vector(), true)); CHECK_FOR_ERROR ; break;} -case 155: -#line 1447 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 156: +#line 1443 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Allow but ignore attributes on function types; this permits auto-upgrade. // FIXME: remove in LLVM 3.0. @@ -3178,8 +3191,8 @@ yyval.TypeWithAttrs.Attrs = ParamAttr::None; ; break;} -case 156: -#line 1456 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 157: +#line 1452 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription()); @@ -3188,29 +3201,29 @@ yyval.TypeVal = yyvsp[0].TypeVal; ; break;} -case 157: -#line 1463 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 158: +#line 1459 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.TypeVal = new PATypeHolder(Type::VoidTy); ; break;} -case 158: -#line 1468 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 159: +#line 1464 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.TypeWithAttrsList = new TypeWithAttrsList(); yyval.TypeWithAttrsList->push_back(yyvsp[0].TypeWithAttrs); CHECK_FOR_ERROR ; break;} -case 159: -#line 1473 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 160: +#line 1469 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList)->push_back(yyvsp[0].TypeWithAttrs); CHECK_FOR_ERROR ; break;} -case 161: -#line 1481 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 162: +#line 1477 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.TypeWithAttrsList=yyvsp[-2].TypeWithAttrsList; TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None; @@ -3219,8 +3232,8 @@ CHECK_FOR_ERROR ; break;} -case 162: -#line 1488 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 163: +#line 1484 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.TypeWithAttrsList = new TypeWithAttrsList; TypeWithAttrs TWA; TWA.Attrs = ParamAttr::None; @@ -3229,15 +3242,15 @@ CHECK_FOR_ERROR ; break;} -case 163: -#line 1495 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 164: +#line 1491 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.TypeWithAttrsList = new TypeWithAttrsList(); CHECK_FOR_ERROR ; break;} -case 164: -#line 1503 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 165: +#line 1499 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.TypeList = new std::list(); yyval.TypeList->push_back(*yyvsp[0].TypeVal); @@ -3245,16 +3258,16 @@ CHECK_FOR_ERROR ; break;} -case 165: -#line 1509 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 166: +#line 1505 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeList=yyvsp[-2].TypeList)->push_back(*yyvsp[0].TypeVal); delete yyvsp[0].TypeVal; CHECK_FOR_ERROR ; break;} -case 166: -#line 1521 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 167: +#line 1517 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); @@ -3284,8 +3297,8 @@ CHECK_FOR_ERROR ; break;} -case 167: -#line 1549 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 168: +#line 1545 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); @@ -3303,8 +3316,8 @@ CHECK_FOR_ERROR ; break;} -case 168: -#line 1565 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 169: +#line 1561 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); @@ -3333,8 +3346,8 @@ CHECK_FOR_ERROR ; break;} -case 169: -#line 1592 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 170: +#line 1588 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); @@ -3364,8 +3377,8 @@ CHECK_FOR_ERROR ; break;} -case 170: -#line 1620 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 171: +#line 1616 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = dyn_cast(yyvsp[-3].TypeVal->get()); if (STy == 0) @@ -3393,8 +3406,8 @@ CHECK_FOR_ERROR ; break;} -case 171: -#line 1646 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 172: +#line 1642 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); @@ -3416,8 +3429,8 @@ CHECK_FOR_ERROR ; break;} -case 172: -#line 1666 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 173: +#line 1662 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const StructType *STy = dyn_cast(yyvsp[-5].TypeVal->get()); if (STy == 0) @@ -3445,8 +3458,8 @@ CHECK_FOR_ERROR ; break;} -case 173: -#line 1692 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 174: +#line 1688 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription()); @@ -3468,8 +3481,8 @@ CHECK_FOR_ERROR ; break;} -case 174: -#line 1712 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 175: +#line 1708 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); @@ -3483,8 +3496,8 @@ CHECK_FOR_ERROR ; break;} -case 175: -#line 1724 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 176: +#line 1720 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); @@ -3493,8 +3506,8 @@ CHECK_FOR_ERROR ; break;} -case 176: -#line 1731 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 177: +#line 1727 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); @@ -3562,8 +3575,8 @@ CHECK_FOR_ERROR ; break;} -case 177: -#line 1797 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 178: +#line 1793 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); @@ -3575,8 +3588,8 @@ CHECK_FOR_ERROR ; break;} -case 178: -#line 1807 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 179: +#line 1803 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); @@ -3588,8 +3601,8 @@ CHECK_FOR_ERROR ; break;} -case 179: -#line 1817 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 180: +#line 1813 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // integral constants if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].SInt64Val)) GEN_ERROR("Constant value doesn't fit in type"); @@ -3597,8 +3610,8 @@ CHECK_FOR_ERROR ; break;} -case 180: -#line 1823 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 181: +#line 1819 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // arbitrary precision integer constants uint32_t BitWidth = cast(yyvsp[-1].PrimType)->getBitWidth(); if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) { @@ -3610,8 +3623,8 @@ CHECK_FOR_ERROR ; break;} -case 181: -#line 1833 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 182: +#line 1829 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // integral constants if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].UInt64Val)) GEN_ERROR("Constant value doesn't fit in type"); @@ -3619,8 +3632,8 @@ CHECK_FOR_ERROR ; break;} -case 182: -#line 1839 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 183: +#line 1835 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // arbitrary precision integer constants uint32_t BitWidth = cast(yyvsp[-1].PrimType)->getBitWidth(); if (yyvsp[0].APIntVal->getBitWidth() > BitWidth) { @@ -3632,24 +3645,24 @@ CHECK_FOR_ERROR ; break;} -case 183: -#line 1849 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 184: +#line 1845 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Boolean constants assert(cast(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?"); yyval.ConstVal = ConstantInt::getTrue(); CHECK_FOR_ERROR ; break;} -case 184: -#line 1854 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 185: +#line 1850 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Boolean constants assert(cast(yyvsp[-1].PrimType)->getBitWidth() == 1 && "Not Bool?"); yyval.ConstVal = ConstantInt::getFalse(); CHECK_FOR_ERROR ; break;} -case 185: -#line 1859 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 186: +#line 1855 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Floating point constants if (!ConstantFP::isValueValidForType(yyvsp[-1].PrimType, *yyvsp[0].FPVal)) GEN_ERROR("Floating point constant invalid for type"); @@ -3662,8 +3675,8 @@ CHECK_FOR_ERROR ; break;} -case 186: -#line 1872 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 187: +#line 1868 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); @@ -3677,8 +3690,8 @@ delete yyvsp[-1].TypeVal; ; break;} -case 187: -#line 1884 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 188: +#line 1880 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa(yyvsp[-2].ConstVal->getType())) GEN_ERROR("GetElementPtr requires a pointer operand"); @@ -3702,8 +3715,8 @@ CHECK_FOR_ERROR ; break;} -case 188: -#line 1906 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 189: +#line 1902 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (yyvsp[-5].ConstVal->getType() != Type::Int1Ty) GEN_ERROR("Select condition must be of boolean type"); @@ -3713,8 +3726,8 @@ CHECK_FOR_ERROR ; break;} -case 189: -#line 1914 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 190: +#line 1910 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) GEN_ERROR("Binary operator types must match"); @@ -3722,8 +3735,8 @@ yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); ; break;} -case 190: -#line 1920 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 191: +#line 1916 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) GEN_ERROR("Logical operator types must match"); @@ -3736,24 +3749,24 @@ CHECK_FOR_ERROR ; break;} -case 191: -#line 1931 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 192: +#line 1927 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) GEN_ERROR("icmp operand types must match"); yyval.ConstVal = ConstantExpr::getICmp(yyvsp[-5].IPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); ; break;} -case 192: -#line 1936 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 193: +#line 1932 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) GEN_ERROR("fcmp operand types must match"); yyval.ConstVal = ConstantExpr::getFCmp(yyvsp[-5].FPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); ; break;} -case 193: -#line 1941 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 194: +#line 1937 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ExtractElementInst::isValidOperands(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal)) GEN_ERROR("Invalid extractelement operands"); @@ -3761,8 +3774,8 @@ CHECK_FOR_ERROR ; break;} -case 194: -#line 1947 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 195: +#line 1943 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!InsertElementInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal)) GEN_ERROR("Invalid insertelement operands"); @@ -3770,8 +3783,8 @@ CHECK_FOR_ERROR ; break;} -case 195: -#line 1953 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 196: +#line 1949 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ShuffleVectorInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal)) GEN_ERROR("Invalid shufflevector operands"); @@ -3779,39 +3792,39 @@ CHECK_FOR_ERROR ; break;} -case 196: -#line 1962 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 197: +#line 1958 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(yyvsp[0].ConstVal); CHECK_FOR_ERROR ; break;} -case 197: -#line 1966 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 198: +#line 1962 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ConstVector = new std::vector(); yyval.ConstVector->push_back(yyvsp[0].ConstVal); CHECK_FOR_ERROR ; break;} -case 198: -#line 1974 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.BoolVal = false; ; - break;} case 199: -#line 1974 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.BoolVal = true; ; +#line 1970 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.BoolVal = false; ; break;} case 200: -#line 1977 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1970 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.BoolVal = true; ; break;} case 201: -#line 1977 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.BoolVal = false; ; +#line 1973 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.BoolVal = true; ; break;} case 202: -#line 1980 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 1973 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.BoolVal = false; ; + break;} +case 203: +#line 1976 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const Type* VTy = yyvsp[-1].TypeVal->get(); Value *V = getVal(VTy, yyvsp[0].ValIDVal); @@ -3825,8 +3838,8 @@ delete yyvsp[-1].TypeVal; ; break;} -case 203: -#line 1992 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 204: +#line 1988 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { Constant *Val = yyvsp[-3].ConstVal; const Type *DestTy = yyvsp[-1].TypeVal->get(); @@ -3840,51 +3853,51 @@ delete yyvsp[-1].TypeVal; ; break;} -case 204: -#line 2013 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 205: +#line 2009 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ModuleVal = ParserResult = CurModule.CurrentModule; CurModule.ModuleDone(); CHECK_FOR_ERROR; ; break;} -case 205: -#line 2018 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 206: +#line 2014 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ModuleVal = ParserResult = CurModule.CurrentModule; CurModule.ModuleDone(); CHECK_FOR_ERROR; ; break;} -case 208: -#line 2031 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 209: +#line 2027 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.isDeclare = false; ; break;} -case 209: -#line 2031 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 210: +#line 2027 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.FunctionDone(); CHECK_FOR_ERROR ; break;} -case 210: -#line 2035 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 211: +#line 2031 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.isDeclare = true; ; break;} -case 211: -#line 2035 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 212: +#line 2031 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ; break;} -case 212: -#line 2038 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 213: +#line 2034 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ; break;} -case 213: -#line 2041 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 214: +#line 2037 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription()); @@ -3910,8 +3923,8 @@ CHECK_FOR_ERROR ; break;} -case 214: -#line 2065 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 215: +#line 2061 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { ResolveTypeTo(yyvsp[-2].StrVal, yyvsp[0].PrimType); @@ -3924,74 +3937,57 @@ CHECK_FOR_ERROR ; break;} -case 215: -#line 2076 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 216: +#line 2073 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { /* "Externally Visible" Linkage */ - if (yyvsp[0].ConstVal == 0) + if (yyvsp[-1].ConstVal == 0) GEN_ERROR("Global value initializer is not a constant"); - CurGV = ParseGlobalVariable(yyvsp[-4].StrVal, GlobalValue::ExternalLinkage, - yyvsp[-3].Visibility, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal, yyvsp[-2].BoolVal); + CurGV = ParseGlobalVariable(yyvsp[-5].StrVal, GlobalValue::ExternalLinkage, + yyvsp[-4].Visibility, yyvsp[-2].BoolVal, yyvsp[-1].ConstVal->getType(), yyvsp[-1].ConstVal, yyvsp[-3].BoolVal, yyvsp[0].UIntVal); CHECK_FOR_ERROR ; break;} -case 216: -#line 2083 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" -{ - CurGV = 0; - ; - break;} case 217: -#line 2087 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" -{ - /* "Externally Visible" Linkage with address space qualifier */ - if (yyvsp[-4].ConstVal == 0) - GEN_ERROR("Global value initializer is not a constant"); - CurGV = ParseGlobalVariable(yyvsp[-8].StrVal, GlobalValue::ExternalLinkage, - yyvsp[-7].Visibility, yyvsp[-5].BoolVal, yyvsp[-4].ConstVal->getType(), yyvsp[-4].ConstVal, yyvsp[-6].BoolVal, yyvsp[-1].UInt64Val); - CHECK_FOR_ERROR - ; - break;} -case 218: -#line 2094 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2080 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; ; break;} -case 219: -#line 2098 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 218: +#line 2084 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - if (yyvsp[0].ConstVal == 0) + if (yyvsp[-1].ConstVal == 0) GEN_ERROR("Global value initializer is not a constant"); - CurGV = ParseGlobalVariable(yyvsp[-5].StrVal, yyvsp[-4].Linkage, yyvsp[-3].Visibility, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal, yyvsp[-2].BoolVal); + CurGV = ParseGlobalVariable(yyvsp[-6].StrVal, yyvsp[-5].Linkage, yyvsp[-4].Visibility, yyvsp[-2].BoolVal, yyvsp[-1].ConstVal->getType(), yyvsp[-1].ConstVal, yyvsp[-3].BoolVal, yyvsp[0].UIntVal); CHECK_FOR_ERROR ; break;} -case 220: -#line 2103 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 219: +#line 2089 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; ; break;} -case 221: -#line 2107 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 220: +#line 2093 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription()); - CurGV = ParseGlobalVariable(yyvsp[-5].StrVal, yyvsp[-4].Linkage, yyvsp[-3].Visibility, yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0, yyvsp[-2].BoolVal); + GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); + CurGV = ParseGlobalVariable(yyvsp[-6].StrVal, yyvsp[-5].Linkage, yyvsp[-4].Visibility, yyvsp[-2].BoolVal, *yyvsp[-1].TypeVal, 0, yyvsp[-3].BoolVal, yyvsp[0].UIntVal); CHECK_FOR_ERROR - delete yyvsp[0].TypeVal; + delete yyvsp[-1].TypeVal; ; break;} -case 222: -#line 2113 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 221: +#line 2099 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; CHECK_FOR_ERROR ; break;} -case 223: -#line 2117 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 222: +#line 2103 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { std::string Name; if (yyvsp[-4].StrVal) { @@ -4033,20 +4029,20 @@ CHECK_FOR_ERROR ; break;} -case 224: -#line 2157 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 223: +#line 2143 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ; break;} -case 225: -#line 2160 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 224: +#line 2146 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ; break;} -case 226: -#line 2166 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 225: +#line 2152 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); if (AsmSoFar.empty()) @@ -4057,44 +4053,44 @@ CHECK_FOR_ERROR ; break;} -case 227: -#line 2176 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 226: +#line 2162 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setTargetTriple(*yyvsp[0].StrVal); delete yyvsp[0].StrVal; ; break;} -case 228: -#line 2180 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 227: +#line 2166 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->setDataLayout(*yyvsp[0].StrVal); delete yyvsp[0].StrVal; ; break;} -case 230: -#line 2187 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 229: +#line 2173 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->addLibrary(*yyvsp[0].StrVal); delete yyvsp[0].StrVal; CHECK_FOR_ERROR ; break;} -case 231: -#line 2192 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 230: +#line 2178 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurModule.CurrentModule->addLibrary(*yyvsp[0].StrVal); delete yyvsp[0].StrVal; CHECK_FOR_ERROR ; break;} -case 232: -#line 2197 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 231: +#line 2183 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ; break;} -case 233: -#line 2206 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 232: +#line 2192 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); @@ -4106,8 +4102,8 @@ CHECK_FOR_ERROR ; break;} -case 234: -#line 2216 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 233: +#line 2202 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); @@ -4119,15 +4115,15 @@ CHECK_FOR_ERROR ; break;} -case 235: -#line 2227 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 234: +#line 2213 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ArgList = yyvsp[0].ArgList; CHECK_FOR_ERROR ; break;} -case 236: -#line 2231 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 235: +#line 2217 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ArgList = yyvsp[-2].ArgList; struct ArgListEntry E; @@ -4138,8 +4134,8 @@ CHECK_FOR_ERROR ; break;} -case 237: -#line 2240 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 236: +#line 2226 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ArgList = new ArgListType; struct ArgListEntry E; @@ -4150,15 +4146,15 @@ CHECK_FOR_ERROR ; break;} -case 238: -#line 2249 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 237: +#line 2235 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ArgList = 0; CHECK_FOR_ERROR ; break;} -case 239: -#line 2255 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 238: +#line 2241 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { std::string FunctionName(*yyvsp[-7].StrVal); delete yyvsp[-7].StrVal; // Free strdup'd memory! @@ -4292,8 +4288,8 @@ CHECK_FOR_ERROR ; break;} -case 242: -#line 2390 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 241: +#line 2376 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FunctionVal = CurFun.CurrentFunction; @@ -4303,15 +4299,15 @@ yyval.FunctionVal->setVisibility(yyvsp[-2].Visibility); ; break;} -case 245: -#line 2401 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 244: +#line 2387 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FunctionVal = yyvsp[-1].FunctionVal; CHECK_FOR_ERROR ; break;} -case 246: -#line 2406 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 245: +#line 2392 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.CurrentFunction->setLinkage(yyvsp[-2].Linkage); CurFun.CurrentFunction->setVisibility(yyvsp[-1].Visibility); @@ -4320,78 +4316,78 @@ CHECK_FOR_ERROR ; break;} -case 247: -#line 2418 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 246: +#line 2404 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.BoolVal = false; CHECK_FOR_ERROR ; break;} -case 248: -#line 2422 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 247: +#line 2408 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.BoolVal = true; CHECK_FOR_ERROR ; break;} -case 249: -#line 2427 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 248: +#line 2413 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // A reference to a direct constant yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val); CHECK_FOR_ERROR ; break;} -case 250: -#line 2431 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 249: +#line 2417 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val); CHECK_FOR_ERROR ; break;} -case 251: -#line 2435 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 250: +#line 2421 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Perhaps it's an FP constant? yyval.ValIDVal = ValID::create(yyvsp[0].FPVal); CHECK_FOR_ERROR ; break;} -case 252: -#line 2439 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 251: +#line 2425 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ValIDVal = ValID::create(ConstantInt::getTrue()); CHECK_FOR_ERROR ; break;} -case 253: -#line 2443 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 252: +#line 2429 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ValIDVal = ValID::create(ConstantInt::getFalse()); CHECK_FOR_ERROR ; break;} -case 254: -#line 2447 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 253: +#line 2433 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ValIDVal = ValID::createNull(); CHECK_FOR_ERROR ; break;} -case 255: -#line 2451 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 254: +#line 2437 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ValIDVal = ValID::createUndef(); CHECK_FOR_ERROR ; break;} -case 256: -#line 2455 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 255: +#line 2441 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // A vector zero constant. yyval.ValIDVal = ValID::createZeroInit(); CHECK_FOR_ERROR ; break;} -case 257: -#line 2459 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 256: +#line 2445 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized packed vector const Type *ETy = (*yyvsp[-1].ConstVector)[0]->getType(); int NumElements = yyvsp[-1].ConstVector->size(); @@ -4418,15 +4414,15 @@ CHECK_FOR_ERROR ; break;} -case 258: -#line 2484 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 257: +#line 2470 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ValIDVal = ValID::create(yyvsp[0].ConstVal); CHECK_FOR_ERROR ; break;} -case 259: -#line 2488 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 258: +#line 2474 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ValIDVal = ValID::createInlineAsm(*yyvsp[-2].StrVal, *yyvsp[0].StrVal, yyvsp[-3].BoolVal); delete yyvsp[-2].StrVal; @@ -4434,38 +4430,38 @@ CHECK_FOR_ERROR ; break;} -case 260: -#line 2498 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 259: +#line 2484 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it an integer reference...? yyval.ValIDVal = ValID::createLocalID(yyvsp[0].UIntVal); CHECK_FOR_ERROR ; break;} -case 261: -#line 2502 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 260: +#line 2488 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ValIDVal = ValID::createGlobalID(yyvsp[0].UIntVal); CHECK_FOR_ERROR ; break;} -case 262: -#line 2506 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 261: +#line 2492 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it a named reference...? yyval.ValIDVal = ValID::createLocalName(*yyvsp[0].StrVal); delete yyvsp[0].StrVal; CHECK_FOR_ERROR ; break;} -case 263: -#line 2511 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 262: +#line 2497 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it a named reference...? yyval.ValIDVal = ValID::createGlobalName(*yyvsp[0].StrVal); delete yyvsp[0].StrVal; CHECK_FOR_ERROR ; break;} -case 266: -#line 2524 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 265: +#line 2510 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); @@ -4474,22 +4470,22 @@ CHECK_FOR_ERROR ; break;} -case 267: -#line 2533 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 266: +#line 2519 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.FunctionVal = yyvsp[-1].FunctionVal; CHECK_FOR_ERROR ; break;} -case 268: -#line 2537 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 267: +#line 2523 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Do not allow functions with 0 basic blocks yyval.FunctionVal = yyvsp[-1].FunctionVal; CHECK_FOR_ERROR ; break;} -case 269: -#line 2546 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 268: +#line 2532 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { setValueName(yyvsp[0].TermInstVal, yyvsp[-1].StrVal); CHECK_FOR_ERROR @@ -4499,8 +4495,8 @@ CHECK_FOR_ERROR ; break;} -case 270: -#line 2555 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 269: +#line 2541 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (CastInst *CI1 = dyn_cast(yyvsp[0].InstVal)) if (CastInst *CI2 = dyn_cast(CI1->getOperand(0))) @@ -4511,15 +4507,15 @@ CHECK_FOR_ERROR ; break;} -case 271: -#line 2564 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 270: +#line 2550 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty space between instruction lists yyval.BasicBlockVal = defineBBVal(ValID::createLocalID(CurFun.NextValNum)); CHECK_FOR_ERROR ; break;} -case 272: -#line 2568 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 271: +#line 2554 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Labelled (named) basic block yyval.BasicBlockVal = defineBBVal(ValID::createLocalName(*yyvsp[0].StrVal)); delete yyvsp[0].StrVal; @@ -4527,30 +4523,30 @@ ; break;} -case 273: -#line 2575 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 272: +#line 2561 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Return with a result... yyval.TermInstVal = new ReturnInst(yyvsp[0].ValueVal); CHECK_FOR_ERROR ; break;} -case 274: -#line 2579 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 273: +#line 2565 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Return with no result... yyval.TermInstVal = new ReturnInst(); CHECK_FOR_ERROR ; break;} -case 275: -#line 2583 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 274: +#line 2569 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Unconditional Branch... BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal); CHECK_FOR_ERROR yyval.TermInstVal = new BranchInst(tmpBB); ; break;} -case 276: -#line 2588 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 275: +#line 2574 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { assert(cast(yyvsp[-7].PrimType)->getBitWidth() == 1 && "Not Bool?"); BasicBlock* tmpBBA = getBBVal(yyvsp[-3].ValIDVal); @@ -4562,8 +4558,8 @@ yyval.TermInstVal = new BranchInst(tmpBBA, tmpBBB, tmpVal); ; break;} -case 277: -#line 2598 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 276: +#line 2584 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal(yyvsp[-7].PrimType, yyvsp[-6].ValIDVal); CHECK_FOR_ERROR @@ -4584,8 +4580,8 @@ CHECK_FOR_ERROR ; break;} -case 278: -#line 2617 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 277: +#line 2603 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { Value* tmpVal = getVal(yyvsp[-6].PrimType, yyvsp[-5].ValIDVal); CHECK_FOR_ERROR @@ -4596,8 +4592,8 @@ CHECK_FOR_ERROR ; break;} -case 279: -#line 2627 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 278: +#line 2613 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Handle the short syntax @@ -4682,22 +4678,22 @@ CHECK_FOR_ERROR ; break;} -case 280: -#line 2710 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 279: +#line 2696 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.TermInstVal = new UnwindInst(); CHECK_FOR_ERROR ; break;} -case 281: -#line 2714 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 280: +#line 2700 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.TermInstVal = new UnreachableInst(); CHECK_FOR_ERROR ; break;} -case 282: -#line 2721 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 281: +#line 2707 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.JumpTable = yyvsp[-5].JumpTable; Constant *V = cast(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal)); @@ -4710,8 +4706,8 @@ yyval.JumpTable->push_back(std::make_pair(V, tmpBB)); ; break;} -case 283: -#line 2732 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 282: +#line 2718 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.JumpTable = new std::vector >(); Constant *V = cast(getExistingVal(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal)); @@ -4725,8 +4721,8 @@ yyval.JumpTable->push_back(std::make_pair(V, tmpBB)); ; break;} -case 284: -#line 2745 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 283: +#line 2731 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Is this definition named?? if so, assign the name... setValueName(yyvsp[0].InstVal, yyvsp[-1].StrVal); @@ -4736,8 +4732,8 @@ CHECK_FOR_ERROR ; break;} -case 285: -#line 2755 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 284: +#line 2741 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Used for PHI nodes if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-5].TypeVal)->getDescription()); @@ -4750,8 +4746,8 @@ delete yyvsp[-5].TypeVal; ; break;} -case 286: -#line 2766 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 285: +#line 2752 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.PHIList = yyvsp[-6].PHIList; Value* tmpVal = getVal(yyvsp[-6].PHIList->front().first->getType(), yyvsp[-3].ValIDVal); @@ -4761,8 +4757,8 @@ yyvsp[-6].PHIList->push_back(std::make_pair(tmpVal, tmpBB)); ; break;} -case 287: -#line 2776 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 286: +#line 2762 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 if (!UpRefs.empty()) @@ -4775,8 +4771,8 @@ CHECK_FOR_ERROR ; break;} -case 288: -#line 2787 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 287: +#line 2773 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 // Labels are only valid in ASMs @@ -4786,8 +4782,8 @@ CHECK_FOR_ERROR ; break;} -case 289: -#line 2795 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 288: +#line 2781 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 if (!UpRefs.empty()) @@ -4799,8 +4795,8 @@ CHECK_FOR_ERROR ; break;} -case 290: -#line 2805 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 289: +#line 2791 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // FIXME: Remove trailing OptParamAttrs in LLVM 3.0, it was a mistake in 2.0 yyval.ParamList = yyvsp[-5].ParamList; @@ -4809,38 +4805,38 @@ CHECK_FOR_ERROR ; break;} -case 291: -#line 2812 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 290: +#line 2798 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ParamList = new ParamList(); ; break;} -case 292: -#line 2815 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 291: +#line 2801 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ValueList = new std::vector(); ; break;} -case 293: -#line 2816 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 292: +#line 2802 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.ValueList = yyvsp[-2].ValueList; yyval.ValueList->push_back(yyvsp[0].ValueVal); CHECK_FOR_ERROR ; break;} -case 294: -#line 2823 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 293: +#line 2809 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.BoolVal = true; CHECK_FOR_ERROR ; break;} -case 295: -#line 2827 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 294: +#line 2813 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.BoolVal = false; CHECK_FOR_ERROR ; break;} -case 296: -#line 2832 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 295: +#line 2818 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); @@ -4858,8 +4854,8 @@ delete yyvsp[-3].TypeVal; ; break;} -case 297: -#line 2848 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 296: +#line 2834 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); @@ -4878,8 +4874,8 @@ delete yyvsp[-3].TypeVal; ; break;} -case 298: -#line 2865 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 297: +#line 2851 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); @@ -4895,8 +4891,8 @@ delete yyvsp[-3].TypeVal; ; break;} -case 299: -#line 2879 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 298: +#line 2865 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-3].TypeVal)->getDescription()); @@ -4912,8 +4908,8 @@ delete yyvsp[-3].TypeVal; ; break;} -case 300: -#line 2893 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 299: +#line 2879 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription()); @@ -4927,8 +4923,8 @@ delete yyvsp[0].TypeVal; ; break;} -case 301: -#line 2905 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 300: +#line 2891 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (yyvsp[-4].ValueVal->getType() != Type::Int1Ty) GEN_ERROR("select condition must be boolean"); @@ -4938,8 +4934,8 @@ CHECK_FOR_ERROR ; break;} -case 302: -#line 2913 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 301: +#line 2899 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription()); @@ -4948,8 +4944,8 @@ CHECK_FOR_ERROR ; break;} -case 303: -#line 2920 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 302: +#line 2906 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ExtractElementInst::isValidOperands(yyvsp[-2].ValueVal, yyvsp[0].ValueVal)) GEN_ERROR("Invalid extractelement operands"); @@ -4957,8 +4953,8 @@ CHECK_FOR_ERROR ; break;} -case 304: -#line 2926 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 303: +#line 2912 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!InsertElementInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal)) GEN_ERROR("Invalid insertelement operands"); @@ -4966,8 +4962,8 @@ CHECK_FOR_ERROR ; break;} -case 305: -#line 2932 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 304: +#line 2918 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!ShuffleVectorInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal)) GEN_ERROR("Invalid shufflevector operands"); @@ -4975,8 +4971,8 @@ CHECK_FOR_ERROR ; break;} -case 306: -#line 2938 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 305: +#line 2924 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const Type *Ty = yyvsp[0].PHIList->front().first->getType(); if (!Ty->isFirstClassType()) @@ -4993,8 +4989,8 @@ CHECK_FOR_ERROR ; break;} -case 307: -#line 2954 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 306: +#line 2940 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Handle the short syntax @@ -5086,29 +5082,29 @@ CHECK_FOR_ERROR ; break;} -case 308: -#line 3044 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 307: +#line 3030 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.InstVal = yyvsp[0].InstVal; CHECK_FOR_ERROR ; break;} -case 309: -#line 3049 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 308: +#line 3035 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.BoolVal = true; CHECK_FOR_ERROR ; break;} -case 310: -#line 3053 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 309: +#line 3039 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { yyval.BoolVal = false; CHECK_FOR_ERROR ; break;} -case 311: -#line 3060 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 310: +#line 3046 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); @@ -5117,8 +5113,8 @@ CHECK_FOR_ERROR ; break;} -case 312: -#line 3067 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 311: +#line 3053 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription()); @@ -5128,8 +5124,8 @@ delete yyvsp[-4].TypeVal; ; break;} -case 313: -#line 3075 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 312: +#line 3061 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-1].TypeVal)->getDescription()); @@ -5138,8 +5134,8 @@ CHECK_FOR_ERROR ; break;} -case 314: -#line 3082 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 313: +#line 3068 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-4].TypeVal)->getDescription()); @@ -5149,8 +5145,8 @@ delete yyvsp[-4].TypeVal; ; break;} -case 315: -#line 3090 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 314: +#line 3076 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!isa(yyvsp[0].ValueVal->getType())) GEN_ERROR("Trying to free nonpointer type " + @@ -5159,8 +5155,8 @@ CHECK_FOR_ERROR ; break;} -case 316: -#line 3098 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 315: +#line 3084 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); @@ -5176,8 +5172,8 @@ delete yyvsp[-2].TypeVal; ; break;} -case 317: -#line 3112 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 316: +#line 3098 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); @@ -5196,8 +5192,8 @@ delete yyvsp[-2].TypeVal; ; break;} -case 318: -#line 3129 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +case 317: +#line 3115 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*yyvsp[-2].TypeVal)->getDescription()); @@ -5436,7 +5432,7 @@ } return 1; } -#line 3146 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 3132 "/Users/clamb/Documents/llvm/llvm/lib/AsmParser/llvmAsmParser.y" // common code from the two 'RunVMAsmParser' functions Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs?rev=44934&r1=44933&r2=44934&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs Wed Dec 12 02:45:45 2007 @@ -1050,7 +1050,7 @@ %type GlobalName OptGlobalAssign GlobalAssign %type OptSection SectionString OptGC -%type OptAlign OptCAlign +%type OptAlign OptCAlign OptAddrSpace %token ZEROINITIALIZER TRUETOK FALSETOK BEGINTOK ENDTOK %token DECLARE DEFINE GLOBAL CONSTANT SECTION ALIAS VOLATILE THREAD_LOCAL @@ -1137,6 +1137,9 @@ LocalName : LOCALVAR | STRINGCONSTANT | PCTSTRINGCONSTANT ; OptLocalName : LocalName | /*empty*/ { $$ = 0; }; +OptAddrSpace : ADDRSPACE '(' EUINT64VAL ')' { $$=$3; } + | /*empty*/ { $$=0; }; + /// OptLocalAssign - Value producing statements have an optional assignment /// component. OptLocalAssign : LocalName '=' { @@ -1316,17 +1319,10 @@ $$ = new PATypeHolder($1); CHECK_FOR_ERROR } - | Types '*' { // Pointer type? + | Types OptAddrSpace '*' { // Pointer type? if (*$1 == Type::LabelTy) GEN_ERROR("Cannot form a pointer to a basic block"); - $$ = new PATypeHolder(HandleUpRefs(PointerType::get(*$1))); - delete $1; - CHECK_FOR_ERROR - } - | Types ADDRSPACE '(' EUINT64VAL ')' '*' { // Pointer type? - if (*$1 == Type::LabelTy) - GEN_ERROR("Cannot form a pointer to a basic block"); - $$ = new PATypeHolder(HandleUpRefs(PointerType::get(*$1, $4))); + $$ = new PATypeHolder(HandleUpRefs(PointerType::get(*$1, $2))); delete $1; CHECK_FOR_ERROR } @@ -2073,41 +2069,31 @@ } CHECK_FOR_ERROR } - | OptGlobalAssign GVVisibilityStyle ThreadLocal GlobalType ConstVal { + | OptGlobalAssign GVVisibilityStyle ThreadLocal GlobalType ConstVal + OptAddrSpace { /* "Externally Visible" Linkage */ if ($5 == 0) GEN_ERROR("Global value initializer is not a constant"); CurGV = ParseGlobalVariable($1, GlobalValue::ExternalLinkage, - $2, $4, $5->getType(), $5, $3); - CHECK_FOR_ERROR - } GlobalVarAttributes { - CurGV = 0; - } - | OptGlobalAssign GVVisibilityStyle ThreadLocal GlobalType ConstVal - ADDRSPACE '(' EUINT64VAL ')' { - /* "Externally Visible" Linkage with address space qualifier */ - if ($5 == 0) - GEN_ERROR("Global value initializer is not a constant"); - CurGV = ParseGlobalVariable($1, GlobalValue::ExternalLinkage, - $2, $4, $5->getType(), $5, $3, $8); + $2, $4, $5->getType(), $5, $3, $6); CHECK_FOR_ERROR } GlobalVarAttributes { CurGV = 0; } | OptGlobalAssign GVInternalLinkage GVVisibilityStyle ThreadLocal GlobalType - ConstVal { + ConstVal OptAddrSpace { if ($6 == 0) GEN_ERROR("Global value initializer is not a constant"); - CurGV = ParseGlobalVariable($1, $2, $3, $5, $6->getType(), $6, $4); + CurGV = ParseGlobalVariable($1, $2, $3, $5, $6->getType(), $6, $4, $7); CHECK_FOR_ERROR } GlobalVarAttributes { CurGV = 0; } | OptGlobalAssign GVExternalLinkage GVVisibilityStyle ThreadLocal GlobalType - Types { + Types OptAddrSpace { if (!UpRefs.empty()) GEN_ERROR("Invalid upreference in type: " + (*$6)->getDescription()); - CurGV = ParseGlobalVariable($1, $2, $3, $5, *$6, 0, $4); + CurGV = ParseGlobalVariable($1, $2, $3, $5, *$6, 0, $4, $7); CHECK_FOR_ERROR delete $6; } GlobalVarAttributes { From evan.cheng at apple.com Wed Dec 12 03:26:24 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 12 Dec 2007 01:26:24 -0800 Subject: [llvm-commits] [llvm] r44877 - /llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp In-Reply-To: <200712112012.lBBKCCLQ029004@zion.cs.uiuc.edu> References: <200712112012.lBBKCCLQ029004@zion.cs.uiuc.edu> Message-ID: Hi Owen, I know it's work in progress. But could you add some comments? I would like to follow the code. :-) Thx, Evan On Dec 11, 2007, at 12:12 PM, Owen Anderson wrote: > Author: resistor > Date: Tue Dec 11 14:12:11 2007 > New Revision: 44877 > > URL: http://llvm.org/viewvc/llvm-project?rev=44877&view=rev > Log: > More progress on StrongPHIElimination. Now we actually USE the > DomForest! > > Modified: > llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp > > Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=44877&r1=44876&r2=44877&view=diff > > === > === > === > ===================================================================== > --- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original) > +++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Tue Dec 11 > 14:12:11 2007 > @@ -97,6 +97,9 @@ > void processBlock(MachineBasicBlock* MBB); > > std::vector computeDomForest(std::set& > instrs); > + void processPHIUnion(MachineInstr* Inst, > + std::set& PHIUnion, > + > std::vector& DF); > void breakCriticalEdges(MachineFunction &Fn); > > }; > @@ -303,6 +306,92 @@ > } > } > > +void StrongPHIElimination::processPHIUnion(MachineInstr* Inst, > + std::set& > PHIUnion, > + > std::vector& DF) { > + > + std::vector worklist(DF.begin(), DF.end()); > + SmallPtrSet visited; > + > + LiveVariables& LV = getAnalysis(); > + unsigned DestReg = Inst->getOperand(0).getReg(); > + > + while (!worklist.empty()) { > + DomForestNode* DFNode = worklist.back(); > + > + LiveVariables::VarInfo& Info = LV.getVarInfo(DFNode->getReg()); > + visited.insert(DFNode); > + > + bool inserted = false; > + SmallPtrSet interferences; > + for (DomForestNode::iterator CI = DFNode->begin(), CE = DFNode- > >end(); > + CI != CE; ++CI) { > + DomForestNode* child = *CI; > + LiveVariables::VarInfo& CInfo = LV.getVarInfo(child->getReg()); > + > + if (isLiveOut(Info, CInfo.DefInst->getParent())) { > + interferences.insert(child); > + } else if (isLiveIn(Info, CInfo.DefInst->getParent()) || > + Info.DefInst->getParent() == CInfo.DefInst- > >getParent()) { > + // FIXME: Add (p, c) to possible local interferences > + } > + > + if (!visited.count(child)) { > + worklist.push_back(child); > + inserted = true; > + } > + } > + > + if (interferences.size() == 1) { > + DomForestNode* child = *interferences.begin(); > + > + unsigned numParentCopies = 0; > + unsigned numChildCopies = 0; > + for (int i = Inst->getNumOperands() - 1; i >= 2; i-=2) { > + unsigned SrcReg = Inst->getOperand(i-1).getReg(); > + if (SrcReg == DFNode->getReg()) numParentCopies++; > + else if (SrcReg == child->getReg()) numChildCopies++; > + } > + > + if (numParentCopies < numChildCopies) { > + // Insert copies for child > + for (int i = Inst->getNumOperands() - 1; i >= 2; i-=2) { > + if (Inst->getOperand(i-1).getReg() == child->getReg()) { > + unsigned SrcReg = Inst->getOperand(i-1).getReg(); > + MachineBasicBlock* From = Inst->getOperand(i).getMBB(); > + > + Waiting[From].push_back(std::make_pair(SrcReg, DestReg)); > + } > + } > + > + // FIXME: Make child's children parent's children > + } else { > + // Insert copies for parent > + for (int i = Inst->getNumOperands() - 1; i >= 2; i-=2) { > + if (Inst->getOperand(i-1).getReg() == DFNode->getReg()) { > + unsigned SrcReg = Inst->getOperand(i-1).getReg(); > + MachineBasicBlock* From = Inst->getOperand(i).getMBB(); > + > + Waiting[From].push_back(std::make_pair(SrcReg, DestReg)); > + } > + } > + } > + } else if (interferences.size() > 1) { > + // Insert copies for parent > + for (int i = Inst->getNumOperands() - 1; i >= 2; i-=2) { > + if (Inst->getOperand(i-1).getReg() == DFNode->getReg()) { > + unsigned SrcReg = Inst->getOperand(i-1).getReg(); > + MachineBasicBlock* From = Inst->getOperand(i).getMBB(); > + > + Waiting[From].push_back(std::make_pair(SrcReg, DestReg)); > + } > + } > + } > + > + if (!inserted) worklist.pop_back(); > + } > +} > + > /// breakCriticalEdges - Break critical edges coming into blocks > with PHI > /// nodes, preserving dominator and livevariable info. > void StrongPHIElimination::breakCriticalEdges(MachineFunction &Fn) { > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From christopher.lamb at gmail.com Wed Dec 12 03:32:47 2007 From: christopher.lamb at gmail.com (Christopher Lamb) Date: Wed, 12 Dec 2007 01:32:47 -0800 Subject: [llvm-commits] [llvm] r44858 - in /llvm/trunk: include/llvm/Bitcode/LLVMBitCodes.h include/llvm/DerivedTypes.h include/llvm/GlobalVariable.h include/llvm/Instructions.h lib/AsmParser/LLLexer.cpp lib/AsmParser/llvmAsmParser.y lib/Bitcode/Reader/BitcodeReader.cpp lib/Bitcode/Writer/BitcodeWriter.cpp lib/VMCore/AsmWriter.cpp lib/VMCore/Constants.cpp lib/VMCore/Globals.cpp lib/VMCore/Instructions.cpp lib/VMCore/Type.cpp test/Assembler/2007-12-11-AddressSpaces.ll tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp In-Reply-To: <6E1DAB22-449F-4C35-9AF2-E209CE95B361@apple.com> References: <200712110859.lBB8x7Sj025775@zion.cs.uiuc.edu> <6E1DAB22-449F-4C35-9AF2-E209CE95B361@apple.com> Message-ID: <6E5231BD-D869-4BA5-BD78-0188C08DE353@gmail.com> On Dec 11, 2007, at 4:12 PM, Chris Lattner wrote: > Making the address space default to zero is convenient, but > dangerous. This means that xforms that play with pointers need to be > very careful to propagate this info in some cases. Do you think this > is the best way to go? Do many clients of PointerType::get need to > be aware of addr spaces? I'm going to add a new method for getting a pointer type 'PointerType::getUnqual()' that only takes an element type, the standard 'PointerType::get()' will take both an element type and address space with no default values. This should at least make it explicit in the code which clients do not pass in an address space. There are currently many clients, so this should help make the work incremental. -- Christopher Lamb -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20071212/1df88096/attachment.html From evan.cheng at apple.com Wed Dec 12 03:38:32 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 12 Dec 2007 01:38:32 -0800 Subject: [llvm-commits] [llvm] r44874 - /llvm/trunk/lib/CodeGen/MachineLICM.cpp In-Reply-To: <200712111940.lBBJe6M9026673@zion.cs.uiuc.edu> References: <200712111940.lBBJe6M9026673@zion.cs.uiuc.edu> Message-ID: <95943504-E295-4844-98FD-3CD53F520457@apple.com> On Dec 11, 2007, at 11:40 AM, Bill Wendling wrote: > Author: void > Date: Tue Dec 11 13:40:06 2007 > New Revision: 44874 > > URL: http://llvm.org/viewvc/llvm-project?rev=44874&view=rev > Log: > Blark! How in the world did this work without this?! Is this just cosmetic changes? I am sure I see why this is better? Just curious. One thing that is some what annoying to me is if LICM is after live variables then it won't need to compute vreg def info or liveness info. I wonder if it is possible to move the pass after live variables? Evan > Modified: > llvm/trunk/lib/CodeGen/MachineLICM.cpp > > Modified: llvm/trunk/lib/CodeGen/MachineLICM.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineLICM.cpp?rev=44874&r1=44873&r2=44874&view=diff > > === > === > === > ===================================================================== > --- llvm/trunk/lib/CodeGen/MachineLICM.cpp (original) > +++ llvm/trunk/lib/CodeGen/MachineLICM.cpp Tue Dec 11 13:40:06 2007 > @@ -43,6 +43,8 @@ > > namespace { > class VISIBILITY_HIDDEN MachineLICM : public MachineFunctionPass { > + MachineFunction *CurMF;// Current MachineFunction > + > // Various analyses that we use... > MachineLoopInfo *LI; // Current MachineLoopInfo > MachineDominatorTree *DT; // Machine dominator tree for the > current Loop > @@ -91,7 +93,7 @@ > /// MapVirtualRegisterDefs - Create a map of which machine > instruction > /// defines a virtual register. > /// > - void MapVirtualRegisterDefs(const MachineFunction &MF); > + void MapVirtualRegisterDefs(); > > /// IsInSubLoop - A little predicate that returns true if the > specified > /// basic block is in a subloop of the current one, not the > current one > @@ -182,12 +184,15 @@ > if (!PerformLICM) return false; // For debugging. > > Changed = false; > - TII = MF.getTarget().getInstrInfo(); > + CurMF = &MF; > + TII = CurMF->getTarget().getInstrInfo(); > > // Get our Loop information... > LI = &getAnalysis(); > DT = &getAnalysis(); > > + MapVirtualRegisterDefs(); > + > for (MachineLoopInfo::iterator > I = LI->begin(), E = LI->end(); I != E; ++I) { > MachineLoop *L = *I; > @@ -205,9 +210,9 @@ > /// MapVirtualRegisterDefs - Create a map of which machine > instruction defines a > /// virtual register. > /// > -void MachineLICM::MapVirtualRegisterDefs(const MachineFunction &MF) { > +void MachineLICM::MapVirtualRegisterDefs() { > for (MachineFunction::const_iterator > - I = MF.begin(), E = MF.end(); I != E; ++I) { > + I = CurMF->begin(), E = CurMF->end(); I != E; ++I) { > const MachineBasicBlock &MBB = *I; > > for (MachineBasicBlock::const_iterator > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From baldrick at free.fr Wed Dec 12 09:11:41 2007 From: baldrick at free.fr (Duncan Sands) Date: Wed, 12 Dec 2007 15:11:41 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r44935 - /llvm-gcc-4.2/trunk/gcc/passes.c Message-ID: <200712121511.lBCFBgZ5019077@zion.cs.uiuc.edu> Author: baldrick Date: Wed Dec 12 09:11:38 2007 New Revision: 44935 URL: http://llvm.org/viewvc/llvm-project?rev=44935&view=rev Log: Turn off ipa-pure-const, the pass that deduces whether functions are pure and constant: it makes wrong deductions because it doesn't know about LLVM's array_ref hack. At some point we should turn of all of the ipa passes, however the gcc inlining pass knows how to deal with exception handlers much better than we do, so leave that on for the moment. Modified: llvm-gcc-4.2/trunk/gcc/passes.c Modified: llvm-gcc-4.2/trunk/gcc/passes.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/passes.c?rev=44935&r1=44934&r2=44935&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/passes.c (original) +++ llvm-gcc-4.2/trunk/gcc/passes.c Wed Dec 12 09:11:38 2007 @@ -485,10 +485,14 @@ NEXT_PASS (pass_early_local_passes); NEXT_PASS (pass_ipa_cp); NEXT_PASS (pass_ipa_inline); +/* LLVM LOCAL begin */ +#ifndef ENABLE_LLVM NEXT_PASS (pass_ipa_reference); NEXT_PASS (pass_ipa_pure_const); NEXT_PASS (pass_ipa_type_escape); NEXT_PASS (pass_ipa_pta); +#endif +/* LLVM LOCAL end */ *p = NULL; /* All passes needed to lower the function into shape optimizers can From wmatyjewicz at fastmail.fm Wed Dec 12 09:21:33 2007 From: wmatyjewicz at fastmail.fm (Wojciech Matyjewicz) Date: Wed, 12 Dec 2007 15:21:33 -0000 Subject: [llvm-commits] [llvm] r44936 - in /llvm/trunk: lib/Transforms/Scalar/InstructionCombining.cpp test/Transforms/InstCombine/2007-12-12-GEPScale.ll Message-ID: <200712121521.lBCFLXQm019435@zion.cs.uiuc.edu> Author: wmat Date: Wed Dec 12 09:21:32 2007 New Revision: 44936 URL: http://llvm.org/viewvc/llvm-project?rev=44936&view=rev Log: 1. "Upgrage" comments. 2. Using zero-extended value of Scale and unsigned division is safe provided that Scale doesn't have the sign bit set. Previously these 2 instructions: %p = bitcast [100 x {i8,i8,i8}]* %x to i8* %q = getelementptr i8* %p, i32 -4 were combined into: %q = getelementptr [100 x { i8, i8, i8 }]* %x, i32 0, i32 1431655764, i32 0 what was incorrect. Added: llvm/trunk/test/Transforms/InstCombine/2007-12-12-GEPScale.ll Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=44936&r1=44935&r2=44936&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Wed Dec 12 09:21:32 2007 @@ -8879,8 +8879,8 @@ if (!isa(X->getType())) { // Not interesting. Source pointer must be a cast from pointer. } else if (HasZeroPointerIndex) { - // transform: GEP (cast [10 x ubyte]* X to [0 x ubyte]*), long 0, ... - // into : GEP [10 x ubyte]* X, long 0, ... + // transform: GEP (bitcast [10 x i8]* X to [0 x i8]*), i32 0, ... + // into : GEP [10 x i8]* X, i32 0, ... // // This occurs when the program declares an array extern like "int X[];" // @@ -8900,8 +8900,8 @@ } } else if (GEP.getNumOperands() == 2) { // Transform things like: - // %t = getelementptr ubyte* cast ([2 x int]* %str to uint*), uint %V - // into: %t1 = getelementptr [2 x int*]* %str, int 0, uint %V; cast + // %t = getelementptr i32* bitcast ([2 x i32]* %str to i32*), i32 %V + // into: %t1 = getelementptr [2 x i32]* %str, i32 0, i32 %V; bitcast const Type *SrcElTy = cast(X->getType())->getElementType(); const Type *ResElTy=cast(PtrOp->getType())->getElementType(); if (isa(SrcElTy) && @@ -8917,12 +8917,11 @@ } // Transform things like: - // getelementptr sbyte* cast ([100 x double]* X to sbyte*), int %tmp + // getelementptr i8* bitcast ([100 x double]* X to i8*), i32 %tmp // (where tmp = 8*tmp2) into: - // getelementptr [100 x double]* %arr, int 0, int %tmp.2 + // getelementptr [100 x double]* %arr, i32 0, i32 %tmp2; bitcast - if (isa(SrcElTy) && - (ResElTy == Type::Int8Ty || ResElTy == Type::Int8Ty)) { + if (isa(SrcElTy) && ResElTy == Type::Int8Ty) { uint64_t ArrayEltSize = TD->getABITypeSize(cast(SrcElTy)->getElementType()); @@ -8949,16 +8948,18 @@ NewIdx = Inst->getOperand(0); } } - + // If the index will be to exactly the right offset with the scale taken - // out, perform the transformation. - if (Scale && Scale->getZExtValue() % ArrayEltSize == 0) { - if (isa(Scale)) - Scale = ConstantInt::get(Scale->getType(), - Scale->getZExtValue() / ArrayEltSize); + // out, perform the transformation. Note, we don't know whether Scale is + // signed or not. We'll use unsigned version of division/modulo + // operation after making sure Scale doesn't have the sign bit set. + if (Scale && Scale->getSExtValue() >= 0LL && + Scale->getZExtValue() % ArrayEltSize == 0) { + Scale = ConstantInt::get(Scale->getType(), + Scale->getZExtValue() / ArrayEltSize); if (Scale->getZExtValue() != 1) { Constant *C = ConstantExpr::getIntegerCast(Scale, NewIdx->getType(), - true /*SExt*/); + false /*ZExt*/); Instruction *Sc = BinaryOperator::createMul(NewIdx, C, "idxscale"); NewIdx = InsertNewInstBefore(Sc, GEP); } Added: llvm/trunk/test/Transforms/InstCombine/2007-12-12-GEPScale.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2007-12-12-GEPScale.ll?rev=44936&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/2007-12-12-GEPScale.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/2007-12-12-GEPScale.ll Wed Dec 12 09:21:32 2007 @@ -0,0 +1,10 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep 1431655764 + +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" + +define i8* @foo([100 x {i8,i8,i8}]* %x) { +entry: + %p = bitcast [100 x {i8,i8,i8}]* %x to i8* + %q = getelementptr i8* %p, i32 -4 + ret i8* %q +} From baldrick at free.fr Wed Dec 12 10:01:51 2007 From: baldrick at free.fr (Duncan Sands) Date: Wed, 12 Dec 2007 16:01:51 -0000 Subject: [llvm-commits] [llvm] r44937 - in /llvm/trunk/lib: Analysis/AliasAnalysis.cpp VMCore/Instruction.cpp Message-ID: <200712121601.lBCG1vKq021208@zion.cs.uiuc.edu> Author: baldrick Date: Wed Dec 12 10:01:40 2007 New Revision: 44937 URL: http://llvm.org/viewvc/llvm-project?rev=44937&view=rev Log: Revert r44626, which turned off the use of readonly and readnone for functions with bodies because it broke llvm-gcc-4.2 bootstrap. It turns out that, because of LLVM's array_ref hack, gcc was computing pure/const attributes wrong (now fixed by turning off the gcc ipa-pure-const pass). Modified: llvm/trunk/lib/Analysis/AliasAnalysis.cpp llvm/trunk/lib/VMCore/Instruction.cpp Modified: llvm/trunk/lib/Analysis/AliasAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasAnalysis.cpp?rev=44937&r1=44936&r2=44937&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/AliasAnalysis.cpp (original) +++ llvm/trunk/lib/Analysis/AliasAnalysis.cpp Wed Dec 12 10:01:40 2007 @@ -116,17 +116,13 @@ AliasAnalysis::ModRefBehavior AliasAnalysis::getModRefBehavior(CallSite CS, std::vector *Info) { - if (CS.doesNotAccessMemory() && - // FIXME: workaround gcc bootstrap breakage - CS.getCalledFunction() && CS.getCalledFunction()->isDeclaration()) + if (CS.doesNotAccessMemory()) // Can't do better than this. return DoesNotAccessMemory; ModRefBehavior MRB = UnknownModRefBehavior; if (Function *F = CS.getCalledFunction()) MRB = getModRefBehavior(F, CS, Info); - if (MRB != DoesNotAccessMemory && CS.onlyReadsMemory() && - // FIXME: workaround gcc bootstrap breakage - CS.getCalledFunction() && CS.getCalledFunction()->isDeclaration()) + if (MRB != DoesNotAccessMemory && CS.onlyReadsMemory()) return OnlyReadsMemory; return MRB; } @@ -134,15 +130,11 @@ AliasAnalysis::ModRefBehavior AliasAnalysis::getModRefBehavior(Function *F, std::vector *Info) { - if (F->doesNotAccessMemory() && - // FIXME: workaround gcc bootstrap breakage - F->isDeclaration()) + if (F->doesNotAccessMemory()) // Can't do better than this. return DoesNotAccessMemory; ModRefBehavior MRB = getModRefBehavior(F, CallSite(), Info); - if (MRB != DoesNotAccessMemory && F->onlyReadsMemory() && - // FIXME: workaround gcc bootstrap breakage - F->isDeclaration()) + if (MRB != DoesNotAccessMemory && F->onlyReadsMemory()) return OnlyReadsMemory; return MRB; } Modified: llvm/trunk/lib/VMCore/Instruction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instruction.cpp?rev=44937&r1=44936&r2=44937&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Instruction.cpp (original) +++ llvm/trunk/lib/VMCore/Instruction.cpp Wed Dec 12 10:01:40 2007 @@ -13,7 +13,6 @@ #include "llvm/Type.h" #include "llvm/Instructions.h" -#include "llvm/IntrinsicInst.h" // FIXME: remove #include "llvm/Function.h" #include "llvm/Support/CallSite.h" #include "llvm/Support/LeakDetector.h" @@ -209,8 +208,6 @@ case Instruction::VAArg: return true; case Instruction::Call: - if (!isa(this)) - return true; // FIXME: workaround gcc bootstrap breakage return !cast(this)->onlyReadsMemory(); case Instruction::Load: return cast(this)->isVolatile(); From clattner at apple.com Wed Dec 12 11:59:22 2007 From: clattner at apple.com (Chris Lattner) Date: Wed, 12 Dec 2007 09:59:22 -0800 Subject: [llvm-commits] [llvm] r44874 - /llvm/trunk/lib/CodeGen/MachineLICM.cpp In-Reply-To: <95943504-E295-4844-98FD-3CD53F520457@apple.com> References: <200712111940.lBBJe6M9026673@zion.cs.uiuc.edu> <95943504-E295-4844-98FD-3CD53F520457@apple.com> Message-ID: <054411A4-9CCD-4C3F-8AAC-A86644D8CB1C@apple.com> On Dec 12, 2007, at 1:38 AM, Evan Cheng wrote: > > > On Dec 11, 2007, at 11:40 AM, Bill Wendling > wrote: > >> Author: void >> Date: Tue Dec 11 13:40:06 2007 >> New Revision: 44874 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=44874&view=rev >> Log: >> Blark! How in the world did this work without this?! > > One thing that is some what annoying to me is if LICM is after live > variables then it won't need to compute vreg def info or liveness > info. I wonder if it is possible to move the pass after live > variables? What would this give? liveness for vregs is trivial in ssa form, no? -Chris From clattner at apple.com Wed Dec 12 12:49:05 2007 From: clattner at apple.com (Chris Lattner) Date: Wed, 12 Dec 2007 10:49:05 -0800 Subject: [llvm-commits] [llvm] r44858 - in /llvm/trunk: include/llvm/Bitcode/LLVMBitCodes.h include/llvm/DerivedTypes.h include/llvm/GlobalVariable.h include/llvm/Instructions.h lib/AsmParser/LLLexer.cpp lib/AsmParser/llvmAsmParser.y lib/Bitcode/Reader/BitcodeReader.cpp lib/Bitcode/Writer/BitcodeWriter.cpp lib/VMCore/AsmWriter.cpp lib/VMCore/Constants.cpp lib/VMCore/Globals.cpp lib/VMCore/Instructions.cpp lib/VMCore/Type.cpp test/Assembler/2007-12-11-AddressSpaces.ll tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp In-Reply-To: <0BE1B1E1-B14C-4481-9C55-E1AB9AF08333@gmail.com> References: <200712110859.lBB8x7Sj025775@zion.cs.uiuc.edu> <6E1DAB22-449F-4C35-9AF2-E209CE95B361@apple.com> <0BE1B1E1-B14C-4481-9C55-E1AB9AF08333@gmail.com> Message-ID: On Dec 12, 2007, at 12:39 AM, Christopher Lamb wrote: > > On Dec 11, 2007, at 4:12 PM, Chris Lattner wrote: > >> Also, should it be possible to place a function in an address space? > > I think probably not... > >> Does the embedded C spec allow this? > > "A function type shall not be qualified by an address-space > qualifier." Ok, sounds great to me. Simple is good. -Chris From clattner at apple.com Wed Dec 12 12:56:01 2007 From: clattner at apple.com (Chris Lattner) Date: Wed, 12 Dec 2007 10:56:01 -0800 Subject: [llvm-commits] [llvm] r44858 - in /llvm/trunk: include/llvm/Bitcode/LLVMBitCodes.h include/llvm/DerivedTypes.h include/llvm/GlobalVariable.h include/llvm/Instructions.h lib/AsmParser/LLLexer.cpp lib/AsmParser/llvmAsmParser.y lib/Bitcode/Reader/BitcodeReader.cpp lib/Bitcode/Writer/BitcodeWriter.cpp lib/VMCore/AsmWriter.cpp lib/VMCore/Constants.cpp lib/VMCore/Globals.cpp lib/VMCore/Instructions.cpp lib/VMCore/Type.cpp test/Assembler/2007-12-11-AddressSpaces.ll tools/llvm-bcanalyzer/llvm-bcanalyzer.cpp In-Reply-To: <6E5231BD-D869-4BA5-BD78-0188C08DE353@gmail.com> References: <200712110859.lBB8x7Sj025775@zion.cs.uiuc.edu> <6E1DAB22-449F-4C35-9AF2-E209CE95B361@apple.com> <6E5231BD-D869-4BA5-BD78-0188C08DE353@gmail.com> Message-ID: On Dec 12, 2007, at 1:32 AM, Christopher Lamb wrote: > > On Dec 11, 2007, at 4:12 PM, Chris Lattner wrote: > >> Making the address space default to zero is convenient, but >> dangerous. This means that xforms that play with pointers need to be >> very careful to propagate this info in some cases. Do you think this >> is the best way to go? Do many clients of PointerType::get need to >> be aware of addr spaces? > > I'm going to add a new method for getting a pointer type > 'PointerType::getUnqual()' that only takes an element type, the > standard 'PointerType::get()' will take both an element type and > address space with no default values. This should at least make it > explicit in the code which clients do not pass in an address space. > There are currently many clients, so this should help make the work > incremental. Excellent idea, -Chris From clattner at apple.com Wed Dec 12 12:56:44 2007 From: clattner at apple.com (Chris Lattner) Date: Wed, 12 Dec 2007 10:56:44 -0800 Subject: [llvm-commits] [llvm] r44933 - in /llvm/trunk: docs/LangRef.html include/llvm/Bitcode/LLVMBitCodes.h lib/AsmParser/llvmAsmParser.y lib/Bitcode/Writer/BitcodeWriter.cpp test/Assembler/2007-12-11-AddressSpaces.ll In-Reply-To: <200712120844.lBC8id5p026891@zion.cs.uiuc.edu> References: <200712120844.lBC8id5p026891@zion.cs.uiuc.edu> Message-ID: <1E5A8716-FDAB-4BFE-B773-99572BEF3467@apple.com> > URL: http://llvm.org/viewvc/llvm-project?rev=44933&view=rev > Log: > Implement part of review feedback for address spaces. Also, please update the alloca/malloc descriptions to say that the pointer has to be in the default address space, and plz make the verifier check this. Thanks! -Chris From asl at math.spbu.ru Wed Dec 12 13:08:44 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Wed, 12 Dec 2007 19:08:44 -0000 Subject: [llvm-commits] [llvm] r44952 - /llvm/trunk/include/llvm/ADT/Trie.h Message-ID: <200712121908.lBCJ8iiO032305@zion.cs.uiuc.edu> Author: asl Date: Wed Dec 12 13:08:44 2007 New Revision: 44952 URL: http://llvm.org/viewvc/llvm-project?rev=44952&view=rev Log: Use vector for child storage instead of map. This will also make our life during future GraphTraits'ing slightly easier. Modified: llvm/trunk/include/llvm/ADT/Trie.h Modified: llvm/trunk/include/llvm/ADT/Trie.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Trie.h?rev=44952&r1=44951&r2=44952&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/Trie.h (original) +++ llvm/trunk/include/llvm/ADT/Trie.h Wed Dec 12 13:08:44 2007 @@ -22,7 +22,6 @@ // FIXME: // - Labels are usually small, maybe it's better to use SmallString -// - Something efficient for child storage // - Should we use char* during construction? // - Should we templatize Empty with traits-like interface? // - GraphTraits interface @@ -39,10 +38,21 @@ DontMatch = 0, HaveCommonPart } QueryResult; + typedef std::vector NodeVector; + typedef typename std::vector::iterator NodeVectorIter; + + struct NodeCmp { + bool operator() (Node* N1, Node* N2) { + return (N1->Label[0] < N2->Label[0]); + } + bool operator() (Node* N, char Id) { + return (N->Label[0] < Id); + } + }; std::string Label; Payload Data; - std::map Children; + NodeVector Children; public: inline explicit Node(const Payload& data, const std::string& label = ""): Label(label), Data(data) { } @@ -70,9 +80,44 @@ inline void setLabel(const std::string& label) { Label = label; } inline const std::string& getLabel() const { return Label; } - inline bool addEdge(Node* N) { - const std::string& Label = N->getLabel(); - return Children.insert(std::make_pair(Label[0], N)).second; +#if 0 + inline void dump() { + std::cerr << "Node: " << this << "\n" + << "Label: " << Label << "\n" + << "Children:\n"; + + for (NodeVectorIter I = Children.begin(), E = Children.end(); I != E; ++I) + std::cerr << (*I)->Label << "\n"; + } +#endif + + inline void addEdge(Node* N) { + if (Children.empty()) + Children.push_back(N); + else { + NodeVectorIter I = std::lower_bound(Children.begin(), Children.end(), + N, NodeCmp()); + // FIXME: no dups are allowed + Children.insert(I, N); + } + } + + inline Node* getEdge(char Id) { + Node* fNode = NULL; + NodeVectorIter I = std::lower_bound(Children.begin(), Children.end(), + Id, NodeCmp()); + if (I != Children.end() && (*I)->Label[0] == Id) + fNode = *I; + + return fNode; + } + + inline void setEdge(Node* N) { + char Id = N->Label[0]; + NodeVectorIter I = std::lower_bound(Children.begin(), Children.end(), + Id, NodeCmp()); + assert(I != Children.end() && "Node does not exists!"); + *I = N; } QueryResult query(const std::string& s) const { @@ -101,6 +146,8 @@ std::vector Nodes; Payload Empty; + inline Node* getRoot() const { return Nodes[0]; } + inline Node* addNode(const Payload& data, const std::string label = "") { Node* N = new Node(data, label); Nodes.push_back(N); @@ -108,21 +155,19 @@ } inline Node* splitEdge(Node* N, char Id, size_t index) { - assert(N->Children.count(Id) && "Node doesn't exist"); - - Node* eNode = N->Children[Id]; + Node* eNode = N->getEdge(Id); + assert(eNode && "Node doesn't exist"); const std::string &l = eNode->Label; assert(index > 0 && index < l.length() && "Trying to split too far!"); std::string l1 = l.substr(0, index); std::string l2 = l.substr(index); - eNode->Label = l2; - Node* nNode = addNode(Empty, l1); - nNode->addEdge(eNode); + N->setEdge(nNode); - N->Children[Id] = nNode; + eNode->Label = l2; + nNode->addEdge(eNode); return nNode; } @@ -136,8 +181,6 @@ delete Nodes[i]; } - inline Node* getRoot() const { return Nodes[0]; } - bool addString(const std::string& s, const Payload& data) { Node* cNode = getRoot(); Node* tNode = NULL; @@ -145,8 +188,7 @@ while (tNode == NULL) { char Id = s1[0]; - if (cNode->Children.count(Id)) { - Node* nNode = cNode->Children[Id]; + if (Node* nNode = cNode->getEdge(Id)) { typename Node::QueryResult r = nNode->query(s1); switch (r) { @@ -167,7 +209,7 @@ nNode = splitEdge(cNode, Id, r); tNode = addNode(data, s1.substr(r)); nNode->addEdge(tNode); - } + } } else { tNode = addNode(data, s1); cNode->addEdge(tNode); @@ -183,8 +225,8 @@ std::string s1(s); while (tNode == NULL) { - if (cNode->Children.count(s1[0])) { - Node* nNode = cNode->Children[s1[0]]; + char Id = s1[0]; + if (Node* nNode = cNode->getEdge(Id)) { typename Node::QueryResult r = nNode->query(s1); switch (r) { From isanbard at gmail.com Wed Dec 12 13:12:33 2007 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 12 Dec 2007 11:12:33 -0800 Subject: [llvm-commits] [llvm] r44874 - /llvm/trunk/lib/CodeGen/MachineLICM.cpp In-Reply-To: <95943504-E295-4844-98FD-3CD53F520457@apple.com> References: <200712111940.lBBJe6M9026673@zion.cs.uiuc.edu> <95943504-E295-4844-98FD-3CD53F520457@apple.com> Message-ID: <16e5fdf90712121112j71e014f7nab5ec3aa80c361e9@mail.gmail.com> On Dec 12, 2007 1:38 AM, Evan Cheng wrote: > > > On Dec 11, 2007, at 11:40 AM, Bill Wendling wrote: > > > Author: void > > Date: Tue Dec 11 13:40:06 2007 > > New Revision: 44874 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=44874&view=rev > > Log: > > Blark! How in the world did this work without this?! > > Is this just cosmetic changes? I am sure I see why this is better? > Just curious. > This is the part of the patch that has the "real" change. The rest are cosmetic. // Get our Loop information... LI = &getAnalysis(); DT = &getAnalysis(); + MapVirtualRegisterDefs(); + > One thing that is some what annoying to me is if LICM is after live > variables then it won't need to compute vreg def info or liveness > info. I wonder if it is possible to move the pass after live variables? > I'm sure I could move it, but as Chris asked, isn't it trivial to get this information anyway? Also, I'm kind of hesitant to put so much effort into compile-time performance issues when it doesn't even have partial (let alone full) functionality right now. We don't know what impact any of those optimizations have or if they are necessary yet. :-) -bw From evan.cheng at apple.com Wed Dec 12 13:32:41 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 12 Dec 2007 11:32:41 -0800 Subject: [llvm-commits] [llvm] r44874 - /llvm/trunk/lib/CodeGen/MachineLICM.cpp In-Reply-To: <16e5fdf90712121112j71e014f7nab5ec3aa80c361e9@mail.gmail.com> References: <200712111940.lBBJe6M9026673@zion.cs.uiuc.edu> <95943504-E295-4844-98FD-3CD53F520457@apple.com> <16e5fdf90712121112j71e014f7nab5ec3aa80c361e9@mail.gmail.com> Message-ID: <097D7F84-E3A3-4862-9FE6-1931583D9A6B@apple.com> On Dec 12, 2007, at 11:12 AM, Bill Wendling wrote: > >> One thing that is some what annoying to me is if LICM is after live >> variables then it won't need to compute vreg def info or liveness >> info. I wonder if it is possible to move the pass after live >> variables? >> > I'm sure I could move it, but as Chris asked, isn't it trivial to get > this information anyway? Also, I'm kind of hesitant to put so much > effort into compile-time performance issues when it doesn't even have > partial (let alone full) functionality right now. We don't know what > impact any of those optimizations have or if they are necessary yet. > :-) It's something to keep in mind. Not critical right now if we are not hoisting anything with implicit defs / uses. If we are keeping LICM before livevariables, we will have to compute liveness in the BB's where the invariants are hoisted to. Now that I think about it, we *cannot* use the register scavenger to do this because it also depends on kill / dead markers on the operands. The scavenger's job is not to add the kill / dead markers, it is to track what registers are live at any point of the BB. This means you'll have to walk the BB and track all physical register defs and uses in the BB. Evan > > -bw > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From evan.cheng at apple.com Wed Dec 12 13:59:03 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 12 Dec 2007 11:59:03 -0800 Subject: [llvm-commits] [llvm] r44874 - /llvm/trunk/lib/CodeGen/MachineLICM.cpp In-Reply-To: <054411A4-9CCD-4C3F-8AAC-A86644D8CB1C@apple.com> References: <200712111940.lBBJe6M9026673@zion.cs.uiuc.edu> <95943504-E295-4844-98FD-3CD53F520457@apple.com> <054411A4-9CCD-4C3F-8AAC-A86644D8CB1C@apple.com> Message-ID: <26830602-E42C-43DB-A358-BCB3F351AF80@apple.com> On Dec 12, 2007, at 9:59 AM, Chris Lattner wrote: > > On Dec 12, 2007, at 1:38 AM, Evan Cheng wrote: > >> >> >> On Dec 11, 2007, at 11:40 AM, Bill Wendling >> wrote: >> >>> Author: void >>> Date: Tue Dec 11 13:40:06 2007 >>> New Revision: 44874 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=44874&view=rev >>> Log: >>> Blark! How in the world did this work without this?! >> >> One thing that is some what annoying to me is if LICM is after live >> variables then it won't need to compute vreg def info or liveness >> info. I wonder if it is possible to move the pass after live >> variables? > > What would this give? liveness for vregs is trivial in ssa form, no? But not physical registers. Evan > > -Chris > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From evan.cheng at apple.com Wed Dec 12 14:14:02 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 12 Dec 2007 12:14:02 -0800 Subject: [llvm-commits] [llvm] r44874 - /llvm/trunk/lib/CodeGen/MachineLICM.cpp In-Reply-To: <26830602-E42C-43DB-A358-BCB3F351AF80@apple.com> References: <200712111940.lBBJe6M9026673@zion.cs.uiuc.edu> <95943504-E295-4844-98FD-3CD53F520457@apple.com> <054411A4-9CCD-4C3F-8AAC-A86644D8CB1C@apple.com> <26830602-E42C-43DB-A358-BCB3F351AF80@apple.com> Message-ID: <27C0120E-B2C8-45FC-A4FA-A9C254006081@apple.com> vreg definition info is trivial but there is no reverse link from vreg to defining MachineInstruction. That's what MachineLICM::MapVirtualRegisterDefs() is constructing. Evan On Dec 12, 2007, at 11:59 AM, Evan Cheng wrote: > > On Dec 12, 2007, at 9:59 AM, Chris Lattner wrote: > >> >> On Dec 12, 2007, at 1:38 AM, Evan Cheng wrote: >> >>> >>> >>> On Dec 11, 2007, at 11:40 AM, Bill Wendling >>> wrote: >>> >>>> Author: void >>>> Date: Tue Dec 11 13:40:06 2007 >>>> New Revision: 44874 >>>> >>>> URL: http://llvm.org/viewvc/llvm-project?rev=44874&view=rev >>>> Log: >>>> Blark! How in the world did this work without this?! >>> >>> One thing that is some what annoying to me is if LICM is after live >>> variables then it won't need to compute vreg def info or liveness >>> info. I wonder if it is possible to move the pass after live >>> variables? >> >> What would this give? liveness for vregs is trivial in ssa form, no? > > But not physical registers. > > Evan > >> >> -Chris >> _______________________________________________ >> 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 isanbard at gmail.com Wed Dec 12 16:02:05 2007 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 12 Dec 2007 14:02:05 -0800 Subject: [llvm-commits] [llvm] r44874 - /llvm/trunk/lib/CodeGen/MachineLICM.cpp In-Reply-To: <097D7F84-E3A3-4862-9FE6-1931583D9A6B@apple.com> References: <200712111940.lBBJe6M9026673@zion.cs.uiuc.edu> <95943504-E295-4844-98FD-3CD53F520457@apple.com> <16e5fdf90712121112j71e014f7nab5ec3aa80c361e9@mail.gmail.com> <097D7F84-E3A3-4862-9FE6-1931583D9A6B@apple.com> Message-ID: <16e5fdf90712121402q7c890ac1i6deaf9a8d0edff03@mail.gmail.com> On Dec 12, 2007 11:32 AM, Evan Cheng wrote: > On Dec 12, 2007, at 11:12 AM, Bill Wendling wrote: > > I'm sure I could move it, but as Chris asked, isn't it trivial to get > > this information anyway? Also, I'm kind of hesitant to put so much > > effort into compile-time performance issues when it doesn't even have > > partial (let alone full) functionality right now. We don't know what > > impact any of those optimizations have or if they are necessary yet. > > :-) > > It's something to keep in mind. Not critical right now if we are not > hoisting anything with implicit defs / uses. > Sounds good. :-) > If we are keeping LICM before livevariables, we will have to compute > liveness in the BB's where the invariants are hoisted to. Now that I > think about it, we *cannot* use the register scavenger to do this > because it also depends on kill / dead markers on the operands. The > scavenger's job is not to add the kill / dead markers, it is to track > what registers are live at any point of the BB. This means you'll > have to walk the BB and track all physical register defs and uses in > the BB. > I see. Okay, so by the time I get to the point where I'm moving instructions that access physical registers, I should have the pass after LiveVariables... -bw From djg at cray.com Wed Dec 12 16:21:26 2007 From: djg at cray.com (Dan Gohman) Date: Wed, 12 Dec 2007 22:21:26 -0000 Subject: [llvm-commits] [llvm] r44954 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/vec_ctbits.ll Message-ID: <200712122221.lBCMLRwY013938@zion.cs.uiuc.edu> Author: djg Date: Wed Dec 12 16:21:26 2007 New Revision: 44954 URL: http://llvm.org/viewvc/llvm-project?rev=44954&view=rev Log: Allow vector integer constants to be created with SelectionDAG::getConstant, in the same way as vector floating-point constants. This allows the legalize expansion code for @llvm.ctpop and friends to be usable with vector types. Added: llvm/trunk/test/CodeGen/X86/vec_ctbits.ll Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=44954&r1=44953&r2=44954&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Dec 12 16:21:26 2007 @@ -687,22 +687,35 @@ SDOperand SelectionDAG::getConstant(uint64_t Val, MVT::ValueType VT, bool isT) { assert(MVT::isInteger(VT) && "Cannot create FP integer constant!"); - assert(!MVT::isVector(VT) && "Cannot create Vector ConstantSDNodes!"); + + MVT::ValueType EltVT = + MVT::isVector(VT) ? MVT::getVectorElementType(VT) : VT; // Mask out any bits that are not valid for this constant. - Val &= MVT::getIntVTBitMask(VT); + Val &= MVT::getIntVTBitMask(EltVT); unsigned Opc = isT ? ISD::TargetConstant : ISD::Constant; FoldingSetNodeID ID; - AddNodeIDNode(ID, Opc, getVTList(VT), 0, 0); + AddNodeIDNode(ID, Opc, getVTList(EltVT), 0, 0); ID.AddInteger(Val); void *IP = 0; - if (SDNode *E = CSEMap.FindNodeOrInsertPos(ID, IP)) - return SDOperand(E, 0); - SDNode *N = new ConstantSDNode(isT, Val, VT); - CSEMap.InsertNode(N, IP); - AllNodes.push_back(N); - return SDOperand(N, 0); + SDNode *N = NULL; + if ((N = CSEMap.FindNodeOrInsertPos(ID, IP))) + if (!MVT::isVector(VT)) + return SDOperand(N, 0); + if (!N) { + N = new ConstantSDNode(isT, Val, EltVT); + CSEMap.InsertNode(N, IP); + AllNodes.push_back(N); + } + + SDOperand Result(N, 0); + if (MVT::isVector(VT)) { + SmallVector Ops; + Ops.assign(MVT::getVectorNumElements(VT), Result); + Result = getNode(ISD::BUILD_VECTOR, VT, &Ops[0], Ops.size()); + } + return Result; } SDOperand SelectionDAG::getConstantFP(const APFloat& V, MVT::ValueType VT, Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=44954&r1=44953&r2=44954&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Dec 12 16:21:26 2007 @@ -483,6 +483,12 @@ setOperationAction(ISD::CTPOP, (MVT::ValueType)VT, Expand); setOperationAction(ISD::CTTZ, (MVT::ValueType)VT, Expand); setOperationAction(ISD::CTLZ, (MVT::ValueType)VT, Expand); + setOperationAction(ISD::SHL, (MVT::ValueType)VT, Expand); + setOperationAction(ISD::SRA, (MVT::ValueType)VT, Expand); + setOperationAction(ISD::SRL, (MVT::ValueType)VT, Expand); + setOperationAction(ISD::ROTL, (MVT::ValueType)VT, Expand); + setOperationAction(ISD::ROTR, (MVT::ValueType)VT, Expand); + setOperationAction(ISD::BSWAP, (MVT::ValueType)VT, Expand); } if (Subtarget->hasMMX()) { Added: llvm/trunk/test/CodeGen/X86/vec_ctbits.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_ctbits.ll?rev=44954&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_ctbits.ll (added) +++ llvm/trunk/test/CodeGen/X86/vec_ctbits.ll Wed Dec 12 16:21:26 2007 @@ -0,0 +1,18 @@ +; RUN: llvm-as < %s | llc -march=x86-64 + +declare <2 x i64> @llvm.cttz.v2i64(<2 x i64>) +declare <2 x i64> @llvm.ctlz.v2i64(<2 x i64>) +declare <2 x i64> @llvm.ctpop.v2i64(<2 x i64>) + +define <2 x i64> @footz(<2 x i64> %a) { + %c = call <2 x i64> @llvm.cttz.v2i64(<2 x i64> %a) + ret <2 x i64> %c +} +define <2 x i64> @foolz(<2 x i64> %a) { + %c = call <2 x i64> @llvm.ctlz.v2i64(<2 x i64> %a) + ret <2 x i64> %c +} +define <2 x i64> @foopop(<2 x i64> %a) { + %c = call <2 x i64> @llvm.ctpop.v2i64(<2 x i64> %a) + ret <2 x i64> %c +} From djg at cray.com Wed Dec 12 16:25:09 2007 From: djg at cray.com (Dan Gohman) Date: Wed, 12 Dec 2007 22:25:09 -0000 Subject: [llvm-commits] [llvm] r44955 - /llvm/trunk/include/llvm/Target/TargetInstrInfo.h Message-ID: <200712122225.lBCMP9Jc014078@zion.cs.uiuc.edu> Author: djg Date: Wed Dec 12 16:25:09 2007 New Revision: 44955 URL: http://llvm.org/viewvc/llvm-project?rev=44955&view=rev Log: Remove a forward-declaration for a non-existant class. Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetInstrInfo.h?rev=44955&r1=44954&r2=44955&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetInstrInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetInstrInfo.h Wed Dec 12 16:25:09 2007 @@ -24,7 +24,6 @@ class MachineInstr; class TargetMachine; -class MachineCodeForInstruction; class TargetRegisterClass; class LiveVariables; From evan.cheng at apple.com Wed Dec 12 16:26:54 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 12 Dec 2007 14:26:54 -0800 Subject: [llvm-commits] [llvm] r44874 - /llvm/trunk/lib/CodeGen/MachineLICM.cpp In-Reply-To: <16e5fdf90712121402q7c890ac1i6deaf9a8d0edff03@mail.gmail.com> References: <200712111940.lBBJe6M9026673@zion.cs.uiuc.edu> <95943504-E295-4844-98FD-3CD53F520457@apple.com> <16e5fdf90712121112j71e014f7nab5ec3aa80c361e9@mail.gmail.com> <097D7F84-E3A3-4862-9FE6-1931583D9A6B@apple.com> <16e5fdf90712121402q7c890ac1i6deaf9a8d0edff03@mail.gmail.com> Message-ID: <43AF41DC-C585-4A5A-B473-16FDA1980E1C@apple.com> On Dec 12, 2007, at 2:02 PM, Bill Wendling wrote: > On Dec 12, 2007 11:32 AM, Evan Cheng wrote: >> On Dec 12, 2007, at 11:12 AM, Bill Wendling wrote: >>> I'm sure I could move it, but as Chris asked, isn't it trivial to >>> get >>> this information anyway? Also, I'm kind of hesitant to put so much >>> effort into compile-time performance issues when it doesn't even >>> have >>> partial (let alone full) functionality right now. We don't know what >>> impact any of those optimizations have or if they are necessary yet. >>> :-) >> >> It's something to keep in mind. Not critical right now if we are not >> hoisting anything with implicit defs / uses. >> > Sounds good. :-) > >> If we are keeping LICM before livevariables, we will have to compute >> liveness in the BB's where the invariants are hoisted to. Now that I >> think about it, we *cannot* use the register scavenger to do this >> because it also depends on kill / dead markers on the operands. The >> scavenger's job is not to add the kill / dead markers, it is to track >> what registers are live at any point of the BB. This means you'll >> have to walk the BB and track all physical register defs and uses in >> the BB. >> > I see. Okay, so by the time I get to the point where I'm moving > instructions that access physical registers, I should have the pass > after LiveVariables... Yeah, maybe. :-) We'll discuss some more. Evan > > -bw > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From baldrick at free.fr Wed Dec 12 11:47:01 2007 From: baldrick at free.fr (Duncan Sands) Date: Wed, 12 Dec 2007 18:47:01 +0100 Subject: [llvm-commits] [llvm-gcc-4.2] r44891 - in /llvm-gcc-4.2/trunk/gcc: llvm-backend.cpp testsuite/g++.dg/init/llvm-convert-1.C In-Reply-To: <200712112317.lBBNHvI7002564@zion.cs.uiuc.edu> References: <200712112317.lBBNHvI7002564@zion.cs.uiuc.edu> Message-ID: <200712121847.01704.baldrick@free.fr> Hi Devang, > Do not emit pending decls twice. ... > --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) > +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Tue Dec 11 17:17:57 2007 > @@ -897,7 +897,8 @@ > } > > if (TheDebugInfo) TheDebugInfo->EmitGlobalVariable(GV, decl); > - > + > + TREE_ASM_WRITTEN(decl) = 1; > timevar_pop(TV_LLVM_GLOBALS); > } at the start of the function there is: void emit_global_to_llvm(tree decl) { if (errorcount || sorrycount) return; Should this be if (errorcount || sorrycount) { TREE_ASM_WRITTEN(fndecl) = 1; return; // Do not process broken code. } like in llvm_emit_code_for_current_function? And if so, maybe it should be like that too in emit_alias_to_llvm. What do you think? Ciao, Duncan. From evan.cheng at apple.com Wed Dec 12 16:32:00 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 12 Dec 2007 14:32:00 -0800 Subject: [llvm-commits] [llvm] r44954 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/vec_ctbits.ll In-Reply-To: <200712122221.lBCMLRwY013938@zion.cs.uiuc.edu> References: <200712122221.lBCMLRwY013938@zion.cs.uiuc.edu> Message-ID: On Dec 12, 2007, at 2:21 PM, Dan Gohman wrote: > > Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/ > X86ISelLowering.cpp?rev=44954&r1=44953&r2=44954&view=diff > > ====================================================================== > ======== > --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) > +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Dec 12 > 16:21:26 2007 > @@ -483,6 +483,12 @@ > setOperationAction(ISD::CTPOP, (MVT::ValueType)VT, Expand); > setOperationAction(ISD::CTTZ, (MVT::ValueType)VT, Expand); > setOperationAction(ISD::CTLZ, (MVT::ValueType)VT, Expand); > + setOperationAction(ISD::SHL, (MVT::ValueType)VT, Expand); > + setOperationAction(ISD::SRA, (MVT::ValueType)VT, Expand); > + setOperationAction(ISD::SRL, (MVT::ValueType)VT, Expand); > + setOperationAction(ISD::ROTL, (MVT::ValueType)VT, Expand); > + setOperationAction(ISD::ROTR, (MVT::ValueType)VT, Expand); > + setOperationAction(ISD::BSWAP, (MVT::ValueType)VT, Expand); > } Hi Dan, How do you create these nodes with vector types (in C)? I don't think the legalizer is capable of expanding these ops with vector types? Evan > > if (Subtarget->hasMMX()) { > > Added: llvm/trunk/test/CodeGen/X86/vec_ctbits.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ > X86/vec_ctbits.ll?rev=44954&view=auto > > ====================================================================== > ======== > --- llvm/trunk/test/CodeGen/X86/vec_ctbits.ll (added) > +++ llvm/trunk/test/CodeGen/X86/vec_ctbits.ll Wed Dec 12 16:21:26 2007 > @@ -0,0 +1,18 @@ > +; RUN: llvm-as < %s | llc -march=x86-64 > + > +declare <2 x i64> @llvm.cttz.v2i64(<2 x i64>) > +declare <2 x i64> @llvm.ctlz.v2i64(<2 x i64>) > +declare <2 x i64> @llvm.ctpop.v2i64(<2 x i64>) > + > +define <2 x i64> @footz(<2 x i64> %a) { > + %c = call <2 x i64> @llvm.cttz.v2i64(<2 x i64> %a) > + ret <2 x i64> %c > +} > +define <2 x i64> @foolz(<2 x i64> %a) { > + %c = call <2 x i64> @llvm.ctlz.v2i64(<2 x i64> %a) > + ret <2 x i64> %c > +} > +define <2 x i64> @foopop(<2 x i64> %a) { > + %c = call <2 x i64> @llvm.ctpop.v2i64(<2 x i64> %a) > + ret <2 x i64> %c > +} > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From dpatel at apple.com Wed Dec 12 16:55:05 2007 From: dpatel at apple.com (Devang Patel) Date: Wed, 12 Dec 2007 22:55:05 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r44958 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Message-ID: <200712122255.lBCMt5k6015532@zion.cs.uiuc.edu> Author: dpatel Date: Wed Dec 12 16:55:05 2007 New Revision: 44958 URL: http://llvm.org/viewvc/llvm-project?rev=44958&view=rev Log: set TREE_ASM_WRITTEN bit even if node is not processed due to previous errors. Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=44958&r1=44957&r2=44958&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Wed Dec 12 16:55:05 2007 @@ -600,7 +600,10 @@ // emit_alias_to_llvm - Given decl and target emit alias to target. void emit_alias_to_llvm(tree decl, tree target, tree target_decl) { - if (errorcount || sorrycount) return; + if (errorcount || sorrycount) { + TREE_ASM_WRITTEN(decl) = 1; + return; // Do not process broken code. + } timevar_push(TV_LLVM_GLOBALS); @@ -769,7 +772,10 @@ /// LLVM as a global variable. This function implements the end of /// assemble_variable. void emit_global_to_llvm(tree decl) { - if (errorcount || sorrycount) return; + if (errorcount || sorrycount) { + TREE_ASM_WRITTEN(decl) = 1; + return; // Do not process broken code. + } // FIXME: Support alignment on globals: DECL_ALIGN. // FIXME: DECL_PRESERVE_P indicates the var is marked with attribute 'used'. From isanbard at gmail.com Wed Dec 12 17:02:26 2007 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 12 Dec 2007 15:02:26 -0800 Subject: [llvm-commits] [llvm-gcc-4.2] r44958 - /llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp In-Reply-To: <200712122255.lBCMt5k6015532@zion.cs.uiuc.edu> References: <200712122255.lBCMt5k6015532@zion.cs.uiuc.edu> Message-ID: <16e5fdf90712121502k41a7bacbhc25ed953ad0d5b36@mail.gmail.com> On Dec 12, 2007 2:55 PM, Devang Patel wrote: > + return; // Do not process broken code. Where's your sense of adventure?! ;-) -bw From baldrick at free.fr Wed Dec 12 17:03:45 2007 From: baldrick at free.fr (Duncan Sands) Date: Wed, 12 Dec 2007 23:03:45 -0000 Subject: [llvm-commits] [llvm] r44959 - in /llvm/trunk: autoconf/configure.ac configure include/llvm/Config/config.h.in include/llvm/System/Host.h include/llvm/Target/TargetData.h lib/ExecutionEngine/ExecutionEngine.cpp lib/Target/TargetData.cpp Message-ID: <200712122303.lBCN3kOb016036@zion.cs.uiuc.edu> Author: baldrick Date: Wed Dec 12 17:03:45 2007 New Revision: 44959 URL: http://llvm.org/viewvc/llvm-project?rev=44959&view=rev Log: Remove host endianness info from TargetData and put it in a new header System/Host.h instead. Instead of getting the endianness from configure, calculate it directly. Added: llvm/trunk/include/llvm/System/Host.h Modified: llvm/trunk/autoconf/configure.ac llvm/trunk/configure llvm/trunk/include/llvm/Config/config.h.in llvm/trunk/include/llvm/Target/TargetData.h llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp llvm/trunk/lib/Target/TargetData.cpp Modified: llvm/trunk/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=44959&r1=44958&r2=44959&view=diff ============================================================================== --- llvm/trunk/autoconf/configure.ac (original) +++ llvm/trunk/autoconf/configure.ac Wed Dec 12 17:03:45 2007 @@ -227,10 +227,7 @@ AC_SUBST(ARCH,$llvm_cv_target_arch) dnl Check for the endianness of the target -AC_C_BIGENDIAN([AC_SUBST([ENDIAN],[big]), - AC_DEFINE([MSB_FIRST], [1], [Define if this target is big endian])], - [AC_SUBST([ENDIAN],[little]), - AC_DEFINE([LSB_FIRST], [1], [Define if this target is little endian])]) +AC_C_BIGENDIAN(AC_SUBST([ENDIAN],[big]),AC_SUBST([ENDIAN],[little])) dnl Check for build platform executable suffix if we're crosscompiling if test "$cross_compiling" = yes; then Modified: llvm/trunk/configure URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=44959&r1=44958&r2=44959&view=diff ============================================================================== --- llvm/trunk/configure (original) +++ llvm/trunk/configure Wed Dec 12 17:03:45 2007 @@ -828,6 +828,7 @@ LLVM_ON_UNIX LLVM_ON_WIN32 ARCH +ENDIAN CC CFLAGS LDFLAGS @@ -838,7 +839,6 @@ CPP GREP EGREP -ENDIAN LLVM_CROSS_COMPILING BUILD_CC BUILD_EXEEXT @@ -4183,19 +4183,9 @@ case $ac_cv_c_bigendian in yes) ENDIAN=big -, - -cat >>confdefs.h <<\_ACEOF -#define MSB_FIRST 1 -_ACEOF ;; no) ENDIAN=little -, - -cat >>confdefs.h <<\_ACEOF -#define LSB_FIRST 1 -_ACEOF ;; *) { { echo "$as_me:$LINENO: error: unknown endianness @@ -9881,7 +9871,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext + echo '#line 11809 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -13456,11 +13446,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13459: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13449: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13463: \$? = $ac_status" >&5 + echo "$as_me:13453: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -13724,11 +13714,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13727: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13717: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13731: \$? = $ac_status" >&5 + echo "$as_me:13721: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -13828,11 +13818,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13831: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13821: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13835: \$? = $ac_status" >&5 + echo "$as_me:13825: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -16136,7 +16126,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:18565: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:18579: \$? = $ac_status" >&5 + echo "$as_me:18569: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -18676,11 +18666,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:18679: $lt_compile\"" >&5) + (eval echo "\"\$as_me:18669: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:18683: \$? = $ac_status" >&5 + echo "$as_me:18673: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -20246,11 +20236,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:20249: $lt_compile\"" >&5) + (eval echo "\"\$as_me:20239: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:20253: \$? = $ac_status" >&5 + echo "$as_me:20243: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -20350,11 +20340,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:20353: $lt_compile\"" >&5) + (eval echo "\"\$as_me:20343: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:20357: \$? = $ac_status" >&5 + echo "$as_me:20347: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -22553,11 +22543,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:22556: $lt_compile\"" >&5) + (eval echo "\"\$as_me:22546: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:22560: \$? = $ac_status" >&5 + echo "$as_me:22550: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -22821,11 +22811,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:22824: $lt_compile\"" >&5) + (eval echo "\"\$as_me:22814: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:22828: \$? = $ac_status" >&5 + echo "$as_me:22818: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -22925,11 +22915,11 @@ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:22928: $lt_compile\"" >&5) + (eval echo "\"\$as_me:22918: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:22932: \$? = $ac_status" >&5 + echo "$as_me:22922: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -32769,6 +32759,7 @@ LLVM_ON_UNIX!$LLVM_ON_UNIX$ac_delim LLVM_ON_WIN32!$LLVM_ON_WIN32$ac_delim ARCH!$ARCH$ac_delim +ENDIAN!$ENDIAN$ac_delim CC!$CC$ac_delim CFLAGS!$CFLAGS$ac_delim LDFLAGS!$LDFLAGS$ac_delim @@ -32779,7 +32770,6 @@ CPP!$CPP$ac_delim GREP!$GREP$ac_delim EGREP!$EGREP$ac_delim -ENDIAN!$ENDIAN$ac_delim LLVM_CROSS_COMPILING!$LLVM_CROSS_COMPILING$ac_delim BUILD_CC!$BUILD_CC$ac_delim BUILD_EXEEXT!$BUILD_EXEEXT$ac_delim Modified: llvm/trunk/include/llvm/Config/config.h.in URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/config.h.in?rev=44959&r1=44958&r2=44959&view=diff ============================================================================== --- llvm/trunk/include/llvm/Config/config.h.in (original) +++ llvm/trunk/include/llvm/Config/config.h.in Wed Dec 12 17:03:45 2007 @@ -494,9 +494,6 @@ /* Installation prefix directory */ #undef LLVM_PREFIX -/* Define if this target is little endian */ -#undef LSB_FIRST - /* Define if the OS needs help to load dependent libraries for dlopen(). */ #undef LTDL_DLOPEN_DEPLIBS @@ -514,9 +511,6 @@ /* Define to the system default library search path. */ #undef LTDL_SYSSEARCHPATH -/* Define if this target is big endian */ -#undef MSB_FIRST - /* Define if /dev/zero should be used when mapping RWX memory, or undefine if its not necessary */ #undef NEED_DEV_ZERO_FOR_MMAP Added: llvm/trunk/include/llvm/System/Host.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/System/Host.h?rev=44959&view=auto ============================================================================== --- llvm/trunk/include/llvm/System/Host.h (added) +++ llvm/trunk/include/llvm/System/Host.h Wed Dec 12 17:03:45 2007 @@ -0,0 +1,36 @@ +//===- llvm/System/Host.h - Host machine characteristics --------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file was developed by Duncan Sands and is distributed under the +// University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// Methods for querying the nature of the host machine. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_SYSTEM_HOST_H +#define LLVM_SYSTEM_HOST_H + +namespace llvm { +namespace sys { + + inline bool littleEndianHost() { + union { + int i; + char c; + }; + i = 1; + return c; + } + + inline bool bigEndianHost() { + return !littleEndianHost(); + } + +} +} + +#endif Modified: llvm/trunk/include/llvm/Target/TargetData.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetData.h?rev=44959&r1=44958&r2=44959&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetData.h (original) +++ llvm/trunk/include/llvm/Target/TargetData.h Wed Dec 12 17:03:45 2007 @@ -142,10 +142,6 @@ bool isLittleEndian() const { return LittleEndian; } bool isBigEndian() const { return !LittleEndian; } - /// Host endianness. - bool hostIsLittleEndian() const; - bool hostIsBigEndian() const { return !hostIsLittleEndian(); } - /// getStringRepresentation - Return the string representation of the /// TargetData. This representation is in the same format accepted by the /// string constructor above. Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=44959&r1=44958&r2=44959&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Wed Dec 12 17:03:45 2007 @@ -23,6 +23,7 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/MutexGuard.h" #include "llvm/System/DynamicLibrary.h" +#include "llvm/System/Host.h" #include "llvm/Target/TargetData.h" #include using namespace llvm; @@ -637,7 +638,7 @@ uint8_t *Src = (uint8_t *)Val.IntVal.getRawData(); uint8_t *Dst = (uint8_t *)Ptr; - if (getTargetData()->hostIsLittleEndian()) + if (sys::littleEndianHost()) // Little-endian host - the source is ordered from LSB to MSB. // Order the destination from LSB to MSB: Do a straight copy. memcpy(Dst, Src, StoreBytes); @@ -698,7 +699,7 @@ uint8_t *Src = (uint8_t *)Ptr; uint8_t *Dst = (uint8_t *)Result.IntVal.getRawData(); - if (getTargetData()->hostIsLittleEndian()) + if (sys::littleEndianHost()) // Little-endian host - the destination must be ordered from LSB to MSB. // The source is ordered from LSB to MSB: Do a straight copy. memcpy(Dst, Src, LoadBytes); Modified: llvm/trunk/lib/Target/TargetData.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetData.cpp?rev=44959&r1=44958&r2=44959&view=diff ============================================================================== --- llvm/trunk/lib/Target/TargetData.cpp (original) +++ llvm/trunk/lib/Target/TargetData.cpp Wed Dec 12 17:03:45 2007 @@ -25,7 +25,6 @@ #include "llvm/Support/ManagedStatic.h" #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/StringExtras.h" -#include "llvm/Config/config.h" #include #include #include @@ -133,14 +132,6 @@ // TargetData Class Implementation //===----------------------------------------------------------------------===// -bool TargetData::hostIsLittleEndian() const { -#ifdef LSB_FIRST - return true; -#else - return false; -#endif -} - /*! A TargetDescription string consists of a sequence of hyphen-delimited specifiers for target endianness, pointer size and alignments, and various From isanbard at gmail.com Wed Dec 12 17:09:45 2007 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 12 Dec 2007 15:09:45 -0800 Subject: [llvm-commits] [llvm] r44959 - in /llvm/trunk: autoconf/configure.ac configure include/llvm/Config/config.h.in include/llvm/System/Host.h include/llvm/Target/TargetData.h lib/ExecutionEngine/ExecutionEngine.cpp lib/Target/TargetData.cpp In-Reply-To: <200712122303.lBCN3kOb016036@zion.cs.uiuc.edu> References: <200712122303.lBCN3kOb016036@zion.cs.uiuc.edu> Message-ID: <16e5fdf90712121509t72616a28s8c8dfab9d82beb5f@mail.gmail.com> On Dec 12, 2007 3:03 PM, Duncan Sands wrote: > Remove host endianness info from TargetData and > put it in a new header System/Host.h instead. > Instead of getting the endianness from configure, > calculate it directly. > Way to obviate my last post. ;-) -bw From evan.cheng at apple.com Wed Dec 12 17:12:09 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 12 Dec 2007 23:12:09 -0000 Subject: [llvm-commits] [llvm] r44960 - in /llvm/trunk: include/llvm/Target/ lib/CodeGen/ lib/Target/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/IA64/ lib/Target/Mips/ lib/Target/PowerPC/ lib/Target/Sparc/ lib/Target/X86/ test/CodeGen/X86/ Message-ID: <200712122312.lBCNCAJs016823@zion.cs.uiuc.edu> Author: evancheng Date: Wed Dec 12 17:12:09 2007 New Revision: 44960 URL: http://llvm.org/viewvc/llvm-project?rev=44960&view=rev Log: Implicit def instructions, e.g. X86::IMPLICIT_DEF_GR32, are always re-materializable and they should not be spilled. Added: llvm/trunk/test/CodeGen/X86/2007-12-11-FoldImpDefSpill.ll Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp llvm/trunk/lib/Target/ARM/ARMInstrInfo.td llvm/trunk/lib/Target/ARM/ARMInstrVFP.td llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.td llvm/trunk/lib/Target/IA64/IA64InstrInfo.td llvm/trunk/lib/Target/Mips/MipsInstrInfo.td llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td llvm/trunk/lib/Target/Target.td llvm/trunk/lib/Target/X86/X86InstrInfo.td llvm/trunk/lib/Target/X86/X86InstrMMX.td llvm/trunk/lib/Target/X86/X86InstrSSE.td llvm/trunk/lib/Target/X86/X86InstrX86-64.td Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetInstrInfo.h?rev=44960&r1=44959&r2=44960&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetInstrInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetInstrInfo.h Wed Dec 12 17:12:09 2007 @@ -48,47 +48,48 @@ const unsigned M_LOAD_FLAG = 1 << 5; const unsigned M_STORE_FLAG = 1 << 6; const unsigned M_INDIRECT_FLAG = 1 << 7; +const unsigned M_IMPLICIT_DEF_FLAG = 1 << 8; // M_CONVERTIBLE_TO_3_ADDR - This is a 2-address instruction which can be // changed into a 3-address instruction if the first two operands cannot be // assigned to the same register. The target must implement the // TargetInstrInfo::convertToThreeAddress method for this instruction. -const unsigned M_CONVERTIBLE_TO_3_ADDR = 1 << 8; +const unsigned M_CONVERTIBLE_TO_3_ADDR = 1 << 9; // This M_COMMUTABLE - is a 2- or 3-address instruction (of the form X = op Y, // Z), which produces the same result if Y and Z are exchanged. -const unsigned M_COMMUTABLE = 1 << 9; +const unsigned M_COMMUTABLE = 1 << 10; // M_TERMINATOR_FLAG - Is this instruction part of the terminator for a basic // block? Typically this is things like return and branch instructions. // Various passes use this to insert code into the bottom of a basic block, but // before control flow occurs. -const unsigned M_TERMINATOR_FLAG = 1 << 10; +const unsigned M_TERMINATOR_FLAG = 1 << 11; // M_USES_CUSTOM_DAG_SCHED_INSERTION - Set if this instruction requires custom // insertion support when the DAG scheduler is inserting it into a machine basic // block. -const unsigned M_USES_CUSTOM_DAG_SCHED_INSERTION = 1 << 11; +const unsigned M_USES_CUSTOM_DAG_SCHED_INSERTION = 1 << 12; // M_VARIABLE_OPS - Set if this instruction can have a variable number of extra // operands in addition to the minimum number operands specified. -const unsigned M_VARIABLE_OPS = 1 << 12; +const unsigned M_VARIABLE_OPS = 1 << 13; // M_PREDICABLE - Set if this instruction has a predicate operand that // controls execution. It may be set to 'always'. -const unsigned M_PREDICABLE = 1 << 13; +const unsigned M_PREDICABLE = 1 << 14; // M_REMATERIALIZIBLE - Set if this instruction can be trivally re-materialized // at any time, e.g. constant generation, load from constant pool. -const unsigned M_REMATERIALIZIBLE = 1 << 14; +const unsigned M_REMATERIALIZIBLE = 1 << 15; // M_NOT_DUPLICABLE - Set if this instruction cannot be safely duplicated. // (e.g. instructions with unique labels attached). -const unsigned M_NOT_DUPLICABLE = 1 << 15; +const unsigned M_NOT_DUPLICABLE = 1 << 16; // M_HAS_OPTIONAL_DEF - Set if this instruction has an optional definition, e.g. // ARM instructions which can set condition code if 's' bit is set. -const unsigned M_HAS_OPTIONAL_DEF = 1 << 16; +const unsigned M_HAS_OPTIONAL_DEF = 1 << 17; // Machine operand flags // M_LOOK_UP_PTR_REG_CLASS - Set if this operand is a pointer value and it Modified: llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp?rev=44960&r1=44959&r2=44960&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp (original) +++ llvm/trunk/lib/CodeGen/LiveIntervalAnalysis.cpp Wed Dec 12 17:12:09 2007 @@ -613,8 +613,10 @@ return false; isLoad = false; - if (tii_->isTriviallyReMaterializable(MI)) { - isLoad = MI->getInstrDescriptor()->Flags & M_LOAD_FLAG; + const TargetInstrDescriptor *TID = MI->getInstrDescriptor(); + if ((TID->Flags & M_IMPLICIT_DEF_FLAG) || + tii_->isTriviallyReMaterializable(MI)) { + isLoad = TID->Flags & M_LOAD_FLAG; return true; } @@ -677,6 +679,15 @@ bool isSS, int Slot, unsigned Reg) { unsigned MRInfo = 0; const TargetInstrDescriptor *TID = MI->getInstrDescriptor(); + // If it is an implicit def instruction, just delete it. + if (TID->Flags & M_IMPLICIT_DEF_FLAG) { + RemoveMachineInstrFromMaps(MI); + vrm.RemoveMachineInstrFromMaps(MI); + MI->eraseFromParent(); + ++numFolds; + return true; + } + SmallVector FoldOps; for (unsigned i = 0, e = Ops.size(); i != e; ++i) { unsigned OpIdx = Ops[i]; @@ -852,7 +863,8 @@ } else { CanFold = canFoldMemoryOperand(MI, Ops); } - } else CanFold = false; + } else + CanFold = false; // Create a new virtual register for the spill interval. bool CreatedNewVReg = false; Modified: llvm/trunk/lib/Target/ARM/ARMInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrInfo.td?rev=44960&r1=44959&r2=44960&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrInfo.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrInfo.td Wed Dec 12 17:12:09 2007 @@ -646,6 +646,7 @@ //===----------------------------------------------------------------------===// // Miscellaneous Instructions. // +let isImplicitDef = 1 in def IMPLICIT_DEF_GPR : PseudoInst<(outs GPR:$rD), (ins pred:$p), "@ IMPLICIT_DEF_GPR $rD", Modified: llvm/trunk/lib/Target/ARM/ARMInstrVFP.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMInstrVFP.td?rev=44960&r1=44959&r2=44960&view=diff ============================================================================== --- llvm/trunk/lib/Target/ARM/ARMInstrVFP.td (original) +++ llvm/trunk/lib/Target/ARM/ARMInstrVFP.td Wed Dec 12 17:12:09 2007 @@ -251,12 +251,14 @@ // FP <-> GPR Copies. Int <-> FP Conversions. // +let isImplicitDef = 1 in { def IMPLICIT_DEF_SPR : PseudoInst<(outs SPR:$rD), (ins pred:$p), "@ IMPLICIT_DEF_SPR $rD", [(set SPR:$rD, (undef))]>; def IMPLICIT_DEF_DPR : PseudoInst<(outs DPR:$rD), (ins pred:$p), "@ IMPLICIT_DEF_DPR $rD", [(set DPR:$rD, (undef))]>; +} def FMRS : ASI<(outs GPR:$dst), (ins SPR:$src), "fmrs", " $dst, $src", Modified: llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.td?rev=44960&r1=44959&r2=44960&view=diff ============================================================================== --- llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.td (original) +++ llvm/trunk/lib/Target/Alpha/AlphaInstrInfo.td Wed Dec 12 17:12:09 2007 @@ -141,12 +141,14 @@ //Pseudo ops for selection +let isImplicitDef = 1 in { def IDEF_I : PseudoInstAlpha<(outs GPRC:$RA), (ins), ";#idef $RA", [(set GPRC:$RA, (undef))], s_pseudo>; def IDEF_F32 : PseudoInstAlpha<(outs F4RC:$RA), (ins), ";#idef $RA", [(set F4RC:$RA, (undef))], s_pseudo>; def IDEF_F64 : PseudoInstAlpha<(outs F8RC:$RA), (ins), ";#idef $RA", [(set F8RC:$RA, (undef))], s_pseudo>; +} def WTF : PseudoInstAlpha<(outs), (ins variable_ops), "#wtf", [], s_pseudo>; Modified: llvm/trunk/lib/Target/IA64/IA64InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/IA64/IA64InstrInfo.td?rev=44960&r1=44959&r2=44960&view=diff ============================================================================== --- llvm/trunk/lib/Target/IA64/IA64InstrInfo.td (original) +++ llvm/trunk/lib/Target/IA64/IA64InstrInfo.td Wed Dec 12 17:12:09 2007 @@ -457,6 +457,7 @@ // TODO: support postincrement (reg, imm9) loads+stores - this needs more // tablegen support +let isImplicitDef = 1 in { def IDEF : PseudoInstIA64<(outs variable_ops), (ins), "// IDEF">; def IDEF_GR_D : PseudoInstIA64_DAG<(outs GR:$reg), (ins), "// $reg = IDEF", @@ -465,6 +466,7 @@ [(set FP:$reg, (undef))]>; def IDEF_PR_D : PseudoInstIA64_DAG<(outs PR:$reg), (ins), "// $reg = IDEF", [(set PR:$reg, (undef))]>; +} def IUSE : PseudoInstIA64<(outs), (ins variable_ops), "// IUSE">; def ADJUSTCALLSTACKUP : PseudoInstIA64<(outs), (ins variable_ops), Modified: llvm/trunk/lib/Target/Mips/MipsInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsInstrInfo.td?rev=44960&r1=44959&r2=44960&view=diff ============================================================================== --- llvm/trunk/lib/Target/Mips/MipsInstrInfo.td (original) +++ llvm/trunk/lib/Target/Mips/MipsInstrInfo.td Wed Dec 12 17:12:09 2007 @@ -356,6 +356,7 @@ [(callseq_end imm:$amt1, imm:$amt2)]>; } +let isImplicitDef = 1 in def IMPLICIT_DEF_CPURegs : PseudoInstMips<(outs CPURegs:$dst), (ins), "!IMPLICIT_DEF $dst", [(set CPURegs:$dst, (undef))]>; Modified: llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td?rev=44960&r1=44959&r2=44960&view=diff ============================================================================== --- llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td (original) +++ llvm/trunk/lib/Target/PowerPC/PPCInstrInfo.td Wed Dec 12 17:12:09 2007 @@ -334,6 +334,7 @@ [(set GPRC:$result, (PPCdynalloc GPRC:$negsize, iaddr:$fpsi))]>; +let isImplicitDef = 1 in { def IMPLICIT_DEF_GPRC: Pseudo<(outs GPRC:$rD), (ins), "${:comment}IMPLICIT_DEF_GPRC $rD", [(set GPRC:$rD, (undef))]>; @@ -343,6 +344,7 @@ def IMPLICIT_DEF_F4 : Pseudo<(outs F4RC:$rD), (ins), "${:comment} IMPLICIT_DEF_F4 $rD", [(set F4RC:$rD, (undef))]>; +} // SELECT_CC_* - Used to implement the SELECT_CC DAG operation. Expanded by the // scheduler into a branch sequence. Modified: llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td?rev=44960&r1=44959&r2=44960&view=diff ============================================================================== --- llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td (original) +++ llvm/trunk/lib/Target/Sparc/SparcInstrInfo.td Wed Dec 12 17:12:09 2007 @@ -212,6 +212,8 @@ "!ADJCALLSTACKUP $amt1", [(callseq_end imm:$amt1, imm:$amt2)]>; } + +let isImplicitDef = 1 in { def IMPLICIT_DEF_Int : Pseudo<(outs IntRegs:$dst), (ins), "!IMPLICIT_DEF $dst", [(set IntRegs:$dst, (undef))]>; @@ -219,6 +221,7 @@ [(set FPRegs:$dst, (undef))]>; def IMPLICIT_DEF_DFP : Pseudo<(outs DFPRegs:$dst), (ins), "!IMPLICIT_DEF $dst", [(set DFPRegs:$dst, (undef))]>; +} // FpMOVD/FpNEGD/FpABSD - These are lowered to single-precision ops by the // fpmover pass. Modified: llvm/trunk/lib/Target/Target.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Target.td?rev=44960&r1=44959&r2=44960&view=diff ============================================================================== --- llvm/trunk/lib/Target/Target.td (original) +++ llvm/trunk/lib/Target/Target.td Wed Dec 12 17:12:09 2007 @@ -192,6 +192,7 @@ bit isCall = 0; // Is this instruction a call instruction? bit isLoad = 0; // Is this instruction a load instruction? bit isStore = 0; // Is this instruction a store instruction? + bit isImplicitDef = 0; // Is this instruction an implicit def instruction? bit isTwoAddress = 0; // Is this a two address instruction? bit isConvertibleToThreeAddress = 0; // Can this 2-addr instruction promote? bit isCommutable = 0; // Is this 3 operand instruction commutable? Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=44960&r1=44959&r2=44960&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Wed Dec 12 17:12:09 2007 @@ -262,6 +262,7 @@ } def IMPLICIT_USE : I<0, Pseudo, (outs), (ins variable_ops), "#IMPLICIT_USE", []>; +let isImplicitDef = 1 in { def IMPLICIT_DEF : I<0, Pseudo, (outs variable_ops), (ins), "#IMPLICIT_DEF", []>; def IMPLICIT_DEF_GR8 : I<0, Pseudo, (outs GR8:$dst), (ins), @@ -273,6 +274,7 @@ def IMPLICIT_DEF_GR32 : I<0, Pseudo, (outs GR32:$dst), (ins), "#IMPLICIT_DEF $dst", [(set GR32:$dst, (undef))]>; +} // Nop def NOOP : I<0x90, RawFrm, (outs), (ins), "nop", []>; Modified: llvm/trunk/lib/Target/X86/X86InstrMMX.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrMMX.td?rev=44960&r1=44959&r2=44960&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrMMX.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrMMX.td Wed Dec 12 17:12:09 2007 @@ -14,6 +14,7 @@ //===----------------------------------------------------------------------===// // Some 'special' instructions +let isImplicitDef = 1 in def IMPLICIT_DEF_VR64 : I<0, Pseudo, (outs VR64:$dst), (ins), "#IMPLICIT_DEF $dst", [(set VR64:$dst, (v8i8 (undef)))]>, Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=44960&r1=44959&r2=44960&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Wed Dec 12 17:12:09 2007 @@ -42,6 +42,7 @@ // SSE 'Special' Instructions //===----------------------------------------------------------------------===// +let isImplicitDef = 1 in def IMPLICIT_DEF_VR128 : I<0, Pseudo, (outs VR128:$dst), (ins), "#IMPLICIT_DEF $dst", [(set VR128:$dst, (v4f32 (undef)))]>, Modified: llvm/trunk/lib/Target/X86/X86InstrX86-64.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrX86-64.td?rev=44960&r1=44959&r2=44960&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrX86-64.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrX86-64.td Wed Dec 12 17:12:09 2007 @@ -80,6 +80,7 @@ // Instruction list... // +let isImplicitDef = 1 in def IMPLICIT_DEF_GR64 : I<0, Pseudo, (outs GR64:$dst), (ins), "#IMPLICIT_DEF $dst", [(set GR64:$dst, (undef))]>; Added: llvm/trunk/test/CodeGen/X86/2007-12-11-FoldImpDefSpill.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2007-12-11-FoldImpDefSpill.ll?rev=44960&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/2007-12-11-FoldImpDefSpill.ll (added) +++ llvm/trunk/test/CodeGen/X86/2007-12-11-FoldImpDefSpill.ll Wed Dec 12 17:12:09 2007 @@ -0,0 +1,680 @@ +; RUN: llvm-as < %s | llc -mtriple=i686-apple-darwin | not grep IMPLICIT_DEF + + %struct.__sbuf = type { i8*, i32 } + %struct.ggBRDF = type { i32 (...)** } + %"struct.ggBST" = type { %"struct.ggBSTNode"*, i32 } + %"struct.ggBST" = type { %"struct.ggBSTNode"*, i32 } + %"struct.ggBST" = type { %"struct.ggBSTNode"*, i32 } + %"struct.ggBST" = type { %"struct.ggBSTNode"*, i32 } + %"struct.ggBST" = type { %"struct.ggBSTNode"*, i32 } + %"struct.ggBSTNode" = type { %"struct.ggBSTNode"*, %"struct.ggBSTNode"*, %struct.ggString, %struct.ggMaterial* } + %"struct.ggBSTNode" = type { %"struct.ggBSTNode"*, %"struct.ggBSTNode"*, %struct.ggString, %struct.ggRasterSurfaceTexture* } + %"struct.ggBSTNode" = type { %"struct.ggBSTNode"*, %"struct.ggBSTNode"*, %struct.ggString, %struct.ggBRDF* } + %"struct.ggBSTNode" = type { %"struct.ggBSTNode"*, %"struct.ggBSTNode"*, %struct.ggString, %struct.ggSpectrum* } + %"struct.ggBSTNode" = type { %"struct.ggBSTNode"*, %"struct.ggBSTNode"*, %struct.ggString, %struct.mrObjectRecord* } + %"struct.ggDictionary" = type { %"struct.ggBST" } + %"struct.ggDictionary" = type { %"struct.ggBST" } + %"struct.ggDictionary" = type { %"struct.ggBST" } + %"struct.ggDictionary" = type { %"struct.ggBST" } + %"struct.ggDictionary" = type { %"struct.ggBST" } + %struct.ggHAffineMatrix3 = type { %struct.ggHMatrix3 } + %struct.ggHBoxMatrix3 = type { %struct.ggHAffineMatrix3 } + %struct.ggHMatrix3 = type { [4 x [4 x double]] } + %struct.ggMaterial = type { i32 (...)**, %struct.ggBRDF* } + %struct.ggPoint3 = type { [3 x double] } + %"struct.ggRGBPixel" = type { [3 x i8], i8 } + %"struct.ggRaster >" = type { i32, i32, %"struct.ggRGBPixel"* } + %struct.ggRasterSurfaceTexture = type { %"struct.ggRaster >"* } + %struct.ggSolidNoise3 = type { i32, [256 x %struct.ggPoint3], [256 x i32] } + %struct.ggSpectrum = type { [8 x float] } + %struct.ggString = type { %"struct.ggString::StringRep"* } + %"struct.ggString::StringRep" = type { i32, i32, [1 x i8] } + %"struct.ggTrain" = type { %struct.ggBRDF**, i32, i32 } + %struct.mrObjectRecord = type { %struct.ggHBoxMatrix3, %struct.ggHBoxMatrix3, %struct.mrSurfaceList, %struct.ggMaterial*, i32, %struct.ggRasterSurfaceTexture*, %struct.ggBRDF*, i32, i32 } + %struct.mrScene = type { %struct.ggSpectrum, %struct.ggSpectrum, %struct.ggBRDF*, %struct.ggBRDF*, %struct.ggBRDF*, i32, double, %"struct.ggDictionary", %"struct.ggDictionary", %"struct.ggDictionary", %"struct.ggDictionary", %"struct.ggDictionary" } + %struct.mrSurfaceList = type { %struct.ggBRDF, %"struct.ggTrain" } + %"struct.std::__codecvt_abstract_base" = type { %"struct.std::locale::facet" } + %"struct.std::basic_ios >" = type { %"struct.std::ios_base", %"struct.std::basic_ostream >"*, i8, i8, %"struct.std::basic_streambuf >"*, %"struct.std::ctype"*, %"struct.std::__codecvt_abstract_base"*, %"struct.std::__codecvt_abstract_base"* } + %"struct.std::basic_istream >" = type { i32 (...)**, i32, %"struct.std::basic_ios >" } + %"struct.std::basic_ostream >" = type { i32 (...)**, %"struct.std::basic_ios >" } + %"struct.std::basic_streambuf >" = type { i32 (...)**, i8*, i8*, i8*, i8*, i8*, i8*, %"struct.std::locale" } + %"struct.std::ctype" = type { %"struct.std::locale::facet", i32*, i8, i32*, i32*, i32*, i8, [256 x i8], [256 x i8], i8 } + %"struct.std::ios_base" = type { i32 (...)**, i32, i32, i32, i32, i32, %"struct.std::ios_base::_Callback_list"*, %struct.__sbuf, [8 x %struct.__sbuf], i32, %struct.__sbuf*, %"struct.std::locale" } + %"struct.std::ios_base::_Callback_list" = type { %"struct.std::ios_base::_Callback_list"*, void (i32, %"struct.std::ios_base"*, i32)*, i32, i32 } + %"struct.std::locale" = type { %"struct.std::locale::_Impl"* } + %"struct.std::locale::_Impl" = type { i32, %"struct.std::locale::facet"**, i32, %"struct.std::locale::facet"**, i8** } + %"struct.std::locale::facet" = type { i32 (...)**, i32 } + at .str80 = external constant [7 x i8] ; <[7 x i8]*> [#uses=1] + at .str81 = external constant [11 x i8] ; <[11 x i8]*> [#uses=1] + +define fastcc void @_ZN7mrScene4ReadERSi(%struct.mrScene* %this, %"struct.std::basic_istream >"* %surfaces) { +entry: + %tmp6.i.i8288 = invoke i8* @_Znam( i32 12 ) + to label %_ZN8ggStringC1Ei.exit unwind label %lpad ; [#uses=0] + +_ZN8ggStringC1Ei.exit: ; preds = %entry + %tmp6.i.i8995 = invoke i8* @_Znam( i32 12 ) + to label %_ZN8ggStringC1Ei.exit96 unwind label %lpad3825 ; [#uses=0] + +_ZN8ggStringC1Ei.exit96: ; preds = %_ZN8ggStringC1Ei.exit + %tmp6.i.i97103 = invoke i8* @_Znam( i32 12 ) + to label %_ZN8ggStringC1Ei.exit104 unwind label %lpad3829 ; [#uses=0] + +_ZN8ggStringC1Ei.exit104: ; preds = %_ZN8ggStringC1Ei.exit96 + %tmp6.i.i105111 = invoke i8* @_Znam( i32 12 ) + to label %_ZN8ggStringC1Ei.exit112 unwind label %lpad3833 ; [#uses=0] + +_ZN8ggStringC1Ei.exit112: ; preds = %_ZN8ggStringC1Ei.exit104 + %tmp6.i.i122128 = invoke i8* @_Znam( i32 12 ) + to label %_ZN8ggStringC1Ei.exit129 unwind label %lpad3837 ; [#uses=0] + +_ZN8ggStringC1Ei.exit129: ; preds = %_ZN8ggStringC1Ei.exit112 + %tmp6.i.i132138 = invoke i8* @_Znam( i32 12 ) + to label %_ZN8ggStringC1Ei.exit139 unwind label %lpad3841 ; [#uses=0] + +_ZN8ggStringC1Ei.exit139: ; preds = %_ZN8ggStringC1Ei.exit129 + %tmp295 = invoke i8* @_Znwm( i32 16 ) + to label %invcont294 unwind label %lpad3845 ; [#uses=0] + +invcont294: ; preds = %_ZN8ggStringC1Ei.exit139 + %tmp10.i.i141 = invoke i8* @_Znam( i32 16 ) + to label %_ZN13mrSurfaceListC1Ev.exit unwind label %lpad3849 ; [#uses=0] + +_ZN13mrSurfaceListC1Ev.exit: ; preds = %invcont294 + %tmp3.i148 = invoke %"struct.std::basic_istream >"* @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_( %"struct.std::basic_istream >"* %surfaces, i8* null ) + to label %tmp3.i.noexc unwind label %lpad3845 ; <%"struct.std::basic_istream >"*> [#uses=0] + +tmp3.i.noexc: ; preds = %_ZN13mrSurfaceListC1Ev.exit + %tmp15.i149 = invoke i8* @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvPvEv( %"struct.std::basic_ios >"* null ) + to label %tmp15.i.noexc unwind label %lpad3845 ; [#uses=0] + +tmp15.i.noexc: ; preds = %tmp3.i.noexc + br i1 false, label %bb308, label %bb.i + +bb.i: ; preds = %tmp15.i.noexc + ret void + +bb308: ; preds = %tmp15.i.noexc + br i1 false, label %bb3743.preheader, label %bb315 + +bb3743.preheader: ; preds = %bb308 + %tmp16.i3862 = getelementptr %struct.ggPoint3* null, i32 0, i32 0, i32 0 ; [#uses=1] + %tmp16.i3859 = getelementptr %struct.ggPoint3* null, i32 0, i32 0, i32 0 ; [#uses=3] + br label %bb3743 + +bb315: ; preds = %bb308 + ret void + +bb333: ; preds = %invcont3758, %invcont335 + %tmp3.i167180 = invoke %"struct.std::basic_istream >"* @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_( %"struct.std::basic_istream >"* %surfaces, i8* null ) + to label %tmp3.i167.noexc unwind label %lpad3845 ; <%"struct.std::basic_istream >"*> [#uses=0] + +tmp3.i167.noexc: ; preds = %bb333 + %tmp15.i182 = invoke i8* @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvPvEv( %"struct.std::basic_ios >"* null ) + to label %tmp15.i.noexc181 unwind label %lpad3845 ; [#uses=0] + +tmp15.i.noexc181: ; preds = %tmp3.i167.noexc + br i1 false, label %invcont335, label %bb.i178 + +bb.i178: ; preds = %tmp15.i.noexc181 + ret void + +invcont335: ; preds = %tmp15.i.noexc181 + br i1 false, label %bb3743, label %bb333 + +bb345: ; preds = %invcont3758 + br i1 false, label %bb353, label %bb360 + +bb353: ; preds = %bb345 + %tmp356 = invoke %"struct.std::basic_istream >"* @_ZNSirsERd( %"struct.std::basic_istream >"* %surfaces, double* null ) + to label %bb3743 unwind label %lpad3845 ; <%"struct.std::basic_istream >"*> [#uses=0] + +bb360: ; preds = %bb345 + br i1 false, label %bb368, label %bb374 + +bb368: ; preds = %bb360 + %tmp373 = invoke %"struct.std::basic_istream >"* @_ZNSirsERd( %"struct.std::basic_istream >"* %surfaces, double* null ) + to label %bb3743 unwind label %lpad3845 ; <%"struct.std::basic_istream >"*> [#uses=0] + +bb374: ; preds = %bb360 + br i1 false, label %bb396, label %bb421 + +bb396: ; preds = %bb374 + ret void + +bb421: ; preds = %bb374 + br i1 false, label %bb429, label %bb530 + +bb429: ; preds = %bb421 + ret void + +bb530: ; preds = %bb421 + br i1 false, label %bb538, label %bb673 + +bb538: ; preds = %bb530 + ret void + +bb673: ; preds = %bb530 + br i1 false, label %bb681, label %bb778 + +bb681: ; preds = %bb673 + ret void + +bb778: ; preds = %bb673 + br i1 false, label %bb786, label %bb891 + +bb786: ; preds = %bb778 + ret void + +bb891: ; preds = %bb778 + br i1 false, label %bb899, label %bb998 + +bb899: ; preds = %bb891 + ret void + +bb998: ; preds = %bb891 + br i1 false, label %bb1168, label %bb1190 + +bb1168: ; preds = %bb998 + ret void + +bb1190: ; preds = %bb998 + br i1 false, label %bb1198, label %bb1220 + +bb1198: ; preds = %bb1190 + ret void + +bb1220: ; preds = %bb1190 + br i1 false, label %bb1228, label %bb1250 + +bb1228: ; preds = %bb1220 + ret void + +bb1250: ; preds = %bb1220 + br i1 false, label %bb1258, label %bb1303 + +bb1258: ; preds = %bb1250 + ret void + +bb1303: ; preds = %bb1250 + br i1 false, label %bb1311, label %bb1366 + +bb1311: ; preds = %bb1303 + ret void + +bb1366: ; preds = %bb1303 + br i1 false, label %bb1374, label %bb1432 + +bb1374: ; preds = %bb1366 + ret void + +bb1432: ; preds = %bb1366 + br i1 false, label %bb1440, label %bb1495 + +bb1440: ; preds = %bb1432 + ret void + +bb1495: ; preds = %bb1432 + br i1 false, label %bb1503, label %bb1561 + +bb1503: ; preds = %bb1495 + ret void + +bb1561: ; preds = %bb1495 + br i1 false, label %bb1569, label %bb1624 + +bb1569: ; preds = %bb1561 + ret void + +bb1624: ; preds = %bb1561 + br i1 false, label %bb1632, label %bb1654 + +bb1632: ; preds = %bb1624 + store double 0.000000e+00, double* %tmp16.i3859, align 8 + %tmp3.i38383852 = invoke %"struct.std::basic_istream >"* @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_( %"struct.std::basic_istream >"* %surfaces, i8* null ) + to label %tmp3.i3838.noexc unwind label %lpad3845 ; <%"struct.std::basic_istream >"*> [#uses=0] + +tmp3.i3838.noexc: ; preds = %bb1632 + %tmp15.i38473853 = invoke i8* @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvPvEv( %"struct.std::basic_ios >"* null ) + to label %tmp15.i3847.noexc unwind label %lpad3845 ; [#uses=0] + +tmp15.i3847.noexc: ; preds = %tmp3.i3838.noexc + br i1 false, label %invcont1634, label %bb.i3850 + +bb.i3850: ; preds = %tmp15.i3847.noexc + ret void + +invcont1634: ; preds = %tmp15.i3847.noexc + %tmp3.i38173831 = invoke %"struct.std::basic_istream >"* @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_( %"struct.std::basic_istream >"* %surfaces, i8* null ) + to label %tmp3.i3817.noexc unwind label %lpad3845 ; <%"struct.std::basic_istream >"*> [#uses=0] + +tmp3.i3817.noexc: ; preds = %invcont1634 + %tmp15.i38263832 = invoke i8* @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvPvEv( %"struct.std::basic_ios >"* null ) + to label %tmp15.i3826.noexc unwind label %lpad3845 ; [#uses=0] + +tmp15.i3826.noexc: ; preds = %tmp3.i3817.noexc + br i1 false, label %invcont1636, label %bb.i3829 + +bb.i3829: ; preds = %tmp15.i3826.noexc + ret void + +invcont1636: ; preds = %tmp15.i3826.noexc + %tmp8.i38083811 = invoke %"struct.std::basic_istream >"* @_ZNSirsERd( %"struct.std::basic_istream >"* %surfaces, double* %tmp16.i3862 ) + to label %tmp8.i3808.noexc unwind label %lpad3845 ; <%"struct.std::basic_istream >"*> [#uses=1] + +tmp8.i3808.noexc: ; preds = %invcont1636 + %tmp9.i38093812 = invoke %"struct.std::basic_istream >"* @_ZNSirsERd( %"struct.std::basic_istream >"* %tmp8.i38083811, double* null ) + to label %tmp9.i3809.noexc unwind label %lpad3845 ; <%"struct.std::basic_istream >"*> [#uses=1] + +tmp9.i3809.noexc: ; preds = %tmp8.i3808.noexc + %tmp10.i38103813 = invoke %"struct.std::basic_istream >"* @_ZNSirsERd( %"struct.std::basic_istream >"* %tmp9.i38093812, double* null ) + to label %invcont1638 unwind label %lpad3845 ; <%"struct.std::basic_istream >"*> [#uses=0] + +invcont1638: ; preds = %tmp9.i3809.noexc + %tmp8.i37983801 = invoke %"struct.std::basic_istream >"* @_ZNSirsERd( %"struct.std::basic_istream >"* %surfaces, double* %tmp16.i3859 ) + to label %tmp8.i3798.noexc unwind label %lpad3845 ; <%"struct.std::basic_istream >"*> [#uses=1] + +tmp8.i3798.noexc: ; preds = %invcont1638 + %tmp9.i37993802 = invoke %"struct.std::basic_istream >"* @_ZNSirsERd( %"struct.std::basic_istream >"* %tmp8.i37983801, double* null ) + to label %tmp9.i3799.noexc unwind label %lpad3845 ; <%"struct.std::basic_istream >"*> [#uses=1] + +tmp9.i3799.noexc: ; preds = %tmp8.i3798.noexc + %tmp10.i38003803 = invoke %"struct.std::basic_istream >"* @_ZNSirsERd( %"struct.std::basic_istream >"* %tmp9.i37993802, double* null ) + to label %invcont1640 unwind label %lpad3845 ; <%"struct.std::basic_istream >"*> [#uses=0] + +invcont1640: ; preds = %tmp9.i3799.noexc + %tmp3.i3778 = load double* %tmp16.i3859, align 8 ; [#uses=1] + %tmp1643 = invoke i8* @_Znwm( i32 76 ) + to label %invcont1642 unwind label %lpad3845 ; [#uses=0] + +invcont1642: ; preds = %invcont1640 + %tmp18.i3770 = sub double %tmp3.i3778, 0.000000e+00 ; [#uses=0] + invoke fastcc void @_ZN7mrScene9AddObjectEP9mrSurfaceRK8ggStringS4_i( %struct.mrScene* %this, %struct.ggBRDF* null, %struct.ggString* null, %struct.ggString* null, i32 0 ) + to label %bb3743 unwind label %lpad3845 + +bb1654: ; preds = %bb1624 + br i1 false, label %bb1662, label %bb1693 + +bb1662: ; preds = %bb1654 + %tmp3.i37143728 = invoke %"struct.std::basic_istream >"* @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_( %"struct.std::basic_istream >"* %surfaces, i8* null ) + to label %tmp3.i3714.noexc unwind label %lpad3845 ; <%"struct.std::basic_istream >"*> [#uses=0] + +tmp3.i3714.noexc: ; preds = %bb1662 + %tmp15.i37233729 = invoke i8* @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvPvEv( %"struct.std::basic_ios >"* null ) + to label %tmp15.i3723.noexc unwind label %lpad3845 ; [#uses=0] + +tmp15.i3723.noexc: ; preds = %tmp3.i3714.noexc + ret void + +bb1693: ; preds = %bb1654 + br i1 false, label %bb1701, label %bb1745 + +bb1701: ; preds = %bb1693 + %tmp3.i36493663 = invoke %"struct.std::basic_istream >"* @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_( %"struct.std::basic_istream >"* %surfaces, i8* null ) + to label %tmp3.i3649.noexc unwind label %lpad3845 ; <%"struct.std::basic_istream >"*> [#uses=0] + +tmp3.i3649.noexc: ; preds = %bb1701 + ret void + +bb1745: ; preds = %bb1693 + br i1 false, label %bb1753, label %bb1797 + +bb1753: ; preds = %bb1745 + ret void + +bb1797: ; preds = %bb1745 + br i1 false, label %bb1805, label %bb1847 + +bb1805: ; preds = %bb1797 + ret void + +bb1847: ; preds = %bb1797 + br i1 false, label %bb1855, label %bb1897 + +bb1855: ; preds = %bb1847 + %tmp3.i34633477 = invoke %"struct.std::basic_istream >"* @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_( %"struct.std::basic_istream >"* %surfaces, i8* null ) + to label %tmp3.i3463.noexc unwind label %lpad3845 ; <%"struct.std::basic_istream >"*> [#uses=0] + +tmp3.i3463.noexc: ; preds = %bb1855 + %tmp15.i34723478 = invoke i8* @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvPvEv( %"struct.std::basic_ios >"* null ) + to label %tmp15.i3472.noexc unwind label %lpad3845 ; [#uses=0] + +tmp15.i3472.noexc: ; preds = %tmp3.i3463.noexc + br i1 false, label %invcont1857, label %bb.i3475 + +bb.i3475: ; preds = %tmp15.i3472.noexc + invoke fastcc void @_ZN8ggStringaSEPKc( %struct.ggString* null, i8* null ) + to label %invcont1857 unwind label %lpad3845 + +invcont1857: ; preds = %bb.i3475, %tmp15.i3472.noexc + %tmp1860 = invoke %"struct.std::basic_istream >"* @_ZNSirsERd( %"struct.std::basic_istream >"* %surfaces, double* null ) + to label %invcont1859 unwind label %lpad3845 ; <%"struct.std::basic_istream >"*> [#uses=1] + +invcont1859: ; preds = %invcont1857 + %tmp1862 = invoke %"struct.std::basic_istream >"* @_ZNSirsERd( %"struct.std::basic_istream >"* %tmp1860, double* null ) + to label %invcont1861 unwind label %lpad3845 ; <%"struct.std::basic_istream >"*> [#uses=1] + +invcont1861: ; preds = %invcont1859 + %tmp1864 = invoke %"struct.std::basic_istream >"* @_ZNSirsERd( %"struct.std::basic_istream >"* %tmp1862, double* null ) + to label %invcont1863 unwind label %lpad3845 ; <%"struct.std::basic_istream >"*> [#uses=1] + +invcont1863: ; preds = %invcont1861 + %tmp1866 = invoke %"struct.std::basic_istream >"* @_ZNSirsERd( %"struct.std::basic_istream >"* %tmp1864, double* null ) + to label %invcont1865 unwind label %lpad3845 ; <%"struct.std::basic_istream >"*> [#uses=1] + +invcont1865: ; preds = %invcont1863 + %tmp1868 = invoke %"struct.std::basic_istream >"* @_ZNSirsERd( %"struct.std::basic_istream >"* %tmp1866, double* null ) + to label %invcont1867 unwind label %lpad3845 ; <%"struct.std::basic_istream >"*> [#uses=0] + +invcont1867: ; preds = %invcont1865 + %tmp1881 = invoke i8 @_ZNKSt9basic_iosIcSt11char_traitsIcEE4goodEv( %"struct.std::basic_ios >"* null ) zeroext + to label %invcont1880 unwind label %lpad3845 ; [#uses=0] + +invcont1880: ; preds = %invcont1867 + %tmp1883 = invoke i8* @_Znwm( i32 24 ) + to label %invcont1882 unwind label %lpad3845 ; [#uses=0] + +invcont1882: ; preds = %invcont1880 + invoke fastcc void @_ZN7mrScene9AddObjectEP9mrSurfaceRK8ggStringS4_i( %struct.mrScene* %this, %struct.ggBRDF* null, %struct.ggString* null, %struct.ggString* null, i32 0 ) + to label %bb3743 unwind label %lpad3845 + +bb1897: ; preds = %bb1847 + br i1 false, label %bb1905, label %bb1947 + +bb1905: ; preds = %bb1897 + ret void + +bb1947: ; preds = %bb1897 + br i1 false, label %bb1955, label %bb2000 + +bb1955: ; preds = %bb1947 + ret void + +bb2000: ; preds = %bb1947 + br i1 false, label %bb2008, label %bb2053 + +bb2008: ; preds = %bb2000 + ret void + +bb2053: ; preds = %bb2000 + br i1 false, label %bb2061, label %bb2106 + +bb2061: ; preds = %bb2053 + %tmp3.i32433257 = invoke %"struct.std::basic_istream >"* @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_( %"struct.std::basic_istream >"* %surfaces, i8* null ) + to label %tmp3.i3243.noexc unwind label %lpad3845 ; <%"struct.std::basic_istream >"*> [#uses=0] + +tmp3.i3243.noexc: ; preds = %bb2061 + %tmp15.i32523258 = invoke i8* @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvPvEv( %"struct.std::basic_ios >"* null ) + to label %bb.i3255 unwind label %lpad3845 ; [#uses=0] + +bb.i3255: ; preds = %tmp3.i3243.noexc + invoke fastcc void @_ZN8ggStringaSEPKc( %struct.ggString* null, i8* null ) + to label %invcont2063 unwind label %lpad3845 + +invcont2063: ; preds = %bb.i3255 + ret void + +bb2106: ; preds = %bb2053 + %tmp7.i3214 = call i32 @strcmp( i8* %tmp5.i161, i8* getelementptr ([7 x i8]* @.str80, i32 0, i32 0) ) nounwind readonly ; [#uses=0] + br i1 false, label %bb2114, label %bb2136 + +bb2114: ; preds = %bb2106 + %tmp3.i31923206 = invoke %"struct.std::basic_istream >"* @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_( %"struct.std::basic_istream >"* %surfaces, i8* null ) + to label %tmp3.i3192.noexc unwind label %lpad3845 ; <%"struct.std::basic_istream >"*> [#uses=0] + +tmp3.i3192.noexc: ; preds = %bb2114 + %tmp15.i32013207 = invoke i8* @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvPvEv( %"struct.std::basic_ios >"* null ) + to label %tmp15.i3201.noexc unwind label %lpad3845 ; [#uses=0] + +tmp15.i3201.noexc: ; preds = %tmp3.i3192.noexc + br i1 false, label %invcont2116, label %bb.i3204 + +bb.i3204: ; preds = %tmp15.i3201.noexc + ret void + +invcont2116: ; preds = %tmp15.i3201.noexc + %tmp3.i31713185 = invoke %"struct.std::basic_istream >"* @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_( %"struct.std::basic_istream >"* %surfaces, i8* null ) + to label %tmp3.i3171.noexc unwind label %lpad3845 ; <%"struct.std::basic_istream >"*> [#uses=0] + +tmp3.i3171.noexc: ; preds = %invcont2116 + %tmp15.i31803186 = invoke i8* @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvPvEv( %"struct.std::basic_ios >"* null ) + to label %tmp15.i3180.noexc unwind label %lpad3845 ; [#uses=0] + +tmp15.i3180.noexc: ; preds = %tmp3.i3171.noexc + br i1 false, label %invcont2118, label %bb.i3183 + +bb.i3183: ; preds = %tmp15.i3180.noexc + ret void + +invcont2118: ; preds = %tmp15.i3180.noexc + %tmp8.i31623165 = invoke %"struct.std::basic_istream >"* @_ZNSirsERd( %"struct.std::basic_istream >"* %surfaces, double* null ) + to label %tmp8.i3162.noexc unwind label %lpad3845 ; <%"struct.std::basic_istream >"*> [#uses=1] + +tmp8.i3162.noexc: ; preds = %invcont2118 + %tmp9.i31633166 = invoke %"struct.std::basic_istream >"* @_ZNSirsERd( %"struct.std::basic_istream >"* %tmp8.i31623165, double* null ) + to label %tmp9.i3163.noexc unwind label %lpad3845 ; <%"struct.std::basic_istream >"*> [#uses=1] + +tmp9.i3163.noexc: ; preds = %tmp8.i3162.noexc + %tmp10.i31643167 = invoke %"struct.std::basic_istream >"* @_ZNSirsERd( %"struct.std::basic_istream >"* %tmp9.i31633166, double* null ) + to label %invcont2120 unwind label %lpad3845 ; <%"struct.std::basic_istream >"*> [#uses=0] + +invcont2120: ; preds = %tmp9.i3163.noexc + %tmp2123 = invoke %"struct.std::basic_istream >"* @_ZNSirsERd( %"struct.std::basic_istream >"* %surfaces, double* null ) + to label %invcont2122 unwind label %lpad3845 ; <%"struct.std::basic_istream >"*> [#uses=0] + +invcont2122: ; preds = %invcont2120 + %tmp2125 = invoke i8* @_Znwm( i32 36 ) + to label %invcont2124 unwind label %lpad3845 ; [#uses=0] + +invcont2124: ; preds = %invcont2122 + invoke fastcc void @_ZN7mrScene9AddObjectEP9mrSurfaceRK8ggStringS4_i( %struct.mrScene* %this, %struct.ggBRDF* null, %struct.ggString* null, %struct.ggString* null, i32 0 ) + to label %bb3743 unwind label %lpad3845 + +bb2136: ; preds = %bb2106 + %tmp7.i3128 = call i32 @strcmp( i8* %tmp5.i161, i8* getelementptr ([11 x i8]* @.str81, i32 0, i32 0) ) nounwind readonly ; [#uses=0] + br i1 false, label %bb2144, label %bb3336 + +bb2144: ; preds = %bb2136 + %tmp6.i.i31173123 = invoke i8* @_Znam( i32 12 ) + to label %_ZN8ggStringC1Ei.exit3124 unwind label %lpad3845 ; [#uses=0] + +_ZN8ggStringC1Ei.exit3124: ; preds = %bb2144 + %tmp3.i30983112 = invoke %"struct.std::basic_istream >"* @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_( %"struct.std::basic_istream >"* %surfaces, i8* null ) + to label %tmp3.i3098.noexc unwind label %lpad3921 ; <%"struct.std::basic_istream >"*> [#uses=0] + +tmp3.i3098.noexc: ; preds = %_ZN8ggStringC1Ei.exit3124 + %tmp15.i31073113 = invoke i8* @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvPvEv( %"struct.std::basic_ios >"* null ) + to label %tmp15.i3107.noexc unwind label %lpad3921 ; [#uses=0] + +tmp15.i3107.noexc: ; preds = %tmp3.i3098.noexc + br i1 false, label %invcont2147, label %bb.i3110 + +bb.i3110: ; preds = %tmp15.i3107.noexc + ret void + +invcont2147: ; preds = %tmp15.i3107.noexc + %tmp2161 = invoke i8 @_ZNKSt9basic_iosIcSt11char_traitsIcEE4goodEv( %"struct.std::basic_ios >"* null ) zeroext + to label %invcont2160 unwind label %lpad3921 ; [#uses=0] + +invcont2160: ; preds = %invcont2147 + %tmp4.i30933094 = invoke fastcc %struct.ggSpectrum* @_ZN5ggBSTI10ggSpectrumE4findERK8ggString3( %"struct.ggBSTNode"* null, %struct.ggString* null ) + to label %invcont2164 unwind label %lpad3921 ; <%struct.ggSpectrum*> [#uses=0] + +invcont2164: ; preds = %invcont2160 + br i1 false, label %bb2170, label %bb2181 + +bb2170: ; preds = %invcont2164 + ret void + +bb2181: ; preds = %invcont2164 + invoke fastcc void @_ZN8ggStringD1Ev( %struct.ggString* null ) + to label %bb3743 unwind label %lpad3845 + +bb3336: ; preds = %bb2136 + br i1 false, label %bb3344, label %bb3734 + +bb3344: ; preds = %bb3336 + %tmp6.i.i773779 = invoke i8* @_Znam( i32 12 ) + to label %_ZN8ggStringC1Ei.exit780 unwind label %lpad3845 ; [#uses=0] + +_ZN8ggStringC1Ei.exit780: ; preds = %bb3344 + %tmp6.i.i765771 = invoke i8* @_Znam( i32 12 ) + to label %_ZN8ggStringC1Ei.exit772 unwind label %lpad4025 ; [#uses=0] + +_ZN8ggStringC1Ei.exit772: ; preds = %_ZN8ggStringC1Ei.exit780 + %tmp3.i746760 = invoke %"struct.std::basic_istream >"* @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_( %"struct.std::basic_istream >"* %surfaces, i8* null ) + to label %tmp3.i746.noexc unwind label %lpad4029 ; <%"struct.std::basic_istream >"*> [#uses=0] + +tmp3.i746.noexc: ; preds = %_ZN8ggStringC1Ei.exit772 + %tmp15.i755761 = invoke i8* @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvPvEv( %"struct.std::basic_ios >"* null ) + to label %tmp15.i755.noexc unwind label %lpad4029 ; [#uses=0] + +tmp15.i755.noexc: ; preds = %tmp3.i746.noexc + br i1 false, label %invcont3348, label %bb.i758 + +bb.i758: ; preds = %tmp15.i755.noexc + ret void + +invcont3348: ; preds = %tmp15.i755.noexc + %tmp3.i726740 = invoke %"struct.std::basic_istream >"* @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_( %"struct.std::basic_istream >"* %surfaces, i8* null ) + to label %tmp3.i726.noexc unwind label %lpad4029 ; <%"struct.std::basic_istream >"*> [#uses=0] + +tmp3.i726.noexc: ; preds = %invcont3348 + %tmp15.i735741 = invoke i8* @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvPvEv( %"struct.std::basic_ios >"* null ) + to label %tmp15.i735.noexc unwind label %lpad4029 ; [#uses=0] + +tmp15.i735.noexc: ; preds = %tmp3.i726.noexc + br i1 false, label %bb3458, label %bb.i738 + +bb.i738: ; preds = %tmp15.i735.noexc + ret void + +bb3458: ; preds = %tmp15.i735.noexc + br i1 false, label %bb3466, label %bb3491 + +bb3466: ; preds = %bb3458 + %tmp3469 = invoke %"struct.std::basic_istream >"* @_ZNSirsERd( %"struct.std::basic_istream >"* %surfaces, double* null ) + to label %invcont3468 unwind label %lpad4029 ; <%"struct.std::basic_istream >"*> [#uses=1] + +invcont3468: ; preds = %bb3466 + %tmp3471 = invoke %"struct.std::basic_istream >"* @_ZNSirsERd( %"struct.std::basic_istream >"* %tmp3469, double* null ) + to label %invcont3470 unwind label %lpad4029 ; <%"struct.std::basic_istream >"*> [#uses=1] + +invcont3470: ; preds = %invcont3468 + %tmp3473 = invoke %"struct.std::basic_istream >"* @_ZNSirsERi( %"struct.std::basic_istream >"* %tmp3471, i32* null ) + to label %invcont3472 unwind label %lpad4029 ; <%"struct.std::basic_istream >"*> [#uses=0] + +invcont3472: ; preds = %invcont3470 + %tmp3475 = invoke i8* @_Znwm( i32 7196 ) + to label %invcont3474 unwind label %lpad4029 ; [#uses=1] + +invcont3474: ; preds = %invcont3472 + invoke fastcc void @_ZN13ggSolidNoise3C1Ev( %struct.ggSolidNoise3* null ) + to label %_ZN22ggCoverageSolidTextureC1Eddi.exit unwind label %lpad4045 + +_ZN22ggCoverageSolidTextureC1Eddi.exit: ; preds = %invcont3474 + %tmp34823483 = bitcast i8* %tmp3475 to %struct.ggBRDF* ; <%struct.ggBRDF*> [#uses=2] + invoke fastcc void @_ZN5ggBSTI14ggSolidTextureE17InsertIntoSubtreeERK8ggStringPS0_RP9ggBSTNodeIS0_E( %"struct.ggBST"* null, %struct.ggString* null, %struct.ggBRDF* %tmp34823483, %"struct.ggBSTNode"** null ) + to label %bb3662 unwind label %lpad4029 + +bb3491: ; preds = %bb3458 + ret void + +bb3662: ; preds = %_ZN22ggCoverageSolidTextureC1Eddi.exit + invoke fastcc void @_ZN8ggStringD1Ev( %struct.ggString* null ) + to label %invcont3663 unwind label %lpad4025 + +invcont3663: ; preds = %bb3662 + invoke fastcc void @_ZN8ggStringD1Ev( %struct.ggString* null ) + to label %bb3743 unwind label %lpad3845 + +bb3734: ; preds = %bb3336 + ret void + +bb3743: ; preds = %invcont3663, %bb2181, %invcont2124, %invcont1882, %invcont1642, %bb368, %bb353, %invcont335, %bb3743.preheader + %tex1.3 = phi %struct.ggBRDF* [ undef, %bb3743.preheader ], [ %tex1.3, %bb368 ], [ %tex1.3, %invcont1642 ], [ %tex1.3, %invcont1882 ], [ %tex1.3, %invcont2124 ], [ %tex1.3, %bb2181 ], [ %tex1.3, %invcont335 ], [ %tmp34823483, %invcont3663 ], [ %tex1.3, %bb353 ] ; <%struct.ggBRDF*> [#uses=7] + %tmp3.i312325 = invoke %"struct.std::basic_istream >"* @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_( %"struct.std::basic_istream >"* %surfaces, i8* null ) + to label %tmp3.i312.noexc unwind label %lpad3845 ; <%"struct.std::basic_istream >"*> [#uses=0] + +tmp3.i312.noexc: ; preds = %bb3743 + %tmp15.i327 = invoke i8* @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvPvEv( %"struct.std::basic_ios >"* null ) + to label %tmp15.i.noexc326 unwind label %lpad3845 ; [#uses=0] + +tmp15.i.noexc326: ; preds = %tmp3.i312.noexc + br i1 false, label %invcont3745, label %bb.i323 + +bb.i323: ; preds = %tmp15.i.noexc326 + ret void + +invcont3745: ; preds = %tmp15.i.noexc326 + %tmp3759 = invoke i8* @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvPvEv( %"struct.std::basic_ios >"* null ) + to label %invcont3758 unwind label %lpad3845 ; [#uses=0] + +invcont3758: ; preds = %invcont3745 + %tmp5.i161 = getelementptr %"struct.ggString::StringRep"* null, i32 0, i32 2, i32 0 ; [#uses=2] + br i1 false, label %bb333, label %bb345 + +lpad: ; preds = %entry + ret void + +lpad3825: ; preds = %_ZN8ggStringC1Ei.exit + ret void + +lpad3829: ; preds = %_ZN8ggStringC1Ei.exit96 + ret void + +lpad3833: ; preds = %_ZN8ggStringC1Ei.exit104 + ret void + +lpad3837: ; preds = %_ZN8ggStringC1Ei.exit112 + ret void + +lpad3841: ; preds = %_ZN8ggStringC1Ei.exit129 + ret void + +lpad3845: ; preds = %invcont3745, %tmp3.i312.noexc, %bb3743, %invcont3663, %bb3344, %bb2181, %bb2144, %invcont2124, %invcont2122, %invcont2120, %tmp9.i3163.noexc, %tmp8.i3162.noexc, %invcont2118, %tmp3.i3171.noexc, %invcont2116, %tmp3.i3192.noexc, %bb2114, %bb.i3255, %tmp3.i3243.noexc, %bb2061, %invcont1882, %invcont1880, %invcont1867, %invcont1865, %invcont1863, %invcont1861, %invcont1859, %invcont1857, %bb.i3475, %tmp3.i3463.noexc, %bb1855, %bb1701, %tmp3.i3714.noexc, %bb1662, %invcont1642, %invcont1640, %tmp9.i3799.noexc, %tmp8.i3798.noexc, %invcont1638, %tmp9.i3809.noexc, %tmp8.i3808.noexc, %invcont1636, %tmp3.i3817.noexc, %invcont1634, %tmp3.i3838.noexc, %bb1632, %bb368, %bb353, %tmp3.i167.noexc, %bb333, %tmp3.i.noexc, %_ZN13mrSurfaceListC1Ev.exit, %_ZN8ggStringC1Ei.exit139 + ret void + +lpad3849: ; preds = %invcont294 + ret void + +lpad3921: ; preds = %invcont2160, %invcont2147, %tmp3.i3098.noexc, %_ZN8ggStringC1Ei.exit3124 + ret void + +lpad4025: ; preds = %bb3662, %_ZN8ggStringC1Ei.exit780 + ret void + +lpad4029: ; preds = %_ZN22ggCoverageSolidTextureC1Eddi.exit, %invcont3472, %invcont3470, %invcont3468, %bb3466, %tmp3.i726.noexc, %invcont3348, %tmp3.i746.noexc, %_ZN8ggStringC1Ei.exit772 + ret void + +lpad4045: ; preds = %invcont3474 + ret void +} + +declare fastcc void @_ZN8ggStringD1Ev(%struct.ggString*) + +declare i8* @_Znam(i32) + +declare fastcc void @_ZN8ggStringaSEPKc(%struct.ggString*, i8*) + +declare i32 @strcmp(i8*, i8*) nounwind readonly + +declare %"struct.std::basic_istream >"* @_ZNSirsERi(%"struct.std::basic_istream >"*, i32*) + +declare i8* @_Znwm(i32) + +declare i8* @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvPvEv(%"struct.std::basic_ios >"*) + +declare %"struct.std::basic_istream >"* @_ZNSirsERd(%"struct.std::basic_istream >"*, double*) + +declare %"struct.std::basic_istream >"* @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_PS3_(%"struct.std::basic_istream >"*, i8*) + +declare fastcc void @_ZN13ggSolidNoise3C1Ev(%struct.ggSolidNoise3*) + +declare i8 @_ZNKSt9basic_iosIcSt11char_traitsIcEE4goodEv(%"struct.std::basic_ios >"*) zeroext + +declare fastcc %struct.ggSpectrum* @_ZN5ggBSTI10ggSpectrumE4findERK8ggString3(%"struct.ggBSTNode"*, %struct.ggString*) + +declare fastcc void @_ZN5ggBSTI14ggSolidTextureE17InsertIntoSubtreeERK8ggStringPS0_RP9ggBSTNodeIS0_E(%"struct.ggBST"*, %struct.ggString*, %struct.ggBRDF*, %"struct.ggBSTNode"**) + +declare fastcc void @_ZN7mrScene9AddObjectEP9mrSurfaceRK8ggStringS4_i(%struct.mrScene*, %struct.ggBRDF*, %struct.ggString*, %struct.ggString*, i32) From evan.cheng at apple.com Wed Dec 12 17:15:59 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 12 Dec 2007 23:15:59 -0000 Subject: [llvm-commits] [llvm] r44961 - /llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Message-ID: <200712122315.lBCNFxtj017602@zion.cs.uiuc.edu> Author: evancheng Date: Wed Dec 12 17:15:59 2007 New Revision: 44961 URL: http://llvm.org/viewvc/llvm-project?rev=44961&view=rev Log: Cosmetic change. Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Modified: llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h?rev=44961&r1=44960&r2=44961&view=diff ============================================================================== --- llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h (original) +++ llvm/trunk/include/llvm/CodeGen/SelectionDAGNodes.h Wed Dec 12 17:15:59 2007 @@ -872,6 +872,9 @@ /// int getNodeId() const { return NodeId; } + /// setNodeId - Set unique node id. + void setNodeId(int Id) { NodeId = Id; } + typedef SmallVector::const_iterator use_iterator; use_iterator use_begin() const { return Uses.begin(); } use_iterator use_end() const { return Uses.end(); } @@ -951,10 +954,6 @@ /// void Profile(FoldingSetNodeID &ID); - void setNodeId(int Id) { - NodeId = Id; - } - protected: friend class SelectionDAG; From sabre at nondot.org Wed Dec 12 18:04:46 2007 From: sabre at nondot.org (Chris Lattner) Date: Thu, 13 Dec 2007 00:04:46 -0000 Subject: [llvm-commits] [llvm] r44965 - /llvm/trunk/lib/Transforms/Instrumentation/EdgeProfiling.cpp Message-ID: <200712130004.lBD04k6F021309@zion.cs.uiuc.edu> Author: lattner Date: Wed Dec 12 18:04:46 2007 New Revision: 44965 URL: http://llvm.org/viewvc/llvm-project?rev=44965&view=rev Log: Fix for edge profiling, patch by 'Marc' for PR1857 Modified: llvm/trunk/lib/Transforms/Instrumentation/EdgeProfiling.cpp Modified: llvm/trunk/lib/Transforms/Instrumentation/EdgeProfiling.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/EdgeProfiling.cpp?rev=44965&r1=44964&r2=44965&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Instrumentation/EdgeProfiling.cpp (original) +++ llvm/trunk/lib/Transforms/Instrumentation/EdgeProfiling.cpp Wed Dec 12 18:04:46 2007 @@ -84,7 +84,7 @@ // Okay, we are guaranteed that the edge is no longer critical. If we // only have a single successor, insert the counter in this block, // otherwise insert it in the successor block. - if (TI->getNumSuccessors() == 0) { + if (TI->getNumSuccessors() == 1) { // Insert counter at the start of the block IncrementCounterInBlock(BB, i++, Counters); } else { From evan.cheng at apple.com Wed Dec 12 18:42:36 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 13 Dec 2007 00:42:36 -0000 Subject: [llvm-commits] [llvm] r44969 - in /llvm/trunk/utils/TableGen: CodeGenInstruction.h CodeGenTarget.cpp InstrInfoEmitter.cpp Message-ID: <200712130042.lBD0gaER024310@zion.cs.uiuc.edu> Author: evancheng Date: Wed Dec 12 18:42:35 2007 New Revision: 44969 URL: http://llvm.org/viewvc/llvm-project?rev=44969&view=rev Log: Oops. Forgot these. Modified: llvm/trunk/utils/TableGen/CodeGenInstruction.h llvm/trunk/utils/TableGen/CodeGenTarget.cpp llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp Modified: llvm/trunk/utils/TableGen/CodeGenInstruction.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenInstruction.h?rev=44969&r1=44968&r2=44969&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/CodeGenInstruction.h (original) +++ llvm/trunk/utils/TableGen/CodeGenInstruction.h Wed Dec 12 18:42:35 2007 @@ -92,6 +92,7 @@ bool isCall; bool isLoad; bool isStore; + bool isImplicitDef; bool isPredicable; bool isConvertibleToThreeAddress; bool isCommutable; Modified: llvm/trunk/utils/TableGen/CodeGenTarget.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenTarget.cpp?rev=44969&r1=44968&r2=44969&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/CodeGenTarget.cpp (original) +++ llvm/trunk/utils/TableGen/CodeGenTarget.cpp Wed Dec 12 18:42:35 2007 @@ -384,6 +384,7 @@ isCall = R->getValueAsBit("isCall"); isLoad = R->getValueAsBit("isLoad"); isStore = R->getValueAsBit("isStore"); + isImplicitDef= R->getValueAsBit("isImplicitDef"); bool isTwoAddress = R->getValueAsBit("isTwoAddress"); isPredicable = R->getValueAsBit("isPredicable"); isConvertibleToThreeAddress = R->getValueAsBit("isConvertibleToThreeAddress"); Modified: llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp?rev=44969&r1=44968&r2=44969&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp Wed Dec 12 18:42:35 2007 @@ -243,6 +243,7 @@ if (Inst.isCall) OS << "|M_CALL_FLAG"; if (Inst.isLoad) OS << "|M_LOAD_FLAG"; if (Inst.isStore || isStore) OS << "|M_STORE_FLAG"; + if (Inst.isImplicitDef)OS << "|M_IMPLICIT_DEF_FLAG"; if (Inst.isPredicable) OS << "|M_PREDICABLE"; if (Inst.isConvertibleToThreeAddress) OS << "|M_CONVERTIBLE_TO_3_ADDR"; if (Inst.isCommutable) OS << "|M_COMMUTABLE"; From evan.cheng at apple.com Wed Dec 12 18:43:27 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 13 Dec 2007 00:43:27 -0000 Subject: [llvm-commits] [llvm] r44970 - in /llvm/trunk: lib/Target/X86/X86ISelDAGToDAG.cpp lib/Target/X86/X86InstrInfo.td test/CodeGen/X86/fold-and-shift.ll Message-ID: <200712130043.lBD0hSxD024346@zion.cs.uiuc.edu> Author: evancheng Date: Wed Dec 12 18:43:27 2007 New Revision: 44970 URL: http://llvm.org/viewvc/llvm-project?rev=44970&view=rev Log: Fold some and + shift in x86 addressing mode. Added: llvm/trunk/test/CodeGen/X86/fold-and-shift.ll Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp llvm/trunk/lib/Target/X86/X86InstrInfo.td Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=44970&r1=44969&r2=44970&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Dec 12 18:43:27 2007 @@ -582,7 +582,7 @@ } int id = N.Val->getNodeId(); - bool Available = isSelected(id); + bool AlreadySelected = isSelected(id); // Already selected, not yet replaced. switch (N.getOpcode()) { default: break; @@ -605,7 +605,7 @@ // If value is available in a register both base and index components have // been picked, we can't fit the result available in the register in the // addressing mode. Duplicate GlobalAddress or ConstantPool as displacement. - if (!Available || (AM.Base.Reg.Val && AM.IndexReg.Val)) { + if (!AlreadySelected || (AM.Base.Reg.Val && AM.IndexReg.Val)) { bool isStatic = TM.getRelocationModel() == Reloc::Static; SDOperand N0 = N.getOperand(0); // Mac OS X X86-64 lower 4G address is not available. @@ -653,7 +653,7 @@ break; case ISD::SHL: - if (Available || AM.IndexReg.Val != 0 || AM.Scale != 1) + if (AlreadySelected || AM.IndexReg.Val != 0 || AM.Scale != 1) break; if (ConstantSDNode *CN = dyn_cast(N.Val->getOperand(1))) { @@ -690,7 +690,7 @@ // FALL THROUGH case ISD::MUL: // X*[3,5,9] -> X+X*[2,4,8] - if (!Available && + if (!AlreadySelected && AM.BaseType == X86ISelAddressMode::RegBase && AM.Base.Reg.Val == 0 && AM.IndexReg.Val == 0) { @@ -725,7 +725,7 @@ break; case ISD::ADD: - if (!Available) { + if (!AlreadySelected) { X86ISelAddressMode Backup = AM; if (!MatchAddress(N.Val->getOperand(0), AM, false, Depth+1) && !MatchAddress(N.Val->getOperand(1), AM, false, Depth+1)) @@ -740,7 +740,7 @@ case ISD::OR: // Handle "X | C" as "X + C" iff X is known to have C bits clear. - if (Available) break; + if (AlreadySelected) break; if (ConstantSDNode *CN = dyn_cast(N.getOperand(1))) { X86ISelAddressMode Backup = AM; @@ -758,6 +758,44 @@ AM = Backup; } break; + + case ISD::AND: { + // Handle "(x << C1) & C2" as "(X & (C2>>C1)) << C1" if safe and if this + // allows us to fold the shift into this addressing mode. + if (AlreadySelected) break; + SDOperand Shift = N.getOperand(0); + if (Shift.getOpcode() != ISD::SHL) break; + + // Scale must not be used already. + if (AM.IndexReg.Val != 0 || AM.Scale != 1) break; + + ConstantSDNode *C2 = dyn_cast(N.getOperand(1)); + ConstantSDNode *C1 = dyn_cast(Shift.getOperand(1)); + if (!C1 || !C2) break; + + // Not likely to be profitable if either the AND or SHIFT node has more + // than one use (unless all uses are for address computation). Besides, + // isel mechanism requires their node ids to be reused. + if (!N.hasOneUse() || !Shift.hasOneUse()) + break; + + // Verify that the shift amount is something we can fold. + unsigned ShiftCst = C1->getValue(); + if (ShiftCst != 1 && ShiftCst != 2 && ShiftCst != 3) + break; + + // Get the new AND mask, this folds to a constant. + SDOperand NewANDMask = CurDAG->getNode(ISD::SRL, N.getValueType(), + SDOperand(C2, 0), SDOperand(C1, 0)); + SDOperand NewAND = CurDAG->getNode(ISD::AND, N.getValueType(), + Shift.getOperand(0), NewANDMask); + NewANDMask.Val->setNodeId(Shift.Val->getNodeId()); + NewAND.Val->setNodeId(N.Val->getNodeId()); + + AM.Scale = 1 << ShiftCst; + AM.IndexReg = NewAND; + return false; + } } return MatchAddressBase(N, AM, isRoot, Depth); Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=44970&r1=44969&r2=44970&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Wed Dec 12 18:43:27 2007 @@ -2613,6 +2613,10 @@ def : Pat<(i32 (anyext (loadi8 addr:$src))), (MOVZX32rm8 addr:$src)>; def : Pat<(i32 (anyext (loadi16 addr:$src))), (MOVZX32rm16 addr:$src)>; +// (and (i32 load), 255) -> (zextload i8) +def : Pat<(i32 (and (loadi32 addr:$src), (i32 255))), (MOVZX32rm8 addr:$src)>; +def : Pat<(i32 (and (loadi32 addr:$src), (i32 65535))),(MOVZX32rm16 addr:$src)>; + //===----------------------------------------------------------------------===// // Some peepholes //===----------------------------------------------------------------------===// Added: llvm/trunk/test/CodeGen/X86/fold-and-shift.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fold-and-shift.ll?rev=44970&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/fold-and-shift.ll (added) +++ llvm/trunk/test/CodeGen/X86/fold-and-shift.ll Wed Dec 12 18:43:27 2007 @@ -0,0 +1,21 @@ +; RUN: llvm-as < %s | llc -march=x86 | not grep and + +define i32 @t1(i8* %X, i32 %i) { +entry: + %tmp2 = shl i32 %i, 2 ; [#uses=1] + %tmp4 = and i32 %tmp2, 1020 ; [#uses=1] + %tmp7 = getelementptr i8* %X, i32 %tmp4 ; [#uses=1] + %tmp78 = bitcast i8* %tmp7 to i32* ; [#uses=1] + %tmp9 = load i32* %tmp78, align 4 ; [#uses=1] + ret i32 %tmp9 +} + +define i32 @t2(i16* %X, i32 %i) { +entry: + %tmp2 = shl i32 %i, 1 ; [#uses=1] + %tmp4 = and i32 %tmp2, 131070 ; [#uses=1] + %tmp7 = getelementptr i16* %X, i32 %tmp4 ; [#uses=1] + %tmp78 = bitcast i16* %tmp7 to i32* ; [#uses=1] + %tmp9 = load i32* %tmp78, align 4 ; [#uses=1] + ret i32 %tmp9 +} From evan.cheng at apple.com Wed Dec 12 18:51:42 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 13 Dec 2007 00:51:42 -0000 Subject: [llvm-commits] [test-suite] r44971 - /test-suite/trunk/Makefile.programs Message-ID: <200712130051.lBD0pgso024681@zion.cs.uiuc.edu> Author: evancheng Date: Wed Dec 12 18:51:41 2007 New Revision: 44971 URL: http://llvm.org/viewvc/llvm-project?rev=44971&view=rev Log: Doh. Modified: test-suite/trunk/Makefile.programs Modified: test-suite/trunk/Makefile.programs URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.programs?rev=44971&r1=44970&r2=44971&view=diff ============================================================================== --- test-suite/trunk/Makefile.programs (original) +++ test-suite/trunk/Makefile.programs Wed Dec 12 18:51:41 2007 @@ -222,7 +222,8 @@ LLCBETAOPTION := -sched=simple endif ifeq ($(ARCH),x86) -LLCBETAOPTION := -new-coalescer-heuristic=true +LLCBETAOPTION := -optimize-ext-uses +#-new-coalescer-heuristic=true #-tailcallopt #-regalloc=local -fast #-disable-rematerialization @@ -233,8 +234,7 @@ LLCBETAOPTION := -enable-sparc-v9-insts endif ifeq ($(ARCH),ARM) -LLCBETAOPTION := -optimize-ext-uses -#-new-coalescer-heuristic=true +LLCBETAOPTION := -new-coalescer-heuristic=true #-disable-rematerialization #-march=thumb endif From clattner at apple.com Wed Dec 12 19:07:18 2007 From: clattner at apple.com (Chris Lattner) Date: Wed, 12 Dec 2007 17:07:18 -0800 Subject: [llvm-commits] [llvm] r44960 - in /llvm/trunk: include/llvm/Target/ lib/CodeGen/ lib/Target/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/IA64/ lib/Target/Mips/ lib/Target/PowerPC/ lib/Target/Sparc/ lib/Target/X86/ test/CodeGen/X86/ In-Reply-To: <200712122312.lBCNCAJs016823@zion.cs.uiuc.edu> References: <200712122312.lBCNCAJs016823@zion.cs.uiuc.edu> Message-ID: On Dec 12, 2007, at 3:12 PM, Evan Cheng wrote: > isLoad = false; > - if (tii_->isTriviallyReMaterializable(MI)) { > - isLoad = MI->getInstrDescriptor()->Flags & M_LOAD_FLAG; > + const TargetInstrDescriptor *TID = MI->getInstrDescriptor(); > + if ((TID->Flags & M_IMPLICIT_DEF_FLAG) || > + tii_->isTriviallyReMaterializable(MI)) { > + isLoad = TID->Flags & M_LOAD_FLAG; > return true; > } Hi Evan, At one point were discussed eliminating TII::isTriviallyReMaterializable. The argument is that target implementations shouldn't have to know about algorithms, they should just describe properties of the target, and the algorithm should figure out if it can make the xform from that info. Is this a pipe dream? :) -Chris From natebegeman at mac.com Wed Dec 12 19:18:53 2007 From: natebegeman at mac.com (Nate Begeman) Date: Thu, 13 Dec 2007 01:18:53 -0000 Subject: [llvm-commits] [llvm] r44973 - /llvm/trunk/configure Message-ID: <200712130118.lBD1IrsY027628@zion.cs.uiuc.edu> Author: sampo Date: Wed Dec 12 19:18:52 2007 New Revision: 44973 URL: http://llvm.org/viewvc/llvm-project?rev=44973&view=rev Log: Do not build CBackend and MSIL regardless of configured targets Modified: llvm/trunk/configure Modified: llvm/trunk/configure URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=44973&r1=44972&r2=44973&view=diff ============================================================================== --- llvm/trunk/configure (original) +++ llvm/trunk/configure Wed Dec 12 19:18:52 2007 @@ -4566,7 +4566,7 @@ fi case "$enableval" in - all) TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha IA64 ARM Mips CellSPU" ;; + all) TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha IA64 ARM Mips CellSPU CBackend MSIL" ;; host-only) case "$llvm_cv_target_arch" in x86) TARGETS_TO_BUILD="X86" ;; @@ -4594,6 +4594,8 @@ arm) TARGETS_TO_BUILD="ARM $TARGETS_TO_BUILD" ;; mips) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;; spu) TARGETS_TO_BUILD="CellSPU $TARGETS_TO_BUILD" ;; + cbe) TARGETS_TO_BUILD="CBackend $TARGETS_TO_BUILD" ;; + msil) TARGETS_TO_BUILD="MSIL $TARGETS_TO_BUILD" ;; *) { { echo "$as_me:$LINENO: error: Unrecognized target $a_target" >&5 echo "$as_me: error: Unrecognized target $a_target" >&2;} { (exit 1); exit 1; }; } ;; @@ -4601,7 +4603,6 @@ done ;; esac -TARGETS_TO_BUILD="CBackend MSIL $TARGETS_TO_BUILD" TARGETS_TO_BUILD=$TARGETS_TO_BUILD From evan.cheng at apple.com Wed Dec 12 19:37:10 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 12 Dec 2007 17:37:10 -0800 Subject: [llvm-commits] [llvm] r44960 - in /llvm/trunk: include/llvm/Target/ lib/CodeGen/ lib/Target/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/IA64/ lib/Target/Mips/ lib/Target/PowerPC/ lib/Target/Sparc/ lib/Target/X86/ test/CodeGen/X86/ In-Reply-To: References: <200712122312.lBCNCAJs016823@zion.cs.uiuc.edu> Message-ID: <9B29D610-D3CF-4536-A2FA-9F18295A4A54@apple.com> On Dec 12, 2007, at 5:07 PM, Chris Lattner wrote: > On Dec 12, 2007, at 3:12 PM, Evan Cheng wrote: >> isLoad = false; >> - if (tii_->isTriviallyReMaterializable(MI)) { >> - isLoad = MI->getInstrDescriptor()->Flags & M_LOAD_FLAG; >> + const TargetInstrDescriptor *TID = MI->getInstrDescriptor(); >> + if ((TID->Flags & M_IMPLICIT_DEF_FLAG) || >> + tii_->isTriviallyReMaterializable(MI)) { >> + isLoad = TID->Flags & M_LOAD_FLAG; >> return true; >> } > > Hi Evan, > > At one point were discussed eliminating > TII::isTriviallyReMaterializable. The argument is that target > implementations shouldn't have to know about algorithms, they should > just describe properties of the target, and the algorithm should > figure out if it can make the xform from that info. What do you mean? The targets don't know about the remat algorithm. It's just the spiller making use of a some property of the instructions. Evan > > Is this a pipe dream? :) > > -Chris > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From evan.cheng at apple.com Wed Dec 12 19:45:16 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 12 Dec 2007 17:45:16 -0800 Subject: [llvm-commits] [llvm] r44960 - in /llvm/trunk: include/llvm/Target/ lib/CodeGen/ lib/Target/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/IA64/ lib/Target/Mips/ lib/Target/PowerPC/ lib/Target/Sparc/ lib/Target/X86/ test/CodeGen/X86/ In-Reply-To: <9B29D610-D3CF-4536-A2FA-9F18295A4A54@apple.com> References: <200712122312.lBCNCAJs016823@zion.cs.uiuc.edu> <9B29D610-D3CF-4536-A2FA-9F18295A4A54@apple.com> Message-ID: <6C30E4DF-38C0-4190-A6CF-543C707D912D@apple.com> On Dec 12, 2007, at 5:37 PM, Evan Cheng wrote: > > On Dec 12, 2007, at 5:07 PM, Chris Lattner wrote: > >> On Dec 12, 2007, at 3:12 PM, Evan Cheng wrote: >>> isLoad = false; >>> - if (tii_->isTriviallyReMaterializable(MI)) { >>> - isLoad = MI->getInstrDescriptor()->Flags & M_LOAD_FLAG; >>> + const TargetInstrDescriptor *TID = MI->getInstrDescriptor(); >>> + if ((TID->Flags & M_IMPLICIT_DEF_FLAG) || >>> + tii_->isTriviallyReMaterializable(MI)) { >>> + isLoad = TID->Flags & M_LOAD_FLAG; >>> return true; >>> } >> >> Hi Evan, >> >> At one point were discussed eliminating >> TII::isTriviallyReMaterializable. The argument is that target >> implementations shouldn't have to know about algorithms, they should >> just describe properties of the target, and the algorithm should >> figure out if it can make the xform from that info. > > What do you mean? The targets don't know about the remat algorithm. > It's just the spiller making use of a some property of the > instructions. Ok, you are talking about isTriviallyReMaterializable, not M_IMPLICIT_DEF_FLAG. Right now it is defined as this: bool isTriviallyReMaterializable(MachineInstr *MI) const { return (MI->getInstrDescriptor()->Flags & M_REMATERIALIZIBLE) && isReallyTriviallyReMaterializable(MI); } X86::isReallyTriviallyReMaterializable() is: ... case X86::MMX_MOVD64rm: case X86::MMX_MOVQ64rm: // Loads from constant pools are trivially rematerializable. return MI->getOperand(1).isRegister() && MI->getOperand (2).isImmediate() && MI->getOperand(3).isRegister() && MI->getOperand (4).isConstantPoolIndex() && MI->getOperand(1).getReg() == 0 && MI->getOperand(2).getImmedValue() == 1 && MI->getOperand(3).getReg() == 0; } The targets is only describing properties of the instruction because we are not able to describe addressing mode in a generic way. Seems like we are not too far off from your "pipe dream". :-) Evan > > Evan > >> >> Is this a pipe dream? :) >> >> -Chris >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Wed Dec 12 19:48:34 2007 From: clattner at apple.com (Chris Lattner) Date: Wed, 12 Dec 2007 17:48:34 -0800 Subject: [llvm-commits] [llvm] r44960 - in /llvm/trunk: include/llvm/Target/ lib/CodeGen/ lib/Target/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/IA64/ lib/Target/Mips/ lib/Target/PowerPC/ lib/Target/Sparc/ lib/Target/X86/ test/CodeGen/X86/ In-Reply-To: <9B29D610-D3CF-4536-A2FA-9F18295A4A54@apple.com> References: <200712122312.lBCNCAJs016823@zion.cs.uiuc.edu> <9B29D610-D3CF-4536-A2FA-9F18295A4A54@apple.com> Message-ID: <2346FC17-A24F-4850-B3D9-6065ED5DE366@apple.com> >> At one point were discussed eliminating >> TII::isTriviallyReMaterializable. The argument is that target >> implementations shouldn't have to know about algorithms, they should >> just describe properties of the target, and the algorithm should >> figure out if it can make the xform from that info. > > What do you mean? The targets don't know about the remat algorithm. > It's just the spiller making use of a some property of the > instructions. The comment above isTriviallyReMaterializable says: /// isTriviallyReMaterializable - Return true if the instruction is trivially /// rematerializable, meaning it has no side effects and requires no operands /// that aren't always available. Why not just expose the properties "has no side effects" and "requires no operands that are not always available"? -Chris From clattner at apple.com Wed Dec 12 19:51:04 2007 From: clattner at apple.com (Chris Lattner) Date: Wed, 12 Dec 2007 17:51:04 -0800 Subject: [llvm-commits] [llvm] r44960 - in /llvm/trunk: include/llvm/Target/ lib/CodeGen/ lib/Target/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/IA64/ lib/Target/Mips/ lib/Target/PowerPC/ lib/Target/Sparc/ lib/Target/X86/ test/CodeGen/X86/ In-Reply-To: <6C30E4DF-38C0-4190-A6CF-543C707D912D@apple.com> References: <200712122312.lBCNCAJs016823@zion.cs.uiuc.edu> <9B29D610-D3CF-4536-A2FA-9F18295A4A54@apple.com> <6C30E4DF-38C0-4190-A6CF-543C707D912D@apple.com> Message-ID: >>> At one point were discussed eliminating >>> TII::isTriviallyReMaterializable. The argument is that target >>> implementations shouldn't have to know about algorithms, they should >>> just describe properties of the target, and the algorithm should >>> figure out if it can make the xform from that info. >> >> What do you mean? The targets don't know about the remat algorithm. >> It's just the spiller making use of a some property of the >> instructions. > > Ok, you are talking about isTriviallyReMaterializable, not > M_IMPLICIT_DEF_FLAG. Right now it is defined as this: Right. > bool isTriviallyReMaterializable(MachineInstr *MI) const { > return (MI->getInstrDescriptor()->Flags & M_REMATERIALIZIBLE) && > isReallyTriviallyReMaterializable(MI); > } > > X86::isReallyTriviallyReMaterializable() is: > ... > case X86::MMX_MOVD64rm: > case X86::MMX_MOVQ64rm: > // Loads from constant pools are trivially rematerializable. > return MI->getOperand(1).isRegister() && MI->getOperand > (2).isImmediate() && > MI->getOperand(3).isRegister() && MI->getOperand > (4).isConstantPoolIndex() && > MI->getOperand(1).getReg() == 0 && > MI->getOperand(2).getImmedValue() == 1 && > MI->getOperand(3).getReg() == 0; > } > > The targets is only describing properties of the instruction because > we are not able to describe addressing mode in a generic way. Seems > like we are not too far off from your "pipe dream". :-) aha! How about we have some new property "can be moved with impunity" which laods from the constant pool would return true for? This property could then be used by licm and is better than calling it "rematerializable", which depends on the implementation of remat. I'd like to nuke M_REMATERIALIZIBLE and isReallyTriviallyReMaterializable, replacing them with the properties that are actually needed. -Chris From dalej at apple.com Wed Dec 12 19:51:56 2007 From: dalej at apple.com (Dale Johannesen) Date: Thu, 13 Dec 2007 01:51:56 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r44975 - in /llvm-gcc-4.2/trunk/gcc: config/darwin.h except.c unwind-dw2.c Message-ID: <200712130151.lBD1puVF030399@zion.cs.uiuc.edu> Author: johannes Date: Wed Dec 12 19:51:55 2007 New Revision: 44975 URL: http://llvm.org/viewvc/llvm-project?rev=44975&view=rev Log: Use Unwind_Resume_or_Rethrow instead of Unwind_Resume for Darwin stack unwind. Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h llvm-gcc-4.2/trunk/gcc/except.c llvm-gcc-4.2/trunk/gcc/unwind-dw2.c Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.h?rev=44975&r1=44974&r2=44975&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/darwin.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/darwin.h Wed Dec 12 19:51:55 2007 @@ -1277,6 +1277,10 @@ else if (!MACHO_DYNAMIC_NO_PIC_P) \ argvec.push_back ("--relocation-model=static") #endif /* defined (TARGET_386) */ + +/* On Darwin _Unwind_Resume is sensitive to the dynamic stack layout; we + use _Unwind_Resume_or_Rethrow instead. */ +#define LLVM_STACKSENSITIVE_UNWIND_RESUME 1 #endif /* LLVM LOCAL end */ Modified: llvm-gcc-4.2/trunk/gcc/except.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/except.c?rev=44975&r1=44974&r2=44975&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/except.c (original) +++ llvm-gcc-4.2/trunk/gcc/except.c Wed Dec 12 19:51:55 2007 @@ -4054,8 +4054,12 @@ /* The default c++ routines aren't actually c++ specific, so use those. */ /* LLVM local begin */ llvm_unwind_resume_libfunc = llvm_init_one_libfunc ( USING_SJLJ_EXCEPTIONS ? - "_Unwind_SjLj_Resume" - : "_Unwind_Resume"); + "_Unwind_SjLj_Resume" +#ifdef LLVM_STACKSENSITIVE_UNWIND_RESUME + : "_Unwind_Resume_or_Rethrow"); +#else + : "_Unwind_Resume"); +#endif /* LLVM local end */ } Modified: llvm-gcc-4.2/trunk/gcc/unwind-dw2.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/unwind-dw2.c?rev=44975&r1=44974&r2=44975&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/unwind-dw2.c (original) +++ llvm-gcc-4.2/trunk/gcc/unwind-dw2.c Wed Dec 12 19:51:55 2007 @@ -1511,7 +1511,14 @@ static inline _Unwind_Ptr uw_identify_context (struct _Unwind_Context *context) { +/* LLVM LOCAL begin + This change is needed to match Apple's installed libgcc. */ +#ifdef LLVM_STACKSENSITIVE_UNWIND_RESUME + return _Unwind_GetCFA (context); +#else return _Unwind_GetIP (context); +#endif +/* LLVM LOCAL end */ } From lattner at apple.com Wed Dec 12 19:51:45 2007 From: lattner at apple.com (Tanya Lattner) Date: Wed, 12 Dec 2007 17:51:45 -0800 Subject: [llvm-commits] [llvm] r44973 - /llvm/trunk/configure In-Reply-To: <200712130118.lBD1IrsY027628@zion.cs.uiuc.edu> References: <200712130118.lBD1IrsY027628@zion.cs.uiuc.edu> Message-ID: <515582AF-C5FB-4721-95C5-EC657D9C0FC1@apple.com> Did you forget to check in configure.ac for this change? -Tanya On Dec 12, 2007, at 5:18 PM, Nate Begeman wrote: > Author: sampo > Date: Wed Dec 12 19:18:52 2007 > New Revision: 44973 > > URL: http://llvm.org/viewvc/llvm-project?rev=44973&view=rev > Log: > Do not build CBackend and MSIL regardless of configured targets > > Modified: > llvm/trunk/configure > > Modified: llvm/trunk/configure > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure? > rev=44973&r1=44972&r2=44973&view=diff > > ====================================================================== > ======== > --- llvm/trunk/configure (original) > +++ llvm/trunk/configure Wed Dec 12 19:18:52 2007 > @@ -4566,7 +4566,7 @@ > fi > > case "$enableval" in > - all) TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha IA64 ARM Mips > CellSPU" ;; > + all) TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha IA64 ARM Mips > CellSPU CBackend MSIL" ;; > host-only) > case "$llvm_cv_target_arch" in > x86) TARGETS_TO_BUILD="X86" ;; > @@ -4594,6 +4594,8 @@ > arm) TARGETS_TO_BUILD="ARM $TARGETS_TO_BUILD" ;; > mips) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;; > spu) TARGETS_TO_BUILD="CellSPU $TARGETS_TO_BUILD" ;; > + cbe) TARGETS_TO_BUILD="CBackend $TARGETS_TO_BUILD" ;; > + msil) TARGETS_TO_BUILD="MSIL $TARGETS_TO_BUILD" ;; > *) { { echo "$as_me:$LINENO: error: Unrecognized target > $a_target" >&5 > echo "$as_me: error: Unrecognized target $a_target" >&2;} > { (exit 1); exit 1; }; } ;; > @@ -4601,7 +4603,6 @@ > done > ;; > esac > -TARGETS_TO_BUILD="CBackend MSIL $TARGETS_TO_BUILD" > TARGETS_TO_BUILD=$TARGETS_TO_BUILD > > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From evan.cheng at apple.com Wed Dec 12 20:01:45 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 12 Dec 2007 18:01:45 -0800 Subject: [llvm-commits] [llvm] r44960 - in /llvm/trunk: include/llvm/Target/ lib/CodeGen/ lib/Target/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/IA64/ lib/Target/Mips/ lib/Target/PowerPC/ lib/Target/Sparc/ lib/Target/X86/ test/CodeGen/X86/ In-Reply-To: References: <200712122312.lBCNCAJs016823@zion.cs.uiuc.edu> <9B29D610-D3CF-4536-A2FA-9F18295A4A54@apple.com> <6C30E4DF-38C0-4190-A6CF-543C707D912D@apple.com> Message-ID: <0B1FCBF6-DE6A-430E-A367-28F6D27738AF@apple.com> On Dec 12, 2007, at 5:51 PM, Chris Lattner wrote: >>>> At one point were discussed eliminating >>>> TII::isTriviallyReMaterializable. The argument is that target >>>> implementations shouldn't have to know about algorithms, they >>>> should >>>> just describe properties of the target, and the algorithm should >>>> figure out if it can make the xform from that info. >>> >>> What do you mean? The targets don't know about the remat algorithm. >>> It's just the spiller making use of a some property of the >>> instructions. >> >> Ok, you are talking about isTriviallyReMaterializable, not >> M_IMPLICIT_DEF_FLAG. Right now it is defined as this: > > Right. > >> bool isTriviallyReMaterializable(MachineInstr *MI) const { >> return (MI->getInstrDescriptor()->Flags & M_REMATERIALIZIBLE) && >> isReallyTriviallyReMaterializable(MI); >> } >> >> X86::isReallyTriviallyReMaterializable() is: >> ... >> case X86::MMX_MOVD64rm: >> case X86::MMX_MOVQ64rm: >> // Loads from constant pools are trivially rematerializable. >> return MI->getOperand(1).isRegister() && MI->getOperand >> (2).isImmediate() && >> MI->getOperand(3).isRegister() && MI->getOperand >> (4).isConstantPoolIndex() && >> MI->getOperand(1).getReg() == 0 && >> MI->getOperand(2).getImmedValue() == 1 && >> MI->getOperand(3).getReg() == 0; >> } >> >> The targets is only describing properties of the instruction because >> we are not able to describe addressing mode in a generic way. Seems >> like we are not too far off from your "pipe dream". :-) > > aha! How about we have some new property "can be moved with > impunity" which laods from the constant pool would return true for? > This property could then be used by licm and is better than calling > it "rematerializable", which depends on the implementation of remat. The problem is the property requires understanding of the MI addressing mode. There is no way to specify a static property to describe that. Unless we want to use different opcodes for constantpool load, for example. > > I'd like to nuke M_REMATERIALIZIBLE and > isReallyTriviallyReMaterializable, replacing them with the properties > that are actually needed. I have no problem with nuking M_REMATERIALIZIBLE. We just have to replace it with something like M_HAS_SIDE_EFFECT. However, I am not sure how to eliminate isReallyTriviallyReMaterializable for reason described above. Evan > > -Chris > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From zhousheng00 at gmail.com Wed Dec 12 20:03:58 2007 From: zhousheng00 at gmail.com (Zhou Sheng) Date: Thu, 13 Dec 2007 02:03:58 -0000 Subject: [llvm-commits] [llvm] r44977 - /llvm/trunk/test/ExecutionEngine/2007-12-11-APIntExFuncCall.ll Message-ID: <200712130203.lBD23whg031110@zion.cs.uiuc.edu> Author: sheng Date: Wed Dec 12 20:03:57 2007 New Revision: 44977 URL: http://llvm.org/viewvc/llvm-project?rev=44977&view=rev Log: Remove this testcase as it will always fail on platform like Darwin. Removed: llvm/trunk/test/ExecutionEngine/2007-12-11-APIntExFuncCall.ll Removed: llvm/trunk/test/ExecutionEngine/2007-12-11-APIntExFuncCall.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/2007-12-11-APIntExFuncCall.ll?rev=44976&view=auto ============================================================================== --- llvm/trunk/test/ExecutionEngine/2007-12-11-APIntExFuncCall.ll (original) +++ llvm/trunk/test/ExecutionEngine/2007-12-11-APIntExFuncCall.ll (removed) @@ -1,54 +0,0 @@ -; RUN: llvm-as < %s -o - | lli -force-interpreter -; PR1629 - -; ModuleID = '' -target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" -target triple = "i686-pc-linux-gnu" - %struct.X = type { i32 } - at _ZGVZ4mainE1a = internal global i64 0, align 8 ; [#uses=3] - at _ZZ4mainE1a = internal global %struct.X zeroinitializer ; <%struct.X*> [#uses=1] - -define i32 @main() nounwind { -entry: - %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - %tmp2 = call double @sin( double 1.999000e+00 ) nounwind readonly ; [#uses=1] - %tmp3 = call double @cos( double 1.990000e+00 ) nounwind readonly ; [#uses=1] - %tmp4 = add double %tmp2, %tmp3 ; [#uses=1] - %tmp5 = load i8* bitcast (i64* @_ZGVZ4mainE1a to i8*), align 1 ; [#uses=1] - %tmp6 = icmp eq i8 %tmp5, 0 ; [#uses=1] - %tmp67 = zext i1 %tmp6 to i8 ; [#uses=1] - %toBool = icmp ne i8 %tmp67, 0 ; [#uses=1] - br i1 %toBool, label %cond_true, label %cond_next14 - -cond_true: ; preds = %entry - %tmp8 = call i32 @__cxa_guard_acquire( i64* @_ZGVZ4mainE1a ) nounwind ; [#uses=1] - %tmp9 = icmp ne i32 %tmp8, 0 ; [#uses=1] - %tmp910 = zext i1 %tmp9 to i8 ; [#uses=1] - %toBool12 = icmp ne i8 %tmp910, 0 ; [#uses=1] - br i1 %toBool12, label %cond_true13, label %cond_next14 - -cond_true13: ; preds = %cond_true - call void @_ZN1XC1Ei( %struct.X* @_ZZ4mainE1a, i32 0 ) nounwind - call void @__cxa_guard_release( i64* @_ZGVZ4mainE1a ) nounwind - br label %cond_next14 - -cond_next14: ; preds = %cond_true13, %cond_true, %entry - %tmp1516 = fptosi double %tmp4 to i32 ; [#uses=1] - ret i32 %tmp1516 -} - -define linkonce void @_ZN1XC1Ei(%struct.X* %this, i32 %val) nounwind { -entry: - %"alloca point" = bitcast i32 0 to i32 ; [#uses=0] - %tmp1 = getelementptr %struct.X* %this, i32 0, i32 0 ; [#uses=1] - store i32 %val, i32* %tmp1, align 4 - ret void -} - -declare double @sin(double) nounwind readonly - -declare double @cos(double) nounwind readonly - -declare i32 @__cxa_guard_acquire(i64*) nounwind - -declare void @__cxa_guard_release(i64*) nounwind From natebegeman at mac.com Wed Dec 12 20:17:17 2007 From: natebegeman at mac.com (Nate Begeman) Date: Thu, 13 Dec 2007 02:17:17 -0000 Subject: [llvm-commits] [llvm] r44979 - /llvm/trunk/Makefile Message-ID: <200712130217.lBD2HH06031803@zion.cs.uiuc.edu> Author: sampo Date: Wed Dec 12 20:17:17 2007 New Revision: 44979 URL: http://llvm.org/viewvc/llvm-project?rev=44979&view=rev Log: Add install-libs target which only installs libraries, not tools Modified: llvm/trunk/Makefile Modified: llvm/trunk/Makefile URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/Makefile?rev=44979&r1=44978&r2=44979&view=diff ============================================================================== --- llvm/trunk/Makefile (original) +++ llvm/trunk/Makefile Wed Dec 12 20:17:17 2007 @@ -37,6 +37,11 @@ OPTIONAL_DIRS := endif +ifeq ($(MAKECMDGOALS),install-libs) + DIRS := $(filter-out tools runtime docs, $(DIRS)) + OPTIONAL_DIRS := $(filter bindings, $(OPTIONAL_DIRS)) +endif + ifeq ($(MAKECMDGOALS),tools-only) DIRS := $(filter-out runtime docs, $(DIRS)) OPTIONAL_DIRS := @@ -81,6 +86,7 @@ tools-only: all libs-only: all +install-libs: install #------------------------------------------------------------------------ # Make sure the generated headers are up-to-date. This must be kept in From natebegeman at mac.com Wed Dec 12 20:24:45 2007 From: natebegeman at mac.com (Nate Begeman) Date: Thu, 13 Dec 2007 02:24:45 -0000 Subject: [llvm-commits] [llvm] r44980 - /llvm/trunk/autoconf/configure.ac Message-ID: <200712130224.lBD2Oj21032139@zion.cs.uiuc.edu> Author: sampo Date: Wed Dec 12 20:24:45 2007 New Revision: 44980 URL: http://llvm.org/viewvc/llvm-project?rev=44980&view=rev Log: Apply CBE/MSIL patch to autoconf Modified: llvm/trunk/autoconf/configure.ac Modified: llvm/trunk/autoconf/configure.ac URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=44980&r1=44979&r2=44980&view=diff ============================================================================== --- llvm/trunk/autoconf/configure.ac (original) +++ llvm/trunk/autoconf/configure.ac Wed Dec 12 20:24:45 2007 @@ -363,7 +363,7 @@ [Build specific host targets: all,host-only,{target-name} (default=all)]),, enableval=all) case "$enableval" in - all) TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha IA64 ARM Mips CellSPU" ;; + all) TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha IA64 ARM Mips CellSPU CBackend MSIL" ;; host-only) case "$llvm_cv_target_arch" in x86) TARGETS_TO_BUILD="X86" ;; @@ -389,12 +389,13 @@ arm) TARGETS_TO_BUILD="ARM $TARGETS_TO_BUILD" ;; mips) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;; spu) TARGETS_TO_BUILD="CellSPU $TARGETS_TO_BUILD" ;; + cbe) TARGETS_TO_BUILD="CBackend $TARGETS_TO_BUILD" ;; + msil) TARGETS_TO_BUILD="MSIL $TARGETS_TO_BUILD" ;; *) AC_MSG_ERROR([Unrecognized target $a_target]) ;; esac done ;; esac -TARGETS_TO_BUILD="CBackend MSIL $TARGETS_TO_BUILD" AC_SUBST(TARGETS_TO_BUILD,$TARGETS_TO_BUILD) dnl Prevent the CBackend from using printf("%a") for floating point so older From evan.cheng at apple.com Wed Dec 12 21:32:53 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 13 Dec 2007 03:32:53 -0000 Subject: [llvm-commits] [llvm] r44981 - in /llvm/trunk: lib/Transforms/Scalar/CodeGenPrepare.cpp test/CodeGen/X86/opt-ext-uses.ll Message-ID: <200712130332.lBD3WsCk006152@zion.cs.uiuc.edu> Author: evancheng Date: Wed Dec 12 21:32:53 2007 New Revision: 44981 URL: http://llvm.org/viewvc/llvm-project?rev=44981&view=rev Log: Be extra careful with extension use optimation. Now turned on by default. Modified: llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp llvm/trunk/test/CodeGen/X86/opt-ext-uses.ll Modified: llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp?rev=44981&r1=44980&r2=44981&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp Wed Dec 12 21:32:53 2007 @@ -36,7 +36,7 @@ namespace { cl::opt OptExtUses("optimize-ext-uses", - cl::init(false), cl::Hidden); + cl::init(true), cl::Hidden); } namespace { @@ -929,6 +929,10 @@ if (Src->hasOneUse()) return false; + // Only do this xform is truncating is free. + if (!TLI->isTruncateFree(I->getType(), Src->getType())) + return false; + // Only safe to perform the optimization if the source is also defined in // this block. if (!isa(Src) || DefBB != cast(Src)->getParent()) @@ -952,8 +956,11 @@ for (Value::use_iterator UI = Src->use_begin(), E = Src->use_end(); UI != E; ++UI) { Instruction *User = cast(*UI); - if (User->getParent() == DefBB) continue; - if (isa(User)) + BasicBlock *UserBB = User->getParent(); + if (UserBB == DefBB) continue; + // Be conservative. We don't want this xform to end up introducing + // reloads just before load / store instructions. + if (isa(User) || isa(User) || isa(User)) return false; } Modified: llvm/trunk/test/CodeGen/X86/opt-ext-uses.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/opt-ext-uses.ll?rev=44981&r1=44980&r2=44981&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/opt-ext-uses.ll (original) +++ llvm/trunk/test/CodeGen/X86/opt-ext-uses.ll Wed Dec 12 21:32:53 2007 @@ -1,4 +1,4 @@ -; RUN: llvm-as < %s | llc -march=x86 -optimize-ext-uses=true | grep movw | count 1 +; RUN: llvm-as < %s | llc -march=x86 | grep movw | count 1 define i16 @t() signext { entry: From clattner at apple.com Wed Dec 12 22:09:53 2007 From: clattner at apple.com (Chris Lattner) Date: Wed, 12 Dec 2007 20:09:53 -0800 Subject: [llvm-commits] [llvm] r44960 - in /llvm/trunk: include/llvm/Target/ lib/CodeGen/ lib/Target/ lib/Target/ARM/ lib/Target/Alpha/ lib/Target/IA64/ lib/Target/Mips/ lib/Target/PowerPC/ lib/Target/Sparc/ lib/Target/X86/ test/CodeGen/X86/ In-Reply-To: <0B1FCBF6-DE6A-430E-A367-28F6D27738AF@apple.com> References: <200712122312.lBCNCAJs016823@zion.cs.uiuc.edu> <9B29D610-D3CF-4536-A2FA-9F18295A4A54@apple.com> <6C30E4DF-38C0-4190-A6CF-543C707D912D@apple.com> <0B1FCBF6-DE6A-430E-A367-28F6D27738AF@apple.com> Message-ID: >>> X86::isReallyTriviallyReMaterializable() is: >>> ... >>> case X86::MMX_MOVD64rm: >>> case X86::MMX_MOVQ64rm: >>> // Loads from constant pools are trivially rematerializable. >>> return MI->getOperand(1).isRegister() && MI->getOperand >>> (2).isImmediate() && >>> MI->getOperand(3).isRegister() && MI->getOperand >>> (4).isConstantPoolIndex() && >>> MI->getOperand(1).getReg() == 0 && >>> MI->getOperand(2).getImmedValue() == 1 && >>> MI->getOperand(3).getReg() == 0; >>> } >>> >>> The targets is only describing properties of the instruction because >>> we are not able to describe addressing mode in a generic way. Seems >>> like we are not too far off from your "pipe dream". :-) >> >> aha! How about we have some new property "can be moved with >> impunity" which laods from the constant pool would return true for? >> This property could then be used by licm and is better than calling >> it "rematerializable", which depends on the implementation of remat. > > The problem is the property requires understanding of the MI > addressing mode. There is no way to specify a static property to > describe that. Unless we want to use different opcodes for > constantpool load, for example. Sure, I'm not arguing for a static flag on the TII instead of a virtual method. I'm really saying that you should rename TII::isReallyTriviallyReMaterializable (which is virtual) to TII::isLoadConstant (which remains virtual) if that is what it really is. >> I'd like to nuke M_REMATERIALIZIBLE and >> isReallyTriviallyReMaterializable, replacing them with the properties >> that are actually needed. > > I have no problem with nuking M_REMATERIALIZIBLE. We just have to > replace it with something like M_HAS_SIDE_EFFECT. However, I am not > sure how to eliminate isReallyTriviallyReMaterializable for reason > described above. Ok. Really I'm talking about naming it better and changing the targets from providing "what remat wants" to providing abstract properties of their ISA. If this ends up being a method rename, so be it :) -Chris From nicholas at mxc.ca Wed Dec 12 22:26:46 2007 From: nicholas at mxc.ca (Nick Lewycky) Date: Wed, 12 Dec 2007 20:26:46 -0800 Subject: [llvm-commits] [llvm] r44981 - in /llvm/trunk: lib/Transforms/Scalar/CodeGenPrepare.cpp test/CodeGen/X86/opt-ext-uses.ll In-Reply-To: <200712130332.lBD3WsCk006152@zion.cs.uiuc.edu> References: <200712130332.lBD3WsCk006152@zion.cs.uiuc.edu> Message-ID: <4760B486.3080407@mxc.ca> Evan Cheng wrote: > @@ -929,6 +929,10 @@ > if (Src->hasOneUse()) > return false; > > + // Only do this xform is truncating is free. Should read ...xform if* truncating... > + if (!TLI->isTruncateFree(I->getType(), Src->getType())) > + return false; > + > // Only safe to perform the optimization if the source is also defined in > // this block. > if (!isa(Src) || DefBB != cast(Src)->getParent()) From clattner at apple.com Wed Dec 12 22:40:56 2007 From: clattner at apple.com (Chris Lattner) Date: Wed, 12 Dec 2007 20:40:56 -0800 Subject: [llvm-commits] [llvm] r44981 - in /llvm/trunk: lib/Transforms/Scalar/CodeGenPrepare.cpp test/CodeGen/X86/opt-ext-uses.ll In-Reply-To: <200712130332.lBD3WsCk006152@zion.cs.uiuc.edu> References: <200712130332.lBD3WsCk006152@zion.cs.uiuc.edu> Message-ID: On Dec 12, 2007, at 7:32 PM, Evan Cheng wrote: > Author: evancheng > Date: Wed Dec 12 21:32:53 2007 > New Revision: 44981 > > URL: http://llvm.org/viewvc/llvm-project?rev=44981&view=rev > Log: > Be extra careful with extension use optimation. Now turned on by > default. FYI, on your testcase with -print-isel-input, it looks like multiple instructions are sunk: cond_true188: ; preds = %entry trunc i32 %tmp180181 to i16 ; :0 [#uses=1] trunc i32 %tmp180181 to i16 ; :1 [#uses=1] %tmp195196 = trunc i16 %0 to i8 ; [#uses=0] ret i16 %1 Is this desired? -Chris > > > Modified: > llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp > llvm/trunk/test/CodeGen/X86/opt-ext-uses.ll > > Modified: llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp?rev=44981&r1=44980&r2=44981&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp (original) > +++ llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp Wed Dec 12 > 21:32:53 2007 > @@ -36,7 +36,7 @@ > > namespace { > cl::opt OptExtUses("optimize-ext-uses", > - cl::init(false), cl::Hidden); > + cl::init(true), cl::Hidden); > } > > namespace { > @@ -929,6 +929,10 @@ > if (Src->hasOneUse()) > return false; > > + // Only do this xform is truncating is free. > + if (!TLI->isTruncateFree(I->getType(), Src->getType())) > + return false; > + > // Only safe to perform the optimization if the source is also > defined in > // this block. > if (!isa(Src) || DefBB != cast(Src)- > >getParent()) > @@ -952,8 +956,11 @@ > for (Value::use_iterator UI = Src->use_begin(), E = Src->use_end(); > UI != E; ++UI) { > Instruction *User = cast(*UI); > - if (User->getParent() == DefBB) continue; > - if (isa(User)) > + BasicBlock *UserBB = User->getParent(); > + if (UserBB == DefBB) continue; > + // Be conservative. We don't want this xform to end up > introducing > + // reloads just before load / store instructions. > + if (isa(User) || isa(User) || > isa(User)) > return false; > } > > > Modified: llvm/trunk/test/CodeGen/X86/opt-ext-uses.ll > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/opt-ext-uses.ll?rev=44981&r1=44980&r2=44981&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/test/CodeGen/X86/opt-ext-uses.ll (original) > +++ llvm/trunk/test/CodeGen/X86/opt-ext-uses.ll Wed Dec 12 21:32:53 > 2007 > @@ -1,4 +1,4 @@ > -; RUN: llvm-as < %s | llc -march=x86 -optimize-ext-uses=true | grep > movw | count 1 > +; RUN: llvm-as < %s | llc -march=x86 | grep movw | count 1 > > define i16 @t() signext { > entry: > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From resistor at mac.com Wed Dec 12 23:43:37 2007 From: resistor at mac.com (Owen Anderson) Date: Thu, 13 Dec 2007 05:43:37 -0000 Subject: [llvm-commits] [llvm] r44986 - /llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Message-ID: <200712130543.lBD5hbG4016257@zion.cs.uiuc.edu> Author: resistor Date: Wed Dec 12 23:43:37 2007 New Revision: 44986 URL: http://llvm.org/viewvc/llvm-project?rev=44986&view=rev Log: Remove ugly and horrible code. It's not necessary for correctness, and can be added back later if it causes code quality issues. Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=44986&r1=44985&r2=44986&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original) +++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Wed Dec 12 23:43:37 2007 @@ -330,43 +330,6 @@ LiveVariables::VarInfo& CInfo = LV.getVarInfo(child->getReg()); if (isLiveOut(Info, CInfo.DefInst->getParent())) { - interferences.insert(child); - } else if (isLiveIn(Info, CInfo.DefInst->getParent()) || - Info.DefInst->getParent() == CInfo.DefInst->getParent()) { - // FIXME: Add (p, c) to possible local interferences - } - - if (!visited.count(child)) { - worklist.push_back(child); - inserted = true; - } - } - - if (interferences.size() == 1) { - DomForestNode* child = *interferences.begin(); - - unsigned numParentCopies = 0; - unsigned numChildCopies = 0; - for (int i = Inst->getNumOperands() - 1; i >= 2; i-=2) { - unsigned SrcReg = Inst->getOperand(i-1).getReg(); - if (SrcReg == DFNode->getReg()) numParentCopies++; - else if (SrcReg == child->getReg()) numChildCopies++; - } - - if (numParentCopies < numChildCopies) { - // Insert copies for child - for (int i = Inst->getNumOperands() - 1; i >= 2; i-=2) { - if (Inst->getOperand(i-1).getReg() == child->getReg()) { - unsigned SrcReg = child->getReg(); - MachineBasicBlock* From = Inst->getOperand(i).getMBB(); - - Waiting[From].push_back(std::make_pair(SrcReg, DestReg)); - PHIUnion.erase(SrcReg); - } - } - - // FIXME: Make child's children parent's children - } else { // Insert copies for parent for (int i = Inst->getNumOperands() - 1; i >= 2; i-=2) { if (Inst->getOperand(i-1).getReg() == DFNode->getReg()) { @@ -377,17 +340,14 @@ PHIUnion.erase(SrcReg); } } + } else if (isLiveIn(Info, CInfo.DefInst->getParent()) || + Info.DefInst->getParent() == CInfo.DefInst->getParent()) { + // FIXME: Add (p, c) to possible local interferences } - } else if (interferences.size() > 1) { - // Insert copies for parent - for (int i = Inst->getNumOperands() - 1; i >= 2; i-=2) { - if (Inst->getOperand(i-1).getReg() == DFNode->getReg()) { - unsigned SrcReg = DFNode->getReg(); - MachineBasicBlock* From = Inst->getOperand(i).getMBB(); - - Waiting[From].push_back(std::make_pair(SrcReg, DestReg)); - PHIUnion.erase(SrcReg); - } + + if (!visited.count(child)) { + worklist.push_back(child); + inserted = true; } } From resistor at mac.com Wed Dec 12 23:53:03 2007 From: resistor at mac.com (Owen Anderson) Date: Thu, 13 Dec 2007 05:53:03 -0000 Subject: [llvm-commits] [llvm] r44987 - /llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Message-ID: <200712130553.lBD5r3vN016890@zion.cs.uiuc.edu> Author: resistor Date: Wed Dec 12 23:53:03 2007 New Revision: 44987 URL: http://llvm.org/viewvc/llvm-project?rev=44987&view=rev Log: Add register pairs to the list to check for local interferences. Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=44987&r1=44986&r2=44987&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original) +++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Wed Dec 12 23:53:03 2007 @@ -99,7 +99,8 @@ std::vector computeDomForest(std::set& instrs); void processPHIUnion(MachineInstr* Inst, std::set& PHIUnion, - std::vector& DF); + std::vector& DF, + std::vector >& locals); void breakCriticalEdges(MachineFunction &Fn); }; @@ -300,6 +301,10 @@ computeDomForest(PHIUnion); // Walk DomForest to resolve interferences + std::vector > localInterferences; + processPHIUnion(P, PHIUnion, DF, localInterferences); + + // FIXME: Check for local interferences ProcessedNames.insert(PHIUnion.begin(), PHIUnion.end()); ++P; @@ -308,7 +313,8 @@ void StrongPHIElimination::processPHIUnion(MachineInstr* Inst, std::set& PHIUnion, - std::vector& DF) { + std::vector& DF, + std::vector >& locals) { std::vector worklist(DF.begin(), DF.end()); SmallPtrSet visited; @@ -323,7 +329,6 @@ visited.insert(DFNode); bool inserted = false; - SmallPtrSet interferences; for (DomForestNode::iterator CI = DFNode->begin(), CE = DFNode->end(); CI != CE; ++CI) { DomForestNode* child = *CI; @@ -342,7 +347,8 @@ } } else if (isLiveIn(Info, CInfo.DefInst->getParent()) || Info.DefInst->getParent() == CInfo.DefInst->getParent()) { - // FIXME: Add (p, c) to possible local interferences + // Add (p, c) to possible local interferences + locals.push_back(std::make_pair(DFNode->getReg(), child->getReg())); } if (!visited.count(child)) { From evan.cheng at apple.com Thu Dec 13 01:48:19 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 12 Dec 2007 23:48:19 -0800 Subject: [llvm-commits] [llvm] r44981 - in /llvm/trunk: lib/Transforms/Scalar/CodeGenPrepare.cpp test/CodeGen/X86/opt-ext-uses.ll In-Reply-To: References: <200712130332.lBD3WsCk006152@zion.cs.uiuc.edu> Message-ID: On Dec 12, 2007, at 8:40 PM, Chris Lattner wrote: > On Dec 12, 2007, at 7:32 PM, Evan Cheng wrote: > >> Author: evancheng >> Date: Wed Dec 12 21:32:53 2007 >> New Revision: 44981 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=44981&view=rev >> Log: >> Be extra careful with extension use optimation. Now turned on by >> default. > > FYI, on your testcase with -print-isel-input, it looks like multiple > instructions are sunk: > > > cond_true188: ; preds = %entry > trunc i32 %tmp180181 to i16 ; :0 [#uses=1] > trunc i32 %tmp180181 to i16 ; :1 [#uses=1] > %tmp195196 = trunc i16 %0 to i8 ; [#uses=0] > ret i16 %1 > > Is this desired? No it's not. I'll look. Evan > > -Chris > >> >> >> Modified: >> llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp >> llvm/trunk/test/CodeGen/X86/opt-ext-uses.ll >> >> Modified: llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/ >> Scalar/CodeGenPrepare.cpp?rev=44981&r1=44980&r2=44981&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> = >> --- llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp (original) >> +++ llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp Wed Dec 12 >> 21:32:53 2007 >> @@ -36,7 +36,7 @@ >> >> namespace { >> cl::opt OptExtUses("optimize-ext-uses", >> - cl::init(false), cl::Hidden); >> + cl::init(true), cl::Hidden); >> } >> >> namespace { >> @@ -929,6 +929,10 @@ >> if (Src->hasOneUse()) >> return false; >> >> + // Only do this xform is truncating is free. >> + if (!TLI->isTruncateFree(I->getType(), Src->getType())) >> + return false; >> + >> // Only safe to perform the optimization if the source is also >> defined in >> // this block. >> if (!isa(Src) || DefBB != cast(Src)- >>> getParent()) >> @@ -952,8 +956,11 @@ >> for (Value::use_iterator UI = Src->use_begin(), E = Src->use_end(); >> UI != E; ++UI) { >> Instruction *User = cast(*UI); >> - if (User->getParent() == DefBB) continue; >> - if (isa(User)) >> + BasicBlock *UserBB = User->getParent(); >> + if (UserBB == DefBB) continue; >> + // Be conservative. We don't want this xform to end up >> introducing >> + // reloads just before load / store instructions. >> + if (isa(User) || isa(User) || >> isa(User)) >> return false; >> } >> >> >> Modified: llvm/trunk/test/CodeGen/X86/opt-ext-uses.ll >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ >> X86/opt-ext-uses.ll?rev=44981&r1=44980&r2=44981&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> = >> --- llvm/trunk/test/CodeGen/X86/opt-ext-uses.ll (original) >> +++ llvm/trunk/test/CodeGen/X86/opt-ext-uses.ll Wed Dec 12 21:32:53 >> 2007 >> @@ -1,4 +1,4 @@ >> -; RUN: llvm-as < %s | llc -march=x86 -optimize-ext-uses=true | grep >> movw | count 1 >> +; RUN: llvm-as < %s | llc -march=x86 | grep movw | count 1 >> >> define i16 @t() signext { >> entry: >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From evan.cheng at apple.com Thu Dec 13 01:50:36 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 13 Dec 2007 07:50:36 -0000 Subject: [llvm-commits] [llvm] r44997 - /llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp Message-ID: <200712130750.lBD7obh5028486@zion.cs.uiuc.edu> Author: evancheng Date: Thu Dec 13 01:50:36 2007 New Revision: 44997 URL: http://llvm.org/viewvc/llvm-project?rev=44997&view=rev Log: Fix typo. Modified: llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp Modified: llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp?rev=44997&r1=44996&r2=44997&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp Thu Dec 13 01:50:36 2007 @@ -929,7 +929,7 @@ if (Src->hasOneUse()) return false; - // Only do this xform is truncating is free. + // Only do this xform if truncating is free. if (!TLI->isTruncateFree(I->getType(), Src->getType())) return false; From evan.cheng at apple.com Thu Dec 13 01:50:42 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 12 Dec 2007 23:50:42 -0800 Subject: [llvm-commits] [llvm] r44981 - in /llvm/trunk: lib/Transforms/Scalar/CodeGenPrepare.cpp test/CodeGen/X86/opt-ext-uses.ll In-Reply-To: <4760B486.3080407@mxc.ca> References: <200712130332.lBD3WsCk006152@zion.cs.uiuc.edu> <4760B486.3080407@mxc.ca> Message-ID: <951DDB43-A048-4185-B5E1-3F8B9E677718@apple.com> Fixed. Thx. Evan On Dec 12, 2007, at 8:26 PM, Nick Lewycky wrote: > Evan Cheng wrote: >> @@ -929,6 +929,10 @@ >> if (Src->hasOneUse()) >> return false; >> >> + // Only do this xform is truncating is free. > > Should read ...xform if* truncating... > >> + if (!TLI->isTruncateFree(I->getType(), Src->getType())) >> + return false; >> + >> // Only safe to perform the optimization if the source is also >> defined in >> // this block. >> if (!isa(Src) || DefBB != cast(Src)- >> >getParent()) > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From wmatyjewicz at fastmail.fm Thu Dec 13 10:22:58 2007 From: wmatyjewicz at fastmail.fm (Wojciech Matyjewicz) Date: Thu, 13 Dec 2007 16:22:58 -0000 Subject: [llvm-commits] [llvm] r44999 - /llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Message-ID: <200712131622.lBDGMwQU007893@zion.cs.uiuc.edu> Author: wmat Date: Thu Dec 13 10:22:58 2007 New Revision: 44999 URL: http://llvm.org/viewvc/llvm-project?rev=44999&view=rev Log: Make these loops follow GetGEPOperands() behavior. Let: %q = GEP %p, X, ... If %p is a GEP, we can chase baseptr further, only if X==0. Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=44999&r1=44998&r2=44999&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original) +++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Thu Dec 13 10:22:58 2007 @@ -391,17 +391,19 @@ if (isGEP(V1) && isGEP(V2)) { // Drill down into the first non-gep value, to test for must-aliasing of // the base pointers. - const Value *BasePtr1 = V1, *BasePtr2 = V2; - do { - BasePtr1 = cast(BasePtr1)->getOperand(0); - } while (isGEP(BasePtr1) && - cast(BasePtr1)->getOperand(1) == - Constant::getNullValue(cast(BasePtr1)->getOperand(1)->getType())); - do { - BasePtr2 = cast(BasePtr2)->getOperand(0); - } while (isGEP(BasePtr2) && - cast(BasePtr2)->getOperand(1) == - Constant::getNullValue(cast(BasePtr2)->getOperand(1)->getType())); + const User *G = cast(V1); + while (isGEP(G->getOperand(0)) && + G->getOperand(1) == + Constant::getNullValue(G->getOperand(1)->getType())) + G = cast(G->getOperand(0)); + const Value *BasePtr1 = G->getOperand(0); + + G = cast(V2); + while (isGEP(G->getOperand(0)) && + G->getOperand(1) == + Constant::getNullValue(G->getOperand(1)->getType())) + G = cast(G->getOperand(0)); + const Value *BasePtr2 = G->getOperand(0); // Do the base pointers alias? AliasResult BaseAlias = alias(BasePtr1, ~0U, BasePtr2, ~0U); From wmatyjewicz at fastmail.fm Thu Dec 13 12:28:45 2007 From: wmatyjewicz at fastmail.fm (Wojciech Matyjewicz) Date: Thu, 13 Dec 2007 19:28:45 +0100 Subject: [llvm-commits] RFC: patch for PR1782 (BasicAliasAnalyis) In-Reply-To: References: <475B1C30.5020800@fastmail.fm> <475B3DCF.2030706@fastmail.fm> <475B4A51.1070000@fastmail.fm> <475C72D9.9000505@fastmail.fm> Message-ID: <476179DD.2040707@fastmail.fm> Chris Lattner wrote: >> Suppose, we have a target with 32-bit pointers and the following >> instructions: >> >> %p = getelementptr i32* %x, i32 -1 >> %q = getelementptr i32* %x, i32 1073741823 ;(1073741823 == 2^30 - 1) >> >> TargetData::getIndexedOffset() uses 64-bit arithmetic to perform >> offset >> computation and return 64-bit values. Hence, it will return -4 as an >> offset for %p, and 2^32 - 4 for %q. Based on these offsets, it may >> seem >> that %p and %q point to different memory objects. However, they don't, >> taking into account that pointers are 32-bit long. > > Ok. > >> I guess, such a large positive index in GEP as seen above can be >> introduced by -instcombine pass. > > Ok. This is somewhat dubious though, as it is wrapping around the end > of the address space which is undefined in C. I've found one place in instcombine, where something like this can be introduced. Fixed with this patch: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071210/056253.html >> I think, the simplest way to fix it is to truncate the computed offset >> to the target pointer size before returning it in >> TargetData::getIndexedOffset(). If you think this is the correct >> approach, I may prepare a patch. > > Ah, that does make a lot of sense. Since the fix is simple, please go > for it! I've rethought the issue. If you say that, wrapping around the memory by getelementptr is undefined, I think it's better to leave it as it is. This way we'll be able to catch other optimizer bugs, if there are any of the above kind. -Wojtek From dalej at apple.com Thu Dec 13 12:32:11 2007 From: dalej at apple.com (Dale Johannesen) Date: Thu, 13 Dec 2007 18:32:11 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r45009 - in /llvm-gcc-4.0/trunk/gcc: config/darwin.h except.c llvm-convert.cpp unwind-dw2.c Message-ID: <200712131832.lBDIWBdf016129@zion.cs.uiuc.edu> Author: johannes Date: Thu Dec 13 12:32:10 2007 New Revision: 45009 URL: http://llvm.org/viewvc/llvm-project?rev=45009&view=rev Log: Make exceptions work on Darwin Modified: llvm-gcc-4.0/trunk/gcc/config/darwin.h llvm-gcc-4.0/trunk/gcc/except.c llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp llvm-gcc-4.0/trunk/gcc/unwind-dw2.c Modified: llvm-gcc-4.0/trunk/gcc/config/darwin.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/config/darwin.h?rev=45009&r1=45008&r2=45009&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/config/darwin.h (original) +++ llvm-gcc-4.0/trunk/gcc/config/darwin.h Thu Dec 13 12:32:10 2007 @@ -1748,6 +1748,10 @@ else if (!MACHO_DYNAMIC_NO_PIC_P) \ argvec.push_back ("--relocation-model=static") #endif /* defined (TARGET_386) */ + +/* On Darwin _Unwind_Resume is sensitive to the dynamic stack layout; we + use _Unwind_Resume_or_Rethrow instead. */ +#define LLVM_STACKSENSITIVE_UNWIND_RESUME 1 #endif /* APPLE LOCAL end LLVM */ Modified: llvm-gcc-4.0/trunk/gcc/except.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/except.c?rev=45009&r1=45008&r2=45009&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/except.c (original) +++ llvm-gcc-4.0/trunk/gcc/except.c Thu Dec 13 12:32:10 2007 @@ -3510,9 +3510,13 @@ default_init_unwind_resume_libfunc (void) { /* The default c++ routines aren't actually c++ specific, so use those. */ - unwind_resume_libfunc = - init_one_libfunc ( USING_SJLJ_EXCEPTIONS ? "_Unwind_SjLj_Resume" - : "_Unwind_Resume"); + unwind_resume_libfunc = init_one_libfunc ( USING_SJLJ_EXCEPTIONS ? + "_Unwind_SjLj_Resume" +#ifdef LLVM_STACKSENSITIVE_UNWIND_RESUME + : "_Unwind_Resume_or_Rethrow"); +#else + : "_Unwind_Resume"); +#endif } /* APPLE LOCAL end LLVM */ Modified: llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp?rev=45009&r1=45008&r2=45009&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Thu Dec 13 12:32:10 2007 @@ -2178,7 +2178,12 @@ NULL); FuncUnwindResume = - TheModule->getOrInsertFunction("_Unwind_Resume", + TheModule->getOrInsertFunction( +#ifdef LLVM_STACKSENSITIVE_UNWIND_RESUME + "_Unwind_Resume_or_Rethrow", +#else + "_Unwind_Resume", +#endif Type::getPrimitiveType(Type::VoidTyID), PointerType::get(Type::Int8Ty), NULL); Modified: llvm-gcc-4.0/trunk/gcc/unwind-dw2.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/unwind-dw2.c?rev=45009&r1=45008&r2=45009&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/unwind-dw2.c (original) +++ llvm-gcc-4.0/trunk/gcc/unwind-dw2.c Thu Dec 13 12:32:10 2007 @@ -1318,7 +1318,14 @@ static inline _Unwind_Ptr uw_identify_context (struct _Unwind_Context *context) { +/* LLVM LOCAL begin + This change is needed to match Apple's installed libgcc. */ +#ifdef LLVM_STACKSENSITIVE_UNWIND_RESUME + return _Unwind_GetCFA (context); +#else return _Unwind_GetIP (context); +#endif +/* LLVM LOCAL end */ } From isanbard at gmail.com Thu Dec 13 12:53:57 2007 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 13 Dec 2007 18:53:57 -0000 Subject: [llvm-commits] [llvm] r45010 - /llvm/tags/Apple/llvmCore-2005/ Message-ID: <200712131853.lBDIrvpR017065@zion.cs.uiuc.edu> Author: void Date: Thu Dec 13 12:53:57 2007 New Revision: 45010 URL: http://llvm.org/viewvc/llvm-project?rev=45010&view=rev Log: Creating llvmCore-2005 tag. Added: llvm/tags/Apple/llvmCore-2005/ - copied from r45009, llvm/trunk/ From djg at cray.com Thu Dec 13 12:58:09 2007 From: djg at cray.com (Dan Gohman) Date: Thu, 13 Dec 2007 12:58:09 -0600 Subject: [llvm-commits] [llvm] r44954 - in /llvm/trunk: lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/vec_ctbits.ll Message-ID: <20071213185808.GR26680@gold.us.cray.com> >> --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) >> +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Dec 12 >> 16:21:26 2007 >> @@ -483,6 +483,12 @@ >> setOperationAction(ISD::CTPOP, (MVT::ValueType)VT, Expand); >> setOperationAction(ISD::CTTZ, (MVT::ValueType)VT, Expand); >> setOperationAction(ISD::CTLZ, (MVT::ValueType)VT, Expand); >> + setOperationAction(ISD::SHL, (MVT::ValueType)VT, Expand); >> + setOperationAction(ISD::SRA, (MVT::ValueType)VT, Expand); >> + setOperationAction(ISD::SRL, (MVT::ValueType)VT, Expand); >> + setOperationAction(ISD::ROTL, (MVT::ValueType)VT, Expand); >> + setOperationAction(ISD::ROTR, (MVT::ValueType)VT, Expand); >> + setOperationAction(ISD::BSWAP, (MVT::ValueType)VT, Expand); >> } > > Hi Dan, > > How do you create these nodes with vector types (in C)? I don't think > the legalizer is capable of expanding these ops with vector types? SelectionDAGLegalize::ExpandBitCount uses ISD::SRL when lowering ISD::CTPOP, so a vector CTPOP gets a vector SRL, for example. I noticed a bug with the way this works though; I'll fix that shortly. Also, in C, one could vectorize a[i] << b[i], though LLVM doesn't currently support that. The legalizer expands these by running SplitVectorOp and ScalarizeVectorOp as necessary, just as with other operations. Dan -- Dan Gohman, Cray Inc. From evan.cheng at apple.com Thu Dec 13 12:58:22 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 13 Dec 2007 18:58:22 -0000 Subject: [llvm-commits] [test-suite] r45011 - /test-suite/trunk/Makefile.programs Message-ID: <200712131858.lBDIwM4d017422@zion.cs.uiuc.edu> Author: evancheng Date: Thu Dec 13 12:58:22 2007 New Revision: 45011 URL: http://llvm.org/viewvc/llvm-project?rev=45011&view=rev Log: Change x86 llcbeta back to -new-coalescer-heuristic=true Modified: test-suite/trunk/Makefile.programs Modified: test-suite/trunk/Makefile.programs URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/Makefile.programs?rev=45011&r1=45010&r2=45011&view=diff ============================================================================== --- test-suite/trunk/Makefile.programs (original) +++ test-suite/trunk/Makefile.programs Thu Dec 13 12:58:22 2007 @@ -222,8 +222,7 @@ LLCBETAOPTION := -sched=simple endif ifeq ($(ARCH),x86) -LLCBETAOPTION := -optimize-ext-uses -#-new-coalescer-heuristic=true +LLCBETAOPTION := -new-coalescer-heuristic=true #-tailcallopt #-regalloc=local -fast #-disable-rematerialization From isanbard at gmail.com Thu Dec 13 13:01:20 2007 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 13 Dec 2007 19:01:20 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r45012 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2003/ Message-ID: <200712131901.lBDJ1K9L017741@zion.cs.uiuc.edu> Author: void Date: Thu Dec 13 13:01:20 2007 New Revision: 45012 URL: http://llvm.org/viewvc/llvm-project?rev=45012&view=rev Log: Creating llvmgcc-2003 tag. Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2003/ - copied from r45011, llvm-gcc-4.2/trunk/ From djg at cray.com Thu Dec 13 14:43:47 2007 From: djg at cray.com (Dan Gohman) Date: Thu, 13 Dec 2007 20:43:47 -0000 Subject: [llvm-commits] [llvm] r45013 - /llvm/trunk/docs/CodeGenerator.html Message-ID: <200712132043.lBDKhlj6023741@zion.cs.uiuc.edu> Author: djg Date: Thu Dec 13 14:43:47 2007 New Revision: 45013 URL: http://llvm.org/viewvc/llvm-project?rev=45013&view=rev Log: Make it more clear that some things that can't be done in .td files can still be done in the LLVM code generator. And update the summary for the X86 target. Modified: llvm/trunk/docs/CodeGenerator.html Modified: llvm/trunk/docs/CodeGenerator.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/CodeGenerator.html?rev=45013&r1=45012&r2=45013&view=diff ============================================================================== --- llvm/trunk/docs/CodeGenerator.html (original) +++ llvm/trunk/docs/CodeGenerator.html Thu Dec 13 14:43:47 2007 @@ -754,7 +754,8 @@

      Portions of the DAG instruction selector are generated from the target description (*.td) files. Our goal is for the entire instruction -selector to be generated from these .td files.

      +selector to be generated from these .td files, though currently +there are still things that require custom C++ code.

      @@ -1112,7 +1113,8 @@
    • There is no great way to support matching complex addressing modes yet. In the future, we will extend pattern fragments to allow them to define multiple values (e.g. the four operands of the X86 - addressing mode). In addition, we'll extend fragments so that a + addressing mode, which are currently matched with custom C++ code). + In addition, we'll extend fragments so that a fragment can match multiple different patterns.
    • We don't automatically infer flags like isStore/isLoad yet.
    • We don't automatically generate the set of supported registers and @@ -1629,11 +1631,9 @@

      The X86 code generator lives in the lib/Target/X86 directory. This -code generator currently targets a generic P6-like processor. As such, it -produces a few P6-and-above instructions (like conditional moves), but it does -not make use of newer features like MMX or SSE. In the future, the X86 backend -will have sub-target support added for specific processor families and -implementations.

      +code generator is capable of targeting a variety of x86-32 and x86-64 +processors, and includes support for ISA extensions such as MMX and SSE. +

      From dalej at apple.com Thu Dec 13 17:56:10 2007 From: dalej at apple.com (Dale Johannesen) Date: Thu, 13 Dec 2007 23:56:10 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r45016 - /llvm-gcc-4.2/trunk/gcc/config/darwin.h Message-ID: <200712132356.lBDNuBws000633@zion.cs.uiuc.edu> Author: johannes Date: Thu Dec 13 17:56:08 2007 New Revision: 45016 URL: http://llvm.org/viewvc/llvm-project?rev=45016&view=rev Log: Do not invoke dsymutil at -O1 or higher, it whines about the lack of debug info which breaks many testcases. Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.h?rev=45016&r1=45015&r2=45016&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/darwin.h (original) +++ llvm-gcc-4.2/trunk/gcc/config/darwin.h Thu Dec 13 17:56:08 2007 @@ -315,7 +315,9 @@ %{!fdump=*:%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\ "/* APPLE LOCAL end mainline 4.3 2006-10-31 4370146 */"\ "/* APPLE LOCAL ARM 5342595 */"\ - %{.c|.cc|.C|.cpp|.cp|.c++|.cxx|.CPP|.m|.mm: %(darwin_dsymutil) }}}}}}}}" +"/* LLVM LOCAL do not use dsymutil with -O1 or higher */"\ + %{.c|.cc|.C|.cpp|.cp|.c++|.cxx|.CPP|.m|.mm: \ + %{!O1: %{!O2: %{!O3: %{!O4: %{!Os: %(darwin_dsymutil) }}}}}}}}}}}}}" /* APPLE LOCAL end mainline */ #ifdef TARGET_SYSTEM_ROOT From clattner at apple.com Thu Dec 13 18:24:43 2007 From: clattner at apple.com (Chris Lattner) Date: Thu, 13 Dec 2007 16:24:43 -0800 Subject: [llvm-commits] RFC: patch for PR1782 (BasicAliasAnalyis) In-Reply-To: <476179DD.2040707@fastmail.fm> References: <475B1C30.5020800@fastmail.fm> <475B3DCF.2030706@fastmail.fm> <475B4A51.1070000@fastmail.fm> <475C72D9.9000505@fastmail.fm> <476179DD.2040707@fastmail.fm> Message-ID: <2088204F-D4C4-4DBF-A24A-90E3FE2632E7@apple.com> >>> I guess, such a large positive index in GEP as seen above can be >>> introduced by -instcombine pass. >> >> Ok. This is somewhat dubious though, as it is wrapping around the >> end >> of the address space which is undefined in C. > > I've found one place in instcombine, where something like this can be > introduced. Fixed with this patch: > http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of- > Mon-20071210/056253.html I agree, that is definitely an instcombine bug, thanks! >>> I think, the simplest way to fix it is to truncate the computed >>> offset >>> to the target pointer size before returning it in >>> TargetData::getIndexedOffset(). If you think this is the correct >>> approach, I may prepare a patch. >> >> Ah, that does make a lot of sense. Since the fix is simple, >> please go >> for it! > > I've rethought the issue. If you say that, wrapping around the > memory by > getelementptr is undefined, I think it's better to leave it as it is. > This way we'll be able to catch other optimizer bugs, if there are any > of the above kind. Excellent, thanks! -Chris From dpatel at apple.com Thu Dec 13 18:54:37 2007 From: dpatel at apple.com (Devang Patel) Date: Fri, 14 Dec 2007 00:54:37 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r45017 - /llvm-gcc-4.2/trunk/gcc/Makefile.in Message-ID: <200712140054.lBE0sb8o003105@zion.cs.uiuc.edu> Author: dpatel Date: Thu Dec 13 18:54:36 2007 New Revision: 45017 URL: http://llvm.org/viewvc/llvm-project?rev=45017&view=rev Log: Set libllvmgcc.dylib compatibility version number. Modified: llvm-gcc-4.2/trunk/gcc/Makefile.in Modified: llvm-gcc-4.2/trunk/gcc/Makefile.in URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/Makefile.in?rev=45017&r1=45016&r2=45017&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/Makefile.in (original) +++ llvm-gcc-4.2/trunk/gcc/Makefile.in Thu Dec 13 18:54:36 2007 @@ -1209,7 +1209,7 @@ echo $(LLVMLIBFILES) $(CXX) $(DYLIB_COMPILE_FLAGS) $(INCLUDES) -o $@ \ $< $(LLVMLIBFILES) -L/usr/lib/gcc/$(build)/4.0.1/ -dynamiclib -single_module \ - -install_name @executable_path/$@ + -compatibility_version 1.0.0 -current_version 1.0.0 -install_name @executable_path/$@ LLVMBACKENDFILES := libllvmgcc$(LLVM_STAGE).dylib From isanbard at gmail.com Thu Dec 13 19:02:33 2007 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 14 Dec 2007 01:02:33 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r45018 - /llvm-gcc-4.2/tags/Apple/llvmgcc42-2004/ Message-ID: <200712140102.lBE12XTU003483@zion.cs.uiuc.edu> Author: void Date: Thu Dec 13 19:02:33 2007 New Revision: 45018 URL: http://llvm.org/viewvc/llvm-project?rev=45018&view=rev Log: Need to grab a patch that makes building happy. Added: llvm-gcc-4.2/tags/Apple/llvmgcc42-2004/ - copied from r45017, llvm-gcc-4.2/trunk/ From dalej at apple.com Thu Dec 13 19:06:35 2007 From: dalej at apple.com (Dale Johannesen) Date: Fri, 14 Dec 2007 01:06:35 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r45019 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200712140106.lBE16arv003704@zion.cs.uiuc.edu> Author: johannes Date: Thu Dec 13 19:06:35 2007 New Revision: 45019 URL: http://llvm.org/viewvc/llvm-project?rev=45019&view=rev Log: Fix broken IR gen for complex int != . Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=45019&r1=45018&r2=45019&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Thu Dec 13 19:06:35 2007 @@ -4753,8 +4753,8 @@ DSTr = Builder.CreateFCmpUNE(LHSr, RHSr, "tmpr"); DSTi = Builder.CreateFCmpUNE(LHSi, RHSi, "tmpi"); } else { - DSTr = Builder.CreateICmpEQ(LHSr, RHSr, "tmpr"); - DSTi = Builder.CreateICmpEQ(LHSi, RHSi, "tmpi"); + DSTr = Builder.CreateICmpNE(LHSr, RHSr, "tmpr"); + DSTi = Builder.CreateICmpNE(LHSi, RHSi, "tmpi"); } return Builder.CreateOr(DSTr, DSTi, "tmp"); } From dalej at apple.com Thu Dec 13 19:11:55 2007 From: dalej at apple.com (Dale Johannesen) Date: Fri, 14 Dec 2007 01:11:55 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r45021 - /llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Message-ID: <200712140111.lBE1Bu6F003988@zion.cs.uiuc.edu> Author: johannes Date: Thu Dec 13 19:11:55 2007 New Revision: 45021 URL: http://llvm.org/viewvc/llvm-project?rev=45021&view=rev Log: Fix broken IR gen for complex int != . Modified: llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp?rev=45021&r1=45020&r2=45021&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Thu Dec 13 19:11:55 2007 @@ -5211,8 +5211,8 @@ DSTr = Builder.CreateFCmpUNE(LHSr, RHSr, "tmpr"); DSTi = Builder.CreateFCmpUNE(LHSi, RHSi, "tmpi"); } else { - DSTr = Builder.CreateICmpEQ(LHSr, RHSr, "tmpr"); - DSTi = Builder.CreateICmpEQ(LHSi, RHSi, "tmpi"); + DSTr = Builder.CreateICmpNE(LHSr, RHSr, "tmpr"); + DSTi = Builder.CreateICmpNE(LHSi, RHSi, "tmpi"); } return Builder.CreateOr(DSTr, DSTi, "tmp"); } From isanbard at gmail.com Thu Dec 13 19:48:59 2007 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 14 Dec 2007 01:48:59 -0000 Subject: [llvm-commits] [llvm] r45022 - in /llvm/trunk: include/llvm/Target/TargetInstrInfo.h lib/Target/Target.td utils/TableGen/CodeGenInstruction.h utils/TableGen/CodeGenTarget.cpp utils/TableGen/InstrInfoEmitter.cpp Message-ID: <200712140148.lBE1mxh2005906@zion.cs.uiuc.edu> Author: void Date: Thu Dec 13 19:48:59 2007 New Revision: 45022 URL: http://llvm.org/viewvc/llvm-project?rev=45022&view=rev Log: Add flags to indicate that there are "never" side effects or that there "may be" side effects for machine instructions. Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h llvm/trunk/lib/Target/Target.td llvm/trunk/utils/TableGen/CodeGenInstruction.h llvm/trunk/utils/TableGen/CodeGenTarget.cpp llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp Modified: llvm/trunk/include/llvm/Target/TargetInstrInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetInstrInfo.h?rev=45022&r1=45021&r2=45022&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/TargetInstrInfo.h (original) +++ llvm/trunk/include/llvm/Target/TargetInstrInfo.h Thu Dec 13 19:48:59 2007 @@ -91,6 +91,18 @@ // ARM instructions which can set condition code if 's' bit is set. const unsigned M_HAS_OPTIONAL_DEF = 1 << 17; +// M_MAY_HAVE_SIDE_EFFECTS - Set if this instruction *might* have side effects, +// e.g. load instructions. Note: This and M_NEVER_HAS_SIDE_EFFECTS are mutually +// exclusive. You can't set both! If neither flag is set, then the instruction +// *always* has side effects. +const unsigned M_MAY_HAVE_SIDE_EFFECTS = 1 << 18; + +// M_NEVER_HAS_SIDE_EFFECTS - Set if this instruction *never* has side effects, +// e.g., xor on X86. Note: This and M_MAY_HAVE_SIDE_EFFECTS are mutually +// exclusive. You can't set both! If neither flag is set, then the instruction +// *always* has side effects. +const unsigned M_NEVER_HAS_SIDE_EFFECTS = 1 << 19; + // Machine operand flags // M_LOOK_UP_PTR_REG_CLASS - Set if this operand is a pointer value and it // requires a callback to look up its register class. Modified: llvm/trunk/lib/Target/Target.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Target.td?rev=45022&r1=45021&r2=45022&view=diff ============================================================================== --- llvm/trunk/lib/Target/Target.td (original) +++ llvm/trunk/lib/Target/Target.td Thu Dec 13 19:48:59 2007 @@ -203,6 +203,11 @@ bit usesCustomDAGSchedInserter = 0; // Pseudo instr needing special help. bit hasCtrlDep = 0; // Does this instruction r/w ctrl-flow chains? bit isNotDuplicable = 0; // Is it unsafe to duplicate this instruction? + + // Side effect flags - If neither of these flags is set, then the instruction + // *always* has side effects. Otherwise, it's one or the other. + bit mayHaveSideEffects = 0; // This instruction *may* have side effects. + bit neverHasSideEffects = 0; // This instruction never has side effects. InstrItinClass Itinerary = NoItinerary;// Execution steps used for scheduling. Modified: llvm/trunk/utils/TableGen/CodeGenInstruction.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenInstruction.h?rev=45022&r1=45021&r2=45022&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/CodeGenInstruction.h (original) +++ llvm/trunk/utils/TableGen/CodeGenInstruction.h Thu Dec 13 19:48:59 2007 @@ -104,6 +104,8 @@ bool hasCtrlDep; bool isNotDuplicable; bool hasOptionalDef; + bool mayHaveSideEffects; + bool neverHasSideEffects; /// ParseOperandName - Parse an operand name like "$foo" or "$foo.bar", /// where $foo is a whole operand and $foo.bar refers to a suboperand. Modified: llvm/trunk/utils/TableGen/CodeGenTarget.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenTarget.cpp?rev=45022&r1=45021&r2=45022&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/CodeGenTarget.cpp (original) +++ llvm/trunk/utils/TableGen/CodeGenTarget.cpp Thu Dec 13 19:48:59 2007 @@ -395,9 +395,15 @@ usesCustomDAGSchedInserter = R->getValueAsBit("usesCustomDAGSchedInserter"); hasCtrlDep = R->getValueAsBit("hasCtrlDep"); isNotDuplicable = R->getValueAsBit("isNotDuplicable"); + mayHaveSideEffects = R->getValueAsBit("mayHaveSideEffects"); + neverHasSideEffects = R->getValueAsBit("neverHasSideEffects"); hasOptionalDef = false; hasVariableNumberOfOperands = false; - + + if (mayHaveSideEffects && neverHasSideEffects) + throw R->getName() + + ": cannot have both 'mayHaveSideEffects' and 'neverHasSideEffects' set!"; + DagInit *DI; try { DI = R->getValueAsDag("OutOperandList"); Modified: llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp?rev=45022&r1=45021&r2=45022&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp Thu Dec 13 19:48:59 2007 @@ -253,8 +253,9 @@ if (Inst.hasOptionalDef) OS << "|M_HAS_OPTIONAL_DEF"; if (Inst.usesCustomDAGSchedInserter) OS << "|M_USES_CUSTOM_DAG_SCHED_INSERTION"; - if (Inst.hasVariableNumberOfOperands) - OS << "|M_VARIABLE_OPS"; + if (Inst.hasVariableNumberOfOperands) OS << "|M_VARIABLE_OPS"; + if (Inst.mayHaveSideEffects) OS << "|M_MAY_HAVE_SIDE_EFFECTS"; + if (Inst.neverHasSideEffects) OS << "|M_NEVER_HAS_SIDE_EFFECTS"; OS << ", 0"; // Emit all of the target-specific flags... From clattner at apple.com Thu Dec 13 19:52:13 2007 From: clattner at apple.com (Chris Lattner) Date: Thu, 13 Dec 2007 17:52:13 -0800 Subject: [llvm-commits] [llvm-gcc-4.2] r45017 - /llvm-gcc-4.2/trunk/gcc/Makefile.in In-Reply-To: <200712140054.lBE0sb8o003105@zion.cs.uiuc.edu> References: <200712140054.lBE0sb8o003105@zion.cs.uiuc.edu> Message-ID: <7858EE70-4984-4F64-9F9F-99630E7CA9D2@apple.com> On Dec 13, 2007, at 4:54 PM, Devang Patel wrote: > URL: http://llvm.org/viewvc/llvm-project?rev=45017&view=rev > Log: > Set libllvmgcc.dylib compatibility version number. > > Modified: > llvm-gcc-4.2/trunk/gcc/Makefile.in > > Modified: llvm-gcc-4.2/trunk/gcc/Makefile.in > URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/ > Makefile.in?rev=45017&r1=45016&r2=45017&view=diff > > ====================================================================== > ======== > --- llvm-gcc-4.2/trunk/gcc/Makefile.in (original) > +++ llvm-gcc-4.2/trunk/gcc/Makefile.in Thu Dec 13 18:54:36 2007 > @@ -1209,7 +1209,7 @@ > echo $(LLVMLIBFILES) > $(CXX) $(DYLIB_COMPILE_FLAGS) $(INCLUDES) -o $@ \ > $< $(LLVMLIBFILES) -L/usr/lib/gcc/$(build)/4.0.1/ - > dynamiclib -single_module \ > - -install_name @executable_path/$@ > + -compatibility_version 1.0.0 -current_version 1.0.0 - > install_name @executable_path/$@ is -L.../4.0.1 really right? -Chris From evan.cheng at apple.com Thu Dec 13 20:13:44 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 14 Dec 2007 02:13:44 -0000 Subject: [llvm-commits] [llvm] r45024 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86InstrInfo.td lib/Target/X86/X86InstrX86-64.td test/CodeGen/X86/clz.ll Message-ID: <200712140213.lBE2DiRu006833@zion.cs.uiuc.edu> Author: evancheng Date: Thu Dec 13 20:13:44 2007 New Revision: 45024 URL: http://llvm.org/viewvc/llvm-project?rev=45024&view=rev Log: Implement ctlz and cttz with bsr and bsf. Added: llvm/trunk/test/CodeGen/X86/clz.ll Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86ISelLowering.h llvm/trunk/lib/Target/X86/X86InstrInfo.td llvm/trunk/lib/Target/X86/X86InstrX86-64.td Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=45024&r1=45023&r2=45024&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Thu Dec 13 20:13:44 2007 @@ -210,18 +210,18 @@ setOperationAction(ISD::FLT_ROUNDS , MVT::i32 , Custom); setOperationAction(ISD::CTPOP , MVT::i8 , Expand); - setOperationAction(ISD::CTTZ , MVT::i8 , Expand); - setOperationAction(ISD::CTLZ , MVT::i8 , Expand); + setOperationAction(ISD::CTTZ , MVT::i8 , Custom); + setOperationAction(ISD::CTLZ , MVT::i8 , Custom); setOperationAction(ISD::CTPOP , MVT::i16 , Expand); - setOperationAction(ISD::CTTZ , MVT::i16 , Expand); - setOperationAction(ISD::CTLZ , MVT::i16 , Expand); + setOperationAction(ISD::CTTZ , MVT::i16 , Custom); + setOperationAction(ISD::CTLZ , MVT::i16 , Custom); setOperationAction(ISD::CTPOP , MVT::i32 , Expand); - setOperationAction(ISD::CTTZ , MVT::i32 , Expand); - setOperationAction(ISD::CTLZ , MVT::i32 , Expand); + setOperationAction(ISD::CTTZ , MVT::i32 , Custom); + setOperationAction(ISD::CTLZ , MVT::i32 , Custom); if (Subtarget->is64Bit()) { setOperationAction(ISD::CTPOP , MVT::i64 , Expand); - setOperationAction(ISD::CTTZ , MVT::i64 , Expand); - setOperationAction(ISD::CTLZ , MVT::i64 , Expand); + setOperationAction(ISD::CTTZ , MVT::i64 , Custom); + setOperationAction(ISD::CTLZ , MVT::i64 , Custom); } setOperationAction(ISD::READCYCLECOUNTER , MVT::i64 , Custom); @@ -5345,6 +5345,42 @@ ISD::TRUNCATE : ISD::ZERO_EXTEND), VT, RetVal); } +SDOperand X86TargetLowering::LowerCTLZ(SDOperand Op, SelectionDAG &DAG) { + MVT::ValueType VT = Op.getValueType(); + MVT::ValueType OpVT = VT; + unsigned NumBits = MVT::getSizeInBits(VT); + + Op = Op.getOperand(0); + if (VT == MVT::i8) { + OpVT = MVT::i32; + Op = DAG.getNode(ISD::ZERO_EXTEND, OpVT, Op); + } + if (VT == MVT::i32 || VT == MVT::i64) + return DAG.getNode(ISD::XOR, OpVT, DAG.getNode(X86ISD::BSR, OpVT, Op), + DAG.getConstant(NumBits-1, OpVT)); + + Op = DAG.getNode(ISD::SUB, OpVT, DAG.getConstant(NumBits-1, OpVT), + DAG.getNode(X86ISD::BSR, OpVT, Op)); + if (VT == MVT::i8) + Op = DAG.getNode(ISD::TRUNCATE, MVT::i8, Op); + return Op; +} + +SDOperand X86TargetLowering::LowerCTTZ(SDOperand Op, SelectionDAG &DAG) { + MVT::ValueType VT = Op.getValueType(); + MVT::ValueType OpVT = VT; + + Op = Op.getOperand(0); + if (VT == MVT::i8) { + OpVT = MVT::i32; + Op = DAG.getNode(ISD::ZERO_EXTEND, OpVT, Op); + } + Op = DAG.getNode(X86ISD::BSF, OpVT, Op); + if (VT == MVT::i8) + Op = DAG.getNode(ISD::TRUNCATE, MVT::i8, Op); + return Op; +} + /// LowerOperation - Provide custom lowering hooks for some operations. /// SDOperand X86TargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) { @@ -5387,7 +5423,8 @@ case ISD::EH_RETURN: return LowerEH_RETURN(Op, DAG); case ISD::TRAMPOLINE: return LowerTRAMPOLINE(Op, DAG); case ISD::FLT_ROUNDS: return LowerFLT_ROUNDS(Op, DAG); - + case ISD::CTLZ: return LowerCTLZ(Op, DAG); + case ISD::CTTZ: return LowerCTTZ(Op, DAG); // FIXME: REMOVE THIS WHEN LegalizeDAGTypes lands. case ISD::READCYCLECOUNTER: @@ -5407,6 +5444,8 @@ const char *X86TargetLowering::getTargetNodeName(unsigned Opcode) const { switch (Opcode) { default: return NULL; + case X86ISD::BSF: return "X86ISD::BSF"; + case X86ISD::BSR: return "X86ISD::BSR"; case X86ISD::SHLD: return "X86ISD::SHLD"; case X86ISD::SHRD: return "X86ISD::SHRD"; case X86ISD::FAND: return "X86ISD::FAND"; Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.h?rev=45024&r1=45023&r2=45024&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.h (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.h Thu Dec 13 20:13:44 2007 @@ -28,6 +28,11 @@ // Start the numbering where the builtin ops leave off. FIRST_NUMBER = ISD::BUILTIN_OP_END+X86::INSTRUCTION_LIST_END, + /// BSF - Bit scan forward. + /// BSR - Bit scan reverse. + BSF, + BSR, + /// SHLD, SHRD - Double shift instructions. These correspond to /// X86::SHLDxx and X86::SHRDxx instructions. SHLD, @@ -489,6 +494,8 @@ SDOperand LowerEH_RETURN(SDOperand Op, SelectionDAG &DAG); SDOperand LowerTRAMPOLINE(SDOperand Op, SelectionDAG &DAG); SDOperand LowerFLT_ROUNDS(SDOperand Op, SelectionDAG &DAG); + SDOperand LowerCTLZ(SDOperand Op, SelectionDAG &DAG); + SDOperand LowerCTTZ(SDOperand Op, SelectionDAG &DAG); SDNode *ExpandFP_TO_SINT(SDNode *N, SelectionDAG &DAG); SDNode *ExpandREADCYCLECOUNTER(SDNode *N, SelectionDAG &DAG); }; Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=45024&r1=45023&r2=45024&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Thu Dec 13 20:13:44 2007 @@ -57,6 +57,8 @@ def SDT_X86TCRET : SDTypeProfile<0, 2, [SDTCisPtrTy<0>, SDTCisVT<1, i32>]>; +def X86bsf : SDNode<"X86ISD::BSF", SDTIntUnaryOp>; +def X86bsr : SDNode<"X86ISD::BSR", SDTIntUnaryOp>; def X86shld : SDNode<"X86ISD::SHLD", SDTIntShiftDOp>; def X86shrd : SDNode<"X86ISD::SHRD", SDTIntShiftDOp>; @@ -445,6 +447,35 @@ (outs), (ins GR32:$src1, i32mem:$src2), "xchg{l}\t{$src2|$src1}, {$src1|$src2}", []>; +// Bit scan instructions. +let Defs = [EFLAGS] in { +def BSF16rr : I<0xBC, AddRegFrm, (outs GR16:$dst), (ins GR16:$src), + "bsf{w}\t{$src, $dst||$dst, $src}", + [(set GR16:$dst, (X86bsf GR16:$src))]>, TB; +def BSF16rm : I<0xBC, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src), + "bsf{w}\t{$src, $dst||$dst, $src}", + [(set GR16:$dst, (X86bsf (loadi16 addr:$src)))]>, TB; +def BSF32rr : I<0xBC, AddRegFrm, (outs GR32:$dst), (ins GR32:$src), + "bsf{l}\t{$src, $dst||$dst, $src}", + [(set GR32:$dst, (X86bsf GR32:$src))]>, TB; +def BSF32rm : I<0xBC, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src), + "bsf{l}\t{$src, $dst||$dst, $src}", + [(set GR32:$dst, (X86bsf (loadi32 addr:$src)))]>, TB; + +def BSR16rr : I<0xBD, AddRegFrm, (outs GR16:$dst), (ins GR16:$src), + "bsr{w}\t{$src, $dst||$dst, $src}", + [(set GR16:$dst, (X86bsr GR16:$src))]>, TB; +def BSR16rm : I<0xBD, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src), + "bsr{w}\t{$src, $dst||$dst, $src}", + [(set GR16:$dst, (X86bsr (loadi16 addr:$src)))]>, TB; +def BSR32rr : I<0xBD, AddRegFrm, (outs GR32:$dst), (ins GR32:$src), + "bsr{l}\t{$src, $dst||$dst, $src}", + [(set GR32:$dst, (X86bsr GR32:$src))]>, TB; +def BSR32rm : I<0xBD, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src), + "bsr{l}\t{$src, $dst||$dst, $src}", + [(set GR32:$dst, (X86bsr (loadi32 addr:$src)))]>, TB; +} // Defs = [EFLAGS] + def LEA16r : I<0x8D, MRMSrcMem, (outs GR16:$dst), (ins i32mem:$src), "lea{w}\t{$src|$dst}, {$dst|$src}", []>, OpSize; Modified: llvm/trunk/lib/Target/X86/X86InstrX86-64.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrX86-64.td?rev=45024&r1=45023&r2=45024&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrX86-64.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrX86-64.td Thu Dec 13 20:13:44 2007 @@ -167,6 +167,23 @@ def XCHG64rm : RI<0x87, MRMSrcMem, (outs), (ins GR64:$src1, i64mem:$src2), "xchg{q}\t{$src2|$src1}, {$src1|$src2}", []>; +// Bit scan instructions. +let Defs = [EFLAGS] in { +def BSF64rr : RI<0xBC, AddRegFrm, (outs GR64:$dst), (ins GR64:$src), + "bsf{q}\t{$src, $dst||$dst, $src}", + [(set GR64:$dst, (X86bsf GR64:$src))]>, TB; +def BSF64rm : RI<0xBC, MRMSrcMem, (outs GR64:$dst), (ins i64mem:$src), + "bsf{q}\t{$src, $dst||$dst, $src}", + [(set GR64:$dst, (X86bsf (loadi64 addr:$src)))]>, TB; + +def BSR64rr : RI<0xBD, AddRegFrm, (outs GR64:$dst), (ins GR64:$src), + "bsr{q}\t{$src, $dst||$dst, $src}", + [(set GR64:$dst, (X86bsr GR64:$src))]>, TB; +def BSR64rm : RI<0xBD, MRMSrcMem, (outs GR64:$dst), (ins i64mem:$src), + "bsr{q}\t{$src, $dst||$dst, $src}", + [(set GR64:$dst, (X86bsr (loadi64 addr:$src)))]>, TB; +} // Defs = [EFLAGS] + // Repeat string ops let Defs = [RCX,RDI,RSI], Uses = [RCX,RDI,RSI] in def REP_MOVSQ : RI<0xA5, RawFrm, (outs), (ins), "{rep;movsq|rep movsq}", Added: llvm/trunk/test/CodeGen/X86/clz.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/clz.ll?rev=45024&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/clz.ll (added) +++ llvm/trunk/test/CodeGen/X86/clz.ll Thu Dec 13 20:13:44 2007 @@ -0,0 +1,16 @@ +; RUN: llvm-as < %s | llc -march=x86 | grep bsr +; RUN: llvm-as < %s | llc -march=x86 | grep bsf + +define i32 @t1(i32 %x) nounwind { + %tmp = tail call i32 @llvm.ctlz.i32( i32 %x ) + ret i32 %tmp +} + +declare i32 @llvm.ctlz.i32(i32) nounwind readnone + +define i32 @t2(i32 %x) nounwind { + %tmp = tail call i32 @llvm.cttz.i32( i32 %x ) + ret i32 %tmp +} + +declare i32 @llvm.cttz.i32(i32) nounwind readnone From dpatel at apple.com Thu Dec 13 23:43:10 2007 From: dpatel at apple.com (Devang Patel) Date: Thu, 13 Dec 2007 21:43:10 -0800 Subject: [llvm-commits] [llvm-gcc-4.2] r45017 - /llvm-gcc-4.2/trunk/gcc/Makefile.in In-Reply-To: <7858EE70-4984-4F64-9F9F-99630E7CA9D2@apple.com> References: <200712140054.lBE0sb8o003105@zion.cs.uiuc.edu> <7858EE70-4984-4F64-9F9F-99630E7CA9D2@apple.com> Message-ID: On Dec 13, 2007, at 5:52 PM, Chris Lattner wrote: > > On Dec 13, 2007, at 4:54 PM, Devang Patel wrote: >> URL: http://llvm.org/viewvc/llvm-project?rev=45017&view=rev >> Log: >> Set libllvmgcc.dylib compatibility version number. >> >> Modified: >> llvm-gcc-4.2/trunk/gcc/Makefile.in >> >> Modified: llvm-gcc-4.2/trunk/gcc/Makefile.in >> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/ >> Makefile.in?rev=45017&r1=45016&r2=45017&view=diff >> >> = >> ===================================================================== >> ======== >> --- llvm-gcc-4.2/trunk/gcc/Makefile.in (original) >> +++ llvm-gcc-4.2/trunk/gcc/Makefile.in Thu Dec 13 18:54:36 2007 >> @@ -1209,7 +1209,7 @@ >> echo $(LLVMLIBFILES) >> $(CXX) $(DYLIB_COMPILE_FLAGS) $(INCLUDES) -o $@ \ >> $< $(LLVMLIBFILES) -L/usr/lib/gcc/$(build)/4.0.1/ - >> dynamiclib -single_module \ >> - -install_name @executable_path/$@ >> + -compatibility_version 1.0.0 -current_version 1.0.0 - >> install_name @executable_path/$@ > > is -L.../4.0.1 really right? hmm.. no. Actually, I don't understand why -L../4.x.1 is required here. I'll investigate. - Devang From dpatel at apple.com Fri Dec 14 00:02:16 2007 From: dpatel at apple.com (Devang Patel) Date: Fri, 14 Dec 2007 06:02:16 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r45026 - /llvm-gcc-4.2/trunk/gcc/Makefile.in Message-ID: <200712140602.lBE62Gx0024896@zion.cs.uiuc.edu> Author: dpatel Date: Fri Dec 14 00:02:16 2007 New Revision: 45026 URL: http://llvm.org/viewvc/llvm-project?rev=45026&view=rev Log: Remove unnecessary -L path. Modified: llvm-gcc-4.2/trunk/gcc/Makefile.in Modified: llvm-gcc-4.2/trunk/gcc/Makefile.in URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/Makefile.in?rev=45026&r1=45025&r2=45026&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/Makefile.in (original) +++ llvm-gcc-4.2/trunk/gcc/Makefile.in Fri Dec 14 00:02:16 2007 @@ -1208,8 +1208,9 @@ libllvmgcc$(LLVM_STAGE).dylib: llvm-linker-hack.cpp $(LLVMLIBFILES) echo $(LLVMLIBFILES) $(CXX) $(DYLIB_COMPILE_FLAGS) $(INCLUDES) -o $@ \ - $< $(LLVMLIBFILES) -L/usr/lib/gcc/$(build)/4.0.1/ -dynamiclib -single_module \ - -compatibility_version 1.0.0 -current_version 1.0.0 -install_name @executable_path/$@ + $< $(LLVMLIBFILES) -dynamiclib -single_module \ + -compatibility_version 1.0.0 -current_version 1.0.0 \ + -install_name @executable_path/$@ LLVMBACKENDFILES := libllvmgcc$(LLVM_STAGE).dylib From andersca at mac.com Fri Dec 14 00:38:54 2007 From: andersca at mac.com (Anders Carlsson) Date: Fri, 14 Dec 2007 06:38:54 -0000 Subject: [llvm-commits] [llvm] r45027 - in /llvm/trunk: include/llvm/IntrinsicsX86.td lib/VMCore/AutoUpgrade.cpp test/Assembler/AutoUpgradeIntrinsics.ll Message-ID: <200712140638.lBE6csKG028926@zion.cs.uiuc.edu> Author: andersca Date: Fri Dec 14 00:38:54 2007 New Revision: 45027 URL: http://llvm.org/viewvc/llvm-project?rev=45027&view=rev Log: All MMX shift instructions took a <2 x i32> vector as the shift amount parameter. Change this to be <1 x i64> instead, which matches the assembler instruction. Modified: llvm/trunk/include/llvm/IntrinsicsX86.td llvm/trunk/lib/VMCore/AutoUpgrade.cpp llvm/trunk/test/Assembler/AutoUpgradeIntrinsics.ll Modified: llvm/trunk/include/llvm/IntrinsicsX86.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IntrinsicsX86.td?rev=45027&r1=45026&r2=45027&view=diff ============================================================================== --- llvm/trunk/include/llvm/IntrinsicsX86.td (original) +++ llvm/trunk/include/llvm/IntrinsicsX86.td Fri Dec 14 00:38:54 2007 @@ -767,30 +767,30 @@ // Shift left logical def int_x86_mmx_psll_w : GCCBuiltin<"__builtin_ia32_psllw">, Intrinsic<[llvm_v4i16_ty, llvm_v4i16_ty, - llvm_v2i32_ty], [IntrNoMem]>; + llvm_v1i64_ty], [IntrNoMem]>; def int_x86_mmx_psll_d : GCCBuiltin<"__builtin_ia32_pslld">, Intrinsic<[llvm_v2i32_ty, llvm_v2i32_ty, - llvm_v2i32_ty], [IntrNoMem]>; + llvm_v1i64_ty], [IntrNoMem]>; def int_x86_mmx_psll_q : GCCBuiltin<"__builtin_ia32_psllq">, Intrinsic<[llvm_v1i64_ty, llvm_v1i64_ty, - llvm_v2i32_ty], [IntrNoMem]>; + llvm_v1i64_ty], [IntrNoMem]>; def int_x86_mmx_psrl_w : GCCBuiltin<"__builtin_ia32_psrlw">, Intrinsic<[llvm_v4i16_ty, llvm_v4i16_ty, - llvm_v2i32_ty], [IntrNoMem]>; + llvm_v1i64_ty], [IntrNoMem]>; def int_x86_mmx_psrl_d : GCCBuiltin<"__builtin_ia32_psrld">, Intrinsic<[llvm_v2i32_ty, llvm_v2i32_ty, - llvm_v2i32_ty], [IntrNoMem]>; + llvm_v1i64_ty], [IntrNoMem]>; def int_x86_mmx_psrl_q : GCCBuiltin<"__builtin_ia32_psrlq">, Intrinsic<[llvm_v1i64_ty, llvm_v1i64_ty, - llvm_v2i32_ty], [IntrNoMem]>; + llvm_v1i64_ty], [IntrNoMem]>; def int_x86_mmx_psra_w : GCCBuiltin<"__builtin_ia32_psraw">, Intrinsic<[llvm_v4i16_ty, llvm_v4i16_ty, - llvm_v2i32_ty], [IntrNoMem]>; + llvm_v1i64_ty], [IntrNoMem]>; def int_x86_mmx_psra_d : GCCBuiltin<"__builtin_ia32_psrad">, Intrinsic<[llvm_v2i32_ty, llvm_v2i32_ty, - llvm_v2i32_ty], [IntrNoMem]>; + llvm_v1i64_ty], [IntrNoMem]>; } // Pack ops. Modified: llvm/trunk/lib/VMCore/AutoUpgrade.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/AutoUpgrade.cpp?rev=45027&r1=45026&r2=45027&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/AutoUpgrade.cpp (original) +++ llvm/trunk/lib/VMCore/AutoUpgrade.cpp Fri Dec 14 00:38:54 2007 @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "llvm/AutoUpgrade.h" +#include "llvm/Constants.h" #include "llvm/Function.h" #include "llvm/Module.h" #include "llvm/Instructions.h" @@ -110,6 +111,39 @@ } break; + case 'x': + // This fixes all MMX shift intrinsic instructions to take a + // v1i64 instead of a v2i32 as the second parameter. + if (Name.compare(5,10,"x86.mmx.ps",10) == 0 && + (Name.compare(13,4,"psll", 4) == 0 || + Name.compare(13,4,"psra", 4) == 0 || + Name.compare(13,4,"psrl", 4) == 0)) { + + const llvm::Type *VT = VectorType::get(IntegerType::get(64), 1); + + // We don't have to do anything if the parameter already has + // the correct type. + if (FTy->getParamType(1) == VT) + break; + + // We first need to change the name of the old (bad) intrinsic, because + // its type is incorrect, but we cannot overload that name. We + // arbitrarily unique it here allowing us to construct a correctly named + // and typed function below. + F->setName(""); + + assert(FTy->getNumParams() == 2 && "MMX shift intrinsics take 2 args!"); + + // Now construct the new intrinsic with the correct name and type. We + // leave the old function around in order to query its type, whatever it + // may be, and correctly convert up to the new type. + return cast(M->getOrInsertFunction(Name, + FTy->getReturnType(), + FTy->getParamType(0), + VT, + (Type *)0)); + } + break; } // This may not belong here. This function is effectively being overloaded @@ -141,6 +175,40 @@ switch(NewFn->getIntrinsicID()) { default: assert(0 && "Unknown function for CallInst upgrade."); + case Intrinsic::x86_mmx_psll_d: + case Intrinsic::x86_mmx_psll_q: + case Intrinsic::x86_mmx_psll_w: + case Intrinsic::x86_mmx_psra_d: + case Intrinsic::x86_mmx_psra_w: + case Intrinsic::x86_mmx_psrl_d: + case Intrinsic::x86_mmx_psrl_q: + case Intrinsic::x86_mmx_psrl_w: { + SmallVector Operands; + + Operands.push_back(CI->getOperand(1)); + + // Cast the second parameter to the correct type. + BitCastInst *BC = new BitCastInst(CI->getOperand(2), + NewFn->getFunctionType()->getParamType(1), + "upgraded", CI); + Operands.push_back(BC); + + // Construct a new CallInst + CallInst *NewCI = new CallInst(NewFn, Operands.begin(), Operands.end(), + "upgraded."+CI->getName(), CI); + NewCI->setTailCall(CI->isTailCall()); + NewCI->setCallingConv(CI->getCallingConv()); + + // Handle any uses of the old CallInst. + if (!CI->use_empty()) + // Replace all uses of the old call with the new cast which has the + // correct type. + CI->replaceAllUsesWith(NewCI); + + // Clean up the old call now that it has been completely upgraded. + CI->eraseFromParent(); + break; + } case Intrinsic::ctlz: case Intrinsic::ctpop: case Intrinsic::cttz: Modified: llvm/trunk/test/Assembler/AutoUpgradeIntrinsics.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/AutoUpgradeIntrinsics.ll?rev=45027&r1=45026&r2=45027&view=diff ============================================================================== --- llvm/trunk/test/Assembler/AutoUpgradeIntrinsics.ll (original) +++ llvm/trunk/test/Assembler/AutoUpgradeIntrinsics.ll Fri Dec 14 00:38:54 2007 @@ -6,6 +6,8 @@ ; RUN: not grep {llvm\\.part\\.select\\.i\[0-9\]*\\.i\[0-9\]*} ; RUN: llvm-as < %s | llvm-dis | \ ; RUN: not grep {llvm\\.bswap\\.i\[0-9\]*\\.i\[0-9\]*} +; RUN: llvm-as < %s | llvm-dis | \ +; RUN: grep {llvm\\.x86\\.mmx\\.ps} | grep {2 x i32> | count 6 declare i32 @llvm.ctpop.i28(i28 %val) declare i32 @llvm.cttz.i29(i29 %val) @@ -50,3 +52,30 @@ ret i32 %d } +declare <4 x i16> @llvm.x86.mmx.psra.w(<4 x i16>, <2 x i32>) nounwind readnone +declare <4 x i16> @llvm.x86.mmx.psll.w(<4 x i16>, <2 x i32>) nounwind readnone +declare <4 x i16> @llvm.x86.mmx.psrl.w(<4 x i16>, <2 x i32>) nounwind readnone +define void @sh16(<4 x i16> %A, <2 x i32> %B) { + %r1 = call <4 x i16> @llvm.x86.mmx.psra.w( <4 x i16> %A, <2 x i32> %B ) ; <<4 x i16>> [#uses=0] + %r2 = call <4 x i16> @llvm.x86.mmx.psll.w( <4 x i16> %A, <2 x i32> %B ) ; <<4 x i16>> [#uses=0] + %r3 = call <4 x i16> @llvm.x86.mmx.psrl.w( <4 x i16> %A, <2 x i32> %B ) ; <<4 x i16>> [#uses=0] + ret void +} + +declare <2 x i32> @llvm.x86.mmx.psra.d(<2 x i32>, <2 x i32>) nounwind readnone +declare <2 x i32> @llvm.x86.mmx.psll.d(<2 x i32>, <2 x i32>) nounwind readnone +declare <2 x i32> @llvm.x86.mmx.psrl.d(<2 x i32>, <2 x i32>) nounwind readnone +define void @sh32(<2 x i32> %A, <2 x i32> %B) { + %r1 = call <2 x i32> @llvm.x86.mmx.psra.d( <2 x i32> %A, <2 x i32> %B ) ; <<2 x i32>> [#uses=0] + %r2 = call <2 x i32> @llvm.x86.mmx.psll.d( <2 x i32> %A, <2 x i32> %B ) ; <<2 x i32>> [#uses=0] + %r3 = call <2 x i32> @llvm.x86.mmx.psrl.d( <2 x i32> %A, <2 x i32> %B ) ; <<2 x i32>> [#uses=0] + ret void +} + +declare <1 x i64> @llvm.x86.mmx.psll.q(<1 x i64>, <2 x i32>) nounwind readnone +declare <1 x i64> @llvm.x86.mmx.psrl.q(<1 x i64>, <2 x i32>) nounwind readnone +define void @sh64(<1 x i64> %A, <2 x i32> %B) { + %r1 = call <1 x i64> @llvm.x86.mmx.psll.q( <1 x i64> %A, <2 x i32> %B ) ; <<1 x i64>> [#uses=0] + %r2 = call <1 x i64> @llvm.x86.mmx.psrl.q( <1 x i64> %A, <2 x i32> %B ) ; <<1 x i64>> [#uses=0] + ret void +} From evan.cheng at apple.com Fri Dec 14 02:25:16 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 14 Dec 2007 08:25:16 -0000 Subject: [llvm-commits] [llvm] r45028 - /llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp Message-ID: <200712140825.lBE8PGte003435@zion.cs.uiuc.edu> Author: evancheng Date: Fri Dec 14 02:25:15 2007 New Revision: 45028 URL: http://llvm.org/viewvc/llvm-project?rev=45028&view=rev Log: Bug fix. Must also match ResNo when matching an operand with a user. Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp Modified: llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp?rev=45028&r1=45027&r2=45028&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp (original) +++ llvm/trunk/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp Fri Dec 14 02:25:15 2007 @@ -326,7 +326,7 @@ } else { for (unsigned i = 0, e = Use->getNumOperands(); i != e; ++i) { SDOperand Op = Use->getOperand(i); - if (Op.Val != Node) + if (Op.Val != Node || Op.ResNo != ResNo) continue; MVT::ValueType VT = Node->getValueType(Op.ResNo); if (VT != MVT::Other && VT != MVT::Flag) From evan.cheng at apple.com Fri Dec 14 02:30:15 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 14 Dec 2007 08:30:15 -0000 Subject: [llvm-commits] [llvm] r45029 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86InstrInfo.td test/CodeGen/X86/clz.ll Message-ID: <200712140830.lBE8UGti003744@zion.cs.uiuc.edu> Author: evancheng Date: Fri Dec 14 02:30:15 2007 New Revision: 45029 URL: http://llvm.org/viewvc/llvm-project?rev=45029&view=rev Log: Fix ctlz and cttz. llvm definition requires them to return number of bits in of the src type when value is zero. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86InstrInfo.td llvm/trunk/test/CodeGen/X86/clz.ll Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=45029&r1=45028&r2=45029&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Dec 14 02:30:15 2007 @@ -5352,15 +5352,26 @@ Op = Op.getOperand(0); if (VT == MVT::i8) { + // Zero extend to i32 since there is not an i8 bsr. OpVT = MVT::i32; Op = DAG.getNode(ISD::ZERO_EXTEND, OpVT, Op); } - if (VT == MVT::i32 || VT == MVT::i64) - return DAG.getNode(ISD::XOR, OpVT, DAG.getNode(X86ISD::BSR, OpVT, Op), - DAG.getConstant(NumBits-1, OpVT)); - Op = DAG.getNode(ISD::SUB, OpVT, DAG.getConstant(NumBits-1, OpVT), - DAG.getNode(X86ISD::BSR, OpVT, Op)); + // Issue a bsr (scan bits in reverse) which also sets EFLAGS. + SDVTList VTs = DAG.getVTList(OpVT, MVT::i32); + Op = DAG.getNode(X86ISD::BSR, VTs, Op); + + // If src is zero (i.e. bsr sets ZF), returns NumBits. + SmallVector Ops; + Ops.push_back(Op); + Ops.push_back(DAG.getConstant(NumBits+NumBits-1, OpVT)); + Ops.push_back(DAG.getConstant(X86::COND_E, MVT::i8)); + Ops.push_back(Op.getValue(1)); + Op = DAG.getNode(X86ISD::CMOV, OpVT, &Ops[0], 4); + + // Finally xor with NumBits-1. + Op = DAG.getNode(ISD::XOR, OpVT, Op, DAG.getConstant(NumBits-1, OpVT)); + if (VT == MVT::i8) Op = DAG.getNode(ISD::TRUNCATE, MVT::i8, Op); return Op; @@ -5369,13 +5380,26 @@ SDOperand X86TargetLowering::LowerCTTZ(SDOperand Op, SelectionDAG &DAG) { MVT::ValueType VT = Op.getValueType(); MVT::ValueType OpVT = VT; + unsigned NumBits = MVT::getSizeInBits(VT); Op = Op.getOperand(0); if (VT == MVT::i8) { OpVT = MVT::i32; Op = DAG.getNode(ISD::ZERO_EXTEND, OpVT, Op); } - Op = DAG.getNode(X86ISD::BSF, OpVT, Op); + + // Issue a bsf (scan bits forward) which also sets EFLAGS. + SDVTList VTs = DAG.getVTList(OpVT, MVT::i32); + Op = DAG.getNode(X86ISD::BSF, VTs, Op); + + // If src is zero (i.e. bsf sets ZF), returns NumBits. + SmallVector Ops; + Ops.push_back(Op); + Ops.push_back(DAG.getConstant(NumBits, OpVT)); + Ops.push_back(DAG.getConstant(X86::COND_E, MVT::i8)); + Ops.push_back(Op.getValue(1)); + Op = DAG.getNode(X86ISD::CMOV, OpVT, &Ops[0], 4); + if (VT == MVT::i8) Op = DAG.getNode(ISD::TRUNCATE, MVT::i8, Op); return Op; Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=45029&r1=45028&r2=45029&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Fri Dec 14 02:30:15 2007 @@ -451,29 +451,33 @@ let Defs = [EFLAGS] in { def BSF16rr : I<0xBC, AddRegFrm, (outs GR16:$dst), (ins GR16:$src), "bsf{w}\t{$src, $dst||$dst, $src}", - [(set GR16:$dst, (X86bsf GR16:$src))]>, TB; + [(set GR16:$dst, (X86bsf GR16:$src)), (implicit EFLAGS)]>, TB; def BSF16rm : I<0xBC, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src), "bsf{w}\t{$src, $dst||$dst, $src}", - [(set GR16:$dst, (X86bsf (loadi16 addr:$src)))]>, TB; + [(set GR16:$dst, (X86bsf (loadi16 addr:$src))), + (implicit EFLAGS)]>, TB; def BSF32rr : I<0xBC, AddRegFrm, (outs GR32:$dst), (ins GR32:$src), "bsf{l}\t{$src, $dst||$dst, $src}", - [(set GR32:$dst, (X86bsf GR32:$src))]>, TB; + [(set GR32:$dst, (X86bsf GR32:$src)), (implicit EFLAGS)]>, TB; def BSF32rm : I<0xBC, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src), "bsf{l}\t{$src, $dst||$dst, $src}", - [(set GR32:$dst, (X86bsf (loadi32 addr:$src)))]>, TB; + [(set GR32:$dst, (X86bsf (loadi32 addr:$src))), + (implicit EFLAGS)]>, TB; def BSR16rr : I<0xBD, AddRegFrm, (outs GR16:$dst), (ins GR16:$src), "bsr{w}\t{$src, $dst||$dst, $src}", - [(set GR16:$dst, (X86bsr GR16:$src))]>, TB; + [(set GR16:$dst, (X86bsr GR16:$src)), (implicit EFLAGS)]>, TB; def BSR16rm : I<0xBD, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src), "bsr{w}\t{$src, $dst||$dst, $src}", - [(set GR16:$dst, (X86bsr (loadi16 addr:$src)))]>, TB; + [(set GR16:$dst, (X86bsr (loadi16 addr:$src))), + (implicit EFLAGS)]>, TB; def BSR32rr : I<0xBD, AddRegFrm, (outs GR32:$dst), (ins GR32:$src), "bsr{l}\t{$src, $dst||$dst, $src}", - [(set GR32:$dst, (X86bsr GR32:$src))]>, TB; + [(set GR32:$dst, (X86bsr GR32:$src)), (implicit EFLAGS)]>, TB; def BSR32rm : I<0xBD, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src), "bsr{l}\t{$src, $dst||$dst, $src}", - [(set GR32:$dst, (X86bsr (loadi32 addr:$src)))]>, TB; + [(set GR32:$dst, (X86bsr (loadi32 addr:$src))), + (implicit EFLAGS)]>, TB; } // Defs = [EFLAGS] def LEA16r : I<0x8D, MRMSrcMem, Modified: llvm/trunk/test/CodeGen/X86/clz.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/clz.ll?rev=45029&r1=45028&r2=45029&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/clz.ll (original) +++ llvm/trunk/test/CodeGen/X86/clz.ll Fri Dec 14 02:30:15 2007 @@ -1,5 +1,6 @@ -; RUN: llvm-as < %s | llc -march=x86 | grep bsr +; RUN: llvm-as < %s | llc -march=x86 | grep bsr | count 2 ; RUN: llvm-as < %s | llc -march=x86 | grep bsf +; RUN: llvm-as < %s | llc -march=x86 | grep cmov | count 3 define i32 @t1(i32 %x) nounwind { %tmp = tail call i32 @llvm.ctlz.i32( i32 %x ) @@ -14,3 +15,12 @@ } declare i32 @llvm.cttz.i32(i32) nounwind readnone + +define i16 @t3(i16 %x, i16 %y) nounwind { +entry: + %tmp1 = add i16 %x, %y + %tmp2 = tail call i16 @llvm.ctlz.i16( i16 %tmp1 ) ; [#uses=1] + ret i16 %tmp2 +} + +declare i16 @llvm.ctlz.i16(i16) nounwind readnone From baldrick at free.fr Fri Dec 14 04:29:28 2007 From: baldrick at free.fr (Duncan Sands) Date: Fri, 14 Dec 2007 11:29:28 +0100 Subject: [llvm-commits] [llvm] r45022 - in /llvm/trunk: include/llvm/Target/TargetInstrInfo.h lib/Target/Target.td utils/TableGen/CodeGenInstruction.h utils/TableGen/CodeGenTarget.cpp utils/TableGen/InstrInfoEmitter.cpp In-Reply-To: <200712140148.lBE1mxh2005906@zion.cs.uiuc.edu> References: <200712140148.lBE1mxh2005906@zion.cs.uiuc.edu> Message-ID: <200712141129.32156.baldrick@free.fr> Hi Bill, does a branch instruction have side-effects? What is a side-effect? I noticed some confusion in gcc about the definition of a side-effect, so it would be good to avoid confusion in LLVM. Ciao, Duncan. From djg at cray.com Fri Dec 14 09:10:09 2007 From: djg at cray.com (Dan Gohman) Date: Fri, 14 Dec 2007 15:10:09 -0000 Subject: [llvm-commits] [llvm] r45030 - in /llvm/trunk/lib/Target/X86: X86InstrInfo.td X86InstrX86-64.td Message-ID: <200712141510.lBEFAEwt002769@zion.cs.uiuc.edu> Author: djg Date: Fri Dec 14 09:10:00 2007 New Revision: 45030 URL: http://llvm.org/viewvc/llvm-project?rev=45030&view=rev Log: Fix Intel asm syntax for the bsr and bsf instructions. Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td llvm/trunk/lib/Target/X86/X86InstrX86-64.td Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=45030&r1=45029&r2=45030&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Fri Dec 14 09:10:00 2007 @@ -450,32 +450,32 @@ // Bit scan instructions. let Defs = [EFLAGS] in { def BSF16rr : I<0xBC, AddRegFrm, (outs GR16:$dst), (ins GR16:$src), - "bsf{w}\t{$src, $dst||$dst, $src}", + "bsf{w}\t{$src, $dst|$dst, $src}", [(set GR16:$dst, (X86bsf GR16:$src)), (implicit EFLAGS)]>, TB; def BSF16rm : I<0xBC, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src), - "bsf{w}\t{$src, $dst||$dst, $src}", + "bsf{w}\t{$src, $dst|$dst, $src}", [(set GR16:$dst, (X86bsf (loadi16 addr:$src))), (implicit EFLAGS)]>, TB; def BSF32rr : I<0xBC, AddRegFrm, (outs GR32:$dst), (ins GR32:$src), - "bsf{l}\t{$src, $dst||$dst, $src}", + "bsf{l}\t{$src, $dst|$dst, $src}", [(set GR32:$dst, (X86bsf GR32:$src)), (implicit EFLAGS)]>, TB; def BSF32rm : I<0xBC, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src), - "bsf{l}\t{$src, $dst||$dst, $src}", + "bsf{l}\t{$src, $dst|$dst, $src}", [(set GR32:$dst, (X86bsf (loadi32 addr:$src))), (implicit EFLAGS)]>, TB; def BSR16rr : I<0xBD, AddRegFrm, (outs GR16:$dst), (ins GR16:$src), - "bsr{w}\t{$src, $dst||$dst, $src}", + "bsr{w}\t{$src, $dst|$dst, $src}", [(set GR16:$dst, (X86bsr GR16:$src)), (implicit EFLAGS)]>, TB; def BSR16rm : I<0xBD, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src), - "bsr{w}\t{$src, $dst||$dst, $src}", + "bsr{w}\t{$src, $dst|$dst, $src}", [(set GR16:$dst, (X86bsr (loadi16 addr:$src))), (implicit EFLAGS)]>, TB; def BSR32rr : I<0xBD, AddRegFrm, (outs GR32:$dst), (ins GR32:$src), - "bsr{l}\t{$src, $dst||$dst, $src}", + "bsr{l}\t{$src, $dst|$dst, $src}", [(set GR32:$dst, (X86bsr GR32:$src)), (implicit EFLAGS)]>, TB; def BSR32rm : I<0xBD, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src), - "bsr{l}\t{$src, $dst||$dst, $src}", + "bsr{l}\t{$src, $dst|$dst, $src}", [(set GR32:$dst, (X86bsr (loadi32 addr:$src))), (implicit EFLAGS)]>, TB; } // Defs = [EFLAGS] Modified: llvm/trunk/lib/Target/X86/X86InstrX86-64.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrX86-64.td?rev=45030&r1=45029&r2=45030&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrX86-64.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrX86-64.td Fri Dec 14 09:10:00 2007 @@ -170,17 +170,17 @@ // Bit scan instructions. let Defs = [EFLAGS] in { def BSF64rr : RI<0xBC, AddRegFrm, (outs GR64:$dst), (ins GR64:$src), - "bsf{q}\t{$src, $dst||$dst, $src}", + "bsf{q}\t{$src, $dst|$dst, $src}", [(set GR64:$dst, (X86bsf GR64:$src))]>, TB; def BSF64rm : RI<0xBC, MRMSrcMem, (outs GR64:$dst), (ins i64mem:$src), - "bsf{q}\t{$src, $dst||$dst, $src}", + "bsf{q}\t{$src, $dst|$dst, $src}", [(set GR64:$dst, (X86bsf (loadi64 addr:$src)))]>, TB; def BSR64rr : RI<0xBD, AddRegFrm, (outs GR64:$dst), (ins GR64:$src), - "bsr{q}\t{$src, $dst||$dst, $src}", + "bsr{q}\t{$src, $dst|$dst, $src}", [(set GR64:$dst, (X86bsr GR64:$src))]>, TB; def BSR64rm : RI<0xBD, MRMSrcMem, (outs GR64:$dst), (ins i64mem:$src), - "bsr{q}\t{$src, $dst||$dst, $src}", + "bsr{q}\t{$src, $dst|$dst, $src}", [(set GR64:$dst, (X86bsr (loadi64 addr:$src)))]>, TB; } // Defs = [EFLAGS] From djg at cray.com Fri Dec 14 09:11:59 2007 From: djg at cray.com (Dan Gohman) Date: Fri, 14 Dec 2007 15:11:59 -0000 Subject: [llvm-commits] [llvm] r45031 - /llvm/trunk/include/llvm/Support/Allocator.h Message-ID: <200712141512.lBEFC06m002845@zion.cs.uiuc.edu> Author: djg Date: Fri Dec 14 09:11:58 2007 New Revision: 45031 URL: http://llvm.org/viewvc/llvm-project?rev=45031&view=rev Log: Fix a typo in a comment. Modified: llvm/trunk/include/llvm/Support/Allocator.h Modified: llvm/trunk/include/llvm/Support/Allocator.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Allocator.h?rev=45031&r1=45030&r2=45031&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/Allocator.h (original) +++ llvm/trunk/include/llvm/Support/Allocator.h Fri Dec 14 09:11:58 2007 @@ -57,6 +57,6 @@ void PrintStats() const; }; -} // end namespace clang +} // end namespace llvm #endif From djg at cray.com Fri Dec 14 09:13:09 2007 From: djg at cray.com (Dan Gohman) Date: Fri, 14 Dec 2007 15:13:09 -0000 Subject: [llvm-commits] [llvm] r45032 - /llvm/trunk/include/llvm/Target/MRegisterInfo.h Message-ID: <200712141513.lBEFDA6s002912@zion.cs.uiuc.edu> Author: djg Date: Fri Dec 14 09:13:08 2007 New Revision: 45032 URL: http://llvm.org/viewvc/llvm-project?rev=45032&view=rev Log: Fix a typo in a comment. Modified: llvm/trunk/include/llvm/Target/MRegisterInfo.h Modified: llvm/trunk/include/llvm/Target/MRegisterInfo.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/MRegisterInfo.h?rev=45032&r1=45031&r2=45032&view=diff ============================================================================== --- llvm/trunk/include/llvm/Target/MRegisterInfo.h (original) +++ llvm/trunk/include/llvm/Target/MRegisterInfo.h Fri Dec 14 09:13:08 2007 @@ -562,7 +562,7 @@ } /// unfoldMemoryOperand - Separate a single instruction which folded a load or - /// a a store or a load and a store into two or more instruction. If this is + /// a store or a load and a store into two or more instruction. If this is /// possible, returns true as well as the new instructions by reference. virtual bool unfoldMemoryOperand(MachineFunction &MF, MachineInstr *MI, unsigned Reg, bool UnfoldLoad, bool UnfoldStore, From djg at cray.com Fri Dec 14 09:15:11 2007 From: djg at cray.com (Dan Gohman) Date: Fri, 14 Dec 2007 15:15:11 -0000 Subject: [llvm-commits] [llvm] r45033 - /llvm/trunk/test/Assembler/2007-12-11-AddressSpaces.ll Message-ID: <200712141515.lBEFFCPe003009@zion.cs.uiuc.edu> Author: djg Date: Fri Dec 14 09:15:11 2007 New Revision: 45033 URL: http://llvm.org/viewvc/llvm-project?rev=45033&view=rev Log: Don't redirect stderr when it isn't needed. Modified: llvm/trunk/test/Assembler/2007-12-11-AddressSpaces.ll Modified: llvm/trunk/test/Assembler/2007-12-11-AddressSpaces.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/2007-12-11-AddressSpaces.ll?rev=45033&r1=45032&r2=45033&view=diff ============================================================================== --- llvm/trunk/test/Assembler/2007-12-11-AddressSpaces.ll (original) +++ llvm/trunk/test/Assembler/2007-12-11-AddressSpaces.ll Fri Dec 14 09:15:11 2007 @@ -1,8 +1,8 @@ -; RUN: llvm-as < %s | llvm-dis |& grep {addrspace(33)} | count 7 -; RUN: llvm-as < %s | llvm-dis |& grep {addrspace(42)} | count 2 -; RUN: llvm-as < %s | llvm-dis |& grep {addrspace(66)} | count 2 -; RUN: llvm-as < %s | llvm-dis |& grep {addrspace(11)} | count 6 -; RUN: llvm-as < %s | llvm-dis |& grep {addrspace(22)} | count 5 +; RUN: llvm-as < %s | llvm-dis | grep {addrspace(33)} | count 7 +; RUN: llvm-as < %s | llvm-dis | grep {addrspace(42)} | count 2 +; RUN: llvm-as < %s | llvm-dis | grep {addrspace(66)} | count 2 +; RUN: llvm-as < %s | llvm-dis | grep {addrspace(11)} | count 6 +; RUN: llvm-as < %s | llvm-dis | grep {addrspace(22)} | count 5 %struct.mystruct = type { i32, i32 addrspace(33)*, i32, i32 addrspace(33)* } @input = weak global %struct.mystruct zeroinitializer addrspace(42) ; <%struct.mystruct addrspace(42)*> [#uses=1] From djg at cray.com Fri Dec 14 09:41:37 2007 From: djg at cray.com (Dan Gohman) Date: Fri, 14 Dec 2007 15:41:37 -0000 Subject: [llvm-commits] [llvm] r45034 - in /llvm/trunk: include/llvm/ADT/StringMap.h include/llvm/ExecutionEngine/ExecutionEngine.h include/llvm/ExecutionEngine/GenericValue.h lib/Analysis/IPA/Andersens.cpp lib/CodeGen/CollectorMetadata.cpp lib/CodeGen/ELFWriter.cpp lib/CodeGen/SimpleRegisterCoalescing.h lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp Message-ID: <200712141541.lBEFfgMv004662@zion.cs.uiuc.edu> Author: djg Date: Fri Dec 14 09:41:34 2007 New Revision: 45034 URL: http://llvm.org/viewvc/llvm-project?rev=45034&view=rev Log: Add explicit keywords, and fix a minor typo that they uncovered. Modified: llvm/trunk/include/llvm/ADT/StringMap.h llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h llvm/trunk/include/llvm/ExecutionEngine/GenericValue.h llvm/trunk/lib/Analysis/IPA/Andersens.cpp llvm/trunk/lib/CodeGen/CollectorMetadata.cpp llvm/trunk/lib/CodeGen/ELFWriter.cpp llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.h llvm/trunk/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp Modified: llvm/trunk/include/llvm/ADT/StringMap.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringMap.h?rev=45034&r1=45033&r2=45034&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/StringMap.h (original) +++ llvm/trunk/include/llvm/ADT/StringMap.h Fri Dec 14 09:41:34 2007 @@ -389,8 +389,8 @@ template class StringMapIterator : public StringMapConstIterator { public: - StringMapIterator(StringMapImpl::ItemBucket *Bucket, - bool NoAdvance = false) + explicit StringMapIterator(StringMapImpl::ItemBucket *Bucket, + bool NoAdvance = false) : StringMapConstIterator(Bucket, NoAdvance) { } StringMapEntry &operator*() const { Modified: llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h?rev=45034&r1=45033&r2=45034&view=diff ============================================================================== --- llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h (original) +++ llvm/trunk/include/llvm/ExecutionEngine/ExecutionEngine.h Fri Dec 14 09:41:34 2007 @@ -248,7 +248,7 @@ } protected: - ExecutionEngine(ModuleProvider *P); + explicit ExecutionEngine(ModuleProvider *P); void emitGlobals(); Modified: llvm/trunk/include/llvm/ExecutionEngine/GenericValue.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ExecutionEngine/GenericValue.h?rev=45034&r1=45033&r2=45034&view=diff ============================================================================== --- llvm/trunk/include/llvm/ExecutionEngine/GenericValue.h (original) +++ llvm/trunk/include/llvm/ExecutionEngine/GenericValue.h Fri Dec 14 09:41:34 2007 @@ -34,7 +34,7 @@ APInt IntVal; // also used for long doubles GenericValue() : DoubleVal(0.0), IntVal(1,0) {} - GenericValue(void *V) : PointerVal(V), IntVal(1,0) { } + explicit GenericValue(void *V) : PointerVal(V), IntVal(1,0) { } }; inline GenericValue PTOGV(void *P) { return GenericValue(P); } Modified: llvm/trunk/lib/Analysis/IPA/Andersens.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/Andersens.cpp?rev=45034&r1=45033&r2=45034&view=diff ============================================================================== --- llvm/trunk/lib/Analysis/IPA/Andersens.cpp (original) +++ llvm/trunk/lib/Analysis/IPA/Andersens.cpp Fri Dec 14 09:41:34 2007 @@ -246,7 +246,7 @@ // Used for work list prioritization. unsigned Timestamp; - Node(bool direct = true) : + explicit Node(bool direct = true) : Val(0), Edges(0), PointsTo(0), OldPointsTo(0), PointerEquivLabel(0), LocationEquivLabel(0), PredEdges(0), ImplicitPredEdges(0), PointedToBy(0), NumInEdges(0), Modified: llvm/trunk/lib/CodeGen/CollectorMetadata.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CollectorMetadata.cpp?rev=45034&r1=45033&r2=45034&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/CollectorMetadata.cpp (original) +++ llvm/trunk/lib/CodeGen/CollectorMetadata.cpp Fri Dec 14 09:41:34 2007 @@ -30,7 +30,7 @@ std::ostream &OS; public: - Printer(std::ostream &OS = *cerr); + explicit Printer(std::ostream &OS = *cerr); const char *getPassName() const; void getAnalysisUsage(AnalysisUsage &AU) const; Modified: llvm/trunk/lib/CodeGen/ELFWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/ELFWriter.cpp?rev=45034&r1=45033&r2=45034&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/ELFWriter.cpp (original) +++ llvm/trunk/lib/CodeGen/ELFWriter.cpp Fri Dec 14 09:41:34 2007 @@ -72,7 +72,7 @@ std::vector *OutBuffer; size_t FnStart; public: - ELFCodeEmitter(ELFWriter &ew) : EW(ew), TM(EW.TM), OutBuffer(0) {} + explicit ELFCodeEmitter(ELFWriter &ew) : EW(ew), TM(EW.TM), OutBuffer(0) {} void startFunction(MachineFunction &F); bool finishFunction(MachineFunction &F); Modified: llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.h?rev=45034&r1=45033&r2=45034&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.h (original) +++ llvm/trunk/lib/CodeGen/SimpleRegisterCoalescing.h Fri Dec 14 09:41:34 2007 @@ -48,7 +48,7 @@ /// struct CopyRecSort : public std::binary_function { JoinPriorityQueue *JPQ; - CopyRecSort(JoinPriorityQueue *jpq) : JPQ(jpq) {} + explicit CopyRecSort(JoinPriorityQueue *jpq) : JPQ(jpq) {} CopyRecSort(const CopyRecSort &RHS) : JPQ(RHS.JPQ) {} bool operator()(CopyRec left, CopyRec right) const; }; @@ -61,7 +61,8 @@ std::priority_queue, SF> Queue; public: - JoinPriorityQueue(SimpleRegisterCoalescing *rc) : Rc(rc), Queue(SF(this)) {} + explicit JoinPriorityQueue(SimpleRegisterCoalescing *rc) + : Rc(rc), Queue(SF(this)) {} bool empty() const { return Queue.empty(); } void push(CopyRec R) { Queue.push(R); } Modified: llvm/trunk/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp?rev=45034&r1=45033&r2=45034&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp Fri Dec 14 09:41:34 2007 @@ -653,7 +653,7 @@ // char *fgets(char *s, int n, FILE *stream); GenericValue lle_X_fgets(FunctionType *FT, const vector &Args) { assert(Args.size() == 3); - return GVTOP(fgets((char*)GVTOP(Args[0]), Args[1].IntVal.getZExtValue(), + return PTOGV(fgets((char*)GVTOP(Args[0]), Args[1].IntVal.getZExtValue(), getFILE(GVTOP(Args[2])))); } From evan.cheng at apple.com Fri Dec 14 12:25:35 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 14 Dec 2007 18:25:35 -0000 Subject: [llvm-commits] [llvm] r45036 - /llvm/trunk/lib/Target/X86/X86InstrX86-64.td Message-ID: <200712141825.lBEIPZq7015512@zion.cs.uiuc.edu> Author: evancheng Date: Fri Dec 14 12:25:34 2007 New Revision: 45036 URL: http://llvm.org/viewvc/llvm-project?rev=45036&view=rev Log: Oops. Forgot these. Modified: llvm/trunk/lib/Target/X86/X86InstrX86-64.td Modified: llvm/trunk/lib/Target/X86/X86InstrX86-64.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrX86-64.td?rev=45036&r1=45035&r2=45036&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrX86-64.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrX86-64.td Fri Dec 14 12:25:34 2007 @@ -171,17 +171,19 @@ let Defs = [EFLAGS] in { def BSF64rr : RI<0xBC, AddRegFrm, (outs GR64:$dst), (ins GR64:$src), "bsf{q}\t{$src, $dst|$dst, $src}", - [(set GR64:$dst, (X86bsf GR64:$src))]>, TB; + [(set GR64:$dst, (X86bsf GR64:$src)), (implicit EFLAGS)]>, TB; def BSF64rm : RI<0xBC, MRMSrcMem, (outs GR64:$dst), (ins i64mem:$src), "bsf{q}\t{$src, $dst|$dst, $src}", - [(set GR64:$dst, (X86bsf (loadi64 addr:$src)))]>, TB; + [(set GR64:$dst, (X86bsf (loadi64 addr:$src))), + (implicit EFLAGS)]>, TB; def BSR64rr : RI<0xBD, AddRegFrm, (outs GR64:$dst), (ins GR64:$src), "bsr{q}\t{$src, $dst|$dst, $src}", - [(set GR64:$dst, (X86bsr GR64:$src))]>, TB; + [(set GR64:$dst, (X86bsr GR64:$src)), (implicit EFLAGS)]>, TB; def BSR64rm : RI<0xBD, MRMSrcMem, (outs GR64:$dst), (ins i64mem:$src), "bsr{q}\t{$src, $dst|$dst, $src}", - [(set GR64:$dst, (X86bsr (loadi64 addr:$src)))]>, TB; + [(set GR64:$dst, (X86bsr (loadi64 addr:$src))), + (implicit EFLAGS)]>, TB; } // Defs = [EFLAGS] // Repeat string ops From isanbard at gmail.com Fri Dec 14 12:40:34 2007 From: isanbard at gmail.com (Bill Wendling) Date: Fri, 14 Dec 2007 10:40:34 -0800 Subject: [llvm-commits] [llvm] r45022 - in /llvm/trunk: include/llvm/Target/TargetInstrInfo.h lib/Target/Target.td utils/TableGen/CodeGenInstruction.h utils/TableGen/CodeGenTarget.cpp utils/TableGen/InstrInfoEmitter.cpp In-Reply-To: <200712141129.32156.baldrick@free.fr> References: <200712140148.lBE1mxh2005906@zion.cs.uiuc.edu> <200712141129.32156.baldrick@free.fr> Message-ID: <16e5fdf90712141040y229de61cl7f0b36187e96ce@mail.gmail.com> Hi Duncan, > Hi Bill, does a branch instruction have side-effects? Yes. > What is a side-effect? I noticed some confusion in gcc about > the definition of a side-effect, so it would be good to avoid > confusion in LLVM. > My understanding of a side effect is when an instruction has un-modeled effects. For instance, "emms" on X86 has side effects that aren't modeled in the instruction pattern -- it resets the FP registers after MMX use. Other instructions have no un-modeled side effects -- e.g., "xor" on X86 or "li" on PPC. Others may have un-modeled side effects in some situations, but not in others -- e.g., loads, in general, have side effects (accessing memory), but loads from a constant pool don't. This is the working definition, anyway. In the beginning, it'll be closely tied to what the "isRematerializable" flag means. I don't know what GCC considers side effects. Could you give a summary? It would be good to contrast/compare with it. -bw From evan.cheng at apple.com Fri Dec 14 12:49:43 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 14 Dec 2007 18:49:43 -0000 Subject: [llvm-commits] [llvm] r45037 - in /llvm/trunk/lib/Target/X86: X86InstrInfo.td X86InstrX86-64.td Message-ID: <200712141849.lBEIniGi017575@zion.cs.uiuc.edu> Author: evancheng Date: Fri Dec 14 12:49:43 2007 New Revision: 45037 URL: http://llvm.org/viewvc/llvm-project?rev=45037&view=rev Log: Fix bsf / bsr jit encoding. Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td llvm/trunk/lib/Target/X86/X86InstrX86-64.td Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.td?rev=45037&r1=45036&r2=45037&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrInfo.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrInfo.td Fri Dec 14 12:49:43 2007 @@ -449,14 +449,14 @@ // Bit scan instructions. let Defs = [EFLAGS] in { -def BSF16rr : I<0xBC, AddRegFrm, (outs GR16:$dst), (ins GR16:$src), +def BSF16rr : I<0xBC, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src), "bsf{w}\t{$src, $dst|$dst, $src}", [(set GR16:$dst, (X86bsf GR16:$src)), (implicit EFLAGS)]>, TB; def BSF16rm : I<0xBC, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src), "bsf{w}\t{$src, $dst|$dst, $src}", [(set GR16:$dst, (X86bsf (loadi16 addr:$src))), (implicit EFLAGS)]>, TB; -def BSF32rr : I<0xBC, AddRegFrm, (outs GR32:$dst), (ins GR32:$src), +def BSF32rr : I<0xBC, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src), "bsf{l}\t{$src, $dst|$dst, $src}", [(set GR32:$dst, (X86bsf GR32:$src)), (implicit EFLAGS)]>, TB; def BSF32rm : I<0xBC, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src), @@ -464,14 +464,14 @@ [(set GR32:$dst, (X86bsf (loadi32 addr:$src))), (implicit EFLAGS)]>, TB; -def BSR16rr : I<0xBD, AddRegFrm, (outs GR16:$dst), (ins GR16:$src), +def BSR16rr : I<0xBD, MRMSrcReg, (outs GR16:$dst), (ins GR16:$src), "bsr{w}\t{$src, $dst|$dst, $src}", [(set GR16:$dst, (X86bsr GR16:$src)), (implicit EFLAGS)]>, TB; def BSR16rm : I<0xBD, MRMSrcMem, (outs GR16:$dst), (ins i16mem:$src), "bsr{w}\t{$src, $dst|$dst, $src}", [(set GR16:$dst, (X86bsr (loadi16 addr:$src))), (implicit EFLAGS)]>, TB; -def BSR32rr : I<0xBD, AddRegFrm, (outs GR32:$dst), (ins GR32:$src), +def BSR32rr : I<0xBD, MRMSrcReg, (outs GR32:$dst), (ins GR32:$src), "bsr{l}\t{$src, $dst|$dst, $src}", [(set GR32:$dst, (X86bsr GR32:$src)), (implicit EFLAGS)]>, TB; def BSR32rm : I<0xBD, MRMSrcMem, (outs GR32:$dst), (ins i32mem:$src), Modified: llvm/trunk/lib/Target/X86/X86InstrX86-64.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrX86-64.td?rev=45037&r1=45036&r2=45037&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrX86-64.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrX86-64.td Fri Dec 14 12:49:43 2007 @@ -169,7 +169,7 @@ // Bit scan instructions. let Defs = [EFLAGS] in { -def BSF64rr : RI<0xBC, AddRegFrm, (outs GR64:$dst), (ins GR64:$src), +def BSF64rr : RI<0xBC, MRMSrcReg, (outs GR64:$dst), (ins GR64:$src), "bsf{q}\t{$src, $dst|$dst, $src}", [(set GR64:$dst, (X86bsf GR64:$src)), (implicit EFLAGS)]>, TB; def BSF64rm : RI<0xBC, MRMSrcMem, (outs GR64:$dst), (ins i64mem:$src), @@ -177,7 +177,7 @@ [(set GR64:$dst, (X86bsf (loadi64 addr:$src))), (implicit EFLAGS)]>, TB; -def BSR64rr : RI<0xBD, AddRegFrm, (outs GR64:$dst), (ins GR64:$src), +def BSR64rr : RI<0xBD, MRMSrcReg, (outs GR64:$dst), (ins GR64:$src), "bsr{q}\t{$src, $dst|$dst, $src}", [(set GR64:$dst, (X86bsr GR64:$src)), (implicit EFLAGS)]>, TB; def BSR64rm : RI<0xBD, MRMSrcMem, (outs GR64:$dst), (ins i64mem:$src), From dalej at apple.com Fri Dec 14 13:25:35 2007 From: dalej at apple.com (Dale Johannesen) Date: Fri, 14 Dec 2007 19:25:35 -0000 Subject: [llvm-commits] [llvm] r45038 - /llvm/trunk/lib/Target/X86/X86CallingConv.td Message-ID: <200712141925.lBEJPZJf022152@zion.cs.uiuc.edu> Author: johannes Date: Fri Dec 14 13:25:34 2007 New Revision: 45038 URL: http://llvm.org/viewvc/llvm-project?rev=45038&view=rev Log: x86-32 long doubles are 4-byte aligned on the stack for parameter passing (only for that, on Darwin). Modified: llvm/trunk/lib/Target/X86/X86CallingConv.td Modified: llvm/trunk/lib/Target/X86/X86CallingConv.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CallingConv.td?rev=45038&r1=45037&r2=45038&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86CallingConv.td (original) +++ llvm/trunk/lib/Target/X86/X86CallingConv.td Fri Dec 14 13:25:34 2007 @@ -183,7 +183,7 @@ // Long doubles get slots whose size and alignment depends on the // subtarget. - CCIfType<[f80], CCAssignToStack<0, 0>>, + CCIfType<[f80], CCAssignToStack<16, 4>>, // The first 4 vector arguments are passed in XMM registers. CCIfType<[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64], From baldrick at free.fr Fri Dec 14 13:38:31 2007 From: baldrick at free.fr (Duncan Sands) Date: Fri, 14 Dec 2007 19:38:31 -0000 Subject: [llvm-commits] [llvm] r45039 - in /llvm/trunk: lib/ExecutionEngine/ExecutionEngine.cpp test/ExecutionEngine/2007-12-14-BigEndian.ll test/ExecutionEngine/2007-12-14-LittleEndian.ll Message-ID: <200712141938.lBEJcVUS022700@zion.cs.uiuc.edu> Author: baldrick Date: Fri Dec 14 13:38:31 2007 New Revision: 45039 URL: http://llvm.org/viewvc/llvm-project?rev=45039&view=rev Log: Teach the interpreter to read and write memory in the endianness of the target not of the host. Done by the simple expedient of reversing bytes for primitive types if the host and target endianness don't match. This is correct for integer and pointer types. I don't know if it is correct for floating point types. Added: llvm/trunk/test/ExecutionEngine/2007-12-14-BigEndian.ll llvm/trunk/test/ExecutionEngine/2007-12-14-LittleEndian.ll Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=45039&r1=45038&r2=45039&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Fri Dec 14 13:38:31 2007 @@ -18,6 +18,7 @@ #include "llvm/Module.h" #include "llvm/ModuleProvider.h" #include "llvm/ADT/Statistic.h" +#include "llvm/Config/alloca.h" #include "llvm/ExecutionEngine/ExecutionEngine.h" #include "llvm/ExecutionEngine/GenericValue.h" #include "llvm/Support/Debug.h" @@ -232,6 +233,15 @@ } } +/// isTargetNullPtr - Return whether the target pointer stored at Loc is null. +static bool isTargetNullPtr(ExecutionEngine *EE, void *Loc) { + unsigned PtrSize = EE->getTargetData()->getPointerSize(); + for (unsigned i = 0; i < PtrSize; ++i) + if (*(i + (uint8_t*)Loc)) + return false; + return true; +} + /// runFunctionAsMain - This is a helper function which wraps runFunction to /// handle the common task of starting up main with the specified argc, argv, /// and envp parameters. @@ -281,7 +291,7 @@ GVArgs.push_back(GVArgc); // Arg #0 = argc. if (NumArgs > 1) { GVArgs.push_back(PTOGV(CreateArgv(this, argv))); // Arg #1 = argv. - assert(((char **)GVTOP(GVArgs[1]))[0] && + assert(!isTargetNullPtr(this, GVTOP(GVArgs[1])) && "argv[0] was null after CreateArgv"); if (NumArgs > 2) { std::vector EnvVars; @@ -624,40 +634,44 @@ return Result; } +/// StoreIntToMemory - Fills the StoreBytes bytes of memory starting from Dst +/// with the integer held in IntVal. +static void StoreIntToMemory(const APInt &IntVal, uint8_t *Dst, + unsigned StoreBytes) { + assert((IntVal.getBitWidth()+7)/8 >= StoreBytes && "Integer too small!"); + uint8_t *Src = (uint8_t *)IntVal.getRawData(); + + if (sys::littleEndianHost()) + // Little-endian host - the source is ordered from LSB to MSB. Order the + // destination from LSB to MSB: Do a straight copy. + memcpy(Dst, Src, StoreBytes); + else { + // Big-endian host - the source is an array of 64 bit words ordered from + // LSW to MSW. Each word is ordered from MSB to LSB. Order the destination + // from MSB to LSB: Reverse the word order, but not the bytes in a word. + while (StoreBytes > sizeof(uint64_t)) { + StoreBytes -= sizeof(uint64_t); + // May not be aligned so use memcpy. + memcpy(Dst + StoreBytes, Src, sizeof(uint64_t)); + Src += sizeof(uint64_t); + } + + memcpy(Dst, Src + sizeof(uint64_t) - StoreBytes, StoreBytes); + } +} + /// StoreValueToMemory - Stores the data in Val of type Ty at address Ptr. Ptr /// is the address of the memory at which to store Val, cast to GenericValue *. /// It is not a pointer to a GenericValue containing the address at which to /// store Val. -/// void ExecutionEngine::StoreValueToMemory(const GenericValue &Val, GenericValue *Ptr, const Type *Ty) { - switch (Ty->getTypeID()) { - case Type::IntegerTyID: { - unsigned BitWidth = cast(Ty)->getBitWidth(); - unsigned StoreBytes = (BitWidth + 7)/8; - uint8_t *Src = (uint8_t *)Val.IntVal.getRawData(); - uint8_t *Dst = (uint8_t *)Ptr; - - if (sys::littleEndianHost()) - // Little-endian host - the source is ordered from LSB to MSB. - // Order the destination from LSB to MSB: Do a straight copy. - memcpy(Dst, Src, StoreBytes); - else { - // Big-endian host - the source is an array of 64 bit words ordered from - // LSW to MSW. Each word is ordered from MSB to LSB. - // Order the destination from MSB to LSB: Reverse the word order, but not - // the bytes in a word. - while (StoreBytes > sizeof(uint64_t)) { - StoreBytes -= sizeof(uint64_t); - // May not be aligned so use memcpy. - memcpy(Dst + StoreBytes, Src, sizeof(uint64_t)); - Src += sizeof(uint64_t); - } + const unsigned StoreBytes = getTargetData()->getTypeStoreSize(Ty); - memcpy(Dst, Src + sizeof(uint64_t) - StoreBytes, StoreBytes); - } + switch (Ty->getTypeID()) { + case Type::IntegerTyID: + StoreIntToMemory(Val.IntVal, (uint8_t*)Ptr, StoreBytes); break; - } case Type::FloatTyID: *((float*)Ptr) = Val.FloatVal; break; @@ -675,61 +689,82 @@ Dest[4] = Src[3]; break; } - case Type::PointerTyID: + case Type::PointerTyID: + // Ensure 64 bit target pointers are fully initialized on 32 bit hosts. + if (StoreBytes != sizeof(PointerTy)) + memset(Ptr, 0, StoreBytes); + *((PointerTy*)Ptr) = Val.PointerVal; break; default: cerr << "Cannot store value of type " << *Ty << "!\n"; } + + if (sys::littleEndianHost() != getTargetData()->isLittleEndian()) + // Host and target are different endian - reverse the stored bytes. + std::reverse((uint8_t*)Ptr, StoreBytes + (uint8_t*)Ptr); +} + +/// LoadIntFromMemory - Loads the integer stored in the LoadBytes bytes starting +/// from Src into IntVal, which is assumed to be wide enough and to hold zero. +static void LoadIntFromMemory(APInt &IntVal, uint8_t *Src, unsigned LoadBytes) { + assert((IntVal.getBitWidth()+7)/8 >= LoadBytes && "Integer too small!"); + uint8_t *Dst = (uint8_t *)IntVal.getRawData(); + + if (sys::littleEndianHost()) + // Little-endian host - the destination must be ordered from LSB to MSB. + // The source is ordered from LSB to MSB: Do a straight copy. + memcpy(Dst, Src, LoadBytes); + else { + // Big-endian - the destination is an array of 64 bit words ordered from + // LSW to MSW. Each word must be ordered from MSB to LSB. The source is + // ordered from MSB to LSB: Reverse the word order, but not the bytes in + // a word. + while (LoadBytes > sizeof(uint64_t)) { + LoadBytes -= sizeof(uint64_t); + // May not be aligned so use memcpy. + memcpy(Dst, Src + LoadBytes, sizeof(uint64_t)); + Dst += sizeof(uint64_t); + } + + memcpy(Dst + sizeof(uint64_t) - LoadBytes, Src, LoadBytes); + } } /// FIXME: document /// -void ExecutionEngine::LoadValueFromMemory(GenericValue &Result, +void ExecutionEngine::LoadValueFromMemory(GenericValue &Result, GenericValue *Ptr, const Type *Ty) { - switch (Ty->getTypeID()) { - case Type::IntegerTyID: { - unsigned BitWidth = cast(Ty)->getBitWidth(); - unsigned LoadBytes = (BitWidth + 7)/8; - - // An APInt with all words initially zero. - Result.IntVal = APInt(BitWidth, 0); - - uint8_t *Src = (uint8_t *)Ptr; - uint8_t *Dst = (uint8_t *)Result.IntVal.getRawData(); + const unsigned LoadBytes = getTargetData()->getTypeStoreSize(Ty); - if (sys::littleEndianHost()) - // Little-endian host - the destination must be ordered from LSB to MSB. - // The source is ordered from LSB to MSB: Do a straight copy. - memcpy(Dst, Src, LoadBytes); - else { - // Big-endian - the destination is an array of 64 bit words ordered from - // LSW to MSW. Each word must be ordered from MSB to LSB. The source is - // ordered from MSB to LSB: Reverse the word order, but not the bytes in - // a word. - while (LoadBytes > sizeof(uint64_t)) { - LoadBytes -= sizeof(uint64_t); - // May not be aligned so use memcpy. - memcpy(Dst, Src + LoadBytes, sizeof(uint64_t)); - Dst += sizeof(uint64_t); - } + if (sys::littleEndianHost() != getTargetData()->isLittleEndian()) { + // Host and target are different endian - reverse copy the stored + // bytes into a buffer, and load from that. + uint8_t *Src = (uint8_t*)Ptr; + uint8_t *Buf = (uint8_t*)alloca(LoadBytes); + std::reverse_copy(Src, Src + LoadBytes, Buf); + Ptr = (GenericValue*)Buf; + } - memcpy(Dst + sizeof(uint64_t) - LoadBytes, Src, LoadBytes); - } + switch (Ty->getTypeID()) { + case Type::IntegerTyID: + // An APInt with all words initially zero. + Result.IntVal = APInt(cast(Ty)->getBitWidth(), 0); + LoadIntFromMemory(Result.IntVal, (uint8_t*)Ptr, LoadBytes); break; - } case Type::FloatTyID: Result.FloatVal = *((float*)Ptr); break; case Type::DoubleTyID: - Result.DoubleVal = *((double*)Ptr); + Result.DoubleVal = *((double*)Ptr); break; - case Type::PointerTyID: + case Type::PointerTyID: Result.PointerVal = *((PointerTy*)Ptr); break; case Type::X86_FP80TyID: { // This is endian dependent, but it will only work on x86 anyway. + // FIXME: Does not trap if loading a trapping NaN. uint16_t *p = (uint16_t*)Ptr; union { uint16_t x[8]; Added: llvm/trunk/test/ExecutionEngine/2007-12-14-BigEndian.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/2007-12-14-BigEndian.ll?rev=45039&view=auto ============================================================================== --- llvm/trunk/test/ExecutionEngine/2007-12-14-BigEndian.ll (added) +++ llvm/trunk/test/ExecutionEngine/2007-12-14-BigEndian.ll Fri Dec 14 13:38:31 2007 @@ -0,0 +1,81 @@ +; RUN: llvm-as < %s -o - | lli -force-interpreter + +target datalayout = "E" + +define i32 @main() { +entry: + %i = alloca i93 + store i93 18364758544493064720, i93* %i + %i1 = load i93* %i + %i2 = shl i93 %i1, 32 + %i3 = or i93 %i2, 3753679480 + store i93 %i3, i93* %i + %i4 = load i93* %i + %C = icmp eq i93 %i3, %i4 + br i1 %C, label %ok1, label %fail +ok1: + %b = bitcast i93* %i to [12 x i8]* + %b0 = getelementptr [12 x i8]* %b, i32 0, i32 0 + %v0 = load i8* %b0 + %c0 = icmp eq i8 %v0, 30 + br i1 %c0, label %ok2, label %fail +ok2: + %b1 = getelementptr [12 x i8]* %b, i32 0, i32 1 + %v1 = load i8* %b1 + %c1 = icmp eq i8 %v1, 220 + br i1 %c1, label %ok3, label %fail +ok3: + %b2 = getelementptr [12 x i8]* %b, i32 0, i32 2 + %v2 = load i8* %b2 + %c2 = icmp eq i8 %v2, 186 + br i1 %c2, label %ok4, label %fail +ok4: + %b3 = getelementptr [12 x i8]* %b, i32 0, i32 3 + %v3 = load i8* %b3 + %c3 = icmp eq i8 %v3, 152 + br i1 %c3, label %ok5, label %fail +ok5: + %b4 = getelementptr [12 x i8]* %b, i32 0, i32 4 + %v4 = load i8* %b4 + %c4 = icmp eq i8 %v4, 118 + br i1 %c4, label %ok6, label %fail +ok6: + %b5 = getelementptr [12 x i8]* %b, i32 0, i32 5 + %v5 = load i8* %b5 + %c5 = icmp eq i8 %v5, 84 + br i1 %c5, label %ok7, label %fail +ok7: + %b6 = getelementptr [12 x i8]* %b, i32 0, i32 6 + %v6 = load i8* %b6 + %c6 = icmp eq i8 %v6, 50 + br i1 %c6, label %ok8, label %fail +ok8: + %b7 = getelementptr [12 x i8]* %b, i32 0, i32 7 + %v7 = load i8* %b7 + %c7 = icmp eq i8 %v7, 16 + br i1 %c7, label %ok9, label %fail +ok9: + %b8 = getelementptr [12 x i8]* %b, i32 0, i32 8 + %v8 = load i8* %b8 + %c8 = icmp eq i8 %v8, 223 + br i1 %c8, label %okA, label %fail +okA: + %b9 = getelementptr [12 x i8]* %b, i32 0, i32 9 + %v9 = load i8* %b9 + %c9 = icmp eq i8 %v9, 188 + br i1 %c9, label %okB, label %fail +okB: + %bA = getelementptr [12 x i8]* %b, i32 0, i32 10 + %vA = load i8* %bA + %cA = icmp eq i8 %vA, 154 + br i1 %cA, label %okC, label %fail +okC: + %bB = getelementptr [12 x i8]* %b, i32 0, i32 11 + %vB = load i8* %bB + %cB = icmp eq i8 %vB, 120 + br i1 %cB, label %okD, label %fail +okD: + ret i32 0 +fail: + ret i32 1 +} Added: llvm/trunk/test/ExecutionEngine/2007-12-14-LittleEndian.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/ExecutionEngine/2007-12-14-LittleEndian.ll?rev=45039&view=auto ============================================================================== --- llvm/trunk/test/ExecutionEngine/2007-12-14-LittleEndian.ll (added) +++ llvm/trunk/test/ExecutionEngine/2007-12-14-LittleEndian.ll Fri Dec 14 13:38:31 2007 @@ -0,0 +1,81 @@ +; RUN: llvm-as < %s -o - | lli -force-interpreter + +target datalayout = "e" + +define i32 @main() { +entry: + %i = alloca i93 + store i93 18364758544493064720, i93* %i + %i1 = load i93* %i + %i2 = shl i93 %i1, 32 + %i3 = or i93 %i2, 3753679480 + store i93 %i3, i93* %i + %i4 = load i93* %i + %C = icmp eq i93 %i3, %i4 + br i1 %C, label %ok1, label %fail +ok1: + %b = bitcast i93* %i to [12 x i8]* + %b0 = getelementptr [12 x i8]* %b, i32 0, i32 0 + %v0 = load i8* %b0 + %c0 = icmp eq i8 %v0, 120 + br i1 %c0, label %ok2, label %fail +ok2: + %b1 = getelementptr [12 x i8]* %b, i32 0, i32 1 + %v1 = load i8* %b1 + %c1 = icmp eq i8 %v1, 154 + br i1 %c1, label %ok3, label %fail +ok3: + %b2 = getelementptr [12 x i8]* %b, i32 0, i32 2 + %v2 = load i8* %b2 + %c2 = icmp eq i8 %v2, 188 + br i1 %c2, label %ok4, label %fail +ok4: + %b3 = getelementptr [12 x i8]* %b, i32 0, i32 3 + %v3 = load i8* %b3 + %c3 = icmp eq i8 %v3, 223 + br i1 %c3, label %ok5, label %fail +ok5: + %b4 = getelementptr [12 x i8]* %b, i32 0, i32 4 + %v4 = load i8* %b4 + %c4 = icmp eq i8 %v4, 16 + br i1 %c4, label %ok6, label %fail +ok6: + %b5 = getelementptr [12 x i8]* %b, i32 0, i32 5 + %v5 = load i8* %b5 + %c5 = icmp eq i8 %v5, 50 + br i1 %c5, label %ok7, label %fail +ok7: + %b6 = getelementptr [12 x i8]* %b, i32 0, i32 6 + %v6 = load i8* %b6 + %c6 = icmp eq i8 %v6, 84 + br i1 %c6, label %ok8, label %fail +ok8: + %b7 = getelementptr [12 x i8]* %b, i32 0, i32 7 + %v7 = load i8* %b7 + %c7 = icmp eq i8 %v7, 118 + br i1 %c7, label %ok9, label %fail +ok9: + %b8 = getelementptr [12 x i8]* %b, i32 0, i32 8 + %v8 = load i8* %b8 + %c8 = icmp eq i8 %v8, 152 + br i1 %c8, label %okA, label %fail +okA: + %b9 = getelementptr [12 x i8]* %b, i32 0, i32 9 + %v9 = load i8* %b9 + %c9 = icmp eq i8 %v9, 186 + br i1 %c9, label %okB, label %fail +okB: + %bA = getelementptr [12 x i8]* %b, i32 0, i32 10 + %vA = load i8* %bA + %cA = icmp eq i8 %vA, 220 + br i1 %cA, label %okC, label %fail +okC: + %bB = getelementptr [12 x i8]* %b, i32 0, i32 11 + %vB = load i8* %bB + %cB = icmp eq i8 %vB, 30 + br i1 %cB, label %okD, label %fail +okD: + ret i32 0 +fail: + ret i32 1 +} From evan.cheng at apple.com Fri Dec 14 13:54:08 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 14 Dec 2007 19:54:08 -0000 Subject: [llvm-commits] [llvm] r45040 - /llvm/trunk/lib/Target/X86/X86InstrX86-64.td Message-ID: <200712141954.lBEJs8Lo023463@zion.cs.uiuc.edu> Author: evancheng Date: Fri Dec 14 13:54:07 2007 New Revision: 45040 URL: http://llvm.org/viewvc/llvm-project?rev=45040&view=rev Log: Fix (mem) <-> low 64-bits of xmm bugs pointed out by David Greene. Mac OS X Leopard assembler recognizes movq. Modified: llvm/trunk/lib/Target/X86/X86InstrX86-64.td Modified: llvm/trunk/lib/Target/X86/X86InstrX86-64.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrX86-64.td?rev=45040&r1=45039&r2=45040&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrX86-64.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrX86-64.td Fri Dec 14 13:54:07 2007 @@ -1256,19 +1256,19 @@ "mov{d|q}\t{$src, $dst|$dst, $src}", [(set VR128:$dst, (v2i64 (scalar_to_vector GR64:$src)))]>; -def MOV64toPQIrm : RPDI<0x6E, MRMSrcMem, (outs VR128:$dst), (ins i64mem:$src), - "mov{d|q}\t{$src, $dst|$dst, $src}", - [(set VR128:$dst, - (v2i64 (scalar_to_vector (loadi64 addr:$src))))]>; +def MOV64toPQIrm : I<0x7E, MRMSrcMem, (outs VR128:$dst), (ins i64mem:$src), + "movq\t{$src, $dst|$dst, $src}", + [(set VR128:$dst, + (v2i64 (scalar_to_vector (loadi64 addr:$src))))]>, XS; def MOVPQIto64rr : RPDI<0x7E, MRMDestReg, (outs GR64:$dst), (ins VR128:$src), "mov{d|q}\t{$src, $dst|$dst, $src}", [(set GR64:$dst, (vector_extract (v2i64 VR128:$src), (iPTR 0)))]>; -def MOVPQIto64mr : RPDI<0x7E, MRMDestMem, (outs), (ins i64mem:$dst, VR128:$src), - "mov{d|q}\t{$src, $dst|$dst, $src}", - [(store (i64 (vector_extract (v2i64 VR128:$src), - (iPTR 0))), addr:$dst)]>; +def MOVPQIto64mr : PDI<0xD6, MRMDestMem, (outs), (ins i64mem:$dst, VR128:$src), + "movq\t{$src, $dst|$dst, $src}", + [(store (i64 (vector_extract (v2i64 VR128:$src), + (iPTR 0))), addr:$dst)]>; def MOV64toSDrr : RPDI<0x6E, MRMSrcReg, (outs FR64:$dst), (ins GR64:$src), "mov{d|q}\t{$src, $dst|$dst, $src}", From evan.cheng at apple.com Fri Dec 14 14:08:17 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 14 Dec 2007 20:08:17 -0000 Subject: [llvm-commits] [llvm] r45041 - in /llvm/trunk/lib/Target/X86: X86InstrX86-64.td X86RegisterInfo.cpp Message-ID: <200712142008.lBEK8HRU024933@zion.cs.uiuc.edu> Author: evancheng Date: Fri Dec 14 14:08:14 2007 New Revision: 45041 URL: http://llvm.org/viewvc/llvm-project?rev=45041&view=rev Log: Actually, MOVPQIto64mr is a dup of MOVPQI2QImr, MOV64toPQIrm is a dup of MOVQI2PQIrm. Modified: llvm/trunk/lib/Target/X86/X86InstrX86-64.td llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Modified: llvm/trunk/lib/Target/X86/X86InstrX86-64.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrX86-64.td?rev=45041&r1=45040&r2=45041&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrX86-64.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrX86-64.td Fri Dec 14 14:08:14 2007 @@ -1256,19 +1256,10 @@ "mov{d|q}\t{$src, $dst|$dst, $src}", [(set VR128:$dst, (v2i64 (scalar_to_vector GR64:$src)))]>; -def MOV64toPQIrm : I<0x7E, MRMSrcMem, (outs VR128:$dst), (ins i64mem:$src), - "movq\t{$src, $dst|$dst, $src}", - [(set VR128:$dst, - (v2i64 (scalar_to_vector (loadi64 addr:$src))))]>, XS; - def MOVPQIto64rr : RPDI<0x7E, MRMDestReg, (outs GR64:$dst), (ins VR128:$src), "mov{d|q}\t{$src, $dst|$dst, $src}", [(set GR64:$dst, (vector_extract (v2i64 VR128:$src), (iPTR 0)))]>; -def MOVPQIto64mr : PDI<0xD6, MRMDestMem, (outs), (ins i64mem:$dst, VR128:$src), - "movq\t{$src, $dst|$dst, $src}", - [(store (i64 (vector_extract (v2i64 VR128:$src), - (iPTR 0))), addr:$dst)]>; def MOV64toSDrr : RPDI<0x6E, MRMSrcReg, (outs FR64:$dst), (ins GR64:$src), "mov{d|q}\t{$src, $dst|$dst, $src}", Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=45041&r1=45040&r2=45041&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Fri Dec 14 14:08:14 2007 @@ -280,7 +280,7 @@ { X86::MOVAPDrr, X86::MOVAPDmr, 0 }, { X86::MOVAPSrr, X86::MOVAPSmr, 0 }, { X86::MOVPDI2DIrr, X86::MOVPDI2DImr, 0 }, - { X86::MOVPQIto64rr,X86::MOVPQIto64mr, 0 }, + { X86::MOVPQIto64rr,X86::MOVPQI2QImr, 0 }, { X86::MOVPS2SSrr, X86::MOVPS2SSmr, 0 }, { X86::MOVSDrr, X86::MOVSDmr, 0 }, { X86::MOVSDto64rr, X86::MOVSDto64mr, 0 }, @@ -387,7 +387,7 @@ { X86::MOV32rr, X86::MOV32rm }, { X86::MOV32to32_, X86::MOV32_rm }, { X86::MOV64rr, X86::MOV64rm }, - { X86::MOV64toPQIrr, X86::MOV64toPQIrm }, + { X86::MOV64toPQIrr, X86::MOVQI2PQIrm }, { X86::MOV64toSDrr, X86::MOV64toSDrm }, { X86::MOV8rr, X86::MOV8rm }, { X86::MOVAPDrr, X86::MOVAPDrm }, From dalej at apple.com Fri Dec 14 16:01:58 2007 From: dalej at apple.com (Dale Johannesen) Date: Fri, 14 Dec 2007 22:01:58 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r45042 - in /llvm-gcc-4.2/trunk/gcc: llvm-backend.cpp llvm-convert.cpp llvm.h Message-ID: <200712142201.lBEM1wWx000436@zion.cs.uiuc.edu> Author: johannes Date: Fri Dec 14 16:01:57 2007 New Revision: 45042 URL: http://llvm.org/viewvc/llvm-project?rev=45042&view=rev Log: Compensate for a representation change in register names between gcc4.0 and 4.2, thus making asm handling be only partially broken, as in 4.0. Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp llvm-gcc-4.2/trunk/gcc/llvm.h Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=45042&r1=45041&r2=45042&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Fri Dec 14 16:01:57 2007 @@ -913,8 +913,7 @@ /// well-formed. If not, emit error messages and return true. If so, return /// false. bool ValidateRegisterVariable(tree decl) { - const char *Name = IDENTIFIER_POINTER(DECL_ASSEMBLER_NAME(decl)); - int RegNumber = decode_reg_name(Name); + int RegNumber = decode_reg_name(llvm_get_register_name(decl)); const Type *Ty = ConvertType(TREE_TYPE(decl)); // If this has already been processed, don't emit duplicate error messages. @@ -1246,4 +1245,12 @@ WriteTypeSymbolic(FS, (const Type*)LLVM, TheModule); } +// Get a register name given its decl. In 4.2 unlike 4.0 these names +// have been run through set_user_assembler_name which means they may +// have a leading \1 at this point; compensate. + +const char* llvm_get_register_name(tree decl) { + const char* Name = IDENTIFIER_POINTER(DECL_ASSEMBLER_NAME(decl)); + return (*Name==1) ? Name+1 : Name; +} /* LLVM LOCAL end (ENTIRE FILE!) */ Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=45042&r1=45041&r2=45042&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Fri Dec 14 16:01:57 2007 @@ -3305,7 +3305,7 @@ // Turn this into a 'tmp = call Ty asm "", "={reg}"()'. FunctionType *FTy = FunctionType::get(Ty, std::vector(),false); - const char *Name = IDENTIFIER_POINTER(DECL_ASSEMBLER_NAME(decl)); + const char *Name = llvm_get_register_name(decl); InlineAsm *IA = InlineAsm::get(FTy, "", "={"+std::string(Name)+"}", false); return Builder.CreateCall(IA, "tmp"); } @@ -3322,7 +3322,7 @@ ArgTys.push_back(ConvertType(TREE_TYPE(decl))); FunctionType *FTy = FunctionType::get(Type::VoidTy, ArgTys, false); - const char *Name = IDENTIFIER_POINTER(DECL_ASSEMBLER_NAME(decl)); + const char *Name = llvm_get_register_name(decl); InlineAsm *IA = InlineAsm::get(FTy, "", "{"+std::string(Name)+"}", true); Builder.CreateCall(IA, RHS); } @@ -3571,8 +3571,7 @@ // If this output register is pinned to a machine register, use that machine // register instead of the specified constraint. if (TREE_CODE(Operand) == VAR_DECL && DECL_HARD_REGISTER(Operand)) { - int RegNum = - decode_reg_name(IDENTIFIER_POINTER(DECL_ASSEMBLER_NAME(Operand))); + int RegNum = decode_reg_name(llvm_get_register_name(Operand)); if (RegNum >= 0) { unsigned RegNameLen = strlen(reg_names[RegNum]); char *NewConstraint = (char*)alloca(RegNameLen+4); @@ -3684,8 +3683,7 @@ // register instead of the specified constraint. int RegNum; if (TREE_CODE(Val) == VAR_DECL && DECL_HARD_REGISTER(Val) && - (RegNum = - decode_reg_name(IDENTIFIER_POINTER(DECL_ASSEMBLER_NAME(Val)))) >= 0) { + (RegNum = decode_reg_name(llvm_get_register_name(Val))) >= 0) { ConstraintStr += '{'; ConstraintStr += reg_names[RegNum]; ConstraintStr += '}'; Modified: llvm-gcc-4.2/trunk/gcc/llvm.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm.h?rev=45042&r1=45041&r2=45042&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm.h (original) +++ llvm-gcc-4.2/trunk/gcc/llvm.h Fri Dec 14 16:01:57 2007 @@ -106,6 +106,10 @@ */ void refine_type_to (union tree_node*, union tree_node*); +/* llvm_get_register_name - extract a register name from a decl in format + * pleasing to llvm. + */ +const char* llvm_get_register_name(union tree_node*); #endif /* ENABLE_LLVM */ #endif From baldrick at free.fr Fri Dec 14 16:19:58 2007 From: baldrick at free.fr (Duncan Sands) Date: Fri, 14 Dec 2007 23:19:58 +0100 Subject: [llvm-commits] [llvm-gcc-4.2] r45042 - in /llvm-gcc-4.2/trunk/gcc: llvm-backend.cpp llvm-convert.cpp llvm.h In-Reply-To: <200712142201.lBEM1wWx000436@zion.cs.uiuc.edu> References: <200712142201.lBEM1wWx000436@zion.cs.uiuc.edu> Message-ID: <200712142319.58316.baldrick@free.fr> Hi Dale, > + int RegNumber = decode_reg_name(llvm_get_register_name(decl)); since it's only used in llvm*.cpp files, doesn't it belong in llvm-internal.h rather than llvm.h? At which point it might as well be named something like ExtractRegisterName. Ciao, Duncan. From dalej at apple.com Fri Dec 14 17:16:28 2007 From: dalej at apple.com (Dale Johannesen) Date: Fri, 14 Dec 2007 23:16:28 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r45044 - in /llvm-gcc-4.2/trunk/gcc: llvm-backend.cpp llvm-convert.cpp llvm-internal.h llvm.h Message-ID: <200712142316.lBENGSQ3008457@zion.cs.uiuc.edu> Author: johannes Date: Fri Dec 14 17:16:27 2007 New Revision: 45044 URL: http://llvm.org/viewvc/llvm-project?rev=45044&view=rev Log: Revise previous patch per review feedback. Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp llvm-gcc-4.2/trunk/gcc/llvm-internal.h llvm-gcc-4.2/trunk/gcc/llvm.h Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=45044&r1=45043&r2=45044&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Fri Dec 14 17:16:27 2007 @@ -913,7 +913,7 @@ /// well-formed. If not, emit error messages and return true. If so, return /// false. bool ValidateRegisterVariable(tree decl) { - int RegNumber = decode_reg_name(llvm_get_register_name(decl)); + int RegNumber = decode_reg_name(extractRegisterName(decl)); const Type *Ty = ConvertType(TREE_TYPE(decl)); // If this has already been processed, don't emit duplicate error messages. @@ -1249,7 +1249,7 @@ // have been run through set_user_assembler_name which means they may // have a leading \1 at this point; compensate. -const char* llvm_get_register_name(tree decl) { +const char* extractRegisterName(tree decl) { const char* Name = IDENTIFIER_POINTER(DECL_ASSEMBLER_NAME(decl)); return (*Name==1) ? Name+1 : Name; } Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=45044&r1=45043&r2=45044&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Fri Dec 14 17:16:27 2007 @@ -3305,7 +3305,7 @@ // Turn this into a 'tmp = call Ty asm "", "={reg}"()'. FunctionType *FTy = FunctionType::get(Ty, std::vector(),false); - const char *Name = llvm_get_register_name(decl); + const char *Name = extractRegisterName(decl); InlineAsm *IA = InlineAsm::get(FTy, "", "={"+std::string(Name)+"}", false); return Builder.CreateCall(IA, "tmp"); } @@ -3322,7 +3322,7 @@ ArgTys.push_back(ConvertType(TREE_TYPE(decl))); FunctionType *FTy = FunctionType::get(Type::VoidTy, ArgTys, false); - const char *Name = llvm_get_register_name(decl); + const char *Name = extractRegisterName(decl); InlineAsm *IA = InlineAsm::get(FTy, "", "{"+std::string(Name)+"}", true); Builder.CreateCall(IA, RHS); } @@ -3571,7 +3571,7 @@ // If this output register is pinned to a machine register, use that machine // register instead of the specified constraint. if (TREE_CODE(Operand) == VAR_DECL && DECL_HARD_REGISTER(Operand)) { - int RegNum = decode_reg_name(llvm_get_register_name(Operand)); + int RegNum = decode_reg_name(extractRegisterName(Operand)); if (RegNum >= 0) { unsigned RegNameLen = strlen(reg_names[RegNum]); char *NewConstraint = (char*)alloca(RegNameLen+4); @@ -3683,7 +3683,7 @@ // register instead of the specified constraint. int RegNum; if (TREE_CODE(Val) == VAR_DECL && DECL_HARD_REGISTER(Val) && - (RegNum = decode_reg_name(llvm_get_register_name(Val))) >= 0) { + (RegNum = decode_reg_name(extractRegisterName(Val))) >= 0) { ConstraintStr += '{'; ConstraintStr += reg_names[RegNum]; ConstraintStr += '}'; Modified: llvm-gcc-4.2/trunk/gcc/llvm-internal.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-internal.h?rev=45044&r1=45043&r2=45044&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-internal.h (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-internal.h Fri Dec 14 17:16:27 2007 @@ -110,6 +110,7 @@ void readLLVMValues(); void writeLLVMValues(); void clearTargetBuiltinCache(); +const char* extractRegisterName(union tree_node*); struct StructTypeConversionInfo; Modified: llvm-gcc-4.2/trunk/gcc/llvm.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm.h?rev=45044&r1=45043&r2=45044&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm.h (original) +++ llvm-gcc-4.2/trunk/gcc/llvm.h Fri Dec 14 17:16:27 2007 @@ -105,11 +105,6 @@ * to the more concrete type new_type. */ void refine_type_to (union tree_node*, union tree_node*); - -/* llvm_get_register_name - extract a register name from a decl in format - * pleasing to llvm. - */ -const char* llvm_get_register_name(union tree_node*); #endif /* ENABLE_LLVM */ #endif From dalej at apple.com Fri Dec 14 17:17:26 2007 From: dalej at apple.com (Dale Johannesen) Date: Fri, 14 Dec 2007 23:17:26 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r45045 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Message-ID: <200712142317.lBENHQah008595@zion.cs.uiuc.edu> Author: johannes Date: Fri Dec 14 17:17:25 2007 New Revision: 45045 URL: http://llvm.org/viewvc/llvm-project?rev=45045&view=rev Log: Fix a testsuite bug, described in comments. Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=45045&r1=45044&r2=45045&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Fri Dec 14 17:17:25 2007 @@ -1068,7 +1068,14 @@ RAttributes |= ParamAttr::NoUnwind; // Check for 'readnone' function attribute. - if (flags & ECF_CONST) + // Both PURE and CONST will be set if the user applied + // __attribute__((const)) to a function the compiler + // knows to be pure, such as log. A user or (more + // likely) libm implementor might know their local log + // is in fact const, so this should be valid (and gcc + // accepts it). But llvm IR does not allow both, so + // set only ReadNone. + if (flags & ECF_CONST && !(flags & ECF_PURE)) // Since they write the return value through a pointer, // 'sret' functions cannot be 'readnone'. if (!ABIConverter.isStructReturn()) From evan.cheng at apple.com Fri Dec 14 18:13:37 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Sat, 15 Dec 2007 00:13:37 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r45048 - /llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Message-ID: <200712150013.lBF0DbKP012544@zion.cs.uiuc.edu> Author: evancheng Date: Fri Dec 14 18:13:36 2007 New Revision: 45048 URL: http://llvm.org/viewvc/llvm-project?rev=45048&view=rev Log: Expand __builtin_ia32_movqv4si (aka IX86_BUILTIN_MOVQ / _mm_move_epi64) into a shuffle. Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=45048&r1=45047&r2=45048&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Fri Dec 14 18:13:36 2007 @@ -375,6 +375,12 @@ case IX86_BUILTIN_MOVSS: Result = BuildVectorShuffle(Ops[0], Ops[1], 4, 1, 2, 3); return true; + case IX86_BUILTIN_MOVQ: { + Value *Zero = ConstantInt::get(Type::Int32Ty, 0); + Ops[1] = BuildVector(Zero, Zero, Zero, Zero, NULL); + Result = BuildVectorShuffle(Ops[1], Ops[0], 4, 5, 2, 3); + return true; + } case IX86_BUILTIN_LOADQ: { PointerType *f64Ptr = PointerType::get(Type::DoubleTy); Value *Zero = ConstantFP::get(Type::DoubleTy, APFloat(0.0)); From evan.cheng at apple.com Fri Dec 14 18:13:55 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Sat, 15 Dec 2007 00:13:55 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r45049 - /llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp Message-ID: <200712150013.lBF0Dt89012578@zion.cs.uiuc.edu> Author: evancheng Date: Fri Dec 14 18:13:55 2007 New Revision: 45049 URL: http://llvm.org/viewvc/llvm-project?rev=45049&view=rev Log: Expand __builtin_ia32_movqv4si (aka IX86_BUILTIN_MOVQ / _mm_move_epi64) into a shuffle. Modified: llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp Modified: llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp?rev=45049&r1=45048&r2=45049&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp Fri Dec 14 18:13:55 2007 @@ -375,6 +375,12 @@ case IX86_BUILTIN_MOVSS: Result = BuildVectorShuffle(Ops[0], Ops[1], 4, 1, 2, 3); return true; + case IX86_BUILTIN_MOVQ: { + Value *Zero = ConstantInt::get(Type::Int32Ty, 0); + Ops[1] = BuildVector(Zero, Zero, Zero, Zero, NULL); + Result = BuildVectorShuffle(Ops[1], Ops[0], 4, 5, 2, 3); + return true; + } case IX86_BUILTIN_LOADQ: { PointerType *f64Ptr = PointerType::get(Type::DoubleTy); Value *Zero = ConstantFP::get(Type::DoubleTy, APFloat(0.0)); From scottm at aero.org Fri Dec 14 18:38:51 2007 From: scottm at aero.org (Scott Michel) Date: Sat, 15 Dec 2007 00:38:51 -0000 Subject: [llvm-commits] [llvm] r45050 - in /llvm/trunk: lib/Target/CellSPU/SPU.h lib/Target/CellSPU/SPUISelDAGToDAG.cpp lib/Target/CellSPU/SPUInstrInfo.td lib/Target/CellSPU/SPUOperands.td test/CodeGen/CellSPU/ test/CodeGen/CellSPU/and_ops.ll Message-ID: <200712150038.lBF0cpAJ014663@zion.cs.uiuc.edu> Author: pingbak Date: Fri Dec 14 18:38:50 2007 New Revision: 45050 URL: http://llvm.org/viewvc/llvm-project?rev=45050&view=rev Log: Start committing working test cases for CellSPU. Added: llvm/trunk/test/CodeGen/CellSPU/ llvm/trunk/test/CodeGen/CellSPU/and_ops.ll Modified: llvm/trunk/lib/Target/CellSPU/SPU.h llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.td llvm/trunk/lib/Target/CellSPU/SPUOperands.td Modified: llvm/trunk/lib/Target/CellSPU/SPU.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPU.h?rev=45050&r1=45049&r2=45050&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPU.h (original) +++ llvm/trunk/lib/Target/CellSPU/SPU.h Fri Dec 14 18:38:50 2007 @@ -25,7 +25,7 @@ FunctionPass *createSPUISelDag(SPUTargetMachine &TM); FunctionPass *createSPUAsmPrinterPass(std::ostream &o, SPUTargetMachine &tm); - /* Utility functions/predicates/etc used all over the place: */ + /*--== Utility functions/predicates/etc used all over the place: --==*/ //! Predicate test for a signed 10-bit value /*! \param Value The input value to be tested @@ -54,6 +54,33 @@ inline bool isS10Constant(uint64_t Value) { return (Value <= ((1 << 9) - 1)); } + + //! Predicate test for an unsigned 10-bit value + /*! + \param Value The input value to be tested + + This predicate tests for an unsigned 10-bit value, returning the 10-bit value + as a short if true. + */ + inline bool isU10Constant(short Value) { + return (Value == (Value & 0x3ff)); + } + + inline bool isU10Constant(int Value) { + return (Value == (Value & 0x3ff)); + } + + inline bool isU10Constant(uint32_t Value) { + return (Value == (Value & 0x3ff)); + } + + inline bool isU10Constant(int64_t Value) { + return (Value == (Value & 0x3ff)); + } + + inline bool isU10Constant(uint64_t Value) { + return (Value == (Value & 0x3ff)); + } } // Defines symbolic names for the SPU instructions. Modified: llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp?rev=45050&r1=45049&r2=45050&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp (original) +++ llvm/trunk/lib/Target/CellSPU/SPUISelDAGToDAG.cpp Fri Dec 14 18:38:50 2007 @@ -78,6 +78,21 @@ && isI16IntS10Immediate(cast(N))); } + //! ConstantSDNode predicate for i16 unsigned 10-bit immediate values + bool + isI16IntU10Immediate(ConstantSDNode *CN) + { + return isU10Constant((short) CN->getValue()); + } + + //! SDNode predicate for i16 sign-extended, 10-bit immediate values + bool + isI16IntU10Immediate(SDNode *N) + { + return (N->getOpcode() == ISD::Constant + && isI16IntU10Immediate(cast(N))); + } + //! ConstantSDNode predicate for signed 16-bit values /*! \arg CN The constant SelectionDAG node holding the value Modified: llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.td?rev=45050&r1=45049&r2=45050&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.td (original) +++ llvm/trunk/lib/Target/CellSPU/SPUInstrInfo.td Fri Dec 14 18:38:50 2007 @@ -1127,7 +1127,7 @@ def ANDHIr16: RI10Form<0b10101000, (outs R16C:$rT), (ins R16C:$rA, s10imm:$val), "andhi\t$rT, $rA, $val", IntegerOp, - [(set R16C:$rT, (and R16C:$rA, i16ImmSExt10:$val))]>; + [(set R16C:$rT, (and R16C:$rA, i16ImmU10:$val))]>; def ANDIv4i32: RI10Form<0b00101000, (outs VECREG:$rT), (ins VECREG:$rA, s10imm:$val), Modified: llvm/trunk/lib/Target/CellSPU/SPUOperands.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUOperands.td?rev=45050&r1=45049&r2=45050&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUOperands.td (original) +++ llvm/trunk/lib/Target/CellSPU/SPUOperands.td Fri Dec 14 18:38:50 2007 @@ -99,12 +99,18 @@ return isI32IntS10Immediate(N); }]>; -// i16ImmSExt10 predicate - True if the i32 immediate fits in a 10-bit sign +// i16ImmSExt10 predicate - True if the i16 immediate fits in a 10-bit sign // extended field. Used by RI10Form instructions like 'ldq'. def i16ImmSExt10 : PatLeaf<(imm), [{ return isI16IntS10Immediate(N); }]>; +// i16ImmU10 predicate - True if the i16 immediate fits into a 10-bit unsigned +// value. Used by RI10Form instructions. +def i16ImmU10 : PatLeaf<(imm), [{ + return isI16IntU10Immediate(N); +}]>; + def immSExt16 : PatLeaf<(imm), [{ // immSExt16 predicate - True if the immediate fits in a 16-bit sign extended // field. @@ -206,7 +212,7 @@ }], FPimm_u18>; //===----------------------------------------------------------------------===// -// 64-bit operands: +// 64-bit operands (TODO): //===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===// Added: llvm/trunk/test/CodeGen/CellSPU/and_ops.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/CellSPU/and_ops.ll?rev=45050&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/CellSPU/and_ops.ll (added) +++ llvm/trunk/test/CodeGen/CellSPU/and_ops.ll Fri Dec 14 18:38:50 2007 @@ -0,0 +1,270 @@ +; RUN: llvm-as -o - %s | llc -march=cellspu > %t1.s +; RUN: grep and %t1.s | count 227 +; RUN: grep andc %t1.s | count 85 +; RUN: grep andi %t1.s | count 36 +; RUN: grep andhi %t1.s | count 31 +; RUN: grep andbi %t1.s | count 1 + +; AND instruction generation: +define <4 x i32> @and_v4i32_1(<4 x i32> %arg1, <4 x i32> %arg2) { + %A = and <4 x i32> %arg1, %arg2 + ret <4 x i32> %A +} + +define <4 x i32> @and_v4i32_2(<4 x i32> %arg1, <4 x i32> %arg2) { + %A = and <4 x i32> %arg2, %arg1 + ret <4 x i32> %A +} + +define <8 x i16> @and_v8i16_1(<8 x i16> %arg1, <8 x i16> %arg2) { + %A = and <8 x i16> %arg1, %arg2 + ret <8 x i16> %A +} + +define <8 x i16> @and_v8i16_2(<8 x i16> %arg1, <8 x i16> %arg2) { + %A = and <8 x i16> %arg2, %arg1 + ret <8 x i16> %A +} + +define <16 x i8> @and_v16i8_1(<16 x i8> %arg1, <16 x i8> %arg2) { + %A = and <16 x i8> %arg2, %arg1 + ret <16 x i8> %A +} + +define <16 x i8> @and_v16i8_2(<16 x i8> %arg1, <16 x i8> %arg2) { + %A = and <16 x i8> %arg1, %arg2 + ret <16 x i8> %A +} + +define i32 @and_i32_1(i32 %arg1, i32 %arg2) { + %A = and i32 %arg2, %arg1 + ret i32 %A +} + +define i32 @and_i32_2(i32 %arg1, i32 %arg2) { + %A = and i32 %arg1, %arg2 + ret i32 %A +} + +define i16 @and_i16_1(i16 %arg1, i16 %arg2) { + %A = and i16 %arg2, %arg1 + ret i16 %A +} + +define i16 @and_i16_2(i16 %arg1, i16 %arg2) { + %A = and i16 %arg1, %arg2 + ret i16 %A +} + +define i8 @and_i8_1(i8 %arg1, i8 %arg2) { + %A = and i8 %arg2, %arg1 + ret i8 %A +} + +define i8 @and_i8_2(i8 %arg1, i8 %arg2) { + %A = and i8 %arg1, %arg2 + ret i8 %A +} + +; ANDC instruction generation: +define <4 x i32> @andc_v4i32_1(<4 x i32> %arg1, <4 x i32> %arg2) { + %A = xor <4 x i32> %arg2, < i32 -1, i32 -1, i32 -1, i32 -1 > + %B = and <4 x i32> %arg1, %A + ret <4 x i32> %B +} + +define <4 x i32> @andc_v4i32_2(<4 x i32> %arg1, <4 x i32> %arg2) { + %A = xor <4 x i32> %arg1, < i32 -1, i32 -1, i32 -1, i32 -1 > + %B = and <4 x i32> %arg2, %A + ret <4 x i32> %B +} + +define <4 x i32> @andc_v4i32_3(<4 x i32> %arg1, <4 x i32> %arg2) { + %A = xor <4 x i32> %arg1, < i32 -1, i32 -1, i32 -1, i32 -1 > + %B = and <4 x i32> %A, %arg2 + ret <4 x i32> %B +} + +define <8 x i16> @andc_v8i16_1(<8 x i16> %arg1, <8 x i16> %arg2) { + %A = xor <8 x i16> %arg2, < i16 -1, i16 -1, i16 -1, i16 -1, + i16 -1, i16 -1, i16 -1, i16 -1 > + %B = and <8 x i16> %arg1, %A + ret <8 x i16> %B +} + +define <8 x i16> @andc_v8i16_2(<8 x i16> %arg1, <8 x i16> %arg2) { + %A = xor <8 x i16> %arg1, < i16 -1, i16 -1, i16 -1, i16 -1, + i16 -1, i16 -1, i16 -1, i16 -1 > + %B = and <8 x i16> %arg2, %A + ret <8 x i16> %B +} + +define <16 x i8> @andc_v16i8_1(<16 x i8> %arg1, <16 x i8> %arg2) { + %A = xor <16 x i8> %arg1, < i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, + i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, + i8 -1, i8 -1, i8 -1, i8 -1 > + %B = and <16 x i8> %arg2, %A + ret <16 x i8> %B +} + +define <16 x i8> @andc_v16i8_2(<16 x i8> %arg1, <16 x i8> %arg2) { + %A = xor <16 x i8> %arg2, < i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, + i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, + i8 -1, i8 -1, i8 -1, i8 -1 > + %B = and <16 x i8> %arg1, %A + ret <16 x i8> %B +} + +define <16 x i8> @andc_v16i8_3(<16 x i8> %arg1, <16 x i8> %arg2) { + %A = xor <16 x i8> %arg2, < i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, + i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, + i8 -1, i8 -1, i8 -1, i8 -1 > + %B = and <16 x i8> %A, %arg1 + ret <16 x i8> %B +} + +define i32 @andc_i32_1(i32 %arg1, i32 %arg2) { + %A = xor i32 %arg2, -1 + %B = and i32 %A, %arg1 + ret i32 %B +} + +define i32 @andc_i32_2(i32 %arg1, i32 %arg2) { + %A = xor i32 %arg1, -1 + %B = and i32 %A, %arg2 + ret i32 %B +} + +define i32 @andc_i32_3(i32 %arg1, i32 %arg2) { + %A = xor i32 %arg2, -1 + %B = and i32 %arg1, %A + ret i32 %B +} + +define i16 @andc_i16_1(i16 %arg1, i16 %arg2) { + %A = xor i16 %arg2, -1 + %B = and i16 %A, %arg1 + ret i16 %B +} + +define i16 @andc_i16_2(i16 %arg1, i16 %arg2) { + %A = xor i16 %arg1, -1 + %B = and i16 %A, %arg2 + ret i16 %B +} + +define i16 @andc_i16_3(i16 %arg1, i16 %arg2) { + %A = xor i16 %arg2, -1 + %B = and i16 %arg1, %A + ret i16 %B +} + +define i8 @andc_i8_1(i8 %arg1, i8 %arg2) { + %A = xor i8 %arg2, -1 + %B = and i8 %A, %arg1 + ret i8 %B +} + +define i8 @andc_i8_2(i8 %arg1, i8 %arg2) { + %A = xor i8 %arg1, -1 + %B = and i8 %A, %arg2 + ret i8 %B +} + +define i8 @andc_i8_3(i8 %arg1, i8 %arg2) { + %A = xor i8 %arg2, -1 + %B = and i8 %arg1, %A + ret i8 %B +} + +; ANDI instruction generation (i32 data type): +define <4 x i32> @andi_v4i32_1(<4 x i32> %in) { + %tmp2 = and <4 x i32> %in, < i32 511, i32 511, i32 511, i32 511 > + ret <4 x i32> %tmp2 +} + +define <4 x i32> @andi_v4i32_2(<4 x i32> %in) { + %tmp2 = and <4 x i32> %in, < i32 510, i32 510, i32 510, i32 510 > + ret <4 x i32> %tmp2 +} + +define <4 x i32> @andi_v4i32_3(<4 x i32> %in) { + %tmp2 = and <4 x i32> %in, < i32 -1, i32 -1, i32 -1, i32 -1 > + ret <4 x i32> %tmp2 +} + +define <4 x i32> @andi_v4i32_4(<4 x i32> %in) { + %tmp2 = and <4 x i32> %in, < i32 -512, i32 -512, i32 -512, i32 -512 > + ret <4 x i32> %tmp2 +} + +define i32 @andi_u32(i32 zeroext %in) zeroext { + %tmp37 = and i32 %in, 37 + ret i32 %tmp37 +} + +define i32 @andi_i32(i32 signext %in) signext { + %tmp38 = and i32 %in, 37 + ret i32 %tmp38 +} + +define i32 @andi_i32_1(i32 %in) { + %tmp37 = and i32 %in, 37 + ret i32 %tmp37 +} + +; ANDHI instruction generation (i16 data type): +define <8 x i16> @andhi_v8i16_1(<8 x i16> %in) { + %tmp2 = and <8 x i16> %in, < i16 511, i16 511, i16 511, i16 511, + i16 511, i16 511, i16 511, i16 511 > + ret <8 x i16> %tmp2 +} + +define <8 x i16> @andhi_v8i16_2(<8 x i16> %in) { + %tmp2 = and <8 x i16> %in, < i16 510, i16 510, i16 510, i16 510, + i16 510, i16 510, i16 510, i16 510 > + ret <8 x i16> %tmp2 +} + +define <8 x i16> @andhi_v8i16_3(<8 x i16> %in) { + %tmp2 = and <8 x i16> %in, < i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, + i16 -1, i16 -1, i16 -1 > + ret <8 x i16> %tmp2 +} + +define <8 x i16> @andhi_v8i16_4(<8 x i16> %in) { + %tmp2 = and <8 x i16> %in, < i16 -512, i16 -512, i16 -512, i16 -512, + i16 -512, i16 -512, i16 -512, i16 -512 > + ret <8 x i16> %tmp2 +} + +define i16 @andhi_u16(i16 zeroext %in) zeroext { + %tmp37 = and i16 %in, 37 ; [#uses=1] + ret i16 %tmp37 +} + +define i16 @andhi_i16(i16 signext %in) signext { + %tmp38 = and i16 %in, 37 ; [#uses=1] + ret i16 %tmp38 +} + +; i8 data type (s/b ANDBI if 8-bit registers were supported): +define <16 x i8> @and_v16i8(<16 x i8> %in) { + ; ANDBI generated for vector types + %tmp2 = and <16 x i8> %in, < i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, + i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, + i8 42, i8 42, i8 42, i8 42 > + ret <16 x i8> %tmp2 +} + +define i8 @and_u8(i8 zeroext %in) zeroext { + ; ANDI generated: + %tmp37 = and i8 %in, 37 ; [#uses=1] + ret i8 %tmp37 +} + +define i8 @and_i8(i8 signext %in) signext { + ; ANDHI generated + %tmp38 = and i8 %in, 37 ; [#uses=1] + ret i8 %tmp38 +} From dalej at apple.com Fri Dec 14 19:29:30 2007 From: dalej at apple.com (Dale Johannesen) Date: Sat, 15 Dec 2007 01:29:30 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r45052 - in /llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute: 20051012-1.x 920501-1.x 921202-1.x 921208-2.x Message-ID: <200712150129.lBF1TVjv016994@zion.cs.uiuc.edu> Author: johannes Date: Fri Dec 14 19:29:30 2007 New Revision: 45052 URL: http://llvm.org/viewvc/llvm-project?rev=45052&view=rev Log: Suppress some incorrect tests for llvm. Added: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/20051012-1.x llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/920501-1.x llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/921202-1.x llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/921208-2.x Added: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/20051012-1.x URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/20051012-1.x?rev=45052&view=auto ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/20051012-1.x (added) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/20051012-1.x Fri Dec 14 19:29:30 2007 @@ -0,0 +1,12 @@ +# This test has a mismatch between caller and callee arguments. +# llvm gives a warning that cannot be suppressed. There seems to +# be no way to tell the testsuite to ignore the warning, so +# suppress the test. + +load_lib target-supports.exp + +if { [is_llvm] } { + return 1 +} + +return 0 Added: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/920501-1.x URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/920501-1.x?rev=45052&view=auto ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/920501-1.x (added) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/920501-1.x Fri Dec 14 19:29:30 2007 @@ -0,0 +1,12 @@ +# This test has a mismatch between caller and callee arguments. +# llvm gives a warning that cannot be suppressed. There seems to +# be no way to tell the testsuite to ignore the warning, so +# suppress the test. + +load_lib target-supports.exp + +if { [is_llvm] } { + return 1 +} + +return 0 Added: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/921202-1.x URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/921202-1.x?rev=45052&view=auto ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/921202-1.x (added) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/921202-1.x Fri Dec 14 19:29:30 2007 @@ -0,0 +1,12 @@ +# This test has a mismatch between caller and callee arguments. +# llvm gives a warning that cannot be suppressed. There seems to +# be no way to tell the testsuite to ignore the warning, so +# suppress the test. + +load_lib target-supports.exp + +if { [is_llvm] } { + return 1 +} + +return 0 Added: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/921208-2.x URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/921208-2.x?rev=45052&view=auto ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/921208-2.x (added) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/921208-2.x Fri Dec 14 19:29:30 2007 @@ -0,0 +1,12 @@ +# This test has a mismatch between caller and callee arguments. +# llvm gives a warning that cannot be suppressed. There seems to +# be no way to tell the testsuite to ignore the warning, so +# suppress the test. + +load_lib target-supports.exp + +if { [is_llvm] } { + return 1 +} + +return 0 From dalej at apple.com Fri Dec 14 19:30:04 2007 From: dalej at apple.com (Dale Johannesen) Date: Sat, 15 Dec 2007 01:30:04 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r45053 - in /llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/unsorted: call.x pass.x Message-ID: <200712150130.lBF1U4jZ017032@zion.cs.uiuc.edu> Author: johannes Date: Fri Dec 14 19:30:04 2007 New Revision: 45053 URL: http://llvm.org/viewvc/llvm-project?rev=45053&view=rev Log: Suppress some incorrect tests for llvm. Added: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/unsorted/call.x llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/unsorted/pass.x Added: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/unsorted/call.x URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/unsorted/call.x?rev=45053&view=auto ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/unsorted/call.x (added) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/unsorted/call.x Fri Dec 14 19:30:04 2007 @@ -0,0 +1,12 @@ +# This test has a mismatch between caller and callee arguments. +# llvm gives a warning that cannot be suppressed. There seems to +# be no way to tell the testsuite to ignore the warning, so +# suppress the test. + +load_lib target-supports.exp + +if { [is_llvm] } { + return 1 +} + +return 0 Added: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/unsorted/pass.x URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/unsorted/pass.x?rev=45053&view=auto ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/unsorted/pass.x (added) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/unsorted/pass.x Fri Dec 14 19:30:04 2007 @@ -0,0 +1,12 @@ +# This test has a mismatch between caller and callee arguments. +# llvm gives a warning that cannot be suppressed. There seems to +# be no way to tell the testsuite to ignore the warning, so +# suppress the test. + +load_lib target-supports.exp + +if { [is_llvm] } { + return 1 +} + +return 0 From dalej at apple.com Fri Dec 14 19:30:32 2007 From: dalej at apple.com (Dale Johannesen) Date: Sat, 15 Dec 2007 01:30:32 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r45054 - /llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/compile/930411-1.c Message-ID: <200712150130.lBF1UWoS017082@zion.cs.uiuc.edu> Author: johannes Date: Fri Dec 14 19:30:32 2007 New Revision: 45054 URL: http://llvm.org/viewvc/llvm-project?rev=45054&view=rev Log: Suppress a valid warning for llvm. Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/compile/930411-1.c Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/compile/930411-1.c URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/compile/930411-1.c?rev=45054&r1=45053&r2=45054&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/compile/930411-1.c (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/compile/930411-1.c Fri Dec 14 19:30:32 2007 @@ -34,3 +34,5 @@ i1 = 1; goto L3; } +/* LLVM LOCAL caller-callee mismatch message can't be suppressed */ +/* { dg-prune-output "arguments were dropped" } */ From dalej at apple.com Fri Dec 14 19:32:24 2007 From: dalej at apple.com (Dale Johannesen) Date: Sat, 15 Dec 2007 01:32:24 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r45055 - in /llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute: 20051012-1.x 920501-1.x 921202-1.x 921208-2.x Message-ID: <200712150132.lBF1WOt6017197@zion.cs.uiuc.edu> Author: johannes Date: Fri Dec 14 19:32:23 2007 New Revision: 45055 URL: http://llvm.org/viewvc/llvm-project?rev=45055&view=rev Log: add local markers Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/20051012-1.x llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/920501-1.x llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/921202-1.x llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/921208-2.x Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/20051012-1.x URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/20051012-1.x?rev=45055&r1=45054&r2=45055&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/20051012-1.x (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/20051012-1.x Fri Dec 14 19:32:23 2007 @@ -1,3 +1,4 @@ +# LLVM LOCAL file # This test has a mismatch between caller and callee arguments. # llvm gives a warning that cannot be suppressed. There seems to # be no way to tell the testsuite to ignore the warning, so Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/920501-1.x URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/920501-1.x?rev=45055&r1=45054&r2=45055&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/920501-1.x (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/920501-1.x Fri Dec 14 19:32:23 2007 @@ -1,3 +1,4 @@ +# LLVM LOCAL file # This test has a mismatch between caller and callee arguments. # llvm gives a warning that cannot be suppressed. There seems to # be no way to tell the testsuite to ignore the warning, so Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/921202-1.x URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/921202-1.x?rev=45055&r1=45054&r2=45055&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/921202-1.x (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/921202-1.x Fri Dec 14 19:32:23 2007 @@ -1,3 +1,4 @@ +# LLVM LOCAL file # This test has a mismatch between caller and callee arguments. # llvm gives a warning that cannot be suppressed. There seems to # be no way to tell the testsuite to ignore the warning, so Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/921208-2.x URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/921208-2.x?rev=45055&r1=45054&r2=45055&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/921208-2.x (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/921208-2.x Fri Dec 14 19:32:23 2007 @@ -1,3 +1,4 @@ +# LLVM LOCAL file # This test has a mismatch between caller and callee arguments. # llvm gives a warning that cannot be suppressed. There seems to # be no way to tell the testsuite to ignore the warning, so From dalej at apple.com Fri Dec 14 19:32:50 2007 From: dalej at apple.com (Dale Johannesen) Date: Sat, 15 Dec 2007 01:32:50 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r45056 - in /llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/unsorted: call.x pass.x Message-ID: <200712150132.lBF1Wpq7017252@zion.cs.uiuc.edu> Author: johannes Date: Fri Dec 14 19:32:50 2007 New Revision: 45056 URL: http://llvm.org/viewvc/llvm-project?rev=45056&view=rev Log: add local markers Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/unsorted/call.x llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/unsorted/pass.x Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/unsorted/call.x URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/unsorted/call.x?rev=45056&r1=45055&r2=45056&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/unsorted/call.x (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/unsorted/call.x Fri Dec 14 19:32:50 2007 @@ -1,3 +1,4 @@ +# LLVM LOCAL file # This test has a mismatch between caller and callee arguments. # llvm gives a warning that cannot be suppressed. There seems to # be no way to tell the testsuite to ignore the warning, so Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/unsorted/pass.x URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/unsorted/pass.x?rev=45056&r1=45055&r2=45056&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/unsorted/pass.x (original) +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/unsorted/pass.x Fri Dec 14 19:32:50 2007 @@ -1,3 +1,4 @@ +# LLVM LOCAL file # This test has a mismatch between caller and callee arguments. # llvm gives a warning that cannot be suppressed. There seems to # be no way to tell the testsuite to ignore the warning, so From echristo at apple.com Fri Dec 14 19:32:44 2007 From: echristo at apple.com (Eric Christopher) Date: Fri, 14 Dec 2007 17:32:44 -0800 Subject: [llvm-commits] [llvm-gcc-4.2] r45052 - in /llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute: 20051012-1.x 920501-1.x 921202-1.x 921208-2.x In-Reply-To: <200712150129.lBF1TVjv016994@zion.cs.uiuc.edu> References: <200712150129.lBF1TVjv016994@zion.cs.uiuc.edu> Message-ID: <06230558-D577-4D20-A2C5-3867E3C31842@apple.com> On Dec 14, 2007, at 5:29 PM, Dale Johannesen wrote: > Author: johannes > Date: Fri Dec 14 19:29:30 2007 > New Revision: 45052 > > URL: http://llvm.org/viewvc/llvm-project?rev=45052&view=rev > Log: > Suppress some incorrect tests for llvm. > > > Added: > llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/20051012-1.x > llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/920501-1.x > llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/921202-1.x > llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/921208-2.x dg-option didn't work? -eric From dalej at apple.com Fri Dec 14 19:45:50 2007 From: dalej at apple.com (Dale Johannesen) Date: Fri, 14 Dec 2007 17:45:50 -0800 Subject: [llvm-commits] [llvm-gcc-4.2] r45052 - in /llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute: 20051012-1.x 920501-1.x 921202-1.x 921208-2.x In-Reply-To: <06230558-D577-4D20-A2C5-3867E3C31842@apple.com> References: <200712150129.lBF1TVjv016994@zion.cs.uiuc.edu> <06230558-D577-4D20-A2C5-3867E3C31842@apple.com> Message-ID: On Dec 14, 2007, at 5:32 PM, Eric Christopher wrote: > > On Dec 14, 2007, at 5:29 PM, Dale Johannesen wrote: > >> Author: johannes >> Date: Fri Dec 14 19:29:30 2007 >> New Revision: 45052 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=45052&view=rev >> Log: >> Suppress some incorrect tests for llvm. >> >> >> Added: >> llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/20051012-1.x >> llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/920501-1.x >> llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/921202-1.x >> llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute/921208-2.x > > dg-option didn't work? No, -w doesn't work to suppress that message (llvm doesn't have a mechanism to suppress it). Considering this is undefined behavior, I'm not convinced this is the wrong thing, although your first reaction would be that -w should suppress everything. I could probably be convinced it should be a hard error though. These tests are incorrect source and I think not running them is OK. What I actually want is not to suppress the message or the test, but to tell the testsuite to ignore the message and proceed. I haven't found a knob that will do that. From echristo at apple.com Fri Dec 14 19:48:58 2007 From: echristo at apple.com (Eric Christopher) Date: Fri, 14 Dec 2007 17:48:58 -0800 Subject: [llvm-commits] [llvm-gcc-4.2] r45052 - in /llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute: 20051012-1.x 920501-1.x 921202-1.x 921208-2.x In-Reply-To: References: <200712150129.lBF1TVjv016994@zion.cs.uiuc.edu> <06230558-D577-4D20-A2C5-3867E3C31842@apple.com> Message-ID: <64BEF195-0FA5-4D76-B3AA-0D6AF346110A@apple.com> > > No, -w doesn't work to suppress that message (llvm doesn't have a > mechanism to > suppress it). Aaah. > Considering this is undefined behavior, I'm not > convinced this is > the wrong thing, although your first reaction would be that -w should > suppress > everything. I could probably be convinced it should be a hard error > though. > > These tests are incorrect source and I think not running them is OK. Well, undefined, not incorrect. I think the tests are valid if undefined C code that the compiler should accept - but maybe warn about. -eric From dalej at apple.com Fri Dec 14 20:04:47 2007 From: dalej at apple.com (Dale Johannesen) Date: Fri, 14 Dec 2007 18:04:47 -0800 Subject: [llvm-commits] [llvm-gcc-4.2] r45052 - in /llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute: 20051012-1.x 920501-1.x 921202-1.x 921208-2.x In-Reply-To: <64BEF195-0FA5-4D76-B3AA-0D6AF346110A@apple.com> References: <200712150129.lBF1TVjv016994@zion.cs.uiuc.edu> <06230558-D577-4D20-A2C5-3867E3C31842@apple.com> <64BEF195-0FA5-4D76-B3AA-0D6AF346110A@apple.com> Message-ID: On Dec 14, 2007, at 5:48 PM, Eric Christopher wrote: >> >> No, -w doesn't work to suppress that message (llvm doesn't have a >> mechanism to >> suppress it). > > Aaah. > >> Considering this is undefined behavior, I'm not >> convinced this is >> the wrong thing, although your first reaction would be that -w should >> suppress >> everything. I could probably be convinced it should be a hard error >> though. >> >> These tests are incorrect source and I think not running them is OK. > > Well, undefined, not incorrect. I think the tests are valid if > undefined C code that the compiler should accept - but maybe warn > about. I'm having trouble with "valid but undefined"....the standard permits a compiler to insert runtime code to check that parameters match in number and type, for example. Not that our compilers do that. (It also permits the program to erase your disk, of course, but what I mentioned is sensible, in fact there are environments that do that.) I'd prefer to accept the warning and run them, but... From echristo at apple.com Fri Dec 14 20:17:55 2007 From: echristo at apple.com (Eric Christopher) Date: Fri, 14 Dec 2007 18:17:55 -0800 Subject: [llvm-commits] [llvm-gcc-4.2] r45052 - in /llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute: 20051012-1.x 920501-1.x 921202-1.x 921208-2.x In-Reply-To: References: <200712150129.lBF1TVjv016994@zion.cs.uiuc.edu> <06230558-D577-4D20-A2C5-3867E3C31842@apple.com> <64BEF195-0FA5-4D76-B3AA-0D6AF346110A@apple.com> Message-ID: <3D231E10-2065-4E59-9718-8C9320B0C132@apple.com> > > > I'm having trouble with "valid but undefined"....the standard permits > a compiler > to insert runtime code to check that parameters match in number and > type, > for example. Not that our compilers do that. (It also permits the > program to > erase your disk, of course, but what I mentioned is sensible, in fact > there are > environments that do that.) > > I'd prefer to accept the warning and run them, but... :) Perhaps an llvm option for "Yes yes, shut up about the possibly bad code"? :) -eric From evan.cheng at apple.com Fri Dec 14 21:00:47 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Sat, 15 Dec 2007 03:00:47 -0000 Subject: [llvm-commits] [llvm] r45058 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86InstrSSE.td lib/Target/X86/X86RegisterInfo.cpp test/CodeGen/X86/vec_set-5.ll test/CodeGen/X86/vec_set-7.ll test/CodeGen/X86/vec_shuffle-14.ll test/CodeGen/X86/vec_shuffle-15.ll Message-ID: <200712150300.lBF30mw2021544@zion.cs.uiuc.edu> Author: evancheng Date: Fri Dec 14 21:00:47 2007 New Revision: 45058 URL: http://llvm.org/viewvc/llvm-project?rev=45058&view=rev Log: Make better use of instructions that clear high bits; fix various 2-wide shuffle bugs. Added: llvm/trunk/test/CodeGen/X86/vec_shuffle-14.ll llvm/trunk/test/CodeGen/X86/vec_shuffle-15.ll Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp llvm/trunk/lib/Target/X86/X86InstrSSE.td llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp llvm/trunk/test/CodeGen/X86/vec_set-5.ll llvm/trunk/test/CodeGen/X86/vec_set-7.ll Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=45058&r1=45057&r2=45058&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Dec 14 21:00:47 2007 @@ -3138,8 +3138,6 @@ return V; } -/// is4WideVector - Returns true if the specific v8i16 or v16i8 vector is -/// actually just a 4 wide vector. e.g. SDOperand X86TargetLowering::LowerBUILD_VECTOR(SDOperand Op, SelectionDAG &DAG) { // All zero's are handled with pxor, all one's are handled with pcmpeqd. @@ -3562,17 +3560,35 @@ } } -/// RewriteAs4WideShuffle - Try rewriting v8i16 and v16i8 shuffles as 4 wide -/// ones if possible. This can be done when every pair / quad of shuffle mask -/// elements point to elements in the right sequence. e.g. +/// RewriteAsNarrowerShuffle - Try rewriting v8i16 and v16i8 shuffles as 4 wide +/// ones, or rewriting v4i32 / v2f32 as 2 wide ones if possible. This can be +/// done when every pair / quad of shuffle mask elements point to elements in +/// the right sequence. e.g. /// vector_shuffle <>, <>, < 3, 4, | 10, 11, | 0, 1, | 14, 15> static -SDOperand RewriteAs4WideShuffle(SDOperand V1, SDOperand V2, +SDOperand RewriteAsNarrowerShuffle(SDOperand V1, SDOperand V2, + MVT::ValueType VT, SDOperand PermMask, SelectionDAG &DAG, TargetLowering &TLI) { unsigned NumElems = PermMask.getNumOperands(); - unsigned Scale = NumElems / 4; - SmallVector MaskVec; + unsigned NewWidth = (NumElems == 4) ? 2 : 4; + MVT::ValueType MaskVT = MVT::getIntVectorWithNumElements(NewWidth); + MVT::ValueType NewVT = MaskVT; + switch (VT) { + case MVT::v4f32: NewVT = MVT::v2f64; break; + case MVT::v4i32: NewVT = MVT::v2i64; break; + case MVT::v8i16: NewVT = MVT::v4i32; break; + case MVT::v16i8: NewVT = MVT::v4i32; break; + default: assert(false && "Unexpected!"); + } + + if (NewWidth == 2) + if (MVT::isInteger(VT)) + NewVT = MVT::v2i64; + else + NewVT = MVT::v2f64; + unsigned Scale = NumElems / NewWidth; + SmallVector MaskVec; for (unsigned i = 0; i < NumElems; i += Scale) { unsigned StartIdx = ~0U; for (unsigned j = 0; j < Scale; ++j) { @@ -3591,10 +3607,11 @@ MaskVec.push_back(DAG.getConstant(StartIdx / Scale, MVT::i32)); } - V1 = DAG.getNode(ISD::BIT_CONVERT, MVT::v4i32, V1); - V2 = DAG.getNode(ISD::BIT_CONVERT, MVT::v4i32, V2); - return DAG.getNode(ISD::VECTOR_SHUFFLE, MVT::v4i32, V1, V2, - DAG.getNode(ISD::BUILD_VECTOR, MVT::v4i32, &MaskVec[0],4)); + V1 = DAG.getNode(ISD::BIT_CONVERT, NewVT, V1); + V2 = DAG.getNode(ISD::BIT_CONVERT, NewVT, V2); + return DAG.getNode(ISD::VECTOR_SHUFFLE, NewVT, V1, V2, + DAG.getNode(ISD::BUILD_VECTOR, MaskVT, + &MaskVec[0], MaskVec.size())); } SDOperand @@ -3626,6 +3643,35 @@ return PromoteSplat(Op, DAG); } + // If the shuffle can be profitably rewritten as a narrower shuffle, then + // do it! + if (VT == MVT::v8i16 || VT == MVT::v16i8) { + SDOperand NewOp= RewriteAsNarrowerShuffle(V1, V2, VT, PermMask, DAG, *this); + if (NewOp.Val) + return DAG.getNode(ISD::BIT_CONVERT, VT, LowerVECTOR_SHUFFLE(NewOp, DAG)); + } else if ((VT == MVT::v4i32 || (VT == MVT::v4f32 && Subtarget->hasSSE2()))) { + // FIXME: Figure out a cleaner way to do this. + // Try to make use of movq to zero out the top part. + if (ISD::isBuildVectorAllZeros(V2.Val)) { + SDOperand NewOp = RewriteAsNarrowerShuffle(V1, V2, VT, PermMask, DAG, *this); + if (NewOp.Val) { + SDOperand NewV1 = NewOp.getOperand(0); + SDOperand NewV2 = NewOp.getOperand(1); + SDOperand NewMask = NewOp.getOperand(2); + if (isCommutedMOVL(NewMask.Val, true, false)) { + NewOp = CommuteVectorShuffle(NewOp, NewV1, NewV2, NewMask, DAG); + NewOp = DAG.getNode(ISD::VECTOR_SHUFFLE, NewOp.getValueType(), + NewV1, NewV2, getMOVLMask(2, DAG)); + return DAG.getNode(ISD::BIT_CONVERT, VT, LowerVECTOR_SHUFFLE(NewOp, DAG)); + } + } + } else if (ISD::isBuildVectorAllZeros(V1.Val)) { + SDOperand NewOp= RewriteAsNarrowerShuffle(V1, V2, VT, PermMask, DAG, *this); + if (NewOp.Val && X86::isMOVLMask(NewOp.getOperand(2).Val)) + return DAG.getNode(ISD::BIT_CONVERT, VT, LowerVECTOR_SHUFFLE(NewOp, DAG)); + } + } + if (X86::isMOVLMask(PermMask.Val)) return (V1IsUndef) ? V2 : Op; @@ -3654,6 +3700,7 @@ Commuted = true; } + // FIXME: Figure out a cleaner way to do this. if (isCommutedMOVL(PermMask.Val, V2IsSplat, V2IsUndef)) { if (V2IsUndef) return V1; Op = CommuteVectorShuffle(Op, V1, V2, PermMask, DAG); @@ -3735,13 +3782,6 @@ } } - // If the shuffle can be rewritten as a 4 wide shuffle, then do it! - if (VT == MVT::v8i16 || VT == MVT::v16i8) { - SDOperand NewOp = RewriteAs4WideShuffle(V1, V2, PermMask, DAG, *this); - if (NewOp.Val) - return DAG.getNode(ISD::BIT_CONVERT, VT, LowerVECTOR_SHUFFLE(NewOp, DAG)); - } - // Handle v8i16 specifically since SSE can do byte extraction and insertion. if (VT == MVT::v8i16) { SDOperand NewOp = LowerVECTOR_SHUFFLEv8i16(V1, V2, PermMask, DAG, *this); Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=45058&r1=45057&r2=45058&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Fri Dec 14 21:00:47 2007 @@ -2224,35 +2224,56 @@ (loadf64 addr:$src))), MOVL_shuffle_mask)))]>; -let AddedComplexity = 15 in // movd / movq to XMM register zero-extends +let AddedComplexity = 15 in { def MOVZDI2PDIrr : PDI<0x6E, MRMSrcReg, (outs VR128:$dst), (ins GR32:$src), "movd\t{$src, $dst|$dst, $src}", [(set VR128:$dst, (v4i32 (vector_shuffle immAllZerosV, (v4i32 (scalar_to_vector GR32:$src)), MOVL_shuffle_mask)))]>; -let AddedComplexity = 20 in +// This is X86-64 only. +def MOVZQI2PQIrr : RPDI<0x6E, MRMSrcReg, (outs VR128:$dst), (ins GR64:$src), + "mov{d|q}\t{$src, $dst|$dst, $src}", + [(set VR128:$dst, + (v2i64 (vector_shuffle immAllZerosV_bc, + (v2i64 (scalar_to_vector GR64:$src)), + MOVL_shuffle_mask)))]>; +} + +let AddedComplexity = 20 in { def MOVZDI2PDIrm : PDI<0x6E, MRMSrcMem, (outs VR128:$dst), (ins i32mem:$src), "movd\t{$src, $dst|$dst, $src}", [(set VR128:$dst, (v4i32 (vector_shuffle immAllZerosV, (v4i32 (scalar_to_vector (loadi32 addr:$src))), MOVL_shuffle_mask)))]>; - -// Moving from XMM to XMM but still clear upper 64 bits. -let AddedComplexity = 15 in -def MOVZQI2PQIrr : I<0x7E, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), - "movq\t{$src, $dst|$dst, $src}", - [(set VR128:$dst, (int_x86_sse2_movl_dq VR128:$src))]>, - XS, Requires<[HasSSE2]>; -let AddedComplexity = 20 in def MOVZQI2PQIrm : I<0x7E, MRMSrcMem, (outs VR128:$dst), (ins i64mem:$src), "movq\t{$src, $dst|$dst, $src}", - [(set VR128:$dst, (int_x86_sse2_movl_dq - (bitconvert (memopv2i64 addr:$src))))]>, - XS, Requires<[HasSSE2]>; + [(set VR128:$dst, + (v2i64 (vector_shuffle immAllZerosV_bc, + (v2i64 (scalar_to_vector (loadi64 addr:$src))), + MOVL_shuffle_mask)))]>, XS, + Requires<[HasSSE2]>; +} +// Moving from XMM to XMM and clear upper 64 bits. Note, there is a bug in +// IA32 document. movq xmm1, xmm2 does clear the high bits. +let AddedComplexity = 15 in +def MOVZPQILo2PQIrr : I<0x7E, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src), + "movq\t{$src, $dst|$dst, $src}", + [(set VR128:$dst, (v2i64 (vector_shuffle immAllZerosV_bc, + VR128:$src, + MOVL_shuffle_mask)))]>, + XS, Requires<[HasSSE2]>; + +let AddedComplexity = 20 in +def MOVZPQILo2PQIrm : I<0x7E, MRMSrcMem, (outs VR128:$dst), (ins i128mem:$src), + "movq\t{$src, $dst|$dst, $src}", + [(set VR128:$dst, (v2i64 (vector_shuffle immAllZerosV_bc, + (memopv2i64 addr:$src), + MOVL_shuffle_mask)))]>, + XS, Requires<[HasSSE2]>; //===----------------------------------------------------------------------===// // SSE3 Instructions @@ -2763,13 +2784,13 @@ // Special unary SHUFPSrri case. // FIXME: when we want non two-address code, then we should use PSHUFD? -def : Pat<(vector_shuffle (v4f32 VR128:$src1), (undef), - SHUFP_unary_shuffle_mask:$sm), +def : Pat<(v4f32 (vector_shuffle VR128:$src1, (undef), + SHUFP_unary_shuffle_mask:$sm)), (SHUFPSrri VR128:$src1, VR128:$src1, SHUFP_unary_shuffle_mask:$sm)>, Requires<[HasSSE1]>; // Special unary SHUFPDrri case. -def : Pat<(vector_shuffle (v2f64 VR128:$src1), (undef), - SHUFP_unary_shuffle_mask:$sm), +def : Pat<(v2f64 (vector_shuffle VR128:$src1, (undef), + SHUFP_unary_shuffle_mask:$sm)), (SHUFPDrri VR128:$src1, VR128:$src1, SHUFP_unary_shuffle_mask:$sm)>, Requires<[HasSSE2]>; // Unary v4f32 shuffle with PSHUF* in order to fold a load. @@ -2778,14 +2799,24 @@ (PSHUFDmi addr:$src1, SHUFP_unary_shuffle_mask:$sm)>, Requires<[HasSSE2]>; // Special binary v4i32 shuffle cases with SHUFPS. -def : Pat<(vector_shuffle (v4i32 VR128:$src1), (v4i32 VR128:$src2), - PSHUFD_binary_shuffle_mask:$sm), +def : Pat<(v4i32 (vector_shuffle VR128:$src1, (v4i32 VR128:$src2), + PSHUFD_binary_shuffle_mask:$sm)), (SHUFPSrri VR128:$src1, VR128:$src2, PSHUFD_binary_shuffle_mask:$sm)>, Requires<[HasSSE2]>; -def : Pat<(vector_shuffle (v4i32 VR128:$src1), - (bc_v4i32 (memopv2i64 addr:$src2)), PSHUFD_binary_shuffle_mask:$sm), +def : Pat<(v4i32 (vector_shuffle VR128:$src1, + (bc_v4i32 (memopv2i64 addr:$src2)), PSHUFD_binary_shuffle_mask:$sm)), (SHUFPSrmi VR128:$src1, addr:$src2, PSHUFD_binary_shuffle_mask:$sm)>, Requires<[HasSSE2]>; +// Special binary v2i64 shuffle cases using SHUFPDrri. +def : Pat<(v2i64 (vector_shuffle VR128:$src1, VR128:$src2, + SHUFP_shuffle_mask:$sm)), + (SHUFPDrri VR128:$src1, VR128:$src2, SHUFP_shuffle_mask:$sm)>, + Requires<[HasSSE2]>; +// Special unary SHUFPDrri case. +def : Pat<(v2i64 (vector_shuffle VR128:$src1, (undef), + SHUFP_unary_shuffle_mask:$sm)), + (SHUFPDrri VR128:$src1, VR128:$src1, SHUFP_unary_shuffle_mask:$sm)>, + Requires<[HasSSE2]>; // vector_shuffle v1, , <0, 0, 1, 1, ...> let AddedComplexity = 10 in { @@ -2888,11 +2919,11 @@ } // Set lowest element and zero upper elements. -let AddedComplexity = 20 in -def : Pat<(bc_v2i64 (vector_shuffle immAllZerosV_bc, - (v2f64 (scalar_to_vector (loadf64 addr:$src))), - MOVL_shuffle_mask)), - (MOVZQI2PQIrm addr:$src)>, Requires<[HasSSE2]>; +let AddedComplexity = 15 in +def : Pat<(v2f64 (vector_shuffle immAllZerosV_bc, VR128:$src, + MOVL_shuffle_mask)), + (MOVZPQILo2PQIrr VR128:$src)>, Requires<[HasSSE2]>; + // FIXME: Temporary workaround since 2-wide shuffle is broken. def : Pat<(int_x86_sse2_movs_d VR128:$src1, VR128:$src2), Modified: llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp?rev=45058&r1=45057&r2=45058&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp (original) +++ llvm/trunk/lib/Target/X86/X86RegisterInfo.cpp Fri Dec 14 21:00:47 2007 @@ -409,6 +409,9 @@ { X86::MOVSX64rr8, X86::MOVSX64rm8 }, { X86::MOVUPDrr, X86::MOVUPDrm }, { X86::MOVUPSrr, X86::MOVUPSrm }, + { X86::MOVZDI2PDIrr, X86::MOVZDI2PDIrm }, + { X86::MOVZQI2PQIrr, X86::MOVZQI2PQIrm }, + { X86::MOVZPQILo2PQIrr, X86::MOVZPQILo2PQIrm }, { X86::MOVZX16rr8, X86::MOVZX16rm8 }, { X86::MOVZX32rr16, X86::MOVZX32rm16 }, { X86::MOVZX32rr8, X86::MOVZX32rm8 }, Modified: llvm/trunk/test/CodeGen/X86/vec_set-5.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_set-5.ll?rev=45058&r1=45057&r2=45058&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_set-5.ll (original) +++ llvm/trunk/test/CodeGen/X86/vec_set-5.ll Fri Dec 14 21:00:47 2007 @@ -1,7 +1,8 @@ ; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 -o %t -f -; RUN: grep movlhps %t | count 2 +; RUN: grep movlhps %t | count 1 ; RUN: grep unpcklps %t | count 1 ; RUN: grep punpckldq %t | count 1 +; RUN: grep movq %t | count 1 <4 x float> %test1(float %a, float %b) { %tmp = insertelement <4 x float> zeroinitializer, float %a, uint 0 Modified: llvm/trunk/test/CodeGen/X86/vec_set-7.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_set-7.ll?rev=45058&r1=45057&r2=45058&view=diff ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_set-7.ll (original) +++ llvm/trunk/test/CodeGen/X86/vec_set-7.ll Fri Dec 14 21:00:47 2007 @@ -1,4 +1,4 @@ -; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep movq | count 1 +; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 | grep movsd | count 1 <2 x long> %test(<2 x long>* %p) { %tmp = cast <2 x long>* %p to double* Added: llvm/trunk/test/CodeGen/X86/vec_shuffle-14.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_shuffle-14.ll?rev=45058&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_shuffle-14.ll (added) +++ llvm/trunk/test/CodeGen/X86/vec_shuffle-14.ll Fri Dec 14 21:00:47 2007 @@ -0,0 +1,42 @@ +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep movd | count 1 +; RUN: llvm-as < %s | llc -march=x86-64 -mattr=+sse2 | grep movd | count 2 +; RUN: llvm-as < %s | llc -march=x86-64 -mattr=+sse2 | grep movq | count 3 +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | not grep xor + +define <4 x i32> @t1(i32 %a) nounwind { +entry: + %tmp = insertelement <4 x i32> undef, i32 %a, i32 0 + %tmp6 = shufflevector <4 x i32> zeroinitializer, <4 x i32> %tmp, <4 x i32> < i32 4, i32 1, i32 2, i32 3 > ; <<4 x i32>> [#uses=1] + ret <4 x i32> %tmp6 +} + +define <2 x i64> @t2(i64 %a) nounwind { +entry: + %tmp = insertelement <2 x i64> undef, i64 %a, i32 0 + %tmp6 = shufflevector <2 x i64> zeroinitializer, <2 x i64> %tmp, <2 x i32> < i32 2, i32 1 > ; <<4 x i32>> [#uses=1] + ret <2 x i64> %tmp6 +} + +define <2 x i64> @t3(<2 x i64>* %a) nounwind { +entry: + %tmp4 = load <2 x i64>* %a, align 16 ; <<2 x i64>> [#uses=1] + %tmp6 = bitcast <2 x i64> %tmp4 to <4 x i32> ; <<4 x i32>> [#uses=1] + %tmp7 = shufflevector <4 x i32> zeroinitializer, <4 x i32> %tmp6, <4 x i32> < i32 4, i32 5, i32 2, i32 3 > ; <<4 x i32>> [#uses=1] + %tmp8 = bitcast <4 x i32> %tmp7 to <2 x i64> ; <<2 x i64>> [#uses=1] + ret <2 x i64> %tmp8 +} + +define <2 x i64> @t4(<2 x i64> %a) nounwind { +entry: + %tmp5 = bitcast <2 x i64> %a to <4 x i32> ; <<4 x i32>> [#uses=1] + %tmp6 = shufflevector <4 x i32> zeroinitializer, <4 x i32> %tmp5, <4 x i32> < i32 4, i32 5, i32 2, i32 3 > ; <<4 x i32>> [#uses=1] + %tmp7 = bitcast <4 x i32> %tmp6 to <2 x i64> ; <<2 x i64>> [#uses=1] + ret <2 x i64> %tmp7 +} + +define <2 x i64> @t5(<2 x i64> %a) nounwind { +entry: + %tmp6 = shufflevector <2 x i64> zeroinitializer, <2 x i64> %a, <2 x i32> < i32 2, i32 1 > ; <<4 x i32>> [#uses=1] + ret <2 x i64> %tmp6 +} Added: llvm/trunk/test/CodeGen/X86/vec_shuffle-15.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/vec_shuffle-15.ll?rev=45058&view=auto ============================================================================== --- llvm/trunk/test/CodeGen/X86/vec_shuffle-15.ll (added) +++ llvm/trunk/test/CodeGen/X86/vec_shuffle-15.ll Fri Dec 14 21:00:47 2007 @@ -0,0 +1,81 @@ +; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 + +define <2 x i64> @t00(<2 x i64> %a, <2 x i64> %b) nounwind { + %tmp = shufflevector <2 x i64> %a, <2 x i64> %b, <2 x i32> < i32 0, i32 0 > + ret <2 x i64> %tmp +} + +define <2 x i64> @t01(<2 x i64> %a, <2 x i64> %b) nounwind { + %tmp = shufflevector <2 x i64> %a, <2 x i64> %b, <2 x i32> < i32 0, i32 1 > + ret <2 x i64> %tmp +} + +define <2 x i64> @t02(<2 x i64> %a, <2 x i64> %b) nounwind { + %tmp = shufflevector <2 x i64> %a, <2 x i64> %b, <2 x i32> < i32 0, i32 2 > + ret <2 x i64> %tmp +} + +define <2 x i64> @t03(<2 x i64> %a, <2 x i64> %b) nounwind { + %tmp = shufflevector <2 x i64> %a, <2 x i64> %b, <2 x i32> < i32 0, i32 3 > + ret <2 x i64> %tmp +} + +define <2 x i64> @t10(<2 x i64> %a, <2 x i64> %b) nounwind { + %tmp = shufflevector <2 x i64> %a, <2 x i64> %b, <2 x i32> < i32 1, i32 0 > + ret <2 x i64> %tmp +} + +define <2 x i64> @t11(<2 x i64> %a, <2 x i64> %b) nounwind { + %tmp = shufflevector <2 x i64> %a, <2 x i64> %b, <2 x i32> < i32 1, i32 1 > + ret <2 x i64> %tmp +} + +define <2 x i64> @t12(<2 x i64> %a, <2 x i64> %b) nounwind { + %tmp = shufflevector <2 x i64> %a, <2 x i64> %b, <2 x i32> < i32 1, i32 2 > + ret <2 x i64> %tmp +} + +define <2 x i64> @t13(<2 x i64> %a, <2 x i64> %b) nounwind { + %tmp = shufflevector <2 x i64> %a, <2 x i64> %b, <2 x i32> < i32 1, i32 3 > + ret <2 x i64> %tmp +} + +define <2 x i64> @t20(<2 x i64> %a, <2 x i64> %b) nounwind { + %tmp = shufflevector <2 x i64> %a, <2 x i64> %b, <2 x i32> < i32 2, i32 0 > + ret <2 x i64> %tmp +} + +define <2 x i64> @t21(<2 x i64> %a, <2 x i64> %b) nounwind { + %tmp = shufflevector <2 x i64> %a, <2 x i64> %b, <2 x i32> < i32 2, i32 1 > + ret <2 x i64> %tmp +} + +define <2 x i64> @t22(<2 x i64> %a, <2 x i64> %b) nounwind { + %tmp = shufflevector <2 x i64> %a, <2 x i64> %b, <2 x i32> < i32 2, i32 2 > + ret <2 x i64> %tmp +} + +define <2 x i64> @t23(<2 x i64> %a, <2 x i64> %b) nounwind { + %tmp = shufflevector <2 x i64> %a, <2 x i64> %b, <2 x i32> < i32 2, i32 3 > + ret <2 x i64> %tmp +} + +define <2 x i64> @t30(<2 x i64> %a, <2 x i64> %b) nounwind { + %tmp = shufflevector <2 x i64> %a, <2 x i64> %b, <2 x i32> < i32 3, i32 0 > + ret <2 x i64> %tmp +} + +define <2 x i64> @t31(<2 x i64> %a, <2 x i64> %b) nounwind { + %tmp = shufflevector <2 x i64> %a, <2 x i64> %b, <2 x i32> < i32 3, i32 1 > + ret <2 x i64> %tmp +} + +define <2 x i64> @t32(<2 x i64> %a, <2 x i64> %b) nounwind { + %tmp = shufflevector <2 x i64> %a, <2 x i64> %b, <2 x i32> < i32 3, i32 2 > + ret <2 x i64> %tmp +} + +define <2 x i64> @t33(<2 x i64> %a, <2 x i64> %b) nounwind { + %tmp = shufflevector <2 x i64> %a, <2 x i64> %b, <2 x i32> < i32 3, i32 3 > + ret <2 x i64> %tmp +} From evan.cheng at apple.com Fri Dec 14 20:54:13 2007 From: evan.cheng at apple.com (Evan Cheng) Date: Sat, 15 Dec 2007 02:54:13 -0000 Subject: [llvm-commits] [llvm] r45057 - /llvm/trunk/include/llvm/IntrinsicsX86.td Message-ID: <200712150254.lBF2sDxZ021250@zion.cs.uiuc.edu> Author: evancheng Date: Fri Dec 14 20:54:12 2007 New Revision: 45057 URL: http://llvm.org/viewvc/llvm-project?rev=45057&view=rev Log: __builtin_ia32_movqv4si is now expanded to a shuffle. Modified: llvm/trunk/include/llvm/IntrinsicsX86.td Modified: llvm/trunk/include/llvm/IntrinsicsX86.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IntrinsicsX86.td?rev=45057&r1=45056&r2=45057&view=diff ============================================================================== --- llvm/trunk/include/llvm/IntrinsicsX86.td (original) +++ llvm/trunk/include/llvm/IntrinsicsX86.td Fri Dec 14 20:54:12 2007 @@ -460,8 +460,6 @@ def int_x86_sse2_packuswb_128 : GCCBuiltin<"__builtin_ia32_packuswb128">, Intrinsic<[llvm_v8i16_ty, llvm_v8i16_ty, llvm_v8i16_ty], [IntrNoMem]>; - def int_x86_sse2_movl_dq : GCCBuiltin<"__builtin_ia32_movqv4si">, - Intrinsic<[llvm_v4i32_ty, llvm_v4i32_ty], [IntrNoMem]>; def int_x86_sse2_movmsk_pd : GCCBuiltin<"__builtin_ia32_movmskpd">, Intrinsic<[llvm_i32_ty, llvm_v2f64_ty], [IntrNoMem]>; def int_x86_sse2_pmovmskb_128 : GCCBuiltin<"__builtin_ia32_pmovmskb128">, From clattner at apple.com Sat Dec 15 00:16:42 2007 From: clattner at apple.com (Chris Lattner) Date: Fri, 14 Dec 2007 22:16:42 -0800 Subject: [llvm-commits] [llvm] r45057 - /llvm/trunk/include/llvm/IntrinsicsX86.td In-Reply-To: <200712150254.lBF2sDxZ021250@zion.cs.uiuc.edu> References: <200712150254.lBF2sDxZ021250@zion.cs.uiuc.edu> Message-ID: <5C7844A6-147D-4355-A7BF-0285C99B5FB2@apple.com> On Dec 14, 2007, at 6:54 PM, Evan Cheng wrote: > Author: evancheng > Date: Fri Dec 14 20:54:12 2007 > New Revision: 45057 > > URL: http://llvm.org/viewvc/llvm-project?rev=45057&view=rev > Log: > __builtin_ia32_movqv4si is now expanded to a shuffle. Hi Evan, This breaks backwards compatibility with old .ll files. Please keep the intrinsic (in llvm, not needed in llvm-gcc) and add a "FIXME: REMOVE IN LLVM 3.0" to it. Thanks, -Chris > > Modified: > llvm/trunk/include/llvm/IntrinsicsX86.td > > Modified: llvm/trunk/include/llvm/IntrinsicsX86.td > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IntrinsicsX86.td?rev=45057&r1=45056&r2=45057&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/include/llvm/IntrinsicsX86.td (original) > +++ llvm/trunk/include/llvm/IntrinsicsX86.td Fri Dec 14 20:54:12 2007 > @@ -460,8 +460,6 @@ > def int_x86_sse2_packuswb_128 : > GCCBuiltin<"__builtin_ia32_packuswb128">, > Intrinsic<[llvm_v8i16_ty, llvm_v8i16_ty, > llvm_v8i16_ty], [IntrNoMem]>; > - def int_x86_sse2_movl_dq : GCCBuiltin<"__builtin_ia32_movqv4si">, > - Intrinsic<[llvm_v4i32_ty, llvm_v4i32_ty], [IntrNoMem]>; > def int_x86_sse2_movmsk_pd : GCCBuiltin<"__builtin_ia32_movmskpd">, > Intrinsic<[llvm_i32_ty, llvm_v2f64_ty], [IntrNoMem]>; > def int_x86_sse2_pmovmskb_128 : > GCCBuiltin<"__builtin_ia32_pmovmskb128">, > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From christopher.lamb at gmail.com Sat Dec 15 03:23:23 2007 From: christopher.lamb at gmail.com (Christopher Lamb) Date: Sat, 15 Dec 2007 01:23:23 -0800 Subject: [llvm-commits] [llvm] r45022 - in /llvm/trunk: include/llvm/Target/TargetInstrInfo.h lib/Target/Target.td utils/TableGen/CodeGenInstruction.h utils/TableGen/CodeGenTarget.cpp utils/TableGen/InstrInfoEmitter.cpp In-Reply-To: <16e5fdf90712141040y229de61cl7f0b36187e96ce@mail.gmail.com> References: <200712140148.lBE1mxh2005906@zion.cs.uiuc.edu> <200712141129.32156.baldrick@free.fr> <16e5fdf90712141040y229de61cl7f0b36187e96ce@mail.gmail.com> Message-ID: <17419116-6477-480D-A8BB-B00B72AAD42B@gmail.com> On Dec 14, 2007, at 10:40 AM, Bill Wendling wrote: > Hi Duncan, > >> Hi Bill, does a branch instruction have side-effects? > > Yes. > >> What is a side-effect? I noticed some confusion in gcc about >> the definition of a side-effect, so it would be good to avoid >> confusion in LLVM. >> > My understanding of a side effect is when an instruction has > un-modeled effects. For instance, "emms" on X86 has side effects that > aren't modeled in the instruction pattern -- it resets the FP > registers after MMX use. Other instructions have no un-modeled side > effects -- e.g., "xor" on X86 or "li" on PPC. Others may have > un-modeled side effects in some situations, but not in others -- e.g., > loads, in general, have side effects (accessing memory), but loads > from a constant pool don't. > > This is the working definition, anyway. In the beginning, it'll be > closely tied to what the "isRematerializable" flag means. I don't know > what GCC considers side effects. Could you give a summary? It would be > good to contrast/compare with it. In processor design discussions all load instructions were termed "side affecting", as they could cause a page fault. Perhaps the key here is whether the un-modeled effects of the instruction affect correct program behavior? -- Christopher Lamb -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20071215/af4bf939/attachment.html From baldrick at free.fr Sat Dec 15 04:18:56 2007 From: baldrick at free.fr (Duncan Sands) Date: Sat, 15 Dec 2007 11:18:56 +0100 Subject: [llvm-commits] =?iso-8859-1?q?=5Bllvm-gcc-4=2E2=5D_r45052_-_in_/l?= =?iso-8859-1?q?lvm-gcc-4=2E2/trunk/gcc/testsuite/gcc=2Ec-torture/execute?= =?iso-8859-1?q?=3A=0920051012-1=2Ex_920501-1=2Ex_921202-1=2Ex_921208-2=2E?= =?iso-8859-1?q?x?= In-Reply-To: References: <200712150129.lBF1TVjv016994@zion.cs.uiuc.edu> <06230558-D577-4D20-A2C5-3867E3C31842@apple.com> Message-ID: <200712151118.59542.baldrick@free.fr> > What I actually want is not to suppress the message or the test, but > to tell the > testsuite to ignore the message and proceed. I haven't found a knob > that will do that. You could try asking a gcc testsuite guru. Ciao, Duncan. PS: You could add a line checking that the warning does occur, i.e. generation of the warning would become part of the test. From baldrick at free.fr Sat Dec 15 04:10:06 2007 From: baldrick at free.fr (Duncan Sands) Date: Sat, 15 Dec 2007 11:10:06 +0100 Subject: [llvm-commits] [llvm-gcc-4.2] r45045 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp In-Reply-To: <200712142317.lBENHQah008595@zion.cs.uiuc.edu> References: <200712142317.lBENHQah008595@zion.cs.uiuc.edu> Message-ID: <200712151110.06621.baldrick@free.fr> Hi Dale, > // Check for 'readnone' function attribute. > - if (flags & ECF_CONST) > + // Both PURE and CONST will be set if the user applied > + // __attribute__((const)) to a function the compiler > + // knows to be pure, such as log. A user or (more > + // likely) libm implementor might know their local log > + // is in fact const, so this should be valid (and gcc > + // accepts it). But llvm IR does not allow both, so > + // set only ReadNone. > + if (flags & ECF_CONST && !(flags & ECF_PURE)) > // Since they write the return value through a pointer, > // 'sret' functions cannot be 'readnone'. > if (!ABIConverter.isStructReturn()) if it is marked both pure and const, this logic seems to mark it pure in LLVM (i.e. readonly). It would be better to mark it readnone since that's stronger. Ciao, D. From baldrick at free.fr Sat Dec 15 11:37:40 2007 From: baldrick at free.fr (Duncan Sands) Date: Sat, 15 Dec 2007 17:37:40 -0000 Subject: [llvm-commits] [llvm] r45059 - /llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Message-ID: <200712151737.lBFHbeDF016596@zion.cs.uiuc.edu> Author: baldrick Date: Sat Dec 15 11:37:40 2007 New Revision: 45059 URL: http://llvm.org/viewvc/llvm-project?rev=45059&view=rev Log: These are more correctly called signaling NaNs. Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=45059&r1=45058&r2=45059&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Sat Dec 15 11:37:40 2007 @@ -764,7 +764,7 @@ break; case Type::X86_FP80TyID: { // This is endian dependent, but it will only work on x86 anyway. - // FIXME: Does not trap if loading a trapping NaN. + // FIXME: Will not trap if loading a signaling NaN. uint16_t *p = (uint16_t*)Ptr; union { uint16_t x[8]; From dalej at apple.com Sat Dec 15 14:50:49 2007 From: dalej at apple.com (Dale Johannesen) Date: Sat, 15 Dec 2007 12:50:49 -0800 Subject: [llvm-commits] [llvm-gcc-4.2] r45052 - in /llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/execute: 20051012-1.x 920501-1.x 921202-1.x 921208-2.x In-Reply-To: <200712151118.59542.baldrick@free.fr> References: <200712150129.lBF1TVjv016994@zion.cs.uiuc.edu> <06230558-D577-4D20-A2C5-3867E3C31842@apple.com> <200712151118.59542.baldrick@free.fr> Message-ID: On Dec 15, 2007, at 2:18 AM, Duncan Sands wrote: >> What I actually want is not to suppress the message or the test, but >> to tell the >> testsuite to ignore the message and proceed. I haven't found a knob >> that will do that. > > You could try asking a gcc testsuite guru. Eric is one, and he didn't know a way. > Ciao, > > Duncan. > > PS: You could add a line checking that the warning does occur, i.e. > generation of the warning would become part of the test. dg-warning doesn't work in this directory. From dalej at apple.com Sat Dec 15 14:53:03 2007 From: dalej at apple.com (Dale Johannesen) Date: Sat, 15 Dec 2007 20:53:03 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r45061 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Message-ID: <200712152053.lBFKr3mL031358@zion.cs.uiuc.edu> Author: johannes Date: Sat Dec 15 14:53:03 2007 New Revision: 45061 URL: http://llvm.org/viewvc/llvm-project?rev=45061&view=rev Log: Fix thinko in previous patch. Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=45061&r1=45060&r2=45061&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Sat Dec 15 14:53:03 2007 @@ -1075,14 +1075,14 @@ // is in fact const, so this should be valid (and gcc // accepts it). But llvm IR does not allow both, so // set only ReadNone. - if (flags & ECF_CONST && !(flags & ECF_PURE)) + if (flags & ECF_CONST) // Since they write the return value through a pointer, // 'sret' functions cannot be 'readnone'. if (!ABIConverter.isStructReturn()) RAttributes |= ParamAttr::ReadNone; // Check for 'readonly' function attribute. - if (flags & ECF_PURE) + if (flags & ECF_PURE && !(flags & ECF_CONST)) // Since they write the return value through a pointer, // 'sret' functions cannot be 'readonly'. if (!ABIConverter.isStructReturn()) From dalej at apple.com Sat Dec 15 14:53:39 2007 From: dalej at apple.com (Dale Johannesen) Date: Sat, 15 Dec 2007 12:53:39 -0800 Subject: [llvm-commits] [llvm-gcc-4.2] r45045 - /llvm-gcc-4.2/trunk/gcc/llvm-types.cpp In-Reply-To: <200712151110.06621.baldrick@free.fr> References: <200712142317.lBENHQah008595@zion.cs.uiuc.edu> <200712151110.06621.baldrick@free.fr> Message-ID: <00304191-AB21-4F79-BAB3-7F3F511786A5@apple.com> On Dec 15, 2007, at 2:10 AM, Duncan Sands wrote: > Hi Dale, > >> // Check for 'readnone' function attribute. >> - if (flags & ECF_CONST) >> + // Both PURE and CONST will be set if the user applied >> + // __attribute__((const)) to a function the compiler >> + // knows to be pure, such as log. A user or (more >> + // likely) libm implementor might know their local log >> + // is in fact const, so this should be valid (and gcc >> + // accepts it). But llvm IR does not allow both, so >> + // set only ReadNone. >> + if (flags & ECF_CONST && !(flags & ECF_PURE)) >> // Since they write the return value through a pointer, >> // 'sret' functions cannot be 'readnone'. >> if (!ABIConverter.isStructReturn()) > > if it is marked both pure and const, this logic seems to > mark it pure in LLVM (i.e. readonly). It would be better > to mark it readnone since that's stronger. Right. Fixed, thanks. From asl at math.spbu.ru Sat Dec 15 16:23:25 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sat, 15 Dec 2007 22:23:25 -0000 Subject: [llvm-commits] [llvm] r45063 - in /llvm/trunk/include/llvm/ADT: DepthFirstIterator.h GraphTraits.h Message-ID: <200712152223.lBFMNPS5006736@zion.cs.uiuc.edu> Author: asl Date: Sat Dec 15 16:23:24 2007 New Revision: 45063 URL: http://llvm.org/viewvc/llvm-project?rev=45063&view=rev Log: Use references in DF iterators. This eliminates copy-ctor calls on huge objects (graphs) Modified: llvm/trunk/include/llvm/ADT/DepthFirstIterator.h llvm/trunk/include/llvm/ADT/GraphTraits.h Modified: llvm/trunk/include/llvm/ADT/DepthFirstIterator.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/DepthFirstIterator.h?rev=45063&r1=45062&r2=45063&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/DepthFirstIterator.h (original) +++ llvm/trunk/include/llvm/ADT/DepthFirstIterator.h Sat Dec 15 16:23:24 2007 @@ -96,16 +96,16 @@ typedef df_iterator _Self; // Provide static begin and end methods as our public "constructors" - static inline _Self begin(GraphT G) { + static inline _Self begin(const GraphT& G) { return _Self(GT::getEntryNode(G)); } - static inline _Self end(GraphT G) { return _Self(); } + static inline _Self end(const GraphT& G) { return _Self(); } // Static begin and end methods as our public ctors for external iterators - static inline _Self begin(GraphT G, SetType &S) { + static inline _Self begin(const GraphT& G, SetType &S) { return _Self(GT::getEntryNode(G), S); } - static inline _Self end(GraphT G, SetType &S) { return _Self(S); } + static inline _Self end(const GraphT& G, SetType &S) { return _Self(S); } inline bool operator==(const _Self& x) const { return VisitStack.size() == x.VisitStack.size() && @@ -162,12 +162,12 @@ // Provide global constructors that automatically figure out correct types... // template -df_iterator df_begin(T G) { +df_iterator df_begin(const T& G) { return df_iterator::begin(G); } template -df_iterator df_end(T G) { +df_iterator df_end(const T& G) { return df_iterator::end(G); } @@ -179,12 +179,12 @@ }; template -df_ext_iterator df_ext_begin(T G, SetTy &S) { +df_ext_iterator df_ext_begin(const T& G, SetTy &S) { return df_ext_iterator::begin(G, S); } template -df_ext_iterator df_ext_end(T G, SetTy &S) { +df_ext_iterator df_ext_end(const T& G, SetTy &S) { return df_ext_iterator::end(G, S); } @@ -199,13 +199,15 @@ }; template -idf_iterator idf_begin(T G) { - return idf_iterator::begin(G); +idf_iterator idf_begin(const T& G) { + Inverse DummyG; + return idf_iterator::begin(DummyG); } template -idf_iterator idf_end(T G){ - return idf_iterator::end(G); +idf_iterator idf_end(const T& G){ + Inverse DummyG; + return idf_iterator::end(DummyG); } // Provide global definitions of external inverse depth first iterators... @@ -218,13 +220,15 @@ }; template -idf_ext_iterator idf_ext_begin(T G, SetTy &S) { - return idf_ext_iterator::begin(G, S); +idf_ext_iterator idf_ext_begin(const T& G, SetTy &S) { + Inverse DummyG(G); + return idf_ext_iterator::begin(DummyG, S); } template -idf_ext_iterator idf_ext_end(T G, SetTy &S) { - return idf_ext_iterator::end(G, S); +idf_ext_iterator idf_ext_end(const T& G, SetTy &S) { + Inverse DummyG(G); + return idf_ext_iterator::end(DummyG, S); } } // End llvm namespace Modified: llvm/trunk/include/llvm/ADT/GraphTraits.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/GraphTraits.h?rev=45063&r1=45062&r2=45063&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/GraphTraits.h (original) +++ llvm/trunk/include/llvm/ADT/GraphTraits.h Sat Dec 15 16:23:24 2007 @@ -73,9 +73,9 @@ // template struct Inverse { - GraphType &Graph; + const GraphType &Graph; - inline Inverse(GraphType &G) : Graph(G) {} + inline Inverse(const GraphType &G) : Graph(G) {} }; // Provide a partial specialization of GraphTraits so that the inverse of an inverse From asl at math.spbu.ru Sat Dec 15 18:42:20 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sun, 16 Dec 2007 00:42:20 -0000 Subject: [llvm-commits] [llvm] r45066 - /llvm/trunk/include/llvm/Support/DOTGraphTraits.h Message-ID: <200712160042.lBG0gKh9014634@zion.cs.uiuc.edu> Author: asl Date: Sat Dec 15 18:42:19 2007 New Revision: 45066 URL: http://llvm.org/viewvc/llvm-project?rev=45066&view=rev Log: Constify graph arguments Modified: llvm/trunk/include/llvm/Support/DOTGraphTraits.h Modified: llvm/trunk/include/llvm/Support/DOTGraphTraits.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/DOTGraphTraits.h?rev=45066&r1=45065&r2=45066&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/DOTGraphTraits.h (original) +++ llvm/trunk/include/llvm/Support/DOTGraphTraits.h Sat Dec 15 18:42:19 2007 @@ -31,13 +31,13 @@ /// top of the graph. /// template - static std::string getGraphName(GraphType Graph) { return ""; } + static std::string getGraphName(const GraphType& Graph) { return ""; } /// getGraphProperties - Return any custom properties that should be included /// in the top level graph structure for dot. /// template - static std::string getGraphProperties(GraphType Graph) { + static std::string getGraphProperties(const GraphType& Graph) { return ""; } @@ -51,21 +51,22 @@ /// getNodeLabel - Given a node and a pointer to the top level graph, return /// the label to print in the node. template - static std::string getNodeLabel(const void *Node, GraphType Graph) { + static std::string getNodeLabel(const void *Node, const GraphType& Graph) { return ""; } /// hasNodeAddressLabel - If this method returns true, the address of the node /// is added to the label of the node. template - static bool hasNodeAddressLabel(const void *Node, GraphType Graph) { + static bool hasNodeAddressLabel(const void *Node, const GraphType& Graph) { return false; } /// If you want to specify custom node attributes, this is the place to do so /// template - static std::string getNodeAttributes(const void *Node, GraphType Graph) { + static std::string getNodeAttributes(const void *Node, + const GraphType& Graph) { return ""; } @@ -106,7 +107,7 @@ /// it to add things to the output graph. /// template - static void addCustomGraphFeatures(GraphType Graph, GraphWriter &GW) {} + static void addCustomGraphFeatures(const GraphType& Graph, GraphWriter &GW) {} }; From clattner at apple.com Sat Dec 15 18:45:13 2007 From: clattner at apple.com (Chris Lattner) Date: Sat, 15 Dec 2007 16:45:13 -0800 Subject: [llvm-commits] [llvm] r45057 - /llvm/trunk/include/llvm/IntrinsicsX86.td In-Reply-To: <5C7844A6-147D-4355-A7BF-0285C99B5FB2@apple.com> References: <200712150254.lBF2sDxZ021250@zion.cs.uiuc.edu> <5C7844A6-147D-4355-A7BF-0285C99B5FB2@apple.com> Message-ID: On Dec 14, 2007, at 10:16 PM, Chris Lattner wrote: > On Dec 14, 2007, at 6:54 PM, Evan Cheng wrote: >> Author: evancheng >> Date: Fri Dec 14 20:54:12 2007 >> New Revision: 45057 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=45057&view=rev >> Log: >> __builtin_ia32_movqv4si is now expanded to a shuffle. > > Hi Evan, > > This breaks backwards compatibility with old .ll files. Please keep > the intrinsic (in llvm, not needed in llvm-gcc) and add a "FIXME: > REMOVE IN LLVM 3.0" to it. Actually, better yet: please update lib/VMCore/AutoUpgrade.cpp to turn the old intrinsic into the corresponding shuffle. This gives us compatibility with old .ll and .bc files, but doesn't require us to keep the isel hooks around. -Chris > > Thanks, > > -Chris > >> >> Modified: >> llvm/trunk/include/llvm/IntrinsicsX86.td >> >> Modified: llvm/trunk/include/llvm/IntrinsicsX86.td >> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IntrinsicsX86.td?rev=45057&r1=45056&r2=45057&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> --- llvm/trunk/include/llvm/IntrinsicsX86.td (original) >> +++ llvm/trunk/include/llvm/IntrinsicsX86.td Fri Dec 14 20:54:12 2007 >> @@ -460,8 +460,6 @@ >> def int_x86_sse2_packuswb_128 : >> GCCBuiltin<"__builtin_ia32_packuswb128">, >> Intrinsic<[llvm_v8i16_ty, llvm_v8i16_ty, >> llvm_v8i16_ty], [IntrNoMem]>; >> - def int_x86_sse2_movl_dq : GCCBuiltin<"__builtin_ia32_movqv4si">, >> - Intrinsic<[llvm_v4i32_ty, llvm_v4i32_ty], >> [IntrNoMem]>; >> def int_x86_sse2_movmsk_pd : GCCBuiltin<"__builtin_ia32_movmskpd">, >> Intrinsic<[llvm_i32_ty, llvm_v2f64_ty], [IntrNoMem]>; >> def int_x86_sse2_pmovmskb_128 : >> GCCBuiltin<"__builtin_ia32_pmovmskb128">, >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From asl at math.spbu.ru Sat Dec 15 19:27:04 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sun, 16 Dec 2007 01:27:04 -0000 Subject: [llvm-commits] [llvm] r45067 - /llvm/trunk/include/llvm/ADT/Trie.h Message-ID: <200712160127.lBG1R4Pl016845@zion.cs.uiuc.edu> Author: asl Date: Sat Dec 15 19:27:04 2007 New Revision: 45067 URL: http://llvm.org/viewvc/llvm-project?rev=45067&view=rev Log: Provide GraphTraits and DOTGraphTraits interface for Trie. Retoss private/public stuff. Make copy ctor and operator= private. Modified: llvm/trunk/include/llvm/ADT/Trie.h Modified: llvm/trunk/include/llvm/ADT/Trie.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Trie.h?rev=45067&r1=45066&r2=45067&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/Trie.h (original) +++ llvm/trunk/include/llvm/ADT/Trie.h Sat Dec 15 19:27:04 2007 @@ -15,7 +15,9 @@ #ifndef LLVM_ADT_TRIE_H #define LLVM_ADT_TRIE_H -#include +#include "llvm/ADT/GraphTraits.h" +#include "llvm/Support/DOTGraphTraits.h" + #include namespace llvm { @@ -24,12 +26,15 @@ // - Labels are usually small, maybe it's better to use SmallString // - Should we use char* during construction? // - Should we templatize Empty with traits-like interface? -// - GraphTraits interface template class Trie { + friend class GraphTraits >; + friend class DOTGraphTraits >; +public: class Node { friend class Trie; + friend class GraphTraits >; typedef enum { Same = -3, @@ -53,43 +58,10 @@ std::string Label; Payload Data; NodeVector Children; - public: - inline explicit Node(const Payload& data, const std::string& label = ""): - Label(label), Data(data) { } - - inline Node(const Node& n) { - Data = n.Data; - Children = n.Children; - Label = n.Label; - } - inline Node& operator=(const Node& n) { - if (&n != this) { - Data = n.Data; - Children = n.Children; - Label = n.Label; - } - - return *this; - } - - inline bool isLeaf() const { return Children.empty(); } - - inline const Payload& getData() const { return Data; } - inline void setData(const Payload& data) { Data = data; } - inline void setLabel(const std::string& label) { Label = label; } - inline const std::string& getLabel() const { return Label; } - -#if 0 - inline void dump() { - std::cerr << "Node: " << this << "\n" - << "Label: " << Label << "\n" - << "Children:\n"; - - for (NodeVectorIter I = Children.begin(), E = Children.end(); I != E; ++I) - std::cerr << (*I)->Label << "\n"; - } -#endif + // Do not implement + Node(const Node&); + Node& operator=(const Node&); inline void addEdge(Node* N) { if (Children.empty()) @@ -102,16 +74,6 @@ } } - inline Node* getEdge(char Id) { - Node* fNode = NULL; - NodeVectorIter I = std::lower_bound(Children.begin(), Children.end(), - Id, NodeCmp()); - if (I != Children.end() && (*I)->Label[0] == Id) - fNode = *I; - - return fNode; - } - inline void setEdge(Node* N) { char Id = N->Label[0]; NodeVectorIter I = std::lower_bound(Children.begin(), Children.end(), @@ -141,13 +103,42 @@ } else // s and Label have common (possible empty) part, return its length return (QueryResult)i; } + + public: + inline explicit Node(const Payload& data, const std::string& label = ""): + Label(label), Data(data) { } + + inline const Payload& data() const { return Data; } + inline void setData(const Payload& data) { Data = data; } + + inline const std::string& label() const { return Label; } + +#if 0 + inline void dump() { + std::cerr << "Node: " << this << "\n" + << "Label: " << Label << "\n" + << "Children:\n"; + + for (NodeVectorIter I = Children.begin(), E = Children.end(); I != E; ++I) + std::cerr << (*I)->Label << "\n"; + } +#endif + + inline Node* getEdge(char Id) { + Node* fNode = NULL; + NodeVectorIter I = std::lower_bound(Children.begin(), Children.end(), + Id, NodeCmp()); + if (I != Children.end() && (*I)->Label[0] == Id) + fNode = *I; + + return fNode; + } }; +private: std::vector Nodes; Payload Empty; - inline Node* getRoot() const { return Nodes[0]; } - inline Node* addNode(const Payload& data, const std::string label = "") { Node* N = new Node(data, label); Nodes.push_back(N); @@ -172,6 +163,10 @@ return nNode; } + // Do not implement + Trie(const Trie&); + Trie& operator=(const Trie&); + public: inline explicit Trie(const Payload& empty):Empty(empty) { addNode(Empty); @@ -181,6 +176,8 @@ delete Nodes[i]; } + inline Node* getRoot() const { return Nodes[0]; } + bool addString(const std::string& s, const Payload& data) { Node* cNode = getRoot(); Node* tNode = NULL; @@ -202,7 +199,7 @@ assert(0 && "Impossible!"); return false; case Node::LabelIsPrefix: - s1 = s1.substr(nNode->getLabel().length()); + s1 = s1.substr(nNode->label().length()); cNode = nNode; break; default: @@ -239,7 +236,7 @@ assert(0 && "Impossible!"); return Empty; case Node::LabelIsPrefix: - s1 = s1.substr(nNode->getLabel().length()); + s1 = s1.substr(nNode->label().length()); cNode = nNode; break; default: @@ -249,11 +246,69 @@ return Empty; } - return tNode->getData(); + return tNode->data(); + } + +}; + +template +struct GraphTraits > { + typedef typename Trie::Node NodeType; + typedef typename std::vector::iterator ChildIteratorType; + + static inline NodeType *getEntryNode(const Trie& T) { + return T.getRoot(); + } + + static inline ChildIteratorType child_begin(NodeType *N) { + return N->Children.begin(); + } + static inline ChildIteratorType child_end(NodeType *N) { + return N->Children.end(); + } + + typedef typename std::vector::const_iterator nodes_iterator; + + static inline nodes_iterator nodes_begin(const Trie& G) { + return G.Nodes.begin(); + } + static inline nodes_iterator nodes_end(const Trie& G) { + return G.Nodes.end(); + } + +}; + +template +struct DOTGraphTraits > : public DefaultDOTGraphTraits { + typedef typename Trie::Node NodeType; + typedef typename GraphTraits >::ChildIteratorType EdgeIter; + + static std::string getGraphName(const Trie& T) { + return "Trie"; + } + + static std::string getNodeLabel(NodeType* Node, const Trie& T) { + if (T.getRoot() == Node) + return ""; + else + return Node->label(); + } + + static std::string getEdgeSourceLabel(NodeType* Node, EdgeIter I) { + NodeType* N = *I; + return N->label().substr(0, 1); + } + + static std::string getNodeAttributes(const NodeType* Node, + const Trie& T) { + if (Node->data() != T.Empty) + return "color=blue"; + + return ""; } }; -} +} // end of llvm namespace #endif // LLVM_ADT_TRIE_H From asl at math.spbu.ru Sat Dec 15 19:36:17 2007 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Sun, 16 Dec 2007 01:36:17 -0000 Subject: [llvm-commits] [llvm] r45068 - /llvm/trunk/include/llvm/ADT/Trie.h Message-ID: <200712160136.lBG1aHAO017207@zion.cs.uiuc.edu> Author: asl Date: Sat Dec 15 19:36:16 2007 New Revision: 45068 URL: http://llvm.org/viewvc/llvm-project?rev=45068&view=rev Log: Define addString() and lookup() out-of-line to dissuade the C++ compiler from inlining it. Modified: llvm/trunk/include/llvm/ADT/Trie.h Modified: llvm/trunk/include/llvm/ADT/Trie.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Trie.h?rev=45068&r1=45067&r2=45068&view=diff ============================================================================== --- llvm/trunk/include/llvm/ADT/Trie.h (original) +++ llvm/trunk/include/llvm/ADT/Trie.h Sat Dec 15 19:36:16 2007 @@ -178,78 +178,84 @@ inline Node* getRoot() const { return Nodes[0]; } - bool addString(const std::string& s, const Payload& data) { - Node* cNode = getRoot(); - Node* tNode = NULL; - std::string s1(s); - - while (tNode == NULL) { - char Id = s1[0]; - if (Node* nNode = cNode->getEdge(Id)) { - typename Node::QueryResult r = nNode->query(s1); - - switch (r) { - case Node::Same: - case Node::StringIsPrefix: - // Currently we don't allow to have two strings in the trie one - // being a prefix of another. This should be fixed. - assert(0 && "FIXME!"); - return false; - case Node::DontMatch: - assert(0 && "Impossible!"); - return false; - case Node::LabelIsPrefix: - s1 = s1.substr(nNode->label().length()); - cNode = nNode; - break; - default: - nNode = splitEdge(cNode, Id, r); - tNode = addNode(data, s1.substr(r)); - nNode->addEdge(tNode); - } - } else { - tNode = addNode(data, s1); - cNode->addEdge(tNode); + bool addString(const std::string& s, const Payload& data); + const Payload& lookup(const std::string& s) const; + +}; + +// Define this out-of-line to dissuade the C++ compiler from inlining it. +template +bool Trie::addString(const std::string& s, const Payload& data) { + Node* cNode = getRoot(); + Node* tNode = NULL; + std::string s1(s); + + while (tNode == NULL) { + char Id = s1[0]; + if (Node* nNode = cNode->getEdge(Id)) { + typename Node::QueryResult r = nNode->query(s1); + + switch (r) { + case Node::Same: + case Node::StringIsPrefix: + // Currently we don't allow to have two strings in the trie one + // being a prefix of another. This should be fixed. + assert(0 && "FIXME!"); + return false; + case Node::DontMatch: + assert(0 && "Impossible!"); + return false; + case Node::LabelIsPrefix: + s1 = s1.substr(nNode->label().length()); + cNode = nNode; + break; + default: + nNode = splitEdge(cNode, Id, r); + tNode = addNode(data, s1.substr(r)); + nNode->addEdge(tNode); } + } else { + tNode = addNode(data, s1); + cNode->addEdge(tNode); } - - return true; } - const Payload& lookup(const std::string& s) const { - Node* cNode = getRoot(); - Node* tNode = NULL; - std::string s1(s); - - while (tNode == NULL) { - char Id = s1[0]; - if (Node* nNode = cNode->getEdge(Id)) { - typename Node::QueryResult r = nNode->query(s1); - - switch (r) { - case Node::Same: - tNode = nNode; - break; - case Node::StringIsPrefix: - return Empty; - case Node::DontMatch: - assert(0 && "Impossible!"); - return Empty; - case Node::LabelIsPrefix: - s1 = s1.substr(nNode->label().length()); - cNode = nNode; - break; - default: - return Empty; - } - } else - return Empty; - } + return true; +} - return tNode->data(); +template +const Payload& Trie::lookup(const std::string& s) const { + Node* cNode = getRoot(); + Node* tNode = NULL; + std::string s1(s); + + while (tNode == NULL) { + char Id = s1[0]; + if (Node* nNode = cNode->getEdge(Id)) { + typename Node::QueryResult r = nNode->query(s1); + + switch (r) { + case Node::Same: + tNode = nNode; + break; + case Node::StringIsPrefix: + return Empty; + case Node::DontMatch: + assert(0 && "Impossible!"); + return Empty; + case Node::LabelIsPrefix: + s1 = s1.substr(nNode->label().length()); + cNode = nNode; + break; + default: + return Empty; + } + } else + return Empty; } -}; + return tNode->data(); +} template struct GraphTraits > { From resistor at mac.com Sat Dec 15 22:07:24 2007 From: resistor at mac.com (Owen Anderson) Date: Sun, 16 Dec 2007 04:07:24 -0000 Subject: [llvm-commits] [llvm] r45069 - /llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Message-ID: <200712160407.lBG47PFv024608@zion.cs.uiuc.edu> Author: resistor Date: Sat Dec 15 22:07:23 2007 New Revision: 45069 URL: http://llvm.org/viewvc/llvm-project?rev=45069&view=rev Log: A few more comments. Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=45069&r1=45068&r2=45069&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original) +++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Sat Dec 15 22:07:23 2007 @@ -311,6 +311,10 @@ } } +/// processPHIUnion - Take a set of candidate registers to be coallesced when +/// decomposing the PHI instruction. Use the DominanceForest to remove the ones +/// that are known to interfere, and flag others that need to be checked for +/// local interferences. void StrongPHIElimination::processPHIUnion(MachineInstr* Inst, std::set& PHIUnion, std::vector& DF, @@ -322,6 +326,7 @@ LiveVariables& LV = getAnalysis(); unsigned DestReg = Inst->getOperand(0).getReg(); + // DF walk on the DomForest while (!worklist.empty()) { DomForestNode* DFNode = worklist.back(); @@ -350,7 +355,7 @@ // Add (p, c) to possible local interferences locals.push_back(std::make_pair(DFNode->getReg(), child->getReg())); } - + if (!visited.count(child)) { worklist.push_back(child); inserted = true; From resistor at mac.com Sat Dec 15 23:44:27 2007 From: resistor at mac.com (Owen Anderson) Date: Sun, 16 Dec 2007 05:44:27 -0000 Subject: [llvm-commits] [llvm] r45070 - /llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Message-ID: <200712160544.lBG5iS49028753@zion.cs.uiuc.edu> Author: resistor Date: Sat Dec 15 23:44:27 2007 New Revision: 45070 URL: http://llvm.org/viewvc/llvm-project?rev=45070&view=rev Log: Break local interferences in StrongPHIElimination. One step closer... Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=45070&r1=45069&r2=45070&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original) +++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Sat Dec 15 23:44:27 2007 @@ -258,6 +258,101 @@ return false; } +/// isKillInst - helper method that determines, from a VarInfo, if an +/// instruction kills a given register +bool isKillInst(LiveVariables::VarInfo& V, MachineInstr* MI) { + return std::find(V.Kills.begin(), V.Kills.end(), MI) != V.Kills.end(); +} + +/// interferes - checks for local interferences by scanning a block. The only +/// trick parameter is 'mode' which tells it the relationship of the two +/// registers. 0 - defined in the same block, 1 - first properly dominates +/// second, 2 - second properly dominates first +bool interferes(LiveVariables::VarInfo& First, LiveVariables::VarInfo& Second, + MachineBasicBlock* scan, unsigned mode) { + MachineInstr* def = 0; + MachineInstr* kill = 0; + + bool interference = false; + + // Wallk the block, checking for interferences + for (MachineBasicBlock::iterator MBI = scan->begin(), MBE = scan->end(); + MBI != MBE; ++MBI) { + MachineInstr* curr = MBI; + + // Same defining block... + if (mode == 0) { + if (curr == First.DefInst) { + // If we find our first DefInst, save it + if (!def) { + def = curr; + // If there's already an unkilled DefInst, then + // this is an interference + } else if (!kill) { + interference = true; + break; + // If there's a DefInst followed by a KillInst, then + // they can't interfere + } else { + interference = false; + break; + } + // Symmetric with the above + } else if (curr == Second.DefInst ) { + if (!def) { + def = curr; + } else if (!kill) { + interference = true; + break; + } else { + interference = false; + break; + } + // Store KillInsts if they match up with the DefInst + } else if (isKillInst(First, curr)) { + if (def == First.DefInst) { + kill = curr; + } else if (isKillInst(Second, curr)) { + if (def == Second.DefInst) { + kill = curr; + } + } + } + // First properly dominates second... + } else if (mode == 1) { + if (curr == Second.DefInst) { + // DefInst of second without kill of first is an interference + if (!kill) { + interference = true; + break; + // DefInst after a kill is a non-interference + } else { + interference = false; + break; + } + // Save KillInsts of First + } else if (isKillInst(First, curr)) { + kill = curr; + } + // Symmetric with the above + } else if (mode == 2) { + if (curr == First.DefInst) { + if (!kill) { + interference = true; + break; + } else { + interference = false; + break; + } + } else if (isKillInst(Second, curr)) { + kill = curr; + } + } + } + + return interference; +} + /// processBlock - Eliminate PHIs in the given block void StrongPHIElimination::processBlock(MachineBasicBlock* MBB) { LiveVariables& LV = getAnalysis(); @@ -305,6 +400,46 @@ processPHIUnion(P, PHIUnion, DF, localInterferences); // FIXME: Check for local interferences + for (std::vector >::iterator I = + localInterferences.begin(), E = localInterferences.end(); I != E; ++I) { + std::pair p = *I; + + LiveVariables::VarInfo& FirstInfo = LV.getVarInfo(p.first); + LiveVariables::VarInfo& SecondInfo = LV.getVarInfo(p.second); + + MachineDominatorTree& MDT = getAnalysis(); + + // Determine the block we need to scan and the relationship between + // the two registers + MachineBasicBlock* scan = 0; + unsigned mode = 0; + if (FirstInfo.DefInst->getParent() == SecondInfo.DefInst->getParent()) { + scan = FirstInfo.DefInst->getParent(); + mode = 0; // Same block + } else if (MDT.dominates(FirstInfo.DefInst->getParent(), + SecondInfo.DefInst->getParent())) { + scan = SecondInfo.DefInst->getParent(); + mode = 1; // First dominates second + } else { + scan = FirstInfo.DefInst->getParent(); + mode = 2; // Second dominates first + } + + // If there's an interference, we need to insert copies + if (interferes(FirstInfo, SecondInfo, scan, mode)) { + // Insert copies for First + for (int i = P->getNumOperands() - 1; i >= 2; i-=2) { + if (P->getOperand(i-1).getReg() == p.first) { + unsigned SrcReg = p.first; + MachineBasicBlock* From = P->getOperand(i).getMBB(); + + Waiting[From].push_back(std::make_pair(SrcReg, + P->getOperand(0).getReg())); + PHIUnion.erase(SrcReg); + } + } + } + } ProcessedNames.insert(PHIUnion.begin(), PHIUnion.end()); ++P; From isanbard at gmail.com Sun Dec 16 02:49:27 2007 From: isanbard at gmail.com (Bill Wendling) Date: Sun, 16 Dec 2007 00:49:27 -0800 Subject: [llvm-commits] [llvm] r45022 - in /llvm/trunk: include/llvm/Target/TargetInstrInfo.h lib/Target/Target.td utils/TableGen/CodeGenInstruction.h utils/TableGen/CodeGenTarget.cpp utils/TableGen/InstrInfoEmitter.cpp In-Reply-To: <17419116-6477-480D-A8BB-B00B72AAD42B@gmail.com> References: <200712140148.lBE1mxh2005906@zion.cs.uiuc.edu> <200712141129.32156.baldrick@free.fr> <16e5fdf90712141040y229de61cl7f0b36187e96ce@mail.gmail.com> <17419116-6477-480D-A8BB-B00B72AAD42B@gmail.com> Message-ID: On Dec 15, 2007, at 1:23 AM, Christopher Lamb wrote: > On Dec 14, 2007, at 10:40 AM, Bill Wendling wrote: >> My understanding of a side effect is when an instruction has >> un-modeled effects. For instance, "emms" on X86 has side effects that >> aren't modeled in the instruction pattern -- it resets the FP >> registers after MMX use. Other instructions have no un-modeled side >> effects -- e.g., "xor" on X86 or "li" on PPC. Others may have >> un-modeled side effects in some situations, but not in others -- >> e.g., >> loads, in general, have side effects (accessing memory), but loads >> from a constant pool don't. >> >> This is the working definition, anyway. In the beginning, it'll be >> closely tied to what the "isRematerializable" flag means. I don't >> know >> what GCC considers side effects. Could you give a summary? It >> would be >> good to contrast/compare with it. > > > In processor design discussions all load instructions were termed > "side affecting", as they could cause a page fault. Perhaps the key > here is whether the un-modeled effects of the instruction affect > correct program behavior? > That is the key, yes. :-) We'll leave it up to the individual back ends to tell us if moving instructions marked as "may having side effects" affects correct program behavior. -bw -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20071216/bb2187ab/attachment.html From isanbard at gmail.com Sun Dec 16 03:16:12 2007 From: isanbard at gmail.com (Bill Wendling) Date: Sun, 16 Dec 2007 09:16:12 -0000 Subject: [llvm-commits] [llvm] r45071 - /llvm/trunk/lib/AsmParser/LLLexer.cpp Message-ID: <200712160916.lBG9GDel013245@zion.cs.uiuc.edu> Author: void Date: Sun Dec 16 03:16:12 2007 New Revision: 45071 URL: http://llvm.org/viewvc/llvm-project?rev=45071&view=rev Log: Remove spurious warnings from GCC: warning: suggest a space before ';' or explicit braces around empty body in 'for' statement Patch by Mike Stump (modified slightly by yours truly). Modified: llvm/trunk/lib/AsmParser/LLLexer.cpp Modified: llvm/trunk/lib/AsmParser/LLLexer.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLLexer.cpp?rev=45071&r1=45070&r2=45071&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/LLLexer.cpp (original) +++ llvm/trunk/lib/AsmParser/LLLexer.cpp Sun Dec 16 03:16:12 2007 @@ -54,7 +54,7 @@ Result += C-'A'+10; else if (C >= 'a' && C <= 'f') Result += C-'a'+10; - + if (Result < OldRes) { // Uh, oh, overflow detected!!! GenerateError("constant bigger than 64 bits detected!"); return 0; @@ -102,7 +102,7 @@ // appropriate character. static void UnEscapeLexed(std::string &Str) { if (Str.empty()) return; - + char *Buffer = &Str[0], *EndBuffer = Buffer+Str.size(); char *BOut = Buffer; for (char *BIn = Buffer; BIn != EndBuffer; ) { @@ -168,9 +168,9 @@ // a random nul in the file. Disambiguate that here. if (CurPtr-1 != CurBuf->getBufferEnd()) return 0; // Just whitespace. - + // Otherwise, return end of file. - --CurPtr; // Another call to lex will return EOF again. + --CurPtr; // Another call to lex will return EOF again. return EOF; case '\n': case '\r': @@ -180,24 +180,24 @@ if ((*CurPtr == '\n' || (*CurPtr == '\r')) && *CurPtr != CurChar) ++CurPtr; // Eat the two char newline sequence. - + ++CurLineNo; return '\n'; - } + } } int LLLexer::LexToken() { TokStart = CurPtr; - + int CurChar = getNextChar(); - + switch (CurChar) { default: // Handle letters: [a-zA-Z_] if (isalpha(CurChar) || CurChar == '_') return LexIdentifier(); - + return CurChar; case EOF: return YYEOF; case 0: @@ -234,7 +234,7 @@ return LexToken(); case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': - case '-': + case '-': return LexDigitOrNegative(); } } @@ -254,11 +254,11 @@ // Handle AtStringConstant: @\"[^\"]*\" if (CurPtr[0] == '"') { ++CurPtr; - + while (1) { int CurChar = getNextChar(); - - if (CurChar == EOF) { + + if (CurChar == EOF) { GenerateError("End of file in global variable name"); return YYERROR; } @@ -269,30 +269,31 @@ } } } - + // Handle GlobalVarName: @[-a-zA-Z$._][-a-zA-Z$._0-9]* - if (isalpha(CurPtr[0]) || CurPtr[0] == '-' || CurPtr[0] == '$' || + if (isalpha(CurPtr[0]) || CurPtr[0] == '-' || CurPtr[0] == '$' || CurPtr[0] == '.' || CurPtr[0] == '_') { ++CurPtr; - while (isalnum(CurPtr[0]) || CurPtr[0] == '-' || CurPtr[0] == '$' || + while (isalnum(CurPtr[0]) || CurPtr[0] == '-' || CurPtr[0] == '$' || CurPtr[0] == '.' || CurPtr[0] == '_') ++CurPtr; llvmAsmlval.StrVal = new std::string(TokStart+1, CurPtr); // Skip @ return GLOBALVAR; } - + // Handle GlobalVarID: @[0-9]+ if (isdigit(CurPtr[0])) { - for (++CurPtr; isdigit(CurPtr[0]); ++CurPtr); - + for (++CurPtr; isdigit(CurPtr[0]); ++CurPtr) + /*empty*/; + uint64_t Val = atoull(TokStart+1, CurPtr); if ((unsigned)Val != Val) GenerateError("Invalid value number (too large)!"); llvmAsmlval.UIntVal = unsigned(Val); return GLOBALVAL_ID; } - + return '@'; } @@ -305,11 +306,11 @@ // Handle PctStringConstant: %\"[^\"]*\" if (CurPtr[0] == '"') { ++CurPtr; - + while (1) { int CurChar = getNextChar(); - - if (CurChar == EOF) { + + if (CurChar == EOF) { GenerateError("End of file in local variable name"); return YYERROR; } @@ -320,30 +321,31 @@ } } } - + // Handle LocalVarName: %[-a-zA-Z$._][-a-zA-Z$._0-9]* - if (isalpha(CurPtr[0]) || CurPtr[0] == '-' || CurPtr[0] == '$' || + if (isalpha(CurPtr[0]) || CurPtr[0] == '-' || CurPtr[0] == '$' || CurPtr[0] == '.' || CurPtr[0] == '_') { ++CurPtr; - while (isalnum(CurPtr[0]) || CurPtr[0] == '-' || CurPtr[0] == '$' || + while (isalnum(CurPtr[0]) || CurPtr[0] == '-' || CurPtr[0] == '$' || CurPtr[0] == '.' || CurPtr[0] == '_') ++CurPtr; - + llvmAsmlval.StrVal = new std::string(TokStart+1, CurPtr); // Skip % return LOCALVAR; } - + // Handle LocalVarID: %[0-9]+ if (isdigit(CurPtr[0])) { - for (++CurPtr; isdigit(CurPtr[0]); ++CurPtr); - + for (++CurPtr; isdigit(CurPtr[0]); ++CurPtr) + /*empty*/; + uint64_t Val = atoull(TokStart+1, CurPtr); if ((unsigned)Val != Val) GenerateError("Invalid value number (too large)!"); llvmAsmlval.UIntVal = unsigned(Val); return LOCALVAL_ID; } - + return '%'; } @@ -353,12 +355,12 @@ int LLLexer::LexQuote() { while (1) { int CurChar = getNextChar(); - - if (CurChar == EOF) { + + if (CurChar == EOF) { GenerateError("End of file in quoted string"); return YYERROR; } - + if (CurChar != '"') continue; if (CurPtr[0] != ':') { @@ -366,7 +368,7 @@ UnEscapeLexed(*llvmAsmlval.StrVal); return STRINGCONSTANT; } - + ++CurPtr; llvmAsmlval.StrVal = new std::string(TokStart+1, CurPtr-2); UnEscapeLexed(*llvmAsmlval.StrVal); @@ -395,26 +397,26 @@ const char *StartChar = CurPtr; const char *IntEnd = CurPtr[-1] == 'i' ? 0 : StartChar; const char *KeywordEnd = 0; - + for (; isLabelChar(*CurPtr); ++CurPtr) { // If we decide this is an integer, remember the end of the sequence. if (!IntEnd && !isdigit(*CurPtr)) IntEnd = CurPtr; if (!KeywordEnd && !isalnum(*CurPtr) && *CurPtr != '_') KeywordEnd = CurPtr; } - + // If we stopped due to a colon, this really is a label. if (*CurPtr == ':') { llvmAsmlval.StrVal = new std::string(StartChar-1, CurPtr++); return LABELSTR; } - + // Otherwise, this wasn't a label. If this was valid as an integer type, // return it. if (IntEnd == 0) IntEnd = CurPtr; if (IntEnd != StartChar) { CurPtr = IntEnd; uint64_t NumBits = atoull(StartChar, CurPtr); - if (NumBits < IntegerType::MIN_INT_BITS || + if (NumBits < IntegerType::MIN_INT_BITS || NumBits > IntegerType::MAX_INT_BITS) { GenerateError("Bitwidth for integer type out of range!"); return YYERROR; @@ -423,7 +425,7 @@ llvmAsmlval.PrimType = Ty; return INTTYPE; } - + // Otherwise, this was a letter sequence. See which keyword this is. if (KeywordEnd == 0) KeywordEnd = CurPtr; CurPtr = KeywordEnd; @@ -440,7 +442,7 @@ KEYWORD("define", DEFINE); KEYWORD("global", GLOBAL); KEYWORD("constant", CONSTANT); - + KEYWORD("internal", INTERNAL); KEYWORD("linkonce", LINKONCE); KEYWORD("weak", WEAK); @@ -470,14 +472,14 @@ KEYWORD("asm", ASM_TOK); KEYWORD("sideeffect", SIDEEFFECT); KEYWORD("gc", GC); - + KEYWORD("cc", CC_TOK); KEYWORD("ccc", CCC_TOK); KEYWORD("fastcc", FASTCC_TOK); KEYWORD("coldcc", COLDCC_TOK); KEYWORD("x86_stdcallcc", X86_STDCALLCC_TOK); KEYWORD("x86_fastcallcc", X86_FASTCALLCC_TOK); - + KEYWORD("signext", SIGNEXT); KEYWORD("zeroext", ZEROEXT); KEYWORD("inreg", INREG); @@ -489,7 +491,7 @@ KEYWORD("nest", NEST); KEYWORD("readnone", READNONE); KEYWORD("readonly", READONLY); - + KEYWORD("type", TYPE); KEYWORD("opaque", OPAQUE); @@ -539,7 +541,7 @@ if (JustWhitespaceNewLine(CurPtr)) return ZEROEXT; } - + // Keywords for instructions. #define INSTKEYWORD(STR, type, Enum, TOK) \ if (Len == strlen(STR) && !memcmp(StartChar, STR, strlen(STR))) { \ @@ -596,8 +598,8 @@ INSTKEYWORD("extractelement", OtherOpVal, ExtractElement, EXTRACTELEMENT); INSTKEYWORD("insertelement", OtherOpVal, InsertElement, INSERTELEMENT); INSTKEYWORD("shufflevector", OtherOpVal, ShuffleVector, SHUFFLEVECTOR); -#undef INSTKEYWORD - +#undef INSTKEYWORD + // Check for [us]0x[0-9A-Fa-f]+ which are Hexadecimal constant generated by // the CFE to avoid forcing it to deal with 64-bit numbers. if ((TokStart[0] == 'u' || TokStart[0] == 's') && @@ -619,13 +621,13 @@ return EUINT64VAL; } } - + // If this is "cc1234", return this as just "cc". if (TokStart[0] == 'c' && TokStart[1] == 'c') { CurPtr = TokStart+2; return CC_TOK; } - + // If this starts with "call", return it as CALL. This is to support old // broken .ll files. FIXME: remove this with LLVM 3.0. if (CurPtr-TokStart > 4 && !memcmp(TokStart, "call", 4)) { @@ -633,7 +635,7 @@ llvmAsmlval.OtherOpVal = Instruction::Call; return CALL; } - + // Finally, if this isn't known, return just a single character. CurPtr = TokStart+1; return TokStart[0]; @@ -648,7 +650,7 @@ /// HexPPC128Constant 0xM[0-9A-Fa-f]+ int LLLexer::Lex0x() { CurPtr = TokStart + 2; - + char Kind; if (CurPtr[0] >= 'K' && CurPtr[0] <= 'M') { Kind = *CurPtr++; @@ -661,18 +663,18 @@ CurPtr = TokStart+1; return '0'; } - + while (isxdigit(CurPtr[0])) ++CurPtr; - + if (Kind == 'J') { // HexFPConstant - Floating point constant represented in IEEE format as a // hexadecimal number for when exponential notation is not precise enough. // Float and double only. - llvmAsmlval.FPVal = new APFloat(HexToFP(TokStart+2, CurPtr)); + llvmAsmlval.FPVal = new APFloat(HexToFP(TokStart+2, CurPtr)); return FPVAL; } - + uint64_t Pair[2]; HexToIntPair(TokStart+3, CurPtr, Pair); switch (Kind) { @@ -710,15 +712,16 @@ CurPtr = End; return LABELSTR; } - + return CurPtr[-1]; } - + // At this point, it is either a label, int or fp constant. - + // Skip digits, we have at least one. - for (; isdigit(CurPtr[0]); ++CurPtr); - + for (; isdigit(CurPtr[0]); ++CurPtr) + /*empty*/; + // Check to see if this really is a label afterall, e.g. "-1:". if (isLabelChar(CurPtr[0]) || CurPtr[0] == ':') { if (const char *End = isLabelTail(CurPtr)) { @@ -727,7 +730,7 @@ return LABELSTR; } } - + // If the next character is a '.', then it is a fp value, otherwise its // integer. if (CurPtr[0] != '.') { @@ -753,7 +756,7 @@ Tmp.trunc(activeBits); if (Tmp.getBitWidth() > 64) { llvmAsmlval.APIntVal = new APInt(Tmp); - return EUAPINTVAL; + return EUAPINTVAL; } else { llvmAsmlval.UInt64Val = Tmp.getZExtValue(); return EUINT64VAL; @@ -762,20 +765,20 @@ } ++CurPtr; - + // Skip over [0-9]*([eE][-+]?[0-9]+)? while (isdigit(CurPtr[0])) ++CurPtr; - + if (CurPtr[0] == 'e' || CurPtr[0] == 'E') { - if (isdigit(CurPtr[1]) || + if (isdigit(CurPtr[1]) || ((CurPtr[1] == '-' || CurPtr[1] == '+') && isdigit(CurPtr[2]))) { CurPtr += 2; while (isdigit(CurPtr[0])) ++CurPtr; } } - + llvmAsmlval.FPVal = new APFloat(atof(TokStart)); - return FPVAL; + return FPVAL; } /// FPConstant [-+]?[0-9]+[.][0-9]*([eE][-+]?[0-9]+)? @@ -784,31 +787,32 @@ // label. if (!isdigit(CurPtr[0])) return CurPtr[-1]; - + // Skip digits. - for (++CurPtr; isdigit(CurPtr[0]); ++CurPtr); + for (++CurPtr; isdigit(CurPtr[0]); ++CurPtr) + /*empty*/; // At this point, we need a '.'. if (CurPtr[0] != '.') { CurPtr = TokStart+1; return TokStart[0]; } - + ++CurPtr; - + // Skip over [0-9]*([eE][-+]?[0-9]+)? while (isdigit(CurPtr[0])) ++CurPtr; - + if (CurPtr[0] == 'e' || CurPtr[0] == 'E') { - if (isdigit(CurPtr[1]) || + if (isdigit(CurPtr[1]) || ((CurPtr[1] == '-' || CurPtr[1] == '+') && isdigit(CurPtr[2]))) { CurPtr += 2; while (isdigit(CurPtr[0])) ++CurPtr; } } - + llvmAsmlval.FPVal = new APFloat(atof(TokStart)); - return FPVAL; + return FPVAL; } From baldrick at free.fr Sun Dec 16 09:39:41 2007 From: baldrick at free.fr (Duncan Sands) Date: Sun, 16 Dec 2007 15:39:41 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r45072 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Message-ID: <200712161539.lBGFdf0M023802@zion.cs.uiuc.edu> Author: baldrick Date: Sun Dec 16 09:39:40 2007 New Revision: 45072 URL: http://llvm.org/viewvc/llvm-project?rev=45072&view=rev Log: Give calls to inline assembler the nounwind attribute. Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=45072&r1=45071&r2=45072&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Sun Dec 16 09:39:40 2007 @@ -3289,6 +3289,16 @@ //===----------------------------------------------------------------------===// +/// Return a ParamAttrsList for the given function return attributes. +const ParamAttrsList *getReturnAttrs(uint16_t attrs) { + if (attrs == ParamAttr::None) + return NULL; + + ParamAttrsVector Attrs; + Attrs.push_back(ParamAttrsWithIndex::get(0, attrs)); + return ParamAttrsList::get(Attrs); +} + /// Reads from register variables are handled by emitting an inline asm node /// that copies the value out of the specified register. Value *TreeToLLVM::EmitReadOfRegisterVariable(tree decl, @@ -3307,7 +3317,9 @@ const char *Name = extractRegisterName(decl); InlineAsm *IA = InlineAsm::get(FTy, "", "={"+std::string(Name)+"}", false); - return Builder.CreateCall(IA, "tmp"); + CallInst *Call = Builder.CreateCall(IA, "tmp"); + Call->setParamAttrs(getReturnAttrs(ParamAttr::NoUnwind)); + return Call; } /// Stores to register variables are handled by emitting an inline asm node @@ -3324,7 +3336,8 @@ const char *Name = extractRegisterName(decl); InlineAsm *IA = InlineAsm::get(FTy, "", "{"+std::string(Name)+"}", true); - Builder.CreateCall(IA, RHS); + CallInst *Call = Builder.CreateCall(IA, RHS); + Call->setParamAttrs(getReturnAttrs(ParamAttr::NoUnwind)); } /// ConvertInlineAsmStr - Convert the specified inline asm string to an LLVM @@ -3747,7 +3760,8 @@ ASM_VOLATILE_P(exp) || !ASM_OUTPUTS(exp)); CallInst *CV = Builder.CreateCall(Asm, CallOps.begin(), CallOps.end(), StoreCallResultAddr ? "tmp" : ""); - + CV->setParamAttrs(getReturnAttrs(ParamAttr::NoUnwind)); + // If the call produces a value, store it into the destination. if (StoreCallResultAddr) Builder.CreateStore(CV, StoreCallResultAddr); From baldrick at free.fr Sun Dec 16 09:51:50 2007 From: baldrick at free.fr (Duncan Sands) Date: Sun, 16 Dec 2007 15:51:50 -0000 Subject: [llvm-commits] [llvm] r45073 - in /llvm/trunk: include/llvm/Support/CallSite.h lib/Transforms/Scalar/InstructionCombining.cpp lib/Transforms/Utils/InlineFunction.cpp lib/VMCore/Instructions.cpp test/CFrontend/2007-12-16-AsmNoUnwind.c test/Transforms/Inline/2007-04-15-InlineEH.ll test/Transforms/InstCombine/2007-12-16-AsmNoUnwind.ll Message-ID: <200712161551.lBGFpoVu024930@zion.cs.uiuc.edu> Author: baldrick Date: Sun Dec 16 09:51:49 2007 New Revision: 45073 URL: http://llvm.org/viewvc/llvm-project?rev=45073&view=rev Log: Make instcombine promote inline asm calls to 'nounwind' calls. Remove special casing of inline asm from the inliner. There is a potential problem: the verifier rejects invokes of inline asm (not sure why). If an asm call is not marked "nounwind" in some .ll, and instcombine is not run, but the inliner is run, then an illegal module will be created. This is bad but I'm not sure what the best approach is. I'm tempted to remove the check in the verifier... Added: llvm/trunk/test/CFrontend/2007-12-16-AsmNoUnwind.c llvm/trunk/test/Transforms/InstCombine/2007-12-16-AsmNoUnwind.ll Modified: llvm/trunk/include/llvm/Support/CallSite.h llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp llvm/trunk/lib/VMCore/Instructions.cpp llvm/trunk/test/Transforms/Inline/2007-04-15-InlineEH.ll Modified: llvm/trunk/include/llvm/Support/CallSite.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CallSite.h?rev=45073&r1=45072&r2=45073&view=diff ============================================================================== --- llvm/trunk/include/llvm/Support/CallSite.h (original) +++ llvm/trunk/include/llvm/Support/CallSite.h Sun Dec 16 09:51:49 2007 @@ -73,6 +73,9 @@ /// @brief Determine if the call does not access or only reads memory. bool onlyReadsMemory() const; + /// @brief Determine if the call cannot unwind. + bool isNoUnwind() const; + /// getType - Return the type of the instruction that generated this call site /// const Type *getType() const { return I->getType(); } Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=45073&r1=45072&r2=45073&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Sun Dec 16 09:51:49 2007 @@ -7972,6 +7972,19 @@ } } + if (isa(Callee) && !CS.isNoUnwind()) { + // Inline asm calls cannot throw - mark them 'nounwind'. + const ParamAttrsList *PAL = CS.getParamAttrs(); + uint16_t RAttributes = PAL ? PAL->getParamAttrs(0) : 0; + RAttributes |= ParamAttr::NoUnwind; + + ParamAttrsVector modVec; + modVec.push_back(ParamAttrsWithIndex::get(0, RAttributes)); + PAL = ParamAttrsList::getModified(PAL, modVec); + CS.setParamAttrs(PAL); + Changed = true; + } + return Changed ? CS.getInstruction() : 0; } Modified: llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp?rev=45073&r1=45072&r2=45073&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp Sun Dec 16 09:51:49 2007 @@ -69,9 +69,8 @@ if (!isa(I)) continue; CallInst *CI = cast(I); - // If this call cannot unwind or is an inline asm, don't - // convert it to an invoke. - if (CI->isNoUnwind() || isa(CI->getCalledValue())) + // If this call cannot unwind, don't convert it to an invoke. + if (CI->isNoUnwind()) continue; // Convert this function call into an invoke instruction. Modified: llvm/trunk/lib/VMCore/Instructions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=45073&r1=45072&r2=45073&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Instructions.cpp (original) +++ llvm/trunk/lib/VMCore/Instructions.cpp Sun Dec 16 09:51:49 2007 @@ -65,6 +65,12 @@ else return cast(I)->onlyReadsMemory(); } +bool CallSite::isNoUnwind() const { + if (CallInst *CI = dyn_cast(I)) + return CI->isNoUnwind(); + else + return cast(I)->isNoUnwind(); +} Added: llvm/trunk/test/CFrontend/2007-12-16-AsmNoUnwind.c URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CFrontend/2007-12-16-AsmNoUnwind.c?rev=45073&view=auto ============================================================================== --- llvm/trunk/test/CFrontend/2007-12-16-AsmNoUnwind.c (added) +++ llvm/trunk/test/CFrontend/2007-12-16-AsmNoUnwind.c Sun Dec 16 09:51:49 2007 @@ -0,0 +1,3 @@ +// RUN: %llvmgcc %s -S -o - | grep nounwind + +void bar() { asm (""); } Modified: llvm/trunk/test/Transforms/Inline/2007-04-15-InlineEH.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/2007-04-15-InlineEH.ll?rev=45073&r1=45072&r2=45073&view=diff ============================================================================== --- llvm/trunk/test/Transforms/Inline/2007-04-15-InlineEH.ll (original) +++ llvm/trunk/test/Transforms/Inline/2007-04-15-InlineEH.ll Sun Dec 16 09:51:49 2007 @@ -8,7 +8,7 @@ define void @bc__support__high_resolution_time__clock() { entry: - call void asm "rdtsc\0A\09movl %eax, $0\0A\09movl %edx, $1", "=*imr,=*imr,~{dirflag},~{fpsr},~{flags},~{dx},~{ax}"( i32* null, i32* null ) + call void asm "rdtsc\0A\09movl %eax, $0\0A\09movl %edx, $1", "=*imr,=*imr,~{dirflag},~{fpsr},~{flags},~{dx},~{ax}"( i32* null, i32* null ) nounwind unreachable } Added: llvm/trunk/test/Transforms/InstCombine/2007-12-16-AsmNoUnwind.ll URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2007-12-16-AsmNoUnwind.ll?rev=45073&view=auto ============================================================================== --- llvm/trunk/test/Transforms/InstCombine/2007-12-16-AsmNoUnwind.ll (added) +++ llvm/trunk/test/Transforms/InstCombine/2007-12-16-AsmNoUnwind.ll Sun Dec 16 09:51:49 2007 @@ -0,0 +1,7 @@ +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep nounwind + +define void @bar() { +entry: + call void asm sideeffect "", "~{dirflag},~{fpsr},~{flags}"( ) + ret void +} From clattner at apple.com Sun Dec 16 14:00:07 2007 From: clattner at apple.com (Chris Lattner) Date: Sun, 16 Dec 2007 12:00:07 -0800 Subject: [llvm-commits] [llvm] r45022 - in /llvm/trunk: include/llvm/Target/TargetInstrInfo.h lib/Target/Target.td utils/TableGen/CodeGenInstruction.h utils/TableGen/CodeGenTarget.cpp utils/TableGen/InstrInfoEmitter.cpp In-Reply-To: <200712140148.lBE1mxh2005906@zion.cs.uiuc.edu> References: <200712140148.lBE1mxh2005906@zion.cs.uiuc.edu> Message-ID: <8940D3A8-8C32-422E-A08A-BC0133789643@apple.com> On Dec 13, 2007, at 5:48 PM, Bill Wendling wrote: > URL: http://llvm.org/viewvc/llvm-project?rev=45022&view=rev > Log: > Add flags to indicate that there are "never" side effects or that > there "may be" > side effects for machine instructions. Hi Bill, > +++ llvm/trunk/include/llvm/Target/TargetInstrInfo.h Thu Dec 13 > 19:48:59 2007 > @@ -91,6 +91,18 @@ > // ARM instructions which can set condition code if 's' bit is set. > const unsigned M_HAS_OPTIONAL_DEF = 1 << 17; > > +// M_MAY_HAVE_SIDE_EFFECTS - Set if this instruction *might* have > side effects, > +// e.g. load instructions. Note: This and M_NEVER_HAS_SIDE_EFFECTS > are mutually > +// exclusive. You can't set both! If neither flag is set, then the > instruction > +// *always* has side effects. > +const unsigned M_MAY_HAVE_SIDE_EFFECTS = 1 << 18; > + > +// M_NEVER_HAS_SIDE_EFFECTS - Set if this instruction *never* has > side effects, > +// e.g., xor on X86. Note: This and M_MAY_HAVE_SIDE_EFFECTS are > mutually > +// exclusive. You can't set both! If neither flag is set, then the > instruction > +// *always* has side effects. > +const unsigned M_NEVER_HAS_SIDE_EFFECTS = 1 << 19; As others have pointed out, we need to be much more clear about what these mean. Specifically, I'd list "NEVER" first (it is easier to explain). The pertinent point here is completely missing in the comments: this flag is set on an instruction where there is a side effect that is not captured by any *operands* of the instruction or *other flags*. Instructions that are "isBranch" instructions but have no other side effects should have M_NEVER_HAS_SIDE_EFFECTS set. This flag should only be set on an instruction when *all instances* of an instruction of that opcode have no side effects in this way. Your description of M_MAY_HAVE_SIDE_EFFECTS is also quite poor. Its point in life is to handle the case when *some instances* of an instruction can have side effects, but others don't. You need to explain that this causes the invocation of some virtual method (which should be named) that the target can implement to make the determination. Give an example of why this is useful: loads in general have side effects, but loads from the constant pool don't. This criticism just applies to the comments for the flags, the functionality of the patch looks great! > bit usesCustomDAGSchedInserter = 0; // Pseudo instr needing > special help. > bit hasCtrlDep = 0; // Does this instruction r/w ctrl-flow > chains? > bit isNotDuplicable = 0; // Is it unsafe to duplicate this > instruction? > + > + // Side effect flags - If neither of these flags is set, then the > instruction > + // *always* has side effects. Otherwise, it's one or the other. Please also make these much more clear, as above. Thanks Bill, -Chris > + bit mayHaveSideEffects = 0; // This instruction *may* have side > effects. > + bit neverHasSideEffects = 0; // This instruction never has side > effects. > > InstrItinClass Itinerary = NoItinerary;// Execution steps used for > scheduling. > > > Modified: llvm/trunk/utils/TableGen/CodeGenInstruction.h > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenInstruction.h?rev=45022&r1=45021&r2=45022&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/utils/TableGen/CodeGenInstruction.h (original) > +++ llvm/trunk/utils/TableGen/CodeGenInstruction.h Thu Dec 13 > 19:48:59 2007 > @@ -104,6 +104,8 @@ > bool hasCtrlDep; > bool isNotDuplicable; > bool hasOptionalDef; > + bool mayHaveSideEffects; > + bool neverHasSideEffects; > > /// ParseOperandName - Parse an operand name like "$foo" or > "$foo.bar", > /// where $foo is a whole operand and $foo.bar refers to a > suboperand. > > Modified: llvm/trunk/utils/TableGen/CodeGenTarget.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/CodeGenTarget.cpp?rev=45022&r1=45021&r2=45022&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/utils/TableGen/CodeGenTarget.cpp (original) > +++ llvm/trunk/utils/TableGen/CodeGenTarget.cpp Thu Dec 13 19:48:59 > 2007 > @@ -395,9 +395,15 @@ > usesCustomDAGSchedInserter = R- > >getValueAsBit("usesCustomDAGSchedInserter"); > hasCtrlDep = R->getValueAsBit("hasCtrlDep"); > isNotDuplicable = R->getValueAsBit("isNotDuplicable"); > + mayHaveSideEffects = R->getValueAsBit("mayHaveSideEffects"); > + neverHasSideEffects = R->getValueAsBit("neverHasSideEffects"); > hasOptionalDef = false; > hasVariableNumberOfOperands = false; > - > + > + if (mayHaveSideEffects && neverHasSideEffects) > + throw R->getName() + > + ": cannot have both 'mayHaveSideEffects' and > 'neverHasSideEffects' set!"; > + > DagInit *DI; > try { > DI = R->getValueAsDag("OutOperandList"); > > Modified: llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp > URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp?rev=45022&r1=45021&r2=45022&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp (original) > +++ llvm/trunk/utils/TableGen/InstrInfoEmitter.cpp Thu Dec 13 > 19:48:59 2007 > @@ -253,8 +253,9 @@ > if (Inst.hasOptionalDef) OS << "|M_HAS_OPTIONAL_DEF"; > if (Inst.usesCustomDAGSchedInserter) > OS << "|M_USES_CUSTOM_DAG_SCHED_INSERTION"; > - if (Inst.hasVariableNumberOfOperands) > - OS << "|M_VARIABLE_OPS"; > + if (Inst.hasVariableNumberOfOperands) OS << "|M_VARIABLE_OPS"; > + if (Inst.mayHaveSideEffects) OS << "|M_MAY_HAVE_SIDE_EFFECTS"; > + if (Inst.neverHasSideEffects) OS << "|M_NEVER_HAS_SIDE_EFFECTS"; > OS << ", 0"; > > // Emit all of the target-specific flags... > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From sabre at nondot.org Sun Dec 16 14:12:42 2007 From: sabre at nondot.org (Chris Lattner) Date: Sun, 16 Dec 2007 20:12:42 -0000 Subject: [llvm-commits] [llvm] r45074 - in /llvm/trunk/lib/Target/X86: X86InstrFormats.td X86InstrSSE.td Message-ID: <200712162012.lBGKCgEx006765@zion.cs.uiuc.edu> Author: lattner Date: Sun Dec 16 14:12:41 2007 New Revision: 45074 URL: http://llvm.org/viewvc/llvm-project?rev=45074&view=rev Log: Fix the JIT encoding of cmp*ss, which aborts with this assertion currently: X86CodeEmitter.cpp:378: failed assertion `0 && "Immediate size not set!"' I *think* this is right, but Evan, please verify. It also looks like CMPSDrr and maybe others are missing this info. Evan, plz investigate. Modified: llvm/trunk/lib/Target/X86/X86InstrFormats.td llvm/trunk/lib/Target/X86/X86InstrSSE.td Modified: llvm/trunk/lib/Target/X86/X86InstrFormats.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrFormats.td?rev=45074&r1=45073&r2=45074&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrFormats.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrFormats.td Sun Dec 16 14:12:41 2007 @@ -145,6 +145,8 @@ class SSI o, Format F, dag outs, dag ins, string asm, list pattern> : I, XS, Requires<[HasSSE1]>; +class SSIi8 o, Format F, dag outs, dag ins, string asm, list pattern> + : Ii8, XS, Requires<[HasSSE1]>; class PSI o, Format F, dag outs, dag ins, string asm, list pattern> : I, TB, Requires<[HasSSE1]>; class PSIi8 o, Format F, dag outs, dag ins, string asm, Modified: llvm/trunk/lib/Target/X86/X86InstrSSE.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrSSE.td?rev=45074&r1=45073&r2=45074&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86InstrSSE.td (original) +++ llvm/trunk/lib/Target/X86/X86InstrSSE.td Sun Dec 16 14:12:41 2007 @@ -385,10 +385,10 @@ // Comparison instructions let isTwoAddress = 1 in { - def CMPSSrr : SSI<0xC2, MRMSrcReg, + def CMPSSrr : SSIi8<0xC2, MRMSrcReg, (outs FR32:$dst), (ins FR32:$src1, FR32:$src, SSECC:$cc), "cmp${cc}ss\t{$src, $dst|$dst, $src}", []>; - def CMPSSrm : SSI<0xC2, MRMSrcMem, + def CMPSSrm : SSIi8<0xC2, MRMSrcMem, (outs FR32:$dst), (ins FR32:$src1, f32mem:$src, SSECC:$cc), "cmp${cc}ss\t{$src, $dst|$dst, $src}", []>; } @@ -405,12 +405,12 @@ // Aliases to match intrinsics which expect XMM operand(s). let isTwoAddress = 1 in { - def Int_CMPSSrr : SSI<0xC2, MRMSrcReg, + def Int_CMPSSrr : SSIi8<0xC2, MRMSrcReg, (outs VR128:$dst), (ins VR128:$src1, VR128:$src, SSECC:$cc), "cmp${cc}ss\t{$src, $dst|$dst, $src}", [(set VR128:$dst, (int_x86_sse_cmp_ss VR128:$src1, VR128:$src, imm:$cc))]>; - def Int_CMPSSrm : SSI<0xC2, MRMSrcMem, + def Int_CMPSSrm : SSIi8<0xC2, MRMSrcMem, (outs VR128:$dst), (ins VR128:$src1, f32mem:$src, SSECC:$cc), "cmp${cc}ss\t{$src, $dst|$dst, $src}", [(set VR128:$dst, (int_x86_sse_cmp_ss VR128:$src1, From sabre at nondot.org Sun Dec 16 14:26:54 2007 From: sabre at nondot.org (Chris Lattner) Date: Sun, 16 Dec 2007 20:26:54 -0000 Subject: [llvm-commits] [llvm] r45075 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200712162026.lBGKQswc007482@zion.cs.uiuc.edu> Author: lattner Date: Sun Dec 16 14:26:54 2007 New Revision: 45075 URL: http://llvm.org/viewvc/llvm-project?rev=45075&view=rev Log: fix a questionable cast, thanks to Mike Stump for pointing this out. Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=45075&r1=45074&r2=45075&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sun Dec 16 14:26:54 2007 @@ -5302,7 +5302,7 @@ Disp = DAG.getNode(ISD::SUB, MVT::i32, FPtr, Addr); unsigned char MOV32ri = TII->getBaseOpcodeFor(X86::MOV32ri); - unsigned char N86Reg = ((X86RegisterInfo&)RegInfo).getX86RegNum(NestReg); + unsigned char N86Reg = ((X86RegisterInfo*)RegInfo)->getX86RegNum(NestReg); OutChains[0] = DAG.getStore(Root, DAG.getConstant(MOV32ri|N86Reg, MVT::i8), Trmp, TrmpSV->getValue(), TrmpSV->getOffset()); From sabre at nondot.org Sun Dec 16 14:41:33 2007 From: sabre at nondot.org (Chris Lattner) Date: Sun, 16 Dec 2007 20:41:33 -0000 Subject: [llvm-commits] [llvm] r45076 - /llvm/trunk/lib/Target/CellSPU/SPUOperands.td Message-ID: <200712162041.lBGKfX4W008252@zion.cs.uiuc.edu> Author: lattner Date: Sun Dec 16 14:41:33 2007 New Revision: 45076 URL: http://llvm.org/viewvc/llvm-project?rev=45076&view=rev Log: don't violate C TBAA rules, use FloatToBits instead. Modified: llvm/trunk/lib/Target/CellSPU/SPUOperands.td Modified: llvm/trunk/lib/Target/CellSPU/SPUOperands.td URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CellSPU/SPUOperands.td?rev=45076&r1=45075&r2=45076&view=diff ============================================================================== --- llvm/trunk/lib/Target/CellSPU/SPUOperands.td (original) +++ llvm/trunk/lib/Target/CellSPU/SPUOperands.td Sun Dec 16 14:41:33 2007 @@ -153,33 +153,25 @@ // Transform a float, returning the high 16 bits shifted down, as if // the float was really an unsigned integer: def HI16_f32 : SDNodeXFormgetValueAPF(); - float fval = apf.convertToFloat(); - unsigned val = *((unsigned *) &fval); - return getI32Imm(val >> 16); + float fval = N->getValueAPF().convertToFloat(); + return getI32Imm(FloatToBits(fval) >> 16); }]>; // Transformation function on floats: get the low 16 bits as if the float was // an unsigned integer. def LO16_f32 : SDNodeXFormgetValueAPF(); - float fval = apf.convertToFloat(); - unsigned val = *((unsigned *) &fval); - return getI32Imm(val & 0xffff); + float fval = N->getValueAPF().convertToFloat(); + return getI32Imm(FloatToBits(fval) & 0xffff); }]>; def FPimm_sext16 : SDNodeXFormgetValueAPF(); - float fval = apf.convertToFloat(); - unsigned val = *((unsigned *) &fval); - return getI32Imm((int) ((val << 16) >> 16)); + float fval = N->getValueAPF().convertToFloat(); + return getI32Imm((int) ((FloatToBits(fval) << 16) >> 16)); }]>; def FPimm_u18 : SDNodeXFormgetValueAPF(); - float fval = apf.convertToFloat(); - unsigned val = *((unsigned *) &fval); - return getI32Imm(val & ((1 << 19) - 1)); + float fval = N->getValueAPF().convertToFloat(); + return getI32Imm(FloatToBits(fval) & ((1 << 19) - 1)); }]>; def fpimmSExt16 : PatLeaf<(fpimm), [{ @@ -190,9 +182,7 @@ // Does the SFP constant only have upp 16 bits set? def hi16_f32 : PatLeaf<(fpimm), [{ if (N->getValueType(0) == MVT::f32) { - const APFloat &apf = N->getValueAPF(); - float fval = apf.convertToFloat(); - uint32_t val = *((unsigned *) &fval); + uint32_t val = FloatToBits(N->getValueAPF().convertToFloat()); return ((val & 0xffff0000) == val); } @@ -202,9 +192,7 @@ // Does the SFP constant fit into 18 bits? def fpimm18 : PatLeaf<(fpimm), [{ if (N->getValueType(0) == MVT::f32) { - const APFloat &apf = N->getValueAPF(); - float fval = apf.convertToFloat(); - uint32_t Value = *((uint32_t *) &fval); + uint32_t Value = FloatToBits(N->getValueAPF().convertToFloat()); return ((Value & ((1 << 19) - 1)) == Value); } From clattner at apple.com Sun Dec 16 14:50:50 2007 From: clattner at apple.com (Chris Lattner) Date: Sun, 16 Dec 2007 12:50:50 -0800 Subject: [llvm-commits] [llvm] r45073 - in /llvm/trunk: include/llvm/Support/CallSite.h lib/Transforms/Scalar/InstructionCombining.cpp lib/Transforms/Utils/InlineFunction.cpp lib/VMCore/Instructions.cpp test/CFrontend/2007-12-16-AsmNoUnwind.c test/Transforms/Inline/2007-04-15-InlineEH.ll test/Transforms/InstCombine/2007-12-16-AsmNoUnwind.ll In-Reply-To: <200712161551.lBGFpoVu024930@zion.cs.uiuc.edu> References: <200712161551.lBGFpoVu024930@zion.cs.uiuc.edu> Message-ID: <025372CE-A218-43CE-BD5C-3FB11FC0C19C@apple.com> > URL: http://llvm.org/viewvc/llvm-project?rev=45073&view=rev > Log: > Make instcombine promote inline asm calls to 'nounwind' > calls. Nice. > Remove special casing of inline asm from the > inliner. There is a potential problem: the verifier > rejects invokes of inline asm (not sure why). Please restore the inliner to not do this or change the verifier to not reject it. Right now you have broken the tree. > +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Sun > Dec 16 09:51:49 2007 > @@ -7972,6 +7972,19 @@ > } > } > > + if (isa(Callee) && !CS.isNoUnwind()) { > + // Inline asm calls cannot throw - mark them 'nounwind'. > + const ParamAttrsList *PAL = CS.getParamAttrs(); > + uint16_t RAttributes = PAL ? PAL->getParamAttrs(0) : 0; > + RAttributes |= ParamAttr::NoUnwind; > + > + ParamAttrsVector modVec; > + modVec.push_back(ParamAttrsWithIndex::get(0, RAttributes)); > + PAL = ParamAttrsList::getModified(PAL, modVec); > + CS.setParamAttrs(PAL); > + Changed = true; > + } Should this go in a helper function? Something like CS.addAttribute(ParamAttr::NoUnwind) ? -Chris From baldrick at free.fr Sun Dec 16 15:01:21 2007 From: baldrick at free.fr (Duncan Sands) Date: Sun, 16 Dec 2007 21:01:21 -0000 Subject: [llvm-commits] [llvm] r45077 - /llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp Message-ID: <200712162101.lBGL1LeH009531@zion.cs.uiuc.edu> Author: baldrick Date: Sun Dec 16 15:01:21 2007 New Revision: 45077 URL: http://llvm.org/viewvc/llvm-project?rev=45077&view=rev Log: Revert this part of r45073 until the verifier is changed not to reject invoke of inline asm. Modified: llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp Modified: llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp?rev=45077&r1=45076&r2=45077&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp Sun Dec 16 15:01:21 2007 @@ -69,8 +69,9 @@ if (!isa(I)) continue; CallInst *CI = cast(I); - // If this call cannot unwind, don't convert it to an invoke. - if (CI->isNoUnwind()) + // If this call cannot unwind or is an inline asm, don't + // convert it to an invoke. + if (CI->isNoUnwind() || isa(CI->getCalledValue())) continue; // Convert this function call into an invoke instruction. From baldrick at free.fr Sun Dec 16 15:04:57 2007 From: baldrick at free.fr (Duncan Sands) Date: Sun, 16 Dec 2007 22:04:57 +0100 Subject: [llvm-commits] [llvm] r45073 - in /llvm/trunk: include/llvm/Support/CallSite.h lib/Transforms/Scalar/InstructionCombining.cpp lib/Transforms/Utils/InlineFunction.cpp lib/VMCore/Instructions.cpp test/CFrontend/2007-12-16-AsmNoUnwind.c test/Transforms/Inline/2007-04-15-InlineEH.ll test/Transforms/InstCombine/2007-12-16-AsmNoUnwind.ll In-Reply-To: <025372CE-A218-43CE-BD5C-3FB11FC0C19C@apple.com> References: <200712161551.lBGFpoVu024930@zion.cs.uiuc.edu> <025372CE-A218-43CE-BD5C-3FB11FC0C19C@apple.com> Message-ID: <200712162204.58068.baldrick@free.fr> Hi Chris, > > Remove special casing of inline asm from the > > inliner. There is a potential problem: the verifier > > rejects invokes of inline asm (not sure why). > > Please restore the inliner to not do this or change the verifier to > not reject it. Right now you have broken the tree. I've reverted the inliner change for the moment. I plan to change the verifier. > > + if (isa(Callee) && !CS.isNoUnwind()) { > > + // Inline asm calls cannot throw - mark them 'nounwind'. > > + const ParamAttrsList *PAL = CS.getParamAttrs(); > > + uint16_t RAttributes = PAL ? PAL->getParamAttrs(0) : 0; > > + RAttributes |= ParamAttr::NoUnwind; > > + > > + ParamAttrsVector modVec; > > + modVec.push_back(ParamAttrsWithIndex::get(0, RAttributes)); > > + PAL = ParamAttrsList::getModified(PAL, modVec); > > + CS.setParamAttrs(PAL); > > + Changed = true; > > + } > > Should this go in a helper function? Something like > CS.addAttribute(ParamAttr::NoUnwind) I would like to accumulate some more examples of fiddling with attributes before factorizing into helper functions, since it is not clear to me yet exactly what helpers would be best. Ciao, Duncan. From clattner at apple.com Sun Dec 16 15:16:09 2007 From: clattner at apple.com (Chris Lattner) Date: Sun, 16 Dec 2007 13:16:09 -0800 Subject: [llvm-commits] [llvm] r45073 - in /llvm/trunk: include/llvm/Support/CallSite.h lib/Transforms/Scalar/InstructionCombining.cpp lib/Transforms/Utils/InlineFunction.cpp lib/VMCore/Instructions.cpp test/CFrontend/2007-12-16-AsmNoUnwind.c test/Transforms/Inline/2007-04-15-InlineEH.ll test/Transforms/InstCombine/2007-12-16-AsmNoUnwind.ll In-Reply-To: <200712162204.58068.baldrick@free.fr> References: <200712161551.lBGFpoVu024930@zion.cs.uiuc.edu> <025372CE-A218-43CE-BD5C-3FB11FC0C19C@apple.com> <200712162204.58068.baldrick@free.fr> Message-ID: On Dec 16, 2007, at 1:04 PM, Duncan Sands wrote: > Hi Chris, > >>> Remove special casing of inline asm from the >>> inliner. There is a potential problem: the verifier >>> rejects invokes of inline asm (not sure why). >> >> Please restore the inliner to not do this or change the verifier to >> not reject it. Right now you have broken the tree. > > I've reverted the inliner change for the moment. I plan to change > the verifier. Thanks! >>> + if (isa(Callee) && !CS.isNoUnwind()) { >>> + // Inline asm calls cannot throw - mark them 'nounwind'. >>> + const ParamAttrsList *PAL = CS.getParamAttrs(); >>> + uint16_t RAttributes = PAL ? PAL->getParamAttrs(0) : 0; >>> + RAttributes |= ParamAttr::NoUnwind; >>> + >>> + ParamAttrsVector modVec; >>> + modVec.push_back(ParamAttrsWithIndex::get(0, RAttributes)); >>> + PAL = ParamAttrsList::getModified(PAL, modVec); >>> + CS.setParamAttrs(PAL); >>> + Changed = true; >>> + } >> >> Should this go in a helper function? Something like >> CS.addAttribute(ParamAttr::NoUnwind) > > I would like to accumulate some more examples of fiddling with > attributes before factorizing into helper functions, since it > is not clear to me yet exactly what helpers would be best. Ok, sounds great, thanks again Duncan, -Chris From clattner at apple.com Sun Dec 16 15:21:46 2007 From: clattner at apple.com (Chris Lattner) Date: Sun, 16 Dec 2007 13:21:46 -0800 Subject: [llvm-commits] [llvm-gcc-4.2] r45054 - /llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/compile/930411-1.c In-Reply-To: <200712150130.lBF1UWoS017082@zion.cs.uiuc.edu> References: <200712150130.lBF1UWoS017082@zion.cs.uiuc.edu> Message-ID: <6E250CEF-134B-4621-B699-676E2732C5E2@apple.com> On Dec 14, 2007, at 5:30 PM, Dale Johannesen wrote: > Author: johannes > Date: Fri Dec 14 19:30:32 2007 > New Revision: 45054 > > URL: http://llvm.org/viewvc/llvm-project?rev=45054&view=rev > Log: > Suppress a valid warning for llvm. Having instcombine emit this warning seems like a really bad thing to do. Should we just stop the optimizer from emitting warnings like this? -Chris > > Modified: > llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/compile/930411-1.c > > Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/compile/ > 930411-1.c > URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/compile/930411-1.c?rev=45054&r1=45053&r2=45054&view=diff > > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/compile/ > 930411-1.c (original) > +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/compile/ > 930411-1.c Fri Dec 14 19:30:32 2007 > @@ -34,3 +34,5 @@ > i1 = 1; > goto L3; > } > +/* LLVM LOCAL caller-callee mismatch message can't be suppressed */ > +/* { dg-prune-output "arguments were dropped" } */ > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From dalej at apple.com Sun Dec 16 15:29:53 2007 From: dalej at apple.com (Dale Johannesen) Date: Sun, 16 Dec 2007 13:29:53 -0800 Subject: [llvm-commits] [llvm-gcc-4.2] r45054 - /llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/compile/930411-1.c In-Reply-To: <6E250CEF-134B-4621-B699-676E2732C5E2@apple.com> References: <200712150130.lBF1UWoS017082@zion.cs.uiuc.edu> <6E250CEF-134B-4621-B699-676E2732C5E2@apple.com> Message-ID: On Dec 16, 2007, at 1:21 PM, Chris Lattner wrote: > > On Dec 14, 2007, at 5:30 PM, Dale Johannesen wrote: > >> Author: johannes >> Date: Fri Dec 14 19:30:32 2007 >> New Revision: 45054 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=45054&view=rev >> Log: >> Suppress a valid warning for llvm. > > Having instcombine emit this warning seems like a really bad thing to > do. Should we just stop the optimizer from emitting warnings like > this? > > -Chris It's a useful thing to tell users about (users, unlike testsuites and benchmarks, are generally willing to change obviously wrong source). Will it get detected anywhere else, particularly in the IPO case? >> Modified: >> llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/compile/930411-1.c >> >> Modified: llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/compile/ >> 930411-1.c >> URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/ >> testsuite/gcc.c-torture/compile/930411-1.c? >> rev=45054&r1=45053&r2=45054&view=diff >> >> = >> = >> = >> = >> = >> = >> = >> = >> ===================================================================== >> = >> --- llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/compile/ >> 930411-1.c (original) >> +++ llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/compile/ >> 930411-1.c Fri Dec 14 19:30:32 2007 >> @@ -34,3 +34,5 @@ >> i1 = 1; >> goto L3; >> } >> +/* LLVM LOCAL caller-callee mismatch message can't be suppressed */ >> +/* { dg-prune-output "arguments were dropped" } */ >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From clattner at apple.com Sun Dec 16 15:32:44 2007 From: clattner at apple.com (Chris Lattner) Date: Sun, 16 Dec 2007 13:32:44 -0800 Subject: [llvm-commits] [llvm-gcc-4.2] r45054 - /llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/compile/930411-1.c In-Reply-To: References: <200712150130.lBF1UWoS017082@zion.cs.uiuc.edu> <6E250CEF-134B-4621-B699-676E2732C5E2@apple.com> Message-ID: On Dec 16, 2007, at 1:29 PM, Dale Johannesen wrote: >>> URL: http://llvm.org/viewvc/llvm-project?rev=45054&view=rev >>> Log: >>> Suppress a valid warning for llvm. >> >> Having instcombine emit this warning seems like a really bad thing to >> do. Should we just stop the optimizer from emitting warnings like >> this? >> >> -Chris > > It's a useful thing to tell users about (users, unlike testsuites and > benchmarks, > are generally willing to change obviously wrong source). Will it get > detected > anywhere else, particularly in the IPO case? I definitely agree, which is why I added it in the first place :). The problem is that it isn't hooked up with any of the other diagnostics machinery, so it isn't controllable and doesn't give decent location info (for example). I don't know that it really provides a good user experience. In the LTO case with debug info, we could do better. -Chris From dalej at apple.com Sun Dec 16 15:59:51 2007 From: dalej at apple.com (Dale Johannesen) Date: Sun, 16 Dec 2007 13:59:51 -0800 Subject: [llvm-commits] [llvm-gcc-4.2] r45054 - /llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/compile/930411-1.c In-Reply-To: References: <200712150130.lBF1UWoS017082@zion.cs.uiuc.edu> <6E250CEF-134B-4621-B699-676E2732C5E2@apple.com> Message-ID: <739EC833-7359-4202-B565-6EBEFBDE0C34@apple.com> On Dec 16, 2007, at 1:32 PM, Chris Lattner wrote: > > On Dec 16, 2007, at 1:29 PM, Dale Johannesen wrote: > >>>> URL: http://llvm.org/viewvc/llvm-project?rev=45054&view=rev >>>> Log: >>>> Suppress a valid warning for llvm. >>> >>> Having instcombine emit this warning seems like a really bad >>> thing to >>> do. Should we just stop the optimizer from emitting warnings like >>> this? >>> >>> -Chris >> >> It's a useful thing to tell users about (users, unlike testsuites and >> benchmarks, >> are generally willing to change obviously wrong source). Will it get >> detected >> anywhere else, particularly in the IPO case? > > I definitely agree, which is why I added it in the first place :). > The problem is that it isn't hooked up with any of the other > diagnostics machinery, so it isn't controllable and doesn't give > decent location info (for example). > > I don't know that it really provides a good user experience. In the > LTO case with debug info, we could do better. So what's your idea, detect it somewhere else? Where were you thinking? From clattner at apple.com Sun Dec 16 16:02:43 2007 From: clattner at apple.com (Chris Lattner) Date: Sun, 16 Dec 2007 14:02:43 -0800 Subject: [llvm-commits] [llvm-gcc-4.2] r45054 - /llvm-gcc-4.2/trunk/gcc/testsuite/gcc.c-torture/compile/930411-1.c In-Reply-To: <739EC833-7359-4202-B565-6EBEFBDE0C34@apple.com> References: <200712150130.lBF1UWoS017082@zion.cs.uiuc.edu> <6E250CEF-134B-4621-B699-676E2732C5E2@apple.com> <739EC833-7359-4202-B565-6EBEFBDE0C34@apple.com> Message-ID: <8C0C40F5-E935-48D2-8774-67C7C78DE65F@apple.com> On Dec 16, 2007, at 1:59 PM, Dale Johannesen wrote: >> I definitely agree, which is why I added it in the first place :). >> The problem is that it isn't hooked up with any of the other >> diagnostics machinery, so it isn't controllable and doesn't give >> decent location info (for example). >> >> I don't know that it really provides a good user experience. In the >> LTO case with debug info, we could do better. > > So what's your idea, detect it somewhere else? Where were you > thinking? For now I think we just just disable the warning. In the future, this could naturally be handled with Ted's work on static analysis stuff. The nice thing about doing it at the source level is that you can detect mismatches that are broken in more subtle ways as well, such as int foo() vs long foo(). You also get good diagnostics hooks and location info. -Chris From christopher.lamb at gmail.com Sun Dec 16 19:00:22 2007 From: christopher.lamb at gmail.com (Christopher Lamb) Date: Mon, 17 Dec 2007 01:00:22 -0000 Subject: [llvm-commits] [llvm] r45080 - in /llvm/trunk: docs/LangRef.html lib/VMCore/Verifier.cpp Message-ID: <200712170100.lBH10M4u021823@zion.cs.uiuc.edu> Author: clamb Date: Sun Dec 16 19:00:21 2007 New Revision: 45080 URL: http://llvm.org/viewvc/llvm-project?rev=45080&view=rev Log: Make it clear in the LangRef that allocation instructions only operated on the generic address space. Implement support in the verifier for ensuring this is true. Modified: llvm/trunk/docs/LangRef.html llvm/trunk/lib/VMCore/Verifier.cpp Modified: llvm/trunk/docs/LangRef.html URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/LangRef.html?rev=45080&r1=45079&r2=45080&view=diff ============================================================================== --- llvm/trunk/docs/LangRef.html (original) +++ llvm/trunk/docs/LangRef.html Sun Dec 16 19:00:21 2007 @@ -2671,7 +2671,8 @@
      Overview:

      The 'malloc' instruction allocates memory from the system -heap and returns a pointer to it.

      +heap and returns a pointer to it. The object is always allocated in the generic +address space (address space zero).

      Arguments:
      @@ -2758,7 +2759,8 @@

      The 'alloca' instruction allocates memory on the stack frame of the currently executing function, to be automatically released when this function -returns to its caller.

      +returns to its caller. The object is always allocated in the generic address +space (address space zero).

      Arguments:
      @@ -3972,6 +3974,10 @@ intrinsics to make use of the LLVM garbage collectors. For more details, see Accurate Garbage Collection with LLVM.

      + +

      The garbage collection intrinsics only operate on objects in the generic + address space (address space zero).

      +
    • Modified: llvm/trunk/lib/VMCore/Verifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=45080&r1=45079&r2=45080&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Verifier.cpp (original) +++ llvm/trunk/lib/VMCore/Verifier.cpp Sun Dec 16 19:00:21 2007 @@ -254,6 +254,7 @@ void visitUserOp1(Instruction &I); void visitUserOp2(Instruction &I) { visitUserOp1(I); } void visitIntrinsicFunctionCall(Intrinsic::ID ID, CallInst &CI); + void visitAllocationInst(AllocationInst &AI); void VerifyIntrinsicPrototype(Intrinsic::ID ID, Function *F, unsigned Count, ...); @@ -987,6 +988,13 @@ visitInstruction(SI); } +void Verifier::visitAllocationInst(AllocationInst &AI) { + const PointerType *Ptr = AI.getType(); + Assert(Ptr->getAddressSpace() == 0, + "Allocation instruction pointer not in the generic address space!"); + visitInstruction(AI); +} + /// verifyInstruction - Verify that an instruction is well formed. /// From christopher.lamb at gmail.com Sun Dec 16 19:12:56 2007 From: christopher.lamb at gmail.com (Christopher Lamb) Date: Mon, 17 Dec 2007 01:12:56 -0000 Subject: [llvm-commits] [llvm] r45082 - in /llvm/trunk: examples/BrainF/ include/llvm/ lib/AsmParser/ lib/Bitcode/Reader/ lib/CodeGen/ lib/ExecutionEngine/ lib/Target/MSIL/ lib/Transforms/IPO/ lib/Transforms/Instrumentation/ lib/Transforms/Scalar/ lib/Transforms/Utils/ lib/VMCore/ tools/bugpoint/ tools/llvm-upgrade/ tools/llvm2cpp/ utils/TableGen/ Message-ID: <200712170112.lBH1CvXW022700@zion.cs.uiuc.edu> Author: clamb Date: Sun Dec 16 19:12:55 2007 New Revision: 45082 URL: http://llvm.org/viewvc/llvm-project?rev=45082&view=rev Log: Change the PointerType api for creating pointer types. The old functionality of PointerType::get() has become PointerType::getUnqual(), which returns a pointer in the generic address space. The new prototype of PointerType::get() requires both a type and an address space. Modified: llvm/trunk/examples/BrainF/BrainF.cpp llvm/trunk/examples/BrainF/BrainFDriver.cpp llvm/trunk/include/llvm/DerivedTypes.h llvm/trunk/lib/AsmParser/llvmAsmParser.y llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp llvm/trunk/lib/Target/MSIL/MSILWriter.cpp llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp llvm/trunk/lib/Transforms/IPO/LowerSetJmp.cpp llvm/trunk/lib/Transforms/IPO/RaiseAllocations.cpp llvm/trunk/lib/Transforms/IPO/SimplifyLibCalls.cpp llvm/trunk/lib/Transforms/Instrumentation/ProfilingUtils.cpp llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp llvm/trunk/lib/Transforms/Scalar/LowerGC.cpp llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp llvm/trunk/lib/Transforms/Utils/LowerAllocations.cpp llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp llvm/trunk/lib/VMCore/ConstantFold.cpp llvm/trunk/lib/VMCore/Constants.cpp llvm/trunk/lib/VMCore/Core.cpp llvm/trunk/lib/VMCore/Function.cpp llvm/trunk/lib/VMCore/InlineAsm.cpp llvm/trunk/lib/VMCore/Instructions.cpp llvm/trunk/lib/VMCore/Module.cpp llvm/trunk/lib/VMCore/Verifier.cpp llvm/trunk/tools/bugpoint/Miscompilation.cpp llvm/trunk/tools/llvm-upgrade/UpgradeParser.y llvm/trunk/tools/llvm2cpp/CppWriter.cpp llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp Modified: llvm/trunk/examples/BrainF/BrainF.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/BrainF/BrainF.cpp?rev=45082&r1=45081&r2=45082&view=diff ============================================================================== --- llvm/trunk/examples/BrainF/BrainF.cpp (original) +++ llvm/trunk/examples/BrainF/BrainF.cpp Sun Dec 16 19:12:55 2007 @@ -54,7 +54,7 @@ //declare void @llvm.memset.i32(i8 *, i8, i32, i32) Function *memset_func = cast(module-> getOrInsertFunction("llvm.memset.i32", Type::VoidTy, - PointerType::get(IntegerType::Int8Ty), + PointerType::getUnqual(IntegerType::Int8Ty), IntegerType::Int8Ty, IntegerType::Int32Ty, IntegerType::Int32Ty, NULL)); @@ -138,7 +138,7 @@ //declare i32 @puts(i8 *) Function *puts_func = cast(module-> getOrInsertFunction("puts", IntegerType::Int32Ty, - PointerType::get(IntegerType::Int8Ty), NULL)); + PointerType::getUnqual(IntegerType::Int8Ty), NULL)); //brainf.aberror: aberrorbb = new BasicBlock(label, brainf_func); @@ -282,7 +282,7 @@ builder->SetInsertPoint(bb_1); //Make part of PHI instruction now, wait until end of loop to finish - PHINode *phi_0 = new PHINode(PointerType::get(IntegerType::Int8Ty), + PHINode *phi_0 = new PHINode(PointerType::getUnqual(IntegerType::Int8Ty), headreg, testbb); phi_0->reserveOperandSpace(2); phi_0->addIncoming(curhead, bb_0); @@ -439,7 +439,7 @@ //%head.%d = phi i8 *[%head.%d, %main.%d] PHINode *phi_1 = builder-> - CreatePHI(PointerType::get(IntegerType::Int8Ty), headreg); + CreatePHI(PointerType::getUnqual(IntegerType::Int8Ty), headreg); phi_1->reserveOperandSpace(1); phi_1->addIncoming(head_0, testbb); curhead = phi_1; Modified: llvm/trunk/examples/BrainF/BrainFDriver.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/BrainF/BrainFDriver.cpp?rev=45082&r1=45081&r2=45082&view=diff ============================================================================== --- llvm/trunk/examples/BrainF/BrainFDriver.cpp (original) +++ llvm/trunk/examples/BrainF/BrainFDriver.cpp Sun Dec 16 19:12:55 2007 @@ -59,7 +59,7 @@ //define i32 @main(i32 %argc, i8 **%argv) Function *main_func = cast(mod-> getOrInsertFunction("main", IntegerType::Int32Ty, IntegerType::Int32Ty, - PointerType::get(PointerType::get( + PointerType::getUnqual(PointerType::getUnqual( IntegerType::Int8Ty)), NULL)); { Function::arg_iterator args = main_func->arg_begin(); Modified: llvm/trunk/include/llvm/DerivedTypes.h URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DerivedTypes.h?rev=45082&r1=45081&r2=45082&view=diff ============================================================================== --- llvm/trunk/include/llvm/DerivedTypes.h (original) +++ llvm/trunk/include/llvm/DerivedTypes.h Sun Dec 16 19:12:55 2007 @@ -369,8 +369,15 @@ const PointerType &operator=(const PointerType &); // Do not implement explicit PointerType(const Type *ElType, unsigned AddrSpace); public: - /// PointerType::get - This is the only way to construct a new pointer type. - static PointerType *get(const Type *ElementType, unsigned AddressSpace = 0); + /// PointerType::get - This constructs a pointer to an object of the specified + /// type in a numbered address space. + static PointerType *get(const Type *ElementType, unsigned AddressSpace); + + /// PointerType::getUnqual - This constructs a pointer to an object of the + /// specified type in the generic address space (address space zero). + static PointerType *getUnqual(const Type *ElementType) { + return PointerType::get(ElementType, 0); + } /// @brief Return the address space of the Pointer type. inline unsigned getAddressSpace() const { return AddressSpace; } Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y?rev=45082&r1=45081&r2=45082&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.y (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y Sun Dec 16 19:12:55 2007 @@ -2280,7 +2280,7 @@ PAL = ParamAttrsList::get(Attrs); FunctionType *FT = FunctionType::get(*$2, ParamTypeList, isVarArg); - const PointerType *PFT = PointerType::get(FT); + const PointerType *PFT = PointerType::getUnqual(FT); delete $2; ValID ID; @@ -2627,7 +2627,7 @@ ParamTypes.push_back(Ty); } Ty = FunctionType::get($3->get(), ParamTypes, false); - PFTy = PointerType::get(Ty); + PFTy = PointerType::getUnqual(Ty); } delete $3; @@ -2954,7 +2954,7 @@ ParamTypes.push_back(Ty); } Ty = FunctionType::get($3->get(), ParamTypes, false); - PFTy = PointerType::get(Ty); + PFTy = PointerType::getUnqual(Ty); } Value *V = getVal(PFTy, $4); // Get the function we're calling... Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=45082&r1=45081&r2=45082&view=diff ============================================================================== --- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original) +++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Sun Dec 16 19:12:55 2007 @@ -1509,7 +1509,7 @@ unsigned OpNum = 0; Value *Val, *Ptr; if (getValueTypePair(Record, OpNum, NextValueNo, Val) || - getValue(Record, OpNum, PointerType::get(Val->getType()), Ptr) || + getValue(Record, OpNum, PointerType::getUnqual(Val->getType()), Ptr)|| OpNum+2 != Record.size()) return Error("Invalid STORE record"); Modified: llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp?rev=45082&r1=45081&r2=45082&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp (original) +++ llvm/trunk/lib/CodeGen/IntrinsicLowering.cpp Sun Dec 16 19:12:55 2007 @@ -81,22 +81,23 @@ break; case Intrinsic::memcpy_i32: case Intrinsic::memcpy_i64: - M.getOrInsertFunction("memcpy", PointerType::get(Type::Int8Ty), - PointerType::get(Type::Int8Ty), - PointerType::get(Type::Int8Ty), + M.getOrInsertFunction("memcpy", PointerType::getUnqual(Type::Int8Ty), + PointerType::getUnqual(Type::Int8Ty), + PointerType::getUnqual(Type::Int8Ty), TD.getIntPtrType(), (Type *)0); break; case Intrinsic::memmove_i32: case Intrinsic::memmove_i64: - M.getOrInsertFunction("memmove", PointerType::get(Type::Int8Ty), - PointerType::get(Type::Int8Ty), - PointerType::get(Type::Int8Ty), + M.getOrInsertFunction("memmove", PointerType::getUnqual(Type::Int8Ty), + PointerType::getUnqual(Type::Int8Ty), + PointerType::getUnqual(Type::Int8Ty), TD.getIntPtrType(), (Type *)0); break; case Intrinsic::memset_i32: case Intrinsic::memset_i64: - M.getOrInsertFunction("memset", PointerType::get(Type::Int8Ty), - PointerType::get(Type::Int8Ty), Type::Int32Ty, + M.getOrInsertFunction("memset", PointerType::getUnqual(Type::Int8Ty), + PointerType::getUnqual(Type::Int8Ty), + Type::Int32Ty, TD.getIntPtrType(), (Type *)0); break; case Intrinsic::sqrt: Modified: llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp?rev=45082&r1=45081&r2=45082&view=diff ============================================================================== --- llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp (original) +++ llvm/trunk/lib/CodeGen/MachineModuleInfo.cpp Sun Dec 16 19:12:55 2007 @@ -1262,7 +1262,7 @@ // If not already defined. if (!StrPtrTy) { // Construct the pointer to signed bytes. - StrPtrTy = PointerType::get(Type::Int8Ty); + StrPtrTy = PointerType::getUnqual(Type::Int8Ty); } return StrPtrTy; @@ -1277,7 +1277,7 @@ const StructType *EmptyStructTy = StructType::get(std::vector()); // Construct the pointer to empty structure type. - EmptyStructPtrTy = PointerType::get(EmptyStructTy); + EmptyStructPtrTy = PointerType::getUnqual(EmptyStructTy); } return EmptyStructPtrTy; Modified: llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp?rev=45082&r1=45081&r2=45082&view=diff ============================================================================== --- llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp (original) +++ llvm/trunk/lib/ExecutionEngine/ExecutionEngine.cpp Sun Dec 16 19:12:55 2007 @@ -170,7 +170,7 @@ char *Result = new char[(InputArgv.size()+1)*PtrSize]; DOUT << "ARGV = " << (void*)Result << "\n"; - const Type *SBytePtr = PointerType::get(Type::Int8Ty); + const Type *SBytePtr = PointerType::getUnqual(Type::Int8Ty); for (unsigned i = 0; i != InputArgv.size(); ++i) { unsigned Size = InputArgv[i].size()+1; @@ -255,7 +255,8 @@ // Check main() type unsigned NumArgs = Fn->getFunctionType()->getNumParams(); const FunctionType *FTy = Fn->getFunctionType(); - const Type* PPInt8Ty = PointerType::get(PointerType::get(Type::Int8Ty)); + const Type* PPInt8Ty = + PointerType::getUnqual(PointerType::getUnqual(Type::Int8Ty)); switch (NumArgs) { case 3: if (FTy->getParamType(2) != PPInt8Ty) { Modified: llvm/trunk/lib/Target/MSIL/MSILWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/MSIL/MSILWriter.cpp?rev=45082&r1=45081&r2=45082&view=diff ============================================================================== --- llvm/trunk/lib/Target/MSIL/MSILWriter.cpp (original) +++ llvm/trunk/lib/Target/MSIL/MSILWriter.cpp Sun Dec 16 19:12:55 2007 @@ -783,7 +783,7 @@ // Save as pointer type "void*" printValueLoad(Inst->getOperand(1)); printSimpleInstruction("ldloca",Name.c_str()); - printIndirectSave(PointerType::get(IntegerType::get(8))); + printIndirectSave(PointerType::getUnqual(IntegerType::get(8))); break; case Intrinsic::vaend: // Close argument list handle. @@ -1002,7 +1002,8 @@ printSimpleInstruction("call", "instance typedref [mscorlib]System.ArgIterator::GetNextArg()"); printSimpleInstruction("refanyval","void*"); - std::string Name = "ldind."+getTypePostfix(PointerType::get(IntegerType::get(8)),false); + std::string Name = + "ldind."+getTypePostfix(PointerType::getUnqual(IntegerType::get(8)),false); printSimpleInstruction(Name.c_str()); } @@ -1217,7 +1218,7 @@ const AllocaInst* AI = dyn_cast(&*I); if (AI && !isa(AI)) { // Local variable allocation. - Ty = PointerType::get(AI->getAllocatedType()); + Ty = PointerType::getUnqual(AI->getAllocatedType()); Name = getValueName(AI); Out << "\t.locals (" << getTypeName(Ty) << Name << ")\n"; } else if (I->getType()!=Type::VoidTy) { Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=45082&r1=45081&r2=45082&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Sun Dec 16 19:12:55 2007 @@ -1052,7 +1052,7 @@ for (unsigned FieldNo = 0, e = STy->getNumElements(); FieldNo != e;++FieldNo){ const Type *FieldTy = STy->getElementType(FieldNo); - const Type *PFieldTy = PointerType::get(FieldTy); + const Type *PFieldTy = PointerType::getUnqual(FieldTy); GlobalVariable *NGV = new GlobalVariable(PFieldTy, false, GlobalValue::InternalLinkage, @@ -1618,7 +1618,7 @@ } else { const Type *FTy = FunctionType::get(Type::VoidTy, std::vector(), false); - const PointerType *PFTy = PointerType::get(FTy); + const PointerType *PFTy = PointerType::getUnqual(FTy); CSVals[1] = Constant::getNullValue(PFTy); CSVals[0] = ConstantInt::get(Type::Int32Ty, 2147483647); } Modified: llvm/trunk/lib/Transforms/IPO/LowerSetJmp.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/LowerSetJmp.cpp?rev=45082&r1=45081&r2=45082&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/LowerSetJmp.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/LowerSetJmp.cpp Sun Dec 16 19:12:55 2007 @@ -199,8 +199,8 @@ // This function is always successful, unless it isn't. bool LowerSetJmp::doInitialization(Module& M) { - const Type *SBPTy = PointerType::get(Type::Int8Ty); - const Type *SBPPTy = PointerType::get(SBPTy); + const Type *SBPTy = PointerType::getUnqual(Type::Int8Ty); + const Type *SBPPTy = PointerType::getUnqual(SBPTy); // N.B. See llvm/runtime/GCCLibraries/libexception/SJLJ-Exception.h for // a description of the following library functions. @@ -256,7 +256,7 @@ // throwing the exception for us. void LowerSetJmp::TransformLongJmpCall(CallInst* Inst) { - const Type* SBPTy = PointerType::get(Type::Int8Ty); + const Type* SBPTy = PointerType::getUnqual(Type::Int8Ty); // Create the call to "__llvm_sjljeh_throw_longjmp". This takes the // same parameters as "longjmp", except that the buffer is cast to a @@ -308,7 +308,7 @@ assert(Inst && "Couldn't find even ONE instruction in entry block!"); // Fill in the alloca and call to initialize the SJ map. - const Type *SBPTy = PointerType::get(Type::Int8Ty); + const Type *SBPTy = PointerType::getUnqual(Type::Int8Ty); AllocaInst* Map = new AllocaInst(SBPTy, 0, "SJMap", Inst); new CallInst(InitSJMap, Map, "", Inst); return SJMap[Func] = Map; @@ -378,7 +378,7 @@ Function* Func = ABlock->getParent(); // Add this setjmp to the setjmp map. - const Type* SBPTy = PointerType::get(Type::Int8Ty); + const Type* SBPTy = PointerType::getUnqual(Type::Int8Ty); CastInst* BufPtr = new BitCastInst(Inst->getOperand(1), SBPTy, "SBJmpBuf", Inst); std::vector Args = Modified: llvm/trunk/lib/Transforms/IPO/RaiseAllocations.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/RaiseAllocations.cpp?rev=45082&r1=45081&r2=45082&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/RaiseAllocations.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/RaiseAllocations.cpp Sun Dec 16 19:12:55 2007 @@ -78,7 +78,7 @@ // Get the expected prototype for malloc const FunctionType *Malloc1Type = - FunctionType::get(PointerType::get(Type::Int8Ty), + FunctionType::get(PointerType::getUnqual(Type::Int8Ty), std::vector(1, Type::Int64Ty), false); // Chck to see if we got the expected malloc @@ -86,14 +86,14 @@ // Check to see if the prototype is wrong, giving us sbyte*(uint) * malloc // This handles the common declaration of: 'void *malloc(unsigned);' const FunctionType *Malloc2Type = - FunctionType::get(PointerType::get(Type::Int8Ty), + FunctionType::get(PointerType::getUnqual(Type::Int8Ty), std::vector(1, Type::Int32Ty), false); if (TyWeHave != Malloc2Type) { // Check to see if the prototype is missing, giving us // sbyte*(...) * malloc // This handles the common declaration of: 'void *malloc();' const FunctionType *Malloc3Type = - FunctionType::get(PointerType::get(Type::Int8Ty), + FunctionType::get(PointerType::getUnqual(Type::Int8Ty), std::vector(), true); if (TyWeHave != Malloc3Type) // Give up @@ -108,7 +108,7 @@ // Get the expected prototype for void free(i8*) const FunctionType *Free1Type = FunctionType::get(Type::VoidTy, - std::vector(1, PointerType::get(Type::Int8Ty)), false); + std::vector(1, PointerType::getUnqual(Type::Int8Ty)), false); if (TyWeHave != Free1Type) { // Check to see if the prototype was forgotten, giving us @@ -219,7 +219,8 @@ // Value *Source = *CS.arg_begin(); if (!isa(Source->getType())) - Source = new IntToPtrInst(Source, PointerType::get(Type::Int8Ty), + Source = new IntToPtrInst(Source, + PointerType::getUnqual(Type::Int8Ty), "FreePtrCast", I); new FreeInst(Source, I); Modified: llvm/trunk/lib/Transforms/IPO/SimplifyLibCalls.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/SimplifyLibCalls.cpp?rev=45082&r1=45081&r2=45082&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/IPO/SimplifyLibCalls.cpp (original) +++ llvm/trunk/lib/Transforms/IPO/SimplifyLibCalls.cpp Sun Dec 16 19:12:55 2007 @@ -244,7 +244,7 @@ Constant *get_puts() { if (!puts_func) puts_func = M->getOrInsertFunction("puts", Type::Int32Ty, - PointerType::get(Type::Int8Ty), + PointerType::getUnqual(Type::Int8Ty), NULL); return puts_func; } @@ -261,7 +261,7 @@ Constant *get_fputs(const Type* FILEptr_type) { if (!fputs_func) fputs_func = M->getOrInsertFunction("fputs", Type::Int32Ty, - PointerType::get(Type::Int8Ty), + PointerType::getUnqual(Type::Int8Ty), FILEptr_type, NULL); return fputs_func; } @@ -270,7 +270,7 @@ Constant *get_fwrite(const Type* FILEptr_type) { if (!fwrite_func) fwrite_func = M->getOrInsertFunction("fwrite", TD->getIntPtrType(), - PointerType::get(Type::Int8Ty), + PointerType::getUnqual(Type::Int8Ty), TD->getIntPtrType(), TD->getIntPtrType(), FILEptr_type, NULL); @@ -289,9 +289,9 @@ Constant *get_strcpy() { if (!strcpy_func) strcpy_func = M->getOrInsertFunction("strcpy", - PointerType::get(Type::Int8Ty), - PointerType::get(Type::Int8Ty), - PointerType::get(Type::Int8Ty), + PointerType::getUnqual(Type::Int8Ty), + PointerType::getUnqual(Type::Int8Ty), + PointerType::getUnqual(Type::Int8Ty), NULL); return strcpy_func; } @@ -300,7 +300,7 @@ Constant *get_strlen() { if (!strlen_func) strlen_func = M->getOrInsertFunction("strlen", TD->getIntPtrType(), - PointerType::get(Type::Int8Ty), + PointerType::getUnqual(Type::Int8Ty), NULL); return strlen_func; } @@ -309,8 +309,8 @@ Constant *get_memchr() { if (!memchr_func) memchr_func = M->getOrInsertFunction("memchr", - PointerType::get(Type::Int8Ty), - PointerType::get(Type::Int8Ty), + PointerType::getUnqual(Type::Int8Ty), + PointerType::getUnqual(Type::Int8Ty), Type::Int32Ty, TD->getIntPtrType(), NULL); return memchr_func; @@ -319,7 +319,7 @@ /// @brief Return a Function* for the memcpy libcall Constant *get_memcpy() { if (!memcpy_func) { - const Type *SBP = PointerType::get(Type::Int8Ty); + const Type *SBP = PointerType::getUnqual(Type::Int8Ty); const char *N = TD->getIntPtrType() == Type::Int32Ty ? "llvm.memcpy.i32" : "llvm.memcpy.i64"; memcpy_func = M->getOrInsertFunction(N, Type::VoidTy, SBP, SBP, @@ -471,7 +471,7 @@ virtual bool ValidateCalledFunction(const Function *F, SimplifyLibCalls &SLC){ const FunctionType *FT = F->getFunctionType(); return FT->getNumParams() == 2 && - FT->getReturnType() == PointerType::get(Type::Int8Ty) && + FT->getReturnType() == PointerType::getUnqual(Type::Int8Ty) && FT->getParamType(0) == FT->getReturnType() && FT->getParamType(1) == FT->getReturnType(); } @@ -528,7 +528,7 @@ virtual bool ValidateCalledFunction(const Function *F, SimplifyLibCalls &SLC){ const FunctionType *FT = F->getFunctionType(); return FT->getNumParams() == 2 && - FT->getReturnType() == PointerType::get(Type::Int8Ty) && + FT->getReturnType() == PointerType::getUnqual(Type::Int8Ty) && FT->getParamType(0) == FT->getReturnType() && isa(FT->getParamType(1)); } @@ -594,7 +594,7 @@ const FunctionType *FT = F->getFunctionType(); return FT->getReturnType() == Type::Int32Ty && FT->getNumParams() == 2 && FT->getParamType(0) == FT->getParamType(1) && - FT->getParamType(0) == PointerType::get(Type::Int8Ty); + FT->getParamType(0) == PointerType::getUnqual(Type::Int8Ty); } /// @brief Perform the strcmp optimization @@ -647,7 +647,7 @@ const FunctionType *FT = F->getFunctionType(); return FT->getReturnType() == Type::Int32Ty && FT->getNumParams() == 3 && FT->getParamType(0) == FT->getParamType(1) && - FT->getParamType(0) == PointerType::get(Type::Int8Ty) && + FT->getParamType(0) == PointerType::getUnqual(Type::Int8Ty) && isa(FT->getParamType(2)); return false; } @@ -715,7 +715,7 @@ return FT->getNumParams() == 2 && FT->getParamType(0) == FT->getParamType(1) && FT->getReturnType() == FT->getParamType(0) && - FT->getParamType(0) == PointerType::get(Type::Int8Ty); + FT->getParamType(0) == PointerType::getUnqual(Type::Int8Ty); } /// @brief Perform the strcpy optimization @@ -770,7 +770,7 @@ virtual bool ValidateCalledFunction(const Function *F, SimplifyLibCalls &SLC){ const FunctionType *FT = F->getFunctionType(); return FT->getNumParams() == 1 && - FT->getParamType(0) == PointerType::get(Type::Int8Ty) && + FT->getParamType(0) == PointerType::getUnqual(Type::Int8Ty) && isa(FT->getReturnType()); } @@ -870,7 +870,7 @@ return ReplaceCallWith(CI, Constant::getNullValue(CI->getType())); case 1: { // memcmp(S1,S2,1) -> *(ubyte*)S1 - *(ubyte*)S2 - const Type *UCharPtr = PointerType::get(Type::Int8Ty); + const Type *UCharPtr = PointerType::getUnqual(Type::Int8Ty); CastInst *Op1Cast = CastInst::create( Instruction::BitCast, LHS, UCharPtr, LHS->getName(), CI); CastInst *Op2Cast = CastInst::create( @@ -888,7 +888,7 @@ // TODO: IF both are aligned, use a short load/compare. // memcmp(S1,S2,2) -> S1[0]-S2[0] | S1[1]-S2[1] iff only ==/!= 0 matters - const Type *UCharPtr = PointerType::get(Type::Int8Ty); + const Type *UCharPtr = PointerType::getUnqual(Type::Int8Ty); CastInst *Op1Cast = CastInst::create( Instruction::BitCast, LHS, UCharPtr, LHS->getName(), CI); CastInst *Op2Cast = CastInst::create( @@ -976,9 +976,9 @@ // Cast source and dest to the right sized primitive and then load/store CastInst* SrcCast = CastInst::create(Instruction::BitCast, - src, PointerType::get(castType), src->getName()+".cast", ci); + src, PointerType::getUnqual(castType), src->getName()+".cast", ci); CastInst* DestCast = CastInst::create(Instruction::BitCast, - dest, PointerType::get(castType),dest->getName()+".cast", ci); + dest, PointerType::getUnqual(castType),dest->getName()+".cast", ci); LoadInst* LI = new LoadInst(SrcCast,SrcCast->getName()+".val",ci); new StoreInst(LI, DestCast, ci); return ReplaceCallWith(ci, 0); @@ -1085,7 +1085,7 @@ } // Cast dest to the right sized primitive and then load/store - CastInst* DestCast = new BitCastInst(dest, PointerType::get(castType), + CastInst* DestCast = new BitCastInst(dest, PointerType::getUnqual(castType), dest->getName()+".cast", ci); new StoreInst(ConstantInt::get(castType,fill_value),DestCast, ci); return ReplaceCallWith(ci, 0); @@ -1207,7 +1207,7 @@ Init, "str", CI->getParent()->getParent()->getParent()); // Cast GV to be a pointer to char. - GV = ConstantExpr::getBitCast(GV, PointerType::get(Type::Int8Ty)); + GV = ConstantExpr::getBitCast(GV, PointerType::getUnqual(Type::Int8Ty)); new CallInst(SLC.get_puts(), GV, "", CI); if (CI->use_empty()) return ReplaceCallWith(CI, 0); @@ -1268,7 +1268,7 @@ virtual bool ValidateCalledFunction(const Function *F, SimplifyLibCalls &SLC){ const FunctionType *FT = F->getFunctionType(); return FT->getNumParams() == 2 && // two fixed arguments. - FT->getParamType(1) == PointerType::get(Type::Int8Ty) && + FT->getParamType(1) == PointerType::getUnqual(Type::Int8Ty) && isa(FT->getParamType(0)) && isa(FT->getReturnType()); } @@ -1358,7 +1358,7 @@ virtual bool ValidateCalledFunction(const Function *F, SimplifyLibCalls &SLC){ const FunctionType *FT = F->getFunctionType(); return FT->getNumParams() == 2 && // two fixed arguments. - FT->getParamType(1) == PointerType::get(Type::Int8Ty) && + FT->getParamType(1) == PointerType::getUnqual(Type::Int8Ty) && FT->getParamType(0) == FT->getParamType(1) && isa(FT->getReturnType()); } @@ -1491,7 +1491,7 @@ virtual bool ValidateCalledFunction(const Function *F, SimplifyLibCalls &SLC){ const FunctionType *FT = F->getFunctionType(); return FT->getNumParams() == 4 && - FT->getParamType(0) == PointerType::get(Type::Int8Ty) && + FT->getParamType(0) == PointerType::getUnqual(Type::Int8Ty) && FT->getParamType(1) == FT->getParamType(2) && isa(FT->getParamType(1)) && isa(FT->getParamType(3)) && @@ -1927,7 +1927,7 @@ static Value *CastToCStr(Value *V, Instruction *IP) { assert(isa(V->getType()) && "Can't cast non-pointer type to C string type"); - const Type *SBPTy = PointerType::get(Type::Int8Ty); + const Type *SBPTy = PointerType::getUnqual(Type::Int8Ty); if (V->getType() != SBPTy) return new BitCastInst(V, SBPTy, V->getName(), IP); return V; Modified: llvm/trunk/lib/Transforms/Instrumentation/ProfilingUtils.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/ProfilingUtils.cpp?rev=45082&r1=45081&r2=45082&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Instrumentation/ProfilingUtils.cpp (original) +++ llvm/trunk/lib/Transforms/Instrumentation/ProfilingUtils.cpp Sun Dec 16 19:12:55 2007 @@ -22,8 +22,9 @@ void llvm::InsertProfilingInitCall(Function *MainFn, const char *FnName, GlobalValue *Array) { - const Type *ArgVTy = PointerType::get(PointerType::get(Type::Int8Ty)); - const PointerType *UIntPtr = PointerType::get(Type::Int32Ty); + const Type *ArgVTy = + PointerType::getUnqual(PointerType::getUnqual(Type::Int8Ty)); + const PointerType *UIntPtr = PointerType::getUnqual(Type::Int32Ty); Module &M = *MainFn->getParent(); Constant *InitFn = M.getOrInsertFunction(FnName, Type::Int32Ty, Type::Int32Ty, ArgVTy, UIntPtr, Type::Int32Ty, Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=45082&r1=45081&r2=45082&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Sun Dec 16 19:12:55 2007 @@ -2122,8 +2122,10 @@ (CI->getType()->getPrimitiveSizeInBits() == TD->getIntPtrType()->getPrimitiveSizeInBits()) && isa(CI->getOperand(0)->getType())) { + unsigned AS = + cast(CI->getOperand(0)->getType())->getAddressSpace(); Value *I2 = InsertCastBefore(Instruction::BitCast, CI->getOperand(0), - PointerType::get(Type::Int8Ty), I); + PointerType::get(Type::Int8Ty, AS), I); I2 = InsertNewInstBefore(new GetElementPtrInst(I2, Other, "ctg2"), I); return new PtrToIntInst(I2, CI->getType()); } @@ -7740,7 +7742,7 @@ // If Size is 2 then use Int16Ty // If Size is 1 then use Int8Ty if (Size && Size <=8 && !(Size&(Size-1))) - NewPtrTy = PointerType::get(IntegerType::get(Size<<3)); + NewPtrTy = PointerType::getUnqual(IntegerType::get(Size<<3)); if (NewPtrTy) { Value *Src = InsertCastBefore(Instruction::BitCast, CI.getOperand(2), @@ -7774,8 +7776,9 @@ // Turn PPC lvx -> load if the pointer is known aligned. // Turn X86 loadups -> load if the pointer is known aligned. if (GetOrEnforceKnownAlignment(II->getOperand(1), TD, 16) >= 16) { - Value *Ptr = InsertCastBefore(Instruction::BitCast, II->getOperand(1), - PointerType::get(II->getType()), CI); + Value *Ptr = + InsertCastBefore(Instruction::BitCast, II->getOperand(1), + PointerType::getUnqual(II->getType()), CI); return new LoadInst(Ptr); } break; @@ -7783,7 +7786,8 @@ case Intrinsic::ppc_altivec_stvxl: // Turn stvx -> store if the pointer is known aligned. if (GetOrEnforceKnownAlignment(II->getOperand(2), TD, 16) >= 16) { - const Type *OpPtrTy = PointerType::get(II->getOperand(1)->getType()); + const Type *OpPtrTy = + PointerType::getUnqual(II->getOperand(1)->getType()); Value *Ptr = InsertCastBefore(Instruction::BitCast, II->getOperand(2), OpPtrTy, CI); return new StoreInst(II->getOperand(1), Ptr); @@ -7795,7 +7799,8 @@ case Intrinsic::x86_sse2_storel_dq: // Turn X86 storeu -> store if the pointer is known aligned. if (GetOrEnforceKnownAlignment(II->getOperand(1), TD, 16) >= 16) { - const Type *OpPtrTy = PointerType::get(II->getOperand(2)->getType()); + const Type *OpPtrTy = + PointerType::getUnqual(II->getOperand(2)->getType()); Value *Ptr = InsertCastBefore(Instruction::BitCast, II->getOperand(1), OpPtrTy, CI); return new StoreInst(II->getOperand(2), Ptr); @@ -7921,7 +7926,8 @@ // If the call and callee calling conventions don't match, this call must // be unreachable, as the call is undefined. new StoreInst(ConstantInt::getTrue(), - UndefValue::get(PointerType::get(Type::Int1Ty)), OldCall); + UndefValue::get(PointerType::getUnqual(Type::Int1Ty)), + OldCall); if (!OldCall->use_empty()) OldCall->replaceAllUsesWith(UndefValue::get(OldCall->getType())); if (isa(OldCall)) // Not worth removing an invoke here. @@ -7934,7 +7940,7 @@ // undef so that we know that this code is not reachable, despite the fact // that we can't modify the CFG here. new StoreInst(ConstantInt::getTrue(), - UndefValue::get(PointerType::get(Type::Int1Ty)), + UndefValue::get(PointerType::getUnqual(Type::Int1Ty)), CS.getInstruction()); if (!CS.getInstruction()->use_empty()) @@ -8299,8 +8305,8 @@ // code sort out any function type mismatches. FunctionType *NewFTy = FunctionType::get(FTy->getReturnType(), NewTypes, FTy->isVarArg()); - Constant *NewCallee = NestF->getType() == PointerType::get(NewFTy) ? - NestF : ConstantExpr::getBitCast(NestF, PointerType::get(NewFTy)); + Constant *NewCallee = NestF->getType() == PointerType::getUnqual(NewFTy) ? + NestF : ConstantExpr::getBitCast(NestF, PointerType::getUnqual(NewFTy)); const ParamAttrsList *NewPAL = ParamAttrsList::get(NewAttrs); Instruction *NewCaller; @@ -9052,7 +9058,7 @@ if (isa(Op)) { // Insert a new store to null because we cannot modify the CFG here. new StoreInst(ConstantInt::getTrue(), - UndefValue::get(PointerType::get(Type::Int1Ty)), &FI); + UndefValue::get(PointerType::getUnqual(Type::Int1Ty)), &FI); return EraseInstFromFunction(FI); } @@ -9887,8 +9893,10 @@ return BinaryOperator::create(BO->getOpcode(), newEI0, newEI1); } } else if (isa(I)) { + unsigned AS = + cast(I->getOperand(0)->getType())->getAddressSpace(); Value *Ptr = InsertCastBefore(Instruction::BitCast, I->getOperand(0), - PointerType::get(EI.getType()), EI); + PointerType::get(EI.getType(), AS), EI); GetElementPtrInst *GEP = new GetElementPtrInst(Ptr, EI.getOperand(1), I->getName() + ".gep"); InsertNewInstBefore(GEP, EI); Modified: llvm/trunk/lib/Transforms/Scalar/LowerGC.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LowerGC.cpp?rev=45082&r1=45081&r2=45082&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Scalar/LowerGC.cpp (original) +++ llvm/trunk/lib/Transforms/Scalar/LowerGC.cpp Sun Dec 16 19:12:55 2007 @@ -86,7 +86,7 @@ PATypeHolder RootListH = MainRootRecordType ? (Type*)MainRootRecordType : (Type*)OpaqueType::get(); ST.clear(); - ST.push_back(PointerType::get(RootListH)); // Prev pointer + ST.push_back(PointerType::getUnqual(RootListH)); // Prev pointer ST.push_back(Type::Int32Ty); // NumElements in array ST.push_back(PairArrTy); // The pairs StructType *RootList = StructType::get(ST); @@ -107,8 +107,8 @@ GCWriteInt = M.getFunction("llvm.gcwrite"); if (!GCRootInt && !GCReadInt && !GCWriteInt) return false; - PointerType *VoidPtr = PointerType::get(Type::Int8Ty); - PointerType *VoidPtrPtr = PointerType::get(VoidPtr); + PointerType *VoidPtr = PointerType::getUnqual(Type::Int8Ty); + PointerType *VoidPtrPtr = PointerType::getUnqual(VoidPtr); // If the program is using read/write barriers, find the implementations of // them from the GC runtime library. @@ -122,7 +122,7 @@ // If the program has GC roots, get or create the global root list. if (GCRootInt) { const StructType *RootListTy = getRootRecordType(0); - const Type *PRLTy = PointerType::get(RootListTy); + const Type *PRLTy = PointerType::getUnqual(RootListTy); M.addTypeName("llvm_gc_root_ty", RootListTy); // Get the root chain if it already exists. @@ -163,8 +163,8 @@ // Quick exit for programs that are not using GC mechanisms. if (!GCRootInt && !GCReadInt && !GCWriteInt) return false; - PointerType *VoidPtr = PointerType::get(Type::Int8Ty); - PointerType *VoidPtrPtr = PointerType::get(VoidPtr); + PointerType *VoidPtr = PointerType::getUnqual(Type::Int8Ty); + PointerType *VoidPtrPtr = PointerType::getUnqual(VoidPtr); // If there are read/write barriers in the program, perform a quick pass over // the function eliminating them. While we are at it, remember where we see @@ -290,7 +290,7 @@ // Now that the record is all initialized, store the pointer into the global // pointer. - Value *C = new BitCastInst(AI, PointerType::get(MainRootRecordType), "", IP); + Value *C = new BitCastInst(AI, PointerType::getUnqual(MainRootRecordType), "", IP); new StoreInst(C, RootChain, IP); // Eliminate all the gcroot records now. Modified: llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp?rev=45082&r1=45081&r2=45082&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/CodeExtractor.cpp Sun Dec 16 19:12:55 2007 @@ -263,7 +263,7 @@ if (AggregateArgs) paramTy.push_back((*I)->getType()); else - paramTy.push_back(PointerType::get((*I)->getType())); + paramTy.push_back(PointerType::getUnqual((*I)->getType())); } DOUT << "Function type: " << *RetTy << " f("; @@ -273,7 +273,7 @@ DOUT << ")\n"; if (AggregateArgs && (inputs.size() + outputs.size() > 0)) { - PointerType *StructPtr = PointerType::get(StructType::get(paramTy)); + PointerType *StructPtr = PointerType::getUnqual(StructType::get(paramTy)); paramTy.clear(); paramTy.push_back(StructPtr); } Modified: llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp?rev=45082&r1=45081&r2=45082&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp Sun Dec 16 19:12:55 2007 @@ -277,7 +277,7 @@ // code with llvm.stacksave/llvm.stackrestore intrinsics. if (InlinedFunctionInfo.ContainsDynamicAllocas) { Module *M = Caller->getParent(); - const Type *BytePtr = PointerType::get(Type::Int8Ty); + const Type *BytePtr = PointerType::getUnqual(Type::Int8Ty); // Get the two intrinsics we care about. Constant *StackSave, *StackRestore; StackSave = M->getOrInsertFunction("llvm.stacksave", BytePtr, NULL); Modified: llvm/trunk/lib/Transforms/Utils/LowerAllocations.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LowerAllocations.cpp?rev=45082&r1=45081&r2=45082&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/LowerAllocations.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/LowerAllocations.cpp Sun Dec 16 19:12:55 2007 @@ -87,7 +87,7 @@ // This function is always successful. // bool LowerAllocations::doInitialization(Module &M) { - const Type *BPTy = PointerType::get(Type::Int8Ty); + const Type *BPTy = PointerType::getUnqual(Type::Int8Ty); // Prototype malloc as "char* malloc(...)", because we don't know in // doInitialization whether size_t is int or long. FunctionType *FT = FunctionType::get(BPTy, std::vector(), true); @@ -158,8 +158,9 @@ Changed = true; ++NumLowered; } else if (FreeInst *FI = dyn_cast(I)) { - Value *PtrCast = new BitCastInst(FI->getOperand(0), - PointerType::get(Type::Int8Ty), "", I); + Value *PtrCast = + new BitCastInst(FI->getOperand(0), + PointerType::getUnqual(Type::Int8Ty), "", I); // Insert a call to the free function... (new CallInst(FreeFunc, PtrCast, "", I))->setTailCall(); Modified: llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp?rev=45082&r1=45081&r2=45082&view=diff ============================================================================== --- llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp (original) +++ llvm/trunk/lib/Transforms/Utils/LowerInvoke.cpp Sun Dec 16 19:12:55 2007 @@ -114,7 +114,7 @@ // doInitialization - Make sure that there is a prototype for abort in the // current module. bool LowerInvoke::doInitialization(Module &M) { - const Type *VoidPtrTy = PointerType::get(Type::Int8Ty); + const Type *VoidPtrTy = PointerType::getUnqual(Type::Int8Ty); AbortMessage = 0; if (ExpensiveEHSupport) { // Insert a type for the linked list of jump buffers. @@ -126,14 +126,14 @@ std::vector Elements; Elements.push_back(JmpBufTy); OpaqueType *OT = OpaqueType::get(); - Elements.push_back(PointerType::get(OT)); + Elements.push_back(PointerType::getUnqual(OT)); PATypeHolder JBLType(StructType::get(Elements)); OT->refineAbstractTypeTo(JBLType.get()); // Complete the cycle. JBLinkTy = JBLType.get(); M.addTypeName("llvm.sjljeh.jmpbufty", JBLinkTy); } - const Type *PtrJBList = PointerType::get(JBLinkTy); + const Type *PtrJBList = PointerType::getUnqual(JBLinkTy); // Now that we've done that, insert the jmpbuf list head global, unless it // already exists. @@ -144,9 +144,10 @@ "llvm.sjljeh.jblist", &M); } SetJmpFn = M.getOrInsertFunction("llvm.setjmp", Type::Int32Ty, - PointerType::get(JmpBufTy), (Type *)0); + PointerType::getUnqual(JmpBufTy), + (Type *)0); LongJmpFn = M.getOrInsertFunction("llvm.longjmp", Type::VoidTy, - PointerType::get(JmpBufTy), + PointerType::getUnqual(JmpBufTy), Type::Int32Ty, (Type *)0); } Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=45082&r1=45081&r2=45082&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/ConstantFold.cpp (original) +++ llvm/trunk/lib/VMCore/ConstantFold.cpp Sun Dec 16 19:12:55 2007 @@ -1383,12 +1383,13 @@ return const_cast(C); if (isa(C)) { - const Type *Ty = GetElementPtrInst::getIndexedType(C->getType(), + const PointerType *Ptr = cast(C->getType()); + const Type *Ty = GetElementPtrInst::getIndexedType(Ptr, (Value **)Idxs, (Value **)Idxs+NumIdx, true); assert(Ty != 0 && "Invalid indices for GEP!"); - return UndefValue::get(PointerType::get(Ty)); + return UndefValue::get(PointerType::get(Ty, Ptr->getAddressSpace())); } Constant *Idx0 = Idxs[0]; @@ -1400,12 +1401,14 @@ break; } if (isNull) { - const Type *Ty = GetElementPtrInst::getIndexedType(C->getType(), + const PointerType *Ptr = cast(C->getType()); + const Type *Ty = GetElementPtrInst::getIndexedType(Ptr, (Value**)Idxs, (Value**)Idxs+NumIdx, true); assert(Ty != 0 && "Invalid indices for GEP!"); - return ConstantPointerNull::get(PointerType::get(Ty)); + return + ConstantPointerNull::get(PointerType::get(Ty,Ptr->getAddressSpace())); } } Modified: llvm/trunk/lib/VMCore/Constants.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=45082&r1=45081&r2=45082&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Constants.cpp (original) +++ llvm/trunk/lib/VMCore/Constants.cpp Sun Dec 16 19:12:55 2007 @@ -1710,7 +1710,7 @@ // sizeof is implemented as: (i64) gep (Ty*)null, 1 Constant *GEPIdx = ConstantInt::get(Type::Int32Ty, 1); Constant *GEP = - getGetElementPtr(getNullValue(PointerType::get(Ty)), &GEPIdx, 1); + getGetElementPtr(getNullValue(PointerType::getUnqual(Ty)), &GEPIdx, 1); return getCast(Instruction::PtrToInt, GEP, Type::Int64Ty); } Modified: llvm/trunk/lib/VMCore/Core.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Core.cpp?rev=45082&r1=45081&r2=45082&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Core.cpp (original) +++ llvm/trunk/lib/VMCore/Core.cpp Sun Dec 16 19:12:55 2007 @@ -150,7 +150,8 @@ } LLVMTypeRef LLVMPointerType(LLVMTypeRef ElementType) { - return wrap(PointerType::get(unwrap(ElementType))); + // FIXME: Needst to handle address spaces + return wrap(PointerType::getUnqual(unwrap(ElementType))); } LLVMTypeRef LLVMVectorType(LLVMTypeRef ElementType,unsigned ElementCount){ Modified: llvm/trunk/lib/VMCore/Function.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Function.cpp?rev=45082&r1=45081&r2=45082&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Function.cpp (original) +++ llvm/trunk/lib/VMCore/Function.cpp Sun Dec 16 19:12:55 2007 @@ -271,7 +271,8 @@ Function::Function(const FunctionType *Ty, LinkageTypes Linkage, const std::string &name, Module *ParentModule) - : GlobalValue(PointerType::get(Ty), Value::FunctionVal, 0, 0, Linkage, name), + : GlobalValue(PointerType::getUnqual(Ty), + Value::FunctionVal, 0, 0, Linkage, name), ParamAttrs(0) { SymTab = new ValueSymbolTable(); Modified: llvm/trunk/lib/VMCore/InlineAsm.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/InlineAsm.cpp?rev=45082&r1=45081&r2=45082&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/InlineAsm.cpp (original) +++ llvm/trunk/lib/VMCore/InlineAsm.cpp Sun Dec 16 19:12:55 2007 @@ -34,7 +34,9 @@ InlineAsm::InlineAsm(const FunctionType *Ty, const std::string &asmString, const std::string &constraints, bool hasSideEffects) - : Value(PointerType::get(Ty), Value::InlineAsmVal), AsmString(asmString), + : Value(PointerType::getUnqual(Ty), + Value::InlineAsmVal), + AsmString(asmString), Constraints(constraints), HasSideEffects(hasSideEffects) { // Do various checks on the constraint string and type. Modified: llvm/trunk/lib/VMCore/Instructions.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=45082&r1=45081&r2=45082&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Instructions.cpp (original) +++ llvm/trunk/lib/VMCore/Instructions.cpp Sun Dec 16 19:12:55 2007 @@ -72,8 +72,6 @@ return cast(I)->isNoUnwind(); } - - //===----------------------------------------------------------------------===// // TerminatorInst Class //===----------------------------------------------------------------------===// @@ -672,7 +670,7 @@ AllocationInst::AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy, unsigned Align, const std::string &Name, Instruction *InsertBefore) - : UnaryInstruction(PointerType::get(Ty), iTy, getAISize(ArraySize), + : UnaryInstruction(PointerType::getUnqual(Ty), iTy, getAISize(ArraySize), InsertBefore), Alignment(Align) { assert((Align & (Align-1)) == 0 && "Alignment is not a power of 2!"); assert(Ty != Type::VoidTy && "Cannot allocate void!"); @@ -682,7 +680,7 @@ AllocationInst::AllocationInst(const Type *Ty, Value *ArraySize, unsigned iTy, unsigned Align, const std::string &Name, BasicBlock *InsertAtEnd) - : UnaryInstruction(PointerType::get(Ty), iTy, getAISize(ArraySize), + : UnaryInstruction(PointerType::getUnqual(Ty), iTy, getAISize(ArraySize), InsertAtEnd), Alignment(Align) { assert((Align & (Align-1)) == 0 && "Alignment is not a power of 2!"); assert(Ty != Type::VoidTy && "Cannot allocate void!"); @@ -925,6 +923,10 @@ // GetElementPtrInst Implementation //===----------------------------------------------------------------------===// +static unsigned retrieveAddrSpace(const Value *Val) { + return cast(Val->getType())->getAddressSpace(); +} + void GetElementPtrInst::init(Value *Ptr, Value* const *Idx, unsigned NumIdx) { NumOperands = 1+NumIdx; Use *OL = OperandList = new Use[NumOperands]; @@ -944,7 +946,7 @@ GetElementPtrInst::GetElementPtrInst(Value *Ptr, Value *Idx, const std::string &Name, Instruction *InBe) : Instruction(PointerType::get(checkType(getIndexedType(Ptr->getType(),Idx)), - cast(Ptr->getType())->getAddressSpace()), + retrieveAddrSpace(Ptr)), GetElementPtr, 0, 0, InBe) { init(Ptr, Idx); setName(Name); @@ -953,7 +955,7 @@ GetElementPtrInst::GetElementPtrInst(Value *Ptr, Value *Idx, const std::string &Name, BasicBlock *IAE) : Instruction(PointerType::get(checkType(getIndexedType(Ptr->getType(),Idx)), - cast(Ptr->getType())->getAddressSpace()), + retrieveAddrSpace(Ptr)), GetElementPtr, 0, 0, IAE) { init(Ptr, Idx); setName(Name); Modified: llvm/trunk/lib/VMCore/Module.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Module.cpp?rev=45082&r1=45081&r2=45082&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Module.cpp (original) +++ llvm/trunk/lib/VMCore/Module.cpp Sun Dec 16 19:12:55 2007 @@ -164,8 +164,8 @@ // If the function exists but has the wrong type, return a bitcast to the // right type. - if (F->getType() != PointerType::get(Ty)) - return ConstantExpr::getBitCast(F, PointerType::get(Ty)); + if (F->getType() != PointerType::getUnqual(Ty)) + return ConstantExpr::getBitCast(F, PointerType::getUnqual(Ty)); // Otherwise, we just found the existing function or a prototype. return F; Modified: llvm/trunk/lib/VMCore/Verifier.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Verifier.cpp?rev=45082&r1=45081&r2=45082&view=diff ============================================================================== --- llvm/trunk/lib/VMCore/Verifier.cpp (original) +++ llvm/trunk/lib/VMCore/Verifier.cpp Sun Dec 16 19:12:55 2007 @@ -1161,12 +1161,12 @@ break; case Intrinsic::gcwrite: Assert1(CI.getOperand(3)->getType() - == PointerType::get(CI.getOperand(1)->getType()), + == PointerType::getUnqual(CI.getOperand(1)->getType()), "Call to llvm.gcwrite must be with type 'void (%ty*, %ty2*, %ty**)'.", &CI); break; case Intrinsic::gcread: - Assert1(CI.getOperand(2)->getType() == PointerType::get(CI.getType()), + Assert1(CI.getOperand(2)->getType() == PointerType::getUnqual(CI.getType()), "Call to llvm.gcread must be with type '%ty* (%ty2*, %ty**).'", &CI); break; Modified: llvm/trunk/tools/bugpoint/Miscompilation.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/Miscompilation.cpp?rev=45082&r1=45081&r2=45082&view=diff ============================================================================== --- llvm/trunk/tools/bugpoint/Miscompilation.cpp (original) +++ llvm/trunk/tools/bugpoint/Miscompilation.cpp Sun Dec 16 19:12:55 2007 @@ -679,8 +679,8 @@ // Prototype: void *getPointerToNamedFunction(const char* Name) Constant *resolverFunc = Safe->getOrInsertFunction("getPointerToNamedFunction", - PointerType::get(Type::Int8Ty), - PointerType::get(Type::Int8Ty), (Type *)0); + PointerType::getUnqual(Type::Int8Ty), + PointerType::getUnqual(Type::Int8Ty), (Type *)0); // Use the function we just added to get addresses of functions we need. for (Module::iterator F = Safe->begin(), E = Safe->end(); F != E; ++F) { @@ -739,7 +739,7 @@ "resolver", LookupBB); // cast the result from the resolver to correctly-typed function CastInst *CastedResolver = new BitCastInst(Resolver, - PointerType::get(F->getFunctionType()), "resolverCast", LookupBB); + PointerType::getUnqual(F->getFunctionType()), "resolverCast", LookupBB); // Save the value in our cache. new StoreInst(CastedResolver, Cache, LookupBB); Modified: llvm/trunk/tools/llvm-upgrade/UpgradeParser.y URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-upgrade/UpgradeParser.y?rev=45082&r1=45081&r2=45082&view=diff ============================================================================== --- llvm/trunk/tools/llvm-upgrade/UpgradeParser.y (original) +++ llvm/trunk/tools/llvm-upgrade/UpgradeParser.y Sun Dec 16 19:12:55 2007 @@ -829,7 +829,7 @@ if (isa(Ty)) error("Cannot declare global vars of function type"); - const PointerType *PTy = PointerType::get(Ty); + const PointerType *PTy = PointerType::getUnqual(Ty); std::string Name; if (NameStr) { @@ -883,7 +883,8 @@ } // Put the renaming in the global rename map - RenameMapKey Key = makeRenameMapKey(Name, PointerType::get(Ty), ID.S); + RenameMapKey Key = + makeRenameMapKey(Name, PointerType::getUnqual(Ty), ID.S); CurModule.RenameMap[Key] = NewName; // Rename it @@ -1404,7 +1405,7 @@ break; case 'v' : { - const Type* PtrTy = PointerType::get(Type::Int8Ty); + const Type* PtrTy = PointerType::getUnqual(Type::Int8Ty); std::vector Params; if (Name == "llvm.va_start" || Name == "llvm.va_end") { if (Args.size() != 1) @@ -1412,7 +1413,7 @@ Params.push_back(PtrTy); const FunctionType *FTy = FunctionType::get(Type::VoidTy, Params, false); - const PointerType *PFTy = PointerType::get(FTy); + const PointerType *PFTy = PointerType::getUnqual(FTy); Value* Func = getVal(PFTy, ID); Args[0] = new BitCastInst(Args[0], PtrTy, makeNameUnique("va"), CurBB); return new CallInst(Func, Args.begin(), Args.end()); @@ -1423,7 +1424,7 @@ Params.push_back(PtrTy); const FunctionType *FTy = FunctionType::get(Type::VoidTy, Params, false); - const PointerType *PFTy = PointerType::get(FTy); + const PointerType *PFTy = PointerType::getUnqual(FTy); Value* Func = getVal(PFTy, ID); std::string InstName0(makeNameUnique("va0")); std::string InstName1(makeNameUnique("va1")); @@ -1592,7 +1593,7 @@ const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID); const Type* ArgTy = F->getFunctionType()->getReturnType(); - const Type* ArgTyPtr = PointerType::get(ArgTy); + const Type* ArgTyPtr = PointerType::getUnqual(ArgTy); Function* NF = cast(Result->getOrInsertFunction( "llvm.va_start", RetTy, ArgTyPtr, (Type *)0)); @@ -1619,7 +1620,7 @@ //vaend bar const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID); const Type* ArgTy = F->getFunctionType()->getParamType(0); - const Type* ArgTyPtr = PointerType::get(ArgTy); + const Type* ArgTyPtr = PointerType::getUnqual(ArgTy); Function* NF = cast(Result->getOrInsertFunction( "llvm.va_end", RetTy, ArgTyPtr, (Type *)0)); @@ -1648,7 +1649,7 @@ const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID); const Type* ArgTy = F->getFunctionType()->getReturnType(); - const Type* ArgTyPtr = PointerType::get(ArgTy); + const Type* ArgTyPtr = PointerType::getUnqual(ArgTy); Function* NF = cast(Result->getOrInsertFunction( "llvm.va_copy", RetTy, ArgTyPtr, ArgTyPtr, (Type *)0)); @@ -2126,8 +2127,9 @@ if ($1.PAT->get() == Type::LabelTy) error("Cannot form a pointer to a basic block"); $$.S.makeComposite($1.S); - $$.PAT = new PATypeHolder(HandleUpRefs(PointerType::get($1.PAT->get()), - $$.S)); + $$.PAT = new + PATypeHolder(HandleUpRefs(PointerType::getUnqual($1.PAT->get()), + $$.S)); delete $1.PAT; } ; @@ -2834,10 +2836,10 @@ // i8*. We check here for those names and override the parameter list // types to ensure the prototype is correct. if (FunctionName == "llvm.va_start" || FunctionName == "llvm.va_end") { - ParamTyList.push_back(PointerType::get(Type::Int8Ty)); + ParamTyList.push_back(PointerType::getUnqual(Type::Int8Ty)); } else if (FunctionName == "llvm.va_copy") { - ParamTyList.push_back(PointerType::get(Type::Int8Ty)); - ParamTyList.push_back(PointerType::get(Type::Int8Ty)); + ParamTyList.push_back(PointerType::getUnqual(Type::Int8Ty)); + ParamTyList.push_back(PointerType::getUnqual(Type::Int8Ty)); } else if ($5) { // If there are arguments... for (std::vector >::iterator I = $5->begin(), E = $5->end(); I != E; ++I) { @@ -2852,7 +2854,7 @@ ParamTyList.pop_back(); const FunctionType *FT = FunctionType::get(RetTy, ParamTyList, isVarArg); - const PointerType *PFT = PointerType::get(FT); + const PointerType *PFT = PointerType::getUnqual(FT); delete $2.PAT; ValID ID; @@ -3102,7 +3104,8 @@ } ; -// SymbolicValueRef - Reference to one of two ways of symbolically refering to // another value. +// SymbolicValueRef - Reference to one of two ways of symbolically refering to +// another value. // SymbolicValueRef : INTVAL { $$ = ValID::create($1); $$.S.makeSignless(); } @@ -3251,7 +3254,7 @@ bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy; if (isVarArg) ParamTypes.pop_back(); Ty = FunctionType::get($3.PAT->get(), ParamTypes, isVarArg); - PFTy = PointerType::get(Ty); + PFTy = PointerType::getUnqual(Ty); $$.S.copy($3.S); } else { FTySign = $3.S; @@ -3656,7 +3659,7 @@ error("Functions cannot return aggregate types"); FTy = FunctionType::get(RetTy, ParamTypes, isVarArg); - PFTy = PointerType::get(FTy); + PFTy = PointerType::getUnqual(FTy); $$.S.copy($3.S); } else { FTySign = $3.S; @@ -3796,7 +3799,7 @@ Value *StoreVal = $3.V; Value* tmpVal = getVal(PTy, $6); if (ElTy != $3.V->getType()) { - PTy = PointerType::get(StoreVal->getType()); + PTy = PointerType::getUnqual(StoreVal->getType()); if (Constant *C = dyn_cast(tmpVal)) tmpVal = ConstantExpr::getBitCast(C, PTy); else Modified: llvm/trunk/tools/llvm2cpp/CppWriter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm2cpp/CppWriter.cpp?rev=45082&r1=45081&r2=45082&view=diff ============================================================================== --- llvm/trunk/tools/llvm2cpp/CppWriter.cpp (original) +++ llvm/trunk/tools/llvm2cpp/CppWriter.cpp Sun Dec 16 19:12:55 2007 @@ -577,7 +577,8 @@ bool isForward = printTypeInternal(ET); std::string elemName(getCppName(ET)); Out << "PointerType* " << typeName << " = PointerType::get(" - << elemName << (isForward ? "_fwd" : "") << ");"; + << elemName << (isForward ? "_fwd" : "") + << ", " << utostr(PT->getAddressSpace()) << ");"; nl(Out); break; } Modified: llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp?rev=45082&r1=45081&r2=45082&view=diff ============================================================================== --- llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp (original) +++ llvm/trunk/utils/TableGen/IntrinsicEmitter.cpp Sun Dec 16 19:12:55 2007 @@ -158,7 +158,7 @@ EmitTypeForValueType(OS, MVT::getVectorElementType(VT)); OS << ", " << MVT::getVectorNumElements(VT) << ")"; } else if (VT == MVT::iPTR) { - OS << "PointerType::get("; + OS << "PointerType::getUnqual("; EmitTypeGenerate(OS, ArgType->getValueAsDef("ElTy"), ArgNo); OS << ")"; } else if (VT == MVT::isVoid) { From christopher.lamb at gmail.com Sun Dec 16 19:15:41 2007 From: christopher.lamb at gmail.com (Christopher Lamb) Date: Mon, 17 Dec 2007 01:15:41 -0000 Subject: [llvm-commits] [llvm-gcc-4.0] r45083 - in /llvm-gcc-4.0/trunk/gcc: config/i386/llvm-i386.cpp config/rs6000/llvm-rs6000.cpp llvm-abi.h llvm-backend.cpp llvm-convert.cpp llvm-types.cpp Message-ID: <200712170115.lBH1Fg9c023106@zion.cs.uiuc.edu> Author: clamb Date: Sun Dec 16 19:15:41 2007 New Revision: 45083 URL: http://llvm.org/viewvc/llvm-project?rev=45083&view=rev Log: Update to use new PointerType::getUnqual() api. Modified: llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp llvm-gcc-4.0/trunk/gcc/config/rs6000/llvm-rs6000.cpp llvm-gcc-4.0/trunk/gcc/llvm-abi.h llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp llvm-gcc-4.0/trunk/gcc/llvm-types.cpp Modified: llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp?rev=45083&r1=45082&r2=45083&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/config/i386/llvm-i386.cpp Sun Dec 16 19:15:41 2007 @@ -382,7 +382,7 @@ return true; } case IX86_BUILTIN_LOADQ: { - PointerType *f64Ptr = PointerType::get(Type::DoubleTy); + PointerType *f64Ptr = PointerType::getUnqual(Type::DoubleTy); Value *Zero = ConstantFP::get(Type::DoubleTy, APFloat(0.0)); Ops[0] = Builder.CreateBitCast(Ops[0], f64Ptr, "tmp"); Ops[0] = Builder.CreateLoad(Ops[0], "tmp"); @@ -391,7 +391,7 @@ return true; } case IX86_BUILTIN_LOADHPS: { - PointerType *f64Ptr = PointerType::get(Type::DoubleTy); + PointerType *f64Ptr = PointerType::getUnqual(Type::DoubleTy); Ops[1] = Builder.CreateBitCast(Ops[1], f64Ptr, "tmp"); Value *Load = Builder.CreateLoad(Ops[1], "tmp"); Ops[1] = BuildVector(Load, UndefValue::get(Type::DoubleTy), NULL); @@ -401,7 +401,7 @@ return true; } case IX86_BUILTIN_LOADLPS: { - PointerType *f64Ptr = PointerType::get(Type::DoubleTy); + PointerType *f64Ptr = PointerType::getUnqual(Type::DoubleTy); Ops[1] = Builder.CreateBitCast(Ops[1], f64Ptr, "tmp"); Value *Load = Builder.CreateLoad(Ops[1], "tmp"); Ops[1] = BuildVector(Load, UndefValue::get(Type::DoubleTy), NULL); @@ -412,7 +412,7 @@ } case IX86_BUILTIN_STOREHPS: { VectorType *v2f64 = VectorType::get(Type::DoubleTy, 2); - PointerType *f64Ptr = PointerType::get(Type::DoubleTy); + PointerType *f64Ptr = PointerType::getUnqual(Type::DoubleTy); Ops[0] = Builder.CreateBitCast(Ops[0], f64Ptr, "tmp"); Value *Idx = ConstantInt::get(Type::Int32Ty, 1); Ops[1] = Builder.CreateBitCast(Ops[1], v2f64, "tmp"); @@ -422,7 +422,7 @@ } case IX86_BUILTIN_STORELPS: { VectorType *v2f64 = VectorType::get(Type::DoubleTy, 2); - PointerType *f64Ptr = PointerType::get(Type::DoubleTy); + PointerType *f64Ptr = PointerType::getUnqual(Type::DoubleTy); Ops[0] = Builder.CreateBitCast(Ops[0], f64Ptr, "tmp"); Value *Idx = ConstantInt::get(Type::Int32Ty, 0); Ops[1] = Builder.CreateBitCast(Ops[1], v2f64, "tmp"); @@ -611,7 +611,7 @@ Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse_ldmxcsr); Value *Ptr = CreateTemporary(Type::Int32Ty); Builder.CreateStore(Ops[0], Ptr); - Ptr = Builder.CreateBitCast(Ptr, PointerType::get(Type::Int8Ty), "tmp"); + Ptr = Builder.CreateBitCast(Ptr, PointerType::getUnqual(Type::Int8Ty), "tmp"); Result = Builder.CreateCall(ldmxcsr, Ptr); return true; } @@ -619,7 +619,7 @@ Function *stmxcsr = Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse_stmxcsr); Value *Ptr = CreateTemporary(Type::Int32Ty); - Value *BPtr = Builder.CreateBitCast(Ptr, PointerType::get(Type::Int8Ty), + Value *BPtr = Builder.CreateBitCast(Ptr, PointerType::getUnqual(Type::Int8Ty), "tmp"); Builder.CreateCall(stmxcsr, BPtr); Modified: llvm-gcc-4.0/trunk/gcc/config/rs6000/llvm-rs6000.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/config/rs6000/llvm-rs6000.cpp?rev=45083&r1=45082&r2=45083&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/config/rs6000/llvm-rs6000.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/config/rs6000/llvm-rs6000.cpp Sun Dec 16 19:15:41 2007 @@ -44,7 +44,7 @@ const Type *ResultType, std::vector &Ops, LLVMBuilder &Builder, Value *&Result) { - const Type *VoidPtrTy = PointerType::get(Type::Int8Ty); + const Type *VoidPtrTy = PointerType::getUnqual(Type::Int8Ty); Function *IntFn = Intrinsic::getDeclaration(TheModule, IID); Modified: llvm-gcc-4.0/trunk/gcc/llvm-abi.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-abi.h?rev=45083&r1=45082&r2=45083&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/llvm-abi.h (original) +++ llvm-gcc-4.0/trunk/gcc/llvm-abi.h Sun Dec 16 19:15:41 2007 @@ -183,7 +183,7 @@ // FIXME: should return the hidden first argument for some targets // (e.g. ELF i386). - C.HandleAggregateShadowArgument(PointerType::get(Ty), false); + C.HandleAggregateShadowArgument(PointerType::getUnqual(Ty), false); } } @@ -196,7 +196,7 @@ const Type *Ty = ConvertType(type); if (isPassedByInvisibleReference(type)) { // variable size -> by-ref. - C.HandleScalarArgument(PointerType::get(Ty), type); + C.HandleScalarArgument(PointerType::getUnqual(Ty), type); } else if (Ty->isFirstClassType()) { C.HandleScalarArgument(Ty, type); } else if (LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(type)) { Modified: llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp?rev=45083&r1=45082&r2=45083&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/llvm-backend.cpp Sun Dec 16 19:15:41 2007 @@ -482,8 +482,9 @@ if (!AttributeUsedGlobals.empty()) { std::vector AUGs; - const Type *SBP= PointerType::get(Type::Int8Ty); - for (SmallSetVector::iterator AI = AttributeUsedGlobals.begin(), + const Type *SBP= PointerType::getUnqual(Type::Int8Ty); + for (SmallSetVector::iterator AI = + AttributeUsedGlobals.begin(), AE = AttributeUsedGlobals.end(); AI != AE; ++AI) { Constant *C = *AI; AUGs.push_back(ConstantExpr::getBitCast(C, SBP)); @@ -499,7 +500,7 @@ // Add llvm.noinline if (!AttributeNoinlineFunctions.empty()) { - const Type *SBP= PointerType::get(Type::Int8Ty); + const Type *SBP= PointerType::getUnqual(Type::Int8Ty); ArrayType *AT = ArrayType::get(SBP, AttributeNoinlineFunctions.size()); Constant *Init = ConstantArray::get(AT, AttributeNoinlineFunctions); GlobalValue *gv = new GlobalVariable(AT, false, @@ -717,7 +718,7 @@ // Get file and line number Constant *lineNo = ConstantInt::get(Type::Int32Ty, DECL_SOURCE_LINE(decl)); Constant *file = ConvertMetadataStringToGV(DECL_SOURCE_FILE(decl)); - const Type *SBP= PointerType::get(Type::Int8Ty); + const Type *SBP= PointerType::getUnqual(Type::Int8Ty); file = ConstantExpr::getBitCast(file, SBP); // There may be multiple annotate attributes. Pass return of lookup_attr Modified: llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp?rev=45083&r1=45082&r2=45083&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/llvm-convert.cpp Sun Dec 16 19:15:41 2007 @@ -459,7 +459,7 @@ Value *Loc = LocStack.back(); if (cast(Loc->getType())->getElementType() != LLVMTy) // This cast only involves pointers, therefore BitCast - Loc = Builder.CreateBitCast(Loc, PointerType::get(LLVMTy), "tmp"); + Loc = Builder.CreateBitCast(Loc, PointerType::getUnqual(LLVMTy), "tmp"); Builder.CreateStore(ArgVal, Loc); AI->setName(NameStack.back()); @@ -472,7 +472,8 @@ Value *Loc = LocStack.back(); if (cast(Loc->getType())->getElementType() != StructTy) // This cast only involves pointers, therefore BitCast - Loc = Builder.CreateBitCast(Loc, PointerType::get(StructTy), "tmp"); + Loc = Builder.CreateBitCast(Loc, PointerType::getUnqual(StructTy), + "tmp"); Value *Idxs[] = { Constant::getNullValue(Type::Int32Ty), @@ -602,7 +603,7 @@ // Handle noinline Functions if (lookup_attribute ("noinline", DECL_ATTRIBUTES (FnDecl))) { - const Type *SBP= PointerType::get(Type::Int8Ty); + const Type *SBP= PointerType::getUnqual(Type::Int8Ty); AttributeNoinlineFunctions.push_back(ConstantExpr::getBitCast(Fn,SBP)); } @@ -717,7 +718,7 @@ // to the specified scalar type, which we do by casting the pointer and // loading. RetVal = BitCastToType(DECL_LLVM(DECL_RESULT(FnDecl)), - PointerType::get(Fn->getReturnType())); + PointerType::getUnqual(Fn->getReturnType())); RetVal = Builder.CreateLoad(RetVal, "retval"); } } @@ -1242,9 +1243,9 @@ // Don't copy tons of tiny elements. CountAggregateElements(LLVMTy) <= 8) { DestLoc.Ptr = CastToType(Instruction::BitCast, DestLoc.Ptr, - PointerType::get(LLVMTy)); + PointerType::getUnqual(LLVMTy)); SrcLoc.Ptr = CastToType(Instruction::BitCast, SrcLoc.Ptr, - PointerType::get(LLVMTy)); + PointerType::getUnqual(LLVMTy)); CopyAggregate(DestLoc, SrcLoc, Builder); return; } @@ -1302,7 +1303,7 @@ // Don't zero tons of tiny elements. CountAggregateElements(LLVMTy) <= 8) { DestLoc.Ptr = CastToType(Instruction::BitCast, DestLoc.Ptr, - PointerType::get(LLVMTy)); + PointerType::getUnqual(LLVMTy)); ZeroAggregate(DestLoc, Builder); return; @@ -1315,7 +1316,7 @@ void TreeToLLVM::EmitMemCpy(Value *DestPtr, Value *SrcPtr, Value *Size, unsigned Align) { - const Type *SBP = PointerType::get(Type::Int8Ty); + const Type *SBP = PointerType::getUnqual(Type::Int8Ty); const Type *IntPtr = TD.getIntPtrType(); Value *Ops[4] = { CastToType(Instruction::BitCast, DestPtr, SBP), @@ -1331,7 +1332,7 @@ void TreeToLLVM::EmitMemMove(Value *DestPtr, Value *SrcPtr, Value *Size, unsigned Align) { - const Type *SBP = PointerType::get(Type::Int8Ty); + const Type *SBP = PointerType::getUnqual(Type::Int8Ty); const Type *IntPtr = TD.getIntPtrType(); Value *Ops[4] = { CastToType(Instruction::BitCast, DestPtr, SBP), @@ -1347,7 +1348,7 @@ void TreeToLLVM::EmitMemSet(Value *DestPtr, Value *SrcVal, Value *Size, unsigned Align) { - const Type *SBP = PointerType::get(Type::Int8Ty); + const Type *SBP = PointerType::getUnqual(Type::Int8Ty); const Type *IntPtr = TD.getIntPtrType(); Value *Ops[4] = { CastToType(Instruction::BitCast, DestPtr, SBP), @@ -1457,8 +1458,8 @@ // The idea is that it's a pointer to type "Value" // which is opaque* but the routine expects i8** and i8*. - const PointerType *Ty = PointerType::get(Type::Int8Ty); - V = Builder.CreateBitCast(V, PointerType::get(Ty), "tmp"); + const PointerType *Ty = PointerType::getUnqual(Type::Int8Ty); + V = Builder.CreateBitCast(V, PointerType::getUnqual(Ty), "tmp"); Value *Ops[2] = { V, @@ -1483,7 +1484,7 @@ // Get file and line number Constant *lineNo = ConstantInt::get(Type::Int32Ty, DECL_SOURCE_LINE(decl)); Constant *file = ConvertMetadataStringToGV(DECL_SOURCE_FILE(decl)); - const Type *SBP= PointerType::get(Type::Int8Ty); + const Type *SBP= PointerType::getUnqual(Type::Int8Ty); file = ConstantExpr::getBitCast(file, SBP); // There may be multiple annotate attributes. Pass return of lookup_attr @@ -1503,7 +1504,7 @@ // Assert its a string, and then get that string. assert(TREE_CODE(val) == STRING_CST && "Annotate attribute arg should always be a string"); - const Type *SBP = PointerType::get(Type::Int8Ty); + const Type *SBP = PointerType::getUnqual(Type::Int8Ty); Constant *strGV = TreeConstantToLLVM::EmitLV_STRING_CST(val); Value *Ops[4] = { BitCastToType(V, SBP), @@ -2056,7 +2057,7 @@ if (TREE_CODE(exp) == CATCH_EXPR) // Catch all. TypeInfos.push_back( - Constant::getNullValue(PointerType::get(Type::Int8Ty)) + Constant::getNullValue(PointerType::getUnqual(Type::Int8Ty)) ); } else if (TREE_CODE(Types) != TREE_LIST) { // Construct typeinfo object. Each call will produce a new expression @@ -2102,7 +2103,7 @@ // The exception and the personality function. Args.push_back(Builder.CreateLoad(ExceptionValue, "eh_ptr")); Args.push_back(CastToType(Instruction::BitCast, FuncCPPPersonality, - PointerType::get(Type::Int8Ty))); + PointerType::getUnqual(Type::Int8Ty))); bool CaughtAll = false; for (std::vector::reverse_iterator I = CurrentEHScopes.rbegin(), @@ -2139,7 +2140,8 @@ // is being unwound. Enforce this by appending a catch-all. // FIXME: The use of null as catch-all is C++ specific. if (!CaughtAll) - Args.push_back(Constant::getNullValue(PointerType::get(Type::Int8Ty))); + Args.push_back( + Constant::getNullValue(PointerType::getUnqual(Type::Int8Ty))); Value *Select = Builder.CreateCall(FuncEHSelector, Args.begin(), Args.end(), "eh_select"); @@ -2155,7 +2157,7 @@ const Type *IntPtr = TD.getIntPtrType(); - ExceptionValue = CreateTemporary(PointerType::get(Type::Int8Ty)); + ExceptionValue = CreateTemporary(PointerType::getUnqual(Type::Int8Ty)); ExceptionValue->setName("eh_exception"); ExceptionSelectorValue = CreateTemporary(IntPtr); @@ -2185,7 +2187,7 @@ "_Unwind_Resume", #endif Type::getPrimitiveType(Type::VoidTyID), - PointerType::get(Type::Int8Ty), + PointerType::getUnqual(Type::Int8Ty), NULL); } @@ -2429,7 +2431,7 @@ tree TypeInfoNopExpr = (*lang_eh_runtime_type)(Types); // Produce value. Duplicate typeinfo get folded here. Value *TypeInfo = Emit(TypeInfoNopExpr, 0); - TypeInfo = BitCastToType(TypeInfo, PointerType::get(Type::Int8Ty)); + TypeInfo = BitCastToType(TypeInfo, PointerType::getUnqual(Type::Int8Ty)); // Call get eh type id. Value *TypeID = Builder.CreateCall(FuncEHGetTypeID, TypeInfo, @@ -2454,7 +2456,7 @@ tree TypeInfoNopExpr = (*lang_eh_runtime_type)(TREE_VALUE(Types)); // Produce value. Duplicate typeinfo get folded here. Value *TypeInfo = Emit(TypeInfoNopExpr, 0); - TypeInfo = BitCastToType(TypeInfo, PointerType::get(Type::Int8Ty)); + TypeInfo = BitCastToType(TypeInfo, PointerType::getUnqual(Type::Int8Ty)); // Call get eh type id. Value *TypeID = Builder.CreateCall(FuncEHGetTypeID, TypeInfo, @@ -2575,7 +2577,7 @@ if (!DestLoc) { // Scalar value: emit a load. Value *Ptr = CastToType(Instruction::BitCast, LV.Ptr, - PointerType::get(Ty)); + PointerType::getUnqual(Ty)); LoadInst *LI = Builder.CreateLoad(Ptr, isVolatile, "tmp"); LI->setAlignment(Alignment); return LI; @@ -2670,7 +2672,7 @@ // If this is a direct call to a function using a static chain then we need // to ensure the function type is the one just calculated: it has an extra // parameter for the chain. - Callee = BitCastToType(Callee, PointerType::get(Ty)); + Callee = BitCastToType(Callee, PointerType::getUnqual(Ty)); //EmitCall(exp, DestLoc); Value *Result = EmitCallOf(Callee, exp, DestLoc, PAL); @@ -2773,7 +2775,7 @@ Value *Loc = LocStack.back(); if (cast(Loc->getType())->getElementType() != LLVMTy) // This always deals with pointer types so BitCast is appropriate - Loc = Builder.CreateBitCast(Loc, PointerType::get(LLVMTy), "tmp"); + Loc = Builder.CreateBitCast(Loc, PointerType::getUnqual(LLVMTy), "tmp"); CallOperands.push_back(Builder.CreateLoad(Loc, "tmp")); } @@ -2784,7 +2786,8 @@ Value *Loc = LocStack.back(); if (cast(Loc->getType())->getElementType() != StructTy) // This always deals with pointer types so BitCast is appropriate - Loc = Builder.CreateBitCast(Loc, PointerType::get(StructTy), "tmp"); + Loc = Builder.CreateBitCast(Loc, PointerType::getUnqual(StructTy), + "tmp"); Value *Idxs[2] = { Zero, FIdx }; LocStack.push_back(Builder.CreateGEP(Loc, Idxs, Idxs + 2, "tmp")); @@ -2847,7 +2850,7 @@ Value *Ptr = ArgVal.Ptr; if (CallOperands.size() >= FTy->getNumParams()) - ArgTy = PointerType::get(ArgTy); + ArgTy = PointerType::getUnqual(ArgTy); CallOperands.push_back(CastToType(Instruction::BitCast, Ptr, ArgTy)); } else if (ActualArgTy->isFirstClassType()) { Value *V = Emit(TREE_VALUE(arg), 0); @@ -2930,7 +2933,8 @@ if (!DestLoc) return Call; // Normal scalar return. - Value *Ptr = BitCastToType(DestLoc->Ptr, PointerType::get(Call->getType())); + Value *Ptr = BitCastToType(DestLoc->Ptr, + PointerType::getUnqual(Call->getType())); StoreInst *St = Builder.CreateStore(Call, Ptr, DestLoc->Volatile); St->setAlignment(DestLoc->Alignment); return 0; @@ -3043,7 +3047,7 @@ if (PT->getElementType()->canLosslesslyBitCastTo(RHS->getType())) RHS = CastToAnyType(RHS, Op1Signed, PT->getElementType(), Op0Signed); else - LV.Ptr = BitCastToType(LV.Ptr, PointerType::get(RHS->getType())); + LV.Ptr = BitCastToType(LV.Ptr, PointerType::getUnqual(RHS->getType())); StoreInst *SI = Builder.CreateStore(RHS, LV.Ptr, isVolatile); SI->setAlignment(Alignment); return RHS; @@ -3126,7 +3130,8 @@ // Aggregate to aggregate copy. MemRef NewLoc = *DestLoc; NewLoc.Ptr = - CastToType(Instruction::BitCast, DestLoc->Ptr, PointerType::get(Ty)); + CastToType(Instruction::BitCast, DestLoc->Ptr, + PointerType::getUnqual(Ty)); Value *OpVal = Emit(Op, &NewLoc); assert(OpVal == 0 && "Shouldn't cast scalar to aggregate!"); return 0; @@ -3135,7 +3140,7 @@ // Scalar to aggregate copy. Value *OpVal = Emit(Op, 0); Value *Ptr = CastToType(Instruction::BitCast, DestLoc->Ptr, - PointerType::get(OpVal->getType())); + PointerType::getUnqual(OpVal->getType())); StoreInst *St = Builder.CreateStore(OpVal, Ptr, DestLoc->Volatile); St->setAlignment(DestLoc->Alignment); return 0; @@ -3159,7 +3164,8 @@ // This is an aggregate-to-agg VIEW_CONVERT_EXPR, just evaluate in place. Target = *DestLoc; Target.Ptr = - CastToType(Instruction::BitCast, DestLoc->Ptr, PointerType::get(OpTy)); + CastToType(Instruction::BitCast, DestLoc->Ptr, + PointerType::getUnqual(OpTy)); } else { // This is an aggregate-to-scalar VIEW_CONVERT_EXPR, evaluate, then load. Target = CreateTempLoc(OpTy); @@ -3202,7 +3208,7 @@ // Target holds the temporary created above. const Type *ExpTy = ConvertType(TREE_TYPE(exp)); return Builder.CreateLoad(CastToType(Instruction::BitCast, Target.Ptr, - PointerType::get(ExpTy)), "tmp"); + PointerType::getUnqual(ExpTy)), "tmp"); } if (DestLoc) { @@ -3211,7 +3217,7 @@ Value *OpVal = Emit(Op, 0); assert(OpVal && "Expected a scalar result!"); Value *Ptr = CastToType(Instruction::BitCast, DestLoc->Ptr, - PointerType::get(OpVal->getType())); + PointerType::getUnqual(OpVal->getType())); StoreInst *St = Builder.CreateStore(OpVal, Ptr, DestLoc->Volatile); St->setAlignment(DestLoc->Alignment); return 0; @@ -4093,7 +4099,8 @@ TySize == 32 || TySize == 64) { LLVMTy = IntegerType::get(TySize); Op = Builder.CreateLoad(CastToType(Instruction::BitCast, LV.Ptr, - PointerType::get(LLVMTy)), "tmp"); + PointerType::getUnqual(LLVMTy)), + "tmp"); } else { // Otherwise, emit our value as a lvalue and let the codegen deal with // it. @@ -4477,7 +4484,7 @@ location_t locus = EXPR_LOCATION (exp); Constant *lineNo = ConstantInt::get(Type::Int32Ty, locus.line); Constant *file = ConvertMetadataStringToGV(locus.file); - const Type *SBP= PointerType::get(Type::Int8Ty); + const Type *SBP= PointerType::getUnqual(Type::Int8Ty); file = ConstantExpr::getBitCast(file, SBP); // Get arguments. @@ -4712,7 +4719,8 @@ if (Locality == 0) Locality = ConstantInt::get(Type::Int32Ty, 3); - Ptr = CastToType(Instruction::BitCast, Ptr, PointerType::get(Type::Int8Ty)); + Ptr = CastToType(Instruction::BitCast, Ptr, + PointerType::getUnqual(Type::Int8Ty)); Value *Ops[3] = { Ptr, ReadWrite, Locality }; Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Intrinsic::prefetch), @@ -4756,7 +4764,8 @@ // Unfortunately, these constants are defined as RTL expressions and // should be handled separately. - Result = CastToType(Instruction::BitCast, Ptr, PointerType::get(Type::Int8Ty)); + Result = CastToType(Instruction::BitCast, Ptr, + PointerType::getUnqual(Type::Int8Ty)); return true; } @@ -4772,7 +4781,8 @@ // needed for: MIPS, Sparc. Unfortunately, these constants are defined // as RTL expressions and should be handled separately. - Result = CastToType(Instruction::BitCast, Ptr, PointerType::get(Type::Int8Ty)); + Result = CastToType(Instruction::BitCast, Ptr, + PointerType::getUnqual(Type::Int8Ty)); return true; } @@ -4874,7 +4884,7 @@ Value *Handler = Emit(TREE_VALUE(TREE_CHAIN(arglist)), 0); Offset = Builder.CreateIntCast(Offset, Type::Int32Ty, true, "tmp"); Handler = CastToType(Instruction::BitCast, Handler, - PointerType::get(Type::Int8Ty)); + PointerType::getUnqual(Type::Int8Ty)); SmallVector Args; Args.push_back(Offset); @@ -4903,7 +4913,7 @@ } Value *Addr = BitCastToType(Emit(TREE_VALUE(arglist), 0), - PointerType::get(Type::Int8Ty)); + PointerType::getUnqual(Type::Int8Ty)); Constant *Size, *Idx; for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) { @@ -4963,7 +4973,8 @@ return false; Value *Ptr = Emit(TREE_VALUE(arglist), 0); - Ptr = CastToType(Instruction::BitCast, Ptr, PointerType::get(Type::Int8Ty)); + Ptr = CastToType(Instruction::BitCast, Ptr, + PointerType::getUnqual(Type::Int8Ty)); Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Intrinsic::stackrestore), Ptr); @@ -5018,7 +5029,7 @@ const Type *FTy = cast(llvm_va_start_fn->getType())->getElementType(); ArgVal = CastToType(Instruction::BitCast, ArgVal, - PointerType::get(Type::Int8Ty)); + PointerType::getUnqual(Type::Int8Ty)); Builder.CreateCall(llvm_va_start_fn, ArgVal); return true; } @@ -5026,7 +5037,7 @@ bool TreeToLLVM::EmitBuiltinVAEnd(tree exp) { Value *Arg = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0); Arg = CastToType(Instruction::BitCast, Arg, - PointerType::get(Type::Int8Ty)); + PointerType::getUnqual(Type::Int8Ty)); Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Intrinsic::vaend), Arg); return true; @@ -5053,7 +5064,7 @@ Arg2 = DestLoc.Ptr; } - static const Type *VPTy = PointerType::get(Type::Int8Ty); + static const Type *VPTy = PointerType::getUnqual(Type::Int8Ty); // FIXME: This ignores alignment and volatility of the arguments. SmallVector Args; @@ -5071,7 +5082,7 @@ VOID_TYPE)) return false; - static const Type *VPTy = PointerType::get(Type::Int8Ty); + static const Type *VPTy = PointerType::getUnqual(Type::Int8Ty); Value *Tramp = Emit(TREE_VALUE(arglist), 0); Tramp = CastToType(Instruction::BitCast, Tramp, VPTy); @@ -5258,7 +5269,8 @@ Value *Decl = DECL_LLVM(exp); if (Decl == 0) { if (errorcount || sorrycount) { - const PointerType *Ty = PointerType::get(ConvertType(TREE_TYPE(exp))); + const PointerType *Ty = + PointerType::getUnqual(ConvertType(TREE_TYPE(exp))); return ConstantPointerNull::get(Ty); } assert(0 && "INTERNAL ERROR: Referencing decl that hasn't been laid out"); @@ -5294,7 +5306,7 @@ // type void. if (Ty == Type::VoidTy) Ty = StructType::get(std::vector(), false); - const PointerType *PTy = PointerType::get(Ty); + const PointerType *PTy = PointerType::getUnqual(Ty); return CastToType(Instruction::BitCast, Decl, PTy); } @@ -5344,22 +5356,24 @@ if (isArrayCompatible(ArrayType)) { Value *Idxs[2] = { ConstantInt::get(Type::Int32Ty, 0), IndexVal }; Value *Ptr = Builder.CreateGEP(ArrayAddr, Idxs, Idxs + 2, "tmp"); - return BitCastToType(Ptr, PointerType::get(ConvertType(TREE_TYPE(exp)))); + return BitCastToType(Ptr, + PointerType::getUnqual(ConvertType(TREE_TYPE(exp)))); } // If we are indexing over a fixed-size type, just use a GEP. if (isSequentialCompatible(ArrayType)) { - const Type *PtrElementTy = PointerType::get(ConvertType(ElementType)); + const Type *PtrElementTy = PointerType::getUnqual(ConvertType(ElementType)); ArrayAddr = BitCastToType(ArrayAddr, PtrElementTy); Value *Ptr = Builder.CreateGEP(ArrayAddr, IndexVal, "tmp"); - return BitCastToType(Ptr, PointerType::get(ConvertType(TREE_TYPE(exp)))); + return BitCastToType(Ptr, + PointerType::getUnqual(ConvertType(TREE_TYPE(exp)))); } // Otherwise, just do raw, low-level pointer arithmetic. FIXME: this could be // much nicer in cases like: // float foo(int w, float A[][w], int g) { return A[g][0]; } - ArrayAddr = BitCastToType(ArrayAddr, PointerType::get(Type::Int8Ty)); + ArrayAddr = BitCastToType(ArrayAddr, PointerType::getUnqual(Type::Int8Ty)); if (VOID_TYPE_P(TREE_TYPE(ArrayType))) // void * size is 1 @@ -5369,7 +5383,8 @@ TypeSize = CastToUIntType(TypeSize, IntPtrTy); IndexVal = Builder.CreateMul(IndexVal, TypeSize, "tmp"); Value *Ptr = Builder.CreateGEP(ArrayAddr, IndexVal, "tmp"); - return BitCastToType(Ptr, PointerType::get(ConvertType(TREE_TYPE(exp)))); + return BitCastToType(Ptr, + PointerType::getUnqual(ConvertType(TREE_TYPE(exp)))); } /// getFieldOffsetInBits - Return the offset (in bits) of a FIELD_DECL in a @@ -5413,7 +5428,7 @@ StructAddrLV.BitStart == 0) && "structs cannot be bitfields!"); StructAddrLV.Ptr = CastToType(Instruction::BitCast, StructAddrLV.Ptr, - PointerType::get(StructTy)); + PointerType::getUnqual(StructTy)); const Type *FieldTy = ConvertType(TREE_TYPE(FieldDecl)); // BitStart - This is the actual offset of the field from the start of the @@ -5444,7 +5459,8 @@ Value *Ptr = CastToType(Instruction::PtrToInt, StructAddrLV.Ptr, Offset->getType()); Ptr = Builder.CreateAdd(Ptr, Offset, "tmp"); - FieldPtr = CastToType(Instruction::IntToPtr, Ptr,PointerType::get(FieldTy)); + FieldPtr = CastToType(Instruction::IntToPtr, Ptr, + PointerType::getUnqual(FieldTy)); } if (tree DeclaredType = DECL_BIT_FIELD_TYPE(FieldDecl)) { @@ -5481,7 +5497,7 @@ // If this is a bitfield, the field may span multiple fields in the LLVM // type. As such, cast the pointer to be a pointer to the declared type. FieldPtr = CastToType(Instruction::BitCast, FieldPtr, - PointerType::get(FieldTy)); + PointerType::getUnqual(FieldTy)); // If this is a normal bitfield reference, return it as such. if (DECL_SIZE(FieldDecl) && TREE_CODE(DECL_SIZE(FieldDecl)) == INTEGER_CST){ @@ -5515,7 +5531,7 @@ Offset->getType()); FieldPtr = Builder.CreateAdd(FieldPtr, Offset, "tmp"); FieldPtr = CastToType(Instruction::IntToPtr, FieldPtr, - PointerType::get(FieldTy)); + PointerType::getUnqual(FieldTy)); // Adjust bitstart to account for the pointer movement. BitStart -= ByteOffset*8; @@ -5534,7 +5550,7 @@ } else { // Make sure we return a pointer to the right type. FieldPtr = CastToType(Instruction::BitCast, FieldPtr, - PointerType::get(ConvertType(TREE_TYPE(exp)))); + PointerType::getUnqual(ConvertType(TREE_TYPE(exp)))); } assert(BitStart == 0 && @@ -5562,7 +5578,7 @@ // TODO: If Ptr.Ptr is a struct type or something, we can do much better // than this. e.g. check out when compiling unwind-dw2-fde-darwin.c. Ptr.Ptr = CastToType(Instruction::BitCast, Ptr.Ptr, - PointerType::get(ValTy)); + PointerType::getUnqual(ValTy)); Ptr.Ptr = Builder.CreateGEP(Ptr.Ptr, ConstantInt::get(Type::Int32Ty, UnitOffset), "tmp"); @@ -5571,9 +5587,9 @@ // If this is referring to the whole field, return the whole thing. if (BitStart == 0 && BitSize == ValueSizeInBits) - return LValue(BitCastToType(Ptr.Ptr, PointerType::get(ValTy))); + return LValue(BitCastToType(Ptr.Ptr, PointerType::getUnqual(ValTy))); - return LValue(BitCastToType(Ptr.Ptr, PointerType::get(ValTy)), BitStart, + return LValue(BitCastToType(Ptr.Ptr, PointerType::getUnqual(ValTy)), BitStart, BitSize); } @@ -5593,14 +5609,16 @@ // If the input is an aggregate, the address is the address of the operand. LValue LV = EmitLV(Op); // The type is the type of the expression. - LV.Ptr = BitCastToType(LV.Ptr, PointerType::get(ConvertType(TREE_TYPE(exp)))); + LV.Ptr = BitCastToType(LV.Ptr, + PointerType::getUnqual(ConvertType(TREE_TYPE(exp)))); return LV; } else { // If the input is a scalar, emit to a temporary. Value *Dest = CreateTemporary(ConvertType(TREE_TYPE(Op))); Builder.CreateStore(Emit(Op, 0), Dest); // The type is the type of the expression. - Dest = BitCastToType(Dest, PointerType::get(ConvertType(TREE_TYPE(exp)))); + Dest = BitCastToType(Dest, + PointerType::getUnqual(ConvertType(TREE_TYPE(exp)))); return LValue(Dest); } } @@ -5666,7 +5684,7 @@ // Scalar value. Evaluate to a register, then do the store. Value *V = Emit(TREE_VALUE(elt), 0); Value *Ptr = CastToType(Instruction::BitCast, DestLoc->Ptr, - PointerType::get(V->getType())); + PointerType::getUnqual(V->getType())); StoreInst *St = Builder.CreateStore(V, Ptr, DestLoc->Volatile); St->setAlignment(DestLoc->Alignment); } @@ -6425,7 +6443,7 @@ BasicBlock *BB = getLabelDeclBlock(exp); Constant *C = TheTreeToLLVM->getIndirectGotoBlockNumber(BB); - return ConstantExpr::getIntToPtr(C, PointerType::get(Type::Int8Ty)); + return ConstantExpr::getIntToPtr(C, PointerType::getUnqual(Type::Int8Ty)); } Constant *TreeConstantToLLVM::EmitLV_STRING_CST(tree exp) { @@ -6505,7 +6523,7 @@ tree FieldDecl = TREE_OPERAND(exp, 1); StructAddrLV = ConstantExpr::getBitCast(StructAddrLV, - PointerType::get(StructTy)); + PointerType::getUnqual(StructTy)); const Type *FieldTy = ConvertType(TREE_TYPE(FieldDecl)); // BitStart - This is the actual offset of the field from the start of the @@ -6538,12 +6556,13 @@ Constant *Offset = Convert(field_offset); Constant *Ptr = ConstantExpr::getPtrToInt(StructAddrLV, Offset->getType()); Ptr = ConstantExpr::getAdd(Ptr, Offset); - FieldPtr = ConstantExpr::getIntToPtr(Ptr, PointerType::get(FieldTy)); + FieldPtr = ConstantExpr::getIntToPtr(Ptr, PointerType::getUnqual(FieldTy)); } if (DECL_BIT_FIELD_TYPE(FieldDecl)) { FieldTy = ConvertType(DECL_BIT_FIELD_TYPE(FieldDecl)); - FieldPtr = ConstantExpr::getBitCast(FieldPtr, PointerType::get(FieldTy)); + FieldPtr = ConstantExpr::getBitCast(FieldPtr, + PointerType::getUnqual(FieldTy)); } assert(BitStart == 0 && Modified: llvm-gcc-4.0/trunk/gcc/llvm-types.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/llvm-types.cpp?rev=45083&r1=45082&r2=45083&view=diff ============================================================================== --- llvm-gcc-4.0/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.0/trunk/gcc/llvm-types.cpp Sun Dec 16 19:15:41 2007 @@ -783,7 +783,8 @@ Ty = GET_TYPE_LLVM(TYPE_MAIN_VARIANT(TREE_TYPE(type))); if (Ty == 0) { PointersToReresolve.push_back(type); - return TypeDB.setType(type, PointerType::get(OpaqueType::get())); + return TypeDB.setType(type, + PointerType::getUnqual(OpaqueType::get())); } // A type has already been computed. However, this may be some sort of @@ -801,7 +802,7 @@ if (Ty->getTypeID() == Type::VoidTyID) Ty = Type::Int8Ty; // void* -> sbyte* - return TypeDB.setType(type, PointerType::get(Ty)); + return TypeDB.setType(type, PointerType::getUnqual(Ty)); } case METHOD_TYPE: From christopher.lamb at gmail.com Sun Dec 16 19:16:41 2007 From: christopher.lamb at gmail.com (Christopher Lamb) Date: Mon, 17 Dec 2007 01:16:41 -0000 Subject: [llvm-commits] [llvm-gcc-4.2] r45084 - in /llvm-gcc-4.2/trunk/gcc: config/i386/llvm-i386.cpp config/rs6000/llvm-rs6000.cpp llvm-abi.h llvm-backend.cpp llvm-convert.cpp llvm-types.cpp Message-ID: <200712170116.lBH1Gg0f023200@zion.cs.uiuc.edu> Author: clamb Date: Sun Dec 16 19:16:41 2007 New Revision: 45084 URL: http://llvm.org/viewvc/llvm-project?rev=45084&view=rev Log: Update to use new PointerType::getUnqual() api. Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp llvm-gcc-4.2/trunk/gcc/llvm-abi.h llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Modified: llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp?rev=45084&r1=45083&r2=45084&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/config/i386/llvm-i386.cpp Sun Dec 16 19:16:41 2007 @@ -382,7 +382,7 @@ return true; } case IX86_BUILTIN_LOADQ: { - PointerType *f64Ptr = PointerType::get(Type::DoubleTy); + PointerType *f64Ptr = PointerType::getUnqual(Type::DoubleTy); Value *Zero = ConstantFP::get(Type::DoubleTy, APFloat(0.0)); Ops[0] = Builder.CreateBitCast(Ops[0], f64Ptr, "tmp"); Ops[0] = Builder.CreateLoad(Ops[0], "tmp"); @@ -391,7 +391,7 @@ return true; } case IX86_BUILTIN_LOADHPS: { - PointerType *f64Ptr = PointerType::get(Type::DoubleTy); + PointerType *f64Ptr = PointerType::getUnqual(Type::DoubleTy); Ops[1] = Builder.CreateBitCast(Ops[1], f64Ptr, "tmp"); Value *Load = Builder.CreateLoad(Ops[1], "tmp"); Ops[1] = BuildVector(Load, UndefValue::get(Type::DoubleTy), NULL); @@ -401,7 +401,7 @@ return true; } case IX86_BUILTIN_LOADLPS: { - PointerType *f64Ptr = PointerType::get(Type::DoubleTy); + PointerType *f64Ptr = PointerType::getUnqual(Type::DoubleTy); Ops[1] = Builder.CreateBitCast(Ops[1], f64Ptr, "tmp"); Value *Load = Builder.CreateLoad(Ops[1], "tmp"); Ops[1] = BuildVector(Load, UndefValue::get(Type::DoubleTy), NULL); @@ -412,7 +412,7 @@ } case IX86_BUILTIN_STOREHPS: { VectorType *v2f64 = VectorType::get(Type::DoubleTy, 2); - PointerType *f64Ptr = PointerType::get(Type::DoubleTy); + PointerType *f64Ptr = PointerType::getUnqual(Type::DoubleTy); Ops[0] = Builder.CreateBitCast(Ops[0], f64Ptr, "tmp"); Value *Idx = ConstantInt::get(Type::Int32Ty, 1); Ops[1] = Builder.CreateBitCast(Ops[1], v2f64, "tmp"); @@ -422,7 +422,7 @@ } case IX86_BUILTIN_STORELPS: { VectorType *v2f64 = VectorType::get(Type::DoubleTy, 2); - PointerType *f64Ptr = PointerType::get(Type::DoubleTy); + PointerType *f64Ptr = PointerType::getUnqual(Type::DoubleTy); Ops[0] = Builder.CreateBitCast(Ops[0], f64Ptr, "tmp"); Value *Idx = ConstantInt::get(Type::Int32Ty, 0); Ops[1] = Builder.CreateBitCast(Ops[1], v2f64, "tmp"); @@ -611,7 +611,7 @@ Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse_ldmxcsr); Value *Ptr = CreateTemporary(Type::Int32Ty); Builder.CreateStore(Ops[0], Ptr); - Ptr = Builder.CreateBitCast(Ptr, PointerType::get(Type::Int8Ty), "tmp"); + Ptr = Builder.CreateBitCast(Ptr, PointerType::getUnqual(Type::Int8Ty), "tmp"); Result = Builder.CreateCall(ldmxcsr, Ptr); return true; } @@ -619,7 +619,7 @@ Function *stmxcsr = Intrinsic::getDeclaration(TheModule, Intrinsic::x86_sse_stmxcsr); Value *Ptr = CreateTemporary(Type::Int32Ty); - Value *BPtr = Builder.CreateBitCast(Ptr, PointerType::get(Type::Int8Ty), + Value *BPtr = Builder.CreateBitCast(Ptr, PointerType::getUnqual(Type::Int8Ty), "tmp"); Builder.CreateCall(stmxcsr, BPtr); Modified: llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp?rev=45084&r1=45083&r2=45084&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/config/rs6000/llvm-rs6000.cpp Sun Dec 16 19:16:41 2007 @@ -44,7 +44,7 @@ const Type *ResultType, std::vector &Ops, LLVMBuilder &Builder, Value *&Result) { - const Type *VoidPtrTy = PointerType::get(Type::Int8Ty); + const Type *VoidPtrTy = PointerType::getUnqual(Type::Int8Ty); Function *IntFn = Intrinsic::getDeclaration(TheModule, IID); Modified: llvm-gcc-4.2/trunk/gcc/llvm-abi.h URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-abi.h?rev=45084&r1=45083&r2=45084&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-abi.h (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-abi.h Sun Dec 16 19:16:41 2007 @@ -183,7 +183,7 @@ // FIXME: should return the hidden first argument for some targets // (e.g. ELF i386). - C.HandleAggregateShadowArgument(PointerType::get(Ty), false); + C.HandleAggregateShadowArgument(PointerType::getUnqual(Ty), false); } } @@ -196,7 +196,7 @@ const Type *Ty = ConvertType(type); if (isPassedByInvisibleReference(type)) { // variable size -> by-ref. - C.HandleScalarArgument(PointerType::get(Ty), type); + C.HandleScalarArgument(PointerType::getUnqual(Ty), type); } else if (Ty->isFirstClassType()) { C.HandleScalarArgument(Ty, type); } else if (LLVM_SHOULD_PASS_AGGREGATE_IN_INTEGER_REGS(type)) { Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=45084&r1=45083&r2=45084&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Sun Dec 16 19:16:41 2007 @@ -483,7 +483,7 @@ if (!AttributeUsedGlobals.empty()) { std::vector AUGs; - const Type *SBP= PointerType::get(Type::Int8Ty); + const Type *SBP= PointerType::getUnqual(Type::Int8Ty); for (SmallSetVector::iterator AI = AttributeUsedGlobals.begin(), AE = AttributeUsedGlobals.end(); AI != AE; ++AI) { Constant *C = *AI; @@ -501,7 +501,7 @@ // Add llvm.noinline if (!AttributeNoinlineFunctions.empty()) { - const Type *SBP= PointerType::get(Type::Int8Ty); + const Type *SBP= PointerType::getUnqual(Type::Int8Ty); ArrayType *AT = ArrayType::get(SBP, AttributeNoinlineFunctions.size()); Constant *Init = ConstantArray::get(AT, AttributeNoinlineFunctions); GlobalValue *gv = new GlobalVariable(AT, false, @@ -731,7 +731,7 @@ // Get file and line number Constant *lineNo = ConstantInt::get(Type::Int32Ty, DECL_SOURCE_LINE(decl)); Constant *file = ConvertMetadataStringToGV(DECL_SOURCE_FILE(decl)); - const Type *SBP= PointerType::get(Type::Int8Ty); + const Type *SBP= PointerType::getUnqual(Type::Int8Ty); file = ConstantExpr::getBitCast(file, SBP); // There may be multiple annotate attributes. Pass return of lookup_attr Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=45084&r1=45083&r2=45084&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Sun Dec 16 19:16:41 2007 @@ -485,7 +485,7 @@ Value *Loc = LocStack.back(); if (cast(Loc->getType())->getElementType() != LLVMTy) // This cast only involves pointers, therefore BitCast - Loc = Builder.CreateBitCast(Loc, PointerType::get(LLVMTy), "tmp"); + Loc = Builder.CreateBitCast(Loc, PointerType::getUnqual(LLVMTy), "tmp"); Builder.CreateStore(ArgVal, Loc); AI->setName(NameStack.back()); @@ -498,7 +498,8 @@ Value *Loc = LocStack.back(); if (cast(Loc->getType())->getElementType() != StructTy) // This cast only involves pointers, therefore BitCast - Loc = Builder.CreateBitCast(Loc, PointerType::get(StructTy), "tmp"); + Loc = Builder.CreateBitCast(Loc, PointerType::getUnqual(StructTy), + "tmp"); Value *Idxs[] = { Constant::getNullValue(Type::Int32Ty), @@ -628,7 +629,7 @@ // Handle noinline Functions if (lookup_attribute ("noinline", DECL_ATTRIBUTES (FnDecl))) { - const Type *SBP= PointerType::get(Type::Int8Ty); + const Type *SBP= PointerType::getUnqual(Type::Int8Ty); AttributeNoinlineFunctions.push_back(ConstantExpr::getBitCast(Fn,SBP)); } @@ -743,7 +744,7 @@ // to the specified scalar type, which we do by casting the pointer and // loading. RetVal = BitCastToType(DECL_LLVM(DECL_RESULT(FnDecl)), - PointerType::get(Fn->getReturnType())); + PointerType::getUnqual(Fn->getReturnType())); RetVal = Builder.CreateLoad(RetVal, "retval"); } } @@ -1271,8 +1272,8 @@ if (!TheTypeConverter->GCCTypeOverlapsWithLLVMTypePadding(type, LLVMTy) && // Don't copy tons of tiny elements. CountAggregateElements(LLVMTy) <= 8) { - DestLoc.Ptr = BitCastToType(DestLoc.Ptr, PointerType::get(LLVMTy)); - SrcLoc.Ptr = BitCastToType(SrcLoc.Ptr, PointerType::get(LLVMTy)); + DestLoc.Ptr = BitCastToType(DestLoc.Ptr, PointerType::getUnqual(LLVMTy)); + SrcLoc.Ptr = BitCastToType(SrcLoc.Ptr, PointerType::getUnqual(LLVMTy)); CopyAggregate(DestLoc, SrcLoc, Builder); return; } @@ -1329,7 +1330,7 @@ if (!TheTypeConverter->GCCTypeOverlapsWithLLVMTypePadding(type, LLVMTy) && // Don't zero tons of tiny elements. CountAggregateElements(LLVMTy) <= 8) { - DestLoc.Ptr = BitCastToType(DestLoc.Ptr, PointerType::get(LLVMTy)); + DestLoc.Ptr = BitCastToType(DestLoc.Ptr, PointerType::getUnqual(LLVMTy)); ZeroAggregate(DestLoc, Builder); return; } @@ -1341,7 +1342,7 @@ void TreeToLLVM::EmitMemCpy(Value *DestPtr, Value *SrcPtr, Value *Size, unsigned Align) { - const Type *SBP = PointerType::get(Type::Int8Ty); + const Type *SBP = PointerType::getUnqual(Type::Int8Ty); const Type *IntPtr = TD.getIntPtrType(); Value *Ops[4] = { BitCastToType(DestPtr, SBP), @@ -1357,7 +1358,7 @@ void TreeToLLVM::EmitMemMove(Value *DestPtr, Value *SrcPtr, Value *Size, unsigned Align) { - const Type *SBP = PointerType::get(Type::Int8Ty); + const Type *SBP = PointerType::getUnqual(Type::Int8Ty); const Type *IntPtr = TD.getIntPtrType(); Value *Ops[4] = { BitCastToType(DestPtr, SBP), @@ -1373,7 +1374,7 @@ void TreeToLLVM::EmitMemSet(Value *DestPtr, Value *SrcVal, Value *Size, unsigned Align) { - const Type *SBP = PointerType::get(Type::Int8Ty); + const Type *SBP = PointerType::getUnqual(Type::Int8Ty); const Type *IntPtr = TD.getIntPtrType(); Value *Ops[4] = { BitCastToType(DestPtr, SBP), @@ -1397,8 +1398,8 @@ // The idea is that it's a pointer to type "Value" // which is opaque* but the routine expects i8** and i8*. - const PointerType *Ty = PointerType::get(Type::Int8Ty); - V = Builder.CreateBitCast(V, PointerType::get(Ty), "tmp"); + const PointerType *Ty = PointerType::getUnqual(Type::Int8Ty); + V = Builder.CreateBitCast(V, PointerType::getUnqual(Ty), "tmp"); Value *Ops[2] = { V, @@ -1423,7 +1424,7 @@ // Get file and line number Constant *lineNo = ConstantInt::get(Type::Int32Ty, DECL_SOURCE_LINE(decl)); Constant *file = ConvertMetadataStringToGV(DECL_SOURCE_FILE(decl)); - const Type *SBP= PointerType::get(Type::Int8Ty); + const Type *SBP= PointerType::getUnqual(Type::Int8Ty); file = ConstantExpr::getBitCast(file, SBP); // There may be multiple annotate attributes. Pass return of lookup_attr @@ -1443,7 +1444,7 @@ // Assert its a string, and then get that string. assert(TREE_CODE(val) == STRING_CST && "Annotate attribute arg should always be a string"); - const Type *SBP = PointerType::get(Type::Int8Ty); + const Type *SBP = PointerType::getUnqual(Type::Int8Ty); Constant *strGV = TreeConstantToLLVM::EmitLV_STRING_CST(val); Value *Ops[4] = { BitCastToType(V, SBP), @@ -1795,7 +1796,7 @@ const Type *IntPtr = TD.getIntPtrType(); - ExceptionValue = CreateTemporary(PointerType::get(Type::Int8Ty)); + ExceptionValue = CreateTemporary(PointerType::getUnqual(Type::Int8Ty)); ExceptionValue->setName("eh_exception"); ExceptionSelectorValue = CreateTemporary(IntPtr); @@ -1857,7 +1858,7 @@ assert(llvm_eh_personality_libfunc && "no exception handling personality function!"); Args.push_back(BitCastToType(DECL_LLVM(llvm_eh_personality_libfunc), - PointerType::get(Type::Int8Ty))); + PointerType::getUnqual(Type::Int8Ty))); // Add selections for each handler. foreach_reachable_handler (i, false, AddHandler, &Handlers); @@ -1889,7 +1890,7 @@ if (!TypeList) { // Catch-all - push a null pointer. Args.push_back( - Constant::getNullValue(PointerType::get(Type::Int8Ty)) + Constant::getNullValue(PointerType::getUnqual(Type::Int8Ty)) ); } else { // Add the type infos. @@ -1915,7 +1916,7 @@ tree catch_all_type = lang_eh_catch_all(); if (catch_all_type == NULL_TREE) // Use a C++ style null catch-all object. - Catch_All = Constant::getNullValue(PointerType::get(Type::Int8Ty)); + Catch_All = Constant::getNullValue(PointerType::getUnqual(Type::Int8Ty)); else // This language has a type that catches all others. Catch_All = Emit(lookup_type_for_runtime(catch_all_type), 0); @@ -1979,7 +1980,7 @@ Value *Cond = NULL; for (; TypeList; TypeList = TREE_CHAIN (TypeList)) { Value *TType = Emit(lookup_type_for_runtime(TREE_VALUE(TypeList)), 0); - TType = BitCastToType(TType, PointerType::get(Type::Int8Ty)); + TType = BitCastToType(TType, PointerType::getUnqual(Type::Int8Ty)); // Call get eh type id. Value *TypeID = Builder.CreateCall(FuncEHGetTypeID, TType, "eh_typeid"); @@ -2087,7 +2088,7 @@ if (!LV.isBitfield()) { if (!DestLoc) { // Scalar value: emit a load. - Value *Ptr = BitCastToType(LV.Ptr, PointerType::get(Ty)); + Value *Ptr = BitCastToType(LV.Ptr, PointerType::getUnqual(Ty)); LoadInst *LI = Builder.CreateLoad(Ptr, isVolatile, "tmp"); LI->setAlignment(Alignment); return LI; @@ -2182,7 +2183,7 @@ // If this is a direct call to a function using a static chain then we need // to ensure the function type is the one just calculated: it has an extra // parameter for the chain. - Callee = BitCastToType(Callee, PointerType::get(Ty)); + Callee = BitCastToType(Callee, PointerType::getUnqual(Ty)); //EmitCall(exp, DestLoc); Value *Result = EmitCallOf(Callee, exp, DestLoc, PAL); @@ -2280,7 +2281,7 @@ Value *Loc = LocStack.back(); if (cast(Loc->getType())->getElementType() != LLVMTy) // This always deals with pointer types so BitCast is appropriate - Loc = Builder.CreateBitCast(Loc, PointerType::get(LLVMTy), "tmp"); + Loc = Builder.CreateBitCast(Loc, PointerType::getUnqual(LLVMTy), "tmp"); CallOperands.push_back(Builder.CreateLoad(Loc, "tmp")); } @@ -2291,7 +2292,8 @@ Value *Loc = LocStack.back(); if (cast(Loc->getType())->getElementType() != StructTy) // This always deals with pointer types so BitCast is appropriate - Loc = Builder.CreateBitCast(Loc, PointerType::get(StructTy), "tmp"); + Loc = Builder.CreateBitCast(Loc, PointerType::getUnqual(StructTy), + "tmp"); Value *Idxs[2] = { Zero, FIdx }; LocStack.push_back(Builder.CreateGEP(Loc, Idxs, Idxs + 2, "tmp")); @@ -2383,7 +2385,7 @@ Value *Ptr = ArgVal.Ptr; if (CallOperands.size() >= FTy->getNumParams()) - ArgTy = PointerType::get(ArgTy); + ArgTy = PointerType::getUnqual(ArgTy); CallOperands.push_back(BitCastToType(Ptr, ArgTy)); } else if (ActualArgTy->isFirstClassType()) { Value *V = Emit(TREE_VALUE(arg), 0); @@ -2449,7 +2451,8 @@ if (!DestLoc) return Call; // Normal scalar return. - Value *Ptr = BitCastToType(DestLoc->Ptr, PointerType::get(Call->getType())); + Value *Ptr = BitCastToType(DestLoc->Ptr, + PointerType::getUnqual(Call->getType())); StoreInst *St = Builder.CreateStore(Call, Ptr, DestLoc->Volatile); St->setAlignment(DestLoc->Alignment); return 0; @@ -2562,7 +2565,7 @@ if (PT->getElementType()->canLosslesslyBitCastTo(RHS->getType())) RHS = CastToAnyType(RHS, Op1Signed, PT->getElementType(), Op0Signed); else - LV.Ptr = BitCastToType(LV.Ptr, PointerType::get(RHS->getType())); + LV.Ptr = BitCastToType(LV.Ptr, PointerType::getUnqual(RHS->getType())); StoreInst *SI = Builder.CreateStore(RHS, LV.Ptr, isVolatile); SI->setAlignment(Alignment); return RHS; @@ -2644,7 +2647,7 @@ } else if (isAggregateTreeType(TREE_TYPE(Op))) { // Aggregate to aggregate copy. MemRef NewLoc = *DestLoc; - NewLoc.Ptr = BitCastToType(DestLoc->Ptr, PointerType::get(Ty)); + NewLoc.Ptr = BitCastToType(DestLoc->Ptr, PointerType::getUnqual(Ty)); Value *OpVal = Emit(Op, &NewLoc); assert(OpVal == 0 && "Shouldn't cast scalar to aggregate!"); return 0; @@ -2652,7 +2655,8 @@ // Scalar to aggregate copy. Value *OpVal = Emit(Op, 0); - Value *Ptr = BitCastToType(DestLoc->Ptr, PointerType::get(OpVal->getType())); + Value *Ptr = BitCastToType(DestLoc->Ptr, + PointerType::getUnqual(OpVal->getType())); StoreInst *St = Builder.CreateStore(OpVal, Ptr, DestLoc->Volatile); St->setAlignment(DestLoc->Alignment); return 0; @@ -2675,7 +2679,7 @@ if (DestLoc) { // This is an aggregate-to-agg VIEW_CONVERT_EXPR, just evaluate in place. Target = *DestLoc; - Target.Ptr = BitCastToType(DestLoc->Ptr, PointerType::get(OpTy)); + Target.Ptr = BitCastToType(DestLoc->Ptr, PointerType::getUnqual(OpTy)); } else { // This is an aggregate-to-scalar VIEW_CONVERT_EXPR, evaluate, then load. Target = CreateTempLoc(OpTy); @@ -2719,7 +2723,8 @@ // Target holds the temporary created above. const Type *ExpTy = ConvertType(TREE_TYPE(exp)); return Builder.CreateLoad(BitCastToType(Target.Ptr, - PointerType::get(ExpTy)), "tmp"); + PointerType::getUnqual(ExpTy)), + "tmp"); } if (DestLoc) { @@ -2728,7 +2733,7 @@ Value *OpVal = Emit(Op, 0); assert(OpVal && "Expected a scalar result!"); Value *Ptr = BitCastToType(DestLoc->Ptr, - PointerType::get(OpVal->getType())); + PointerType::getUnqual(OpVal->getType())); StoreInst *St = Builder.CreateStore(OpVal, Ptr, DestLoc->Volatile); St->setAlignment(DestLoc->Alignment); return 0; @@ -3667,7 +3672,7 @@ TySize == 32 || TySize == 64) { LLVMTy = IntegerType::get(TySize); Op = Builder.CreateLoad(BitCastToType(LV.Ptr, - PointerType::get(LLVMTy)), + PointerType::getUnqual(LLVMTy)), "tmp"); } else { // Otherwise, emit our value as a lvalue and let the codegen deal with @@ -4264,7 +4269,7 @@ if (Locality == 0) Locality = ConstantInt::get(Type::Int32Ty, 3); - Ptr = BitCastToType(Ptr, PointerType::get(Type::Int8Ty)); + Ptr = BitCastToType(Ptr, PointerType::getUnqual(Type::Int8Ty)); Value *Ops[3] = { Ptr, ReadWrite, Locality }; Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Intrinsic::prefetch), @@ -4308,7 +4313,7 @@ // Unfortunately, these constants are defined as RTL expressions and // should be handled separately. - Result = BitCastToType(Ptr, PointerType::get(Type::Int8Ty)); + Result = BitCastToType(Ptr, PointerType::getUnqual(Type::Int8Ty)); return true; } @@ -4324,7 +4329,7 @@ // needed for: MIPS, Sparc. Unfortunately, these constants are defined // as RTL expressions and should be handled separately. - Result = BitCastToType(Ptr, PointerType::get(Type::Int8Ty)); + Result = BitCastToType(Ptr, PointerType::getUnqual(Type::Int8Ty)); return true; } @@ -4427,7 +4432,7 @@ Value *Offset = Emit(TREE_VALUE(arglist), 0); Value *Handler = Emit(TREE_VALUE(TREE_CHAIN(arglist)), 0); Offset = Builder.CreateIntCast(Offset, Type::Int32Ty, true, "tmp"); - Handler = BitCastToType(Handler, PointerType::get(Type::Int8Ty)); + Handler = BitCastToType(Handler, PointerType::getUnqual(Type::Int8Ty)); SmallVector Args; Args.push_back(Offset); @@ -4457,7 +4462,7 @@ } Value *Addr = BitCastToType(Emit(TREE_VALUE(arglist), 0), - PointerType::get(Type::Int8Ty)); + PointerType::getUnqual(Type::Int8Ty)); Constant *Size, *Idx; for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) { @@ -4519,7 +4524,7 @@ return false; Value *Ptr = Emit(TREE_VALUE(arglist), 0); - Ptr = BitCastToType(Ptr, PointerType::get(Type::Int8Ty)); + Ptr = BitCastToType(Ptr, PointerType::getUnqual(Type::Int8Ty)); Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Intrinsic::stackrestore), Ptr); @@ -4573,14 +4578,14 @@ Intrinsic::vastart); const Type *FTy = cast(llvm_va_start_fn->getType())->getElementType(); - ArgVal = BitCastToType(ArgVal, PointerType::get(Type::Int8Ty)); + ArgVal = BitCastToType(ArgVal, PointerType::getUnqual(Type::Int8Ty)); Builder.CreateCall(llvm_va_start_fn, ArgVal); return true; } bool TreeToLLVM::EmitBuiltinVAEnd(tree exp) { Value *Arg = Emit(TREE_VALUE(TREE_OPERAND(exp, 1)), 0); - Arg = BitCastToType(Arg, PointerType::get(Type::Int8Ty)); + Arg = BitCastToType(Arg, PointerType::getUnqual(Type::Int8Ty)); Builder.CreateCall(Intrinsic::getDeclaration(TheModule, Intrinsic::vaend), Arg); return true; @@ -4607,7 +4612,7 @@ Arg2 = DestLoc.Ptr; } - static const Type *VPTy = PointerType::get(Type::Int8Ty); + static const Type *VPTy = PointerType::getUnqual(Type::Int8Ty); // FIXME: This ignores alignment and volatility of the arguments. SmallVector Args; @@ -4625,7 +4630,7 @@ VOID_TYPE)) return false; - static const Type *VPTy = PointerType::get(Type::Int8Ty); + static const Type *VPTy = PointerType::getUnqual(Type::Int8Ty); Value *Tramp = Emit(TREE_VALUE(arglist), 0); Tramp = BitCastToType(Tramp, VPTy); @@ -4812,7 +4817,8 @@ Value *Decl = DECL_LLVM(exp); if (Decl == 0) { if (errorcount || sorrycount) { - const PointerType *Ty = PointerType::get(ConvertType(TREE_TYPE(exp))); + const PointerType *Ty = + PointerType::getUnqual(ConvertType(TREE_TYPE(exp))); return ConstantPointerNull::get(Ty); } assert(0 && "INTERNAL ERROR: Referencing decl that hasn't been laid out"); @@ -4850,7 +4856,7 @@ // type void. if (Ty == Type::VoidTy) Ty = StructType::get(std::vector(), false); - const PointerType *PTy = PointerType::get(Ty); + const PointerType *PTy = PointerType::getUnqual(Ty); return BitCastToType(Decl, PTy); } @@ -4900,22 +4906,24 @@ if (isArrayCompatible(ArrayType)) { Value *Idxs[2] = { ConstantInt::get(Type::Int32Ty, 0), IndexVal }; Value *Ptr = Builder.CreateGEP(ArrayAddr, Idxs, Idxs + 2, "tmp"); - return BitCastToType(Ptr, PointerType::get(ConvertType(TREE_TYPE(exp)))); + return BitCastToType(Ptr, + PointerType::getUnqual(ConvertType(TREE_TYPE(exp)))); } // If we are indexing over a fixed-size type, just use a GEP. if (isSequentialCompatible(ArrayType)) { - const Type *PtrElementTy = PointerType::get(ConvertType(ElementType)); + const Type *PtrElementTy = PointerType::getUnqual(ConvertType(ElementType)); ArrayAddr = BitCastToType(ArrayAddr, PtrElementTy); Value *Ptr = Builder.CreateGEP(ArrayAddr, IndexVal, "tmp"); - return BitCastToType(Ptr, PointerType::get(ConvertType(TREE_TYPE(exp)))); + return BitCastToType(Ptr, + PointerType::getUnqual(ConvertType(TREE_TYPE(exp)))); } // Otherwise, just do raw, low-level pointer arithmetic. FIXME: this could be // much nicer in cases like: // float foo(int w, float A[][w], int g) { return A[g][0]; } - ArrayAddr = BitCastToType(ArrayAddr, PointerType::get(Type::Int8Ty)); + ArrayAddr = BitCastToType(ArrayAddr, PointerType::getUnqual(Type::Int8Ty)); if (VOID_TYPE_P(TREE_TYPE(ArrayType))) return Builder.CreateGEP(ArrayAddr, IndexVal, "tmp"); @@ -4923,7 +4931,7 @@ TypeSize = CastToUIntType(TypeSize, IntPtrTy); IndexVal = Builder.CreateMul(IndexVal, TypeSize, "tmp"); Value *Ptr = Builder.CreateGEP(ArrayAddr, IndexVal, "tmp"); - return BitCastToType(Ptr, PointerType::get(ConvertType(TREE_TYPE(exp)))); + return BitCastToType(Ptr, PointerType::getUnqual(ConvertType(TREE_TYPE(exp)))); } /// getFieldOffsetInBits - Return the offset (in bits) of a FIELD_DECL in a @@ -4968,7 +4976,7 @@ StructAddrLV.BitStart == 0) && "structs cannot be bitfields!"); StructAddrLV.Ptr = BitCastToType(StructAddrLV.Ptr, - PointerType::get(StructTy)); + PointerType::getUnqual(StructTy)); const Type *FieldTy = ConvertType(TREE_TYPE(FieldDecl)); // BitStart - This is the actual offset of the field from the start of the @@ -4998,7 +5006,8 @@ Value *Ptr = CastToType(Instruction::PtrToInt, StructAddrLV.Ptr, Offset->getType()); Ptr = Builder.CreateAdd(Ptr, Offset, "tmp"); - FieldPtr = CastToType(Instruction::IntToPtr, Ptr,PointerType::get(FieldTy)); + FieldPtr = CastToType(Instruction::IntToPtr, Ptr, + PointerType::getUnqual(FieldTy)); } if (tree DeclaredType = DECL_BIT_FIELD_TYPE(FieldDecl)) { @@ -5034,7 +5043,7 @@ // If this is a bitfield, the field may span multiple fields in the LLVM // type. As such, cast the pointer to be a pointer to the declared type. - FieldPtr = BitCastToType(FieldPtr, PointerType::get(FieldTy)); + FieldPtr = BitCastToType(FieldPtr, PointerType::getUnqual(FieldTy)); // If this is a normal bitfield reference, return it as such. if (DECL_SIZE(FieldDecl) && TREE_CODE(DECL_SIZE(FieldDecl)) == INTEGER_CST){ @@ -5068,7 +5077,7 @@ Offset->getType()); FieldPtr = Builder.CreateAdd(FieldPtr, Offset, "tmp"); FieldPtr = CastToType(Instruction::IntToPtr, FieldPtr, - PointerType::get(FieldTy)); + PointerType::getUnqual(FieldTy)); // Adjust bitstart to account for the pointer movement. BitStart -= ByteOffset*8; @@ -5087,7 +5096,7 @@ } else { // Make sure we return a pointer to the right type. FieldPtr = BitCastToType(FieldPtr, - PointerType::get(ConvertType(TREE_TYPE(exp)))); + PointerType::getUnqual(ConvertType(TREE_TYPE(exp)))); } assert(BitStart == 0 && @@ -5114,7 +5123,7 @@ if (unsigned UnitOffset = BitStart / ValueSizeInBits) { // TODO: If Ptr.Ptr is a struct type or something, we can do much better // than this. e.g. check out when compiling unwind-dw2-fde-darwin.c. - Ptr.Ptr = BitCastToType(Ptr.Ptr, PointerType::get(ValTy)); + Ptr.Ptr = BitCastToType(Ptr.Ptr, PointerType::getUnqual(ValTy)); Ptr.Ptr = Builder.CreateGEP(Ptr.Ptr, ConstantInt::get(Type::Int32Ty, UnitOffset), "tmp"); @@ -5123,9 +5132,9 @@ // If this is referring to the whole field, return the whole thing. if (BitStart == 0 && BitSize == ValueSizeInBits) - return LValue(BitCastToType(Ptr.Ptr, PointerType::get(ValTy))); + return LValue(BitCastToType(Ptr.Ptr, PointerType::getUnqual(ValTy))); - return LValue(BitCastToType(Ptr.Ptr, PointerType::get(ValTy)), BitStart, + return LValue(BitCastToType(Ptr.Ptr, PointerType::getUnqual(ValTy)), BitStart, BitSize); } @@ -5145,14 +5154,16 @@ // If the input is an aggregate, the address is the address of the operand. LValue LV = EmitLV(Op); // The type is the type of the expression. - LV.Ptr = BitCastToType(LV.Ptr, PointerType::get(ConvertType(TREE_TYPE(exp)))); + LV.Ptr = BitCastToType(LV.Ptr, + PointerType::getUnqual(ConvertType(TREE_TYPE(exp)))); return LV; } else { // If the input is a scalar, emit to a temporary. Value *Dest = CreateTemporary(ConvertType(TREE_TYPE(Op))); Builder.CreateStore(Emit(Op, 0), Dest); // The type is the type of the expression. - Dest = BitCastToType(Dest, PointerType::get(ConvertType(TREE_TYPE(exp)))); + Dest = BitCastToType(Dest, + PointerType::getUnqual(ConvertType(TREE_TYPE(exp)))); return LValue(Dest); } } @@ -5235,7 +5246,8 @@ } else { // Scalar value. Evaluate to a register, then do the store. Value *V = Emit(tree_value, 0); - Value *Ptr = BitCastToType(DestLoc->Ptr, PointerType::get(V->getType())); + Value *Ptr = BitCastToType(DestLoc->Ptr, + PointerType::getUnqual(V->getType())); StoreInst *St = Builder.CreateStore(V, Ptr, DestLoc->Volatile); St->setAlignment(DestLoc->Alignment); } @@ -6005,7 +6017,7 @@ BasicBlock *BB = getLabelDeclBlock(exp); Constant *C = TheTreeToLLVM->getIndirectGotoBlockNumber(BB); - return ConstantExpr::getIntToPtr(C, PointerType::get(Type::Int8Ty)); + return ConstantExpr::getIntToPtr(C, PointerType::getUnqual(Type::Int8Ty)); } Constant *TreeConstantToLLVM::EmitLV_COMPLEX_CST(tree exp) { @@ -6101,7 +6113,7 @@ tree FieldDecl = TREE_OPERAND(exp, 1); StructAddrLV = ConstantExpr::getBitCast(StructAddrLV, - PointerType::get(StructTy)); + PointerType::getUnqual(StructTy)); const Type *FieldTy = ConvertType(TREE_TYPE(FieldDecl)); // BitStart - This is the actual offset of the field from the start of the @@ -6132,12 +6144,13 @@ Constant *Offset = Convert(field_offset); Constant *Ptr = ConstantExpr::getPtrToInt(StructAddrLV, Offset->getType()); Ptr = ConstantExpr::getAdd(Ptr, Offset); - FieldPtr = ConstantExpr::getIntToPtr(Ptr, PointerType::get(FieldTy)); + FieldPtr = ConstantExpr::getIntToPtr(Ptr, PointerType::getUnqual(FieldTy)); } if (DECL_BIT_FIELD_TYPE(FieldDecl)) { FieldTy = ConvertType(DECL_BIT_FIELD_TYPE(FieldDecl)); - FieldPtr = ConstantExpr::getBitCast(FieldPtr, PointerType::get(FieldTy)); + FieldPtr = ConstantExpr::getBitCast(FieldPtr, + PointerType::getUnqual(FieldTy)); } assert(BitStart == 0 && Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=45084&r1=45083&r2=45084&view=diff ============================================================================== --- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original) +++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Sun Dec 16 19:16:41 2007 @@ -811,7 +811,8 @@ Ty = GET_TYPE_LLVM(TYPE_MAIN_VARIANT(TREE_TYPE(type))); if (Ty == 0) { PointersToReresolve.push_back(type); - return TypeDB.setType(type, PointerType::get(OpaqueType::get())); + return TypeDB.setType(type, + PointerType::getUnqual(OpaqueType::get())); } // A type has already been computed. However, this may be some sort of @@ -829,7 +830,7 @@ if (Ty->getTypeID() == Type::VoidTyID) Ty = Type::Int8Ty; // void* -> sbyte* - return TypeDB.setType(type, PointerType::get(Ty)); + return TypeDB.setType(type, PointerType::getUnqual(Ty)); } case METHOD_TYPE: From christopher.lamb at gmail.com Sun Dec 16 19:17:35 2007 From: christopher.lamb at gmail.com (Christopher Lamb) Date: Mon, 17 Dec 2007 01:17:35 -0000 Subject: [llvm-commits] [llvm] r45085 - in /llvm/trunk: lib/AsmParser/llvmAsmParser.cpp.cvs lib/AsmParser/llvmAsmParser.y.cvs tools/llvm-upgrade/UpgradeParser.cpp.cvs tools/llvm-upgrade/UpgradeParser.h.cvs tools/llvm-upgrade/UpgradeParser.y.cvs Message-ID: <200712170117.lBH1Hacc023261@zion.cs.uiuc.edu> Author: clamb Date: Sun Dec 16 19:17:35 2007 New Revision: 45085 URL: http://llvm.org/viewvc/llvm-project?rev=45085&view=rev Log: regenerate. Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs llvm/trunk/tools/llvm-upgrade/UpgradeParser.cpp.cvs llvm/trunk/tools/llvm-upgrade/UpgradeParser.h.cvs llvm/trunk/tools/llvm-upgrade/UpgradeParser.y.cvs Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs?rev=45085&r1=45084&r2=45085&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.cpp.cvs Sun Dec 16 19:17:35 2007 @@ -4197,7 +4197,7 @@ PAL = ParamAttrsList::get(Attrs); FunctionType *FT = FunctionType::get(*yyvsp[-8].TypeVal, ParamTypeList, isVarArg); - const PointerType *PFT = PointerType::get(FT); + const PointerType *PFT = PointerType::getUnqual(FT); delete yyvsp[-8].TypeVal; ValID ID; @@ -4611,7 +4611,7 @@ ParamTypes.push_back(Ty); } Ty = FunctionType::get(yyvsp[-11].TypeVal->get(), ParamTypes, false); - PFTy = PointerType::get(Ty); + PFTy = PointerType::getUnqual(Ty); } delete yyvsp[-11].TypeVal; @@ -5008,7 +5008,7 @@ ParamTypes.push_back(Ty); } Ty = FunctionType::get(yyvsp[-5].TypeVal->get(), ParamTypes, false); - PFTy = PointerType::get(Ty); + PFTy = PointerType::getUnqual(Ty); } Value *V = getVal(PFTy, yyvsp[-4].ValIDVal); // Get the function we're calling... Modified: llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs?rev=45085&r1=45084&r2=45085&view=diff ============================================================================== --- llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs (original) +++ llvm/trunk/lib/AsmParser/llvmAsmParser.y.cvs Sun Dec 16 19:17:35 2007 @@ -2280,7 +2280,7 @@ PAL = ParamAttrsList::get(Attrs); FunctionType *FT = FunctionType::get(*$2, ParamTypeList, isVarArg); - const PointerType *PFT = PointerType::get(FT); + const PointerType *PFT = PointerType::getUnqual(FT); delete $2; ValID ID; @@ -2627,7 +2627,7 @@ ParamTypes.push_back(Ty); } Ty = FunctionType::get($3->get(), ParamTypes, false); - PFTy = PointerType::get(Ty); + PFTy = PointerType::getUnqual(Ty); } delete $3; @@ -2954,7 +2954,7 @@ ParamTypes.push_back(Ty); } Ty = FunctionType::get($3->get(), ParamTypes, false); - PFTy = PointerType::get(Ty); + PFTy = PointerType::getUnqual(Ty); } Value *V = getVal(PFTy, $4); // Get the function we're calling... Modified: llvm/trunk/tools/llvm-upgrade/UpgradeParser.cpp.cvs URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-upgrade/UpgradeParser.cpp.cvs?rev=45085&r1=45084&r2=45085&view=diff ============================================================================== --- llvm/trunk/tools/llvm-upgrade/UpgradeParser.cpp.cvs (original) +++ llvm/trunk/tools/llvm-upgrade/UpgradeParser.cpp.cvs Sun Dec 16 19:17:35 2007 @@ -1,386 +1,167 @@ -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton implementation for Bison's Yacc-like parsers in C +/* A Bison parser, made from /Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y + by GNU Bison version 1.28 */ - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. +#define YYBISON 1 /* Identify Bison output. */ - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* C LALR(1) parser skeleton written by Richard Stallman, by - simplifying the original so-called "semantic" parser. */ - -/* All symbols defined below should begin with yy or YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -/* Identify Bison output. */ -#define YYBISON 1 - -/* Bison version. */ -#define YYBISON_VERSION "2.3" - -/* Skeleton name. */ -#define YYSKELETON_NAME "yacc.c" - -/* Pure parsers. */ -#define YYPURE 0 - -/* Using locations. */ -#define YYLSP_NEEDED 0 - -/* Substitute the variable and function names. */ #define yyparse Upgradeparse -#define yylex Upgradelex +#define yylex Upgradelex #define yyerror Upgradeerror -#define yylval Upgradelval -#define yychar Upgradechar +#define yylval Upgradelval +#define yychar Upgradechar #define yydebug Upgradedebug #define yynerrs Upgradenerrs +#define ESINT64VAL 257 +#define EUINT64VAL 258 +#define SINTVAL 259 +#define UINTVAL 260 +#define FPVAL 261 +#define VOID 262 +#define BOOL 263 +#define SBYTE 264 +#define UBYTE 265 +#define SHORT 266 +#define USHORT 267 +#define INT 268 +#define UINT 269 +#define LONG 270 +#define ULONG 271 +#define FLOAT 272 +#define DOUBLE 273 +#define TYPE 274 +#define LABEL 275 +#define VAR_ID 276 +#define LABELSTR 277 +#define STRINGCONSTANT 278 +#define IMPLEMENTATION 279 +#define ZEROINITIALIZER 280 +#define TRUETOK 281 +#define FALSETOK 282 +#define BEGINTOK 283 +#define ENDTOK 284 +#define DECLARE 285 +#define GLOBAL 286 +#define CONSTANT 287 +#define SECTION 288 +#define VOLATILE 289 +#define TO 290 +#define DOTDOTDOT 291 +#define NULL_TOK 292 +#define UNDEF 293 +#define CONST 294 +#define INTERNAL 295 +#define LINKONCE 296 +#define WEAK 297 +#define APPENDING 298 +#define DLLIMPORT 299 +#define DLLEXPORT 300 +#define EXTERN_WEAK 301 +#define OPAQUE 302 +#define NOT 303 +#define EXTERNAL 304 +#define TARGET 305 +#define TRIPLE 306 +#define ENDIAN 307 +#define POINTERSIZE 308 +#define LITTLE 309 +#define BIG 310 +#define ALIGN 311 +#define DEPLIBS 312 +#define CALL 313 +#define TAIL 314 +#define ASM_TOK 315 +#define MODULE 316 +#define SIDEEFFECT 317 +#define CC_TOK 318 +#define CCC_TOK 319 +#define CSRETCC_TOK 320 +#define FASTCC_TOK 321 +#define COLDCC_TOK 322 +#define X86_STDCALLCC_TOK 323 +#define X86_FASTCALLCC_TOK 324 +#define DATALAYOUT 325 +#define RET 326 +#define BR 327 +#define SWITCH 328 +#define INVOKE 329 +#define UNREACHABLE 330 +#define UNWIND 331 +#define EXCEPT 332 +#define ADD 333 +#define SUB 334 +#define MUL 335 +#define DIV 336 +#define UDIV 337 +#define SDIV 338 +#define FDIV 339 +#define REM 340 +#define UREM 341 +#define SREM 342 +#define FREM 343 +#define AND 344 +#define OR 345 +#define XOR 346 +#define SHL 347 +#define SHR 348 +#define ASHR 349 +#define LSHR 350 +#define SETLE 351 +#define SETGE 352 +#define SETLT 353 +#define SETGT 354 +#define SETEQ 355 +#define SETNE 356 +#define ICMP 357 +#define FCMP 358 +#define MALLOC 359 +#define ALLOCA 360 +#define FREE 361 +#define LOAD 362 +#define STORE 363 +#define GETELEMENTPTR 364 +#define PHI_TOK 365 +#define SELECT 366 +#define VAARG 367 +#define EXTRACTELEMENT 368 +#define INSERTELEMENT 369 +#define SHUFFLEVECTOR 370 +#define VAARG_old 371 +#define VANEXT_old 372 +#define EQ 373 +#define NE 374 +#define SLT 375 +#define SGT 376 +#define SLE 377 +#define SGE 378 +#define ULT 379 +#define UGT 380 +#define ULE 381 +#define UGE 382 +#define OEQ 383 +#define ONE 384 +#define OLT 385 +#define OGT 386 +#define OLE 387 +#define OGE 388 +#define ORD 389 +#define UNO 390 +#define UEQ 391 +#define UNE 392 +#define CAST 393 +#define TRUNC 394 +#define ZEXT 395 +#define SEXT 396 +#define FPTRUNC 397 +#define FPEXT 398 +#define FPTOUI 399 +#define FPTOSI 400 +#define UITOFP 401 +#define SITOFP 402 +#define PTRTOINT 403 +#define INTTOPTR 404 +#define BITCAST 405 - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - ESINT64VAL = 258, - EUINT64VAL = 259, - SINTVAL = 260, - UINTVAL = 261, - FPVAL = 262, - VOID = 263, - BOOL = 264, - SBYTE = 265, - UBYTE = 266, - SHORT = 267, - USHORT = 268, - INT = 269, - UINT = 270, - LONG = 271, - ULONG = 272, - FLOAT = 273, - DOUBLE = 274, - TYPE = 275, - LABEL = 276, - VAR_ID = 277, - LABELSTR = 278, - STRINGCONSTANT = 279, - IMPLEMENTATION = 280, - ZEROINITIALIZER = 281, - TRUETOK = 282, - FALSETOK = 283, - BEGINTOK = 284, - ENDTOK = 285, - DECLARE = 286, - GLOBAL = 287, - CONSTANT = 288, - SECTION = 289, - VOLATILE = 290, - TO = 291, - DOTDOTDOT = 292, - NULL_TOK = 293, - UNDEF = 294, - CONST = 295, - INTERNAL = 296, - LINKONCE = 297, - WEAK = 298, - APPENDING = 299, - DLLIMPORT = 300, - DLLEXPORT = 301, - EXTERN_WEAK = 302, - OPAQUE = 303, - NOT = 304, - EXTERNAL = 305, - TARGET = 306, - TRIPLE = 307, - ENDIAN = 308, - POINTERSIZE = 309, - LITTLE = 310, - BIG = 311, - ALIGN = 312, - DEPLIBS = 313, - CALL = 314, - TAIL = 315, - ASM_TOK = 316, - MODULE = 317, - SIDEEFFECT = 318, - CC_TOK = 319, - CCC_TOK = 320, - CSRETCC_TOK = 321, - FASTCC_TOK = 322, - COLDCC_TOK = 323, - X86_STDCALLCC_TOK = 324, - X86_FASTCALLCC_TOK = 325, - DATALAYOUT = 326, - RET = 327, - BR = 328, - SWITCH = 329, - INVOKE = 330, - UNREACHABLE = 331, - UNWIND = 332, - EXCEPT = 333, - ADD = 334, - SUB = 335, - MUL = 336, - DIV = 337, - UDIV = 338, - SDIV = 339, - FDIV = 340, - REM = 341, - UREM = 342, - SREM = 343, - FREM = 344, - AND = 345, - OR = 346, - XOR = 347, - SHL = 348, - SHR = 349, - ASHR = 350, - LSHR = 351, - SETLE = 352, - SETGE = 353, - SETLT = 354, - SETGT = 355, - SETEQ = 356, - SETNE = 357, - ICMP = 358, - FCMP = 359, - MALLOC = 360, - ALLOCA = 361, - FREE = 362, - LOAD = 363, - STORE = 364, - GETELEMENTPTR = 365, - PHI_TOK = 366, - SELECT = 367, - VAARG = 368, - EXTRACTELEMENT = 369, - INSERTELEMENT = 370, - SHUFFLEVECTOR = 371, - VAARG_old = 372, - VANEXT_old = 373, - EQ = 374, - NE = 375, - SLT = 376, - SGT = 377, - SLE = 378, - SGE = 379, - ULT = 380, - UGT = 381, - ULE = 382, - UGE = 383, - OEQ = 384, - ONE = 385, - OLT = 386, - OGT = 387, - OLE = 388, - OGE = 389, - ORD = 390, - UNO = 391, - UEQ = 392, - UNE = 393, - CAST = 394, - TRUNC = 395, - ZEXT = 396, - SEXT = 397, - FPTRUNC = 398, - FPEXT = 399, - FPTOUI = 400, - FPTOSI = 401, - UITOFP = 402, - SITOFP = 403, - PTRTOINT = 404, - INTTOPTR = 405, - BITCAST = 406 - }; -#endif -/* Tokens. */ -#define ESINT64VAL 258 -#define EUINT64VAL 259 -#define SINTVAL 260 -#define UINTVAL 261 -#define FPVAL 262 -#define VOID 263 -#define BOOL 264 -#define SBYTE 265 -#define UBYTE 266 -#define SHORT 267 -#define USHORT 268 -#define INT 269 -#define UINT 270 -#define LONG 271 -#define ULONG 272 -#define FLOAT 273 -#define DOUBLE 274 -#define TYPE 275 -#define LABEL 276 -#define VAR_ID 277 -#define LABELSTR 278 -#define STRINGCONSTANT 279 -#define IMPLEMENTATION 280 -#define ZEROINITIALIZER 281 -#define TRUETOK 282 -#define FALSETOK 283 -#define BEGINTOK 284 -#define ENDTOK 285 -#define DECLARE 286 -#define GLOBAL 287 -#define CONSTANT 288 -#define SECTION 289 -#define VOLATILE 290 -#define TO 291 -#define DOTDOTDOT 292 -#define NULL_TOK 293 -#define UNDEF 294 -#define CONST 295 -#define INTERNAL 296 -#define LINKONCE 297 -#define WEAK 298 -#define APPENDING 299 -#define DLLIMPORT 300 -#define DLLEXPORT 301 -#define EXTERN_WEAK 302 -#define OPAQUE 303 -#define NOT 304 -#define EXTERNAL 305 -#define TARGET 306 -#define TRIPLE 307 -#define ENDIAN 308 -#define POINTERSIZE 309 -#define LITTLE 310 -#define BIG 311 -#define ALIGN 312 -#define DEPLIBS 313 -#define CALL 314 -#define TAIL 315 -#define ASM_TOK 316 -#define MODULE 317 -#define SIDEEFFECT 318 -#define CC_TOK 319 -#define CCC_TOK 320 -#define CSRETCC_TOK 321 -#define FASTCC_TOK 322 -#define COLDCC_TOK 323 -#define X86_STDCALLCC_TOK 324 -#define X86_FASTCALLCC_TOK 325 -#define DATALAYOUT 326 -#define RET 327 -#define BR 328 -#define SWITCH 329 -#define INVOKE 330 -#define UNREACHABLE 331 -#define UNWIND 332 -#define EXCEPT 333 -#define ADD 334 -#define SUB 335 -#define MUL 336 -#define DIV 337 -#define UDIV 338 -#define SDIV 339 -#define FDIV 340 -#define REM 341 -#define UREM 342 -#define SREM 343 -#define FREM 344 -#define AND 345 -#define OR 346 -#define XOR 347 -#define SHL 348 -#define SHR 349 -#define ASHR 350 -#define LSHR 351 -#define SETLE 352 -#define SETGE 353 -#define SETLT 354 -#define SETGT 355 -#define SETEQ 356 -#define SETNE 357 -#define ICMP 358 -#define FCMP 359 -#define MALLOC 360 -#define ALLOCA 361 -#define FREE 362 -#define LOAD 363 -#define STORE 364 -#define GETELEMENTPTR 365 -#define PHI_TOK 366 -#define SELECT 367 -#define VAARG 368 -#define EXTRACTELEMENT 369 -#define INSERTELEMENT 370 -#define SHUFFLEVECTOR 371 -#define VAARG_old 372 -#define VANEXT_old 373 -#define EQ 374 -#define NE 375 -#define SLT 376 -#define SGT 377 -#define SLE 378 -#define SGE 379 -#define ULT 380 -#define UGT 381 -#define ULE 382 -#define UGE 383 -#define OEQ 384 -#define ONE 385 -#define OLT 386 -#define OGT 387 -#define OLE 388 -#define OGE 389 -#define ORD 390 -#define UNO 391 -#define UEQ 392 -#define UNE 393 -#define CAST 394 -#define TRUNC 395 -#define ZEXT 396 -#define SEXT 397 -#define FPTRUNC 398 -#define FPEXT 399 -#define FPTOUI 400 -#define FPTOSI 401 -#define UITOFP 402 -#define SITOFP 403 -#define PTRTOINT 404 -#define INTTOPTR 405 -#define BITCAST 406 - - - - -/* Copy the first part of user declarations. */ -#line 14 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" +#line 14 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" #include "UpgradeInternals.h" #include "llvm/CallingConv.h" @@ -1199,7 +980,7 @@ if (isa(Ty)) error("Cannot declare global vars of function type"); - const PointerType *PTy = PointerType::get(Ty); + const PointerType *PTy = PointerType::getUnqual(Ty); std::string Name; if (NameStr) { @@ -1253,7 +1034,8 @@ } // Put the renaming in the global rename map - RenameMapKey Key = makeRenameMapKey(Name, PointerType::get(Ty), ID.S); + RenameMapKey Key = + makeRenameMapKey(Name, PointerType::getUnqual(Ty), ID.S); CurModule.RenameMap[Key] = NewName; // Rename it @@ -1774,7 +1556,7 @@ break; case 'v' : { - const Type* PtrTy = PointerType::get(Type::Int8Ty); + const Type* PtrTy = PointerType::getUnqual(Type::Int8Ty); std::vector Params; if (Name == "llvm.va_start" || Name == "llvm.va_end") { if (Args.size() != 1) @@ -1782,7 +1564,7 @@ Params.push_back(PtrTy); const FunctionType *FTy = FunctionType::get(Type::VoidTy, Params, false); - const PointerType *PFTy = PointerType::get(FTy); + const PointerType *PFTy = PointerType::getUnqual(FTy); Value* Func = getVal(PFTy, ID); Args[0] = new BitCastInst(Args[0], PtrTy, makeNameUnique("va"), CurBB); return new CallInst(Func, Args.begin(), Args.end()); @@ -1793,7 +1575,7 @@ Params.push_back(PtrTy); const FunctionType *FTy = FunctionType::get(Type::VoidTy, Params, false); - const PointerType *PFTy = PointerType::get(FTy); + const PointerType *PFTy = PointerType::getUnqual(FTy); Value* Func = getVal(PFTy, ID); std::string InstName0(makeNameUnique("va0")); std::string InstName1(makeNameUnique("va1")); @@ -1962,7 +1744,7 @@ const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID); const Type* ArgTy = F->getFunctionType()->getReturnType(); - const Type* ArgTyPtr = PointerType::get(ArgTy); + const Type* ArgTyPtr = PointerType::getUnqual(ArgTy); Function* NF = cast(Result->getOrInsertFunction( "llvm.va_start", RetTy, ArgTyPtr, (Type *)0)); @@ -1989,7 +1771,7 @@ //vaend bar const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID); const Type* ArgTy = F->getFunctionType()->getParamType(0); - const Type* ArgTyPtr = PointerType::get(ArgTy); + const Type* ArgTyPtr = PointerType::getUnqual(ArgTy); Function* NF = cast(Result->getOrInsertFunction( "llvm.va_end", RetTy, ArgTyPtr, (Type *)0)); @@ -2018,7 +1800,7 @@ const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID); const Type* ArgTy = F->getFunctionType()->getReturnType(); - const Type* ArgTyPtr = PointerType::get(ArgTy); + const Type* ArgTyPtr = PointerType::getUnqual(ArgTy); Function* NF = cast(Result->getOrInsertFunction( "llvm.va_copy", RetTy, ArgTyPtr, ArgTyPtr, (Type *)0)); @@ -2046,29 +1828,8 @@ using namespace llvm; - -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif - -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 -#endif - -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -#line 1680 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" -{ +#line 1681 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +typedef union { llvm::Module *ModuleVal; llvm::Function *FunctionVal; std::pair *ArgVal; @@ -2108,1815 +1869,1124 @@ llvm::ICmpInst::Predicate IPred; llvm::FCmpInst::Predicate FPred; llvm::Module::Endianness Endianness; -} -/* Line 187 of yacc.c. */ -#line 2114 "UpgradeParser.tab.c" - YYSTYPE; -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 -#endif +} YYSTYPE; +#include +#ifndef __cplusplus +#ifndef __STDC__ +#define const +#endif +#endif -/* Copy the second part of user declarations. */ +#define YYFINAL 606 +#define YYFLAG -32768 +#define YYNTBASE 166 + +#define YYTRANSLATE(x) ((unsigned)(x) <= 405 ? yytranslate[x] : 246) + +static const short yytranslate[] = { 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 155, + 156, 164, 2, 153, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 160, + 152, 161, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 157, 154, 159, 2, 2, 2, 2, 2, 165, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 158, + 2, 2, 162, 2, 163, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, + 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, + 147, 148, 149, 150, 151 +}; -/* Line 216 of yacc.c. */ -#line 2127 "UpgradeParser.tab.c" +#if YYDEBUG != 0 +static const short yyprhs[] = { 0, + 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, + 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, + 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, + 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, + 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, + 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, + 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, + 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, + 161, 162, 164, 166, 168, 170, 172, 174, 176, 177, + 178, 180, 182, 184, 186, 188, 190, 193, 194, 197, + 198, 202, 205, 206, 208, 209, 213, 215, 218, 220, + 222, 224, 226, 228, 230, 232, 234, 236, 238, 240, + 242, 244, 246, 248, 250, 252, 254, 256, 258, 261, + 266, 272, 278, 282, 285, 291, 296, 299, 301, 305, + 307, 311, 313, 314, 319, 323, 327, 332, 337, 341, + 348, 354, 357, 360, 363, 366, 369, 372, 375, 378, + 381, 384, 391, 397, 406, 413, 420, 427, 435, 443, + 450, 457, 466, 475, 479, 481, 483, 485, 487, 490, + 493, 498, 501, 503, 508, 511, 516, 517, 525, 526, + 534, 535, 543, 544, 552, 556, 561, 562, 564, 566, + 568, 572, 576, 580, 584, 588, 592, 594, 595, 597, + 599, 601, 602, 605, 609, 611, 613, 617, 619, 620, + 629, 631, 633, 634, 639, 641, 643, 646, 647, 649, + 651, 652, 653, 659, 660, 662, 664, 666, 668, 670, + 672, 674, 676, 678, 682, 684, 690, 692, 694, 696, + 698, 701, 704, 707, 711, 714, 715, 717, 719, 721, + 724, 727, 731, 741, 751, 760, 774, 776, 778, 785, + 791, 794, 801, 809, 811, 815, 817, 818, 821, 823, + 829, 835, 841, 848, 855, 858, 863, 868, 875, 880, + 885, 890, 895, 902, 909, 912, 920, 922, 925, 926, + 928, 929, 933, 940, 944, 951, 954, 959, 966 +}; -#ifdef short -# undef short -#endif +static const short yyrhs[] = { 5, + 0, 6, 0, 3, 0, 4, 0, 79, 0, 80, + 0, 81, 0, 82, 0, 83, 0, 84, 0, 85, + 0, 86, 0, 87, 0, 88, 0, 89, 0, 90, + 0, 91, 0, 92, 0, 97, 0, 98, 0, 99, + 0, 100, 0, 101, 0, 102, 0, 119, 0, 120, + 0, 121, 0, 122, 0, 123, 0, 124, 0, 125, + 0, 126, 0, 127, 0, 128, 0, 129, 0, 130, + 0, 131, 0, 132, 0, 133, 0, 134, 0, 135, + 0, 136, 0, 137, 0, 138, 0, 125, 0, 126, + 0, 127, 0, 128, 0, 27, 0, 28, 0, 93, + 0, 94, 0, 95, 0, 96, 0, 140, 0, 141, + 0, 142, 0, 143, 0, 144, 0, 145, 0, 146, + 0, 147, 0, 148, 0, 149, 0, 150, 0, 151, + 0, 139, 0, 16, 0, 14, 0, 12, 0, 10, + 0, 17, 0, 15, 0, 13, 0, 11, 0, 175, + 0, 176, 0, 18, 0, 19, 0, 211, 152, 0, + 0, 41, 0, 42, 0, 43, 0, 44, 0, 45, + 0, 46, 0, 47, 0, 0, 0, 65, 0, 66, + 0, 67, 0, 68, 0, 69, 0, 70, 0, 64, + 4, 0, 0, 57, 4, 0, 0, 153, 57, 4, + 0, 34, 24, 0, 0, 184, 0, 0, 153, 187, + 186, 0, 184, 0, 57, 4, 0, 190, 0, 8, + 0, 192, 0, 8, 0, 192, 0, 9, 0, 10, + 0, 11, 0, 12, 0, 13, 0, 14, 0, 15, + 0, 16, 0, 17, 0, 18, 0, 19, 0, 21, + 0, 191, 0, 48, 0, 228, 0, 154, 4, 0, + 189, 155, 194, 156, 0, 157, 4, 158, 192, 159, + 0, 160, 4, 158, 192, 161, 0, 162, 193, 163, + 0, 162, 163, 0, 160, 162, 193, 163, 161, 0, + 160, 162, 163, 161, 0, 192, 164, 0, 192, 0, + 193, 153, 192, 0, 193, 0, 193, 153, 37, 0, + 37, 0, 0, 190, 157, 197, 159, 0, 190, 157, + 159, 0, 190, 165, 24, 0, 190, 160, 197, 161, + 0, 190, 162, 197, 163, 0, 190, 162, 163, 0, + 190, 160, 162, 197, 163, 161, 0, 190, 160, 162, + 163, 161, 0, 190, 38, 0, 190, 39, 0, 190, + 228, 0, 190, 196, 0, 190, 26, 0, 175, 167, + 0, 176, 4, 0, 9, 27, 0, 9, 28, 0, + 178, 7, 0, 174, 155, 195, 36, 190, 156, 0, + 110, 155, 195, 243, 156, 0, 112, 155, 195, 153, + 195, 153, 195, 156, 0, 168, 155, 195, 153, 195, + 156, 0, 169, 155, 195, 153, 195, 156, 0, 170, + 155, 195, 153, 195, 156, 0, 103, 171, 155, 195, + 153, 195, 156, 0, 104, 172, 155, 195, 153, 195, + 156, 0, 173, 155, 195, 153, 195, 156, 0, 114, + 155, 195, 153, 195, 156, 0, 115, 155, 195, 153, + 195, 153, 195, 156, 0, 116, 155, 195, 153, 195, + 153, 195, 156, 0, 197, 153, 195, 0, 195, 0, + 32, 0, 33, 0, 200, 0, 200, 221, 0, 200, + 223, 0, 200, 62, 61, 206, 0, 200, 25, 0, + 201, 0, 201, 179, 20, 188, 0, 201, 223, 0, + 201, 62, 61, 206, 0, 0, 201, 179, 180, 198, + 195, 202, 186, 0, 0, 201, 179, 50, 198, 190, + 203, 186, 0, 0, 201, 179, 45, 198, 190, 204, + 186, 0, 0, 201, 179, 47, 198, 190, 205, 186, + 0, 201, 51, 208, 0, 201, 58, 152, 209, 0, + 0, 24, 0, 56, 0, 55, 0, 53, 152, 207, + 0, 54, 152, 4, 0, 52, 152, 24, 0, 71, + 152, 24, 0, 157, 210, 159, 0, 210, 153, 24, + 0, 24, 0, 0, 22, 0, 24, 0, 211, 0, + 0, 190, 212, 0, 214, 153, 213, 0, 213, 0, + 214, 0, 214, 153, 37, 0, 37, 0, 0, 181, + 188, 211, 155, 215, 156, 185, 182, 0, 29, 0, + 162, 0, 0, 180, 219, 216, 217, 0, 30, 0, + 163, 0, 231, 220, 0, 0, 45, 0, 47, 0, + 0, 0, 31, 224, 222, 225, 216, 0, 0, 63, + 0, 3, 0, 4, 0, 7, 0, 27, 0, 28, + 0, 38, 0, 39, 0, 26, 0, 160, 197, 161, + 0, 196, 0, 61, 226, 24, 153, 24, 0, 166, + 0, 211, 0, 228, 0, 227, 0, 190, 229, 0, + 231, 232, 0, 218, 232, 0, 233, 179, 235, 0, + 233, 237, 0, 0, 23, 0, 77, 0, 78, 0, + 72, 230, 0, 72, 8, 0, 73, 21, 229, 0, + 73, 9, 229, 153, 21, 229, 153, 21, 229, 0, + 74, 177, 229, 153, 21, 229, 157, 236, 159, 0, + 74, 177, 229, 153, 21, 229, 157, 159, 0, 75, + 181, 188, 229, 155, 240, 156, 36, 21, 229, 234, + 21, 229, 0, 234, 0, 76, 0, 236, 177, 227, + 153, 21, 229, 0, 177, 227, 153, 21, 229, 0, + 179, 242, 0, 190, 157, 229, 153, 229, 159, 0, + 238, 153, 157, 229, 153, 229, 159, 0, 230, 0, + 239, 153, 230, 0, 239, 0, 0, 60, 59, 0, + 59, 0, 168, 190, 229, 153, 229, 0, 169, 190, + 229, 153, 229, 0, 170, 190, 229, 153, 229, 0, + 103, 171, 190, 229, 153, 229, 0, 104, 172, 190, + 229, 153, 229, 0, 49, 230, 0, 173, 230, 153, + 230, 0, 174, 230, 36, 190, 0, 112, 230, 153, + 230, 153, 230, 0, 113, 230, 153, 190, 0, 117, + 230, 153, 190, 0, 118, 230, 153, 190, 0, 114, + 230, 153, 230, 0, 115, 230, 153, 230, 153, 230, + 0, 116, 230, 153, 230, 153, 230, 0, 111, 238, + 0, 241, 181, 188, 229, 155, 240, 156, 0, 245, + 0, 153, 239, 0, 0, 35, 0, 0, 105, 190, + 183, 0, 105, 190, 153, 15, 229, 183, 0, 106, + 190, 183, 0, 106, 190, 153, 15, 229, 183, 0, + 107, 230, 0, 244, 108, 190, 229, 0, 244, 109, + 230, 153, 190, 229, 0, 110, 190, 229, 243, 0 +}; -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; #endif -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; -#else -typedef short int yytype_int8; +#if YYDEBUG != 0 +static const short yyrline[] = { 0, + 1821, 1822, 1830, 1831, 1841, 1841, 1841, 1841, 1841, 1841, + 1841, 1841, 1841, 1841, 1841, 1845, 1845, 1845, 1849, 1849, + 1849, 1849, 1849, 1849, 1853, 1853, 1854, 1854, 1855, 1855, + 1856, 1856, 1857, 1857, 1861, 1861, 1862, 1862, 1863, 1863, + 1864, 1864, 1865, 1865, 1866, 1866, 1867, 1867, 1868, 1869, + 1872, 1872, 1872, 1872, 1876, 1876, 1876, 1876, 1876, 1876, + 1876, 1877, 1877, 1877, 1877, 1877, 1877, 1883, 1883, 1883, + 1883, 1887, 1887, 1887, 1887, 1891, 1891, 1895, 1895, 1900, + 1903, 1908, 1909, 1910, 1911, 1912, 1913, 1914, 1915, 1919, + 1920, 1921, 1922, 1923, 1924, 1925, 1926, 1936, 1937, 1945, + 1946, 1954, 1963, 1964, 1971, 1972, 1976, 1980, 1996, 1997, + 2004, 2005, 2012, 2020, 2020, 2020, 2020, 2020, 2020, 2020, + 2021, 2021, 2021, 2021, 2021, 2026, 2030, 2034, 2039, 2048, + 2075, 2081, 2094, 2105, 2109, 2122, 2126, 2141, 2145, 2152, + 2153, 2159, 2166, 2178, 2208, 2221, 2244, 2272, 2294, 2305, + 2327, 2338, 2347, 2352, 2411, 2418, 2426, 2433, 2440, 2444, + 2448, 2462, 2477, 2489, 2498, 2526, 2539, 2548, 2554, 2560, + 2571, 2577, 2583, 2594, 2595, 2604, 2605, 2617, 2626, 2627, + 2628, 2629, 2630, 2646, 2666, 2668, 2670, 2674, 2677, 2682, + 2685, 2690, 2693, 2699, 2702, 2704, 2706, 2711, 2725, 2726, + 2730, 2733, 2741, 2745, 2752, 2756, 2760, 2764, 2772, 2772, + 2776, 2777, 2781, 2789, 2794, 2802, 2803, 2810, 2817, 2821, + 3009, 3009, 3013, 3013, 3023, 3023, 3027, 3032, 3033, 3034, + 3038, 3039, 3039, 3051, 3052, 3057, 3058, 3059, 3060, 3064, + 3068, 3069, 3070, 3071, 3092, 3096, 3111, 3112, 3117, 3117, + 3125, 3135, 3138, 3147, 3158, 3163, 3172, 3183, 3183, 3186, + 3190, 3194, 3199, 3209, 3227, 3236, 3309, 3313, 3320, 3332, + 3347, 3377, 3387, 3397, 3401, 3408, 3409, 3413, 3416, 3422, + 3441, 3459, 3475, 3489, 3503, 3514, 3532, 3541, 3550, 3557, + 3578, 3602, 3608, 3614, 3620, 3636, 3728, 3736, 3737, 3741, + 3742, 3746, 3752, 3759, 3765, 3772, 3779, 3792, 3812 +}; #endif -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; -#else -typedef unsigned short int yytype_uint16; -#endif -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; -#else -typedef short int yytype_int16; -#endif +#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) -#ifndef YYSIZE_T -# ifdef __SIZE_TYPE__ -# define YYSIZE_T __SIZE_TYPE__ -# elif defined size_t -# define YYSIZE_T size_t -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# else -# define YYSIZE_T unsigned int -# endif -#endif - -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) - -#ifndef YY_ -# if YYENABLE_NLS -# if ENABLE_NLS -# include /* INFRINGES ON USER NAME SPACE */ -# define YY_(msgid) dgettext ("bison-runtime", msgid) -# endif -# endif -# ifndef YY_ -# define YY_(msgid) msgid -# endif -#endif - -/* Suppress unused-variable warnings by "using" E. */ -#if ! defined lint || defined __GNUC__ -# define YYUSE(e) ((void) (e)) -#else -# define YYUSE(e) /* empty */ +static const char * const yytname[] = { "$","error","$undefined.","ESINT64VAL", +"EUINT64VAL","SINTVAL","UINTVAL","FPVAL","VOID","BOOL","SBYTE","UBYTE","SHORT", +"USHORT","INT","UINT","LONG","ULONG","FLOAT","DOUBLE","TYPE","LABEL","VAR_ID", +"LABELSTR","STRINGCONSTANT","IMPLEMENTATION","ZEROINITIALIZER","TRUETOK","FALSETOK", +"BEGINTOK","ENDTOK","DECLARE","GLOBAL","CONSTANT","SECTION","VOLATILE","TO", +"DOTDOTDOT","NULL_TOK","UNDEF","CONST","INTERNAL","LINKONCE","WEAK","APPENDING", +"DLLIMPORT","DLLEXPORT","EXTERN_WEAK","OPAQUE","NOT","EXTERNAL","TARGET","TRIPLE", +"ENDIAN","POINTERSIZE","LITTLE","BIG","ALIGN","DEPLIBS","CALL","TAIL","ASM_TOK", +"MODULE","SIDEEFFECT","CC_TOK","CCC_TOK","CSRETCC_TOK","FASTCC_TOK","COLDCC_TOK", +"X86_STDCALLCC_TOK","X86_FASTCALLCC_TOK","DATALAYOUT","RET","BR","SWITCH","INVOKE", +"UNREACHABLE","UNWIND","EXCEPT","ADD","SUB","MUL","DIV","UDIV","SDIV","FDIV", +"REM","UREM","SREM","FREM","AND","OR","XOR","SHL","SHR","ASHR","LSHR","SETLE", +"SETGE","SETLT","SETGT","SETEQ","SETNE","ICMP","FCMP","MALLOC","ALLOCA","FREE", +"LOAD","STORE","GETELEMENTPTR","PHI_TOK","SELECT","VAARG","EXTRACTELEMENT","INSERTELEMENT", +"SHUFFLEVECTOR","VAARG_old","VANEXT_old","EQ","NE","SLT","SGT","SLE","SGE","ULT", +"UGT","ULE","UGE","OEQ","ONE","OLT","OGT","OLE","OGE","ORD","UNO","UEQ","UNE", +"CAST","TRUNC","ZEXT","SEXT","FPTRUNC","FPEXT","FPTOUI","FPTOSI","UITOFP","SITOFP", +"PTRTOINT","INTTOPTR","BITCAST","'='","','","'\\\\'","'('","')'","'['","'x'", +"']'","'<'","'>'","'{'","'}'","'*'","'c'","INTVAL","EINT64VAL","ArithmeticOps", +"LogicalOps","SetCondOps","IPredicates","FPredicates","ShiftOps","CastOps","SIntType", +"UIntType","IntType","FPType","OptAssign","OptLinkage","OptCallingConv","OptAlign", +"OptCAlign","SectionString","OptSection","GlobalVarAttributes","GlobalVarAttribute", +"TypesV","UpRTypesV","Types","PrimType","UpRTypes","TypeListI","ArgTypeListI", +"ConstVal","ConstExpr","ConstVector","GlobalType","Module","FunctionList","ConstPool", +"@1","@2","@3","@4","AsmBlock","BigOrLittle","TargetDefinition","LibrariesDefinition", +"LibList","Name","OptName","ArgVal","ArgListH","ArgList","FunctionHeaderH","BEGIN", +"FunctionHeader","@5","END","Function","FnDeclareLinkage","FunctionProto","@6", +"@7","OptSideEffect","ConstValueRef","SymbolicValueRef","ValueRef","ResolvedVal", +"BasicBlockList","BasicBlock","InstructionList","Unwind","BBTerminatorInst", +"JumpTable","Inst","PHIList","ValueRefList","ValueRefListE","OptTailCall","InstVal", +"IndexList","OptVolatile","MemoryInst", NULL +}; #endif -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(n) (n) -#else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID (int i) -#else -static int -YYID (i) - int i; -#endif -{ - return i; -} -#endif - -#if ! defined yyoverflow || YYERROR_VERBOSE - -/* The parser invokes alloca or malloc; define the necessary symbols. */ - -# ifdef YYSTACK_USE_ALLOCA -# if YYSTACK_USE_ALLOCA -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# elif defined __BUILTIN_VA_ARG_INCR -# include /* INFRINGES ON USER NAME SPACE */ -# elif defined _AIX -# define YYSTACK_ALLOC __alloca -# elif defined _MSC_VER -# include /* INFRINGES ON USER NAME SPACE */ -# define alloca _alloca -# else -# define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -# include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 -# endif -# endif -# endif -# endif -# endif - -# ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) -# ifndef YYSTACK_ALLOC_MAXIMUM - /* The OS might guarantee only one guard page at the bottom of the stack, - and a page size can be as small as 4096 bytes. So we cannot safely - invoke alloca (N) if N exceeds 4096. Use a slightly smaller number - to allow for a few compiler-allocated temporary stack slots. */ -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ -# endif -# else -# define YYSTACK_ALLOC YYMALLOC -# define YYSTACK_FREE YYFREE -# ifndef YYSTACK_ALLOC_MAXIMUM -# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM -# endif -# if (defined __cplusplus && ! defined _STDLIB_H \ - && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) -# include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 -# endif -# endif -# ifndef YYMALLOC -# define YYMALLOC malloc -# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# ifndef YYFREE -# define YYFREE free -# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -void free (void *); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ - - -#if (! defined yyoverflow \ - && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) - -/* A type that is properly aligned for any stack member. */ -union yyalloc -{ - yytype_int16 yyss; - YYSTYPE yyvs; - }; - -/* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) - -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ - + YYSTACK_GAP_MAXIMUM) - -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (YYID (0)) -# endif -# endif - -/* Relocate STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ -# define YYSTACK_RELOCATE(Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (YYID (0)) - -#endif - -/* YYFINAL -- State number of the termination state. */ -#define YYFINAL 4 -/* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 1630 - -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 166 -/* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 81 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 310 -/* YYNRULES -- Number of states. */ -#define YYNSTATES 606 - -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ -#define YYUNDEFTOK 2 -#define YYMAXUTOK 406 - -#define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) - -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ -static const yytype_uint8 yytranslate[] = -{ - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 155, 156, 164, 2, 153, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 160, 152, 161, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 157, 154, 159, 2, 2, 2, 2, 2, 165, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 158, 2, 2, 162, 2, 163, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151 +static const short yyr1[] = { 0, + 166, 166, 167, 167, 168, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 169, 169, 169, 170, 170, + 170, 170, 170, 170, 171, 171, 171, 171, 171, 171, + 171, 171, 171, 171, 172, 172, 172, 172, 172, 172, + 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, + 173, 173, 173, 173, 174, 174, 174, 174, 174, 174, + 174, 174, 174, 174, 174, 174, 174, 175, 175, 175, + 175, 176, 176, 176, 176, 177, 177, 178, 178, 179, + 179, 180, 180, 180, 180, 180, 180, 180, 180, 181, + 181, 181, 181, 181, 181, 181, 181, 182, 182, 183, + 183, 184, 185, 185, 186, 186, 187, 187, 188, 188, + 189, 189, 190, 191, 191, 191, 191, 191, 191, 191, + 191, 191, 191, 191, 191, 192, 192, 192, 192, 192, + 192, 192, 192, 192, 192, 192, 192, 193, 193, 194, + 194, 194, 194, 195, 195, 195, 195, 195, 195, 195, + 195, 195, 195, 195, 195, 195, 195, 195, 195, 195, + 195, 196, 196, 196, 196, 196, 196, 196, 196, 196, + 196, 196, 196, 197, 197, 198, 198, 199, 200, 200, + 200, 200, 200, 201, 201, 201, 202, 201, 203, 201, + 204, 201, 205, 201, 201, 201, 201, 206, 207, 207, + 208, 208, 208, 208, 209, 210, 210, 210, 211, 211, + 212, 212, 213, 214, 214, 215, 215, 215, 215, 216, + 217, 217, 219, 218, 220, 220, 221, 222, 222, 222, + 224, 225, 223, 226, 226, 227, 227, 227, 227, 227, + 227, 227, 227, 227, 227, 227, 228, 228, 229, 229, + 230, 231, 231, 232, 233, 233, 233, 234, 234, 235, + 235, 235, 235, 235, 235, 235, 235, 235, 236, 236, + 237, 238, 238, 239, 239, 240, 240, 241, 241, 242, + 242, 242, 242, 242, 242, 242, 242, 242, 242, 242, + 242, 242, 242, 242, 242, 242, 242, 243, 243, 244, + 244, 245, 245, 245, 245, 245, 245, 245, 245 }; -#if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const yytype_uint16 yyprhs[] = -{ - 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, - 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, - 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, - 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, - 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, - 99, 101, 103, 105, 107, 109, 111, 113, 115, 117, - 119, 121, 123, 125, 127, 129, 131, 133, 135, 137, - 139, 141, 143, 145, 147, 149, 151, 153, 155, 157, - 159, 161, 164, 165, 167, 169, 171, 173, 175, 177, - 179, 180, 181, 183, 185, 187, 189, 191, 193, 196, - 197, 200, 201, 205, 208, 209, 211, 212, 216, 218, - 221, 223, 225, 227, 229, 231, 233, 235, 237, 239, - 241, 243, 245, 247, 249, 251, 253, 255, 257, 259, - 261, 264, 269, 275, 281, 285, 288, 294, 299, 302, - 304, 308, 310, 314, 316, 317, 322, 326, 330, 335, - 340, 344, 351, 357, 360, 363, 366, 369, 372, 375, - 378, 381, 384, 387, 394, 400, 409, 416, 423, 430, - 438, 446, 453, 460, 469, 478, 482, 484, 486, 488, - 490, 493, 496, 501, 504, 506, 511, 514, 519, 520, - 528, 529, 537, 538, 546, 547, 555, 559, 564, 565, - 567, 569, 571, 575, 579, 583, 587, 591, 595, 597, - 598, 600, 602, 604, 605, 608, 612, 614, 616, 620, - 622, 623, 632, 634, 636, 637, 642, 644, 646, 649, - 650, 652, 654, 655, 656, 662, 663, 665, 667, 669, - 671, 673, 675, 677, 679, 681, 685, 687, 693, 695, - 697, 699, 701, 704, 707, 710, 714, 717, 718, 720, - 722, 724, 727, 730, 734, 744, 754, 763, 777, 779, - 781, 788, 794, 797, 804, 812, 814, 818, 820, 821, - 824, 826, 832, 838, 844, 851, 858, 861, 866, 871, - 878, 883, 888, 893, 898, 905, 912, 915, 923, 925, - 928, 929, 931, 932, 936, 943, 947, 954, 957, 962, - 969 +static const short yyr2[] = { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, + 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, + 1, 1, 1, 1, 1, 1, 2, 0, 2, 0, + 3, 2, 0, 1, 0, 3, 1, 2, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, + 5, 5, 3, 2, 5, 4, 2, 1, 3, 1, + 3, 1, 0, 4, 3, 3, 4, 4, 3, 6, + 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 6, 5, 8, 6, 6, 6, 7, 7, 6, + 6, 8, 8, 3, 1, 1, 1, 1, 2, 2, + 4, 2, 1, 4, 2, 4, 0, 7, 0, 7, + 0, 7, 0, 7, 3, 4, 0, 1, 1, 1, + 3, 3, 3, 3, 3, 3, 1, 0, 1, 1, + 1, 0, 2, 3, 1, 1, 3, 1, 0, 8, + 1, 1, 0, 4, 1, 1, 2, 0, 1, 1, + 0, 0, 5, 0, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 3, 1, 5, 1, 1, 1, 1, + 2, 2, 2, 3, 2, 0, 1, 1, 1, 2, + 2, 3, 9, 9, 8, 13, 1, 1, 6, 5, + 2, 6, 7, 1, 3, 1, 0, 2, 1, 5, + 5, 5, 6, 6, 2, 4, 4, 6, 4, 4, + 4, 4, 6, 6, 2, 7, 1, 2, 0, 1, + 0, 3, 6, 3, 6, 2, 4, 6, 4 }; -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int16 yyrhs[] = -{ - 200, 0, -1, 5, -1, 6, -1, 3, -1, 4, - -1, 79, -1, 80, -1, 81, -1, 82, -1, 83, - -1, 84, -1, 85, -1, 86, -1, 87, -1, 88, - -1, 89, -1, 90, -1, 91, -1, 92, -1, 97, - -1, 98, -1, 99, -1, 100, -1, 101, -1, 102, - -1, 119, -1, 120, -1, 121, -1, 122, -1, 123, - -1, 124, -1, 125, -1, 126, -1, 127, -1, 128, - -1, 129, -1, 130, -1, 131, -1, 132, -1, 133, - -1, 134, -1, 135, -1, 136, -1, 137, -1, 138, - -1, 125, -1, 126, -1, 127, -1, 128, -1, 27, - -1, 28, -1, 93, -1, 94, -1, 95, -1, 96, - -1, 140, -1, 141, -1, 142, -1, 143, -1, 144, - -1, 145, -1, 146, -1, 147, -1, 148, -1, 149, - -1, 150, -1, 151, -1, 139, -1, 16, -1, 14, - -1, 12, -1, 10, -1, 17, -1, 15, -1, 13, - -1, 11, -1, 176, -1, 177, -1, 18, -1, 19, - -1, 212, 152, -1, -1, 41, -1, 42, -1, 43, - -1, 44, -1, 45, -1, 46, -1, 47, -1, -1, - -1, 65, -1, 66, -1, 67, -1, 68, -1, 69, - -1, 70, -1, 64, 4, -1, -1, 57, 4, -1, - -1, 153, 57, 4, -1, 34, 24, -1, -1, 185, - -1, -1, 153, 188, 187, -1, 185, -1, 57, 4, - -1, 191, -1, 8, -1, 193, -1, 8, -1, 193, - -1, 9, -1, 10, -1, 11, -1, 12, -1, 13, - -1, 14, -1, 15, -1, 16, -1, 17, -1, 18, - -1, 19, -1, 21, -1, 192, -1, 48, -1, 229, - -1, 154, 4, -1, 190, 155, 195, 156, -1, 157, - 4, 158, 193, 159, -1, 160, 4, 158, 193, 161, - -1, 162, 194, 163, -1, 162, 163, -1, 160, 162, - 194, 163, 161, -1, 160, 162, 163, 161, -1, 193, - 164, -1, 193, -1, 194, 153, 193, -1, 194, -1, - 194, 153, 37, -1, 37, -1, -1, 191, 157, 198, - 159, -1, 191, 157, 159, -1, 191, 165, 24, -1, - 191, 160, 198, 161, -1, 191, 162, 198, 163, -1, - 191, 162, 163, -1, 191, 160, 162, 198, 163, 161, - -1, 191, 160, 162, 163, 161, -1, 191, 38, -1, - 191, 39, -1, 191, 229, -1, 191, 197, -1, 191, - 26, -1, 176, 168, -1, 177, 4, -1, 9, 27, - -1, 9, 28, -1, 179, 7, -1, 175, 155, 196, - 36, 191, 156, -1, 110, 155, 196, 244, 156, -1, - 112, 155, 196, 153, 196, 153, 196, 156, -1, 169, - 155, 196, 153, 196, 156, -1, 170, 155, 196, 153, - 196, 156, -1, 171, 155, 196, 153, 196, 156, -1, - 103, 172, 155, 196, 153, 196, 156, -1, 104, 173, - 155, 196, 153, 196, 156, -1, 174, 155, 196, 153, - 196, 156, -1, 114, 155, 196, 153, 196, 156, -1, - 115, 155, 196, 153, 196, 153, 196, 156, -1, 116, - 155, 196, 153, 196, 153, 196, 156, -1, 198, 153, - 196, -1, 196, -1, 32, -1, 33, -1, 201, -1, - 201, 222, -1, 201, 224, -1, 201, 62, 61, 207, - -1, 201, 25, -1, 202, -1, 202, 180, 20, 189, - -1, 202, 224, -1, 202, 62, 61, 207, -1, -1, - 202, 180, 181, 199, 196, 203, 187, -1, -1, 202, - 180, 50, 199, 191, 204, 187, -1, -1, 202, 180, - 45, 199, 191, 205, 187, -1, -1, 202, 180, 47, - 199, 191, 206, 187, -1, 202, 51, 209, -1, 202, - 58, 152, 210, -1, -1, 24, -1, 56, -1, 55, - -1, 53, 152, 208, -1, 54, 152, 4, -1, 52, - 152, 24, -1, 71, 152, 24, -1, 157, 211, 159, - -1, 211, 153, 24, -1, 24, -1, -1, 22, -1, - 24, -1, 212, -1, -1, 191, 213, -1, 215, 153, - 214, -1, 214, -1, 215, -1, 215, 153, 37, -1, - 37, -1, -1, 182, 189, 212, 155, 216, 156, 186, - 183, -1, 29, -1, 162, -1, -1, 181, 220, 217, - 218, -1, 30, -1, 163, -1, 232, 221, -1, -1, - 45, -1, 47, -1, -1, -1, 31, 225, 223, 226, - 217, -1, -1, 63, -1, 3, -1, 4, -1, 7, - -1, 27, -1, 28, -1, 38, -1, 39, -1, 26, - -1, 160, 198, 161, -1, 197, -1, 61, 227, 24, - 153, 24, -1, 167, -1, 212, -1, 229, -1, 228, - -1, 191, 230, -1, 232, 233, -1, 219, 233, -1, - 234, 180, 236, -1, 234, 238, -1, -1, 23, -1, - 77, -1, 78, -1, 72, 231, -1, 72, 8, -1, - 73, 21, 230, -1, 73, 9, 230, 153, 21, 230, - 153, 21, 230, -1, 74, 178, 230, 153, 21, 230, - 157, 237, 159, -1, 74, 178, 230, 153, 21, 230, - 157, 159, -1, 75, 182, 189, 230, 155, 241, 156, - 36, 21, 230, 235, 21, 230, -1, 235, -1, 76, - -1, 237, 178, 228, 153, 21, 230, -1, 178, 228, - 153, 21, 230, -1, 180, 243, -1, 191, 157, 230, - 153, 230, 159, -1, 239, 153, 157, 230, 153, 230, - 159, -1, 231, -1, 240, 153, 231, -1, 240, -1, - -1, 60, 59, -1, 59, -1, 169, 191, 230, 153, - 230, -1, 170, 191, 230, 153, 230, -1, 171, 191, - 230, 153, 230, -1, 103, 172, 191, 230, 153, 230, - -1, 104, 173, 191, 230, 153, 230, -1, 49, 231, - -1, 174, 231, 153, 231, -1, 175, 231, 36, 191, - -1, 112, 231, 153, 231, 153, 231, -1, 113, 231, - 153, 191, -1, 117, 231, 153, 191, -1, 118, 231, - 153, 191, -1, 114, 231, 153, 231, -1, 115, 231, - 153, 231, 153, 231, -1, 116, 231, 153, 231, 153, - 231, -1, 111, 239, -1, 242, 182, 189, 230, 155, - 241, 156, -1, 246, -1, 153, 240, -1, -1, 35, - -1, -1, 105, 191, 184, -1, 105, 191, 153, 15, - 230, 184, -1, 106, 191, 184, -1, 106, 191, 153, - 15, 230, 184, -1, 107, 231, -1, 245, 108, 191, - 230, -1, 245, 109, 231, 153, 191, 230, -1, 110, - 191, 230, 244, -1 +static const short yydefact[] = { 197, + 89, 183, 182, 231, 82, 83, 84, 85, 86, 87, + 88, 0, 223, 256, 179, 180, 256, 209, 210, 0, + 0, 0, 89, 0, 185, 228, 0, 90, 257, 253, + 81, 225, 226, 227, 252, 0, 0, 0, 0, 195, + 0, 0, 0, 0, 0, 0, 0, 80, 229, 230, + 232, 198, 181, 0, 91, 92, 93, 94, 95, 96, + 0, 0, 301, 255, 0, 0, 0, 0, 208, 196, + 186, 1, 2, 110, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 127, 0, 0, 0, + 0, 247, 184, 0, 109, 126, 113, 248, 128, 176, + 177, 0, 0, 0, 0, 90, 97, 0, 221, 222, + 224, 300, 0, 279, 0, 0, 0, 0, 90, 268, + 258, 259, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 51, 52, 53, 54, + 19, 20, 21, 22, 23, 24, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 67, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 0, 0, 0, 0, 0, 267, 254, + 90, 271, 0, 297, 203, 200, 199, 201, 202, 204, + 207, 0, 129, 0, 0, 0, 112, 134, 138, 0, + 143, 137, 191, 193, 189, 114, 115, 116, 117, 118, + 119, 120, 121, 122, 123, 124, 0, 0, 0, 0, + 187, 233, 0, 0, 285, 278, 261, 260, 0, 0, + 71, 75, 70, 74, 69, 73, 68, 72, 76, 77, + 0, 0, 25, 26, 27, 28, 29, 30, 31, 32, + 33, 34, 0, 49, 50, 45, 46, 47, 48, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 0, + 100, 100, 306, 0, 0, 295, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 205, 0, 0, 0, 0, 0, 133, 142, + 140, 0, 105, 105, 105, 159, 160, 3, 4, 157, + 158, 161, 156, 152, 153, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 155, 154, 105, 219, 236, 237, 238, 243, 239, + 240, 241, 242, 234, 0, 245, 250, 249, 251, 0, + 262, 0, 0, 0, 0, 0, 302, 0, 304, 299, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 206, 111, 111, + 136, 0, 139, 0, 130, 0, 192, 194, 190, 0, + 0, 0, 0, 0, 0, 0, 145, 175, 0, 0, + 0, 149, 0, 146, 0, 0, 0, 0, 0, 188, + 218, 212, 215, 216, 0, 235, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 309, 0, 0, + 0, 289, 292, 0, 0, 290, 291, 0, 0, 0, + 286, 287, 0, 307, 0, 131, 132, 135, 141, 0, + 0, 107, 105, 0, 0, 299, 0, 0, 0, 0, + 0, 144, 134, 113, 0, 147, 148, 0, 0, 0, + 0, 0, 211, 213, 0, 103, 0, 244, 0, 0, + 277, 0, 0, 100, 101, 100, 274, 298, 0, 0, + 0, 0, 0, 280, 281, 282, 277, 0, 102, 108, + 106, 0, 0, 0, 0, 0, 0, 0, 174, 151, + 0, 0, 0, 0, 0, 0, 217, 214, 104, 98, + 0, 0, 0, 276, 0, 283, 284, 0, 303, 305, + 0, 0, 0, 288, 293, 294, 0, 308, 0, 0, + 163, 0, 0, 0, 0, 150, 0, 0, 0, 0, + 0, 0, 220, 246, 0, 0, 0, 275, 272, 0, + 296, 0, 0, 0, 171, 0, 0, 165, 166, 167, + 170, 162, 99, 0, 265, 0, 0, 0, 273, 168, + 169, 0, 0, 0, 263, 0, 264, 0, 0, 164, + 172, 173, 0, 0, 0, 0, 0, 0, 270, 0, + 0, 269, 266, 0, 0, 0 }; -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = -{ - 0, 1820, 1820, 1821, 1829, 1830, 1840, 1840, 1840, 1840, - 1840, 1840, 1840, 1840, 1840, 1840, 1840, 1844, 1844, 1844, - 1848, 1848, 1848, 1848, 1848, 1848, 1852, 1852, 1853, 1853, - 1854, 1854, 1855, 1855, 1856, 1856, 1860, 1860, 1861, 1861, - 1862, 1862, 1863, 1863, 1864, 1864, 1865, 1865, 1866, 1866, - 1867, 1868, 1871, 1871, 1871, 1871, 1875, 1875, 1875, 1875, - 1875, 1875, 1875, 1876, 1876, 1876, 1876, 1876, 1876, 1882, - 1882, 1882, 1882, 1886, 1886, 1886, 1886, 1890, 1890, 1894, - 1894, 1899, 1902, 1907, 1908, 1909, 1910, 1911, 1912, 1913, - 1914, 1918, 1919, 1920, 1921, 1922, 1923, 1924, 1925, 1935, - 1936, 1944, 1945, 1953, 1962, 1963, 1970, 1971, 1975, 1979, - 1995, 1996, 2003, 2004, 2011, 2019, 2019, 2019, 2019, 2019, - 2019, 2019, 2020, 2020, 2020, 2020, 2020, 2025, 2029, 2033, - 2038, 2047, 2074, 2080, 2093, 2104, 2108, 2121, 2125, 2139, - 2143, 2150, 2151, 2157, 2164, 2176, 2206, 2219, 2242, 2270, - 2292, 2303, 2325, 2336, 2345, 2350, 2409, 2416, 2424, 2431, - 2438, 2442, 2446, 2460, 2475, 2487, 2496, 2524, 2537, 2546, - 2552, 2558, 2569, 2575, 2581, 2592, 2593, 2602, 2603, 2615, - 2624, 2625, 2626, 2627, 2628, 2644, 2664, 2666, 2668, 2668, - 2675, 2675, 2683, 2683, 2691, 2691, 2700, 2702, 2704, 2709, - 2723, 2724, 2728, 2731, 2739, 2743, 2750, 2754, 2758, 2762, - 2770, 2770, 2774, 2775, 2779, 2787, 2792, 2800, 2801, 2808, - 2815, 2819, 3007, 3007, 3011, 3011, 3021, 3021, 3025, 3030, - 3031, 3032, 3036, 3037, 3036, 3049, 3050, 3055, 3056, 3057, - 3058, 3062, 3066, 3067, 3068, 3069, 3090, 3094, 3108, 3109, - 3114, 3114, 3122, 3132, 3135, 3144, 3155, 3160, 3169, 3180, - 3180, 3183, 3187, 3191, 3196, 3206, 3224, 3233, 3306, 3310, - 3317, 3329, 3344, 3374, 3384, 3394, 3398, 3405, 3406, 3410, - 3413, 3419, 3438, 3456, 3472, 3486, 3500, 3511, 3529, 3538, - 3547, 3554, 3575, 3599, 3605, 3611, 3617, 3633, 3725, 3733, - 3734, 3738, 3739, 3743, 3749, 3756, 3762, 3769, 3776, 3789, - 3809 +static const short yydefgoto[] = { 92, + 310, 327, 328, 329, 253, 270, 330, 331, 217, 218, + 241, 219, 23, 13, 61, 553, 357, 452, 520, 387, + 453, 93, 94, 220, 96, 97, 200, 302, 398, 346, + 399, 102, 604, 1, 2, 334, 305, 303, 304, 53, + 188, 40, 70, 192, 98, 474, 413, 414, 415, 62, + 111, 14, 28, 34, 15, 51, 16, 26, 106, 417, + 347, 99, 349, 487, 17, 30, 31, 179, 180, 577, + 64, 276, 524, 525, 181, 182, 428, 183, 184 }; -#endif -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE -/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ -static const char *const yytname[] = -{ - "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "SINTVAL", - "UINTVAL", "FPVAL", "VOID", "BOOL", "SBYTE", "UBYTE", "SHORT", "USHORT", - "INT", "UINT", "LONG", "ULONG", "FLOAT", "DOUBLE", "TYPE", "LABEL", - "VAR_ID", "LABELSTR", "STRINGCONSTANT", "IMPLEMENTATION", - "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK", - "DECLARE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO", - "DOTDOTDOT", "NULL_TOK", "UNDEF", "CONST", "INTERNAL", "LINKONCE", - "WEAK", "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE", - "NOT", "EXTERNAL", "TARGET", "TRIPLE", "ENDIAN", "POINTERSIZE", "LITTLE", - "BIG", "ALIGN", "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE", - "SIDEEFFECT", "CC_TOK", "CCC_TOK", "CSRETCC_TOK", "FASTCC_TOK", - "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT", - "RET", "BR", "SWITCH", "INVOKE", "UNREACHABLE", "UNWIND", "EXCEPT", - "ADD", "SUB", "MUL", "DIV", "UDIV", "SDIV", "FDIV", "REM", "UREM", - "SREM", "FREM", "AND", "OR", "XOR", "SHL", "SHR", "ASHR", "LSHR", - "SETLE", "SETGE", "SETLT", "SETGT", "SETEQ", "SETNE", "ICMP", "FCMP", - "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR", "PHI_TOK", - "SELECT", "VAARG", "EXTRACTELEMENT", "INSERTELEMENT", "SHUFFLEVECTOR", - "VAARG_old", "VANEXT_old", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", - "UGT", "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", - "UNO", "UEQ", "UNE", "CAST", "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", - "FPTOUI", "FPTOSI", "UITOFP", "SITOFP", "PTRTOINT", "INTTOPTR", - "BITCAST", "'='", "','", "'\\\\'", "'('", "')'", "'['", "'x'", "']'", - "'<'", "'>'", "'{'", "'}'", "'*'", "'c'", "$accept", "INTVAL", - "EINT64VAL", "ArithmeticOps", "LogicalOps", "SetCondOps", "IPredicates", - "FPredicates", "ShiftOps", "CastOps", "SIntType", "UIntType", "IntType", - "FPType", "OptAssign", "OptLinkage", "OptCallingConv", "OptAlign", - "OptCAlign", "SectionString", "OptSection", "GlobalVarAttributes", - "GlobalVarAttribute", "TypesV", "UpRTypesV", "Types", "PrimType", - "UpRTypes", "TypeListI", "ArgTypeListI", "ConstVal", "ConstExpr", - "ConstVector", "GlobalType", "Module", "FunctionList", "ConstPool", "@1", - "@2", "@3", "@4", "AsmBlock", "BigOrLittle", "TargetDefinition", - "LibrariesDefinition", "LibList", "Name", "OptName", "ArgVal", - "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN", "FunctionHeader", - "@5", "END", "Function", "FnDeclareLinkage", "FunctionProto", "@6", "@7", - "OptSideEffect", "ConstValueRef", "SymbolicValueRef", "ValueRef", - "ResolvedVal", "BasicBlockList", "BasicBlock", "InstructionList", - "Unwind", "BBTerminatorInst", "JumpTable", "Inst", "PHIList", - "ValueRefList", "ValueRefListE", "OptTailCall", "InstVal", "IndexList", - "OptVolatile", "MemoryInst", 0 +static const short yypact[] = {-32768, + 239, 567,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, +-32768, -46,-32768, 55,-32768,-32768, -14,-32768,-32768, 48, + -6, 104, 161, 19,-32768, -34, 155, 249,-32768,-32768, + 98,-32768,-32768,-32768,-32768, 33, 43, 49, 57,-32768, + 59, 155, 1265, 150, 150, 150, 150,-32768,-32768,-32768, +-32768,-32768,-32768, 214,-32768,-32768,-32768,-32768,-32768,-32768, + 1265, -19, 1479,-32768, 196, 157, 224, 206, 212,-32768, +-32768,-32768,-32768, 87,-32768,-32768,-32768,-32768,-32768,-32768, +-32768,-32768,-32768,-32768,-32768,-32768,-32768, 241, 247, 4, + 15,-32768,-32768, 108,-32768,-32768, 12,-32768,-32768,-32768, +-32768, 1306, 1306, 1306, 1326, 249,-32768, 98,-32768,-32768, +-32768,-32768, 1306,-32768, 194, 1367, 116, 177, 249,-32768, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, +-32768,-32768,-32768,-32768,-32768,-32768, 355, 429, 1306, 1306, + 1306, 1306, 1306, 1306, 1306, 1306, 1306, 1306, 1306, 1306, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, +-32768,-32768,-32768, 1306, 1306, 1306, 1306, 1306,-32768,-32768, + 249,-32768, 106,-32768,-32768,-32768,-32768,-32768,-32768,-32768, +-32768, -32,-32768, 103, 110, 75,-32768,-32768, 12, -81, + 1046,-32768,-32768,-32768,-32768, 197, 230, 265, 237, 267, + 240, 268, 246, 270, 269, 271, 254, 273, 272, 566, +-32768,-32768, 120, 766,-32768,-32768, 87,-32768, 766, 766, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + 766, 1265,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, +-32768,-32768, 1306,-32768,-32768,-32768,-32768,-32768,-32768,-32768, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 1306, + 136, 137,-32768, 766, 134, 146, 147, 149, 152, 158, + 174, 176, 179, 766, 766, 766, 180, 262, 1265, 1306, + 1306, 279,-32768, 1306, 1306, 173, -27, 1306,-32768,-32768, + 184, 183, 187, 187, 187,-32768,-32768,-32768,-32768,-32768, +-32768,-32768,-32768,-32768,-32768, 355, 429, 186, 188, 189, + 190, 191, 1087, 1387, 529, 311, 192, 193, 198, 199, + 202,-32768,-32768, 187, 1107,-32768,-32768,-32768,-32768,-32768, +-32768,-32768,-32768, 286, 1326,-32768,-32768,-32768,-32768, 205, +-32768, 207, 766, 766, 766, 7,-32768, 20,-32768, 208, + 766, 209, 1306, 1306, 1306, 1306, 1306, 1306, 1306, 210, + 216, 217, 1306, 1306, 766, 766, 218,-32768, -12, 9, +-32768, 204, 12, 1148,-32768, 8,-32768,-32768,-32768, 220, + 221, 1326, 1326, 1326, 1326, 1326,-32768,-32768, -8, 741, + -82,-32768, -9,-32768, 1326, 1326, 1326, 1326, 1326,-32768, +-32768, 98,-32768, 219, 203,-32768, 343, -13, 356, 357, + 228, 226, 233, 766, 383, 766, 1306,-32768, 235, 766, + 236,-32768,-32768, 243, 244,-32768,-32768, 766, 766, 766, +-32768,-32768, 238,-32768, 1306,-32768,-32768,-32768,-32768, 366, + 394,-32768, 187, 1326, 1326, 208, 250, 251, 252, 258, + 1326,-32768, 256, -25, 11,-32768,-32768, 259, 266, 274, + 278, 363,-32768,-32768, 1205, 387, 280,-32768, 766, 766, + 1306, 766, 766, 281,-32768, 281,-32768, 282, 766, 283, + 1306, 1306, 1306,-32768,-32768,-32768, 1306, 766,-32768,-32768, +-32768, 284, 290, 288, 1326, 1326, 1326, 1326,-32768,-32768, + 263, 1326, 1326, 1326, 1326, 1306,-32768,-32768,-32768, 368, + 376, 293, 294, 282, 291,-32768,-32768, 369,-32768,-32768, + 1306, 264, 766,-32768,-32768,-32768, 296,-32768, 1326, 1326, +-32768, 300, 299, 305, 306,-32768, 308, 310, 313, 314, + 315, 457,-32768,-32768, 441, 41, 436,-32768,-32768, 325, +-32768, 329, 331, 1326,-32768, 1326, 1326,-32768,-32768,-32768, +-32768,-32768,-32768, 766,-32768, 893, 145, 468,-32768,-32768, +-32768, 334, 335, 336,-32768, 340,-32768, 893, 766,-32768, +-32768,-32768, 473, 342, 182, 766, 475, 479,-32768, 766, + 766,-32768,-32768, 502, 503,-32768 }; -#endif -# ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ -static const yytype_uint16 yytoknum[] = -{ - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, - 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, - 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, - 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, - 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, - 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, - 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, - 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, - 405, 406, 61, 44, 92, 40, 41, 91, 120, 93, - 60, 62, 123, 125, 42, 99 +static const short yypgoto[] = {-32768, +-32768, 443, 444, 446, 195, 200, 447, 451, -117, -114, + -539,-32768, 484, 481, -105,-32768, -265, 40,-32768, -236, +-32768, -58,-32768, -43,-32768, -72, -33,-32768, -99, 298, + -250, 58,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 480, +-32768,-32768,-32768,-32768, 10,-32768, 46,-32768,-32768, 417, +-32768,-32768,-32768,-32768,-32768,-32768, 522,-32768,-32768,-32768, + -526, 144, -88, -111,-32768, 508,-32768, -69,-32768,-32768, +-32768,-32768, 100, 31,-32768,-32768, 73,-32768,-32768 }; -# endif -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 166, 167, 167, 168, 168, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 170, 170, 170, - 171, 171, 171, 171, 171, 171, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 173, 173, 173, 173, - 173, 173, 173, 173, 173, 173, 173, 173, 173, 173, - 173, 173, 174, 174, 174, 174, 175, 175, 175, 175, - 175, 175, 175, 175, 175, 175, 175, 175, 175, 176, - 176, 176, 176, 177, 177, 177, 177, 178, 178, 179, - 179, 180, 180, 181, 181, 181, 181, 181, 181, 181, - 181, 182, 182, 182, 182, 182, 182, 182, 182, 183, - 183, 184, 184, 185, 186, 186, 187, 187, 188, 188, - 189, 189, 190, 190, 191, 192, 192, 192, 192, 192, - 192, 192, 192, 192, 192, 192, 192, 193, 193, 193, - 193, 193, 193, 193, 193, 193, 193, 193, 193, 194, - 194, 195, 195, 195, 195, 196, 196, 196, 196, 196, - 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, - 196, 196, 196, 197, 197, 197, 197, 197, 197, 197, - 197, 197, 197, 197, 197, 198, 198, 199, 199, 200, - 201, 201, 201, 201, 201, 202, 202, 202, 203, 202, - 204, 202, 205, 202, 206, 202, 202, 202, 202, 207, - 208, 208, 209, 209, 209, 209, 210, 211, 211, 211, - 212, 212, 213, 213, 214, 215, 215, 216, 216, 216, - 216, 217, 218, 218, 220, 219, 221, 221, 222, 223, - 223, 223, 225, 226, 224, 227, 227, 228, 228, 228, - 228, 228, 228, 228, 228, 228, 228, 228, 229, 229, - 230, 230, 231, 232, 232, 233, 234, 234, 234, 235, - 235, 236, 236, 236, 236, 236, 236, 236, 236, 236, - 237, 237, 238, 239, 239, 240, 240, 241, 241, 242, - 242, 243, 243, 243, 243, 243, 243, 243, 243, 243, - 243, 243, 243, 243, 243, 243, 243, 243, 243, 244, - 244, 245, 245, 246, 246, 246, 246, 246, 246, 246, - 246 -}; -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, - 0, 0, 1, 1, 1, 1, 1, 1, 2, 0, - 2, 0, 3, 2, 0, 1, 0, 3, 1, 2, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 4, 5, 5, 3, 2, 5, 4, 2, 1, - 3, 1, 3, 1, 0, 4, 3, 3, 4, 4, - 3, 6, 5, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 6, 5, 8, 6, 6, 6, 7, - 7, 6, 6, 8, 8, 3, 1, 1, 1, 1, - 2, 2, 4, 2, 1, 4, 2, 4, 0, 7, - 0, 7, 0, 7, 0, 7, 3, 4, 0, 1, - 1, 1, 3, 3, 3, 3, 3, 3, 1, 0, - 1, 1, 1, 0, 2, 3, 1, 1, 3, 1, - 0, 8, 1, 1, 0, 4, 1, 1, 2, 0, - 1, 1, 0, 0, 5, 0, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 3, 1, 5, 1, 1, - 1, 1, 2, 2, 2, 3, 2, 0, 1, 1, - 1, 2, 2, 3, 9, 9, 8, 13, 1, 1, - 6, 5, 2, 6, 7, 1, 3, 1, 0, 2, - 1, 5, 5, 5, 6, 6, 2, 4, 4, 6, - 4, 4, 4, 4, 6, 6, 2, 7, 1, 2, - 0, 1, 0, 3, 6, 3, 6, 2, 4, 6, - 4 -}; +#define YYLAST 1630 -/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state - STATE-NUM when YYTABLE doesn't specify something else to do. Zero - means the default is an error. */ -static const yytype_uint16 yydefact[] = -{ - 198, 0, 90, 184, 1, 183, 232, 83, 84, 85, - 86, 87, 88, 89, 0, 224, 257, 180, 181, 257, - 210, 211, 0, 0, 0, 90, 0, 186, 229, 0, - 91, 258, 254, 82, 226, 227, 228, 253, 0, 0, - 0, 0, 196, 0, 0, 0, 0, 0, 0, 0, - 81, 230, 231, 233, 199, 182, 0, 92, 93, 94, - 95, 96, 97, 0, 0, 302, 256, 0, 0, 0, - 0, 209, 197, 187, 2, 3, 111, 115, 116, 117, - 118, 119, 120, 121, 122, 123, 124, 125, 126, 128, - 0, 0, 0, 0, 248, 185, 0, 110, 127, 114, - 249, 129, 177, 178, 0, 0, 0, 0, 91, 98, - 0, 222, 223, 225, 301, 0, 280, 0, 0, 0, - 0, 91, 269, 259, 260, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 52, - 53, 54, 55, 20, 21, 22, 23, 24, 25, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 68, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 0, 0, 0, 0, - 0, 268, 255, 91, 272, 0, 298, 204, 201, 200, - 202, 203, 205, 208, 0, 130, 0, 0, 0, 113, - 135, 139, 0, 144, 138, 192, 194, 190, 115, 116, - 117, 118, 119, 120, 121, 122, 123, 124, 125, 0, - 0, 0, 0, 188, 234, 0, 0, 286, 279, 262, - 261, 0, 0, 72, 76, 71, 75, 70, 74, 69, - 73, 77, 78, 0, 0, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 0, 50, 51, 46, 47, - 48, 49, 36, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 0, 101, 101, 307, 0, 0, 296, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 206, 0, 0, 0, 0, - 0, 134, 143, 141, 0, 106, 106, 106, 160, 161, - 4, 5, 158, 159, 162, 157, 153, 154, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 156, 155, 106, 220, 237, 238, - 239, 244, 240, 241, 242, 243, 235, 0, 246, 251, - 250, 252, 0, 263, 0, 0, 0, 0, 0, 303, - 0, 305, 300, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 207, 112, 112, 137, 0, 140, 0, 131, 0, 193, - 195, 191, 0, 0, 0, 0, 0, 0, 0, 146, - 176, 0, 0, 0, 150, 0, 147, 0, 0, 0, - 0, 0, 189, 219, 213, 216, 217, 0, 236, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 310, 0, 0, 0, 290, 293, 0, 0, 291, 292, - 0, 0, 0, 287, 288, 0, 308, 0, 132, 133, - 136, 142, 0, 0, 108, 106, 0, 0, 300, 0, - 0, 0, 0, 0, 145, 135, 114, 0, 148, 149, - 0, 0, 0, 0, 0, 212, 214, 0, 104, 0, - 245, 0, 0, 278, 0, 0, 101, 102, 101, 275, - 299, 0, 0, 0, 0, 0, 281, 282, 283, 278, - 0, 103, 109, 107, 0, 0, 0, 0, 0, 0, - 0, 175, 152, 0, 0, 0, 0, 0, 0, 218, - 215, 105, 99, 0, 0, 0, 277, 0, 284, 285, - 0, 304, 306, 0, 0, 0, 289, 294, 295, 0, - 309, 0, 0, 164, 0, 0, 0, 0, 151, 0, - 0, 0, 0, 0, 0, 221, 247, 0, 0, 0, - 276, 273, 0, 297, 0, 0, 0, 172, 0, 0, - 166, 167, 168, 171, 163, 100, 0, 266, 0, 0, - 0, 274, 169, 170, 0, 0, 0, 264, 0, 265, - 0, 0, 165, 173, 174, 0, 0, 0, 0, 0, - 0, 271, 0, 0, 270, 267 -}; -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int16 yydefgoto[] = -{ - -1, 94, 312, 329, 330, 331, 255, 272, 332, 333, - 219, 220, 243, 221, 25, 15, 63, 555, 359, 454, - 522, 389, 455, 95, 96, 222, 98, 99, 202, 304, - 400, 348, 401, 104, 1, 2, 3, 336, 307, 305, - 306, 55, 190, 42, 72, 194, 100, 476, 415, 416, - 417, 64, 113, 16, 30, 36, 17, 53, 18, 28, - 108, 419, 349, 101, 351, 489, 19, 32, 33, 181, - 182, 579, 66, 278, 526, 527, 183, 184, 430, 185, - 186 +static const short yytable[] = { 95, + 239, 225, 108, 240, 228, 221, 359, 195, 29, 109, + 49, 24, 50, 242, 27, 32, 576, 95, 199, 72, + 73, 424, 197, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 426, 86, 18, 588, 19, 273, + 24, 450, 277, 278, 279, 280, 281, 282, 283, 586, + 231, 232, 233, 234, 235, 236, 237, 238, 203, 204, + 205, 594, 87, 425, 451, 287, 288, 388, 389, 224, + 461, 298, 224, 401, 403, 289, 425, 29, 466, 72, + 73, 299, 197, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 418, 86, 18, 410, 19, 36, + 37, 38, 103, 104, 105, 271, 272, 224, 274, 275, + 224, 224, 224, 224, 224, 224, 224, 223, 39, 18, + 292, 19, 87, 199, 229, 298, 293, -138, 199, -111, + 284, 285, 286, 224, 224, 382, 230, -138, 202, 461, + 350, 351, 110, 461, 461, 41, 446, 478, 33, 465, + 462, 202, 352, 467, 231, 232, 233, 234, 235, 236, + 237, 238, 297, 461, 42, 196, -111, 301, 88, 447, + 48, 89, 202, 511, 90, 202, 91, 198, 52, 377, + 43, 100, 101, 353, 65, 360, 231, 232, 233, 234, + 235, 236, 237, 238, 66, 370, 371, 372, 95, 575, + 67, 5, 6, 7, 8, 44, 10, 45, 68, 354, + 46, 186, 187, 290, 291, 69, 501, 107, 529, 185, + 530, 379, 380, 306, 307, 383, 355, 189, 88, 190, + 375, 89, -71, -71, 90, 191, 91, 296, -178, -70, + -70, -112, -69, -69, 193, 95, 376, 224, -68, -68, + 194, 431, 226, 433, 434, 435, 308, 309, 121, 122, + 294, 441, 201, 3, 421, 422, 423, 295, -75, 4, + -74, -73, 429, -72, 335, -78, 311, -79, 312, 5, + 6, 7, 8, 9, 10, 11, 443, 444, 356, 358, + 361, 412, 456, 457, 458, 459, 460, 374, 362, 363, + 12, 364, 378, 587, 365, 468, 469, 470, 471, 472, + 366, 383, 54, 55, 56, 57, 58, 59, 60, 224, + 432, 224, 224, 224, 436, 437, 367, 464, 368, 224, + 442, 369, 373, 381, 404, 484, 384, 486, 385, 386, + 392, 490, 393, 394, 395, 396, 405, 406, 416, 494, + 495, 496, 407, 408, 502, 503, 409, 419, 476, 420, + 427, 509, 438, 333, 448, 430, 477, 348, 439, 440, + 445, 475, 348, 348, 454, 455, 479, 480, 482, 534, + 535, 536, 481, 224, 348, 483, 485, 489, 491, 499, + 522, 523, 497, 526, 527, 492, 493, 500, 516, 554, + 532, 498, 505, 506, 507, 542, 543, 544, 545, 538, + 508, 512, 547, 548, 549, 550, 510, 348, 513, 558, + 450, 473, 559, 546, 552, 425, 514, 348, 348, 348, + 515, 412, 521, 528, 531, 533, 539, 224, 239, 562, + 563, 240, 540, 541, 560, 555, 557, 224, 224, 224, + 556, 561, 564, 224, 565, 254, 255, 566, 567, 239, + 573, 574, 240, 568, 582, 569, 583, 584, 570, 571, + 572, 578, 551, 243, 244, 245, 246, 247, 248, 249, + 250, 251, 252, 579, 580, 585, 581, 224, 589, 590, + 591, 592, 593, 596, 597, 600, 348, 348, 348, 601, + 595, 605, 606, 47, 348, 174, 175, 599, 176, 177, + 390, 602, 603, 178, 63, 519, 391, 332, 348, 348, + 518, 71, 222, 25, 35, 598, 488, 537, 504, 0, + 0, 0, 0, 72, 73, 0, 197, 206, 207, 208, + 209, 210, 211, 212, 213, 214, 215, 216, 0, 86, + 18, 0, 19, 256, 257, 258, 259, 260, 261, 262, + 263, 264, 265, 266, 267, 268, 269, 348, 0, 348, + 72, 73, 0, 348, 0, 0, 87, 0, 0, 0, + 0, 348, 348, 348, 0, 0, -81, 18, 18, 19, + 19, 313, 0, 0, 0, 0, 0, 4, -81, -81, + 0, 0, 0, 314, 315, 0, 0, -81, -81, -81, + -81, -81, -81, -81, 0, 0, -81, 20, 0, 0, + 0, 0, 348, 348, 21, 348, 348, 0, 22, 0, + 0, 0, 348, 0, 0, 0, 0, 0, 0, 0, + 0, 348, 0, 0, 123, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, + 139, 140, 141, 142, 143, 144, 145, 146, 316, 317, + 0, 0, 0, 0, 0, 318, 348, 319, 0, 320, + 321, 322, 88, 0, 0, 89, 0, 0, 90, 0, + 91, 402, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 161, 162, 163, 164, 165, 166, + 167, 168, 169, 170, 171, 172, 173, 348, 0, 0, + 0, 0, 323, 0, 0, 324, 0, 325, 0, 0, + 326, 0, 348, 0, 0, 0, 0, 0, 0, 348, + 0, 0, 0, 348, 348, 72, 73, 0, 197, 206, + 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, + 0, 86, 18, 0, 19, 0, 0, 0, 336, 337, + 72, 73, 338, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 18, 87, 19, + 0, 339, 340, 341, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 342, 343, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 344, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 123, 124, 125, 126, 127, 128, + 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, + 139, 140, 141, 142, 143, 144, 145, 146, 316, 317, + 0, 0, 0, 0, 0, 318, 0, 319, 0, 320, + 321, 322, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 88, 336, 337, 89, 0, 338, + 90, 0, 91, 463, 161, 162, 163, 164, 165, 166, + 167, 168, 169, 170, 171, 172, 173, 0, 339, 340, + 341, 0, 0, 0, 0, 345, 0, 0, 0, 0, + 342, 343, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 344, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 123, 124, 125, 126, 127, 128, 129, 130, 131, + 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 146, 316, 317, 0, 0, 0, + 0, 0, 318, 0, 319, 0, 320, 321, 322, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 161, 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 172, 173, 0, 0, 0, 0, 0, 0, + 72, 73, 345, 197, 75, 76, 77, 78, 79, 80, + 81, 82, 83, 84, 85, 0, 86, 18, 0, 19, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 300, 0, 0, 0, 0, 0, 0, 0, + 0, 72, 73, 87, 197, 206, 207, 208, 209, 210, + 211, 212, 213, 214, 215, 216, 0, 86, 18, 0, + 19, 72, 73, 0, 197, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 0, 86, 18, 0, + 19, 0, 0, 0, 87, 0, 0, 0, 0, 0, + 0, 0, 0, 411, 0, 0, 0, 0, 0, 0, + 0, 0, 72, 73, 87, 197, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 0, 86, 18, + 0, 19, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 449, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 87, 0, 0, 0, 88, + 0, 0, 89, 0, 0, 90, 0, 91, 0, 72, + 73, 0, 197, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 0, 86, 18, 0, 19, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 88, 517, 0, 89, 0, 397, 90, 0, 91, 0, + 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, + 88, 0, 0, 89, 0, 0, 90, 0, 91, 72, + 73, 0, 74, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 0, 86, 18, 0, 19, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 88, 0, 0, 89, 0, 0, 90, 0, 91, + 72, 73, 87, 197, 75, 76, 77, 78, 79, 80, + 81, 82, 83, 84, 85, 0, 86, 18, 0, 19, + 72, 73, 0, 197, 206, 207, 208, 209, 210, 211, + 212, 213, 214, 215, 216, 0, 86, 18, 0, 19, + 0, 0, 0, 87, 0, 0, 0, 0, 88, 0, + 0, 89, 0, 0, 90, 0, 91, 0, 0, 0, + 0, 72, 73, 87, 227, 75, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 0, 86, 18, 0, + 19, 72, 73, 0, 197, 206, 207, 208, 209, 210, + 211, 212, 213, 214, 215, 216, 0, 86, 18, 0, + 19, 0, 0, 0, 87, 0, 0, 0, 88, 0, + 0, 89, 0, 0, 90, 0, 91, 0, 0, 0, + 0, 0, 0, 0, 87, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 88, + 0, 0, 89, 0, 0, 90, 0, 91, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 88, + 0, 0, 89, 0, 0, 90, 0, 91, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 112, 0, 0, 0, 0, 0, 0, + 88, 0, 0, 89, 0, 0, 90, 113, 91, 0, + 0, 0, 0, 0, 0, 0, 0, 114, 115, 0, + 88, 0, 0, 89, 0, 0, 90, 0, 400, 0, + 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, + 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, + 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, + 146, 147, 148, 149, 150, 151, 0, 0, 152, 153, + 154, 155, 156, 157, 158, 159, 160, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 161, 162, 163, + 164, 165, 166, 167, 168, 169, 170, 171, 172, 173 }; -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -542 -static const yytype_int16 yypact[] = -{ - -542, 13, 162, 567, -542, -542, -542, -542, -542, -542, - -542, -542, -542, -542, 83, -542, 19, -542, -542, -14, - -542, -542, 50, -87, 87, 233, 27, -542, 123, 141, - 175, -542, -542, 98, -542, -542, -542, -542, 33, 40, - 66, 68, -542, 14, 141, 1265, 156, 156, 156, 156, - -542, -542, -542, -542, -542, -542, 221, -542, -542, -542, - -542, -542, -542, 1265, -19, 1479, -542, 204, 135, 226, - 227, 235, -542, -542, -542, -542, 81, -542, -542, -542, - -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, - 256, 257, 4, 15, -542, -542, 108, -542, -542, 12, - -542, -542, -542, -542, 1306, 1306, 1306, 1326, 175, -542, - 98, -542, -542, -542, -542, 1306, -542, 205, 1367, 116, - 479, 175, -542, -542, -542, -542, -542, -542, -542, -542, - -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, - -542, -542, -542, -542, -542, -542, -542, -542, -542, 355, - 429, 1306, 1306, 1306, 1306, 1306, 1306, 1306, 1306, 1306, - 1306, 1306, 1306, -542, -542, -542, -542, -542, -542, -542, - -542, -542, -542, -542, -542, -542, 1306, 1306, 1306, 1306, - 1306, -542, -542, 175, -542, 86, -542, -542, -542, -542, - -542, -542, -542, -542, -13, -542, 110, 111, 75, -542, - -542, 12, -81, 1046, -542, -542, -542, -542, 174, 208, - 266, 210, 267, 212, 268, 230, 277, 275, 278, 246, - 280, 279, 566, -542, -542, 136, 766, -542, -542, 81, - -542, 766, 766, -542, -542, -542, -542, -542, -542, -542, - -542, -542, -542, 766, 1265, -542, -542, -542, -542, -542, - -542, -542, -542, -542, -542, 1306, -542, -542, -542, -542, - -542, -542, -542, -542, -542, -542, -542, -542, -542, -542, - -542, -542, 1306, 137, 145, -542, 766, 132, 146, 147, - 148, 149, 151, 152, 158, 160, 766, 766, 766, 161, - 281, 1265, 1306, 1306, 291, -542, 1306, 1306, 155, -27, - 1306, -542, -542, 165, 163, 176, 176, 176, -542, -542, - -542, -542, -542, -542, -542, -542, -542, -542, 355, 429, - 172, 177, 178, 179, 182, 1087, 1387, 529, 311, 184, - 185, 186, 188, 189, -542, -542, 176, 1107, -542, -542, - -542, -542, -542, -542, -542, -542, 282, 1326, -542, -542, - -542, -542, 193, -542, 194, 766, 766, 766, 7, -542, - 20, -542, 195, 766, 192, 1306, 1306, 1306, 1306, 1306, - 1306, 1306, 200, 201, 206, 1306, 1306, 766, 766, 207, - -542, -59, -149, -542, 196, 12, 1148, -542, 44, -542, - -542, -542, 203, 211, 1326, 1326, 1326, 1326, 1326, -542, - -542, -8, 741, -82, -542, 10, -542, 1326, 1326, 1326, - 1326, 1326, -542, -542, 98, -542, 214, 209, -542, 337, - -34, 342, 348, 215, 218, 219, 766, 371, 766, 1306, - -542, 223, 766, 224, -542, -542, 225, 234, -542, -542, - 766, 766, 766, -542, -542, 228, -542, 1306, -542, -542, - -542, -542, 362, 375, -542, 176, 1326, 1326, 195, 236, - 237, 240, 243, 1326, -542, 238, -25, 11, -542, -542, - 244, 245, 247, 250, 352, -542, -542, 1205, 370, 252, - -542, 766, 766, 1306, 766, 766, 258, -542, 258, -542, - 259, 766, 264, 1306, 1306, 1306, -542, -542, -542, 1306, - 766, -542, -542, -542, 270, 271, 263, 1326, 1326, 1326, - 1326, -542, -542, 260, 1326, 1326, 1326, 1326, 1306, -542, - -542, -542, 368, 402, 274, 276, 259, 287, -542, -542, - 374, -542, -542, 1306, 285, 766, -542, -542, -542, 290, - -542, 1326, 1326, -542, 283, 295, 284, 294, -542, 296, - 297, 299, 302, 303, 430, -542, -542, 414, 41, 425, - -542, -542, 305, -542, 306, 310, 1326, -542, 1326, 1326, - -542, -542, -542, -542, -542, -542, 766, -542, 893, 144, - 448, -542, -542, -542, 314, 315, 316, -542, 331, -542, - 893, 766, -542, -542, -542, 464, 334, 180, 766, 481, - 482, -542, 766, 766, -542, -542 +static const short yycheck[] = { 43, + 118, 113, 61, 118, 116, 105, 272, 4, 23, 29, + 45, 2, 47, 119, 61, 30, 556, 61, 91, 5, + 6, 15, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 15, 21, 22, 577, 24, 151, + 31, 34, 154, 155, 156, 157, 158, 159, 160, 576, + 10, 11, 12, 13, 14, 15, 16, 17, 102, 103, + 104, 588, 48, 57, 57, 177, 178, 304, 305, 113, + 153, 153, 116, 324, 325, 181, 57, 23, 161, 5, + 6, 163, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 345, 21, 22, 334, 24, 52, + 53, 54, 45, 46, 47, 149, 150, 151, 152, 153, + 154, 155, 156, 157, 158, 159, 160, 108, 71, 22, + 153, 24, 48, 196, 9, 153, 159, 153, 201, 155, + 174, 175, 176, 177, 178, 163, 21, 163, 164, 153, + 229, 230, 162, 153, 153, 152, 159, 161, 163, 400, + 159, 164, 241, 163, 10, 11, 12, 13, 14, 15, + 16, 17, 196, 153, 61, 162, 155, 201, 154, 161, + 152, 157, 164, 163, 160, 164, 162, 163, 24, 291, + 20, 32, 33, 242, 152, 274, 10, 11, 12, 13, + 14, 15, 16, 17, 152, 284, 285, 286, 242, 159, + 152, 41, 42, 43, 44, 45, 46, 47, 152, 253, + 50, 55, 56, 108, 109, 157, 453, 4, 484, 24, + 486, 294, 295, 27, 28, 298, 270, 4, 154, 24, + 289, 157, 3, 4, 160, 24, 162, 163, 0, 3, + 4, 155, 3, 4, 4, 289, 290, 291, 3, 4, + 4, 363, 59, 365, 366, 367, 3, 4, 77, 78, + 158, 373, 155, 25, 353, 354, 355, 158, 4, 31, + 4, 4, 361, 4, 155, 7, 4, 7, 7, 41, + 42, 43, 44, 45, 46, 47, 375, 376, 153, 153, + 157, 335, 392, 393, 394, 395, 396, 36, 153, 153, + 62, 153, 24, 159, 153, 405, 406, 407, 408, 409, + 153, 384, 64, 65, 66, 67, 68, 69, 70, 363, + 364, 365, 366, 367, 368, 369, 153, 400, 153, 373, + 374, 153, 153, 161, 24, 424, 153, 426, 156, 153, + 155, 430, 155, 155, 155, 155, 155, 155, 63, 438, + 439, 440, 155, 155, 454, 455, 155, 153, 156, 153, + 153, 461, 153, 220, 161, 157, 24, 224, 153, 153, + 153, 153, 229, 230, 155, 155, 21, 21, 153, 491, + 492, 493, 155, 427, 241, 153, 4, 153, 153, 24, + 479, 480, 155, 482, 483, 153, 153, 4, 36, 24, + 489, 445, 153, 153, 153, 505, 506, 507, 508, 498, + 153, 153, 512, 513, 514, 515, 161, 274, 153, 531, + 34, 412, 159, 161, 57, 57, 153, 284, 285, 286, + 153, 475, 153, 153, 153, 153, 153, 481, 556, 539, + 540, 556, 153, 156, 533, 153, 156, 491, 492, 493, + 157, 156, 153, 497, 156, 27, 28, 153, 153, 577, + 4, 21, 577, 156, 564, 156, 566, 567, 156, 156, + 156, 36, 516, 119, 120, 121, 122, 123, 124, 125, + 126, 127, 128, 159, 156, 574, 156, 531, 21, 156, + 156, 156, 153, 21, 153, 21, 353, 354, 355, 21, + 589, 0, 0, 23, 361, 63, 63, 596, 63, 63, + 316, 600, 601, 63, 31, 476, 317, 220, 375, 376, + 475, 42, 106, 2, 17, 595, 427, 497, 456, -1, + -1, -1, -1, 5, 6, -1, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, -1, 21, + 22, -1, 24, 125, 126, 127, 128, 129, 130, 131, + 132, 133, 134, 135, 136, 137, 138, 424, -1, 426, + 5, 6, -1, 430, -1, -1, 48, -1, -1, -1, + -1, 438, 439, 440, -1, -1, 20, 22, 22, 24, + 24, 26, -1, -1, -1, -1, -1, 31, 32, 33, + -1, -1, -1, 38, 39, -1, -1, 41, 42, 43, + 44, 45, 46, 47, -1, -1, 50, 51, -1, -1, + -1, -1, 479, 480, 58, 482, 483, -1, 62, -1, + -1, -1, 489, -1, -1, -1, -1, -1, -1, -1, + -1, 498, -1, -1, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + -1, -1, -1, -1, -1, 110, 533, 112, -1, 114, + 115, 116, 154, -1, -1, 157, -1, -1, 160, -1, + 162, 163, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 139, 140, 141, 142, 143, 144, + 145, 146, 147, 148, 149, 150, 151, 574, -1, -1, + -1, -1, 157, -1, -1, 160, -1, 162, -1, -1, + 165, -1, 589, -1, -1, -1, -1, -1, -1, 596, + -1, -1, -1, 600, 601, 5, 6, -1, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + -1, 21, 22, -1, 24, -1, -1, -1, 3, 4, + 5, 6, 7, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 22, 48, 24, + -1, 26, 27, 28, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 38, 39, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 61, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + -1, -1, -1, -1, -1, 110, -1, 112, -1, 114, + 115, 116, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 154, 3, 4, 157, -1, 7, + 160, -1, 162, 163, 139, 140, 141, 142, 143, 144, + 145, 146, 147, 148, 149, 150, 151, -1, 26, 27, + 28, -1, -1, -1, -1, 160, -1, -1, -1, -1, + 38, 39, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 61, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 79, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 103, 104, -1, -1, -1, + -1, -1, 110, -1, 112, -1, 114, 115, 116, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 139, 140, 141, 142, 143, 144, 145, 146, 147, + 148, 149, 150, 151, -1, -1, -1, -1, -1, -1, + 5, 6, 160, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, -1, 21, 22, -1, 24, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 37, -1, -1, -1, -1, -1, -1, -1, + -1, 5, 6, 48, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, -1, 21, 22, -1, + 24, 5, 6, -1, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, -1, 21, 22, -1, + 24, -1, -1, -1, 48, -1, -1, -1, -1, -1, + -1, -1, -1, 37, -1, -1, -1, -1, -1, -1, + -1, -1, 5, 6, 48, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, -1, 21, 22, + -1, 24, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 37, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 48, -1, -1, -1, 154, + -1, -1, 157, -1, -1, 160, -1, 162, -1, 5, + 6, -1, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, -1, 21, 22, -1, 24, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 154, 37, -1, 157, -1, 159, 160, -1, 162, -1, + -1, -1, 48, -1, -1, -1, -1, -1, -1, -1, + 154, -1, -1, 157, -1, -1, 160, -1, 162, 5, + 6, -1, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, -1, 21, 22, -1, 24, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 154, -1, -1, 157, -1, -1, 160, -1, 162, + 5, 6, 48, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, -1, 21, 22, -1, 24, + 5, 6, -1, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, -1, 21, 22, -1, 24, + -1, -1, -1, 48, -1, -1, -1, -1, 154, -1, + -1, 157, -1, -1, 160, -1, 162, -1, -1, -1, + -1, 5, 6, 48, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, -1, 21, 22, -1, + 24, 5, 6, -1, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, -1, 21, 22, -1, + 24, -1, -1, -1, 48, -1, -1, -1, 154, -1, + -1, 157, -1, -1, 160, -1, 162, -1, -1, -1, + -1, -1, -1, -1, 48, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 154, + -1, -1, 157, -1, -1, 160, -1, 162, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 154, + -1, -1, 157, -1, -1, 160, -1, 162, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 35, -1, -1, -1, -1, -1, -1, + 154, -1, -1, 157, -1, -1, 160, 49, 162, -1, + -1, -1, -1, -1, -1, -1, -1, 59, 60, -1, + 154, -1, -1, 157, -1, -1, 160, -1, 162, -1, + 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, -1, -1, 110, 111, + 112, 113, 114, 115, 116, 117, 118, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 139, 140, 141, + 142, 143, 144, 145, 146, 147, 148, 149, 150, 151 }; +/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ +#line 3 "/usr/share/bison.simple" +/* This file comes from bison-1.28. */ -/* YYPGOTO[NTERM-NUM]. */ -static const yytype_int16 yypgoto[] = -{ - -542, -542, -542, 435, 439, 441, 191, 197, 442, 445, - -119, -116, -541, -542, 478, 489, -107, -542, -267, 37, - -542, -238, -542, -60, -542, -45, -542, -74, -51, -542, - -101, 300, -252, 134, -542, -542, -542, -542, -542, -542, - -542, 473, -542, -542, -542, -542, 8, -542, 46, -542, - -542, 410, -542, -542, -542, -542, -542, -542, 518, -542, - -542, -542, -528, 142, -90, -113, -542, 505, -542, -72, - -542, -542, -542, -542, 97, 28, -542, -542, 70, -542, - -542 -}; +/* Skeleton output parser for bison, + Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which - number is the opposite. If zero, do what YYDEFACT says. - If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -180 -static const yytype_int16 yytable[] = -{ - 97, 241, 227, 110, 242, 230, 223, 361, 197, 31, - 111, 26, 449, 4, 244, 204, 34, 578, 97, 201, - 74, 75, 426, 199, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 428, 88, 20, 590, 21, - 275, 26, 31, 279, 280, 281, 282, 283, 284, 285, - 588, 233, 234, 235, 236, 237, 238, 239, 240, 205, - 206, 207, 596, 89, 427, 43, 289, 290, 390, 391, - 226, 463, 300, 226, 403, 405, 291, 427, 452, 468, - 74, 75, 301, 199, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 420, 88, 20, 412, 21, - 448, 453, 38, 39, 40, 204, 273, 274, 226, 276, - 277, 226, 226, 226, 226, 226, 226, 226, 225, 463, - 20, 41, 21, 89, 201, 231, 300, 480, -139, 201, - -112, 286, 287, 288, 226, 226, 384, 232, -139, 204, - 294, 352, 353, 112, 29, 463, 295, 299, 44, 35, - 467, 464, 303, 354, 233, 234, 235, 236, 237, 238, - 239, 240, -179, 463, 463, 54, 198, -112, 51, 90, - 52, 71, 91, 469, 513, 92, 204, 93, 200, 50, - 379, 105, 106, 107, 355, 67, 362, 5, 102, 103, - 188, 189, 68, 6, 292, 293, 372, 373, 374, 97, - 577, 308, 309, 7, 8, 9, 10, 11, 12, 13, - 356, -72, -72, -71, -71, -70, -70, 503, 69, 531, - 70, 532, 381, 382, 14, 109, 385, 357, 187, 90, - 191, 377, 91, -69, -69, 92, -113, 93, 298, 56, - 57, 58, 59, 60, 61, 62, 97, 378, 226, 310, - 311, 192, 433, 45, 435, 436, 437, 123, 124, 193, - 195, 196, 443, 203, 228, 423, 424, 425, 296, 297, - -76, -75, -74, 431, 7, 8, 9, 10, 46, 12, - 47, -73, -79, 48, 313, -80, 314, 445, 446, 363, - 358, 337, 414, 458, 459, 460, 461, 462, 360, 364, - 365, 366, 367, 589, 368, 369, 470, 471, 472, 473, - 474, 370, 385, 371, 375, 380, 383, 376, 386, 387, - 226, 434, 226, 226, 226, 438, 439, 394, 466, 388, - 226, 444, 395, 396, 397, 406, 486, 398, 488, 407, - 408, 409, 492, 410, 411, 418, 421, 422, 429, 432, - 496, 497, 498, 440, 441, 504, 505, 450, 456, 442, - 447, 479, 511, 481, 335, 478, 457, 477, 350, 482, - 483, 484, 485, 350, 350, 487, 491, 493, 494, 502, - 536, 537, 538, 499, 226, 350, 501, 495, 518, 507, - 508, 524, 525, 509, 528, 529, 510, 514, 515, 512, - 516, 534, 500, 517, 452, 523, 544, 545, 546, 547, - 540, 530, 533, 549, 550, 551, 552, 535, 350, 543, - 560, 548, 475, 541, 542, 554, 556, 557, 350, 350, - 350, 427, 414, 558, 575, 576, 566, 568, 226, 241, - 564, 565, 242, 559, 561, 562, 563, 569, 226, 226, - 226, 567, 570, 571, 226, 572, 256, 257, 573, 574, - 241, 580, 582, 242, 581, 584, 583, 585, 586, 591, - 592, 593, 594, 553, 245, 246, 247, 248, 249, 250, - 251, 252, 253, 254, 595, 598, 587, 599, 226, 233, - 234, 235, 236, 237, 238, 239, 240, 350, 350, 350, - 176, 597, 602, 603, 177, 350, 178, 179, 601, 392, - 180, 65, 604, 605, 49, 521, 393, 73, 224, 350, - 350, 27, 334, 520, 37, 600, 490, 539, 506, 0, - 0, 0, 0, 0, 74, 75, 0, 199, 208, 209, - 210, 211, 212, 213, 214, 215, 216, 217, 218, 0, - 88, 20, 0, 21, 258, 259, 260, 261, 262, 263, - 264, 265, 266, 267, 268, 269, 270, 271, 350, 0, - 350, 74, 75, 0, 350, 0, 0, 89, 0, 0, - 0, 0, 350, 350, 350, 0, 0, -82, 20, 20, - 21, 21, 315, 0, 0, 0, 0, 0, 6, -82, - -82, 0, 0, 0, 316, 317, 0, 0, -82, -82, - -82, -82, -82, -82, -82, 0, 0, -82, 22, 0, - 0, 0, 0, 350, 350, 23, 350, 350, 0, 24, - 0, 0, 0, 350, 0, 0, 0, 0, 0, 0, - 0, 0, 350, 0, 0, 125, 126, 127, 128, 129, - 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, - 140, 141, 142, 143, 144, 145, 146, 147, 148, 318, - 319, 0, 0, 0, 0, 0, 320, 350, 321, 0, - 322, 323, 324, 90, 0, 0, 91, 0, 0, 92, - 0, 93, 404, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 172, 173, 174, 175, 350, 0, - 0, 0, 0, 325, 0, 0, 326, 0, 327, 0, - 0, 328, 0, 350, 0, 0, 0, 0, 0, 0, - 350, 0, 0, 0, 350, 350, 74, 75, 0, 199, - 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, - 218, 0, 88, 20, 0, 21, 0, 0, 0, 338, - 339, 74, 75, 340, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 20, 89, - 21, 0, 341, 342, 343, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 344, 345, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 346, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 125, 126, 127, 128, 129, - 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, - 140, 141, 142, 143, 144, 145, 146, 147, 148, 318, - 319, 0, 0, 0, 0, 0, 320, 0, 321, 0, - 322, 323, 324, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 90, 338, 339, 91, 0, - 340, 92, 0, 93, 465, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 172, 173, 174, 175, 0, 341, - 342, 343, 0, 0, 0, 0, 347, 0, 0, 0, - 0, 344, 345, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 346, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 318, 319, 0, 0, - 0, 0, 0, 320, 0, 321, 0, 322, 323, 324, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 163, 164, 165, 166, 167, 168, 169, 170, - 171, 172, 173, 174, 175, 0, 0, 0, 0, 0, - 0, 74, 75, 347, 199, 77, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 0, 88, 20, 0, - 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 302, 0, 0, 0, 0, 0, 0, - 0, 0, 74, 75, 89, 199, 208, 209, 210, 211, - 212, 213, 214, 215, 216, 217, 218, 0, 88, 20, - 0, 21, 74, 75, 0, 199, 77, 78, 79, 80, - 81, 82, 83, 84, 85, 86, 87, 0, 88, 20, - 0, 21, 0, 0, 0, 89, 0, 0, 0, 0, - 0, 0, 0, 0, 413, 0, 0, 0, 0, 0, - 0, 0, 0, 74, 75, 89, 199, 77, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 0, 88, - 20, 0, 21, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 451, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 89, 0, 0, 0, - 90, 0, 0, 91, 0, 0, 92, 0, 93, 0, - 74, 75, 0, 199, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 0, 88, 20, 0, 21, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 90, 519, 0, 91, 0, 399, 92, 0, 93, - 0, 0, 0, 89, 0, 0, 0, 0, 0, 0, - 0, 90, 0, 0, 91, 0, 0, 92, 0, 93, - 74, 75, 0, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 0, 88, 20, 0, 21, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 90, 0, 0, 91, 0, 0, 92, 0, - 93, 74, 75, 89, 199, 77, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 0, 88, 20, 0, - 21, 74, 75, 0, 199, 208, 209, 210, 211, 212, - 213, 214, 215, 216, 217, 218, 0, 88, 20, 0, - 21, 0, 0, 0, 89, 0, 0, 0, 0, 90, - 0, 0, 91, 0, 0, 92, 0, 93, 0, 0, - 0, 0, 74, 75, 89, 229, 77, 78, 79, 80, - 81, 82, 83, 84, 85, 86, 87, 0, 88, 20, - 0, 21, 74, 75, 0, 199, 208, 209, 210, 211, - 212, 213, 214, 215, 216, 217, 218, 0, 88, 20, - 0, 21, 0, 0, 0, 89, 0, 0, 0, 90, - 0, 0, 91, 0, 0, 92, 0, 93, 0, 0, - 0, 0, 0, 0, 0, 89, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 90, 0, 0, 91, 0, 0, 92, 0, 93, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 90, 0, 0, 91, 0, 0, 92, 0, 93, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 114, 0, 0, 0, 0, 0, - 0, 90, 0, 0, 91, 0, 0, 92, 115, 93, - 0, 0, 0, 0, 0, 0, 0, 0, 116, 117, - 0, 90, 0, 0, 91, 0, 0, 92, 0, 402, - 0, 118, 119, 120, 121, 122, 123, 124, 125, 126, - 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, - 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, - 147, 148, 149, 150, 151, 152, 153, 0, 0, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, - 175 -}; + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. -static const yytype_int16 yycheck[] = -{ - 45, 120, 115, 63, 120, 118, 107, 274, 4, 23, - 29, 3, 161, 0, 121, 164, 30, 558, 63, 93, - 5, 6, 15, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 15, 21, 22, 579, 24, - 153, 33, 23, 156, 157, 158, 159, 160, 161, 162, - 578, 10, 11, 12, 13, 14, 15, 16, 17, 104, - 105, 106, 590, 48, 57, 152, 179, 180, 306, 307, - 115, 153, 153, 118, 326, 327, 183, 57, 34, 161, - 5, 6, 163, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 347, 21, 22, 336, 24, - 159, 57, 52, 53, 54, 164, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 110, 153, - 22, 71, 24, 48, 198, 9, 153, 161, 153, 203, - 155, 176, 177, 178, 179, 180, 163, 21, 163, 164, - 153, 231, 232, 162, 61, 153, 159, 198, 61, 163, - 402, 159, 203, 243, 10, 11, 12, 13, 14, 15, - 16, 17, 0, 153, 153, 24, 162, 155, 45, 154, - 47, 157, 157, 163, 163, 160, 164, 162, 163, 152, - 293, 47, 48, 49, 244, 152, 276, 25, 32, 33, - 55, 56, 152, 31, 108, 109, 286, 287, 288, 244, - 159, 27, 28, 41, 42, 43, 44, 45, 46, 47, - 255, 3, 4, 3, 4, 3, 4, 455, 152, 486, - 152, 488, 296, 297, 62, 4, 300, 272, 24, 154, - 4, 291, 157, 3, 4, 160, 155, 162, 163, 64, - 65, 66, 67, 68, 69, 70, 291, 292, 293, 3, - 4, 24, 365, 20, 367, 368, 369, 77, 78, 24, - 4, 4, 375, 155, 59, 355, 356, 357, 158, 158, - 4, 4, 4, 363, 41, 42, 43, 44, 45, 46, - 47, 4, 7, 50, 4, 7, 7, 377, 378, 157, - 153, 155, 337, 394, 395, 396, 397, 398, 153, 153, - 153, 153, 153, 159, 153, 153, 407, 408, 409, 410, - 411, 153, 386, 153, 153, 24, 161, 36, 153, 156, - 365, 366, 367, 368, 369, 370, 371, 155, 402, 153, - 375, 376, 155, 155, 155, 24, 426, 155, 428, 155, - 155, 155, 432, 155, 155, 63, 153, 153, 153, 157, - 440, 441, 442, 153, 153, 456, 457, 161, 155, 153, - 153, 24, 463, 21, 222, 156, 155, 153, 226, 21, - 155, 153, 153, 231, 232, 4, 153, 153, 153, 4, - 493, 494, 495, 155, 429, 243, 24, 153, 36, 153, - 153, 481, 482, 153, 484, 485, 153, 153, 153, 161, - 153, 491, 447, 153, 34, 153, 507, 508, 509, 510, - 500, 153, 153, 514, 515, 516, 517, 153, 276, 156, - 533, 161, 414, 153, 153, 57, 24, 153, 286, 287, - 288, 57, 477, 157, 4, 21, 153, 153, 483, 558, - 541, 542, 558, 156, 159, 535, 156, 153, 493, 494, - 495, 156, 156, 156, 499, 156, 27, 28, 156, 156, - 579, 36, 156, 579, 159, 566, 156, 568, 569, 21, - 156, 156, 156, 518, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 153, 21, 576, 153, 533, 10, - 11, 12, 13, 14, 15, 16, 17, 355, 356, 357, - 65, 591, 21, 21, 65, 363, 65, 65, 598, 318, - 65, 33, 602, 603, 25, 478, 319, 44, 108, 377, - 378, 3, 222, 477, 19, 597, 429, 499, 458, -1, - -1, -1, -1, -1, 5, 6, -1, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, -1, - 21, 22, -1, 24, 125, 126, 127, 128, 129, 130, - 131, 132, 133, 134, 135, 136, 137, 138, 426, -1, - 428, 5, 6, -1, 432, -1, -1, 48, -1, -1, - -1, -1, 440, 441, 442, -1, -1, 20, 22, 22, - 24, 24, 26, -1, -1, -1, -1, -1, 31, 32, - 33, -1, -1, -1, 38, 39, -1, -1, 41, 42, - 43, 44, 45, 46, 47, -1, -1, 50, 51, -1, - -1, -1, -1, 481, 482, 58, 484, 485, -1, 62, - -1, -1, -1, 491, -1, -1, -1, -1, -1, -1, - -1, -1, 500, -1, -1, 79, 80, 81, 82, 83, - 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, - 104, -1, -1, -1, -1, -1, 110, 535, 112, -1, - 114, 115, 116, 154, -1, -1, 157, -1, -1, 160, - -1, 162, 163, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 139, 140, 141, 142, 143, - 144, 145, 146, 147, 148, 149, 150, 151, 576, -1, - -1, -1, -1, 157, -1, -1, 160, -1, 162, -1, - -1, 165, -1, 591, -1, -1, -1, -1, -1, -1, - 598, -1, -1, -1, 602, 603, 5, 6, -1, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, -1, 21, 22, -1, 24, -1, -1, -1, 3, - 4, 5, 6, 7, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 22, 48, - 24, -1, 26, 27, 28, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 38, 39, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 61, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 79, 80, 81, 82, 83, - 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, - 104, -1, -1, -1, -1, -1, 110, -1, 112, -1, - 114, 115, 116, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 154, 3, 4, 157, -1, - 7, 160, -1, 162, 163, 139, 140, 141, 142, 143, - 144, 145, 146, 147, 148, 149, 150, 151, -1, 26, - 27, 28, -1, -1, -1, -1, 160, -1, -1, -1, - -1, 38, 39, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 61, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - 97, 98, 99, 100, 101, 102, 103, 104, -1, -1, - -1, -1, -1, 110, -1, 112, -1, 114, 115, 116, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 139, 140, 141, 142, 143, 144, 145, 146, - 147, 148, 149, 150, 151, -1, -1, -1, -1, -1, - -1, 5, 6, 160, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, -1, 21, 22, -1, - 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 37, -1, -1, -1, -1, -1, -1, - -1, -1, 5, 6, 48, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, -1, 21, 22, - -1, 24, 5, 6, -1, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, -1, 21, 22, - -1, 24, -1, -1, -1, 48, -1, -1, -1, -1, - -1, -1, -1, -1, 37, -1, -1, -1, -1, -1, - -1, -1, -1, 5, 6, 48, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, -1, 21, - 22, -1, 24, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 37, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 48, -1, -1, -1, - 154, -1, -1, 157, -1, -1, 160, -1, 162, -1, - 5, 6, -1, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, -1, 21, 22, -1, 24, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 154, 37, -1, 157, -1, 159, 160, -1, 162, - -1, -1, -1, 48, -1, -1, -1, -1, -1, -1, - -1, 154, -1, -1, 157, -1, -1, 160, -1, 162, - 5, 6, -1, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, -1, 21, 22, -1, 24, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 154, -1, -1, 157, -1, -1, 160, -1, - 162, 5, 6, 48, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, -1, 21, 22, -1, - 24, 5, 6, -1, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, -1, 21, 22, -1, - 24, -1, -1, -1, 48, -1, -1, -1, -1, 154, - -1, -1, 157, -1, -1, 160, -1, 162, -1, -1, - -1, -1, 5, 6, 48, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, -1, 21, 22, - -1, 24, 5, 6, -1, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, -1, 21, 22, - -1, 24, -1, -1, -1, 48, -1, -1, -1, 154, - -1, -1, 157, -1, -1, 160, -1, 162, -1, -1, - -1, -1, -1, -1, -1, 48, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 154, -1, -1, 157, -1, -1, 160, -1, 162, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 154, -1, -1, 157, -1, -1, 160, -1, 162, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 35, -1, -1, -1, -1, -1, - -1, 154, -1, -1, 157, -1, -1, 160, 49, 162, - -1, -1, -1, -1, -1, -1, -1, -1, 59, 60, - -1, 154, -1, -1, 157, -1, -1, 160, -1, 162, - -1, 72, 73, 74, 75, 76, 77, 78, 79, 80, - 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, - 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, - 101, 102, 103, 104, 105, 106, 107, -1, -1, 110, - 111, 112, 113, 114, 115, 116, 117, 118, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 139, 140, - 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, - 151 -}; + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = -{ - 0, 200, 201, 202, 0, 25, 31, 41, 42, 43, - 44, 45, 46, 47, 62, 181, 219, 222, 224, 232, - 22, 24, 51, 58, 62, 180, 212, 224, 225, 61, - 220, 23, 233, 234, 30, 163, 221, 233, 52, 53, - 54, 71, 209, 152, 61, 20, 45, 47, 50, 181, - 152, 45, 47, 223, 24, 207, 64, 65, 66, 67, - 68, 69, 70, 182, 217, 180, 238, 152, 152, 152, - 152, 157, 210, 207, 5, 6, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 21, 48, - 154, 157, 160, 162, 167, 189, 190, 191, 192, 193, - 212, 229, 32, 33, 199, 199, 199, 199, 226, 4, - 189, 29, 162, 218, 35, 49, 59, 60, 72, 73, - 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, - 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, - 104, 105, 106, 107, 110, 111, 112, 113, 114, 115, - 116, 117, 118, 139, 140, 141, 142, 143, 144, 145, - 146, 147, 148, 149, 150, 151, 169, 170, 171, 174, - 175, 235, 236, 242, 243, 245, 246, 24, 55, 56, - 208, 4, 24, 24, 211, 4, 4, 4, 162, 8, - 163, 193, 194, 155, 164, 191, 191, 191, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 176, - 177, 179, 191, 196, 217, 212, 191, 231, 59, 8, - 231, 9, 21, 10, 11, 12, 13, 14, 15, 16, - 17, 176, 177, 178, 182, 119, 120, 121, 122, 123, - 124, 125, 126, 127, 128, 172, 27, 28, 125, 126, - 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, - 137, 138, 173, 191, 191, 231, 191, 191, 239, 231, - 231, 231, 231, 231, 231, 231, 191, 191, 191, 231, - 231, 182, 108, 109, 153, 159, 158, 158, 163, 194, - 153, 163, 37, 194, 195, 205, 206, 204, 27, 28, - 3, 4, 168, 4, 7, 26, 38, 39, 103, 104, - 110, 112, 114, 115, 116, 157, 160, 162, 165, 169, - 170, 171, 174, 175, 197, 229, 203, 155, 3, 4, - 7, 26, 27, 28, 38, 39, 61, 160, 197, 228, - 229, 230, 230, 230, 230, 189, 191, 191, 153, 184, - 153, 184, 230, 157, 153, 153, 153, 153, 153, 153, - 153, 153, 230, 230, 230, 153, 36, 189, 191, 231, - 24, 193, 193, 161, 163, 193, 153, 156, 153, 187, - 187, 187, 172, 173, 155, 155, 155, 155, 155, 159, - 196, 198, 162, 198, 163, 198, 24, 155, 155, 155, - 155, 155, 187, 37, 191, 214, 215, 216, 63, 227, - 198, 153, 153, 230, 230, 230, 15, 57, 15, 153, - 244, 230, 157, 231, 191, 231, 231, 231, 191, 191, - 153, 153, 153, 231, 191, 230, 230, 153, 159, 161, - 161, 37, 34, 57, 185, 188, 155, 155, 196, 196, - 196, 196, 196, 153, 159, 163, 193, 198, 161, 163, - 196, 196, 196, 196, 196, 212, 213, 153, 156, 24, - 161, 21, 21, 155, 153, 153, 230, 4, 230, 231, - 240, 153, 230, 153, 153, 153, 230, 230, 230, 155, - 191, 24, 4, 187, 196, 196, 244, 153, 153, 153, - 153, 196, 161, 163, 153, 153, 153, 153, 36, 37, - 214, 185, 186, 153, 230, 230, 240, 241, 230, 230, - 153, 184, 184, 153, 230, 153, 231, 231, 231, 241, - 230, 153, 153, 156, 196, 196, 196, 196, 161, 196, - 196, 196, 196, 191, 57, 183, 24, 153, 157, 156, - 231, 159, 230, 156, 196, 196, 153, 156, 153, 153, - 156, 156, 156, 156, 156, 4, 21, 159, 178, 237, - 36, 159, 156, 156, 196, 196, 196, 230, 228, 159, - 178, 21, 156, 156, 156, 153, 228, 230, 21, 153, - 235, 230, 21, 21, 230, 230 -}; + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +/* This is the parser code that is written into each bison parser + when the %semantic_parser declaration is not specified in the grammar. + It was written by Richard Stallman by simplifying the hairy parser + used when %semantic_parser is specified. */ + +#ifndef YYSTACK_USE_ALLOCA +#ifdef alloca +#define YYSTACK_USE_ALLOCA +#else /* alloca not defined */ +#ifdef __GNUC__ +#define YYSTACK_USE_ALLOCA +#define alloca __builtin_alloca +#else /* not GNU C. */ +#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) +#define YYSTACK_USE_ALLOCA +#include +#else /* not sparc */ +/* We think this test detects Watcom and Microsoft C. */ +/* This used to test MSDOS, but that is a bad idea + since that symbol is in the user namespace. */ +#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) +#if 0 /* No need for malloc.h, which pollutes the namespace; + instead, just don't use alloca. */ +#include +#endif +#else /* not MSDOS, or __TURBOC__ */ +#if defined(_AIX) +/* I don't know what this was needed for, but it pollutes the namespace. + So I turned it off. rms, 2 May 1997. */ +/* #include */ + #pragma alloca +#define YYSTACK_USE_ALLOCA +#else /* not MSDOS, or __TURBOC__, or _AIX */ +#if 0 +#ifdef __hpux /* haible at ilog.fr says this works for HPUX 9.05 and up, + and on HPUX 10. Eventually we can turn this on. */ +#define YYSTACK_USE_ALLOCA +#define alloca __builtin_alloca +#endif /* __hpux */ +#endif +#endif /* not _AIX */ +#endif /* not MSDOS, or __TURBOC__ */ +#endif /* not sparc */ +#endif /* not GNU C */ +#endif /* alloca not defined */ +#endif /* YYSTACK_USE_ALLOCA not defined */ + +#ifdef YYSTACK_USE_ALLOCA +#define YYSTACK_ALLOC alloca +#else +#define YYSTACK_ALLOC malloc +#endif + +/* Note: there must be only one dollar sign in this file. + It is replaced by the list of actions, each action + as one case of the switch. */ #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) +#define YYEMPTY -2 #define YYEOF 0 - #define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab - - -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrlab1 +/* Like YYERROR except do call yyerror. + This remains here temporarily to ease the + transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ - #define YYFAIL goto yyerrlab - #define YYRECOVERING() (!!yyerrstatus) - -#define YYBACKUP(Token, Value) \ +#define YYBACKUP(token, value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK (1); \ + { yychar = (token), yylval = (value); \ + yychar1 = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ goto yybackup; \ } \ else \ - { \ - yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (YYID (0)) - + { yyerror ("syntax error: cannot back up"); YYERROR; } \ +while (0) #define YYTERROR 1 #define YYERRCODE 256 - -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (YYID (N)) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ - while (YYID (0)) -#endif - - -/* YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know - we won't break user code: when these are the locations we know. */ - -#ifndef YY_LOCATION_PRINT -# if YYLTYPE_IS_TRIVIAL -# define YY_LOCATION_PRINT(File, Loc) \ - fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) -# else -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -# endif +#ifndef YYPURE +#define YYLEX yylex() #endif - -/* YYLEX -- calling `yylex' with the right arguments. */ - +#ifdef YYPURE +#ifdef YYLSP_NEEDED #ifdef YYLEX_PARAM -# define YYLEX yylex (YYLEX_PARAM) +#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) #else -# define YYLEX yylex () +#define YYLEX yylex(&yylval, &yylloc) #endif - -/* Enable debugging if requested. */ -#if YYDEBUG - -# ifndef YYFPRINTF -# include /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (YYID (0)) - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (YYID (0)) - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else /* not YYLSP_NEEDED */ +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, YYLEX_PARAM) #else -static void -yy_symbol_value_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; +#define YYLEX yylex(&yylval) #endif -{ - if (!yyvaluep) - return; -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# else - YYUSE (yyoutput); -# endif - switch (yytype) - { - default: - break; - } -} - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -#else -static void -yy_symbol_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const * const yyvaluep; +#endif /* not YYLSP_NEEDED */ #endif -{ - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); - - yy_symbol_value_print (yyoutput, yytype, yyvaluep); - YYFPRINTF (yyoutput, ")"); -} -/*------------------------------------------------------------------. -| yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (included). | -`------------------------------------------------------------------*/ +/* If nonreentrant, generate the variables here */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) -#else -static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; -#endif -{ - YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); - YYFPRINTF (stderr, "\n"); -} +#ifndef YYPURE -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (YYID (0)) +int yychar; /* the lookahead symbol */ +YYSTYPE yylval; /* the semantic value of the */ + /* lookahead symbol */ +#ifdef YYLSP_NEEDED +YYLTYPE yylloc; /* location data for the lookahead */ + /* symbol */ +#endif -/*------------------------------------------------. -| Report that the YYRULE is going to be reduced. | -`------------------------------------------------*/ +int yynerrs; /* number of parse errors so far */ +#endif /* not YYPURE */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_reduce_print (YYSTYPE *yyvsp, int yyrule) -#else -static void -yy_reduce_print (yyvsp, yyrule) - YYSTYPE *yyvsp; - int yyrule; +#if YYDEBUG != 0 +int yydebug; /* nonzero means print parse trace */ +/* Since this is uninitialized, it does not stop multiple parsers + from coexisting. */ #endif -{ - int yynrhs = yyr2[yyrule]; - int yyi; - unsigned long int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); - /* The symbols being reduced. */ - for (yyi = 0; yyi < yynrhs; yyi++) - { - fprintf (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &(yyvsp[(yyi + 1) - (yynrhs)]) - ); - fprintf (stderr, "\n"); - } -} -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyvsp, Rule); \ -} while (YYID (0)) - -/* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -int yydebug; -#else /* !YYDEBUG */ -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) -# define YY_STACK_PRINT(Bottom, Top) -# define YY_REDUCE_PRINT(Rule) -#endif /* !YYDEBUG */ +/* YYINITDEPTH indicates the initial size of the parser's stacks */ - -/* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH -# define YYINITDEPTH 200 +#define YYINITDEPTH 200 #endif -/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only - if the built-in stack extension method is used). +/* YYMAXDEPTH is the maximum size the stacks can grow to + (effective only if the built-in stack extension method is used). */ - Do not make this value too large; the results are undefined if - YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) - evaluated with infinite-precision integer arithmetic. */ +#if YYMAXDEPTH == 0 +#undef YYMAXDEPTH +#endif #ifndef YYMAXDEPTH -# define YYMAXDEPTH 10000 +#define YYMAXDEPTH 10000 #endif - +/* Define __yy_memcpy. Note that the size argument + should be passed with type unsigned int, because that is what the non-GCC + definitions require. With GCC, __builtin_memcpy takes an arg + of type size_t, but it can handle unsigned int. */ + +#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ +#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) +#else /* not GNU C or C++ */ +#ifndef __cplusplus -#if YYERROR_VERBOSE - -# ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen -# else -/* Return the length of YYSTR. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static YYSIZE_T -yystrlen (const char *yystr) -#else -static YYSIZE_T -yystrlen (yystr) - const char *yystr; -#endif -{ - YYSIZE_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) - continue; - return yylen; -} -# endif -# endif - -# ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static char * -yystpcpy (char *yydest, const char *yysrc) -#else -static char * -yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -#endif -{ - char *yyd = yydest; - const char *yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; -} -# endif -# endif - -# ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static YYSIZE_T -yytnamerr (char *yyres, const char *yystr) -{ - if (*yystr == '"') - { - YYSIZE_T yyn = 0; - char const *yyp = yystr; - - for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes: ; - } - - if (! yyres) - return yystrlen (yystr); - - return yystpcpy (yyres, yystr) - yyres; -} -# endif - -/* Copy into YYRESULT an error message about the unexpected token - YYCHAR while in state YYSTATE. Return the number of bytes copied, - including the terminating null byte. If YYRESULT is null, do not - copy anything; just return the number of bytes that would be - copied. As a special case, return 0 if an ordinary "syntax error" - message will do. Return YYSIZE_MAXIMUM if overflow occurs during - size calculation. */ -static YYSIZE_T -yysyntax_error (char *yyresult, int yystate, int yychar) +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ +static void +__yy_memcpy (to, from, count) + char *to; + char *from; + unsigned int count; { - int yyn = yypact[yystate]; + register char *f = from; + register char *t = to; + register int i = count; - if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) - return 0; - else - { - int yytype = YYTRANSLATE (yychar); - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; - -# if 0 - /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ - YY_("syntax error, unexpected %s"); - YY_("syntax error, unexpected %s, expecting %s"); - YY_("syntax error, unexpected %s, expecting %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); -# endif - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy (yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; - } - - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen (yyf); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - - if (yysize_overflow) - return YYSIZE_MAXIMUM; - - if (yyresult) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yyresult; - int yyi = 0; - while ((*yyp = *yyf) != '\0') - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - } - return yysize; - } + while (i-- > 0) + *t++ = *f++; } -#endif /* YYERROR_VERBOSE */ - -/*-----------------------------------------------. -| Release the memory associated to this symbol. | -`-----------------------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) -#else +#else /* __cplusplus */ + +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ static void -yydestruct (yymsg, yytype, yyvaluep) - const char *yymsg; - int yytype; - YYSTYPE *yyvaluep; -#endif +__yy_memcpy (char *to, char *from, unsigned int count) { - YYUSE (yyvaluep); + register char *t = to; + register char *f = from; + register int i = count; - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - - switch (yytype) - { - - default: - break; - } + while (i-- > 0) + *t++ = *f++; } - - -/* Prevent warnings from -Wmissing-prototypes. */ -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int yyparse (void *YYPARSE_PARAM); -#else -int yyparse (); #endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus -int yyparse (void); -#else -int yyparse (); #endif -#endif /* ! YYPARSE_PARAM */ - - - -/* The look-ahead symbol. */ -int yychar; - -/* The semantic value of the look-ahead symbol. */ -YYSTYPE yylval; - -/* Number of syntax errors so far. */ -int yynerrs; - + +#line 217 "/usr/share/bison.simple" +/* The user can define YYPARSE_PARAM as the name of an argument to be passed + into yyparse. The argument should have type void *. + It should actually point to an object. + Grammar actions can access the variable by casting it + to the proper pointer type. */ -/*----------. -| yyparse. | -`----------*/ +#ifdef YYPARSE_PARAM +#ifdef __cplusplus +#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM +#define YYPARSE_PARAM_DECL +#else /* not __cplusplus */ +#define YYPARSE_PARAM_ARG YYPARSE_PARAM +#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; +#endif /* not __cplusplus */ +#else /* not YYPARSE_PARAM */ +#define YYPARSE_PARAM_ARG +#define YYPARSE_PARAM_DECL +#endif /* not YYPARSE_PARAM */ +/* Prevent warning if -Wstrict-prototypes. */ +#ifdef __GNUC__ #ifdef YYPARSE_PARAM -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void *YYPARSE_PARAM) -#else -int -yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -#endif -#else /* ! YYPARSE_PARAM */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void) +int yyparse (void *); #else -int -yyparse () - -#endif +int yyparse (void); #endif -{ - - int yystate; - int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; - - +int +yyparse(YYPARSE_PARAM_ARG) + YYPARSE_PARAM_DECL +{ + register int yystate; + register int yyn; + register short *yyssp; + register YYSTYPE *yyvsp; + int yyerrstatus; /* number of tokens to shift before error messages enabled */ + int yychar1 = 0; /* lookahead token as an internal (translated) token number */ + + short yyssa[YYINITDEPTH]; /* the state stack */ + YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ + + short *yyss = yyssa; /* refer to the stacks thru separate pointers */ + YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ + +#ifdef YYLSP_NEEDED + YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ + YYLTYPE *yyls = yylsa; + YYLTYPE *yylsp; -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) +#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) +#else +#define YYPOPSTACK (yyvsp--, yyssp--) +#endif - YYSIZE_T yystacksize = YYINITDEPTH; + int yystacksize = YYINITDEPTH; + int yyfree_stacks = 0; - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; +#ifdef YYPURE + int yychar; + YYSTYPE yylval; + int yynerrs; +#ifdef YYLSP_NEEDED + YYLTYPE yylloc; +#endif +#endif + YYSTYPE yyval; /* the variable used to return */ + /* semantic values from the action */ + /* routines */ - /* The number of symbols on the RHS of the reduced rule. - Keep to zero when no symbol should be popped. */ - int yylen = 0; + int yylen; - YYDPRINTF ((stderr, "Starting parse\n")); +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Starting parse\n"); +#endif yystate = 0; yyerrstatus = 0; @@ -3928,584 +2998,574 @@ so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss; + yyssp = yyss - 1; yyvsp = yyvs; +#ifdef YYLSP_NEEDED + yylsp = yyls; +#endif - goto yysetstate; - -/*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | -`------------------------------------------------------------*/ - yynewstate: - /* In all cases, when you get here, the value and location stacks - have just been pushed. So pushing a state here evens the stacks. */ - yyssp++; +/* Push a new state, which is found in yystate . */ +/* In all cases, when you get here, the value and location stacks + have just been pushed. so pushing a state here evens the stacks. */ +yynewstate: - yysetstate: - *yyssp = yystate; + *++yyssp = yystate; - if (yyss + yystacksize - 1 <= yyssp) + if (yyssp >= yyss + yystacksize - 1) { + /* Give user a chance to reallocate the stack */ + /* Use copies of these so that the &'s don't force the real ones into memory. */ + YYSTYPE *yyvs1 = yyvs; + short *yyss1 = yyss; +#ifdef YYLSP_NEEDED + YYLTYPE *yyls1 = yyls; +#endif + /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; + int size = yyssp - yyss + 1; #ifdef yyoverflow - { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; - - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - - &yystacksize); + /* Each stack pointer address is followed by the size of + the data in use in that stack, in bytes. */ +#ifdef YYLSP_NEEDED + /* This used to be a conditional around just the two extra args, + but that might be undefined if yyoverflow is a macro. */ + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yyls1, size * sizeof (*yylsp), + &yystacksize); +#else + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yystacksize); +#endif - yyss = yyss1; - yyvs = yyvs1; - } + yyss = yyss1; yyvs = yyvs1; +#ifdef YYLSP_NEEDED + yyls = yyls1; +#endif #else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; + if (yystacksize >= YYMAXDEPTH) + { + yyerror("parser stack overflow"); + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } + return 2; + } yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) + if (yystacksize > YYMAXDEPTH) yystacksize = YYMAXDEPTH; - - { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - -# undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); - } -# endif +#ifndef YYSTACK_USE_ALLOCA + yyfree_stacks = 1; +#endif + yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); + __yy_memcpy ((char *)yyss, (char *)yyss1, + size * (unsigned int) sizeof (*yyssp)); + yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); + __yy_memcpy ((char *)yyvs, (char *)yyvs1, + size * (unsigned int) sizeof (*yyvsp)); +#ifdef YYLSP_NEEDED + yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); + __yy_memcpy ((char *)yyls, (char *)yyls1, + size * (unsigned int) sizeof (*yylsp)); +#endif #endif /* no yyoverflow */ - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; - + yyssp = yyss + size - 1; + yyvsp = yyvs + size - 1; +#ifdef YYLSP_NEEDED + yylsp = yyls + size - 1; +#endif - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Stack size increased to %d\n", yystacksize); +#endif - if (yyss + yystacksize - 1 <= yyssp) + if (yyssp >= yyss + yystacksize - 1) YYABORT; } - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Entering state %d\n", yystate); +#endif goto yybackup; + yybackup: -/*-----------. -| yybackup. | -`-----------*/ -yybackup: +/* Do appropriate processing given the current state. */ +/* Read a lookahead token if we need one and don't already have one. */ +/* yyresume: */ - /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ + /* First try to decide what to do without reference to lookahead token. */ - /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) + if (yyn == YYFLAG) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ + + /* yychar is either YYEMPTY or YYEOF + or a valid token in external form. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { - YYDPRINTF ((stderr, "Reading a token: ")); +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Reading a token: "); +#endif yychar = YYLEX; } - if (yychar <= YYEOF) + /* Convert token to internal form (in yychar1) for indexing tables with */ + + if (yychar <= 0) /* This means end of input. */ { - yychar = yytoken = YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); + yychar1 = 0; + yychar = YYEOF; /* Don't call YYLEX any more */ + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Now at end of input.\n"); +#endif } else { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + yychar1 = YYTRANSLATE(yychar); + +#if YYDEBUG != 0 + if (yydebug) + { + fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); + /* Give the individual parser a way to print the precise meaning + of a token, for further debugging info. */ +#ifdef YYPRINT + YYPRINT (stderr, yychar, yylval); +#endif + fprintf (stderr, ")\n"); + } +#endif } - /* If the proper action on seeing token YYTOKEN is to reduce or to - detect an error, take that action. */ - yyn += yytoken; - if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + yyn += yychar1; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) goto yydefault; + yyn = yytable[yyn]; - if (yyn <= 0) + + /* yyn is what to do for this token type in this state. + Negative => reduce, -yyn is rule number. + Positive => shift, yyn is new state. + New state is final state => don't bother to shift, + just return success. + 0, or most negative number => error. */ + + if (yyn < 0) { - if (yyn == 0 || yyn == YYTABLE_NINF) + if (yyn == YYFLAG) goto yyerrlab; yyn = -yyn; goto yyreduce; } + else if (yyn == 0) + goto yyerrlab; if (yyn == YYFINAL) YYACCEPT; - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; + /* Shift the lookahead token. */ - /* Shift the look-ahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); +#endif - /* Discard the shifted token unless it is eof. */ + /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; - yystate = yyn; *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif - goto yynewstate; + /* count tokens shifted since error; after three, turn off error status. */ + if (yyerrstatus) yyerrstatus--; + yystate = yyn; + goto yynewstate; -/*-----------------------------------------------------------. -| yydefault -- do the default action for the current state. | -`-----------------------------------------------------------*/ +/* Do the default action for the current state. */ yydefault: + yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; - goto yyreduce; - -/*-----------------------------. -| yyreduce -- Do a reduction. | -`-----------------------------*/ +/* Do a reduction. yyn is the number of a rule to reduce with. */ yyreduce: - /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; + if (yylen > 0) + yyval = yyvsp[1-yylen]; /* implement default value of the action */ - /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. +#if YYDEBUG != 0 + if (yydebug) + { + int i; - Otherwise, the following line sets YYVAL to garbage. - This behavior is undocumented and Bison - users should not rely upon it. Assigning to YYVAL - unconditionally makes the parser a bit smaller, and it avoids a - GCC warning that YYVAL may be used uninitialized. */ - yyval = yyvsp[1-yylen]; + fprintf (stderr, "Reducing via rule %d (line %d), ", + yyn, yyrline[yyn]); + /* Print the symbols being reduced, and their result. */ + for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) + fprintf (stderr, "%s ", yytname[yyrhs[i]]); + fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); + } +#endif - YY_REDUCE_PRINT (yyn); - switch (yyn) - { - case 3: -#line 1821 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - if ((yyvsp[(1) - (1)].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range! - error("Value too large for type"); - (yyval.SIntVal) = (int32_t)(yyvsp[(1) - (1)].UIntVal); - ;} - break; - case 5: -#line 1830 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - if ((yyvsp[(1) - (1)].UInt64Val) > (uint64_t)INT64_MAX) // Outside of my range! - error("Value too large for type"); - (yyval.SInt64Val) = (int64_t)(yyvsp[(1) - (1)].UInt64Val); - ;} - break; - - case 26: -#line 1852 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.IPred) = ICmpInst::ICMP_EQ; ;} - break; - - case 27: -#line 1852 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.IPred) = ICmpInst::ICMP_NE; ;} - break; - - case 28: -#line 1853 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.IPred) = ICmpInst::ICMP_SLT; ;} - break; - - case 29: -#line 1853 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.IPred) = ICmpInst::ICMP_SGT; ;} - break; - - case 30: -#line 1854 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.IPred) = ICmpInst::ICMP_SLE; ;} - break; - - case 31: -#line 1854 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.IPred) = ICmpInst::ICMP_SGE; ;} - break; - - case 32: -#line 1855 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.IPred) = ICmpInst::ICMP_ULT; ;} - break; - - case 33: -#line 1855 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.IPred) = ICmpInst::ICMP_UGT; ;} - break; - - case 34: -#line 1856 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.IPred) = ICmpInst::ICMP_ULE; ;} - break; - - case 35: -#line 1856 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.IPred) = ICmpInst::ICMP_UGE; ;} - break; - - case 36: -#line 1860 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.FPred) = FCmpInst::FCMP_OEQ; ;} - break; - - case 37: -#line 1860 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.FPred) = FCmpInst::FCMP_ONE; ;} - break; - - case 38: -#line 1861 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.FPred) = FCmpInst::FCMP_OLT; ;} - break; - - case 39: -#line 1861 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.FPred) = FCmpInst::FCMP_OGT; ;} - break; - - case 40: -#line 1862 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.FPred) = FCmpInst::FCMP_OLE; ;} - break; - - case 41: -#line 1862 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.FPred) = FCmpInst::FCMP_OGE; ;} - break; - - case 42: -#line 1863 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.FPred) = FCmpInst::FCMP_ORD; ;} - break; - - case 43: -#line 1863 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.FPred) = FCmpInst::FCMP_UNO; ;} - break; - - case 44: -#line 1864 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.FPred) = FCmpInst::FCMP_UEQ; ;} - break; - - case 45: -#line 1864 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.FPred) = FCmpInst::FCMP_UNE; ;} - break; - - case 46: -#line 1865 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.FPred) = FCmpInst::FCMP_ULT; ;} - break; - - case 47: -#line 1865 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.FPred) = FCmpInst::FCMP_UGT; ;} - break; - - case 48: -#line 1866 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.FPred) = FCmpInst::FCMP_ULE; ;} - break; - - case 49: -#line 1866 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.FPred) = FCmpInst::FCMP_UGE; ;} - break; - - case 50: -#line 1867 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.FPred) = FCmpInst::FCMP_TRUE; ;} - break; - - case 51: -#line 1868 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.FPred) = FCmpInst::FCMP_FALSE; ;} - break; - - case 81: -#line 1899 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal); - ;} - break; - - case 82: -#line 1902 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.StrVal) = 0; - ;} - break; - - case 83: -#line 1907 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} - break; + switch (yyn) { - case 84: -#line 1908 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} - break; - - case 85: -#line 1909 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} - break; - - case 86: -#line 1910 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} - break; - - case 87: -#line 1911 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} - break; - - case 88: -#line 1912 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} - break; - - case 89: -#line 1913 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} - break; - - case 90: -#line 1914 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} - break; - - case 91: -#line 1918 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.UIntVal) = lastCallingConv = OldCallingConv::C; ;} - break; - - case 92: -#line 1919 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.UIntVal) = lastCallingConv = OldCallingConv::C; ;} - break; - - case 93: -#line 1920 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.UIntVal) = lastCallingConv = OldCallingConv::CSRet; ;} - break; - - case 94: -#line 1921 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.UIntVal) = lastCallingConv = OldCallingConv::Fast; ;} - break; - - case 95: -#line 1922 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.UIntVal) = lastCallingConv = OldCallingConv::Cold; ;} - break; - - case 96: -#line 1923 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.UIntVal) = lastCallingConv = OldCallingConv::X86_StdCall; ;} - break; - - case 97: -#line 1924 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.UIntVal) = lastCallingConv = OldCallingConv::X86_FastCall; ;} - break; - - case 98: -#line 1925 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val)) +case 2: +#line 1822 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + if (yyvsp[0].UIntVal > (uint32_t)INT32_MAX) // Outside of my range! + error("Value too large for type"); + yyval.SIntVal = (int32_t)yyvsp[0].UIntVal; + ; + break;} +case 4: +#line 1831 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + if (yyvsp[0].UInt64Val > (uint64_t)INT64_MAX) // Outside of my range! + error("Value too large for type"); + yyval.SInt64Val = (int64_t)yyvsp[0].UInt64Val; + ; + break;} +case 25: +#line 1853 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.IPred = ICmpInst::ICMP_EQ; ; + break;} +case 26: +#line 1853 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.IPred = ICmpInst::ICMP_NE; ; + break;} +case 27: +#line 1854 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.IPred = ICmpInst::ICMP_SLT; ; + break;} +case 28: +#line 1854 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.IPred = ICmpInst::ICMP_SGT; ; + break;} +case 29: +#line 1855 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.IPred = ICmpInst::ICMP_SLE; ; + break;} +case 30: +#line 1855 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.IPred = ICmpInst::ICMP_SGE; ; + break;} +case 31: +#line 1856 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.IPred = ICmpInst::ICMP_ULT; ; + break;} +case 32: +#line 1856 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.IPred = ICmpInst::ICMP_UGT; ; + break;} +case 33: +#line 1857 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.IPred = ICmpInst::ICMP_ULE; ; + break;} +case 34: +#line 1857 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.IPred = ICmpInst::ICMP_UGE; ; + break;} +case 35: +#line 1861 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.FPred = FCmpInst::FCMP_OEQ; ; + break;} +case 36: +#line 1861 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.FPred = FCmpInst::FCMP_ONE; ; + break;} +case 37: +#line 1862 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.FPred = FCmpInst::FCMP_OLT; ; + break;} +case 38: +#line 1862 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.FPred = FCmpInst::FCMP_OGT; ; + break;} +case 39: +#line 1863 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.FPred = FCmpInst::FCMP_OLE; ; + break;} +case 40: +#line 1863 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.FPred = FCmpInst::FCMP_OGE; ; + break;} +case 41: +#line 1864 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.FPred = FCmpInst::FCMP_ORD; ; + break;} +case 42: +#line 1864 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.FPred = FCmpInst::FCMP_UNO; ; + break;} +case 43: +#line 1865 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.FPred = FCmpInst::FCMP_UEQ; ; + break;} +case 44: +#line 1865 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.FPred = FCmpInst::FCMP_UNE; ; + break;} +case 45: +#line 1866 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.FPred = FCmpInst::FCMP_ULT; ; + break;} +case 46: +#line 1866 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.FPred = FCmpInst::FCMP_UGT; ; + break;} +case 47: +#line 1867 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.FPred = FCmpInst::FCMP_ULE; ; + break;} +case 48: +#line 1867 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.FPred = FCmpInst::FCMP_UGE; ; + break;} +case 49: +#line 1868 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.FPred = FCmpInst::FCMP_TRUE; ; + break;} +case 50: +#line 1869 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.FPred = FCmpInst::FCMP_FALSE; ; + break;} +case 80: +#line 1900 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.StrVal = yyvsp[-1].StrVal; + ; + break;} +case 81: +#line 1903 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.StrVal = 0; + ; + break;} +case 82: +#line 1908 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.Linkage = GlobalValue::InternalLinkage; ; + break;} +case 83: +#line 1909 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.Linkage = GlobalValue::LinkOnceLinkage; ; + break;} +case 84: +#line 1910 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.Linkage = GlobalValue::WeakLinkage; ; + break;} +case 85: +#line 1911 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.Linkage = GlobalValue::AppendingLinkage; ; + break;} +case 86: +#line 1912 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.Linkage = GlobalValue::DLLImportLinkage; ; + break;} +case 87: +#line 1913 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.Linkage = GlobalValue::DLLExportLinkage; ; + break;} +case 88: +#line 1914 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.Linkage = GlobalValue::ExternalWeakLinkage; ; + break;} +case 89: +#line 1915 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.Linkage = GlobalValue::ExternalLinkage; ; + break;} +case 90: +#line 1919 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.UIntVal = lastCallingConv = OldCallingConv::C; ; + break;} +case 91: +#line 1920 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.UIntVal = lastCallingConv = OldCallingConv::C; ; + break;} +case 92: +#line 1921 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.UIntVal = lastCallingConv = OldCallingConv::CSRet; ; + break;} +case 93: +#line 1922 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.UIntVal = lastCallingConv = OldCallingConv::Fast; ; + break;} +case 94: +#line 1923 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.UIntVal = lastCallingConv = OldCallingConv::Cold; ; + break;} +case 95: +#line 1924 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.UIntVal = lastCallingConv = OldCallingConv::X86_StdCall; ; + break;} +case 96: +#line 1925 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.UIntVal = lastCallingConv = OldCallingConv::X86_FastCall; ; + break;} +case 97: +#line 1926 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + if ((unsigned)yyvsp[0].UInt64Val != yyvsp[0].UInt64Val) error("Calling conv too large"); - (yyval.UIntVal) = lastCallingConv = (yyvsp[(2) - (2)].UInt64Val); - ;} - break; - - case 99: -#line 1935 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.UIntVal) = 0; ;} - break; - - case 100: -#line 1936 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val); - if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) + yyval.UIntVal = lastCallingConv = yyvsp[0].UInt64Val; + ; + break;} +case 98: +#line 1936 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.UIntVal = 0; ; + break;} +case 99: +#line 1937 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.UIntVal = yyvsp[0].UInt64Val; + if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal)) error("Alignment must be a power of two"); - ;} - break; - - case 101: -#line 1944 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.UIntVal) = 0; ;} - break; - - case 102: -#line 1945 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val); - if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) + ; + break;} +case 100: +#line 1945 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.UIntVal = 0; ; + break;} +case 101: +#line 1946 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.UIntVal = yyvsp[0].UInt64Val; + if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal)) error("Alignment must be a power of two"); - ;} - break; - - case 103: -#line 1953 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - for (unsigned i = 0, e = strlen((yyvsp[(2) - (2)].StrVal)); i != e; ++i) - if ((yyvsp[(2) - (2)].StrVal)[i] == '"' || (yyvsp[(2) - (2)].StrVal)[i] == '\\') + ; + break;} +case 102: +#line 1954 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + for (unsigned i = 0, e = strlen(yyvsp[0].StrVal); i != e; ++i) + if (yyvsp[0].StrVal[i] == '"' || yyvsp[0].StrVal[i] == '\\') error("Invalid character in section name"); - (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal); - ;} - break; - - case 104: -#line 1962 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.StrVal) = 0; ;} - break; - - case 105: -#line 1963 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;} - break; - - case 106: -#line 1970 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - {;} - break; - - case 107: -#line 1971 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - {;} - break; - - case 108: -#line 1975 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - CurGV->setSection((yyvsp[(1) - (1)].StrVal)); - free((yyvsp[(1) - (1)].StrVal)); - ;} - break; - - case 109: -#line 1979 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val))) + yyval.StrVal = yyvsp[0].StrVal; + ; + break;} +case 103: +#line 1963 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.StrVal = 0; ; + break;} +case 104: +#line 1964 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.StrVal = yyvsp[0].StrVal; ; + break;} +case 105: +#line 1971 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{; + break;} +case 106: +#line 1972 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{; + break;} +case 107: +#line 1976 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + CurGV->setSection(yyvsp[0].StrVal); + free(yyvsp[0].StrVal); + ; + break;} +case 108: +#line 1980 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + if (yyvsp[0].UInt64Val != 0 && !isPowerOf2_32(yyvsp[0].UInt64Val)) error("Alignment must be a power of two"); - CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val)); + CurGV->setAlignment(yyvsp[0].UInt64Val); - ;} - break; - - case 111: -#line 1996 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.TypeVal).PAT = new PATypeHolder((yyvsp[(1) - (1)].PrimType).T); - (yyval.TypeVal).S.makeSignless(); - ;} - break; - - case 113: -#line 2004 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.TypeVal).PAT = new PATypeHolder((yyvsp[(1) - (1)].PrimType).T); - (yyval.TypeVal).S.makeSignless(); - ;} - break; - - case 114: -#line 2011 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { + ; + break;} +case 110: +#line 1997 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.TypeVal.PAT = new PATypeHolder(yyvsp[0].PrimType.T); + yyval.TypeVal.S.makeSignless(); + ; + break;} +case 112: +#line 2005 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.TypeVal.PAT = new PATypeHolder(yyvsp[0].PrimType.T); + yyval.TypeVal.S.makeSignless(); + ; + break;} +case 113: +#line 2012 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ if (!UpRefs.empty()) - error("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal).PAT)->getDescription()); - (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal); - ;} - break; - - case 127: -#line 2025 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.TypeVal).PAT = new PATypeHolder((yyvsp[(1) - (1)].PrimType).T); - (yyval.TypeVal).S.copy((yyvsp[(1) - (1)].PrimType).S); - ;} - break; - - case 128: -#line 2029 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.TypeVal).PAT = new PATypeHolder(OpaqueType::get()); - (yyval.TypeVal).S.makeSignless(); - ;} - break; - - case 129: -#line 2033 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { // Named types are also simple types... - (yyval.TypeVal).S.copy(getTypeSign((yyvsp[(1) - (1)].ValIDVal))); - const Type* tmp = getType((yyvsp[(1) - (1)].ValIDVal)); - (yyval.TypeVal).PAT = new PATypeHolder(tmp); - ;} - break; - - case 130: -#line 2038 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { // Type UpReference - if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) + error("Invalid upreference in type: " + (*yyvsp[0].TypeVal.PAT)->getDescription()); + yyval.TypeVal = yyvsp[0].TypeVal; + ; + break;} +case 126: +#line 2026 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.TypeVal.PAT = new PATypeHolder(yyvsp[0].PrimType.T); + yyval.TypeVal.S.copy(yyvsp[0].PrimType.S); + ; + break;} +case 127: +#line 2030 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.TypeVal.PAT = new PATypeHolder(OpaqueType::get()); + yyval.TypeVal.S.makeSignless(); + ; + break;} +case 128: +#line 2034 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ // Named types are also simple types... + yyval.TypeVal.S.copy(getTypeSign(yyvsp[0].ValIDVal)); + const Type* tmp = getType(yyvsp[0].ValIDVal); + yyval.TypeVal.PAT = new PATypeHolder(tmp); + ; + break;} +case 129: +#line 2039 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ // Type UpReference + if (yyvsp[0].UInt64Val > (uint64_t)~0U) error("Value out of range"); OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder - UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector... - (yyval.TypeVal).PAT = new PATypeHolder(OT); - (yyval.TypeVal).S.makeSignless(); + UpRefs.push_back(UpRefRecord((unsigned)yyvsp[0].UInt64Val, OT)); // Add to vector... + yyval.TypeVal.PAT = new PATypeHolder(OT); + yyval.TypeVal.S.makeSignless(); UR_OUT("New Upreference!\n"); - ;} - break; - - case 131: -#line 2047 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { // Function derived type? - (yyval.TypeVal).S.makeComposite((yyvsp[(1) - (4)].TypeVal).S); + ; + break;} +case 130: +#line 2048 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ // Function derived type? + yyval.TypeVal.S.makeComposite(yyvsp[-3].TypeVal.S); std::vector Params; - for (std::list::iterator I = (yyvsp[(3) - (4)].TypeList)->begin(), - E = (yyvsp[(3) - (4)].TypeList)->end(); I != E; ++I) { + for (std::list::iterator I = yyvsp[-1].TypeList->begin(), + E = yyvsp[-1].TypeList->end(); I != E; ++I) { Params.push_back(I->PAT->get()); - (yyval.TypeVal).S.add(I->S); + yyval.TypeVal.S.add(I->S); } bool isVarArg = Params.size() && Params.back() == Type::VoidTy; if (isVarArg) Params.pop_back(); @@ -4520,164 +3580,152 @@ } const FunctionType *FTy = - FunctionType::get((yyvsp[(1) - (4)].TypeVal).PAT->get(), Params, isVarArg); + FunctionType::get(yyvsp[-3].TypeVal.PAT->get(), Params, isVarArg); - (yyval.TypeVal).PAT = new PATypeHolder( HandleUpRefs(FTy, (yyval.TypeVal).S) ); - delete (yyvsp[(1) - (4)].TypeVal).PAT; // Delete the return type handle - delete (yyvsp[(3) - (4)].TypeList); // Delete the argument list - ;} - break; - - case 132: -#line 2074 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { // Sized array type? - (yyval.TypeVal).S.makeComposite((yyvsp[(4) - (5)].TypeVal).S); - (yyval.TypeVal).PAT = new PATypeHolder(HandleUpRefs(ArrayType::get((yyvsp[(4) - (5)].TypeVal).PAT->get(), - (unsigned)(yyvsp[(2) - (5)].UInt64Val)), (yyval.TypeVal).S)); - delete (yyvsp[(4) - (5)].TypeVal).PAT; - ;} - break; - - case 133: -#line 2080 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { // Vector type? - const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal).PAT->get(); - if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val)) + yyval.TypeVal.PAT = new PATypeHolder( HandleUpRefs(FTy, yyval.TypeVal.S) ); + delete yyvsp[-3].TypeVal.PAT; // Delete the return type handle + delete yyvsp[-1].TypeList; // Delete the argument list + ; + break;} +case 131: +#line 2075 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ // Sized array type? + yyval.TypeVal.S.makeComposite(yyvsp[-1].TypeVal.S); + yyval.TypeVal.PAT = new PATypeHolder(HandleUpRefs(ArrayType::get(yyvsp[-1].TypeVal.PAT->get(), + (unsigned)yyvsp[-3].UInt64Val), yyval.TypeVal.S)); + delete yyvsp[-1].TypeVal.PAT; + ; + break;} +case 132: +#line 2081 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ // Vector type? + const llvm::Type* ElemTy = yyvsp[-1].TypeVal.PAT->get(); + if ((unsigned)yyvsp[-3].UInt64Val != yyvsp[-3].UInt64Val) error("Unsigned result not equal to signed result"); if (!(ElemTy->isInteger() || ElemTy->isFloatingPoint())) error("Elements of a VectorType must be integer or floating point"); - if (!isPowerOf2_32((yyvsp[(2) - (5)].UInt64Val))) + if (!isPowerOf2_32(yyvsp[-3].UInt64Val)) error("VectorType length should be a power of 2"); - (yyval.TypeVal).S.makeComposite((yyvsp[(4) - (5)].TypeVal).S); - (yyval.TypeVal).PAT = new PATypeHolder(HandleUpRefs(VectorType::get(ElemTy, - (unsigned)(yyvsp[(2) - (5)].UInt64Val)), (yyval.TypeVal).S)); - delete (yyvsp[(4) - (5)].TypeVal).PAT; - ;} - break; - - case 134: -#line 2093 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { // Structure type? + yyval.TypeVal.S.makeComposite(yyvsp[-1].TypeVal.S); + yyval.TypeVal.PAT = new PATypeHolder(HandleUpRefs(VectorType::get(ElemTy, + (unsigned)yyvsp[-3].UInt64Val), yyval.TypeVal.S)); + delete yyvsp[-1].TypeVal.PAT; + ; + break;} +case 133: +#line 2094 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ // Structure type? std::vector Elements; - (yyval.TypeVal).S.makeComposite(); - for (std::list::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(), - E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I) { + yyval.TypeVal.S.makeComposite(); + for (std::list::iterator I = yyvsp[-1].TypeList->begin(), + E = yyvsp[-1].TypeList->end(); I != E; ++I) { Elements.push_back(I->PAT->get()); - (yyval.TypeVal).S.add(I->S); + yyval.TypeVal.S.add(I->S); } - (yyval.TypeVal).PAT = new PATypeHolder(HandleUpRefs(StructType::get(Elements), (yyval.TypeVal).S)); - delete (yyvsp[(2) - (3)].TypeList); - ;} - break; - - case 135: -#line 2104 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { // Empty structure type? - (yyval.TypeVal).PAT = new PATypeHolder(StructType::get(std::vector())); - (yyval.TypeVal).S.makeComposite(); - ;} - break; - - case 136: -#line 2108 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { // Packed Structure type? - (yyval.TypeVal).S.makeComposite(); + yyval.TypeVal.PAT = new PATypeHolder(HandleUpRefs(StructType::get(Elements), yyval.TypeVal.S)); + delete yyvsp[-1].TypeList; + ; + break;} +case 134: +#line 2105 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ // Empty structure type? + yyval.TypeVal.PAT = new PATypeHolder(StructType::get(std::vector())); + yyval.TypeVal.S.makeComposite(); + ; + break;} +case 135: +#line 2109 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ // Packed Structure type? + yyval.TypeVal.S.makeComposite(); std::vector Elements; - for (std::list::iterator I = (yyvsp[(3) - (5)].TypeList)->begin(), - E = (yyvsp[(3) - (5)].TypeList)->end(); I != E; ++I) { + for (std::list::iterator I = yyvsp[-2].TypeList->begin(), + E = yyvsp[-2].TypeList->end(); I != E; ++I) { Elements.push_back(I->PAT->get()); - (yyval.TypeVal).S.add(I->S); + yyval.TypeVal.S.add(I->S); delete I->PAT; } - (yyval.TypeVal).PAT = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true), - (yyval.TypeVal).S)); - delete (yyvsp[(3) - (5)].TypeList); - ;} - break; - - case 137: -#line 2121 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { // Empty packed structure type? - (yyval.TypeVal).PAT = new PATypeHolder(StructType::get(std::vector(),true)); - (yyval.TypeVal).S.makeComposite(); - ;} - break; - - case 138: -#line 2125 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { // Pointer type? - if ((yyvsp[(1) - (2)].TypeVal).PAT->get() == Type::LabelTy) + yyval.TypeVal.PAT = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true), + yyval.TypeVal.S)); + delete yyvsp[-2].TypeList; + ; + break;} +case 136: +#line 2122 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ // Empty packed structure type? + yyval.TypeVal.PAT = new PATypeHolder(StructType::get(std::vector(),true)); + yyval.TypeVal.S.makeComposite(); + ; + break;} +case 137: +#line 2126 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ // Pointer type? + if (yyvsp[-1].TypeVal.PAT->get() == Type::LabelTy) error("Cannot form a pointer to a basic block"); - (yyval.TypeVal).S.makeComposite((yyvsp[(1) - (2)].TypeVal).S); - (yyval.TypeVal).PAT = new PATypeHolder(HandleUpRefs(PointerType::get((yyvsp[(1) - (2)].TypeVal).PAT->get()), - (yyval.TypeVal).S)); - delete (yyvsp[(1) - (2)].TypeVal).PAT; - ;} - break; - - case 139: -#line 2139 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.TypeList) = new std::list(); - (yyval.TypeList)->push_back((yyvsp[(1) - (1)].TypeVal)); - ;} - break; - - case 140: -#line 2143 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back((yyvsp[(3) - (3)].TypeVal)); - ;} - break; - - case 142: -#line 2151 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { + yyval.TypeVal.S.makeComposite(yyvsp[-1].TypeVal.S); + yyval.TypeVal.PAT = new + PATypeHolder(HandleUpRefs(PointerType::getUnqual(yyvsp[-1].TypeVal.PAT->get()), + yyval.TypeVal.S)); + delete yyvsp[-1].TypeVal.PAT; + ; + break;} +case 138: +#line 2141 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.TypeList = new std::list(); + yyval.TypeList->push_back(yyvsp[0].TypeVal); + ; + break;} +case 139: +#line 2145 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + (yyval.TypeList=yyvsp[-2].TypeList)->push_back(yyvsp[0].TypeVal); + ; + break;} +case 141: +#line 2153 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ PATypeInfo VoidTI; VoidTI.PAT = new PATypeHolder(Type::VoidTy); VoidTI.S.makeSignless(); - ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(VoidTI); - ;} - break; - - case 143: -#line 2157 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.TypeList) = new std::list(); + (yyval.TypeList=yyvsp[-2].TypeList)->push_back(VoidTI); + ; + break;} +case 142: +#line 2159 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.TypeList = new std::list(); PATypeInfo VoidTI; VoidTI.PAT = new PATypeHolder(Type::VoidTy); VoidTI.S.makeSignless(); - (yyval.TypeList)->push_back(VoidTI); - ;} - break; - - case 144: -#line 2164 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.TypeList) = new std::list(); - ;} - break; - - case 145: -#line 2176 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { // Nonempty unsized arr - const ArrayType *ATy = dyn_cast((yyvsp[(1) - (4)].TypeVal).PAT->get()); + yyval.TypeList->push_back(VoidTI); + ; + break;} +case 143: +#line 2166 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.TypeList = new std::list(); + ; + break;} +case 144: +#line 2178 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ // Nonempty unsized arr + const ArrayType *ATy = dyn_cast(yyvsp[-3].TypeVal.PAT->get()); if (ATy == 0) error("Cannot make array constant with type: '" + - (yyvsp[(1) - (4)].TypeVal).PAT->get()->getDescription() + "'"); + yyvsp[-3].TypeVal.PAT->get()->getDescription() + "'"); const Type *ETy = ATy->getElementType(); int NumElements = ATy->getNumElements(); // Verify that we have the correct size... - if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size()) + if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size()) error("Type mismatch: constant sized array initialized with " + - utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " + + utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " + itostr(NumElements) + ""); // Verify all elements are correct type! std::vector Elems; - for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) { - Constant *C = (*(yyvsp[(3) - (4)].ConstVector))[i].C; + for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) { + Constant *C = (*yyvsp[-1].ConstVector)[i].C; const Type* ValTy = C->getType(); if (ETy != ValTy) error("Element #" + utostr(i) + " is not of type '" + @@ -4685,75 +3733,72 @@ ValTy->getDescription() + "'"); Elems.push_back(C); } - (yyval.ConstVal).C = ConstantArray::get(ATy, Elems); - (yyval.ConstVal).S.copy((yyvsp[(1) - (4)].TypeVal).S); - delete (yyvsp[(1) - (4)].TypeVal).PAT; - delete (yyvsp[(3) - (4)].ConstVector); - ;} - break; - - case 146: -#line 2206 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - const ArrayType *ATy = dyn_cast((yyvsp[(1) - (3)].TypeVal).PAT->get()); + yyval.ConstVal.C = ConstantArray::get(ATy, Elems); + yyval.ConstVal.S.copy(yyvsp[-3].TypeVal.S); + delete yyvsp[-3].TypeVal.PAT; + delete yyvsp[-1].ConstVector; + ; + break;} +case 145: +#line 2208 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + const ArrayType *ATy = dyn_cast(yyvsp[-2].TypeVal.PAT->get()); if (ATy == 0) error("Cannot make array constant with type: '" + - (yyvsp[(1) - (3)].TypeVal).PAT->get()->getDescription() + "'"); + yyvsp[-2].TypeVal.PAT->get()->getDescription() + "'"); int NumElements = ATy->getNumElements(); if (NumElements != -1 && NumElements != 0) error("Type mismatch: constant sized array initialized with 0" " arguments, but has size of " + itostr(NumElements) +""); - (yyval.ConstVal).C = ConstantArray::get(ATy, std::vector()); - (yyval.ConstVal).S.copy((yyvsp[(1) - (3)].TypeVal).S); - delete (yyvsp[(1) - (3)].TypeVal).PAT; - ;} - break; - - case 147: -#line 2219 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - const ArrayType *ATy = dyn_cast((yyvsp[(1) - (3)].TypeVal).PAT->get()); + yyval.ConstVal.C = ConstantArray::get(ATy, std::vector()); + yyval.ConstVal.S.copy(yyvsp[-2].TypeVal.S); + delete yyvsp[-2].TypeVal.PAT; + ; + break;} +case 146: +#line 2221 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + const ArrayType *ATy = dyn_cast(yyvsp[-2].TypeVal.PAT->get()); if (ATy == 0) error("Cannot make array constant with type: '" + - (yyvsp[(1) - (3)].TypeVal).PAT->get()->getDescription() + "'"); + yyvsp[-2].TypeVal.PAT->get()->getDescription() + "'"); int NumElements = ATy->getNumElements(); const Type *ETy = dyn_cast(ATy->getElementType()); if (!ETy || cast(ETy)->getBitWidth() != 8) error("String arrays require type i8, not '" + ETy->getDescription() + "'"); - char *EndStr = UnEscapeLexed((yyvsp[(3) - (3)].StrVal), true); - if (NumElements != -1 && NumElements != (EndStr-(yyvsp[(3) - (3)].StrVal))) + char *EndStr = UnEscapeLexed(yyvsp[0].StrVal, true); + if (NumElements != -1 && NumElements != (EndStr-yyvsp[0].StrVal)) error("Can't build string constant of size " + - itostr((int)(EndStr-(yyvsp[(3) - (3)].StrVal))) + " when array has size " + + itostr((int)(EndStr-yyvsp[0].StrVal)) + " when array has size " + itostr(NumElements) + ""); std::vector Vals; - for (char *C = (char *)(yyvsp[(3) - (3)].StrVal); C != (char *)EndStr; ++C) + for (char *C = (char *)yyvsp[0].StrVal; C != (char *)EndStr; ++C) Vals.push_back(ConstantInt::get(ETy, *C)); - free((yyvsp[(3) - (3)].StrVal)); - (yyval.ConstVal).C = ConstantArray::get(ATy, Vals); - (yyval.ConstVal).S.copy((yyvsp[(1) - (3)].TypeVal).S); - delete (yyvsp[(1) - (3)].TypeVal).PAT; - ;} - break; - - case 148: -#line 2242 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { // Nonempty unsized arr - const VectorType *PTy = dyn_cast((yyvsp[(1) - (4)].TypeVal).PAT->get()); + free(yyvsp[0].StrVal); + yyval.ConstVal.C = ConstantArray::get(ATy, Vals); + yyval.ConstVal.S.copy(yyvsp[-2].TypeVal.S); + delete yyvsp[-2].TypeVal.PAT; + ; + break;} +case 147: +#line 2244 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ // Nonempty unsized arr + const VectorType *PTy = dyn_cast(yyvsp[-3].TypeVal.PAT->get()); if (PTy == 0) error("Cannot make packed constant with type: '" + - (yyvsp[(1) - (4)].TypeVal).PAT->get()->getDescription() + "'"); + yyvsp[-3].TypeVal.PAT->get()->getDescription() + "'"); const Type *ETy = PTy->getElementType(); int NumElements = PTy->getNumElements(); // Verify that we have the correct size... - if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size()) + if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size()) error("Type mismatch: constant sized packed initialized with " + - utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " + + utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " + itostr(NumElements) + ""); // Verify all elements are correct type! std::vector Elems; - for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) { - Constant *C = (*(yyvsp[(3) - (4)].ConstVector))[i].C; + for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) { + Constant *C = (*yyvsp[-1].ConstVector)[i].C; const Type* ValTy = C->getType(); if (ETy != ValTy) error("Element #" + utostr(i) + " is not of type '" + @@ -4761,124 +3806,117 @@ ValTy->getDescription() + "'"); Elems.push_back(C); } - (yyval.ConstVal).C = ConstantVector::get(PTy, Elems); - (yyval.ConstVal).S.copy((yyvsp[(1) - (4)].TypeVal).S); - delete (yyvsp[(1) - (4)].TypeVal).PAT; - delete (yyvsp[(3) - (4)].ConstVector); - ;} - break; - - case 149: -#line 2270 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - const StructType *STy = dyn_cast((yyvsp[(1) - (4)].TypeVal).PAT->get()); + yyval.ConstVal.C = ConstantVector::get(PTy, Elems); + yyval.ConstVal.S.copy(yyvsp[-3].TypeVal.S); + delete yyvsp[-3].TypeVal.PAT; + delete yyvsp[-1].ConstVector; + ; + break;} +case 148: +#line 2272 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + const StructType *STy = dyn_cast(yyvsp[-3].TypeVal.PAT->get()); if (STy == 0) error("Cannot make struct constant with type: '" + - (yyvsp[(1) - (4)].TypeVal).PAT->get()->getDescription() + "'"); - if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes()) + yyvsp[-3].TypeVal.PAT->get()->getDescription() + "'"); + if (yyvsp[-1].ConstVector->size() != STy->getNumContainedTypes()) error("Illegal number of initializers for structure type"); // Check to ensure that constants are compatible with the type initializer! std::vector Fields; - for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i) { - Constant *C = (*(yyvsp[(3) - (4)].ConstVector))[i].C; + for (unsigned i = 0, e = yyvsp[-1].ConstVector->size(); i != e; ++i) { + Constant *C = (*yyvsp[-1].ConstVector)[i].C; if (C->getType() != STy->getElementType(i)) error("Expected type '" + STy->getElementType(i)->getDescription() + "' for element #" + utostr(i) + " of structure initializer"); Fields.push_back(C); } - (yyval.ConstVal).C = ConstantStruct::get(STy, Fields); - (yyval.ConstVal).S.copy((yyvsp[(1) - (4)].TypeVal).S); - delete (yyvsp[(1) - (4)].TypeVal).PAT; - delete (yyvsp[(3) - (4)].ConstVector); - ;} - break; - - case 150: -#line 2292 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - const StructType *STy = dyn_cast((yyvsp[(1) - (3)].TypeVal).PAT->get()); + yyval.ConstVal.C = ConstantStruct::get(STy, Fields); + yyval.ConstVal.S.copy(yyvsp[-3].TypeVal.S); + delete yyvsp[-3].TypeVal.PAT; + delete yyvsp[-1].ConstVector; + ; + break;} +case 149: +#line 2294 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + const StructType *STy = dyn_cast(yyvsp[-2].TypeVal.PAT->get()); if (STy == 0) error("Cannot make struct constant with type: '" + - (yyvsp[(1) - (3)].TypeVal).PAT->get()->getDescription() + "'"); + yyvsp[-2].TypeVal.PAT->get()->getDescription() + "'"); if (STy->getNumContainedTypes() != 0) error("Illegal number of initializers for structure type"); - (yyval.ConstVal).C = ConstantStruct::get(STy, std::vector()); - (yyval.ConstVal).S.copy((yyvsp[(1) - (3)].TypeVal).S); - delete (yyvsp[(1) - (3)].TypeVal).PAT; - ;} - break; - - case 151: -#line 2303 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - const StructType *STy = dyn_cast((yyvsp[(1) - (6)].TypeVal).PAT->get()); + yyval.ConstVal.C = ConstantStruct::get(STy, std::vector()); + yyval.ConstVal.S.copy(yyvsp[-2].TypeVal.S); + delete yyvsp[-2].TypeVal.PAT; + ; + break;} +case 150: +#line 2305 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + const StructType *STy = dyn_cast(yyvsp[-5].TypeVal.PAT->get()); if (STy == 0) error("Cannot make packed struct constant with type: '" + - (yyvsp[(1) - (6)].TypeVal).PAT->get()->getDescription() + "'"); - if ((yyvsp[(4) - (6)].ConstVector)->size() != STy->getNumContainedTypes()) + yyvsp[-5].TypeVal.PAT->get()->getDescription() + "'"); + if (yyvsp[-2].ConstVector->size() != STy->getNumContainedTypes()) error("Illegal number of initializers for packed structure type"); // Check to ensure that constants are compatible with the type initializer! std::vector Fields; - for (unsigned i = 0, e = (yyvsp[(4) - (6)].ConstVector)->size(); i != e; ++i) { - Constant *C = (*(yyvsp[(4) - (6)].ConstVector))[i].C; + for (unsigned i = 0, e = yyvsp[-2].ConstVector->size(); i != e; ++i) { + Constant *C = (*yyvsp[-2].ConstVector)[i].C; if (C->getType() != STy->getElementType(i)) error("Expected type '" + STy->getElementType(i)->getDescription() + "' for element #" + utostr(i) + " of packed struct initializer"); Fields.push_back(C); } - (yyval.ConstVal).C = ConstantStruct::get(STy, Fields); - (yyval.ConstVal).S.copy((yyvsp[(1) - (6)].TypeVal).S); - delete (yyvsp[(1) - (6)].TypeVal).PAT; - delete (yyvsp[(4) - (6)].ConstVector); - ;} - break; - - case 152: -#line 2325 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - const StructType *STy = dyn_cast((yyvsp[(1) - (5)].TypeVal).PAT->get()); + yyval.ConstVal.C = ConstantStruct::get(STy, Fields); + yyval.ConstVal.S.copy(yyvsp[-5].TypeVal.S); + delete yyvsp[-5].TypeVal.PAT; + delete yyvsp[-2].ConstVector; + ; + break;} +case 151: +#line 2327 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + const StructType *STy = dyn_cast(yyvsp[-4].TypeVal.PAT->get()); if (STy == 0) error("Cannot make packed struct constant with type: '" + - (yyvsp[(1) - (5)].TypeVal).PAT->get()->getDescription() + "'"); + yyvsp[-4].TypeVal.PAT->get()->getDescription() + "'"); if (STy->getNumContainedTypes() != 0) error("Illegal number of initializers for packed structure type"); - (yyval.ConstVal).C = ConstantStruct::get(STy, std::vector()); - (yyval.ConstVal).S.copy((yyvsp[(1) - (5)].TypeVal).S); - delete (yyvsp[(1) - (5)].TypeVal).PAT; - ;} - break; - - case 153: -#line 2336 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - const PointerType *PTy = dyn_cast((yyvsp[(1) - (2)].TypeVal).PAT->get()); + yyval.ConstVal.C = ConstantStruct::get(STy, std::vector()); + yyval.ConstVal.S.copy(yyvsp[-4].TypeVal.S); + delete yyvsp[-4].TypeVal.PAT; + ; + break;} +case 152: +#line 2338 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + const PointerType *PTy = dyn_cast(yyvsp[-1].TypeVal.PAT->get()); if (PTy == 0) error("Cannot make null pointer constant with type: '" + - (yyvsp[(1) - (2)].TypeVal).PAT->get()->getDescription() + "'"); - (yyval.ConstVal).C = ConstantPointerNull::get(PTy); - (yyval.ConstVal).S.copy((yyvsp[(1) - (2)].TypeVal).S); - delete (yyvsp[(1) - (2)].TypeVal).PAT; - ;} - break; - - case 154: -#line 2345 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.ConstVal).C = UndefValue::get((yyvsp[(1) - (2)].TypeVal).PAT->get()); - (yyval.ConstVal).S.copy((yyvsp[(1) - (2)].TypeVal).S); - delete (yyvsp[(1) - (2)].TypeVal).PAT; - ;} - break; - - case 155: -#line 2350 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - const PointerType *Ty = dyn_cast((yyvsp[(1) - (2)].TypeVal).PAT->get()); + yyvsp[-1].TypeVal.PAT->get()->getDescription() + "'"); + yyval.ConstVal.C = ConstantPointerNull::get(PTy); + yyval.ConstVal.S.copy(yyvsp[-1].TypeVal.S); + delete yyvsp[-1].TypeVal.PAT; + ; + break;} +case 153: +#line 2347 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.ConstVal.C = UndefValue::get(yyvsp[-1].TypeVal.PAT->get()); + yyval.ConstVal.S.copy(yyvsp[-1].TypeVal.S); + delete yyvsp[-1].TypeVal.PAT; + ; + break;} +case 154: +#line 2352 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + const PointerType *Ty = dyn_cast(yyvsp[-1].TypeVal.PAT->get()); if (Ty == 0) error("Global const reference must be a pointer type, not" + - (yyvsp[(1) - (2)].TypeVal).PAT->get()->getDescription()); + yyvsp[-1].TypeVal.PAT->get()->getDescription()); // ConstExprs can exist in the body of a function, thus creating // GlobalValues whenever they refer to a variable. Because we are in @@ -4889,8 +3927,8 @@ // Function *SavedCurFn = CurFun.CurrentFunction; CurFun.CurrentFunction = 0; - (yyvsp[(2) - (2)].ValIDVal).S.copy((yyvsp[(1) - (2)].TypeVal).S); - Value *V = getExistingValue(Ty, (yyvsp[(2) - (2)].ValIDVal)); + yyvsp[0].ValIDVal.S.copy(yyvsp[-1].TypeVal.S); + Value *V = getExistingValue(Ty, yyvsp[0].ValIDVal); CurFun.CurrentFunction = SavedCurFn; // If this is an initializer for a constant pointer, which is referencing a @@ -4903,14 +3941,14 @@ // First check to see if the forward references value is already created! PerModuleInfo::GlobalRefsType::iterator I = - CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal))); + CurModule.GlobalRefs.find(std::make_pair(PT, yyvsp[0].ValIDVal)); if (I != CurModule.GlobalRefs.end()) { V = I->second; // Placeholder already exists, use it... - (yyvsp[(2) - (2)].ValIDVal).destroy(); + yyvsp[0].ValIDVal.destroy(); } else { std::string Name; - if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::NameVal) Name = (yyvsp[(2) - (2)].ValIDVal).Name; + if (yyvsp[0].ValIDVal.Type == ValID::NameVal) Name = yyvsp[0].ValIDVal.Name; // Create the forward referenced global. GlobalValue *GV; @@ -4925,156 +3963,145 @@ } // Keep track of the fact that we have a forward ref to recycle it - CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV)); + CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, yyvsp[0].ValIDVal), GV)); V = GV; } } - (yyval.ConstVal).C = cast(V); - (yyval.ConstVal).S.copy((yyvsp[(1) - (2)].TypeVal).S); - delete (yyvsp[(1) - (2)].TypeVal).PAT; // Free the type handle - ;} - break; - - case 156: -#line 2409 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - if ((yyvsp[(1) - (2)].TypeVal).PAT->get() != (yyvsp[(2) - (2)].ConstVal).C->getType()) + yyval.ConstVal.C = cast(V); + yyval.ConstVal.S.copy(yyvsp[-1].TypeVal.S); + delete yyvsp[-1].TypeVal.PAT; // Free the type handle + ; + break;} +case 155: +#line 2411 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + if (yyvsp[-1].TypeVal.PAT->get() != yyvsp[0].ConstVal.C->getType()) error("Mismatched types for constant expression"); - (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal); - (yyval.ConstVal).S.copy((yyvsp[(1) - (2)].TypeVal).S); - delete (yyvsp[(1) - (2)].TypeVal).PAT; - ;} - break; - - case 157: -#line 2416 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - const Type *Ty = (yyvsp[(1) - (2)].TypeVal).PAT->get(); + yyval.ConstVal = yyvsp[0].ConstVal; + yyval.ConstVal.S.copy(yyvsp[-1].TypeVal.S); + delete yyvsp[-1].TypeVal.PAT; + ; + break;} +case 156: +#line 2418 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + const Type *Ty = yyvsp[-1].TypeVal.PAT->get(); if (isa(Ty) || Ty == Type::LabelTy || isa(Ty)) error("Cannot create a null initialized value of this type"); - (yyval.ConstVal).C = Constant::getNullValue(Ty); - (yyval.ConstVal).S.copy((yyvsp[(1) - (2)].TypeVal).S); - delete (yyvsp[(1) - (2)].TypeVal).PAT; - ;} - break; - - case 158: -#line 2424 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { // integral constants - const Type *Ty = (yyvsp[(1) - (2)].PrimType).T; - if (!ConstantInt::isValueValidForType(Ty, (yyvsp[(2) - (2)].SInt64Val))) + yyval.ConstVal.C = Constant::getNullValue(Ty); + yyval.ConstVal.S.copy(yyvsp[-1].TypeVal.S); + delete yyvsp[-1].TypeVal.PAT; + ; + break;} +case 157: +#line 2426 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ // integral constants + const Type *Ty = yyvsp[-1].PrimType.T; + if (!ConstantInt::isValueValidForType(Ty, yyvsp[0].SInt64Val)) error("Constant value doesn't fit in type"); - (yyval.ConstVal).C = ConstantInt::get(Ty, (yyvsp[(2) - (2)].SInt64Val)); - (yyval.ConstVal).S.makeSigned(); - ;} - break; - - case 159: -#line 2431 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { // integral constants - const Type *Ty = (yyvsp[(1) - (2)].PrimType).T; - if (!ConstantInt::isValueValidForType(Ty, (yyvsp[(2) - (2)].UInt64Val))) + yyval.ConstVal.C = ConstantInt::get(Ty, yyvsp[0].SInt64Val); + yyval.ConstVal.S.makeSigned(); + ; + break;} +case 158: +#line 2433 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ // integral constants + const Type *Ty = yyvsp[-1].PrimType.T; + if (!ConstantInt::isValueValidForType(Ty, yyvsp[0].UInt64Val)) error("Constant value doesn't fit in type"); - (yyval.ConstVal).C = ConstantInt::get(Ty, (yyvsp[(2) - (2)].UInt64Val)); - (yyval.ConstVal).S.makeUnsigned(); - ;} - break; - - case 160: -#line 2438 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { // Boolean constants - (yyval.ConstVal).C = ConstantInt::get(Type::Int1Ty, true); - (yyval.ConstVal).S.makeUnsigned(); - ;} - break; - - case 161: -#line 2442 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { // Boolean constants - (yyval.ConstVal).C = ConstantInt::get(Type::Int1Ty, false); - (yyval.ConstVal).S.makeUnsigned(); - ;} - break; - - case 162: -#line 2446 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { // Float & Double constants - if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType).T, *(yyvsp[(2) - (2)].FPVal))) + yyval.ConstVal.C = ConstantInt::get(Ty, yyvsp[0].UInt64Val); + yyval.ConstVal.S.makeUnsigned(); + ; + break;} +case 159: +#line 2440 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ // Boolean constants + yyval.ConstVal.C = ConstantInt::get(Type::Int1Ty, true); + yyval.ConstVal.S.makeUnsigned(); + ; + break;} +case 160: +#line 2444 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ // Boolean constants + yyval.ConstVal.C = ConstantInt::get(Type::Int1Ty, false); + yyval.ConstVal.S.makeUnsigned(); + ; + break;} +case 161: +#line 2448 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ // Float & Double constants + if (!ConstantFP::isValueValidForType(yyvsp[-1].PrimType.T, *yyvsp[0].FPVal)) error("Floating point constant invalid for type"); // Lexer has no type info, so builds all FP constants as double. // Fix this here. - if ((yyvsp[(1) - (2)].PrimType).T==Type::FloatTy) - (yyvsp[(2) - (2)].FPVal)->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven); - (yyval.ConstVal).C = ConstantFP::get((yyvsp[(1) - (2)].PrimType).T, *(yyvsp[(2) - (2)].FPVal)); - delete (yyvsp[(2) - (2)].FPVal); - (yyval.ConstVal).S.makeSignless(); - ;} - break; - - case 163: -#line 2460 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - const Type* SrcTy = (yyvsp[(3) - (6)].ConstVal).C->getType(); - const Type* DstTy = (yyvsp[(5) - (6)].TypeVal).PAT->get(); - Signedness SrcSign((yyvsp[(3) - (6)].ConstVal).S); - Signedness DstSign((yyvsp[(5) - (6)].TypeVal).S); + if (yyvsp[-1].PrimType.T==Type::FloatTy) + yyvsp[0].FPVal->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven); + yyval.ConstVal.C = ConstantFP::get(yyvsp[-1].PrimType.T, *yyvsp[0].FPVal); + delete yyvsp[0].FPVal; + yyval.ConstVal.S.makeSignless(); + ; + break;} +case 162: +#line 2462 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + const Type* SrcTy = yyvsp[-3].ConstVal.C->getType(); + const Type* DstTy = yyvsp[-1].TypeVal.PAT->get(); + Signedness SrcSign(yyvsp[-3].ConstVal.S); + Signedness DstSign(yyvsp[-1].TypeVal.S); if (!SrcTy->isFirstClassType()) error("cast constant expression from a non-primitive type: '" + SrcTy->getDescription() + "'"); if (!DstTy->isFirstClassType()) error("cast constant expression to a non-primitive type: '" + DstTy->getDescription() + "'"); - (yyval.ConstVal).C = cast(getCast((yyvsp[(1) - (6)].CastOpVal), (yyvsp[(3) - (6)].ConstVal).C, SrcSign, DstTy, DstSign)); - (yyval.ConstVal).S.copy(DstSign); - delete (yyvsp[(5) - (6)].TypeVal).PAT; - ;} - break; - - case 164: -#line 2475 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - const Type *Ty = (yyvsp[(3) - (5)].ConstVal).C->getType(); + yyval.ConstVal.C = cast(getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal.C, SrcSign, DstTy, DstSign)); + yyval.ConstVal.S.copy(DstSign); + delete yyvsp[-1].TypeVal.PAT; + ; + break;} +case 163: +#line 2477 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + const Type *Ty = yyvsp[-2].ConstVal.C->getType(); if (!isa(Ty)) error("GetElementPtr requires a pointer operand"); std::vector CIndices; - upgradeGEPCEIndices((yyvsp[(3) - (5)].ConstVal).C->getType(), (yyvsp[(4) - (5)].ValueList), CIndices); - - delete (yyvsp[(4) - (5)].ValueList); - (yyval.ConstVal).C = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal).C, &CIndices[0], CIndices.size()); - (yyval.ConstVal).S.copy(getElementSign((yyvsp[(3) - (5)].ConstVal), CIndices)); - ;} - break; + upgradeGEPCEIndices(yyvsp[-2].ConstVal.C->getType(), yyvsp[-1].ValueList, CIndices); - case 165: -#line 2487 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - if (!(yyvsp[(3) - (8)].ConstVal).C->getType()->isInteger() || - cast((yyvsp[(3) - (8)].ConstVal).C->getType())->getBitWidth() != 1) + delete yyvsp[-1].ValueList; + yyval.ConstVal.C = ConstantExpr::getGetElementPtr(yyvsp[-2].ConstVal.C, &CIndices[0], CIndices.size()); + yyval.ConstVal.S.copy(getElementSign(yyvsp[-2].ConstVal, CIndices)); + ; + break;} +case 164: +#line 2489 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + if (!yyvsp[-5].ConstVal.C->getType()->isInteger() || + cast(yyvsp[-5].ConstVal.C->getType())->getBitWidth() != 1) error("Select condition must be bool type"); - if ((yyvsp[(5) - (8)].ConstVal).C->getType() != (yyvsp[(7) - (8)].ConstVal).C->getType()) + if (yyvsp[-3].ConstVal.C->getType() != yyvsp[-1].ConstVal.C->getType()) error("Select operand types must match"); - (yyval.ConstVal).C = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal).C, (yyvsp[(5) - (8)].ConstVal).C, (yyvsp[(7) - (8)].ConstVal).C); - (yyval.ConstVal).S.copy((yyvsp[(5) - (8)].ConstVal).S); - ;} - break; - - case 166: -#line 2496 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - const Type *Ty = (yyvsp[(3) - (6)].ConstVal).C->getType(); - if (Ty != (yyvsp[(5) - (6)].ConstVal).C->getType()) + yyval.ConstVal.C = ConstantExpr::getSelect(yyvsp[-5].ConstVal.C, yyvsp[-3].ConstVal.C, yyvsp[-1].ConstVal.C); + yyval.ConstVal.S.copy(yyvsp[-3].ConstVal.S); + ; + break;} +case 165: +#line 2498 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + const Type *Ty = yyvsp[-3].ConstVal.C->getType(); + if (Ty != yyvsp[-1].ConstVal.C->getType()) error("Binary operator types must match"); // First, make sure we're dealing with the right opcode by upgrading from // obsolete versions. - Instruction::BinaryOps Opcode = getBinaryOp((yyvsp[(1) - (6)].BinaryOpVal), Ty, (yyvsp[(3) - (6)].ConstVal).S); + Instruction::BinaryOps Opcode = getBinaryOp(yyvsp[-5].BinaryOpVal, Ty, yyvsp[-3].ConstVal.S); // HACK: llvm 1.3 and earlier used to emit invalid pointer constant exprs. // To retain backward compatibility with these early compilers, we emit a // cast to the appropriate integer type automatically if we are in the // broken case. See PR424 for more information. if (!isa(Ty)) { - (yyval.ConstVal).C = ConstantExpr::get(Opcode, (yyvsp[(3) - (6)].ConstVal).C, (yyvsp[(5) - (6)].ConstVal).C); + yyval.ConstVal.C = ConstantExpr::get(Opcode, yyvsp[-3].ConstVal.C, yyvsp[-1].ConstVal.C); } else { const Type *IntPtrTy = 0; switch (CurModule.CurrentModule->getPointerSize()) { @@ -5082,165 +4109,147 @@ case Module::Pointer64: IntPtrTy = Type::Int64Ty; break; default: error("invalid pointer binary constant expr"); } - (yyval.ConstVal).C = ConstantExpr::get(Opcode, - ConstantExpr::getCast(Instruction::PtrToInt, (yyvsp[(3) - (6)].ConstVal).C, IntPtrTy), - ConstantExpr::getCast(Instruction::PtrToInt, (yyvsp[(5) - (6)].ConstVal).C, IntPtrTy)); - (yyval.ConstVal).C = ConstantExpr::getCast(Instruction::IntToPtr, (yyval.ConstVal).C, Ty); - } - (yyval.ConstVal).S.copy((yyvsp[(3) - (6)].ConstVal).S); - ;} - break; - - case 167: -#line 2524 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - const Type* Ty = (yyvsp[(3) - (6)].ConstVal).C->getType(); - if (Ty != (yyvsp[(5) - (6)].ConstVal).C->getType()) + yyval.ConstVal.C = ConstantExpr::get(Opcode, + ConstantExpr::getCast(Instruction::PtrToInt, yyvsp[-3].ConstVal.C, IntPtrTy), + ConstantExpr::getCast(Instruction::PtrToInt, yyvsp[-1].ConstVal.C, IntPtrTy)); + yyval.ConstVal.C = ConstantExpr::getCast(Instruction::IntToPtr, yyval.ConstVal.C, Ty); + } + yyval.ConstVal.S.copy(yyvsp[-3].ConstVal.S); + ; + break;} +case 166: +#line 2526 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + const Type* Ty = yyvsp[-3].ConstVal.C->getType(); + if (Ty != yyvsp[-1].ConstVal.C->getType()) error("Logical operator types must match"); if (!Ty->isInteger()) { if (!isa(Ty) || !cast(Ty)->getElementType()->isInteger()) error("Logical operator requires integer operands"); } - Instruction::BinaryOps Opcode = getBinaryOp((yyvsp[(1) - (6)].BinaryOpVal), Ty, (yyvsp[(3) - (6)].ConstVal).S); - (yyval.ConstVal).C = ConstantExpr::get(Opcode, (yyvsp[(3) - (6)].ConstVal).C, (yyvsp[(5) - (6)].ConstVal).C); - (yyval.ConstVal).S.copy((yyvsp[(3) - (6)].ConstVal).S); - ;} - break; - - case 168: -#line 2537 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - const Type* Ty = (yyvsp[(3) - (6)].ConstVal).C->getType(); - if (Ty != (yyvsp[(5) - (6)].ConstVal).C->getType()) + Instruction::BinaryOps Opcode = getBinaryOp(yyvsp[-5].BinaryOpVal, Ty, yyvsp[-3].ConstVal.S); + yyval.ConstVal.C = ConstantExpr::get(Opcode, yyvsp[-3].ConstVal.C, yyvsp[-1].ConstVal.C); + yyval.ConstVal.S.copy(yyvsp[-3].ConstVal.S); + ; + break;} +case 167: +#line 2539 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + const Type* Ty = yyvsp[-3].ConstVal.C->getType(); + if (Ty != yyvsp[-1].ConstVal.C->getType()) error("setcc operand types must match"); unsigned short pred; - Instruction::OtherOps Opcode = getCompareOp((yyvsp[(1) - (6)].BinaryOpVal), pred, Ty, (yyvsp[(3) - (6)].ConstVal).S); - (yyval.ConstVal).C = ConstantExpr::getCompare(Opcode, (yyvsp[(3) - (6)].ConstVal).C, (yyvsp[(5) - (6)].ConstVal).C); - (yyval.ConstVal).S.makeUnsigned(); - ;} - break; - - case 169: -#line 2546 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - if ((yyvsp[(4) - (7)].ConstVal).C->getType() != (yyvsp[(6) - (7)].ConstVal).C->getType()) + Instruction::OtherOps Opcode = getCompareOp(yyvsp[-5].BinaryOpVal, pred, Ty, yyvsp[-3].ConstVal.S); + yyval.ConstVal.C = ConstantExpr::getCompare(Opcode, yyvsp[-3].ConstVal.C, yyvsp[-1].ConstVal.C); + yyval.ConstVal.S.makeUnsigned(); + ; + break;} +case 168: +#line 2548 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + if (yyvsp[-3].ConstVal.C->getType() != yyvsp[-1].ConstVal.C->getType()) error("icmp operand types must match"); - (yyval.ConstVal).C = ConstantExpr::getCompare((yyvsp[(2) - (7)].IPred), (yyvsp[(4) - (7)].ConstVal).C, (yyvsp[(6) - (7)].ConstVal).C); - (yyval.ConstVal).S.makeUnsigned(); - ;} - break; - - case 170: -#line 2552 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - if ((yyvsp[(4) - (7)].ConstVal).C->getType() != (yyvsp[(6) - (7)].ConstVal).C->getType()) + yyval.ConstVal.C = ConstantExpr::getCompare(yyvsp[-5].IPred, yyvsp[-3].ConstVal.C, yyvsp[-1].ConstVal.C); + yyval.ConstVal.S.makeUnsigned(); + ; + break;} +case 169: +#line 2554 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + if (yyvsp[-3].ConstVal.C->getType() != yyvsp[-1].ConstVal.C->getType()) error("fcmp operand types must match"); - (yyval.ConstVal).C = ConstantExpr::getCompare((yyvsp[(2) - (7)].FPred), (yyvsp[(4) - (7)].ConstVal).C, (yyvsp[(6) - (7)].ConstVal).C); - (yyval.ConstVal).S.makeUnsigned(); - ;} - break; - - case 171: -#line 2558 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - if (!(yyvsp[(5) - (6)].ConstVal).C->getType()->isInteger() || - cast((yyvsp[(5) - (6)].ConstVal).C->getType())->getBitWidth() != 8) + yyval.ConstVal.C = ConstantExpr::getCompare(yyvsp[-5].FPred, yyvsp[-3].ConstVal.C, yyvsp[-1].ConstVal.C); + yyval.ConstVal.S.makeUnsigned(); + ; + break;} +case 170: +#line 2560 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + if (!yyvsp[-1].ConstVal.C->getType()->isInteger() || + cast(yyvsp[-1].ConstVal.C->getType())->getBitWidth() != 8) error("Shift count for shift constant must be unsigned byte"); - const Type* Ty = (yyvsp[(3) - (6)].ConstVal).C->getType(); - if (!(yyvsp[(3) - (6)].ConstVal).C->getType()->isInteger()) + const Type* Ty = yyvsp[-3].ConstVal.C->getType(); + if (!yyvsp[-3].ConstVal.C->getType()->isInteger()) error("Shift constant expression requires integer operand"); - Constant *ShiftAmt = ConstantExpr::getZExt((yyvsp[(5) - (6)].ConstVal).C, Ty); - (yyval.ConstVal).C = ConstantExpr::get(getBinaryOp((yyvsp[(1) - (6)].BinaryOpVal), Ty, (yyvsp[(3) - (6)].ConstVal).S), (yyvsp[(3) - (6)].ConstVal).C, ShiftAmt); - (yyval.ConstVal).S.copy((yyvsp[(3) - (6)].ConstVal).S); - ;} - break; - - case 172: -#line 2569 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal).C, (yyvsp[(5) - (6)].ConstVal).C)) + Constant *ShiftAmt = ConstantExpr::getZExt(yyvsp[-1].ConstVal.C, Ty); + yyval.ConstVal.C = ConstantExpr::get(getBinaryOp(yyvsp[-5].BinaryOpVal, Ty, yyvsp[-3].ConstVal.S), yyvsp[-3].ConstVal.C, ShiftAmt); + yyval.ConstVal.S.copy(yyvsp[-3].ConstVal.S); + ; + break;} +case 171: +#line 2571 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + if (!ExtractElementInst::isValidOperands(yyvsp[-3].ConstVal.C, yyvsp[-1].ConstVal.C)) error("Invalid extractelement operands"); - (yyval.ConstVal).C = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal).C, (yyvsp[(5) - (6)].ConstVal).C); - (yyval.ConstVal).S.copy((yyvsp[(3) - (6)].ConstVal).S.get(0)); - ;} - break; - - case 173: -#line 2575 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal).C, (yyvsp[(5) - (8)].ConstVal).C, (yyvsp[(7) - (8)].ConstVal).C)) + yyval.ConstVal.C = ConstantExpr::getExtractElement(yyvsp[-3].ConstVal.C, yyvsp[-1].ConstVal.C); + yyval.ConstVal.S.copy(yyvsp[-3].ConstVal.S.get(0)); + ; + break;} +case 172: +#line 2577 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + if (!InsertElementInst::isValidOperands(yyvsp[-5].ConstVal.C, yyvsp[-3].ConstVal.C, yyvsp[-1].ConstVal.C)) error("Invalid insertelement operands"); - (yyval.ConstVal).C = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal).C, (yyvsp[(5) - (8)].ConstVal).C, (yyvsp[(7) - (8)].ConstVal).C); - (yyval.ConstVal).S.copy((yyvsp[(3) - (8)].ConstVal).S); - ;} - break; - - case 174: -#line 2581 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal).C, (yyvsp[(5) - (8)].ConstVal).C, (yyvsp[(7) - (8)].ConstVal).C)) + yyval.ConstVal.C = ConstantExpr::getInsertElement(yyvsp[-5].ConstVal.C, yyvsp[-3].ConstVal.C, yyvsp[-1].ConstVal.C); + yyval.ConstVal.S.copy(yyvsp[-5].ConstVal.S); + ; + break;} +case 173: +#line 2583 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + if (!ShuffleVectorInst::isValidOperands(yyvsp[-5].ConstVal.C, yyvsp[-3].ConstVal.C, yyvsp[-1].ConstVal.C)) error("Invalid shufflevector operands"); - (yyval.ConstVal).C = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal).C, (yyvsp[(5) - (8)].ConstVal).C, (yyvsp[(7) - (8)].ConstVal).C); - (yyval.ConstVal).S.copy((yyvsp[(3) - (8)].ConstVal).S); - ;} - break; - - case 175: -#line 2592 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal)); ;} - break; - - case 176: -#line 2593 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.ConstVector) = new std::vector(); - (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal)); - ;} - break; - - case 177: -#line 2602 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.BoolVal) = false; ;} - break; - - case 178: -#line 2603 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.BoolVal) = true; ;} - break; - - case 179: -#line 2615 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.ModuleVal) = ParserResult = (yyvsp[(1) - (1)].ModuleVal); + yyval.ConstVal.C = ConstantExpr::getShuffleVector(yyvsp[-5].ConstVal.C, yyvsp[-3].ConstVal.C, yyvsp[-1].ConstVal.C); + yyval.ConstVal.S.copy(yyvsp[-5].ConstVal.S); + ; + break;} +case 174: +#line 2594 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(yyvsp[0].ConstVal); ; + break;} +case 175: +#line 2595 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.ConstVector = new std::vector(); + yyval.ConstVector->push_back(yyvsp[0].ConstVal); + ; + break;} +case 176: +#line 2604 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.BoolVal = false; ; + break;} +case 177: +#line 2605 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.BoolVal = true; ; + break;} +case 178: +#line 2617 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.ModuleVal = ParserResult = yyvsp[0].ModuleVal; CurModule.ModuleDone(); - ;} - break; - - case 180: -#line 2624 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.ModuleVal) = (yyvsp[(1) - (2)].ModuleVal); CurFun.FunctionDone(); ;} - break; - - case 181: -#line 2625 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.ModuleVal) = (yyvsp[(1) - (2)].ModuleVal); ;} - break; - - case 182: -#line 2626 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.ModuleVal) = (yyvsp[(1) - (4)].ModuleVal); ;} - break; - - case 183: -#line 2627 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.ModuleVal) = (yyvsp[(1) - (2)].ModuleVal); ;} - break; - - case 184: -#line 2628 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.ModuleVal) = CurModule.CurrentModule; + ; + break;} +case 179: +#line 2626 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.ModuleVal = yyvsp[-1].ModuleVal; CurFun.FunctionDone(); ; + break;} +case 180: +#line 2627 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.ModuleVal = yyvsp[-1].ModuleVal; ; + break;} +case 181: +#line 2628 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.ModuleVal = yyvsp[-3].ModuleVal; ; + break;} +case 182: +#line 2629 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.ModuleVal = yyvsp[-1].ModuleVal; ; + break;} +case 183: +#line 2630 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.ModuleVal = CurModule.CurrentModule; // Emit an error if there are any unresolved types left. if (!CurModule.LateResolveTypes.empty()) { const ValID &DID = CurModule.LateResolveTypes.begin()->first; @@ -5250,12 +4259,11 @@ error("Reference to an undefined type: #" + itostr(DID.Num)); } } - ;} - break; - - case 185: -#line 2644 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { + ; + break;} +case 184: +#line 2646 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ // Eagerly resolve types. This is not an optimization, this is a // requirement that is due to the fact that we could have this: // @@ -5265,288 +4273,256 @@ // If types are not resolved eagerly, then the two types will not be // determined to be the same type! // - ResolveTypeTo((yyvsp[(2) - (4)].StrVal), (yyvsp[(4) - (4)].TypeVal).PAT->get(), (yyvsp[(4) - (4)].TypeVal).S); + ResolveTypeTo(yyvsp[-2].StrVal, yyvsp[0].TypeVal.PAT->get(), yyvsp[0].TypeVal.S); - if (!setTypeName((yyvsp[(4) - (4)].TypeVal), (yyvsp[(2) - (4)].StrVal)) && !(yyvsp[(2) - (4)].StrVal)) { + if (!setTypeName(yyvsp[0].TypeVal, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) { // If this is a numbered type that is not a redefinition, add it to the // slot table. - CurModule.Types.push_back((yyvsp[(4) - (4)].TypeVal).PAT->get()); - CurModule.TypeSigns.push_back((yyvsp[(4) - (4)].TypeVal).S); + CurModule.Types.push_back(yyvsp[0].TypeVal.PAT->get()); + CurModule.TypeSigns.push_back(yyvsp[0].TypeVal.S); } - delete (yyvsp[(4) - (4)].TypeVal).PAT; - ;} - break; - - case 186: -#line 2664 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { // Function prototypes can be in const pool - ;} - break; - - case 187: -#line 2666 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { // Asm blocks can be in the const pool - ;} - break; - - case 188: -#line 2668 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - if ((yyvsp[(5) - (5)].ConstVal).C == 0) + delete yyvsp[0].TypeVal.PAT; + ; + break;} +case 185: +#line 2666 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ // Function prototypes can be in const pool + ; + break;} +case 186: +#line 2668 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ // Asm blocks can be in the const pool + ; + break;} +case 187: +#line 2670 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + if (yyvsp[0].ConstVal.C == 0) error("Global value initializer is not a constant"); - CurGV = ParseGlobalVariable((yyvsp[(2) - (5)].StrVal), (yyvsp[(3) - (5)].Linkage), (yyvsp[(4) - (5)].BoolVal), (yyvsp[(5) - (5)].ConstVal).C->getType(), (yyvsp[(5) - (5)].ConstVal).C, (yyvsp[(5) - (5)].ConstVal).S); - ;} - break; - - case 189: -#line 2672 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { + CurGV = ParseGlobalVariable(yyvsp[-3].StrVal, yyvsp[-2].Linkage, yyvsp[-1].BoolVal, yyvsp[0].ConstVal.C->getType(), yyvsp[0].ConstVal.C, yyvsp[0].ConstVal.S); + ; + break;} +case 188: +#line 2674 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ CurGV = 0; - ;} - break; - - case 190: -#line 2675 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - const Type *Ty = (yyvsp[(5) - (5)].TypeVal).PAT->get(); - CurGV = ParseGlobalVariable((yyvsp[(2) - (5)].StrVal), GlobalValue::ExternalLinkage, (yyvsp[(4) - (5)].BoolVal), Ty, 0, - (yyvsp[(5) - (5)].TypeVal).S); - delete (yyvsp[(5) - (5)].TypeVal).PAT; - ;} - break; - - case 191: -#line 2680 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { + ; + break;} +case 189: +#line 2677 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + const Type *Ty = yyvsp[0].TypeVal.PAT->get(); + CurGV = ParseGlobalVariable(yyvsp[-3].StrVal, GlobalValue::ExternalLinkage, yyvsp[-1].BoolVal, Ty, 0, + yyvsp[0].TypeVal.S); + delete yyvsp[0].TypeVal.PAT; + ; + break;} +case 190: +#line 2682 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ CurGV = 0; - ;} - break; - - case 192: -#line 2683 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - const Type *Ty = (yyvsp[(5) - (5)].TypeVal).PAT->get(); - CurGV = ParseGlobalVariable((yyvsp[(2) - (5)].StrVal), GlobalValue::DLLImportLinkage, (yyvsp[(4) - (5)].BoolVal), Ty, 0, - (yyvsp[(5) - (5)].TypeVal).S); - delete (yyvsp[(5) - (5)].TypeVal).PAT; - ;} - break; - - case 193: -#line 2688 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { + ; + break;} +case 191: +#line 2685 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + const Type *Ty = yyvsp[0].TypeVal.PAT->get(); + CurGV = ParseGlobalVariable(yyvsp[-3].StrVal, GlobalValue::DLLImportLinkage, yyvsp[-1].BoolVal, Ty, 0, + yyvsp[0].TypeVal.S); + delete yyvsp[0].TypeVal.PAT; + ; + break;} +case 192: +#line 2690 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ CurGV = 0; - ;} - break; - - case 194: -#line 2691 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - const Type *Ty = (yyvsp[(5) - (5)].TypeVal).PAT->get(); + ; + break;} +case 193: +#line 2693 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + const Type *Ty = yyvsp[0].TypeVal.PAT->get(); CurGV = - ParseGlobalVariable((yyvsp[(2) - (5)].StrVal), GlobalValue::ExternalWeakLinkage, (yyvsp[(4) - (5)].BoolVal), Ty, 0, - (yyvsp[(5) - (5)].TypeVal).S); - delete (yyvsp[(5) - (5)].TypeVal).PAT; - ;} - break; - - case 195: -#line 2697 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { + ParseGlobalVariable(yyvsp[-3].StrVal, GlobalValue::ExternalWeakLinkage, yyvsp[-1].BoolVal, Ty, 0, + yyvsp[0].TypeVal.S); + delete yyvsp[0].TypeVal.PAT; + ; + break;} +case 194: +#line 2699 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ CurGV = 0; - ;} - break; - - case 196: -#line 2700 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - ;} - break; - - case 197: -#line 2702 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - ;} - break; - - case 198: -#line 2704 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - ;} - break; - - case 199: -#line 2709 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { + ; + break;} +case 195: +#line 2702 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + ; + break;} +case 196: +#line 2704 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + ; + break;} +case 197: +#line 2706 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + ; + break;} +case 198: +#line 2711 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); - char *EndStr = UnEscapeLexed((yyvsp[(1) - (1)].StrVal), true); - std::string NewAsm((yyvsp[(1) - (1)].StrVal), EndStr); - free((yyvsp[(1) - (1)].StrVal)); + char *EndStr = UnEscapeLexed(yyvsp[0].StrVal, true); + std::string NewAsm(yyvsp[0].StrVal, EndStr); + free(yyvsp[0].StrVal); if (AsmSoFar.empty()) CurModule.CurrentModule->setModuleInlineAsm(NewAsm); else CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm); - ;} - break; - - case 200: -#line 2723 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.Endianness) = Module::BigEndian; ;} - break; - - case 201: -#line 2724 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.Endianness) = Module::LittleEndian; ;} - break; - - case 202: -#line 2728 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - CurModule.setEndianness((yyvsp[(3) - (3)].Endianness)); - ;} - break; - - case 203: -#line 2731 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - if ((yyvsp[(3) - (3)].UInt64Val) == 32) + ; + break;} +case 199: +#line 2725 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.Endianness = Module::BigEndian; ; + break;} +case 200: +#line 2726 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.Endianness = Module::LittleEndian; ; + break;} +case 201: +#line 2730 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + CurModule.setEndianness(yyvsp[0].Endianness); + ; + break;} +case 202: +#line 2733 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + if (yyvsp[0].UInt64Val == 32) CurModule.setPointerSize(Module::Pointer32); - else if ((yyvsp[(3) - (3)].UInt64Val) == 64) + else if (yyvsp[0].UInt64Val == 64) CurModule.setPointerSize(Module::Pointer64); else - error("Invalid pointer size: '" + utostr((yyvsp[(3) - (3)].UInt64Val)) + "'"); - ;} - break; - - case 204: -#line 2739 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - CurModule.CurrentModule->setTargetTriple((yyvsp[(3) - (3)].StrVal)); - free((yyvsp[(3) - (3)].StrVal)); - ;} - break; - - case 205: -#line 2743 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - CurModule.CurrentModule->setDataLayout((yyvsp[(3) - (3)].StrVal)); - free((yyvsp[(3) - (3)].StrVal)); - ;} - break; - - case 207: -#line 2754 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - CurModule.CurrentModule->addLibrary((yyvsp[(3) - (3)].StrVal)); - free((yyvsp[(3) - (3)].StrVal)); - ;} - break; - - case 208: -#line 2758 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - CurModule.CurrentModule->addLibrary((yyvsp[(1) - (1)].StrVal)); - free((yyvsp[(1) - (1)].StrVal)); - ;} - break; - - case 209: -#line 2762 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { ;} - break; - - case 213: -#line 2775 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.StrVal) = 0; ;} - break; - - case 214: -#line 2779 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - if ((yyvsp[(1) - (2)].TypeVal).PAT->get() == Type::VoidTy) + error("Invalid pointer size: '" + utostr(yyvsp[0].UInt64Val) + "'"); + ; + break;} +case 203: +#line 2741 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + CurModule.CurrentModule->setTargetTriple(yyvsp[0].StrVal); + free(yyvsp[0].StrVal); + ; + break;} +case 204: +#line 2745 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + CurModule.CurrentModule->setDataLayout(yyvsp[0].StrVal); + free(yyvsp[0].StrVal); + ; + break;} +case 206: +#line 2756 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal); + free(yyvsp[0].StrVal); + ; + break;} +case 207: +#line 2760 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal); + free(yyvsp[0].StrVal); + ; + break;} +case 208: +#line 2764 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ ; + break;} +case 212: +#line 2777 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.StrVal = 0; ; + break;} +case 213: +#line 2781 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + if (yyvsp[-1].TypeVal.PAT->get() == Type::VoidTy) error("void typed arguments are invalid"); - (yyval.ArgVal) = new std::pair((yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].StrVal)); - ;} - break; - - case 215: -#line 2787 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList); - (yyval.ArgList)->push_back(*(yyvsp[(3) - (3)].ArgVal)); - delete (yyvsp[(3) - (3)].ArgVal); - ;} - break; - - case 216: -#line 2792 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.ArgList) = new std::vector >(); - (yyval.ArgList)->push_back(*(yyvsp[(1) - (1)].ArgVal)); - delete (yyvsp[(1) - (1)].ArgVal); - ;} - break; - - case 217: -#line 2800 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList); ;} - break; - - case 218: -#line 2801 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList); + yyval.ArgVal = new std::pair(yyvsp[-1].TypeVal, yyvsp[0].StrVal); + ; + break;} +case 214: +#line 2789 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.ArgList = yyvsp[-2].ArgList; + yyval.ArgList->push_back(*yyvsp[0].ArgVal); + delete yyvsp[0].ArgVal; + ; + break;} +case 215: +#line 2794 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.ArgList = new std::vector >(); + yyval.ArgList->push_back(*yyvsp[0].ArgVal); + delete yyvsp[0].ArgVal; + ; + break;} +case 216: +#line 2802 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.ArgList = yyvsp[0].ArgList; ; + break;} +case 217: +#line 2803 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.ArgList = yyvsp[-2].ArgList; PATypeInfo VoidTI; VoidTI.PAT = new PATypeHolder(Type::VoidTy); VoidTI.S.makeSignless(); - (yyval.ArgList)->push_back(std::pair(VoidTI, 0)); - ;} - break; - - case 219: -#line 2808 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.ArgList) = new std::vector >(); + yyval.ArgList->push_back(std::pair(VoidTI, 0)); + ; + break;} +case 218: +#line 2810 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.ArgList = new std::vector >(); PATypeInfo VoidTI; VoidTI.PAT = new PATypeHolder(Type::VoidTy); VoidTI.S.makeSignless(); - (yyval.ArgList)->push_back(std::pair(VoidTI, 0)); - ;} - break; - - case 220: -#line 2815 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.ArgList) = 0; ;} - break; - - case 221: -#line 2819 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - UnEscapeLexed((yyvsp[(3) - (8)].StrVal)); - std::string FunctionName((yyvsp[(3) - (8)].StrVal)); - free((yyvsp[(3) - (8)].StrVal)); // Free strdup'd memory! + yyval.ArgList->push_back(std::pair(VoidTI, 0)); + ; + break;} +case 219: +#line 2817 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.ArgList = 0; ; + break;} +case 220: +#line 2821 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + UnEscapeLexed(yyvsp[-5].StrVal); + std::string FunctionName(yyvsp[-5].StrVal); + free(yyvsp[-5].StrVal); // Free strdup'd memory! - const Type* RetTy = (yyvsp[(2) - (8)].TypeVal).PAT->get(); + const Type* RetTy = yyvsp[-6].TypeVal.PAT->get(); if (!RetTy->isFirstClassType() && RetTy != Type::VoidTy) error("LLVM functions cannot return aggregate types"); Signedness FTySign; - FTySign.makeComposite((yyvsp[(2) - (8)].TypeVal).S); + FTySign.makeComposite(yyvsp[-6].TypeVal.S); std::vector ParamTyList; // In LLVM 2.0 the signatures of three varargs intrinsics changed to take // i8*. We check here for those names and override the parameter list // types to ensure the prototype is correct. if (FunctionName == "llvm.va_start" || FunctionName == "llvm.va_end") { - ParamTyList.push_back(PointerType::get(Type::Int8Ty)); + ParamTyList.push_back(PointerType::getUnqual(Type::Int8Ty)); } else if (FunctionName == "llvm.va_copy") { - ParamTyList.push_back(PointerType::get(Type::Int8Ty)); - ParamTyList.push_back(PointerType::get(Type::Int8Ty)); - } else if ((yyvsp[(5) - (8)].ArgList)) { // If there are arguments... + ParamTyList.push_back(PointerType::getUnqual(Type::Int8Ty)); + ParamTyList.push_back(PointerType::getUnqual(Type::Int8Ty)); + } else if (yyvsp[-3].ArgList) { // If there are arguments... for (std::vector >::iterator - I = (yyvsp[(5) - (8)].ArgList)->begin(), E = (yyvsp[(5) - (8)].ArgList)->end(); I != E; ++I) { + I = yyvsp[-3].ArgList->begin(), E = yyvsp[-3].ArgList->end(); I != E; ++I) { const Type *Ty = I->first.PAT->get(); ParamTyList.push_back(Ty); FTySign.add(I->first.S); @@ -5558,8 +4534,8 @@ ParamTyList.pop_back(); const FunctionType *FT = FunctionType::get(RetTy, ParamTyList, isVarArg); - const PointerType *PFT = PointerType::get(FT); - delete (yyvsp[(2) - (8)].TypeVal).PAT; + const PointerType *PFT = PointerType::getUnqual(FT); + delete yyvsp[-6].TypeVal.PAT; ValID ID; if (!FunctionName.empty()) { @@ -5668,16 +4644,16 @@ // argument to another function. Fn->setLinkage(CurFun.Linkage); } - Fn->setCallingConv(upgradeCallingConv((yyvsp[(1) - (8)].UIntVal))); - Fn->setAlignment((yyvsp[(8) - (8)].UIntVal)); - if ((yyvsp[(7) - (8)].StrVal)) { - Fn->setSection((yyvsp[(7) - (8)].StrVal)); - free((yyvsp[(7) - (8)].StrVal)); + Fn->setCallingConv(upgradeCallingConv(yyvsp[-7].UIntVal)); + Fn->setAlignment(yyvsp[0].UIntVal); + if (yyvsp[-1].StrVal) { + Fn->setSection(yyvsp[-1].StrVal); + free(yyvsp[-1].StrVal); } // Convert the CSRet calling convention into the corresponding parameter // attribute. - if ((yyvsp[(1) - (8)].UIntVal) == OldCallingConv::CSRet) { + if (yyvsp[-7].UIntVal == OldCallingConv::CSRet) { ParamAttrsVector Attrs; ParamAttrsWithIndex PAWI; PAWI.index = 1; PAWI.attrs = ParamAttr::StructRet; // first arg @@ -5686,155 +4662,135 @@ } // Add all of the arguments we parsed to the function... - if ((yyvsp[(5) - (8)].ArgList)) { // Is null if empty... + if (yyvsp[-3].ArgList) { // Is null if empty... if (isVarArg) { // Nuke the last entry - assert((yyvsp[(5) - (8)].ArgList)->back().first.PAT->get() == Type::VoidTy && - (yyvsp[(5) - (8)].ArgList)->back().second == 0 && "Not a varargs marker"); - delete (yyvsp[(5) - (8)].ArgList)->back().first.PAT; - (yyvsp[(5) - (8)].ArgList)->pop_back(); // Delete the last entry + assert(yyvsp[-3].ArgList->back().first.PAT->get() == Type::VoidTy && + yyvsp[-3].ArgList->back().second == 0 && "Not a varargs marker"); + delete yyvsp[-3].ArgList->back().first.PAT; + yyvsp[-3].ArgList->pop_back(); // Delete the last entry } Function::arg_iterator ArgIt = Fn->arg_begin(); Function::arg_iterator ArgEnd = Fn->arg_end(); - std::vector >::iterator I = (yyvsp[(5) - (8)].ArgList)->begin(); - std::vector >::iterator E = (yyvsp[(5) - (8)].ArgList)->end(); + std::vector >::iterator I = yyvsp[-3].ArgList->begin(); + std::vector >::iterator E = yyvsp[-3].ArgList->end(); for ( ; I != E && ArgIt != ArgEnd; ++I, ++ArgIt) { delete I->first.PAT; // Delete the typeholder... ValueInfo VI; VI.V = ArgIt; VI.S.copy(I->first.S); setValueName(VI, I->second); // Insert arg into symtab... InsertValue(ArgIt); } - delete (yyvsp[(5) - (8)].ArgList); // We're now done with the argument list + delete yyvsp[-3].ArgList; // We're now done with the argument list } lastCallingConv = OldCallingConv::C; - ;} - break; - - case 224: -#line 3011 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { CurFun.Linkage = (yyvsp[(1) - (1)].Linkage); ;} - break; - - case 225: -#line 3011 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.FunctionVal) = CurFun.CurrentFunction; + ; + break;} +case 223: +#line 3013 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ CurFun.Linkage = yyvsp[0].Linkage; ; + break;} +case 224: +#line 3013 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.FunctionVal = CurFun.CurrentFunction; // Make sure that we keep track of the linkage type even if there was a // previous "declare". - (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (4)].Linkage)); - ;} - break; - - case 228: -#line 3025 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); - ;} - break; - - case 229: -#line 3030 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} - break; - - case 230: -#line 3031 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} - break; - - case 231: -#line 3032 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} - break; - - case 232: -#line 3036 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { CurFun.isDeclare = true; ;} - break; - - case 233: -#line 3037 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { CurFun.Linkage = (yyvsp[(3) - (3)].Linkage); ;} - break; - - case 234: -#line 3037 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.FunctionVal) = CurFun.CurrentFunction; + yyval.FunctionVal->setLinkage(yyvsp[-3].Linkage); + ; + break;} +case 227: +#line 3027 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.FunctionVal = yyvsp[-1].FunctionVal; + ; + break;} +case 228: +#line 3032 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.Linkage = GlobalValue::ExternalLinkage; ; + break;} +case 229: +#line 3033 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.Linkage = GlobalValue::DLLImportLinkage; ; + break;} +case 230: +#line 3034 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.Linkage = GlobalValue::ExternalWeakLinkage; ; + break;} +case 231: +#line 3038 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ CurFun.isDeclare = true; ; + break;} +case 232: +#line 3039 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ CurFun.Linkage = yyvsp[0].Linkage; ; + break;} +case 233: +#line 3039 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.FunctionVal = CurFun.CurrentFunction; CurFun.FunctionDone(); - ;} - break; - - case 235: -#line 3049 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.BoolVal) = false; ;} - break; - - case 236: -#line 3050 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.BoolVal) = true; ;} - break; - - case 237: -#line 3055 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val)); ;} - break; - - case 238: -#line 3056 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val)); ;} - break; - - case 239: -#line 3057 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal)); ;} - break; - - case 240: -#line 3058 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.ValIDVal) = ValID::create(ConstantInt::get(Type::Int1Ty, true)); - (yyval.ValIDVal).S.makeUnsigned(); - ;} - break; - - case 241: -#line 3062 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.ValIDVal) = ValID::create(ConstantInt::get(Type::Int1Ty, false)); - (yyval.ValIDVal).S.makeUnsigned(); - ;} - break; - - case 242: -#line 3066 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.ValIDVal) = ValID::createNull(); ;} - break; - - case 243: -#line 3067 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.ValIDVal) = ValID::createUndef(); ;} - break; - - case 244: -#line 3068 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.ValIDVal) = ValID::createZeroInit(); ;} - break; - - case 245: -#line 3069 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { // Nonempty unsized packed vector - const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0].C->getType(); - int NumElements = (yyvsp[(2) - (3)].ConstVector)->size(); + ; + break;} +case 234: +#line 3051 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.BoolVal = false; ; + break;} +case 235: +#line 3052 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.BoolVal = true; ; + break;} +case 236: +#line 3057 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val); ; + break;} +case 237: +#line 3058 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val); ; + break;} +case 238: +#line 3059 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.ValIDVal = ValID::create(yyvsp[0].FPVal); ; + break;} +case 239: +#line 3060 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.ValIDVal = ValID::create(ConstantInt::get(Type::Int1Ty, true)); + yyval.ValIDVal.S.makeUnsigned(); + ; + break;} +case 240: +#line 3064 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.ValIDVal = ValID::create(ConstantInt::get(Type::Int1Ty, false)); + yyval.ValIDVal.S.makeUnsigned(); + ; + break;} +case 241: +#line 3068 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.ValIDVal = ValID::createNull(); ; + break;} +case 242: +#line 3069 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.ValIDVal = ValID::createUndef(); ; + break;} +case 243: +#line 3070 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.ValIDVal = ValID::createZeroInit(); ; + break;} +case 244: +#line 3071 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ // Nonempty unsized packed vector + const Type *ETy = (*yyvsp[-1].ConstVector)[0].C->getType(); + int NumElements = yyvsp[-1].ConstVector->size(); VectorType* pt = VectorType::get(ETy, NumElements); - (yyval.ValIDVal).S.makeComposite((*(yyvsp[(2) - (3)].ConstVector))[0].S); - PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(pt, (yyval.ValIDVal).S)); + yyval.ValIDVal.S.makeComposite((*yyvsp[-1].ConstVector)[0].S); + PATypeHolder* PTy = new PATypeHolder(HandleUpRefs(pt, yyval.ValIDVal.S)); // Verify all elements are correct type! std::vector Elems; - for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) { - Constant *C = (*(yyvsp[(2) - (3)].ConstVector))[i].C; + for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) { + Constant *C = (*yyvsp[-1].ConstVector)[i].C; const Type *CTy = C->getType(); if (ETy != CTy) error("Element #" + utostr(i) + " is not of type '" + @@ -5842,202 +4798,184 @@ CTy->getDescription() + "'"); Elems.push_back(C); } - (yyval.ValIDVal) = ValID::create(ConstantVector::get(pt, Elems)); - delete PTy; delete (yyvsp[(2) - (3)].ConstVector); - ;} - break; - - case 246: -#line 3090 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal).C); - (yyval.ValIDVal).S.copy((yyvsp[(1) - (1)].ConstVal).S); - ;} - break; - - case 247: -#line 3094 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - char *End = UnEscapeLexed((yyvsp[(3) - (5)].StrVal), true); - std::string AsmStr = std::string((yyvsp[(3) - (5)].StrVal), End); - End = UnEscapeLexed((yyvsp[(5) - (5)].StrVal), true); - std::string Constraints = std::string((yyvsp[(5) - (5)].StrVal), End); - (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[(2) - (5)].BoolVal)); - free((yyvsp[(3) - (5)].StrVal)); - free((yyvsp[(5) - (5)].StrVal)); - ;} - break; - - case 248: -#line 3108 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SIntVal)); (yyval.ValIDVal).S.makeSignless(); ;} - break; - - case 249: -#line 3109 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].StrVal)); (yyval.ValIDVal).S.makeSignless(); ;} - break; - - case 252: -#line 3122 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - const Type *Ty = (yyvsp[(1) - (2)].TypeVal).PAT->get(); - (yyvsp[(2) - (2)].ValIDVal).S.copy((yyvsp[(1) - (2)].TypeVal).S); - (yyval.ValueVal).V = getVal(Ty, (yyvsp[(2) - (2)].ValIDVal)); - (yyval.ValueVal).S.copy((yyvsp[(1) - (2)].TypeVal).S); - delete (yyvsp[(1) - (2)].TypeVal).PAT; - ;} - break; - - case 253: -#line 3132 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); - ;} - break; - - case 254: -#line 3135 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { // Do not allow functions with 0 basic blocks - (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); - ;} - break; - - case 255: -#line 3144 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - ValueInfo VI; VI.V = (yyvsp[(3) - (3)].TermInstVal).TI; VI.S.copy((yyvsp[(3) - (3)].TermInstVal).S); - setValueName(VI, (yyvsp[(2) - (3)].StrVal)); - InsertValue((yyvsp[(3) - (3)].TermInstVal).TI); - (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal).TI); - InsertValue((yyvsp[(1) - (3)].BasicBlockVal)); - (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal); - ;} - break; - - case 256: -#line 3155 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - if ((yyvsp[(2) - (2)].InstVal).I) - (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal).I); - (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal); - ;} - break; - - case 257: -#line 3160 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((int)CurFun.NextBBNum++),true); + yyval.ValIDVal = ValID::create(ConstantVector::get(pt, Elems)); + delete PTy; delete yyvsp[-1].ConstVector; + ; + break;} +case 245: +#line 3092 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.ValIDVal = ValID::create(yyvsp[0].ConstVal.C); + yyval.ValIDVal.S.copy(yyvsp[0].ConstVal.S); + ; + break;} +case 246: +#line 3096 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + char *End = UnEscapeLexed(yyvsp[-2].StrVal, true); + std::string AsmStr = std::string(yyvsp[-2].StrVal, End); + End = UnEscapeLexed(yyvsp[0].StrVal, true); + std::string Constraints = std::string(yyvsp[0].StrVal, End); + yyval.ValIDVal = ValID::createInlineAsm(AsmStr, Constraints, yyvsp[-3].BoolVal); + free(yyvsp[-2].StrVal); + free(yyvsp[0].StrVal); + ; + break;} +case 247: +#line 3111 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.ValIDVal = ValID::create(yyvsp[0].SIntVal); yyval.ValIDVal.S.makeSignless(); ; + break;} +case 248: +#line 3112 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.ValIDVal = ValID::create(yyvsp[0].StrVal); yyval.ValIDVal.S.makeSignless(); ; + break;} +case 251: +#line 3125 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + const Type *Ty = yyvsp[-1].TypeVal.PAT->get(); + yyvsp[0].ValIDVal.S.copy(yyvsp[-1].TypeVal.S); + yyval.ValueVal.V = getVal(Ty, yyvsp[0].ValIDVal); + yyval.ValueVal.S.copy(yyvsp[-1].TypeVal.S); + delete yyvsp[-1].TypeVal.PAT; + ; + break;} +case 252: +#line 3135 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.FunctionVal = yyvsp[-1].FunctionVal; + ; + break;} +case 253: +#line 3138 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ // Do not allow functions with 0 basic blocks + yyval.FunctionVal = yyvsp[-1].FunctionVal; + ; + break;} +case 254: +#line 3147 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + ValueInfo VI; VI.V = yyvsp[0].TermInstVal.TI; VI.S.copy(yyvsp[0].TermInstVal.S); + setValueName(VI, yyvsp[-1].StrVal); + InsertValue(yyvsp[0].TermInstVal.TI); + yyvsp[-2].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal.TI); + InsertValue(yyvsp[-2].BasicBlockVal); + yyval.BasicBlockVal = yyvsp[-2].BasicBlockVal; + ; + break;} +case 255: +#line 3158 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + if (yyvsp[0].InstVal.I) + yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal.I); + yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal; + ; + break;} +case 256: +#line 3163 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.BasicBlockVal = CurBB = getBBVal(ValID::create((int)CurFun.NextBBNum++),true); // Make sure to move the basic block to the correct location in the // function, instead of leaving it inserted wherever it was first // referenced. Function::BasicBlockListType &BBL = CurFun.CurrentFunction->getBasicBlockList(); - BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal)); - ;} - break; - - case 258: -#line 3169 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((yyvsp[(1) - (1)].StrVal)), true); + BBL.splice(BBL.end(), BBL, yyval.BasicBlockVal); + ; + break;} +case 257: +#line 3172 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.BasicBlockVal = CurBB = getBBVal(ValID::create(yyvsp[0].StrVal), true); // Make sure to move the basic block to the correct location in the // function, instead of leaving it inserted wherever it was first // referenced. Function::BasicBlockListType &BBL = CurFun.CurrentFunction->getBasicBlockList(); - BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal)); - ;} - break; - - case 261: -#line 3183 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { // Return with a result... - (yyval.TermInstVal).TI = new ReturnInst((yyvsp[(2) - (2)].ValueVal).V); - (yyval.TermInstVal).S.makeSignless(); - ;} - break; - - case 262: -#line 3187 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { // Return with no result... - (yyval.TermInstVal).TI = new ReturnInst(); - (yyval.TermInstVal).S.makeSignless(); - ;} - break; - - case 263: -#line 3191 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { // Unconditional Branch... - BasicBlock* tmpBB = getBBVal((yyvsp[(3) - (3)].ValIDVal)); - (yyval.TermInstVal).TI = new BranchInst(tmpBB); - (yyval.TermInstVal).S.makeSignless(); - ;} - break; - - case 264: -#line 3196 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyvsp[(6) - (9)].ValIDVal).S.makeSignless(); - (yyvsp[(9) - (9)].ValIDVal).S.makeSignless(); - BasicBlock* tmpBBA = getBBVal((yyvsp[(6) - (9)].ValIDVal)); - BasicBlock* tmpBBB = getBBVal((yyvsp[(9) - (9)].ValIDVal)); - (yyvsp[(3) - (9)].ValIDVal).S.makeUnsigned(); - Value* tmpVal = getVal(Type::Int1Ty, (yyvsp[(3) - (9)].ValIDVal)); - (yyval.TermInstVal).TI = new BranchInst(tmpBBA, tmpBBB, tmpVal); - (yyval.TermInstVal).S.makeSignless(); - ;} - break; - - case 265: -#line 3206 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyvsp[(3) - (9)].ValIDVal).S.copy((yyvsp[(2) - (9)].PrimType).S); - Value* tmpVal = getVal((yyvsp[(2) - (9)].PrimType).T, (yyvsp[(3) - (9)].ValIDVal)); - (yyvsp[(6) - (9)].ValIDVal).S.makeSignless(); - BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (9)].ValIDVal)); - SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[(8) - (9)].JumpTable)->size()); - (yyval.TermInstVal).TI = S; - (yyval.TermInstVal).S.makeSignless(); - std::vector >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(), - E = (yyvsp[(8) - (9)].JumpTable)->end(); + BBL.splice(BBL.end(), BBL, yyval.BasicBlockVal); + ; + break;} +case 260: +#line 3186 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ // Return with a result... + yyval.TermInstVal.TI = new ReturnInst(yyvsp[0].ValueVal.V); + yyval.TermInstVal.S.makeSignless(); + ; + break;} +case 261: +#line 3190 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ // Return with no result... + yyval.TermInstVal.TI = new ReturnInst(); + yyval.TermInstVal.S.makeSignless(); + ; + break;} +case 262: +#line 3194 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ // Unconditional Branch... + BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal); + yyval.TermInstVal.TI = new BranchInst(tmpBB); + yyval.TermInstVal.S.makeSignless(); + ; + break;} +case 263: +#line 3199 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyvsp[-3].ValIDVal.S.makeSignless(); + yyvsp[0].ValIDVal.S.makeSignless(); + BasicBlock* tmpBBA = getBBVal(yyvsp[-3].ValIDVal); + BasicBlock* tmpBBB = getBBVal(yyvsp[0].ValIDVal); + yyvsp[-6].ValIDVal.S.makeUnsigned(); + Value* tmpVal = getVal(Type::Int1Ty, yyvsp[-6].ValIDVal); + yyval.TermInstVal.TI = new BranchInst(tmpBBA, tmpBBB, tmpVal); + yyval.TermInstVal.S.makeSignless(); + ; + break;} +case 264: +#line 3209 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyvsp[-6].ValIDVal.S.copy(yyvsp[-7].PrimType.S); + Value* tmpVal = getVal(yyvsp[-7].PrimType.T, yyvsp[-6].ValIDVal); + yyvsp[-3].ValIDVal.S.makeSignless(); + BasicBlock* tmpBB = getBBVal(yyvsp[-3].ValIDVal); + SwitchInst *S = new SwitchInst(tmpVal, tmpBB, yyvsp[-1].JumpTable->size()); + yyval.TermInstVal.TI = S; + yyval.TermInstVal.S.makeSignless(); + std::vector >::iterator I = yyvsp[-1].JumpTable->begin(), + E = yyvsp[-1].JumpTable->end(); for (; I != E; ++I) { if (ConstantInt *CI = dyn_cast(I->first)) S->addCase(CI, I->second); else error("Switch case is constant, but not a simple integer"); } - delete (yyvsp[(8) - (9)].JumpTable); - ;} - break; - - case 266: -#line 3224 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyvsp[(3) - (8)].ValIDVal).S.copy((yyvsp[(2) - (8)].PrimType).S); - Value* tmpVal = getVal((yyvsp[(2) - (8)].PrimType).T, (yyvsp[(3) - (8)].ValIDVal)); - (yyvsp[(6) - (8)].ValIDVal).S.makeSignless(); - BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (8)].ValIDVal)); + delete yyvsp[-1].JumpTable; + ; + break;} +case 265: +#line 3227 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyvsp[-5].ValIDVal.S.copy(yyvsp[-6].PrimType.S); + Value* tmpVal = getVal(yyvsp[-6].PrimType.T, yyvsp[-5].ValIDVal); + yyvsp[-2].ValIDVal.S.makeSignless(); + BasicBlock* tmpBB = getBBVal(yyvsp[-2].ValIDVal); SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0); - (yyval.TermInstVal).TI = S; - (yyval.TermInstVal).S.makeSignless(); - ;} - break; - - case 267: -#line 3234 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { + yyval.TermInstVal.TI = S; + yyval.TermInstVal.S.makeSignless(); + ; + break;} +case 266: +#line 3237 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ const PointerType *PFTy; const FunctionType *Ty; Signedness FTySign; - if (!(PFTy = dyn_cast((yyvsp[(3) - (13)].TypeVal).PAT->get())) || + if (!(PFTy = dyn_cast(yyvsp[-10].TypeVal.PAT->get())) || !(Ty = dyn_cast(PFTy->getElementType()))) { // Pull out the types of all of the arguments... std::vector ParamTypes; - FTySign.makeComposite((yyvsp[(3) - (13)].TypeVal).S); - if ((yyvsp[(6) - (13)].ValueList)) { - for (std::vector::iterator I = (yyvsp[(6) - (13)].ValueList)->begin(), E = (yyvsp[(6) - (13)].ValueList)->end(); + FTySign.makeComposite(yyvsp[-10].TypeVal.S); + if (yyvsp[-7].ValueList) { + for (std::vector::iterator I = yyvsp[-7].ValueList->begin(), E = yyvsp[-7].ValueList->end(); I != E; ++I) { ParamTypes.push_back((*I).V->getType()); FTySign.add(I->S); @@ -6045,33 +4983,33 @@ } bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy; if (isVarArg) ParamTypes.pop_back(); - Ty = FunctionType::get((yyvsp[(3) - (13)].TypeVal).PAT->get(), ParamTypes, isVarArg); - PFTy = PointerType::get(Ty); - (yyval.TermInstVal).S.copy((yyvsp[(3) - (13)].TypeVal).S); + Ty = FunctionType::get(yyvsp[-10].TypeVal.PAT->get(), ParamTypes, isVarArg); + PFTy = PointerType::getUnqual(Ty); + yyval.TermInstVal.S.copy(yyvsp[-10].TypeVal.S); } else { - FTySign = (yyvsp[(3) - (13)].TypeVal).S; + FTySign = yyvsp[-10].TypeVal.S; // Get the signedness of the result type. $3 is the pointer to the // function type so we get the 0th element to extract the function type, // and then the 0th element again to get the result type. - (yyval.TermInstVal).S.copy((yyvsp[(3) - (13)].TypeVal).S.get(0).get(0)); + yyval.TermInstVal.S.copy(yyvsp[-10].TypeVal.S.get(0).get(0)); } - (yyvsp[(4) - (13)].ValIDVal).S.makeComposite(FTySign); - Value *V = getVal(PFTy, (yyvsp[(4) - (13)].ValIDVal)); // Get the function we're calling... - BasicBlock *Normal = getBBVal((yyvsp[(10) - (13)].ValIDVal)); - BasicBlock *Except = getBBVal((yyvsp[(13) - (13)].ValIDVal)); + yyvsp[-9].ValIDVal.S.makeComposite(FTySign); + Value *V = getVal(PFTy, yyvsp[-9].ValIDVal); // Get the function we're calling... + BasicBlock *Normal = getBBVal(yyvsp[-3].ValIDVal); + BasicBlock *Except = getBBVal(yyvsp[0].ValIDVal); // Create the call node... - if (!(yyvsp[(6) - (13)].ValueList)) { // Has no arguments? + if (!yyvsp[-7].ValueList) { // Has no arguments? std::vector Args; - (yyval.TermInstVal).TI = new InvokeInst(V, Normal, Except, Args.begin(), Args.end()); + yyval.TermInstVal.TI = new InvokeInst(V, Normal, Except, Args.begin(), Args.end()); } else { // Has arguments? // Loop through FunctionType's arguments and ensure they are specified // correctly! // FunctionType::param_iterator I = Ty->param_begin(); FunctionType::param_iterator E = Ty->param_end(); - std::vector::iterator ArgI = (yyvsp[(6) - (13)].ValueList)->begin(), ArgE = (yyvsp[(6) - (13)].ValueList)->end(); + std::vector::iterator ArgI = yyvsp[-7].ValueList->begin(), ArgE = yyvsp[-7].ValueList->end(); std::vector Args; for (; ArgI != ArgE && I != E; ++ArgI, ++I) { @@ -6084,78 +5022,73 @@ if (I != E || (ArgI != ArgE && !Ty->isVarArg())) error("Invalid number of parameters detected"); - (yyval.TermInstVal).TI = new InvokeInst(V, Normal, Except, Args.begin(), Args.end()); + yyval.TermInstVal.TI = new InvokeInst(V, Normal, Except, Args.begin(), Args.end()); } - cast((yyval.TermInstVal).TI)->setCallingConv(upgradeCallingConv((yyvsp[(2) - (13)].UIntVal))); - if ((yyvsp[(2) - (13)].UIntVal) == OldCallingConv::CSRet) { + cast(yyval.TermInstVal.TI)->setCallingConv(upgradeCallingConv(yyvsp[-11].UIntVal)); + if (yyvsp[-11].UIntVal == OldCallingConv::CSRet) { ParamAttrsVector Attrs; ParamAttrsWithIndex PAWI; PAWI.index = 1; PAWI.attrs = ParamAttr::StructRet; // first arg Attrs.push_back(PAWI); - cast((yyval.TermInstVal).TI)->setParamAttrs(ParamAttrsList::get(Attrs)); + cast(yyval.TermInstVal.TI)->setParamAttrs(ParamAttrsList::get(Attrs)); } - delete (yyvsp[(3) - (13)].TypeVal).PAT; - delete (yyvsp[(6) - (13)].ValueList); + delete yyvsp[-10].TypeVal.PAT; + delete yyvsp[-7].ValueList; lastCallingConv = OldCallingConv::C; - ;} - break; - - case 268: -#line 3306 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.TermInstVal).TI = new UnwindInst(); - (yyval.TermInstVal).S.makeSignless(); - ;} - break; - - case 269: -#line 3310 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.TermInstVal).TI = new UnreachableInst(); - (yyval.TermInstVal).S.makeSignless(); - ;} - break; - - case 270: -#line 3317 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable); - (yyvsp[(3) - (6)].ValIDVal).S.copy((yyvsp[(2) - (6)].PrimType).S); - Constant *V = cast(getExistingValue((yyvsp[(2) - (6)].PrimType).T, (yyvsp[(3) - (6)].ValIDVal))); + ; + break;} +case 267: +#line 3309 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.TermInstVal.TI = new UnwindInst(); + yyval.TermInstVal.S.makeSignless(); + ; + break;} +case 268: +#line 3313 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.TermInstVal.TI = new UnreachableInst(); + yyval.TermInstVal.S.makeSignless(); + ; + break;} +case 269: +#line 3320 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.JumpTable = yyvsp[-5].JumpTable; + yyvsp[-3].ValIDVal.S.copy(yyvsp[-4].PrimType.S); + Constant *V = cast(getExistingValue(yyvsp[-4].PrimType.T, yyvsp[-3].ValIDVal)); if (V == 0) error("May only switch on a constant pool value"); - (yyvsp[(6) - (6)].ValIDVal).S.makeSignless(); - BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (6)].ValIDVal)); - (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); - ;} - break; - - case 271: -#line 3329 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.JumpTable) = new std::vector >(); - (yyvsp[(2) - (5)].ValIDVal).S.copy((yyvsp[(1) - (5)].PrimType).S); - Constant *V = cast(getExistingValue((yyvsp[(1) - (5)].PrimType).T, (yyvsp[(2) - (5)].ValIDVal))); + yyvsp[0].ValIDVal.S.makeSignless(); + BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal); + yyval.JumpTable->push_back(std::make_pair(V, tmpBB)); + ; + break;} +case 270: +#line 3332 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.JumpTable = new std::vector >(); + yyvsp[-3].ValIDVal.S.copy(yyvsp[-4].PrimType.S); + Constant *V = cast(getExistingValue(yyvsp[-4].PrimType.T, yyvsp[-3].ValIDVal)); if (V == 0) error("May only switch on a constant pool value"); - (yyvsp[(5) - (5)].ValIDVal).S.makeSignless(); - BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (5)].ValIDVal)); - (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); - ;} - break; - - case 272: -#line 3344 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { + yyvsp[0].ValIDVal.S.makeSignless(); + BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal); + yyval.JumpTable->push_back(std::make_pair(V, tmpBB)); + ; + break;} +case 271: +#line 3347 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ bool omit = false; - if ((yyvsp[(1) - (2)].StrVal)) - if (BitCastInst *BCI = dyn_cast((yyvsp[(2) - (2)].InstVal).I)) + if (yyvsp[-1].StrVal) + if (BitCastInst *BCI = dyn_cast(yyvsp[0].InstVal.I)) if (BCI->getSrcTy() == BCI->getDestTy() && - BCI->getOperand(0)->getName() == (yyvsp[(1) - (2)].StrVal)) + BCI->getOperand(0)->getName() == yyvsp[-1].StrVal) // This is a useless bit cast causing a name redefinition. It is // a bit cast from a type to the same type of an operand with the // same name as the name we would give this instruction. Since this @@ -6170,258 +5103,240 @@ // The bitcast is clearly useless so we omit it. omit = true; if (omit) { - (yyval.InstVal).I = 0; - (yyval.InstVal).S.makeSignless(); + yyval.InstVal.I = 0; + yyval.InstVal.S.makeSignless(); } else { - ValueInfo VI; VI.V = (yyvsp[(2) - (2)].InstVal).I; VI.S.copy((yyvsp[(2) - (2)].InstVal).S); - setValueName(VI, (yyvsp[(1) - (2)].StrVal)); - InsertValue((yyvsp[(2) - (2)].InstVal).I); - (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal); - } - ;} - break; - - case 273: -#line 3374 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { // Used for PHI nodes - (yyval.PHIList).P = new std::list >(); - (yyval.PHIList).S.copy((yyvsp[(1) - (6)].TypeVal).S); - (yyvsp[(3) - (6)].ValIDVal).S.copy((yyvsp[(1) - (6)].TypeVal).S); - Value* tmpVal = getVal((yyvsp[(1) - (6)].TypeVal).PAT->get(), (yyvsp[(3) - (6)].ValIDVal)); - (yyvsp[(5) - (6)].ValIDVal).S.makeSignless(); - BasicBlock* tmpBB = getBBVal((yyvsp[(5) - (6)].ValIDVal)); - (yyval.PHIList).P->push_back(std::make_pair(tmpVal, tmpBB)); - delete (yyvsp[(1) - (6)].TypeVal).PAT; - ;} - break; - - case 274: -#line 3384 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList); - (yyvsp[(4) - (7)].ValIDVal).S.copy((yyvsp[(1) - (7)].PHIList).S); - Value* tmpVal = getVal((yyvsp[(1) - (7)].PHIList).P->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal)); - (yyvsp[(6) - (7)].ValIDVal).S.makeSignless(); - BasicBlock* tmpBB = getBBVal((yyvsp[(6) - (7)].ValIDVal)); - (yyvsp[(1) - (7)].PHIList).P->push_back(std::make_pair(tmpVal, tmpBB)); - ;} - break; - - case 275: -#line 3394 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { // Used for call statements, and memory insts... - (yyval.ValueList) = new std::vector(); - (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal)); - ;} - break; - - case 276: -#line 3398 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList); - (yyvsp[(1) - (3)].ValueList)->push_back((yyvsp[(3) - (3)].ValueVal)); - ;} - break; - - case 278: -#line 3406 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { (yyval.ValueList) = 0; ;} - break; - - case 279: -#line 3410 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.BoolVal) = true; - ;} - break; - - case 280: -#line 3413 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyval.BoolVal) = false; - ;} - break; - - case 281: -#line 3419 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyvsp[(3) - (5)].ValIDVal).S.copy((yyvsp[(2) - (5)].TypeVal).S); - (yyvsp[(5) - (5)].ValIDVal).S.copy((yyvsp[(2) - (5)].TypeVal).S); - const Type* Ty = (yyvsp[(2) - (5)].TypeVal).PAT->get(); + ValueInfo VI; VI.V = yyvsp[0].InstVal.I; VI.S.copy(yyvsp[0].InstVal.S); + setValueName(VI, yyvsp[-1].StrVal); + InsertValue(yyvsp[0].InstVal.I); + yyval.InstVal = yyvsp[0].InstVal; + } + ; + break;} +case 272: +#line 3377 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ // Used for PHI nodes + yyval.PHIList.P = new std::list >(); + yyval.PHIList.S.copy(yyvsp[-5].TypeVal.S); + yyvsp[-3].ValIDVal.S.copy(yyvsp[-5].TypeVal.S); + Value* tmpVal = getVal(yyvsp[-5].TypeVal.PAT->get(), yyvsp[-3].ValIDVal); + yyvsp[-1].ValIDVal.S.makeSignless(); + BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal); + yyval.PHIList.P->push_back(std::make_pair(tmpVal, tmpBB)); + delete yyvsp[-5].TypeVal.PAT; + ; + break;} +case 273: +#line 3387 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.PHIList = yyvsp[-6].PHIList; + yyvsp[-3].ValIDVal.S.copy(yyvsp[-6].PHIList.S); + Value* tmpVal = getVal(yyvsp[-6].PHIList.P->front().first->getType(), yyvsp[-3].ValIDVal); + yyvsp[-1].ValIDVal.S.makeSignless(); + BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal); + yyvsp[-6].PHIList.P->push_back(std::make_pair(tmpVal, tmpBB)); + ; + break;} +case 274: +#line 3397 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ // Used for call statements, and memory insts... + yyval.ValueList = new std::vector(); + yyval.ValueList->push_back(yyvsp[0].ValueVal); + ; + break;} +case 275: +#line 3401 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.ValueList = yyvsp[-2].ValueList; + yyvsp[-2].ValueList->push_back(yyvsp[0].ValueVal); + ; + break;} +case 277: +#line 3409 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ yyval.ValueList = 0; ; + break;} +case 278: +#line 3413 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.BoolVal = true; + ; + break;} +case 279: +#line 3416 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyval.BoolVal = false; + ; + break;} +case 280: +#line 3422 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyvsp[-2].ValIDVal.S.copy(yyvsp[-3].TypeVal.S); + yyvsp[0].ValIDVal.S.copy(yyvsp[-3].TypeVal.S); + const Type* Ty = yyvsp[-3].TypeVal.PAT->get(); if (!Ty->isInteger() && !Ty->isFloatingPoint() && !isa(Ty)) error("Arithmetic operator requires integer, FP, or packed operands"); if (isa(Ty) && - ((yyvsp[(1) - (5)].BinaryOpVal) == URemOp || (yyvsp[(1) - (5)].BinaryOpVal) == SRemOp || (yyvsp[(1) - (5)].BinaryOpVal) == FRemOp || (yyvsp[(1) - (5)].BinaryOpVal) == RemOp)) + (yyvsp[-4].BinaryOpVal == URemOp || yyvsp[-4].BinaryOpVal == SRemOp || yyvsp[-4].BinaryOpVal == FRemOp || yyvsp[-4].BinaryOpVal == RemOp)) error("Remainder not supported on vector types"); // Upgrade the opcode from obsolete versions before we do anything with it. - Instruction::BinaryOps Opcode = getBinaryOp((yyvsp[(1) - (5)].BinaryOpVal), Ty, (yyvsp[(2) - (5)].TypeVal).S); - Value* val1 = getVal(Ty, (yyvsp[(3) - (5)].ValIDVal)); - Value* val2 = getVal(Ty, (yyvsp[(5) - (5)].ValIDVal)); - (yyval.InstVal).I = BinaryOperator::create(Opcode, val1, val2); - if ((yyval.InstVal).I == 0) + Instruction::BinaryOps Opcode = getBinaryOp(yyvsp[-4].BinaryOpVal, Ty, yyvsp[-3].TypeVal.S); + Value* val1 = getVal(Ty, yyvsp[-2].ValIDVal); + Value* val2 = getVal(Ty, yyvsp[0].ValIDVal); + yyval.InstVal.I = BinaryOperator::create(Opcode, val1, val2); + if (yyval.InstVal.I == 0) error("binary operator returned null"); - (yyval.InstVal).S.copy((yyvsp[(2) - (5)].TypeVal).S); - delete (yyvsp[(2) - (5)].TypeVal).PAT; - ;} - break; - - case 282: -#line 3438 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyvsp[(3) - (5)].ValIDVal).S.copy((yyvsp[(2) - (5)].TypeVal).S); - (yyvsp[(5) - (5)].ValIDVal).S.copy((yyvsp[(2) - (5)].TypeVal).S); - const Type *Ty = (yyvsp[(2) - (5)].TypeVal).PAT->get(); + yyval.InstVal.S.copy(yyvsp[-3].TypeVal.S); + delete yyvsp[-3].TypeVal.PAT; + ; + break;} +case 281: +#line 3441 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyvsp[-2].ValIDVal.S.copy(yyvsp[-3].TypeVal.S); + yyvsp[0].ValIDVal.S.copy(yyvsp[-3].TypeVal.S); + const Type *Ty = yyvsp[-3].TypeVal.PAT->get(); if (!Ty->isInteger()) { if (!isa(Ty) || !cast(Ty)->getElementType()->isInteger()) error("Logical operator requires integral operands"); } - Instruction::BinaryOps Opcode = getBinaryOp((yyvsp[(1) - (5)].BinaryOpVal), Ty, (yyvsp[(2) - (5)].TypeVal).S); - Value* tmpVal1 = getVal(Ty, (yyvsp[(3) - (5)].ValIDVal)); - Value* tmpVal2 = getVal(Ty, (yyvsp[(5) - (5)].ValIDVal)); - (yyval.InstVal).I = BinaryOperator::create(Opcode, tmpVal1, tmpVal2); - if ((yyval.InstVal).I == 0) + Instruction::BinaryOps Opcode = getBinaryOp(yyvsp[-4].BinaryOpVal, Ty, yyvsp[-3].TypeVal.S); + Value* tmpVal1 = getVal(Ty, yyvsp[-2].ValIDVal); + Value* tmpVal2 = getVal(Ty, yyvsp[0].ValIDVal); + yyval.InstVal.I = BinaryOperator::create(Opcode, tmpVal1, tmpVal2); + if (yyval.InstVal.I == 0) error("binary operator returned null"); - (yyval.InstVal).S.copy((yyvsp[(2) - (5)].TypeVal).S); - delete (yyvsp[(2) - (5)].TypeVal).PAT; - ;} - break; - - case 283: -#line 3456 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyvsp[(3) - (5)].ValIDVal).S.copy((yyvsp[(2) - (5)].TypeVal).S); - (yyvsp[(5) - (5)].ValIDVal).S.copy((yyvsp[(2) - (5)].TypeVal).S); - const Type* Ty = (yyvsp[(2) - (5)].TypeVal).PAT->get(); + yyval.InstVal.S.copy(yyvsp[-3].TypeVal.S); + delete yyvsp[-3].TypeVal.PAT; + ; + break;} +case 282: +#line 3459 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyvsp[-2].ValIDVal.S.copy(yyvsp[-3].TypeVal.S); + yyvsp[0].ValIDVal.S.copy(yyvsp[-3].TypeVal.S); + const Type* Ty = yyvsp[-3].TypeVal.PAT->get(); if(isa(Ty)) error("VectorTypes currently not supported in setcc instructions"); unsigned short pred; - Instruction::OtherOps Opcode = getCompareOp((yyvsp[(1) - (5)].BinaryOpVal), pred, Ty, (yyvsp[(2) - (5)].TypeVal).S); - Value* tmpVal1 = getVal(Ty, (yyvsp[(3) - (5)].ValIDVal)); - Value* tmpVal2 = getVal(Ty, (yyvsp[(5) - (5)].ValIDVal)); - (yyval.InstVal).I = CmpInst::create(Opcode, pred, tmpVal1, tmpVal2); - if ((yyval.InstVal).I == 0) + Instruction::OtherOps Opcode = getCompareOp(yyvsp[-4].BinaryOpVal, pred, Ty, yyvsp[-3].TypeVal.S); + Value* tmpVal1 = getVal(Ty, yyvsp[-2].ValIDVal); + Value* tmpVal2 = getVal(Ty, yyvsp[0].ValIDVal); + yyval.InstVal.I = CmpInst::create(Opcode, pred, tmpVal1, tmpVal2); + if (yyval.InstVal.I == 0) error("binary operator returned null"); - (yyval.InstVal).S.makeUnsigned(); - delete (yyvsp[(2) - (5)].TypeVal).PAT; - ;} - break; - - case 284: -#line 3472 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyvsp[(4) - (6)].ValIDVal).S.copy((yyvsp[(3) - (6)].TypeVal).S); - (yyvsp[(6) - (6)].ValIDVal).S.copy((yyvsp[(3) - (6)].TypeVal).S); - const Type *Ty = (yyvsp[(3) - (6)].TypeVal).PAT->get(); + yyval.InstVal.S.makeUnsigned(); + delete yyvsp[-3].TypeVal.PAT; + ; + break;} +case 283: +#line 3475 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyvsp[-2].ValIDVal.S.copy(yyvsp[-3].TypeVal.S); + yyvsp[0].ValIDVal.S.copy(yyvsp[-3].TypeVal.S); + const Type *Ty = yyvsp[-3].TypeVal.PAT->get(); if (isa(Ty)) error("VectorTypes currently not supported in icmp instructions"); else if (!Ty->isInteger() && !isa(Ty)) error("icmp requires integer or pointer typed operands"); - Value* tmpVal1 = getVal(Ty, (yyvsp[(4) - (6)].ValIDVal)); - Value* tmpVal2 = getVal(Ty, (yyvsp[(6) - (6)].ValIDVal)); - (yyval.InstVal).I = new ICmpInst((yyvsp[(2) - (6)].IPred), tmpVal1, tmpVal2); - (yyval.InstVal).S.makeUnsigned(); - delete (yyvsp[(3) - (6)].TypeVal).PAT; - ;} - break; - - case 285: -#line 3486 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - (yyvsp[(4) - (6)].ValIDVal).S.copy((yyvsp[(3) - (6)].TypeVal).S); - (yyvsp[(6) - (6)].ValIDVal).S.copy((yyvsp[(3) - (6)].TypeVal).S); - const Type *Ty = (yyvsp[(3) - (6)].TypeVal).PAT->get(); + Value* tmpVal1 = getVal(Ty, yyvsp[-2].ValIDVal); + Value* tmpVal2 = getVal(Ty, yyvsp[0].ValIDVal); + yyval.InstVal.I = new ICmpInst(yyvsp[-4].IPred, tmpVal1, tmpVal2); + yyval.InstVal.S.makeUnsigned(); + delete yyvsp[-3].TypeVal.PAT; + ; + break;} +case 284: +#line 3489 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + yyvsp[-2].ValIDVal.S.copy(yyvsp[-3].TypeVal.S); + yyvsp[0].ValIDVal.S.copy(yyvsp[-3].TypeVal.S); + const Type *Ty = yyvsp[-3].TypeVal.PAT->get(); if (isa(Ty)) error("VectorTypes currently not supported in fcmp instructions"); else if (!Ty->isFloatingPoint()) error("fcmp instruction requires floating point operands"); - Value* tmpVal1 = getVal(Ty, (yyvsp[(4) - (6)].ValIDVal)); - Value* tmpVal2 = getVal(Ty, (yyvsp[(6) - (6)].ValIDVal)); - (yyval.InstVal).I = new FCmpInst((yyvsp[(2) - (6)].FPred), tmpVal1, tmpVal2); - (yyval.InstVal).S.makeUnsigned(); - delete (yyvsp[(3) - (6)].TypeVal).PAT; - ;} - break; - - case 286: -#line 3500 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { + Value* tmpVal1 = getVal(Ty, yyvsp[-2].ValIDVal); + Value* tmpVal2 = getVal(Ty, yyvsp[0].ValIDVal); + yyval.InstVal.I = new FCmpInst(yyvsp[-4].FPred, tmpVal1, tmpVal2); + yyval.InstVal.S.makeUnsigned(); + delete yyvsp[-3].TypeVal.PAT; + ; + break;} +case 285: +#line 3503 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ warning("Use of obsolete 'not' instruction: Replacing with 'xor"); - const Type *Ty = (yyvsp[(2) - (2)].ValueVal).V->getType(); + const Type *Ty = yyvsp[0].ValueVal.V->getType(); Value *Ones = ConstantInt::getAllOnesValue(Ty); if (Ones == 0) error("Expected integral type for not instruction"); - (yyval.InstVal).I = BinaryOperator::create(Instruction::Xor, (yyvsp[(2) - (2)].ValueVal).V, Ones); - if ((yyval.InstVal).I == 0) + yyval.InstVal.I = BinaryOperator::create(Instruction::Xor, yyvsp[0].ValueVal.V, Ones); + if (yyval.InstVal.I == 0) error("Could not create a xor instruction"); - (yyval.InstVal).S.copy((yyvsp[(2) - (2)].ValueVal).S); - ;} - break; - - case 287: -#line 3511 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - if (!(yyvsp[(4) - (4)].ValueVal).V->getType()->isInteger() || - cast((yyvsp[(4) - (4)].ValueVal).V->getType())->getBitWidth() != 8) + yyval.InstVal.S.copy(yyvsp[0].ValueVal.S); + ; + break;} +case 286: +#line 3514 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + if (!yyvsp[0].ValueVal.V->getType()->isInteger() || + cast(yyvsp[0].ValueVal.V->getType())->getBitWidth() != 8) error("Shift amount must be int8"); - const Type* Ty = (yyvsp[(2) - (4)].ValueVal).V->getType(); + const Type* Ty = yyvsp[-2].ValueVal.V->getType(); if (!Ty->isInteger()) error("Shift constant expression requires integer operand"); Value* ShiftAmt = 0; if (cast(Ty)->getBitWidth() > Type::Int8Ty->getBitWidth()) - if (Constant *C = dyn_cast((yyvsp[(4) - (4)].ValueVal).V)) + if (Constant *C = dyn_cast(yyvsp[0].ValueVal.V)) ShiftAmt = ConstantExpr::getZExt(C, Ty); else - ShiftAmt = new ZExtInst((yyvsp[(4) - (4)].ValueVal).V, Ty, makeNameUnique("shift"), CurBB); + ShiftAmt = new ZExtInst(yyvsp[0].ValueVal.V, Ty, makeNameUnique("shift"), CurBB); else - ShiftAmt = (yyvsp[(4) - (4)].ValueVal).V; - (yyval.InstVal).I = BinaryOperator::create(getBinaryOp((yyvsp[(1) - (4)].BinaryOpVal), Ty, (yyvsp[(2) - (4)].ValueVal).S), (yyvsp[(2) - (4)].ValueVal).V, ShiftAmt); - (yyval.InstVal).S.copy((yyvsp[(2) - (4)].ValueVal).S); - ;} - break; - - case 288: -#line 3529 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - const Type *DstTy = (yyvsp[(4) - (4)].TypeVal).PAT->get(); + ShiftAmt = yyvsp[0].ValueVal.V; + yyval.InstVal.I = BinaryOperator::create(getBinaryOp(yyvsp[-3].BinaryOpVal, Ty, yyvsp[-2].ValueVal.S), yyvsp[-2].ValueVal.V, ShiftAmt); + yyval.InstVal.S.copy(yyvsp[-2].ValueVal.S); + ; + break;} +case 287: +#line 3532 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + const Type *DstTy = yyvsp[0].TypeVal.PAT->get(); if (!DstTy->isFirstClassType()) error("cast instruction to a non-primitive type: '" + DstTy->getDescription() + "'"); - (yyval.InstVal).I = cast(getCast((yyvsp[(1) - (4)].CastOpVal), (yyvsp[(2) - (4)].ValueVal).V, (yyvsp[(2) - (4)].ValueVal).S, DstTy, (yyvsp[(4) - (4)].TypeVal).S, true)); - (yyval.InstVal).S.copy((yyvsp[(4) - (4)].TypeVal).S); - delete (yyvsp[(4) - (4)].TypeVal).PAT; - ;} - break; - - case 289: -#line 3538 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - if (!(yyvsp[(2) - (6)].ValueVal).V->getType()->isInteger() || - cast((yyvsp[(2) - (6)].ValueVal).V->getType())->getBitWidth() != 1) + yyval.InstVal.I = cast(getCast(yyvsp[-3].CastOpVal, yyvsp[-2].ValueVal.V, yyvsp[-2].ValueVal.S, DstTy, yyvsp[0].TypeVal.S, true)); + yyval.InstVal.S.copy(yyvsp[0].TypeVal.S); + delete yyvsp[0].TypeVal.PAT; + ; + break;} +case 288: +#line 3541 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + if (!yyvsp[-4].ValueVal.V->getType()->isInteger() || + cast(yyvsp[-4].ValueVal.V->getType())->getBitWidth() != 1) error("select condition must be bool"); - if ((yyvsp[(4) - (6)].ValueVal).V->getType() != (yyvsp[(6) - (6)].ValueVal).V->getType()) + if (yyvsp[-2].ValueVal.V->getType() != yyvsp[0].ValueVal.V->getType()) error("select value types should match"); - (yyval.InstVal).I = new SelectInst((yyvsp[(2) - (6)].ValueVal).V, (yyvsp[(4) - (6)].ValueVal).V, (yyvsp[(6) - (6)].ValueVal).V); - (yyval.InstVal).S.copy((yyvsp[(4) - (6)].ValueVal).S); - ;} - break; - - case 290: -#line 3547 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - const Type *Ty = (yyvsp[(4) - (4)].TypeVal).PAT->get(); + yyval.InstVal.I = new SelectInst(yyvsp[-4].ValueVal.V, yyvsp[-2].ValueVal.V, yyvsp[0].ValueVal.V); + yyval.InstVal.S.copy(yyvsp[-2].ValueVal.S); + ; + break;} +case 289: +#line 3550 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + const Type *Ty = yyvsp[0].TypeVal.PAT->get(); NewVarArgs = true; - (yyval.InstVal).I = new VAArgInst((yyvsp[(2) - (4)].ValueVal).V, Ty); - (yyval.InstVal).S.copy((yyvsp[(4) - (4)].TypeVal).S); - delete (yyvsp[(4) - (4)].TypeVal).PAT; - ;} - break; - - case 291: -#line 3554 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - const Type* ArgTy = (yyvsp[(2) - (4)].ValueVal).V->getType(); - const Type* DstTy = (yyvsp[(4) - (4)].TypeVal).PAT->get(); + yyval.InstVal.I = new VAArgInst(yyvsp[-2].ValueVal.V, Ty); + yyval.InstVal.S.copy(yyvsp[0].TypeVal.S); + delete yyvsp[0].TypeVal.PAT; + ; + break;} +case 290: +#line 3557 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + const Type* ArgTy = yyvsp[-2].ValueVal.V->getType(); + const Type* DstTy = yyvsp[0].TypeVal.PAT->get(); ObsoleteVarArgs = true; Function* NF = cast(CurModule.CurrentModule-> getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0)); @@ -6433,20 +5348,19 @@ //b = vaarg foo, t AllocaInst* foo = new AllocaInst(ArgTy, 0, "vaarg.fix"); CurBB->getInstList().push_back(foo); - CallInst* bar = new CallInst(NF, (yyvsp[(2) - (4)].ValueVal).V); + CallInst* bar = new CallInst(NF, yyvsp[-2].ValueVal.V); CurBB->getInstList().push_back(bar); CurBB->getInstList().push_back(new StoreInst(bar, foo)); - (yyval.InstVal).I = new VAArgInst(foo, DstTy); - (yyval.InstVal).S.copy((yyvsp[(4) - (4)].TypeVal).S); - delete (yyvsp[(4) - (4)].TypeVal).PAT; - ;} - break; - - case 292: -#line 3575 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - const Type* ArgTy = (yyvsp[(2) - (4)].ValueVal).V->getType(); - const Type* DstTy = (yyvsp[(4) - (4)].TypeVal).PAT->get(); + yyval.InstVal.I = new VAArgInst(foo, DstTy); + yyval.InstVal.S.copy(yyvsp[0].TypeVal.S); + delete yyvsp[0].TypeVal.PAT; + ; + break;} +case 291: +#line 3578 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + const Type* ArgTy = yyvsp[-2].ValueVal.V->getType(); + const Type* DstTy = yyvsp[0].TypeVal.PAT->get(); ObsoleteVarArgs = true; Function* NF = cast(CurModule.CurrentModule-> getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0)); @@ -6459,81 +5373,76 @@ //b = load foo AllocaInst* foo = new AllocaInst(ArgTy, 0, "vanext.fix"); CurBB->getInstList().push_back(foo); - CallInst* bar = new CallInst(NF, (yyvsp[(2) - (4)].ValueVal).V); + CallInst* bar = new CallInst(NF, yyvsp[-2].ValueVal.V); CurBB->getInstList().push_back(bar); CurBB->getInstList().push_back(new StoreInst(bar, foo)); Instruction* tmp = new VAArgInst(foo, DstTy); CurBB->getInstList().push_back(tmp); - (yyval.InstVal).I = new LoadInst(foo); - (yyval.InstVal).S.copy((yyvsp[(4) - (4)].TypeVal).S); - delete (yyvsp[(4) - (4)].TypeVal).PAT; - ;} - break; - - case 293: -#line 3599 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal).V, (yyvsp[(4) - (4)].ValueVal).V)) + yyval.InstVal.I = new LoadInst(foo); + yyval.InstVal.S.copy(yyvsp[0].TypeVal.S); + delete yyvsp[0].TypeVal.PAT; + ; + break;} +case 292: +#line 3602 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + if (!ExtractElementInst::isValidOperands(yyvsp[-2].ValueVal.V, yyvsp[0].ValueVal.V)) error("Invalid extractelement operands"); - (yyval.InstVal).I = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal).V, (yyvsp[(4) - (4)].ValueVal).V); - (yyval.InstVal).S.copy((yyvsp[(2) - (4)].ValueVal).S.get(0)); - ;} - break; - - case 294: -#line 3605 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal).V, (yyvsp[(4) - (6)].ValueVal).V, (yyvsp[(6) - (6)].ValueVal).V)) + yyval.InstVal.I = new ExtractElementInst(yyvsp[-2].ValueVal.V, yyvsp[0].ValueVal.V); + yyval.InstVal.S.copy(yyvsp[-2].ValueVal.S.get(0)); + ; + break;} +case 293: +#line 3608 "/Users/clamb/Documents/llvm/llvm/tools/llvm-upgrade/UpgradeParser.y" +{ + if (!InsertElementInst::isValidOperands(yyvsp[-4].ValueVal.V, yyvsp[-2].ValueVal.V, yyvsp[0].ValueVal.V)) error("Invalid insertelement operands"); - (yyval.InstVal).I = new InsertElementInst((yyvsp[(2) - (6)].ValueVal).V, (yyvsp[(4) - (6)].ValueVal).V, (yyvsp[(6) - (6)].ValueVal).V); - (yyval.InstVal).S.copy((yyvsp[(2) - (6)].ValueVal).S); - ;} - break; - - case 295: -#line 3611 "/home/duncan/LLVM/llvm.top/llvm/tools/llvm-upgrade/UpgradeParser.y" - { - if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal