From lattner at cs.uiuc.edu Mon Feb 13 00:09:19 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 13 Feb 2006 00:09:19 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200602130609.AAA25197@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.432 -> 1.433 --- Log message: Be careful not to request or look at bits shifted in from outside the size of the input. This fixes the mediabench/gsm/toast failure last night. --- Diffs of the changes: (+9 -3) InstructionCombining.cpp | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.432 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.433 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.432 Sun Feb 12 02:07:37 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Feb 13 00:09:08 2006 @@ -939,20 +939,26 @@ // Compute the new bits that are at the top now. uint64_t HighBits = (1ULL << ShAmt)-1; HighBits <<= I->getType()->getPrimitiveSizeInBits() - ShAmt; - + uint64_t TypeMask = I->getType()->getIntegralTypeMask(); if (I->getType()->isUnsigned()) { // Unsigned shift right. - if (SimplifyDemandedBits(I->getOperand(0), DemandedMask << ShAmt, + if (SimplifyDemandedBits(I->getOperand(0), + (DemandedMask << ShAmt) & TypeMask, KnownZero, KnownOne, Depth+1)) return true; assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); + KnownZero &= TypeMask; + KnownOne &= TypeMask; KnownZero >>= ShAmt; KnownOne >>= ShAmt; KnownZero |= HighBits; // high bits known zero. } else { // Signed shift right. - if (SimplifyDemandedBits(I->getOperand(0), DemandedMask << ShAmt, + if (SimplifyDemandedBits(I->getOperand(0), + (DemandedMask << ShAmt) & TypeMask, KnownZero, KnownOne, Depth+1)) return true; assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); + KnownZero &= TypeMask; + KnownOne &= TypeMask; KnownZero >>= SA->getValue(); KnownOne >>= SA->getValue(); From lattner at cs.uiuc.edu Mon Feb 13 01:03:01 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 13 Feb 2006 01:03:01 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/Generic/2006-02-12-InsertLibcall.ll Message-ID: <200602130703.BAA25403@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/Generic: 2006-02-12-InsertLibcall.ll updated: 1.1 -> 1.2 --- Log message: Reduce this testcase a bit more, with the help of llvm-extract and some hand tweaks --- Diffs of the changes: (+8 -12) 2006-02-12-InsertLibcall.ll | 20 ++++++++------------ 1 files changed, 8 insertions(+), 12 deletions(-) Index: llvm/test/Regression/CodeGen/Generic/2006-02-12-InsertLibcall.ll diff -u llvm/test/Regression/CodeGen/Generic/2006-02-12-InsertLibcall.ll:1.1 llvm/test/Regression/CodeGen/Generic/2006-02-12-InsertLibcall.ll:1.2 --- llvm/test/Regression/CodeGen/Generic/2006-02-12-InsertLibcall.ll:1.1 Sun Feb 12 04:24:00 2006 +++ llvm/test/Regression/CodeGen/Generic/2006-02-12-InsertLibcall.ll Mon Feb 13 01:02:50 2006 @@ -1,14 +1,16 @@ ; RUN: llvm-as < %s | llc +%G = external global int - %typedef.InputParameters = type { int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, [8 x [2 x int]], [8 x [2 x int]], int, int, int, int, [200 x sbyte], [200 x sbyte], [200 x sbyte], [200 x sbyte], [200 x sbyte], int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, [1024 x sbyte], int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, double, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, [200 x sbyte], [200 x sbyte], int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, [200 x sbyte], int, int, int*, int*, ubyte*, int*, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, [8 x int], int, int, int, int, int, int, int, int, int, int, int, [6 x double], [200 x sbyte], int,! int, int, int, [2 x [5 x int]], int, int, int, int } - -%inputs = external global %typedef.InputParameters ; <%typedef.InputParameters*> [#uses=1] - -void %encode_one_frame() { +void %encode_one_frame(long %tmp.2i) { entry: %tmp.9 = seteq int 0, 0 ; [#uses=1] br bool %tmp.9, label %endif.0, label %shortcirc_next.0 +then.5.i: ; preds = %shortcirc_next.i + %tmp.114.i = div long %tmp.2i, 3 ; [#uses=1] + %tmp.111.i = call long %lseek( int 0, long %tmp.114.i, int 1 ) ; [#uses=0] + ret void + shortcirc_next.0: ; preds = %entry ret void @@ -40,8 +42,7 @@ ret void else.1.i56: ; preds = %then.0.i40 - %tmp.25.i = cast int 0 to long ; [#uses=1] - %tmp.28.i = load int* getelementptr (%typedef.InputParameters* %inputs, int 0, uint 152) ; [#uses=1] + %tmp.28.i = load int* %G %tmp.29.i = seteq int %tmp.28.i, 1 ; [#uses=1] br bool %tmp.29.i, label %shortcirc_next.i, label %shortcirc_done.i @@ -52,11 +53,6 @@ shortcirc_done.i: ; preds = %else.1.i56 ret void -then.5.i: ; preds = %shortcirc_next.i - %tmp.114.i = div long %tmp.25.i, 3 ; [#uses=1] - %tmp.111.i = call long %lseek( int 0, long %tmp.114.i, int 1 ) ; [#uses=0] - ret void - endif.5.i: ; preds = %shortcirc_next.i ret void } From lattner at cs.uiuc.edu Mon Feb 13 01:26:48 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 13 Feb 2006 01:26:48 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/PowerPC/and-imm.ll Message-ID: <200602130726.BAA25490@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/PowerPC: and-imm.ll updated: 1.1 -> 1.2 --- Log message: this passes now, due to Nate's recent efforts --- Diffs of the changes: (+0 -1) and-imm.ll | 1 - 1 files changed, 1 deletion(-) Index: llvm/test/Regression/CodeGen/PowerPC/and-imm.ll diff -u llvm/test/Regression/CodeGen/PowerPC/and-imm.ll:1.1 llvm/test/Regression/CodeGen/PowerPC/and-imm.ll:1.2 --- llvm/test/Regression/CodeGen/PowerPC/and-imm.ll:1.1 Tue Aug 30 13:44:09 2005 +++ llvm/test/Regression/CodeGen/PowerPC/and-imm.ll Mon Feb 13 01:26:36 2006 @@ -1,5 +1,4 @@ ; RUN: llvm-as < %s | llc -march=ppc32 | not grep 'ori\|lis' -; XFAIL: * int %test(int %X) { %Y = and int %X, 32769 ; andi. r3, r3, 32769 From lattner at cs.uiuc.edu Mon Feb 13 02:54:58 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 13 Feb 2006 02:54:58 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAG.h Message-ID: <200602130854.CAA03275@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: SelectionDAG.h updated: 1.97 -> 1.98 --- Log message: Add a method --- Diffs of the changes: (+12 -0) SelectionDAG.h | 12 ++++++++++++ 1 files changed, 12 insertions(+) Index: llvm/include/llvm/CodeGen/SelectionDAG.h diff -u llvm/include/llvm/CodeGen/SelectionDAG.h:1.97 llvm/include/llvm/CodeGen/SelectionDAG.h:1.98 --- llvm/include/llvm/CodeGen/SelectionDAG.h:1.97 Thu Feb 9 16:11:03 2006 +++ llvm/include/llvm/CodeGen/SelectionDAG.h Mon Feb 13 02:54:46 2006 @@ -196,6 +196,18 @@ /// getZeroExtendInReg - Return the expression required to zero extend the Op /// value assuming it was the smaller SrcTy value. SDOperand getZeroExtendInReg(SDOperand Op, MVT::ValueType SrcTy); + + /// getCALLSEQ_START - Return a new CALLSEQ_START node, which always must have + /// a flag result (to ensure it's not CSE'd). + SDOperand getCALLSEQ_START(SDOperand Chain, SDOperand Op) { + std::vector ResultTys; + ResultTys.push_back(MVT::Other); + ResultTys.push_back(MVT::Flag); + std::vector Ops; + Ops.push_back(Chain); + Ops.push_back(Op); + return getNode(ISD::CALLSEQ_START, ResultTys, Ops); + } /// getNode - Gets or creates the specified node. /// From lattner at cs.uiuc.edu Mon Feb 13 02:55:41 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 13 Feb 2006 02:55:41 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelLowering.cpp Message-ID: <200602130855.CAA03337@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCISelLowering.cpp updated: 1.86 -> 1.87 --- Log message: Switch to using getCALLSEQ_START instead of using our own creation calls --- Diffs of the changes: (+4 -4) PPCISelLowering.cpp | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.86 llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.87 --- llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.86 Tue Feb 7 14:16:30 2006 +++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp Mon Feb 13 02:55:29 2006 @@ -730,8 +730,8 @@ unsigned NumBytes = 24; if (Args.empty()) { - Chain = DAG.getNode(ISD::CALLSEQ_START, MVT::Other, Chain, - DAG.getConstant(NumBytes, getPointerTy())); + Chain = DAG.getCALLSEQ_START(Chain, + DAG.getConstant(NumBytes, getPointerTy())); } else { for (unsigned i = 0, e = Args.size(); i != e; ++i) { switch (getValueType(Args[i].second)) { @@ -757,8 +757,8 @@ // Adjust the stack pointer for the new arguments... // These operations are automatically eliminated by the prolog/epilog pass - Chain = DAG.getNode(ISD::CALLSEQ_START, MVT::Other, Chain, - DAG.getConstant(NumBytes, getPointerTy())); + Chain = DAG.getCALLSEQ_START(Chain, + DAG.getConstant(NumBytes, getPointerTy())); // Set up a copy of the stack pointer for use loading and storing any // arguments that may not fit in the registers available for argument From lattner at cs.uiuc.edu Mon Feb 13 03:00:56 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 13 Feb 2006 03:00:56 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp Message-ID: <200602130900.DAA03457@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: SparcISelDAGToDAG.cpp updated: 1.83 -> 1.84 --- Log message: Switch targets over to using SelectionDAG::getCALLSEQ_START to create CALLSEQ_START nodes. --- Diffs of the changes: (+1 -2) SparcISelDAGToDAG.cpp | 3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp diff -u llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp:1.83 llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp:1.84 --- llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp:1.83 Fri Feb 10 01:35:42 2006 +++ llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp Mon Feb 13 03:00:43 2006 @@ -481,8 +481,7 @@ // Keep stack frames 8-byte aligned. ArgsSize = (ArgsSize+7) & ~7; - Chain = DAG.getNode(ISD::CALLSEQ_START, MVT::Other, Chain, - DAG.getConstant(ArgsSize, getPointerTy())); + Chain = DAG.getCALLSEQ_START(Chain,DAG.getConstant(ArgsSize, getPointerTy())); SDOperand StackPtr, NullSV; std::vector Stores; From lattner at cs.uiuc.edu Mon Feb 13 03:00:57 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 13 Feb 2006 03:00:57 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200602130900.DAA03461@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.79 -> 1.80 --- Log message: Switch targets over to using SelectionDAG::getCALLSEQ_START to create CALLSEQ_START nodes. --- Diffs of the changes: (+4 -6) X86ISelLowering.cpp | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.79 llvm/lib/Target/X86/X86ISelLowering.cpp:1.80 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.79 Tue Feb 7 02:38:37 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Mon Feb 13 03:00:43 2006 @@ -382,8 +382,7 @@ if (Args.empty()) { // Save zero bytes. - Chain = DAG.getNode(ISD::CALLSEQ_START, MVT::Other, Chain, - DAG.getConstant(0, getPointerTy())); + Chain = DAG.getCALLSEQ_START(Chain, DAG.getConstant(0, getPointerTy())); } else { for (unsigned i = 0, e = Args.size(); i != e; ++i) switch (getValueType(Args[i].second)) { @@ -401,8 +400,8 @@ break; } - Chain = DAG.getNode(ISD::CALLSEQ_START, MVT::Other, Chain, - DAG.getConstant(NumBytes, getPointerTy())); + Chain = DAG.getCALLSEQ_START(Chain, + DAG.getConstant(NumBytes, getPointerTy())); // Arguments go on the stack in reverse order, as specified by the ABI. unsigned ArgOffset = 0; @@ -846,8 +845,7 @@ if ((NumBytes & 7) == 0) NumBytes += 4; - Chain = DAG.getNode(ISD::CALLSEQ_START, MVT::Other, Chain, - DAG.getConstant(NumBytes, getPointerTy())); + Chain = DAG.getCALLSEQ_START(Chain,DAG.getConstant(NumBytes, getPointerTy())); // Arguments go on the stack in reverse order, as specified by the ABI. unsigned ArgOffset = 0; From lattner at cs.uiuc.edu Mon Feb 13 03:00:57 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 13 Feb 2006 03:00:57 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelLowering.cpp Message-ID: <200602130900.DAA03465@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaISelLowering.cpp updated: 1.37 -> 1.38 --- Log message: Switch targets over to using SelectionDAG::getCALLSEQ_START to create CALLSEQ_START nodes. --- Diffs of the changes: (+2 -2) AlphaISelLowering.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Target/Alpha/AlphaISelLowering.cpp diff -u llvm/lib/Target/Alpha/AlphaISelLowering.cpp:1.37 llvm/lib/Target/Alpha/AlphaISelLowering.cpp:1.38 --- llvm/lib/Target/Alpha/AlphaISelLowering.cpp:1.37 Wed Feb 1 01:19:44 2006 +++ llvm/lib/Target/Alpha/AlphaISelLowering.cpp Mon Feb 13 03:00:43 2006 @@ -327,8 +327,8 @@ if (Args.size() > 6) NumBytes = (Args.size() - 6) * 8; - Chain = DAG.getNode(ISD::CALLSEQ_START, MVT::Other, Chain, - DAG.getConstant(NumBytes, getPointerTy())); + Chain = DAG.getCALLSEQ_START(Chain, + DAG.getConstant(NumBytes, getPointerTy())); std::vector args_to_use; for (unsigned i = 0, e = Args.size(); i != e; ++i) { From lattner at cs.uiuc.edu Mon Feb 13 03:00:57 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 13 Feb 2006 03:00:57 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/IA64/IA64ISelLowering.cpp Message-ID: <200602130900.DAA03469@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/IA64: IA64ISelLowering.cpp updated: 1.33 -> 1.34 --- Log message: Switch targets over to using SelectionDAG::getCALLSEQ_START to create CALLSEQ_START nodes. --- Diffs of the changes: (+1 -2) IA64ISelLowering.cpp | 3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/lib/Target/IA64/IA64ISelLowering.cpp diff -u llvm/lib/Target/IA64/IA64ISelLowering.cpp:1.33 llvm/lib/Target/IA64/IA64ISelLowering.cpp:1.34 --- llvm/lib/Target/IA64/IA64ISelLowering.cpp:1.33 Wed Feb 1 01:19:44 2006 +++ llvm/lib/Target/IA64/IA64ISelLowering.cpp Mon Feb 13 03:00:43 2006 @@ -323,8 +323,7 @@ //assert(NumBytes==((NumBytes+15) & ~15) && "stack frame not 16-byte aligned!"); NumBytes = (NumBytes+15) & ~15; - Chain = DAG.getNode(ISD::CALLSEQ_START, MVT::Other, Chain, - DAG.getConstant(NumBytes, getPointerTy())); + Chain = DAG.getCALLSEQ_START(Chain,DAG.getConstant(NumBytes, getPointerTy())); SDOperand StackPtr, NullSV; std::vector Stores; From lattner at cs.uiuc.edu Mon Feb 13 03:18:14 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 13 Feb 2006 03:18:14 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200602130918.DAA18642@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.301 -> 1.302 --- Log message: Completely rewrite libcall insertion by the legalizer, providing the following handy-dandy properties: 1. it is always correct now 2. it is much faster than before 3. it is easier to understand This implementation builds off of the recent simplifications of the legalizer that made it single-pass instead of iterative. This fixes JM/lencod, JM/ldecod, and CodeGen/Generic/2006-02-12-InsertLibcall.ll (at least on PPC). --- Diffs of the changes: (+217 -198) LegalizeDAG.cpp | 415 +++++++++++++++++++++++++++++--------------------------- 1 files changed, 217 insertions(+), 198 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.301 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.302 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.301 Wed Feb 1 13:05:15 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Feb 13 03:18:02 2006 @@ -41,12 +41,24 @@ TargetLowering &TLI; SelectionDAG &DAG; + // Libcall insertion helpers. + + /// LastCALLSEQ_END - This keeps track of the CALLSEQ_END node that has been + /// legalized. We use this to ensure that calls are properly serialized + /// against each other, including inserted libcalls. + SDOperand LastCALLSEQ_END; + + /// IsLegalizingCall - This member is used *only* for purposes of providing + /// helpful assertions that a libcall isn't created while another call is + /// being legalized (which could lead to non-serialized call sequences). + bool IsLegalizingCall; + enum LegalizeAction { Legal, // The target natively supports this operation. Promote, // This operation should be executed in a larger type. Expand, // Try to expand this to other ops, otherwise use a libcall. }; - + /// ValueTypeActions - This is a bitvector that contains two bits for each /// value type, where the two bits correspond to the LegalizeAction enum. /// This can be queried with "getTypeAction(VT)". @@ -106,6 +118,8 @@ void ExpandOp(SDOperand O, SDOperand &Lo, SDOperand &Hi); SDOperand PromoteOp(SDOperand O); + bool LegalizeAllNodesNotLeadingTo(SDNode *N, SDNode *Dest); + void LegalizeSetCCOperands(SDOperand &LHS, SDOperand &RHS, SDOperand &CC); SDOperand ExpandLibCall(const char *Name, SDNode *Node, @@ -128,7 +142,6 @@ SDOperand &Lo, SDOperand &Hi); void ExpandShiftParts(unsigned NodeOp, SDOperand Op, SDOperand Amt, SDOperand &Lo, SDOperand &Hi); - void SpliceCallInto(const SDOperand &CallResult, SDNode *OutChain); SDOperand getIntPtrConstant(uint64_t Val) { return DAG.getConstant(Val, TLI.getPointerTy()); @@ -174,6 +187,9 @@ void SelectionDAGLegalize::LegalizeDAG() { + LastCALLSEQ_END = DAG.getEntryNode(); + IsLegalizingCall = false; + // The legalize process is inherently a bottom-up recursive process (users // legalize their uses before themselves). Given infinite stack space, we // could just start legalizing on the root and traverse the whole graph. In @@ -230,6 +246,107 @@ DAG.RemoveDeadNodes(OldRoot.Val); } + +/// FindCallEndFromCallStart - Given a chained node that is part of a call +/// sequence, find the CALLSEQ_END node that terminates the call sequence. +static SDNode *FindCallEndFromCallStart(SDNode *Node) { + if (Node->getOpcode() == ISD::CALLSEQ_END) + return Node; + if (Node->use_empty()) + return 0; // No CallSeqEnd + + // The chain is usually at the end. + SDOperand TheChain(Node, Node->getNumValues()-1); + if (TheChain.getValueType() != MVT::Other) { + // Sometimes it's at the beginning. + TheChain = SDOperand(Node, 0); + if (TheChain.getValueType() != MVT::Other) { + // Otherwise, hunt for it. + for (unsigned i = 1, e = Node->getNumValues(); i != e; ++i) + if (Node->getValueType(i) == MVT::Other) { + TheChain = SDOperand(Node, i); + break; + } + + // Otherwise, we walked into a node without a chain. + if (TheChain.getValueType() != MVT::Other) + return 0; + } + } + + for (SDNode::use_iterator UI = Node->use_begin(), + E = Node->use_end(); UI != E; ++UI) { + + // Make sure to only follow users of our token chain. + SDNode *User = *UI; + for (unsigned i = 0, e = User->getNumOperands(); i != e; ++i) + if (User->getOperand(i) == TheChain) + if (SDNode *Result = FindCallEndFromCallStart(User)) + return Result; + } + return 0; +} + +/// FindCallStartFromCallEnd - Given a chained node that is part of a call +/// sequence, find the CALLSEQ_START node that initiates the call sequence. +static SDNode *FindCallStartFromCallEnd(SDNode *Node) { + assert(Node && "Didn't find callseq_start for a call??"); + if (Node->getOpcode() == ISD::CALLSEQ_START) return Node; + + assert(Node->getOperand(0).getValueType() == MVT::Other && + "Node doesn't have a token chain argument!"); + return FindCallStartFromCallEnd(Node->getOperand(0).Val); +} + +/// LegalizeAllNodesNotLeadingTo - Recursively walk the uses of N, looking to +/// see if any uses can reach Dest. If no dest operands can get to dest, +/// legalize them, legalize ourself, and return false, otherwise, return true. +bool SelectionDAGLegalize::LegalizeAllNodesNotLeadingTo(SDNode *N, + SDNode *Dest) { + if (N == Dest) return true; // N certainly leads to Dest :) + + // If the first result of this node has been already legalized, then it cannot + // reach N. + switch (getTypeAction(N->getValueType(0))) { + case Legal: + if (LegalizedNodes.count(SDOperand(N, 0))) return false; + break; + case Promote: + if (PromotedNodes.count(SDOperand(N, 0))) return false; + break; + case Expand: + if (ExpandedNodes.count(SDOperand(N, 0))) return false; + break; + } + + // Okay, this node has not already been legalized. Check and legalize all + // operands. If none lead to Dest, then we can legalize this node. + bool OperandsLeadToDest = false; + for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) + OperandsLeadToDest |= // If an operand leads to Dest, so do we. + LegalizeAllNodesNotLeadingTo(N->getOperand(i).Val, Dest); + + if (OperandsLeadToDest) return true; + + // Okay, this node looks safe, legalize it and return false. + switch (getTypeAction(N->getValueType(0))) { + case Legal: + LegalizeOp(SDOperand(N, 0)); + break; + case Promote: + PromoteOp(SDOperand(N, 0)); + break; + case Expand: { + SDOperand X, Y; + ExpandOp(SDOperand(N, 0), X, Y); + break; + } + } + return false; +} + + + SDOperand SelectionDAGLegalize::LegalizeOp(SDOperand Op) { assert(isTypeLegal(Op.getValueType()) && "Caller should expand or promote operands that are not legal!"); @@ -586,8 +703,62 @@ } break; - case ISD::CALLSEQ_START: + case ISD::CALLSEQ_START: { + SDNode *CallEnd = FindCallEndFromCallStart(Node); + + // Recursively Legalize all of the inputs of the call end that do not lead + // to this call start. This ensures that any libcalls that need be inserted + // are inserted *before* the CALLSEQ_START. + for (unsigned i = 0, e = CallEnd->getNumOperands(); i != e; ++i) + LegalizeAllNodesNotLeadingTo(CallEnd->getOperand(i).Val, Node); + + // Now that we legalized all of the inputs (which may have inserted + // libcalls) create the new CALLSEQ_START node. + Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain. + + // Merge in the last call, to ensure that this call start after the last + // call ended. + Tmp1 = DAG.getNode(ISD::TokenFactor, MVT::Other, Tmp1, LastCALLSEQ_END); + Tmp1 = LegalizeOp(Tmp1); + + // Do not try to legalize the target-specific arguments (#1+). + if (Tmp1 != Node->getOperand(0)) { + std::vector Ops(Node->op_begin(), Node->op_end()); + Ops[0] = Tmp1; + Result = DAG.UpdateNodeOperands(Result, Ops); + } + + // Remember that the CALLSEQ_START is legalized. + AddLegalizedOperand(Op, Result); + + // Now that the callseq_start and all of the non-call nodes above this call + // sequence have been legalized, legalize the call itself. During this + // process, no libcalls can/will be inserted, guaranteeing that no calls + // can overlap. + assert(!IsLegalizingCall && "Inconsistent sequentialization of calls!"); + SDOperand InCallSEQ = LastCALLSEQ_END; + // Note that we are selecting this call! + LastCALLSEQ_END = SDOperand(CallEnd, 0); + IsLegalizingCall = true; + + // Legalize the call, starting from the CALLSEQ_END. + LegalizeOp(LastCALLSEQ_END); + assert(!IsLegalizingCall && "CALLSEQ_END should have cleared this!"); + return Result; + } case ISD::CALLSEQ_END: + // If the CALLSEQ_START node hasn't been legalized first, legalize it. This + // will cause this node to be legalized as well as handling libcalls right. + if (LastCALLSEQ_END.Val != Node) { + LegalizeOp(SDOperand(FindCallStartFromCallEnd(Node), 0)); + std::map::iterator I = LegalizedNodes.find(Op); + assert(I != LegalizedNodes.end() && + "Legalizing the call start should have legalized this node!"); + return I->second; + } + + // Otherwise, the call start has been legalized and everything is going + // according to plan. Just legalize ourselves normally here. Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain. // Do not try to legalize the target-specific arguments (#1+), except for // an optional flag input. @@ -607,6 +778,9 @@ Result = DAG.UpdateNodeOperands(Result, Ops); } } + assert(IsLegalizingCall && "imbalance between START/END?"); + // This finishes up call legalization. + IsLegalizingCall = false; break; case ISD::DYNAMIC_STACKALLOC: { Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain. @@ -669,12 +843,21 @@ return Result.getValue(Op.ResNo); case ISD::BR: Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain. + // Ensure that libcalls are emitted before a branch. + Tmp1 = DAG.getNode(ISD::TokenFactor, MVT::Other, Tmp1, LastCALLSEQ_END); + Tmp1 = LegalizeOp(Tmp1); + LastCALLSEQ_END = DAG.getEntryNode(); + Result = DAG.UpdateNodeOperands(Result, Tmp1, Node->getOperand(1)); break; case ISD::BRCOND: Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain. - + // Ensure that libcalls are emitted before a return. + Tmp1 = DAG.getNode(ISD::TokenFactor, MVT::Other, Tmp1, LastCALLSEQ_END); + Tmp1 = LegalizeOp(Tmp1); + LastCALLSEQ_END = DAG.getEntryNode(); + switch (getTypeAction(Node->getOperand(1).getValueType())) { case Expand: assert(0 && "It's impossible to expand bools"); case Legal: @@ -719,6 +902,11 @@ break; case ISD::BR_CC: Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain. + // Ensure that libcalls are emitted before a branch. + Tmp1 = DAG.getNode(ISD::TokenFactor, MVT::Other, Tmp1, LastCALLSEQ_END); + Tmp1 = LegalizeOp(Tmp1); + LastCALLSEQ_END = DAG.getEntryNode(); + Tmp2 = Node->getOperand(2); // LHS Tmp3 = Node->getOperand(3); // RHS Tmp4 = Node->getOperand(1); // CC @@ -798,6 +986,11 @@ break; case ISD::BRTWOWAY_CC: { Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain. + // Ensure that libcalls are emitted before a branch. + Tmp1 = DAG.getNode(ISD::TokenFactor, MVT::Other, Tmp1, LastCALLSEQ_END); + Tmp1 = LegalizeOp(Tmp1); + LastCALLSEQ_END = DAG.getEntryNode(); + Tmp2 = Node->getOperand(2); // LHS Tmp3 = Node->getOperand(3); // RHS Tmp4 = Node->getOperand(1); // CC @@ -982,6 +1175,12 @@ case ISD::RET: Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain. + + // Ensure that libcalls are emitted before a return. + Tmp1 = DAG.getNode(ISD::TokenFactor, MVT::Other, Tmp1, LastCALLSEQ_END); + Tmp1 = LegalizeOp(Tmp1); + LastCALLSEQ_END = DAG.getEntryNode(); + switch (Node->getNumOperands()) { case 2: // ret val switch (getTypeAction(Node->getOperand(1).getValueType())) { @@ -2803,169 +3002,6 @@ return false; } -/// FindLatestCallSeqStart - Scan up the dag to find the latest (highest -/// NodeDepth) node that is an CallSeqStart operation and occurs later than -/// Found. -static void FindLatestCallSeqStart(SDNode *Node, SDNode *&Found, - std::set &Visited) { - if (Node->getNodeDepth() <= Found->getNodeDepth() || - !Visited.insert(Node).second) return; - - // If we found an CALLSEQ_START, we already know this node occurs later - // than the Found node. Just remember this node and return. - if (Node->getOpcode() == ISD::CALLSEQ_START) { - Found = Node; - return; - } - - // Otherwise, scan the operands of Node to see if any of them is a call. - assert(Node->getNumOperands() != 0 && - "All leaves should have depth equal to the entry node!"); - for (unsigned i = 0, e = Node->getNumOperands()-1; i != e; ++i) - FindLatestCallSeqStart(Node->getOperand(i).Val, Found, Visited); - - // Tail recurse for the last iteration. - FindLatestCallSeqStart(Node->getOperand(Node->getNumOperands()-1).Val, - Found, Visited); -} - - -/// FindEarliestCallSeqEnd - Scan down the dag to find the earliest (lowest -/// NodeDepth) node that is an CallSeqEnd operation and occurs more recent -/// than Found. -static void FindEarliestCallSeqEnd(SDNode *Node, SDNode *&Found, - std::set &Visited) { - if ((Found && Node->getNodeDepth() >= Found->getNodeDepth()) || - !Visited.insert(Node).second) return; - - // If we found an CALLSEQ_END, we already know this node occurs earlier - // than the Found node. Just remember this node and return. - if (Node->getOpcode() == ISD::CALLSEQ_END) { - Found = Node; - return; - } - - // Otherwise, scan the operands of Node to see if any of them is a call. - SDNode::use_iterator UI = Node->use_begin(), E = Node->use_end(); - if (UI == E) return; - for (--E; UI != E; ++UI) - FindEarliestCallSeqEnd(*UI, Found, Visited); - - // Tail recurse for the last iteration. - FindEarliestCallSeqEnd(*UI, Found, Visited); -} - -/// FindCallSeqEnd - Given a chained node that is part of a call sequence, -/// find the CALLSEQ_END node that terminates the call sequence. -static SDNode *FindCallSeqEnd(SDNode *Node) { - if (Node->getOpcode() == ISD::CALLSEQ_END) - return Node; - if (Node->use_empty()) - return 0; // No CallSeqEnd - - // The chain is usually at the end. - SDOperand TheChain(Node, Node->getNumValues()-1); - if (TheChain.getValueType() != MVT::Other) { - // Sometimes it's at the beginning. - TheChain = SDOperand(Node, 0); - if (TheChain.getValueType() != MVT::Other) { - // Otherwise, hunt for it. - for (unsigned i = 1, e = Node->getNumValues(); i != e; ++i) - if (Node->getValueType(i) == MVT::Other) { - TheChain = SDOperand(Node, i); - break; - } - - // Otherwise, we walked into a node without a chain. - if (TheChain.getValueType() != MVT::Other) - return 0; - } - } - - for (SDNode::use_iterator UI = Node->use_begin(), - E = Node->use_end(); UI != E; ++UI) { - - // Make sure to only follow users of our token chain. - SDNode *User = *UI; - for (unsigned i = 0, e = User->getNumOperands(); i != e; ++i) - if (User->getOperand(i) == TheChain) - if (SDNode *Result = FindCallSeqEnd(User)) - return Result; - } - return 0; -} - -/// FindCallSeqStart - Given a chained node that is part of a call sequence, -/// find the CALLSEQ_START node that initiates the call sequence. -static SDNode *FindCallSeqStart(SDNode *Node) { - assert(Node && "Didn't find callseq_start for a call??"); - if (Node->getOpcode() == ISD::CALLSEQ_START) return Node; - - assert(Node->getOperand(0).getValueType() == MVT::Other && - "Node doesn't have a token chain argument!"); - return FindCallSeqStart(Node->getOperand(0).Val); -} - - -/// FindInputOutputChains - If we are replacing an operation with a call we need -/// to find the call that occurs before and the call that occurs after it to -/// properly serialize the calls in the block. The returned operand is the -/// input chain value for the new call (e.g. the entry node or the previous -/// call), and OutChain is set to be the chain node to update to point to the -/// end of the call chain. -static SDOperand FindInputOutputChains(SDNode *OpNode, SDNode *&OutChain, - SDOperand Entry) { - SDNode *LatestCallSeqStart = Entry.Val; - SDNode *LatestCallSeqEnd = 0; - std::set Visited; - FindLatestCallSeqStart(OpNode, LatestCallSeqStart, Visited); - Visited.clear(); - //std::cerr<<"Found node: "; LatestCallSeqStart->dump(); std::cerr <<"\n"; - - // It is possible that no ISD::CALLSEQ_START was found because there is no - // previous call in the function. LatestCallStackDown may in that case be - // the entry node itself. Do not attempt to find a matching CALLSEQ_END - // unless LatestCallStackDown is an CALLSEQ_START. - if (LatestCallSeqStart->getOpcode() == ISD::CALLSEQ_START) { - LatestCallSeqEnd = FindCallSeqEnd(LatestCallSeqStart); - //std::cerr<<"Found end node: "; LatestCallSeqEnd->dump(); std::cerr <<"\n"; - } else { - LatestCallSeqEnd = Entry.Val; - } - assert(LatestCallSeqEnd && "NULL return from FindCallSeqEnd"); - - // Finally, find the first call that this must come before, first we find the - // CallSeqEnd that ends the call. - OutChain = 0; - FindEarliestCallSeqEnd(OpNode, OutChain, Visited); - Visited.clear(); - - // If we found one, translate from the adj up to the callseq_start. - if (OutChain) - OutChain = FindCallSeqStart(OutChain); - - return SDOperand(LatestCallSeqEnd, 0); -} - -/// SpliceCallInto - Given the result chain of a libcall (CallResult), and a -void SelectionDAGLegalize::SpliceCallInto(const SDOperand &CallResult, - SDNode *OutChain) { - // Nothing to splice it into? - if (OutChain == 0) return; - - assert(OutChain->getOperand(0).getValueType() == MVT::Other); - //OutChain->dump(); - - // Form a token factor node merging the old inval and the new inval. - SDOperand InToken = DAG.getNode(ISD::TokenFactor, MVT::Other, CallResult, - OutChain->getOperand(0)); - // Change the node to refer to the new token. - std::vector Ops(OutChain->op_begin(), OutChain->op_end()); - Ops[0] = InToken; - SDOperand Res = DAG.UpdateNodeOperands(SDOperand(OutChain, 0), Ops); - assert(Res.Val == OutChain && "Didn't update in place!"); -} - // ExpandLibCall - Expand a node into a call to a libcall. If the result value // does not fit into a register, return the lo part and set the hi part to the @@ -2973,12 +3009,12 @@ // and leave the Hi part unset. SDOperand SelectionDAGLegalize::ExpandLibCall(const char *Name, SDNode *Node, SDOperand &Hi) { - SDNode *OutChain; - SDOperand InChain = FindInputOutputChains(Node, OutChain, - DAG.getEntryNode()); - if (InChain.Val == 0) - InChain = DAG.getEntryNode(); - + assert(!IsLegalizingCall && "Cannot overlap legalization of calls!"); + // The input chain to this libcall is the entry node of the function. + // Legalizing the call will automatically add the previous call to the + // dependence. + SDOperand InChain = DAG.getEntryNode(); + TargetLowering::ArgListTy Args; for (unsigned i = 0, e = Node->getNumOperands(); i != e; ++i) { MVT::ValueType ArgVT = Node->getOperand(i).getValueType(); @@ -2993,6 +3029,10 @@ TLI.LowerCallTo(InChain, RetTy, false, CallingConv::C, false, Callee, Args, DAG); + // Legalize the call sequence, starting with the chain. This will advance + // the LastCALLSEQ_END to the legalized version of the CALLSEQ_END node that + // was added by LowerCallTo (guaranteeing proper serialization of calls). + LegalizeOp(CallInfo.second); SDOperand Result; switch (getTypeAction(CallInfo.first.getValueType())) { default: assert(0 && "Unknown thing"); @@ -3003,9 +3043,6 @@ ExpandOp(CallInfo.first, Result, Hi); break; } - - CallInfo.second = LegalizeOp(CallInfo.second); - SpliceCallInto(CallInfo.second, OutChain); return Result; } @@ -3078,9 +3115,6 @@ ExpandOp(Source, SrcLo, SrcHi); Source = DAG.getNode(ISD::BUILD_PAIR, Source.getValueType(), SrcLo, SrcHi); - SDNode *OutChain = 0; - SDOperand InChain = FindInputOutputChains(Source.Val, OutChain, - DAG.getEntryNode()); const char *FnName = 0; if (DestTy == MVT::f32) FnName = "__floatdisf"; @@ -3088,25 +3122,10 @@ assert(DestTy == MVT::f64 && "Unknown fp value type!"); FnName = "__floatdidf"; } - - SDOperand Callee = DAG.getExternalSymbol(FnName, TLI.getPointerTy()); - - TargetLowering::ArgListTy Args; - const Type *ArgTy = MVT::getTypeForValueType(Source.getValueType()); - - Args.push_back(std::make_pair(Source, ArgTy)); - - // We don't care about token chains for libcalls. We just use the entry - // node as our input and ignore the output chain. This allows us to place - // calls wherever we need them to satisfy data dependences. - const Type *RetTy = MVT::getTypeForValueType(DestTy); - - std::pair CallResult = - TLI.LowerCallTo(InChain, RetTy, false, CallingConv::C, true, - Callee, Args, DAG); - - SpliceCallInto(CallResult.second, OutChain); - return CallResult.first; + + Source = DAG.getNode(ISD::SINT_TO_FP, DestTy, Source); + SDOperand UnusedHiPart; + return ExpandLibCall("__floatdidf", Source.Val, UnusedHiPart); } /// ExpandLegalINT_TO_FP - This function is responsible for legalizing a From jlaskey at apple.com Mon Feb 13 06:51:02 2006 From: jlaskey at apple.com (Jim Laskey) Date: Mon, 13 Feb 2006 06:51:02 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineDebugInfo.h Message-ID: <200602131251.GAA28543@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineDebugInfo.h updated: 1.14 -> 1.15 --- Log message: Rename to better reflect usage (current and planned.) --- Diffs of the changes: (+3 -2) MachineDebugInfo.h | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) Index: llvm/include/llvm/CodeGen/MachineDebugInfo.h diff -u llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.14 llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.15 --- llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.14 Fri Feb 10 19:01:30 2006 +++ llvm/include/llvm/CodeGen/MachineDebugInfo.h Mon Feb 13 06:50:38 2006 @@ -584,9 +584,10 @@ /// bool doFinalization(); - /// Deserialize - Convert a Value to a debug information descriptor. + /// getDescFor - Convert a Value to a debug information descriptor. /// - DebugInfoDesc *Deserialize(Value *V); + // FIXME - use new Value type when available. + DebugInfoDesc *getDescFor(Value *V); /// Verify - Verify that a Value is debug information descriptor. /// From jlaskey at apple.com Mon Feb 13 06:51:02 2006 From: jlaskey at apple.com (Jim Laskey) Date: Mon, 13 Feb 2006 06:51:02 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/MachineDebugInfo.cpp Message-ID: <200602131251.GAA28542@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: MachineDebugInfo.cpp updated: 1.13 -> 1.14 --- Log message: Rename to better reflect usage (current and planned.) --- Diffs of the changes: (+3 -2) MachineDebugInfo.cpp | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/MachineDebugInfo.cpp diff -u llvm/lib/CodeGen/MachineDebugInfo.cpp:1.13 llvm/lib/CodeGen/MachineDebugInfo.cpp:1.14 --- llvm/lib/CodeGen/MachineDebugInfo.cpp:1.13 Fri Feb 10 19:01:30 2006 +++ llvm/lib/CodeGen/MachineDebugInfo.cpp Mon Feb 13 06:50:38 2006 @@ -887,9 +887,10 @@ return false; } -/// Deserialize - Convert a Value to a debug information descriptor. +/// getDescFor - Convert a Value to a debug information descriptor. /// -DebugInfoDesc *MachineDebugInfo::Deserialize(Value *V) { +// FIXME - use new Value type when available. +DebugInfoDesc *MachineDebugInfo::getDescFor(Value *V) { return DR.Deserialize(V); } From jlaskey at apple.com Mon Feb 13 06:51:02 2006 From: jlaskey at apple.com (Jim Laskey) Date: Mon, 13 Feb 2006 06:51:02 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200602131251.GAA28541@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.151 -> 1.152 --- Log message: Rename to better reflect usage (current and planned.) --- Diffs of the changes: (+1 -1) SelectionDAGISel.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.151 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.152 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.151 Fri Feb 10 19:01:30 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Feb 13 06:50:39 2006 @@ -954,7 +954,7 @@ // column Ops.push_back(getValue(I.getOperand(3))); - DebugInfoDesc *DD = DebugInfo->Deserialize(I.getOperand(4)); + DebugInfoDesc *DD = DebugInfo->getDescFor(I.getOperand(4)); assert(DD && "Not a debug information descriptor"); CompileUnitDesc *CompileUnit = dyn_cast(DD); assert(CompileUnit && "Not a compile unit"); From jlaskey at apple.com Mon Feb 13 10:56:56 2006 From: jlaskey at apple.com (Jim Laskey) Date: Mon, 13 Feb 2006 10:56:56 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineDebugInfo.h Message-ID: <200602131656.KAA06340@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineDebugInfo.h updated: 1.15 -> 1.16 --- Log message: Sync up the tag numbers with gcc4. --- Diffs of the changes: (+1 -9) MachineDebugInfo.h | 10 +--------- 1 files changed, 1 insertion(+), 9 deletions(-) Index: llvm/include/llvm/CodeGen/MachineDebugInfo.h diff -u llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.15 llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.16 --- llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.15 Mon Feb 13 06:50:38 2006 +++ llvm/include/llvm/CodeGen/MachineDebugInfo.h Mon Feb 13 10:56:43 2006 @@ -58,17 +58,10 @@ DIInvalid = ~0U, // Invalid result indicator. // DebugInfoDesc type identifying tags. - // FIXME - Change over with gcc4. DI_TAG_anchor = 0, -#if 1 - DI_TAG_compile_unit = DW_TAG_compile_unit, - DI_TAG_global_variable = DW_TAG_variable, - DI_TAG_subprogram = DW_TAG_subprogram -#else DI_TAG_compile_unit, DI_TAG_global_variable, DI_TAG_subprogram -#endif }; //===----------------------------------------------------------------------===// @@ -78,8 +71,7 @@ public: DIVisitor() {} virtual ~DIVisitor() {} - - + /// ApplyToFields - Target the visitor to each field of the debug information /// descriptor. void ApplyToFields(DebugInfoDesc *DD); From alenhar2 at cs.uiuc.edu Mon Feb 13 12:52:23 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Mon, 13 Feb 2006 12:52:23 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/Alpha/srl_and.ll Message-ID: <200602131852.MAA20042@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/Alpha: srl_and.ll added (r1.1) --- Log message: test for improved zap discovery --- Diffs of the changes: (+10 -0) srl_and.ll | 10 ++++++++++ 1 files changed, 10 insertions(+) Index: llvm/test/Regression/CodeGen/Alpha/srl_and.ll diff -c /dev/null llvm/test/Regression/CodeGen/Alpha/srl_and.ll:1.1 *** /dev/null Mon Feb 13 12:52:11 2006 --- llvm/test/Regression/CodeGen/Alpha/srl_and.ll Mon Feb 13 12:52:01 2006 *************** *** 0 **** --- 1,10 ---- + ; Make sure this testcase codegens to the zapnot instruction + ; RUN: llvm-as < %s | llc -march=alpha | grep 'zapnot' + + ulong %foo(ulong %y) { + entry: + %tmp = shr ulong %y, ubyte 3 ; [#uses=1] + %tmp2 = and ulong %tmp, 8191 ; [#uses=1] + ret ulong %tmp2 + } + From alenhar2 at cs.uiuc.edu Mon Feb 13 12:52:45 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Mon, 13 Feb 2006 12:52:45 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp Message-ID: <200602131852.MAA20052@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Target/Alpha: AlphaISelDAGToDAG.cpp updated: 1.34 -> 1.35 --- Log message: improved zap discovery --- Diffs of the changes: (+33 -0) AlphaISelDAGToDAG.cpp | 33 +++++++++++++++++++++++++++++++++ 1 files changed, 33 insertions(+) Index: llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp diff -u llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp:1.34 llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp:1.35 --- llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp:1.34 Thu Feb 9 01:17:49 2006 +++ llvm/lib/Target/Alpha/AlphaISelDAGToDAG.cpp Mon Feb 13 12:52:29 2006 @@ -363,6 +363,39 @@ } break; + case ISD::AND: { + ConstantSDNode* SC; + ConstantSDNode* MC; + if (N->getOperand(0).getOpcode() == ISD::SRL && + (MC = dyn_cast(N->getOperand(1))) && + (SC = dyn_cast(N->getOperand(0).getOperand(1)))) + { + uint64_t sval = SC->getValue(); + uint64_t mval = MC->getValue(); + if (get_zapImm(mval)) //the result is a zap, let the autogened stuff deal + break; + // given mask X, and shift S, we want to see if there is any zap in the mask + // if we play around with the botton S bits + uint64_t dontcare = (~0ULL) >> (64 - sval); + uint64_t mask = mval << sval; + + if (get_zapImm(mask | dontcare)) + mask = mask | dontcare; + + if (get_zapImm(mask)) { + SDOperand Src; + Select(Src, N->getOperand(0).getOperand(0)); + SDOperand Z = + SDOperand(CurDAG->getTargetNode(Alpha::ZAPNOTi, MVT::i64, Src, + getI64Imm(get_zapImm(mask))), 0); + Result = SDOperand(CurDAG->getTargetNode(Alpha::SRL, MVT::i64, Z, + getI64Imm(sval)), 0); + return; + } + } + break; + } + } SelectCode(Result, Op); From lattner at cs.uiuc.edu Mon Feb 13 15:43:38 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 13 Feb 2006 15:43:38 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Mangler.cpp Message-ID: <200602132143.PAA12322@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Mangler.cpp updated: 1.26 -> 1.27 --- Log message: Another work around for the 'symbols with different types can have the same name' issue. --- Diffs of the changes: (+4 -0) Mangler.cpp | 4 ++++ 1 files changed, 4 insertions(+) Index: llvm/lib/VMCore/Mangler.cpp diff -u llvm/lib/VMCore/Mangler.cpp:1.26 llvm/lib/VMCore/Mangler.cpp:1.27 --- llvm/lib/VMCore/Mangler.cpp:1.26 Mon Nov 14 19:32:03 2005 +++ llvm/lib/VMCore/Mangler.cpp Mon Feb 13 15:43:26 2006 @@ -161,6 +161,10 @@ if (GV->hasExternalLinkage() && !ExistingValue->hasExternalLinkage()) { MangledGlobals.insert(ExistingValue); ExistingValue = GV; + } else if (GV->hasExternalLinkage() && ExistingValue->hasExternalLinkage()&& + GV->isExternal() && ExistingValue->isExternal()) { + // If the two globals both have external inkage, and are both external, + // don't mangle either of them, we just have some silly type mismatch. } else { // Otherwise, mangle GV MangledGlobals.insert(GV); From lattner at cs.uiuc.edu Mon Feb 13 16:22:54 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 13 Feb 2006 16:22:54 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp Message-ID: <200602132222.QAA12543@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/CBackend: Writer.cpp updated: 1.252 -> 1.253 --- Log message: Another hack due to allowing multiple symbols with the same name. --- Diffs of the changes: (+52 -11) Writer.cpp | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 52 insertions(+), 11 deletions(-) Index: llvm/lib/Target/CBackend/Writer.cpp diff -u llvm/lib/Target/CBackend/Writer.cpp:1.252 llvm/lib/Target/CBackend/Writer.cpp:1.253 --- llvm/lib/Target/CBackend/Writer.cpp:1.252 Fri Jan 20 14:43:57 2006 +++ llvm/lib/Target/CBackend/Writer.cpp Mon Feb 13 16:22:42 2006 @@ -47,10 +47,11 @@ // Register the target. RegisterTarget X("c", " C backend"); - /// NameAllUsedStructs - This pass inserts names for any unnamed structure - /// types that are used by the program. + /// CBackendNameAllUsedStructsAndMergeFunctions - This pass inserts names for + /// any unnamed structure types that are used by the program, and merges + /// external functions with the same name. /// - class CBackendNameAllUsedStructs : public ModulePass { + class CBackendNameAllUsedStructsAndMergeFunctions : public ModulePass { void getAnalysisUsage(AnalysisUsage &AU) const { AU.addRequired(); } @@ -119,7 +120,6 @@ private : void lowerIntrinsics(Function &F); - bool nameAllUsedStructureTypes(Module &M); void printModule(Module *M); void printModuleTypes(const SymbolTable &ST); void printContainedStructs(const Type *Ty, std::set &); @@ -224,7 +224,7 @@ /// the program, and removes names from structure types that are not used by the /// program. /// -bool CBackendNameAllUsedStructs::runOnModule(Module &M) { +bool CBackendNameAllUsedStructsAndMergeFunctions::runOnModule(Module &M) { // Get a set of types that are used by the program... std::set UT = getAnalysis().getTypes(); @@ -256,6 +256,44 @@ ++RenameCounter; Changed = true; } + + + // Loop over all external functions and globals. If we have two with + // identical names, merge them. + // FIXME: This code should disappear when we don't allow values with the same + // names when they have different types! + std::map ExtSymbols; + for (Module::iterator I = M.begin(), E = M.end(); I != E;) { + Function *GV = I++; + if (GV->isExternal() && GV->hasName()) { + std::pair::iterator, bool> X + = ExtSymbols.insert(std::make_pair(GV->getName(), GV)); + if (!X.second) { + // Found a conflict, replace this global with the previous one. + GlobalValue *OldGV = X.first->second; + GV->replaceAllUsesWith(ConstantExpr::getCast(OldGV, GV->getType())); + GV->eraseFromParent(); + Changed = true; + } + } + } + // Do the same for globals. + for (Module::global_iterator I = M.global_begin(), E = M.global_end(); + I != E;) { + GlobalVariable *GV = I++; + if (GV->isExternal() && GV->hasName()) { + std::pair::iterator, bool> X + = ExtSymbols.insert(std::make_pair(GV->getName(), GV)); + if (!X.second) { + // Found a conflict, replace this global with the previous one. + GlobalValue *OldGV = X.first->second; + GV->replaceAllUsesWith(ConstantExpr::getCast(OldGV, GV->getType())); + GV->eraseFromParent(); + Changed = true; + } + } + } + return Changed; } @@ -845,7 +883,8 @@ << "#define LLVM_NANSF(NanStr) __builtin_nansf(NanStr) /* Float */\n" << "#define LLVM_INF __builtin_inf() /* Double */\n" << "#define LLVM_INFF __builtin_inff() /* Float */\n" - << "#define LLVM_PREFETCH(addr,rw,locality) __builtin_prefetch(addr,rw,locality)\n" + << "#define LLVM_PREFETCH(addr,rw,locality) " + "__builtin_prefetch(addr,rw,locality)\n" << "#else\n" << "#define LLVM_NAN(NanStr) ((double)0.0) /* Double */\n" << "#define LLVM_NANF(NanStr) 0.0F /* Float */\n" @@ -905,7 +944,8 @@ // Global variable declarations... if (!M.global_empty()) { Out << "\n/* External Global Variable Declarations */\n"; - for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) { + for (Module::global_iterator I = M.global_begin(), E = M.global_end(); + I != E; ++I) { if (I->hasExternalLinkage()) { Out << "extern "; printType(Out, I->getType()->getElementType(), Mang->getValueName(I)); @@ -935,7 +975,8 @@ // Output the global variable declarations if (!M.global_empty()) { Out << "\n\n/* Global Variable Declarations */\n"; - for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) + for (Module::global_iterator I = M.global_begin(), E = M.global_end(); + I != E; ++I) if (!I->isExternal()) { if (I->hasInternalLinkage()) Out << "static "; @@ -954,7 +995,8 @@ // Output the global variable definitions and contents... if (!M.global_empty()) { Out << "\n\n/* Global Variable Definitions and Initialization */\n"; - for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) + for (Module::global_iterator I = M.global_begin(), E = M.global_end(); + I != E; ++I) if (!I->isExternal()) { if (I->hasInternalLinkage()) Out << "static "; @@ -1507,7 +1549,6 @@ case Intrinsic::vastart: Out << "0; "; - // Out << "va_start(*(va_list*)&" << Mang->getValueName(&I) << ", "; Out << "va_start(*(va_list*)"; writeOperand(I.getOperand(1)); Out << ", "; @@ -1772,7 +1813,7 @@ PM.add(createLowerAllocationsPass(true)); PM.add(createLowerInvokePass()); PM.add(createCFGSimplificationPass()); // clean up after lower invoke. - PM.add(new CBackendNameAllUsedStructs()); + PM.add(new CBackendNameAllUsedStructsAndMergeFunctions()); PM.add(new CWriter(o, getIntrinsicLowering())); return false; } From lattner at cs.uiuc.edu Mon Feb 13 16:32:02 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 13 Feb 2006 16:32:02 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/2006-02-13-DemandedMiscompile.ll Message-ID: <200602132232.QAA12632@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/InstCombine: 2006-02-13-DemandedMiscompile.ll added (r1.1) --- Log message: testcase reduced from Ptrdist/bc that is miscompiled by recent instcombine changes. --- Diffs of the changes: (+9 -0) 2006-02-13-DemandedMiscompile.ll | 9 +++++++++ 1 files changed, 9 insertions(+) Index: llvm/test/Regression/Transforms/InstCombine/2006-02-13-DemandedMiscompile.ll diff -c /dev/null llvm/test/Regression/Transforms/InstCombine/2006-02-13-DemandedMiscompile.ll:1.1 *** /dev/null Mon Feb 13 16:32:00 2006 --- llvm/test/Regression/Transforms/InstCombine/2006-02-13-DemandedMiscompile.ll Mon Feb 13 16:31:50 2006 *************** *** 0 **** --- 1,9 ---- + ; RUN: llvm-as < %s | opt -instcombine -disable-output && + ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep undef + + int %test(sbyte %A) { + %B = cast sbyte %A to int + %C = shr int %B, ubyte 8 + ret int %C + } + From lattner at cs.uiuc.edu Mon Feb 13 16:41:19 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 13 Feb 2006 16:41:19 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200602132241.QAA12777@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.433 -> 1.434 --- Log message: If any of the sign extended bits are demanded, the input sign bit is demanded for a sign extension. This fixes InstCombine/2006-02-13-DemandedMiscompile.ll and Ptrdist/bc. --- Diffs of the changes: (+9 -3) InstructionCombining.cpp | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.433 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.434 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.433 Mon Feb 13 00:09:08 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Feb 13 16:41:07 2006 @@ -889,15 +889,21 @@ KnownZero |= NewBits; } else { // Sign extension. - if (SimplifyDemandedBits(I->getOperand(0), - DemandedMask & SrcTy->getIntegralTypeMask(), + uint64_t InSignBit = 1ULL << (SrcTy->getPrimitiveSizeInBits()-1); + int64_t InputDemandedBits = DemandedMask & SrcTy->getIntegralTypeMask(); + + // If any of the sign extended bits are demanded, we know that the sign + // bit is demanded. + if (NewBits & DemandedMask) + InputDemandedBits |= InSignBit; + + if (SimplifyDemandedBits(I->getOperand(0), InputDemandedBits, KnownZero, KnownOne, Depth+1)) return true; assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); // If the sign bit of the input is known set or clear, then we know the // top bits of the result. - uint64_t InSignBit = 1ULL << (SrcTy->getPrimitiveSizeInBits()-1); // If the input sign bit is known zero, or if the NewBits are not demanded // convert this into a zero extension. From lattner at cs.uiuc.edu Mon Feb 13 17:06:51 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 13 Feb 2006 17:06:51 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/PatternMatch.h Message-ID: <200602132306.RAA13019@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Support: PatternMatch.h updated: 1.6 -> 1.7 --- Log message: Fix typo that caused build failures for things trying to use m_Or. --- Diffs of the changes: (+2 -2) PatternMatch.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/include/llvm/Support/PatternMatch.h diff -u llvm/include/llvm/Support/PatternMatch.h:1.6 llvm/include/llvm/Support/PatternMatch.h:1.7 --- llvm/include/llvm/Support/PatternMatch.h:1.6 Tue Sep 27 01:38:05 2005 +++ llvm/include/llvm/Support/PatternMatch.h Mon Feb 13 17:06:39 2006 @@ -130,8 +130,8 @@ } template -inline BinaryOp_match m_Or(const LHS &L, - const RHS &R) { +inline BinaryOp_match m_Or(const LHS &L, + const RHS &R) { return BinaryOp_match(L, R); } From lattner at cs.uiuc.edu Mon Feb 13 17:07:14 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 13 Feb 2006 17:07:14 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/and.ll Message-ID: <200602132307.RAA13084@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/InstCombine: and.ll updated: 1.29 -> 1.30 --- Log message: new testcase --- Diffs of the changes: (+6 -0) and.ll | 6 ++++++ 1 files changed, 6 insertions(+) Index: llvm/test/Regression/Transforms/InstCombine/and.ll diff -u llvm/test/Regression/Transforms/InstCombine/and.ll:1.29 llvm/test/Regression/Transforms/InstCombine/and.ll:1.30 --- llvm/test/Regression/Transforms/InstCombine/and.ll:1.29 Sun May 8 23:54:18 2005 +++ llvm/test/Regression/Transforms/InstCombine/and.ll Mon Feb 13 17:07:02 2006 @@ -220,3 +220,9 @@ ret uint %tmp.13 } +int %test34(int %A, int %B) { + %tmp.2 = or int %B, %A + %tmp.4 = and int %tmp.2, %B + ret int %tmp.4 +} + From lattner at cs.uiuc.edu Mon Feb 13 17:07:34 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 13 Feb 2006 17:07:34 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200602132307.RAA13115@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.434 -> 1.435 --- Log message: Implement Instcombine/and.ll:test34 --- Diffs of the changes: (+12 -0) InstructionCombining.cpp | 12 ++++++++++++ 1 files changed, 12 insertions(+) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.434 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.435 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.434 Mon Feb 13 16:41:07 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Feb 13 17:07:23 2006 @@ -2439,6 +2439,18 @@ InsertNewInstBefore(Or, I); return BinaryOperator::createNot(Or); } + + { + Value *A = 0, *B = 0; + ConstantInt *C1 = 0, *C2 = 0; + if (match(Op0, m_Or(m_Value(A), m_Value(B)))) + if (A == Op1 || B == Op1) // (A | ?) & A --> A + return ReplaceInstUsesWith(I, Op1); + if (match(Op1, m_Or(m_Value(A), m_Value(B)))) + if (A == Op0 || B == Op0) // A & (A | ?) --> A + return ReplaceInstUsesWith(I, Op0); + } + if (SetCondInst *RHS = dyn_cast(Op1)) { // (setcc1 A, B) & (setcc2 A, B) --> (setcc3 A, B) From lattner at cs.uiuc.edu Mon Feb 13 18:55:14 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 13 Feb 2006 18:55:14 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200602140055.SAA17829@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.302 -> 1.303 --- Log message: Fix a latent bug in the call sequence handling stuff. Some targets (e.g. x86) create these nodes with flag results. Remember that we legalized them. --- Diffs of the changes: (+11 -4) LegalizeDAG.cpp | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.302 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.303 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.302 Mon Feb 13 03:18:02 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Feb 13 18:55:02 2006 @@ -729,8 +729,10 @@ } // Remember that the CALLSEQ_START is legalized. - AddLegalizedOperand(Op, Result); - + AddLegalizedOperand(Op.getValue(0), Result); + if (Node->getNumValues() == 2) // If this has a flag result, remember it. + AddLegalizedOperand(Op.getValue(1), Result.getValue(1)); + // Now that the callseq_start and all of the non-call nodes above this call // sequence have been legalized, legalize the call itself. During this // process, no libcalls can/will be inserted, guaranteeing that no calls @@ -778,10 +780,15 @@ Result = DAG.UpdateNodeOperands(Result, Ops); } } - assert(IsLegalizingCall && "imbalance between START/END?"); + assert(IsLegalizingCall && "Call sequence imbalance between start/end?"); // This finishes up call legalization. IsLegalizingCall = false; - break; + + // If the CALLSEQ_END node has a flag, remember that we legalized it. + AddLegalizedOperand(SDOperand(Node, 0), Result.getValue(0)); + if (Node->getNumValues() == 2) + AddLegalizedOperand(SDOperand(Node, 1), Result.getValue(1)); + return Result.getValue(Op.ResNo); case ISD::DYNAMIC_STACKALLOC: { Tmp1 = LegalizeOp(Node->getOperand(0)); // Legalize the chain. Tmp2 = LegalizeOp(Node->getOperand(1)); // Legalize the size. From lattner at cs.uiuc.edu Mon Feb 13 19:01:52 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 13 Feb 2006 19:01:52 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Message-ID: <200602140101.TAA17971@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LoopUnswitch.cpp updated: 1.17 -> 1.18 --- Log message: Use statistics to keep track of what flavors of loops we are unswitching --- Diffs of the changes: (+19 -7) LoopUnswitch.cpp | 26 +++++++++++++++++++------- 1 files changed, 19 insertions(+), 7 deletions(-) Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.17 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.18 --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.17 Fri Feb 10 18:43:37 2006 +++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Mon Feb 13 19:01:41 2006 @@ -44,7 +44,11 @@ using namespace llvm; namespace { - Statistic<> NumUnswitched("loop-unswitch", "Number of loops unswitched"); + Statistic<> NumBranches("loop-unswitch", "Number of branches unswitched"); + Statistic<> NumSwitches("loop-unswitch", "Number of switches unswitched"); + Statistic<> NumSelects ("loop-unswitch", "Number of selects unswitched"); + Statistic<> NumTrivial ("loop-unswitch", + "Number of unswitches that are trivial"); cl::opt Threshold("loop-unswitch-threshold", cl::desc("Max loop size to unswitch"), cl::init(10), cl::Hidden); @@ -267,8 +271,10 @@ // See if this, or some part of it, is loop invariant. If so, we can // unswitch on it if we desire. Value *LoopCond = FindLIVLoopCondition(BI->getCondition(), L, Changed); - if (LoopCond && UnswitchIfProfitable(LoopCond, ConstantBool::True, L)) + if (LoopCond && UnswitchIfProfitable(LoopCond, ConstantBool::True, L)) { + ++NumBranches; return true; + } } } else if (SwitchInst *SI = dyn_cast(TI)) { Value *LoopCond = FindLIVLoopCondition(SI->getCondition(), L, Changed); @@ -276,8 +282,10 @@ // Find a value to unswitch on: // FIXME: this should chose the most expensive case! Constant *UnswitchVal = SI->getCaseValue(1); - if (UnswitchIfProfitable(LoopCond, UnswitchVal, L)) + if (UnswitchIfProfitable(LoopCond, UnswitchVal, L)) { + ++NumSwitches; return true; + } } } @@ -286,8 +294,10 @@ BBI != E; ++BBI) if (SelectInst *SI = dyn_cast(BBI)) { Value *LoopCond = FindLIVLoopCondition(SI->getCondition(), L, Changed); - if (LoopCond && UnswitchIfProfitable(LoopCond, ConstantBool::True, L)) + if (LoopCond && UnswitchIfProfitable(LoopCond, ConstantBool::True, L)) { + ++NumSelects; return true; + } } } @@ -331,7 +341,6 @@ } else { VersionLoop(LoopCond, Val, L, NewLoop1, NewLoop2); } - ++NumUnswitched; //std::cerr << "AFTER:\n"; LI->dump(); @@ -462,6 +471,7 @@ // at least eliminate the old branch. RewriteLoopBodyWithConditionConstant(L, Cond, ConstantBool::get(EnterOnCond), true); + ++NumTrivial; } @@ -497,6 +507,7 @@ ExitBlocks.end()); // Split all of the edges from inside the loop to their exit blocks. This // unswitching trivial: no phi nodes to update. + unsigned NumBlocks = L->getBlocks().size(); for (unsigned i = 0, e = ExitBlocks.size(); i != e; ++i) { BasicBlock *ExitBlock = ExitBlocks[i]; std::vector Preds(pred_begin(ExitBlock), pred_end(ExitBlock)); @@ -525,8 +536,9 @@ NewBlocks.reserve(LoopBlocks.size()); std::map ValueMap; for (unsigned i = 0, e = LoopBlocks.size(); i != e; ++i) { - NewBlocks.push_back(CloneBasicBlock(LoopBlocks[i], ValueMap, ".us", F)); - ValueMap[LoopBlocks[i]] = NewBlocks.back(); // Keep the BB mapping. + BasicBlock *New = CloneBasicBlock(LoopBlocks[i], ValueMap, ".us", F); + NewBlocks.push_back(New); + ValueMap[LoopBlocks[i]] = New; // Keep the BB mapping. } // Splice the newly inserted blocks into the function right before the From lattner at cs.uiuc.edu Mon Feb 13 22:26:06 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 13 Feb 2006 22:26:06 -0600 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200602140426.WAA18871@zion.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.339 -> 1.340 --- Log message: wrap long lines --- Diffs of the changes: (+16 -9) Makefile.rules | 25 ++++++++++++++++--------- 1 files changed, 16 insertions(+), 9 deletions(-) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.339 llvm/Makefile.rules:1.340 --- llvm/Makefile.rules:1.339 Fri Jan 27 16:13:12 2006 +++ llvm/Makefile.rules Mon Feb 13 22:25:54 2006 @@ -930,7 +930,8 @@ $(Echo) Linking $(BuildMode) executable $(TOOLNAME) $(StripWarnMsg) $(Verb) $(Link) -o $@ $(TOOLLINKOPTS) $(ObjectsO) $(ProjLibsOptions) \ $(LLVMLibsOptions) $(ExtraLibs) $(TOOLLINKOPTSB) $(LIBS) - $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) $(StripWarnMsg) + $(Echo) ======= Finished Linking $(BuildMode) Executable $(TOOLNAME) \ + $(StripWarnMsg) DestTool = $(PROJ_bindir)/$(TOOLNAME) @@ -1021,19 +1022,22 @@ $(ObjDir)/%.ll: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(Echo) "Compiling $*.cpp for $(BuildMode) build (bytecode)" - $(Verb) if $(BCCompile.CXX) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCXXd" $< -o $@ -S -emit-llvm ; \ + $(Verb) if $(BCCompile.CXX) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCXXd" \ + $< -o $@ -S -emit-llvm ; \ then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \ else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi $(ObjDir)/%.ll: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(Echo) "Compiling $*.cc for $(BuildMode) build (bytecode)" - $(Verb) if $(BCCompile.CXX) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCXXd" $< -o $@ -S -emit-llvm ; \ + $(Verb) if $(BCCompile.CXX) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCXXd" \ + $< -o $@ -S -emit-llvm ; \ then $(MV) -f "$(ObjDir)/$*.BCCXXd" "$(ObjDir)/$*.d"; \ else $(RM) -f "$(ObjDir)/$*.BCCXXd"; exit 1; fi $(ObjDir)/%.ll: %.c $(ObjDir)/.dir $(BUILT_SOURCES) $(Echo) "Compiling $*.c for $(BuildMode) build (bytecode)" - $(Verb) if $(BCCompile.C) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCd" $< -o $@ -S -emit-llvm ; \ + $(Verb) if $(BCCompile.C) -MD -MT $@ -MP -MF "$(ObjDir)/$*.BCCd" \ + $< -o $@ -S -emit-llvm ; \ then $(MV) -f "$(ObjDir)/$*.BCCd" "$(ObjDir)/$*.d"; \ else $(RM) -f "$(ObjDir)/$*.BCCd"; exit 1; fi @@ -1109,7 +1113,9 @@ ifdef TARGET -TDFiles := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td) $(LLVM_SRC_ROOT)/lib/Target/Target.td $(LLVM_SRC_ROOT)/lib/Target/TargetSelectionDAG.td) +TDFiles := $(strip $(wildcard $(PROJ_SRC_DIR)/*.td) \ + $(LLVM_SRC_ROOT)/lib/Target/Target.td \ + $(LLVM_SRC_ROOT)/lib/Target/TargetSelectionDAG.td) INCFiles := $(filter %.inc,$(BUILT_SOURCES)) INCTMPFiles := $(INCFiles:%=$(ObjDir)/%.tmp) .PRECIOUS: $(INCTMPFiles) $(INCFiles) @@ -1578,11 +1584,12 @@ $(Verb) if [ -d "$(PROJ_SRC_ROOT)/include" ] ; then \ cd $(PROJ_SRC_ROOT)/include && \ $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f \ - '!' '(' -name '*~' -o -name '.cvsignore' -o -name '.#*' -o -name '*.in' ')' \ - -print ')' | grep -v CVS | sed 's#^#$(PROJ_includedir)/#'` ; \ + '!' '(' -name '*~' -o -name '.cvsignore' -o -name '.#*' \ + -o -name '*.in' ')' -print ')' | \ + grep -v CVS | sed 's#^#$(PROJ_includedir)/#'` ; \ cd $(PROJ_SRC_ROOT)/include && \ - $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f -name '*.in' -print ')' \ - | sed 's#\.in$$##;s#^#$(PROJ_includedir)/#'` ; \ + $(RM) -f `find . -path '*/Internal' -prune -o '(' -type f -name '*.in' \ + -print ')' | sed 's#\.in$$##;s#^#$(PROJ_includedir)/#'` ; \ fi endif From lattner at cs.uiuc.edu Mon Feb 13 22:27:27 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 13 Feb 2006 22:27:27 -0600 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200602140427.WAA18908@zion.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.340 -> 1.341 --- Log message: Wrap a couple more long lines --- Diffs of the changes: (+5 -4) Makefile.rules | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.340 llvm/Makefile.rules:1.341 --- llvm/Makefile.rules:1.340 Mon Feb 13 22:25:54 2006 +++ llvm/Makefile.rules Mon Feb 13 22:27:15 2006 @@ -10,7 +10,7 @@ # This file is included by all of the LLVM makefiles. For details on how to use # it properly, please see the document MakefileGuide.html in the docs directory. # -#===-----------------------------------------------------------------------==== +#===-----------------------------------------------------------------------====# ################################################################################ # TARGETS: Define standard targets that can be invoked @@ -961,13 +961,13 @@ $(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES) $(Echo) "Compiling $*.cpp for $(BuildMode) build (PIC)" - $(Verb) if $(LTCompile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACXXd $< -o $@ ; \ + $(Verb) if $(LTCompile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACXXd $< -o $@ ;\ then $(MV) -f "$(ObjDir)/$*.LACXXd" "$(ObjDir)/$*.d"; \ else $(RM) -f "$(ObjDir)/$*.LACXXd"; exit 1; fi $(ObjDir)/%.lo $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES) $(Echo) "Compiling $*.cc for $(BuildMode) build (PIC)" - $(Verb) if $(LTCompile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACXXd $< -o $@ ; \ + $(Verb) if $(LTCompile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACXXd $< -o $@ ;\ then $(MV) -f "$(ObjDir)/$*.LACXXd" "$(ObjDir)/$*.d"; \ else $(RM) -f "$(ObjDir)/$*.LACXXd"; exit 1; fi @@ -1530,7 +1530,8 @@ done $(Verb) if test "$(DistDir)" = "$(TopDistDir)" ; then \ $(EchoCmd) Eliminating CVS/.svn directories from distribution ; \ - $(RM) -rf `find $(TopDistDir) -type d \( -name CVS -o -name .svn \) -print` ;\ + $(RM) -rf `find $(TopDistDir) -type d \( -name CVS -o \ + -name .svn \) -print` ;\ $(MAKE) dist-hook ; \ $(FIND) $(TopDistDir) -type d ! -perm -777 -exec chmod a+rwx {} \; \ -o ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; \ From lattner at cs.uiuc.edu Mon Feb 13 23:12:13 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 13 Feb 2006 23:12:13 -0600 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200602140512.XAA19581@zion.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.341 -> 1.342 --- Log message: Implement an alternative way of handling generated lex files in CVS. This should solve the "updating cvs when .l files change give me conflict markers that break my build" issue. --- Diffs of the changes: (+14 -4) Makefile.rules | 18 ++++++++++++++---- 1 files changed, 14 insertions(+), 4 deletions(-) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.341 llvm/Makefile.rules:1.342 --- llvm/Makefile.rules:1.341 Mon Feb 13 22:27:15 2006 +++ llvm/Makefile.rules Mon Feb 13 23:12:00 2006 @@ -1204,6 +1204,8 @@ %.c: %.l %.cpp: %.l +all:: $(LexFiles:%.l=$(PROJ_SRC_DIR)/%.cpp.cvs) + # Note the extra sed filtering here, used to cut down on the warnings emited # by GCC. The last line is a gross hack to work around flex aparently not # being able to resize the buffer on a large token input. Currently, for @@ -1217,10 +1219,18 @@ $(SED) 's/void \*yy_flex_realloc/inline void *yy_flex_realloc/' | \ $(SED) 's/#define YY_BUF_SIZE 16384/#define YY_BUF_SIZE (16384*64)/' \ > $(PROJ_SRC_DIR)/$*.cpp - $(Echo) "*** DON'T FORGET TO CHECK IN $*.cpp (generated file)" + +# IFF the .l file has changed since it was last checked into CVS, copy the .l +# file to .l.cvs and the generated .cpp file to .cpp.cvs. We use this mechanism +# so that people without flex can build LLVM by copying the .cvs files to the +# source location and building them. +$(LexFiles:%.l=$(PROJ_SRC_DIR)/%.cpp.cvs): \ +$(PROJ_SRC_DIR)/%.cpp.cvs: $(PROJ_SRC_DIR)/%.cpp + $(Verb) $(CMP) -s $@ $< || \ + ($(CP) $< $@; $(CP) $(PROJ_SRC_DIR)/$*.l $(PROJ_SRC_DIR)/$*.l.cvs) -LexObjs := $(patsubst %.l,$(ObjDir)/%.o,$(LexFiles)) -$(LexObjs): $(ObjDir)/%.o : $(PROJ_SRC_DIR)/%.cpp +$(LexFiles:%.l=$(ObjDir)/%.o) : \ +$(ObjDir)/%.o : $(PROJ_SRC_DIR)/%.cpp clean-local:: -$(Verb) $(RM) -f $(LexOutput) @@ -1323,7 +1333,7 @@ # Get the list of dependency files DependFiles := $(basename $(filter %.cpp %.c %.cc, $(Sources))) -DependFiles := $(patsubst %,$(PROJ_OBJ_DIR)/$(BuildMode)/%.d,$(DependFiles)) +DependFiles := $(DependFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.d) -include /dev/null $(DependFiles) From lattner at cs.uiuc.edu Mon Feb 13 23:13:25 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 13 Feb 2006 23:13:25 -0600 Subject: [llvm-commits] CVS: llvm/utils/TableGen/FileLexer.cpp.cvs FileLexer.l.cvs FileLexer.l FileLexer.cpp Message-ID: <200602140513.XAA19708@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: FileLexer.cpp.cvs added (r1.1) FileLexer.l.cvs added (r1.1) FileLexer.l updated: 1.25 -> 1.26 FileLexer.cpp (r1.4) removed --- Log message: Adjust to new form of handling lexer dependencies, this way shouldn't have the problems the old way did. --- Diffs of the changes: (+2169 -0) FileLexer.cpp.cvs | 1941 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ FileLexer.l | 1 FileLexer.l.cvs | 227 ++++++ 3 files changed, 2169 insertions(+) Index: llvm/utils/TableGen/FileLexer.cpp.cvs diff -c /dev/null llvm/utils/TableGen/FileLexer.cpp.cvs:1.1 *** /dev/null Mon Feb 13 23:13:23 2006 --- llvm/utils/TableGen/FileLexer.cpp.cvs Mon Feb 13 23:13:13 2006 *************** *** 0 **** --- 1,1941 ---- + #define yy_create_buffer File_create_buffer + #define yy_delete_buffer File_delete_buffer + #define yy_scan_buffer File_scan_buffer + #define yy_scan_string File_scan_string + #define yy_scan_bytes File_scan_bytes + #define yy_flex_debug File_flex_debug + #define yy_init_buffer File_init_buffer + #define yy_flush_buffer File_flush_buffer + #define yy_load_buffer_state File_load_buffer_state + #define yy_switch_to_buffer File_switch_to_buffer + #define yyin Filein + #define yyleng Fileleng + #define yylex Filelex + #define yyout Fileout + #define yyrestart Filerestart + #define yytext Filetext + #define yylineno Filelineno + #define yywrap Filewrap + + #line 21 "Lexer.cpp" + /* A lexical scanner generated by flex */ + + /* Scanner skeleton version: + * $Header: /home/vadve/shared/PublicCVS/llvm/utils/TableGen/FileLexer.cpp.cvs,v 1.1 2006/02/14 05:13:13 lattner Exp $ + */ + + #define FLEX_SCANNER + #define YY_FLEX_MAJOR_VERSION 2 + #define YY_FLEX_MINOR_VERSION 5 + + #include + + + /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ + #ifdef c_plusplus + #ifndef __cplusplus + #define __cplusplus + #endif + #endif + + + #ifdef __cplusplus + + #include + #include + + /* Use prototypes in function declarations. */ + #define YY_USE_PROTOS + + /* The "const" storage-class-modifier is valid. */ + #define YY_USE_CONST + + #else /* ! __cplusplus */ + + #if __STDC__ + + #define YY_USE_PROTOS + #define YY_USE_CONST + + #endif /* __STDC__ */ + #endif /* ! __cplusplus */ + + #ifdef __TURBOC__ + #pragma warn -rch + #pragma warn -use + #include + #include + #define YY_USE_CONST + #define YY_USE_PROTOS + #endif + + #ifdef YY_USE_CONST + #define yyconst const + #else + #define yyconst + #endif + + + #ifdef YY_USE_PROTOS + #define YY_PROTO(proto) proto + #else + #define YY_PROTO(proto) () + #endif + + /* Returned upon end-of-file. */ + #define YY_NULL 0 + + /* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ + #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + + /* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ + #define BEGIN yy_start = 1 + 2 * + + /* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ + #define YY_START ((yy_start - 1) / 2) + #define YYSTATE YY_START + + /* Action number for EOF rule of a given start state. */ + #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + + /* Special action meaning "start processing a new file". */ + #define YY_NEW_FILE yyrestart( yyin ) + + #define YY_END_OF_BUFFER_CHAR 0 + + /* Size of default input buffer. */ + #define YY_BUF_SIZE (16384*64) + + typedef struct yy_buffer_state *YY_BUFFER_STATE; + + extern int yyleng; + extern FILE *yyin, *yyout; + + #define EOB_ACT_CONTINUE_SCAN 0 + #define EOB_ACT_END_OF_FILE 1 + #define EOB_ACT_LAST_MATCH 2 + + /* The funky do-while in the following #define is used to turn the definition + * int a single C statement (which needs a semi-colon terminator). This + * avoids problems with code like: + * + * if ( condition_holds ) + * yyless( 5 ); + * else + * do_something_else(); + * + * Prior to using the do-while the compiler would get upset at the + * "else" because it interpreted the "if" statement as being all + * done when it reached the ';' after the yyless() call. + */ + + /* Return all but the first 'n' matched characters back to the input stream. */ + + #define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + *yy_cp = yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ + yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + + #define unput(c) yyunput( c, yytext_ptr ) + + /* The following is because we cannot portably get our hands on size_t + * (without autoconf's help, which isn't available because we want + * flex-generated scanners to compile on their own). + */ + typedef unsigned int yy_size_t; + + + struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + #define YY_BUFFER_NEW 0 + #define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ + #define YY_BUFFER_EOF_PENDING 2 + }; + + static YY_BUFFER_STATE yy_current_buffer = 0; + + /* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + */ + #define YY_CURRENT_BUFFER yy_current_buffer + + + /* yy_hold_char holds the character lost when yytext is formed. */ + static char yy_hold_char; + + static int yy_n_chars; /* number of characters read into yy_ch_buf */ + + + int yyleng; + + /* Points to current character in buffer. */ + static char *yy_c_buf_p = (char *) 0; + static int yy_init = 1; /* whether we need to initialize */ + static int yy_start = 0; /* start state number */ + + /* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ + static int yy_did_buffer_switch_on_eof; + + void yyrestart YY_PROTO(( FILE *input_file )); + + void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); + void yy_load_buffer_state YY_PROTO(( void )); + YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); + void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); + void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); + void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); + #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) + + YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); + YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); + YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); + + static void *yy_flex_alloc YY_PROTO(( yy_size_t )); + static inline void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); + static void yy_flex_free YY_PROTO(( void * )); + + #define yy_new_buffer yy_create_buffer + + #define yy_set_interactive(is_interactive) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_is_interactive = is_interactive; \ + } + + #define yy_set_bol(at_bol) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_at_bol = at_bol; \ + } + + #define YY_AT_BOL() (yy_current_buffer->yy_at_bol) + + + #define YY_USES_REJECT + typedef unsigned char YY_CHAR; + FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; + typedef int yy_state_type; + extern int yylineno; + int yylineno = 1; + extern char *yytext; + #define yytext_ptr yytext + + static yy_state_type yy_get_previous_state YY_PROTO(( void )); + static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); + static int yy_get_next_buffer YY_PROTO(( void )); + static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); + + /* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ + #define YY_DO_BEFORE_ACTION \ + yytext_ptr = yy_bp; \ + yyleng = (int) (yy_cp - yy_bp); \ + yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yy_c_buf_p = yy_cp; + + #define YY_NUM_RULES 31 + #define YY_END_OF_BUFFER 32 + static yyconst short int yy_acclist[129] = + { 0, + 25, 25, 32, 30, 31, 23, 30, 31, 23, 31, + 30, 31, 30, 31, 30, 31, 30, 31, 30, 31, + 22, 30, 31, 22, 30, 31, 19, 30, 31, 30, + 31, 19, 30, 31, 19, 30, 31, 19, 30, 31, + 19, 30, 31, 19, 30, 31, 19, 30, 31, 19, + 30, 31, 25, 31, 26, 31, 28, 31, 23, 21, + 20, 22, 24, 1, 19, 19, 19, 19, 19, 19, + 19, 15, 19, 19, 19, 19, 25, 26, 26, 29, + 28, 27, 28, 20, 1, 22, 22, 5, 19, 19, + 19, 10, 19, 12, 19, 19, 19, 4, 19, 14, + + 19, 19, 19, 18, 16, 17, 3, 6, 19, 19, + 9, 19, 19, 19, 8, 19, 19, 11, 19, 13, + 19, 19, 19, 19, 7, 19, 19, 2 + } ; + + static yyconst short int yy_accept[101] = + { 0, + 1, 1, 1, 2, 3, 4, 6, 9, 11, 13, + 15, 17, 19, 21, 24, 27, 30, 32, 35, 38, + 41, 44, 47, 50, 53, 55, 57, 59, 60, 60, + 60, 61, 62, 63, 64, 65, 65, 65, 66, 66, + 67, 68, 69, 70, 71, 72, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, 84, 84, 84, 85, + 86, 87, 88, 88, 88, 90, 91, 92, 94, 96, + 97, 98, 100, 102, 103, 104, 105, 106, 107, 107, + 108, 110, 111, 113, 114, 115, 117, 118, 120, 122, + 123, 124, 125, 127, 128, 128, 128, 128, 129, 129 + + } ; + + static yyconst int yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 5, 6, 1, 7, 1, 1, 1, 1, + 1, 8, 9, 1, 9, 1, 10, 11, 12, 13, + 13, 13, 13, 13, 13, 13, 13, 1, 1, 1, + 1, 1, 1, 1, 14, 14, 14, 14, 14, 14, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, + 16, 1, 17, 1, 15, 1, 18, 19, 20, 21, + + 22, 23, 24, 25, 26, 15, 15, 27, 15, 28, + 29, 15, 15, 30, 31, 32, 33, 15, 15, 34, + 15, 15, 35, 1, 36, 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, 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 + } ; + + static yyconst int yy_meta[37] = + { 0, + 1, 1, 2, 1, 1, 1, 1, 3, 1, 3, + 4, 4, 4, 5, 6, 1, 1, 5, 5, 5, + 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 1, 1 + } ; + + static yyconst short int yy_base[113] = + { 0, + 0, 0, 29, 30, 199, 200, 39, 42, 167, 191, + 0, 36, 42, 42, 45, 0, 161, 169, 33, 41, + 168, 165, 42, 160, 0, 57, 61, 70, 45, 185, + 200, 0, 66, 200, 0, 69, 0, 0, 154, 157, + 170, 166, 162, 162, 162, 62, 151, 151, 151, 0, + 75, 76, 200, 79, 200, 80, 153, 73, 0, 0, + 81, 0, 143, 161, 146, 145, 153, 0, 0, 147, + 146, 0, 0, 140, 145, 200, 200, 200, 134, 200, + 0, 138, 0, 147, 134, 0, 138, 0, 0, 120, + 97, 77, 0, 93, 95, 60, 45, 200, 200, 101, + + 107, 109, 112, 118, 124, 130, 133, 139, 142, 147, + 153, 159 + } ; + + static yyconst short int yy_def[113] = + { 0, + 99, 1, 100, 100, 99, 99, 99, 99, 99, 101, + 102, 99, 99, 99, 99, 103, 99, 103, 103, 103, + 103, 103, 103, 103, 104, 105, 106, 99, 99, 101, + 99, 107, 99, 99, 108, 99, 109, 103, 110, 103, + 103, 103, 103, 103, 103, 103, 103, 103, 103, 104, + 105, 105, 99, 106, 99, 106, 99, 99, 107, 108, + 99, 109, 110, 111, 103, 103, 103, 103, 103, 103, + 103, 103, 103, 103, 103, 99, 99, 99, 110, 99, + 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, + 103, 103, 103, 103, 99, 112, 112, 99, 0, 99, + + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99 + } ; + + static yyconst short int yy_nxt[237] = + { 0, + 6, 7, 8, 7, 9, 10, 11, 6, 12, 13, + 14, 15, 15, 16, 16, 17, 6, 16, 18, 19, + 20, 16, 21, 16, 16, 22, 23, 16, 16, 16, + 24, 16, 16, 16, 6, 6, 26, 26, 27, 27, + 28, 28, 28, 28, 28, 28, 33, 33, 33, 34, + 98, 35, 33, 33, 33, 33, 33, 33, 43, 41, + 36, 42, 44, 47, 52, 98, 53, 48, 55, 57, + 56, 28, 28, 28, 58, 37, 33, 33, 33, 61, + 61, 71, 99, 52, 99, 53, 99, 99, 99, 56, + 77, 61, 61, 72, 95, 95, 95, 95, 94, 78, + + 96, 25, 25, 25, 25, 25, 25, 30, 30, 30, + 30, 30, 30, 32, 32, 38, 38, 38, 50, 50, + 93, 50, 50, 50, 51, 51, 51, 51, 51, 51, + 54, 54, 54, 54, 54, 54, 59, 59, 59, 60, + 92, 60, 60, 60, 60, 62, 62, 63, 63, 63, + 63, 63, 63, 79, 79, 79, 79, 79, 79, 97, + 97, 97, 97, 97, 97, 91, 90, 89, 88, 64, + 87, 86, 85, 84, 83, 82, 81, 80, 64, 76, + 75, 74, 73, 70, 69, 68, 67, 66, 65, 64, + 31, 49, 46, 45, 40, 39, 31, 29, 99, 5, + + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99 + } ; + + static yyconst short int yy_chk[237] = + { 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, 3, 4, 3, 4, + 7, 7, 7, 8, 8, 8, 12, 12, 12, 13, + 97, 13, 14, 14, 14, 15, 15, 15, 20, 19, + 14, 19, 20, 23, 26, 96, 26, 23, 27, 29, + 27, 28, 28, 28, 29, 14, 33, 33, 33, 36, + 36, 46, 51, 52, 51, 52, 54, 56, 54, 56, + 58, 61, 61, 46, 94, 94, 95, 95, 92, 58, + + 95, 100, 100, 100, 100, 100, 100, 101, 101, 101, + 101, 101, 101, 102, 102, 103, 103, 103, 104, 104, + 91, 104, 104, 104, 105, 105, 105, 105, 105, 105, + 106, 106, 106, 106, 106, 106, 107, 107, 107, 108, + 90, 108, 108, 108, 108, 109, 109, 110, 110, 110, + 110, 110, 110, 111, 111, 111, 111, 111, 111, 112, + 112, 112, 112, 112, 112, 87, 85, 84, 82, 79, + 75, 74, 71, 70, 67, 66, 65, 64, 63, 57, + 49, 48, 47, 45, 44, 43, 42, 41, 40, 39, + 30, 24, 22, 21, 18, 17, 10, 9, 5, 99, + + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 99, 99, 99 + } ; + + static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr; + static char *yy_full_match; + static int yy_lp; + #define REJECT \ + { \ + *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \ + yy_cp = yy_full_match; /* restore poss. backed-over text */ \ + ++yy_lp; \ + goto find_rule; \ + } + #define yymore() yymore_used_but_not_detected + #define YY_MORE_ADJ 0 + #define YY_RESTORE_YY_MORE_OFFSET + char *yytext; + #line 1 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + #define INITIAL 0 + /*===-- FileLexer.l - Scanner for TableGen Files ----------------*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by the LLVM research group and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file defines a simple flex scanner for TableGen files. This is pretty + // straight-forward, except for the magic to handle file inclusion. + // + //===----------------------------------------------------------------------===*/ + #define YY_NEVER_INTERACTIVE 1 + #define comment 1 + + #line 30 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + #include "Record.h" + typedef std::pair*> SubClassRefTy; + #include "FileParser.h" + + int Fileparse(); + + namespace llvm { + + // Global variable recording the location of the include directory + std::string IncludeDirectory; + + /// ParseInt - This has to handle the special case of binary numbers 0b0101 + /// + static int ParseInt(const char *Str) { + if (Str[0] == '0' && Str[1] == 'b') + return strtol(Str+2, 0, 2); + return strtol(Str, 0, 0); + } + + static int CommentDepth = 0; + + struct IncludeRec { + std::string Filename; + FILE *File; + unsigned LineNo; + YY_BUFFER_STATE Buffer; + + IncludeRec(const std::string &FN, FILE *F) + : Filename(FN), File(F), LineNo(0){ + } + }; + + static std::vector IncludeStack; + + std::ostream &err() { + if (IncludeStack.empty()) + return std::cerr << "At end of input: "; + + for (unsigned i = 0, e = IncludeStack.size()-1; i != e; ++i) + std::cerr << "Included from " << IncludeStack[i].Filename << ":" + << IncludeStack[i].LineNo << ":\n"; + return std::cerr << "Parsing " << IncludeStack.back().Filename << ":" + << Filelineno << ": "; + } + + /// ParseFile - this function begins the parsing of the specified tablegen file. + /// + void ParseFile(const std::string &Filename, const std::string & IncludeDir) { + FILE *F = stdin; + if (Filename != "-") { + F = fopen(Filename.c_str(), "r"); + + if (F == 0) { + std::cerr << "Could not open input file '" + Filename + "'!\n"; + exit (1); + } + IncludeStack.push_back(IncludeRec(Filename, F)); + } else { + IncludeStack.push_back(IncludeRec("", stdin)); + } + + // Record the location of the include directory so that the lexer can find + // it later. + IncludeDirectory = IncludeDir; + + Filein = F; + Filelineno = 1; + Fileparse(); + Filein = stdin; + } + + /// HandleInclude - This function is called when an include directive is + /// encountered in the input stream... + /// + static void HandleInclude(const char *Buffer) { + unsigned Length = yyleng; + assert(Buffer[Length-1] == '"'); + Buffer += strlen("include "); + Length -= strlen("include "); + while (*Buffer != '"') { + ++Buffer; + --Length; + } + assert(Length >= 2 && "Double quotes not found?"); + std::string Filename(Buffer+1, Buffer+Length-1); + //std::cerr << "Filename = '" << Filename << "'\n"; + + // Save the line number and lex buffer of the includer... + IncludeStack.back().LineNo = Filelineno; + IncludeStack.back().Buffer = YY_CURRENT_BUFFER; + + // Open the new input file... + yyin = fopen(Filename.c_str(), "r"); + if (yyin == 0) { + // If we couldn't find the file in the current directory, look for it in + // the include directories. + // + // NOTE: Right now, there is only one directory. We need to eventually add + // support for more. + std::string NextFilename = IncludeDirectory + "/" + Filename; + yyin = fopen(NextFilename.c_str(), "r"); + if (yyin == 0) { + err() << "Could not find include file '" << Filename << "'!\n"; + exit(1); + } + Filename = NextFilename; + } + + // Add the file to our include stack... + IncludeStack.push_back(IncludeRec(Filename, yyin)); + Filelineno = 1; // Reset line numbering... + //yyrestart(yyin); // Start lexing the new file... + + yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE)); + } + + /// yywrap - This is called when the lexer runs out of input in one of the + /// files. Switch back to an includer if an includee has run out of input. + /// + extern "C" + int yywrap(void) { + if (IncludeStack.back().File != stdin) + fclose(IncludeStack.back().File); + IncludeStack.pop_back(); + if (IncludeStack.empty()) return 1; // Top-level file is done. + + // Otherwise, we need to switch back to a file which included the current one. + Filelineno = IncludeStack.back().LineNo; // Restore current line number + yy_switch_to_buffer(IncludeStack.back().Buffer); + return 0; + } + + } // End llvm namespace + + using namespace llvm; + + #line 648 "Lexer.cpp" + + /* Macros after this point can all be overridden by user definitions in + * section 1. + */ + + #ifndef YY_SKIP_YYWRAP + #ifdef __cplusplus + extern "C" int yywrap YY_PROTO(( void )); + #else + extern int yywrap YY_PROTO(( void )); + #endif + #endif + + #ifndef YY_NO_UNPUT + static inline void yyunput YY_PROTO(( int c, char *buf_ptr )); + #endif + + #ifndef yytext_ptr + static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); + #endif + + #ifdef YY_NEED_STRLEN + static int yy_flex_strlen YY_PROTO(( yyconst char * )); + #endif + + #ifndef YY_NO_INPUT + #ifdef __cplusplus + static int yyinput YY_PROTO(( void )); + #else + static int input YY_PROTO(( void )); + #endif + #endif + + #if YY_STACK_USED + static int yy_start_stack_ptr = 0; + static int yy_start_stack_depth = 0; + static int *yy_start_stack = 0; + #ifndef YY_NO_PUSH_STATE + static void yy_push_state YY_PROTO(( int new_state )); + #endif + #ifndef YY_NO_POP_STATE + static void yy_pop_state YY_PROTO(( void )); + #endif + #ifndef YY_NO_TOP_STATE + static int yy_top_state YY_PROTO(( void )); + #endif + + #else + #define YY_NO_PUSH_STATE 1 + #define YY_NO_POP_STATE 1 + #define YY_NO_TOP_STATE 1 + #endif + + #ifdef YY_MALLOC_DECL + YY_MALLOC_DECL + #else + #if __STDC__ + #ifndef __cplusplus + #include + #endif + #else + /* Just try to get by without declaring the routines. This will fail + * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) + * or sizeof(void*) != sizeof(int). + */ + #endif + #endif + + /* Amount of stuff to slurp up with each read. */ + #ifndef YY_READ_BUF_SIZE + #define YY_READ_BUF_SIZE 8192 + #endif + + /* Copy whatever the last rule matched to the standard output. */ + + #ifndef ECHO + /* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ + #define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) + #endif + + /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ + #ifndef YY_INPUT + #define YY_INPUT(buf,result,max_size) \ + if ( yy_current_buffer->yy_is_interactive ) \ + { \ + int c = '*', n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ + && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); + #endif + + /* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ + #ifndef yyterminate + #define yyterminate() return YY_NULL + #endif + + /* Number of entries by which start-condition stack grows. */ + #ifndef YY_START_STACK_INCR + #define YY_START_STACK_INCR 25 + #endif + + /* Report a fatal error. */ + #ifndef YY_FATAL_ERROR + #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) + #endif + + /* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ + #ifndef YY_DECL + #define YY_DECL int yylex YY_PROTO(( void )) + #endif + + /* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ + #ifndef YY_USER_ACTION + #define YY_USER_ACTION + #endif + + /* Code executed at the end of each rule. */ + #ifndef YY_BREAK + #define YY_BREAK break; + #endif + + #define YY_RULE_SETUP \ + YY_USER_ACTION + + YY_DECL + { + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + + #line 176 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + + + #line 802 "Lexer.cpp" + + if ( yy_init ) + { + yy_init = 0; + + #ifdef YY_USER_INIT + YY_USER_INIT; + #endif + + if ( ! yy_start ) + yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! yy_current_buffer ) + yy_current_buffer = + yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_load_buffer_state(); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = yy_start; + yy_state_ptr = yy_state_buf; + *yy_state_ptr++ = yy_current_state; + yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 100 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + *yy_state_ptr++ = yy_current_state; + ++yy_cp; + } + while ( yy_current_state != 99 ); + + yy_find_action: + yy_current_state = *--yy_state_ptr; + yy_lp = yy_accept[yy_current_state]; + find_rule: /* we branch to this label when backing up */ + for ( ; ; ) /* until we find what rule we matched */ + { + if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] ) + { + yy_act = yy_acclist[yy_lp]; + { + yy_full_match = yy_cp; + break; + } + } + --yy_cp; + yy_current_state = *--yy_state_ptr; + yy_lp = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + + if ( yy_act != YY_END_OF_BUFFER ) + { + int yyl; + for ( yyl = 0; yyl < yyleng; ++yyl ) + if ( yytext[yyl] == '\n' ) + ++yylineno; + } + + do_action: /* This label is used only to access EOF actions. */ + + + switch ( yy_act ) + { /* beginning of action switch */ + case 1: + YY_RULE_SETUP + #line 178 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + { /* Ignore comments */ } + YY_BREAK + case 2: + YY_RULE_SETUP + #line 180 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + { HandleInclude(yytext); } + YY_BREAK + case 3: + YY_RULE_SETUP + #line 181 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + { Filelval.StrVal = new std::string(yytext+2, yytext+yyleng-2); + return CODEFRAGMENT; } + YY_BREAK + case 4: + YY_RULE_SETUP + #line 184 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + { return INT; } + YY_BREAK + case 5: + YY_RULE_SETUP + #line 185 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + { return BIT; } + YY_BREAK + case 6: + YY_RULE_SETUP + #line 186 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + { return BITS; } + YY_BREAK + case 7: + YY_RULE_SETUP + #line 187 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + { return STRING; } + YY_BREAK + case 8: + YY_RULE_SETUP + #line 188 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + { return LIST; } + YY_BREAK + case 9: + YY_RULE_SETUP + #line 189 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + { return CODE; } + YY_BREAK + case 10: + YY_RULE_SETUP + #line 190 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + { return DAG; } + YY_BREAK + case 11: + YY_RULE_SETUP + #line 192 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + { return CLASS; } + YY_BREAK + case 12: + YY_RULE_SETUP + #line 193 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + { return DEF; } + YY_BREAK + case 13: + YY_RULE_SETUP + #line 194 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + { return FIELD; } + YY_BREAK + case 14: + YY_RULE_SETUP + #line 195 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + { return LET; } + YY_BREAK + case 15: + YY_RULE_SETUP + #line 196 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + { return IN; } + YY_BREAK + case 16: + YY_RULE_SETUP + #line 198 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + { return SRATOK; } + YY_BREAK + case 17: + YY_RULE_SETUP + #line 199 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + { return SRLTOK; } + YY_BREAK + case 18: + YY_RULE_SETUP + #line 200 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + { return SHLTOK; } + YY_BREAK + case 19: + YY_RULE_SETUP + #line 203 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + { Filelval.StrVal = new std::string(yytext, yytext+yyleng); + return ID; } + YY_BREAK + case 20: + YY_RULE_SETUP + #line 205 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + { Filelval.StrVal = new std::string(yytext+1, yytext+yyleng); + return VARNAME; } + YY_BREAK + case 21: + YY_RULE_SETUP + #line 208 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + { Filelval.StrVal = new std::string(yytext+1, yytext+yyleng-1); + return STRVAL; } + YY_BREAK + case 22: + YY_RULE_SETUP + #line 211 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + { Filelval.IntVal = ParseInt(Filetext); return INTVAL; } + YY_BREAK + case 23: + YY_RULE_SETUP + #line 213 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + { /* Ignore whitespace */ } + YY_BREAK + case 24: + YY_RULE_SETUP + #line 216 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + { BEGIN(comment); CommentDepth++; } + YY_BREAK + case 25: + YY_RULE_SETUP + #line 217 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + {} /* eat anything that's not a '*' or '/' */ + YY_BREAK + case 26: + YY_RULE_SETUP + #line 218 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + {} /* eat up '*'s not followed by '/'s */ + YY_BREAK + case 27: + YY_RULE_SETUP + #line 219 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + { ++CommentDepth; } + YY_BREAK + case 28: + YY_RULE_SETUP + #line 220 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + {} /* eat up /'s not followed by *'s */ + YY_BREAK + case 29: + YY_RULE_SETUP + #line 221 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + { if (!--CommentDepth) { BEGIN(INITIAL); } } + YY_BREAK + case YY_STATE_EOF(comment): + #line 222 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + { err() << "Unterminated comment!\n"; exit(1); } + YY_BREAK + case 30: + YY_RULE_SETUP + #line 224 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + { return Filetext[0]; } + YY_BREAK + case 31: + YY_RULE_SETUP + #line 226 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + YY_FATAL_ERROR( "flex scanner jammed" ); + YY_BREAK + #line 1056 "Lexer.cpp" + case YY_STATE_EOF(INITIAL): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yy_hold_char; + YY_RESTORE_YY_MORE_OFFSET + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between yy_current_buffer and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yy_n_chars = yy_current_buffer->yy_n_chars; + yy_current_buffer->yy_input_file = yyin; + yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = yy_c_buf_p; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + yy_did_buffer_switch_on_eof = 0; + + if ( yywrap() ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = + yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yy_c_buf_p = + &yy_current_buffer->yy_ch_buf[yy_n_chars]; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of yylex */ + + + /* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ + + static int yy_get_next_buffer() + { + register char *dest = yy_current_buffer->yy_ch_buf; + register char *source = yytext_ptr; + register int number_to_move, i; + int ret_val; + + if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( yy_current_buffer->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + yy_current_buffer->yy_n_chars = yy_n_chars = 0; + + else + { + int num_to_read = + yy_current_buffer->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + #ifdef YY_USES_REJECT + YY_FATAL_ERROR( + "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); + #else + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = yy_current_buffer; + + int yy_c_buf_p_offset = + (int) (yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yy_flex_realloc( (void *) b->yy_ch_buf, + b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = yy_current_buffer->yy_buf_size - + number_to_move - 1; + #endif + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), + yy_n_chars, num_to_read ); + + yy_current_buffer->yy_n_chars = yy_n_chars; + } + + if ( yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart( yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + yy_current_buffer->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + yy_n_chars += number_to_move; + yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; + yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; + + return ret_val; + } + + + /* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state() + { + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = yy_start; + yy_state_ptr = yy_state_buf; + *yy_state_ptr++ = yy_current_state; + + for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 100 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + *yy_state_ptr++ = yy_current_state; + } + + return yy_current_state; + } + + + /* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + + #ifdef YY_USE_PROTOS + static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) + #else + static yy_state_type yy_try_NUL_trans( yy_current_state ) + yy_state_type yy_current_state; + #endif + { + register int yy_is_jam; + + register YY_CHAR yy_c = 1; + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 100 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 99); + if ( ! yy_is_jam ) + *yy_state_ptr++ = yy_current_state; + + return yy_is_jam ? 0 : yy_current_state; + } + + + #ifndef YY_NO_UNPUT + #ifdef YY_USE_PROTOS + static inline void yyunput( int c, register char *yy_bp ) + #else + static inline void yyunput( c, yy_bp ) + int c; + register char *yy_bp; + #endif + { + register char *yy_cp = yy_c_buf_p; + + /* undo effects of setting up yytext */ + *yy_cp = yy_hold_char; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = yy_n_chars + 2; + register char *dest = &yy_current_buffer->yy_ch_buf[ + yy_current_buffer->yy_buf_size + 2]; + register char *source = + &yy_current_buffer->yy_ch_buf[number_to_move]; + + while ( source > yy_current_buffer->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + yy_current_buffer->yy_n_chars = + yy_n_chars = yy_current_buffer->yy_buf_size; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + if ( c == '\n' ) + --yylineno; + + yytext_ptr = yy_bp; + yy_hold_char = *yy_cp; + yy_c_buf_p = yy_cp; + } + #endif /* ifndef YY_NO_UNPUT */ + + + #ifdef __cplusplus + static int yyinput() + #else + static int input() + #endif + { + int c; + + *yy_c_buf_p = yy_hold_char; + + if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + /* This was really a NUL. */ + *yy_c_buf_p = '\0'; + + else + { /* need more input */ + int offset = yy_c_buf_p - yytext_ptr; + ++yy_c_buf_p; + + switch ( yy_get_next_buffer() ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart( yyin ); + + /* fall through */ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap() ) + return EOF; + + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + #ifdef __cplusplus + return yyinput(); + #else + return input(); + #endif + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = yytext_ptr + offset; + break; + } + } + } + + c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ + *yy_c_buf_p = '\0'; /* preserve yytext */ + yy_hold_char = *++yy_c_buf_p; + + if ( c == '\n' ) + ++yylineno; + + return c; + } + + + #ifdef YY_USE_PROTOS + void yyrestart( FILE *input_file ) + #else + void yyrestart( input_file ) + FILE *input_file; + #endif + { + if ( ! yy_current_buffer ) + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_init_buffer( yy_current_buffer, input_file ); + yy_load_buffer_state(); + } + + + #ifdef YY_USE_PROTOS + void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) + #else + void yy_switch_to_buffer( new_buffer ) + YY_BUFFER_STATE new_buffer; + #endif + { + if ( yy_current_buffer == new_buffer ) + return; + + if ( yy_current_buffer ) + { + /* Flush out information for old buffer. */ + *yy_c_buf_p = yy_hold_char; + yy_current_buffer->yy_buf_pos = yy_c_buf_p; + yy_current_buffer->yy_n_chars = yy_n_chars; + } + + yy_current_buffer = new_buffer; + yy_load_buffer_state(); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yy_did_buffer_switch_on_eof = 1; + } + + + #ifdef YY_USE_PROTOS + void yy_load_buffer_state( void ) + #else + void yy_load_buffer_state() + #endif + { + yy_n_chars = yy_current_buffer->yy_n_chars; + yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; + yyin = yy_current_buffer->yy_input_file; + yy_hold_char = *yy_c_buf_p; + } + + + #ifdef YY_USE_PROTOS + YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) + #else + YY_BUFFER_STATE yy_create_buffer( file, size ) + FILE *file; + int size; + #endif + { + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer( b, file ); + + return b; + } + + + #ifdef YY_USE_PROTOS + void yy_delete_buffer( YY_BUFFER_STATE b ) + #else + void yy_delete_buffer( b ) + YY_BUFFER_STATE b; + #endif + { + if ( ! b ) + return; + + if ( b == yy_current_buffer ) + yy_current_buffer = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yy_flex_free( (void *) b->yy_ch_buf ); + + yy_flex_free( (void *) b ); + } + + + #ifndef YY_ALWAYS_INTERACTIVE + #ifndef YY_NEVER_INTERACTIVE + extern int isatty YY_PROTO(( int )); + #endif + #endif + + #ifdef YY_USE_PROTOS + void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) + #else + void yy_init_buffer( b, file ) + YY_BUFFER_STATE b; + FILE *file; + #endif + + + { + yy_flush_buffer( b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + #if YY_ALWAYS_INTERACTIVE + b->yy_is_interactive = 1; + #else + #if YY_NEVER_INTERACTIVE + b->yy_is_interactive = 0; + #else + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + #endif + #endif + } + + + #ifdef YY_USE_PROTOS + void yy_flush_buffer( YY_BUFFER_STATE b ) + #else + void yy_flush_buffer( b ) + YY_BUFFER_STATE b; + #endif + + { + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == yy_current_buffer ) + yy_load_buffer_state(); + } + + + #ifndef YY_NO_SCAN_BUFFER + #ifdef YY_USE_PROTOS + YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) + #else + YY_BUFFER_STATE yy_scan_buffer( base, size ) + char *base; + yy_size_t size; + #endif + { + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer( b ); + + return b; + } + #endif + + + #ifndef YY_NO_SCAN_STRING + #ifdef YY_USE_PROTOS + YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) + #else + YY_BUFFER_STATE yy_scan_string( yy_str ) + yyconst char *yy_str; + #endif + { + int len; + for ( len = 0; yy_str[len]; ++len ) + ; + + return yy_scan_bytes( yy_str, len ); + } + #endif + + + #ifndef YY_NO_SCAN_BYTES + #ifdef YY_USE_PROTOS + YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) + #else + YY_BUFFER_STATE yy_scan_bytes( bytes, len ) + yyconst char *bytes; + int len; + #endif + { + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = len + 2; + buf = (char *) yy_flex_alloc( n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < len; ++i ) + buf[i] = bytes[i]; + + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer( buf, n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; + } + #endif + + + #ifndef YY_NO_PUSH_STATE + #ifdef YY_USE_PROTOS + static void yy_push_state( int new_state ) + #else + static void yy_push_state( new_state ) + int new_state; + #endif + { + if ( yy_start_stack_ptr >= yy_start_stack_depth ) + { + yy_size_t new_size; + + yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yy_start_stack_depth * sizeof( int ); + + if ( ! yy_start_stack ) + yy_start_stack = (int *) yy_flex_alloc( new_size ); + + else + yy_start_stack = (int *) yy_flex_realloc( + (void *) yy_start_stack, new_size ); + + if ( ! yy_start_stack ) + YY_FATAL_ERROR( + "out of memory expanding start-condition stack" ); + } + + yy_start_stack[yy_start_stack_ptr++] = YY_START; + + BEGIN(new_state); + } + #endif + + + #ifndef YY_NO_POP_STATE + static void yy_pop_state() + { + if ( --yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); + + BEGIN(yy_start_stack[yy_start_stack_ptr]); + } + #endif + + + #ifndef YY_NO_TOP_STATE + static int yy_top_state() + { + return yy_start_stack[yy_start_stack_ptr - 1]; + } + #endif + + #ifndef YY_EXIT_FAILURE + #define YY_EXIT_FAILURE 2 + #endif + + #ifdef YY_USE_PROTOS + static void yy_fatal_error( yyconst char msg[] ) + #else + static void yy_fatal_error( msg ) + char msg[]; + #endif + { + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); + } + + + + /* Redefine yyless() so it works in section 3 code. */ + + #undef yyless + #define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + yytext[yyleng] = yy_hold_char; \ + yy_c_buf_p = yytext + n; \ + yy_hold_char = *yy_c_buf_p; \ + *yy_c_buf_p = '\0'; \ + yyleng = n; \ + } \ + while ( 0 ) + + + /* Internal utility routines. */ + + #ifndef yytext_ptr + #ifdef YY_USE_PROTOS + static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) + #else + static void yy_flex_strncpy( s1, s2, n ) + char *s1; + yyconst char *s2; + int n; + #endif + { + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; + } + #endif + + #ifdef YY_NEED_STRLEN + #ifdef YY_USE_PROTOS + static int yy_flex_strlen( yyconst char *s ) + #else + static int yy_flex_strlen( s ) + yyconst char *s; + #endif + { + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; + } + #endif + + + #ifdef YY_USE_PROTOS + static void *yy_flex_alloc( yy_size_t size ) + #else + static void *yy_flex_alloc( size ) + yy_size_t size; + #endif + { + return (void *) malloc( size ); + } + + #ifdef YY_USE_PROTOS + static inline void *yy_flex_realloc( void *ptr, yy_size_t size ) + #else + static inline void *yy_flex_realloc( ptr, size ) + void *ptr; + yy_size_t size; + #endif + { + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); + } + + #ifdef YY_USE_PROTOS + static void yy_flex_free( void *ptr ) + #else + static void yy_flex_free( ptr ) + void *ptr; + #endif + { + free( ptr ); + } + + #if YY_MAIN + int main() + { + yylex(); + return 0; + } + #endif + #line 226 "/Users/sabre/cvs/llvm/utils/TableGen/FileLexer.l" + + Index: llvm/utils/TableGen/FileLexer.l.cvs diff -c /dev/null llvm/utils/TableGen/FileLexer.l.cvs:1.1 *** /dev/null Mon Feb 13 23:13:25 2006 --- llvm/utils/TableGen/FileLexer.l.cvs Mon Feb 13 23:13:13 2006 *************** *** 0 **** --- 1,227 ---- + /*===-- FileLexer.l - Scanner for TableGen Files ----------------*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by the LLVM research group and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file defines a simple flex scanner for TableGen files. This is pretty + // straight-forward, except for the magic to handle file inclusion. + // + //===----------------------------------------------------------------------===*/ + + %option prefix="File" + %option yylineno + %option nostdinit + %option never-interactive + %option batch + %option nodefault + %option 8bit + %option outfile="Lexer.cpp" + %option ecs + %option noreject + %option noyymore + + %x comment + + %{ + #include "Record.h" + typedef std::pair*> SubClassRefTy; + #include "FileParser.h" + + int Fileparse(); + + namespace llvm { + + // Global variable recording the location of the include directory + std::string IncludeDirectory; + + /// ParseInt - This has to handle the special case of binary numbers 0b0101 + /// + static int ParseInt(const char *Str) { + if (Str[0] == '0' && Str[1] == 'b') + return strtol(Str+2, 0, 2); + return strtol(Str, 0, 0); + } + + static int CommentDepth = 0; + + struct IncludeRec { + std::string Filename; + FILE *File; + unsigned LineNo; + YY_BUFFER_STATE Buffer; + + IncludeRec(const std::string &FN, FILE *F) + : Filename(FN), File(F), LineNo(0){ + } + }; + + static std::vector IncludeStack; + + std::ostream &err() { + if (IncludeStack.empty()) + return std::cerr << "At end of input: "; + + for (unsigned i = 0, e = IncludeStack.size()-1; i != e; ++i) + std::cerr << "Included from " << IncludeStack[i].Filename << ":" + << IncludeStack[i].LineNo << ":\n"; + return std::cerr << "Parsing " << IncludeStack.back().Filename << ":" + << Filelineno << ": "; + } + + /// ParseFile - this function begins the parsing of the specified tablegen file. + /// + void ParseFile(const std::string &Filename, const std::string & IncludeDir) { + FILE *F = stdin; + if (Filename != "-") { + F = fopen(Filename.c_str(), "r"); + + if (F == 0) { + std::cerr << "Could not open input file '" + Filename + "'!\n"; + exit (1); + } + IncludeStack.push_back(IncludeRec(Filename, F)); + } else { + IncludeStack.push_back(IncludeRec("", stdin)); + } + + // Record the location of the include directory so that the lexer can find + // it later. + IncludeDirectory = IncludeDir; + + Filein = F; + Filelineno = 1; + Fileparse(); + Filein = stdin; + } + + /// HandleInclude - This function is called when an include directive is + /// encountered in the input stream... + /// + static void HandleInclude(const char *Buffer) { + unsigned Length = yyleng; + assert(Buffer[Length-1] == '"'); + Buffer += strlen("include "); + Length -= strlen("include "); + while (*Buffer != '"') { + ++Buffer; + --Length; + } + assert(Length >= 2 && "Double quotes not found?"); + std::string Filename(Buffer+1, Buffer+Length-1); + //std::cerr << "Filename = '" << Filename << "'\n"; + + // Save the line number and lex buffer of the includer... + IncludeStack.back().LineNo = Filelineno; + IncludeStack.back().Buffer = YY_CURRENT_BUFFER; + + // Open the new input file... + yyin = fopen(Filename.c_str(), "r"); + if (yyin == 0) { + // If we couldn't find the file in the current directory, look for it in + // the include directories. + // + // NOTE: Right now, there is only one directory. We need to eventually add + // support for more. + std::string NextFilename = IncludeDirectory + "/" + Filename; + yyin = fopen(NextFilename.c_str(), "r"); + if (yyin == 0) { + err() << "Could not find include file '" << Filename << "'!\n"; + exit(1); + } + Filename = NextFilename; + } + + // Add the file to our include stack... + IncludeStack.push_back(IncludeRec(Filename, yyin)); + Filelineno = 1; // Reset line numbering... + //yyrestart(yyin); // Start lexing the new file... + + yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE)); + } + + /// yywrap - This is called when the lexer runs out of input in one of the + /// files. Switch back to an includer if an includee has run out of input. + /// + extern "C" + int yywrap(void) { + if (IncludeStack.back().File != stdin) + fclose(IncludeStack.back().File); + IncludeStack.pop_back(); + if (IncludeStack.empty()) return 1; // Top-level file is done. + + // Otherwise, we need to switch back to a file which included the current one. + Filelineno = IncludeStack.back().LineNo; // Restore current line number + yy_switch_to_buffer(IncludeStack.back().Buffer); + return 0; + } + + } // End llvm namespace + + using namespace llvm; + + %} + + Comment \/\/.* + + Identifier [a-zA-Z_][0-9a-zA-Z_]* + Integer [-+]?[0-9]+|0x[0-9a-fA-F]+|0b[01]+ + CodeFragment \[\{([^}]+|\}[^\]])*\}\] + StringVal \"[^"]*\" + IncludeStr include[ \t\n]+\"[^"]*\" + + %% + + {Comment} { /* Ignore comments */ } + + {IncludeStr} { HandleInclude(yytext); } + {CodeFragment} { Filelval.StrVal = new std::string(yytext+2, yytext+yyleng-2); + return CODEFRAGMENT; } + + int { return INT; } + bit { return BIT; } + bits { return BITS; } + string { return STRING; } + list { return LIST; } + code { return CODE; } + dag { return DAG; } + + class { return CLASS; } + def { return DEF; } + field { return FIELD; } + let { return LET; } + in { return IN; } + + !sra { return SRATOK; } + !srl { return SRLTOK; } + !shl { return SHLTOK; } + + + {Identifier} { Filelval.StrVal = new std::string(yytext, yytext+yyleng); + return ID; } + ${Identifier} { Filelval.StrVal = new std::string(yytext+1, yytext+yyleng); + return VARNAME; } + + {StringVal} { Filelval.StrVal = new std::string(yytext+1, yytext+yyleng-1); + return STRVAL; } + + {Integer} { Filelval.IntVal = ParseInt(Filetext); return INTVAL; } + + [ \t\n\r]+ { /* Ignore whitespace */ } + + + "/*" { BEGIN(comment); CommentDepth++; } + [^*/]* {} /* eat anything that's not a '*' or '/' */ + "*"+[^*/]* {} /* eat up '*'s not followed by '/'s */ + "/*" { ++CommentDepth; } + "/"+[^*/]* {} /* eat up /'s not followed by *'s */ + "*"+"/" { if (!--CommentDepth) { BEGIN(INITIAL); } } + <> { err() << "Unterminated comment!\n"; exit(1); } + + . { return Filetext[0]; } + + %% + Index: llvm/utils/TableGen/FileLexer.l diff -u llvm/utils/TableGen/FileLexer.l:1.25 llvm/utils/TableGen/FileLexer.l:1.26 --- llvm/utils/TableGen/FileLexer.l:1.25 Tue Sep 6 16:23:09 2005 +++ llvm/utils/TableGen/FileLexer.l Mon Feb 13 23:13:13 2006 @@ -224,3 +224,4 @@ . { return Filetext[0]; } %% + From lattner at cs.uiuc.edu Mon Feb 13 23:14:58 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 13 Feb 2006 23:14:58 -0600 Subject: [llvm-commits] CVS: llvm/lib/AsmParser/Lexer.cpp.cvs Lexer.l.cvs Lexer.cpp Message-ID: <200602140514.XAA19820@zion.cs.uiuc.edu> Changes in directory llvm/lib/AsmParser: Lexer.cpp.cvs added (r1.1) Lexer.l.cvs added (r1.1) Lexer.cpp (r1.18) removed --- Log message: adjust to new style of handling lexer changes --- Diffs of the changes: (+2980 -0) Lexer.cpp.cvs | 2625 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Lexer.l.cvs | 355 +++++++ 2 files changed, 2980 insertions(+) Index: llvm/lib/AsmParser/Lexer.cpp.cvs diff -c /dev/null llvm/lib/AsmParser/Lexer.cpp.cvs:1.1 *** /dev/null Mon Feb 13 23:14:56 2006 --- llvm/lib/AsmParser/Lexer.cpp.cvs Mon Feb 13 23:14:46 2006 *************** *** 0 **** --- 1,2625 ---- + #define yy_create_buffer llvmAsm_create_buffer + #define yy_delete_buffer llvmAsm_delete_buffer + #define yy_scan_buffer llvmAsm_scan_buffer + #define yy_scan_string llvmAsm_scan_string + #define yy_scan_bytes llvmAsm_scan_bytes + #define yy_flex_debug llvmAsm_flex_debug + #define yy_init_buffer llvmAsm_init_buffer + #define yy_flush_buffer llvmAsm_flush_buffer + #define yy_load_buffer_state llvmAsm_load_buffer_state + #define yy_switch_to_buffer llvmAsm_switch_to_buffer + #define yyin llvmAsmin + #define yyleng llvmAsmleng + #define yylex llvmAsmlex + #define yyout llvmAsmout + #define yyrestart llvmAsmrestart + #define yytext llvmAsmtext + #define yylineno llvmAsmlineno + + #line 20 "Lexer.cpp" + /* A lexical scanner generated by flex */ + + /* Scanner skeleton version: + * $Header: /home/vadve/shared/PublicCVS/llvm/lib/AsmParser/Lexer.cpp.cvs,v 1.1 2006/02/14 05:14:46 lattner Exp $ + */ + + #define FLEX_SCANNER + #define YY_FLEX_MAJOR_VERSION 2 + #define YY_FLEX_MINOR_VERSION 5 + + #include + + + /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ + #ifdef c_plusplus + #ifndef __cplusplus + #define __cplusplus + #endif + #endif + + + #ifdef __cplusplus + + #include + #include + + /* Use prototypes in function declarations. */ + #define YY_USE_PROTOS + + /* The "const" storage-class-modifier is valid. */ + #define YY_USE_CONST + + #else /* ! __cplusplus */ + + #if __STDC__ + + #define YY_USE_PROTOS + #define YY_USE_CONST + + #endif /* __STDC__ */ + #endif /* ! __cplusplus */ + + #ifdef __TURBOC__ + #pragma warn -rch + #pragma warn -use + #include + #include + #define YY_USE_CONST + #define YY_USE_PROTOS + #endif + + #ifdef YY_USE_CONST + #define yyconst const + #else + #define yyconst + #endif + + + #ifdef YY_USE_PROTOS + #define YY_PROTO(proto) proto + #else + #define YY_PROTO(proto) () + #endif + + /* Returned upon end-of-file. */ + #define YY_NULL 0 + + /* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ + #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + + /* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ + #define BEGIN yy_start = 1 + 2 * + + /* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ + #define YY_START ((yy_start - 1) / 2) + #define YYSTATE YY_START + + /* Action number for EOF rule of a given start state. */ + #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + + /* Special action meaning "start processing a new file". */ + #define YY_NEW_FILE yyrestart( yyin ) + + #define YY_END_OF_BUFFER_CHAR 0 + + /* Size of default input buffer. */ + #define YY_BUF_SIZE (16384*64) + + typedef struct yy_buffer_state *YY_BUFFER_STATE; + + extern int yyleng; + extern FILE *yyin, *yyout; + + #define EOB_ACT_CONTINUE_SCAN 0 + #define EOB_ACT_END_OF_FILE 1 + #define EOB_ACT_LAST_MATCH 2 + + /* The funky do-while in the following #define is used to turn the definition + * int a single C statement (which needs a semi-colon terminator). This + * avoids problems with code like: + * + * if ( condition_holds ) + * yyless( 5 ); + * else + * do_something_else(); + * + * Prior to using the do-while the compiler would get upset at the + * "else" because it interpreted the "if" statement as being all + * done when it reached the ';' after the yyless() call. + */ + + /* Return all but the first 'n' matched characters back to the input stream. */ + + #define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + *yy_cp = yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ + yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + + #define unput(c) yyunput( c, yytext_ptr ) + + /* The following is because we cannot portably get our hands on size_t + * (without autoconf's help, which isn't available because we want + * flex-generated scanners to compile on their own). + */ + typedef unsigned int yy_size_t; + + + struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + #define YY_BUFFER_NEW 0 + #define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ + #define YY_BUFFER_EOF_PENDING 2 + }; + + static YY_BUFFER_STATE yy_current_buffer = 0; + + /* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + */ + #define YY_CURRENT_BUFFER yy_current_buffer + + + /* yy_hold_char holds the character lost when yytext is formed. */ + static char yy_hold_char; + + static int yy_n_chars; /* number of characters read into yy_ch_buf */ + + + int yyleng; + + /* Points to current character in buffer. */ + static char *yy_c_buf_p = (char *) 0; + static int yy_init = 1; /* whether we need to initialize */ + static int yy_start = 0; /* start state number */ + + /* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ + static int yy_did_buffer_switch_on_eof; + + void yyrestart YY_PROTO(( FILE *input_file )); + + void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); + void yy_load_buffer_state YY_PROTO(( void )); + YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); + void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); + void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); + void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); + #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) + + YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); + YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); + YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); + + static void *yy_flex_alloc YY_PROTO(( yy_size_t )); + static inline void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); + static void yy_flex_free YY_PROTO(( void * )); + + #define yy_new_buffer yy_create_buffer + + #define yy_set_interactive(is_interactive) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_is_interactive = is_interactive; \ + } + + #define yy_set_bol(at_bol) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_at_bol = at_bol; \ + } + + #define YY_AT_BOL() (yy_current_buffer->yy_at_bol) + + + #define YY_USES_REJECT + + #define yywrap() 1 + #define YY_SKIP_YYWRAP + typedef unsigned char YY_CHAR; + FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; + typedef int yy_state_type; + extern int yylineno; + int yylineno = 1; + extern char *yytext; + #define yytext_ptr yytext + + static yy_state_type yy_get_previous_state YY_PROTO(( void )); + static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); + static int yy_get_next_buffer YY_PROTO(( void )); + static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); + + /* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ + #define YY_DO_BEFORE_ACTION \ + yytext_ptr = yy_bp; \ + yyleng = (int) (yy_cp - yy_bp); \ + yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yy_c_buf_p = yy_cp; + + #define YY_NUM_RULES 106 + #define YY_END_OF_BUFFER 107 + static yyconst short int yy_acclist[184] = + { 0, + 107, 105, 106, 104, 105, 106, 104, 106, 105, 106, + 105, 106, 105, 106, 105, 106, 105, 106, 105, 106, + 97, 105, 106, 97, 105, 106, 1, 105, 106, 105, + 106, 105, 106, 105, 106, 105, 106, 105, 106, 105, + 106, 105, 106, 105, 106, 105, 106, 105, 106, 105, + 106, 105, 106, 105, 106, 105, 106, 105, 106, 105, + 106, 105, 106, 105, 106, 105, 106, 105, 106, 105, + 106, 96, 94, 93, 93, 100, 98, 102, 97, 1, + 80, 37, 62, 20, 96, 93, 93, 101, 102, 17, + 102, 103, 56, 61, 35, 30, 38, 59, 3, 47, + + 58, 22, 70, 60, 79, 74, 75, 57, 63, 95, + 102, 102, 42, 71, 72, 87, 88, 49, 19, 99, + 23, 4, 54, 48, 41, 11, 102, 32, 2, 5, + 51, 53, 43, 65, 69, 67, 68, 66, 64, 45, + 89, 44, 50, 18, 77, 86, 40, 52, 27, 21, + 39, 7, 82, 29, 85, 34, 55, 73, 81, 24, + 25, 83, 46, 78, 76, 6, 26, 33, 8, 14, + 9, 10, 31, 12, 36, 28, 84, 90, 92, 13, + 91, 15, 16 + } ; + + static yyconst short int yy_accept[444] = + { 0, + 1, 1, 1, 2, 4, 7, 9, 11, 13, 15, + 17, 19, 21, 24, 27, 30, 32, 34, 36, 38, + 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, + 60, 62, 64, 66, 68, 70, 72, 72, 73, 73, + 74, 75, 76, 77, 77, 78, 78, 79, 80, 80, + 81, 81, 81, 81, 81, 81, 81, 81, 81, 82, + 82, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, + 83, 83, 83, 83, 84, 84, 84, 84, 84, 84, + 84, 84, 84, 84, 84, 84, 84, 85, 85, 85, + + 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, + 86, 87, 89, 90, 91, 92, 92, 93, 94, 94, + 94, 95, 95, 96, 96, 97, 97, 97, 97, 98, + 98, 98, 98, 98, 99, 99, 100, 100, 100, 100, + 100, 100, 100, 100, 100, 100, 100, 101, 101, 101, + 101, 101, 101, 101, 101, 101, 102, 103, 103, 103, + 104, 104, 105, 106, 106, 106, 106, 106, 106, 107, + 107, 108, 108, 108, 109, 109, 109, 109, 109, 109, + 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, + 109, 109, 109, 109, 109, 110, 110, 111, 112, 112, + + 112, 112, 113, 113, 113, 113, 113, 114, 115, 116, + 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, + 116, 116, 117, 117, 117, 117, 117, 117, 117, 117, + 117, 117, 118, 119, 119, 119, 120, 120, 120, 121, + 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, + 121, 122, 122, 122, 123, 124, 124, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 126, 126, 127, + 127, 128, 129, 129, 129, 130, 130, 130, 130, 130, + 130, 130, 130, 130, 130, 131, 131, 132, 132, 132, + 132, 132, 132, 132, 133, 133, 133, 133, 133, 133, + + 133, 134, 134, 134, 135, 136, 137, 138, 139, 140, + 141, 141, 142, 142, 142, 142, 143, 144, 145, 145, + 145, 145, 145, 145, 146, 146, 146, 146, 147, 147, + 148, 148, 148, 148, 149, 150, 151, 151, 151, 152, + 152, 153, 153, 153, 153, 154, 154, 155, 156, 157, + 158, 158, 158, 159, 159, 160, 161, 162, 162, 162, + 163, 164, 165, 166, 166, 166, 166, 166, 167, 168, + 168, 168, 168, 168, 168, 168, 168, 168, 169, 169, + 169, 169, 169, 169, 169, 170, 171, 171, 171, 171, + 171, 172, 173, 173, 173, 173, 173, 174, 174, 175, + + 175, 175, 175, 175, 175, 175, 175, 175, 175, 175, + 175, 175, 175, 175, 176, 176, 176, 176, 176, 176, + 176, 176, 177, 177, 178, 178, 178, 178, 178, 178, + 178, 178, 178, 179, 179, 180, 181, 181, 182, 183, + 183, 184, 184 + } ; + + static yyconst int yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 1, 4, 1, 5, 6, 1, 1, 1, + 1, 1, 7, 1, 8, 9, 1, 10, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 12, 13, 1, + 1, 1, 1, 1, 14, 14, 14, 14, 15, 14, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 1, 1, 1, 1, 16, 1, 17, 18, 19, 20, + + 21, 22, 23, 24, 25, 5, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 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, 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 + } ; + + static yyconst int yy_meta[42] = + { 0, + 1, 1, 2, 1, 3, 1, 1, 3, 3, 3, + 3, 4, 1, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3 + } ; + + static yyconst short int yy_base[448] = + { 0, + 0, 0, 926, 927, 927, 927, 921, 912, 34, 36, + 38, 42, 46, 50, 0, 52, 57, 54, 68, 62, + 80, 82, 76, 94, 98, 40, 83, 88, 56, 125, + 108, 154, 109, 87, 110, 111, 919, 927, 910, 927, + 0, 119, 134, 142, 145, 124, 159, 166, 179, 0, + 55, 180, 147, 153, 119, 150, 183, 156, 909, 175, + 191, 192, 196, 90, 146, 200, 199, 201, 202, 204, + 205, 211, 212, 210, 218, 217, 221, 227, 236, 230, + 214, 239, 241, 908, 243, 247, 248, 225, 249, 250, + 251, 253, 258, 262, 267, 270, 907, 274, 259, 275, + + 279, 263, 284, 41, 285, 286, 288, 84, 294, 906, + 0, 308, 310, 905, 318, 330, 0, 904, 300, 304, + 903, 314, 902, 282, 901, 320, 324, 331, 900, 332, + 312, 333, 336, 899, 337, 342, 338, 341, 344, 345, + 352, 349, 356, 353, 346, 360, 363, 364, 367, 370, + 371, 373, 374, 375, 377, 898, 897, 378, 31, 896, + 379, 895, 894, 404, 392, 395, 380, 408, 893, 383, + 892, 388, 399, 891, 398, 416, 422, 386, 391, 426, + 424, 427, 428, 429, 432, 430, 440, 434, 436, 437, + 442, 446, 443, 455, 890, 444, 927, 458, 475, 461, + + 465, 477, 466, 472, 468, 478, 889, 888, 887, 480, + 481, 484, 486, 482, 488, 490, 491, 496, 494, 498, + 492, 886, 502, 506, 507, 500, 508, 510, 513, 514, + 518, 885, 884, 519, 520, 883, 522, 525, 0, 527, + 526, 523, 531, 534, 538, 540, 541, 544, 545, 552, + 882, 556, 555, 881, 880, 558, 879, 560, 562, 550, + 568, 566, 569, 574, 575, 576, 878, 577, 877, 578, + 581, 876, 582, 581, 875, 585, 588, 584, 596, 597, + 594, 598, 599, 601, 874, 607, 873, 604, 609, 610, + 612, 615, 618, 872, 617, 619, 622, 630, 631, 633, + + 871, 620, 623, 870, 869, 868, 867, 866, 865, 864, + 637, 863, 636, 641, 643, 862, 861, 860, 644, 649, + 645, 650, 651, 859, 654, 655, 657, 858, 658, 857, + 659, 660, 661, 856, 855, 854, 665, 663, 853, 666, + 852, 672, 675, 680, 851, 687, 850, 849, 848, 847, + 678, 679, 846, 688, 845, 844, 843, 689, 691, 842, + 839, 829, 828, 690, 693, 692, 695, 827, 825, 697, + 701, 704, 700, 707, 708, 711, 714, 824, 715, 716, + 725, 719, 726, 727, 823, 822, 729, 731, 732, 733, + 819, 818, 734, 739, 735, 737, 817, 740, 816, 745, + + 741, 751, 752, 757, 758, 759, 760, 761, 762, 763, + 765, 767, 770, 812, 769, 771, 774, 783, 773, 777, + 784, 811, 785, 810, 787, 791, 793, 795, 797, 799, + 802, 803, 805, 804, 625, 542, 806, 387, 255, 809, + 219, 927, 843, 845, 182, 849, 139 + } ; + + static yyconst short int yy_def[448] = + { 0, + 442, 1, 442, 442, 442, 442, 443, 444, 445, 442, + 444, 444, 444, 444, 446, 444, 444, 444, 444, 444, + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + 444, 444, 444, 444, 444, 444, 443, 442, 444, 442, + 447, 447, 442, 442, 444, 444, 444, 444, 444, 446, + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + + 444, 444, 444, 444, 444, 444, 444, 444, 444, 442, + 447, 447, 442, 444, 444, 444, 49, 444, 444, 444, + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + 444, 444, 444, 49, 444, 444, 444, 444, 444, 444, + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + 444, 444, 444, 444, 444, 444, 442, 442, 442, 442, + + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + 444, 444, 444, 444, 444, 444, 444, 444, 164, 444, + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + 442, 444, 444, 444, 444, 444, 444, 444, 444, 444, + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + 444, 444, 444, 444, 444, 444, 444, 444, 444, 444, + 444, 0, 442, 442, 442, 442, 442 + } ; + + static yyconst short int yy_nxt[969] = + { 0, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 4, 15, 8, 8, 8, 16, 17, 18, 19, + 20, 21, 22, 8, 23, 8, 24, 25, 26, 27, + 28, 8, 29, 30, 31, 32, 33, 34, 35, 8, + 36, 42, 40, 43, 43, 44, 44, 45, 45, 40, + 46, 40, 40, 40, 47, 48, 48, 40, 47, 48, + 48, 40, 237, 40, 188, 40, 40, 40, 40, 81, + 60, 51, 61, 40, 118, 82, 87, 56, 52, 40, + 53, 57, 54, 62, 49, 55, 58, 40, 63, 59, + 66, 40, 64, 40, 40, 40, 68, 65, 40, 40, + + 67, 40, 71, 73, 74, 40, 69, 107, 72, 40, + 75, 85, 70, 83, 78, 84, 195, 86, 76, 40, + 40, 40, 40, 77, 96, 105, 134, 79, 112, 112, + 40, 109, 114, 80, 88, 40, 40, 97, 106, 108, + 98, 111, 89, 43, 43, 90, 123, 99, 91, 92, + 113, 44, 44, 47, 45, 45, 40, 40, 40, 93, + 94, 40, 95, 88, 40, 40, 121, 40, 115, 115, + 40, 100, 124, 116, 47, 48, 48, 40, 101, 116, + 102, 135, 103, 122, 41, 126, 40, 104, 117, 117, + 40, 40, 117, 117, 40, 117, 117, 117, 117, 117, + + 117, 127, 40, 40, 119, 125, 120, 40, 128, 129, + 40, 40, 40, 40, 132, 40, 40, 137, 130, 136, + 131, 40, 40, 40, 142, 40, 133, 139, 40, 40, + 40, 141, 40, 138, 140, 149, 40, 152, 40, 143, + 144, 40, 145, 146, 147, 150, 148, 40, 157, 153, + 40, 151, 40, 154, 40, 155, 156, 159, 40, 40, + 40, 40, 40, 164, 40, 158, 40, 160, 166, 40, + 40, 161, 172, 40, 40, 162, 167, 169, 40, 174, + 170, 40, 163, 171, 168, 40, 40, 173, 165, 180, + 40, 175, 183, 40, 176, 40, 40, 40, 178, 40, + + 189, 190, 177, 184, 194, 40, 206, 182, 185, 179, + 192, 40, 193, 191, 181, 40, 186, 112, 112, 198, + 198, 187, 203, 40, 199, 40, 196, 115, 115, 40, + 199, 40, 116, 204, 205, 40, 200, 201, 116, 202, + 202, 40, 40, 40, 40, 211, 207, 40, 40, 40, + 208, 210, 40, 40, 214, 40, 40, 40, 216, 212, + 40, 217, 213, 40, 40, 209, 215, 40, 221, 222, + 224, 40, 225, 218, 40, 40, 223, 219, 40, 220, + 226, 40, 40, 227, 40, 40, 40, 229, 40, 40, + 40, 40, 232, 228, 40, 230, 233, 40, 40, 40, + + 242, 234, 40, 40, 236, 231, 40, 238, 248, 40, + 40, 254, 235, 239, 239, 247, 253, 239, 239, 40, + 239, 239, 239, 239, 239, 239, 240, 40, 243, 241, + 244, 249, 250, 40, 245, 40, 246, 40, 40, 40, + 40, 40, 251, 40, 252, 40, 255, 40, 40, 259, + 261, 40, 264, 40, 40, 40, 258, 40, 256, 268, + 260, 257, 266, 263, 262, 267, 40, 198, 198, 265, + 271, 271, 199, 270, 202, 202, 40, 40, 199, 40, + 269, 200, 200, 40, 271, 271, 202, 202, 40, 40, + 273, 40, 40, 40, 272, 40, 274, 40, 276, 40, + + 278, 40, 40, 40, 281, 40, 275, 40, 280, 40, + 279, 40, 284, 40, 285, 277, 286, 40, 40, 40, + 282, 40, 289, 283, 40, 40, 287, 290, 288, 40, + 40, 40, 291, 40, 40, 293, 40, 40, 40, 294, + 292, 303, 40, 295, 296, 40, 298, 301, 297, 40, + 302, 40, 40, 40, 305, 40, 40, 299, 307, 300, + 309, 40, 304, 40, 311, 312, 40, 40, 306, 40, + 313, 40, 308, 40, 319, 310, 314, 40, 316, 40, + 40, 315, 317, 318, 320, 40, 40, 40, 40, 40, + 271, 271, 40, 40, 321, 40, 40, 324, 328, 40, + + 329, 322, 327, 330, 331, 40, 323, 40, 40, 40, + 40, 326, 40, 333, 325, 40, 332, 334, 40, 338, + 40, 40, 335, 40, 340, 339, 40, 337, 40, 40, + 40, 40, 336, 40, 40, 341, 40, 342, 345, 347, + 348, 40, 40, 344, 40, 346, 343, 40, 40, 352, + 349, 350, 40, 351, 40, 40, 40, 353, 354, 355, + 40, 40, 40, 357, 360, 40, 40, 359, 40, 40, + 40, 40, 40, 362, 40, 356, 40, 40, 358, 364, + 368, 370, 366, 40, 361, 365, 40, 367, 363, 40, + 40, 40, 373, 372, 369, 374, 375, 371, 40, 40, + + 40, 40, 40, 40, 40, 376, 40, 378, 40, 379, + 377, 40, 40, 380, 381, 40, 382, 383, 40, 40, + 384, 387, 40, 386, 388, 40, 40, 40, 389, 385, + 40, 392, 395, 390, 391, 394, 40, 40, 40, 397, + 40, 396, 40, 40, 40, 40, 40, 393, 40, 399, + 40, 40, 40, 403, 407, 400, 40, 405, 404, 401, + 398, 406, 40, 40, 408, 409, 402, 411, 40, 40, + 40, 40, 40, 40, 40, 410, 40, 417, 40, 412, + 40, 40, 40, 415, 40, 40, 416, 421, 40, 418, + 422, 424, 414, 419, 40, 40, 40, 413, 40, 420, + + 425, 428, 40, 426, 40, 430, 40, 427, 40, 423, + 40, 431, 429, 40, 40, 40, 40, 40, 436, 432, + 40, 40, 40, 40, 434, 433, 440, 40, 40, 40, + 40, 435, 439, 40, 40, 40, 40, 438, 40, 40, + 40, 441, 437, 37, 37, 37, 37, 39, 39, 50, + 40, 50, 50, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 197, 40, 40, + 40, 40, 110, 40, 38, 442, 3, 442, 442, 442, + 442, 442, 442, 442, 442, 442, 442, 442, 442, 442, + 442, 442, 442, 442, 442, 442, 442, 442, 442, 442, + 442, 442, 442, 442, 442, 442, 442, 442, 442, 442, + 442, 442, 442, 442, 442, 442, 442, 442 + } ; + + static yyconst short int yy_chk[969] = + { 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, 9, 159, 9, 9, 10, 10, 11, 11, 11, + 12, 26, 104, 12, 13, 13, 13, 13, 14, 14, + 14, 14, 159, 16, 104, 18, 51, 29, 17, 26, + 18, 16, 18, 20, 51, 26, 29, 17, 16, 19, + 16, 17, 16, 18, 13, 16, 17, 23, 19, 17, + 20, 21, 19, 22, 27, 108, 21, 19, 34, 28, + + 20, 64, 22, 23, 23, 24, 21, 34, 22, 25, + 24, 28, 21, 27, 25, 27, 108, 28, 24, 31, + 33, 35, 36, 24, 31, 33, 64, 25, 42, 42, + 55, 36, 46, 25, 30, 46, 30, 31, 33, 35, + 31, 447, 30, 43, 43, 30, 55, 31, 30, 30, + 44, 44, 44, 45, 45, 45, 45, 65, 53, 30, + 30, 56, 30, 32, 54, 32, 53, 58, 47, 47, + 47, 32, 56, 47, 48, 48, 48, 48, 32, 47, + 32, 65, 32, 54, 445, 58, 60, 32, 49, 49, + 49, 52, 49, 49, 57, 49, 49, 49, 49, 49, + + 49, 60, 61, 62, 52, 57, 52, 63, 60, 61, + 67, 66, 68, 69, 63, 70, 71, 67, 62, 66, + 62, 74, 72, 73, 70, 81, 63, 68, 76, 75, + 441, 69, 77, 67, 68, 75, 88, 77, 78, 71, + 72, 80, 73, 74, 74, 76, 74, 79, 81, 77, + 82, 76, 83, 78, 85, 79, 80, 83, 86, 87, + 89, 90, 91, 88, 92, 82, 439, 85, 90, 93, + 99, 86, 92, 94, 102, 87, 90, 91, 95, 94, + 91, 96, 87, 91, 90, 98, 100, 93, 89, 99, + 101, 95, 102, 124, 96, 103, 105, 106, 98, 107, + + 105, 105, 96, 103, 107, 109, 124, 101, 103, 98, + 106, 119, 106, 105, 100, 120, 103, 112, 112, 113, + 113, 103, 119, 131, 113, 122, 109, 115, 115, 115, + 113, 126, 115, 120, 122, 127, 116, 116, 115, 116, + 116, 116, 128, 130, 132, 131, 126, 133, 135, 137, + 127, 130, 138, 136, 135, 139, 140, 145, 137, 132, + 142, 138, 133, 141, 144, 128, 136, 143, 141, 142, + 144, 146, 145, 138, 147, 148, 143, 139, 149, 140, + 146, 150, 151, 147, 152, 153, 154, 149, 155, 158, + 161, 167, 152, 148, 170, 150, 153, 178, 438, 172, + + 167, 154, 179, 165, 158, 151, 166, 161, 172, 175, + 173, 179, 155, 164, 164, 170, 178, 164, 164, 168, + 164, 164, 164, 164, 164, 164, 165, 176, 168, 166, + 168, 173, 175, 177, 168, 181, 168, 180, 182, 183, + 184, 186, 176, 185, 177, 188, 180, 189, 190, 184, + 186, 187, 189, 191, 193, 196, 183, 192, 181, 193, + 185, 182, 191, 188, 187, 192, 194, 198, 198, 190, + 200, 200, 198, 196, 201, 201, 201, 203, 198, 205, + 194, 199, 199, 204, 199, 199, 202, 202, 202, 206, + 204, 210, 211, 214, 203, 212, 205, 213, 210, 215, + + 212, 216, 217, 221, 215, 219, 206, 218, 214, 220, + 213, 226, 218, 223, 219, 211, 220, 224, 225, 227, + 216, 228, 224, 217, 229, 230, 221, 225, 223, 231, + 234, 235, 226, 237, 242, 228, 238, 241, 240, 229, + 227, 242, 243, 230, 231, 244, 235, 240, 234, 245, + 241, 246, 247, 436, 244, 248, 249, 237, 245, 238, + 246, 260, 243, 250, 248, 249, 253, 252, 244, 256, + 250, 258, 245, 259, 260, 247, 252, 262, 256, 261, + 263, 253, 258, 259, 261, 264, 265, 266, 268, 270, + 271, 271, 274, 273, 262, 278, 276, 265, 273, 277, + + 274, 263, 270, 276, 277, 281, 264, 279, 280, 282, + 283, 268, 284, 279, 266, 288, 278, 280, 286, 284, + 289, 290, 281, 291, 288, 286, 292, 283, 295, 293, + 296, 302, 282, 297, 303, 289, 435, 290, 293, 296, + 297, 298, 299, 292, 300, 295, 291, 313, 311, 302, + 298, 299, 314, 300, 315, 319, 321, 303, 311, 313, + 320, 322, 323, 315, 321, 325, 326, 320, 327, 329, + 331, 332, 333, 323, 338, 314, 337, 340, 319, 326, + 332, 337, 329, 342, 322, 327, 343, 331, 325, 351, + 352, 344, 342, 340, 333, 343, 344, 338, 346, 354, + + 358, 364, 359, 366, 365, 346, 367, 352, 370, 354, + 351, 373, 371, 358, 359, 372, 364, 365, 374, 375, + 366, 371, 376, 370, 372, 377, 379, 380, 373, 367, + 382, 376, 380, 374, 375, 379, 381, 383, 384, 382, + 387, 381, 388, 389, 390, 393, 395, 377, 396, 384, + 394, 398, 401, 390, 396, 387, 400, 394, 393, 388, + 383, 395, 402, 403, 398, 400, 389, 402, 404, 405, + 406, 407, 408, 409, 410, 401, 411, 408, 412, 403, + 415, 413, 416, 406, 419, 417, 407, 412, 420, 409, + 413, 416, 405, 410, 418, 421, 423, 404, 425, 411, + + 417, 420, 426, 418, 427, 423, 428, 419, 429, 415, + 430, 425, 421, 431, 432, 434, 433, 437, 430, 426, + 440, 424, 422, 414, 428, 427, 437, 399, 397, 392, + 391, 429, 434, 386, 385, 378, 369, 432, 368, 363, + 362, 440, 431, 443, 443, 443, 443, 444, 444, 446, + 361, 446, 446, 360, 357, 356, 355, 353, 350, 349, + 348, 347, 345, 341, 339, 336, 335, 334, 330, 328, + 324, 318, 317, 316, 312, 310, 309, 308, 307, 306, + 305, 304, 301, 294, 287, 285, 275, 272, 269, 267, + 257, 255, 254, 251, 236, 233, 232, 222, 209, 208, + + 207, 195, 174, 171, 169, 163, 162, 160, 157, 156, + 134, 129, 125, 123, 121, 118, 114, 110, 97, 84, + 59, 39, 37, 8, 7, 3, 442, 442, 442, 442, + 442, 442, 442, 442, 442, 442, 442, 442, 442, 442, + 442, 442, 442, 442, 442, 442, 442, 442, 442, 442, + 442, 442, 442, 442, 442, 442, 442, 442, 442, 442, + 442, 442, 442, 442, 442, 442, 442, 442 + } ; + + static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr; + static char *yy_full_match; + static int yy_lp; + #define REJECT \ + { \ + *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \ + yy_cp = yy_full_match; /* restore poss. backed-over text */ \ + ++yy_lp; \ + goto find_rule; \ + } + #define yymore() yymore_used_but_not_detected + #define YY_MORE_ADJ 0 + #define YY_RESTORE_YY_MORE_OFFSET + char *yytext; + #line 1 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + #define INITIAL 0 + /*===-- Lexer.l - Scanner for llvm assembly files --------------*- C++ -*--===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by the LLVM research group and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file implements the flex scanner for LLVM assembly languages files. + // + //===----------------------------------------------------------------------===*/ + #define YY_NEVER_INTERACTIVE 1 + #line 28 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + #include "ParserInternals.h" + #include "llvm/Module.h" + #include + #include "llvmAsmParser.h" + #include + #include + + void set_scan_file(FILE * F){ + yy_switch_to_buffer(yy_create_buffer( F, YY_BUF_SIZE ) ); + } + void set_scan_string (const char * str) { + yy_scan_string (str); + } + + #define RET_TOK(type, Enum, sym) \ + llvmAsmlval.type = Instruction::Enum; return sym + + namespace llvm { + + // TODO: All of the static identifiers are figured out by the lexer, + // these should be hashed to reduce the lexer size + + + // atoull - Convert an ascii string of decimal digits into the unsigned long + // long representation... this does not have to do input error checking, + // because we know that the input will be matched by a suitable regex... + // + static uint64_t atoull(const char *Buffer) { + uint64_t Result = 0; + for (; *Buffer; Buffer++) { + uint64_t OldRes = Result; + Result *= 10; + Result += *Buffer-'0'; + if (Result < OldRes) // Uh, oh, overflow detected!!! + ThrowException("constant bigger than 64 bits detected!"); + } + return Result; + } + + static uint64_t HexIntToVal(const char *Buffer) { + uint64_t Result = 0; + for (; *Buffer; ++Buffer) { + uint64_t OldRes = Result; + Result *= 16; + char C = *Buffer; + if (C >= '0' && C <= '9') + Result += C-'0'; + else if (C >= 'A' && C <= 'F') + Result += C-'A'+10; + else if (C >= 'a' && C <= 'f') + Result += C-'a'+10; + + if (Result < OldRes) // Uh, oh, overflow detected!!! + ThrowException("constant bigger than 64 bits detected!"); + } + return Result; + } + + + // HexToFP - Convert the ascii string in hexidecimal format to the floating + // point representation of it. + // + static double HexToFP(const char *Buffer) { + // Behave nicely in the face of C TBAA rules... see: + // http://www.nullstone.com/htmls/category/aliastyp.htm + union { + uint64_t UI; + double FP; + } UIntToFP; + UIntToFP.UI = HexIntToVal(Buffer); + + assert(sizeof(double) == sizeof(uint64_t) && + "Data sizes incompatible on this target!"); + return UIntToFP.FP; // Cast Hex constant to double + } + + + // UnEscapeLexed - Run through the specified buffer and change \xx codes to the + // appropriate character. If AllowNull is set to false, a \00 value will cause + // an exception to be thrown. + // + // If AllowNull is set to true, the return value of the function points to the + // last character of the string in memory. + // + char *UnEscapeLexed(char *Buffer, bool AllowNull) { + char *BOut = Buffer; + for (char *BIn = Buffer; *BIn; ) { + if (BIn[0] == '\\' && isxdigit(BIn[1]) && isxdigit(BIn[2])) { + char Tmp = BIn[3]; BIn[3] = 0; // Terminate string + *BOut = (char)strtol(BIn+1, 0, 16); // Convert to number + if (!AllowNull && !*BOut) + ThrowException("String literal cannot accept \\00 escape!"); + + BIn[3] = Tmp; // Restore character + BIn += 3; // Skip over handled chars + ++BOut; + } else { + *BOut++ = *BIn++; + } + } + + return BOut; + } + + } // End llvm namespace + + using namespace llvm; + + #define YY_NEVER_INTERACTIVE 1 + /* Comments start with a ; and go till end of line */ + /* Variable(Value) identifiers start with a % sign */ + /* Label identifiers end with a colon */ + /* Quoted names can contain any character except " and \ */ + /* [PN]Integer: match positive and negative literal integer values that + * are preceeded by a '%' character. These represent unnamed variable slots. + */ + /* E[PN]Integer: match positive and negative literal integer values */ + /* FPConstant - A Floating point constant. + */ + /* HexFPConstant - Floating point constant represented in IEEE format as a + * hexadecimal number for when exponential notation is not precise enough. + */ + /* HexIntConstant - Hexadecimal constant generated by the CFE to avoid forcing + * it to deal with 64 bit numbers. + */ + #line 913 "Lexer.cpp" + + /* Macros after this point can all be overridden by user definitions in + * section 1. + */ + + #ifndef YY_SKIP_YYWRAP + #ifdef __cplusplus + extern "C" int yywrap YY_PROTO(( void )); + #else + extern int yywrap YY_PROTO(( void )); + #endif + #endif + + #ifndef YY_NO_UNPUT + static inline void yyunput YY_PROTO(( int c, char *buf_ptr )); + #endif + + #ifndef yytext_ptr + static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); + #endif + + #ifdef YY_NEED_STRLEN + static int yy_flex_strlen YY_PROTO(( yyconst char * )); + #endif + + #ifndef YY_NO_INPUT + #ifdef __cplusplus + static int yyinput YY_PROTO(( void )); + #else + static int input YY_PROTO(( void )); + #endif + #endif + + #if YY_STACK_USED + static int yy_start_stack_ptr = 0; + static int yy_start_stack_depth = 0; + static int *yy_start_stack = 0; + #ifndef YY_NO_PUSH_STATE + static void yy_push_state YY_PROTO(( int new_state )); + #endif + #ifndef YY_NO_POP_STATE + static void yy_pop_state YY_PROTO(( void )); + #endif + #ifndef YY_NO_TOP_STATE + static int yy_top_state YY_PROTO(( void )); + #endif + + #else + #define YY_NO_PUSH_STATE 1 + #define YY_NO_POP_STATE 1 + #define YY_NO_TOP_STATE 1 + #endif + + #ifdef YY_MALLOC_DECL + YY_MALLOC_DECL + #else + #if __STDC__ + #ifndef __cplusplus + #include + #endif + #else + /* Just try to get by without declaring the routines. This will fail + * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) + * or sizeof(void*) != sizeof(int). + */ + #endif + #endif + + /* Amount of stuff to slurp up with each read. */ + #ifndef YY_READ_BUF_SIZE + #define YY_READ_BUF_SIZE 8192 + #endif + + /* Copy whatever the last rule matched to the standard output. */ + + #ifndef ECHO + /* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ + #define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) + #endif + + /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ + #ifndef YY_INPUT + #define YY_INPUT(buf,result,max_size) \ + if ( yy_current_buffer->yy_is_interactive ) \ + { \ + int c = '*', n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ + && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); + #endif + + /* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ + #ifndef yyterminate + #define yyterminate() return YY_NULL + #endif + + /* Number of entries by which start-condition stack grows. */ + #ifndef YY_START_STACK_INCR + #define YY_START_STACK_INCR 25 + #endif + + /* Report a fatal error. */ + #ifndef YY_FATAL_ERROR + #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) + #endif + + /* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ + #ifndef YY_DECL + #define YY_DECL int yylex YY_PROTO(( void )) + #endif + + /* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ + #ifndef YY_USER_ACTION + #define YY_USER_ACTION + #endif + + /* Code executed at the end of each rule. */ + #ifndef YY_BREAK + #define YY_BREAK break; + #endif + + #define YY_RULE_SETUP \ + YY_USER_ACTION + + YY_DECL + { + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + + #line 179 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + + + #line 1067 "Lexer.cpp" + + if ( yy_init ) + { + yy_init = 0; + + #ifdef YY_USER_INIT + YY_USER_INIT; + #endif + + if ( ! yy_start ) + yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! yy_current_buffer ) + yy_current_buffer = + yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_load_buffer_state(); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = yy_start; + yy_state_ptr = yy_state_buf; + *yy_state_ptr++ = yy_current_state; + yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 443 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + *yy_state_ptr++ = yy_current_state; + ++yy_cp; + } + while ( yy_current_state != 442 ); + + yy_find_action: + yy_current_state = *--yy_state_ptr; + yy_lp = yy_accept[yy_current_state]; + find_rule: /* we branch to this label when backing up */ + for ( ; ; ) /* until we find what rule we matched */ + { + if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] ) + { + yy_act = yy_acclist[yy_lp]; + { + yy_full_match = yy_cp; + break; + } + } + --yy_cp; + yy_current_state = *--yy_state_ptr; + yy_lp = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + + if ( yy_act != YY_END_OF_BUFFER ) + { + int yyl; + for ( yyl = 0; yyl < yyleng; ++yyl ) + if ( yytext[yyl] == '\n' ) + ++yylineno; + } + + do_action: /* This label is used only to access EOF actions. */ + + + switch ( yy_act ) + { /* beginning of action switch */ + case 1: + YY_RULE_SETUP + #line 181 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { /* Ignore comments for now */ } + YY_BREAK + case 2: + YY_RULE_SETUP + #line 183 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return BEGINTOK; } + YY_BREAK + case 3: + YY_RULE_SETUP + #line 184 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return ENDTOK; } + YY_BREAK + case 4: + YY_RULE_SETUP + #line 185 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return TRUETOK; } + YY_BREAK + case 5: + YY_RULE_SETUP + #line 186 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return FALSETOK; } + YY_BREAK + case 6: + YY_RULE_SETUP + #line 187 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return DECLARE; } + YY_BREAK + case 7: + YY_RULE_SETUP + #line 188 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return GLOBAL; } + YY_BREAK + case 8: + YY_RULE_SETUP + #line 189 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return CONSTANT; } + YY_BREAK + case 9: + YY_RULE_SETUP + #line 190 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return INTERNAL; } + YY_BREAK + case 10: + YY_RULE_SETUP + #line 191 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return LINKONCE; } + YY_BREAK + case 11: + YY_RULE_SETUP + #line 192 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return WEAK; } + YY_BREAK + case 12: + YY_RULE_SETUP + #line 193 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return APPENDING; } + YY_BREAK + case 13: + YY_RULE_SETUP + #line 194 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return EXTERNAL; } /* Deprecated, turn into external */ + YY_BREAK + case 14: + YY_RULE_SETUP + #line 195 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return EXTERNAL; } + YY_BREAK + case 15: + YY_RULE_SETUP + #line 196 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return IMPLEMENTATION; } + YY_BREAK + case 16: + YY_RULE_SETUP + #line 197 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return ZEROINITIALIZER; } + YY_BREAK + case 17: + YY_RULE_SETUP + #line 198 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return DOTDOTDOT; } + YY_BREAK + case 18: + YY_RULE_SETUP + #line 199 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return UNDEF; } + YY_BREAK + case 19: + YY_RULE_SETUP + #line 200 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return NULL_TOK; } + YY_BREAK + case 20: + YY_RULE_SETUP + #line 201 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return TO; } + YY_BREAK + case 21: + YY_RULE_SETUP + #line 202 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(TermOpVal, Unwind, UNWIND); } + YY_BREAK + case 22: + YY_RULE_SETUP + #line 203 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return NOT; } /* Deprecated, turned into XOR */ + YY_BREAK + case 23: + YY_RULE_SETUP + #line 204 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return TAIL; } + YY_BREAK + case 24: + YY_RULE_SETUP + #line 205 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return TARGET; } + YY_BREAK + case 25: + YY_RULE_SETUP + #line 206 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return TRIPLE; } + YY_BREAK + case 26: + YY_RULE_SETUP + #line 207 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return DEPLIBS; } + YY_BREAK + case 27: + YY_RULE_SETUP + #line 208 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return ENDIAN; } + YY_BREAK + case 28: + YY_RULE_SETUP + #line 209 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return POINTERSIZE; } + YY_BREAK + case 29: + YY_RULE_SETUP + #line 210 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return LITTLE; } + YY_BREAK + case 30: + YY_RULE_SETUP + #line 211 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return BIG; } + YY_BREAK + case 31: + YY_RULE_SETUP + #line 212 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return VOLATILE; } + YY_BREAK + case 32: + YY_RULE_SETUP + #line 213 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return ALIGN; } + YY_BREAK + case 33: + YY_RULE_SETUP + #line 214 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return SECTION; } + YY_BREAK + case 34: + YY_RULE_SETUP + #line 215 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return MODULE; } + YY_BREAK + case 35: + YY_RULE_SETUP + #line 216 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return ASM_TOK; } + YY_BREAK + case 36: + YY_RULE_SETUP + #line 217 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return SIDEEFFECT; } + YY_BREAK + case 37: + YY_RULE_SETUP + #line 219 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return CC_TOK; } + YY_BREAK + case 38: + YY_RULE_SETUP + #line 220 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return CCC_TOK; } + YY_BREAK + case 39: + YY_RULE_SETUP + #line 221 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return FASTCC_TOK; } + YY_BREAK + case 40: + YY_RULE_SETUP + #line 222 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return COLDCC_TOK; } + YY_BREAK + case 41: + YY_RULE_SETUP + #line 224 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { llvmAsmlval.PrimType = Type::VoidTy ; return VOID; } + YY_BREAK + case 42: + YY_RULE_SETUP + #line 225 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { llvmAsmlval.PrimType = Type::BoolTy ; return BOOL; } + YY_BREAK + case 43: + YY_RULE_SETUP + #line 226 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { llvmAsmlval.PrimType = Type::SByteTy ; return SBYTE; } + YY_BREAK + case 44: + YY_RULE_SETUP + #line 227 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { llvmAsmlval.PrimType = Type::UByteTy ; return UBYTE; } + YY_BREAK + case 45: + YY_RULE_SETUP + #line 228 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { llvmAsmlval.PrimType = Type::ShortTy ; return SHORT; } + YY_BREAK + case 46: + YY_RULE_SETUP + #line 229 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { llvmAsmlval.PrimType = Type::UShortTy; return USHORT; } + YY_BREAK + case 47: + YY_RULE_SETUP + #line 230 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { llvmAsmlval.PrimType = Type::IntTy ; return INT; } + YY_BREAK + case 48: + YY_RULE_SETUP + #line 231 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { llvmAsmlval.PrimType = Type::UIntTy ; return UINT; } + YY_BREAK + case 49: + YY_RULE_SETUP + #line 232 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { llvmAsmlval.PrimType = Type::LongTy ; return LONG; } + YY_BREAK + case 50: + YY_RULE_SETUP + #line 233 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { llvmAsmlval.PrimType = Type::ULongTy ; return ULONG; } + YY_BREAK + case 51: + YY_RULE_SETUP + #line 234 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { llvmAsmlval.PrimType = Type::FloatTy ; return FLOAT; } + YY_BREAK + case 52: + YY_RULE_SETUP + #line 235 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { llvmAsmlval.PrimType = Type::DoubleTy; return DOUBLE; } + YY_BREAK + case 53: + YY_RULE_SETUP + #line 236 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { llvmAsmlval.PrimType = Type::LabelTy ; return LABEL; } + YY_BREAK + case 54: + YY_RULE_SETUP + #line 237 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return TYPE; } + YY_BREAK + case 55: + YY_RULE_SETUP + #line 238 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return OPAQUE; } + YY_BREAK + case 56: + YY_RULE_SETUP + #line 240 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(BinaryOpVal, Add, ADD); } + YY_BREAK + case 57: + YY_RULE_SETUP + #line 241 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(BinaryOpVal, Sub, SUB); } + YY_BREAK + case 58: + YY_RULE_SETUP + #line 242 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(BinaryOpVal, Mul, MUL); } + YY_BREAK + case 59: + YY_RULE_SETUP + #line 243 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(BinaryOpVal, Div, DIV); } + YY_BREAK + case 60: + YY_RULE_SETUP + #line 244 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(BinaryOpVal, Rem, REM); } + YY_BREAK + case 61: + YY_RULE_SETUP + #line 245 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(BinaryOpVal, And, AND); } + YY_BREAK + case 62: + YY_RULE_SETUP + #line 246 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(BinaryOpVal, Or , OR ); } + YY_BREAK + case 63: + YY_RULE_SETUP + #line 247 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(BinaryOpVal, Xor, XOR); } + YY_BREAK + case 64: + YY_RULE_SETUP + #line 248 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(BinaryOpVal, SetNE, SETNE); } + YY_BREAK + case 65: + YY_RULE_SETUP + #line 249 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(BinaryOpVal, SetEQ, SETEQ); } + YY_BREAK + case 66: + YY_RULE_SETUP + #line 250 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(BinaryOpVal, SetLT, SETLT); } + YY_BREAK + case 67: + YY_RULE_SETUP + #line 251 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(BinaryOpVal, SetGT, SETGT); } + YY_BREAK + case 68: + YY_RULE_SETUP + #line 252 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(BinaryOpVal, SetLE, SETLE); } + YY_BREAK + case 69: + YY_RULE_SETUP + #line 253 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(BinaryOpVal, SetGE, SETGE); } + YY_BREAK + case 70: + YY_RULE_SETUP + #line 255 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(OtherOpVal, PHI, PHI_TOK); } + YY_BREAK + case 71: + YY_RULE_SETUP + #line 256 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(OtherOpVal, Call, CALL); } + YY_BREAK + case 72: + YY_RULE_SETUP + #line 257 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(OtherOpVal, Cast, CAST); } + YY_BREAK + case 73: + YY_RULE_SETUP + #line 258 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(OtherOpVal, Select, SELECT); } + YY_BREAK + case 74: + YY_RULE_SETUP + #line 259 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(OtherOpVal, Shl, SHL); } + YY_BREAK + case 75: + YY_RULE_SETUP + #line 260 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(OtherOpVal, Shr, SHR); } + YY_BREAK + case 76: + YY_RULE_SETUP + #line 261 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return VANEXT_old; } + YY_BREAK + case 77: + YY_RULE_SETUP + #line 262 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return VAARG_old; } + YY_BREAK + case 78: + YY_RULE_SETUP + #line 263 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(OtherOpVal, VAArg , VAARG); } + YY_BREAK + case 79: + YY_RULE_SETUP + #line 264 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(TermOpVal, Ret, RET); } + YY_BREAK + case 80: + YY_RULE_SETUP + #line 265 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(TermOpVal, Br, BR); } + YY_BREAK + case 81: + YY_RULE_SETUP + #line 266 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(TermOpVal, Switch, SWITCH); } + YY_BREAK + case 82: + YY_RULE_SETUP + #line 267 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(TermOpVal, Invoke, INVOKE); } + YY_BREAK + case 83: + YY_RULE_SETUP + #line 268 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(TermOpVal, Unwind, UNWIND); } + YY_BREAK + case 84: + YY_RULE_SETUP + #line 269 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(TermOpVal, Unreachable, UNREACHABLE); } + YY_BREAK + case 85: + YY_RULE_SETUP + #line 271 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(MemOpVal, Malloc, MALLOC); } + YY_BREAK + case 86: + YY_RULE_SETUP + #line 272 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(MemOpVal, Alloca, ALLOCA); } + YY_BREAK + case 87: + YY_RULE_SETUP + #line 273 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(MemOpVal, Free, FREE); } + YY_BREAK + case 88: + YY_RULE_SETUP + #line 274 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(MemOpVal, Load, LOAD); } + YY_BREAK + case 89: + YY_RULE_SETUP + #line 275 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(MemOpVal, Store, STORE); } + YY_BREAK + case 90: + YY_RULE_SETUP + #line 276 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(MemOpVal, GetElementPtr, GETELEMENTPTR); } + YY_BREAK + case 91: + YY_RULE_SETUP + #line 278 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(OtherOpVal, ExtractElement, EXTRACTELEMENT); } + YY_BREAK + case 92: + YY_RULE_SETUP + #line 279 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { RET_TOK(OtherOpVal, InsertElement, INSERTELEMENT); } + YY_BREAK + case 93: + YY_RULE_SETUP + #line 282 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { + UnEscapeLexed(yytext+1); + llvmAsmlval.StrVal = strdup(yytext+1); // Skip % + return VAR_ID; + } + YY_BREAK + case 94: + YY_RULE_SETUP + #line 287 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { + yytext[strlen(yytext)-1] = 0; // nuke colon + UnEscapeLexed(yytext); + llvmAsmlval.StrVal = strdup(yytext); + return LABELSTR; + } + YY_BREAK + case 95: + YY_RULE_SETUP + #line 293 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { + yytext[strlen(yytext)-2] = 0; // nuke colon, end quote + UnEscapeLexed(yytext+1); + llvmAsmlval.StrVal = strdup(yytext+1); + return LABELSTR; + } + YY_BREAK + case 96: + YY_RULE_SETUP + #line 300 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { // Note that we cannot unescape a string constant here! The + // string constant might contain a \00 which would not be + // understood by the string stuff. It is valid to make a + // [sbyte] c"Hello World\00" constant, for example. + // + yytext[strlen(yytext)-1] = 0; // nuke end quote + llvmAsmlval.StrVal = strdup(yytext+1); // Nuke start quote + return STRINGCONSTANT; + } + YY_BREAK + case 97: + YY_RULE_SETUP + #line 311 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { llvmAsmlval.UInt64Val = atoull(yytext); return EUINT64VAL; } + YY_BREAK + case 98: + YY_RULE_SETUP + #line 312 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { + uint64_t Val = atoull(yytext+1); + // +1: we have bigger negative range + if (Val > (uint64_t)INT64_MAX+1) + ThrowException("Constant too large for signed 64 bits!"); + llvmAsmlval.SInt64Val = -Val; + return ESINT64VAL; + } + YY_BREAK + case 99: + YY_RULE_SETUP + #line 320 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { + llvmAsmlval.UInt64Val = HexIntToVal(yytext+3); + return yytext[0] == 's' ? ESINT64VAL : EUINT64VAL; + } + YY_BREAK + case 100: + YY_RULE_SETUP + #line 325 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { + uint64_t Val = atoull(yytext+1); + if ((unsigned)Val != Val) + ThrowException("Invalid value number (too large)!"); + llvmAsmlval.UIntVal = unsigned(Val); + return UINTVAL; + } + YY_BREAK + case 101: + YY_RULE_SETUP + #line 332 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { + uint64_t Val = atoull(yytext+2); + // +1: we have bigger negative range + if (Val > (uint64_t)INT32_MAX+1) + ThrowException("Constant too large for signed 32 bits!"); + llvmAsmlval.SIntVal = (int)-Val; + return SINTVAL; + } + YY_BREAK + case 102: + YY_RULE_SETUP + #line 341 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { llvmAsmlval.FPVal = atof(yytext); return FPVAL; } + YY_BREAK + case 103: + YY_RULE_SETUP + #line 342 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { llvmAsmlval.FPVal = HexToFP(yytext); return FPVAL; } + YY_BREAK + case YY_STATE_EOF(INITIAL): + #line 344 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { + /* Make sure to free the internal buffers for flex when we are + * done reading our input! + */ + yy_delete_buffer(YY_CURRENT_BUFFER); + return EOF; + } + YY_BREAK + case 104: + YY_RULE_SETUP + #line 352 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { /* Ignore whitespace */ } + YY_BREAK + case 105: + YY_RULE_SETUP + #line 353 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + { return yytext[0]; } + YY_BREAK + case 106: + YY_RULE_SETUP + #line 355 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + YY_FATAL_ERROR( "flex scanner jammed" ); + YY_BREAK + #line 1743 "Lexer.cpp" + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yy_hold_char; + YY_RESTORE_YY_MORE_OFFSET + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between yy_current_buffer and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yy_n_chars = yy_current_buffer->yy_n_chars; + yy_current_buffer->yy_input_file = yyin; + yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = yy_c_buf_p; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + yy_did_buffer_switch_on_eof = 0; + + if ( yywrap() ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = + yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yy_c_buf_p = + &yy_current_buffer->yy_ch_buf[yy_n_chars]; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of yylex */ + + + /* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ + + static int yy_get_next_buffer() + { + register char *dest = yy_current_buffer->yy_ch_buf; + register char *source = yytext_ptr; + register int number_to_move, i; + int ret_val; + + if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( yy_current_buffer->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + yy_current_buffer->yy_n_chars = yy_n_chars = 0; + + else + { + int num_to_read = + yy_current_buffer->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + #ifdef YY_USES_REJECT + YY_FATAL_ERROR( + "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); + #else + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = yy_current_buffer; + + int yy_c_buf_p_offset = + (int) (yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yy_flex_realloc( (void *) b->yy_ch_buf, + b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = yy_current_buffer->yy_buf_size - + number_to_move - 1; + #endif + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), + yy_n_chars, num_to_read ); + + yy_current_buffer->yy_n_chars = yy_n_chars; + } + + if ( yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart( yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + yy_current_buffer->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + yy_n_chars += number_to_move; + yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; + yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; + + return ret_val; + } + + + /* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state() + { + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = yy_start; + yy_state_ptr = yy_state_buf; + *yy_state_ptr++ = yy_current_state; + + for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 443 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + *yy_state_ptr++ = yy_current_state; + } + + return yy_current_state; + } + + + /* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + + #ifdef YY_USE_PROTOS + static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) + #else + static yy_state_type yy_try_NUL_trans( yy_current_state ) + yy_state_type yy_current_state; + #endif + { + register int yy_is_jam; + + register YY_CHAR yy_c = 1; + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 443 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 442); + if ( ! yy_is_jam ) + *yy_state_ptr++ = yy_current_state; + + return yy_is_jam ? 0 : yy_current_state; + } + + + #ifndef YY_NO_UNPUT + #ifdef YY_USE_PROTOS + static inline void yyunput( int c, register char *yy_bp ) + #else + static inline void yyunput( c, yy_bp ) + int c; + register char *yy_bp; + #endif + { + register char *yy_cp = yy_c_buf_p; + + /* undo effects of setting up yytext */ + *yy_cp = yy_hold_char; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = yy_n_chars + 2; + register char *dest = &yy_current_buffer->yy_ch_buf[ + yy_current_buffer->yy_buf_size + 2]; + register char *source = + &yy_current_buffer->yy_ch_buf[number_to_move]; + + while ( source > yy_current_buffer->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + yy_current_buffer->yy_n_chars = + yy_n_chars = yy_current_buffer->yy_buf_size; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + if ( c == '\n' ) + --yylineno; + + yytext_ptr = yy_bp; + yy_hold_char = *yy_cp; + yy_c_buf_p = yy_cp; + } + #endif /* ifndef YY_NO_UNPUT */ + + + #ifdef __cplusplus + static int yyinput() + #else + static int input() + #endif + { + int c; + + *yy_c_buf_p = yy_hold_char; + + if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + /* This was really a NUL. */ + *yy_c_buf_p = '\0'; + + else + { /* need more input */ + int offset = yy_c_buf_p - yytext_ptr; + ++yy_c_buf_p; + + switch ( yy_get_next_buffer() ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart( yyin ); + + /* fall through */ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap() ) + return EOF; + + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + #ifdef __cplusplus + return yyinput(); + #else + return input(); + #endif + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = yytext_ptr + offset; + break; + } + } + } + + c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ + *yy_c_buf_p = '\0'; /* preserve yytext */ + yy_hold_char = *++yy_c_buf_p; + + if ( c == '\n' ) + ++yylineno; + + return c; + } + + + #ifdef YY_USE_PROTOS + void yyrestart( FILE *input_file ) + #else + void yyrestart( input_file ) + FILE *input_file; + #endif + { + if ( ! yy_current_buffer ) + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_init_buffer( yy_current_buffer, input_file ); + yy_load_buffer_state(); + } + + + #ifdef YY_USE_PROTOS + void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) + #else + void yy_switch_to_buffer( new_buffer ) + YY_BUFFER_STATE new_buffer; + #endif + { + if ( yy_current_buffer == new_buffer ) + return; + + if ( yy_current_buffer ) + { + /* Flush out information for old buffer. */ + *yy_c_buf_p = yy_hold_char; + yy_current_buffer->yy_buf_pos = yy_c_buf_p; + yy_current_buffer->yy_n_chars = yy_n_chars; + } + + yy_current_buffer = new_buffer; + yy_load_buffer_state(); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yy_did_buffer_switch_on_eof = 1; + } + + + #ifdef YY_USE_PROTOS + void yy_load_buffer_state( void ) + #else + void yy_load_buffer_state() + #endif + { + yy_n_chars = yy_current_buffer->yy_n_chars; + yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; + yyin = yy_current_buffer->yy_input_file; + yy_hold_char = *yy_c_buf_p; + } + + + #ifdef YY_USE_PROTOS + YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) + #else + YY_BUFFER_STATE yy_create_buffer( file, size ) + FILE *file; + int size; + #endif + { + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer( b, file ); + + return b; + } + + + #ifdef YY_USE_PROTOS + void yy_delete_buffer( YY_BUFFER_STATE b ) + #else + void yy_delete_buffer( b ) + YY_BUFFER_STATE b; + #endif + { + if ( ! b ) + return; + + if ( b == yy_current_buffer ) + yy_current_buffer = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yy_flex_free( (void *) b->yy_ch_buf ); + + yy_flex_free( (void *) b ); + } + + + #ifndef YY_ALWAYS_INTERACTIVE + #ifndef YY_NEVER_INTERACTIVE + extern int isatty YY_PROTO(( int )); + #endif + #endif + + #ifdef YY_USE_PROTOS + void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) + #else + void yy_init_buffer( b, file ) + YY_BUFFER_STATE b; + FILE *file; + #endif + + + { + yy_flush_buffer( b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + #if YY_ALWAYS_INTERACTIVE + b->yy_is_interactive = 1; + #else + #if YY_NEVER_INTERACTIVE + b->yy_is_interactive = 0; + #else + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + #endif + #endif + } + + + #ifdef YY_USE_PROTOS + void yy_flush_buffer( YY_BUFFER_STATE b ) + #else + void yy_flush_buffer( b ) + YY_BUFFER_STATE b; + #endif + + { + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == yy_current_buffer ) + yy_load_buffer_state(); + } + + + #ifndef YY_NO_SCAN_BUFFER + #ifdef YY_USE_PROTOS + YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) + #else + YY_BUFFER_STATE yy_scan_buffer( base, size ) + char *base; + yy_size_t size; + #endif + { + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer( b ); + + return b; + } + #endif + + + #ifndef YY_NO_SCAN_STRING + #ifdef YY_USE_PROTOS + YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) + #else + YY_BUFFER_STATE yy_scan_string( yy_str ) + yyconst char *yy_str; + #endif + { + int len; + for ( len = 0; yy_str[len]; ++len ) + ; + + return yy_scan_bytes( yy_str, len ); + } + #endif + + + #ifndef YY_NO_SCAN_BYTES + #ifdef YY_USE_PROTOS + YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) + #else + YY_BUFFER_STATE yy_scan_bytes( bytes, len ) + yyconst char *bytes; + int len; + #endif + { + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = len + 2; + buf = (char *) yy_flex_alloc( n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < len; ++i ) + buf[i] = bytes[i]; + + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer( buf, n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; + } + #endif + + + #ifndef YY_NO_PUSH_STATE + #ifdef YY_USE_PROTOS + static void yy_push_state( int new_state ) + #else + static void yy_push_state( new_state ) + int new_state; + #endif + { + if ( yy_start_stack_ptr >= yy_start_stack_depth ) + { + yy_size_t new_size; + + yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yy_start_stack_depth * sizeof( int ); + + if ( ! yy_start_stack ) + yy_start_stack = (int *) yy_flex_alloc( new_size ); + + else + yy_start_stack = (int *) yy_flex_realloc( + (void *) yy_start_stack, new_size ); + + if ( ! yy_start_stack ) + YY_FATAL_ERROR( + "out of memory expanding start-condition stack" ); + } + + yy_start_stack[yy_start_stack_ptr++] = YY_START; + + BEGIN(new_state); + } + #endif + + + #ifndef YY_NO_POP_STATE + static void yy_pop_state() + { + if ( --yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); + + BEGIN(yy_start_stack[yy_start_stack_ptr]); + } + #endif + + + #ifndef YY_NO_TOP_STATE + static int yy_top_state() + { + return yy_start_stack[yy_start_stack_ptr - 1]; + } + #endif + + #ifndef YY_EXIT_FAILURE + #define YY_EXIT_FAILURE 2 + #endif + + #ifdef YY_USE_PROTOS + static void yy_fatal_error( yyconst char msg[] ) + #else + static void yy_fatal_error( msg ) + char msg[]; + #endif + { + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); + } + + + + /* Redefine yyless() so it works in section 3 code. */ + + #undef yyless + #define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + yytext[yyleng] = yy_hold_char; \ + yy_c_buf_p = yytext + n; \ + yy_hold_char = *yy_c_buf_p; \ + *yy_c_buf_p = '\0'; \ + yyleng = n; \ + } \ + while ( 0 ) + + + /* Internal utility routines. */ + + #ifndef yytext_ptr + #ifdef YY_USE_PROTOS + static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) + #else + static void yy_flex_strncpy( s1, s2, n ) + char *s1; + yyconst char *s2; + int n; + #endif + { + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; + } + #endif + + #ifdef YY_NEED_STRLEN + #ifdef YY_USE_PROTOS + static int yy_flex_strlen( yyconst char *s ) + #else + static int yy_flex_strlen( s ) + yyconst char *s; + #endif + { + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; + } + #endif + + + #ifdef YY_USE_PROTOS + static void *yy_flex_alloc( yy_size_t size ) + #else + static void *yy_flex_alloc( size ) + yy_size_t size; + #endif + { + return (void *) malloc( size ); + } + + #ifdef YY_USE_PROTOS + static inline void *yy_flex_realloc( void *ptr, yy_size_t size ) + #else + static inline void *yy_flex_realloc( ptr, size ) + void *ptr; + yy_size_t size; + #endif + { + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); + } + + #ifdef YY_USE_PROTOS + static void yy_flex_free( void *ptr ) + #else + static void yy_flex_free( ptr ) + void *ptr; + #endif + { + free( ptr ); + } + + #if YY_MAIN + int main() + { + yylex(); + return 0; + } + #endif + #line 355 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + Index: llvm/lib/AsmParser/Lexer.l.cvs diff -c /dev/null llvm/lib/AsmParser/Lexer.l.cvs:1.1 *** /dev/null Mon Feb 13 23:14:58 2006 --- llvm/lib/AsmParser/Lexer.l.cvs Mon Feb 13 23:14:46 2006 *************** *** 0 **** --- 1,355 ---- + /*===-- Lexer.l - Scanner for llvm assembly files --------------*- C++ -*--===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by the LLVM research group and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file implements the flex scanner for LLVM assembly languages files. + // + //===----------------------------------------------------------------------===*/ + + %option prefix="llvmAsm" + %option yylineno + %option nostdinit + %option never-interactive + %option batch + %option noyywrap + %option nodefault + %option 8bit + %option outfile="Lexer.cpp" + %option ecs + %option noreject + %option noyymore + + %{ + #include "ParserInternals.h" + #include "llvm/Module.h" + #include + #include "llvmAsmParser.h" + #include + #include + + void set_scan_file(FILE * F){ + yy_switch_to_buffer(yy_create_buffer( F, YY_BUF_SIZE ) ); + } + void set_scan_string (const char * str) { + yy_scan_string (str); + } + + #define RET_TOK(type, Enum, sym) \ + llvmAsmlval.type = Instruction::Enum; return sym + + namespace llvm { + + // TODO: All of the static identifiers are figured out by the lexer, + // these should be hashed to reduce the lexer size + + + // atoull - Convert an ascii string of decimal digits into the unsigned long + // long representation... this does not have to do input error checking, + // because we know that the input will be matched by a suitable regex... + // + static uint64_t atoull(const char *Buffer) { + uint64_t Result = 0; + for (; *Buffer; Buffer++) { + uint64_t OldRes = Result; + Result *= 10; + Result += *Buffer-'0'; + if (Result < OldRes) // Uh, oh, overflow detected!!! + ThrowException("constant bigger than 64 bits detected!"); + } + return Result; + } + + static uint64_t HexIntToVal(const char *Buffer) { + uint64_t Result = 0; + for (; *Buffer; ++Buffer) { + uint64_t OldRes = Result; + Result *= 16; + char C = *Buffer; + if (C >= '0' && C <= '9') + Result += C-'0'; + else if (C >= 'A' && C <= 'F') + Result += C-'A'+10; + else if (C >= 'a' && C <= 'f') + Result += C-'a'+10; + + if (Result < OldRes) // Uh, oh, overflow detected!!! + ThrowException("constant bigger than 64 bits detected!"); + } + return Result; + } + + + // HexToFP - Convert the ascii string in hexidecimal format to the floating + // point representation of it. + // + static double HexToFP(const char *Buffer) { + // Behave nicely in the face of C TBAA rules... see: + // http://www.nullstone.com/htmls/category/aliastyp.htm + union { + uint64_t UI; + double FP; + } UIntToFP; + UIntToFP.UI = HexIntToVal(Buffer); + + assert(sizeof(double) == sizeof(uint64_t) && + "Data sizes incompatible on this target!"); + return UIntToFP.FP; // Cast Hex constant to double + } + + + // UnEscapeLexed - Run through the specified buffer and change \xx codes to the + // appropriate character. If AllowNull is set to false, a \00 value will cause + // an exception to be thrown. + // + // If AllowNull is set to true, the return value of the function points to the + // last character of the string in memory. + // + char *UnEscapeLexed(char *Buffer, bool AllowNull) { + char *BOut = Buffer; + for (char *BIn = Buffer; *BIn; ) { + if (BIn[0] == '\\' && isxdigit(BIn[1]) && isxdigit(BIn[2])) { + char Tmp = BIn[3]; BIn[3] = 0; // Terminate string + *BOut = (char)strtol(BIn+1, 0, 16); // Convert to number + if (!AllowNull && !*BOut) + ThrowException("String literal cannot accept \\00 escape!"); + + BIn[3] = Tmp; // Restore character + BIn += 3; // Skip over handled chars + ++BOut; + } else { + *BOut++ = *BIn++; + } + } + + return BOut; + } + + } // End llvm namespace + + using namespace llvm; + + #define YY_NEVER_INTERACTIVE 1 + %} + + + + /* Comments start with a ; and go till end of line */ + Comment ;.* + + /* Variable(Value) identifiers start with a % sign */ + VarID %[-a-zA-Z$._][-a-zA-Z$._0-9]* + + /* Label identifiers end with a colon */ + Label [-a-zA-Z$._0-9]+: + QuoteLabel \"[^\"]+\": + + /* Quoted names can contain any character except " and \ */ + StringConstant \"[^\"]*\" + + + /* [PN]Integer: match positive and negative literal integer values that + * are preceeded by a '%' character. These represent unnamed variable slots. + */ + EPInteger %[0-9]+ + ENInteger %-[0-9]+ + + + /* E[PN]Integer: match positive and negative literal integer values */ + PInteger [0-9]+ + NInteger -[0-9]+ + + /* FPConstant - A Floating point constant. + */ + FPConstant [-+]?[0-9]+[.][0-9]*([eE][-+]?[0-9]+)? + + /* HexFPConstant - Floating point constant represented in IEEE format as a + * hexadecimal number for when exponential notation is not precise enough. + */ + HexFPConstant 0x[0-9A-Fa-f]+ + + /* HexIntConstant - Hexadecimal constant generated by the CFE to avoid forcing + * it to deal with 64 bit numbers. + */ + HexIntConstant [us]0x[0-9A-Fa-f]+ + %% + + {Comment} { /* Ignore comments for now */ } + + begin { return BEGINTOK; } + end { return ENDTOK; } + true { return TRUETOK; } + false { return FALSETOK; } + declare { return DECLARE; } + global { return GLOBAL; } + constant { return CONSTANT; } + internal { return INTERNAL; } + linkonce { return LINKONCE; } + weak { return WEAK; } + appending { return APPENDING; } + uninitialized { return EXTERNAL; } /* Deprecated, turn into external */ + external { return EXTERNAL; } + implementation { return IMPLEMENTATION; } + zeroinitializer { return ZEROINITIALIZER; } + \.\.\. { return DOTDOTDOT; } + undef { return UNDEF; } + null { return NULL_TOK; } + to { return TO; } + except { RET_TOK(TermOpVal, Unwind, UNWIND); } + not { return NOT; } /* Deprecated, turned into XOR */ + tail { return TAIL; } + target { return TARGET; } + triple { return TRIPLE; } + deplibs { return DEPLIBS; } + endian { return ENDIAN; } + pointersize { return POINTERSIZE; } + little { return LITTLE; } + big { return BIG; } + volatile { return VOLATILE; } + align { return ALIGN; } + section { return SECTION; } + module { return MODULE; } + asm { return ASM_TOK; } + sideeffect { return SIDEEFFECT; } + + cc { return CC_TOK; } + ccc { return CCC_TOK; } + fastcc { return FASTCC_TOK; } + coldcc { return COLDCC_TOK; } + + void { llvmAsmlval.PrimType = Type::VoidTy ; return VOID; } + bool { llvmAsmlval.PrimType = Type::BoolTy ; return BOOL; } + sbyte { llvmAsmlval.PrimType = Type::SByteTy ; return SBYTE; } + ubyte { llvmAsmlval.PrimType = Type::UByteTy ; return UBYTE; } + short { llvmAsmlval.PrimType = Type::ShortTy ; return SHORT; } + ushort { llvmAsmlval.PrimType = Type::UShortTy; return USHORT; } + int { llvmAsmlval.PrimType = Type::IntTy ; return INT; } + uint { llvmAsmlval.PrimType = Type::UIntTy ; return UINT; } + long { llvmAsmlval.PrimType = Type::LongTy ; return LONG; } + ulong { llvmAsmlval.PrimType = Type::ULongTy ; return ULONG; } + float { llvmAsmlval.PrimType = Type::FloatTy ; return FLOAT; } + double { llvmAsmlval.PrimType = Type::DoubleTy; return DOUBLE; } + label { llvmAsmlval.PrimType = Type::LabelTy ; return LABEL; } + type { return TYPE; } + opaque { return OPAQUE; } + + add { RET_TOK(BinaryOpVal, Add, ADD); } + sub { RET_TOK(BinaryOpVal, Sub, SUB); } + mul { RET_TOK(BinaryOpVal, Mul, MUL); } + div { RET_TOK(BinaryOpVal, Div, DIV); } + rem { RET_TOK(BinaryOpVal, Rem, REM); } + and { RET_TOK(BinaryOpVal, And, AND); } + or { RET_TOK(BinaryOpVal, Or , OR ); } + xor { RET_TOK(BinaryOpVal, Xor, XOR); } + setne { RET_TOK(BinaryOpVal, SetNE, SETNE); } + seteq { RET_TOK(BinaryOpVal, SetEQ, SETEQ); } + setlt { RET_TOK(BinaryOpVal, SetLT, SETLT); } + setgt { RET_TOK(BinaryOpVal, SetGT, SETGT); } + setle { RET_TOK(BinaryOpVal, SetLE, SETLE); } + setge { RET_TOK(BinaryOpVal, SetGE, SETGE); } + + phi { RET_TOK(OtherOpVal, PHI, PHI_TOK); } + call { RET_TOK(OtherOpVal, Call, CALL); } + cast { RET_TOK(OtherOpVal, Cast, CAST); } + select { RET_TOK(OtherOpVal, Select, SELECT); } + shl { RET_TOK(OtherOpVal, Shl, SHL); } + shr { RET_TOK(OtherOpVal, Shr, SHR); } + vanext { return VANEXT_old; } + vaarg { return VAARG_old; } + va_arg { RET_TOK(OtherOpVal, VAArg , VAARG); } + ret { RET_TOK(TermOpVal, Ret, RET); } + br { RET_TOK(TermOpVal, Br, BR); } + switch { RET_TOK(TermOpVal, Switch, SWITCH); } + invoke { RET_TOK(TermOpVal, Invoke, INVOKE); } + unwind { RET_TOK(TermOpVal, Unwind, UNWIND); } + unreachable { RET_TOK(TermOpVal, Unreachable, UNREACHABLE); } + + malloc { RET_TOK(MemOpVal, Malloc, MALLOC); } + alloca { RET_TOK(MemOpVal, Alloca, ALLOCA); } + free { RET_TOK(MemOpVal, Free, FREE); } + load { RET_TOK(MemOpVal, Load, LOAD); } + store { RET_TOK(MemOpVal, Store, STORE); } + getelementptr { RET_TOK(MemOpVal, GetElementPtr, GETELEMENTPTR); } + + extractelement { RET_TOK(OtherOpVal, ExtractElement, EXTRACTELEMENT); } + insertelement { RET_TOK(OtherOpVal, InsertElement, INSERTELEMENT); } + + + {VarID} { + UnEscapeLexed(yytext+1); + llvmAsmlval.StrVal = strdup(yytext+1); // Skip % + return VAR_ID; + } + {Label} { + yytext[strlen(yytext)-1] = 0; // nuke colon + UnEscapeLexed(yytext); + llvmAsmlval.StrVal = strdup(yytext); + return LABELSTR; + } + {QuoteLabel} { + yytext[strlen(yytext)-2] = 0; // nuke colon, end quote + UnEscapeLexed(yytext+1); + llvmAsmlval.StrVal = strdup(yytext+1); + return LABELSTR; + } + + {StringConstant} { // Note that we cannot unescape a string constant here! The + // string constant might contain a \00 which would not be + // understood by the string stuff. It is valid to make a + // [sbyte] c"Hello World\00" constant, for example. + // + yytext[strlen(yytext)-1] = 0; // nuke end quote + llvmAsmlval.StrVal = strdup(yytext+1); // Nuke start quote + return STRINGCONSTANT; + } + + + {PInteger} { llvmAsmlval.UInt64Val = atoull(yytext); return EUINT64VAL; } + {NInteger} { + uint64_t Val = atoull(yytext+1); + // +1: we have bigger negative range + if (Val > (uint64_t)INT64_MAX+1) + ThrowException("Constant too large for signed 64 bits!"); + llvmAsmlval.SInt64Val = -Val; + return ESINT64VAL; + } + {HexIntConstant} { + llvmAsmlval.UInt64Val = HexIntToVal(yytext+3); + return yytext[0] == 's' ? ESINT64VAL : EUINT64VAL; + } + + {EPInteger} { + uint64_t Val = atoull(yytext+1); + if ((unsigned)Val != Val) + ThrowException("Invalid value number (too large)!"); + llvmAsmlval.UIntVal = unsigned(Val); + return UINTVAL; + } + {ENInteger} { + uint64_t Val = atoull(yytext+2); + // +1: we have bigger negative range + if (Val > (uint64_t)INT32_MAX+1) + ThrowException("Constant too large for signed 32 bits!"); + llvmAsmlval.SIntVal = (int)-Val; + return SINTVAL; + } + + {FPConstant} { llvmAsmlval.FPVal = atof(yytext); return FPVAL; } + {HexFPConstant} { llvmAsmlval.FPVal = HexToFP(yytext); return FPVAL; } + + <> { + /* Make sure to free the internal buffers for flex when we are + * done reading our input! + */ + yy_delete_buffer(YY_CURRENT_BUFFER); + return EOF; + } + + [ \r\t\n] { /* Ignore whitespace */ } + . { return yytext[0]; } + + %% From lattner at cs.uiuc.edu Mon Feb 13 23:16:46 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 13 Feb 2006 23:16:46 -0600 Subject: [llvm-commits] CVS: llvm/tools/llvmc/ConfigLexer.cpp.cvs ConfigLexer.l.cvs ConfigLexer.cpp Message-ID: <200602140516.XAA19944@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvmc: ConfigLexer.cpp.cvs added (r1.1) ConfigLexer.l.cvs added (r1.1) ConfigLexer.cpp (r1.1) removed --- Log message: Adjust to new style "generated files in CVS" mechanism for lex output --- Diffs of the changes: (+2921 -0) ConfigLexer.cpp.cvs | 2720 ++++++++++++++++++++++++++++++++++++++++++++++++++++ ConfigLexer.l.cvs | 201 +++ 2 files changed, 2921 insertions(+) Index: llvm/tools/llvmc/ConfigLexer.cpp.cvs diff -c /dev/null llvm/tools/llvmc/ConfigLexer.cpp.cvs:1.1 *** /dev/null Mon Feb 13 23:16:45 2006 --- llvm/tools/llvmc/ConfigLexer.cpp.cvs Mon Feb 13 23:16:35 2006 *************** *** 0 **** --- 1,2720 ---- + #define yy_create_buffer Config_create_buffer + #define yy_delete_buffer Config_delete_buffer + #define yy_scan_buffer Config_scan_buffer + #define yy_scan_string Config_scan_string + #define yy_scan_bytes Config_scan_bytes + #define yy_flex_debug Config_flex_debug + #define yy_init_buffer Config_init_buffer + #define yy_flush_buffer Config_flush_buffer + #define yy_load_buffer_state Config_load_buffer_state + #define yy_switch_to_buffer Config_switch_to_buffer + #define yyin Configin + #define yyleng Configleng + #define yylex Configlex + #define yyout Configout + #define yyrestart Configrestart + #define yytext Configtext + + #line 19 "ConfigLexer.cpp" + /* A lexical scanner generated by flex */ + + /* Scanner skeleton version: + * $Header: /home/vadve/shared/PublicCVS/llvm/tools/llvmc/ConfigLexer.cpp.cvs,v 1.1 2006/02/14 05:16:35 lattner Exp $ + */ + + #define FLEX_SCANNER + #define YY_FLEX_MAJOR_VERSION 2 + #define YY_FLEX_MINOR_VERSION 5 + + #include + #include + + + /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ + #ifdef c_plusplus + #ifndef __cplusplus + #define __cplusplus + #endif + #endif + + + #ifdef __cplusplus + + #include + + /* Use prototypes in function declarations. */ + #define YY_USE_PROTOS + + /* The "const" storage-class-modifier is valid. */ + #define YY_USE_CONST + + #else /* ! __cplusplus */ + + #if __STDC__ + + #define YY_USE_PROTOS + #define YY_USE_CONST + + #endif /* __STDC__ */ + #endif /* ! __cplusplus */ + + #ifdef __TURBOC__ + #pragma warn -rch + #pragma warn -use + #include + #include + #define YY_USE_CONST + #define YY_USE_PROTOS + #endif + + #ifdef YY_USE_CONST + #define yyconst const + #else + #define yyconst + #endif + + + #ifdef YY_USE_PROTOS + #define YY_PROTO(proto) proto + #else + #define YY_PROTO(proto) () + #endif + + /* Returned upon end-of-file. */ + #define YY_NULL 0 + + /* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ + #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + + /* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ + #define BEGIN yy_start = 1 + 2 * + + /* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ + #define YY_START ((yy_start - 1) / 2) + #define YYSTATE YY_START + + /* Action number for EOF rule of a given start state. */ + #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + + /* Special action meaning "start processing a new file". */ + #define YY_NEW_FILE yyrestart( yyin ) + + #define YY_END_OF_BUFFER_CHAR 0 + + /* Size of default input buffer. */ + #define YY_BUF_SIZE (16384*64) + + typedef struct yy_buffer_state *YY_BUFFER_STATE; + + extern int yyleng; + extern FILE *yyin, *yyout; + + #define EOB_ACT_CONTINUE_SCAN 0 + #define EOB_ACT_END_OF_FILE 1 + #define EOB_ACT_LAST_MATCH 2 + + /* The funky do-while in the following #define is used to turn the definition + * int a single C statement (which needs a semi-colon terminator). This + * avoids problems with code like: + * + * if ( condition_holds ) + * yyless( 5 ); + * else + * do_something_else(); + * + * Prior to using the do-while the compiler would get upset at the + * "else" because it interpreted the "if" statement as being all + * done when it reached the ';' after the yyless() call. + */ + + /* Return all but the first 'n' matched characters back to the input stream. */ + + #define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + *yy_cp = yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ + yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + + #define unput(c) yyunput( c, yytext_ptr ) + + /* The following is because we cannot portably get our hands on size_t + * (without autoconf's help, which isn't available because we want + * flex-generated scanners to compile on their own). + */ + typedef unsigned int yy_size_t; + + + struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + #define YY_BUFFER_NEW 0 + #define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ + #define YY_BUFFER_EOF_PENDING 2 + }; + + static YY_BUFFER_STATE yy_current_buffer = 0; + + /* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + */ + #define YY_CURRENT_BUFFER yy_current_buffer + + + /* yy_hold_char holds the character lost when yytext is formed. */ + static char yy_hold_char; + + static int yy_n_chars; /* number of characters read into yy_ch_buf */ + + + int yyleng; + + /* Points to current character in buffer. */ + static char *yy_c_buf_p = (char *) 0; + static int yy_init = 1; /* whether we need to initialize */ + static int yy_start = 0; /* start state number */ + + /* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ + static int yy_did_buffer_switch_on_eof; + + void yyrestart YY_PROTO(( FILE *input_file )); + + void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); + void yy_load_buffer_state YY_PROTO(( void )); + YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); + void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); + void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); + void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); + #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) + + YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); + YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); + YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); + + static void *yy_flex_alloc YY_PROTO(( yy_size_t )); + static inline void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); + static void yy_flex_free YY_PROTO(( void * )); + + #define yy_new_buffer yy_create_buffer + + #define yy_set_interactive(is_interactive) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_is_interactive = is_interactive; \ + } + + #define yy_set_bol(at_bol) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_at_bol = at_bol; \ + } + + #define YY_AT_BOL() (yy_current_buffer->yy_at_bol) + + + #define yywrap() 1 + #define YY_SKIP_YYWRAP + typedef unsigned char YY_CHAR; + FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; + typedef int yy_state_type; + extern char *yytext; + #define yytext_ptr yytext + + static yy_state_type yy_get_previous_state YY_PROTO(( void )); + static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); + static int yy_get_next_buffer YY_PROTO(( void )); + static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); + + /* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ + #define YY_DO_BEFORE_ACTION \ + yytext_ptr = yy_bp; \ + yyleng = (int) (yy_cp - yy_bp); \ + yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yy_c_buf_p = yy_cp; + + #define YY_NUM_RULES 55 + #define YY_END_OF_BUFFER 56 + static yyconst short int yy_accept[411] = + { 0, + 1, 1, 56, 55, 1, 4, 55, 55, 55, 52, + 52, 6, 5, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 1, 4, + 0, 53, 0, 2, 0, 54, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 49, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 51, 52, 52, 50, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 3, 0, 52, 52, 52, 52, 52, + + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 48, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 29, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 8, 9, 52, 52, 10, + + 11, 12, 13, 14, 15, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 39, 40, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 26, 52, 28, 52, + 52, 52, 32, 52, 52, 52, 52, 43, 52, 52, + 52, 52, 52, 52, 52, 25, 52, 21, 52, 52, + + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 46, 47, 52, 45, 30, + 52, 52, 52, 52, 41, 52, 52, 52, 52, 52, + 52, 17, 52, 52, 52, 52, 52, 52, 52, 52, + 7, 52, 52, 52, 52, 52, 52, 27, 31, 52, + 52, 52, 42, 52, 52, 52, 52, 52, 52, 52, + 18, 52, 52, 52, 52, 52, 52, 37, 52, 35, + 52, 52, 36, 44, 24, 22, 52, 52, 52, 52, + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, + 23, 19, 52, 52, 52, 52, 52, 52, 52, 52, + + 52, 52, 52, 52, 33, 20, 16, 38, 34, 0 + } ; + + static yyconst int yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 1, 5, 6, 1, 7, 1, 1, 1, + 1, 1, 8, 8, 8, 9, 8, 8, 10, 11, + 12, 13, 14, 8, 8, 8, 8, 8, 1, 1, + 15, 1, 1, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 24, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 24, 39, 40, + 1, 41, 1, 1, 8, 1, 42, 43, 44, 45, + + 46, 47, 48, 49, 50, 24, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 24, 63, + 64, 65, 1, 8, 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, 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 + } ; + + static yyconst int yy_meta[66] = + { 0, + 1, 1, 1, 1, 1, 1, 2, 3, 1, 3, + 3, 3, 3, 3, 1, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3 + } ; + + static yyconst short int yy_base[415] = + { 0, + 0, 0, 728, 3250, 725, 3250, 723, 719, 63, 61, + 0, 3250, 3250, 36, 61, 46, 65, 67, 80, 83, + 57, 72, 91, 105, 106, 75, 659, 84, 659, 671, + 41, 39, 82, 654, 665, 651, 662, 661, 704, 3250, + 700, 3250, 82, 3250, 701, 3250, 0, 146, 181, 216, + 251, 303, 347, 387, 422, 470, 516, 571, 625, 669, + 106, 644, 0, 667, 641, 672, 646, 671, 645, 667, + 69, 641, 88, 666, 0, 640, 670, 0, 656, 655, + 642, 628, 627, 665, 638, 646, 617, 128, 104, 640, + 614, 637, 611, 3250, 666, 88, 608, 612, 612, 609, + + 107, 609, 614, 600, 599, 612, 600, 113, 598, 596, + 709, 759, 809, 851, 899, 940, 990, 1028, 1065, 1121, + 1175, 1229, 1265, 1317, 1364, 0, 633, 607, 631, 605, + 622, 596, 614, 588, 623, 611, 618, 595, 583, 589, + 613, 584, 156, 598, 165, 572, 596, 595, 589, 563, + 594, 601, 567, 574, 585, 559, 571, 570, 562, 555, + 565, 552, 559, 563, 188, 552, 551, 545, 551, 558, + 544, 1416, 1470, 1524, 1577, 1616, 1669, 3250, 1723, 1769, + 1822, 196, 237, 1869, 1923, 1965, 2005, 574, 548, 581, + 555, 581, 555, 575, 549, 0, 0, 573, 546, 0, + + 0, 0, 0, 0, 0, 563, 554, 536, 527, 553, + 518, 550, 524, 539, 512, 545, 519, 508, 514, 514, + 508, 502, 492, 483, 483, 485, 466, 469, 2042, 2095, + 261, 2148, 277, 2192, 2245, 2298, 287, 2342, 3250, 3250, + 2384, 2437, 323, 2477, 499, 465, 477, 450, 470, 435, + 446, 417, 449, 437, 421, 409, 429, 398, 417, 389, + 414, 385, 401, 372, 383, 370, 369, 356, 363, 351, + 355, 351, 356, 352, 335, 361, 3250, 2526, 3250, 371, + 408, 2578, 3250, 2630, 2668, 432, 2725, 3250, 2779, 379, + 353, 384, 351, 372, 346, 0, 350, 0, 324, 367, + + 336, 349, 321, 349, 323, 333, 302, 300, 305, 296, + 275, 294, 286, 287, 273, 3250, 3250, 444, 3250, 3250, + 454, 480, 2832, 2870, 3250, 490, 2927, 151, 150, 305, + 279, 0, 303, 277, 301, 275, 300, 267, 273, 247, + 0, 167, 260, 258, 240, 238, 222, 3250, 3250, 126, + 2967, 502, 3250, 526, 248, 222, 243, 208, 226, 197, + 0, 150, 170, 197, 196, 193, 187, 3250, 189, 3250, + 3006, 3058, 3250, 3250, 0, 0, 206, 180, 202, 202, + 162, 162, 160, 159, 159, 144, 3102, 3140, 213, 224, + 0, 0, 250, 127, 3192, 539, 151, 151, 124, 115, + + 104, 74, 89, 552, 3250, 0, 0, 3250, 3250, 3250, + 3241, 3244, 3246, 85 + } ; + + static yyconst short int yy_def[415] = + { 0, + 410, 1, 410, 410, 410, 410, 410, 411, 412, 413, + 414, 410, 410, 414, 414, 414, 414, 414, 414, 414, + 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, + 414, 414, 414, 414, 414, 414, 414, 414, 410, 410, + 411, 410, 412, 410, 410, 410, 414, 413, 413, 413, + 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, + 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, + 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, + 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, + 414, 414, 414, 410, 410, 414, 414, 414, 414, 414, + + 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, + 413, 413, 413, 413, 413, 413, 413, 413, 413, 413, + 413, 413, 413, 413, 413, 414, 414, 414, 414, 414, + 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, + 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, + 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, + 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, + 414, 413, 413, 413, 413, 413, 413, 410, 413, 413, + 413, 413, 413, 413, 413, 413, 413, 414, 414, 414, + 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, + + 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, + 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, + 414, 414, 414, 414, 414, 414, 414, 414, 413, 413, + 413, 413, 413, 413, 413, 413, 413, 413, 410, 410, + 413, 413, 413, 413, 414, 414, 414, 414, 414, 414, + 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, + 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, + 414, 414, 414, 414, 413, 413, 410, 413, 410, 413, + 413, 413, 410, 413, 413, 413, 413, 410, 413, 414, + 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, + + 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, + 414, 414, 414, 414, 414, 410, 410, 413, 410, 410, + 413, 413, 413, 413, 410, 413, 413, 414, 414, 414, + 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, + 414, 414, 414, 414, 414, 414, 414, 410, 410, 414, + 413, 413, 410, 413, 414, 414, 414, 414, 414, 414, + 414, 414, 414, 414, 414, 414, 414, 410, 414, 410, + 413, 413, 410, 410, 414, 414, 414, 414, 414, 414, + 414, 414, 414, 414, 414, 414, 413, 413, 414, 414, + 414, 414, 414, 414, 413, 413, 414, 414, 414, 414, + + 414, 414, 414, 413, 410, 414, 414, 410, 410, 0, + 410, 410, 410, 410 + } ; + + static yyconst short int yy_nxt[3316] = + { 0, + 4, 5, 6, 7, 8, 9, 10, 11, 12, 11, + 11, 11, 11, 11, 13, 4, 14, 15, 16, 11, + 11, 17, 11, 11, 11, 11, 18, 11, 19, 20, + 21, 11, 22, 11, 23, 11, 24, 11, 25, 11, + 26, 27, 28, 29, 11, 11, 30, 11, 11, 11, + 11, 31, 11, 32, 33, 34, 11, 35, 11, 36, + 11, 37, 11, 38, 11, 44, 45, 46, 47, 61, + 47, 47, 47, 47, 47, 66, 47, 94, 95, 63, + 102, 68, 100, 70, 44, 45, 136, 47, 49, 84, + 101, 71, 86, 75, 62, 408, 74, 137, 50, 64, + + 67, 47, 51, 52, 77, 53, 69, 54, 72, 75, + 55, 78, 56, 79, 85, 57, 73, 87, 80, 58, + 59, 76, 60, 88, 65, 90, 92, 63, 103, 81, + 139, 407, 368, 126, 75, 78, 78, 104, 82, 127, + 126, 140, 105, 83, 151, 153, 157, 97, 89, 162, + 91, 93, 46, 47, 169, 47, 47, 47, 47, 47, + 163, 47, 406, 152, 154, 201, 202, 203, 204, 205, + 379, 355, 407, 170, 201, 202, 203, 204, 205, 380, + 206, 369, 406, 407, 406, 403, 47, 46, 47, 126, + 47, 47, 47, 47, 47, 356, 47, 201, 202, 203, + + 204, 205, 239, 47, 394, 47, 47, 47, 47, 47, + 111, 47, 364, 126, 208, 381, 392, 391, 393, 392, + 391, 47, 46, 47, 382, 47, 47, 47, 47, 47, + 126, 47, 384, 397, 392, 391, 47, 223, 390, 389, + 386, 385, 398, 240, 47, 112, 47, 47, 47, 47, + 47, 383, 47, 376, 375, 378, 47, 46, 47, 377, + 47, 47, 47, 47, 47, 376, 47, 277, 47, 399, + 47, 47, 47, 47, 47, 376, 47, 47, 400, 375, + 375, 367, 361, 279, 47, 366, 47, 47, 47, 47, + 47, 47, 47, 283, 47, 401, 47, 47, 47, 47, + + 47, 47, 47, 365, 402, 63, 363, 362, 113, 46, + 47, 361, 47, 47, 47, 47, 47, 47, 47, 361, + 360, 359, 358, 357, 63, 63, 341, 47, 347, 288, + 47, 346, 47, 47, 47, 47, 47, 345, 47, 344, + 332, 316, 47, 47, 47, 47, 47, 47, 47, 343, + 47, 342, 114, 46, 47, 341, 47, 47, 47, 47, + 47, 341, 47, 47, 340, 339, 338, 317, 47, 337, + 47, 47, 47, 47, 47, 47, 47, 319, 47, 336, + 47, 47, 47, 47, 47, 335, 47, 47, 334, 333, + 332, 332, 115, 46, 47, 331, 47, 47, 47, 47, + + 47, 47, 47, 330, 329, 328, 315, 314, 313, 312, + 298, 47, 311, 296, 320, 47, 116, 47, 47, 47, + 47, 47, 310, 47, 309, 308, 307, 47, 46, 47, + 306, 47, 47, 47, 47, 47, 305, 47, 325, 47, + 304, 47, 47, 47, 47, 47, 303, 47, 47, 302, + 348, 47, 301, 47, 47, 47, 47, 47, 300, 47, + 349, 47, 47, 47, 47, 47, 47, 47, 298, 47, + 299, 298, 47, 297, 296, 117, 46, 47, 296, 47, + 47, 47, 47, 47, 47, 47, 46, 47, 295, 350, + 47, 47, 47, 47, 47, 47, 353, 47, 294, 47, + + 47, 47, 47, 47, 293, 47, 292, 291, 373, 47, + 47, 47, 47, 47, 47, 47, 290, 47, 274, 118, + 47, 119, 46, 47, 273, 47, 47, 47, 47, 47, + 47, 47, 374, 47, 272, 47, 47, 47, 47, 47, + 271, 47, 47, 270, 269, 405, 47, 268, 47, 47, + 47, 47, 47, 75, 47, 267, 47, 266, 409, 47, + 265, 47, 47, 47, 47, 47, 47, 47, 264, 263, + 262, 120, 261, 260, 259, 258, 121, 46, 47, 47, + 47, 47, 47, 47, 47, 257, 47, 256, 255, 254, + 253, 252, 47, 251, 75, 75, 250, 249, 248, 247, + + 246, 245, 228, 78, 227, 226, 225, 224, 200, 222, + 197, 47, 196, 221, 220, 219, 218, 217, 216, 78, + 215, 78, 214, 213, 212, 211, 210, 209, 207, 200, + 122, 46, 47, 200, 47, 47, 47, 47, 47, 199, + 47, 197, 196, 198, 197, 196, 195, 194, 193, 192, + 191, 190, 189, 188, 78, 171, 168, 167, 166, 165, + 75, 164, 161, 160, 159, 47, 123, 158, 94, 78, + 78, 156, 155, 150, 124, 46, 47, 149, 47, 47, + 47, 47, 47, 148, 47, 147, 146, 145, 75, 144, + 143, 75, 142, 141, 138, 135, 134, 133, 132, 131, + + 130, 129, 128, 44, 42, 39, 110, 109, 108, 47, + 107, 106, 99, 98, 125, 46, 47, 96, 47, 47, + 47, 47, 47, 42, 47, 40, 39, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 47, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 172, 46, 47, 410, 47, 47, + 47, 47, 47, 410, 47, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 47, + + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 173, 46, 47, 410, 47, 47, + 47, 47, 47, 410, 47, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 47, + 410, 410, 410, 410, 410, 410, 174, 46, 47, 410, + 47, 47, 47, 47, 47, 410, 47, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 47, 410, 410, 410, 410, 410, 410, 410, 410, + + 410, 410, 410, 410, 175, 46, 47, 410, 47, 47, + 47, 47, 47, 410, 47, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 47, + 410, 410, 410, 410, 410, 176, 46, 47, 410, 47, + 47, 47, 47, 47, 410, 47, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 47, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 177, 178, 47, 410, 47, + + 47, 47, 47, 47, 410, 47, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 47, 410, 410, 179, 46, 47, 410, 47, 47, 47, + 47, 47, 410, 47, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 47, 410, + 180, 46, 47, 410, 47, 47, 47, 47, 47, 410, + 47, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + + 410, 410, 410, 410, 410, 47, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 181, 46, 47, 410, + 47, 47, 47, 47, 47, 410, 47, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 47, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 182, 46, 47, 410, 47, 47, 47, 47, 47, 410, + 47, 410, 410, 410, 410, 410, 410, 410, 410, 410, + + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 47, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 183, 46, 47, 410, 47, 47, + 47, 47, 47, 410, 47, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 47, + 184, 46, 47, 410, 47, 47, 47, 47, 47, 410, + 47, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + + 410, 410, 410, 410, 410, 47, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 185, 46, 47, 410, 47, 47, 47, 47, + 47, 410, 47, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 47, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 186, + 46, 47, 410, 47, 47, 47, 47, 47, 410, 47, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + + 410, 410, 410, 410, 47, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 187, 46, 47, 410, 47, 47, 47, 47, 47, + 410, 47, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 47, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 229, 46, 47, 410, 47, + 47, 47, 47, 47, 410, 47, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 47, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 230, + 46, 47, 410, 47, 47, 47, 47, 47, 410, 47, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 47, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 231, 46, 47, 410, 47, 47, 47, 47, + 47, 410, 47, 410, 410, 410, 410, 410, 410, 410, + + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 47, 410, 410, + 410, 232, 46, 47, 410, 47, 47, 47, 47, 47, + 410, 47, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 47, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 233, 46, 47, 410, 47, 47, + 47, 47, 47, 410, 47, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + + 410, 410, 410, 410, 410, 410, 410, 410, 410, 47, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 234, 46, + 47, 410, 47, 47, 47, 47, 47, 410, 47, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 47, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 235, 46, 47, 410, 47, 47, + 47, 47, 47, 410, 47, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + + 410, 410, 410, 410, 410, 410, 410, 410, 410, 47, + 410, 410, 410, 236, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 237, 46, 47, + 410, 47, 47, 47, 47, 47, 410, 47, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 47, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 238, 46, 47, 410, 47, 47, + 47, 47, 47, 410, 47, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + + 410, 410, 410, 410, 410, 410, 410, 410, 410, 47, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 241, 46, + 47, 410, 47, 47, 47, 47, 47, 410, 47, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 47, 410, 410, 410, 410, 410, 410, + 242, 46, 47, 410, 47, 47, 47, 47, 47, 410, + 47, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + + 410, 410, 410, 410, 410, 47, 410, 410, 410, 410, + 243, 46, 47, 410, 47, 47, 47, 47, 47, 410, + 47, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 47, 410, 244, 46, 47, + 410, 47, 47, 47, 47, 47, 410, 47, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 47, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + + 275, 46, 47, 410, 47, 47, 47, 47, 47, 410, + 47, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 47, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 276, 46, 47, 410, 47, 47, 47, + 47, 47, 410, 47, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 47, 410, + 410, 410, 410, 410, 410, 410, 410, 278, 46, 47, + + 410, 47, 47, 47, 47, 47, 410, 47, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 47, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 280, 46, 47, 410, 47, 47, 47, 47, 47, 410, + 47, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 47, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + + 410, 410, 410, 281, 46, 47, 410, 47, 47, 47, + 47, 47, 410, 47, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 47, 410, + 410, 410, 410, 410, 410, 410, 410, 282, 46, 47, + 410, 47, 47, 47, 47, 47, 410, 47, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 47, 410, 410, 284, 410, 410, 410, 285, + 46, 47, 410, 47, 47, 47, 47, 47, 410, 47, + + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 47, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 286, 46, 47, 410, 47, 47, 47, 47, + 47, 410, 47, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 47, 410, 410, + 410, 410, 287, 46, 47, 410, 47, 47, 47, 47, + 47, 410, 47, 410, 410, 410, 410, 410, 410, 410, + + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 47, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 289, 46, 47, 410, 47, 47, 47, 47, 47, + 410, 47, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 47, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 318, 46, 47, 410, 47, 47, 47, + 47, 47, 410, 47, 410, 410, 410, 410, 410, 410, + + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 47, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 321, 46, 47, 410, 47, + 47, 47, 47, 47, 410, 47, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 47, 410, 410, 322, 46, 47, 410, 47, 47, 47, + 47, 47, 410, 47, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + + 410, 410, 410, 410, 410, 410, 410, 410, 47, 410, + 410, 323, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 324, 46, 47, 410, 47, 47, 47, 47, 47, 410, + 47, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 47, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 326, 46, 47, 410, 47, 47, + 47, 47, 47, 410, 47, 410, 410, 410, 410, 410, + + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 47, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 327, 46, 47, + 410, 47, 47, 47, 47, 47, 410, 47, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 47, 410, 410, 351, 46, 47, 410, 47, + 47, 47, 47, 47, 410, 47, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 47, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 352, 46, 47, 410, 47, 47, 47, 47, + 47, 410, 47, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 47, 410, 410, + 410, 410, 354, 370, 47, 410, 47, 47, 47, 47, + 47, 410, 47, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + + 410, 410, 410, 410, 410, 410, 410, 47, 371, 410, + 410, 372, 46, 47, 410, 47, 47, 47, 47, 47, + 410, 47, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 47, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 387, 46, 47, 410, 47, 47, 47, + 47, 47, 410, 47, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 47, 410, + + 410, 410, 410, 410, 410, 410, 410, 388, 46, 47, + 410, 47, 47, 47, 47, 47, 410, 47, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 47, 410, 410, 395, 46, 47, 410, 47, + 47, 47, 47, 47, 410, 47, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 47, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 396, 46, 47, + + 410, 47, 47, 47, 47, 47, 410, 47, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 47, 410, 410, 410, 410, 410, 410, 410, + 404, 41, 41, 41, 43, 43, 43, 48, 48, 3, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410 + } ; + + static yyconst short int yy_chk[3316] = + { 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, 9, 9, 10, 10, 14, + 10, 10, 10, 10, 10, 16, 10, 26, 26, 15, + 32, 17, 31, 18, 43, 43, 71, 414, 10, 21, + 31, 18, 22, 32, 14, 403, 19, 71, 10, 15, + + 16, 10, 10, 10, 20, 10, 17, 10, 18, 19, + 10, 20, 10, 20, 21, 10, 18, 22, 20, 10, + 10, 19, 10, 23, 15, 24, 25, 28, 33, 20, + 73, 402, 350, 61, 19, 33, 20, 33, 20, 61, + 96, 73, 33, 20, 88, 89, 96, 28, 23, 101, + 24, 25, 48, 48, 108, 48, 48, 48, 48, 48, + 101, 48, 401, 88, 89, 143, 143, 143, 143, 143, + 362, 328, 400, 108, 145, 145, 145, 145, 145, 362, + 143, 350, 399, 398, 397, 394, 48, 49, 49, 328, + 49, 49, 49, 49, 49, 329, 49, 165, 165, 165, + + 165, 165, 182, 182, 386, 182, 182, 182, 182, 182, + 49, 182, 342, 329, 145, 363, 385, 384, 383, 382, + 381, 49, 50, 50, 363, 50, 50, 50, 50, 50, + 342, 50, 367, 389, 380, 379, 182, 165, 378, 377, + 369, 367, 389, 183, 183, 50, 183, 183, 183, 183, + 183, 366, 183, 365, 364, 360, 50, 51, 51, 359, + 51, 51, 51, 51, 51, 358, 51, 231, 231, 390, + 231, 231, 231, 231, 231, 357, 231, 183, 390, 356, + 355, 347, 346, 233, 233, 345, 233, 233, 233, 233, + 233, 51, 233, 237, 237, 393, 237, 237, 237, 237, + + 237, 231, 237, 344, 393, 343, 340, 339, 51, 52, + 52, 338, 52, 52, 52, 52, 52, 233, 52, 337, + 336, 335, 334, 333, 331, 330, 315, 237, 314, 243, + 243, 313, 243, 243, 243, 243, 243, 312, 243, 311, + 310, 275, 275, 52, 275, 275, 275, 275, 275, 309, + 275, 308, 52, 53, 53, 307, 53, 53, 53, 53, + 53, 306, 53, 243, 305, 304, 303, 276, 276, 302, + 276, 276, 276, 276, 276, 275, 276, 280, 280, 301, + 280, 280, 280, 280, 280, 300, 280, 53, 299, 297, + 295, 294, 53, 54, 54, 293, 54, 54, 54, 54, + + 54, 276, 54, 292, 291, 290, 274, 273, 272, 271, + 270, 280, 269, 268, 281, 281, 54, 281, 281, 281, + 281, 281, 267, 281, 266, 265, 264, 54, 55, 55, + 263, 55, 55, 55, 55, 55, 262, 55, 286, 286, + 261, 286, 286, 286, 286, 286, 260, 286, 281, 259, + 318, 318, 258, 318, 318, 318, 318, 318, 257, 318, + 321, 321, 55, 321, 321, 321, 321, 321, 256, 321, + 255, 254, 286, 253, 252, 55, 56, 56, 251, 56, + 56, 56, 56, 56, 318, 56, 322, 322, 250, 322, + 322, 322, 322, 322, 321, 322, 326, 326, 249, 326, + + 326, 326, 326, 326, 248, 326, 247, 246, 352, 352, + 56, 352, 352, 352, 352, 352, 245, 352, 228, 56, + 322, 56, 57, 57, 227, 57, 57, 57, 57, 57, + 326, 57, 354, 354, 226, 354, 354, 354, 354, 354, + 225, 354, 352, 224, 223, 396, 396, 222, 396, 396, + 396, 396, 396, 221, 396, 220, 57, 219, 404, 404, + 218, 404, 404, 404, 404, 404, 354, 404, 217, 216, + 215, 57, 214, 213, 212, 211, 57, 58, 58, 396, + 58, 58, 58, 58, 58, 210, 58, 209, 208, 207, + 206, 199, 404, 198, 195, 194, 193, 192, 191, 190, + + 189, 188, 171, 170, 169, 168, 167, 166, 164, 163, + 162, 58, 161, 160, 159, 158, 157, 156, 155, 154, + 153, 152, 151, 150, 149, 148, 147, 146, 144, 142, + 58, 59, 59, 141, 59, 59, 59, 59, 59, 140, + 59, 139, 138, 137, 136, 135, 134, 133, 132, 131, + 130, 129, 128, 127, 110, 109, 107, 106, 105, 104, + 103, 102, 100, 99, 98, 59, 59, 97, 95, 93, + 92, 91, 90, 87, 59, 60, 60, 86, 60, 60, + 60, 60, 60, 85, 60, 84, 83, 82, 81, 80, + 79, 77, 76, 74, 72, 70, 69, 68, 67, 66, + + 65, 64, 62, 45, 41, 39, 38, 37, 36, 60, + 35, 34, 30, 29, 60, 111, 111, 27, 111, 111, + 111, 111, 111, 8, 111, 7, 5, 3, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 111, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 111, 112, 112, 0, 112, 112, + 112, 112, 112, 0, 112, 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, 0, 0, 0, 0, + 0, 0, 0, 0, 112, 113, 113, 0, 113, 113, + 113, 113, 113, 0, 113, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 113, + 0, 0, 0, 0, 0, 0, 113, 114, 114, 0, + 114, 114, 114, 114, 114, 0, 114, 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, 0, 0, + + 0, 0, 0, 0, 114, 115, 115, 0, 115, 115, + 115, 115, 115, 0, 115, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 115, + 0, 0, 0, 0, 0, 115, 116, 116, 0, 116, + 116, 116, 116, 116, 0, 116, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 116, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 116, 117, 117, 0, 117, + + 117, 117, 117, 117, 0, 117, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 117, 0, 0, 117, 118, 118, 0, 118, 118, 118, + 118, 118, 0, 118, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 118, 0, + 118, 119, 119, 0, 119, 119, 119, 119, 119, 0, + 119, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 119, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 119, 120, 120, 0, + 120, 120, 120, 120, 120, 0, 120, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 120, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 120, 121, 121, 0, 121, 121, 121, 121, 121, 0, + 121, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 121, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 121, 122, 122, 0, 122, 122, + 122, 122, 122, 0, 122, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, + 122, 123, 123, 0, 123, 123, 123, 123, 123, 0, + 123, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 123, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 123, 124, 124, 0, 124, 124, 124, 124, + 124, 0, 124, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 124, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 124, + 125, 125, 0, 125, 125, 125, 125, 125, 0, 125, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 125, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 125, 172, 172, 0, 172, 172, 172, 172, 172, + 0, 172, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 172, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 172, 173, 173, 0, 173, + 173, 173, 173, 173, 0, 173, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 173, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 173, + 174, 174, 0, 174, 174, 174, 174, 174, 0, 174, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 174, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 174, 175, 175, 0, 175, 175, 175, 175, + 175, 0, 175, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 175, 0, 0, + 0, 175, 176, 176, 0, 176, 176, 176, 176, 176, + 0, 176, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 176, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 176, 177, 177, 0, 177, 177, + 177, 177, 177, 0, 177, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 177, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 177, 179, + 179, 0, 179, 179, 179, 179, 179, 0, 179, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 179, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 179, 180, 180, 0, 180, 180, + 180, 180, 180, 0, 180, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 180, + 0, 0, 0, 180, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 180, 181, 181, + 0, 181, 181, 181, 181, 181, 0, 181, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 181, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 181, 184, 184, 0, 184, 184, + 184, 184, 184, 0, 184, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 184, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 184, 185, + 185, 0, 185, 185, 185, 185, 185, 0, 185, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 185, 0, 0, 0, 0, 0, 0, + 185, 186, 186, 0, 186, 186, 186, 186, 186, 0, + 186, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 186, 0, 0, 0, 0, + 186, 187, 187, 0, 187, 187, 187, 187, 187, 0, + 187, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 187, 0, 187, 229, 229, + 0, 229, 229, 229, 229, 229, 0, 229, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 229, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 229, 230, 230, 0, 230, 230, 230, 230, 230, 0, + 230, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 230, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 230, 232, 232, 0, 232, 232, 232, + 232, 232, 0, 232, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 232, 0, + 0, 0, 0, 0, 0, 0, 0, 232, 234, 234, + + 0, 234, 234, 234, 234, 234, 0, 234, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 234, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 234, 235, 235, 0, 235, 235, 235, 235, 235, 0, + 235, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 235, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 235, 236, 236, 0, 236, 236, 236, + 236, 236, 0, 236, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 236, 0, + 0, 0, 0, 0, 0, 0, 0, 236, 238, 238, + 0, 238, 238, 238, 238, 238, 0, 238, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 238, 0, 0, 238, 0, 0, 0, 238, + 241, 241, 0, 241, 241, 241, 241, 241, 0, 241, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 241, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 241, 242, 242, 0, 242, 242, 242, 242, + 242, 0, 242, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 242, 0, 0, + 0, 0, 242, 244, 244, 0, 244, 244, 244, 244, + 244, 0, 244, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 244, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 244, 278, 278, 0, 278, 278, 278, 278, 278, + 0, 278, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 278, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 278, 282, 282, 0, 282, 282, 282, + 282, 282, 0, 282, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 282, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 282, 284, 284, 0, 284, + 284, 284, 284, 284, 0, 284, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 284, 0, 0, 284, 285, 285, 0, 285, 285, 285, + 285, 285, 0, 285, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 285, 0, + 0, 285, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 285, 287, 287, 0, 287, 287, 287, 287, 287, 0, + 287, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 287, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 287, 289, 289, 0, 289, 289, + 289, 289, 289, 0, 289, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 289, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 289, 323, 323, + 0, 323, 323, 323, 323, 323, 0, 323, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 323, 0, 0, 323, 324, 324, 0, 324, + 324, 324, 324, 324, 0, 324, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 324, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 324, 327, 327, 0, 327, 327, 327, 327, + 327, 0, 327, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 327, 0, 0, + 0, 0, 327, 351, 351, 0, 351, 351, 351, 351, + 351, 0, 351, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 351, 351, 0, + 0, 351, 371, 371, 0, 371, 371, 371, 371, 371, + 0, 371, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 371, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 371, 372, 372, 0, 372, 372, 372, + 372, 372, 0, 372, 0, 0, 0, 0, 0, 0, + 0, 0, 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, 372, 387, 387, + 0, 387, 387, 387, 387, 387, 0, 387, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 387, 0, 0, 387, 388, 388, 0, 388, + 388, 388, 388, 388, 0, 388, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 388, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 388, 395, 395, + + 0, 395, 395, 395, 395, 395, 0, 395, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 395, 0, 0, 0, 0, 0, 0, 0, + 395, 411, 411, 411, 412, 412, 412, 413, 413, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + + 410, 410, 410, 410, 410, 410, 410, 410, 410, 410, + 410, 410, 410, 410, 410 + } ; + + static yy_state_type yy_last_accepting_state; + static char *yy_last_accepting_cpos; + + /* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ + #define REJECT reject_used_but_not_detected + #define yymore() yymore_used_but_not_detected + #define YY_MORE_ADJ 0 + #define YY_RESTORE_YY_MORE_OFFSET + char *yytext; + #line 1 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + #define INITIAL 0 + /*===- ConfigLexer.l - Scanner for CompilerDriver Config Files -*- C++ -*--===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file implements the flex scanner for configuration files for the + // llvmc CompilerDriver. + // + //===----------------------------------------------------------------------===*/ + #define YY_NEVER_INTERACTIVE 1 + #line 29 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + + #include "ConfigLexer.h" + + #define YY_INPUT(buf,result,max_size) \ + { \ + assert(ConfigLexerInput != 0 && "Oops"); \ + result = ConfigLexerInput->read(buf,max_size); \ + if (result == 0 ) result = YY_NULL; \ + } + + #define YY_FATAL_ERROR(msg) \ + { \ + assert(ConfigLexerInput != 0 && "Oops"); \ + ConfigLexerInput->error(msg); \ + } + + #define YY_DECL ConfigLexerTokens llvm::Configlex() + + #define yyterminate() { return EOFTOK; } + + using namespace llvm; + + inline llvm::ConfigLexerTokens + handleNameContext(llvm::ConfigLexerTokens token) { + ConfigLexerState.StringVal = yytext; + if (ConfigLexerState.in_value) + return OPTION; + return token; + } + + inline llvm::ConfigLexerTokens + handleSubstitution(llvm::ConfigLexerTokens token) { + if (ConfigLexerState.in_value) { + ConfigLexerState.StringVal = yytext; + return token; + } + YY_FATAL_ERROR("Substitition tokens not allowed in names" ); + return ERRORTOK; + }; + + inline llvm::ConfigLexerTokens handleValueContext(llvm::ConfigLexerTokens token) { + ConfigLexerState.StringVal = yytext; + if (ConfigLexerState.in_value) + return token; + return OPTION; + } + + #line 1314 "ConfigLexer.cpp" + + /* Macros after this point can all be overridden by user definitions in + * section 1. + */ + + #ifndef YY_SKIP_YYWRAP + #ifdef __cplusplus + extern "C" int yywrap YY_PROTO(( void )); + #else + extern int yywrap YY_PROTO(( void )); + #endif + #endif + + #ifndef YY_NO_UNPUT + static inline void yyunput YY_PROTO(( int c, char *buf_ptr )); + #endif + + #ifndef yytext_ptr + static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); + #endif + + #ifdef YY_NEED_STRLEN + static int yy_flex_strlen YY_PROTO(( yyconst char * )); + #endif + + #ifndef YY_NO_INPUT + #ifdef __cplusplus + static int yyinput YY_PROTO(( void )); + #else + static int input YY_PROTO(( void )); + #endif + #endif + + #if YY_STACK_USED + static int yy_start_stack_ptr = 0; + static int yy_start_stack_depth = 0; + static int *yy_start_stack = 0; + #ifndef YY_NO_PUSH_STATE + static void yy_push_state YY_PROTO(( int new_state )); + #endif + #ifndef YY_NO_POP_STATE + static void yy_pop_state YY_PROTO(( void )); + #endif + #ifndef YY_NO_TOP_STATE + static int yy_top_state YY_PROTO(( void )); + #endif + + #else + #define YY_NO_PUSH_STATE 1 + #define YY_NO_POP_STATE 1 + #define YY_NO_TOP_STATE 1 + #endif + + #ifdef YY_MALLOC_DECL + YY_MALLOC_DECL + #else + #if __STDC__ + #ifndef __cplusplus + #include + #endif + #else + /* Just try to get by without declaring the routines. This will fail + * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) + * or sizeof(void*) != sizeof(int). + */ + #endif + #endif + + /* Amount of stuff to slurp up with each read. */ + #ifndef YY_READ_BUF_SIZE + #define YY_READ_BUF_SIZE 8192 + #endif + + /* Copy whatever the last rule matched to the standard output. */ + + #ifndef ECHO + /* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ + #define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) + #endif + + /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ + #ifndef YY_INPUT + #define YY_INPUT(buf,result,max_size) \ + if ( yy_current_buffer->yy_is_interactive ) \ + { \ + int c = '*', n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ + && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); + #endif + + /* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ + #ifndef yyterminate + #define yyterminate() return YY_NULL + #endif + + /* Number of entries by which start-condition stack grows. */ + #ifndef YY_START_STACK_INCR + #define YY_START_STACK_INCR 25 + #endif + + /* Report a fatal error. */ + #ifndef YY_FATAL_ERROR + #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) + #endif + + /* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ + #ifndef YY_DECL + #define YY_DECL int yylex YY_PROTO(( void )) + #endif + + /* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ + #ifndef YY_USER_ACTION + #define YY_USER_ACTION + #endif + + /* Code executed at the end of each rule. */ + #ifndef YY_BREAK + #define YY_BREAK break; + #endif + + #define YY_RULE_SETUP \ + YY_USER_ACTION + + YY_DECL + { + register yy_state_type yy_current_state; + register char *yy_cp = NULL, *yy_bp = NULL; + register int yy_act; + + #line 114 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + + + #line 1468 "ConfigLexer.cpp" + + if ( yy_init ) + { + yy_init = 0; + + #ifdef YY_USER_INIT + YY_USER_INIT; + #endif + + if ( ! yy_start ) + yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! yy_current_buffer ) + yy_current_buffer = + yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_load_buffer_state(); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = yy_start; + yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 411 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_current_state != 410 ); + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + + yy_find_action: + yy_act = yy_accept[yy_current_state]; + + YY_DO_BEFORE_ACTION; + + + do_action: /* This label is used only to access EOF actions. */ + + + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yy_hold_char; + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + goto yy_find_action; + + case 1: + YY_RULE_SETUP + #line 116 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { if (ConfigLexerState.in_value) return SPACE; } + YY_BREAK + case 2: + YY_RULE_SETUP + #line 118 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { /* Ignore comments */ + ConfigLexerState.in_value = false; + ConfigLexerState.lineNum++; + return EOLTOK; + } + YY_BREAK + case 3: + YY_RULE_SETUP + #line 124 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { ConfigLexerState.lineNum++; + /* Don't return EOLTOK! */ + } + YY_BREAK + case 4: + YY_RULE_SETUP + #line 128 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { ConfigLexerState.in_value = false; + ConfigLexerState.lineNum++; + return EOLTOK; + } + YY_BREAK + case 5: + YY_RULE_SETUP + #line 133 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { ConfigLexerState.in_value = true; + return EQUALS; + } + YY_BREAK + case 6: + YY_RULE_SETUP + #line 137 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return SEPARATOR; } + YY_BREAK + case 7: + YY_RULE_SETUP + #line 139 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleNameContext(VERSION_TOK); } + YY_BREAK + case 8: + YY_RULE_SETUP + #line 141 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleNameContext(LANG); } + YY_BREAK + case 9: + YY_RULE_SETUP + #line 142 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleNameContext(LIBS); } + YY_BREAK + case 10: + YY_RULE_SETUP + #line 143 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleNameContext(NAME); } + YY_BREAK + case 11: + YY_RULE_SETUP + #line 144 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleNameContext(OPT1); } + YY_BREAK + case 12: + YY_RULE_SETUP + #line 145 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleNameContext(OPT2); } + YY_BREAK + case 13: + YY_RULE_SETUP + #line 146 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleNameContext(OPT3); } + YY_BREAK + case 14: + YY_RULE_SETUP + #line 147 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleNameContext(OPT4); } + YY_BREAK + case 15: + YY_RULE_SETUP + #line 148 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleNameContext(OPT5); } + YY_BREAK + case 16: + YY_RULE_SETUP + #line 150 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleNameContext(PREPROCESSOR); } + YY_BREAK + case 17: + YY_RULE_SETUP + #line 151 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleNameContext(COMMAND); } + YY_BREAK + case 18: + YY_RULE_SETUP + #line 152 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleNameContext(REQUIRED); } + YY_BREAK + case 19: + YY_RULE_SETUP + #line 154 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleNameContext(TRANSLATOR); } + YY_BREAK + case 20: + YY_RULE_SETUP + #line 155 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleNameContext(PREPROCESSES); } + YY_BREAK + case 21: + YY_RULE_SETUP + #line 156 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleNameContext(OUTPUT); } + YY_BREAK + case 22: + YY_RULE_SETUP + #line 158 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleNameContext(OPTIMIZER); } + YY_BREAK + case 23: + YY_RULE_SETUP + #line 159 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleNameContext(TRANSLATES); } + YY_BREAK + case 24: + YY_RULE_SETUP + #line 161 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleNameContext(ASSEMBLER); } + YY_BREAK + case 25: + YY_RULE_SETUP + #line 163 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleNameContext(LINKER); } + YY_BREAK + case 26: + YY_RULE_SETUP + #line 165 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleSubstitution(ARGS_SUBST); } + YY_BREAK + case 27: + YY_RULE_SETUP + #line 166 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleSubstitution(BINDIR_SUBST); } + YY_BREAK + case 28: + YY_RULE_SETUP + #line 167 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleSubstitution(DEFS_SUBST); } + YY_BREAK + case 29: + YY_RULE_SETUP + #line 168 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleSubstitution(IN_SUBST); } + YY_BREAK + case 30: + YY_RULE_SETUP + #line 169 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleSubstitution(INCLS_SUBST); } + YY_BREAK + case 31: + YY_RULE_SETUP + #line 170 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleSubstitution(LIBDIR_SUBST); } + YY_BREAK + case 32: + YY_RULE_SETUP + #line 171 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleSubstitution(LIBS_SUBST); } + YY_BREAK + case 33: + YY_RULE_SETUP + #line 172 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleSubstitution(LLVMGCCDIR_SUBST); } + YY_BREAK + case 34: + YY_RULE_SETUP + #line 173 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleSubstitution(LLVMGCCARCH_SUBST); } + YY_BREAK + case 35: + YY_RULE_SETUP + #line 174 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleSubstitution(LLVMGCC_SUBST); } + YY_BREAK + case 36: + YY_RULE_SETUP + #line 175 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleSubstitution(LLVMGXX_SUBST); } + YY_BREAK + case 37: + YY_RULE_SETUP + #line 176 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleSubstitution(LLVMCC1_SUBST); } + YY_BREAK + case 38: + YY_RULE_SETUP + #line 177 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleSubstitution(LLVMCC1PLUS_SUBST); } + YY_BREAK + case 39: + YY_RULE_SETUP + #line 178 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleSubstitution(OPT_SUBST); } + YY_BREAK + case 40: + YY_RULE_SETUP + #line 179 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleSubstitution(OUT_SUBST); } + YY_BREAK + case 41: + YY_RULE_SETUP + #line 180 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleSubstitution(STATS_SUBST); } + YY_BREAK + case 42: + YY_RULE_SETUP + #line 181 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleSubstitution(TARGET_SUBST); } + YY_BREAK + case 43: + YY_RULE_SETUP + #line 182 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleSubstitution(TIME_SUBST); } + YY_BREAK + case 44: + YY_RULE_SETUP + #line 183 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleSubstitution(VERBOSE_SUBST); } + YY_BREAK + case 45: + YY_RULE_SETUP + #line 184 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleSubstitution(FOPTS_SUBST); } + YY_BREAK + case 46: + YY_RULE_SETUP + #line 185 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleSubstitution(MOPTS_SUBST); } + YY_BREAK + case 47: + YY_RULE_SETUP + #line 186 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleSubstitution(WOPTS_SUBST); } + YY_BREAK + case 48: + YY_RULE_SETUP + #line 188 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleValueContext(ASSEMBLY); } + YY_BREAK + case 49: + YY_RULE_SETUP + #line 189 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleValueContext(BYTECODE); } + YY_BREAK + case 50: + YY_RULE_SETUP + #line 190 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleValueContext(TRUETOK); } + YY_BREAK + case 51: + YY_RULE_SETUP + #line 191 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { return handleValueContext(FALSETOK); } + YY_BREAK + case 52: + YY_RULE_SETUP + #line 193 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { ConfigLexerState.StringVal = yytext; return OPTION; } + YY_BREAK + case 53: + YY_RULE_SETUP + #line 194 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { ConfigLexerState.StringVal = yytext+1; // Nuke start quote + ConfigLexerState.StringVal.erase( + --ConfigLexerState.StringVal.end()); + return STRING; + } + YY_BREAK + case 54: + YY_RULE_SETUP + #line 199 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + { YY_FATAL_ERROR("Invalid substitution token"); } + YY_BREAK + case 55: + YY_RULE_SETUP + #line 201 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + ECHO; + YY_BREAK + #line 1837 "ConfigLexer.cpp" + case YY_STATE_EOF(INITIAL): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yy_hold_char; + YY_RESTORE_YY_MORE_OFFSET + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between yy_current_buffer and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yy_n_chars = yy_current_buffer->yy_n_chars; + yy_current_buffer->yy_input_file = yyin; + yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = yy_last_accepting_cpos; + yy_current_state = yy_last_accepting_state; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + yy_did_buffer_switch_on_eof = 0; + + if ( yywrap() ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = + yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yy_c_buf_p = + &yy_current_buffer->yy_ch_buf[yy_n_chars]; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of yylex */ + + + /* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ + + static int yy_get_next_buffer() + { + register char *dest = yy_current_buffer->yy_ch_buf; + register char *source = yytext_ptr; + register int number_to_move, i; + int ret_val; + + if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( yy_current_buffer->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + yy_current_buffer->yy_n_chars = yy_n_chars = 0; + + else + { + int num_to_read = + yy_current_buffer->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + #ifdef YY_USES_REJECT + YY_FATAL_ERROR( + "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); + #else + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = yy_current_buffer; + + int yy_c_buf_p_offset = + (int) (yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yy_flex_realloc( (void *) b->yy_ch_buf, + b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = yy_current_buffer->yy_buf_size - + number_to_move - 1; + #endif + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), + yy_n_chars, num_to_read ); + + yy_current_buffer->yy_n_chars = yy_n_chars; + } + + if ( yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart( yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + yy_current_buffer->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + yy_n_chars += number_to_move; + yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; + yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; + + return ret_val; + } + + + /* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state() + { + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = yy_start; + + for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 411 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + + return yy_current_state; + } + + + /* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + + #ifdef YY_USE_PROTOS + static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) + #else + static yy_state_type yy_try_NUL_trans( yy_current_state ) + yy_state_type yy_current_state; + #endif + { + register int yy_is_jam; + register char *yy_cp = yy_c_buf_p; + + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + yy_last_accepting_state = yy_current_state; + yy_last_accepting_cpos = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 411 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 410); + + return yy_is_jam ? 0 : yy_current_state; + } + + + #ifndef YY_NO_UNPUT + #ifdef YY_USE_PROTOS + static inline void yyunput( int c, register char *yy_bp ) + #else + static inline void yyunput( c, yy_bp ) + int c; + register char *yy_bp; + #endif + { + register char *yy_cp = yy_c_buf_p; + + /* undo effects of setting up yytext */ + *yy_cp = yy_hold_char; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = yy_n_chars + 2; + register char *dest = &yy_current_buffer->yy_ch_buf[ + yy_current_buffer->yy_buf_size + 2]; + register char *source = + &yy_current_buffer->yy_ch_buf[number_to_move]; + + while ( source > yy_current_buffer->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + yy_current_buffer->yy_n_chars = + yy_n_chars = yy_current_buffer->yy_buf_size; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + + yytext_ptr = yy_bp; + yy_hold_char = *yy_cp; + yy_c_buf_p = yy_cp; + } + #endif /* ifndef YY_NO_UNPUT */ + + + #ifndef YY_NO_INPUT + #ifdef __cplusplus + static int yyinput() + #else + static int input() + #endif + { + int c; + + *yy_c_buf_p = yy_hold_char; + + if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + /* This was really a NUL. */ + *yy_c_buf_p = '\0'; + + else + { /* need more input */ + int offset = yy_c_buf_p - yytext_ptr; + ++yy_c_buf_p; + + switch ( yy_get_next_buffer() ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart( yyin ); + + /* fall through */ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap() ) + return EOF; + + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + #ifdef __cplusplus + return yyinput(); + #else + return input(); + #endif + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = yytext_ptr + offset; + break; + } + } + } + + c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ + *yy_c_buf_p = '\0'; /* preserve yytext */ + yy_hold_char = *++yy_c_buf_p; + + + return c; + } + #endif /* YY_NO_INPUT */ + + #ifdef YY_USE_PROTOS + void yyrestart( FILE *input_file ) + #else + void yyrestart( input_file ) + FILE *input_file; + #endif + { + if ( ! yy_current_buffer ) + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_init_buffer( yy_current_buffer, input_file ); + yy_load_buffer_state(); + } + + + #ifdef YY_USE_PROTOS + void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) + #else + void yy_switch_to_buffer( new_buffer ) + YY_BUFFER_STATE new_buffer; + #endif + { + if ( yy_current_buffer == new_buffer ) + return; + + if ( yy_current_buffer ) + { + /* Flush out information for old buffer. */ + *yy_c_buf_p = yy_hold_char; + yy_current_buffer->yy_buf_pos = yy_c_buf_p; + yy_current_buffer->yy_n_chars = yy_n_chars; + } + + yy_current_buffer = new_buffer; + yy_load_buffer_state(); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yy_did_buffer_switch_on_eof = 1; + } + + + #ifdef YY_USE_PROTOS + void yy_load_buffer_state( void ) + #else + void yy_load_buffer_state() + #endif + { + yy_n_chars = yy_current_buffer->yy_n_chars; + yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; + yyin = yy_current_buffer->yy_input_file; + yy_hold_char = *yy_c_buf_p; + } + + + #ifdef YY_USE_PROTOS + YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) + #else + YY_BUFFER_STATE yy_create_buffer( file, size ) + FILE *file; + int size; + #endif + { + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer( b, file ); + + return b; + } + + + #ifdef YY_USE_PROTOS + void yy_delete_buffer( YY_BUFFER_STATE b ) + #else + void yy_delete_buffer( b ) + YY_BUFFER_STATE b; + #endif + { + if ( ! b ) + return; + + if ( b == yy_current_buffer ) + yy_current_buffer = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yy_flex_free( (void *) b->yy_ch_buf ); + + yy_flex_free( (void *) b ); + } + + + + #ifdef YY_USE_PROTOS + void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) + #else + void yy_init_buffer( b, file ) + YY_BUFFER_STATE b; + FILE *file; + #endif + + + { + yy_flush_buffer( b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + #if YY_ALWAYS_INTERACTIVE + b->yy_is_interactive = 1; + #else + #if YY_NEVER_INTERACTIVE + b->yy_is_interactive = 0; + #else + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + #endif + #endif + } + + + #ifdef YY_USE_PROTOS + void yy_flush_buffer( YY_BUFFER_STATE b ) + #else + void yy_flush_buffer( b ) + YY_BUFFER_STATE b; + #endif + + { + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == yy_current_buffer ) + yy_load_buffer_state(); + } + + + #ifndef YY_NO_SCAN_BUFFER + #ifdef YY_USE_PROTOS + YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) + #else + YY_BUFFER_STATE yy_scan_buffer( base, size ) + char *base; + yy_size_t size; + #endif + { + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer( b ); + + return b; + } + #endif + + + #ifndef YY_NO_SCAN_STRING + #ifdef YY_USE_PROTOS + YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) + #else + YY_BUFFER_STATE yy_scan_string( yy_str ) + yyconst char *yy_str; + #endif + { + int len; + for ( len = 0; yy_str[len]; ++len ) + ; + + return yy_scan_bytes( yy_str, len ); + } + #endif + + + #ifndef YY_NO_SCAN_BYTES + #ifdef YY_USE_PROTOS + YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) + #else + YY_BUFFER_STATE yy_scan_bytes( bytes, len ) + yyconst char *bytes; + int len; + #endif + { + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = len + 2; + buf = (char *) yy_flex_alloc( n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < len; ++i ) + buf[i] = bytes[i]; + + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer( buf, n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; + } + #endif + + + #ifndef YY_NO_PUSH_STATE + #ifdef YY_USE_PROTOS + static void yy_push_state( int new_state ) + #else + static void yy_push_state( new_state ) + int new_state; + #endif + { + if ( yy_start_stack_ptr >= yy_start_stack_depth ) + { + yy_size_t new_size; + + yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yy_start_stack_depth * sizeof( int ); + + if ( ! yy_start_stack ) + yy_start_stack = (int *) yy_flex_alloc( new_size ); + + else + yy_start_stack = (int *) yy_flex_realloc( + (void *) yy_start_stack, new_size ); + + if ( ! yy_start_stack ) + YY_FATAL_ERROR( + "out of memory expanding start-condition stack" ); + } + + yy_start_stack[yy_start_stack_ptr++] = YY_START; + + BEGIN(new_state); + } + #endif + + + #ifndef YY_NO_POP_STATE + static void yy_pop_state() + { + if ( --yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); + + BEGIN(yy_start_stack[yy_start_stack_ptr]); + } + #endif + + + #ifndef YY_NO_TOP_STATE + static int yy_top_state() + { + return yy_start_stack[yy_start_stack_ptr - 1]; + } + #endif + + #ifndef YY_EXIT_FAILURE + #define YY_EXIT_FAILURE 2 + #endif + + #ifdef YY_USE_PROTOS + static void yy_fatal_error( yyconst char msg[] ) + #else + static void yy_fatal_error( msg ) + char msg[]; + #endif + { + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); + } + + + + /* Redefine yyless() so it works in section 3 code. */ + + #undef yyless + #define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + yytext[yyleng] = yy_hold_char; \ + yy_c_buf_p = yytext + n; \ + yy_hold_char = *yy_c_buf_p; \ + *yy_c_buf_p = '\0'; \ + yyleng = n; \ + } \ + while ( 0 ) + + + /* Internal utility routines. */ + + #ifndef yytext_ptr + #ifdef YY_USE_PROTOS + static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) + #else + static void yy_flex_strncpy( s1, s2, n ) + char *s1; + yyconst char *s2; + int n; + #endif + { + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; + } + #endif + + #ifdef YY_NEED_STRLEN + #ifdef YY_USE_PROTOS + static int yy_flex_strlen( yyconst char *s ) + #else + static int yy_flex_strlen( s ) + yyconst char *s; + #endif + { + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; + } + #endif + + + #ifdef YY_USE_PROTOS + static void *yy_flex_alloc( yy_size_t size ) + #else + static void *yy_flex_alloc( size ) + yy_size_t size; + #endif + { + return (void *) malloc( size ); + } + + #ifdef YY_USE_PROTOS + static inline void *yy_flex_realloc( void *ptr, yy_size_t size ) + #else + static inline void *yy_flex_realloc( ptr, size ) + void *ptr; + yy_size_t size; + #endif + { + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); + } + + #ifdef YY_USE_PROTOS + static void yy_flex_free( void *ptr ) + #else + static void yy_flex_free( ptr ) + void *ptr; + #endif + { + free( ptr ); + } + + #if YY_MAIN + int main() + { + yylex(); + return 0; + } + #endif + #line 201 "/proj/llvm/build/../llvm/tools/llvmc/ConfigLexer.l" + Index: llvm/tools/llvmc/ConfigLexer.l.cvs diff -c /dev/null llvm/tools/llvmc/ConfigLexer.l.cvs:1.1 *** /dev/null Mon Feb 13 23:16:46 2006 --- llvm/tools/llvmc/ConfigLexer.l.cvs Mon Feb 13 23:16:35 2006 *************** *** 0 **** --- 1,201 ---- + /*===- ConfigLexer.l - Scanner for CompilerDriver Config Files -*- C++ -*--===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and is distributed under the + // University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file implements the flex scanner for configuration files for the + // llvmc CompilerDriver. + // + //===----------------------------------------------------------------------===*/ + + + %option prefix="Config" + %option nostdinit + %option never-interactive + %option batch + %option noyywrap + %option 8bit + %option outfile="ConfigLexer.cpp" + %option ecs + %option noyymore + %option noreject + %pointer + + %{ + + #include "ConfigLexer.h" + + #define YY_INPUT(buf,result,max_size) \ + { \ + assert(ConfigLexerInput != 0 && "Oops"); \ + result = ConfigLexerInput->read(buf,max_size); \ + if (result == 0 ) result = YY_NULL; \ + } + + #define YY_FATAL_ERROR(msg) \ + { \ + assert(ConfigLexerInput != 0 && "Oops"); \ + ConfigLexerInput->error(msg); \ + } + + #define YY_DECL ConfigLexerTokens llvm::Configlex() + + #define yyterminate() { return EOFTOK; } + + using namespace llvm; + + inline llvm::ConfigLexerTokens + handleNameContext(llvm::ConfigLexerTokens token) { + ConfigLexerState.StringVal = yytext; + if (ConfigLexerState.in_value) + return OPTION; + return token; + } + + inline llvm::ConfigLexerTokens + handleSubstitution(llvm::ConfigLexerTokens token) { + if (ConfigLexerState.in_value) { + ConfigLexerState.StringVal = yytext; + return token; + } + YY_FATAL_ERROR("Substitition tokens not allowed in names" ); + return ERRORTOK; + }; + + inline llvm::ConfigLexerTokens handleValueContext(llvm::ConfigLexerTokens token) { + ConfigLexerState.StringVal = yytext; + if (ConfigLexerState.in_value) + return token; + return OPTION; + } + + %} + + ASSEMBLER assembler|Assembler|ASSEMBLER + COMMAND command|Command|COMMAND + LANG lang|Lang|LANG + LIBS libs|Libs|LIBS + LINKER linker|Linker|LINKER + NAME name|Name|NAME + OPT1 opt1|Opt1|OPT1 + OPT2 opt2|Opt2|OPT2 + OPT3 opt3|Opt3|OPT3 + OPT4 opt4|Opt4|OPT4 + OPT5 opt5|Opt5|OPT5 + OPTIMIZER optimizer|Optimizer|OPTIMIZER + OUTPUT output|Output|OUTPUT + PREPROCESSES preprocesses|PreProcesses|PREPROCESSES + PREPROCESSOR preprocessor|PreProcessor|PREPROCESSOR + REQUIRED required|Required|REQUIRED + TRANSLATES translates|Translates|TRANSLATES + TRANSLATOR translator|Translator|TRANSLATOR + VERSION version|Version|VERSION + + True true|True|TRUE|on|On|ON|yes|Yes|YES + False false|False|FALSE|off|Off|OFF|no|No|NO + Bytecode bc|BC|bytecode|Bytecode|BYTECODE + Assembly asm|ASM|assembly|Assembly|ASSEMBLY + + BadSubst \%[a-zA-Z]*\% + Comment \#[^\r\n]*\r?\n + NewLine \r?\n + Eq \= + EscNewLine \\\r?\n + Option [-A-Za-z0-9_:%+/\\|,][-A-Za-z0-9_:+/\\|,@]* + Sep \. + String \"[^\"]*\" + White [ \t]* + + + %% + + {White} { if (ConfigLexerState.in_value) return SPACE; } + + {Comment} { /* Ignore comments */ + ConfigLexerState.in_value = false; + ConfigLexerState.lineNum++; + return EOLTOK; + } + + {EscNewLine} { ConfigLexerState.lineNum++; + /* Don't return EOLTOK! */ + } + + {NewLine} { ConfigLexerState.in_value = false; + ConfigLexerState.lineNum++; + return EOLTOK; + } + + {Eq} { ConfigLexerState.in_value = true; + return EQUALS; + } + + {Sep} { return SEPARATOR; } + + {VERSION} { return handleNameContext(VERSION_TOK); } + + {LANG} { return handleNameContext(LANG); } + {LIBS} { return handleNameContext(LIBS); } + {NAME} { return handleNameContext(NAME); } + {OPT1} { return handleNameContext(OPT1); } + {OPT2} { return handleNameContext(OPT2); } + {OPT3} { return handleNameContext(OPT3); } + {OPT4} { return handleNameContext(OPT4); } + {OPT5} { return handleNameContext(OPT5); } + + {PREPROCESSOR} { return handleNameContext(PREPROCESSOR); } + {COMMAND} { return handleNameContext(COMMAND); } + {REQUIRED} { return handleNameContext(REQUIRED); } + + {TRANSLATOR} { return handleNameContext(TRANSLATOR); } + {PREPROCESSES} { return handleNameContext(PREPROCESSES); } + {OUTPUT} { return handleNameContext(OUTPUT); } + + {OPTIMIZER} { return handleNameContext(OPTIMIZER); } + {TRANSLATES} { return handleNameContext(TRANSLATES); } + + {ASSEMBLER} { return handleNameContext(ASSEMBLER); } + + {LINKER} { return handleNameContext(LINKER); } + + %args% { return handleSubstitution(ARGS_SUBST); } + %bindir% { return handleSubstitution(BINDIR_SUBST); } + %defs% { return handleSubstitution(DEFS_SUBST); } + %in% { return handleSubstitution(IN_SUBST); } + %incls% { return handleSubstitution(INCLS_SUBST); } + %libdir% { return handleSubstitution(LIBDIR_SUBST); } + %libs% { return handleSubstitution(LIBS_SUBST); } + %llvmgccdir% { return handleSubstitution(LLVMGCCDIR_SUBST); } + %llvmgccarch% { return handleSubstitution(LLVMGCCARCH_SUBST); } + %llvmgcc% { return handleSubstitution(LLVMGCC_SUBST); } + %llvmgxx% { return handleSubstitution(LLVMGXX_SUBST); } + %llvmcc1% { return handleSubstitution(LLVMCC1_SUBST); } + %llvmcc1plus% { return handleSubstitution(LLVMCC1PLUS_SUBST); } + %opt% { return handleSubstitution(OPT_SUBST); } + %out% { return handleSubstitution(OUT_SUBST); } + %stats% { return handleSubstitution(STATS_SUBST); } + %target% { return handleSubstitution(TARGET_SUBST); } + %time% { return handleSubstitution(TIME_SUBST); } + %verbose% { return handleSubstitution(VERBOSE_SUBST); } + %fOpts% { return handleSubstitution(FOPTS_SUBST); } + %MOpts% { return handleSubstitution(MOPTS_SUBST); } + %WOpts% { return handleSubstitution(WOPTS_SUBST); } + + {Assembly} { return handleValueContext(ASSEMBLY); } + {Bytecode} { return handleValueContext(BYTECODE); } + {True} { return handleValueContext(TRUETOK); } + {False} { return handleValueContext(FALSETOK); } + + {Option} { ConfigLexerState.StringVal = yytext; return OPTION; } + {String} { ConfigLexerState.StringVal = yytext+1; // Nuke start quote + ConfigLexerState.StringVal.erase( + --ConfigLexerState.StringVal.end()); + return STRING; + } + {BadSubst} { YY_FATAL_ERROR("Invalid substitution token"); } + + %% From lattner at cs.uiuc.edu Mon Feb 13 23:39:47 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Mon, 13 Feb 2006 23:39:47 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200602140539.XAA20167@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.152 -> 1.153 --- Log message: now that libcalls don't suck, we can remove this hack --- Diffs of the changes: (+2 -6) SelectionDAGISel.cpp | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.152 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.153 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.152 Mon Feb 13 06:50:39 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Mon Feb 13 23:39:35 2006 @@ -1098,9 +1098,7 @@ } else if (Name[0] == 's' && (Name == "sin" || Name == "sinf")) { if (I.getNumOperands() == 2 && // Basic sanity checks. I.getOperand(1)->getType()->isFloatingPoint() && - I.getType() == I.getOperand(1)->getType() && - TLI.isOperationLegal(ISD::FSIN, - TLI.getValueType(I.getOperand(1)->getType()))) { + I.getType() == I.getOperand(1)->getType()) { SDOperand Tmp = getValue(I.getOperand(1)); setValue(&I, DAG.getNode(ISD::FSIN, Tmp.getValueType(), Tmp)); return; @@ -1108,9 +1106,7 @@ } else if (Name[0] == 'c' && (Name == "cos" || Name == "cosf")) { if (I.getNumOperands() == 2 && // Basic sanity checks. I.getOperand(1)->getType()->isFloatingPoint() && - I.getType() == I.getOperand(1)->getType() && - TLI.isOperationLegal(ISD::FCOS, - TLI.getValueType(I.getOperand(1)->getType()))) { + I.getType() == I.getOperand(1)->getType()) { SDOperand Tmp = getValue(I.getOperand(1)); setValue(&I, DAG.getNode(ISD::FCOS, Tmp.getValueType(), Tmp)); return; From lattner at cs.uiuc.edu Tue Feb 14 00:07:58 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 14 Feb 2006 00:07:58 -0600 Subject: [llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/Fhourstones-3.1/ Message-ID: <200602140607.AAA20388@zion.cs.uiuc.edu> Changes in directory llvm-test/MultiSource/Benchmarks/Fhourstones-3.1: --- Log message: Directory /home/vadve/shared/PublicCVS/llvm-test/MultiSource/Benchmarks/Fhourstones-3.1 added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From lattner at cs.uiuc.edu Tue Feb 14 00:08:46 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 14 Feb 2006 00:08:46 -0600 Subject: [llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/Fhourstones-3.1/Game.h LICENSE.txt Makefile SearchGame.c TransGame.h inputs inputs_large Message-ID: <200602140608.AAA20457@zion.cs.uiuc.edu> Changes in directory llvm-test/MultiSource/Benchmarks/Fhourstones-3.1: Game.h added (r1.1) LICENSE.txt added (r1.1) Makefile added (r1.1) SearchGame.c added (r1.1) TransGame.h added (r1.1) inputs added (r1.1) inputs_large added (r1.1) --- Log message: New tasty version of fhourstones: 3.1! This one even includes a LARGE_PROBLEM_SIZE input! :) --- Diffs of the changes: (+484 -0) Game.h | 122 ++++++++++++++++++++++++++++++++++++ LICENSE.txt | 11 +++ Makefile | 16 ++++ SearchGame.c | 197 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ TransGame.h | 133 +++++++++++++++++++++++++++++++++++++++ inputs | 2 inputs_large | 3 7 files changed, 484 insertions(+) Index: llvm-test/MultiSource/Benchmarks/Fhourstones-3.1/Game.h diff -c /dev/null llvm-test/MultiSource/Benchmarks/Fhourstones-3.1/Game.h:1.1 *** /dev/null Tue Feb 14 00:08:44 2006 --- llvm-test/MultiSource/Benchmarks/Fhourstones-3.1/Game.h Tue Feb 14 00:08:34 2006 *************** *** 0 **** --- 1,122 ---- + // Fhourstones 3.0 Board Logic + // (http://www.cwi.nl/~tromp/c4/fhour.html) + // + // implementation of the well-known game + // usually played on a vertical board of 7 columns by 6 rows, + // where 2 players take turns in dropping counters in a column. + // the first player to get four of his counters + // in a horizontal, vertical or diagonal row, wins the game. + // if neither player has won after 42 moves, then the game is drawn. + // + // This software is copyright (c) 1996-2005 by + // John Tromp + // Insulindeweg 908 + // 1095 DX Amsterdam + // Netherlands + // E-mail: tromp at cwi.nl + // + // This notice must not be removed. + // This software must not be sold for profit. + // You may redistribute if your distributees have the + // same rights and restrictions. + + #include + #include + #define WIDTH 7 + #define HEIGHT 6 + // bitmask corresponds to board as follows in 7x6 case: + // . . . . . . . TOP + // 5 12 19 26 33 40 47 + // 4 11 18 25 32 39 46 + // 3 10 17 24 31 38 45 + // 2 9 16 23 30 37 44 + // 1 8 15 22 29 36 43 + // 0 7 14 21 28 35 42 BOTTOM + #define H1 (HEIGHT+1) + #define H2 (HEIGHT+2) + #define SIZE (HEIGHT*WIDTH) + #define SIZE1 (H1*WIDTH) + #define ALL1 (((uint64)1< + typedef u_int64_t uint64; + typedef int64_t int64; + + uint64 color[2]; // black and white bitboard + int moves[SIZE],nplies; + char height[WIDTH]; // holds bit index of lowest free square + + void reset() + { + int i; + nplies = 0; + color[0] = color[1] = 0; + for (i=0; i>HEIGHT); + if ((y & (y >> 2*HEIGHT)) != 0) // check \ diagonal + return 1; + y = newboard & (newboard>>H1); + if ((y & (y >> 2*H1)) != 0) // check horizontal - + return 1; + y = newboard & (newboard>>H2); // check / diagonal + if ((y & (y >> 2*H2)) != 0) + return 1; + y = newboard & (newboard>>1); // check vertical | + return (y & (y >> 2)) != 0; + } + + // return whether newboard is legal and includes a win + int islegalhaswon(uint64 newboard) + { + return islegal(newboard) && haswon(newboard); + } + + void backmove() + { + int n; + + n = moves[--nplies]; + color[nplies&1] ^= (uint64)1<<--height[n]; + } + + void makemove(int n) + { + color[nplies&1] ^= (uint64)1< + #include + + #define BOOKPLY 0 // full-width search up to this depth + #define REPORTPLY -1 + + uint64 millisecs() + { + struct rusage rusage; + getrusage(RUSAGE_SELF,&rusage); + return rusage.ru_utime.tv_sec * 1000 + rusage.ru_utime.tv_usec / 1000; + } + + int history[2][SIZE1]; + uint64 nodes, msecs; + + int min(int x, int y) { return xy ? x : y; } + + void inithistory() + { + int side,i,h; + for (side=0; side<2; side++) + for (i=0; i<(WIDTH+1)/2; i++) + for (h=0; h

= beta) + return ttscore; + } else return ttscore; // exact score + } + hashindx = htindex; + hashlock = lock; + poscnt = posed; + besti=0; + score = LOSS; + for (i = 0; i < nav; i++) { + val = history[side][(int)height[av[l = i]]]; + for (j = i+1; j < nav; j++) { + v = history[side][(int)height[av[j]]]; + if (v > val) { + val = v; l = j; + } + } + for (j = av[l]; l>i; l--) + av[l] = av[l-1]; + makemove(av[i] = j); + val = LOSSWIN-ab(LOSSWIN-beta,LOSSWIN-alpha); + backmove(); + if (val > score) { + besti = i; + if ((score=val) > alpha && nplies >= BOOKPLY && (alpha=val) >= beta) { + if (score == DRAW && i < nav-1) + score = DRAWWIN; + if (besti > 0) { + for (i = 0; i < besti; i++) + history[side][(int)height[av[i]]]--; // punish bad histories + history[side][(int)height[av[besti]]] += besti; + } + break; + } + } + } + if (score == LOSSWIN-ttscore) // combine < and > + score = DRAW; + poscnt = posed - poscnt; + for (work=0; (poscnt>>=1) != 0; work++) ; // work=log #positions stored + transtore(hashindx, hashlock, score, work); + if (nplies <= REPORTPLY) { + printMoves(); + printf("%c%d\n", "#-<=>+"[score], work); + } + return score; + } + + int solve() + { + int i, side = nplies & 1, otherside = side ^ 1, score; + + nodes = 0; + msecs = 1L; + if (haswon(color[otherside])) + return LOSS; + for (i = 0; i < WIDTH; i++) + if (islegalhaswon(color[side] | ((uint64)1 << height[i]))) + return WIN; + inithistory(); + msecs = millisecs(); + score = ab(LOSS, WIN); + msecs = 1L + millisecs() - msecs; // prevent division by 0 + return score; + } + + int main() + { + int c, result, work; + uint64 poscnt; + + if (sizeof(uint64) != 8) { + printf("sizeof(uint64) == %d; please redefine.\n", sizeof(uint64)); + exit(0); + } + trans_init(); + puts("Fhourstones 3.1 (C)"); + printf("Boardsize = %dx%d\n",WIDTH,HEIGHT); + printf("Using %d transposition table entries.\n", TRANSIZE); + + for (;;) { + reset(); + while ((c = getchar()) != -1) { + if (c >= '1' && c <= '0'+WIDTH) + makemove(c - '1'); + else if (c == '\n') + break; + } + if (c == -1) + break; + printf("\nSolving %d-ply position after ", nplies); + printMoves(); + puts(" . . ."); + + emptyTT(); + result = solve(); // expect score << 6 | work + poscnt = posed; + for (work=0; (poscnt>>=1) != 0; work++) ; //work = log of #positions stored + printf("score = %d (%c) work = %d\n", + result, "#-<=>+"[result], work); + //printf("%llu pos / %llu msec = %.1f Kpos/sec\n", + // nodes, msecs, (double)nodes/msecs); + htstat(); + } + return 0; + } Index: llvm-test/MultiSource/Benchmarks/Fhourstones-3.1/TransGame.h diff -c /dev/null llvm-test/MultiSource/Benchmarks/Fhourstones-3.1/TransGame.h:1.1 *** /dev/null Tue Feb 14 00:08:46 2006 --- llvm-test/MultiSource/Benchmarks/Fhourstones-3.1/TransGame.h Tue Feb 14 00:08:34 2006 *************** *** 0 **** --- 1,133 ---- + // Java Fhourstones 3.1 Transposition table logic + // (http://www.cwi.nl/~tromp/c4/fhour.html) + // + // implementation of the well-known game + // usually played on a vertical board of 7 columns by 6 rows, + // where 2 players take turns in dropping counters in a column. + // the first player to get four of his counters + // in a horizontal, vertical or diagonal row, wins the game. + // if neither player has won after 42 moves, then the game is drawn. + // + // This software is copyright (c) 1996-2005 by + // John Tromp + // Insulindeweg 908 + // 1095 DX Amsterdam + // Netherlands + // E-mail: tromp at cwi.nl + // + // This notice must not be removed. + // This software must not be sold for profit. + // You may redistribute if your distributees have the + // same rights and restrictions. + + #include "Game.h" + + #define LOCKSIZE 26 + #define TRANSIZE 8306069 + // should be a prime no less than about 2^{SIZE1-LOCKSIZE} + #define SYMMREC 10 // symmetry normalize first SYMMREC moves + #define UNKNOWN 0 + #define LOSS 1 + #define DRAWLOSS 2 + #define DRAW 3 + #define DRAWWIN 4 + #define WIN 5 + #define LOSSWIN 6 + + typedef struct { + unsigned biglock:LOCKSIZE; + unsigned bigwork:6; + unsigned newlock:LOCKSIZE; + unsigned newscore:3; + unsigned bigscore:3; + } hashentry; + + unsigned int htindex, lock; + hashentry *ht; + + uint64 posed; // counts transtore calls + + void trans_init() + { + ht = (hashentry *)calloc(TRANSIZE, sizeof(hashentry)); + } + + void emptyTT() + { + int i; + + for (i=0; i>=H1) + htemp2 = htemp2<

> (SIZE1-LOCKSIZE)); + htindex = (unsigned int)(htemp % TRANSIZE); + } + + int transpose() + { + hashentry he; + int biglock,newlock; + + hash(); + he = ht[htindex]; + if (he.biglock == lock) + return he.bigscore; + if (he.newlock == lock) + return he.newscore; + return UNKNOWN; + } + + void transtore(int x, unsigned int lock, int score, int work) + { + hashentry he; + + posed++; + he = ht[x]; + if (he.biglock == lock || work >= he.bigwork) { + he.biglock = lock; + he.bigscore = score; + he.bigwork = work; + } else { + he.newlock = lock; + he.newscore = score; + } + ht[x] = he; + } + + void htstat() /* some statistics on hash table performance */ + { + int total, i; + int typecnt[8]; /* bound type stats */ + hashentry he; + + for (i=0; i<8; i++) + typecnt[i] = 0; + for (i=0; i 0) { + printf("- %5.3f < %5.3f = %5.3f > %5.3f + %5.3f\n", + typecnt[LOSS]/(double)total, typecnt[DRAWLOSS]/(double)total, + typecnt[DRAW]/(double)total, typecnt[DRAWWIN]/(double)total, + typecnt[WIN]/(double)total); + } + } Index: llvm-test/MultiSource/Benchmarks/Fhourstones-3.1/inputs diff -c /dev/null llvm-test/MultiSource/Benchmarks/Fhourstones-3.1/inputs:1.1 *** /dev/null Tue Feb 14 00:08:46 2006 --- llvm-test/MultiSource/Benchmarks/Fhourstones-3.1/inputs Tue Feb 14 00:08:34 2006 *************** *** 0 **** --- 1,2 ---- + 45461667 + 35333571 Index: llvm-test/MultiSource/Benchmarks/Fhourstones-3.1/inputs_large diff -c /dev/null llvm-test/MultiSource/Benchmarks/Fhourstones-3.1/inputs_large:1.1 *** /dev/null Tue Feb 14 00:08:46 2006 --- llvm-test/MultiSource/Benchmarks/Fhourstones-3.1/inputs_large Tue Feb 14 00:08:34 2006 *************** *** 0 **** --- 1,3 ---- + 45461667 + 35333571 + 13333111 From lattner at cs.uiuc.edu Tue Feb 14 00:11:47 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 14 Feb 2006 00:11:47 -0600 Subject: [llvm-commits] CVS: llvm-test/MultiSource/Benchmarks/Makefile Message-ID: <200602140611.AAA20504@zion.cs.uiuc.edu> Changes in directory llvm-test/MultiSource/Benchmarks: Makefile updated: 1.10 -> 1.11 --- Log message: Add fhourstones 3.1 --- Diffs of the changes: (+2 -1) Makefile | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm-test/MultiSource/Benchmarks/Makefile diff -u llvm-test/MultiSource/Benchmarks/Makefile:1.10 llvm-test/MultiSource/Benchmarks/Makefile:1.11 --- llvm-test/MultiSource/Benchmarks/Makefile:1.10 Mon Apr 11 14:19:16 2005 +++ llvm-test/MultiSource/Benchmarks/Makefile Tue Feb 14 00:11:36 2006 @@ -1,7 +1,8 @@ # MultiSource/Benchmarks Makefile: Build all subdirectories automatically LEVEL = ../.. -PARALLEL_DIRS := Fhourstones McCat Olden OptimizerEval Ptrdist llubenchmark \ +PARALLEL_DIRS := Fhourstones Fhourstones-3.1 \ + McCat Olden OptimizerEval Ptrdist llubenchmark \ sim FreeBench MallocBench Prolangs-C Prolangs-C++ SciMark2-C\ mediabench ASCI_Purple From jeffc at jolt-lang.org Tue Feb 14 00:12:20 2006 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Tue, 14 Feb 2006 00:12:20 -0600 Subject: [llvm-commits] CVS: llvm/win32/doflex.cmd Message-ID: <200602140612.AAA20539@zion.cs.uiuc.edu> Changes in directory llvm/win32: doflex.cmd updated: 1.2 -> 1.3 --- Log message: Match changes to unix build system. --- Diffs of the changes: (+1 -1) doflex.cmd | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/win32/doflex.cmd diff -u llvm/win32/doflex.cmd:1.2 llvm/win32/doflex.cmd:1.3 --- llvm/win32/doflex.cmd:1.2 Wed Oct 26 20:10:37 2005 +++ llvm/win32/doflex.cmd Tue Feb 14 00:12:08 2006 @@ -16,5 +16,5 @@ :noflex echo Flex not found. Using pre-generated files. -copy %~pn3.cpp %2.cpp +copy %~pn3.cpp.cvs %2.cpp exit From lattner at cs.uiuc.edu Tue Feb 14 00:12:32 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 14 Feb 2006 00:12:32 -0600 Subject: [llvm-commits] CVS: llvm-test/LICENSE.TXT Message-ID: <200602140612.AAA20549@zion.cs.uiuc.edu> Changes in directory llvm-test: LICENSE.TXT updated: 1.11 -> 1.12 --- Log message: Add fhourstones --- Diffs of the changes: (+1 -0) LICENSE.TXT | 1 + 1 files changed, 1 insertion(+) Index: llvm-test/LICENSE.TXT diff -u llvm-test/LICENSE.TXT:1.11 llvm-test/LICENSE.TXT:1.12 --- llvm-test/LICENSE.TXT:1.11 Sun Feb 12 00:55:00 2006 +++ llvm-test/LICENSE.TXT Tue Feb 14 00:12:20 2006 @@ -79,6 +79,7 @@ JM: llvm-test/MultiSource/Applications/JM smg2000: llvm-test/MultiSource/Benchmarks/ASCI_Purple/SMG2000 Fhourstones: llvm-test/MultiSource/Benchmarks/Fhourstones +Fhourstones-3.1: llvm-test/MultiSource/Benchmarks/Fhourstones-3.1 McCat: llvm-test/MultiSource/Benchmarks/McCat Olden: llvm-test/MultiSource/Benchmarks/Olden OptimizerEval: llvm-test/MultiSource/Benchmarks/OptimizerEval From evan.cheng at apple.com Tue Feb 14 02:08:11 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 14 Feb 2006 02:08:11 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86Subtarget.cpp Message-ID: <200602140808.CAA21591@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86Subtarget.cpp updated: 1.21 -> 1.22 --- Log message: Enable SSE (for the right subtargets) --- Diffs of the changes: (+3 -6) X86Subtarget.cpp | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-) Index: llvm/lib/Target/X86/X86Subtarget.cpp diff -u llvm/lib/Target/X86/X86Subtarget.cpp:1.21 llvm/lib/Target/X86/X86Subtarget.cpp:1.22 --- llvm/lib/Target/X86/X86Subtarget.cpp:1.21 Sat Jan 28 14:30:18 2006 +++ llvm/lib/Target/X86/X86Subtarget.cpp Tue Feb 14 02:07:58 2006 @@ -16,11 +16,10 @@ #include "X86GenSubtarget.inc" using namespace llvm; -// FIXME: temporary. #include "llvm/Support/CommandLine.h" namespace { - cl::opt EnableSSE("enable-x86-sse", cl::Hidden, - cl::desc("Enable sse on X86")); + cl::opt DisableSSE("disable-x86-sse", cl::Hidden, + cl::desc("Disable sse on X86")); } /// GetCpuIDAndInfo - Execute the specified cpuid and return the 4 values in the @@ -167,9 +166,7 @@ // Default to ELF unless otherwise specified. TargetType = isELF; - // FIXME: Force these off until they work. An llc-beta option should turn - // them back on. - if (!EnableSSE) { + if (DisableSSE) { X86SSELevel = NoMMXSSE; X863DNowLevel = NoThreeDNow; } From evan.cheng at apple.com Tue Feb 14 02:09:18 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 14 Feb 2006 02:09:18 -0600 Subject: [llvm-commits] CVS: llvm-test/Makefile.programs Message-ID: <200602140809.CAA21819@zion.cs.uiuc.edu> Changes in directory llvm-test: Makefile.programs updated: 1.191 -> 1.192 --- Log message: Set -enable-x86-fastcc as X86 llc-beta option --- Diffs of the changes: (+1 -1) Makefile.programs | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-test/Makefile.programs diff -u llvm-test/Makefile.programs:1.191 llvm-test/Makefile.programs:1.192 --- llvm-test/Makefile.programs:1.191 Thu Feb 9 14:01:19 2006 +++ llvm-test/Makefile.programs Tue Feb 14 02:09:05 2006 @@ -197,7 +197,7 @@ LLCBETAOPTION := -sched=simple endif ifeq ($(ARCH),x86) -LLCBETAOPTION := -enable-x86-sse +LLCBETAOPTION := -enable-x86-fastcc endif ifeq ($(ARCH),Sparc) LLCBETAOPTION := -enable-sparc-v9-insts From evan.cheng at apple.com Tue Feb 14 02:22:51 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 14 Feb 2006 02:22:51 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200602140822.CAA25459@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.153 -> 1.154 --- Log message: Expand memset dst, c, size to a series of stores if size falls below the target specific theshold, e.g. 16 for x86. --- Diffs of the changes: (+127 -4) SelectionDAGISel.cpp | 131 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 127 insertions(+), 4 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.153 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.154 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.153 Mon Feb 13 23:39:35 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Feb 14 02:22:34 2006 @@ -1523,13 +1523,136 @@ DAG.setRoot(Result.second); } +/// getMemSetValue - Vectorized representation of the memset value +/// operand. +static SDOperand getMemsetValue(SDOperand Value, MVT::ValueType VT, + SelectionDAG &DAG) { + if (VT == MVT::i8) + return Value; + + MVT::ValueType CurVT = VT; + if (ConstantSDNode *C = dyn_cast(Value)) { + uint64_t Val = C->getValue() & 255; + unsigned Shift = 8; + while (CurVT != MVT::i8) { + Val = (Val << Shift) | Val; + Shift <<= 1; + CurVT = (MVT::ValueType)((unsigned)CurVT - 1); + assert(MVT::isInteger(CurVT)); + } + return DAG.getConstant(Val, VT); + } else { + Value = DAG.getNode(ISD::ZERO_EXTEND, VT, Value); + unsigned Shift = 8; + while (CurVT != MVT::i8) { + Value = + DAG.getNode(ISD::OR, VT, + DAG.getNode(ISD::SHL, VT, Value, + DAG.getConstant(Shift, MVT::i8)), Value); + Shift <<= 1; + CurVT = (MVT::ValueType)((unsigned)CurVT - 1); + assert(MVT::isInteger(CurVT)); + } + + return Value; + } +} + +/// getMemBasePlusOffset - Returns base and offset node for the +static SDOperand getMemBasePlusOffset(SDOperand Base, unsigned Offset, + SelectionDAG &DAG, TargetLowering &TLI) { + MVT::ValueType VT = Base.getValueType(); + return DAG.getNode(ISD::ADD, VT, Base, DAG.getConstant(Offset, VT)); +} + +/// getMemOpTypes - Determines the types of the sequence of +/// memory ops to perform memset / memcpy. +static void getMemOpTypes(std::vector &MemOps, + uint64_t Size, unsigned Align, TargetLowering &TLI) { + MVT::ValueType VT; + + if (TLI.allowsUnalignedMemoryAccesses()) { + VT = MVT::i64; + } else { + switch (Align & 7) { + case 0: + VT = MVT::i64; + break; + case 4: + VT = MVT::i32; + break; + case 2: + VT = MVT::i16; + break; + default: + VT = MVT::i8; + break; + } + } + + while (!TLI.isTypeLegal(VT)) { + VT = (MVT::ValueType)((unsigned)VT - 1); + assert(MVT::isInteger(VT)); + } + + while (Size != 0) { + unsigned VTSize = getSizeInBits(VT) / 8; + while (VTSize > Size) { + VT = (MVT::ValueType)((unsigned)VT - 1); + assert(MVT::isInteger(VT)); + VTSize >>= 1; + } + MemOps.push_back(VT); + Size -= VTSize; + } +} + void SelectionDAGLowering::visitMemIntrinsic(CallInst &I, unsigned Op) { + SDOperand Op1 = getValue(I.getOperand(1)); + SDOperand Op2 = getValue(I.getOperand(2)); + SDOperand Op3 = getValue(I.getOperand(3)); + SDOperand Op4 = getValue(I.getOperand(4)); + unsigned Align = (unsigned)cast(Op4)->getValue(); + if (Align == 0) Align = 1; + + if (ConstantSDNode *Size = dyn_cast(Op3)) { + std::vector MemOps; + getMemOpTypes(MemOps, Size->getValue(), Align, TLI); + unsigned NumMemOps = MemOps.size(); + + // Expand memset / memcpy to a series of load / store ops + // if the size operand falls below a certain threshold. + std::vector OutChains; + switch (Op) { + default: ; // Do nothing for now. + case ISD::MEMSET: { + if (NumMemOps <= TLI.getMaxStoresPerMemSet()) { + unsigned Offset = 0; + for (unsigned i = 0; i < NumMemOps; i++) { + MVT::ValueType VT = MemOps[i]; + unsigned VTSize = getSizeInBits(VT) / 8; + SDOperand Value = getMemsetValue(Op2, VT, DAG); + OutChains. + push_back(DAG.getNode(ISD::STORE, MVT::Other, getRoot(), + Value, + getMemBasePlusOffset(Op1, Offset, DAG, TLI), + DAG.getSrcValue(NULL))); + Offset += VTSize; + } + + DAG.setRoot(DAG.getNode(ISD::TokenFactor, MVT::Other, OutChains)); + return; + } + } + } + } + std::vector Ops; Ops.push_back(getRoot()); - Ops.push_back(getValue(I.getOperand(1))); - Ops.push_back(getValue(I.getOperand(2))); - Ops.push_back(getValue(I.getOperand(3))); - Ops.push_back(getValue(I.getOperand(4))); + Ops.push_back(Op1); + Ops.push_back(Op2); + Ops.push_back(Op3); + Ops.push_back(Op4); DAG.setRoot(DAG.getNode(Op, MVT::Other, Ops)); } From evan.cheng at apple.com Tue Feb 14 02:25:20 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 14 Feb 2006 02:25:20 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200602140825.CAA26318@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.80 -> 1.81 --- Log message: Set maxStoresPerMemSet to 16. Ditto for maxStoresPerMemCpy and maxStoresPerMemMove. Although the last one is not used. --- Diffs of the changes: (+5 -3) X86ISelLowering.cpp | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.80 llvm/lib/Target/X86/X86ISelLowering.cpp:1.81 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.80 Mon Feb 13 03:00:43 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Tue Feb 14 02:25:08 2006 @@ -251,9 +251,11 @@ } computeRegisterProperties(); - maxStoresPerMemSet = 8; // For %llvm.memset -> sequence of stores - maxStoresPerMemCpy = 8; // For %llvm.memcpy -> sequence of stores - maxStoresPerMemMove = 8; // For %llvm.memmove -> sequence of stores + // FIXME: These should be based on subtarget info. Plus, the values should + // be smaller when we are in optimizing for size mode. + maxStoresPerMemSet = 16; // For %llvm.memset -> sequence of stores + maxStoresPerMemCpy = 16; // For %llvm.memcpy -> sequence of stores + maxStoresPerMemMove = 16; // For %llvm.memmove -> sequence of stores allowUnalignedMemoryAccesses = true; // x86 supports it! } From evan.cheng at apple.com Tue Feb 14 02:25:45 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 14 Feb 2006 02:25:45 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/README.txt Message-ID: <200602140825.CAA26479@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: README.txt updated: 1.51 -> 1.52 --- Log message: Add a entry. --- Diffs of the changes: (+17 -0) README.txt | 17 +++++++++++++++++ 1 files changed, 17 insertions(+) Index: llvm/lib/Target/X86/README.txt diff -u llvm/lib/Target/X86/README.txt:1.51 llvm/lib/Target/X86/README.txt:1.52 --- llvm/lib/Target/X86/README.txt:1.51 Thu Feb 9 23:48:15 2006 +++ llvm/lib/Target/X86/README.txt Tue Feb 14 02:25:32 2006 @@ -426,3 +426,20 @@ //===---------------------------------------------------------------------===// Use fisttp to do FP to integer conversion whenever it is available. + +//===---------------------------------------------------------------------===// + +Instead of the following for memset char*, 1, 10: + + movl $16843009, 4(%edx) + movl $16843009, (%edx) + movw $257, 8(%edx) + +It might be better to generate + + movl $16843009, %eax + movl %eax, 4(%edx) + movl %eax, (%edx) + movw al, 8(%edx) + +when we can spare a register. It reduces code size. From evan.cheng at apple.com Tue Feb 14 02:38:48 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 14 Feb 2006 02:38:48 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetLowering.h Message-ID: <200602140838.CAA31118@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetLowering.h updated: 1.48 -> 1.49 --- Log message: Rename maxStoresPerMemSet to maxStoresPerMemset, etc. --- Diffs of the changes: (+6 -6) TargetLowering.h | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) Index: llvm/include/llvm/Target/TargetLowering.h diff -u llvm/include/llvm/Target/TargetLowering.h:1.48 llvm/include/llvm/Target/TargetLowering.h:1.49 --- llvm/include/llvm/Target/TargetLowering.h:1.48 Tue Feb 7 14:13:44 2006 +++ llvm/include/llvm/Target/TargetLowering.h Tue Feb 14 02:38:30 2006 @@ -243,19 +243,19 @@ /// to replace a call to llvm.memset. The value is set by the target at the /// performance threshold for such a replacement. /// @brief Get maximum # of store operations permitted for llvm.memset - unsigned getMaxStoresPerMemSet() const { return maxStoresPerMemSet; } + unsigned getMaxStoresPerMemset() const { return maxStoresPerMemset; } /// This function returns the maximum number of store operations permitted /// to replace a call to llvm.memcpy. The value is set by the target at the /// performance threshold for such a replacement. /// @brief Get maximum # of store operations permitted for llvm.memcpy - unsigned getMaxStoresPerMemCpy() const { return maxStoresPerMemCpy; } + unsigned getMaxStoresPerMemcpy() const { return maxStoresPerMemcpy; } /// This function returns the maximum number of store operations permitted /// to replace a call to llvm.memmove. The value is set by the target at the /// performance threshold for such a replacement. /// @brief Get maximum # of store operations permitted for llvm.memmove - unsigned getMaxStoresPerMemMove() const { return maxStoresPerMemMove; } + unsigned getMaxStoresPerMemmove() const { return maxStoresPerMemmove; } /// This function returns true if the target allows unaligned memory accesses. /// This is used, for example, in situations where an array copy/move/set is @@ -567,7 +567,7 @@ /// with 16-bit alignment would result in four 2-byte stores and one 1-byte /// store. This only applies to setting a constant array of a constant size. /// @brief Specify maximum number of store instructions per memset call. - unsigned maxStoresPerMemSet; + unsigned maxStoresPerMemset; /// When lowering %llvm.memcpy this field specifies the maximum number of /// store operations that may be substituted for a call to memcpy. Targets @@ -579,7 +579,7 @@ /// and one 1-byte store. This only applies to copying a constant array of /// constant size. /// @brief Specify maximum bytes of store instructions per memcpy call. - unsigned maxStoresPerMemCpy; + unsigned maxStoresPerMemcpy; /// When lowering %llvm.memmove this field specifies the maximum number of /// store instructions that may be substituted for a call to memmove. Targets @@ -590,7 +590,7 @@ /// with 8-bit alignment would result in nine 1-byte stores. This only /// applies to copying a constant array of constant size. /// @brief Specify maximum bytes of store instructions per memmove call. - unsigned maxStoresPerMemMove; + unsigned maxStoresPerMemmove; /// This field specifies whether the target machine permits unaligned memory /// accesses. This is used, for example, to determine the size of store From evan.cheng at apple.com Tue Feb 14 02:38:48 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 14 Feb 2006 02:38:48 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/TargetLowering.cpp Message-ID: <200602140838.CAA31115@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: TargetLowering.cpp updated: 1.29 -> 1.30 --- Log message: Rename maxStoresPerMemSet to maxStoresPerMemset, etc. --- Diffs of the changes: (+1 -1) TargetLowering.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/TargetLowering.cpp diff -u llvm/lib/Target/TargetLowering.cpp:1.29 llvm/lib/Target/TargetLowering.cpp:1.30 --- llvm/lib/Target/TargetLowering.cpp:1.29 Fri Feb 3 20:13:02 2006 +++ llvm/lib/Target/TargetLowering.cpp Tue Feb 14 02:38:30 2006 @@ -30,7 +30,7 @@ ShiftAmountTy = SetCCResultTy = PointerTy = getValueType(TD.getIntPtrType()); ShiftAmtHandling = Undefined; memset(RegClassForVT, 0,MVT::LAST_VALUETYPE*sizeof(TargetRegisterClass*)); - maxStoresPerMemSet = maxStoresPerMemCpy = maxStoresPerMemMove = 8; + maxStoresPerMemset = maxStoresPerMemcpy = maxStoresPerMemmove = 8; allowUnalignedMemoryAccesses = false; UseUnderscoreSetJmpLongJmp = false; IntDivIsCheap = false; From evan.cheng at apple.com Tue Feb 14 02:38:48 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 14 Feb 2006 02:38:48 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200602140838.CAA31114@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.81 -> 1.82 --- Log message: Rename maxStoresPerMemSet to maxStoresPerMemset, etc. --- Diffs of the changes: (+3 -3) X86ISelLowering.cpp | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.81 llvm/lib/Target/X86/X86ISelLowering.cpp:1.82 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.81 Tue Feb 14 02:25:08 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Tue Feb 14 02:38:30 2006 @@ -253,9 +253,9 @@ // FIXME: These should be based on subtarget info. Plus, the values should // be smaller when we are in optimizing for size mode. - maxStoresPerMemSet = 16; // For %llvm.memset -> sequence of stores - maxStoresPerMemCpy = 16; // For %llvm.memcpy -> sequence of stores - maxStoresPerMemMove = 16; // For %llvm.memmove -> sequence of stores + maxStoresPerMemset = 16; // For %llvm.memset -> sequence of stores + maxStoresPerMemcpy = 16; // For %llvm.memcpy -> sequence of stores + maxStoresPerMemmove = 16; // For %llvm.memmove -> sequence of stores allowUnalignedMemoryAccesses = true; // x86 supports it! } From evan.cheng at apple.com Tue Feb 14 02:38:48 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 14 Feb 2006 02:38:48 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200602140838.CAA31116@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.154 -> 1.155 --- Log message: Rename maxStoresPerMemSet to maxStoresPerMemset, etc. --- Diffs of the changes: (+1 -1) SelectionDAGISel.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.154 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.155 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.154 Tue Feb 14 02:22:34 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Feb 14 02:38:30 2006 @@ -1626,7 +1626,7 @@ switch (Op) { default: ; // Do nothing for now. case ISD::MEMSET: { - if (NumMemOps <= TLI.getMaxStoresPerMemSet()) { + if (NumMemOps <= TLI.getMaxStoresPerMemset()) { unsigned Offset = 0; for (unsigned i = 0; i < NumMemOps; i++) { MVT::ValueType VT = MemOps[i]; From evan.cheng at apple.com Tue Feb 14 03:12:12 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 14 Feb 2006 03:12:12 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200602140912.DAA21474@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.155 -> 1.156 --- Log message: Fixed a build breakage. --- Diffs of the changes: (+23 -14) SelectionDAGISel.cpp | 37 +++++++++++++++++++++++-------------- 1 files changed, 23 insertions(+), 14 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.155 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.156 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.155 Tue Feb 14 02:38:30 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Feb 14 03:11:59 2006 @@ -1538,7 +1538,6 @@ Val = (Val << Shift) | Val; Shift <<= 1; CurVT = (MVT::ValueType)((unsigned)CurVT - 1); - assert(MVT::isInteger(CurVT)); } return DAG.getConstant(Val, VT); } else { @@ -1551,7 +1550,6 @@ DAG.getConstant(Shift, MVT::i8)), Value); Shift <<= 1; CurVT = (MVT::ValueType)((unsigned)CurVT - 1); - assert(MVT::isInteger(CurVT)); } return Value; @@ -1565,10 +1563,12 @@ return DAG.getNode(ISD::ADD, VT, Base, DAG.getConstant(Offset, VT)); } -/// getMemOpTypes - Determines the types of the sequence of -/// memory ops to perform memset / memcpy. -static void getMemOpTypes(std::vector &MemOps, - uint64_t Size, unsigned Align, TargetLowering &TLI) { +/// MeetMaxMemopRequirement - Determines if the number of memory ops required +/// to replace the memset / memcpy is below the threshold. It also returns the +/// types of the sequence of memory ops to perform memset / memcpy. +static bool MeetMaxMemopRequirement(std::vector &MemOps, + unsigned Limit, + uint64_t Size, unsigned Align, TargetLowering &TLI) { MVT::ValueType VT; if (TLI.allowsUnalignedMemoryAccesses()) { @@ -1590,21 +1590,30 @@ } } - while (!TLI.isTypeLegal(VT)) { - VT = (MVT::ValueType)((unsigned)VT - 1); - assert(MVT::isInteger(VT)); - } + MVT::ValueType LVT = MVT::i64; + while (!TLI.isTypeLegal(LVT)) + LVT = (MVT::ValueType)((unsigned)LVT - 1); + assert(MVT::isInteger(LVT)); + if (VT > LVT) + VT = LVT; + + unsigned NumMemOps; while (Size != 0) { unsigned VTSize = getSizeInBits(VT) / 8; while (VTSize > Size) { VT = (MVT::ValueType)((unsigned)VT - 1); - assert(MVT::isInteger(VT)); VTSize >>= 1; } + assert(MVT::isInteger(VT)); + + if (++NumMemOps > Limit) + return false; MemOps.push_back(VT); Size -= VTSize; } + + return true; } void SelectionDAGLowering::visitMemIntrinsic(CallInst &I, unsigned Op) { @@ -1617,8 +1626,6 @@ if (ConstantSDNode *Size = dyn_cast(Op3)) { std::vector MemOps; - getMemOpTypes(MemOps, Size->getValue(), Align, TLI); - unsigned NumMemOps = MemOps.size(); // Expand memset / memcpy to a series of load / store ops // if the size operand falls below a certain threshold. @@ -1626,7 +1633,9 @@ switch (Op) { default: ; // Do nothing for now. case ISD::MEMSET: { - if (NumMemOps <= TLI.getMaxStoresPerMemset()) { + if (MeetMaxMemopRequirement(MemOps, TLI.getMaxStoresPerMemset(), + Size->getValue(), Align, TLI)) { + unsigned NumMemOps = MemOps.size(); unsigned Offset = 0; for (unsigned i = 0; i < NumMemOps; i++) { MVT::ValueType VT = MemOps[i]; From evan.cheng at apple.com Tue Feb 14 13:46:09 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 14 Feb 2006 13:46:09 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200602141946.NAA06575@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.156 -> 1.157 --- Log message: Missed a break so memcpy cases fell through to memset. Doh. --- Diffs of the changes: (+1 -1) SelectionDAGISel.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.156 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.157 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.156 Tue Feb 14 03:11:59 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Feb 14 13:45:56 2006 @@ -1631,7 +1631,7 @@ // if the size operand falls below a certain threshold. std::vector OutChains; switch (Op) { - default: ; // Do nothing for now. + default: break; // Do nothing for now. case ISD::MEMSET: { if (MeetMaxMemopRequirement(MemOps, TLI.getMaxStoresPerMemset(), Size->getValue(), Align, TLI)) { From evan.cheng at apple.com Tue Feb 14 14:12:50 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 14 Feb 2006 14:12:50 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200602142012.OAA06768@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.157 -> 1.158 --- Log message: Keep to < 80 cols --- Diffs of the changes: (+6 -6) SelectionDAGISel.cpp | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.157 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.158 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.157 Tue Feb 14 13:45:56 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Feb 14 14:12:38 2006 @@ -1563,12 +1563,12 @@ return DAG.getNode(ISD::ADD, VT, Base, DAG.getConstant(Offset, VT)); } -/// MeetMaxMemopRequirement - Determines if the number of memory ops required +/// MeetsMaxMemopRequirement - Determines if the number of memory ops required /// to replace the memset / memcpy is below the threshold. It also returns the /// types of the sequence of memory ops to perform memset / memcpy. -static bool MeetMaxMemopRequirement(std::vector &MemOps, - unsigned Limit, - uint64_t Size, unsigned Align, TargetLowering &TLI) { +static bool MeetsMaxMemopRequirement(std::vector &MemOps, + unsigned Limit, uint64_t Size, + unsigned Align, TargetLowering &TLI) { MVT::ValueType VT; if (TLI.allowsUnalignedMemoryAccesses()) { @@ -1633,8 +1633,8 @@ switch (Op) { default: break; // Do nothing for now. case ISD::MEMSET: { - if (MeetMaxMemopRequirement(MemOps, TLI.getMaxStoresPerMemset(), - Size->getValue(), Align, TLI)) { + if (MeetsMaxMemopRequirement(MemOps, TLI.getMaxStoresPerMemset(), + Size->getValue(), Align, TLI)) { unsigned NumMemOps = MemOps.size(); unsigned Offset = 0; for (unsigned i = 0; i < NumMemOps; i++) { From lattner at cs.uiuc.edu Tue Feb 14 14:14:28 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 14 Feb 2006 14:14:28 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/LoopInfo.cpp Message-ID: <200602142014.OAA06832@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: LoopInfo.cpp updated: 1.67 -> 1.68 --- Log message: add an assert --- Diffs of the changes: (+2 -1) LoopInfo.cpp | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/Analysis/LoopInfo.cpp diff -u llvm/lib/Analysis/LoopInfo.cpp:1.67 llvm/lib/Analysis/LoopInfo.cpp:1.68 --- llvm/lib/Analysis/LoopInfo.cpp:1.67 Sat Jan 14 14:55:08 2006 +++ llvm/lib/Analysis/LoopInfo.cpp Tue Feb 14 14:14:17 2006 @@ -367,7 +367,8 @@ Out = *PI; } - // Make sure there is only one exit out of the preheader... + // Make sure there is only one exit out of the preheader. + assert(Out && "Header of loop has no predecessors from outside loop?"); succ_iterator SI = succ_begin(Out); ++SI; if (SI != succ_end(Out)) From evan.cheng at apple.com Tue Feb 14 14:30:26 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 14 Feb 2006 14:30:26 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86Subtarget.cpp Message-ID: <200602142030.OAA06905@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86Subtarget.cpp updated: 1.22 -> 1.23 --- Log message: Remove -disable-x86-sse --- Diffs of the changes: (+2 -10) X86Subtarget.cpp | 12 ++---------- 1 files changed, 2 insertions(+), 10 deletions(-) Index: llvm/lib/Target/X86/X86Subtarget.cpp diff -u llvm/lib/Target/X86/X86Subtarget.cpp:1.22 llvm/lib/Target/X86/X86Subtarget.cpp:1.23 --- llvm/lib/Target/X86/X86Subtarget.cpp:1.22 Tue Feb 14 02:07:58 2006 +++ llvm/lib/Target/X86/X86Subtarget.cpp Tue Feb 14 14:30:14 2006 @@ -16,12 +16,6 @@ #include "X86GenSubtarget.inc" using namespace llvm; -#include "llvm/Support/CommandLine.h" -namespace { - cl::opt DisableSSE("disable-x86-sse", cl::Hidden, - cl::desc("Disable sse on X86")); -} - /// GetCpuIDAndInfo - Execute the specified cpuid and return the 4 values in the /// specified arguments. If we can't run cpuid on the host, return true. static bool GetCpuIDAndInfo(unsigned value, unsigned *rEAX, unsigned *rEBX, @@ -166,10 +160,8 @@ // Default to ELF unless otherwise specified. TargetType = isELF; - if (DisableSSE) { - X86SSELevel = NoMMXSSE; - X863DNowLevel = NoThreeDNow; - } + X86SSELevel = NoMMXSSE; + X863DNowLevel = NoThreeDNow; // Set the boolean corresponding to the current target triple, or the default // if one cannot be determined, to true. From evan.cheng at apple.com Tue Feb 14 14:37:49 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 14 Feb 2006 14:37:49 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86Subtarget.cpp Message-ID: <200602142037.OAA06928@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86Subtarget.cpp updated: 1.23 -> 1.24 --- Log message: Duh --- Diffs of the changes: (+0 -3) X86Subtarget.cpp | 3 --- 1 files changed, 3 deletions(-) Index: llvm/lib/Target/X86/X86Subtarget.cpp diff -u llvm/lib/Target/X86/X86Subtarget.cpp:1.23 llvm/lib/Target/X86/X86Subtarget.cpp:1.24 --- llvm/lib/Target/X86/X86Subtarget.cpp:1.23 Tue Feb 14 14:30:14 2006 +++ llvm/lib/Target/X86/X86Subtarget.cpp Tue Feb 14 14:37:37 2006 @@ -160,9 +160,6 @@ // Default to ELF unless otherwise specified. TargetType = isELF; - X86SSELevel = NoMMXSSE; - X863DNowLevel = NoThreeDNow; - // Set the boolean corresponding to the current target triple, or the default // if one cannot be determined, to true. const std::string& TT = M.getTargetTriple(); From lattner at cs.uiuc.edu Tue Feb 14 14:42:45 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 14 Feb 2006 14:42:45 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Message-ID: <200602142042.OAA06977@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCAsmPrinter.cpp updated: 1.149 -> 1.150 --- Log message: Make sure that weak functions are aligned properly --- Diffs of the changes: (+1 -2) PPCAsmPrinter.cpp | 3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.149 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.150 --- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.149 Wed Feb 8 17:42:22 2006 +++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Tue Feb 14 14:42:33 2006 @@ -464,11 +464,9 @@ default: assert(0 && "Unknown linkage type!"); case Function::InternalLinkage: // Symbols default to internal. SwitchSection(".text", F); - EmitAlignment(4, F); break; case Function::ExternalLinkage: SwitchSection(".text", F); - EmitAlignment(4, F); O << "\t.globl\t" << CurrentFnName << "\n"; break; case Function::WeakLinkage: @@ -479,6 +477,7 @@ O << "\t.weak_definition\t" << CurrentFnName << "\n"; break; } + EmitAlignment(4, F); O << CurrentFnName << ":\n"; // Print out code for the function. From evan.cheng at apple.com Tue Feb 14 15:45:36 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 14 Feb 2006 15:45:36 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86CodeEmitter.cpp Message-ID: <200602142145.PAA07403@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86CodeEmitter.cpp updated: 1.87 -> 1.88 --- Log message: Bug fix: XS, XD prefixes were being emitted twice. XMM registers were not being handled. --- Diffs of the changes: (+9 -9) X86CodeEmitter.cpp | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-) Index: llvm/lib/Target/X86/X86CodeEmitter.cpp diff -u llvm/lib/Target/X86/X86CodeEmitter.cpp:1.87 llvm/lib/Target/X86/X86CodeEmitter.cpp:1.88 --- llvm/lib/Target/X86/X86CodeEmitter.cpp:1.87 Wed Feb 1 00:13:50 2006 +++ llvm/lib/Target/X86/X86CodeEmitter.cpp Tue Feb 14 15:45:24 2006 @@ -186,6 +186,11 @@ case X86::ST0: case X86::ST1: case X86::ST2: case X86::ST3: case X86::ST4: case X86::ST5: case X86::ST6: case X86::ST7: return RegNo-X86::ST0; + + case X86::XMM0: case X86::XMM1: case X86::XMM2: case X86::XMM3: + case X86::XMM4: case X86::XMM5: case X86::XMM6: case X86::XMM7: + return RegNo-X86::XMM0; + default: assert(MRegisterInfo::isVirtualRegister(RegNo) && "Unknown physical register!"); @@ -371,21 +376,16 @@ case X86II::TB: MCE.emitByte(0x0F); // Two-byte opcode prefix break; - case X86II::REP: break; // already handled. - case X86II::XS: // F3 0F - MCE.emitByte(0xF3); - MCE.emitByte(0x0F); - break; - case X86II::XD: // F2 0F - MCE.emitByte(0xF2); - MCE.emitByte(0x0F); - break; case X86II::D8: case X86II::D9: case X86II::DA: case X86II::DB: case X86II::DC: case X86II::DD: case X86II::DE: case X86II::DF: MCE.emitByte(0xD8+ (((Desc.TSFlags & X86II::Op0Mask)-X86II::D8) >> X86II::Op0Shift)); break; // Two-byte opcode prefix + case X86II::REP: + case X86II::XS: + case X86II::XD: + break; // already handled. default: assert(0 && "Invalid prefix!"); case 0: break; // No prefix! } From evan.cheng at apple.com Tue Feb 14 15:53:02 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 14 Feb 2006 15:53:02 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86CodeEmitter.cpp Message-ID: <200602142153.PAA07424@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86CodeEmitter.cpp updated: 1.88 -> 1.89 --- Log message: Don't special case XS, XD prefixes. --- Diffs of the changes: (+9 -14) X86CodeEmitter.cpp | 23 +++++++++-------------- 1 files changed, 9 insertions(+), 14 deletions(-) Index: llvm/lib/Target/X86/X86CodeEmitter.cpp diff -u llvm/lib/Target/X86/X86CodeEmitter.cpp:1.88 llvm/lib/Target/X86/X86CodeEmitter.cpp:1.89 --- llvm/lib/Target/X86/X86CodeEmitter.cpp:1.88 Tue Feb 14 15:45:24 2006 +++ llvm/lib/Target/X86/X86CodeEmitter.cpp Tue Feb 14 15:52:51 2006 @@ -362,30 +362,25 @@ // Emit the operand size opcode prefix as needed. if (Desc.TSFlags & X86II::OpSize) MCE.emitByte(0x66); - // Emit the double precision sse fp opcode prefix as needed. - if ((Desc.TSFlags & X86II::Op0Mask) == X86II::XD) { - MCE.emitByte(0xF2); MCE.emitByte(0x0F); - } - - // Emit the double precision sse fp opcode prefix as needed. - if ((Desc.TSFlags & X86II::Op0Mask) == X86II::XS) { - MCE.emitByte(0xF3); MCE.emitByte(0x0F); - } - switch (Desc.TSFlags & X86II::Op0Mask) { case X86II::TB: MCE.emitByte(0x0F); // Two-byte opcode prefix break; + case X86II::REP: break; // already handled. + case X86II::XS: // F3 0F + MCE.emitByte(0xF3); + MCE.emitByte(0x0F); + break; + case X86II::XD: // F2 0F + MCE.emitByte(0xF2); + MCE.emitByte(0x0F); + break; case X86II::D8: case X86II::D9: case X86II::DA: case X86II::DB: case X86II::DC: case X86II::DD: case X86II::DE: case X86II::DF: MCE.emitByte(0xD8+ (((Desc.TSFlags & X86II::Op0Mask)-X86II::D8) >> X86II::Op0Shift)); break; // Two-byte opcode prefix - case X86II::REP: - case X86II::XS: - case X86II::XD: - break; // already handled. default: assert(0 && "Invalid prefix!"); case 0: break; // No prefix! } From jlaskey at apple.com Tue Feb 14 16:02:09 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 14 Feb 2006 16:02:09 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/DwarfWriter.cpp Message-ID: <200602142202.QAA07531@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: DwarfWriter.cpp updated: 1.25 -> 1.26 --- Log message: Using wrong DW_FORM. --- Diffs of the changes: (+1 -1) DwarfWriter.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/DwarfWriter.cpp diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.25 llvm/lib/CodeGen/DwarfWriter.cpp:1.26 --- llvm/lib/CodeGen/DwarfWriter.cpp:1.25 Mon Feb 6 09:33:21 2006 +++ llvm/lib/CodeGen/DwarfWriter.cpp Tue Feb 14 16:01:57 2006 @@ -941,7 +941,7 @@ // construct the type DIE. TypeDie = new DIE(DW_TAG_base_type, DW_CHILDREN_no); TypeDie->AddString(DW_AT_name, DW_FORM_string, Name); - TypeDie->AddUInt (DW_AT_byte_size, DW_FORM_data1, Size); + TypeDie->AddUInt (DW_AT_byte_size, 0, Size); TypeDie->AddUInt (DW_AT_encoding, DW_FORM_data1, Encoding); TypeDie->Complete(DW); From lattner at cs.uiuc.edu Tue Feb 14 16:18:35 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 14 Feb 2006 16:18:35 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Message-ID: <200602142218.QAA07629@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCAsmPrinter.cpp updated: 1.150 -> 1.151 --- Log message: If we have zero initialized data with external linkage, use .zerofill to emit it (instead of .space), saving a bit of space in the .o file. For example: int foo[100]; int bar[100] = {}; when compiled with C++ or -fno-common results in shrinkage from 1160 to 360 bytes of space. The X86 backend can also do this on darwin. --- Diffs of the changes: (+11 -4) PPCAsmPrinter.cpp | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-) Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.150 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.151 --- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.150 Tue Feb 14 14:42:33 2006 +++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Tue Feb 14 16:18:23 2006 @@ -539,13 +539,20 @@ if (C->isNullValue() && /* FIXME: Verify correct */ (I->hasInternalLinkage() || I->hasWeakLinkage() || - I->hasLinkOnceLinkage())) { - SwitchSection(".data", I); + I->hasLinkOnceLinkage() || + (I->hasExternalLinkage() && !I->hasSection()))) { if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it. - if (I->hasInternalLinkage()) + if (I->hasExternalLinkage()) { + O << "\t.globl " << name << '\n'; + O << "\t.zerofill __DATA, __common, " << name << ", " + << Size << ", " << Align; + } else if (I->hasInternalLinkage()) { + SwitchSection(".data", I); O << LCOMMDirective << name << "," << Size << "," << Align; - else + } else { + SwitchSection(".data", I); O << ".comm " << name << "," << Size; + } O << "\t\t; '" << I->getName() << "'\n"; } else { switch (I->getLinkage()) { From lattner at cs.uiuc.edu Tue Feb 14 16:20:06 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 14 Feb 2006 16:20:06 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/README.txt Message-ID: <200602142220.QAA07699@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: README.txt updated: 1.52 -> 1.53 --- Log message: new note --- Diffs of the changes: (+5 -0) README.txt | 5 +++++ 1 files changed, 5 insertions(+) Index: llvm/lib/Target/X86/README.txt diff -u llvm/lib/Target/X86/README.txt:1.52 llvm/lib/Target/X86/README.txt:1.53 --- llvm/lib/Target/X86/README.txt:1.52 Tue Feb 14 02:25:32 2006 +++ llvm/lib/Target/X86/README.txt Tue Feb 14 16:19:54 2006 @@ -443,3 +443,8 @@ movw al, 8(%edx) when we can spare a register. It reduces code size. + +//===---------------------------------------------------------------------===// + +Use .zerofill on x86/darwin when appropriate. + From lattner at cs.uiuc.edu Tue Feb 14 16:34:20 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 14 Feb 2006 16:34:20 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/LoopSimplify.cpp Message-ID: <200602142234.QAA07791@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: LoopSimplify.cpp updated: 1.67 -> 1.68 --- Log message: When splitting exit edges to canonicalize loops, make sure to put the new block in the appropriate loop nest. Third time is the charm, right? --- Diffs of the changes: (+20 -18) LoopSimplify.cpp | 38 ++++++++++++++++++++------------------ 1 files changed, 20 insertions(+), 18 deletions(-) Index: llvm/lib/Transforms/Utils/LoopSimplify.cpp diff -u llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.67 llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.68 --- llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.67 Sat Feb 11 19:59:10 2006 +++ llvm/lib/Transforms/Utils/LoopSimplify.cpp Tue Feb 14 16:34:08 2006 @@ -57,6 +57,7 @@ // AA - If we have an alias analysis object to update, this is it, otherwise // this is null. AliasAnalysis *AA; + LoopInfo *LI; virtual bool runOnFunction(Function &F); @@ -100,10 +101,10 @@ /// bool LoopSimplify::runOnFunction(Function &F) { bool Changed = false; - LoopInfo &LI = getAnalysis(); + LI = &getAnalysis(); AA = getAnalysisToUpdate(); - for (LoopInfo::iterator I = LI.begin(), E = LI.end(); I != E; ++I) + for (LoopInfo::iterator I = LI->begin(), E = LI->end(); I != E; ++I) Changed |= ProcessLoop(*I); return Changed; @@ -159,9 +160,8 @@ // predecessors from outside of the loop, split the edge now. std::vector ExitBlocks; L->getExitBlocks(ExitBlocks); - + SetVector ExitBlockSet(ExitBlocks.begin(), ExitBlocks.end()); - LoopInfo &LI = getAnalysis(); for (SetVector::iterator I = ExitBlockSet.begin(), E = ExitBlockSet.end(); I != E; ++I) { BasicBlock *ExitBlock = *I; @@ -326,7 +326,7 @@ // We know that we have loop information to update... update it now. if (Loop *Parent = L->getParentLoop()) - Parent->addBasicBlockToLoop(NewBB, getAnalysis()); + Parent->addBasicBlockToLoop(NewBB, *LI); DominatorSet &DS = getAnalysis(); // Update dominator info DominatorTree &DT = getAnalysis(); @@ -414,8 +414,6 @@ /// blocks. This method is used to split exit blocks that have predecessors /// outside of the loop. BasicBlock *LoopSimplify::RewriteLoopExitBlock(Loop *L, BasicBlock *Exit) { - DominatorSet &DS = getAnalysis(); - std::vector LoopBlocks; for (pred_iterator I = pred_begin(Exit), E = pred_end(Exit); I != E; ++I) if (L->contains(*I)) @@ -424,10 +422,16 @@ assert(!LoopBlocks.empty() && "No edges coming in from outside the loop?"); BasicBlock *NewBB = SplitBlockPredecessors(Exit, ".loopexit", LoopBlocks); - // Update Loop Information - we know that the new block will be in the parent - // loop of L. - if (Loop *Parent = L->getParentLoop()) - Parent->addBasicBlockToLoop(NewBB, getAnalysis()); + // Update Loop Information - we know that the new block will be in whichever + // loop the Exit block is in. Note that it may not be in that immediate loop, + // if the successor is some other loop header. In that case, we continue + // walking up the loop tree to find a loop that contains both the successor + // block and the predecessor block. + Loop *SuccLoop = LI->getLoopFor(Exit); + while (SuccLoop && !SuccLoop->contains(L->getHeader())) + SuccLoop = SuccLoop->getParentLoop(); + if (SuccLoop) + SuccLoop->addBasicBlockToLoop(NewBB, *LI); // Update dominator information (set, immdom, domtree, and domfrontier) UpdateDomInfoForRevectoredPreds(NewBB, LoopBlocks); @@ -511,17 +515,15 @@ // Create the new outer loop. Loop *NewOuter = new Loop(); - LoopInfo &LI = getAnalysis(); - // Change the parent loop to use the outer loop as its child now. if (Loop *Parent = L->getParentLoop()) Parent->replaceChildLoopWith(L, NewOuter); else - LI.changeTopLevelLoop(L, NewOuter); + LI->changeTopLevelLoop(L, NewOuter); // This block is going to be our new header block: add it to this loop and all // parent loops. - NewOuter->addBasicBlockToLoop(NewBB, getAnalysis()); + NewOuter->addBasicBlockToLoop(NewBB, *LI); // L is now a subloop of our outer loop. NewOuter->addChildLoop(L); @@ -553,8 +555,8 @@ if (!BlocksInL.count(BB)) { // Move this block to the parent, updating the exit blocks sets L->removeBlockFromLoop(BB); - if (LI[BB] == L) - LI.changeLoopFor(BB, NewOuter); + if ((*LI)[BB] == L) + LI->changeLoopFor(BB, NewOuter); --i; } } @@ -656,7 +658,7 @@ // Update Loop Information - we know that this block is now in the current // loop and all parent loops. - L->addBasicBlockToLoop(BEBlock, getAnalysis()); + L->addBasicBlockToLoop(BEBlock, *LI); // Update dominator information (set, immdom, domtree, and domfrontier) UpdateDomInfoForRevectoredPreds(BEBlock, BackedgeBlocks); From evan.cheng at apple.com Tue Feb 14 17:06:06 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 14 Feb 2006 17:06:06 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200602142306.RAA13554@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.158 -> 1.159 --- Log message: Doh again! --- Diffs of the changes: (+1 -1) SelectionDAGISel.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.158 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.159 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.158 Tue Feb 14 14:12:38 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Feb 14 17:05:54 2006 @@ -1598,7 +1598,7 @@ if (VT > LVT) VT = LVT; - unsigned NumMemOps; + unsigned NumMemOps = 0; while (Size != 0) { unsigned VTSize = getSizeInBits(VT) / 8; while (VTSize > Size) { From lattner at cs.uiuc.edu Tue Feb 14 17:06:14 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 14 Feb 2006 17:06:14 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/LoopSimplify.cpp Message-ID: <200602142306.RAA13563@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: LoopSimplify.cpp updated: 1.68 -> 1.69 --- Log message: Canonicalize inner loops before outer loops. Inner loop canonicalization can provide work for the outer loop to canonicalize. This fixes a case that breaks unswitching. --- Diffs of the changes: (+5 -4) LoopSimplify.cpp | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) Index: llvm/lib/Transforms/Utils/LoopSimplify.cpp diff -u llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.68 llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.69 --- llvm/lib/Transforms/Utils/LoopSimplify.cpp:1.68 Tue Feb 14 16:34:08 2006 +++ llvm/lib/Transforms/Utils/LoopSimplify.cpp Tue Feb 14 17:06:02 2006 @@ -115,7 +115,11 @@ /// bool LoopSimplify::ProcessLoop(Loop *L) { bool Changed = false; - + // Canonicalize inner loops before outer loops. Inner loop canonicalization + // can provide work for the outer loop to canonicalize. + for (Loop::iterator I = L->begin(), E = L->end(); I != E; ++I) + Changed |= ProcessLoop(*I); + // Check to see that no blocks (other than the header) in the loop have // predecessors that are not in the loop. This is not valid for natural // loops, but can occur if the blocks are unreachable. Since they are @@ -205,9 +209,6 @@ PN->eraseFromParent(); } - for (Loop::iterator I = L->begin(), E = L->end(); I != E; ++I) - Changed |= ProcessLoop(*I); - return Changed; } From lattner at cs.uiuc.edu Tue Feb 14 17:07:41 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 14 Feb 2006 17:07:41 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/LoopUnswitch/2006-02-14-LoopSimplifyCrash.ll Message-ID: <200602142307.RAA13639@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/LoopUnswitch: 2006-02-14-LoopSimplifyCrash.ll added (r1.1) --- Log message: new testcase that broke unswitch due to loopsimplify not doing the right thing. --- Diffs of the changes: (+1705 -0) 2006-02-14-LoopSimplifyCrash.ll | 1705 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 1705 insertions(+) Index: llvm/test/Regression/Transforms/LoopUnswitch/2006-02-14-LoopSimplifyCrash.ll diff -c /dev/null llvm/test/Regression/Transforms/LoopUnswitch/2006-02-14-LoopSimplifyCrash.ll:1.1 *** /dev/null Tue Feb 14 17:07:39 2006 --- llvm/test/Regression/Transforms/LoopUnswitch/2006-02-14-LoopSimplifyCrash.ll Tue Feb 14 17:07:29 2006 *************** *** 0 **** --- 1,1705 ---- + ; RUN: llvm-as < %s | opt -loop-unswitch -disable-output + + target endian = big + target pointersize = 32 + target triple = "powerpc-apple-darwin8.2.0" + deplibs = [ "c", "crtend" ] + %struct.__sFILE = type { ubyte*, int, int, short, short, %struct.__sbuf, int, sbyte*, int (sbyte*)*, int (sbyte*, sbyte*, int)*, long (sbyte*, long, int)*, int (sbyte*, sbyte*, int)*, %struct.__sbuf, %struct.__sFILEX*, int, [3 x ubyte], [1 x ubyte], %struct.__sbuf, int, long } + %struct.__sFILEX = type opaque + %struct.__sbuf = type { ubyte*, int } + %struct.fd_set = type { [32 x int] } + %struct.timeval = type { int, int } + %struct.tm = type { int, int, int, int, int, int, int, int, int, int, sbyte* } + %typedef.CHESS_PATH = type { [65 x int], ubyte, ubyte, ubyte } + %typedef.CHESS_POSITION = type { ulong, ulong, ulong, ulong, ulong, ulong, ulong, ulong, ulong, ulong, ulong, ulong, ulong, ulong, ulong, ulong, ulong, ulong, uint, int, sbyte, sbyte, [64 x sbyte], sbyte, sbyte, sbyte, sbyte, sbyte } + %typedef.HASH_ENTRY = type { ulong, ulong } + %typedef.NEXT_MOVE = type { int, int, int* } + %typedef.PAWN_HASH_ENTRY = type { uint, short, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte, ubyte } + %typedef.SEARCH_POSITION = type { ubyte, sbyte, sbyte, ubyte } + %union.doub0. = type { ulong } + %search = external global %typedef.CHESS_POSITION ; <%typedef.CHESS_POSITION*> [#uses=1] + %w_pawn_attacks = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %b_pawn_attacks = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %knight_attacks = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %bishop_attacks_rl45 = external global [64 x [256 x ulong]] ; <[64 x [256 x ulong]]*> [#uses=0] + %bishop_shift_rl45 = external global [64 x int] ; <[64 x int]*> [#uses=0] + %bishop_attacks_rr45 = external global [64 x [256 x ulong]] ; <[64 x [256 x ulong]]*> [#uses=0] + %bishop_shift_rr45 = external global [64 x int] ; <[64 x int]*> [#uses=0] + %rook_attacks_r0 = external global [64 x [256 x ulong]] ; <[64 x [256 x ulong]]*> [#uses=0] + %rook_attacks_rl90 = external global [64 x [256 x ulong]] ; <[64 x [256 x ulong]]*> [#uses=0] + %king_attacks = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %set_mask = external global [65 x ulong] ; <[65 x ulong]*> [#uses=0] + %first_ones = external global [65536 x ubyte] ; <[65536 x ubyte]*> [#uses=0] + %last_ones = external global [65536 x ubyte] ; <[65536 x ubyte]*> [#uses=0] + %draw_score_is_zero = external global int ; [#uses=0] + %default_draw_score = external global int ; [#uses=0] + %opening = external global int ; [#uses=0] + %middle_game = external global int ; [#uses=0] + %tc_increment = external global int ; [#uses=0] + %tc_time_remaining_opponent = external global int ; [#uses=0] + %.ctor_1 = external global [17 x sbyte] ; <[17 x sbyte]*> [#uses=0] + %input_stream = external global %struct.__sFILE* ; <%struct.__sFILE**> [#uses=0] + %__sF = external global [0 x %struct.__sFILE] ; <[0 x %struct.__sFILE]*> [#uses=1] + %xboard = external global int ; [#uses=0] + %.str_1 = external global [14 x sbyte] ; <[14 x sbyte]*> [#uses=0] + %.str_2 = external global [14 x sbyte] ; <[14 x sbyte]*> [#uses=0] + %buffer = external global [512 x sbyte] ; <[512 x sbyte]*> [#uses=0] + %nargs = external global int ; [#uses=0] + %args = external global [32 x sbyte*] ; <[32 x sbyte*]*> [#uses=0] + %.str_3 = external global [4 x sbyte] ; <[4 x sbyte]*> [#uses=0] + %.str_4 = external global [17 x sbyte] ; <[17 x sbyte]*> [#uses=0] + %.str_5 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_6 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_7 = external global [2 x sbyte] ; <[2 x sbyte]*> [#uses=0] + %.str_8 = external global [2 x sbyte] ; <[2 x sbyte]*> [#uses=0] + %.str_9 = external global [4 x sbyte] ; <[4 x sbyte]*> [#uses=0] + %.str_10 = external global [2 x sbyte] ; <[2 x sbyte]*> [#uses=0] + %.str_11 = external global [2 x sbyte] ; <[2 x sbyte]*> [#uses=0] + %.str_12 = external global [24 x sbyte] ; <[24 x sbyte]*> [#uses=0] + %.str_14 = external global [23 x sbyte] ; <[23 x sbyte]*> [#uses=0] + %position = external global [67 x %typedef.SEARCH_POSITION] ; <[67 x %typedef.SEARCH_POSITION]*> [#uses=0] + %log_file = external global %struct.__sFILE* ; <%struct.__sFILE**> [#uses=0] + %move_number = external global int ; [#uses=0] + %rephead_b = external global ulong* ; [#uses=0] + %replist_b = external global [82 x ulong] ; <[82 x ulong]*> [#uses=0] + %rephead_w = external global ulong* ; [#uses=0] + %replist_w = external global [82 x ulong] ; <[82 x ulong]*> [#uses=0] + %moves_out_of_book = external global int ; [#uses=0] + %largest_positional_score = external global int ; [#uses=0] + %end_game = external global int ; [#uses=0] + %p_values = external global [15 x int] ; <[15 x int]*> [#uses=0] + %clear_mask = external global [65 x ulong] ; <[65 x ulong]*> [#uses=0] + %directions = external global [64 x [64 x sbyte]] ; <[64 x [64 x sbyte]]*> [#uses=0] + %root_wtm = external global int ; [#uses=0] + %all_pawns = external global ulong ; [#uses=0] + %pawn_score = external global %typedef.PAWN_HASH_ENTRY ; <%typedef.PAWN_HASH_ENTRY*> [#uses=0] + %pawn_probes = external global int ; [#uses=0] + %pawn_hits = external global int ; [#uses=0] + %outside_passed = external global [128 x int] ; <[128 x int]*> [#uses=0] + %root_total_black_pieces = external global int ; [#uses=0] + %root_total_white_pawns = external global int ; [#uses=0] + %root_total_white_pieces = external global int ; [#uses=0] + %root_total_black_pawns = external global int ; [#uses=0] + %mask_A7H7 = external global ulong ; [#uses=0] + %mask_B6B7 = external global ulong ; [#uses=0] + %mask_G6G7 = external global ulong ; [#uses=0] + %mask_A2H2 = external global ulong ; [#uses=0] + %mask_B2B3 = external global ulong ; [#uses=0] + %mask_G2G3 = external global ulong ; [#uses=0] + %king_defects_w = external global [64 x sbyte] ; <[64 x sbyte]*> [#uses=0] + %good_bishop_kw = external global ulong ; [#uses=0] + %mask_F3H3 = external global ulong ; [#uses=0] + %file_mask = external global [8 x ulong] ; <[8 x ulong]*> [#uses=0] + %good_bishop_qw = external global ulong ; [#uses=0] + %mask_A3C3 = external global ulong ; [#uses=0] + %king_defects_b = external global [64 x sbyte] ; <[64 x sbyte]*> [#uses=0] + %good_bishop_kb = external global ulong ; [#uses=0] + %mask_F6H6 = external global ulong ; [#uses=0] + %good_bishop_qb = external global ulong ; [#uses=0] + %mask_A6C6 = external global ulong ; [#uses=0] + %square_color = external global [64 x sbyte] ; <[64 x sbyte]*> [#uses=0] + %evaluations = external global uint ; [#uses=0] + %king_value_w = external global [64 x int] ; <[64 x int]*> [#uses=0] + %rank_mask = external global [8 x ulong] ; <[8 x ulong]*> [#uses=0] + %mask_kr_trapped_w = external global [3 x ulong] ; <[3 x ulong]*> [#uses=0] + %mask_qr_trapped_w = external global [3 x ulong] ; <[3 x ulong]*> [#uses=0] + %king_value_b = external global [64 x int] ; <[64 x int]*> [#uses=0] + %mask_kr_trapped_b = external global [3 x ulong] ; <[3 x ulong]*> [#uses=0] + %mask_qr_trapped_b = external global [3 x ulong] ; <[3 x ulong]*> [#uses=0] + %white_outpost = external global [64 x sbyte] ; <[64 x sbyte]*> [#uses=0] + %mask_no_pawn_attacks_b = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %knight_value_w = external global [64 x int] ; <[64 x int]*> [#uses=0] + %black_outpost = external global [64 x sbyte] ; <[64 x sbyte]*> [#uses=0] + %mask_no_pawn_attacks_w = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %knight_value_b = external global [64 x int] ; <[64 x int]*> [#uses=0] + %bishop_value_w = external global [64 x int] ; <[64 x int]*> [#uses=0] + %bishop_mobility_rl45 = external global [64 x [256 x int]] ; <[64 x [256 x int]]*> [#uses=0] + %bishop_mobility_rr45 = external global [64 x [256 x int]] ; <[64 x [256 x int]]*> [#uses=0] + %bishop_value_b = external global [64 x int] ; <[64 x int]*> [#uses=0] + %rook_value_w = external global [64 x int] ; <[64 x int]*> [#uses=0] + %plus8dir = external global [65 x ulong] ; <[65 x ulong]*> [#uses=0] + %mask_abs7_w = external global ulong ; [#uses=0] + %rook_value_b = external global [64 x int] ; <[64 x int]*> [#uses=0] + %minus8dir = external global [65 x ulong] ; <[65 x ulong]*> [#uses=0] + %mask_abs7_b = external global ulong ; [#uses=0] + %queen_value_w = external global [64 x int] ; <[64 x int]*> [#uses=0] + %queen_value_b = external global [64 x int] ; <[64 x int]*> [#uses=0] + %white_minor_pieces = external global ulong ; [#uses=0] + %black_minor_pieces = external global ulong ; [#uses=0] + %not_rook_pawns = external global ulong ; [#uses=0] + %dark_squares = external global ulong ; [#uses=0] + %b_n_mate_dark_squares = external global [64 x int] ; <[64 x int]*> [#uses=0] + %b_n_mate_light_squares = external global [64 x int] ; <[64 x int]*> [#uses=0] + %mate = external global [64 x int] ; <[64 x int]*> [#uses=0] + %first_ones_8bit = external global [256 x ubyte] ; <[256 x ubyte]*> [#uses=0] + %reduced_material_passer = external global [20 x int] ; <[20 x int]*> [#uses=0] + %supported_passer = external global [8 x int] ; <[8 x int]*> [#uses=0] + %passed_pawn_value = external global [8 x int] ; <[8 x int]*> [#uses=0] + %connected_passed = external global [256 x ubyte] ; <[256 x ubyte]*> [#uses=0] + %black_pawn_race_btm = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %white_pawn_race_wtm = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %black_pawn_race_wtm = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %white_pawn_race_btm = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %obstructed = external global [64 x [64 x ulong]] ; <[64 x [64 x ulong]]*> [#uses=0] + %pawn_hash_table = external global %typedef.PAWN_HASH_ENTRY* ; <%typedef.PAWN_HASH_ENTRY**> [#uses=0] + %pawn_hash_mask = external global uint ; [#uses=0] + %pawn_value_w = external global [64 x int] ; <[64 x int]*> [#uses=0] + %mask_pawn_isolated = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %mask_pawn_passed_w = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %mask_pawn_protected_w = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %pawn_value_b = external global [64 x int] ; <[64 x int]*> [#uses=0] + %mask_pawn_passed_b = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %mask_pawn_protected_b = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %unblocked_pawns = external global [9 x int] ; <[9 x int]*> [#uses=0] + %mask_wk_4th = external global ulong ; [#uses=0] + %mask_wk_5th = external global ulong ; [#uses=0] + %mask_wq_4th = external global ulong ; [#uses=0] + %mask_wq_5th = external global ulong ; [#uses=0] + %stonewall_white = external global ulong ; [#uses=0] + %mask_bk_4th = external global ulong ; [#uses=0] + %mask_bk_5th = external global ulong ; [#uses=0] + %mask_bq_5th = external global ulong ; [#uses=0] + %mask_bq_4th = external global ulong ; [#uses=0] + %stonewall_black = external global ulong ; [#uses=0] + %last_ones_8bit = external global [256 x ubyte] ; <[256 x ubyte]*> [#uses=0] + %right_side_mask = external global [8 x ulong] ; <[8 x ulong]*> [#uses=0] + %left_side_empty_mask = external global [8 x ulong] ; <[8 x ulong]*> [#uses=0] + %left_side_mask = external global [8 x ulong] ; <[8 x ulong]*> [#uses=0] + %right_side_empty_mask = external global [8 x ulong] ; <[8 x ulong]*> [#uses=0] + %pv = external global [65 x %typedef.CHESS_PATH] ; <[65 x %typedef.CHESS_PATH]*> [#uses=0] + %history_w = external global [4096 x int] ; <[4096 x int]*> [#uses=0] + %history_b = external global [4096 x int] ; <[4096 x int]*> [#uses=0] + %killer_move1 = external global [65 x int] ; <[65 x int]*> [#uses=0] + %killer_count1 = external global [65 x int] ; <[65 x int]*> [#uses=0] + %killer_move2 = external global [65 x int] ; <[65 x int]*> [#uses=0] + %killer_count2 = external global [65 x int] ; <[65 x int]*> [#uses=0] + %current_move = external global [65 x int] ; <[65 x int]*> [#uses=0] + %init_r90 = external global [64 x int] ; <[64 x int]*> [#uses=0] + %init_l90 = external global [64 x int] ; <[64 x int]*> [#uses=0] + %init_l45 = external global [64 x int] ; <[64 x int]*> [#uses=0] + %init_ul45 = external global [64 x int] ; <[64 x int]*> [#uses=0] + %init_r45 = external global [64 x int] ; <[64 x int]*> [#uses=0] + %init_ur45 = external global [64 x int] ; <[64 x int]*> [#uses=0] + %diagonal_length = external global [64 x int] ; <[64 x int]*> [#uses=0] + %last = external global [65 x int*] ; <[65 x int*]*> [#uses=0] + %move_list = external global [5120 x int] ; <[5120 x int]*> [#uses=0] + %history_file = external global %struct.__sFILE* ; <%struct.__sFILE**> [#uses=0] + %.str_1 = external global [9 x sbyte] ; <[9 x sbyte]*> [#uses=0] + %.str_2 = external global [3 x sbyte] ; <[3 x sbyte]*> [#uses=0] + %.str_3 = external global [32 x sbyte] ; <[32 x sbyte]*> [#uses=0] + %.str_5 = external global [3 x sbyte] ; <[3 x sbyte]*> [#uses=0] + %.str_6 = external global [14 x sbyte] ; <[14 x sbyte]*> [#uses=0] + %trans_ref_wa = external global %typedef.HASH_ENTRY* ; <%typedef.HASH_ENTRY**> [#uses=0] + %hash_table_size = external global int ; [#uses=0] + %trans_ref_wb = external global %typedef.HASH_ENTRY* ; <%typedef.HASH_ENTRY**> [#uses=0] + %trans_ref_ba = external global %typedef.HASH_ENTRY* ; <%typedef.HASH_ENTRY**> [#uses=0] + %trans_ref_bb = external global %typedef.HASH_ENTRY* ; <%typedef.HASH_ENTRY**> [#uses=0] + %pawn_hash_table_size = external global int ; [#uses=0] + %.str_9 = external global [37 x sbyte] ; <[37 x sbyte]*> [#uses=0] + %log_hash = external global int ; [#uses=0] + %log_pawn_hash = external global int ; [#uses=0] + %hash_maska = external global int ; [#uses=0] + %hash_maskb = external global int ; [#uses=0] + %mask_1 = external global ulong ; [#uses=0] + %bishop_attacks = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %queen_attacks = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %plus7dir = external global [65 x ulong] ; <[65 x ulong]*> [#uses=0] + %plus9dir = external global [65 x ulong] ; <[65 x ulong]*> [#uses=0] + %minus7dir = external global [65 x ulong] ; <[65 x ulong]*> [#uses=0] + %minus9dir = external global [65 x ulong] ; <[65 x ulong]*> [#uses=0] + %plus1dir = external global [65 x ulong] ; <[65 x ulong]*> [#uses=0] + %minus1dir = external global [65 x ulong] ; <[65 x ulong]*> [#uses=0] + %rook_attacks = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %king_attacks_1 = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %king_attacks_2 = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %.ctor_1 = external global [64 x int] ; <[64 x int]*> [#uses=0] + %.ctor_2 = external global [64 x int] ; <[64 x int]*> [#uses=0] + %rook_mobility_r0 = external global [64 x [256 x int]] ; <[64 x [256 x int]]*> [#uses=0] + %rook_mobility_rl90 = external global [64 x [256 x int]] ; <[64 x [256 x int]]*> [#uses=0] + %initial_position = external global [80 x sbyte] ; <[80 x sbyte]*> [#uses=5] + "a1.0__" = external global [80 x sbyte] ; <[80 x sbyte]*> [#uses=0] + "a2.1__" = external global [16 x sbyte] ; <[16 x sbyte]*> [#uses=0] + "a3.2__" = external global [16 x sbyte] ; <[16 x sbyte]*> [#uses=0] + "a4.3__" = external global [16 x sbyte] ; <[16 x sbyte]*> [#uses=0] + "a5.4__" = external global [16 x sbyte] ; <[16 x sbyte]*> [#uses=0] + "args.5__" = external global [16 x sbyte*] ; <[16 x sbyte*]*> [#uses=0] + %.str_10 = external global [3 x sbyte] ; <[3 x sbyte]*> [#uses=0] + %w_pawn_random = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %w_pawn_random32 = external global [64 x uint] ; <[64 x uint]*> [#uses=0] + %b_pawn_random = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %b_pawn_random32 = external global [64 x uint] ; <[64 x uint]*> [#uses=0] + %w_knight_random = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %b_knight_random = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %w_bishop_random = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %b_bishop_random = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %w_rook_random = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %b_rook_random = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %w_queen_random = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %b_queen_random = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %w_king_random = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %b_king_random = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %enpassant_random = external global [65 x ulong] ; <[65 x ulong]*> [#uses=0] + %castle_random_w = external global [2 x ulong] ; <[2 x ulong]*> [#uses=0] + %castle_random_b = external global [2 x ulong] ; <[2 x ulong]*> [#uses=0] + %set_mask_rl90 = external global [65 x ulong] ; <[65 x ulong]*> [#uses=0] + %set_mask_rl45 = external global [65 x ulong] ; <[65 x ulong]*> [#uses=0] + %set_mask_rr45 = external global [65 x ulong] ; <[65 x ulong]*> [#uses=0] + %transposition_id = external global sbyte ; [#uses=0] + %mask_2 = external global ulong ; [#uses=0] + %mask_3 = external global ulong ; [#uses=0] + %mask_4 = external global ulong ; [#uses=0] + %mask_8 = external global ulong ; [#uses=0] + %mask_16 = external global ulong ; [#uses=0] + %mask_32 = external global ulong ; [#uses=0] + %mask_72 = external global ulong ; [#uses=0] + %mask_80 = external global ulong ; [#uses=0] + %mask_85 = external global ulong ; [#uses=0] + %mask_96 = external global ulong ; [#uses=0] + %mask_107 = external global ulong ; [#uses=0] + %mask_108 = external global ulong ; [#uses=0] + %mask_112 = external global ulong ; [#uses=0] + %mask_118 = external global ulong ; [#uses=0] + %mask_120 = external global ulong ; [#uses=0] + %mask_121 = external global ulong ; [#uses=0] + %mask_127 = external global ulong ; [#uses=0] + %mask_clear_entry = external global ulong ; [#uses=0] + %clear_mask_rl45 = external global [65 x ulong] ; <[65 x ulong]*> [#uses=0] + %clear_mask_rr45 = external global [65 x ulong] ; <[65 x ulong]*> [#uses=0] + %clear_mask_rl90 = external global [65 x ulong] ; <[65 x ulong]*> [#uses=0] + %right_half_mask = external global ulong ; [#uses=0] + %left_half_mask = external global ulong ; [#uses=0] + %mask_not_rank8 = external global ulong ; [#uses=0] + %mask_not_rank1 = external global ulong ; [#uses=0] + %center = external global ulong ; [#uses=0] + %mask_pawn_connected = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %mask_eptest = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %mask_kingside_attack_w1 = external global ulong ; [#uses=0] + %mask_kingside_attack_w2 = external global ulong ; [#uses=0] + %mask_queenside_attack_w1 = external global ulong ; [#uses=0] + %mask_queenside_attack_w2 = external global ulong ; [#uses=0] + %mask_kingside_attack_b1 = external global ulong ; [#uses=0] + %mask_kingside_attack_b2 = external global ulong ; [#uses=0] + %mask_queenside_attack_b1 = external global ulong ; [#uses=0] + %mask_queenside_attack_b2 = external global ulong ; [#uses=0] + %pawns_cramp_black = external global ulong ; [#uses=0] + %pawns_cramp_white = external global ulong ; [#uses=0] + %light_squares = external global ulong ; [#uses=0] + %mask_left_edge = external global ulong ; [#uses=0] + %mask_right_edge = external global ulong ; [#uses=0] + %mask_advance_2_w = external global ulong ; [#uses=0] + %mask_advance_2_b = external global ulong ; [#uses=0] + %mask_corner_squares = external global ulong ; [#uses=0] + %mask_promotion_threat_w = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %mask_promotion_threat_b = external global [64 x ulong] ; <[64 x ulong]*> [#uses=0] + %promote_mask_w = external global ulong ; [#uses=0] + %promote_mask_b = external global ulong ; [#uses=0] + %mask_a1_corner = external global ulong ; [#uses=0] + %mask_h1_corner = external global ulong ; [#uses=0] + %mask_a8_corner = external global ulong ; [#uses=0] + %mask_h8_corner = external global ulong ; [#uses=0] + %white_center_pawns = external global ulong ; [#uses=0] + %black_center_pawns = external global ulong ; [#uses=0] + %wtm_random = external global [2 x ulong] ; <[2 x ulong]*> [#uses=0] + %endgame_random_w = external global ulong ; [#uses=0] + %endgame_random_b = external global ulong ; [#uses=0] + %w_rooks_random = external global ulong ; [#uses=0] + %b_rooks_random = external global ulong ; [#uses=0] + %.ctor_11 = external global [17 x sbyte] ; <[17 x sbyte]*> [#uses=0] + %.ctor_2 = external global [17 x sbyte] ; <[17 x sbyte]*> [#uses=0] + %.str_1 = external global [4 x sbyte] ; <[4 x sbyte]*> [#uses=0] + %.str_2 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_32 = external global [4 x sbyte] ; <[4 x sbyte]*> [#uses=0] + %.str_4 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_5 = external global [4 x sbyte] ; <[4 x sbyte]*> [#uses=0] + %.str_6 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_7 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_8 = external global [7 x sbyte] ; <[7 x sbyte]*> [#uses=0] + %.str_9 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_10 = external global [7 x sbyte] ; <[7 x sbyte]*> [#uses=0] + %.str_11 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_12 = external global [7 x sbyte] ; <[7 x sbyte]*> [#uses=0] + %.str_13 = external global [15 x sbyte] ; <[15 x sbyte]*> [#uses=0] + %num_ponder_moves = external global int ; [#uses=0] + %ponder_moves = external global [220 x int] ; <[220 x int]*> [#uses=0] + %.str_14 = external global [15 x sbyte] ; <[15 x sbyte]*> [#uses=0] + %.str_15 = external global [22 x sbyte] ; <[22 x sbyte]*> [#uses=0] + %.str_16 = external global [20 x sbyte] ; <[20 x sbyte]*> [#uses=0] + %auto232 = external global int ; [#uses=0] + %puzzling = external global sbyte ; [#uses=0] + %abort_search = external global sbyte ; [#uses=0] + %.str_24 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %wtm = external global int ; [#uses=0] + %.str_3 = external global [15 x sbyte] ; <[15 x sbyte]*> [#uses=0] + %.str_4 = external global [15 x sbyte] ; <[15 x sbyte]*> [#uses=0] + %end_time = external global uint ; [#uses=0] + %time_type = external global uint ; [#uses=0] + %start_time = external global uint ; [#uses=0] + %.str_6 = external global [12 x sbyte] ; <[12 x sbyte]*> [#uses=0] + %.str_7 = external global [4 x sbyte] ; <[4 x sbyte]*> [#uses=0] + %nodes_searched = external global uint ; [#uses=0] + %iteration_depth = external global int ; [#uses=0] + %searched_this_root_move = external global [256 x sbyte] ; <[256 x sbyte]*> [#uses=0] + %.str_9 = external global [8 x sbyte] ; <[8 x sbyte]*> [#uses=0] + %.str_10 = external global [9 x sbyte] ; <[9 x sbyte]*> [#uses=0] + %.str_11 = external global [10 x sbyte] ; <[10 x sbyte]*> [#uses=0] + %.str_12 = external global [12 x sbyte] ; <[12 x sbyte]*> [#uses=0] + %.str_14 = external global [2 x sbyte] ; <[2 x sbyte]*> [#uses=0] + %.str_16 = external global [2 x sbyte] ; <[2 x sbyte]*> [#uses=0] + %thinking = external global sbyte ; [#uses=0] + %time_abort = external global int ; [#uses=0] + %.str_17 = external global [24 x sbyte] ; <[24 x sbyte]*> [#uses=0] + %analyze_move_read = external global int ; [#uses=0] + %analyze_mode = external global int ; [#uses=0] + %pondering = external global sbyte ; [#uses=0] + %auto232_delay = external global int ; [#uses=0] + %auto_file = external global %struct.__sFILE* ; <%struct.__sFILE**> [#uses=0] + %.str_19 = external global [2 x sbyte] ; <[2 x sbyte]*> [#uses=0] + %.str_20 = external global [11 x sbyte] ; <[11 x sbyte]*> [#uses=0] + %.str_21 = external global [4 x sbyte] ; <[4 x sbyte]*> [#uses=0] + %ponder_move = external global int ; [#uses=0] + %predicted = external global int ; [#uses=0] + %made_predicted_move = external global int ; [#uses=0] + %opponent_end_time = external global uint ; [#uses=0] + %program_start_time = external global uint ; [#uses=0] + %.str_23 = external global [22 x sbyte] ; <[22 x sbyte]*> [#uses=0] + %.str_24 = external global [3 x sbyte] ; <[3 x sbyte]*> [#uses=0] + %.str_25 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_26 = external global [3 x sbyte] ; <[3 x sbyte]*> [#uses=0] + %.str_28 = external global [31 x sbyte] ; <[31 x sbyte]*> [#uses=0] + %book_move = external global int ; [#uses=0] + %elapsed_start = external global uint ; [#uses=0] + %burp = external global int ; [#uses=0] + %cpu_percent = external global int ; [#uses=0] + %next_time_check = external global int ; [#uses=0] + %nodes_between_time_checks = external global int ; [#uses=0] + %transposition_hits = external global int ; [#uses=0] + %transposition_probes = external global int ; [#uses=0] + %tb_probes = external global int ; [#uses=0] + %tb_probes_successful = external global int ; [#uses=0] + %check_extensions_done = external global int ; [#uses=0] + %recapture_extensions_done = external global int ; [#uses=0] + %passed_pawn_extensions_done = external global int ; [#uses=0] + %one_reply_extensions_done = external global int ; [#uses=0] + %program_end_time = external global uint ; [#uses=0] + %root_value = external global int ; [#uses=0] + %last_search_value = external global int ; [#uses=0] + %.str_1 = external global [48 x sbyte] ; <[48 x sbyte]*> [#uses=0] + %.str_2 = external global [48 x sbyte] ; <[48 x sbyte]*> [#uses=0] + %booking = external global sbyte ; [#uses=0] + %annotate_mode = external global int ; [#uses=0] + %.str_4 = external global [38 x sbyte] ; <[38 x sbyte]*> [#uses=0] + %.str_5 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %last_pv = external global %typedef.CHESS_PATH ; <%typedef.CHESS_PATH*> [#uses=0] + %.str_8 = external global [53 x sbyte] ; <[53 x sbyte]*> [#uses=0] + %root_alpha = external global int ; [#uses=0] + %last_value = external global int ; [#uses=0] + %root_beta = external global int ; [#uses=0] + %root_nodes = external global [256 x uint] ; <[256 x uint]*> [#uses=0] + %trace_level = external global int ; [#uses=0] + %.str_9 = external global [36 x sbyte] ; <[36 x sbyte]*> [#uses=0] + %.str_10 = external global [37 x sbyte] ; <[37 x sbyte]*> [#uses=0] + %search_failed_high = external global int ; [#uses=0] + %search_failed_low = external global int ; [#uses=0] + %nodes_per_second = external global int ; [#uses=0] + %time_limit = external global int ; [#uses=0] + %easy_move = external global int ; [#uses=0] + %noise_level = external global uint ; [#uses=0] + %.str_12 = external global [34 x sbyte] ; <[34 x sbyte]*> [#uses=0] + %.str_136 = external global [4 x sbyte] ; <[4 x sbyte]*> [#uses=0] + %solution_type = external global int ; [#uses=0] + %number_of_solutions = external global int ; [#uses=0] + %solutions = external global [10 x int] ; <[10 x int]*> [#uses=0] + %early_exit = external global int ; [#uses=0] + %.str_14 = external global [4 x sbyte] ; <[4 x sbyte]*> [#uses=0] + %.str_15 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_16 = external global [8 x sbyte] ; <[8 x sbyte]*> [#uses=0] + %whisper_value = external global int ; [#uses=0] + %.str_17 = external global [29 x sbyte] ; <[29 x sbyte]*> [#uses=0] + %.str_19 = external global [37 x sbyte] ; <[37 x sbyte]*> [#uses=0] + %last_mate_score = external global int ; [#uses=0] + %search_depth = external global int ; [#uses=0] + %elapsed_end = external global uint ; [#uses=0] + %.str_20 = external global [40 x sbyte] ; <[40 x sbyte]*> [#uses=0] + %.str_21 = external global [7 x sbyte] ; <[7 x sbyte]*> [#uses=0] + %.str_22 = external global [13 x sbyte] ; <[13 x sbyte]*> [#uses=0] + %.str_23 = external global [58 x sbyte] ; <[58 x sbyte]*> [#uses=0] + %.str_24 = external global [48 x sbyte] ; <[48 x sbyte]*> [#uses=0] + %.str_25 = external global [67 x sbyte] ; <[67 x sbyte]*> [#uses=0] + %.str_26 = external global [69 x sbyte] ; <[69 x sbyte]*> [#uses=0] + %hash_move = external global [65 x int] ; <[65 x int]*> [#uses=0] + %version = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %mode = external global uint ; [#uses=0] + %batch_mode = external global int ; [#uses=0] + %crafty_rating = external global int ; [#uses=0] + %opponent_rating = external global int ; [#uses=0] + %pgn_event = external global [32 x sbyte] ; <[32 x sbyte]*> [#uses=0] + %pgn_site = external global [32 x sbyte] ; <[32 x sbyte]*> [#uses=0] + %pgn_date = external global [32 x sbyte] ; <[32 x sbyte]*> [#uses=0] + %pgn_round = external global [32 x sbyte] ; <[32 x sbyte]*> [#uses=0] + %pgn_white = external global [64 x sbyte] ; <[64 x sbyte]*> [#uses=0] + %pgn_white_elo = external global [32 x sbyte] ; <[32 x sbyte]*> [#uses=0] + %pgn_black = external global [64 x sbyte] ; <[64 x sbyte]*> [#uses=0] + %pgn_black_elo = external global [32 x sbyte] ; <[32 x sbyte]*> [#uses=0] + %pgn_result = external global [32 x sbyte] ; <[32 x sbyte]*> [#uses=0] + %number_auto_kibitzers = external global int ; [#uses=0] + %auto_kibitz_list = external global [100 x [20 x sbyte]] ; <[100 x [20 x sbyte]]*> [#uses=0] + %number_of_computers = external global int ; [#uses=0] + %computer_list = external global [100 x [20 x sbyte]] ; <[100 x [20 x sbyte]]*> [#uses=0] + %number_of_GMs = external global int ; [#uses=0] + %GM_list = external global [100 x [20 x sbyte]] ; <[100 x [20 x sbyte]]*> [#uses=0] + %number_of_IMs = external global int ; [#uses=0] + %IM_list = external global [100 x [20 x sbyte]] ; <[100 x [20 x sbyte]]*> [#uses=0] + %ics = external global int ; [#uses=0] + %output_format = external global int ; [#uses=0] + %EGTBlimit = external global int ; [#uses=0] + %whisper = external global int ; [#uses=0] + %channel = external global int ; [#uses=0] + %new_game = external global int ; [#uses=0] + %channel_title = external global [32 x sbyte] ; <[32 x sbyte]*> [#uses=0] + %initialized = external global int ; [#uses=0] + %kibitz = external global int ; [#uses=0] + %post = external global int ; [#uses=0] + %log_id = external global int ; [#uses=0] + %crafty_is_white = external global int ; [#uses=0] + %last_opponent_move = external global int ; [#uses=0] + %search_move = external global int ; [#uses=0] + %time_used = external global int ; [#uses=0] + %time_used_opponent = external global int ; [#uses=0] + %auto_kibitzing = external global int ; [#uses=0] + %test_mode = external global int ; [#uses=0] + %resign = external global sbyte ; [#uses=0] + %resign_counter = external global sbyte ; [#uses=0] + %resign_count = external global sbyte ; [#uses=0] + %draw_counter = external global sbyte ; [#uses=0] + %draw_count = external global sbyte ; [#uses=0] + %tc_moves = external global int ; [#uses=0] + %tc_time = external global int ; [#uses=0] + %tc_time_remaining = external global int ; [#uses=0] + %tc_moves_remaining = external global int ; [#uses=0] + %tc_secondary_moves = external global int ; [#uses=0] + %tc_secondary_time = external global int ; [#uses=0] + %tc_sudden_death = external global int ; [#uses=0] + %tc_operator_time = external global int ; [#uses=0] + %tc_safety_margin = external global int ; [#uses=0] + %force = external global int ; [#uses=0] + %over = external global int ; [#uses=0] + %usage_level = external global int ; [#uses=0] + %audible_alarm = external global sbyte ; [#uses=0] + %ansi = external global int ; [#uses=0] + %book_accept_mask = external global int ; [#uses=0] + %book_reject_mask = external global int ; [#uses=0] + %book_random = external global int ; [#uses=0] + %book_search_trigger = external global int ; [#uses=0] + %learning = external global int ; [#uses=0] + %show_book = external global int ; [#uses=0] + %book_selection_width = external global int ; [#uses=0] + %ponder = external global int ; [#uses=0] + %verbosity_level = external global int ; [#uses=0] + %push_extensions = external global [64 x sbyte] ; <[64 x sbyte]*> [#uses=0] + %.str_28 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_3 = external global [43 x sbyte] ; <[43 x sbyte]*> [#uses=0] + %display = external global %typedef.CHESS_POSITION ; <%typedef.CHESS_POSITION*> [#uses=0] + %.str_4 = external global [14 x sbyte] ; <[14 x sbyte]*> [#uses=0] + %opponent_start_time = external global uint ; [#uses=0] + %.str_8 = external global [12 x sbyte] ; <[12 x sbyte]*> [#uses=0] + %.str_9 = external global [12 x sbyte] ; <[12 x sbyte]*> [#uses=0] + %.str_18 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_19 = external global [35 x sbyte] ; <[35 x sbyte]*> [#uses=0] + %.str_2013 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_21 = external global [41 x sbyte] ; <[41 x sbyte]*> [#uses=0] + %.str_22 = external global [29 x sbyte] ; <[29 x sbyte]*> [#uses=0] + %.str_23 = external global [8 x sbyte] ; <[8 x sbyte]*> [#uses=0] + %whisper_text = external global [500 x sbyte] ; <[500 x sbyte]*> [#uses=0] + %.str_24 = external global [4 x sbyte] ; <[4 x sbyte]*> [#uses=0] + %.str_25 = external global [3 x sbyte] ; <[3 x sbyte]*> [#uses=0] + %.str_26 = external global [11 x sbyte] ; <[11 x sbyte]*> [#uses=0] + %.str_28 = external global [13 x sbyte] ; <[13 x sbyte]*> [#uses=0] + %.str_29 = external global [13 x sbyte] ; <[13 x sbyte]*> [#uses=0] + %.str_30 = external global [33 x sbyte] ; <[33 x sbyte]*> [#uses=0] + %.str_31 = external global [2 x sbyte] ; <[2 x sbyte]*> [#uses=0] + %.str_32 = external global [22 x sbyte] ; <[22 x sbyte]*> [#uses=0] + %.str_36 = external global [3 x sbyte] ; <[3 x sbyte]*> [#uses=1] + %.str_37 = external global [15 x sbyte] ; <[15 x sbyte]*> [#uses=0] + %.str_44 = external global [12 x sbyte] ; <[12 x sbyte]*> [#uses=0] + %.str_45 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_49 = external global [15 x sbyte] ; <[15 x sbyte]*> [#uses=0] + %.str_52 = external global [12 x sbyte] ; <[12 x sbyte]*> [#uses=0] + %previous_search_value = external global int ; [#uses=0] + %.str_64 = external global [8 x sbyte] ; <[8 x sbyte]*> [#uses=0] + %whisper_depth = external global int ; [#uses=0] + %.str_65 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_66 = external global [57 x sbyte] ; <[57 x sbyte]*> [#uses=0] + %total_moves = external global int ; [#uses=0] + %book_file = external global %struct.__sFILE* ; <%struct.__sFILE**> [#uses=0] + %books_file = external global %struct.__sFILE* ; <%struct.__sFILE**> [#uses=0] + %book_lrn_file = external global %struct.__sFILE* ; <%struct.__sFILE**> [#uses=0] + %position_file = external global %struct.__sFILE* ; <%struct.__sFILE**> [#uses=0] + %position_lrn_file = external global %struct.__sFILE* ; <%struct.__sFILE**> [#uses=0] + %log_filename = external global [64 x sbyte] ; <[64 x sbyte]*> [#uses=0] + %history_filename = external global [64 x sbyte] ; <[64 x sbyte]*> [#uses=0] + %book_path = external global [128 x sbyte] ; <[128 x sbyte]*> [#uses=0] + %log_path = external global [128 x sbyte] ; <[128 x sbyte]*> [#uses=0] + %tb_path = external global [128 x sbyte] ; <[128 x sbyte]*> [#uses=0] + %cmd_buffer = external global [512 x sbyte] ; <[512 x sbyte]*> [#uses=0] + %root_move = external global int ; [#uses=0] + %hint = external global [16 x sbyte] ; <[16 x sbyte]*> [#uses=0] + %absolute_time_limit = external global int ; [#uses=0] + %search_time_limit = external global int ; [#uses=0] + %in_check = external global [65 x sbyte] ; <[65 x sbyte]*> [#uses=0] + %extended_reason = external global [65 x sbyte] ; <[65 x sbyte]*> [#uses=0] + %current_phase = external global [65 x sbyte] ; <[65 x sbyte]*> [#uses=0] + %sort_value = external global [256 x int] ; <[256 x int]*> [#uses=0] + %next_status = external global [65 x %typedef.NEXT_MOVE] ; <[65 x %typedef.NEXT_MOVE]*> [#uses=0] + %save_hash_key = external global [67 x ulong] ; <[67 x ulong]*> [#uses=0] + %save_pawn_hash_key = external global [67 x uint] ; <[67 x uint]*> [#uses=0] + %pawn_advance = external global [8 x int] ; <[8 x int]*> [#uses=0] + %bit_move = external global ulong ; [#uses=0] + %.str_1 = external global [17 x sbyte] ; <[17 x sbyte]*> [#uses=0] + %.str_2 = external global [36 x sbyte] ; <[36 x sbyte]*> [#uses=0] + %.str_3 = external global [8 x sbyte] ; <[8 x sbyte]*> [#uses=0] + %.str_1 = external global [34 x sbyte] ; <[34 x sbyte]*> [#uses=0] + %.str_2 = external global [46 x sbyte] ; <[46 x sbyte]*> [#uses=0] + %.str_2 = external global [47 x sbyte] ; <[47 x sbyte]*> [#uses=0] + %.str_1 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_2 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_3 = external global [3 x sbyte] ; <[3 x sbyte]*> [#uses=0] + %.str_4 = external global [4 x sbyte] ; <[4 x sbyte]*> [#uses=0] + %.str_5 = external global [22 x sbyte] ; <[22 x sbyte]*> [#uses=0] + %.str_615 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_7 = external global [21 x sbyte] ; <[21 x sbyte]*> [#uses=0] + %.str_10 = external global [8 x sbyte] ; <[8 x sbyte]*> [#uses=0] + %.str_11 = external global [3 x sbyte] ; <[3 x sbyte]*> [#uses=0] + %.str_12 = external global [18 x sbyte] ; <[18 x sbyte]*> [#uses=0] + %.str_1318 = external global [4 x sbyte] ; <[4 x sbyte]*> [#uses=0] + %.str_1419 = external global [2 x sbyte] ; <[2 x sbyte]*> [#uses=0] + %.str_15 = external global [17 x sbyte] ; <[17 x sbyte]*> [#uses=0] + %.str_16 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_19 = external global [22 x sbyte] ; <[22 x sbyte]*> [#uses=0] + %.str_20 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_2222 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_2323 = external global [8 x sbyte] ; <[8 x sbyte]*> [#uses=0] + %.str_25 = external global [29 x sbyte] ; <[29 x sbyte]*> [#uses=0] + %.str_27 = external global [48 x sbyte] ; <[48 x sbyte]*> [#uses=0] + %.str_28 = external global [42 x sbyte] ; <[42 x sbyte]*> [#uses=0] + %.str_29 = external global [64 x sbyte] ; <[64 x sbyte]*> [#uses=0] + %.str_30 = external global [27 x sbyte] ; <[27 x sbyte]*> [#uses=0] + %.str_31 = external global [18 x sbyte] ; <[18 x sbyte]*> [#uses=0] + %.str_32 = external global [40 x sbyte] ; <[40 x sbyte]*> [#uses=0] + %.str_33 = external global [8 x sbyte] ; <[8 x sbyte]*> [#uses=0] + %.str_34 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_35 = external global [40 x sbyte] ; <[40 x sbyte]*> [#uses=0] + %.str_36 = external global [46 x sbyte] ; <[46 x sbyte]*> [#uses=0] + %.str_37 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_38 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_41 = external global [7 x sbyte] ; <[7 x sbyte]*> [#uses=0] + %.str_42 = external global [7 x sbyte] ; <[7 x sbyte]*> [#uses=0] + %.str_43 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_44 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_4525 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_46 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_47 = external global [19 x sbyte] ; <[19 x sbyte]*> [#uses=0] + %.str_48 = external global [35 x sbyte] ; <[35 x sbyte]*> [#uses=0] + %.str_49 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_50 = external global [19 x sbyte] ; <[19 x sbyte]*> [#uses=0] + %.str_51 = external global [25 x sbyte] ; <[25 x sbyte]*> [#uses=0] + %.str_52 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_53 = external global [10 x sbyte] ; <[10 x sbyte]*> [#uses=0] + %.str_54 = external global [23 x sbyte] ; <[23 x sbyte]*> [#uses=0] + %.str_55 = external global [32 x sbyte] ; <[32 x sbyte]*> [#uses=0] + %.str_56 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_57 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_58 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_59 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_60 = external global [3 x sbyte] ; <[3 x sbyte]*> [#uses=0] + %.str_61 = external global [10 x sbyte] ; <[10 x sbyte]*> [#uses=0] + %.str_62 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_63 = external global [16 x sbyte] ; <[16 x sbyte]*> [#uses=0] + %.str_64 = external global [37 x sbyte] ; <[37 x sbyte]*> [#uses=0] + %.str_66 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_67 = external global [21 x sbyte] ; <[21 x sbyte]*> [#uses=0] + %.str_68 = external global [4 x sbyte] ; <[4 x sbyte]*> [#uses=0] + %.str_69 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_71 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_72 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_73 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_74 = external global [22 x sbyte] ; <[22 x sbyte]*> [#uses=0] + %.str_75 = external global [9 x sbyte] ; <[9 x sbyte]*> [#uses=0] + %.str_81 = external global [7 x sbyte] ; <[7 x sbyte]*> [#uses=0] + %.str_83 = external global [8 x sbyte] ; <[8 x sbyte]*> [#uses=0] + %.str_84 = external global [23 x sbyte] ; <[23 x sbyte]*> [#uses=0] + %.str_86 = external global [4 x sbyte] ; <[4 x sbyte]*> [#uses=0] + %.str_87 = external global [8 x sbyte] ; <[8 x sbyte]*> [#uses=0] + %.str_89 = external global [7 x sbyte] ; <[7 x sbyte]*> [#uses=0] + %.str_90 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_91 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_92 = external global [47 x sbyte] ; <[47 x sbyte]*> [#uses=0] + %.str_94 = external global [37 x sbyte] ; <[37 x sbyte]*> [#uses=0] + %.str_95 = external global [33 x sbyte] ; <[33 x sbyte]*> [#uses=0] + %.str_96 = external global [34 x sbyte] ; <[34 x sbyte]*> [#uses=0] + %.str_97 = external global [33 x sbyte] ; <[33 x sbyte]*> [#uses=0] + %.str_98 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_100 = external global [42 x sbyte] ; <[42 x sbyte]*> [#uses=0] + %.str_101 = external global [38 x sbyte] ; <[38 x sbyte]*> [#uses=0] + %.str_102 = external global [39 x sbyte] ; <[39 x sbyte]*> [#uses=0] + %.str_103 = external global [38 x sbyte] ; <[38 x sbyte]*> [#uses=0] + %.str_104 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_105 = external global [8 x sbyte] ; <[8 x sbyte]*> [#uses=0] + %.str_106 = external global [9 x sbyte] ; <[9 x sbyte]*> [#uses=0] + %.str_107 = external global [59 x sbyte] ; <[59 x sbyte]*> [#uses=0] + %.str_108 = external global [57 x sbyte] ; <[57 x sbyte]*> [#uses=0] + %.str_109 = external global [56 x sbyte] ; <[56 x sbyte]*> [#uses=0] + %.str_110 = external global [59 x sbyte] ; <[59 x sbyte]*> [#uses=0] + %.str_111 = external global [54 x sbyte] ; <[54 x sbyte]*> [#uses=0] + %.str_112 = external global [57 x sbyte] ; <[57 x sbyte]*> [#uses=0] + %.str_113 = external global [58 x sbyte] ; <[58 x sbyte]*> [#uses=0] + %.str_114 = external global [9 x sbyte] ; <[9 x sbyte]*> [#uses=0] + %.str_115 = external global [48 x sbyte] ; <[48 x sbyte]*> [#uses=0] + %.str_116 = external global [61 x sbyte] ; <[61 x sbyte]*> [#uses=0] + %.str_117 = external global [60 x sbyte] ; <[60 x sbyte]*> [#uses=0] + %.str_118 = external global [63 x sbyte] ; <[63 x sbyte]*> [#uses=0] + %.str_119 = external global [62 x sbyte] ; <[62 x sbyte]*> [#uses=0] + %.str_120 = external global [63 x sbyte] ; <[63 x sbyte]*> [#uses=0] + %.str_121 = external global [60 x sbyte] ; <[60 x sbyte]*> [#uses=0] + %.str_122 = external global [64 x sbyte] ; <[64 x sbyte]*> [#uses=0] + %.str_123 = external global [61 x sbyte] ; <[61 x sbyte]*> [#uses=0] + %.str_124 = external global [60 x sbyte] ; <[60 x sbyte]*> [#uses=0] + %.str_125 = external global [65 x sbyte] ; <[65 x sbyte]*> [#uses=0] + %.str_126 = external global [65 x sbyte] ; <[65 x sbyte]*> [#uses=0] + %.str_127 = external global [69 x sbyte] ; <[69 x sbyte]*> [#uses=0] + %.str_128 = external global [66 x sbyte] ; <[66 x sbyte]*> [#uses=0] + %.str_129 = external global [61 x sbyte] ; <[61 x sbyte]*> [#uses=0] + %.str_130 = external global [63 x sbyte] ; <[63 x sbyte]*> [#uses=0] + %.str_131 = external global [67 x sbyte] ; <[67 x sbyte]*> [#uses=0] + %.str_132 = external global [63 x sbyte] ; <[63 x sbyte]*> [#uses=0] + %.str_133 = external global [58 x sbyte] ; <[58 x sbyte]*> [#uses=0] + %.str_134 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_135 = external global [57 x sbyte] ; <[57 x sbyte]*> [#uses=0] + %.str_136 = external global [56 x sbyte] ; <[56 x sbyte]*> [#uses=0] + %.str_137 = external global [60 x sbyte] ; <[60 x sbyte]*> [#uses=0] + %.str_138 = external global [60 x sbyte] ; <[60 x sbyte]*> [#uses=0] + %.str_139 = external global [58 x sbyte] ; <[58 x sbyte]*> [#uses=0] + %.str_140 = external global [57 x sbyte] ; <[57 x sbyte]*> [#uses=0] + %.str_141 = external global [60 x sbyte] ; <[60 x sbyte]*> [#uses=0] + %.str_142 = external global [59 x sbyte] ; <[59 x sbyte]*> [#uses=0] + %.str_143 = external global [59 x sbyte] ; <[59 x sbyte]*> [#uses=0] + %.str_144 = external global [62 x sbyte] ; <[62 x sbyte]*> [#uses=0] + %.str_145 = external global [62 x sbyte] ; <[62 x sbyte]*> [#uses=0] + %.str_146 = external global [61 x sbyte] ; <[61 x sbyte]*> [#uses=0] + %.str_147 = external global [60 x sbyte] ; <[60 x sbyte]*> [#uses=0] + %.str_148 = external global [62 x sbyte] ; <[62 x sbyte]*> [#uses=0] + %.str_149 = external global [64 x sbyte] ; <[64 x sbyte]*> [#uses=0] + %.str_150 = external global [65 x sbyte] ; <[65 x sbyte]*> [#uses=0] + %.str_151 = external global [61 x sbyte] ; <[61 x sbyte]*> [#uses=0] + %.str_152 = external global [46 x sbyte] ; <[46 x sbyte]*> [#uses=0] + %.str_153 = external global [8 x sbyte] ; <[8 x sbyte]*> [#uses=0] + %.str_154 = external global [64 x sbyte] ; <[64 x sbyte]*> [#uses=0] + %.str_156 = external global [57 x sbyte] ; <[57 x sbyte]*> [#uses=0] + %.str_157 = external global [31 x sbyte] ; <[31 x sbyte]*> [#uses=0] + %.str_158 = external global [71 x sbyte] ; <[71 x sbyte]*> [#uses=0] + %.str_159 = external global [72 x sbyte] ; <[72 x sbyte]*> [#uses=0] + %.str_160 = external global [56 x sbyte] ; <[56 x sbyte]*> [#uses=0] + %.str_161 = external global [59 x sbyte] ; <[59 x sbyte]*> [#uses=0] + %.str_162 = external global [63 x sbyte] ; <[63 x sbyte]*> [#uses=0] + %.str_163 = external global [62 x sbyte] ; <[62 x sbyte]*> [#uses=0] + %.str_164 = external global [58 x sbyte] ; <[58 x sbyte]*> [#uses=0] + %.str_165 = external global [57 x sbyte] ; <[57 x sbyte]*> [#uses=0] + %.str_166 = external global [61 x sbyte] ; <[61 x sbyte]*> [#uses=0] + %.str_167 = external global [63 x sbyte] ; <[63 x sbyte]*> [#uses=0] + %.str_168 = external global [62 x sbyte] ; <[62 x sbyte]*> [#uses=0] + %.str_169 = external global [65 x sbyte] ; <[65 x sbyte]*> [#uses=0] + %.str_170 = external global [62 x sbyte] ; <[62 x sbyte]*> [#uses=0] + %.str_171 = external global [63 x sbyte] ; <[63 x sbyte]*> [#uses=0] + %.str_172 = external global [61 x sbyte] ; <[61 x sbyte]*> [#uses=0] + %.str_173 = external global [64 x sbyte] ; <[64 x sbyte]*> [#uses=0] + %.str_174 = external global [51 x sbyte] ; <[51 x sbyte]*> [#uses=0] + %.str_175 = external global [70 x sbyte] ; <[70 x sbyte]*> [#uses=0] + %.str_176 = external global [67 x sbyte] ; <[67 x sbyte]*> [#uses=0] + %.str_177 = external global [64 x sbyte] ; <[64 x sbyte]*> [#uses=0] + %.str_178 = external global [48 x sbyte] ; <[48 x sbyte]*> [#uses=0] + %.str_180 = external global [57 x sbyte] ; <[57 x sbyte]*> [#uses=0] + %.str_181 = external global [60 x sbyte] ; <[60 x sbyte]*> [#uses=0] + %.str_182 = external global [53 x sbyte] ; <[53 x sbyte]*> [#uses=0] + %.str_183 = external global [61 x sbyte] ; <[61 x sbyte]*> [#uses=0] + %.str_184 = external global [57 x sbyte] ; <[57 x sbyte]*> [#uses=0] + %.str_185 = external global [61 x sbyte] ; <[61 x sbyte]*> [#uses=0] + %.str_186 = external global [59 x sbyte] ; <[59 x sbyte]*> [#uses=0] + %.str_187 = external global [57 x sbyte] ; <[57 x sbyte]*> [#uses=0] + %.str_188 = external global [35 x sbyte] ; <[35 x sbyte]*> [#uses=0] + %.str_189 = external global [58 x sbyte] ; <[58 x sbyte]*> [#uses=0] + %.str_190 = external global [59 x sbyte] ; <[59 x sbyte]*> [#uses=0] + %.str_191 = external global [60 x sbyte] ; <[60 x sbyte]*> [#uses=0] + %.str_192 = external global [39 x sbyte] ; <[39 x sbyte]*> [#uses=0] + %.str_193 = external global [55 x sbyte] ; <[55 x sbyte]*> [#uses=0] + %.str_194 = external global [32 x sbyte] ; <[32 x sbyte]*> [#uses=0] + %.str_195 = external global [33 x sbyte] ; <[33 x sbyte]*> [#uses=0] + %.str_196 = external global [46 x sbyte] ; <[46 x sbyte]*> [#uses=0] + %.str_197 = external global [11 x sbyte] ; <[11 x sbyte]*> [#uses=0] + %.str_198 = external global [16 x sbyte] ; <[16 x sbyte]*> [#uses=0] + %.str_201 = external global [57 x sbyte] ; <[57 x sbyte]*> [#uses=0] + %.str_202 = external global [58 x sbyte] ; <[58 x sbyte]*> [#uses=0] + %.str_203 = external global [60 x sbyte] ; <[60 x sbyte]*> [#uses=0] + %.str_204 = external global [3 x sbyte] ; <[3 x sbyte]*> [#uses=0] + %.str_206 = external global [48 x sbyte] ; <[48 x sbyte]*> [#uses=0] + %.str_207 = external global [46 x sbyte] ; <[46 x sbyte]*> [#uses=0] + %.str_208 = external global [56 x sbyte] ; <[56 x sbyte]*> [#uses=0] + %.str_209 = external global [59 x sbyte] ; <[59 x sbyte]*> [#uses=0] + %.str_210 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_211 = external global [43 x sbyte] ; <[43 x sbyte]*> [#uses=0] + %.str_213 = external global [52 x sbyte] ; <[52 x sbyte]*> [#uses=0] + %.str_214 = external global [59 x sbyte] ; <[59 x sbyte]*> [#uses=0] + %.str_215 = external global [60 x sbyte] ; <[60 x sbyte]*> [#uses=0] + %.str_216 = external global [14 x sbyte] ; <[14 x sbyte]*> [#uses=0] + %.str_218 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_219 = external global [60 x sbyte] ; <[60 x sbyte]*> [#uses=0] + %.str_220 = external global [62 x sbyte] ; <[62 x sbyte]*> [#uses=0] + %.str_221 = external global [37 x sbyte] ; <[37 x sbyte]*> [#uses=0] + %.str_222 = external global [64 x sbyte] ; <[64 x sbyte]*> [#uses=0] + %.str_223 = external global [66 x sbyte] ; <[66 x sbyte]*> [#uses=0] + %.str_224 = external global [62 x sbyte] ; <[62 x sbyte]*> [#uses=0] + %.str_225 = external global [64 x sbyte] ; <[64 x sbyte]*> [#uses=0] + %.str_226 = external global [63 x sbyte] ; <[63 x sbyte]*> [#uses=0] + %.str_227 = external global [46 x sbyte] ; <[46 x sbyte]*> [#uses=0] + %.str_228 = external global [4 x sbyte] ; <[4 x sbyte]*> [#uses=0] + %.str_229 = external global [56 x sbyte] ; <[56 x sbyte]*> [#uses=0] + %.str_230 = external global [60 x sbyte] ; <[60 x sbyte]*> [#uses=0] + %.str_231 = external global [19 x sbyte] ; <[19 x sbyte]*> [#uses=0] + %.str_232 = external global [57 x sbyte] ; <[57 x sbyte]*> [#uses=0] + %.str_233 = external global [60 x sbyte] ; <[60 x sbyte]*> [#uses=0] + %.str_234 = external global [54 x sbyte] ; <[54 x sbyte]*> [#uses=0] + %.str_235 = external global [60 x sbyte] ; <[60 x sbyte]*> [#uses=0] + %.str_236 = external global [17 x sbyte] ; <[17 x sbyte]*> [#uses=0] + %.str_237 = external global [9 x sbyte] ; <[9 x sbyte]*> [#uses=0] + %.str_238 = external global [61 x sbyte] ; <[61 x sbyte]*> [#uses=0] + %.str_239 = external global [59 x sbyte] ; <[59 x sbyte]*> [#uses=0] + %.str_240 = external global [17 x sbyte] ; <[17 x sbyte]*> [#uses=0] + %.str_241 = external global [61 x sbyte] ; <[61 x sbyte]*> [#uses=0] + %.str_242 = external global [61 x sbyte] ; <[61 x sbyte]*> [#uses=0] + %.str_243 = external global [35 x sbyte] ; <[35 x sbyte]*> [#uses=0] + %.str_245 = external global [60 x sbyte] ; <[60 x sbyte]*> [#uses=0] + %.str_246 = external global [58 x sbyte] ; <[58 x sbyte]*> [#uses=0] + %.str_247 = external global [59 x sbyte] ; <[59 x sbyte]*> [#uses=0] + %.str_248 = external global [56 x sbyte] ; <[56 x sbyte]*> [#uses=0] + %.str_249 = external global [58 x sbyte] ; <[58 x sbyte]*> [#uses=0] + %.str_250 = external global [45 x sbyte] ; <[45 x sbyte]*> [#uses=0] + %.str_253 = external global [56 x sbyte] ; <[56 x sbyte]*> [#uses=0] + %.str_254 = external global [17 x sbyte] ; <[17 x sbyte]*> [#uses=0] + %.str_256 = external global [43 x sbyte] ; <[43 x sbyte]*> [#uses=0] + %.str_258 = external global [52 x sbyte] ; <[52 x sbyte]*> [#uses=0] + %.str_259 = external global [27 x sbyte] ; <[27 x sbyte]*> [#uses=0] + %.str_261 = external global [43 x sbyte] ; <[43 x sbyte]*> [#uses=0] + %.str_262 = external global [43 x sbyte] ; <[43 x sbyte]*> [#uses=0] + %.str_263 = external global [43 x sbyte] ; <[43 x sbyte]*> [#uses=0] + %.str_266 = external global [43 x sbyte] ; <[43 x sbyte]*> [#uses=0] + %.str_267 = external global [43 x sbyte] ; <[43 x sbyte]*> [#uses=0] + %.str_268 = external global [43 x sbyte] ; <[43 x sbyte]*> [#uses=0] + %.str_270 = external global [60 x sbyte] ; <[60 x sbyte]*> [#uses=0] + %.str_271 = external global [59 x sbyte] ; <[59 x sbyte]*> [#uses=0] + %.str_272 = external global [60 x sbyte] ; <[60 x sbyte]*> [#uses=0] + %.str_273 = external global [59 x sbyte] ; <[59 x sbyte]*> [#uses=0] + %.str_274 = external global [59 x sbyte] ; <[59 x sbyte]*> [#uses=0] + %.str_275 = external global [44 x sbyte] ; <[44 x sbyte]*> [#uses=0] + %.str_276 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_277 = external global [21 x sbyte] ; <[21 x sbyte]*> [#uses=0] + %.str_278 = external global [48 x sbyte] ; <[48 x sbyte]*> [#uses=0] + %.str_279 = external global [51 x sbyte] ; <[51 x sbyte]*> [#uses=0] + %.str_280 = external global [52 x sbyte] ; <[52 x sbyte]*> [#uses=0] + %.str_281 = external global [53 x sbyte] ; <[53 x sbyte]*> [#uses=0] + %.str_282 = external global [50 x sbyte] ; <[50 x sbyte]*> [#uses=0] + %.str_283 = external global [53 x sbyte] ; <[53 x sbyte]*> [#uses=0] + %.str_284 = external global [56 x sbyte] ; <[56 x sbyte]*> [#uses=0] + %.str_285 = external global [55 x sbyte] ; <[55 x sbyte]*> [#uses=0] + %.str_286 = external global [56 x sbyte] ; <[56 x sbyte]*> [#uses=0] + %.str_287 = external global [54 x sbyte] ; <[54 x sbyte]*> [#uses=0] + %.str_288 = external global [58 x sbyte] ; <[58 x sbyte]*> [#uses=0] + %.str_289 = external global [61 x sbyte] ; <[61 x sbyte]*> [#uses=0] + %.str_290 = external global [56 x sbyte] ; <[56 x sbyte]*> [#uses=0] + %.str_291 = external global [58 x sbyte] ; <[58 x sbyte]*> [#uses=0] + %.str_292 = external global [58 x sbyte] ; <[58 x sbyte]*> [#uses=0] + %.str_293 = external global [54 x sbyte] ; <[54 x sbyte]*> [#uses=0] + %.str_294 = external global [56 x sbyte] ; <[56 x sbyte]*> [#uses=0] + %.str_295 = external global [9 x sbyte] ; <[9 x sbyte]*> [#uses=0] + %.str_296 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_297 = external global [52 x sbyte] ; <[52 x sbyte]*> [#uses=0] + %.str_298 = external global [51 x sbyte] ; <[51 x sbyte]*> [#uses=0] + %.str_299 = external global [54 x sbyte] ; <[54 x sbyte]*> [#uses=0] + %.str_300 = external global [49 x sbyte] ; <[49 x sbyte]*> [#uses=0] + %.str_301 = external global [56 x sbyte] ; <[56 x sbyte]*> [#uses=0] + %.str_302 = external global [18 x sbyte] ; <[18 x sbyte]*> [#uses=0] + %.str_304 = external global [50 x sbyte] ; <[50 x sbyte]*> [#uses=0] + %.str_305 = external global [50 x sbyte] ; <[50 x sbyte]*> [#uses=0] + %.str_306 = external global [10 x sbyte] ; <[10 x sbyte]*> [#uses=0] + %.str_308 = external global [52 x sbyte] ; <[52 x sbyte]*> [#uses=0] + %.str_310 = external global [50 x sbyte] ; <[50 x sbyte]*> [#uses=0] + %.str_311 = external global [52 x sbyte] ; <[52 x sbyte]*> [#uses=0] + %.str_312 = external global [53 x sbyte] ; <[53 x sbyte]*> [#uses=0] + %.str_313 = external global [52 x sbyte] ; <[52 x sbyte]*> [#uses=0] + %.str_314 = external global [53 x sbyte] ; <[53 x sbyte]*> [#uses=0] + %.str_315 = external global [54 x sbyte] ; <[54 x sbyte]*> [#uses=0] + %.str_316 = external global [51 x sbyte] ; <[51 x sbyte]*> [#uses=0] + %.str_317 = external global [26 x sbyte] ; <[26 x sbyte]*> [#uses=0] + %.str_319 = external global [56 x sbyte] ; <[56 x sbyte]*> [#uses=0] + %.str_320 = external global [53 x sbyte] ; <[53 x sbyte]*> [#uses=0] + %.str_321 = external global [52 x sbyte] ; <[52 x sbyte]*> [#uses=0] + %.str_322 = external global [55 x sbyte] ; <[55 x sbyte]*> [#uses=0] + %.str_323 = external global [20 x sbyte] ; <[20 x sbyte]*> [#uses=0] + %.str_325 = external global [26 x sbyte] ; <[26 x sbyte]*> [#uses=0] + %.str_327 = external global [51 x sbyte] ; <[51 x sbyte]*> [#uses=0] + %.str_328 = external global [51 x sbyte] ; <[51 x sbyte]*> [#uses=0] + %.str_329 = external global [10 x sbyte] ; <[10 x sbyte]*> [#uses=0] + %.str_330 = external global [8 x sbyte] ; <[8 x sbyte]*> [#uses=0] + %.str_331 = external global [53 x sbyte] ; <[53 x sbyte]*> [#uses=0] + %.str_332 = external global [39 x sbyte] ; <[39 x sbyte]*> [#uses=0] + %.str_333 = external global [50 x sbyte] ; <[50 x sbyte]*> [#uses=0] + %.str_334 = external global [54 x sbyte] ; <[54 x sbyte]*> [#uses=0] + %.str_335 = external global [48 x sbyte] ; <[48 x sbyte]*> [#uses=0] + %.str_336 = external global [52 x sbyte] ; <[52 x sbyte]*> [#uses=0] + %.str_337 = external global [50 x sbyte] ; <[50 x sbyte]*> [#uses=0] + %.str_338 = external global [56 x sbyte] ; <[56 x sbyte]*> [#uses=0] + %.str_339 = external global [36 x sbyte] ; <[36 x sbyte]*> [#uses=0] + %.str_340 = external global [55 x sbyte] ; <[55 x sbyte]*> [#uses=0] + %.str_341 = external global [54 x sbyte] ; <[54 x sbyte]*> [#uses=0] + %.str_342 = external global [49 x sbyte] ; <[49 x sbyte]*> [#uses=0] + %.str_343 = external global [63 x sbyte] ; <[63 x sbyte]*> [#uses=0] + %.str_344 = external global [49 x sbyte] ; <[49 x sbyte]*> [#uses=0] + %.str_345 = external global [47 x sbyte] ; <[47 x sbyte]*> [#uses=0] + %.str_346 = external global [49 x sbyte] ; <[49 x sbyte]*> [#uses=0] + %.str_347 = external global [43 x sbyte] ; <[43 x sbyte]*> [#uses=0] + %.str_348 = external global [52 x sbyte] ; <[52 x sbyte]*> [#uses=0] + %.str_349 = external global [52 x sbyte] ; <[52 x sbyte]*> [#uses=0] + %.str_350 = external global [55 x sbyte] ; <[55 x sbyte]*> [#uses=0] + %.str_351 = external global [47 x sbyte] ; <[47 x sbyte]*> [#uses=0] + %.str_352 = external global [49 x sbyte] ; <[49 x sbyte]*> [#uses=0] + %.str_353 = external global [49 x sbyte] ; <[49 x sbyte]*> [#uses=0] + %.str_354 = external global [42 x sbyte] ; <[42 x sbyte]*> [#uses=0] + %.str_355 = external global [57 x sbyte] ; <[57 x sbyte]*> [#uses=0] + %.str_356 = external global [59 x sbyte] ; <[59 x sbyte]*> [#uses=0] + %.str_357 = external global [53 x sbyte] ; <[53 x sbyte]*> [#uses=0] + %.str_358 = external global [47 x sbyte] ; <[47 x sbyte]*> [#uses=0] + %.str_359 = external global [63 x sbyte] ; <[63 x sbyte]*> [#uses=0] + %.str_360 = external global [54 x sbyte] ; <[54 x sbyte]*> [#uses=0] + %.str_362 = external global [53 x sbyte] ; <[53 x sbyte]*> [#uses=0] + %.str_363 = external global [62 x sbyte] ; <[62 x sbyte]*> [#uses=0] + %.str_364 = external global [56 x sbyte] ; <[56 x sbyte]*> [#uses=0] + %.str_365 = external global [51 x sbyte] ; <[51 x sbyte]*> [#uses=0] + %.str_366 = external global [64 x sbyte] ; <[64 x sbyte]*> [#uses=0] + %.str_367 = external global [62 x sbyte] ; <[62 x sbyte]*> [#uses=0] + %.str_368 = external global [48 x sbyte] ; <[48 x sbyte]*> [#uses=0] + %.str_369 = external global [52 x sbyte] ; <[52 x sbyte]*> [#uses=0] + %.str_370 = external global [58 x sbyte] ; <[58 x sbyte]*> [#uses=0] + %.str_371 = external global [49 x sbyte] ; <[49 x sbyte]*> [#uses=0] + %.str_372 = external global [58 x sbyte] ; <[58 x sbyte]*> [#uses=0] + %.str_373 = external global [61 x sbyte] ; <[61 x sbyte]*> [#uses=0] + %.str_374 = external global [52 x sbyte] ; <[52 x sbyte]*> [#uses=0] + %.str_375 = external global [63 x sbyte] ; <[63 x sbyte]*> [#uses=0] + %.str_376 = external global [63 x sbyte] ; <[63 x sbyte]*> [#uses=0] + %.str_377 = external global [62 x sbyte] ; <[62 x sbyte]*> [#uses=0] + %.str_378 = external global [52 x sbyte] ; <[52 x sbyte]*> [#uses=0] + %.str_379 = external global [60 x sbyte] ; <[60 x sbyte]*> [#uses=0] + %.str_380 = external global [60 x sbyte] ; <[60 x sbyte]*> [#uses=0] + %.str_381 = external global [60 x sbyte] ; <[60 x sbyte]*> [#uses=0] + %.str_382 = external global [62 x sbyte] ; <[62 x sbyte]*> [#uses=0] + %.str_383 = external global [49 x sbyte] ; <[49 x sbyte]*> [#uses=0] + %.str_384 = external global [62 x sbyte] ; <[62 x sbyte]*> [#uses=0] + %.str_385 = external global [62 x sbyte] ; <[62 x sbyte]*> [#uses=0] + %.str_387 = external global [53 x sbyte] ; <[53 x sbyte]*> [#uses=0] + %.str_388 = external global [57 x sbyte] ; <[57 x sbyte]*> [#uses=0] + %.str_389 = external global [57 x sbyte] ; <[57 x sbyte]*> [#uses=0] + %.str_390 = external global [55 x sbyte] ; <[55 x sbyte]*> [#uses=0] + %.str_391 = external global [55 x sbyte] ; <[55 x sbyte]*> [#uses=0] + %.str_392 = external global [71 x sbyte] ; <[71 x sbyte]*> [#uses=0] + %.str_393 = external global [46 x sbyte] ; <[46 x sbyte]*> [#uses=0] + %.str_394 = external global [51 x sbyte] ; <[51 x sbyte]*> [#uses=0] + %.str_395 = external global [54 x sbyte] ; <[54 x sbyte]*> [#uses=0] + %.str_396 = external global [60 x sbyte] ; <[60 x sbyte]*> [#uses=0] + %.str_397 = external global [49 x sbyte] ; <[49 x sbyte]*> [#uses=0] + %.str_398 = external global [62 x sbyte] ; <[62 x sbyte]*> [#uses=0] + %.str_399 = external global [67 x sbyte] ; <[67 x sbyte]*> [#uses=0] + %.str_400 = external global [55 x sbyte] ; <[55 x sbyte]*> [#uses=0] + %.str_401 = external global [52 x sbyte] ; <[52 x sbyte]*> [#uses=0] + %.str_402 = external global [62 x sbyte] ; <[62 x sbyte]*> [#uses=0] + %.str_403 = external global [47 x sbyte] ; <[47 x sbyte]*> [#uses=0] + %.str_404 = external global [59 x sbyte] ; <[59 x sbyte]*> [#uses=0] + %.str_405 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_406 = external global [10 x sbyte] ; <[10 x sbyte]*> [#uses=0] + %.str_407 = external global [4 x sbyte] ; <[4 x sbyte]*> [#uses=0] + %.str_408 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_409 = external global [4 x sbyte] ; <[4 x sbyte]*> [#uses=0] + %.str_410 = external global [26 x sbyte] ; <[26 x sbyte]*> [#uses=0] + %.str_411 = external global [2 x sbyte] ; <[2 x sbyte]*> [#uses=0] + %.str_412 = external global [22 x sbyte] ; <[22 x sbyte]*> [#uses=0] + %.str_413 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_414 = external global [19 x sbyte] ; <[19 x sbyte]*> [#uses=0] + %.str_421 = external global [53 x sbyte] ; <[53 x sbyte]*> [#uses=0] + %.str_422 = external global [55 x sbyte] ; <[55 x sbyte]*> [#uses=0] + %.str_423 = external global [23 x sbyte] ; <[23 x sbyte]*> [#uses=0] + %.str_424 = external global [39 x sbyte] ; <[39 x sbyte]*> [#uses=0] + %.str_426 = external global [42 x sbyte] ; <[42 x sbyte]*> [#uses=0] + %.str_427 = external global [40 x sbyte] ; <[40 x sbyte]*> [#uses=0] + %.str_429 = external global [7 x sbyte] ; <[7 x sbyte]*> [#uses=0] + %.str_430 = external global [24 x sbyte] ; <[24 x sbyte]*> [#uses=0] + %.str_431 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_432 = external global [23 x sbyte] ; <[23 x sbyte]*> [#uses=0] + %.str_433 = external global [23 x sbyte] ; <[23 x sbyte]*> [#uses=0] + %.str_434 = external global [24 x sbyte] ; <[24 x sbyte]*> [#uses=0] + %.str_435 = external global [27 x sbyte] ; <[27 x sbyte]*> [#uses=0] + %.str_436 = external global [28 x sbyte] ; <[28 x sbyte]*> [#uses=0] + %.str_437 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_438 = external global [38 x sbyte] ; <[38 x sbyte]*> [#uses=0] + %.str_440 = external global [44 x sbyte] ; <[44 x sbyte]*> [#uses=0] + %.str_445 = external global [3 x sbyte] ; <[3 x sbyte]*> [#uses=0] + %.str_446 = external global [26 x sbyte] ; <[26 x sbyte]*> [#uses=0] + %.str_447 = external global [36 x sbyte] ; <[36 x sbyte]*> [#uses=0] + %.str_448 = external global [40 x sbyte] ; <[40 x sbyte]*> [#uses=0] + %.str_449 = external global [22 x sbyte] ; <[22 x sbyte]*> [#uses=0] + %.str_450 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_451 = external global [44 x sbyte] ; <[44 x sbyte]*> [#uses=0] + %.str_452 = external global [3 x sbyte] ; <[3 x sbyte]*> [#uses=0] + %.str_453 = external global [26 x sbyte] ; <[26 x sbyte]*> [#uses=0] + %.str_454 = external global [36 x sbyte] ; <[36 x sbyte]*> [#uses=0] + %.str_455 = external global [40 x sbyte] ; <[40 x sbyte]*> [#uses=0] + %.str_456 = external global [22 x sbyte] ; <[22 x sbyte]*> [#uses=0] + %.str_459 = external global [2 x sbyte] ; <[2 x sbyte]*> [#uses=0] + %.str_460 = external global [32 x sbyte] ; <[32 x sbyte]*> [#uses=0] + %.str_461 = external global [42 x sbyte] ; <[42 x sbyte]*> [#uses=0] + %.str_462 = external global [39 x sbyte] ; <[39 x sbyte]*> [#uses=0] + %.str_463 = external global [28 x sbyte] ; <[28 x sbyte]*> [#uses=0] + %.str_466 = external global [3 x sbyte] ; <[3 x sbyte]*> [#uses=0] + %.str_467 = external global [35 x sbyte] ; <[35 x sbyte]*> [#uses=0] + %.str_468 = external global [45 x sbyte] ; <[45 x sbyte]*> [#uses=0] + %.str_469 = external global [40 x sbyte] ; <[40 x sbyte]*> [#uses=0] + %.str_470 = external global [31 x sbyte] ; <[31 x sbyte]*> [#uses=0] + %.str_474 = external global [10 x sbyte] ; <[10 x sbyte]*> [#uses=0] + %.str_477 = external global [10 x sbyte] ; <[10 x sbyte]*> [#uses=0] + %.str_480 = external global [16 x sbyte] ; <[16 x sbyte]*> [#uses=0] + %.str_483 = external global [19 x sbyte] ; <[19 x sbyte]*> [#uses=0] + %.str_485 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_487 = external global [32 x sbyte] ; <[32 x sbyte]*> [#uses=0] + %.str_490 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_494 = external global [4 x sbyte] ; <[4 x sbyte]*> [#uses=0] + %.str_495 = external global [33 x sbyte] ; <[33 x sbyte]*> [#uses=0] + %.str_497 = external global [12 x sbyte] ; <[12 x sbyte]*> [#uses=0] + %.str_498 = external global [13 x sbyte] ; <[13 x sbyte]*> [#uses=0] + %.str_507 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_508 = external global [11 x sbyte] ; <[11 x sbyte]*> [#uses=0] + %.str_509 = external global [57 x sbyte] ; <[57 x sbyte]*> [#uses=0] + %.str_510 = external global [37 x sbyte] ; <[37 x sbyte]*> [#uses=0] + %.str_511 = external global [7 x sbyte] ; <[7 x sbyte]*> [#uses=0] + %.str_512 = external global [32 x sbyte] ; <[32 x sbyte]*> [#uses=0] + %.str_513 = external global [18 x sbyte] ; <[18 x sbyte]*> [#uses=0] + %.str_514 = external global [14 x sbyte] ; <[14 x sbyte]*> [#uses=0] + %.str_515 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_516 = external global [21 x sbyte] ; <[21 x sbyte]*> [#uses=0] + %.str_517 = external global [10 x sbyte] ; <[10 x sbyte]*> [#uses=0] + %.str_519 = external global [17 x sbyte] ; <[17 x sbyte]*> [#uses=0] + %.str_520 = external global [21 x sbyte] ; <[21 x sbyte]*> [#uses=0] + %.str_521 = external global [15 x sbyte] ; <[15 x sbyte]*> [#uses=0] + %.str_522 = external global [16 x sbyte] ; <[16 x sbyte]*> [#uses=0] + %.str_523 = external global [4 x sbyte] ; <[4 x sbyte]*> [#uses=0] + %.str_524 = external global [3 x sbyte] ; <[3 x sbyte]*> [#uses=0] + %.str_525 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_526 = external global [19 x sbyte] ; <[19 x sbyte]*> [#uses=0] + %.str_527 = external global [24 x sbyte] ; <[24 x sbyte]*> [#uses=0] + %.str_528 = external global [9 x sbyte] ; <[9 x sbyte]*> [#uses=0] + %.str_529 = external global [28 x sbyte] ; <[28 x sbyte]*> [#uses=0] + %.str_530 = external global [54 x sbyte] ; <[54 x sbyte]*> [#uses=0] + %.str_531 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_532 = external global [38 x sbyte] ; <[38 x sbyte]*> [#uses=0] + %.str_533 = external global [32 x sbyte] ; <[32 x sbyte]*> [#uses=0] + %.str_534 = external global [7 x sbyte] ; <[7 x sbyte]*> [#uses=0] + %.str_535 = external global [27 x sbyte] ; <[27 x sbyte]*> [#uses=0] + %.str_536 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_537 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_539 = external global [39 x sbyte] ; <[39 x sbyte]*> [#uses=0] + %.str_540 = external global [40 x sbyte] ; <[40 x sbyte]*> [#uses=0] + %.str_541 = external global [8 x sbyte] ; <[8 x sbyte]*> [#uses=0] + %.str_542 = external global [9 x sbyte] ; <[9 x sbyte]*> [#uses=0] + %.str_543 = external global [7 x sbyte] ; <[7 x sbyte]*> [#uses=0] + %.str_544 = external global [49 x sbyte] ; <[49 x sbyte]*> [#uses=0] + %.str_546 = external global [40 x sbyte] ; <[40 x sbyte]*> [#uses=0] + %.str_550 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_551 = external global [40 x sbyte] ; <[40 x sbyte]*> [#uses=0] + %.str_552 = external global [31 x sbyte] ; <[31 x sbyte]*> [#uses=0] + %.str_553 = external global [52 x sbyte] ; <[52 x sbyte]*> [#uses=0] + %.str_554 = external global [43 x sbyte] ; <[43 x sbyte]*> [#uses=0] + %.str_555 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_556 = external global [26 x sbyte] ; <[26 x sbyte]*> [#uses=0] + %.str_557 = external global [16 x sbyte] ; <[16 x sbyte]*> [#uses=0] + %.str_559 = external global [27 x sbyte] ; <[27 x sbyte]*> [#uses=0] + %.str_560 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_562 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_564 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_565 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_567 = external global [9 x sbyte] ; <[9 x sbyte]*> [#uses=0] + %.str_568 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_570 = external global [9 x sbyte] ; <[9 x sbyte]*> [#uses=0] + %.str_571 = external global [7 x sbyte] ; <[7 x sbyte]*> [#uses=0] + %.str_572 = external global [30 x sbyte] ; <[30 x sbyte]*> [#uses=0] + %.str_574 = external global [20 x sbyte] ; <[20 x sbyte]*> [#uses=0] + %.str_576 = external global [21 x sbyte] ; <[21 x sbyte]*> [#uses=0] + %.str_577 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_578 = external global [7 x sbyte] ; <[7 x sbyte]*> [#uses=0] + %.str_579 = external global [7 x sbyte] ; <[7 x sbyte]*> [#uses=0] + %.str_580 = external global [7 x sbyte] ; <[7 x sbyte]*> [#uses=0] + %.str_581 = external global [36 x sbyte] ; <[36 x sbyte]*> [#uses=0] + %.str_582 = external global [22 x sbyte] ; <[22 x sbyte]*> [#uses=0] + %.str_583 = external global [24 x sbyte] ; <[24 x sbyte]*> [#uses=0] + %.str_584 = external global [7 x sbyte] ; <[7 x sbyte]*> [#uses=0] + %.str_586 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_587 = external global [28 x sbyte] ; <[28 x sbyte]*> [#uses=0] + %.str_589 = external global [28 x sbyte] ; <[28 x sbyte]*> [#uses=0] + %.str_590 = external global [39 x sbyte] ; <[39 x sbyte]*> [#uses=0] + %.str_591 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_592 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_596 = external global [25 x sbyte] ; <[25 x sbyte]*> [#uses=0] + %.str_597 = external global [27 x sbyte] ; <[27 x sbyte]*> [#uses=0] + %.str_598 = external global [17 x sbyte] ; <[17 x sbyte]*> [#uses=0] + %.str_599 = external global [17 x sbyte] ; <[17 x sbyte]*> [#uses=0] + %.str_605 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_610 = external global [7 x sbyte] ; <[7 x sbyte]*> [#uses=0] + %.str_613 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_616 = external global [4 x sbyte] ; <[4 x sbyte]*> [#uses=0] + %.str_621 = external global [7 x sbyte] ; <[7 x sbyte]*> [#uses=0] + %.str_622 = external global [24 x sbyte] ; <[24 x sbyte]*> [#uses=0] + %.str_623 = external global [40 x sbyte] ; <[40 x sbyte]*> [#uses=0] + %.str_624 = external global [24 x sbyte] ; <[24 x sbyte]*> [#uses=0] + %.str_625 = external global [9 x sbyte] ; <[9 x sbyte]*> [#uses=0] + %.str_626 = external global [3 x sbyte] ; <[3 x sbyte]*> [#uses=0] + %.str_628 = external global [30 x sbyte] ; <[30 x sbyte]*> [#uses=0] + %.str_629 = external global [14 x sbyte] ; <[14 x sbyte]*> [#uses=0] + %.str_630 = external global [13 x sbyte] ; <[13 x sbyte]*> [#uses=0] + %.str_631 = external global [24 x sbyte] ; <[24 x sbyte]*> [#uses=0] + %.str_632 = external global [14 x sbyte] ; <[14 x sbyte]*> [#uses=0] + %.str_633 = external global [14 x sbyte] ; <[14 x sbyte]*> [#uses=0] + %.str_634 = external global [17 x sbyte] ; <[17 x sbyte]*> [#uses=0] + %.str_635 = external global [14 x sbyte] ; <[14 x sbyte]*> [#uses=0] + %.str_636 = external global [17 x sbyte] ; <[17 x sbyte]*> [#uses=0] + %.str_637 = external global [16 x sbyte] ; <[16 x sbyte]*> [#uses=0] + %.str_639 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_643 = external global [20 x sbyte] ; <[20 x sbyte]*> [#uses=0] + %.str_644 = external global [8 x sbyte] ; <[8 x sbyte]*> [#uses=0] + %.str_645 = external global [2 x sbyte] ; <[2 x sbyte]*> [#uses=0] + %.str_646 = external global [1 x sbyte] ; <[1 x sbyte]*> [#uses=0] + %.str_649 = external global [10 x sbyte] ; <[10 x sbyte]*> [#uses=0] + %.str_654 = external global [2 x sbyte] ; <[2 x sbyte]*> [#uses=1] + %.str_656 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_658 = external global [2 x sbyte] ; <[2 x sbyte]*> [#uses=0] + %.str_660 = external global [2 x sbyte] ; <[2 x sbyte]*> [#uses=0] + %.str_662 = external global [2 x sbyte] ; <[2 x sbyte]*> [#uses=0] + %.str_664 = external global [2 x sbyte] ; <[2 x sbyte]*> [#uses=0] + %.str_666 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_667 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_669 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_670 = external global [20 x sbyte] ; <[20 x sbyte]*> [#uses=0] + %.str_671 = external global [7 x sbyte] ; <[7 x sbyte]*> [#uses=0] + %.str_672 = external global [23 x sbyte] ; <[23 x sbyte]*> [#uses=0] + %.str_674 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_675 = external global [39 x sbyte] ; <[39 x sbyte]*> [#uses=0] + %.str_676 = external global [30 x sbyte] ; <[30 x sbyte]*> [#uses=0] + %.str_680 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_682 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_683 = external global [37 x sbyte] ; <[37 x sbyte]*> [#uses=0] + %.str_684 = external global [40 x sbyte] ; <[40 x sbyte]*> [#uses=0] + %.str_685 = external global [40 x sbyte] ; <[40 x sbyte]*> [#uses=0] + %.str_686 = external global [40 x sbyte] ; <[40 x sbyte]*> [#uses=0] + %.str_687 = external global [40 x sbyte] ; <[40 x sbyte]*> [#uses=0] + %.str_688 = external global [40 x sbyte] ; <[40 x sbyte]*> [#uses=0] + %.str_689 = external global [40 x sbyte] ; <[40 x sbyte]*> [#uses=0] + %.str_690 = external global [40 x sbyte] ; <[40 x sbyte]*> [#uses=0] + %.str_691 = external global [3 x sbyte] ; <[3 x sbyte]*> [#uses=0] + %.str_692 = external global [20 x sbyte] ; <[20 x sbyte]*> [#uses=0] + %.str_694 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_695 = external global [19 x sbyte] ; <[19 x sbyte]*> [#uses=0] + %.str_697 = external global [22 x sbyte] ; <[22 x sbyte]*> [#uses=0] + %.str_698 = external global [28 x sbyte] ; <[28 x sbyte]*> [#uses=0] + %.str_700 = external global [3 x sbyte] ; <[3 x sbyte]*> [#uses=0] + %.str_701 = external global [19 x sbyte] ; <[19 x sbyte]*> [#uses=0] + %.str_702 = external global [26 x sbyte] ; <[26 x sbyte]*> [#uses=0] + %.str_703 = external global [8 x sbyte] ; <[8 x sbyte]*> [#uses=0] + %.str_704 = external global [25 x sbyte] ; <[25 x sbyte]*> [#uses=0] + %.str_707 = external global [4 x sbyte] ; <[4 x sbyte]*> [#uses=0] + %.str_708 = external global [16 x sbyte] ; <[16 x sbyte]*> [#uses=0] + %.str_709 = external global [8 x sbyte] ; <[8 x sbyte]*> [#uses=0] + %.str_710 = external global [20 x sbyte] ; <[20 x sbyte]*> [#uses=0] + %.str_711 = external global [37 x sbyte] ; <[37 x sbyte]*> [#uses=0] + %.str_722 = external global [9 x sbyte] ; <[9 x sbyte]*> [#uses=0] + %.str_723 = external global [34 x sbyte] ; <[34 x sbyte]*> [#uses=0] + %.str_726 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_727 = external global [23 x sbyte] ; <[23 x sbyte]*> [#uses=0] + %.str_728 = external global [10 x sbyte] ; <[10 x sbyte]*> [#uses=0] + %.str_729 = external global [3 x sbyte] ; <[3 x sbyte]*> [#uses=0] + %.str_730 = external global [12 x sbyte] ; <[12 x sbyte]*> [#uses=0] + %.str_732 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_734 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_735 = external global [28 x sbyte] ; <[28 x sbyte]*> [#uses=0] + %.str_736 = external global [61 x sbyte] ; <[61 x sbyte]*> [#uses=0] + %.str_738 = external global [25 x sbyte] ; <[25 x sbyte]*> [#uses=0] + %.str_739 = external global [22 x sbyte] ; <[22 x sbyte]*> [#uses=0] + %.str_740 = external global [8 x sbyte] ; <[8 x sbyte]*> [#uses=0] + %.str_741 = external global [25 x sbyte] ; <[25 x sbyte]*> [#uses=0] + %.str_742 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_743 = external global [22 x sbyte] ; <[22 x sbyte]*> [#uses=0] + %.str_744 = external global [31 x sbyte] ; <[31 x sbyte]*> [#uses=0] + %.str_745 = external global [42 x sbyte] ; <[42 x sbyte]*> [#uses=0] + %.str_747 = external global [7 x sbyte] ; <[7 x sbyte]*> [#uses=0] + %.str_748 = external global [9 x sbyte] ; <[9 x sbyte]*> [#uses=0] + %.str_750 = external global [3 x sbyte] ; <[3 x sbyte]*> [#uses=0] + "text_move.0__" = external global [10 x sbyte] ; <[10 x sbyte]*> [#uses=0] + "new_text.1__" = external global [10 x sbyte] ; <[10 x sbyte]*> [#uses=0] + %.str_1 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + "text_move.2__" = external global [10 x sbyte] ; <[10 x sbyte]*> [#uses=0] + %.str_1 = external global [15 x sbyte] ; <[15 x sbyte]*> [#uses=0] + %.str_2 = external global [19 x sbyte] ; <[19 x sbyte]*> [#uses=0] + %.str_3 = external global [16 x sbyte] ; <[16 x sbyte]*> [#uses=0] + %.str_130 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_231 = external global [47 x sbyte] ; <[47 x sbyte]*> [#uses=0] + %.str_3 = external global [27 x sbyte] ; <[27 x sbyte]*> [#uses=0] + %.str_4 = external global [27 x sbyte] ; <[27 x sbyte]*> [#uses=0] + %.str_7 = external global [30 x sbyte] ; <[30 x sbyte]*> [#uses=0] + "hashing_pawns.0__" = external global int ; [#uses=0] + "hashing_opening.1__" = external global int ; [#uses=0] + "hashing_middle_game.2__" = external global int ; [#uses=0] + "hashing_end_game.3__" = external global int ; [#uses=0] + "last_wtm.4__" = external global int ; [#uses=0] + %.str_1 = external global [37 x sbyte] ; <[37 x sbyte]*> [#uses=0] + %.str_1 = external global [8 x sbyte] ; <[8 x sbyte]*> [#uses=0] + %.str_1 = external global [19 x sbyte] ; <[19 x sbyte]*> [#uses=0] + %.str_2 = external global [16 x sbyte] ; <[16 x sbyte]*> [#uses=0] + %.str_3 = external global [30 x sbyte] ; <[30 x sbyte]*> [#uses=0] + %.str_4 = external global [30 x sbyte] ; <[30 x sbyte]*> [#uses=0] + %.str_5 = external global [10 x sbyte] ; <[10 x sbyte]*> [#uses=0] + %.str_6 = external global [25 x sbyte] ; <[25 x sbyte]*> [#uses=0] + %.str_7 = external global [14 x sbyte] ; <[14 x sbyte]*> [#uses=0] + %.str_934 = external global [8 x sbyte] ; <[8 x sbyte]*> [#uses=0] + %.str_1 = external global [28 x sbyte] ; <[28 x sbyte]*> [#uses=0] + %.str_3 = external global [9 x sbyte] ; <[9 x sbyte]*> [#uses=0] + %.str_1 = external global [38 x sbyte] ; <[38 x sbyte]*> [#uses=0] + %.str_2 = external global [7 x sbyte] ; <[7 x sbyte]*> [#uses=0] + %.str_4 = external global [28 x sbyte] ; <[28 x sbyte]*> [#uses=0] + %.str_5 = external global [40 x sbyte] ; <[40 x sbyte]*> [#uses=0] + %.str_1 = external global [11 x sbyte] ; <[11 x sbyte]*> [#uses=0] + %.str_2 = external global [27 x sbyte] ; <[27 x sbyte]*> [#uses=0] + %.str_7 = external global [29 x sbyte] ; <[29 x sbyte]*> [#uses=0] + %.str_10 = external global [34 x sbyte] ; <[34 x sbyte]*> [#uses=0] + %.str_1141 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_12 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_14 = external global [20 x sbyte] ; <[20 x sbyte]*> [#uses=0] + %.str_1542 = external global [17 x sbyte] ; <[17 x sbyte]*> [#uses=0] + %.ctor_1 = external global [25 x sbyte] ; <[25 x sbyte]*> [#uses=0] + %.str_1 = external global [33 x sbyte] ; <[33 x sbyte]*> [#uses=0] + %.str_3 = external global [21 x sbyte] ; <[21 x sbyte]*> [#uses=0] + %.str_4 = external global [25 x sbyte] ; <[25 x sbyte]*> [#uses=0] + %.str_5 = external global [26 x sbyte] ; <[26 x sbyte]*> [#uses=0] + %.str_6 = external global [55 x sbyte] ; <[55 x sbyte]*> [#uses=0] + %.str_143 = external global [33 x sbyte] ; <[33 x sbyte]*> [#uses=0] + %.str_2 = external global [15 x sbyte] ; <[15 x sbyte]*> [#uses=0] + %.str_1 = external global [22 x sbyte] ; <[22 x sbyte]*> [#uses=0] + %.str_2 = external global [51 x sbyte] ; <[51 x sbyte]*> [#uses=0] + %bit_move44 = external global ulong ; [#uses=0] + %.str_1 = external global [7 x sbyte] ; <[7 x sbyte]*> [#uses=0] + %.str_248 = external global [3 x sbyte] ; <[3 x sbyte]*> [#uses=0] + %.str_349 = external global [3 x sbyte] ; <[3 x sbyte]*> [#uses=0] + %.ctor_1 = external global [46 x sbyte] ; <[46 x sbyte]*> [#uses=0] + %.str_5 = external global [43 x sbyte] ; <[43 x sbyte]*> [#uses=0] + %.str_6 = external global [9 x sbyte] ; <[9 x sbyte]*> [#uses=0] + %.str_751 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_852 = external global [3 x sbyte] ; <[3 x sbyte]*> [#uses=0] + %.str_9 = external global [42 x sbyte] ; <[42 x sbyte]*> [#uses=0] + %.str_10 = external global [41 x sbyte] ; <[41 x sbyte]*> [#uses=0] + "out.0__" = external global [10 x sbyte] ; <[10 x sbyte]*> [#uses=0] + %.str_1153 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_12 = external global [9 x sbyte] ; <[9 x sbyte]*> [#uses=0] + %.str_13 = external global [9 x sbyte] ; <[9 x sbyte]*> [#uses=0] + %.str_14 = external global [8 x sbyte] ; <[8 x sbyte]*> [#uses=0] + %.str_15 = external global [8 x sbyte] ; <[8 x sbyte]*> [#uses=0] + %.str_16 = external global [10 x sbyte] ; <[10 x sbyte]*> [#uses=0] + %.str_17 = external global [10 x sbyte] ; <[10 x sbyte]*> [#uses=0] + "out.1__" = external global [10 x sbyte] ; <[10 x sbyte]*> [#uses=0] + %.str_18 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_19 = external global [8 x sbyte] ; <[8 x sbyte]*> [#uses=0] + %.str_20 = external global [8 x sbyte] ; <[8 x sbyte]*> [#uses=0] + %.str_21 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_2254 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_2355 = external global [8 x sbyte] ; <[8 x sbyte]*> [#uses=0] + %.str_24 = external global [9 x sbyte] ; <[9 x sbyte]*> [#uses=0] + %.str_25 = external global [45 x sbyte] ; <[45 x sbyte]*> [#uses=0] + %.str_26 = external global [24 x sbyte] ; <[24 x sbyte]*> [#uses=0] + "out.2__" = external global [10 x sbyte] ; <[10 x sbyte]*> [#uses=0] + %.str_31 = external global [7 x sbyte] ; <[7 x sbyte]*> [#uses=0] + "out.3__" = external global [10 x sbyte] ; <[10 x sbyte]*> [#uses=0] + "out.4__" = external global [10 x sbyte] ; <[10 x sbyte]*> [#uses=0] + %.str_3457 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_35 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_36 = external global [10 x sbyte] ; <[10 x sbyte]*> [#uses=0] + %.str_37 = external global [40 x sbyte] ; <[40 x sbyte]*> [#uses=0] + %.str_41 = external global [10 x sbyte] ; <[10 x sbyte]*> [#uses=0] + %.str_45 = external global [55 x sbyte] ; <[55 x sbyte]*> [#uses=0] + "save_book_selection_width.5__" = external global int ; [#uses=0] + "save_book_random.6__" = external global int ; [#uses=0] + "save_whisper.7__" = external global int ; [#uses=0] + "save_kibitz.8__" = external global int ; [#uses=0] + "save_channel.9__" = external global int ; [#uses=0] + "save_resign.10" = external global int ; [#uses=0] + "save_resign_count.11" = external global int ; [#uses=0] + "save_draw_count.12" = external global int ; [#uses=0] + "save_learning.13" = external global int ; [#uses=0] + %.str_49 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_51 = external global [44 x sbyte] ; <[44 x sbyte]*> [#uses=0] + "x.14" = external global [55 x uint] ; <[55 x uint]*> [#uses=0] + "init.15.b" = external global bool ; [#uses=0] + "y.16" = external global [55 x uint] ; <[55 x uint]*> [#uses=0] + "j.17" = external global int ; [#uses=0] + "k.18" = external global int ; [#uses=0] + %.str_52 = external global [50 x sbyte] ; <[50 x sbyte]*> [#uses=0] + "text.19" = external global [128 x sbyte] ; <[128 x sbyte]*> [#uses=0] + %.str_5659 = external global [12 x sbyte] ; <[12 x sbyte]*> [#uses=0] + %.str_62 = external global [14 x sbyte] ; <[14 x sbyte]*> [#uses=0] + %.str_6662 = external global [5 x sbyte] ; <[5 x sbyte]*> [#uses=0] + %.str_68 = external global [22 x sbyte] ; <[22 x sbyte]*> [#uses=0] + %.str_69 = external global [16 x sbyte] ; <[16 x sbyte]*> [#uses=0] + %.str_70 = external global [16 x sbyte] ; <[16 x sbyte]*> [#uses=0] + %.str_72 = external global [35 x sbyte] ; <[35 x sbyte]*> [#uses=0] + %.str_74 = external global [23 x sbyte] ; <[23 x sbyte]*> [#uses=0] + %.str_76 = external global [24 x sbyte] ; <[24 x sbyte]*> [#uses=0] + %.str_78 = external global [57 x sbyte] ; <[57 x sbyte]*> [#uses=0] + %.str_80 = external global [45 x sbyte] ; <[45 x sbyte]*> [#uses=0] + %.str_82 = external global [22 x sbyte] ; <[22 x sbyte]*> [#uses=0] + %.str_84 = external global [10 x sbyte] ; <[10 x sbyte]*> [#uses=0] + %.str_86 = external global [19 x sbyte] ; <[19 x sbyte]*> [#uses=0] + %.str_88 = external global [7 x sbyte] ; <[7 x sbyte]*> [#uses=0] + %.str_90 = external global [31 x sbyte] ; <[31 x sbyte]*> [#uses=0] + %.str_92 = external global [19 x sbyte] ; <[19 x sbyte]*> [#uses=0] + %.str_94 = external global [30 x sbyte] ; <[30 x sbyte]*> [#uses=0] + %.str_95 = external global [48 x sbyte] ; <[48 x sbyte]*> [#uses=0] + %.str_97 = external global [18 x sbyte] ; <[18 x sbyte]*> [#uses=0] + %.str_98 = external global [36 x sbyte] ; <[36 x sbyte]*> [#uses=0] + %.str_100 = external global [22 x sbyte] ; <[22 x sbyte]*> [#uses=0] + %.str_163 = external global [38 x sbyte] ; <[38 x sbyte]*> [#uses=0] + %.str_2 = external global [38 x sbyte] ; <[38 x sbyte]*> [#uses=0] + %.str_3 = external global [50 x sbyte] ; <[50 x sbyte]*> [#uses=0] + %.str_4 = external global [50 x sbyte] ; <[50 x sbyte]*> [#uses=0] + %.str_5 = external global [51 x sbyte] ; <[51 x sbyte]*> [#uses=0] + %.str_6 = external global [30 x sbyte] ; <[30 x sbyte]*> [#uses=0] + %.str_7 = external global [28 x sbyte] ; <[28 x sbyte]*> [#uses=0] + %.str_8 = external global [33 x sbyte] ; <[33 x sbyte]*> [#uses=0] + %.str_9 = external global [54 x sbyte] ; <[54 x sbyte]*> [#uses=0] + %.str_10 = external global [47 x sbyte] ; <[47 x sbyte]*> [#uses=0] + %.str_11 = external global [46 x sbyte] ; <[46 x sbyte]*> [#uses=0] + %.str_12 = external global [47 x sbyte] ; <[47 x sbyte]*> [#uses=0] + %.str_13 = external global [46 x sbyte] ; <[46 x sbyte]*> [#uses=0] + %.str_14 = external global [35 x sbyte] ; <[35 x sbyte]*> [#uses=0] + %.str_15 = external global [36 x sbyte] ; <[36 x sbyte]*> [#uses=0] + %.str_16 = external global [35 x sbyte] ; <[35 x sbyte]*> [#uses=0] + %.str_17 = external global [36 x sbyte] ; <[36 x sbyte]*> [#uses=0] + %.str_18 = external global [35 x sbyte] ; <[35 x sbyte]*> [#uses=0] + %.str_19 = external global [41 x sbyte] ; <[41 x sbyte]*> [#uses=0] + %.str_20 = external global [36 x sbyte] ; <[36 x sbyte]*> [#uses=0] + %.str_22 = external global [35 x sbyte] ; <[35 x sbyte]*> [#uses=0] + %.str_23 = external global [39 x sbyte] ; <[39 x sbyte]*> [#uses=0] + %.str_24 = external global [36 x sbyte] ; <[36 x sbyte]*> [#uses=0] + %.str_26 = external global [35 x sbyte] ; <[35 x sbyte]*> [#uses=0] + %.str_27 = external global [40 x sbyte] ; <[40 x sbyte]*> [#uses=0] + %.str_28 = external global [36 x sbyte] ; <[36 x sbyte]*> [#uses=0] + %.str_30 = external global [35 x sbyte] ; <[35 x sbyte]*> [#uses=0] + %.str_31 = external global [40 x sbyte] ; <[40 x sbyte]*> [#uses=0] + %.str_32 = external global [36 x sbyte] ; <[36 x sbyte]*> [#uses=0] + %.str_33 = external global [40 x sbyte] ; <[40 x sbyte]*> [#uses=0] + %.str_34 = external global [39 x sbyte] ; <[39 x sbyte]*> [#uses=0] + %.str_3565 = external global [40 x sbyte] ; <[40 x sbyte]*> [#uses=0] + %.str_36 = external global [39 x sbyte] ; <[39 x sbyte]*> [#uses=0] + %.str_37 = external global [41 x sbyte] ; <[41 x sbyte]*> [#uses=0] + %.str_38 = external global [41 x sbyte] ; <[41 x sbyte]*> [#uses=0] + %.str_39 = external global [39 x sbyte] ; <[39 x sbyte]*> [#uses=0] + %.str_40 = external global [39 x sbyte] ; <[39 x sbyte]*> [#uses=0] + %.str_41 = external global [40 x sbyte] ; <[40 x sbyte]*> [#uses=0] + %.str_42 = external global [39 x sbyte] ; <[39 x sbyte]*> [#uses=0] + %.str_43 = external global [41 x sbyte] ; <[41 x sbyte]*> [#uses=0] + %.str_44 = external global [41 x sbyte] ; <[41 x sbyte]*> [#uses=0] + %.str_45 = external global [39 x sbyte] ; <[39 x sbyte]*> [#uses=0] + %.str_46 = external global [35 x sbyte] ; <[35 x sbyte]*> [#uses=0] + %.str_47 = external global [50 x sbyte] ; <[50 x sbyte]*> [#uses=0] + %.str_48 = external global [26 x sbyte] ; <[26 x sbyte]*> [#uses=0] + %.str_49 = external global [31 x sbyte] ; <[31 x sbyte]*> [#uses=0] + %.str_50 = external global [15 x sbyte] ; <[15 x sbyte]*> [#uses=0] + %.str_51 = external global [6 x sbyte] ; <[6 x sbyte]*> [#uses=0] + %.str_52 = external global [24 x sbyte] ; <[24 x sbyte]*> [#uses=0] + %.str_53 = external global [9 x sbyte] ; <[9 x sbyte]*> [#uses=0] + + implementation ; Functions: + + declare ulong %AttacksFrom(int, int) + + declare ulong %AttacksTo(int) + + declare int %Attacked(int, int) + + declare ulong %Mask(int) + + declare int %PopCnt(ulong) + + declare int %FirstOne(ulong) + + declare int %LastOne(ulong) + + declare int %DrawScore() + + declare int %Drawn(int) + + declare sbyte* %strchr(sbyte*, int) + + declare int %strcmp(sbyte*, sbyte*) + + declare uint %strlen(sbyte*) + + declare int %printf(sbyte*, ...) + + declare void %Edit() + + declare void %llvm.memcpy(sbyte*, sbyte*, uint, uint) + + declare int %fflush(%struct.__sFILE*) + + declare int %Read(int, sbyte*) + + declare int %ReadParse(sbyte*, sbyte**, sbyte*) + + declare void %DisplayChessBoard(%struct.__sFILE*, ulong, ulong, ulong, ulong, ulong, ulong, ulong, ulong, ulong, ulong, ulong, ulong, ulong, ulong, ulong, ulong, ulong, ulong, uint, int, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte, sbyte) + + declare void %SetChessBitBoards(%typedef.SEARCH_POSITION*) + + declare int %EnPrise(int, int) + + declare ulong %SwapXray(ulong, int, int) + + declare int %Evaluate(int, int, int, int) + + declare int %EvaluateMate() + + declare int %EvaluatePawns() + + declare int %EvaluatePassedPawns() + + declare int %EvaluatePassedPawnRaces(int) + + declare int %Swap(int, int, int) + + declare int %EvaluateDevelopment(int) + + declare int %EvaluateDraws() + + declare int %HasOpposition(int, int, int) + + declare void %HistoryBest(int, int, int) + + declare void %HistoryRefutation(int, int, int) + + declare int %sprintf(sbyte*, sbyte*, ...) + + declare void %Initialize(int) + + declare void %InitializeZeroMasks() + + declare void %InitializeMasks() + + declare void %InitializeRandomHash() + + declare void %InitializeAttackBoards() + + declare void %InitializePawnMasks() + + declare void %InitializePieceMasks() + + declare void %InitializeChessBoard(%typedef.SEARCH_POSITION*) + + declare %struct.__sFILE* %fopen(sbyte*, sbyte*) + + int %Option() { + no_exit.53.outer: + %tmp.4747 = shl int 7, ubyte 3 ; [#uses=1] + %tmp.4779 = seteq %struct.__sFILE* getelementptr ([0 x %struct.__sFILE]* %__sF, int 0, int 1), null ; [#uses=2] + br label %no_exit.53 + + no_exit.53: ; preds = %else.166, %else.168, %then.360, %no_exit.53.outer + %file.2.3.3.ph = phi int [ 0, %no_exit.53.outer ], [ %inc.551688, %then.360 ], [ %inc.551701, %else.168 ], [ %file.2.3.3.ph, %else.166 ] ; [#uses=2] + %nempty.5.3.ph = phi int [ 0, %no_exit.53.outer ], [ %nempty.5.3, %then.360 ], [ %nempty.5.3, %else.168 ], [ %nempty.5.3.ph, %else.166 ] ; [#uses=2] + %indvar2053 = phi uint [ 0, %no_exit.53.outer ], [ 0, %then.360 ], [ 0, %else.168 ], [ %indvar.next2054, %else.166 ] ; [#uses=2] + %indvar2053 = cast uint %indvar2053 to int ; [#uses=2] + %file.2.3.3 = add int %indvar2053, %file.2.3.3.ph ; [#uses=4] + %nempty.5.3 = add int %indvar2053, %nempty.5.3.ph ; [#uses=3] + %tmp.4749 = add int %file.2.3.3, %tmp.4747 ; [#uses=1] + %tmp.4750 = getelementptr %typedef.CHESS_POSITION* %search, int 0, uint 22, int %tmp.4749 ; [#uses=3] + %tmp.4751 = load sbyte* %tmp.4750 ; [#uses=1] + %tmp.4752 = seteq sbyte %tmp.4751, 0 ; [#uses=1] + br bool %tmp.4752, label %else.166, label %then.357 + + then.357: ; preds = %no_exit.53 + %tmp.4755 = seteq int %nempty.5.3, 0 ; [#uses=1] + br bool %tmp.4755, label %endif.358, label %then.358 + + then.358: ; preds = %then.357 + ret int 0 + + endif.358: ; preds = %then.357 + br bool %tmp.4779, label %else.168, label %then.360 + + then.360: ; preds = %endif.358 + %tmp.4791 = load sbyte* %tmp.4750 ; [#uses=1] + %tmp.4792 = cast sbyte %tmp.4791 to int ; [#uses=1] + %tmp.4793 = add int %tmp.4792, 7 ; [#uses=1] + %tmp.4794 = getelementptr [15 x sbyte]* null, int 0, int %tmp.4793 ; [#uses=1] + %tmp.4795 = load sbyte* %tmp.4794 ; [#uses=1] + %tmp.4796 = cast sbyte %tmp.4795 to int ; [#uses=1] + %tmp.4781 = call int (%struct.__sFILE*, sbyte*, ...)* %fprintf( %struct.__sFILE* getelementptr ([0 x %struct.__sFILE]* %__sF, int 0, int 1), sbyte* getelementptr ([3 x sbyte]* %.str_36, int 0, int 0), int %tmp.4796 ) ; [#uses=0] + %inc.551688 = add int %file.2.3.3, 1 ; [#uses=2] + %tmp.47421699 = setlt int %inc.551688, 8 ; [#uses=1] + br bool %tmp.47421699, label %no_exit.53, label %loopexit.56 + + else.168: ; preds = %endif.358 + %tmp.4799 = call uint %strlen( sbyte* getelementptr ([80 x sbyte]* %initial_position, int 0, int 0) ) ; [#uses=2] + %tmp.4802 = getelementptr [80 x sbyte]* %initial_position, int 0, uint %tmp.4799 ; [#uses=1] + %tmp.4811 = load sbyte* %tmp.4750 ; [#uses=1] + %tmp.4812 = cast sbyte %tmp.4811 to int ; [#uses=1] + %tmp.4813 = add int %tmp.4812, 7 ; [#uses=1] + %tmp.4814 = getelementptr [15 x sbyte]* null, int 0, int %tmp.4813 ; [#uses=1] + %tmp.4815 = load sbyte* %tmp.4814 ; [#uses=1] + store sbyte %tmp.4815, sbyte* %tmp.4802 + %tmp.4802.sum = add uint %tmp.4799, 1 ; [#uses=1] + %tmp.4802.end = getelementptr [80 x sbyte]* %initial_position, int 0, uint %tmp.4802.sum ; [#uses=1] + store sbyte 0, sbyte* %tmp.4802.end + %inc.551701 = add int %file.2.3.3, 1 ; [#uses=2] + %tmp.47421703 = setlt int %inc.551701, 8 ; [#uses=1] + br bool %tmp.47421703, label %no_exit.53, label %loopexit.56 + + else.166: ; preds = %no_exit.53 + %inc.55 = add int %file.2.3.3, 1 ; [#uses=1] + %tmp.47421705 = setlt int %inc.55, 8 ; [#uses=1] + %indvar.next2054 = add uint %indvar2053, 1 ; [#uses=1] + br bool %tmp.47421705, label %no_exit.53, label %loopexit.56 + + loopexit.56: ; preds = %else.166, %else.168, %then.360 + br bool %tmp.4779, label %else.169, label %then.361 + + then.361: ; preds = %loopexit.56 + %tmp.4822 = call uint %fwrite( sbyte* getelementptr ([2 x sbyte]* %.str_654, int 0, int 0), uint 1, uint 1, %struct.__sFILE* getelementptr ([0 x %struct.__sFILE]* %__sF, int 0, int 1) ) ; [#uses=0] + %dec.101707 = add int 7, -1 ; [#uses=1] + %tmp.47391709 = setgt int %dec.101707, -1 ; [#uses=0] + ret int 0 + + else.169: ; preds = %loopexit.56 + %tmp.4827 = call uint %strlen( sbyte* getelementptr ([80 x sbyte]* %initial_position, int 0, int 0) ) ; [#uses=2] + %tmp.4830 = getelementptr [80 x sbyte]* %initial_position, int 0, uint %tmp.4827 ; [#uses=1] + store sbyte 47, sbyte* %tmp.4830 + %tmp.4830.sum = add uint %tmp.4827, 1 ; [#uses=1] + %tmp.4830.end = getelementptr [80 x sbyte]* %initial_position, int 0, uint %tmp.4830.sum ; [#uses=1] + store sbyte 0, sbyte* %tmp.4830.end + %dec.10 = add int 7, -1 ; [#uses=1] + %tmp.47391711 = setgt int %dec.10, -1 ; [#uses=0] + ret int 0 + } + + declare void %InitializeHashTables() + + declare int %InitializeFindAttacks(int, int, int) + + declare void %SetBoard(int, sbyte**, int) + + declare int %KingPawnSquare(int, int, int, int) + + declare ulong %Random64() + + declare uint %Random32() + + declare sbyte* %strcpy(sbyte*, sbyte*) + + declare int %InputMove(sbyte*, int, int, int, int) + + declare int %InputMoveICS(sbyte*, int, int, int, int) + + declare int* %GenerateCaptures(int, int, int*) + + declare int* %GenerateNonCaptures(int, int, int*) + + declare void %MakeMove(int, int, int) + + declare void %UnMakeMove(int, int, int) + + declare void %Interrupt(int) + + declare uint %GetTime(uint) + + declare sbyte* %DisplayTime(uint) + + declare sbyte* %OutputMoveICS(int*) + + declare void %Delay(int) + + declare int %fprintf(%struct.__sFILE*, sbyte*, ...) + + declare void %SignalInterrupt(int) + + declare void (int)* %signal(int, void (int)*) + + declare int %Iterate(int, int, int) + + declare void %PreEvaluate(int) + + declare void %RootMoveList(int) + + declare sbyte* %OutputMove(int*, int, int) + + declare void %TimeSet(int) + + declare void %StorePV(int, int) + + declare int %SearchRoot(int, int, int, int) + + declare void %Whisper(int, int, int, int, uint, int, sbyte*) + + declare sbyte* %DisplayEvaluation(int) + + declare int %LookUp(int, int, int, int*, int*) + + declare sbyte* %strstr(sbyte*, sbyte*) + + declare int %main(int, sbyte**) + + declare void %__main() + + declare int %atoi(sbyte*) + + declare void %NewGame(int) + + declare int %Ponder(int) + + declare int %fseek(%struct.__sFILE*, int, int) + + declare void %MakeMoveRoot(int, int) + + declare int %RepetitionDraw(int) + + declare sbyte* %Reverse() + + declare sbyte* %Normal() + + declare void %TimeAdjust(int, uint) + + declare void %ValidatePosition(int, int, sbyte*) + + declare int %ValidMove(int, int, int) + + declare int* %GenerateCheckEvasions(int, int, int*) + + declare ulong %InterposeSquares(int, int, int) + + declare int %PinnedOnKing(int, int) + + declare int %NextMove(int, int) + + declare int %NextEvasion(int, int) + + declare int %NextRootMove(int) + + declare int %TimeCheck(int) + + declare int %strncmp(sbyte*, sbyte*, uint) + + declare void %exit(int) + + declare int %OptionMatch(sbyte*, sbyte*) + + declare int %fclose(%struct.__sFILE*) + + declare int %ParseTime(sbyte*) + + declare sbyte* %DisplayHHMM(uint) + + declare void %DisplayPieceBoards(int*, int*) + + declare int %fscanf(%struct.__sFILE*, sbyte*, ...) + + declare int %feof(%struct.__sFILE*) + + declare sbyte* %fgets(sbyte*, int, %struct.__sFILE*) + + declare int %remove(sbyte*) + + declare int %__tolower(int) + + declare uint %clock() + + declare void %OptionPerft(int, int, int) + + declare void %Phase() + + declare int %ReadNextMove(sbyte*, int, int) + + declare int %time(int*) + + declare %struct.tm* %localtime(int*) + + declare sbyte* %gets(sbyte*) + + declare int %OutputGood(sbyte*, int, int) + + declare int %CheckInput() + + declare void %ClearHashTables() + + declare int %Quiesce(int, int, int, int) + + declare void %SearchTrace(int, int, int, int, int, sbyte*, int) + + declare int %RepetitionCheck(int, int) + + declare void %ResignOrDraw(int, int) + + declare int %Search(int, int, int, int, int, int) + + declare void %StoreRefutation(int, int, int, int) + + declare void %StoreBest(int, int, int, int, int) + + declare void %SearchOutput(int, int) + + declare uint %strspn(sbyte*, sbyte*) + + declare int %isatty(int) + + declare int %fileno(%struct.__sFILE*) + + declare void %llvm.memset(sbyte*, ubyte, uint, uint) + + declare int %select(int, %struct.fd_set*, %struct.fd_set*, %struct.fd_set*, %struct.timeval*) + + declare void %DisplayBitBoard(ulong) + + declare sbyte* %DisplayEvaluationWhisper(int) + + declare sbyte* %DisplayTimeWhisper(uint) + + declare void %Display64bitWord(ulong) + + declare void %Display2BitBoards(ulong, ulong) + + declare void %DisplayChessMove(sbyte*, int) + + declare void %llvm.memmove(sbyte*, sbyte*, uint, uint) + + declare void %ReadClear() + + declare sbyte* %strtok(sbyte*, sbyte*) + + declare int %SpecReadRaw() + + declare int %read(int, sbyte*, uint) + + declare int* %__error() + + declare int %ReadChessMove(%struct.__sFILE*, int, int) + + declare ulong %ValidateComputeBishopAttacks(int) + + declare ulong %ValidateComputeRookAttacks(int) + + declare sbyte* %memchr(sbyte*, int, uint) + + declare uint %fwrite(sbyte*, uint, uint, %struct.__sFILE*) From lattner at cs.uiuc.edu Tue Feb 14 18:07:54 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 14 Feb 2006 18:07:54 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Message-ID: <200602150007.SAA16300@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LoopUnswitch.cpp updated: 1.18 -> 1.19 --- Log message: pull some code out into a function --- Diffs of the changes: (+28 -18) LoopUnswitch.cpp | 46 ++++++++++++++++++++++++++++------------------ 1 files changed, 28 insertions(+), 18 deletions(-) Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.18 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.19 --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.18 Mon Feb 13 19:01:41 2006 +++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Tue Feb 14 18:07:43 2006 @@ -432,6 +432,28 @@ return New; } +/// EmitPreheaderBranchOnCondition - Emit a conditional branch on two values +/// if LIC == Val, branch to TrueDst, otherwise branch to FalseDest. Insert the +/// code immediately before InsertPt. +static void EmitPreheaderBranchOnCondition(Value *LIC, Constant *Val, + BasicBlock *TrueDest, + BasicBlock *FalseDest, + Instruction *InsertPt) { + // Insert a conditional branch on LIC to the two preheaders. The original + // code is the true version and the new code is the false version. + Value *BranchVal = LIC; + if (!isa(BranchVal)) { + BranchVal = BinaryOperator::createSetEQ(LIC, Val, "tmp", InsertPt); + } else if (Val != ConstantBool::True) { + // We want to enter the new loop when the condition is true. + std::swap(TrueDest, FalseDest); + } + + // Insert the new branch. + new BranchInst(TrueDest, FalseDest, BranchVal, InsertPt); +} + + /// UnswitchTrivialCondition - Given a loop that has a trivial unswitchable /// condition in it (a cond branch from its header block to its latch block, /// where the path through the loop that doesn't execute its body has no @@ -505,6 +527,7 @@ std::sort(ExitBlocks.begin(), ExitBlocks.end()); ExitBlocks.erase(std::unique(ExitBlocks.begin(), ExitBlocks.end()), ExitBlocks.end()); + // Split all of the edges from inside the loop to their exit blocks. This // unswitching trivial: no phi nodes to update. unsigned NumBlocks = L->getBlocks().size(); @@ -583,26 +606,13 @@ RemapInstruction(I, ValueMap); // Rewrite the original preheader to select between versions of the loop. - assert(isa(OrigPreheader->getTerminator()) && - cast(OrigPreheader->getTerminator())->isUnconditional() && - OrigPreheader->getTerminator()->getSuccessor(0) == LoopBlocks[0] && + BranchInst *OldBR = cast(OrigPreheader->getTerminator()); + assert(OldBR->isUnconditional() && OldBR->getSuccessor(0) == LoopBlocks[0] && "Preheader splitting did not work correctly!"); - // Insert a conditional branch on LIC to the two preheaders. The original - // code is the true version and the new code is the false version. - Value *BranchVal = LIC; - if (!isa(BranchVal)) { - BranchVal = BinaryOperator::createSetEQ(LIC, Val, "tmp", - OrigPreheader->getTerminator()); - } else if (Val != ConstantBool::True) { - // We want to enter the new loop when the condition is true. - BranchVal = BinaryOperator::createNot(BranchVal, "tmp", - OrigPreheader->getTerminator()); - } - - // Remove the unconditional branch to LoopBlocks[0] and insert the new branch. - OrigPreheader->getInstList().pop_back(); - new BranchInst(NewBlocks[0], LoopBlocks[0], BranchVal, OrigPreheader); + // Emit the new branch that selects between the two versions of this loop. + EmitPreheaderBranchOnCondition(LIC, Val, NewBlocks[0], LoopBlocks[0], OldBR); + OldBR->eraseFromParent(); // Now we rewrite the original code to know that the condition is true and the // new code to know that the condition is false. From evan.cheng at apple.com Tue Feb 14 18:11:49 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 14 Feb 2006 18:11:49 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86InstrInfo.td Message-ID: <200602150011.SAA16334@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86InstrInfo.td updated: 1.231 -> 1.232 --- Log message: movaps, movapd encoding bug. --- Diffs of the changes: (+8 -8) X86InstrInfo.td | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) Index: llvm/lib/Target/X86/X86InstrInfo.td diff -u llvm/lib/Target/X86/X86InstrInfo.td:1.231 llvm/lib/Target/X86/X86InstrInfo.td:1.232 --- llvm/lib/Target/X86/X86InstrInfo.td:1.231 Mon Feb 6 17:41:19 2006 +++ llvm/lib/Target/X86/X86InstrInfo.td Tue Feb 14 18:11:37 2006 @@ -3015,34 +3015,34 @@ def MOVAPSrr : I<0x28, MRMSrcMem, (ops V4F4:$dst, V4F4:$src), "movaps {$src, $dst|$dst, $src}", []>, - Requires<[HasSSE1]>, XS; + Requires<[HasSSE1]>, TB; def MOVAPDrr : I<0x28, MRMSrcMem, (ops V2F8:$dst, V2F8:$src), "movapd {$src, $dst|$dst, $src}", []>, - Requires<[HasSSE2]>, XD; + Requires<[HasSSE2]>, TB, OpSize; def MOVAPSrm : I<0x28, MRMSrcMem, (ops V4F4:$dst, f128mem:$src), "movaps {$src, $dst|$dst, $src}", []>, - Requires<[HasSSE1]>, XS; + Requires<[HasSSE1]>, TB; def MOVAPSmr : I<0x29, MRMDestMem, (ops f128mem:$dst, V4F4:$src), "movaps {$src, $dst|$dst, $src}",[]>, - Requires<[HasSSE1]>, XD; + Requires<[HasSSE1]>, TB; def MOVAPDrm : I<0x28, MRMSrcMem, (ops V2F8:$dst, f128mem:$src), "movapd {$src, $dst|$dst, $src}", []>, - Requires<[HasSSE1]>, XD; + Requires<[HasSSE1]>, TB, OpSize; def MOVAPDmr : I<0x29, MRMDestMem, (ops f128mem:$dst, V2F8:$src), "movapd {$src, $dst|$dst, $src}",[]>, - Requires<[HasSSE2]>, XD; + Requires<[HasSSE2]>, TB, OpSize; // Pseudo-instructions to load FR32 / FR64 from f128mem using movaps / movapd. // Upper bits are disregarded. def MOVSAPSrm : I<0x28, MRMSrcMem, (ops FR32:$dst, f128mem:$src), "movaps {$src, $dst|$dst, $src}", [(set FR32:$dst, (X86loadpf32 addr:$src))]>, - Requires<[HasSSE1]>, XS; + Requires<[HasSSE1]>, TB; def MOVSAPDrm : I<0x28, MRMSrcMem, (ops FR64:$dst, f128mem:$src), "movapd {$src, $dst|$dst, $src}", [(set FR64:$dst, (X86loadpf64 addr:$src))]>, - Requires<[HasSSE1]>, XD; + Requires<[HasSSE2]>, TB, OpSize; //===----------------------------------------------------------------------===// From evan.cheng at apple.com Tue Feb 14 18:31:15 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 14 Feb 2006 18:31:15 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86InstrInfo.td Message-ID: <200602150031.SAA16415@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86InstrInfo.td updated: 1.232 -> 1.233 --- Log message: cvtsd2ss / cvtss2sd encoding bug. --- Diffs of the changes: (+4 -4) X86InstrInfo.td | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm/lib/Target/X86/X86InstrInfo.td diff -u llvm/lib/Target/X86/X86InstrInfo.td:1.232 llvm/lib/Target/X86/X86InstrInfo.td:1.233 --- llvm/lib/Target/X86/X86InstrInfo.td:1.232 Tue Feb 14 18:11:37 2006 +++ llvm/lib/Target/X86/X86InstrInfo.td Tue Feb 14 18:31:03 2006 @@ -2423,19 +2423,19 @@ def CVTSS2SDrr: I<0x5A, MRMSrcReg, (ops FR64:$dst, FR32:$src), "cvtss2sd {$src, $dst|$dst, $src}", [(set FR64:$dst, (fextend FR32:$src))]>, - Requires<[HasSSE2]>, XD; + Requires<[HasSSE2]>, XS; def CVTSS2SDrm: I<0x5A, MRMSrcMem, (ops FR64:$dst, f32mem:$src), "cvtss2sd {$src, $dst|$dst, $src}", [(set FR64:$dst, (fextend (loadf32 addr:$src)))]>, - Requires<[HasSSE2]>, XD; + Requires<[HasSSE2]>, XS; def CVTSD2SSrr: I<0x5A, MRMSrcReg, (ops FR32:$dst, FR64:$src), "cvtsd2ss {$src, $dst|$dst, $src}", [(set FR32:$dst, (fround FR64:$src))]>, - Requires<[HasSSE2]>, XS; + Requires<[HasSSE2]>, XD; def CVTSD2SSrm: I<0x5A, MRMSrcMem, (ops FR32:$dst, f64mem:$src), "cvtsd2ss {$src, $dst|$dst, $src}", [(set FR32:$dst, (fround (loadf64 addr:$src)))]>, - Requires<[HasSSE2]>, XS; + Requires<[HasSSE2]>, XD; def CVTSI2SSrr: I<0x2A, MRMSrcReg, (ops FR32:$dst, R32:$src), "cvtsi2ss {$src, $dst|$dst, $src}", [(set FR32:$dst, (sint_to_fp R32:$src))]>, From lattner at cs.uiuc.edu Tue Feb 14 19:44:53 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Tue, 14 Feb 2006 19:44:53 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Message-ID: <200602150144.TAA16807@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LoopUnswitch.cpp updated: 1.19 -> 1.20 --- Log message: more refactoring, no functionality change. --- Diffs of the changes: (+11 -12) LoopUnswitch.cpp | 23 +++++++++++------------ 1 files changed, 11 insertions(+), 12 deletions(-) Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.19 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.20 --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.19 Tue Feb 14 18:07:43 2006 +++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Tue Feb 14 19:44:42 2006 @@ -77,7 +77,7 @@ BasicBlock *SplitEdge(BasicBlock *From, BasicBlock *To); void RewriteLoopBodyWithConditionConstant(Loop *L, Value *LIC,Constant *Val, bool isEqual); - void UnswitchTrivialCondition(Loop *L, Value *Cond, bool EntersLoopOnCond, + void UnswitchTrivialCondition(Loop *L, Value *Cond, Constant *Val, BasicBlock *ExitBlock); }; RegisterOpt X("loop-unswitch", "Unswitch loops"); @@ -154,7 +154,7 @@ /// runs when the condition is true, False if the loop body executes when the /// condition is false. Otherwise, return null to indicate a complex condition. static bool IsTrivialUnswitchCondition(Loop *L, Value *Cond, - bool *CondEntersLoop = 0, + Constant **Val = 0, BasicBlock **LoopExit = 0) { BasicBlock *Header = L->getHeader(); BranchInst *HeaderTerm = dyn_cast(Header->getTerminator()); @@ -170,9 +170,9 @@ // the loop. BasicBlock *Latch = L->getLoopLatch(); if (HeaderTerm->getSuccessor(1) == Latch) { - if (CondEntersLoop) *CondEntersLoop = true; + if (Val) *Val = ConstantBool::True; } else if (HeaderTerm->getSuccessor(0) == Latch) - if (CondEntersLoop) *CondEntersLoop = false; + if (Val) *Val = ConstantBool::False; else return false; // Doesn't branch to latch block. @@ -333,10 +333,10 @@ // If this is a trivial condition to unswitch (which results in no code // duplication), do it now. - bool EntersLoopOnCond; + Constant *CondVal; BasicBlock *ExitBlock; - if (IsTrivialUnswitchCondition(L, LoopCond, &EntersLoopOnCond, &ExitBlock)){ - UnswitchTrivialCondition(L, LoopCond, EntersLoopOnCond, ExitBlock); + if (IsTrivialUnswitchCondition(L, LoopCond, &CondVal, &ExitBlock)){ + UnswitchTrivialCondition(L, LoopCond, CondVal, ExitBlock); NewLoop1 = L; } else { VersionLoop(LoopCond, Val, L, NewLoop1, NewLoop2); @@ -460,7 +460,7 @@ /// side-effects), unswitch it. This doesn't involve any code duplication, just /// moving the conditional branch outside of the loop and updating loop info. void LoopUnswitch::UnswitchTrivialCondition(Loop *L, Value *Cond, - bool EnterOnCond, + Constant *Val, BasicBlock *ExitBlock) { DEBUG(std::cerr << "loop-unswitch: Trivial-Unswitch loop %" << L->getHeader()->getName() << " [" << L->getBlocks().size() @@ -484,15 +484,14 @@ // Okay, now we have a position to branch from and a position to branch to, // insert the new conditional branch. - new BranchInst(EnterOnCond ? NewPH : NewExit, EnterOnCond ? NewExit : NewPH, - Cond, OrigPH->getTerminator()); + EmitPreheaderBranchOnCondition(Cond, Val, NewPH, NewExit, + OrigPH->getTerminator()); OrigPH->getTerminator()->eraseFromParent(); // Now that we know that the loop is never entered when this condition is a // particular value, rewrite the loop with this info. We know that this will // at least eliminate the old branch. - RewriteLoopBodyWithConditionConstant(L, Cond, ConstantBool::get(EnterOnCond), - true); + RewriteLoopBodyWithConditionConstant(L, Cond, Val, true); ++NumTrivial; } From evan.cheng at apple.com Tue Feb 14 19:55:03 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 14 Feb 2006 19:55:03 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200602150155.TAA16855@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.159 -> 1.160 --- Log message: Lower memcpy with small constant size operand into a series of load / store ops. --- Diffs of the changes: (+34 -8) SelectionDAGISel.cpp | 42 ++++++++++++++++++++++++++++++++++-------- 1 files changed, 34 insertions(+), 8 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.159 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.160 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.159 Tue Feb 14 17:05:54 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Feb 14 19:54:51 2006 @@ -1641,18 +1641,44 @@ MVT::ValueType VT = MemOps[i]; unsigned VTSize = getSizeInBits(VT) / 8; SDOperand Value = getMemsetValue(Op2, VT, DAG); - OutChains. - push_back(DAG.getNode(ISD::STORE, MVT::Other, getRoot(), - Value, - getMemBasePlusOffset(Op1, Offset, DAG, TLI), - DAG.getSrcValue(NULL))); + SDOperand Store = DAG.getNode(ISD::STORE, MVT::Other, getRoot(), + Value, + getMemBasePlusOffset(Op1, Offset, DAG, TLI), + DAG.getSrcValue(I.getOperand(1), Offset)); + OutChains.push_back(Store); Offset += VTSize; } - - DAG.setRoot(DAG.getNode(ISD::TokenFactor, MVT::Other, OutChains)); - return; } + break; } + case ISD::MEMCPY: { + if (MeetsMaxMemopRequirement(MemOps, TLI.getMaxStoresPerMemcpy(), + Size->getValue(), Align, TLI)) { + unsigned NumMemOps = MemOps.size(); + unsigned Offset = 0; + for (unsigned i = 0; i < NumMemOps; i++) { + MVT::ValueType VT = MemOps[i]; + unsigned VTSize = getSizeInBits(VT) / 8; + SDOperand Value = + DAG.getLoad(VT, getRoot(), + getMemBasePlusOffset(Op2, Offset, DAG, TLI), + DAG.getSrcValue(I.getOperand(2), Offset)); + SDOperand Store = + DAG.getNode(ISD::STORE, MVT::Other, Value.getValue(1), + Value, + getMemBasePlusOffset(Op1, Offset, DAG, TLI), + DAG.getSrcValue(I.getOperand(1), Offset)); + OutChains.push_back(Store); + Offset += VTSize; + } + } + break; + } + } + + if (!OutChains.empty()) { + DAG.setRoot(DAG.getNode(ISD::TokenFactor, MVT::Other, OutChains)); + return; } } From evan.cheng at apple.com Tue Feb 14 19:56:35 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 14 Feb 2006 19:56:35 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86AsmPrinter.cpp Message-ID: <200602150156.TAA16870@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86AsmPrinter.cpp updated: 1.164 -> 1.165 --- Log message: Use .zerofill on x86/darwin. --- Diffs of the changes: (+22 -15) X86AsmPrinter.cpp | 37 ++++++++++++++++++++++--------------- 1 files changed, 22 insertions(+), 15 deletions(-) Index: llvm/lib/Target/X86/X86AsmPrinter.cpp diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.164 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.165 --- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.164 Wed Feb 8 17:42:22 2006 +++ llvm/lib/Target/X86/X86AsmPrinter.cpp Tue Feb 14 19:56:23 2006 @@ -96,24 +96,31 @@ if (C->isNullValue() && /* FIXME: Verify correct */ (I->hasInternalLinkage() || I->hasWeakLinkage() || - I->hasLinkOnceLinkage())) { + I->hasLinkOnceLinkage() || + (forDarwin && I->hasExternalLinkage() && !I->hasSection()))) { if (Size == 0) Size = 1; // .comm Foo, 0 is undefined, avoid it. - SwitchSection(".data", I); - if (LCOMMDirective != NULL) { - if (I->hasInternalLinkage()) { - O << LCOMMDirective << name << "," << Size; - if (forDarwin) - O << "," << (AlignmentIsInBytes ? (1 << Align) : Align); - } else - O << COMMDirective << name << "," << Size; + if (I->hasExternalLinkage()) { + O << "\t.global\t" << name << "\n"; + O << "\t.zerofill __DATA__, __common, " << name << ", " + << Size << ", " << Align; } else { - if (I->hasInternalLinkage()) - O <<"\t.local\t" << name << "\n"; - O << COMMDirective << name << "," << Size; - if (COMMDirectiveTakesAlignment) - O << "," << (AlignmentIsInBytes ? (1 << Align) : Align); + SwitchSection(".data", I); + if (LCOMMDirective != NULL) { + if (I->hasInternalLinkage()) { + O << LCOMMDirective << name << "," << Size; + if (forDarwin) + O << "," << (AlignmentIsInBytes ? (1 << Align) : Align); + } else + O << COMMDirective << name << "," << Size; + } else { + if (I->hasInternalLinkage()) + O << "\t.local\t" << name << "\n"; + O << COMMDirective << name << "," << Size; + if (COMMDirectiveTakesAlignment) + O << "," << (AlignmentIsInBytes ? (1 << Align) : Align); + } + O << "\t\t" << CommentString << " " << I->getName() << "\n"; } - O << "\t\t" << CommentString << " " << I->getName() << "\n"; } else { switch (I->getLinkage()) { case GlobalValue::LinkOnceLinkage: From evan.cheng at apple.com Tue Feb 14 19:57:00 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 14 Feb 2006 19:57:00 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/README.txt Message-ID: <200602150157.TAA16882@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: README.txt updated: 1.53 -> 1.54 --- Log message: Remove an entry. --- Diffs of the changes: (+0 -5) README.txt | 5 ----- 1 files changed, 5 deletions(-) Index: llvm/lib/Target/X86/README.txt diff -u llvm/lib/Target/X86/README.txt:1.53 llvm/lib/Target/X86/README.txt:1.54 --- llvm/lib/Target/X86/README.txt:1.53 Tue Feb 14 16:19:54 2006 +++ llvm/lib/Target/X86/README.txt Tue Feb 14 19:56:48 2006 @@ -443,8 +443,3 @@ movw al, 8(%edx) when we can spare a register. It reduces code size. - -//===---------------------------------------------------------------------===// - -Use .zerofill on x86/darwin when appropriate. - From duraid at octopus.com.au Tue Feb 14 21:16:07 2006 From: duraid at octopus.com.au (Duraid Madina) Date: Tue, 14 Feb 2006 21:16:07 -0600 Subject: [llvm-commits] CVS: llvm/autoconf/configure.ac Message-ID: <200602150316.VAA17105@zion.cs.uiuc.edu> Changes in directory llvm/autoconf: configure.ac updated: 1.207 -> 1.208 --- Log message: previously, configure would die if GCC or ICC was not found. Now it'll go through, but we do want to know if we're using GCC/ICC since they share certain funky command line options (for dependency generation stuff) --- Diffs of the changes: (+0 -11) configure.ac | 11 ----------- 1 files changed, 11 deletions(-) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.207 llvm/autoconf/configure.ac:1.208 --- llvm/autoconf/configure.ac:1.207 Sat Feb 4 23:56:51 2006 +++ llvm/autoconf/configure.ac Tue Feb 14 21:15:55 2006 @@ -412,17 +412,6 @@ ;; esac -if test "$GCC" != "yes" && test "$ICC" != "yes" -then - AC_MSG_ERROR([gcc|icc required but not found]) -fi - -dnl Ensure that compilation tools are GCC; we use GCC specific extensions -if test "$GXX" != "yes" && test "$IXX" != "yes" -then - AC_MSG_ERROR([g++|icc required but not found]) -fi - dnl Verify that GCC is version 3.0 or higher if test "$GCC" = "yes" then From duraid at octopus.com.au Tue Feb 14 21:17:04 2006 From: duraid at octopus.com.au (Duraid Madina) Date: Tue, 14 Feb 2006 21:17:04 -0600 Subject: [llvm-commits] CVS: llvm/configure Message-ID: <200602150317.VAA17117@zion.cs.uiuc.edu> Changes in directory llvm: configure updated: 1.209 -> 1.210 --- Log message: zap --- Diffs of the changes: (+0 -14) configure | 14 -------------- 1 files changed, 14 deletions(-) Index: llvm/configure diff -u llvm/configure:1.209 llvm/configure:1.210 --- llvm/configure:1.209 Sun Feb 5 00:26:43 2006 +++ llvm/configure Tue Feb 14 21:16:52 2006 @@ -24870,20 +24870,6 @@ ;; esac -if test "$GCC" != "yes" && test "$ICC" != "yes" -then - { { echo "$as_me:$LINENO: error: gcc|icc required but not found" >&5 -echo "$as_me: error: gcc|icc required but not found" >&2;} - { (exit 1); exit 1; }; } -fi - -if test "$GXX" != "yes" && test "$IXX" != "yes" -then - { { echo "$as_me:$LINENO: error: g++|icc required but not found" >&5 -echo "$as_me: error: g++|icc required but not found" >&2;} - { (exit 1); exit 1; }; } -fi - if test "$GCC" = "yes" then gccmajor=`$CC --version | head -n 1 | sed 's/[^0-9]*\([0-9.]\).*/\1/'` From duraid at octopus.com.au Tue Feb 14 21:20:28 2006 From: duraid at octopus.com.au (Duraid Madina) Date: Tue, 14 Feb 2006 21:20:28 -0600 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200602150320.VAA17199@zion.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.342 -> 1.343 --- Log message: oops, I meant this --- Diffs of the changes: (+1 -1) Makefile.rules | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.342 llvm/Makefile.rules:1.343 --- llvm/Makefile.rules:1.342 Mon Feb 13 23:12:00 2006 +++ llvm/Makefile.rules Tue Feb 14 21:20:16 2006 @@ -347,7 +347,7 @@ CompileCommonOpts := -Wall -W -Wwrite-strings -Wno-unused ifeq ($(OS),HP-UX) - CompileCommonOpts += -D_REENTRANT -D_HPUX_SOURCE + CompileCommonOpts := -D_REENTRANT -D_HPUX_SOURCE endif LD.Flags += -L$(LibDir) -L$(LLVMLibDir) From duraid at octopus.com.au Tue Feb 14 21:23:37 2006 From: duraid at octopus.com.au (Duraid Madina) Date: Tue, 14 Feb 2006 21:23:37 -0600 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200602150323.VAA17212@zion.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.343 -> 1.344 --- Log message: HP aCC (and a bunch of other compilers, no doubt) don't share GCC's syntax for auto-dependency generation stuff. This should be changed to be disabling dependency stuff unless GCC/ICC is found. --- Diffs of the changes: (+5 -0) Makefile.rules | 5 +++++ 1 files changed, 5 insertions(+) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.343 llvm/Makefile.rules:1.344 --- llvm/Makefile.rules:1.343 Tue Feb 14 21:20:16 2006 +++ llvm/Makefile.rules Tue Feb 14 21:23:26 2006 @@ -951,6 +951,11 @@ # Object Build Rules: Build object files based on sources ############################################################################### +# FIXME: This should be checking for "if not GCC or ICC", not for "if HP-UX" +ifeq ($(OS),HP-UX) + DISABLE_AUTO_DEPENDENCIES=1 +endif + # Provide rule sets for when dependency generation is enabled ifndef DISABLE_AUTO_DEPENDENCIES From reid at x10sys.com Wed Feb 15 00:08:44 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 14 Feb 2006 22:08:44 -0800 Subject: [llvm-commits] CVS: llvm/autoconf/configure.ac In-Reply-To: <200602150316.VAA17105@zion.cs.uiuc.edu> References: <200602150316.VAA17105@zion.cs.uiuc.edu> Message-ID: <1139983724.5130.33.camel@bashful.x10sys.com> Rather than just kill this checking, I would prefer it if the aCC compiler was added to the check for supported compilers. This configuration check (that you've deleted) can prevent really bad things happening downstream. REid. On Tue, 2006-02-14 at 21:16 -0600, Duraid Madina wrote: > > Changes in directory llvm/autoconf: > > configure.ac updated: 1.207 -> 1.208 > --- > Log message: > > previously, configure would die if GCC or ICC was not found. Now it'll > go through, but we do want to know if we're using GCC/ICC since they > share certain funky command line options (for dependency generation > stuff) > > > > --- > Diffs of the changes: (+0 -11) > > configure.ac | 11 ----------- > 1 files changed, 11 deletions(-) > > > Index: llvm/autoconf/configure.ac > diff -u llvm/autoconf/configure.ac:1.207 llvm/autoconf/configure.ac:1.208 > --- llvm/autoconf/configure.ac:1.207 Sat Feb 4 23:56:51 2006 > +++ llvm/autoconf/configure.ac Tue Feb 14 21:15:55 2006 > @@ -412,17 +412,6 @@ > ;; > esac > > -if test "$GCC" != "yes" && test "$ICC" != "yes" > -then > - AC_MSG_ERROR([gcc|icc required but not found]) > -fi > - > -dnl Ensure that compilation tools are GCC; we use GCC specific extensions > -if test "$GXX" != "yes" && test "$IXX" != "yes" > -then > - AC_MSG_ERROR([g++|icc required but not found]) > -fi > - > dnl Verify that GCC is version 3.0 or higher > if test "$GCC" = "yes" > then > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20060214/93e806f1/attachment.bin From sabre at nondot.org Wed Feb 15 00:10:00 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 15 Feb 2006 00:10:00 -0600 (CST) Subject: [llvm-commits] CVS: llvm/autoconf/configure.ac In-Reply-To: <1139983724.5130.33.camel@bashful.x10sys.com> References: <200602150316.VAA17105@zion.cs.uiuc.edu> <1139983724.5130.33.camel@bashful.x10sys.com> Message-ID: On Tue, 14 Feb 2006, Reid Spencer wrote: > Rather than just kill this checking, I would prefer it if the aCC > compiler was added to the check for supported compilers. This > configuration check (that you've deleted) can prevent really bad things > happening downstream. FWIW, I agree with reid. -Chris > On Tue, 2006-02-14 at 21:16 -0600, Duraid Madina wrote: >> >> Changes in directory llvm/autoconf: >> >> configure.ac updated: 1.207 -> 1.208 >> --- >> Log message: >> >> previously, configure would die if GCC or ICC was not found. Now it'll >> go through, but we do want to know if we're using GCC/ICC since they >> share certain funky command line options (for dependency generation >> stuff) >> >> >> >> --- >> Diffs of the changes: (+0 -11) >> >> configure.ac | 11 ----------- >> 1 files changed, 11 deletions(-) >> >> >> Index: llvm/autoconf/configure.ac >> diff -u llvm/autoconf/configure.ac:1.207 llvm/autoconf/configure.ac:1.208 >> --- llvm/autoconf/configure.ac:1.207 Sat Feb 4 23:56:51 2006 >> +++ llvm/autoconf/configure.ac Tue Feb 14 21:15:55 2006 >> @@ -412,17 +412,6 @@ >> ;; >> esac >> >> -if test "$GCC" != "yes" && test "$ICC" != "yes" >> -then >> - AC_MSG_ERROR([gcc|icc required but not found]) >> -fi >> - >> -dnl Ensure that compilation tools are GCC; we use GCC specific extensions >> -if test "$GXX" != "yes" && test "$IXX" != "yes" >> -then >> - AC_MSG_ERROR([g++|icc required but not found]) >> -fi >> - >> dnl Verify that GCC is version 3.0 or higher >> if test "$GCC" = "yes" >> then >> >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > -Chris -- http://nondot.org/sabre/ http://llvm.org/ From lattner at cs.uiuc.edu Wed Feb 15 00:41:46 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 15 Feb 2006 00:41:46 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp Message-ID: <200602150641.AAA18039@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: SparcISelDAGToDAG.cpp updated: 1.84 -> 1.85 --- Log message: Fix SingleSource/Regression/C/2004-08-12-InlinerAndAllocas.c on Sparc. The ABI specifies that there is a register save area at the bottom of the stack, which means the actual used pointer needs to be an offset from the subtracted value. --- Diffs of the changes: (+22 -1) SparcISelDAGToDAG.cpp | 23 ++++++++++++++++++++++- 1 files changed, 22 insertions(+), 1 deletion(-) Index: llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp diff -u llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp:1.84 llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp:1.85 --- llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp:1.84 Mon Feb 13 03:00:43 2006 +++ llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp Wed Feb 15 00:41:34 2006 @@ -211,7 +211,7 @@ setOperationAction(ISD::VAEND , MVT::Other, Expand); setOperationAction(ISD::STACKSAVE , MVT::Other, Expand); setOperationAction(ISD::STACKRESTORE , MVT::Other, Expand); - setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i32 , Expand); + setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i32 , Custom); setOperationAction(ISD::ConstantFP, MVT::f64, Expand); setOperationAction(ISD::ConstantFP, MVT::f32, Expand); @@ -807,6 +807,27 @@ return DAG.getNode(ISD::MERGE_VALUES, Tys, Ops); } } + case ISD::DYNAMIC_STACKALLOC: { + SDOperand Chain = Op.getOperand(0); // Legalize the chain. + SDOperand Size = Op.getOperand(1); // Legalize the size. + + unsigned SPReg = SP::O6; + SDOperand SP = DAG.getCopyFromReg(Chain, SPReg, MVT::i32); + SDOperand NewSP = DAG.getNode(ISD::SUB, MVT::i32, SP, Size); // Value + Chain = DAG.getCopyToReg(SP.getValue(1), SPReg, NewSP); // Output chain + + // The resultant pointer is actually 16 words from the bottom of the stack, + // to provide a register spill area. + SDOperand NewVal = DAG.getNode(ISD::ADD, MVT::i32, NewSP, + DAG.getConstant(96, MVT::i32)); + std::vector Tys; + Tys.push_back(MVT::i32); + Tys.push_back(MVT::Other); + std::vector Ops; + Ops.push_back(NewVal); + Ops.push_back(Chain); + return DAG.getNode(ISD::MERGE_VALUES, Tys, Ops); + } case ISD::RET: { SDOperand Copy; From lattner at cs.uiuc.edu Wed Feb 15 01:03:11 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 15 Feb 2006 01:03:11 -0600 Subject: [llvm-commits] CVS: llvm/lib/AsmParser/Lexer.cpp.cvs Lexer.l Lexer.l.cvs Message-ID: <200602150703.BAA18170@zion.cs.uiuc.edu> Changes in directory llvm/lib/AsmParser: Lexer.cpp.cvs updated: 1.1 -> 1.2 Lexer.l updated: 1.71 -> 1.72 Lexer.l.cvs updated: 1.1 -> 1.2 --- Log message: random lexer change to test the makefile updating stuff --- Diffs of the changes: (+4 -1) Lexer.cpp.cvs | 3 ++- Lexer.l | 1 + Lexer.l.cvs | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) Index: llvm/lib/AsmParser/Lexer.cpp.cvs diff -u llvm/lib/AsmParser/Lexer.cpp.cvs:1.1 llvm/lib/AsmParser/Lexer.cpp.cvs:1.2 --- llvm/lib/AsmParser/Lexer.cpp.cvs:1.1 Mon Feb 13 23:14:46 2006 +++ llvm/lib/AsmParser/Lexer.cpp.cvs Wed Feb 15 01:02:59 2006 @@ -20,7 +20,7 @@ /* A lexical scanner generated by flex */ /* Scanner skeleton version: - * $Header: /home/vadve/shared/PublicCVS/llvm/lib/AsmParser/Lexer.cpp.cvs,v 1.1 2006/02/14 05:14:46 lattner Exp $ + * $Header: /home/vadve/shared/PublicCVS/llvm/lib/AsmParser/Lexer.cpp.cvs,v 1.2 2006/02/15 07:02:59 lattner Exp $ */ #define FLEX_SCANNER @@ -2623,3 +2623,4 @@ #endif #line 355 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" + Index: llvm/lib/AsmParser/Lexer.l diff -u llvm/lib/AsmParser/Lexer.l:1.71 llvm/lib/AsmParser/Lexer.l:1.72 --- llvm/lib/AsmParser/Lexer.l:1.71 Wed Jan 25 16:26:43 2006 +++ llvm/lib/AsmParser/Lexer.l Wed Feb 15 01:02:59 2006 @@ -353,3 +353,4 @@ . { return yytext[0]; } %% + Index: llvm/lib/AsmParser/Lexer.l.cvs diff -u llvm/lib/AsmParser/Lexer.l.cvs:1.1 llvm/lib/AsmParser/Lexer.l.cvs:1.2 --- llvm/lib/AsmParser/Lexer.l.cvs:1.1 Mon Feb 13 23:14:46 2006 +++ llvm/lib/AsmParser/Lexer.l.cvs Wed Feb 15 01:02:59 2006 @@ -353,3 +353,4 @@ . { return yytext[0]; } %% + From lattner at cs.uiuc.edu Wed Feb 15 01:07:26 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 15 Feb 2006 01:07:26 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/SparcAsmPrinter.cpp Message-ID: <200602150707.BAA18238@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: SparcAsmPrinter.cpp updated: 1.54 -> 1.55 --- Log message: Sparc actually *DOES* have a directive for emitting zeros. In fact, it requires it, because this: .bss X: .byte 0 results in the assembler warning: "initialization in bss segment". Annoying. --- Diffs of the changes: (+1 -1) SparcAsmPrinter.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/Sparc/SparcAsmPrinter.cpp diff -u llvm/lib/Target/Sparc/SparcAsmPrinter.cpp:1.54 llvm/lib/Target/Sparc/SparcAsmPrinter.cpp:1.55 --- llvm/lib/Target/Sparc/SparcAsmPrinter.cpp:1.54 Fri Feb 10 01:35:42 2006 +++ llvm/lib/Target/Sparc/SparcAsmPrinter.cpp Wed Feb 15 01:07:14 2006 @@ -40,7 +40,7 @@ Data16bitsDirective = "\t.half\t"; Data32bitsDirective = "\t.word\t"; Data64bitsDirective = 0; // .xword is only supported by V9. - ZeroDirective = 0; // no .zero or .space! + ZeroDirective = "\t.skip\t"; CommentString = "!"; ConstantPoolSection = "\t.section \".rodata\",#alloc\n"; } From lattner at cs.uiuc.edu Wed Feb 15 01:17:09 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 15 Feb 2006 01:17:09 -0600 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200602150717.BAA18339@zion.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.344 -> 1.345 --- Log message: Convert the bison-output-checked-into-cvs makefile handling stuff to work like the flex stuff, which actually works when people do cvs updates and get conflicts in the updated checked in file. --- Diffs of the changes: (+16 -3) Makefile.rules | 19 ++++++++++++++++--- 1 files changed, 16 insertions(+), 3 deletions(-) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.344 llvm/Makefile.rules:1.345 --- llvm/Makefile.rules:1.344 Tue Feb 14 21:23:26 2006 +++ llvm/Makefile.rules Wed Feb 15 01:16:57 2006 @@ -1252,6 +1252,8 @@ .PRECIOUS: $(YaccOutput) +all:: $(YaccFiles:%.l=$(PROJ_SRC_DIR)/%.cpp.cvs) + # Cancel built-in rules for yacc %.c: %.y %.cpp: %.y @@ -1265,10 +1267,21 @@ $(Verb) $(MV) -f $*.tab.h $(PROJ_SRC_DIR)/$*.h $(Echo) "*** DON'T FORGET TO CHECK IN $*.cpp and $*.h (generated files)" -YaccObjs := $(patsubst %.y,$(ObjDir)/%.o,$(YaccFiles)) -$(YaccObjs): $(ObjDir)/%.o : $(PROJ_SRC_DIR)/%.cpp +# IFF the .y file has changed since it was last checked into CVS, copy the .y +# file to .y.cvs and the generated .cpp/.h file to .cpp.cvs/.h.cvs. We use this +# mechanism so that people without flex can build LLVM by copying the .cvs files +# to the source location and building them. +$(YaccFiles:%.y=$(PROJ_SRC_DIR)/%.cpp.cvs): \ +$(PROJ_SRC_DIR)/%.cpp.cvs: $(PROJ_SRC_DIR)/%.cpp + $(Verb) $(CMP) -s $@ $< || \ + ($(CP) $< $@; \ + $(CP) $(PROJ_SRC_DIR)/$*.l $(PROJ_SRC_DIR)/$*.l.cvs; \ + $(CP) $(PROJ_SRC_DIR)/$*.h $(PROJ_SRC_DIR)/$*.h.cvs) + + +$(YaccFiles:%.y=$(ObjDir)/%.o): $(ObjDir)/%.o : $(PROJ_SRC_DIR)/%.cpp -YaccOutput := $(addprefix $(patsubst %.y,%,$(YaccFiles)),.output) +YaccOutput := $(YaccFiles:%.y=%.output) clean-local:: -$(Verb) $(RM) -f $(YaccOutput) From lattner at cs.uiuc.edu Wed Feb 15 01:23:10 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 15 Feb 2006 01:23:10 -0600 Subject: [llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.cpp.cvs llvmAsmParser.h.cvs llvmAsmParser.y.cvs Lexer.cpp.cvs llvmAsmParser.cpp llvmAsmParser.h Message-ID: <200602150723.BAA18481@zion.cs.uiuc.edu> Changes in directory llvm/lib/AsmParser: llvmAsmParser.cpp.cvs added (r1.1) llvmAsmParser.h.cvs added (r1.1) llvmAsmParser.y.cvs added (r1.1) Lexer.cpp.cvs updated: 1.2 -> 1.3 llvmAsmParser.cpp (r1.35) removed llvmAsmParser.h (r1.19) removed --- Log message: Convert this over to work with the new makefiles --- Diffs of the changes: (+6826 -1) Lexer.cpp.cvs | 2 llvmAsmParser.cpp.cvs | 4249 ++++++++++++++++++++++++++++++++++++++++++++++++++ llvmAsmParser.h.cvs | 140 + llvmAsmParser.y.cvs | 2436 ++++++++++++++++++++++++++++ 4 files changed, 6826 insertions(+), 1 deletion(-) Index: llvm/lib/AsmParser/llvmAsmParser.cpp.cvs diff -c /dev/null llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.1 *** /dev/null Wed Feb 15 01:23:08 2006 --- llvm/lib/AsmParser/llvmAsmParser.cpp.cvs Wed Feb 15 01:22:58 2006 *************** *** 0 **** --- 1,4249 ---- + + /* A Bison parser, made from /Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y + by GNU Bison version 1.28 */ + + #define YYBISON 1 /* Identify Bison output. */ + + #define yyparse llvmAsmparse + #define yylex llvmAsmlex + #define yyerror llvmAsmerror + #define yylval llvmAsmlval + #define yychar llvmAsmchar + #define yydebug llvmAsmdebug + #define yynerrs llvmAsmnerrs + #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 OPAQUE 299 + #define NOT 300 + #define EXTERNAL 301 + #define TARGET 302 + #define TRIPLE 303 + #define ENDIAN 304 + #define POINTERSIZE 305 + #define LITTLE 306 + #define BIG 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 RET 319 + #define BR 320 + #define SWITCH 321 + #define INVOKE 322 + #define UNWIND 323 + #define UNREACHABLE 324 + #define ADD 325 + #define SUB 326 + #define MUL 327 + #define DIV 328 + #define REM 329 + #define AND 330 + #define OR 331 + #define XOR 332 + #define SETLE 333 + #define SETGE 334 + #define SETLT 335 + #define SETGT 336 + #define SETEQ 337 + #define SETNE 338 + #define MALLOC 339 + #define ALLOCA 340 + #define FREE 341 + #define LOAD 342 + #define STORE 343 + #define GETELEMENTPTR 344 + #define PHI_TOK 345 + #define CAST 346 + #define SELECT 347 + #define SHL 348 + #define SHR 349 + #define VAARG 350 + #define EXTRACTELEMENT 351 + #define INSERTELEMENT 352 + #define VAARG_old 353 + #define VANEXT_old 354 + + #line 14 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + + #include "ParserInternals.h" + #include "llvm/CallingConv.h" + #include "llvm/InlineAsm.h" + #include "llvm/Instructions.h" + #include "llvm/Module.h" + #include "llvm/SymbolTable.h" + #include "llvm/Assembly/AutoUpgrade.h" + #include "llvm/Support/GetElementPtrTypeIterator.h" + #include "llvm/ADT/STLExtras.h" + #include "llvm/Support/MathExtras.h" + #include + #include + #include + #include + + int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit + int yylex(); // declaration" of xxx warnings. + int yyparse(); + + namespace llvm { + std::string CurFilename; + } + using namespace llvm; + + static Module *ParserResult; + + // DEBUG_UPREFS - Define this symbol if you want to enable debugging output + // relating to upreferences in the input stream. + // + //#define DEBUG_UPREFS 1 + #ifdef DEBUG_UPREFS + #define UR_OUT(X) std::cerr << X + #else + #define UR_OUT(X) + #endif + + #define YYERROR_VERBOSE 1 + + static bool ObsoleteVarArgs; + static bool NewVarArgs; + static BasicBlock *CurBB; + static GlobalVariable *CurGV; + + + // This contains info used when building the body of a function. It is + // destroyed when the function is completed. + // + typedef std::vector ValueList; // Numbered defs + static void + ResolveDefinitions(std::map &LateResolvers, + std::map *FutureLateResolvers = 0); + + static struct PerModuleInfo { + Module *CurrentModule; + std::map Values; // Module level numbered definitions + std::map LateResolveValues; + std::vector Types; + std::map LateResolveTypes; + + /// PlaceHolderInfo - When temporary placeholder objects are created, remember + /// how they were referenced and one which line of the input they came from so + /// that we can resolve them later and print error messages as appropriate. + std::map > PlaceHolderInfo; + + // GlobalRefs - This maintains a mapping between 's and forward + // references to global values. Global values may be referenced before they + // are defined, and if so, the temporary object that they represent is held + // here. This is used for forward references of GlobalValues. + // + typedef std::map, GlobalValue*> GlobalRefsType; + GlobalRefsType GlobalRefs; + + void ModuleDone() { + // If we could not resolve some functions at function compilation time + // (calls to functions before they are defined), resolve them now... Types + // are resolved when the constant pool has been completely parsed. + // + ResolveDefinitions(LateResolveValues); + + // Check to make sure that all global value forward references have been + // resolved! + // + if (!GlobalRefs.empty()) { + std::string UndefinedReferences = "Unresolved global references exist:\n"; + + for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end(); + I != E; ++I) { + UndefinedReferences += " " + I->first.first->getDescription() + " " + + I->first.second.getName() + "\n"; + } + ThrowException(UndefinedReferences); + } + + // Look for intrinsic functions and CallInst that need to be upgraded + for (Module::iterator FI = CurrentModule->begin(),FE = CurrentModule->end(); + FI != FE; ++FI) + UpgradeCallsToIntrinsic(FI); + + Values.clear(); // Clear out function local definitions + Types.clear(); + CurrentModule = 0; + } + + // GetForwardRefForGlobal - Check to see if there is a forward reference + // for this global. If so, remove it from the GlobalRefs map and return it. + // If not, just return null. + GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) { + // Check to see if there is a forward reference to this global variable... + // if there is, eliminate it and patch the reference to use the new def'n. + GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID)); + GlobalValue *Ret = 0; + if (I != GlobalRefs.end()) { + Ret = I->second; + GlobalRefs.erase(I); + } + return Ret; + } + } CurModule; + + static struct PerFunctionInfo { + Function *CurrentFunction; // Pointer to current function being created + + std::map Values; // Keep track of #'d definitions + std::map LateResolveValues; + bool isDeclare; // Is this function a forward declararation? + + /// BBForwardRefs - When we see forward references to basic blocks, keep + /// track of them here. + std::map > BBForwardRefs; + std::vector NumberedBlocks; + unsigned NextBBNum; + + inline PerFunctionInfo() { + CurrentFunction = 0; + isDeclare = false; + } + + inline void FunctionStart(Function *M) { + CurrentFunction = M; + NextBBNum = 0; + } + + void FunctionDone() { + NumberedBlocks.clear(); + + // Any forward referenced blocks left? + if (!BBForwardRefs.empty()) + ThrowException("Undefined reference to label " + + BBForwardRefs.begin()->first->getName()); + + // Resolve all forward references now. + ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues); + + Values.clear(); // Clear out function local definitions + CurrentFunction = 0; + isDeclare = false; + } + } CurFun; // Info for the current function... + + static bool inFunctionScope() { return CurFun.CurrentFunction != 0; } + + + //===----------------------------------------------------------------------===// + // Code to handle definitions of all the types + //===----------------------------------------------------------------------===// + + static int InsertValue(Value *V, + std::map &ValueTab = CurFun.Values) { + if (V->hasName()) return -1; // Is this a numbered definition? + + // Yes, insert the value into the value table... + ValueList &List = ValueTab[V->getType()]; + List.push_back(V); + return List.size()-1; + } + + static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) { + switch (D.Type) { + case ValID::NumberVal: // Is it a numbered definition? + // Module constants occupy the lowest numbered slots... + if ((unsigned)D.Num < CurModule.Types.size()) + return CurModule.Types[(unsigned)D.Num]; + break; + case ValID::NameVal: // Is it a named definition? + if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) { + D.destroy(); // Free old strdup'd memory... + return N; + } + break; + default: + ThrowException("Internal parser error: Invalid symbol type reference!"); + } + + // If we reached here, we referenced either a symbol that we don't know about + // or an id number that hasn't been read yet. We may be referencing something + // forward, so just create an entry to be resolved later and get to it... + // + if (DoNotImprovise) return 0; // Do we just want a null to be returned? + + + if (inFunctionScope()) { + if (D.Type == ValID::NameVal) + ThrowException("Reference to an undefined type: '" + D.getName() + "'"); + else + ThrowException("Reference to an undefined type: #" + itostr(D.Num)); + } + + std::map::iterator I =CurModule.LateResolveTypes.find(D); + if (I != CurModule.LateResolveTypes.end()) + return I->second; + + Type *Typ = OpaqueType::get(); + CurModule.LateResolveTypes.insert(std::make_pair(D, Typ)); + return Typ; + } + + static Value *lookupInSymbolTable(const Type *Ty, const std::string &Name) { + SymbolTable &SymTab = + inFunctionScope() ? CurFun.CurrentFunction->getSymbolTable() : + CurModule.CurrentModule->getSymbolTable(); + return SymTab.lookup(Ty, Name); + } + + // getValNonImprovising - Look up the value specified by the provided type and + // the provided ValID. If the value exists and has already been defined, return + // it. Otherwise return null. + // + static Value *getValNonImprovising(const Type *Ty, const ValID &D) { + if (isa(Ty)) + ThrowException("Functions are not values and " + "must be referenced as pointers"); + + switch (D.Type) { + case ValID::NumberVal: { // Is it a numbered definition? + unsigned Num = (unsigned)D.Num; + + // Module constants occupy the lowest numbered slots... + std::map::iterator VI = CurModule.Values.find(Ty); + if (VI != CurModule.Values.end()) { + if (Num < VI->second.size()) + return VI->second[Num]; + Num -= VI->second.size(); + } + + // Make sure that our type is within bounds + VI = CurFun.Values.find(Ty); + if (VI == CurFun.Values.end()) return 0; + + // Check that the number is within bounds... + if (VI->second.size() <= Num) return 0; + + return VI->second[Num]; + } + + case ValID::NameVal: { // Is it a named definition? + Value *N = lookupInSymbolTable(Ty, std::string(D.Name)); + if (N == 0) return 0; + + D.destroy(); // Free old strdup'd memory... + return N; + } + + // Check to make sure that "Ty" is an integral type, and that our + // value will fit into the specified type... + case ValID::ConstSIntVal: // Is it a constant pool reference?? + if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64)) + ThrowException("Signed integral constant '" + + itostr(D.ConstPool64) + "' is invalid for type '" + + Ty->getDescription() + "'!"); + return ConstantSInt::get(Ty, D.ConstPool64); + + case ValID::ConstUIntVal: // Is it an unsigned const pool reference? + if (!ConstantUInt::isValueValidForType(Ty, D.UConstPool64)) { + if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64)) { + ThrowException("Integral constant '" + utostr(D.UConstPool64) + + "' is invalid or out of range!"); + } else { // This is really a signed reference. Transmogrify. + return ConstantSInt::get(Ty, D.ConstPool64); + } + } else { + return ConstantUInt::get(Ty, D.UConstPool64); + } + + case ValID::ConstFPVal: // Is it a floating point const pool reference? + if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) + ThrowException("FP constant invalid for type!!"); + return ConstantFP::get(Ty, D.ConstPoolFP); + + case ValID::ConstNullVal: // Is it a null value? + if (!isa(Ty)) + ThrowException("Cannot create a a non pointer null!"); + return ConstantPointerNull::get(cast(Ty)); + + case ValID::ConstUndefVal: // Is it an undef value? + return UndefValue::get(Ty); + + case ValID::ConstZeroVal: // Is it a zero value? + return Constant::getNullValue(Ty); + + case ValID::ConstantVal: // Fully resolved constant? + if (D.ConstantValue->getType() != Ty) + ThrowException("Constant expression type different from required type!"); + return D.ConstantValue; + + case ValID::InlineAsmVal: { // Inline asm expression + const PointerType *PTy = dyn_cast(Ty); + const FunctionType *FTy = + PTy ? dyn_cast(PTy->getElementType()) : 0; + if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) + ThrowException("Invalid type for asm constraint string!"); + InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints, + D.IAD->HasSideEffects); + D.destroy(); // Free InlineAsmDescriptor. + return IA; + } + default: + assert(0 && "Unhandled case!"); + return 0; + } // End of switch + + assert(0 && "Unhandled case!"); + return 0; + } + + // getVal - This function is identical to getValNonImprovising, except that if a + // value is not already defined, it "improvises" by creating a placeholder var + // that looks and acts just like the requested variable. When the value is + // defined later, all uses of the placeholder variable are replaced with the + // real thing. + // + static Value *getVal(const Type *Ty, const ValID &ID) { + if (Ty == Type::LabelTy) + ThrowException("Cannot use a basic block here"); + + // See if the value has already been defined. + Value *V = getValNonImprovising(Ty, ID); + if (V) return V; + + if (!Ty->isFirstClassType() && !isa(Ty)) + ThrowException("Invalid use of a composite type!"); + + // If we reached here, we referenced either a symbol that we don't know about + // or an id number that hasn't been read yet. We may be referencing something + // forward, so just create an entry to be resolved later and get to it... + // + V = new Argument(Ty); + + // Remember where this forward reference came from. FIXME, shouldn't we try + // to recycle these things?? + CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID, + llvmAsmlineno))); + + if (inFunctionScope()) + InsertValue(V, CurFun.LateResolveValues); + else + InsertValue(V, CurModule.LateResolveValues); + return V; + } + + /// getBBVal - This is used for two purposes: + /// * If isDefinition is true, a new basic block with the specified ID is being + /// defined. + /// * If isDefinition is true, this is a reference to a basic block, which may + /// or may not be a forward reference. + /// + static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) { + assert(inFunctionScope() && "Can't get basic block at global scope!"); + + std::string Name; + BasicBlock *BB = 0; + switch (ID.Type) { + default: ThrowException("Illegal label reference " + ID.getName()); + case ValID::NumberVal: // Is it a numbered definition? + if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size()) + CurFun.NumberedBlocks.resize(ID.Num+1); + BB = CurFun.NumberedBlocks[ID.Num]; + break; + case ValID::NameVal: // Is it a named definition? + Name = ID.Name; + if (Value *N = CurFun.CurrentFunction-> + getSymbolTable().lookup(Type::LabelTy, Name)) + BB = cast(N); + break; + } + + // See if the block has already been defined. + if (BB) { + // If this is the definition of the block, make sure the existing value was + // just a forward reference. If it was a forward reference, there will be + // an entry for it in the PlaceHolderInfo map. + if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) + // The existing value was a definition, not a forward reference. + ThrowException("Redefinition of label " + ID.getName()); + + ID.destroy(); // Free strdup'd memory. + return BB; + } + + // Otherwise this block has not been seen before. + BB = new BasicBlock("", CurFun.CurrentFunction); + if (ID.Type == ValID::NameVal) { + BB->setName(ID.Name); + } else { + CurFun.NumberedBlocks[ID.Num] = BB; + } + + // If this is not a definition, keep track of it so we can use it as a forward + // reference. + if (!isDefinition) { + // Remember where this forward reference came from. + CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno); + } else { + // The forward declaration could have been inserted anywhere in the + // function: insert it into the correct place now. + CurFun.CurrentFunction->getBasicBlockList().remove(BB); + CurFun.CurrentFunction->getBasicBlockList().push_back(BB); + } + ID.destroy(); + return BB; + } + + + //===----------------------------------------------------------------------===// + // Code to handle forward references in instructions + //===----------------------------------------------------------------------===// + // + // This code handles the late binding needed with statements that reference + // values not defined yet... for example, a forward branch, or the PHI node for + // a loop body. + // + // This keeps a table (CurFun.LateResolveValues) of all such forward references + // and back patchs after we are done. + // + + // ResolveDefinitions - If we could not resolve some defs at parsing + // time (forward branches, phi functions for loops, etc...) resolve the + // defs now... + // + static void + ResolveDefinitions(std::map &LateResolvers, + std::map *FutureLateResolvers) { + // Loop over LateResolveDefs fixing up stuff that couldn't be resolved + for (std::map::iterator LRI = LateResolvers.begin(), + E = LateResolvers.end(); LRI != E; ++LRI) { + ValueList &List = LRI->second; + while (!List.empty()) { + Value *V = List.back(); + List.pop_back(); + + std::map >::iterator PHI = + CurModule.PlaceHolderInfo.find(V); + assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!"); + + ValID &DID = PHI->second.first; + + Value *TheRealValue = getValNonImprovising(LRI->first, DID); + if (TheRealValue) { + V->replaceAllUsesWith(TheRealValue); + delete V; + CurModule.PlaceHolderInfo.erase(PHI); + } else if (FutureLateResolvers) { + // Functions have their unresolved items forwarded to the module late + // resolver table + InsertValue(V, *FutureLateResolvers); + } else { + if (DID.Type == ValID::NameVal) + ThrowException("Reference to an invalid definition: '" +DID.getName()+ + "' of type '" + V->getType()->getDescription() + "'", + PHI->second.second); + else + ThrowException("Reference to an invalid definition: #" + + itostr(DID.Num) + " of type '" + + V->getType()->getDescription() + "'", + PHI->second.second); + } + } + } + + LateResolvers.clear(); + } + + // ResolveTypeTo - A brand new type was just declared. This means that (if + // name is not null) things referencing Name can be resolved. Otherwise, things + // refering to the number can be resolved. Do this now. + // + static void ResolveTypeTo(char *Name, const Type *ToTy) { + ValID D; + if (Name) D = ValID::create(Name); + else D = ValID::create((int)CurModule.Types.size()); + + std::map::iterator I = + CurModule.LateResolveTypes.find(D); + if (I != CurModule.LateResolveTypes.end()) { + ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy); + CurModule.LateResolveTypes.erase(I); + } + } + + // setValueName - Set the specified value to the name given. The name may be + // null potentially, in which case this is a noop. The string passed in is + // assumed to be a malloc'd string buffer, and is free'd by this function. + // + static void setValueName(Value *V, char *NameStr) { + if (NameStr) { + std::string Name(NameStr); // Copy string + free(NameStr); // Free old string + + if (V->getType() == Type::VoidTy) + ThrowException("Can't assign name '" + Name+"' to value with void type!"); + + assert(inFunctionScope() && "Must be in function scope!"); + SymbolTable &ST = CurFun.CurrentFunction->getSymbolTable(); + if (ST.lookup(V->getType(), Name)) + ThrowException("Redefinition of value named '" + Name + "' in the '" + + V->getType()->getDescription() + "' type plane!"); + + // Set the name. + V->setName(Name); + } + } + + /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null, + /// this is a declaration, otherwise it is a definition. + static GlobalVariable * + ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage, + bool isConstantGlobal, const Type *Ty, + Constant *Initializer) { + if (isa(Ty)) + ThrowException("Cannot declare global vars of function type!"); + + const PointerType *PTy = PointerType::get(Ty); + + std::string Name; + if (NameStr) { + Name = NameStr; // Copy string + free(NameStr); // Free old string + } + + // See if this global value was forward referenced. If so, recycle the + // object. + ValID ID; + if (!Name.empty()) { + ID = ValID::create((char*)Name.c_str()); + } else { + ID = ValID::create((int)CurModule.Values[PTy].size()); + } + + if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) { + // Move the global to the end of the list, from whereever it was + // previously inserted. + GlobalVariable *GV = cast(FWGV); + CurModule.CurrentModule->getGlobalList().remove(GV); + CurModule.CurrentModule->getGlobalList().push_back(GV); + GV->setInitializer(Initializer); + GV->setLinkage(Linkage); + GV->setConstant(isConstantGlobal); + InsertValue(GV, CurModule.Values); + return GV; + } + + // If this global has a name, check to see if there is already a definition + // of this global in the module. If so, merge as appropriate. Note that + // this is really just a hack around problems in the CFE. :( + if (!Name.empty()) { + // We are a simple redefinition of a value, check to see if it is defined + // the same as the old one. + if (GlobalVariable *EGV = + CurModule.CurrentModule->getGlobalVariable(Name, Ty)) { + // We are allowed to redefine a global variable in two circumstances: + // 1. If at least one of the globals is uninitialized or + // 2. If both initializers have the same value. + // + if (!EGV->hasInitializer() || !Initializer || + EGV->getInitializer() == Initializer) { + + // Make sure the existing global version gets the initializer! Make + // sure that it also gets marked const if the new version is. + if (Initializer && !EGV->hasInitializer()) + EGV->setInitializer(Initializer); + if (isConstantGlobal) + EGV->setConstant(true); + EGV->setLinkage(Linkage); + return EGV; + } + + ThrowException("Redefinition of global variable named '" + Name + + "' in the '" + Ty->getDescription() + "' type plane!"); + } + } + + // Otherwise there is no existing GV to use, create one now. + GlobalVariable *GV = + new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name, + CurModule.CurrentModule); + InsertValue(GV, CurModule.Values); + return GV; + } + + // setTypeName - Set the specified type to the name given. The name may be + // null potentially, in which case this is a noop. The string passed in is + // assumed to be a malloc'd string buffer, and is freed by this function. + // + // This function returns true if the type has already been defined, but is + // allowed to be redefined in the specified context. If the name is a new name + // for the type plane, it is inserted and false is returned. + static bool setTypeName(const Type *T, char *NameStr) { + assert(!inFunctionScope() && "Can't give types function-local names!"); + if (NameStr == 0) return false; + + std::string Name(NameStr); // Copy string + free(NameStr); // Free old string + + // We don't allow assigning names to void type + if (T == Type::VoidTy) + ThrowException("Can't assign name '" + Name + "' to the void type!"); + + // Set the type name, checking for conflicts as we do so. + bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T); + + if (AlreadyExists) { // Inserting a name that is already defined??? + const Type *Existing = CurModule.CurrentModule->getTypeByName(Name); + assert(Existing && "Conflict but no matching type?"); + + // There is only one case where this is allowed: when we are refining an + // opaque type. In this case, Existing will be an opaque type. + if (const OpaqueType *OpTy = dyn_cast(Existing)) { + // We ARE replacing an opaque type! + const_cast(OpTy)->refineAbstractTypeTo(T); + return true; + } + + // Otherwise, this is an attempt to redefine a type. That's okay if + // the redefinition is identical to the original. This will be so if + // Existing and T point to the same Type object. In this one case we + // allow the equivalent redefinition. + if (Existing == T) return true; // Yes, it's equal. + + // Any other kind of (non-equivalent) redefinition is an error. + ThrowException("Redefinition of type named '" + Name + "' in the '" + + T->getDescription() + "' type plane!"); + } + + return false; + } + + //===----------------------------------------------------------------------===// + // Code for handling upreferences in type names... + // + + // TypeContains - Returns true if Ty directly contains E in it. + // + static bool TypeContains(const Type *Ty, const Type *E) { + return std::find(Ty->subtype_begin(), Ty->subtype_end(), + E) != Ty->subtype_end(); + } + + namespace { + struct UpRefRecord { + // NestingLevel - The number of nesting levels that need to be popped before + // this type is resolved. + unsigned NestingLevel; + + // LastContainedTy - This is the type at the current binding level for the + // type. Every time we reduce the nesting level, this gets updated. + const Type *LastContainedTy; + + // UpRefTy - This is the actual opaque type that the upreference is + // represented with. + OpaqueType *UpRefTy; + + UpRefRecord(unsigned NL, OpaqueType *URTy) + : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {} + }; + } + + // UpRefs - A list of the outstanding upreferences that need to be resolved. + static std::vector UpRefs; + + /// HandleUpRefs - Every time we finish a new layer of types, this function is + /// called. It loops through the UpRefs vector, which is a list of the + /// currently active types. For each type, if the up reference is contained in + /// the newly completed type, we decrement the level count. When the level + /// count reaches zero, the upreferenced type is the type that is passed in: + /// thus we can complete the cycle. + /// + static PATypeHolder HandleUpRefs(const Type *ty) { + if (!ty->isAbstract()) return ty; + PATypeHolder Ty(ty); + UR_OUT("Type '" << Ty->getDescription() << + "' newly formed. Resolving upreferences.\n" << + UpRefs.size() << " upreferences active!\n"); + + // If we find any resolvable upreferences (i.e., those whose NestingLevel goes + // to zero), we resolve them all together before we resolve them to Ty. At + // the end of the loop, if there is anything to resolve to Ty, it will be in + // this variable. + OpaqueType *TypeToResolve = 0; + + for (unsigned i = 0; i != UpRefs.size(); ++i) { + UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", " + << UpRefs[i].second->getDescription() << ") = " + << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n"); + if (TypeContains(Ty, UpRefs[i].LastContainedTy)) { + // Decrement level of upreference + unsigned Level = --UpRefs[i].NestingLevel; + UpRefs[i].LastContainedTy = Ty; + UR_OUT(" Uplevel Ref Level = " << Level << "\n"); + if (Level == 0) { // Upreference should be resolved! + if (!TypeToResolve) { + TypeToResolve = UpRefs[i].UpRefTy; + } else { + UR_OUT(" * Resolving upreference for " + << UpRefs[i].second->getDescription() << "\n"; + std::string OldName = UpRefs[i].UpRefTy->getDescription()); + UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve); + UR_OUT(" * Type '" << OldName << "' refined upreference to: " + << (const void*)Ty << ", " << Ty->getDescription() << "\n"); + } + UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list... + --i; // Do not skip the next element... + } + } + } + + if (TypeToResolve) { + UR_OUT(" * Resolving upreference for " + << UpRefs[i].second->getDescription() << "\n"; + std::string OldName = TypeToResolve->getDescription()); + TypeToResolve->refineAbstractTypeTo(Ty); + } + + return Ty; + } + + + // common code from the two 'RunVMAsmParser' functions + static Module * RunParser(Module * M) { + + llvmAsmlineno = 1; // Reset the current line number... + ObsoleteVarArgs = false; + NewVarArgs = false; + + CurModule.CurrentModule = M; + yyparse(); // Parse the file, potentially throwing exception + + Module *Result = ParserResult; + ParserResult = 0; + + //Not all functions use vaarg, so make a second check for ObsoleteVarArgs + { + Function* F; + if ((F = Result->getNamedFunction("llvm.va_start")) + && F->getFunctionType()->getNumParams() == 0) + ObsoleteVarArgs = true; + if((F = Result->getNamedFunction("llvm.va_copy")) + && F->getFunctionType()->getNumParams() == 1) + ObsoleteVarArgs = true; + } + + if (ObsoleteVarArgs && NewVarArgs) + ThrowException("This file is corrupt: it uses both new and old style varargs"); + + if(ObsoleteVarArgs) { + if(Function* F = Result->getNamedFunction("llvm.va_start")) { + if (F->arg_size() != 0) + ThrowException("Obsolete va_start takes 0 argument!"); + + //foo = va_start() + // -> + //bar = alloca typeof(foo) + //va_start(bar) + //foo = load bar + + const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID); + const Type* ArgTy = F->getFunctionType()->getReturnType(); + const Type* ArgTyPtr = PointerType::get(ArgTy); + Function* NF = Result->getOrInsertFunction("llvm.va_start", + RetTy, ArgTyPtr, (Type *)0); + + while (!F->use_empty()) { + CallInst* CI = cast(F->use_back()); + AllocaInst* bar = new AllocaInst(ArgTy, 0, "vastart.fix.1", CI); + new CallInst(NF, bar, "", CI); + Value* foo = new LoadInst(bar, "vastart.fix.2", CI); + CI->replaceAllUsesWith(foo); + CI->getParent()->getInstList().erase(CI); + } + Result->getFunctionList().erase(F); + } + + if(Function* F = Result->getNamedFunction("llvm.va_end")) { + if(F->arg_size() != 1) + ThrowException("Obsolete va_end takes 1 argument!"); + + //vaend foo + // -> + //bar = alloca 1 of typeof(foo) + //vaend bar + const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID); + const Type* ArgTy = F->getFunctionType()->getParamType(0); + const Type* ArgTyPtr = PointerType::get(ArgTy); + Function* NF = Result->getOrInsertFunction("llvm.va_end", + RetTy, ArgTyPtr, (Type *)0); + + while (!F->use_empty()) { + CallInst* CI = cast(F->use_back()); + AllocaInst* bar = new AllocaInst(ArgTy, 0, "vaend.fix.1", CI); + new StoreInst(CI->getOperand(1), bar, CI); + new CallInst(NF, bar, "", CI); + CI->getParent()->getInstList().erase(CI); + } + Result->getFunctionList().erase(F); + } + + if(Function* F = Result->getNamedFunction("llvm.va_copy")) { + if(F->arg_size() != 1) + ThrowException("Obsolete va_copy takes 1 argument!"); + //foo = vacopy(bar) + // -> + //a = alloca 1 of typeof(foo) + //b = alloca 1 of typeof(foo) + //store bar -> b + //vacopy(a, b) + //foo = load a + + const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID); + const Type* ArgTy = F->getFunctionType()->getReturnType(); + const Type* ArgTyPtr = PointerType::get(ArgTy); + Function* NF = Result->getOrInsertFunction("llvm.va_copy", + RetTy, ArgTyPtr, ArgTyPtr, + (Type *)0); + + while (!F->use_empty()) { + CallInst* CI = cast(F->use_back()); + AllocaInst* a = new AllocaInst(ArgTy, 0, "vacopy.fix.1", CI); + AllocaInst* b = new AllocaInst(ArgTy, 0, "vacopy.fix.2", CI); + new StoreInst(CI->getOperand(1), b, CI); + new CallInst(NF, a, b, "", CI); + Value* foo = new LoadInst(a, "vacopy.fix.3", CI); + CI->replaceAllUsesWith(foo); + CI->getParent()->getInstList().erase(CI); + } + Result->getFunctionList().erase(F); + } + } + + return Result; + + } + + //===----------------------------------------------------------------------===// + // RunVMAsmParser - Define an interface to this parser + //===----------------------------------------------------------------------===// + // + Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) { + set_scan_file(F); + + CurFilename = Filename; + return RunParser(new Module(CurFilename)); + } + + Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) { + set_scan_string(AsmString); + + CurFilename = "from_memory"; + if (M == NULL) { + return RunParser(new Module (CurFilename)); + } else { + return RunParser(M); + } + } + + + #line 890 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + typedef union { + llvm::Module *ModuleVal; + llvm::Function *FunctionVal; + std::pair *ArgVal; + llvm::BasicBlock *BasicBlockVal; + llvm::TerminatorInst *TermInstVal; + llvm::Instruction *InstVal; + llvm::Constant *ConstVal; + + const llvm::Type *PrimType; + llvm::PATypeHolder *TypeVal; + llvm::Value *ValueVal; + + std::vector > *ArgList; + std::vector *ValueList; + std::list *TypeList; + // Represent the RHS of PHI node + std::list > *PHIList; + std::vector > *JumpTable; + std::vector *ConstVector; + + llvm::GlobalValue::LinkageTypes Linkage; + int64_t SInt64Val; + uint64_t UInt64Val; + int SIntVal; + unsigned UIntVal; + double FPVal; + bool BoolVal; + + char *StrVal; // This memory is strdup'd! + llvm::ValID ValIDVal; // strdup'd memory maybe! + + llvm::Instruction::BinaryOps BinaryOpVal; + llvm::Instruction::TermOps TermOpVal; + llvm::Instruction::MemoryOps MemOpVal; + llvm::Instruction::OtherOps OtherOpVal; + llvm::Module::Endianness Endianness; + } YYSTYPE; + #include + + #ifndef __cplusplus + #ifndef __STDC__ + #define const + #endif + #endif + + + + #define YYFINAL 473 + #define YYFLAG -32768 + #define YYNTBASE 115 + + #define YYTRANSLATE(x) ((unsigned)(x) <= 354 ? yytranslate[x] : 186) + + static const char 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, 104, + 105, 113, 2, 102, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 109, + 101, 110, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 106, 103, 108, 2, 2, 2, 2, 2, 114, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 107, + 2, 2, 111, 2, 112, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 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 + }; + + #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, 67, 68, 70, 72, 74, 76, 77, + 78, 80, 82, 84, 87, 88, 91, 92, 96, 99, + 100, 102, 103, 107, 109, 112, 114, 116, 118, 120, + 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, + 142, 144, 146, 148, 150, 152, 154, 157, 162, 168, + 174, 178, 181, 184, 186, 190, 192, 196, 198, 199, + 204, 208, 212, 217, 222, 226, 229, 232, 235, 238, + 241, 244, 247, 250, 253, 256, 263, 269, 278, 285, + 292, 299, 306, 313, 317, 319, 321, 323, 325, 328, + 331, 336, 339, 341, 346, 349, 354, 355, 363, 364, + 372, 376, 381, 382, 384, 386, 388, 392, 396, 400, + 404, 408, 410, 411, 413, 415, 417, 418, 421, 425, + 427, 429, 433, 435, 436, 445, 447, 449, 453, 455, + 457, 460, 461, 465, 466, 468, 470, 472, 474, 476, + 478, 480, 482, 484, 488, 490, 496, 498, 500, 502, + 504, 507, 510, 513, 517, 520, 521, 523, 526, 529, + 533, 543, 553, 562, 576, 578, 580, 587, 593, 596, + 603, 611, 613, 617, 619, 620, 623, 625, 631, 637, + 643, 646, 651, 656, 663, 668, 673, 678, 683, 690, + 693, 701, 703, 706, 707, 709, 710, 714, 721, 725, + 732, 735, 740, 747 + }; + + static const short yyrhs[] = { 5, + 0, 6, 0, 3, 0, 4, 0, 71, 0, 72, + 0, 73, 0, 74, 0, 75, 0, 76, 0, 77, + 0, 78, 0, 79, 0, 80, 0, 81, 0, 82, + 0, 83, 0, 84, 0, 94, 0, 95, 0, 16, + 0, 14, 0, 12, 0, 10, 0, 17, 0, 15, + 0, 13, 0, 11, 0, 121, 0, 122, 0, 18, + 0, 19, 0, 155, 101, 0, 0, 41, 0, 42, + 0, 43, 0, 44, 0, 0, 0, 62, 0, 63, + 0, 64, 0, 61, 4, 0, 0, 54, 4, 0, + 0, 102, 54, 4, 0, 34, 24, 0, 0, 130, + 0, 0, 102, 133, 132, 0, 130, 0, 54, 4, + 0, 136, 0, 8, 0, 138, 0, 8, 0, 138, + 0, 9, 0, 10, 0, 11, 0, 12, 0, 13, + 0, 14, 0, 15, 0, 16, 0, 17, 0, 18, + 0, 19, 0, 20, 0, 21, 0, 45, 0, 137, + 0, 169, 0, 103, 4, 0, 135, 104, 140, 105, + 0, 106, 4, 107, 138, 108, 0, 109, 4, 107, + 138, 110, 0, 111, 139, 112, 0, 111, 112, 0, + 138, 113, 0, 138, 0, 139, 102, 138, 0, 139, + 0, 139, 102, 37, 0, 37, 0, 0, 136, 106, + 143, 108, 0, 136, 106, 108, 0, 136, 114, 24, + 0, 136, 109, 143, 110, 0, 136, 111, 143, 112, + 0, 136, 111, 112, 0, 136, 38, 0, 136, 39, + 0, 136, 169, 0, 136, 142, 0, 136, 26, 0, + 121, 116, 0, 122, 4, 0, 9, 27, 0, 9, + 28, 0, 124, 7, 0, 92, 104, 141, 36, 136, + 105, 0, 90, 104, 141, 183, 105, 0, 93, 104, + 141, 102, 141, 102, 141, 105, 0, 117, 104, 141, + 102, 141, 105, 0, 118, 104, 141, 102, 141, 105, + 0, 119, 104, 141, 102, 141, 105, 0, 120, 104, + 141, 102, 141, 105, 0, 97, 104, 141, 102, 141, + 105, 0, 143, 102, 141, 0, 141, 0, 32, 0, + 33, 0, 146, 0, 146, 164, 0, 146, 165, 0, + 146, 59, 58, 150, 0, 146, 25, 0, 147, 0, + 147, 125, 20, 134, 0, 147, 165, 0, 147, 59, + 58, 150, 0, 0, 147, 125, 126, 144, 141, 148, + 132, 0, 0, 147, 125, 47, 144, 136, 149, 132, + 0, 147, 48, 152, 0, 147, 55, 101, 153, 0, + 0, 24, 0, 53, 0, 52, 0, 50, 101, 151, + 0, 51, 101, 4, 0, 49, 101, 24, 0, 106, + 154, 108, 0, 154, 102, 24, 0, 24, 0, 0, + 22, 0, 24, 0, 155, 0, 0, 136, 156, 0, + 158, 102, 157, 0, 157, 0, 158, 0, 158, 102, + 37, 0, 37, 0, 0, 127, 134, 155, 104, 159, + 105, 131, 128, 0, 29, 0, 111, 0, 126, 160, + 161, 0, 30, 0, 112, 0, 172, 163, 0, 0, + 31, 166, 160, 0, 0, 60, 0, 3, 0, 4, + 0, 7, 0, 27, 0, 28, 0, 38, 0, 39, + 0, 26, 0, 109, 143, 110, 0, 142, 0, 58, + 167, 24, 102, 24, 0, 115, 0, 155, 0, 169, + 0, 168, 0, 136, 170, 0, 172, 173, 0, 162, + 173, 0, 174, 125, 175, 0, 174, 177, 0, 0, + 23, 0, 65, 171, 0, 65, 8, 0, 66, 21, + 170, 0, 66, 9, 170, 102, 21, 170, 102, 21, + 170, 0, 67, 123, 170, 102, 21, 170, 106, 176, + 108, 0, 67, 123, 170, 102, 21, 170, 106, 108, + 0, 68, 127, 134, 170, 104, 180, 105, 36, 21, + 170, 69, 21, 170, 0, 69, 0, 70, 0, 176, + 123, 168, 102, 21, 170, 0, 123, 168, 102, 21, + 170, 0, 125, 182, 0, 136, 106, 170, 102, 170, + 108, 0, 178, 102, 106, 170, 102, 170, 108, 0, + 171, 0, 179, 102, 171, 0, 179, 0, 0, 57, + 56, 0, 56, 0, 117, 136, 170, 102, 170, 0, + 118, 136, 170, 102, 170, 0, 119, 136, 170, 102, + 170, 0, 46, 171, 0, 120, 171, 102, 171, 0, + 92, 171, 36, 136, 0, 93, 171, 102, 171, 102, + 171, 0, 96, 171, 102, 136, 0, 99, 171, 102, + 136, 0, 100, 171, 102, 136, 0, 97, 171, 102, + 171, 0, 98, 171, 102, 171, 102, 171, 0, 91, + 178, 0, 181, 127, 134, 170, 104, 180, 105, 0, + 185, 0, 102, 179, 0, 0, 35, 0, 0, 85, + 136, 129, 0, 85, 136, 102, 15, 170, 129, 0, + 86, 136, 129, 0, 86, 136, 102, 15, 170, 129, + 0, 87, 171, 0, 184, 88, 136, 170, 0, 184, + 89, 171, 102, 136, 170, 0, 90, 136, 170, 183, + 0 + }; + + #endif + + #if YYDEBUG != 0 + static const short yyrline[] = { 0, + 1010, 1011, 1018, 1019, 1028, 1028, 1028, 1028, 1028, 1029, + 1029, 1029, 1030, 1030, 1030, 1030, 1030, 1030, 1032, 1032, + 1036, 1036, 1036, 1036, 1037, 1037, 1037, 1037, 1038, 1038, + 1039, 1039, 1042, 1045, 1049, 1049, 1050, 1051, 1052, 1055, + 1055, 1056, 1057, 1058, 1067, 1067, 1073, 1073, 1081, 1088, + 1088, 1094, 1094, 1096, 1100, 1113, 1113, 1114, 1114, 1116, + 1125, 1125, 1125, 1125, 1125, 1125, 1125, 1126, 1126, 1126, + 1126, 1126, 1126, 1127, 1130, 1133, 1139, 1146, 1158, 1162, + 1173, 1182, 1185, 1193, 1197, 1202, 1203, 1206, 1209, 1219, + 1244, 1257, 1286, 1311, 1331, 1343, 1352, 1356, 1415, 1421, + 1429, 1434, 1439, 1442, 1445, 1452, 1462, 1493, 1500, 1521, + 1531, 1536, 1543, 1553, 1556, 1563, 1563, 1573, 1580, 1584, + 1587, 1590, 1593, 1606, 1626, 1628, 1630, 1633, 1636, 1640, + 1643, 1645, 1647, 1651, 1663, 1664, 1666, 1669, 1677, 1682, + 1684, 1688, 1692, 1700, 1700, 1701, 1701, 1703, 1709, 1714, + 1720, 1723, 1728, 1732, 1736, 1822, 1822, 1824, 1832, 1832, + 1834, 1838, 1838, 1847, 1850, 1854, 1857, 1860, 1863, 1866, + 1869, 1872, 1875, 1878, 1902, 1905, 1918, 1921, 1926, 1926, + 1932, 1936, 1939, 1947, 1956, 1960, 1970, 1981, 1984, 1987, + 1990, 1993, 2007, 2011, 2064, 2067, 2073, 2081, 2091, 2098, + 2103, 2110, 2114, 2120, 2120, 2122, 2125, 2131, 2143, 2154, + 2164, 2176, 2183, 2190, 2197, 2202, 2221, 2243, 2251, 2263, + 2277, 2334, 2340, 2342, 2346, 2349, 2355, 2359, 2363, 2367, + 2371, 2378, 2388, 2401 + }; + #endif + + + #if YYDEBUG != 0 || defined (YYERROR_VERBOSE) + + 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", + "OPAQUE","NOT","EXTERNAL","TARGET","TRIPLE","ENDIAN","POINTERSIZE","LITTLE", + "BIG","ALIGN","DEPLIBS","CALL","TAIL","ASM_TOK","MODULE","SIDEEFFECT","CC_TOK", + "CCC_TOK","FASTCC_TOK","COLDCC_TOK","RET","BR","SWITCH","INVOKE","UNWIND","UNREACHABLE", + "ADD","SUB","MUL","DIV","REM","AND","OR","XOR","SETLE","SETGE","SETLT","SETGT", + "SETEQ","SETNE","MALLOC","ALLOCA","FREE","LOAD","STORE","GETELEMENTPTR","PHI_TOK", + "CAST","SELECT","SHL","SHR","VAARG","EXTRACTELEMENT","INSERTELEMENT","VAARG_old", + "VANEXT_old","'='","','","'\\\\'","'('","')'","'['","'x'","']'","'<'","'>'", + "'{'","'}'","'*'","'c'","INTVAL","EINT64VAL","ArithmeticOps","LogicalOps","SetCondOps", + "ShiftOps","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","AsmBlock","BigOrLittle","TargetDefinition","LibrariesDefinition", + "LibList","Name","OptName","ArgVal","ArgListH","ArgList","FunctionHeaderH","BEGIN", + "FunctionHeader","END","Function","FunctionProto","@3","OptSideEffect","ConstValueRef", + "SymbolicValueRef","ValueRef","ResolvedVal","BasicBlockList","BasicBlock","InstructionList", + "BBTerminatorInst","JumpTable","Inst","PHIList","ValueRefList","ValueRefListE", + "OptTailCall","InstVal","IndexList","OptVolatile","MemoryInst", NULL + }; + #endif + + static const short yyr1[] = { 0, + 115, 115, 116, 116, 117, 117, 117, 117, 117, 118, + 118, 118, 119, 119, 119, 119, 119, 119, 120, 120, + 121, 121, 121, 121, 122, 122, 122, 122, 123, 123, + 124, 124, 125, 125, 126, 126, 126, 126, 126, 127, + 127, 127, 127, 127, 128, 128, 129, 129, 130, 131, + 131, 132, 132, 133, 133, 134, 134, 135, 135, 136, + 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, + 137, 137, 137, 138, 138, 138, 138, 138, 138, 138, + 138, 138, 138, 139, 139, 140, 140, 140, 140, 141, + 141, 141, 141, 141, 141, 141, 141, 141, 141, 141, + 141, 141, 141, 141, 141, 142, 142, 142, 142, 142, + 142, 142, 142, 143, 143, 144, 144, 145, 146, 146, + 146, 146, 146, 147, 147, 147, 148, 147, 149, 147, + 147, 147, 147, 150, 151, 151, 152, 152, 152, 153, + 154, 154, 154, 155, 155, 156, 156, 157, 158, 158, + 159, 159, 159, 159, 160, 161, 161, 162, 163, 163, + 164, 166, 165, 167, 167, 168, 168, 168, 168, 168, + 168, 168, 168, 168, 168, 168, 169, 169, 170, 170, + 171, 172, 172, 173, 174, 174, 174, 175, 175, 175, + 175, 175, 175, 175, 175, 175, 176, 176, 177, 178, + 178, 179, 179, 180, 180, 181, 181, 182, 182, 182, + 182, 182, 182, 182, 182, 182, 182, 182, 182, 182, + 182, 182, 183, 183, 184, 184, 185, 185, 185, 185, + 185, 185, 185, 185 + }; + + 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, 2, 0, 1, 1, 1, 1, 0, 0, + 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, 1, 2, 4, 5, 5, + 3, 2, 2, 1, 3, 1, 3, 1, 0, 4, + 3, 3, 4, 4, 3, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 6, 5, 8, 6, 6, + 6, 6, 6, 3, 1, 1, 1, 1, 2, 2, + 4, 2, 1, 4, 2, 4, 0, 7, 0, 7, + 3, 4, 0, 1, 1, 1, 3, 3, 3, 3, + 3, 1, 0, 1, 1, 1, 0, 2, 3, 1, + 1, 3, 1, 0, 8, 1, 1, 3, 1, 1, + 2, 0, 3, 0, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 3, 1, 5, 1, 1, 1, 1, + 2, 2, 2, 3, 2, 0, 1, 2, 2, 3, + 9, 9, 8, 13, 1, 1, 6, 5, 2, 6, + 7, 1, 3, 1, 0, 2, 1, 5, 5, 5, + 2, 4, 4, 6, 4, 4, 4, 4, 6, 2, + 7, 1, 2, 0, 1, 0, 3, 6, 3, 6, + 2, 4, 6, 4 + }; + + static const short yydefact[] = { 133, + 39, 123, 122, 162, 35, 36, 37, 38, 0, 40, + 186, 119, 120, 186, 144, 145, 0, 0, 0, 39, + 0, 125, 40, 0, 0, 41, 42, 43, 0, 0, + 187, 183, 34, 159, 160, 161, 182, 0, 0, 0, + 131, 0, 0, 0, 0, 0, 33, 163, 134, 121, + 44, 1, 2, 57, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 0, 0, + 0, 0, 177, 0, 0, 56, 75, 60, 178, 76, + 156, 157, 158, 226, 185, 0, 0, 0, 143, 132, + 126, 124, 116, 117, 0, 0, 77, 0, 0, 59, + 82, 84, 0, 0, 89, 83, 225, 0, 207, 0, + 0, 0, 0, 40, 195, 196, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 0, 0, 0, 0, 0, 0, 0, 19, 20, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 184, 40, + 199, 0, 222, 139, 136, 135, 137, 138, 142, 0, + 129, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 0, 0, 0, 0, 127, 0, 0, 0, + 81, 154, 88, 86, 0, 0, 211, 206, 189, 188, + 0, 0, 24, 28, 23, 27, 22, 26, 21, 25, + 29, 30, 0, 0, 47, 47, 231, 0, 0, 220, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 140, 52, 103, 104, 3, + 4, 101, 102, 105, 100, 96, 97, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 99, + 98, 52, 58, 58, 85, 153, 147, 150, 151, 0, + 0, 78, 166, 167, 168, 173, 169, 170, 171, 172, + 164, 0, 175, 180, 179, 181, 0, 190, 0, 0, + 0, 227, 0, 229, 224, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 141, 0, 130, 0, 0, 0, 0, 91, 115, + 0, 0, 95, 0, 92, 0, 0, 0, 0, 128, + 79, 80, 146, 148, 0, 50, 87, 165, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 234, 0, 0, + 213, 0, 215, 218, 0, 216, 217, 0, 0, 0, + 212, 0, 232, 0, 0, 0, 54, 52, 224, 0, + 0, 0, 0, 90, 93, 94, 0, 0, 0, 0, + 152, 149, 51, 45, 0, 174, 0, 0, 205, 47, + 48, 47, 202, 223, 0, 0, 0, 0, 208, 209, + 210, 205, 0, 49, 55, 53, 0, 0, 0, 0, + 114, 0, 0, 0, 0, 0, 155, 0, 0, 0, + 204, 0, 0, 228, 230, 0, 0, 0, 214, 219, + 0, 233, 107, 0, 0, 0, 0, 0, 0, 0, + 46, 176, 0, 0, 0, 203, 200, 0, 221, 106, + 0, 113, 109, 110, 111, 112, 0, 193, 0, 0, + 0, 201, 0, 191, 0, 192, 0, 0, 108, 0, + 0, 0, 0, 0, 0, 198, 0, 0, 197, 194, + 0, 0, 0 + }; + + static const short yydefgoto[] = { 73, + 232, 246, 247, 248, 249, 173, 174, 203, 175, 20, + 10, 29, 407, 282, 357, 374, 304, 358, 74, 75, + 186, 77, 78, 103, 185, 310, 273, 311, 95, 471, + 1, 2, 252, 227, 50, 157, 41, 90, 160, 79, + 324, 258, 259, 260, 30, 83, 11, 36, 12, 13, + 23, 329, 274, 80, 276, 383, 14, 32, 33, 149, + 450, 85, 210, 411, 412, 150, 151, 338, 152, 153 + }; + + static const short yypact[] = {-32768, + 30, 99,-32768,-32768,-32768,-32768,-32768,-32768, -47, 46, + 33,-32768,-32768, -13,-32768,-32768, 75, -32, 26, 21, + -3,-32768, 46, 63, 100,-32768,-32768,-32768, 974, -21, + -32768,-32768, 105,-32768,-32768,-32768,-32768, 10, 27, 32, + -32768, 38, 63, 974, 103, 103,-32768,-32768,-32768,-32768, + -32768,-32768,-32768, 18,-32768,-32768,-32768,-32768,-32768,-32768, + -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 135, 148, + 155, 490,-32768, 105, 67,-32768,-32768, -64,-32768,-32768, + -32768,-32768,-32768, 1136,-32768, 149, 85, 172, 154,-32768, + -32768,-32768,-32768,-32768, 1012, 1050,-32768, 73, 76,-32768, + -32768, -64, -17, 80, 784,-32768,-32768, 1012,-32768, 129, + 1088, 23, 221, 46,-32768,-32768,-32768,-32768,-32768,-32768, + -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + 1012, 1012, 1012, 1012, 1012, 1012, 1012,-32768,-32768, 1012, + 1012, 1012, 1012, 1012, 1012, 1012, 1012, 1012,-32768, 46, + -32768, 60,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -14, + -32768, 123, 153, 182, 159, 186, 162, 187, 164, 188, + 189, 190, 166, 194, 193, 372,-32768, 1012, 1012, 1012, + -32768, 822,-32768, 101, 102, 622,-32768,-32768, 18,-32768, + 622, 622,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + -32768,-32768, 622, 974, 104, 107,-32768, 622, 98, 108, + 169, 109, 110, 118, 119, 120, 121, 622, 622, 622, + 122, 974, 1012, 1012, 201,-32768, 124,-32768,-32768,-32768, + -32768,-32768,-32768,-32768,-32768,-32768,-32768, 136, 137, 138, + 141, 860, 1050, 531, 215, 142, 143, 144, 146,-32768, + -32768, 124, -75, -53, -64,-32768, 105,-32768, 150, 139, + 898,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + 191, 1050,-32768,-32768,-32768,-32768, 151,-32768, 152, 622, + 5,-32768, 16,-32768, 158, 622, 156, 1012, 1012, 1012, + 1012, 1012, 1012, 1012, 161, 165, 168, 1012, 622, 622, + 170,-32768, -18,-32768, 1050, 1050, 1050, 1050,-32768,-32768, + -11, -65,-32768, -16,-32768, 1050, 1050, 1050, 1050,-32768, + -32768,-32768,-32768,-32768, 936, 222,-32768,-32768, 233, -10, + 245, 250, 171, 622, 269, 622, 1012,-32768, 178, 622, + -32768, 179,-32768,-32768, 180,-32768,-32768, 622, 622, 622, + -32768, 181,-32768, 1012, 259, 280,-32768, 124, 158, 255, + 184, 192, 1050,-32768,-32768,-32768, 197, 198, 199, 200, + -32768,-32768,-32768, 238, 202,-32768, 622, 622, 1012, 204, + -32768, 204,-32768, 205, 622, 206, 1012, 1012,-32768,-32768, + -32768, 1012, 622,-32768,-32768,-32768, 207, 1012, 1050, 1050, + -32768, 1050, 1050, 1050, 1050, 289,-32768, 271, 218, 223, + 205, 216, 270,-32768,-32768, 1012, 219, 622,-32768,-32768, + 225,-32768,-32768, 228, 226, 230, 231, 232, 235, 236, + -32768,-32768, 321, 12, 308,-32768,-32768, 237,-32768,-32768, + 1050,-32768,-32768,-32768,-32768,-32768, 622,-32768, 682, 66, + 328,-32768, 246,-32768, 248,-32768, 682, 622,-32768, 332, + 253, 287, 622, 336, 340,-32768, 622, 622,-32768,-32768, + 363, 364,-32768 + }; + + static const short yypgoto[] = {-32768, + -32768, 281, 282, 283, 284, -112, -111, -415,-32768, 339, + 359, -102,-32768, -201, 54,-32768, -243,-32768, -40,-32768, + -29,-32768, -66, 276,-32768, -89, 208, -230, 337,-32768, + -32768,-32768,-32768,-32768, 342,-32768,-32768,-32768,-32768, 1, + -32768, 57,-32768,-32768, 365,-32768,-32768,-32768,-32768, 384, + -32768,-32768, -356, -31, 140, -90,-32768, 375,-32768,-32768, + -32768,-32768,-32768, 53, -1,-32768,-32768, 34,-32768,-32768 + }; + + + #define YYLAST 1236 + + + static const short yytable[] = { 76, + 201, 202, 21, 92, 284, 102, 177, 81, 320, 31, + 24, 204, 312, 314, 76, 355, 34, 187, 449, 334, + 190, 193, 194, 195, 196, 197, 198, 199, 200, -118, + 336, 191, 321, 21, 457, 356, 363, 106, 102, -58, + 44, 330, 207, 192, 365, 211, 212, 222, 106, 213, + 214, 215, 216, 217, 3, 31, 322, 221, 335, 106, + 4, 5, 6, 7, 8, 161, 176, 45, 42, 335, + 5, 6, 7, 8, 104, 193, 194, 195, 196, 197, + 198, 199, 200, 43, 180, 363, 49, 225, 9, 82, + 363, 363, 455, 226, 181, 366, 364, 47, 35, 376, + 461, 205, 206, 51, 208, 209, 25, 26, 27, 28, + 86, 253, 254, 255, 396, 218, 219, 220, -34, 448, + 15, -59, 16, 38, 39, 40, 15, 87, 16, 4, + -34, -34, 88, 301, 93, 94, 155, 156, 97, -34, + -34, -34, -34, 89, 251, -34, 17, 223, 224, 228, + 229, 98, 257, 18, 275, -24, -24, 19, 99, 275, + 275, -23, -23, 280, -22, -22, -21, -21, 230, 231, + 105, 275, 154, 456, 76, 158, 275, 159, 414, 178, + 415, 299, 179, 182, 188, -28, 275, 275, 275, -27, + -26, -25, 76, 300, 255, -31, -32, 233, 342, 234, + 344, 345, 261, 286, 288, 281, 262, 351, 283, 287, + 289, 290, 176, 176, 176, 359, 360, 361, 362, 291, + 292, 293, 294, 298, 302, 303, 367, 368, 369, 370, + 193, 194, 195, 196, 197, 198, 199, 200, 315, 305, + 306, 307, 176, 326, 308, 316, 317, 318, 275, 319, + 328, 325, 331, 332, 275, 355, 375, 323, 341, 337, + 343, 340, 348, 346, 347, 377, 349, 275, 275, 350, + 378, 354, 381, 401, 379, 176, 176, 176, 176, 385, + 387, 388, 394, 395, 392, 399, 176, 176, 176, 176, + 398, 406, 431, 400, 432, 257, 419, 420, 402, 403, + 404, 405, 275, 408, 275, 413, 416, 418, 275, 425, + 426, 423, 427, 428, 429, 430, 275, 275, 275, 433, + 435, 201, 202, 335, 393, 436, 437, 441, 434, 439, + 277, 278, 440, 176, 442, 443, 444, 201, 202, 445, + 446, 447, 279, 451, 452, 275, 275, 285, 458, 460, + 459, 453, 463, 275, 464, 465, 467, 295, 296, 297, + 468, 275, 472, 473, 145, 146, 147, 148, 424, 176, + 176, 84, 176, 176, 176, 176, 52, 53, 46, 373, + 184, 372, 96, 250, 91, 22, 275, 48, 37, 384, + 421, 0, 397, 15, 0, 16, 0, 235, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 236, + 237, 176, 0, 0, 0, 275, 0, 0, 0, 333, + 0, 0, 0, 0, 0, 339, 275, 0, 0, 0, + 0, 275, 0, 0, 0, 275, 275, 0, 352, 353, + 0, 0, 117, 118, 119, 120, 121, 122, 123, 124, + 125, 126, 127, 128, 129, 130, 0, 0, 0, 0, + 0, 238, 0, 239, 240, 138, 139, 0, 241, 0, + 0, 0, 0, 380, 0, 382, 0, 242, 0, 386, + 243, 0, 244, 0, 0, 245, 0, 389, 390, 391, + 0, 0, 0, 0, 52, 53, 0, 100, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 15, 0, 16, 0, 0, 409, 410, 0, 0, + 0, 0, 0, 0, 417, 0, 0, 0, 0, 0, + 0, 0, 422, 0, 68, 52, 53, 0, 100, 162, + 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, + 66, 67, 15, 0, 16, 0, 0, 438, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 68, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 454, 0, 0, 0, + 0, 0, 69, 0, 0, 70, 0, 462, 71, 0, + 72, 101, 466, 0, 0, 0, 469, 470, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 263, 264, 52, 53, 265, 0, + 0, 0, 0, 69, 0, 0, 70, 0, 0, 71, + 0, 72, 313, 15, 0, 16, 0, 266, 267, 268, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 269, + 270, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 271, + 0, 0, 0, 0, 263, 264, 0, 0, 265, 0, + 0, 0, 117, 118, 119, 120, 121, 122, 123, 124, + 125, 126, 127, 128, 129, 130, 0, 266, 267, 268, + 0, 238, 0, 239, 240, 138, 139, 0, 241, 269, + 270, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 272, 0, 0, 0, 0, 0, 0, 0, 0, 271, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 117, 118, 119, 120, 121, 122, 123, 124, + 125, 126, 127, 128, 129, 130, 0, 0, 0, 0, + 0, 238, 0, 239, 240, 138, 139, 0, 241, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 52, 53, + 272, 100, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 15, 0, 16, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 183, 0, 0, 0, 0, 0, 52, 53, 68, 100, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 15, 0, 16, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 256, 0, + 0, 0, 0, 0, 52, 53, 68, 100, 162, 163, + 164, 165, 166, 167, 168, 169, 170, 171, 172, 66, + 67, 15, 0, 16, 0, 0, 69, 0, 0, 70, + 0, 0, 71, 0, 72, 0, 0, 0, 0, 0, + 0, 0, 52, 53, 68, 100, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 15, + 0, 16, 0, 0, 69, 0, 0, 70, 0, 0, + 71, 0, 72, 0, 327, 0, 0, 0, 0, 0, + 52, 53, 68, 100, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 15, 0, 16, + 0, 0, 69, 0, 0, 70, 0, 309, 71, 0, + 72, 0, 371, 0, 0, 0, 0, 0, 52, 53, + 68, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 15, 0, 16, 0, 0, + 69, 0, 0, 70, 0, 0, 71, 0, 72, 0, + 0, 0, 0, 0, 0, 0, 52, 53, 68, 100, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 15, 0, 16, 0, 0, 69, 0, + 0, 70, 0, 0, 71, 0, 72, 0, 0, 0, + 0, 0, 0, 0, 52, 53, 68, 100, 162, 163, + 164, 165, 166, 167, 168, 169, 170, 171, 172, 66, + 67, 15, 0, 16, 0, 0, 69, 0, 0, 70, + 0, 0, 71, 0, 72, 0, 0, 0, 0, 0, + 0, 0, 52, 53, 68, 189, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 15, + 0, 16, 0, 0, 69, 0, 0, 70, 0, 0, + 71, 0, 72, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 69, 0, 0, 70, 0, 0, 71, 0, + 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 107, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 108, 0, 0, 0, 0, 0, 0, 0, 0, + 69, 109, 110, 70, 0, 0, 71, 0, 72, 0, + 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, + 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, + 131, 132, 133, 0, 0, 134, 135, 136, 137, 138, + 139, 140, 141, 142, 143, 144 + }; + + static const short yycheck[] = { 29, + 113, 113, 2, 44, 206, 72, 96, 29, 252, 23, + 58, 114, 243, 244, 44, 34, 30, 108, 434, 15, + 111, 10, 11, 12, 13, 14, 15, 16, 17, 0, + 15, 9, 108, 33, 450, 54, 102, 113, 105, 104, + 20, 272, 133, 21, 110, 136, 137, 150, 113, 140, + 141, 142, 143, 144, 25, 23, 110, 148, 54, 113, + 31, 41, 42, 43, 44, 95, 96, 47, 101, 54, + 41, 42, 43, 44, 74, 10, 11, 12, 13, 14, + 15, 16, 17, 58, 102, 102, 24, 102, 59, 111, + 102, 102, 449, 108, 112, 112, 108, 101, 112, 110, + 457, 131, 132, 4, 134, 135, 61, 62, 63, 64, + 101, 178, 179, 180, 358, 145, 146, 147, 20, 108, + 22, 104, 24, 49, 50, 51, 22, 101, 24, 31, + 32, 33, 101, 224, 32, 33, 52, 53, 4, 41, + 42, 43, 44, 106, 176, 47, 48, 88, 89, 27, + 28, 4, 182, 55, 186, 3, 4, 59, 4, 191, + 192, 3, 4, 204, 3, 4, 3, 4, 3, 4, + 104, 203, 24, 108, 204, 4, 208, 24, 380, 107, + 382, 222, 107, 104, 56, 4, 218, 219, 220, 4, + 4, 4, 222, 223, 261, 7, 7, 4, 289, 7, + 291, 292, 102, 106, 36, 102, 105, 298, 102, 102, + 102, 102, 242, 243, 244, 305, 306, 307, 308, 102, + 102, 102, 102, 102, 24, 102, 316, 317, 318, 319, + 10, 11, 12, 13, 14, 15, 16, 17, 24, 104, + 104, 104, 272, 105, 104, 104, 104, 104, 280, 104, + 60, 102, 102, 102, 286, 34, 24, 257, 288, 102, + 290, 106, 102, 293, 294, 21, 102, 299, 300, 102, + 21, 102, 4, 363, 104, 305, 306, 307, 308, 102, + 102, 102, 24, 4, 104, 102, 316, 317, 318, 319, + 36, 54, 4, 102, 24, 325, 387, 388, 102, 102, + 102, 102, 334, 102, 336, 102, 102, 102, 340, 399, + 400, 105, 402, 403, 404, 405, 348, 349, 350, 102, + 105, 434, 434, 54, 354, 416, 108, 102, 106, 105, + 191, 192, 105, 363, 105, 105, 105, 450, 450, 105, + 105, 21, 203, 36, 108, 377, 378, 208, 21, 102, + 105, 441, 21, 385, 102, 69, 21, 218, 219, 220, + 21, 393, 0, 0, 84, 84, 84, 84, 398, 399, + 400, 33, 402, 403, 404, 405, 5, 6, 20, 326, + 105, 325, 46, 176, 43, 2, 418, 23, 14, 337, + 392, -1, 359, 22, -1, 24, -1, 26, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 38, + 39, 441, -1, -1, -1, 447, -1, -1, -1, 280, + -1, -1, -1, -1, -1, 286, 458, -1, -1, -1, + -1, 463, -1, -1, -1, 467, 468, -1, 299, 300, + -1, -1, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, -1, -1, -1, -1, + -1, 90, -1, 92, 93, 94, 95, -1, 97, -1, + -1, -1, -1, 334, -1, 336, -1, 106, -1, 340, + 109, -1, 111, -1, -1, 114, -1, 348, 349, 350, + -1, -1, -1, -1, 5, 6, -1, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, -1, 24, -1, -1, 377, 378, -1, -1, + -1, -1, -1, -1, 385, -1, -1, -1, -1, -1, + -1, -1, 393, -1, 45, 5, 6, -1, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, -1, 24, -1, -1, 418, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 45, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 447, -1, -1, -1, + -1, -1, 103, -1, -1, 106, -1, 458, 109, -1, + 111, 112, 463, -1, -1, -1, 467, 468, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 3, 4, 5, 6, 7, -1, + -1, -1, -1, 103, -1, -1, 106, -1, -1, 109, + -1, 111, 112, 22, -1, 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, 58, + -1, -1, -1, -1, 3, 4, -1, -1, 7, -1, + -1, -1, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, -1, 26, 27, 28, + -1, 90, -1, 92, 93, 94, 95, -1, 97, 38, + 39, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 109, -1, -1, -1, -1, -1, -1, -1, -1, 58, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, -1, -1, -1, -1, + -1, 90, -1, 92, 93, 94, 95, -1, 97, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 5, 6, + 109, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, -1, 24, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 37, -1, -1, -1, -1, -1, 5, 6, 45, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, -1, 24, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 37, -1, + -1, -1, -1, -1, 5, 6, 45, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, -1, 24, -1, -1, 103, -1, -1, 106, + -1, -1, 109, -1, 111, -1, -1, -1, -1, -1, + -1, -1, 5, 6, 45, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + -1, 24, -1, -1, 103, -1, -1, 106, -1, -1, + 109, -1, 111, -1, 37, -1, -1, -1, -1, -1, + 5, 6, 45, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, -1, 24, + -1, -1, 103, -1, -1, 106, -1, 108, 109, -1, + 111, -1, 37, -1, -1, -1, -1, -1, 5, 6, + 45, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, -1, 24, -1, -1, + 103, -1, -1, 106, -1, -1, 109, -1, 111, -1, + -1, -1, -1, -1, -1, -1, 5, 6, 45, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, -1, 24, -1, -1, 103, -1, + -1, 106, -1, -1, 109, -1, 111, -1, -1, -1, + -1, -1, -1, -1, 5, 6, 45, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, -1, 24, -1, -1, 103, -1, -1, 106, + -1, -1, 109, -1, 111, -1, -1, -1, -1, -1, + -1, -1, 5, 6, 45, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + -1, 24, -1, -1, 103, -1, -1, 106, -1, -1, + 109, -1, 111, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 45, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 103, -1, -1, 106, -1, -1, 109, -1, + 111, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 35, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 46, -1, -1, -1, -1, -1, -1, -1, -1, + 103, 56, 57, 106, -1, -1, 109, -1, 111, -1, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, -1, -1, 90, 91, 92, 93, 94, + 95, 96, 97, 98, 99, 100 + }; + /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ + #line 3 "/usr/share/bison.simple" + /* This file comes from bison-1.28. */ + + /* Skeleton output parser for bison, + Copyright (C) 1984, 1989, 1990 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., 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 YYEOF 0 + #define YYACCEPT goto yyacceptlab + #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) \ + do \ + if (yychar == YYEMPTY && yylen == 1) \ + { yychar = (token), yylval = (value); \ + yychar1 = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ + { yyerror ("syntax error: cannot back up"); YYERROR; } \ + while (0) + + #define YYTERROR 1 + #define YYERRCODE 256 + + #ifndef YYPURE + #define YYLEX yylex() + #endif + + #ifdef YYPURE + #ifdef YYLSP_NEEDED + #ifdef YYLEX_PARAM + #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) + #else + #define YYLEX yylex(&yylval, &yylloc) + #endif + #else /* not YYLSP_NEEDED */ + #ifdef YYLEX_PARAM + #define YYLEX yylex(&yylval, YYLEX_PARAM) + #else + #define YYLEX yylex(&yylval) + #endif + #endif /* not YYLSP_NEEDED */ + #endif + + /* If nonreentrant, generate the variables here */ + + #ifndef YYPURE + + 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 + + int yynerrs; /* number of parse errors so far */ + #endif /* not YYPURE */ + + #if YYDEBUG != 0 + int yydebug; /* nonzero means print parse trace */ + /* Since this is uninitialized, it does not stop multiple parsers + from coexisting. */ + #endif + + /* YYINITDEPTH indicates the initial size of the parser's stacks */ + + #ifndef YYINITDEPTH + #define YYINITDEPTH 200 + #endif + + /* YYMAXDEPTH is the maximum size the stacks can grow to + (effective only if the built-in stack extension method is used). */ + + #if YYMAXDEPTH == 0 + #undef YYMAXDEPTH + #endif + + #ifndef YYMAXDEPTH + #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 + + /* 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; + { + register char *f = from; + register char *t = to; + register int i = count; + + while (i-- > 0) + *t++ = *f++; + } + + #else /* __cplusplus */ + + /* 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) + { + register char *t = to; + register char *f = from; + register int i = count; + + while (i-- > 0) + *t++ = *f++; + } + + #endif + #endif + + #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. */ + + #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 + int yyparse (void *); + #else + int yyparse (void); + #endif + #endif + + 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 (yyvsp--, yyssp--, yylsp--) + #else + #define YYPOPSTACK (yyvsp--, yyssp--) + #endif + + int yystacksize = YYINITDEPTH; + int yyfree_stacks = 0; + + #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 */ + + int yylen; + + #if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Starting parse\n"); + #endif + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + + yyssp = yyss - 1; + yyvsp = yyvs; + #ifdef YYLSP_NEEDED + yylsp = yyls; + #endif + + /* 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: + + *++yyssp = yystate; + + 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. */ + int size = yyssp - yyss + 1; + + #ifdef yyoverflow + /* 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; + #ifdef YYLSP_NEEDED + yyls = yyls1; + #endif + #else /* no yyoverflow */ + /* Extend the stack our own way. */ + 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 (yystacksize > YYMAXDEPTH) + yystacksize = YYMAXDEPTH; + #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 + size - 1; + yyvsp = yyvs + size - 1; + #ifdef YYLSP_NEEDED + yylsp = yyls + size - 1; + #endif + + #if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Stack size increased to %d\n", yystacksize); + #endif + + if (yyssp >= yyss + yystacksize - 1) + YYABORT; + } + + #if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Entering state %d\n", yystate); + #endif + + goto yybackup; + yybackup: + + /* Do appropriate processing given the current state. */ + /* Read a lookahead token if we need one and don't already have one. */ + /* yyresume: */ + + /* First try to decide what to do without reference to lookahead token. */ + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yydefault; + + /* 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. */ + + if (yychar == YYEMPTY) + { + #if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Reading a token: "); + #endif + yychar = YYLEX; + } + + /* Convert token to internal form (in yychar1) for indexing tables with */ + + if (yychar <= 0) /* This means end of input. */ + { + 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 + { + 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 + } + + yyn += yychar1; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) + goto yydefault; + + yyn = yytable[yyn]; + + /* 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 == YYFLAG) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + else if (yyn == 0) + goto yyerrlab; + + if (yyn == YYFINAL) + YYACCEPT; + + /* Shift the lookahead token. */ + + #if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); + #endif + + /* Discard the token being shifted unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + + *++yyvsp = yylval; + #ifdef YYLSP_NEEDED + *++yylsp = yylloc; + #endif + + /* count tokens shifted since error; after three, turn off error status. */ + if (yyerrstatus) yyerrstatus--; + + yystate = yyn; + goto yynewstate; + + /* Do the default action for the current state. */ + yydefault: + + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + + /* Do a reduction. yyn is the number of a rule to reduce with. */ + yyreduce: + yylen = yyr2[yyn]; + if (yylen > 0) + yyval = yyvsp[1-yylen]; /* implement default value of the action */ + + #if YYDEBUG != 0 + if (yydebug) + { + int i; + + 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 2: + #line 1011 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (yyvsp[0].UIntVal > (uint32_t)INT32_MAX) // Outside of my range! + ThrowException("Value too large for type!"); + yyval.SIntVal = (int32_t)yyvsp[0].UIntVal; + ; + break;} + case 4: + #line 1019 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (yyvsp[0].UInt64Val > (uint64_t)INT64_MAX) // Outside of my range! + ThrowException("Value too large for type!"); + yyval.SInt64Val = (int64_t)yyvsp[0].UInt64Val; + ; + break;} + case 33: + #line 1042 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.StrVal = yyvsp[-1].StrVal; + ; + break;} + case 34: + #line 1045 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.StrVal = 0; + ; + break;} + case 35: + #line 1049 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { yyval.Linkage = GlobalValue::InternalLinkage; ; + break;} + case 36: + #line 1050 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { yyval.Linkage = GlobalValue::LinkOnceLinkage; ; + break;} + case 37: + #line 1051 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { yyval.Linkage = GlobalValue::WeakLinkage; ; + break;} + case 38: + #line 1052 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { yyval.Linkage = GlobalValue::AppendingLinkage; ; + break;} + case 39: + #line 1053 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { yyval.Linkage = GlobalValue::ExternalLinkage; ; + break;} + case 40: + #line 1055 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { yyval.UIntVal = CallingConv::C; ; + break;} + case 41: + #line 1056 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { yyval.UIntVal = CallingConv::C; ; + break;} + case 42: + #line 1057 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { yyval.UIntVal = CallingConv::Fast; ; + break;} + case 43: + #line 1058 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { yyval.UIntVal = CallingConv::Cold; ; + break;} + case 44: + #line 1059 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + if ((unsigned)yyvsp[0].UInt64Val != yyvsp[0].UInt64Val) + ThrowException("Calling conv too large!"); + yyval.UIntVal = yyvsp[0].UInt64Val; + ; + break;} + case 45: + #line 1067 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { yyval.UIntVal = 0; ; + break;} + case 46: + #line 1068 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.UIntVal = yyvsp[0].UInt64Val; + if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal)) + ThrowException("Alignment must be a power of two!"); + ; + break;} + case 47: + #line 1073 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { yyval.UIntVal = 0; ; + break;} + case 48: + #line 1074 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.UIntVal = yyvsp[0].UInt64Val; + if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal)) + ThrowException("Alignment must be a power of two!"); + ; + break;} + case 49: + #line 1081 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + for (unsigned i = 0, e = strlen(yyvsp[0].StrVal); i != e; ++i) + if (yyvsp[0].StrVal[i] == '"' || yyvsp[0].StrVal[i] == '\\') + ThrowException("Invalid character in section name!"); + yyval.StrVal = yyvsp[0].StrVal; + ; + break;} + case 50: + #line 1088 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { yyval.StrVal = 0; ; + break;} + case 51: + #line 1089 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { yyval.StrVal = yyvsp[0].StrVal; ; + break;} + case 52: + #line 1094 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + {; + break;} + case 53: + #line 1095 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + {; + break;} + case 54: + #line 1096 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + CurGV->setSection(yyvsp[0].StrVal); + free(yyvsp[0].StrVal); + ; + break;} + case 55: + #line 1100 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (yyvsp[0].UInt64Val != 0 && !isPowerOf2_32(yyvsp[0].UInt64Val)) + ThrowException("Alignment must be a power of two!"); + CurGV->setAlignment(yyvsp[0].UInt64Val); + ; + break;} + case 57: + #line 1113 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); ; + break;} + case 59: + #line 1114 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); ; + break;} + case 60: + #line 1116 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (!UpRefs.empty()) + ThrowException("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription()); + yyval.TypeVal = yyvsp[0].TypeVal; + ; + break;} + case 74: + #line 1127 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.TypeVal = new PATypeHolder(OpaqueType::get()); + ; + break;} + case 75: + #line 1130 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); + ; + break;} + case 76: + #line 1133 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { // Named types are also simple types... + yyval.TypeVal = new PATypeHolder(getTypeVal(yyvsp[0].ValIDVal)); + ; + break;} + case 77: + #line 1139 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { // Type UpReference + if (yyvsp[0].UInt64Val > (uint64_t)~0U) ThrowException("Value out of range!"); + OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder + UpRefs.push_back(UpRefRecord((unsigned)yyvsp[0].UInt64Val, OT)); // Add to vector... + yyval.TypeVal = new PATypeHolder(OT); + UR_OUT("New Upreference!\n"); + ; + break;} + case 78: + #line 1146 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { // Function derived type? + std::vector Params; + for (std::list::iterator I = yyvsp[-1].TypeList->begin(), + E = yyvsp[-1].TypeList->end(); I != E; ++I) + Params.push_back(*I); + bool isVarArg = Params.size() && Params.back() == Type::VoidTy; + if (isVarArg) Params.pop_back(); + + yyval.TypeVal = new PATypeHolder(HandleUpRefs(FunctionType::get(*yyvsp[-3].TypeVal,Params,isVarArg))); + delete yyvsp[-1].TypeList; // Delete the argument list + delete yyvsp[-3].TypeVal; // Delete the return type handle + ; + break;} + case 79: + #line 1158 "/Users/sabre/cvs/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; + ; + break;} + case 80: + #line 1162 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { // Packed array type? + const llvm::Type* ElemTy = yyvsp[-1].TypeVal->get(); + if ((unsigned)yyvsp[-3].UInt64Val != yyvsp[-3].UInt64Val) + ThrowException("Unsigned result not equal to signed result"); + if (!ElemTy->isPrimitiveType()) + ThrowException("Elemental type of a PackedType must be primitive"); + if (!isPowerOf2_32(yyvsp[-3].UInt64Val)) + ThrowException("Vector length should be a power of 2!"); + yyval.TypeVal = new PATypeHolder(HandleUpRefs(PackedType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val))); + delete yyvsp[-1].TypeVal; + ; + break;} + case 81: + #line 1173 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { // Structure type? + std::vector Elements; + 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[-1].TypeList; + ; + break;} + case 82: + #line 1182 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { // Empty structure type? + yyval.TypeVal = new PATypeHolder(StructType::get(std::vector())); + ; + break;} + case 83: + #line 1185 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { // Pointer type? + yyval.TypeVal = new PATypeHolder(HandleUpRefs(PointerType::get(*yyvsp[-1].TypeVal))); + delete yyvsp[-1].TypeVal; + ; + break;} + case 84: + #line 1193 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.TypeList = new std::list(); + yyval.TypeList->push_back(*yyvsp[0].TypeVal); delete yyvsp[0].TypeVal; + ; + break;} + case 85: + #line 1197 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.TypeList=yyvsp[-2].TypeList)->push_back(*yyvsp[0].TypeVal); delete yyvsp[0].TypeVal; + ; + break;} + case 87: + #line 1203 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.TypeList=yyvsp[-2].TypeList)->push_back(Type::VoidTy); + ; + break;} + case 88: + #line 1206 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.TypeList = new std::list())->push_back(Type::VoidTy); + ; + break;} + case 89: + #line 1209 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.TypeList = new std::list(); + ; + break;} + case 90: + #line 1219 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { // Nonempty unsized arr + const ArrayType *ATy = dyn_cast(yyvsp[-3].TypeVal->get()); + if (ATy == 0) + ThrowException("Cannot make array constant with type: '" + + (*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[-1].ConstVector->size()) + ThrowException("Type mismatch: constant sized array initialized with " + + utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " + + itostr(NumElements) + "!"); + + // Verify all elements are correct type! + for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) { + if (ETy != (*yyvsp[-1].ConstVector)[i]->getType()) + ThrowException("Element #" + utostr(i) + " is not of type '" + + ETy->getDescription() +"' as required!\nIt is of type '"+ + (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'."); + } + + yyval.ConstVal = ConstantArray::get(ATy, *yyvsp[-1].ConstVector); + delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector; + ; + break;} + case 91: + #line 1244 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + const ArrayType *ATy = dyn_cast(yyvsp[-2].TypeVal->get()); + if (ATy == 0) + ThrowException("Cannot make array constant with type: '" + + (*yyvsp[-2].TypeVal)->getDescription() + "'!"); + + int NumElements = ATy->getNumElements(); + if (NumElements != -1 && NumElements != 0) + ThrowException("Type mismatch: constant sized array initialized with 0" + " arguments, but has size of " + itostr(NumElements) +"!"); + yyval.ConstVal = ConstantArray::get(ATy, std::vector()); + delete yyvsp[-2].TypeVal; + ; + break;} + case 92: + #line 1257 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + const ArrayType *ATy = dyn_cast(yyvsp[-2].TypeVal->get()); + if (ATy == 0) + ThrowException("Cannot make array constant with type: '" + + (*yyvsp[-2].TypeVal)->getDescription() + "'!"); + + int NumElements = ATy->getNumElements(); + const Type *ETy = ATy->getElementType(); + char *EndStr = UnEscapeLexed(yyvsp[0].StrVal, true); + if (NumElements != -1 && NumElements != (EndStr-yyvsp[0].StrVal)) + ThrowException("Can't build string constant of size " + + itostr((int)(EndStr-yyvsp[0].StrVal)) + + " when array has size " + itostr(NumElements) + "!"); + std::vector Vals; + if (ETy == Type::SByteTy) { + for (signed char *C = (signed char *)yyvsp[0].StrVal; C != (signed char *)EndStr; ++C) + Vals.push_back(ConstantSInt::get(ETy, *C)); + } else if (ETy == Type::UByteTy) { + for (unsigned char *C = (unsigned char *)yyvsp[0].StrVal; + C != (unsigned char*)EndStr; ++C) + Vals.push_back(ConstantUInt::get(ETy, *C)); + } else { + free(yyvsp[0].StrVal); + ThrowException("Cannot build string arrays of non byte sized elements!"); + } + free(yyvsp[0].StrVal); + yyval.ConstVal = ConstantArray::get(ATy, Vals); + delete yyvsp[-2].TypeVal; + ; + break;} + case 93: + #line 1286 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { // Nonempty unsized arr + const PackedType *PTy = dyn_cast(yyvsp[-3].TypeVal->get()); + if (PTy == 0) + ThrowException("Cannot make packed constant with type: '" + + (*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[-1].ConstVector->size()) + ThrowException("Type mismatch: constant sized packed initialized with " + + utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " + + itostr(NumElements) + "!"); + + // Verify all elements are correct type! + for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) { + if (ETy != (*yyvsp[-1].ConstVector)[i]->getType()) + ThrowException("Element #" + utostr(i) + " is not of type '" + + ETy->getDescription() +"' as required!\nIt is of type '"+ + (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'."); + } + + yyval.ConstVal = ConstantPacked::get(PTy, *yyvsp[-1].ConstVector); + delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector; + ; + break;} + case 94: + #line 1311 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + const StructType *STy = dyn_cast(yyvsp[-3].TypeVal->get()); + if (STy == 0) + ThrowException("Cannot make struct constant with type: '" + + (*yyvsp[-3].TypeVal)->getDescription() + "'!"); + + if (yyvsp[-1].ConstVector->size() != STy->getNumContainedTypes()) + ThrowException("Illegal number of initializers for structure type!"); + + // Check to ensure that constants are compatible with the type initializer! + for (unsigned i = 0, e = yyvsp[-1].ConstVector->size(); i != e; ++i) + if ((*yyvsp[-1].ConstVector)[i]->getType() != STy->getElementType(i)) + ThrowException("Expected type '" + + STy->getElementType(i)->getDescription() + + "' for element #" + utostr(i) + + " of structure initializer!"); + + yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-1].ConstVector); + delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector; + ; + break;} + case 95: + #line 1331 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + const StructType *STy = dyn_cast(yyvsp[-2].TypeVal->get()); + if (STy == 0) + ThrowException("Cannot make struct constant with type: '" + + (*yyvsp[-2].TypeVal)->getDescription() + "'!"); + + if (STy->getNumContainedTypes() != 0) + ThrowException("Illegal number of initializers for structure type!"); + + yyval.ConstVal = ConstantStruct::get(STy, std::vector()); + delete yyvsp[-2].TypeVal; + ; + break;} + case 96: + #line 1343 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + const PointerType *PTy = dyn_cast(yyvsp[-1].TypeVal->get()); + if (PTy == 0) + ThrowException("Cannot make null pointer constant with type: '" + + (*yyvsp[-1].TypeVal)->getDescription() + "'!"); + + yyval.ConstVal = ConstantPointerNull::get(PTy); + delete yyvsp[-1].TypeVal; + ; + break;} + case 97: + #line 1352 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.ConstVal = UndefValue::get(yyvsp[-1].TypeVal->get()); + delete yyvsp[-1].TypeVal; + ; + break;} + case 98: + #line 1356 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + const PointerType *Ty = dyn_cast(yyvsp[-1].TypeVal->get()); + if (Ty == 0) + ThrowException("Global const reference must be a pointer type!"); + + // ConstExprs can exist in the body of a function, thus creating + // GlobalValues whenever they refer to a variable. Because we are in + // the context of a function, getValNonImprovising will search the functions + // symbol table instead of the module symbol table for the global symbol, + // which throws things all off. To get around this, we just tell + // getValNonImprovising that we are at global scope here. + // + Function *SavedCurFn = CurFun.CurrentFunction; + CurFun.CurrentFunction = 0; + + Value *V = getValNonImprovising(Ty, yyvsp[0].ValIDVal); + + CurFun.CurrentFunction = SavedCurFn; + + // If this is an initializer for a constant pointer, which is referencing a + // (currently) undefined variable, create a stub now that shall be replaced + // in the future with the right type of variable. + // + if (V == 0) { + assert(isa(Ty) && "Globals may only be used as pointers!"); + const PointerType *PT = cast(Ty); + + // First check to see if the forward references value is already created! + PerModuleInfo::GlobalRefsType::iterator I = + CurModule.GlobalRefs.find(std::make_pair(PT, yyvsp[0].ValIDVal)); + + if (I != CurModule.GlobalRefs.end()) { + V = I->second; // Placeholder already exists, use it... + yyvsp[0].ValIDVal.destroy(); + } else { + std::string Name; + if (yyvsp[0].ValIDVal.Type == ValID::NameVal) Name = yyvsp[0].ValIDVal.Name; + + // Create the forward referenced global. + GlobalValue *GV; + if (const FunctionType *FTy = + dyn_cast(PT->getElementType())) { + GV = new Function(FTy, GlobalValue::ExternalLinkage, Name, + CurModule.CurrentModule); + } else { + GV = new GlobalVariable(PT->getElementType(), false, + GlobalValue::ExternalLinkage, 0, + Name, CurModule.CurrentModule); + } + + // 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[0].ValIDVal), GV)); + V = GV; + } + } + + yyval.ConstVal = cast(V); + delete yyvsp[-1].TypeVal; // Free the type handle + ; + break;} + case 99: + #line 1415 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (yyvsp[-1].TypeVal->get() != yyvsp[0].ConstVal->getType()) + ThrowException("Mismatched types for constant expression!"); + yyval.ConstVal = yyvsp[0].ConstVal; + delete yyvsp[-1].TypeVal; + ; + break;} + case 100: + #line 1421 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + const Type *Ty = yyvsp[-1].TypeVal->get(); + if (isa(Ty) || Ty == Type::LabelTy || isa(Ty)) + ThrowException("Cannot create a null initialized value of this type!"); + yyval.ConstVal = Constant::getNullValue(Ty); + delete yyvsp[-1].TypeVal; + ; + break;} + case 101: + #line 1429 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { // integral constants + if (!ConstantSInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].SInt64Val)) + ThrowException("Constant value doesn't fit in type!"); + yyval.ConstVal = ConstantSInt::get(yyvsp[-1].PrimType, yyvsp[0].SInt64Val); + ; + break;} + case 102: + #line 1434 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { // integral constants + if (!ConstantUInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].UInt64Val)) + ThrowException("Constant value doesn't fit in type!"); + yyval.ConstVal = ConstantUInt::get(yyvsp[-1].PrimType, yyvsp[0].UInt64Val); + ; + break;} + case 103: + #line 1439 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { // Boolean constants + yyval.ConstVal = ConstantBool::True; + ; + break;} + case 104: + #line 1442 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { // Boolean constants + yyval.ConstVal = ConstantBool::False; + ; + break;} + case 105: + #line 1445 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { // Float & Double constants + if (!ConstantFP::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].FPVal)) + ThrowException("Floating point constant invalid for type!!"); + yyval.ConstVal = ConstantFP::get(yyvsp[-1].PrimType, yyvsp[0].FPVal); + ; + break;} + case 106: + #line 1452 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (!yyvsp[-3].ConstVal->getType()->isFirstClassType()) + ThrowException("cast constant expression from a non-primitive type: '" + + yyvsp[-3].ConstVal->getType()->getDescription() + "'!"); + if (!yyvsp[-1].TypeVal->get()->isFirstClassType()) + ThrowException("cast constant expression to a non-primitive type: '" + + yyvsp[-1].TypeVal->get()->getDescription() + "'!"); + yyval.ConstVal = ConstantExpr::getCast(yyvsp[-3].ConstVal, yyvsp[-1].TypeVal->get()); + delete yyvsp[-1].TypeVal; + ; + break;} + case 107: + #line 1462 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (!isa(yyvsp[-2].ConstVal->getType())) + ThrowException("GetElementPtr requires a pointer operand!"); + + // LLVM 1.2 and earlier used ubyte struct indices. Convert any ubyte struct + // indices to uint struct indices for compatibility. + generic_gep_type_iterator::iterator> + GTI = gep_type_begin(yyvsp[-2].ConstVal->getType(), yyvsp[-1].ValueList->begin(), yyvsp[-1].ValueList->end()), + GTE = gep_type_end(yyvsp[-2].ConstVal->getType(), yyvsp[-1].ValueList->begin(), yyvsp[-1].ValueList->end()); + for (unsigned i = 0, e = yyvsp[-1].ValueList->size(); i != e && GTI != GTE; ++i, ++GTI) + if (isa(*GTI)) // Only change struct indices + if (ConstantUInt *CUI = dyn_cast((*yyvsp[-1].ValueList)[i])) + if (CUI->getType() == Type::UByteTy) + (*yyvsp[-1].ValueList)[i] = ConstantExpr::getCast(CUI, Type::UIntTy); + + const Type *IdxTy = + GetElementPtrInst::getIndexedType(yyvsp[-2].ConstVal->getType(), *yyvsp[-1].ValueList, true); + if (!IdxTy) + ThrowException("Index list invalid for constant getelementptr!"); + + std::vector IdxVec; + 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 + ThrowException("Indices to constant getelementptr must be constants!"); + + delete yyvsp[-1].ValueList; + + yyval.ConstVal = ConstantExpr::getGetElementPtr(yyvsp[-2].ConstVal, IdxVec); + ; + break;} + case 108: + #line 1493 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (yyvsp[-5].ConstVal->getType() != Type::BoolTy) + ThrowException("Select condition must be of boolean type!"); + if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) + ThrowException("Select operand types must match!"); + yyval.ConstVal = ConstantExpr::getSelect(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); + ; + break;} + case 109: + #line 1500 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) + ThrowException("Binary operator types must match!"); + // 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(yyvsp[-3].ConstVal->getType())) { + yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); + } else { + const Type *IntPtrTy = 0; + switch (CurModule.CurrentModule->getPointerSize()) { + case Module::Pointer32: IntPtrTy = Type::IntTy; break; + case Module::Pointer64: IntPtrTy = Type::LongTy; break; + default: ThrowException("invalid pointer binary constant expr!"); + } + yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, ConstantExpr::getCast(yyvsp[-3].ConstVal, IntPtrTy), + ConstantExpr::getCast(yyvsp[-1].ConstVal, IntPtrTy)); + yyval.ConstVal = ConstantExpr::getCast(yyval.ConstVal, yyvsp[-3].ConstVal->getType()); + } + ; + break;} + case 110: + #line 1521 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) + ThrowException("Logical operator types must match!"); + if (!yyvsp[-3].ConstVal->getType()->isIntegral()) { + if (!isa(yyvsp[-3].ConstVal->getType()) || + !cast(yyvsp[-3].ConstVal->getType())->getElementType()->isIntegral()) + ThrowException("Logical operator requires integral operands!"); + } + yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); + ; + break;} + case 111: + #line 1531 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) + ThrowException("setcc operand types must match!"); + yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); + ; + break;} + case 112: + #line 1536 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (yyvsp[-1].ConstVal->getType() != Type::UByteTy) + ThrowException("Shift count for shift constant must be unsigned byte!"); + if (!yyvsp[-3].ConstVal->getType()->isInteger()) + ThrowException("Shift constant expression requires integer operand!"); + yyval.ConstVal = ConstantExpr::get(yyvsp[-5].OtherOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); + ; + break;} + case 113: + #line 1543 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (!isa(yyvsp[-3].ConstVal->getType())) + ThrowException("First operand of extractelement must be " + "packed type!"); + if (yyvsp[-1].ConstVal->getType() != Type::UIntTy) + ThrowException("Second operand of extractelement must be uint!"); + yyval.ConstVal = ConstantExpr::getExtractElement(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); + ; + break;} + case 114: + #line 1553 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(yyvsp[0].ConstVal); + ; + break;} + case 115: + #line 1556 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.ConstVector = new std::vector(); + yyval.ConstVector->push_back(yyvsp[0].ConstVal); + ; + break;} + case 116: + #line 1563 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { yyval.BoolVal = false; ; + break;} + case 117: + #line 1563 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { yyval.BoolVal = true; ; + break;} + case 118: + #line 1573 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.ModuleVal = ParserResult = yyvsp[0].ModuleVal; + CurModule.ModuleDone(); + ; + break;} + case 119: + #line 1580 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.ModuleVal = yyvsp[-1].ModuleVal; + CurFun.FunctionDone(); + ; + break;} + case 120: + #line 1584 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.ModuleVal = yyvsp[-1].ModuleVal; + ; + break;} + case 121: + #line 1587 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.ModuleVal = yyvsp[-3].ModuleVal; + ; + break;} + case 122: + #line 1590 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.ModuleVal = yyvsp[-1].ModuleVal; + ; + break;} + case 123: + #line 1593 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.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; + if (DID.Type == ValID::NameVal) + ThrowException("Reference to an undefined type: '"+DID.getName() + "'"); + else + ThrowException("Reference to an undefined type: #" + itostr(DID.Num)); + } + ; + break;} + case 124: + #line 1606 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + // Eagerly resolve types. This is not an optimization, this is a + // requirement that is due to the fact that we could have this: + // + // %list = type { %list * } + // %list = type { %list * } ; repeated type decl + // + // If types are not resolved eagerly, then the two types will not be + // determined to be the same type! + // + ResolveTypeTo(yyvsp[-2].StrVal, *yyvsp[0].TypeVal); + + if (!setTypeName(*yyvsp[0].TypeVal, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) { + // If this is a named type that is not a redefinition, add it to the slot + // table. + CurModule.Types.push_back(*yyvsp[0].TypeVal); + } + + delete yyvsp[0].TypeVal; + ; + break;} + case 125: + #line 1626 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { // Function prototypes can be in const pool + ; + break;} + case 126: + #line 1628 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { // Asm blocks can be in the const pool + ; + break;} + case 127: + #line 1630 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (yyvsp[0].ConstVal == 0) ThrowException("Global value initializer is not a constant!"); + CurGV = ParseGlobalVariable(yyvsp[-3].StrVal, yyvsp[-2].Linkage, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal); + ; + break;} + case 128: + #line 1633 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + CurGV = 0; + ; + break;} + case 129: + #line 1636 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + CurGV = ParseGlobalVariable(yyvsp[-3].StrVal, GlobalValue::ExternalLinkage, + yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0); + delete yyvsp[0].TypeVal; + ; + break;} + case 130: + #line 1640 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + CurGV = 0; + ; + break;} + case 131: + #line 1643 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + ; + break;} + case 132: + #line 1645 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + ; + break;} + case 133: + #line 1647 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + ; + break;} + case 134: + #line 1651 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); + 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 135: + #line 1663 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { yyval.Endianness = Module::BigEndian; ; + break;} + case 136: + #line 1664 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { yyval.Endianness = Module::LittleEndian; ; + break;} + case 137: + #line 1666 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + CurModule.CurrentModule->setEndianness(yyvsp[0].Endianness); + ; + break;} + case 138: + #line 1669 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (yyvsp[0].UInt64Val == 32) + CurModule.CurrentModule->setPointerSize(Module::Pointer32); + else if (yyvsp[0].UInt64Val == 64) + CurModule.CurrentModule->setPointerSize(Module::Pointer64); + else + ThrowException("Invalid pointer size: '" + utostr(yyvsp[0].UInt64Val) + "'!"); + ; + break;} + case 139: + #line 1677 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + CurModule.CurrentModule->setTargetTriple(yyvsp[0].StrVal); + free(yyvsp[0].StrVal); + ; + break;} + case 141: + #line 1684 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal); + free(yyvsp[0].StrVal); + ; + break;} + case 142: + #line 1688 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal); + free(yyvsp[0].StrVal); + ; + break;} + case 143: + #line 1692 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + ; + break;} + case 147: + #line 1701 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { yyval.StrVal = 0; ; + break;} + case 148: + #line 1703 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (*yyvsp[-1].TypeVal == Type::VoidTy) + ThrowException("void typed arguments are invalid!"); + yyval.ArgVal = new std::pair(yyvsp[-1].TypeVal, yyvsp[0].StrVal); + ; + break;} + case 149: + #line 1709 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.ArgList = yyvsp[-2].ArgList; + yyvsp[-2].ArgList->push_back(*yyvsp[0].ArgVal); + delete yyvsp[0].ArgVal; + ; + break;} + case 150: + #line 1714 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.ArgList = new std::vector >(); + yyval.ArgList->push_back(*yyvsp[0].ArgVal); + delete yyvsp[0].ArgVal; + ; + break;} + case 151: + #line 1720 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.ArgList = yyvsp[0].ArgList; + ; + break;} + case 152: + #line 1723 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.ArgList = yyvsp[-2].ArgList; + yyval.ArgList->push_back(std::pair(new PATypeHolder(Type::VoidTy), 0)); + ; + break;} + case 153: + #line 1728 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.ArgList = new std::vector >(); + yyval.ArgList->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0)); + ; + break;} + case 154: + #line 1732 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.ArgList = 0; + ; + break;} + case 155: + #line 1737 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + UnEscapeLexed(yyvsp[-5].StrVal); + std::string FunctionName(yyvsp[-5].StrVal); + free(yyvsp[-5].StrVal); // Free strdup'd memory! + + if (!(*yyvsp[-6].TypeVal)->isFirstClassType() && *yyvsp[-6].TypeVal != Type::VoidTy) + ThrowException("LLVM functions cannot return aggregate types!"); + + std::vector ParamTypeList; + if (yyvsp[-3].ArgList) { // If there are arguments... + for (std::vector >::iterator I = yyvsp[-3].ArgList->begin(); + I != yyvsp[-3].ArgList->end(); ++I) + ParamTypeList.push_back(I->first->get()); + } + + bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; + if (isVarArg) ParamTypeList.pop_back(); + + const FunctionType *FT = FunctionType::get(*yyvsp[-6].TypeVal, ParamTypeList, isVarArg); + const PointerType *PFT = PointerType::get(FT); + delete yyvsp[-6].TypeVal; + + ValID ID; + if (!FunctionName.empty()) { + ID = ValID::create((char*)FunctionName.c_str()); + } else { + ID = ValID::create((int)CurModule.Values[PFT].size()); + } + + Function *Fn = 0; + // See if this function was forward referenced. If so, recycle the object. + if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) { + // Move the function to the end of the list, from whereever it was + // previously inserted. + Fn = cast(FWRef); + CurModule.CurrentModule->getFunctionList().remove(Fn); + CurModule.CurrentModule->getFunctionList().push_back(Fn); + } else if (!FunctionName.empty() && // Merge with an earlier prototype? + (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) { + // If this is the case, either we need to be a forward decl, or it needs + // to be. + if (!CurFun.isDeclare && !Fn->isExternal()) + ThrowException("Redefinition of function '" + FunctionName + "'!"); + + // Make sure to strip off any argument names so we can't get conflicts. + if (Fn->isExternal()) + for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); + AI != AE; ++AI) + AI->setName(""); + + } else { // Not already defined? + Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName, + CurModule.CurrentModule); + InsertValue(Fn, CurModule.Values); + } + + CurFun.FunctionStart(Fn); + Fn->setCallingConv(yyvsp[-7].UIntVal); + Fn->setAlignment(yyvsp[0].UIntVal); + if (yyvsp[-1].StrVal) { + Fn->setSection(yyvsp[-1].StrVal); + free(yyvsp[-1].StrVal); + } + + // Add all of the arguments we parsed to the function... + if (yyvsp[-3].ArgList) { // Is null if empty... + if (isVarArg) { // Nuke the last entry + assert(yyvsp[-3].ArgList->back().first->get() == Type::VoidTy && yyvsp[-3].ArgList->back().second == 0&& + "Not a varargs marker!"); + delete yyvsp[-3].ArgList->back().first; + yyvsp[-3].ArgList->pop_back(); // Delete the last entry + } + Function::arg_iterator ArgIt = Fn->arg_begin(); + for (std::vector >::iterator I = yyvsp[-3].ArgList->begin(); + I != yyvsp[-3].ArgList->end(); ++I, ++ArgIt) { + delete I->first; // Delete the typeholder... + + setValueName(ArgIt, I->second); // Insert arg into symtab... + InsertValue(ArgIt); + } + + delete yyvsp[-3].ArgList; // We're now done with the argument list + } + ; + break;} + case 158: + #line 1824 "/Users/sabre/cvs/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[-2].Linkage); + ; + break;} + case 161: + #line 1834 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.FunctionVal = yyvsp[-1].FunctionVal; + ; + break;} + case 162: + #line 1838 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { CurFun.isDeclare = true; ; + break;} + case 163: + #line 1838 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.FunctionVal = CurFun.CurrentFunction; + CurFun.FunctionDone(); + ; + break;} + case 164: + #line 1847 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.BoolVal = false; + ; + break;} + case 165: + #line 1850 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.BoolVal = true; + ; + break;} + case 166: + #line 1854 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { // A reference to a direct constant + yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val); + ; + break;} + case 167: + #line 1857 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val); + ; + break;} + case 168: + #line 1860 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { // Perhaps it's an FP constant? + yyval.ValIDVal = ValID::create(yyvsp[0].FPVal); + ; + break;} + case 169: + #line 1863 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.ValIDVal = ValID::create(ConstantBool::True); + ; + break;} + case 170: + #line 1866 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.ValIDVal = ValID::create(ConstantBool::False); + ; + break;} + case 171: + #line 1869 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.ValIDVal = ValID::createNull(); + ; + break;} + case 172: + #line 1872 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.ValIDVal = ValID::createUndef(); + ; + break;} + case 173: + #line 1875 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { // A vector zero constant. + yyval.ValIDVal = ValID::createZeroInit(); + ; + break;} + case 174: + #line 1878 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { // Nonempty unsized packed vector + const Type *ETy = (*yyvsp[-1].ConstVector)[0]->getType(); + int NumElements = yyvsp[-1].ConstVector->size(); + + PackedType* pt = PackedType::get(ETy, NumElements); + PATypeHolder* PTy = new PATypeHolder( + HandleUpRefs( + PackedType::get( + ETy, + NumElements) + ) + ); + + // Verify all elements are correct type! + for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) { + if (ETy != (*yyvsp[-1].ConstVector)[i]->getType()) + ThrowException("Element #" + utostr(i) + " is not of type '" + + ETy->getDescription() +"' as required!\nIt is of type '" + + (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'."); + } + + yyval.ValIDVal = ValID::create(ConstantPacked::get(pt, *yyvsp[-1].ConstVector)); + delete PTy; delete yyvsp[-1].ConstVector; + ; + break;} + case 175: + #line 1902 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.ValIDVal = ValID::create(yyvsp[0].ConstVal); + ; + break;} + case 176: + #line 1905 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.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 177: + #line 1918 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { // Is it an integer reference...? + yyval.ValIDVal = ValID::create(yyvsp[0].SIntVal); + ; + break;} + case 178: + #line 1921 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { // Is it a named reference...? + yyval.ValIDVal = ValID::create(yyvsp[0].StrVal); + ; + break;} + case 181: + #line 1932 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.ValueVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal); delete yyvsp[-1].TypeVal; + ; + break;} + case 182: + #line 1936 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.FunctionVal = yyvsp[-1].FunctionVal; + ; + break;} + case 183: + #line 1939 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { // Do not allow functions with 0 basic blocks + yyval.FunctionVal = yyvsp[-1].FunctionVal; + ; + break;} + case 184: + #line 1947 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + setValueName(yyvsp[0].TermInstVal, yyvsp[-1].StrVal); + InsertValue(yyvsp[0].TermInstVal); + + yyvsp[-2].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal); + InsertValue(yyvsp[-2].BasicBlockVal); + yyval.BasicBlockVal = yyvsp[-2].BasicBlockVal; + ; + break;} + case 185: + #line 1956 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal); + yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal; + ; + break;} + case 186: + #line 1960 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.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 187: + #line 1970 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.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 188: + #line 1981 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { // Return with a result... + yyval.TermInstVal = new ReturnInst(yyvsp[0].ValueVal); + ; + break;} + case 189: + #line 1984 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { // Return with no result... + yyval.TermInstVal = new ReturnInst(); + ; + break;} + case 190: + #line 1987 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { // Unconditional Branch... + yyval.TermInstVal = new BranchInst(getBBVal(yyvsp[0].ValIDVal)); + ; + break;} + case 191: + #line 1990 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.TermInstVal = new BranchInst(getBBVal(yyvsp[-3].ValIDVal), getBBVal(yyvsp[0].ValIDVal), getVal(Type::BoolTy, yyvsp[-6].ValIDVal)); + ; + break;} + case 192: + #line 1993 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + SwitchInst *S = new SwitchInst(getVal(yyvsp[-7].PrimType, yyvsp[-6].ValIDVal), getBBVal(yyvsp[-3].ValIDVal), yyvsp[-1].JumpTable->size()); + yyval.TermInstVal = S; + + 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 + ThrowException("Switch case is constant, but not a simple integer!"); + } + delete yyvsp[-1].JumpTable; + ; + break;} + case 193: + #line 2007 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + SwitchInst *S = new SwitchInst(getVal(yyvsp[-6].PrimType, yyvsp[-5].ValIDVal), getBBVal(yyvsp[-2].ValIDVal), 0); + yyval.TermInstVal = S; + ; + break;} + case 194: + #line 2012 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + const PointerType *PFTy; + const FunctionType *Ty; + + if (!(PFTy = dyn_cast(yyvsp[-10].TypeVal->get())) || + !(Ty = dyn_cast(PFTy->getElementType()))) { + // Pull out the types of all of the arguments... + std::vector ParamTypes; + 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)->getType()); + } + + bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy; + if (isVarArg) ParamTypes.pop_back(); + + Ty = FunctionType::get(yyvsp[-10].TypeVal->get(), ParamTypes, isVarArg); + PFTy = PointerType::get(Ty); + } + + 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[-7].ValueList) { // Has no arguments? + yyval.TermInstVal = new InvokeInst(V, Normal, Except, std::vector()); + } 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[-7].ValueList->begin(), ArgE = yyvsp[-7].ValueList->end(); + + for (; ArgI != ArgE && I != E; ++ArgI, ++I) + if ((*ArgI)->getType() != *I) + ThrowException("Parameter " +(*ArgI)->getName()+ " is not of type '" + + (*I)->getDescription() + "'!"); + + if (I != E || (ArgI != ArgE && !Ty->isVarArg())) + ThrowException("Invalid number of parameters detected!"); + + yyval.TermInstVal = new InvokeInst(V, Normal, Except, *yyvsp[-7].ValueList); + } + cast(yyval.TermInstVal)->setCallingConv(yyvsp[-11].UIntVal); + + delete yyvsp[-10].TypeVal; + delete yyvsp[-7].ValueList; + ; + break;} + case 195: + #line 2064 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.TermInstVal = new UnwindInst(); + ; + break;} + case 196: + #line 2067 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.TermInstVal = new UnreachableInst(); + ; + break;} + case 197: + #line 2073 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.JumpTable = yyvsp[-5].JumpTable; + Constant *V = cast(getValNonImprovising(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal)); + if (V == 0) + ThrowException("May only switch on a constant pool value!"); + + yyval.JumpTable->push_back(std::make_pair(V, getBBVal(yyvsp[0].ValIDVal))); + ; + break;} + case 198: + #line 2081 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.JumpTable = new std::vector >(); + Constant *V = cast(getValNonImprovising(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal)); + + if (V == 0) + ThrowException("May only switch on a constant pool value!"); + + yyval.JumpTable->push_back(std::make_pair(V, getBBVal(yyvsp[0].ValIDVal))); + ; + break;} + case 199: + #line 2091 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + // Is this definition named?? if so, assign the name... + setValueName(yyvsp[0].InstVal, yyvsp[-1].StrVal); + InsertValue(yyvsp[0].InstVal); + yyval.InstVal = yyvsp[0].InstVal; + ; + break;} + case 200: + #line 2098 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { // Used for PHI nodes + yyval.PHIList = new std::list >(); + yyval.PHIList->push_back(std::make_pair(getVal(*yyvsp[-5].TypeVal, yyvsp[-3].ValIDVal), getBBVal(yyvsp[-1].ValIDVal))); + delete yyvsp[-5].TypeVal; + ; + break;} + case 201: + #line 2103 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.PHIList = yyvsp[-6].PHIList; + yyvsp[-6].PHIList->push_back(std::make_pair(getVal(yyvsp[-6].PHIList->front().first->getType(), yyvsp[-3].ValIDVal), + getBBVal(yyvsp[-1].ValIDVal))); + ; + break;} + case 202: + #line 2110 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { // Used for call statements, and memory insts... + yyval.ValueList = new std::vector(); + yyval.ValueList->push_back(yyvsp[0].ValueVal); + ; + break;} + case 203: + #line 2114 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.ValueList = yyvsp[-2].ValueList; + yyvsp[-2].ValueList->push_back(yyvsp[0].ValueVal); + ; + break;} + case 205: + #line 2120 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { yyval.ValueList = 0; ; + break;} + case 206: + #line 2122 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.BoolVal = true; + ; + break;} + case 207: + #line 2125 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.BoolVal = false; + ; + break;} + case 208: + #line 2131 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (!(*yyvsp[-3].TypeVal)->isInteger() && !(*yyvsp[-3].TypeVal)->isFloatingPoint() && + !isa((*yyvsp[-3].TypeVal).get())) + ThrowException( + "Arithmetic operator requires integer, FP, or packed operands!"); + if (isa((*yyvsp[-3].TypeVal).get()) && yyvsp[-4].BinaryOpVal == Instruction::Rem) + ThrowException("Rem not supported on packed types!"); + yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal), getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal)); + if (yyval.InstVal == 0) + ThrowException("binary operator returned null!"); + delete yyvsp[-3].TypeVal; + ; + break;} + case 209: + #line 2143 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (!(*yyvsp[-3].TypeVal)->isIntegral()) { + if (!isa(yyvsp[-3].TypeVal->get()) || + !cast(yyvsp[-3].TypeVal->get())->getElementType()->isIntegral()) + ThrowException("Logical operator requires integral operands!"); + } + yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal), getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal)); + if (yyval.InstVal == 0) + ThrowException("binary operator returned null!"); + delete yyvsp[-3].TypeVal; + ; + break;} + case 210: + #line 2154 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + if(isa((*yyvsp[-3].TypeVal).get())) { + ThrowException( + "PackedTypes currently not supported in setcc instructions!"); + } + yyval.InstVal = new SetCondInst(yyvsp[-4].BinaryOpVal, getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal), getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal)); + if (yyval.InstVal == 0) + ThrowException("binary operator returned null!"); + delete yyvsp[-3].TypeVal; + ; + break;} + case 211: + #line 2164 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + std::cerr << "WARNING: Use of eliminated 'not' instruction:" + << " Replacing with 'xor'.\n"; + + Value *Ones = ConstantIntegral::getAllOnesValue(yyvsp[0].ValueVal->getType()); + if (Ones == 0) + ThrowException("Expected integral type for not instruction!"); + + yyval.InstVal = BinaryOperator::create(Instruction::Xor, yyvsp[0].ValueVal, Ones); + if (yyval.InstVal == 0) + ThrowException("Could not create a xor instruction!"); + ; + break;} + case 212: + #line 2176 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (yyvsp[0].ValueVal->getType() != Type::UByteTy) + ThrowException("Shift amount must be ubyte!"); + if (!yyvsp[-2].ValueVal->getType()->isInteger()) + ThrowException("Shift constant expression requires integer operand!"); + yyval.InstVal = new ShiftInst(yyvsp[-3].OtherOpVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal); + ; + break;} + case 213: + #line 2183 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (!yyvsp[0].TypeVal->get()->isFirstClassType()) + ThrowException("cast instruction to a non-primitive type: '" + + yyvsp[0].TypeVal->get()->getDescription() + "'!"); + yyval.InstVal = new CastInst(yyvsp[-2].ValueVal, *yyvsp[0].TypeVal); + delete yyvsp[0].TypeVal; + ; + break;} + case 214: + #line 2190 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (yyvsp[-4].ValueVal->getType() != Type::BoolTy) + ThrowException("select condition must be boolean!"); + if (yyvsp[-2].ValueVal->getType() != yyvsp[0].ValueVal->getType()) + ThrowException("select value types should match!"); + yyval.InstVal = new SelectInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal); + ; + break;} + case 215: + #line 2197 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + NewVarArgs = true; + yyval.InstVal = new VAArgInst(yyvsp[-2].ValueVal, *yyvsp[0].TypeVal); + delete yyvsp[0].TypeVal; + ; + break;} + case 216: + #line 2202 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + ObsoleteVarArgs = true; + const Type* ArgTy = yyvsp[-2].ValueVal->getType(); + Function* NF = CurModule.CurrentModule-> + getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0); + + //b = vaarg a, t -> + //foo = alloca 1 of t + //bar = vacopy a + //store bar -> foo + //b = vaarg foo, t + AllocaInst* foo = new AllocaInst(ArgTy, 0, "vaarg.fix"); + CurBB->getInstList().push_back(foo); + CallInst* bar = new CallInst(NF, yyvsp[-2].ValueVal); + CurBB->getInstList().push_back(bar); + CurBB->getInstList().push_back(new StoreInst(bar, foo)); + yyval.InstVal = new VAArgInst(foo, *yyvsp[0].TypeVal); + delete yyvsp[0].TypeVal; + ; + break;} + case 217: + #line 2221 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + ObsoleteVarArgs = true; + const Type* ArgTy = yyvsp[-2].ValueVal->getType(); + Function* NF = CurModule.CurrentModule-> + getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0); + + //b = vanext a, t -> + //foo = alloca 1 of t + //bar = vacopy a + //store bar -> foo + //tmp = vaarg foo, t + //b = load foo + AllocaInst* foo = new AllocaInst(ArgTy, 0, "vanext.fix"); + CurBB->getInstList().push_back(foo); + CallInst* bar = new CallInst(NF, yyvsp[-2].ValueVal); + CurBB->getInstList().push_back(bar); + CurBB->getInstList().push_back(new StoreInst(bar, foo)); + Instruction* tmp = new VAArgInst(foo, *yyvsp[0].TypeVal); + CurBB->getInstList().push_back(tmp); + yyval.InstVal = new LoadInst(foo); + delete yyvsp[0].TypeVal; + ; + break;} + case 218: + #line 2243 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (!isa(yyvsp[-2].ValueVal->getType())) + ThrowException("First operand of extractelement must be " + "packed type!"); + if (yyvsp[0].ValueVal->getType() != Type::UIntTy) + ThrowException("Second operand of extractelement must be uint!"); + yyval.InstVal = new ExtractElementInst(yyvsp[-2].ValueVal, yyvsp[0].ValueVal); + ; + break;} + case 219: + #line 2251 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (!isa(yyvsp[-4].ValueVal->getType())) + ThrowException("First operand of insertelement must be " + "packed type!"); + if (yyvsp[-2].ValueVal->getType() != + cast(yyvsp[-4].ValueVal->getType())->getElementType()) + ThrowException("Second operand of insertelement must be " + "packed element type!"); + if (yyvsp[0].ValueVal->getType() != Type::UIntTy) + ThrowException("Third operand of insertelement must be uint!"); + yyval.InstVal = new InsertElementInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal); + ; + break;} + case 220: + #line 2263 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + const Type *Ty = yyvsp[0].PHIList->front().first->getType(); + if (!Ty->isFirstClassType()) + ThrowException("PHI node operands must be of first class type!"); + 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) + ThrowException("All elements of a PHI node must be of the same type!"); + cast(yyval.InstVal)->addIncoming(yyvsp[0].PHIList->front().first, yyvsp[0].PHIList->front().second); + yyvsp[0].PHIList->pop_front(); + } + delete yyvsp[0].PHIList; // Free the list... + ; + break;} + case 221: + #line 2277 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + const PointerType *PFTy; + const FunctionType *Ty; + + if (!(PFTy = dyn_cast(yyvsp[-4].TypeVal->get())) || + !(Ty = dyn_cast(PFTy->getElementType()))) { + // Pull out the types of all of the arguments... + std::vector ParamTypes; + if (yyvsp[-1].ValueList) { + for (std::vector::iterator I = yyvsp[-1].ValueList->begin(), E = yyvsp[-1].ValueList->end(); + I != E; ++I) + ParamTypes.push_back((*I)->getType()); + } + + bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy; + if (isVarArg) ParamTypes.pop_back(); + + if (!(*yyvsp[-4].TypeVal)->isFirstClassType() && *yyvsp[-4].TypeVal != Type::VoidTy) + ThrowException("LLVM functions cannot return aggregate types!"); + + Ty = FunctionType::get(yyvsp[-4].TypeVal->get(), ParamTypes, isVarArg); + PFTy = PointerType::get(Ty); + } + + Value *V = getVal(PFTy, yyvsp[-3].ValIDVal); // Get the function we're calling... + + // Create the call node... + if (!yyvsp[-1].ValueList) { // Has no arguments? + // Make sure no arguments is a good thing! + if (Ty->getNumParams() != 0) + ThrowException("No arguments passed to a function that " + "expects arguments!"); + + yyval.InstVal = new CallInst(V, std::vector()); + } 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[-1].ValueList->begin(), ArgE = yyvsp[-1].ValueList->end(); + + for (; ArgI != ArgE && I != E; ++ArgI, ++I) + if ((*ArgI)->getType() != *I) + ThrowException("Parameter " +(*ArgI)->getName()+ " is not of type '" + + (*I)->getDescription() + "'!"); + + if (I != E || (ArgI != ArgE && !Ty->isVarArg())) + ThrowException("Invalid number of parameters detected!"); + + yyval.InstVal = new CallInst(V, *yyvsp[-1].ValueList); + } + cast(yyval.InstVal)->setTailCall(yyvsp[-6].BoolVal); + cast(yyval.InstVal)->setCallingConv(yyvsp[-5].UIntVal); + delete yyvsp[-4].TypeVal; + delete yyvsp[-1].ValueList; + ; + break;} + case 222: + #line 2334 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.InstVal = yyvsp[0].InstVal; + ; + break;} + case 223: + #line 2340 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.ValueList = yyvsp[0].ValueList; + ; + break;} + case 224: + #line 2342 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.ValueList = new std::vector(); + ; + break;} + case 225: + #line 2346 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.BoolVal = true; + ; + break;} + case 226: + #line 2349 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.BoolVal = false; + ; + break;} + case 227: + #line 2355 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.InstVal = new MallocInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal); + delete yyvsp[-1].TypeVal; + ; + break;} + case 228: + #line 2359 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.InstVal = new MallocInst(*yyvsp[-4].TypeVal, getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal), yyvsp[0].UIntVal); + delete yyvsp[-4].TypeVal; + ; + break;} + case 229: + #line 2363 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.InstVal = new AllocaInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal); + delete yyvsp[-1].TypeVal; + ; + break;} + case 230: + #line 2367 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + yyval.InstVal = new AllocaInst(*yyvsp[-4].TypeVal, getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal), yyvsp[0].UIntVal); + delete yyvsp[-4].TypeVal; + ; + break;} + case 231: + #line 2371 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (!isa(yyvsp[0].ValueVal->getType())) + ThrowException("Trying to free nonpointer type " + + yyvsp[0].ValueVal->getType()->getDescription() + "!"); + yyval.InstVal = new FreeInst(yyvsp[0].ValueVal); + ; + break;} + case 232: + #line 2378 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (!isa(yyvsp[-1].TypeVal->get())) + ThrowException("Can't load from nonpointer type: " + + (*yyvsp[-1].TypeVal)->getDescription()); + if (!cast(yyvsp[-1].TypeVal->get())->getElementType()->isFirstClassType()) + ThrowException("Can't load from pointer of non-first-class type: " + + (*yyvsp[-1].TypeVal)->getDescription()); + yyval.InstVal = new LoadInst(getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal), "", yyvsp[-3].BoolVal); + delete yyvsp[-1].TypeVal; + ; + break;} + case 233: + #line 2388 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + const PointerType *PT = dyn_cast(yyvsp[-1].TypeVal->get()); + if (!PT) + ThrowException("Can't store to a nonpointer type: " + + (*yyvsp[-1].TypeVal)->getDescription()); + const Type *ElTy = PT->getElementType(); + if (ElTy != yyvsp[-3].ValueVal->getType()) + ThrowException("Can't store '" + yyvsp[-3].ValueVal->getType()->getDescription() + + "' into space of type '" + ElTy->getDescription() + "'!"); + + yyval.InstVal = new StoreInst(yyvsp[-3].ValueVal, getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal), yyvsp[-5].BoolVal); + delete yyvsp[-1].TypeVal; + ; + break;} + case 234: + #line 2401 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + { + if (!isa(yyvsp[-2].TypeVal->get())) + ThrowException("getelementptr insn requires pointer operand!"); + + // LLVM 1.2 and earlier used ubyte struct indices. Convert any ubyte struct + // indices to uint struct indices for compatibility. + generic_gep_type_iterator::iterator> + GTI = gep_type_begin(yyvsp[-2].TypeVal->get(), yyvsp[0].ValueList->begin(), yyvsp[0].ValueList->end()), + GTE = gep_type_end(yyvsp[-2].TypeVal->get(), yyvsp[0].ValueList->begin(), yyvsp[0].ValueList->end()); + for (unsigned i = 0, e = yyvsp[0].ValueList->size(); i != e && GTI != GTE; ++i, ++GTI) + if (isa(*GTI)) // Only change struct indices + if (ConstantUInt *CUI = dyn_cast((*yyvsp[0].ValueList)[i])) + if (CUI->getType() == Type::UByteTy) + (*yyvsp[0].ValueList)[i] = ConstantExpr::getCast(CUI, Type::UIntTy); + + if (!GetElementPtrInst::getIndexedType(*yyvsp[-2].TypeVal, *yyvsp[0].ValueList, true)) + ThrowException("Invalid getelementptr indices for type '" + + (*yyvsp[-2].TypeVal)->getDescription()+ "'!"); + yyval.InstVal = new GetElementPtrInst(getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal), *yyvsp[0].ValueList); + 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 + + #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. */ + + yyn = yyr1[yyn]; + + yystate = yypgoto[yyn - YYNTBASE] + *yyssp; + if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTBASE]; + + goto yynewstate; + + yyerrlab: /* here on detecting error */ + + if (! yyerrstatus) + /* If not already recovering from an error, report this error. */ + { + ++yynerrs; + + #ifdef YYERROR_VERBOSE + yyn = yypact[yystate]; + + if (yyn > YYFLAG && yyn < YYLAST) + { + 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 + #endif /* YYERROR_VERBOSE */ + yyerror("parse error"); + } + + 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; + + #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; + + yyerrdefault: /* current state does not do anything special for the error token. */ + + #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) + { + short *ssp1 = yyss - 1; + fprintf (stderr, "Error: state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); + } + #endif + + yyerrhandle: + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yyerrdefault; + + yyn += YYTERROR; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) + goto yyerrdefault; + + 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; + + #if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting error token, "); + #endif + + *++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; + + yyabortlab: + /* YYABORT comes here. */ + if (yyfree_stacks) + { + free (yyss); + free (yyvs); + #ifdef YYLSP_NEEDED + free (yyls); + #endif + } + return 1; + } + #line 2424 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + + int yyerror(const char *ErrorMsg) { + std::string where + = std::string((CurFilename == "-") ? std::string("") : CurFilename) + + ":" + utostr((unsigned) llvmAsmlineno) + ": "; + std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading "; + if (yychar == YYEMPTY || yychar == 0) + errMsg += "end-of-file."; + else + errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'"; + ThrowException(errMsg); + return 0; + } Index: llvm/lib/AsmParser/llvmAsmParser.h.cvs diff -c /dev/null llvm/lib/AsmParser/llvmAsmParser.h.cvs:1.1 *** /dev/null Wed Feb 15 01:23:10 2006 --- llvm/lib/AsmParser/llvmAsmParser.h.cvs Wed Feb 15 01:22:58 2006 *************** *** 0 **** --- 1,140 ---- + typedef union { + llvm::Module *ModuleVal; + llvm::Function *FunctionVal; + std::pair *ArgVal; + llvm::BasicBlock *BasicBlockVal; + llvm::TerminatorInst *TermInstVal; + llvm::Instruction *InstVal; + llvm::Constant *ConstVal; + + const llvm::Type *PrimType; + llvm::PATypeHolder *TypeVal; + llvm::Value *ValueVal; + + std::vector > *ArgList; + std::vector *ValueList; + std::list *TypeList; + // Represent the RHS of PHI node + std::list > *PHIList; + std::vector > *JumpTable; + std::vector *ConstVector; + + llvm::GlobalValue::LinkageTypes Linkage; + int64_t SInt64Val; + uint64_t UInt64Val; + int SIntVal; + unsigned UIntVal; + double FPVal; + bool BoolVal; + + char *StrVal; // This memory is strdup'd! + llvm::ValID ValIDVal; // strdup'd memory maybe! + + llvm::Instruction::BinaryOps BinaryOpVal; + llvm::Instruction::TermOps TermOpVal; + llvm::Instruction::MemoryOps MemOpVal; + llvm::Instruction::OtherOps OtherOpVal; + llvm::Module::Endianness Endianness; + } YYSTYPE; + #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 OPAQUE 299 + #define NOT 300 + #define EXTERNAL 301 + #define TARGET 302 + #define TRIPLE 303 + #define ENDIAN 304 + #define POINTERSIZE 305 + #define LITTLE 306 + #define BIG 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 RET 319 + #define BR 320 + #define SWITCH 321 + #define INVOKE 322 + #define UNWIND 323 + #define UNREACHABLE 324 + #define ADD 325 + #define SUB 326 + #define MUL 327 + #define DIV 328 + #define REM 329 + #define AND 330 + #define OR 331 + #define XOR 332 + #define SETLE 333 + #define SETGE 334 + #define SETLT 335 + #define SETGT 336 + #define SETEQ 337 + #define SETNE 338 + #define MALLOC 339 + #define ALLOCA 340 + #define FREE 341 + #define LOAD 342 + #define STORE 343 + #define GETELEMENTPTR 344 + #define PHI_TOK 345 + #define CAST 346 + #define SELECT 347 + #define SHL 348 + #define SHR 349 + #define VAARG 350 + #define EXTRACTELEMENT 351 + #define INSERTELEMENT 352 + #define VAARG_old 353 + #define VANEXT_old 354 + + + extern YYSTYPE llvmAsmlval; Index: llvm/lib/AsmParser/llvmAsmParser.y.cvs diff -c /dev/null llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.1 *** /dev/null Wed Feb 15 01:23:10 2006 --- llvm/lib/AsmParser/llvmAsmParser.y.cvs Wed Feb 15 01:22:58 2006 *************** *** 0 **** --- 1,2436 ---- + //===-- llvmAsmParser.y - Parser for llvm assembly files --------*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by the LLVM research group and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file implements the bison parser for LLVM assembly languages files. + // + //===----------------------------------------------------------------------===// + + %{ + #include "ParserInternals.h" + #include "llvm/CallingConv.h" + #include "llvm/InlineAsm.h" + #include "llvm/Instructions.h" + #include "llvm/Module.h" + #include "llvm/SymbolTable.h" + #include "llvm/Assembly/AutoUpgrade.h" + #include "llvm/Support/GetElementPtrTypeIterator.h" + #include "llvm/ADT/STLExtras.h" + #include "llvm/Support/MathExtras.h" + #include + #include + #include + #include + + int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit + int yylex(); // declaration" of xxx warnings. + int yyparse(); + + namespace llvm { + std::string CurFilename; + } + using namespace llvm; + + static Module *ParserResult; + + // DEBUG_UPREFS - Define this symbol if you want to enable debugging output + // relating to upreferences in the input stream. + // + //#define DEBUG_UPREFS 1 + #ifdef DEBUG_UPREFS + #define UR_OUT(X) std::cerr << X + #else + #define UR_OUT(X) + #endif + + #define YYERROR_VERBOSE 1 + + static bool ObsoleteVarArgs; + static bool NewVarArgs; + static BasicBlock *CurBB; + static GlobalVariable *CurGV; + + + // This contains info used when building the body of a function. It is + // destroyed when the function is completed. + // + typedef std::vector ValueList; // Numbered defs + static void + ResolveDefinitions(std::map &LateResolvers, + std::map *FutureLateResolvers = 0); + + static struct PerModuleInfo { + Module *CurrentModule; + std::map Values; // Module level numbered definitions + std::map LateResolveValues; + std::vector Types; + std::map LateResolveTypes; + + /// PlaceHolderInfo - When temporary placeholder objects are created, remember + /// how they were referenced and one which line of the input they came from so + /// that we can resolve them later and print error messages as appropriate. + std::map > PlaceHolderInfo; + + // GlobalRefs - This maintains a mapping between 's and forward + // references to global values. Global values may be referenced before they + // are defined, and if so, the temporary object that they represent is held + // here. This is used for forward references of GlobalValues. + // + typedef std::map, GlobalValue*> GlobalRefsType; + GlobalRefsType GlobalRefs; + + void ModuleDone() { + // If we could not resolve some functions at function compilation time + // (calls to functions before they are defined), resolve them now... Types + // are resolved when the constant pool has been completely parsed. + // + ResolveDefinitions(LateResolveValues); + + // Check to make sure that all global value forward references have been + // resolved! + // + if (!GlobalRefs.empty()) { + std::string UndefinedReferences = "Unresolved global references exist:\n"; + + for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end(); + I != E; ++I) { + UndefinedReferences += " " + I->first.first->getDescription() + " " + + I->first.second.getName() + "\n"; + } + ThrowException(UndefinedReferences); + } + + // Look for intrinsic functions and CallInst that need to be upgraded + for (Module::iterator FI = CurrentModule->begin(),FE = CurrentModule->end(); + FI != FE; ++FI) + UpgradeCallsToIntrinsic(FI); + + Values.clear(); // Clear out function local definitions + Types.clear(); + CurrentModule = 0; + } + + // GetForwardRefForGlobal - Check to see if there is a forward reference + // for this global. If so, remove it from the GlobalRefs map and return it. + // If not, just return null. + GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) { + // Check to see if there is a forward reference to this global variable... + // if there is, eliminate it and patch the reference to use the new def'n. + GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID)); + GlobalValue *Ret = 0; + if (I != GlobalRefs.end()) { + Ret = I->second; + GlobalRefs.erase(I); + } + return Ret; + } + } CurModule; + + static struct PerFunctionInfo { + Function *CurrentFunction; // Pointer to current function being created + + std::map Values; // Keep track of #'d definitions + std::map LateResolveValues; + bool isDeclare; // Is this function a forward declararation? + + /// BBForwardRefs - When we see forward references to basic blocks, keep + /// track of them here. + std::map > BBForwardRefs; + std::vector NumberedBlocks; + unsigned NextBBNum; + + inline PerFunctionInfo() { + CurrentFunction = 0; + isDeclare = false; + } + + inline void FunctionStart(Function *M) { + CurrentFunction = M; + NextBBNum = 0; + } + + void FunctionDone() { + NumberedBlocks.clear(); + + // Any forward referenced blocks left? + if (!BBForwardRefs.empty()) + ThrowException("Undefined reference to label " + + BBForwardRefs.begin()->first->getName()); + + // Resolve all forward references now. + ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues); + + Values.clear(); // Clear out function local definitions + CurrentFunction = 0; + isDeclare = false; + } + } CurFun; // Info for the current function... + + static bool inFunctionScope() { return CurFun.CurrentFunction != 0; } + + + //===----------------------------------------------------------------------===// + // Code to handle definitions of all the types + //===----------------------------------------------------------------------===// + + static int InsertValue(Value *V, + std::map &ValueTab = CurFun.Values) { + if (V->hasName()) return -1; // Is this a numbered definition? + + // Yes, insert the value into the value table... + ValueList &List = ValueTab[V->getType()]; + List.push_back(V); + return List.size()-1; + } + + static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) { + switch (D.Type) { + case ValID::NumberVal: // Is it a numbered definition? + // Module constants occupy the lowest numbered slots... + if ((unsigned)D.Num < CurModule.Types.size()) + return CurModule.Types[(unsigned)D.Num]; + break; + case ValID::NameVal: // Is it a named definition? + if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) { + D.destroy(); // Free old strdup'd memory... + return N; + } + break; + default: + ThrowException("Internal parser error: Invalid symbol type reference!"); + } + + // If we reached here, we referenced either a symbol that we don't know about + // or an id number that hasn't been read yet. We may be referencing something + // forward, so just create an entry to be resolved later and get to it... + // + if (DoNotImprovise) return 0; // Do we just want a null to be returned? + + + if (inFunctionScope()) { + if (D.Type == ValID::NameVal) + ThrowException("Reference to an undefined type: '" + D.getName() + "'"); + else + ThrowException("Reference to an undefined type: #" + itostr(D.Num)); + } + + std::map::iterator I =CurModule.LateResolveTypes.find(D); + if (I != CurModule.LateResolveTypes.end()) + return I->second; + + Type *Typ = OpaqueType::get(); + CurModule.LateResolveTypes.insert(std::make_pair(D, Typ)); + return Typ; + } + + static Value *lookupInSymbolTable(const Type *Ty, const std::string &Name) { + SymbolTable &SymTab = + inFunctionScope() ? CurFun.CurrentFunction->getSymbolTable() : + CurModule.CurrentModule->getSymbolTable(); + return SymTab.lookup(Ty, Name); + } + + // getValNonImprovising - Look up the value specified by the provided type and + // the provided ValID. If the value exists and has already been defined, return + // it. Otherwise return null. + // + static Value *getValNonImprovising(const Type *Ty, const ValID &D) { + if (isa(Ty)) + ThrowException("Functions are not values and " + "must be referenced as pointers"); + + switch (D.Type) { + case ValID::NumberVal: { // Is it a numbered definition? + unsigned Num = (unsigned)D.Num; + + // Module constants occupy the lowest numbered slots... + std::map::iterator VI = CurModule.Values.find(Ty); + if (VI != CurModule.Values.end()) { + if (Num < VI->second.size()) + return VI->second[Num]; + Num -= VI->second.size(); + } + + // Make sure that our type is within bounds + VI = CurFun.Values.find(Ty); + if (VI == CurFun.Values.end()) return 0; + + // Check that the number is within bounds... + if (VI->second.size() <= Num) return 0; + + return VI->second[Num]; + } + + case ValID::NameVal: { // Is it a named definition? + Value *N = lookupInSymbolTable(Ty, std::string(D.Name)); + if (N == 0) return 0; + + D.destroy(); // Free old strdup'd memory... + return N; + } + + // Check to make sure that "Ty" is an integral type, and that our + // value will fit into the specified type... + case ValID::ConstSIntVal: // Is it a constant pool reference?? + if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64)) + ThrowException("Signed integral constant '" + + itostr(D.ConstPool64) + "' is invalid for type '" + + Ty->getDescription() + "'!"); + return ConstantSInt::get(Ty, D.ConstPool64); + + case ValID::ConstUIntVal: // Is it an unsigned const pool reference? + if (!ConstantUInt::isValueValidForType(Ty, D.UConstPool64)) { + if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64)) { + ThrowException("Integral constant '" + utostr(D.UConstPool64) + + "' is invalid or out of range!"); + } else { // This is really a signed reference. Transmogrify. + return ConstantSInt::get(Ty, D.ConstPool64); + } + } else { + return ConstantUInt::get(Ty, D.UConstPool64); + } + + case ValID::ConstFPVal: // Is it a floating point const pool reference? + if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) + ThrowException("FP constant invalid for type!!"); + return ConstantFP::get(Ty, D.ConstPoolFP); + + case ValID::ConstNullVal: // Is it a null value? + if (!isa(Ty)) + ThrowException("Cannot create a a non pointer null!"); + return ConstantPointerNull::get(cast(Ty)); + + case ValID::ConstUndefVal: // Is it an undef value? + return UndefValue::get(Ty); + + case ValID::ConstZeroVal: // Is it a zero value? + return Constant::getNullValue(Ty); + + case ValID::ConstantVal: // Fully resolved constant? + if (D.ConstantValue->getType() != Ty) + ThrowException("Constant expression type different from required type!"); + return D.ConstantValue; + + case ValID::InlineAsmVal: { // Inline asm expression + const PointerType *PTy = dyn_cast(Ty); + const FunctionType *FTy = + PTy ? dyn_cast(PTy->getElementType()) : 0; + if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) + ThrowException("Invalid type for asm constraint string!"); + InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints, + D.IAD->HasSideEffects); + D.destroy(); // Free InlineAsmDescriptor. + return IA; + } + default: + assert(0 && "Unhandled case!"); + return 0; + } // End of switch + + assert(0 && "Unhandled case!"); + return 0; + } + + // getVal - This function is identical to getValNonImprovising, except that if a + // value is not already defined, it "improvises" by creating a placeholder var + // that looks and acts just like the requested variable. When the value is + // defined later, all uses of the placeholder variable are replaced with the + // real thing. + // + static Value *getVal(const Type *Ty, const ValID &ID) { + if (Ty == Type::LabelTy) + ThrowException("Cannot use a basic block here"); + + // See if the value has already been defined. + Value *V = getValNonImprovising(Ty, ID); + if (V) return V; + + if (!Ty->isFirstClassType() && !isa(Ty)) + ThrowException("Invalid use of a composite type!"); + + // If we reached here, we referenced either a symbol that we don't know about + // or an id number that hasn't been read yet. We may be referencing something + // forward, so just create an entry to be resolved later and get to it... + // + V = new Argument(Ty); + + // Remember where this forward reference came from. FIXME, shouldn't we try + // to recycle these things?? + CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID, + llvmAsmlineno))); + + if (inFunctionScope()) + InsertValue(V, CurFun.LateResolveValues); + else + InsertValue(V, CurModule.LateResolveValues); + return V; + } + + /// getBBVal - This is used for two purposes: + /// * If isDefinition is true, a new basic block with the specified ID is being + /// defined. + /// * If isDefinition is true, this is a reference to a basic block, which may + /// or may not be a forward reference. + /// + static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) { + assert(inFunctionScope() && "Can't get basic block at global scope!"); + + std::string Name; + BasicBlock *BB = 0; + switch (ID.Type) { + default: ThrowException("Illegal label reference " + ID.getName()); + case ValID::NumberVal: // Is it a numbered definition? + if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size()) + CurFun.NumberedBlocks.resize(ID.Num+1); + BB = CurFun.NumberedBlocks[ID.Num]; + break; + case ValID::NameVal: // Is it a named definition? + Name = ID.Name; + if (Value *N = CurFun.CurrentFunction-> + getSymbolTable().lookup(Type::LabelTy, Name)) + BB = cast(N); + break; + } + + // See if the block has already been defined. + if (BB) { + // If this is the definition of the block, make sure the existing value was + // just a forward reference. If it was a forward reference, there will be + // an entry for it in the PlaceHolderInfo map. + if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) + // The existing value was a definition, not a forward reference. + ThrowException("Redefinition of label " + ID.getName()); + + ID.destroy(); // Free strdup'd memory. + return BB; + } + + // Otherwise this block has not been seen before. + BB = new BasicBlock("", CurFun.CurrentFunction); + if (ID.Type == ValID::NameVal) { + BB->setName(ID.Name); + } else { + CurFun.NumberedBlocks[ID.Num] = BB; + } + + // If this is not a definition, keep track of it so we can use it as a forward + // reference. + if (!isDefinition) { + // Remember where this forward reference came from. + CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno); + } else { + // The forward declaration could have been inserted anywhere in the + // function: insert it into the correct place now. + CurFun.CurrentFunction->getBasicBlockList().remove(BB); + CurFun.CurrentFunction->getBasicBlockList().push_back(BB); + } + ID.destroy(); + return BB; + } + + + //===----------------------------------------------------------------------===// + // Code to handle forward references in instructions + //===----------------------------------------------------------------------===// + // + // This code handles the late binding needed with statements that reference + // values not defined yet... for example, a forward branch, or the PHI node for + // a loop body. + // + // This keeps a table (CurFun.LateResolveValues) of all such forward references + // and back patchs after we are done. + // + + // ResolveDefinitions - If we could not resolve some defs at parsing + // time (forward branches, phi functions for loops, etc...) resolve the + // defs now... + // + static void + ResolveDefinitions(std::map &LateResolvers, + std::map *FutureLateResolvers) { + // Loop over LateResolveDefs fixing up stuff that couldn't be resolved + for (std::map::iterator LRI = LateResolvers.begin(), + E = LateResolvers.end(); LRI != E; ++LRI) { + ValueList &List = LRI->second; + while (!List.empty()) { + Value *V = List.back(); + List.pop_back(); + + std::map >::iterator PHI = + CurModule.PlaceHolderInfo.find(V); + assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!"); + + ValID &DID = PHI->second.first; + + Value *TheRealValue = getValNonImprovising(LRI->first, DID); + if (TheRealValue) { + V->replaceAllUsesWith(TheRealValue); + delete V; + CurModule.PlaceHolderInfo.erase(PHI); + } else if (FutureLateResolvers) { + // Functions have their unresolved items forwarded to the module late + // resolver table + InsertValue(V, *FutureLateResolvers); + } else { + if (DID.Type == ValID::NameVal) + ThrowException("Reference to an invalid definition: '" +DID.getName()+ + "' of type '" + V->getType()->getDescription() + "'", + PHI->second.second); + else + ThrowException("Reference to an invalid definition: #" + + itostr(DID.Num) + " of type '" + + V->getType()->getDescription() + "'", + PHI->second.second); + } + } + } + + LateResolvers.clear(); + } + + // ResolveTypeTo - A brand new type was just declared. This means that (if + // name is not null) things referencing Name can be resolved. Otherwise, things + // refering to the number can be resolved. Do this now. + // + static void ResolveTypeTo(char *Name, const Type *ToTy) { + ValID D; + if (Name) D = ValID::create(Name); + else D = ValID::create((int)CurModule.Types.size()); + + std::map::iterator I = + CurModule.LateResolveTypes.find(D); + if (I != CurModule.LateResolveTypes.end()) { + ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy); + CurModule.LateResolveTypes.erase(I); + } + } + + // setValueName - Set the specified value to the name given. The name may be + // null potentially, in which case this is a noop. The string passed in is + // assumed to be a malloc'd string buffer, and is free'd by this function. + // + static void setValueName(Value *V, char *NameStr) { + if (NameStr) { + std::string Name(NameStr); // Copy string + free(NameStr); // Free old string + + if (V->getType() == Type::VoidTy) + ThrowException("Can't assign name '" + Name+"' to value with void type!"); + + assert(inFunctionScope() && "Must be in function scope!"); + SymbolTable &ST = CurFun.CurrentFunction->getSymbolTable(); + if (ST.lookup(V->getType(), Name)) + ThrowException("Redefinition of value named '" + Name + "' in the '" + + V->getType()->getDescription() + "' type plane!"); + + // Set the name. + V->setName(Name); + } + } + + /// ParseGlobalVariable - Handle parsing of a global. If Initializer is null, + /// this is a declaration, otherwise it is a definition. + static GlobalVariable * + ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage, + bool isConstantGlobal, const Type *Ty, + Constant *Initializer) { + if (isa(Ty)) + ThrowException("Cannot declare global vars of function type!"); + + const PointerType *PTy = PointerType::get(Ty); + + std::string Name; + if (NameStr) { + Name = NameStr; // Copy string + free(NameStr); // Free old string + } + + // See if this global value was forward referenced. If so, recycle the + // object. + ValID ID; + if (!Name.empty()) { + ID = ValID::create((char*)Name.c_str()); + } else { + ID = ValID::create((int)CurModule.Values[PTy].size()); + } + + if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) { + // Move the global to the end of the list, from whereever it was + // previously inserted. + GlobalVariable *GV = cast(FWGV); + CurModule.CurrentModule->getGlobalList().remove(GV); + CurModule.CurrentModule->getGlobalList().push_back(GV); + GV->setInitializer(Initializer); + GV->setLinkage(Linkage); + GV->setConstant(isConstantGlobal); + InsertValue(GV, CurModule.Values); + return GV; + } + + // If this global has a name, check to see if there is already a definition + // of this global in the module. If so, merge as appropriate. Note that + // this is really just a hack around problems in the CFE. :( + if (!Name.empty()) { + // We are a simple redefinition of a value, check to see if it is defined + // the same as the old one. + if (GlobalVariable *EGV = + CurModule.CurrentModule->getGlobalVariable(Name, Ty)) { + // We are allowed to redefine a global variable in two circumstances: + // 1. If at least one of the globals is uninitialized or + // 2. If both initializers have the same value. + // + if (!EGV->hasInitializer() || !Initializer || + EGV->getInitializer() == Initializer) { + + // Make sure the existing global version gets the initializer! Make + // sure that it also gets marked const if the new version is. + if (Initializer && !EGV->hasInitializer()) + EGV->setInitializer(Initializer); + if (isConstantGlobal) + EGV->setConstant(true); + EGV->setLinkage(Linkage); + return EGV; + } + + ThrowException("Redefinition of global variable named '" + Name + + "' in the '" + Ty->getDescription() + "' type plane!"); + } + } + + // Otherwise there is no existing GV to use, create one now. + GlobalVariable *GV = + new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name, + CurModule.CurrentModule); + InsertValue(GV, CurModule.Values); + return GV; + } + + // setTypeName - Set the specified type to the name given. The name may be + // null potentially, in which case this is a noop. The string passed in is + // assumed to be a malloc'd string buffer, and is freed by this function. + // + // This function returns true if the type has already been defined, but is + // allowed to be redefined in the specified context. If the name is a new name + // for the type plane, it is inserted and false is returned. + static bool setTypeName(const Type *T, char *NameStr) { + assert(!inFunctionScope() && "Can't give types function-local names!"); + if (NameStr == 0) return false; + + std::string Name(NameStr); // Copy string + free(NameStr); // Free old string + + // We don't allow assigning names to void type + if (T == Type::VoidTy) + ThrowException("Can't assign name '" + Name + "' to the void type!"); + + // Set the type name, checking for conflicts as we do so. + bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T); + + if (AlreadyExists) { // Inserting a name that is already defined??? + const Type *Existing = CurModule.CurrentModule->getTypeByName(Name); + assert(Existing && "Conflict but no matching type?"); + + // There is only one case where this is allowed: when we are refining an + // opaque type. In this case, Existing will be an opaque type. + if (const OpaqueType *OpTy = dyn_cast(Existing)) { + // We ARE replacing an opaque type! + const_cast(OpTy)->refineAbstractTypeTo(T); + return true; + } + + // Otherwise, this is an attempt to redefine a type. That's okay if + // the redefinition is identical to the original. This will be so if + // Existing and T point to the same Type object. In this one case we + // allow the equivalent redefinition. + if (Existing == T) return true; // Yes, it's equal. + + // Any other kind of (non-equivalent) redefinition is an error. + ThrowException("Redefinition of type named '" + Name + "' in the '" + + T->getDescription() + "' type plane!"); + } + + return false; + } + + //===----------------------------------------------------------------------===// + // Code for handling upreferences in type names... + // + + // TypeContains - Returns true if Ty directly contains E in it. + // + static bool TypeContains(const Type *Ty, const Type *E) { + return std::find(Ty->subtype_begin(), Ty->subtype_end(), + E) != Ty->subtype_end(); + } + + namespace { + struct UpRefRecord { + // NestingLevel - The number of nesting levels that need to be popped before + // this type is resolved. + unsigned NestingLevel; + + // LastContainedTy - This is the type at the current binding level for the + // type. Every time we reduce the nesting level, this gets updated. + const Type *LastContainedTy; + + // UpRefTy - This is the actual opaque type that the upreference is + // represented with. + OpaqueType *UpRefTy; + + UpRefRecord(unsigned NL, OpaqueType *URTy) + : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {} + }; + } + + // UpRefs - A list of the outstanding upreferences that need to be resolved. + static std::vector UpRefs; + + /// HandleUpRefs - Every time we finish a new layer of types, this function is + /// called. It loops through the UpRefs vector, which is a list of the + /// currently active types. For each type, if the up reference is contained in + /// the newly completed type, we decrement the level count. When the level + /// count reaches zero, the upreferenced type is the type that is passed in: + /// thus we can complete the cycle. + /// + static PATypeHolder HandleUpRefs(const Type *ty) { + if (!ty->isAbstract()) return ty; + PATypeHolder Ty(ty); + UR_OUT("Type '" << Ty->getDescription() << + "' newly formed. Resolving upreferences.\n" << + UpRefs.size() << " upreferences active!\n"); + + // If we find any resolvable upreferences (i.e., those whose NestingLevel goes + // to zero), we resolve them all together before we resolve them to Ty. At + // the end of the loop, if there is anything to resolve to Ty, it will be in + // this variable. + OpaqueType *TypeToResolve = 0; + + for (unsigned i = 0; i != UpRefs.size(); ++i) { + UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", " + << UpRefs[i].second->getDescription() << ") = " + << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n"); + if (TypeContains(Ty, UpRefs[i].LastContainedTy)) { + // Decrement level of upreference + unsigned Level = --UpRefs[i].NestingLevel; + UpRefs[i].LastContainedTy = Ty; + UR_OUT(" Uplevel Ref Level = " << Level << "\n"); + if (Level == 0) { // Upreference should be resolved! + if (!TypeToResolve) { + TypeToResolve = UpRefs[i].UpRefTy; + } else { + UR_OUT(" * Resolving upreference for " + << UpRefs[i].second->getDescription() << "\n"; + std::string OldName = UpRefs[i].UpRefTy->getDescription()); + UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve); + UR_OUT(" * Type '" << OldName << "' refined upreference to: " + << (const void*)Ty << ", " << Ty->getDescription() << "\n"); + } + UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list... + --i; // Do not skip the next element... + } + } + } + + if (TypeToResolve) { + UR_OUT(" * Resolving upreference for " + << UpRefs[i].second->getDescription() << "\n"; + std::string OldName = TypeToResolve->getDescription()); + TypeToResolve->refineAbstractTypeTo(Ty); + } + + return Ty; + } + + + // common code from the two 'RunVMAsmParser' functions + static Module * RunParser(Module * M) { + + llvmAsmlineno = 1; // Reset the current line number... + ObsoleteVarArgs = false; + NewVarArgs = false; + + CurModule.CurrentModule = M; + yyparse(); // Parse the file, potentially throwing exception + + Module *Result = ParserResult; + ParserResult = 0; + + //Not all functions use vaarg, so make a second check for ObsoleteVarArgs + { + Function* F; + if ((F = Result->getNamedFunction("llvm.va_start")) + && F->getFunctionType()->getNumParams() == 0) + ObsoleteVarArgs = true; + if((F = Result->getNamedFunction("llvm.va_copy")) + && F->getFunctionType()->getNumParams() == 1) + ObsoleteVarArgs = true; + } + + if (ObsoleteVarArgs && NewVarArgs) + ThrowException("This file is corrupt: it uses both new and old style varargs"); + + if(ObsoleteVarArgs) { + if(Function* F = Result->getNamedFunction("llvm.va_start")) { + if (F->arg_size() != 0) + ThrowException("Obsolete va_start takes 0 argument!"); + + //foo = va_start() + // -> + //bar = alloca typeof(foo) + //va_start(bar) + //foo = load bar + + const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID); + const Type* ArgTy = F->getFunctionType()->getReturnType(); + const Type* ArgTyPtr = PointerType::get(ArgTy); + Function* NF = Result->getOrInsertFunction("llvm.va_start", + RetTy, ArgTyPtr, (Type *)0); + + while (!F->use_empty()) { + CallInst* CI = cast(F->use_back()); + AllocaInst* bar = new AllocaInst(ArgTy, 0, "vastart.fix.1", CI); + new CallInst(NF, bar, "", CI); + Value* foo = new LoadInst(bar, "vastart.fix.2", CI); + CI->replaceAllUsesWith(foo); + CI->getParent()->getInstList().erase(CI); + } + Result->getFunctionList().erase(F); + } + + if(Function* F = Result->getNamedFunction("llvm.va_end")) { + if(F->arg_size() != 1) + ThrowException("Obsolete va_end takes 1 argument!"); + + //vaend foo + // -> + //bar = alloca 1 of typeof(foo) + //vaend bar + const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID); + const Type* ArgTy = F->getFunctionType()->getParamType(0); + const Type* ArgTyPtr = PointerType::get(ArgTy); + Function* NF = Result->getOrInsertFunction("llvm.va_end", + RetTy, ArgTyPtr, (Type *)0); + + while (!F->use_empty()) { + CallInst* CI = cast(F->use_back()); + AllocaInst* bar = new AllocaInst(ArgTy, 0, "vaend.fix.1", CI); + new StoreInst(CI->getOperand(1), bar, CI); + new CallInst(NF, bar, "", CI); + CI->getParent()->getInstList().erase(CI); + } + Result->getFunctionList().erase(F); + } + + if(Function* F = Result->getNamedFunction("llvm.va_copy")) { + if(F->arg_size() != 1) + ThrowException("Obsolete va_copy takes 1 argument!"); + //foo = vacopy(bar) + // -> + //a = alloca 1 of typeof(foo) + //b = alloca 1 of typeof(foo) + //store bar -> b + //vacopy(a, b) + //foo = load a + + const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID); + const Type* ArgTy = F->getFunctionType()->getReturnType(); + const Type* ArgTyPtr = PointerType::get(ArgTy); + Function* NF = Result->getOrInsertFunction("llvm.va_copy", + RetTy, ArgTyPtr, ArgTyPtr, + (Type *)0); + + while (!F->use_empty()) { + CallInst* CI = cast(F->use_back()); + AllocaInst* a = new AllocaInst(ArgTy, 0, "vacopy.fix.1", CI); + AllocaInst* b = new AllocaInst(ArgTy, 0, "vacopy.fix.2", CI); + new StoreInst(CI->getOperand(1), b, CI); + new CallInst(NF, a, b, "", CI); + Value* foo = new LoadInst(a, "vacopy.fix.3", CI); + CI->replaceAllUsesWith(foo); + CI->getParent()->getInstList().erase(CI); + } + Result->getFunctionList().erase(F); + } + } + + return Result; + + } + + //===----------------------------------------------------------------------===// + // RunVMAsmParser - Define an interface to this parser + //===----------------------------------------------------------------------===// + // + Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) { + set_scan_file(F); + + CurFilename = Filename; + return RunParser(new Module(CurFilename)); + } + + Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) { + set_scan_string(AsmString); + + CurFilename = "from_memory"; + if (M == NULL) { + return RunParser(new Module (CurFilename)); + } else { + return RunParser(M); + } + } + + %} + + %union { + llvm::Module *ModuleVal; + llvm::Function *FunctionVal; + std::pair *ArgVal; + llvm::BasicBlock *BasicBlockVal; + llvm::TerminatorInst *TermInstVal; + llvm::Instruction *InstVal; + llvm::Constant *ConstVal; + + const llvm::Type *PrimType; + llvm::PATypeHolder *TypeVal; + llvm::Value *ValueVal; + + std::vector > *ArgList; + std::vector *ValueList; + std::list *TypeList; + // Represent the RHS of PHI node + std::list > *PHIList; + std::vector > *JumpTable; + std::vector *ConstVector; + + llvm::GlobalValue::LinkageTypes Linkage; + int64_t SInt64Val; + uint64_t UInt64Val; + int SIntVal; + unsigned UIntVal; + double FPVal; + bool BoolVal; + + char *StrVal; // This memory is strdup'd! + llvm::ValID ValIDVal; // strdup'd memory maybe! + + llvm::Instruction::BinaryOps BinaryOpVal; + llvm::Instruction::TermOps TermOpVal; + llvm::Instruction::MemoryOps MemOpVal; + llvm::Instruction::OtherOps OtherOpVal; + llvm::Module::Endianness Endianness; + } + + %type Module FunctionList + %type Function FunctionProto FunctionHeader BasicBlockList + %type BasicBlock InstructionList + %type BBTerminatorInst + %type Inst InstVal MemoryInst + %type ConstVal ConstExpr + %type ConstVector + %type ArgList ArgListH + %type ArgVal + %type PHIList + %type ValueRefList ValueRefListE // For call param lists + %type IndexList // For GEP derived indices + %type TypeListI ArgTypeListI + %type JumpTable + %type GlobalType // GLOBAL or CONSTANT? + %type OptVolatile // 'volatile' or not + %type OptTailCall // TAIL CALL or plain CALL. + %type OptSideEffect // 'sideeffect' or not. + %type OptLinkage + %type BigOrLittle + + // ValueRef - Unresolved reference to a definition or BB + %type ValueRef ConstValueRef SymbolicValueRef + %type ResolvedVal // pair + // Tokens and types for handling constant integer values + // + // ESINT64VAL - A negative number within long long range + %token ESINT64VAL + + // EUINT64VAL - A positive number within uns. long long range + %token EUINT64VAL + %type EINT64VAL + + %token SINTVAL // Signed 32 bit ints... + %token UINTVAL // Unsigned 32 bit ints... + %type INTVAL + %token FPVAL // Float or Double constant + + // Built in types... + %type Types TypesV UpRTypes UpRTypesV + %type SIntType UIntType IntType FPType PrimType // Classifications + %token VOID BOOL SBYTE UBYTE SHORT USHORT INT UINT LONG ULONG + %token FLOAT DOUBLE TYPE LABEL + + %token VAR_ID LABELSTR STRINGCONSTANT + %type Name OptName OptAssign + %type OptAlign OptCAlign + %type OptSection SectionString + + %token IMPLEMENTATION ZEROINITIALIZER TRUETOK FALSETOK BEGINTOK ENDTOK + %token DECLARE GLOBAL CONSTANT SECTION VOLATILE + %token TO DOTDOTDOT NULL_TOK UNDEF CONST INTERNAL LINKONCE WEAK APPENDING + %token OPAQUE NOT EXTERNAL TARGET TRIPLE ENDIAN POINTERSIZE LITTLE BIG ALIGN + %token DEPLIBS CALL TAIL ASM_TOK MODULE SIDEEFFECT + %token CC_TOK CCC_TOK FASTCC_TOK COLDCC_TOK + %type OptCallingConv + + // Basic Block Terminating Operators + %token RET BR SWITCH INVOKE UNWIND UNREACHABLE + + // Binary Operators + %type ArithmeticOps LogicalOps SetCondOps // Binops Subcatagories + %token ADD SUB MUL DIV REM AND OR XOR + %token SETLE SETGE SETLT SETGT SETEQ SETNE // Binary Comarators + + // Memory Instructions + %token MALLOC ALLOCA FREE LOAD STORE GETELEMENTPTR + + // Other Operators + %type ShiftOps + %token PHI_TOK CAST SELECT SHL SHR VAARG + %token EXTRACTELEMENT INSERTELEMENT + %token VAARG_old VANEXT_old //OBSOLETE + + + %start Module + %% + + // Handle constant integer size restriction and conversion... + // + INTVAL : SINTVAL; + INTVAL : UINTVAL { + if ($1 > (uint32_t)INT32_MAX) // Outside of my range! + ThrowException("Value too large for type!"); + $$ = (int32_t)$1; + }; + + + EINT64VAL : ESINT64VAL; // These have same type and can't cause problems... + EINT64VAL : EUINT64VAL { + if ($1 > (uint64_t)INT64_MAX) // Outside of my range! + ThrowException("Value too large for type!"); + $$ = (int64_t)$1; + }; + + // Operations that are notably excluded from this list include: + // RET, BR, & SWITCH because they end basic blocks and are treated specially. + // + ArithmeticOps: ADD | SUB | MUL | DIV | REM; + LogicalOps : AND | OR | XOR; + SetCondOps : SETLE | SETGE | SETLT | SETGT | SETEQ | SETNE; + + ShiftOps : SHL | SHR; + + // These are some types that allow classification if we only want a particular + // thing... for example, only a signed, unsigned, or integral type. + SIntType : LONG | INT | SHORT | SBYTE; + UIntType : ULONG | UINT | USHORT | UBYTE; + IntType : SIntType | UIntType; + FPType : FLOAT | DOUBLE; + + // OptAssign - Value producing statements have an optional assignment component + OptAssign : Name '=' { + $$ = $1; + } + | /*empty*/ { + $$ = 0; + }; + + OptLinkage : INTERNAL { $$ = GlobalValue::InternalLinkage; } | + LINKONCE { $$ = GlobalValue::LinkOnceLinkage; } | + WEAK { $$ = GlobalValue::WeakLinkage; } | + APPENDING { $$ = GlobalValue::AppendingLinkage; } | + /*empty*/ { $$ = GlobalValue::ExternalLinkage; }; + + OptCallingConv : /*empty*/ { $$ = CallingConv::C; } | + CCC_TOK { $$ = CallingConv::C; } | + FASTCC_TOK { $$ = CallingConv::Fast; } | + COLDCC_TOK { $$ = CallingConv::Cold; } | + CC_TOK EUINT64VAL { + if ((unsigned)$2 != $2) + ThrowException("Calling conv too large!"); + $$ = $2; + }; + + // OptAlign/OptCAlign - An optional alignment, and an optional alignment with + // a comma before it. + OptAlign : /*empty*/ { $$ = 0; } | + ALIGN EUINT64VAL { + $$ = $2; + if ($$ != 0 && !isPowerOf2_32($$)) + ThrowException("Alignment must be a power of two!"); + }; + OptCAlign : /*empty*/ { $$ = 0; } | + ',' ALIGN EUINT64VAL { + $$ = $3; + if ($$ != 0 && !isPowerOf2_32($$)) + ThrowException("Alignment must be a power of two!"); + }; + + + SectionString : SECTION STRINGCONSTANT { + for (unsigned i = 0, e = strlen($2); i != e; ++i) + if ($2[i] == '"' || $2[i] == '\\') + ThrowException("Invalid character in section name!"); + $$ = $2; + }; + + OptSection : /*empty*/ { $$ = 0; } | + SectionString { $$ = $1; }; + + // GlobalVarAttributes - Used to pass the attributes string on a global. CurGV + // is set to be the global we are processing. + // + GlobalVarAttributes : /* empty */ {} | + ',' GlobalVarAttribute GlobalVarAttributes {}; + GlobalVarAttribute : SectionString { + CurGV->setSection($1); + free($1); + } + | ALIGN EUINT64VAL { + if ($2 != 0 && !isPowerOf2_32($2)) + ThrowException("Alignment must be a power of two!"); + CurGV->setAlignment($2); + }; + + //===----------------------------------------------------------------------===// + // Types includes all predefined types... except void, because it can only be + // used in specific contexts (function returning void for example). To have + // access to it, a user must explicitly use TypesV. + // + + // TypesV includes all of 'Types', but it also includes the void type. + TypesV : Types | VOID { $$ = new PATypeHolder($1); }; + UpRTypesV : UpRTypes | VOID { $$ = new PATypeHolder($1); }; + + Types : UpRTypes { + if (!UpRefs.empty()) + ThrowException("Invalid upreference in type: " + (*$1)->getDescription()); + $$ = $1; + }; + + + // Derived types are added later... + // + PrimType : BOOL | SBYTE | UBYTE | SHORT | USHORT | INT | UINT ; + PrimType : LONG | ULONG | FLOAT | DOUBLE | TYPE | LABEL; + UpRTypes : OPAQUE { + $$ = new PATypeHolder(OpaqueType::get()); + } + | PrimType { + $$ = new PATypeHolder($1); + }; + UpRTypes : SymbolicValueRef { // Named types are also simple types... + $$ = new PATypeHolder(getTypeVal($1)); + }; + + // Include derived types in the Types production. + // + UpRTypes : '\\' EUINT64VAL { // Type UpReference + if ($2 > (uint64_t)~0U) ThrowException("Value out of range!"); + OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder + UpRefs.push_back(UpRefRecord((unsigned)$2, OT)); // Add to vector... + $$ = new PATypeHolder(OT); + UR_OUT("New Upreference!\n"); + } + | UpRTypesV '(' ArgTypeListI ')' { // Function derived type? + std::vector Params; + for (std::list::iterator I = $3->begin(), + E = $3->end(); I != E; ++I) + Params.push_back(*I); + bool isVarArg = Params.size() && Params.back() == Type::VoidTy; + if (isVarArg) Params.pop_back(); + + $$ = new PATypeHolder(HandleUpRefs(FunctionType::get(*$1,Params,isVarArg))); + delete $3; // Delete the argument list + delete $1; // Delete the return type handle + } + | '[' EUINT64VAL 'x' UpRTypes ']' { // Sized array type? + $$ = new PATypeHolder(HandleUpRefs(ArrayType::get(*$4, (unsigned)$2))); + delete $4; + } + | '<' EUINT64VAL 'x' UpRTypes '>' { // Packed array type? + const llvm::Type* ElemTy = $4->get(); + if ((unsigned)$2 != $2) + ThrowException("Unsigned result not equal to signed result"); + if (!ElemTy->isPrimitiveType()) + ThrowException("Elemental type of a PackedType must be primitive"); + if (!isPowerOf2_32($2)) + ThrowException("Vector length should be a power of 2!"); + $$ = new PATypeHolder(HandleUpRefs(PackedType::get(*$4, (unsigned)$2))); + delete $4; + } + | '{' TypeListI '}' { // Structure type? + std::vector Elements; + for (std::list::iterator I = $2->begin(), + E = $2->end(); I != E; ++I) + Elements.push_back(*I); + + $$ = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); + delete $2; + } + | '{' '}' { // Empty structure type? + $$ = new PATypeHolder(StructType::get(std::vector())); + } + | UpRTypes '*' { // Pointer type? + $$ = new PATypeHolder(HandleUpRefs(PointerType::get(*$1))); + delete $1; + }; + + // TypeList - Used for struct declarations and as a basis for function type + // declaration type lists + // + TypeListI : UpRTypes { + $$ = new std::list(); + $$->push_back(*$1); delete $1; + } + | TypeListI ',' UpRTypes { + ($$=$1)->push_back(*$3); delete $3; + }; + + // ArgTypeList - List of types for a function type declaration... + ArgTypeListI : TypeListI + | TypeListI ',' DOTDOTDOT { + ($$=$1)->push_back(Type::VoidTy); + } + | DOTDOTDOT { + ($$ = new std::list())->push_back(Type::VoidTy); + } + | /*empty*/ { + $$ = new std::list(); + }; + + // ConstVal - The various declarations that go into the constant pool. This + // production is used ONLY to represent constants that show up AFTER a 'const', + // 'constant' or 'global' token at global scope. Constants that can be inlined + // into other expressions (such as integers and constexprs) are handled by the + // ResolvedVal, ValueRef and ConstValueRef productions. + // + ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr + const ArrayType *ATy = dyn_cast($1->get()); + if (ATy == 0) + ThrowException("Cannot make array constant with type: '" + + (*$1)->getDescription() + "'!"); + const Type *ETy = ATy->getElementType(); + int NumElements = ATy->getNumElements(); + + // Verify that we have the correct size... + if (NumElements != -1 && NumElements != (int)$3->size()) + ThrowException("Type mismatch: constant sized array initialized with " + + utostr($3->size()) + " arguments, but has size of " + + itostr(NumElements) + "!"); + + // Verify all elements are correct type! + for (unsigned i = 0; i < $3->size(); i++) { + if (ETy != (*$3)[i]->getType()) + ThrowException("Element #" + utostr(i) + " is not of type '" + + ETy->getDescription() +"' as required!\nIt is of type '"+ + (*$3)[i]->getType()->getDescription() + "'."); + } + + $$ = ConstantArray::get(ATy, *$3); + delete $1; delete $3; + } + | Types '[' ']' { + const ArrayType *ATy = dyn_cast($1->get()); + if (ATy == 0) + ThrowException("Cannot make array constant with type: '" + + (*$1)->getDescription() + "'!"); + + int NumElements = ATy->getNumElements(); + if (NumElements != -1 && NumElements != 0) + ThrowException("Type mismatch: constant sized array initialized with 0" + " arguments, but has size of " + itostr(NumElements) +"!"); + $$ = ConstantArray::get(ATy, std::vector()); + delete $1; + } + | Types 'c' STRINGCONSTANT { + const ArrayType *ATy = dyn_cast($1->get()); + if (ATy == 0) + ThrowException("Cannot make array constant with type: '" + + (*$1)->getDescription() + "'!"); + + int NumElements = ATy->getNumElements(); + const Type *ETy = ATy->getElementType(); + char *EndStr = UnEscapeLexed($3, true); + if (NumElements != -1 && NumElements != (EndStr-$3)) + ThrowException("Can't build string constant of size " + + itostr((int)(EndStr-$3)) + + " when array has size " + itostr(NumElements) + "!"); + std::vector Vals; + if (ETy == Type::SByteTy) { + for (signed char *C = (signed char *)$3; C != (signed char *)EndStr; ++C) + Vals.push_back(ConstantSInt::get(ETy, *C)); + } else if (ETy == Type::UByteTy) { + for (unsigned char *C = (unsigned char *)$3; + C != (unsigned char*)EndStr; ++C) + Vals.push_back(ConstantUInt::get(ETy, *C)); + } else { + free($3); + ThrowException("Cannot build string arrays of non byte sized elements!"); + } + free($3); + $$ = ConstantArray::get(ATy, Vals); + delete $1; + } + | Types '<' ConstVector '>' { // Nonempty unsized arr + const PackedType *PTy = dyn_cast($1->get()); + if (PTy == 0) + ThrowException("Cannot make packed constant with type: '" + + (*$1)->getDescription() + "'!"); + const Type *ETy = PTy->getElementType(); + int NumElements = PTy->getNumElements(); + + // Verify that we have the correct size... + if (NumElements != -1 && NumElements != (int)$3->size()) + ThrowException("Type mismatch: constant sized packed initialized with " + + utostr($3->size()) + " arguments, but has size of " + + itostr(NumElements) + "!"); + + // Verify all elements are correct type! + for (unsigned i = 0; i < $3->size(); i++) { + if (ETy != (*$3)[i]->getType()) + ThrowException("Element #" + utostr(i) + " is not of type '" + + ETy->getDescription() +"' as required!\nIt is of type '"+ + (*$3)[i]->getType()->getDescription() + "'."); + } + + $$ = ConstantPacked::get(PTy, *$3); + delete $1; delete $3; + } + | Types '{' ConstVector '}' { + const StructType *STy = dyn_cast($1->get()); + if (STy == 0) + ThrowException("Cannot make struct constant with type: '" + + (*$1)->getDescription() + "'!"); + + if ($3->size() != STy->getNumContainedTypes()) + ThrowException("Illegal number of initializers for structure type!"); + + // Check to ensure that constants are compatible with the type initializer! + for (unsigned i = 0, e = $3->size(); i != e; ++i) + if ((*$3)[i]->getType() != STy->getElementType(i)) + ThrowException("Expected type '" + + STy->getElementType(i)->getDescription() + + "' for element #" + utostr(i) + + " of structure initializer!"); + + $$ = ConstantStruct::get(STy, *$3); + delete $1; delete $3; + } + | Types '{' '}' { + const StructType *STy = dyn_cast($1->get()); + if (STy == 0) + ThrowException("Cannot make struct constant with type: '" + + (*$1)->getDescription() + "'!"); + + if (STy->getNumContainedTypes() != 0) + ThrowException("Illegal number of initializers for structure type!"); + + $$ = ConstantStruct::get(STy, std::vector()); + delete $1; + } + | Types NULL_TOK { + const PointerType *PTy = dyn_cast($1->get()); + if (PTy == 0) + ThrowException("Cannot make null pointer constant with type: '" + + (*$1)->getDescription() + "'!"); + + $$ = ConstantPointerNull::get(PTy); + delete $1; + } + | Types UNDEF { + $$ = UndefValue::get($1->get()); + delete $1; + } + | Types SymbolicValueRef { + const PointerType *Ty = dyn_cast($1->get()); + if (Ty == 0) + ThrowException("Global const reference must be a pointer type!"); + + // ConstExprs can exist in the body of a function, thus creating + // GlobalValues whenever they refer to a variable. Because we are in + // the context of a function, getValNonImprovising will search the functions + // symbol table instead of the module symbol table for the global symbol, + // which throws things all off. To get around this, we just tell + // getValNonImprovising that we are at global scope here. + // + Function *SavedCurFn = CurFun.CurrentFunction; + CurFun.CurrentFunction = 0; + + Value *V = getValNonImprovising(Ty, $2); + + CurFun.CurrentFunction = SavedCurFn; + + // If this is an initializer for a constant pointer, which is referencing a + // (currently) undefined variable, create a stub now that shall be replaced + // in the future with the right type of variable. + // + if (V == 0) { + assert(isa(Ty) && "Globals may only be used as pointers!"); + const PointerType *PT = cast(Ty); + + // First check to see if the forward references value is already created! + PerModuleInfo::GlobalRefsType::iterator I = + CurModule.GlobalRefs.find(std::make_pair(PT, $2)); + + if (I != CurModule.GlobalRefs.end()) { + V = I->second; // Placeholder already exists, use it... + $2.destroy(); + } else { + std::string Name; + if ($2.Type == ValID::NameVal) Name = $2.Name; + + // Create the forward referenced global. + GlobalValue *GV; + if (const FunctionType *FTy = + dyn_cast(PT->getElementType())) { + GV = new Function(FTy, GlobalValue::ExternalLinkage, Name, + CurModule.CurrentModule); + } else { + GV = new GlobalVariable(PT->getElementType(), false, + GlobalValue::ExternalLinkage, 0, + Name, CurModule.CurrentModule); + } + + // Keep track of the fact that we have a forward ref to recycle it + CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, $2), GV)); + V = GV; + } + } + + $$ = cast(V); + delete $1; // Free the type handle + } + | Types ConstExpr { + if ($1->get() != $2->getType()) + ThrowException("Mismatched types for constant expression!"); + $$ = $2; + delete $1; + } + | Types ZEROINITIALIZER { + const Type *Ty = $1->get(); + if (isa(Ty) || Ty == Type::LabelTy || isa(Ty)) + ThrowException("Cannot create a null initialized value of this type!"); + $$ = Constant::getNullValue(Ty); + delete $1; + }; + + ConstVal : SIntType EINT64VAL { // integral constants + if (!ConstantSInt::isValueValidForType($1, $2)) + ThrowException("Constant value doesn't fit in type!"); + $$ = ConstantSInt::get($1, $2); + } + | UIntType EUINT64VAL { // integral constants + if (!ConstantUInt::isValueValidForType($1, $2)) + ThrowException("Constant value doesn't fit in type!"); + $$ = ConstantUInt::get($1, $2); + } + | BOOL TRUETOK { // Boolean constants + $$ = ConstantBool::True; + } + | BOOL FALSETOK { // Boolean constants + $$ = ConstantBool::False; + } + | FPType FPVAL { // Float & Double constants + if (!ConstantFP::isValueValidForType($1, $2)) + ThrowException("Floating point constant invalid for type!!"); + $$ = ConstantFP::get($1, $2); + }; + + + ConstExpr: CAST '(' ConstVal TO Types ')' { + if (!$3->getType()->isFirstClassType()) + ThrowException("cast constant expression from a non-primitive type: '" + + $3->getType()->getDescription() + "'!"); + if (!$5->get()->isFirstClassType()) + ThrowException("cast constant expression to a non-primitive type: '" + + $5->get()->getDescription() + "'!"); + $$ = ConstantExpr::getCast($3, $5->get()); + delete $5; + } + | GETELEMENTPTR '(' ConstVal IndexList ')' { + if (!isa($3->getType())) + ThrowException("GetElementPtr requires a pointer operand!"); + + // LLVM 1.2 and earlier used ubyte struct indices. Convert any ubyte struct + // indices to uint struct indices for compatibility. + generic_gep_type_iterator::iterator> + GTI = gep_type_begin($3->getType(), $4->begin(), $4->end()), + GTE = gep_type_end($3->getType(), $4->begin(), $4->end()); + for (unsigned i = 0, e = $4->size(); i != e && GTI != GTE; ++i, ++GTI) + if (isa(*GTI)) // Only change struct indices + if (ConstantUInt *CUI = dyn_cast((*$4)[i])) + if (CUI->getType() == Type::UByteTy) + (*$4)[i] = ConstantExpr::getCast(CUI, Type::UIntTy); + + const Type *IdxTy = + GetElementPtrInst::getIndexedType($3->getType(), *$4, true); + if (!IdxTy) + ThrowException("Index list invalid for constant getelementptr!"); + + std::vector IdxVec; + for (unsigned i = 0, e = $4->size(); i != e; ++i) + if (Constant *C = dyn_cast((*$4)[i])) + IdxVec.push_back(C); + else + ThrowException("Indices to constant getelementptr must be constants!"); + + delete $4; + + $$ = ConstantExpr::getGetElementPtr($3, IdxVec); + } + | SELECT '(' ConstVal ',' ConstVal ',' ConstVal ')' { + if ($3->getType() != Type::BoolTy) + ThrowException("Select condition must be of boolean type!"); + if ($5->getType() != $7->getType()) + ThrowException("Select operand types must match!"); + $$ = ConstantExpr::getSelect($3, $5, $7); + } + | ArithmeticOps '(' ConstVal ',' ConstVal ')' { + if ($3->getType() != $5->getType()) + ThrowException("Binary operator types must match!"); + // 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($3->getType())) { + $$ = ConstantExpr::get($1, $3, $5); + } else { + const Type *IntPtrTy = 0; + switch (CurModule.CurrentModule->getPointerSize()) { + case Module::Pointer32: IntPtrTy = Type::IntTy; break; + case Module::Pointer64: IntPtrTy = Type::LongTy; break; + default: ThrowException("invalid pointer binary constant expr!"); + } + $$ = ConstantExpr::get($1, ConstantExpr::getCast($3, IntPtrTy), + ConstantExpr::getCast($5, IntPtrTy)); + $$ = ConstantExpr::getCast($$, $3->getType()); + } + } + | LogicalOps '(' ConstVal ',' ConstVal ')' { + if ($3->getType() != $5->getType()) + ThrowException("Logical operator types must match!"); + if (!$3->getType()->isIntegral()) { + if (!isa($3->getType()) || + !cast($3->getType())->getElementType()->isIntegral()) + ThrowException("Logical operator requires integral operands!"); + } + $$ = ConstantExpr::get($1, $3, $5); + } + | SetCondOps '(' ConstVal ',' ConstVal ')' { + if ($3->getType() != $5->getType()) + ThrowException("setcc operand types must match!"); + $$ = ConstantExpr::get($1, $3, $5); + } + | ShiftOps '(' ConstVal ',' ConstVal ')' { + if ($5->getType() != Type::UByteTy) + ThrowException("Shift count for shift constant must be unsigned byte!"); + if (!$3->getType()->isInteger()) + ThrowException("Shift constant expression requires integer operand!"); + $$ = ConstantExpr::get($1, $3, $5); + } + | EXTRACTELEMENT '(' ConstVal ',' ConstVal ')' { + if (!isa($3->getType())) + ThrowException("First operand of extractelement must be " + "packed type!"); + if ($5->getType() != Type::UIntTy) + ThrowException("Second operand of extractelement must be uint!"); + $$ = ConstantExpr::getExtractElement($3, $5); + }; + + // ConstVector - A list of comma separated constants. + ConstVector : ConstVector ',' ConstVal { + ($$ = $1)->push_back($3); + } + | ConstVal { + $$ = new std::vector(); + $$->push_back($1); + }; + + + // GlobalType - Match either GLOBAL or CONSTANT for global declarations... + GlobalType : GLOBAL { $$ = false; } | CONSTANT { $$ = true; }; + + + //===----------------------------------------------------------------------===// + // Rules to match Modules + //===----------------------------------------------------------------------===// + + // Module rule: Capture the result of parsing the whole file into a result + // variable... + // + Module : FunctionList { + $$ = ParserResult = $1; + CurModule.ModuleDone(); + }; + + // FunctionList - A list of functions, preceeded by a constant pool. + // + FunctionList : FunctionList Function { + $$ = $1; + CurFun.FunctionDone(); + } + | FunctionList FunctionProto { + $$ = $1; + } + | FunctionList MODULE ASM_TOK AsmBlock { + $$ = $1; + } + | FunctionList IMPLEMENTATION { + $$ = $1; + } + | ConstPool { + $$ = CurModule.CurrentModule; + // Emit an error if there are any unresolved types left. + if (!CurModule.LateResolveTypes.empty()) { + const ValID &DID = CurModule.LateResolveTypes.begin()->first; + if (DID.Type == ValID::NameVal) + ThrowException("Reference to an undefined type: '"+DID.getName() + "'"); + else + ThrowException("Reference to an undefined type: #" + itostr(DID.Num)); + } + }; + + // ConstPool - Constants with optional names assigned to them. + ConstPool : ConstPool OptAssign TYPE TypesV { + // Eagerly resolve types. This is not an optimization, this is a + // requirement that is due to the fact that we could have this: + // + // %list = type { %list * } + // %list = type { %list * } ; repeated type decl + // + // If types are not resolved eagerly, then the two types will not be + // determined to be the same type! + // + ResolveTypeTo($2, *$4); + + if (!setTypeName(*$4, $2) && !$2) { + // If this is a named type that is not a redefinition, add it to the slot + // table. + CurModule.Types.push_back(*$4); + } + + delete $4; + } + | ConstPool FunctionProto { // Function prototypes can be in const pool + } + | ConstPool MODULE ASM_TOK AsmBlock { // Asm blocks can be in the const pool + } + | ConstPool OptAssign OptLinkage GlobalType ConstVal { + if ($5 == 0) ThrowException("Global value initializer is not a constant!"); + CurGV = ParseGlobalVariable($2, $3, $4, $5->getType(), $5); + } GlobalVarAttributes { + CurGV = 0; + } + | ConstPool OptAssign EXTERNAL GlobalType Types { + CurGV = ParseGlobalVariable($2, GlobalValue::ExternalLinkage, + $4, *$5, 0); + delete $5; + } GlobalVarAttributes { + CurGV = 0; + } + | ConstPool TARGET TargetDefinition { + } + | ConstPool DEPLIBS '=' LibrariesDefinition { + } + | /* empty: end of list */ { + }; + + + AsmBlock : STRINGCONSTANT { + const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); + char *EndStr = UnEscapeLexed($1, true); + std::string NewAsm($1, EndStr); + free($1); + + if (AsmSoFar.empty()) + CurModule.CurrentModule->setModuleInlineAsm(NewAsm); + else + CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm); + }; + + BigOrLittle : BIG { $$ = Module::BigEndian; }; + BigOrLittle : LITTLE { $$ = Module::LittleEndian; }; + + TargetDefinition : ENDIAN '=' BigOrLittle { + CurModule.CurrentModule->setEndianness($3); + } + | POINTERSIZE '=' EUINT64VAL { + if ($3 == 32) + CurModule.CurrentModule->setPointerSize(Module::Pointer32); + else if ($3 == 64) + CurModule.CurrentModule->setPointerSize(Module::Pointer64); + else + ThrowException("Invalid pointer size: '" + utostr($3) + "'!"); + } + | TRIPLE '=' STRINGCONSTANT { + CurModule.CurrentModule->setTargetTriple($3); + free($3); + }; + + LibrariesDefinition : '[' LibList ']'; + + LibList : LibList ',' STRINGCONSTANT { + CurModule.CurrentModule->addLibrary($3); + free($3); + } + | STRINGCONSTANT { + CurModule.CurrentModule->addLibrary($1); + free($1); + } + | /* empty: end of list */ { + } + ; + + //===----------------------------------------------------------------------===// + // Rules to match Function Headers + //===----------------------------------------------------------------------===// + + Name : VAR_ID | STRINGCONSTANT; + OptName : Name | /*empty*/ { $$ = 0; }; + + ArgVal : Types OptName { + if (*$1 == Type::VoidTy) + ThrowException("void typed arguments are invalid!"); + $$ = new std::pair($1, $2); + }; + + ArgListH : ArgListH ',' ArgVal { + $$ = $1; + $1->push_back(*$3); + delete $3; + } + | ArgVal { + $$ = new std::vector >(); + $$->push_back(*$1); + delete $1; + }; + + ArgList : ArgListH { + $$ = $1; + } + | ArgListH ',' DOTDOTDOT { + $$ = $1; + $$->push_back(std::pair(new PATypeHolder(Type::VoidTy), 0)); + } + | DOTDOTDOT { + $$ = new std::vector >(); + $$->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0)); + } + | /* empty */ { + $$ = 0; + }; + + FunctionHeaderH : OptCallingConv TypesV Name '(' ArgList ')' + OptSection OptAlign { + UnEscapeLexed($3); + std::string FunctionName($3); + free($3); // Free strdup'd memory! + + if (!(*$2)->isFirstClassType() && *$2 != Type::VoidTy) + ThrowException("LLVM functions cannot return aggregate types!"); + + std::vector ParamTypeList; + if ($5) { // If there are arguments... + for (std::vector >::iterator I = $5->begin(); + I != $5->end(); ++I) + ParamTypeList.push_back(I->first->get()); + } + + bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; + if (isVarArg) ParamTypeList.pop_back(); + + const FunctionType *FT = FunctionType::get(*$2, ParamTypeList, isVarArg); + const PointerType *PFT = PointerType::get(FT); + delete $2; + + ValID ID; + if (!FunctionName.empty()) { + ID = ValID::create((char*)FunctionName.c_str()); + } else { + ID = ValID::create((int)CurModule.Values[PFT].size()); + } + + Function *Fn = 0; + // See if this function was forward referenced. If so, recycle the object. + if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) { + // Move the function to the end of the list, from whereever it was + // previously inserted. + Fn = cast(FWRef); + CurModule.CurrentModule->getFunctionList().remove(Fn); + CurModule.CurrentModule->getFunctionList().push_back(Fn); + } else if (!FunctionName.empty() && // Merge with an earlier prototype? + (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) { + // If this is the case, either we need to be a forward decl, or it needs + // to be. + if (!CurFun.isDeclare && !Fn->isExternal()) + ThrowException("Redefinition of function '" + FunctionName + "'!"); + + // Make sure to strip off any argument names so we can't get conflicts. + if (Fn->isExternal()) + for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); + AI != AE; ++AI) + AI->setName(""); + + } else { // Not already defined? + Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName, + CurModule.CurrentModule); + InsertValue(Fn, CurModule.Values); + } + + CurFun.FunctionStart(Fn); + Fn->setCallingConv($1); + Fn->setAlignment($8); + if ($7) { + Fn->setSection($7); + free($7); + } + + // Add all of the arguments we parsed to the function... + if ($5) { // Is null if empty... + if (isVarArg) { // Nuke the last entry + assert($5->back().first->get() == Type::VoidTy && $5->back().second == 0&& + "Not a varargs marker!"); + delete $5->back().first; + $5->pop_back(); // Delete the last entry + } + Function::arg_iterator ArgIt = Fn->arg_begin(); + for (std::vector >::iterator I = $5->begin(); + I != $5->end(); ++I, ++ArgIt) { + delete I->first; // Delete the typeholder... + + setValueName(ArgIt, I->second); // Insert arg into symtab... + InsertValue(ArgIt); + } + + delete $5; // We're now done with the argument list + } + }; + + BEGIN : BEGINTOK | '{'; // Allow BEGIN or '{' to start a function + + FunctionHeader : OptLinkage FunctionHeaderH BEGIN { + $$ = CurFun.CurrentFunction; + + // Make sure that we keep track of the linkage type even if there was a + // previous "declare". + $$->setLinkage($1); + }; + + END : ENDTOK | '}'; // Allow end of '}' to end a function + + Function : BasicBlockList END { + $$ = $1; + }; + + FunctionProto : DECLARE { CurFun.isDeclare = true; } FunctionHeaderH { + $$ = CurFun.CurrentFunction; + CurFun.FunctionDone(); + }; + + //===----------------------------------------------------------------------===// + // Rules to match Basic Blocks + //===----------------------------------------------------------------------===// + + OptSideEffect : /* empty */ { + $$ = false; + } + | SIDEEFFECT { + $$ = true; + }; + + ConstValueRef : ESINT64VAL { // A reference to a direct constant + $$ = ValID::create($1); + } + | EUINT64VAL { + $$ = ValID::create($1); + } + | FPVAL { // Perhaps it's an FP constant? + $$ = ValID::create($1); + } + | TRUETOK { + $$ = ValID::create(ConstantBool::True); + } + | FALSETOK { + $$ = ValID::create(ConstantBool::False); + } + | NULL_TOK { + $$ = ValID::createNull(); + } + | UNDEF { + $$ = ValID::createUndef(); + } + | ZEROINITIALIZER { // A vector zero constant. + $$ = ValID::createZeroInit(); + } + | '<' ConstVector '>' { // Nonempty unsized packed vector + const Type *ETy = (*$2)[0]->getType(); + int NumElements = $2->size(); + + PackedType* pt = PackedType::get(ETy, NumElements); + PATypeHolder* PTy = new PATypeHolder( + HandleUpRefs( + PackedType::get( + ETy, + NumElements) + ) + ); + + // Verify all elements are correct type! + for (unsigned i = 0; i < $2->size(); i++) { + if (ETy != (*$2)[i]->getType()) + ThrowException("Element #" + utostr(i) + " is not of type '" + + ETy->getDescription() +"' as required!\nIt is of type '" + + (*$2)[i]->getType()->getDescription() + "'."); + } + + $$ = ValID::create(ConstantPacked::get(pt, *$2)); + delete PTy; delete $2; + } + | ConstExpr { + $$ = ValID::create($1); + } + | ASM_TOK OptSideEffect STRINGCONSTANT ',' STRINGCONSTANT { + char *End = UnEscapeLexed($3, true); + std::string AsmStr = std::string($3, End); + End = UnEscapeLexed($5, true); + std::string Constraints = std::string($5, End); + $$ = ValID::createInlineAsm(AsmStr, Constraints, $2); + free($3); + free($5); + }; + + // SymbolicValueRef - Reference to one of two ways of symbolically refering to + // another value. + // + SymbolicValueRef : INTVAL { // Is it an integer reference...? + $$ = ValID::create($1); + } + | Name { // Is it a named reference...? + $$ = ValID::create($1); + }; + + // ValueRef - A reference to a definition... either constant or symbolic + ValueRef : SymbolicValueRef | ConstValueRef; + + + // ResolvedVal - a pair. This is used only in cases where the + // type immediately preceeds the value reference, and allows complex constant + // pool references (for things like: 'ret [2 x int] [ int 12, int 42]') + ResolvedVal : Types ValueRef { + $$ = getVal(*$1, $2); delete $1; + }; + + BasicBlockList : BasicBlockList BasicBlock { + $$ = $1; + } + | FunctionHeader BasicBlock { // Do not allow functions with 0 basic blocks + $$ = $1; + }; + + + // Basic blocks are terminated by branching instructions: + // br, br/cc, switch, ret + // + BasicBlock : InstructionList OptAssign BBTerminatorInst { + setValueName($3, $2); + InsertValue($3); + + $1->getInstList().push_back($3); + InsertValue($1); + $$ = $1; + }; + + InstructionList : InstructionList Inst { + $1->getInstList().push_back($2); + $$ = $1; + } + | /* empty */ { + $$ = 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, $$); + } + | LABELSTR { + $$ = CurBB = getBBVal(ValID::create($1), 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, $$); + }; + + BBTerminatorInst : RET ResolvedVal { // Return with a result... + $$ = new ReturnInst($2); + } + | RET VOID { // Return with no result... + $$ = new ReturnInst(); + } + | BR LABEL ValueRef { // Unconditional Branch... + $$ = new BranchInst(getBBVal($3)); + } // Conditional Branch... + | BR BOOL ValueRef ',' LABEL ValueRef ',' LABEL ValueRef { + $$ = new BranchInst(getBBVal($6), getBBVal($9), getVal(Type::BoolTy, $3)); + } + | SWITCH IntType ValueRef ',' LABEL ValueRef '[' JumpTable ']' { + SwitchInst *S = new SwitchInst(getVal($2, $3), getBBVal($6), $8->size()); + $$ = S; + + std::vector >::iterator I = $8->begin(), + E = $8->end(); + for (; I != E; ++I) { + if (ConstantInt *CI = dyn_cast(I->first)) + S->addCase(CI, I->second); + else + ThrowException("Switch case is constant, but not a simple integer!"); + } + delete $8; + } + | SWITCH IntType ValueRef ',' LABEL ValueRef '[' ']' { + SwitchInst *S = new SwitchInst(getVal($2, $3), getBBVal($6), 0); + $$ = S; + } + | INVOKE OptCallingConv TypesV ValueRef '(' ValueRefListE ')' + TO LABEL ValueRef UNWIND LABEL ValueRef { + const PointerType *PFTy; + const FunctionType *Ty; + + if (!(PFTy = dyn_cast($3->get())) || + !(Ty = dyn_cast(PFTy->getElementType()))) { + // Pull out the types of all of the arguments... + std::vector ParamTypes; + if ($6) { + for (std::vector::iterator I = $6->begin(), E = $6->end(); + I != E; ++I) + ParamTypes.push_back((*I)->getType()); + } + + bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy; + if (isVarArg) ParamTypes.pop_back(); + + Ty = FunctionType::get($3->get(), ParamTypes, isVarArg); + PFTy = PointerType::get(Ty); + } + + Value *V = getVal(PFTy, $4); // Get the function we're calling... + + BasicBlock *Normal = getBBVal($10); + BasicBlock *Except = getBBVal($13); + + // Create the call node... + if (!$6) { // Has no arguments? + $$ = new InvokeInst(V, Normal, Except, std::vector()); + } 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 = $6->begin(), ArgE = $6->end(); + + for (; ArgI != ArgE && I != E; ++ArgI, ++I) + if ((*ArgI)->getType() != *I) + ThrowException("Parameter " +(*ArgI)->getName()+ " is not of type '" + + (*I)->getDescription() + "'!"); + + if (I != E || (ArgI != ArgE && !Ty->isVarArg())) + ThrowException("Invalid number of parameters detected!"); + + $$ = new InvokeInst(V, Normal, Except, *$6); + } + cast($$)->setCallingConv($2); + + delete $3; + delete $6; + } + | UNWIND { + $$ = new UnwindInst(); + } + | UNREACHABLE { + $$ = new UnreachableInst(); + }; + + + + JumpTable : JumpTable IntType ConstValueRef ',' LABEL ValueRef { + $$ = $1; + Constant *V = cast(getValNonImprovising($2, $3)); + if (V == 0) + ThrowException("May only switch on a constant pool value!"); + + $$->push_back(std::make_pair(V, getBBVal($6))); + } + | IntType ConstValueRef ',' LABEL ValueRef { + $$ = new std::vector >(); + Constant *V = cast(getValNonImprovising($1, $2)); + + if (V == 0) + ThrowException("May only switch on a constant pool value!"); + + $$->push_back(std::make_pair(V, getBBVal($5))); + }; + + Inst : OptAssign InstVal { + // Is this definition named?? if so, assign the name... + setValueName($2, $1); + InsertValue($2); + $$ = $2; + }; + + PHIList : Types '[' ValueRef ',' ValueRef ']' { // Used for PHI nodes + $$ = new std::list >(); + $$->push_back(std::make_pair(getVal(*$1, $3), getBBVal($5))); + delete $1; + } + | PHIList ',' '[' ValueRef ',' ValueRef ']' { + $$ = $1; + $1->push_back(std::make_pair(getVal($1->front().first->getType(), $4), + getBBVal($6))); + }; + + + ValueRefList : ResolvedVal { // Used for call statements, and memory insts... + $$ = new std::vector(); + $$->push_back($1); + } + | ValueRefList ',' ResolvedVal { + $$ = $1; + $1->push_back($3); + }; + + // ValueRefListE - Just like ValueRefList, except that it may also be empty! + ValueRefListE : ValueRefList | /*empty*/ { $$ = 0; }; + + OptTailCall : TAIL CALL { + $$ = true; + } + | CALL { + $$ = false; + }; + + + + InstVal : ArithmeticOps Types ValueRef ',' ValueRef { + if (!(*$2)->isInteger() && !(*$2)->isFloatingPoint() && + !isa((*$2).get())) + ThrowException( + "Arithmetic operator requires integer, FP, or packed operands!"); + if (isa((*$2).get()) && $1 == Instruction::Rem) + ThrowException("Rem not supported on packed types!"); + $$ = BinaryOperator::create($1, getVal(*$2, $3), getVal(*$2, $5)); + if ($$ == 0) + ThrowException("binary operator returned null!"); + delete $2; + } + | LogicalOps Types ValueRef ',' ValueRef { + if (!(*$2)->isIntegral()) { + if (!isa($2->get()) || + !cast($2->get())->getElementType()->isIntegral()) + ThrowException("Logical operator requires integral operands!"); + } + $$ = BinaryOperator::create($1, getVal(*$2, $3), getVal(*$2, $5)); + if ($$ == 0) + ThrowException("binary operator returned null!"); + delete $2; + } + | SetCondOps Types ValueRef ',' ValueRef { + if(isa((*$2).get())) { + ThrowException( + "PackedTypes currently not supported in setcc instructions!"); + } + $$ = new SetCondInst($1, getVal(*$2, $3), getVal(*$2, $5)); + if ($$ == 0) + ThrowException("binary operator returned null!"); + delete $2; + } + | NOT ResolvedVal { + std::cerr << "WARNING: Use of eliminated 'not' instruction:" + << " Replacing with 'xor'.\n"; + + Value *Ones = ConstantIntegral::getAllOnesValue($2->getType()); + if (Ones == 0) + ThrowException("Expected integral type for not instruction!"); + + $$ = BinaryOperator::create(Instruction::Xor, $2, Ones); + if ($$ == 0) + ThrowException("Could not create a xor instruction!"); + } + | ShiftOps ResolvedVal ',' ResolvedVal { + if ($4->getType() != Type::UByteTy) + ThrowException("Shift amount must be ubyte!"); + if (!$2->getType()->isInteger()) + ThrowException("Shift constant expression requires integer operand!"); + $$ = new ShiftInst($1, $2, $4); + } + | CAST ResolvedVal TO Types { + if (!$4->get()->isFirstClassType()) + ThrowException("cast instruction to a non-primitive type: '" + + $4->get()->getDescription() + "'!"); + $$ = new CastInst($2, *$4); + delete $4; + } + | SELECT ResolvedVal ',' ResolvedVal ',' ResolvedVal { + if ($2->getType() != Type::BoolTy) + ThrowException("select condition must be boolean!"); + if ($4->getType() != $6->getType()) + ThrowException("select value types should match!"); + $$ = new SelectInst($2, $4, $6); + } + | VAARG ResolvedVal ',' Types { + NewVarArgs = true; + $$ = new VAArgInst($2, *$4); + delete $4; + } + | VAARG_old ResolvedVal ',' Types { + ObsoleteVarArgs = true; + const Type* ArgTy = $2->getType(); + Function* NF = CurModule.CurrentModule-> + getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0); + + //b = vaarg a, t -> + //foo = alloca 1 of t + //bar = vacopy a + //store bar -> foo + //b = vaarg foo, t + AllocaInst* foo = new AllocaInst(ArgTy, 0, "vaarg.fix"); + CurBB->getInstList().push_back(foo); + CallInst* bar = new CallInst(NF, $2); + CurBB->getInstList().push_back(bar); + CurBB->getInstList().push_back(new StoreInst(bar, foo)); + $$ = new VAArgInst(foo, *$4); + delete $4; + } + | VANEXT_old ResolvedVal ',' Types { + ObsoleteVarArgs = true; + const Type* ArgTy = $2->getType(); + Function* NF = CurModule.CurrentModule-> + getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0); + + //b = vanext a, t -> + //foo = alloca 1 of t + //bar = vacopy a + //store bar -> foo + //tmp = vaarg foo, t + //b = load foo + AllocaInst* foo = new AllocaInst(ArgTy, 0, "vanext.fix"); + CurBB->getInstList().push_back(foo); + CallInst* bar = new CallInst(NF, $2); + CurBB->getInstList().push_back(bar); + CurBB->getInstList().push_back(new StoreInst(bar, foo)); + Instruction* tmp = new VAArgInst(foo, *$4); + CurBB->getInstList().push_back(tmp); + $$ = new LoadInst(foo); + delete $4; + } + | EXTRACTELEMENT ResolvedVal ',' ResolvedVal { + if (!isa($2->getType())) + ThrowException("First operand of extractelement must be " + "packed type!"); + if ($4->getType() != Type::UIntTy) + ThrowException("Second operand of extractelement must be uint!"); + $$ = new ExtractElementInst($2, $4); + } + | INSERTELEMENT ResolvedVal ',' ResolvedVal ',' ResolvedVal { + if (!isa($2->getType())) + ThrowException("First operand of insertelement must be " + "packed type!"); + if ($4->getType() != + cast($2->getType())->getElementType()) + ThrowException("Second operand of insertelement must be " + "packed element type!"); + if ($6->getType() != Type::UIntTy) + ThrowException("Third operand of insertelement must be uint!"); + $$ = new InsertElementInst($2, $4, $6); + } + | PHI_TOK PHIList { + const Type *Ty = $2->front().first->getType(); + if (!Ty->isFirstClassType()) + ThrowException("PHI node operands must be of first class type!"); + $$ = new PHINode(Ty); + ((PHINode*)$$)->reserveOperandSpace($2->size()); + while ($2->begin() != $2->end()) { + if ($2->front().first->getType() != Ty) + ThrowException("All elements of a PHI node must be of the same type!"); + cast($$)->addIncoming($2->front().first, $2->front().second); + $2->pop_front(); + } + delete $2; // Free the list... + } + | OptTailCall OptCallingConv TypesV ValueRef '(' ValueRefListE ')' { + const PointerType *PFTy; + const FunctionType *Ty; + + if (!(PFTy = dyn_cast($3->get())) || + !(Ty = dyn_cast(PFTy->getElementType()))) { + // Pull out the types of all of the arguments... + std::vector ParamTypes; + if ($6) { + for (std::vector::iterator I = $6->begin(), E = $6->end(); + I != E; ++I) + ParamTypes.push_back((*I)->getType()); + } + + bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy; + if (isVarArg) ParamTypes.pop_back(); + + if (!(*$3)->isFirstClassType() && *$3 != Type::VoidTy) + ThrowException("LLVM functions cannot return aggregate types!"); + + Ty = FunctionType::get($3->get(), ParamTypes, isVarArg); + PFTy = PointerType::get(Ty); + } + + Value *V = getVal(PFTy, $4); // Get the function we're calling... + + // Create the call node... + if (!$6) { // Has no arguments? + // Make sure no arguments is a good thing! + if (Ty->getNumParams() != 0) + ThrowException("No arguments passed to a function that " + "expects arguments!"); + + $$ = new CallInst(V, std::vector()); + } 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 = $6->begin(), ArgE = $6->end(); + + for (; ArgI != ArgE && I != E; ++ArgI, ++I) + if ((*ArgI)->getType() != *I) + ThrowException("Parameter " +(*ArgI)->getName()+ " is not of type '" + + (*I)->getDescription() + "'!"); + + if (I != E || (ArgI != ArgE && !Ty->isVarArg())) + ThrowException("Invalid number of parameters detected!"); + + $$ = new CallInst(V, *$6); + } + cast($$)->setTailCall($1); + cast($$)->setCallingConv($2); + delete $3; + delete $6; + } + | MemoryInst { + $$ = $1; + }; + + + // IndexList - List of indices for GEP based instructions... + IndexList : ',' ValueRefList { + $$ = $2; + } | /* empty */ { + $$ = new std::vector(); + }; + + OptVolatile : VOLATILE { + $$ = true; + } + | /* empty */ { + $$ = false; + }; + + + + MemoryInst : MALLOC Types OptCAlign { + $$ = new MallocInst(*$2, 0, $3); + delete $2; + } + | MALLOC Types ',' UINT ValueRef OptCAlign { + $$ = new MallocInst(*$2, getVal($4, $5), $6); + delete $2; + } + | ALLOCA Types OptCAlign { + $$ = new AllocaInst(*$2, 0, $3); + delete $2; + } + | ALLOCA Types ',' UINT ValueRef OptCAlign { + $$ = new AllocaInst(*$2, getVal($4, $5), $6); + delete $2; + } + | FREE ResolvedVal { + if (!isa($2->getType())) + ThrowException("Trying to free nonpointer type " + + $2->getType()->getDescription() + "!"); + $$ = new FreeInst($2); + } + + | OptVolatile LOAD Types ValueRef { + if (!isa($3->get())) + ThrowException("Can't load from nonpointer type: " + + (*$3)->getDescription()); + if (!cast($3->get())->getElementType()->isFirstClassType()) + ThrowException("Can't load from pointer of non-first-class type: " + + (*$3)->getDescription()); + $$ = new LoadInst(getVal(*$3, $4), "", $1); + delete $3; + } + | OptVolatile STORE ResolvedVal ',' Types ValueRef { + const PointerType *PT = dyn_cast($5->get()); + if (!PT) + ThrowException("Can't store to a nonpointer type: " + + (*$5)->getDescription()); + const Type *ElTy = PT->getElementType(); + if (ElTy != $3->getType()) + ThrowException("Can't store '" + $3->getType()->getDescription() + + "' into space of type '" + ElTy->getDescription() + "'!"); + + $$ = new StoreInst($3, getVal(*$5, $6), $1); + delete $5; + } + | GETELEMENTPTR Types ValueRef IndexList { + if (!isa($2->get())) + ThrowException("getelementptr insn requires pointer operand!"); + + // LLVM 1.2 and earlier used ubyte struct indices. Convert any ubyte struct + // indices to uint struct indices for compatibility. + generic_gep_type_iterator::iterator> + GTI = gep_type_begin($2->get(), $4->begin(), $4->end()), + GTE = gep_type_end($2->get(), $4->begin(), $4->end()); + for (unsigned i = 0, e = $4->size(); i != e && GTI != GTE; ++i, ++GTI) + if (isa(*GTI)) // Only change struct indices + if (ConstantUInt *CUI = dyn_cast((*$4)[i])) + if (CUI->getType() == Type::UByteTy) + (*$4)[i] = ConstantExpr::getCast(CUI, Type::UIntTy); + + if (!GetElementPtrInst::getIndexedType(*$2, *$4, true)) + ThrowException("Invalid getelementptr indices for type '" + + (*$2)->getDescription()+ "'!"); + $$ = new GetElementPtrInst(getVal(*$2, $3), *$4); + delete $2; delete $4; + }; + + + %% + int yyerror(const char *ErrorMsg) { + std::string where + = std::string((CurFilename == "-") ? std::string("") : CurFilename) + + ":" + utostr((unsigned) llvmAsmlineno) + ": "; + std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading "; + if (yychar == YYEMPTY || yychar == 0) + errMsg += "end-of-file."; + else + errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'"; + ThrowException(errMsg); + return 0; + } Index: llvm/lib/AsmParser/Lexer.cpp.cvs diff -u llvm/lib/AsmParser/Lexer.cpp.cvs:1.2 llvm/lib/AsmParser/Lexer.cpp.cvs:1.3 --- llvm/lib/AsmParser/Lexer.cpp.cvs:1.2 Wed Feb 15 01:02:59 2006 +++ llvm/lib/AsmParser/Lexer.cpp.cvs Wed Feb 15 01:22:58 2006 @@ -20,7 +20,7 @@ /* A lexical scanner generated by flex */ /* Scanner skeleton version: - * $Header: /home/vadve/shared/PublicCVS/llvm/lib/AsmParser/Lexer.cpp.cvs,v 1.2 2006/02/15 07:02:59 lattner Exp $ + * $Header: /home/vadve/shared/PublicCVS/llvm/lib/AsmParser/Lexer.cpp.cvs,v 1.3 2006/02/15 07:22:58 lattner Exp $ */ #define FLEX_SCANNER From lattner at cs.uiuc.edu Wed Feb 15 01:23:18 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 15 Feb 2006 01:23:18 -0600 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200602150723.BAA18488@zion.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.345 -> 1.346 --- Log message: bugfixes --- Diffs of the changes: (+2 -3) Makefile.rules | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.345 llvm/Makefile.rules:1.346 --- llvm/Makefile.rules:1.345 Wed Feb 15 01:16:57 2006 +++ llvm/Makefile.rules Wed Feb 15 01:23:05 2006 @@ -1252,7 +1252,7 @@ .PRECIOUS: $(YaccOutput) -all:: $(YaccFiles:%.l=$(PROJ_SRC_DIR)/%.cpp.cvs) +all:: $(YaccFiles:%.y=$(PROJ_SRC_DIR)/%.cpp.cvs) # Cancel built-in rules for yacc %.c: %.y @@ -1265,7 +1265,6 @@ $(Verb) $(BISON) -v -d -p $( Changes in directory llvm/utils/TableGen: FileParser.cpp.cvs added (r1.1) FileParser.h.cvs added (r1.1) FileParser.y.cvs added (r1.1) FileLexer.cpp.cvs updated: 1.1 -> 1.2 FileParser.cpp (r1.11) removed FileParser.h (r1.5) removed --- Log message: Check the new form for bison output into CVS --- Diffs of the changes: (+2998 -1) FileLexer.cpp.cvs | 2 FileParser.cpp.cvs | 2257 +++++++++++++++++++++++++++++++++++++++++++++++++++++ FileParser.h.cvs | 102 ++ FileParser.y.cvs | 638 ++++++++++++++ 4 files changed, 2998 insertions(+), 1 deletion(-) Index: llvm/utils/TableGen/FileParser.cpp.cvs diff -c /dev/null llvm/utils/TableGen/FileParser.cpp.cvs:1.1 *** /dev/null Wed Feb 15 01:24:11 2006 --- llvm/utils/TableGen/FileParser.cpp.cvs Wed Feb 15 01:24:01 2006 *************** *** 0 **** --- 1,2257 ---- + /* A Bison parser, made by GNU Bison 1.875. */ + + /* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 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., 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. */ + + /* 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 + + /* Skeleton name. */ + #define YYSKELETON_NAME "yacc.c" + + /* Pure parsers. */ + #define YYPURE 0 + + /* Using locations. */ + #define YYLSP_NEEDED 0 + + /* If NAME_PREFIX is specified substitute the variables and functions + names. */ + #define yyparse Fileparse + #define yylex Filelex + #define yyerror Fileerror + #define yylval Filelval + #define yychar Filechar + #define yydebug Filedebug + #define yynerrs Filenerrs + + + /* Tokens. */ + #ifndef YYTOKENTYPE + # define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + INT = 258, + BIT = 259, + STRING = 260, + BITS = 261, + LIST = 262, + CODE = 263, + DAG = 264, + CLASS = 265, + DEF = 266, + FIELD = 267, + LET = 268, + IN = 269, + SHLTOK = 270, + SRATOK = 271, + SRLTOK = 272, + INTVAL = 273, + ID = 274, + VARNAME = 275, + STRVAL = 276, + CODEFRAGMENT = 277 + }; + #endif + #define INT 258 + #define BIT 259 + #define STRING 260 + #define BITS 261 + #define LIST 262 + #define CODE 263 + #define DAG 264 + #define CLASS 265 + #define DEF 266 + #define FIELD 267 + #define LET 268 + #define IN 269 + #define SHLTOK 270 + #define SRATOK 271 + #define SRLTOK 272 + #define INTVAL 273 + #define ID 274 + #define VARNAME 275 + #define STRVAL 276 + #define CODEFRAGMENT 277 + + + + + /* Copy the first part of user declarations. */ + #line 14 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + + #include "Record.h" + #include "llvm/ADT/StringExtras.h" + #include + #include + #define YYERROR_VERBOSE 1 + + int yyerror(const char *ErrorMsg); + int yylex(); + + namespace llvm { + + extern int Filelineno; + static Record *CurRec = 0; + static bool ParsingTemplateArgs = false; + + typedef std::pair*> SubClassRefTy; + + struct LetRecord { + std::string Name; + std::vector Bits; + Init *Value; + bool HasBits; + LetRecord(const std::string &N, std::vector *B, Init *V) + : Name(N), Value(V), HasBits(B != 0) { + if (HasBits) Bits = *B; + } + }; + + static std::vector > LetStack; + + + extern std::ostream &err(); + + static void addValue(const RecordVal &RV) { + if (RecordVal *ERV = CurRec->getValue(RV.getName())) { + // The value already exists in the class, treat this as a set... + if (ERV->setValue(RV.getValue())) { + err() << "New definition of '" << RV.getName() << "' of type '" + << *RV.getType() << "' is incompatible with previous " + << "definition of type '" << *ERV->getType() << "'!\n"; + exit(1); + } + } else { + CurRec->addValue(RV); + } + } + + static void addSuperClass(Record *SC) { + if (CurRec->isSubClassOf(SC)) { + err() << "Already subclass of '" << SC->getName() << "'!\n"; + exit(1); + } + CurRec->addSuperClass(SC); + } + + static void setValue(const std::string &ValName, + std::vector *BitList, Init *V) { + if (!V) return; + + RecordVal *RV = CurRec->getValue(ValName); + if (RV == 0) { + err() << "Value '" << ValName << "' unknown!\n"; + exit(1); + } + + // Do not allow assignments like 'X = X'. This will just cause infinite loops + // in the resolution machinery. + if (!BitList) + if (VarInit *VI = dynamic_cast(V)) + if (VI->getName() == ValName) + return; + + // If we are assigning to a subset of the bits in the value... then we must be + // assigning to a field of BitsRecTy, which must have a BitsInit + // initializer... + // + if (BitList) { + BitsInit *CurVal = dynamic_cast(RV->getValue()); + if (CurVal == 0) { + err() << "Value '" << ValName << "' is not a bits type!\n"; + exit(1); + } + + // Convert the incoming value to a bits type of the appropriate size... + Init *BI = V->convertInitializerTo(new BitsRecTy(BitList->size())); + if (BI == 0) { + V->convertInitializerTo(new BitsRecTy(BitList->size())); + err() << "Initializer '" << *V << "' not compatible with bit range!\n"; + exit(1); + } + + // We should have a BitsInit type now... + assert(dynamic_cast(BI) != 0 || &(std::cerr << *BI) == 0); + BitsInit *BInit = (BitsInit*)BI; + + BitsInit *NewVal = new BitsInit(CurVal->getNumBits()); + + // Loop over bits, assigning values as appropriate... + for (unsigned i = 0, e = BitList->size(); i != e; ++i) { + unsigned Bit = (*BitList)[i]; + if (NewVal->getBit(Bit)) { + err() << "Cannot set bit #" << Bit << " of value '" << ValName + << "' more than once!\n"; + exit(1); + } + NewVal->setBit(Bit, BInit->getBit(i)); + } + + for (unsigned i = 0, e = CurVal->getNumBits(); i != e; ++i) + if (NewVal->getBit(i) == 0) + NewVal->setBit(i, CurVal->getBit(i)); + + V = NewVal; + } + + if (RV->setValue(V)) { + err() << "Value '" << ValName << "' of type '" << *RV->getType() + << "' is incompatible with initializer '" << *V << "'!\n"; + exit(1); + } + } + + // addSubClass - Add SC as a subclass to CurRec, resolving TemplateArgs as SC's + // template arguments. + static void addSubClass(Record *SC, const std::vector &TemplateArgs) { + // Add all of the values in the subclass into the current class... + const std::vector &Vals = SC->getValues(); + for (unsigned i = 0, e = Vals.size(); i != e; ++i) + addValue(Vals[i]); + + const std::vector &TArgs = SC->getTemplateArgs(); + + // Ensure that an appropriate number of template arguments are specified... + if (TArgs.size() < TemplateArgs.size()) { + err() << "ERROR: More template args specified than expected!\n"; + exit(1); + } else { // This class expects template arguments... + // Loop over all of the template arguments, setting them to the specified + // value or leaving them as the default if necessary. + for (unsigned i = 0, e = TArgs.size(); i != e; ++i) { + if (i < TemplateArgs.size()) { // A value is specified for this temp-arg? + // Set it now. + setValue(TArgs[i], 0, TemplateArgs[i]); + + // Resolve it next. + CurRec->resolveReferencesTo(CurRec->getValue(TArgs[i])); + + + // Now remove it. + CurRec->removeValue(TArgs[i]); + + } else if (!CurRec->getValue(TArgs[i])->getValue()->isComplete()) { + err() << "ERROR: Value not specified for template argument #" + << i << " (" << TArgs[i] << ") of subclass '" << SC->getName() + << "'!\n"; + exit(1); + } + } + } + + // Since everything went well, we can now set the "superclass" list for the + // current record. + const std::vector &SCs = SC->getSuperClasses(); + for (unsigned i = 0, e = SCs.size(); i != e; ++i) + addSuperClass(SCs[i]); + addSuperClass(SC); + } + + } // End llvm namespace + + 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 + + #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) + #line 189 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + typedef union YYSTYPE { + std::string* StrVal; + int IntVal; + llvm::RecTy* Ty; + llvm::Init* Initializer; + std::vector* FieldList; + std::vector* BitList; + llvm::Record* Rec; + SubClassRefTy* SubClassRef; + std::vector* SubClassList; + std::vector >* DagValueList; + } YYSTYPE; + /* Line 191 of yacc.c. */ + #line 316 "FileParser.tab.c" + # define yystype YYSTYPE /* obsolescent; will be withdrawn */ + # define YYSTYPE_IS_DECLARED 1 + # define YYSTYPE_IS_TRIVIAL 1 + #endif + + + + /* Copy the second part of user declarations. */ + + + /* Line 214 of yacc.c. */ + #line 328 "FileParser.tab.c" + + #if ! defined (yyoverflow) || YYERROR_VERBOSE + + /* The parser invokes alloca or malloc; define the necessary symbols. */ + + # if YYSTACK_USE_ALLOCA + # define YYSTACK_ALLOC alloca + # else + # ifndef YYSTACK_USE_ALLOCA + # if defined (alloca) || defined (_ALLOCA_H) + # define YYSTACK_ALLOC alloca + # else + # ifdef __GNUC__ + # define YYSTACK_ALLOC __builtin_alloca + # endif + # endif + # endif + # endif + + # ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ + # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) + # else + # if defined (__STDC__) || defined (__cplusplus) + # include /* INFRINGES ON USER NAME SPACE */ + # define YYSIZE_T size_t + # endif + # define YYSTACK_ALLOC malloc + # define YYSTACK_FREE free + # endif + #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ + + + #if (! defined (yyoverflow) \ + && (! defined (__cplusplus) \ + || (YYSTYPE_IS_TRIVIAL))) + + /* A type that is properly aligned for any stack member. */ + union yyalloc + { + short 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 (short) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + + /* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ + # ifndef YYCOPY + # if 1 < __GNUC__ + # define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) + # else + # define YYCOPY(To, From, Count) \ + do \ + { \ + register YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (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 (0) + + #endif + + #if defined (__STDC__) || defined (__cplusplus) + typedef signed char yysigned_char; + #else + typedef short yysigned_char; + #endif + + /* YYFINAL -- State number of the termination state. */ + #define YYFINAL 20 + /* YYLAST -- Last index in YYTABLE. */ + #define YYLAST 163 + + /* YYNTOKENS -- Number of terminals. */ + #define YYNTOKENS 38 + /* YYNNTS -- Number of nonterminals. */ + #define YYNNTS 41 + /* YYNRULES -- Number of rules. */ + #define YYNRULES 89 + /* YYNRULES -- Number of states. */ + #define YYNSTATES 160 + + /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ + #define YYUNDEFTOK 2 + #define YYMAXUTOK 277 + + #define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + + /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ + static const unsigned char 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, + 32, 33, 2, 2, 34, 36, 31, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 35, 37, + 23, 25, 24, 26, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 29, 2, 30, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 27, 2, 28, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 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 + }; + + #if YYDEBUG + /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ + static const unsigned short yyprhs[] = + { + 0, 0, 3, 5, 7, 9, 14, 16, 21, 23, + 25, 27, 28, 30, 31, 34, 36, 38, 40, 42, + 46, 51, 53, 58, 62, 66, 71, 76, 83, 90, + 97, 98, 101, 104, 109, 110, 112, 114, 118, 121, + 125, 131, 136, 138, 139, 143, 144, 146, 148, 152, + 157, 160, 167, 168, 171, 173, 177, 179, 184, 186, + 190, 191, 194, 196, 200, 204, 205, 207, 209, 210, + 212, 214, 216, 217, 221, 222, 223, 230, 234, 236, + 238, 243, 245, 249, 250, 255, 260, 263, 265, 268 + }; + + /* YYRHS -- A `-1'-separated list of the rules' RHS. */ + static const yysigned_char yyrhs[] = + { + 78, 0, -1, 19, -1, 5, -1, 4, -1, 6, + 23, 18, 24, -1, 3, -1, 7, 23, 40, 24, + -1, 8, -1, 9, -1, 39, -1, -1, 12, -1, + -1, 25, 43, -1, 18, -1, 21, -1, 22, -1, + 26, -1, 27, 50, 28, -1, 19, 23, 51, 24, + -1, 19, -1, 43, 27, 48, 28, -1, 29, 50, + 30, -1, 43, 31, 19, -1, 32, 19, 46, 33, + -1, 43, 29, 48, 30, -1, 15, 32, 43, 34, + 43, 33, -1, 16, 32, 43, 34, 43, 33, -1, + 17, 32, 43, 34, 43, 33, -1, -1, 35, 20, + -1, 43, 44, -1, 45, 34, 43, 44, -1, -1, + 45, -1, 18, -1, 18, 36, 18, -1, 18, 18, + -1, 47, 34, 18, -1, 47, 34, 18, 36, 18, + -1, 47, 34, 18, 18, -1, 47, -1, -1, 27, + 48, 28, -1, -1, 51, -1, 43, -1, 51, 34, + 43, -1, 41, 40, 19, 42, -1, 52, 37, -1, + 13, 19, 49, 25, 43, 37, -1, -1, 54, 53, + -1, 37, -1, 27, 54, 28, -1, 39, -1, 39, + 23, 51, 24, -1, 56, -1, 57, 34, 56, -1, + -1, 35, 57, -1, 52, -1, 59, 34, 52, -1, + 23, 59, 24, -1, -1, 60, -1, 19, -1, -1, + 62, -1, 63, -1, 63, -1, -1, 58, 67, 55, + -1, -1, -1, 10, 64, 69, 61, 70, 66, -1, + 11, 65, 66, -1, 68, -1, 71, -1, 19, 49, + 25, 43, -1, 73, -1, 74, 34, 73, -1, -1, + 13, 76, 74, 14, -1, 75, 27, 77, 28, -1, + 75, 72, -1, 72, -1, 77, 72, -1, 77, -1 + }; + + /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ + static const unsigned short yyrline[] = + { + 0, 223, 223, 234, 236, 238, 240, 242, 244, 246, + 248, 252, 252, 254, 254, 256, 258, 261, 264, 266, + 279, 307, 322, 329, 332, 339, 347, 355, 361, 367, + 375, 378, 382, 387, 393, 396, 399, 402, 415, 429, + 431, 444, 460, 462, 462, 466, 468, 472, 475, 479, + 489, 491, 497, 497, 498, 498, 500, 502, 506, 511, + 516, 519, 523, 526, 531, 532, 532, 534, 534, 536, + 543, 561, 573, 573, 592, 594, 592, 600, 609, 609, + 611, 616, 616, 619, 619, 622, 625, 629, 629, 631 + }; + #endif + + #if YYDEBUG || YYERROR_VERBOSE + /* YYTNME[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", "INT", "BIT", "STRING", "BITS", "LIST", + "CODE", "DAG", "CLASS", "DEF", "FIELD", "LET", "IN", "SHLTOK", "SRATOK", + "SRLTOK", "INTVAL", "ID", "VARNAME", "STRVAL", "CODEFRAGMENT", "'<'", + "'>'", "'='", "'?'", "'{'", "'}'", "'['", "']'", "'.'", "'('", "')'", + "','", "':'", "'-'", "';'", "$accept", "ClassID", "Type", "OptPrefix", + "OptValue", "Value", "OptVarName", "DagArgListNE", "DagArgList", + "RBitList", "BitList", "OptBitList", "ValueList", "ValueListNE", + "Declaration", "BodyItem", "BodyList", "Body", "SubClassRef", + "ClassListNE", "ClassList", "DeclListNE", "TemplateArgList", + "OptTemplateArgList", "OptID", "ObjectName", "ClassName", "DefName", + "ObjectBody", "@1", "ClassInst", "@2", "@3", "DefInst", "Object", + "LETItem", "LETList", "LETCommand", "@4", "ObjectList", "File", 0 + }; + #endif + + # ifdef YYPRINT + /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ + static const unsigned short yytoknum[] = + { + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 60, 62, 61, 63, 123, 125, 91, + 93, 46, 40, 41, 44, 58, 45, 59 + }; + # endif + + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ + static const unsigned char yyr1[] = + { + 0, 38, 39, 40, 40, 40, 40, 40, 40, 40, + 40, 41, 41, 42, 42, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 44, 44, 45, 45, 46, 46, 47, 47, 47, 47, + 47, 47, 48, 49, 49, 50, 50, 51, 51, 52, + 53, 53, 54, 54, 55, 55, 56, 56, 57, 57, + 58, 58, 59, 59, 60, 61, 61, 62, 62, 63, + 64, 65, 67, 66, 69, 70, 68, 71, 72, 72, + 73, 74, 74, 76, 75, 72, 72, 77, 77, 78 + }; + + /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ + static const unsigned char yyr2[] = + { + 0, 2, 1, 1, 1, 4, 1, 4, 1, 1, + 1, 0, 1, 0, 2, 1, 1, 1, 1, 3, + 4, 1, 4, 3, 3, 4, 4, 6, 6, 6, + 0, 2, 2, 4, 0, 1, 1, 3, 2, 3, + 5, 4, 1, 0, 3, 0, 1, 1, 3, 4, + 2, 6, 0, 2, 1, 3, 1, 4, 1, 3, + 0, 2, 1, 3, 3, 0, 1, 1, 0, 1, + 1, 1, 0, 3, 0, 0, 6, 3, 1, 1, + 4, 1, 3, 0, 4, 4, 2, 1, 2, 1 + }; + + /* 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 unsigned char yydefact[] = + { + 0, 68, 68, 83, 78, 79, 87, 0, 89, 0, + 67, 69, 70, 74, 71, 60, 0, 0, 86, 88, + 1, 65, 0, 72, 77, 43, 81, 0, 0, 11, + 66, 75, 2, 56, 58, 61, 0, 0, 0, 84, + 0, 85, 12, 0, 62, 0, 60, 0, 0, 52, + 54, 73, 36, 42, 0, 0, 82, 6, 4, 3, + 0, 0, 8, 9, 10, 0, 64, 11, 76, 0, + 0, 0, 15, 21, 16, 17, 18, 45, 45, 0, + 47, 0, 59, 11, 38, 0, 0, 44, 80, 0, + 0, 13, 63, 0, 0, 0, 0, 0, 46, 0, + 34, 0, 0, 0, 57, 0, 0, 55, 0, 53, + 37, 39, 0, 0, 0, 49, 0, 0, 0, 0, + 19, 23, 30, 35, 0, 0, 0, 24, 48, 43, + 50, 41, 0, 5, 7, 14, 0, 0, 0, 20, + 0, 32, 0, 25, 22, 26, 0, 40, 0, 0, + 0, 31, 30, 0, 27, 28, 29, 33, 0, 51 + }; + + /* YYDEFGOTO[NTERM-NUM]. */ + static const short yydefgoto[] = + { + -1, 33, 65, 43, 115, 80, 141, 123, 124, 53, + 54, 38, 97, 98, 44, 109, 83, 51, 34, 35, + 23, 45, 30, 31, 11, 12, 13, 15, 24, 36, + 4, 21, 46, 5, 6, 26, 27, 7, 16, 8, + 9 + }; + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ + #define YYPACT_NINF -82 + static const yysigned_char yypact[] = + { + 114, -12, -12, -82, -82, -82, -82, 4, 114, 16, + -82, -82, -82, -82, -82, -3, 10, 114, -82, -82, + -82, 12, 17, -82, -82, 14, -82, -9, -2, 35, + -82, -82, -82, 26, -82, 28, -14, 46, 42, -82, + 10, -82, -82, 69, -82, 3, -3, 39, 17, -82, + -82, -82, -8, 36, 41, 39, -82, -82, -82, -82, + 56, 57, -82, -82, -82, 66, -82, 35, -82, 52, + 54, 58, -82, 72, -82, -82, -82, 39, 39, 87, + 91, 9, -82, 6, -82, 108, 110, -82, 91, 111, + 69, 105, -82, 39, 39, 39, 39, 103, 98, 104, + 39, 46, 46, 116, -82, 39, 117, -82, 96, -82, + -82, -6, 113, 115, 39, -82, 65, 73, 74, 29, + -82, -82, 62, 106, 109, 118, 119, -82, 91, 14, + -82, -82, 120, -82, -82, 91, 39, 39, 39, -82, + 121, -82, 39, -82, -82, -82, 122, -82, 82, 83, + 90, -82, 62, 39, -82, -82, -82, -82, 15, -82 + }; + + /* YYPGOTO[NTERM-NUM]. */ + static const short yypgoto[] = + { + -82, -42, 53, -82, -82, -55, -7, -82, -82, -82, + -81, 19, 75, -45, -61, -82, -82, -82, 102, -82, + -82, -82, -82, -82, -82, 142, -82, -82, 112, -82, + -82, -82, -82, -82, -4, 123, -82, -82, -82, 134, + -82 + }; + + /* 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 -1 + static const unsigned char yytable[] = + { + 88, 64, 81, 18, 19, 39, 92, 10, 1, 2, + 84, 3, 131, 49, 1, 2, 20, 3, 42, 106, + 125, 126, 108, 50, 19, 40, 41, 66, 85, 25, + 132, 17, 22, 104, 107, 29, 32, 67, 116, 117, + 118, 37, 101, 105, 102, 122, 103, 42, 64, 47, + 128, 119, 159, 139, 69, 70, 71, 72, 73, 135, + 74, 75, 48, 105, 52, 76, 77, 55, 78, 87, + 86, 79, 57, 58, 59, 60, 61, 62, 63, 89, + 90, 148, 149, 150, 93, 91, 94, 152, 32, 101, + 95, 102, 101, 103, 102, 96, 103, 140, 158, 136, + 101, 101, 102, 102, 103, 103, 100, 137, 138, 101, + 101, 102, 102, 103, 103, 154, 155, 101, 101, 102, + 102, 103, 103, 156, 1, 2, 110, 3, 111, 112, + 114, 120, 105, 130, 121, 127, 129, 133, 147, 134, + 142, 151, 143, 113, 14, 157, 144, 153, 146, 145, + 82, 28, 0, 99, 0, 0, 0, 0, 68, 0, + 0, 0, 0, 56 + }; + + static const short yycheck[] = + { + 55, 43, 47, 7, 8, 14, 67, 19, 10, 11, + 18, 13, 18, 27, 10, 11, 0, 13, 12, 13, + 101, 102, 83, 37, 28, 34, 28, 24, 36, 19, + 36, 27, 35, 24, 28, 23, 19, 34, 93, 94, + 95, 27, 27, 34, 29, 100, 31, 12, 90, 23, + 105, 96, 37, 24, 15, 16, 17, 18, 19, 114, + 21, 22, 34, 34, 18, 26, 27, 25, 29, 28, + 34, 32, 3, 4, 5, 6, 7, 8, 9, 23, + 23, 136, 137, 138, 32, 19, 32, 142, 19, 27, + 32, 29, 27, 31, 29, 23, 31, 35, 153, 34, + 27, 27, 29, 29, 31, 31, 19, 34, 34, 27, + 27, 29, 29, 31, 31, 33, 33, 27, 27, 29, + 29, 31, 31, 33, 10, 11, 18, 13, 18, 18, + 25, 28, 34, 37, 30, 19, 19, 24, 18, 24, + 34, 20, 33, 90, 2, 152, 28, 25, 129, 30, + 48, 17, -1, 78, -1, -1, -1, -1, 46, -1, + -1, -1, -1, 40 + }; + + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ + static const unsigned char yystos[] = + { + 0, 10, 11, 13, 68, 71, 72, 75, 77, 78, + 19, 62, 63, 64, 63, 65, 76, 27, 72, 72, + 0, 69, 35, 58, 66, 19, 73, 74, 77, 23, + 60, 61, 19, 39, 56, 57, 67, 27, 49, 14, + 34, 28, 12, 41, 52, 59, 70, 23, 34, 27, + 37, 55, 18, 47, 48, 25, 73, 3, 4, 5, + 6, 7, 8, 9, 39, 40, 24, 34, 66, 15, + 16, 17, 18, 19, 21, 22, 26, 27, 29, 32, + 43, 51, 56, 54, 18, 36, 34, 28, 43, 23, + 23, 19, 52, 32, 32, 32, 23, 50, 51, 50, + 19, 27, 29, 31, 24, 34, 13, 28, 52, 53, + 18, 18, 18, 40, 25, 42, 43, 43, 43, 51, + 28, 30, 43, 45, 46, 48, 48, 19, 43, 19, + 37, 18, 36, 24, 24, 43, 34, 34, 34, 24, + 35, 44, 34, 33, 28, 30, 49, 18, 43, 43, + 43, 20, 43, 25, 33, 33, 33, 44, 43, 37 + }; + + #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) + # define YYSIZE_T __SIZE_TYPE__ + #endif + #if ! defined (YYSIZE_T) && defined (size_t) + # define YYSIZE_T size_t + #endif + #if ! defined (YYSIZE_T) + # if defined (__STDC__) || defined (__cplusplus) + # include /* INFRINGES ON USER NAME SPACE */ + # define YYSIZE_T size_t + # endif + #endif + #if ! defined (YYSIZE_T) + # define YYSIZE_T unsigned int + #endif + + #define yyerrok (yyerrstatus = 0) + #define yyclearin (yychar = YYEMPTY) + #define YYEMPTY (-2) + #define YYEOF 0 + + #define YYACCEPT goto yyacceptlab + #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) \ + do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror ("syntax error: cannot back up");\ + YYERROR; \ + } \ + while (0) + + #define YYTERROR 1 + #define YYERRCODE 256 + + /* YYLLOC_DEFAULT -- Compute the default location (before the actions + are run). */ + + #ifndef YYLLOC_DEFAULT + # define YYLLOC_DEFAULT(Current, Rhs, N) \ + Current.first_line = Rhs[1].first_line; \ + Current.first_column = Rhs[1].first_column; \ + Current.last_line = Rhs[N].last_line; \ + Current.last_column = Rhs[N].last_column; + #endif + + /* YYLEX -- calling `yylex' with the right arguments. */ + + #ifdef YYLEX_PARAM + # define YYLEX yylex (YYLEX_PARAM) + #else + # define YYLEX yylex () + #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 (0) + + # define YYDSYMPRINT(Args) \ + do { \ + if (yydebug) \ + yysymprint Args; \ + } while (0) + + # define YYDSYMPRINTF(Title, Token, Value, Location) \ + do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yysymprint (stderr, \ + Token, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ + } while (0) + + /*------------------------------------------------------------------. + | yy_stack_print -- Print the state stack from its BOTTOM up to its | + | TOP (cinluded). | + `------------------------------------------------------------------*/ + + #if defined (__STDC__) || defined (__cplusplus) + static void + yy_stack_print (short *bottom, short *top) + #else + static void + yy_stack_print (bottom, top) + short *bottom; + short *top; + #endif + { + YYFPRINTF (stderr, "Stack now"); + for (/* Nothing. */; bottom <= top; ++bottom) + YYFPRINTF (stderr, " %d", *bottom); + YYFPRINTF (stderr, "\n"); + } + + # define YY_STACK_PRINT(Bottom, Top) \ + do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ + } while (0) + + + /*------------------------------------------------. + | Report that the YYRULE is going to be reduced. | + `------------------------------------------------*/ + + #if defined (__STDC__) || defined (__cplusplus) + static void + yy_reduce_print (int yyrule) + #else + static void + yy_reduce_print (yyrule) + int yyrule; + #endif + { + int yyi; + unsigned int yylineno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", + yyrule - 1, yylineno); + /* Print the symbols being reduced, and their result. */ + for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) + YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); + YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); + } + + # define YY_REDUCE_PRINT(Rule) \ + do { \ + if (yydebug) \ + yy_reduce_print (Rule); \ + } while (0) + + /* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ + int yydebug; + #else /* !YYDEBUG */ + # define YYDPRINTF(Args) + # define YYDSYMPRINT(Args) + # define YYDSYMPRINTF(Title, Token, Value, Location) + # define YY_STACK_PRINT(Bottom, Top) + # define YY_REDUCE_PRINT(Rule) + #endif /* !YYDEBUG */ + + + /* YYINITDEPTH -- initial size of the parser's stacks. */ + #ifndef YYINITDEPTH + # define YYINITDEPTH 200 + #endif + + /* YYMAXDEPTH -- 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 + SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + + #if YYMAXDEPTH == 0 + # undef YYMAXDEPTH + #endif + + #ifndef YYMAXDEPTH + # define YYMAXDEPTH 10000 + #endif + + + + #if YYERROR_VERBOSE + + # ifndef yystrlen + # if defined (__GLIBC__) && defined (_STRING_H) + # define yystrlen strlen + # else + /* Return the length of YYSTR. */ + static YYSIZE_T + # if defined (__STDC__) || defined (__cplusplus) + yystrlen (const char *yystr) + # else + yystrlen (yystr) + const char *yystr; + # endif + { + register const char *yys = yystr; + + while (*yys++ != '\0') + continue; + + return yys - yystr - 1; + } + # 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. */ + static char * + # if defined (__STDC__) || defined (__cplusplus) + yystpcpy (char *yydest, const char *yysrc) + # else + yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; + # endif + { + register char *yyd = yydest; + register const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; + } + # endif + # endif + + #endif /* !YYERROR_VERBOSE */ + + + + #if YYDEBUG + /*--------------------------------. + | Print this symbol on YYOUTPUT. | + `--------------------------------*/ + + #if defined (__STDC__) || defined (__cplusplus) + static void + yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) + #else + static void + yysymprint (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE *yyvaluep; + #endif + { + /* Pacify ``unused variable'' warnings. */ + (void) yyvaluep; + + if (yytype < YYNTOKENS) + { + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + # ifdef YYPRINT + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); + # endif + } + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + switch (yytype) + { + default: + break; + } + YYFPRINTF (yyoutput, ")"); + } + + #endif /* ! YYDEBUG */ + /*-----------------------------------------------. + | Release the memory associated to this symbol. | + `-----------------------------------------------*/ + + #if defined (__STDC__) || defined (__cplusplus) + static void + yydestruct (int yytype, YYSTYPE *yyvaluep) + #else + static void + yydestruct (yytype, yyvaluep) + int yytype; + YYSTYPE *yyvaluep; + #endif + { + /* Pacify ``unused variable'' warnings. */ + (void) yyvaluep; + + switch (yytype) + { + + default: + break; + } + } + + + /* 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 lookahead symbol. */ + int yychar; + + /* The semantic value of the lookahead symbol. */ + YYSTYPE yylval; + + /* Number of syntax errors so far. */ + int yynerrs; + + + + /*----------. + | yyparse. | + `----------*/ + + #ifdef YYPARSE_PARAM + # if defined (__STDC__) || defined (__cplusplus) + int yyparse (void *YYPARSE_PARAM) + # else + int yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; + # endif + #else /* ! YYPARSE_PARAM */ + #if defined (__STDC__) || defined (__cplusplus) + int + yyparse (void) + #else + int + yyparse () + + #endif + #endif + { + + register int yystate; + register int yyn; + int yyresult; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Lookahead token as an internal (translated) token number. */ + int yytoken = 0; + + /* 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. */ + short yyssa[YYINITDEPTH]; + short *yyss = yyssa; + register short *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + register YYSTYPE *yyvsp; + + + + #define YYPOPSTACK (yyvsp--, yyssp--) + + YYSIZE_T yystacksize = YYINITDEPTH; + + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + + + /* When reducing, the number of symbols on the RHS of the reduced + rule. */ + int yylen; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + + yyssp = yyss; + yyvsp = yyvs; + + 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++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = 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; + short *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 ("parser stack overflow", + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } + #else /* no yyoverflow */ + # ifndef YYSTACK_RELOCATE + goto yyoverflowlab; + # else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyoverflowlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + short *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyoverflowlab; + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); + + # undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } + # endif + #endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + goto 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: */ + + /* First try to decide what to do without reference to lookahead token. */ + + yyn = yypact[yystate]; + if (yyn == YYPACT_NINF) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); + } + + /* 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) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yyn == 0 || yyn == YYTABLE_NINF) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + if (yyn == YYFINAL) + YYACCEPT; + + /* Shift the lookahead token. */ + YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); + + /* Discard the token being shifted unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + + *++yyvsp = yylval; + + + /* 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. | + `-----------------------------------------------------------*/ + yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + + /*-----------------------------. + | yyreduce -- Do a reduction. | + `-----------------------------*/ + yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* 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) + { + case 2: + #line 223 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + yyval.Rec = Records.getClass(*yyvsp[0].StrVal); + if (yyval.Rec == 0) { + err() << "Couldn't find class '" << *yyvsp[0].StrVal << "'!\n"; + exit(1); + } + delete yyvsp[0].StrVal; + ;} + break; + + case 3: + #line 234 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { // string type + yyval.Ty = new StringRecTy(); + ;} + break; + + case 4: + #line 236 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { // bit type + yyval.Ty = new BitRecTy(); + ;} + break; + + case 5: + #line 238 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { // bits type + yyval.Ty = new BitsRecTy(yyvsp[-1].IntVal); + ;} + break; + + case 6: + #line 240 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { // int type + yyval.Ty = new IntRecTy(); + ;} + break; + + case 7: + #line 242 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { // list type + yyval.Ty = new ListRecTy(yyvsp[-1].Ty); + ;} + break; + + case 8: + #line 244 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { // code type + yyval.Ty = new CodeRecTy(); + ;} + break; + + case 9: + #line 246 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { // dag type + yyval.Ty = new DagRecTy(); + ;} + break; + + case 10: + #line 248 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { // Record Type + yyval.Ty = new RecordRecTy(yyvsp[0].Rec); + ;} + break; + + case 11: + #line 252 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { yyval.IntVal = 0; ;} + break; + + case 12: + #line 252 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { yyval.IntVal = 1; ;} + break; + + case 13: + #line 254 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { yyval.Initializer = 0; ;} + break; + + case 14: + #line 254 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { yyval.Initializer = yyvsp[0].Initializer; ;} + break; + + case 15: + #line 256 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + yyval.Initializer = new IntInit(yyvsp[0].IntVal); + ;} + break; + + case 16: + #line 258 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + yyval.Initializer = new StringInit(*yyvsp[0].StrVal); + delete yyvsp[0].StrVal; + ;} + break; + + case 17: + #line 261 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + yyval.Initializer = new CodeInit(*yyvsp[0].StrVal); + delete yyvsp[0].StrVal; + ;} + break; + + case 18: + #line 264 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + yyval.Initializer = new UnsetInit(); + ;} + break; + + case 19: + #line 266 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + BitsInit *Init = new BitsInit(yyvsp[-1].FieldList->size()); + for (unsigned i = 0, e = yyvsp[-1].FieldList->size(); i != e; ++i) { + struct Init *Bit = (*yyvsp[-1].FieldList)[i]->convertInitializerTo(new BitRecTy()); + if (Bit == 0) { + err() << "Element #" << i << " (" << *(*yyvsp[-1].FieldList)[i] + << ") is not convertable to a bit!\n"; + exit(1); + } + Init->setBit(yyvsp[-1].FieldList->size()-i-1, Bit); + } + yyval.Initializer = Init; + delete yyvsp[-1].FieldList; + ;} + break; + + case 20: + #line 279 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + // This is a CLASS expression. This is supposed to synthesize + // a new anonymous definition, deriving from CLASS with no + // body. + Record *Class = Records.getClass(*yyvsp[-3].StrVal); + if (!Class) { + err() << "Expected a class, got '" << *yyvsp[-3].StrVal << "'!\n"; + exit(1); + } + delete yyvsp[-3].StrVal; + + static unsigned AnonCounter = 0; + Record *OldRec = CurRec; // Save CurRec. + + // Create the new record, set it as CurRec temporarily. + CurRec = new Record("anonymous.val."+utostr(AnonCounter++)); + addSubClass(Class, *yyvsp[-1].FieldList); // Add info about the subclass to CurRec. + delete yyvsp[-1].FieldList; // Free up the template args. + + CurRec->resolveReferences(); + + Records.addDef(CurRec); + + // The result of the expression is a reference to the new record. + yyval.Initializer = new DefInit(CurRec); + + // Restore the old CurRec + CurRec = OldRec; + ;} + break; + + case 21: + #line 307 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + if (const RecordVal *RV = (CurRec ? CurRec->getValue(*yyvsp[0].StrVal) : 0)) { + yyval.Initializer = new VarInit(*yyvsp[0].StrVal, RV->getType()); + } else if (CurRec && CurRec->isTemplateArg(CurRec->getName()+":"+*yyvsp[0].StrVal)) { + const RecordVal *RV = CurRec->getValue(CurRec->getName()+":"+*yyvsp[0].StrVal); + assert(RV && "Template arg doesn't exist??"); + yyval.Initializer = new VarInit(CurRec->getName()+":"+*yyvsp[0].StrVal, RV->getType()); + } else if (Record *D = Records.getDef(*yyvsp[0].StrVal)) { + yyval.Initializer = new DefInit(D); + } else { + err() << "Variable not defined: '" << *yyvsp[0].StrVal << "'!\n"; + exit(1); + } + + delete yyvsp[0].StrVal; + ;} + break; + + case 22: + #line 322 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + yyval.Initializer = yyvsp[-3].Initializer->convertInitializerBitRange(*yyvsp[-1].BitList); + if (yyval.Initializer == 0) { + err() << "Invalid bit range for value '" << *yyvsp[-3].Initializer << "'!\n"; + exit(1); + } + delete yyvsp[-1].BitList; + ;} + break; + + case 23: + #line 329 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + yyval.Initializer = new ListInit(*yyvsp[-1].FieldList); + delete yyvsp[-1].FieldList; + ;} + break; + + case 24: + #line 332 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + if (!yyvsp[-2].Initializer->getFieldType(*yyvsp[0].StrVal)) { + err() << "Cannot access field '" << *yyvsp[0].StrVal << "' of value '" << *yyvsp[-2].Initializer << "!\n"; + exit(1); + } + yyval.Initializer = new FieldInit(yyvsp[-2].Initializer, *yyvsp[0].StrVal); + delete yyvsp[0].StrVal; + ;} + break; + + case 25: + #line 339 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + Record *D = Records.getDef(*yyvsp[-2].StrVal); + if (D == 0) { + err() << "Invalid def '" << *yyvsp[-2].StrVal << "'!\n"; + exit(1); + } + yyval.Initializer = new DagInit(D, *yyvsp[-1].DagValueList); + delete yyvsp[-2].StrVal; delete yyvsp[-1].DagValueList; + ;} + break; + + case 26: + #line 347 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + std::reverse(yyvsp[-1].BitList->begin(), yyvsp[-1].BitList->end()); + yyval.Initializer = yyvsp[-3].Initializer->convertInitListSlice(*yyvsp[-1].BitList); + if (yyval.Initializer == 0) { + err() << "Invalid list slice for value '" << *yyvsp[-3].Initializer << "'!\n"; + exit(1); + } + delete yyvsp[-1].BitList; + ;} + break; + + case 27: + #line 355 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + yyval.Initializer = yyvsp[-3].Initializer->getBinaryOp(Init::SHL, yyvsp[-1].Initializer); + if (yyval.Initializer == 0) { + err() << "Cannot shift values '" << *yyvsp[-3].Initializer << "' and '" << *yyvsp[-1].Initializer << "'!\n"; + exit(1); + } + ;} + break; + + case 28: + #line 361 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + yyval.Initializer = yyvsp[-3].Initializer->getBinaryOp(Init::SRA, yyvsp[-1].Initializer); + if (yyval.Initializer == 0) { + err() << "Cannot shift values '" << *yyvsp[-3].Initializer << "' and '" << *yyvsp[-1].Initializer << "'!\n"; + exit(1); + } + ;} + break; + + case 29: + #line 367 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + yyval.Initializer = yyvsp[-3].Initializer->getBinaryOp(Init::SRL, yyvsp[-1].Initializer); + if (yyval.Initializer == 0) { + err() << "Cannot shift values '" << *yyvsp[-3].Initializer << "' and '" << *yyvsp[-1].Initializer << "'!\n"; + exit(1); + } + ;} + break; + + case 30: + #line 375 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + yyval.StrVal = new std::string(); + ;} + break; + + case 31: + #line 378 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + yyval.StrVal = yyvsp[0].StrVal; + ;} + break; + + case 32: + #line 382 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + yyval.DagValueList = new std::vector >(); + yyval.DagValueList->push_back(std::make_pair(yyvsp[-1].Initializer, *yyvsp[0].StrVal)); + delete yyvsp[0].StrVal; + ;} + break; + + case 33: + #line 387 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + yyvsp[-3].DagValueList->push_back(std::make_pair(yyvsp[-1].Initializer, *yyvsp[0].StrVal)); + delete yyvsp[0].StrVal; + yyval.DagValueList = yyvsp[-3].DagValueList; + ;} + break; + + case 34: + #line 393 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + yyval.DagValueList = new std::vector >(); + ;} + break; + + case 35: + #line 396 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { yyval.DagValueList = yyvsp[0].DagValueList; ;} + break; + + case 36: + #line 399 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + yyval.BitList = new std::vector(); + yyval.BitList->push_back(yyvsp[0].IntVal); + ;} + break; + + case 37: + #line 402 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + if (yyvsp[-2].IntVal < 0 || yyvsp[0].IntVal < 0) { + err() << "Invalid range: " << yyvsp[-2].IntVal << "-" << yyvsp[0].IntVal << "!\n"; + exit(1); + } + yyval.BitList = new std::vector(); + if (yyvsp[-2].IntVal < yyvsp[0].IntVal) { + for (int i = yyvsp[-2].IntVal; i <= yyvsp[0].IntVal; ++i) + yyval.BitList->push_back(i); + } else { + for (int i = yyvsp[-2].IntVal; i >= yyvsp[0].IntVal; --i) + yyval.BitList->push_back(i); + } + ;} + break; + + case 38: + #line 415 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + yyvsp[0].IntVal = -yyvsp[0].IntVal; + if (yyvsp[-1].IntVal < 0 || yyvsp[0].IntVal < 0) { + err() << "Invalid range: " << yyvsp[-1].IntVal << "-" << yyvsp[0].IntVal << "!\n"; + exit(1); + } + yyval.BitList = new std::vector(); + if (yyvsp[-1].IntVal < yyvsp[0].IntVal) { + for (int i = yyvsp[-1].IntVal; i <= yyvsp[0].IntVal; ++i) + yyval.BitList->push_back(i); + } else { + for (int i = yyvsp[-1].IntVal; i >= yyvsp[0].IntVal; --i) + yyval.BitList->push_back(i); + } + ;} + break; + + case 39: + #line 429 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + (yyval.BitList=yyvsp[-2].BitList)->push_back(yyvsp[0].IntVal); + ;} + break; + + case 40: + #line 431 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + if (yyvsp[-2].IntVal < 0 || yyvsp[0].IntVal < 0) { + err() << "Invalid range: " << yyvsp[-2].IntVal << "-" << yyvsp[0].IntVal << "!\n"; + exit(1); + } + yyval.BitList = yyvsp[-4].BitList; + if (yyvsp[-2].IntVal < yyvsp[0].IntVal) { + for (int i = yyvsp[-2].IntVal; i <= yyvsp[0].IntVal; ++i) + yyval.BitList->push_back(i); + } else { + for (int i = yyvsp[-2].IntVal; i >= yyvsp[0].IntVal; --i) + yyval.BitList->push_back(i); + } + ;} + break; + + case 41: + #line 444 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + yyvsp[0].IntVal = -yyvsp[0].IntVal; + if (yyvsp[-1].IntVal < 0 || yyvsp[0].IntVal < 0) { + err() << "Invalid range: " << yyvsp[-1].IntVal << "-" << yyvsp[0].IntVal << "!\n"; + exit(1); + } + yyval.BitList = yyvsp[-3].BitList; + if (yyvsp[-1].IntVal < yyvsp[0].IntVal) { + for (int i = yyvsp[-1].IntVal; i <= yyvsp[0].IntVal; ++i) + yyval.BitList->push_back(i); + } else { + for (int i = yyvsp[-1].IntVal; i >= yyvsp[0].IntVal; --i) + yyval.BitList->push_back(i); + } + ;} + break; + + case 42: + #line 460 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { yyval.BitList = yyvsp[0].BitList; std::reverse(yyvsp[0].BitList->begin(), yyvsp[0].BitList->end()); ;} + break; + + case 43: + #line 462 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { yyval.BitList = 0; ;} + break; + + case 44: + #line 462 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { yyval.BitList = yyvsp[-1].BitList; ;} + break; + + case 45: + #line 466 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + yyval.FieldList = new std::vector(); + ;} + break; + + case 46: + #line 468 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + yyval.FieldList = yyvsp[0].FieldList; + ;} + break; + + case 47: + #line 472 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + yyval.FieldList = new std::vector(); + yyval.FieldList->push_back(yyvsp[0].Initializer); + ;} + break; + + case 48: + #line 475 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + (yyval.FieldList = yyvsp[-2].FieldList)->push_back(yyvsp[0].Initializer); + ;} + break; + + case 49: + #line 479 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + std::string DecName = *yyvsp[-1].StrVal; + if (ParsingTemplateArgs) + DecName = CurRec->getName() + ":" + DecName; + + addValue(RecordVal(DecName, yyvsp[-2].Ty, yyvsp[-3].IntVal)); + setValue(DecName, 0, yyvsp[0].Initializer); + yyval.StrVal = new std::string(DecName); + ;} + break; + + case 50: + #line 489 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + delete yyvsp[-1].StrVal; + ;} + break; + + case 51: + #line 491 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + setValue(*yyvsp[-4].StrVal, yyvsp[-3].BitList, yyvsp[-1].Initializer); + delete yyvsp[-4].StrVal; + delete yyvsp[-3].BitList; + ;} + break; + + case 56: + #line 500 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + yyval.SubClassRef = new SubClassRefTy(yyvsp[0].Rec, new std::vector()); + ;} + break; + + case 57: + #line 502 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + yyval.SubClassRef = new SubClassRefTy(yyvsp[-3].Rec, yyvsp[-1].FieldList); + ;} + break; + + case 58: + #line 506 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + yyval.SubClassList = new std::vector(); + yyval.SubClassList->push_back(*yyvsp[0].SubClassRef); + delete yyvsp[0].SubClassRef; + ;} + break; + + case 59: + #line 511 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + (yyval.SubClassList=yyvsp[-2].SubClassList)->push_back(*yyvsp[0].SubClassRef); + delete yyvsp[0].SubClassRef; + ;} + break; + + case 60: + #line 516 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + yyval.SubClassList = new std::vector(); + ;} + break; + + case 61: + #line 519 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + yyval.SubClassList = yyvsp[0].SubClassList; + ;} + break; + + case 62: + #line 523 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + CurRec->addTemplateArg(*yyvsp[0].StrVal); + delete yyvsp[0].StrVal; + ;} + break; + + case 63: + #line 526 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + CurRec->addTemplateArg(*yyvsp[0].StrVal); + delete yyvsp[0].StrVal; + ;} + break; + + case 64: + #line 531 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + {;} + break; + + case 67: + #line 534 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { yyval.StrVal = yyvsp[0].StrVal; ;} + break; + + case 68: + #line 534 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { yyval.StrVal = new std::string(); ;} + break; + + case 69: + #line 536 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + static unsigned AnonCounter = 0; + if (yyvsp[0].StrVal->empty()) + *yyvsp[0].StrVal = "anonymous."+utostr(AnonCounter++); + yyval.StrVal = yyvsp[0].StrVal; + ;} + break; + + case 70: + #line 543 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + // If a class of this name already exists, it must be a forward ref. + if ((CurRec = Records.getClass(*yyvsp[0].StrVal))) { + // If the body was previously defined, this is an error. + if (!CurRec->getValues().empty() || + !CurRec->getSuperClasses().empty() || + !CurRec->getTemplateArgs().empty()) { + err() << "Class '" << CurRec->getName() << "' already defined!\n"; + exit(1); + } + } else { + // If this is the first reference to this class, create and add it. + CurRec = new Record(*yyvsp[0].StrVal); + Records.addClass(CurRec); + } + delete yyvsp[0].StrVal; + ;} + break; + + case 71: + #line 561 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + CurRec = new Record(*yyvsp[0].StrVal); + delete yyvsp[0].StrVal; + + // Ensure redefinition doesn't happen. + if (Records.getDef(CurRec->getName())) { + err() << "Def '" << CurRec->getName() << "' already defined!\n"; + exit(1); + } + Records.addDef(CurRec); + ;} + break; + + case 72: + #line 573 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + for (unsigned i = 0, e = yyvsp[0].SubClassList->size(); i != e; ++i) { + addSubClass((*yyvsp[0].SubClassList)[i].first, *(*yyvsp[0].SubClassList)[i].second); + // Delete the template arg values for the class + delete (*yyvsp[0].SubClassList)[i].second; + } + delete yyvsp[0].SubClassList; // Delete the class list... + + // Process any variables on the set stack... + for (unsigned i = 0, e = LetStack.size(); i != e; ++i) + for (unsigned j = 0, e = LetStack[i].size(); j != e; ++j) + setValue(LetStack[i][j].Name, + LetStack[i][j].HasBits ? &LetStack[i][j].Bits : 0, + LetStack[i][j].Value); + ;} + break; + + case 73: + #line 587 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + yyval.Rec = CurRec; + CurRec = 0; + ;} + break; + + case 74: + #line 592 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + ParsingTemplateArgs = true; + ;} + break; + + case 75: + #line 594 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + ParsingTemplateArgs = false; + ;} + break; + + case 76: + #line 596 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + yyval.Rec = yyvsp[0].Rec; + ;} + break; + + case 77: + #line 600 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + yyvsp[0].Rec->resolveReferences(); + + // If ObjectBody has template arguments, it's an error. + assert(yyvsp[0].Rec->getTemplateArgs().empty() && "How'd this get template args?"); + yyval.Rec = yyvsp[0].Rec; + ;} + break; + + case 80: + #line 611 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + LetStack.back().push_back(LetRecord(*yyvsp[-3].StrVal, yyvsp[-2].BitList, yyvsp[0].Initializer)); + delete yyvsp[-3].StrVal; delete yyvsp[-2].BitList; + ;} + break; + + case 83: + #line 619 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { LetStack.push_back(std::vector()); ;} + break; + + case 85: + #line 622 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + LetStack.pop_back(); + ;} + break; + + case 86: + #line 625 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + { + LetStack.pop_back(); + ;} + break; + + case 87: + #line 629 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + {;} + break; + + case 88: + #line 629 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + {;} + break; + + case 89: + #line 631 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + {;} + break; + + + } + + /* Line 999 of yacc.c. */ + #line 2056 "FileParser.tab.c" + + yyvsp -= yylen; + yyssp -= yylen; + + + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + + /* 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 = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + + /*------------------------------------. + | yyerrlab -- here on detecting error | + `------------------------------------*/ + yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; + #if YYERROR_VERBOSE + yyn = yypact[yystate]; + + if (YYPACT_NINF < yyn && yyn < YYLAST) + { + YYSIZE_T yysize = 0; + int yytype = YYTRANSLATE (yychar); + char *yymsg; + int yyx, yycount; + + yycount = 0; + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + for (yyx = yyn < 0 ? -yyn : 0; + yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + yysize += yystrlen (yytname[yyx]) + 15, yycount++; + yysize += yystrlen ("syntax error, unexpected ") + 1; + yysize += yystrlen (yytname[yytype]); + yymsg = (char *) YYSTACK_ALLOC (yysize); + if (yymsg != 0) + { + char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); + yyp = yystpcpy (yyp, yytname[yytype]); + + if (yycount < 5) + { + yycount = 0; + for (yyx = yyn < 0 ? -yyn : 0; + yyx < (int) (sizeof (yytname) / sizeof (char *)); + yyx++) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + const char *yyq = ! yycount ? ", expecting " : " or "; + yyp = yystpcpy (yyp, yyq); + yyp = yystpcpy (yyp, yytname[yyx]); + yycount++; + } + } + yyerror (yymsg); + YYSTACK_FREE (yymsg); + } + else + yyerror ("syntax error; also virtual memory exhausted"); + } + else + #endif /* YYERROR_VERBOSE */ + yyerror ("syntax error"); + } + + + + 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) + { + /* Pop the error token. */ + YYPOPSTACK; + /* Pop the rest of the stack. */ + while (yyss < yyssp) + { + YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); + yydestruct (yystos[*yyssp], yyvsp); + YYPOPSTACK; + } + YYABORT; + } + + YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); + yydestruct (yytoken, &yylval); + yychar = YYEMPTY; + + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + + /*----------------------------------------------------. + | yyerrlab1 -- error raised explicitly by an action. | + `----------------------------------------------------*/ + yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); + yydestruct (yystos[yystate], yyvsp); + yyvsp--; + yystate = *--yyssp; + + YY_STACK_PRINT (yyss, yyssp); + } + + if (yyn == YYFINAL) + YYACCEPT; + + YYDPRINTF ((stderr, "Shifting error token, ")); + + *++yyvsp = yylval; + + + yystate = yyn; + goto yynewstate; + + + /*-------------------------------------. + | yyacceptlab -- YYACCEPT comes here. | + `-------------------------------------*/ + yyacceptlab: + yyresult = 0; + goto yyreturn; + + /*-----------------------------------. + | yyabortlab -- YYABORT comes here. | + `-----------------------------------*/ + yyabortlab: + yyresult = 1; + goto yyreturn; + + #ifndef yyoverflow + /*----------------------------------------------. + | yyoverflowlab -- parser overflow comes here. | + `----------------------------------------------*/ + yyoverflowlab: + yyerror ("parser stack overflow"); + yyresult = 2; + /* Fall through. */ + #endif + + yyreturn: + #ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); + #endif + return yyresult; + } + + + #line 633 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + + + int yyerror(const char *ErrorMsg) { + err() << "Error parsing: " << ErrorMsg << "\n"; + exit(1); + } + Index: llvm/utils/TableGen/FileParser.h.cvs diff -c /dev/null llvm/utils/TableGen/FileParser.h.cvs:1.1 *** /dev/null Wed Feb 15 01:24:13 2006 --- llvm/utils/TableGen/FileParser.h.cvs Wed Feb 15 01:24:01 2006 *************** *** 0 **** --- 1,102 ---- + /* A Bison parser, made by GNU Bison 1.875. */ + + /* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 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., 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. */ + + /* Tokens. */ + #ifndef YYTOKENTYPE + # define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + INT = 258, + BIT = 259, + STRING = 260, + BITS = 261, + LIST = 262, + CODE = 263, + DAG = 264, + CLASS = 265, + DEF = 266, + FIELD = 267, + LET = 268, + IN = 269, + SHLTOK = 270, + SRATOK = 271, + SRLTOK = 272, + INTVAL = 273, + ID = 274, + VARNAME = 275, + STRVAL = 276, + CODEFRAGMENT = 277 + }; + #endif + #define INT 258 + #define BIT 259 + #define STRING 260 + #define BITS 261 + #define LIST 262 + #define CODE 263 + #define DAG 264 + #define CLASS 265 + #define DEF 266 + #define FIELD 267 + #define LET 268 + #define IN 269 + #define SHLTOK 270 + #define SRATOK 271 + #define SRLTOK 272 + #define INTVAL 273 + #define ID 274 + #define VARNAME 275 + #define STRVAL 276 + #define CODEFRAGMENT 277 + + + + + #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) + #line 189 "/home/vadve/criswell/llvm/utils/TableGen/FileParser.y" + typedef union YYSTYPE { + std::string* StrVal; + int IntVal; + llvm::RecTy* Ty; + llvm::Init* Initializer; + std::vector* FieldList; + std::vector* BitList; + llvm::Record* Rec; + SubClassRefTy* SubClassRef; + std::vector* SubClassList; + std::vector >* DagValueList; + } YYSTYPE; + /* Line 1240 of yacc.c. */ + #line 93 "FileParser.tab.h" + # define yystype YYSTYPE /* obsolescent; will be withdrawn */ + # define YYSTYPE_IS_DECLARED 1 + # define YYSTYPE_IS_TRIVIAL 1 + #endif + + extern YYSTYPE Filelval; + + + Index: llvm/utils/TableGen/FileParser.y.cvs diff -c /dev/null llvm/utils/TableGen/FileParser.y.cvs:1.1 *** /dev/null Wed Feb 15 01:24:13 2006 --- llvm/utils/TableGen/FileParser.y.cvs Wed Feb 15 01:24:01 2006 *************** *** 0 **** --- 1,638 ---- + //===-- FileParser.y - Parser for TableGen files ----------------*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by the LLVM research group and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file implements the bison parser for Table Generator files... + // + //===----------------------------------------------------------------------===// + + %{ + #include "Record.h" + #include "llvm/ADT/StringExtras.h" + #include + #include + #define YYERROR_VERBOSE 1 + + int yyerror(const char *ErrorMsg); + int yylex(); + + namespace llvm { + + extern int Filelineno; + static Record *CurRec = 0; + static bool ParsingTemplateArgs = false; + + typedef std::pair*> SubClassRefTy; + + struct LetRecord { + std::string Name; + std::vector Bits; + Init *Value; + bool HasBits; + LetRecord(const std::string &N, std::vector *B, Init *V) + : Name(N), Value(V), HasBits(B != 0) { + if (HasBits) Bits = *B; + } + }; + + static std::vector > LetStack; + + + extern std::ostream &err(); + + static void addValue(const RecordVal &RV) { + if (RecordVal *ERV = CurRec->getValue(RV.getName())) { + // The value already exists in the class, treat this as a set... + if (ERV->setValue(RV.getValue())) { + err() << "New definition of '" << RV.getName() << "' of type '" + << *RV.getType() << "' is incompatible with previous " + << "definition of type '" << *ERV->getType() << "'!\n"; + exit(1); + } + } else { + CurRec->addValue(RV); + } + } + + static void addSuperClass(Record *SC) { + if (CurRec->isSubClassOf(SC)) { + err() << "Already subclass of '" << SC->getName() << "'!\n"; + exit(1); + } + CurRec->addSuperClass(SC); + } + + static void setValue(const std::string &ValName, + std::vector *BitList, Init *V) { + if (!V) return; + + RecordVal *RV = CurRec->getValue(ValName); + if (RV == 0) { + err() << "Value '" << ValName << "' unknown!\n"; + exit(1); + } + + // Do not allow assignments like 'X = X'. This will just cause infinite loops + // in the resolution machinery. + if (!BitList) + if (VarInit *VI = dynamic_cast(V)) + if (VI->getName() == ValName) + return; + + // If we are assigning to a subset of the bits in the value... then we must be + // assigning to a field of BitsRecTy, which must have a BitsInit + // initializer... + // + if (BitList) { + BitsInit *CurVal = dynamic_cast(RV->getValue()); + if (CurVal == 0) { + err() << "Value '" << ValName << "' is not a bits type!\n"; + exit(1); + } + + // Convert the incoming value to a bits type of the appropriate size... + Init *BI = V->convertInitializerTo(new BitsRecTy(BitList->size())); + if (BI == 0) { + V->convertInitializerTo(new BitsRecTy(BitList->size())); + err() << "Initializer '" << *V << "' not compatible with bit range!\n"; + exit(1); + } + + // We should have a BitsInit type now... + assert(dynamic_cast(BI) != 0 || &(std::cerr << *BI) == 0); + BitsInit *BInit = (BitsInit*)BI; + + BitsInit *NewVal = new BitsInit(CurVal->getNumBits()); + + // Loop over bits, assigning values as appropriate... + for (unsigned i = 0, e = BitList->size(); i != e; ++i) { + unsigned Bit = (*BitList)[i]; + if (NewVal->getBit(Bit)) { + err() << "Cannot set bit #" << Bit << " of value '" << ValName + << "' more than once!\n"; + exit(1); + } + NewVal->setBit(Bit, BInit->getBit(i)); + } + + for (unsigned i = 0, e = CurVal->getNumBits(); i != e; ++i) + if (NewVal->getBit(i) == 0) + NewVal->setBit(i, CurVal->getBit(i)); + + V = NewVal; + } + + if (RV->setValue(V)) { + err() << "Value '" << ValName << "' of type '" << *RV->getType() + << "' is incompatible with initializer '" << *V << "'!\n"; + exit(1); + } + } + + // addSubClass - Add SC as a subclass to CurRec, resolving TemplateArgs as SC's + // template arguments. + static void addSubClass(Record *SC, const std::vector &TemplateArgs) { + // Add all of the values in the subclass into the current class... + const std::vector &Vals = SC->getValues(); + for (unsigned i = 0, e = Vals.size(); i != e; ++i) + addValue(Vals[i]); + + const std::vector &TArgs = SC->getTemplateArgs(); + + // Ensure that an appropriate number of template arguments are specified... + if (TArgs.size() < TemplateArgs.size()) { + err() << "ERROR: More template args specified than expected!\n"; + exit(1); + } else { // This class expects template arguments... + // Loop over all of the template arguments, setting them to the specified + // value or leaving them as the default if necessary. + for (unsigned i = 0, e = TArgs.size(); i != e; ++i) { + if (i < TemplateArgs.size()) { // A value is specified for this temp-arg? + // Set it now. + setValue(TArgs[i], 0, TemplateArgs[i]); + + // Resolve it next. + CurRec->resolveReferencesTo(CurRec->getValue(TArgs[i])); + + + // Now remove it. + CurRec->removeValue(TArgs[i]); + + } else if (!CurRec->getValue(TArgs[i])->getValue()->isComplete()) { + err() << "ERROR: Value not specified for template argument #" + << i << " (" << TArgs[i] << ") of subclass '" << SC->getName() + << "'!\n"; + exit(1); + } + } + } + + // Since everything went well, we can now set the "superclass" list for the + // current record. + const std::vector &SCs = SC->getSuperClasses(); + for (unsigned i = 0, e = SCs.size(); i != e; ++i) + addSuperClass(SCs[i]); + addSuperClass(SC); + } + + } // End llvm namespace + + using namespace llvm; + + %} + + %union { + std::string* StrVal; + int IntVal; + llvm::RecTy* Ty; + llvm::Init* Initializer; + std::vector* FieldList; + std::vector* BitList; + llvm::Record* Rec; + SubClassRefTy* SubClassRef; + std::vector* SubClassList; + std::vector >* DagValueList; + }; + + %token INT BIT STRING BITS LIST CODE DAG CLASS DEF FIELD LET IN + %token SHLTOK SRATOK SRLTOK + %token INTVAL + %token ID VARNAME STRVAL CODEFRAGMENT + + %type Type + %type ClassInst DefInst Object ObjectBody ClassID + + %type SubClassRef + %type ClassList ClassListNE + %type OptPrefix + %type Value OptValue + %type DagArgList DagArgListNE + %type ValueList ValueListNE + %type BitList OptBitList RBitList + %type Declaration OptID OptVarName ObjectName + + %start File + + %% + + ClassID : ID { + $$ = Records.getClass(*$1); + if ($$ == 0) { + err() << "Couldn't find class '" << *$1 << "'!\n"; + exit(1); + } + delete $1; + }; + + + // TableGen types... + Type : STRING { // string type + $$ = new StringRecTy(); + } | BIT { // bit type + $$ = new BitRecTy(); + } | BITS '<' INTVAL '>' { // bits type + $$ = new BitsRecTy($3); + } | INT { // int type + $$ = new IntRecTy(); + } | LIST '<' Type '>' { // list type + $$ = new ListRecTy($3); + } | CODE { // code type + $$ = new CodeRecTy(); + } | DAG { // dag type + $$ = new DagRecTy(); + } | ClassID { // Record Type + $$ = new RecordRecTy($1); + }; + + OptPrefix : /*empty*/ { $$ = 0; } | FIELD { $$ = 1; }; + + OptValue : /*empty*/ { $$ = 0; } | '=' Value { $$ = $2; }; + + Value : INTVAL { + $$ = new IntInit($1); + } | STRVAL { + $$ = new StringInit(*$1); + delete $1; + } | CODEFRAGMENT { + $$ = new CodeInit(*$1); + delete $1; + } | '?' { + $$ = new UnsetInit(); + } | '{' ValueList '}' { + BitsInit *Init = new BitsInit($2->size()); + for (unsigned i = 0, e = $2->size(); i != e; ++i) { + struct Init *Bit = (*$2)[i]->convertInitializerTo(new BitRecTy()); + if (Bit == 0) { + err() << "Element #" << i << " (" << *(*$2)[i] + << ") is not convertable to a bit!\n"; + exit(1); + } + Init->setBit($2->size()-i-1, Bit); + } + $$ = Init; + delete $2; + } | ID '<' ValueListNE '>' { + // This is a CLASS expression. This is supposed to synthesize + // a new anonymous definition, deriving from CLASS with no + // body. + Record *Class = Records.getClass(*$1); + if (!Class) { + err() << "Expected a class, got '" << *$1 << "'!\n"; + exit(1); + } + delete $1; + + static unsigned AnonCounter = 0; + Record *OldRec = CurRec; // Save CurRec. + + // Create the new record, set it as CurRec temporarily. + CurRec = new Record("anonymous.val."+utostr(AnonCounter++)); + addSubClass(Class, *$3); // Add info about the subclass to CurRec. + delete $3; // Free up the template args. + + CurRec->resolveReferences(); + + Records.addDef(CurRec); + + // The result of the expression is a reference to the new record. + $$ = new DefInit(CurRec); + + // Restore the old CurRec + CurRec = OldRec; + } | ID { + if (const RecordVal *RV = (CurRec ? CurRec->getValue(*$1) : 0)) { + $$ = new VarInit(*$1, RV->getType()); + } else if (CurRec && CurRec->isTemplateArg(CurRec->getName()+":"+*$1)) { + const RecordVal *RV = CurRec->getValue(CurRec->getName()+":"+*$1); + assert(RV && "Template arg doesn't exist??"); + $$ = new VarInit(CurRec->getName()+":"+*$1, RV->getType()); + } else if (Record *D = Records.getDef(*$1)) { + $$ = new DefInit(D); + } else { + err() << "Variable not defined: '" << *$1 << "'!\n"; + exit(1); + } + + delete $1; + } | Value '{' BitList '}' { + $$ = $1->convertInitializerBitRange(*$3); + if ($$ == 0) { + err() << "Invalid bit range for value '" << *$1 << "'!\n"; + exit(1); + } + delete $3; + } | '[' ValueList ']' { + $$ = new ListInit(*$2); + delete $2; + } | Value '.' ID { + if (!$1->getFieldType(*$3)) { + err() << "Cannot access field '" << *$3 << "' of value '" << *$1 << "!\n"; + exit(1); + } + $$ = new FieldInit($1, *$3); + delete $3; + } | '(' ID DagArgList ')' { + Record *D = Records.getDef(*$2); + if (D == 0) { + err() << "Invalid def '" << *$2 << "'!\n"; + exit(1); + } + $$ = new DagInit(D, *$3); + delete $2; delete $3; + } | Value '[' BitList ']' { + std::reverse($3->begin(), $3->end()); + $$ = $1->convertInitListSlice(*$3); + if ($$ == 0) { + err() << "Invalid list slice for value '" << *$1 << "'!\n"; + exit(1); + } + delete $3; + } | SHLTOK '(' Value ',' Value ')' { + $$ = $3->getBinaryOp(Init::SHL, $5); + if ($$ == 0) { + err() << "Cannot shift values '" << *$3 << "' and '" << *$5 << "'!\n"; + exit(1); + } + } | SRATOK '(' Value ',' Value ')' { + $$ = $3->getBinaryOp(Init::SRA, $5); + if ($$ == 0) { + err() << "Cannot shift values '" << *$3 << "' and '" << *$5 << "'!\n"; + exit(1); + } + } | SRLTOK '(' Value ',' Value ')' { + $$ = $3->getBinaryOp(Init::SRL, $5); + if ($$ == 0) { + err() << "Cannot shift values '" << *$3 << "' and '" << *$5 << "'!\n"; + exit(1); + } + }; + + OptVarName : /* empty */ { + $$ = new std::string(); + } + | ':' VARNAME { + $$ = $2; + }; + + DagArgListNE : Value OptVarName { + $$ = new std::vector >(); + $$->push_back(std::make_pair($1, *$2)); + delete $2; + } + | DagArgListNE ',' Value OptVarName { + $1->push_back(std::make_pair($3, *$4)); + delete $4; + $$ = $1; + }; + + DagArgList : /*empty*/ { + $$ = new std::vector >(); + } + | DagArgListNE { $$ = $1; }; + + + RBitList : INTVAL { + $$ = new std::vector(); + $$->push_back($1); + } | INTVAL '-' INTVAL { + if ($1 < 0 || $3 < 0) { + err() << "Invalid range: " << $1 << "-" << $3 << "!\n"; + exit(1); + } + $$ = new std::vector(); + if ($1 < $3) { + for (int i = $1; i <= $3; ++i) + $$->push_back(i); + } else { + for (int i = $1; i >= $3; --i) + $$->push_back(i); + } + } | INTVAL INTVAL { + $2 = -$2; + if ($1 < 0 || $2 < 0) { + err() << "Invalid range: " << $1 << "-" << $2 << "!\n"; + exit(1); + } + $$ = new std::vector(); + if ($1 < $2) { + for (int i = $1; i <= $2; ++i) + $$->push_back(i); + } else { + for (int i = $1; i >= $2; --i) + $$->push_back(i); + } + } | RBitList ',' INTVAL { + ($$=$1)->push_back($3); + } | RBitList ',' INTVAL '-' INTVAL { + if ($3 < 0 || $5 < 0) { + err() << "Invalid range: " << $3 << "-" << $5 << "!\n"; + exit(1); + } + $$ = $1; + if ($3 < $5) { + for (int i = $3; i <= $5; ++i) + $$->push_back(i); + } else { + for (int i = $3; i >= $5; --i) + $$->push_back(i); + } + } | RBitList ',' INTVAL INTVAL { + $4 = -$4; + if ($3 < 0 || $4 < 0) { + err() << "Invalid range: " << $3 << "-" << $4 << "!\n"; + exit(1); + } + $$ = $1; + if ($3 < $4) { + for (int i = $3; i <= $4; ++i) + $$->push_back(i); + } else { + for (int i = $3; i >= $4; --i) + $$->push_back(i); + } + }; + + BitList : RBitList { $$ = $1; std::reverse($1->begin(), $1->end()); }; + + OptBitList : /*empty*/ { $$ = 0; } | '{' BitList '}' { $$ = $2; }; + + + + ValueList : /*empty*/ { + $$ = new std::vector(); + } | ValueListNE { + $$ = $1; + }; + + ValueListNE : Value { + $$ = new std::vector(); + $$->push_back($1); + } | ValueListNE ',' Value { + ($$ = $1)->push_back($3); + }; + + Declaration : OptPrefix Type ID OptValue { + std::string DecName = *$3; + if (ParsingTemplateArgs) + DecName = CurRec->getName() + ":" + DecName; + + addValue(RecordVal(DecName, $2, $1)); + setValue(DecName, 0, $4); + $$ = new std::string(DecName); + }; + + BodyItem : Declaration ';' { + delete $1; + } | LET ID OptBitList '=' Value ';' { + setValue(*$2, $3, $5); + delete $2; + delete $3; + }; + + BodyList : /*empty*/ | BodyList BodyItem; + Body : ';' | '{' BodyList '}'; + + SubClassRef : ClassID { + $$ = new SubClassRefTy($1, new std::vector()); + } | ClassID '<' ValueListNE '>' { + $$ = new SubClassRefTy($1, $3); + }; + + ClassListNE : SubClassRef { + $$ = new std::vector(); + $$->push_back(*$1); + delete $1; + } + | ClassListNE ',' SubClassRef { + ($$=$1)->push_back(*$3); + delete $3; + }; + + ClassList : /*empty */ { + $$ = new std::vector(); + } + | ':' ClassListNE { + $$ = $2; + }; + + DeclListNE : Declaration { + CurRec->addTemplateArg(*$1); + delete $1; + } | DeclListNE ',' Declaration { + CurRec->addTemplateArg(*$3); + delete $3; + }; + + TemplateArgList : '<' DeclListNE '>' {}; + OptTemplateArgList : /*empty*/ | TemplateArgList; + + OptID : ID { $$ = $1; } | /*empty*/ { $$ = new std::string(); }; + + ObjectName : OptID { + static unsigned AnonCounter = 0; + if ($1->empty()) + *$1 = "anonymous."+utostr(AnonCounter++); + $$ = $1; + }; + + ClassName : ObjectName { + // If a class of this name already exists, it must be a forward ref. + if ((CurRec = Records.getClass(*$1))) { + // If the body was previously defined, this is an error. + if (!CurRec->getValues().empty() || + !CurRec->getSuperClasses().empty() || + !CurRec->getTemplateArgs().empty()) { + err() << "Class '" << CurRec->getName() << "' already defined!\n"; + exit(1); + } + } else { + // If this is the first reference to this class, create and add it. + CurRec = new Record(*$1); + Records.addClass(CurRec); + } + delete $1; + }; + + DefName : ObjectName { + CurRec = new Record(*$1); + delete $1; + + // Ensure redefinition doesn't happen. + if (Records.getDef(CurRec->getName())) { + err() << "Def '" << CurRec->getName() << "' already defined!\n"; + exit(1); + } + Records.addDef(CurRec); + }; + + ObjectBody : ClassList { + for (unsigned i = 0, e = $1->size(); i != e; ++i) { + addSubClass((*$1)[i].first, *(*$1)[i].second); + // Delete the template arg values for the class + delete (*$1)[i].second; + } + delete $1; // Delete the class list... + + // Process any variables on the set stack... + for (unsigned i = 0, e = LetStack.size(); i != e; ++i) + for (unsigned j = 0, e = LetStack[i].size(); j != e; ++j) + setValue(LetStack[i][j].Name, + LetStack[i][j].HasBits ? &LetStack[i][j].Bits : 0, + LetStack[i][j].Value); + } Body { + $$ = CurRec; + CurRec = 0; + }; + + ClassInst : CLASS ClassName { + ParsingTemplateArgs = true; + } OptTemplateArgList { + ParsingTemplateArgs = false; + } ObjectBody { + $$ = $6; + }; + + DefInst : DEF DefName ObjectBody { + $3->resolveReferences(); + + // If ObjectBody has template arguments, it's an error. + assert($3->getTemplateArgs().empty() && "How'd this get template args?"); + $$ = $3; + }; + + + Object : ClassInst | DefInst; + + LETItem : ID OptBitList '=' Value { + LetStack.back().push_back(LetRecord(*$1, $2, $4)); + delete $1; delete $2; + }; + + LETList : LETItem | LETList ',' LETItem; + + // LETCommand - A 'LET' statement start... + LETCommand : LET { LetStack.push_back(std::vector()); } LETList IN; + + // Support Set commands wrapping objects... both with and without braces. + Object : LETCommand '{' ObjectList '}' { + LetStack.pop_back(); + } + | LETCommand Object { + LetStack.pop_back(); + }; + + ObjectList : Object {} | ObjectList Object {}; + + File : ObjectList {}; + + %% + + int yyerror(const char *ErrorMsg) { + err() << "Error parsing: " << ErrorMsg << "\n"; + exit(1); + } Index: llvm/utils/TableGen/FileLexer.cpp.cvs diff -u llvm/utils/TableGen/FileLexer.cpp.cvs:1.1 llvm/utils/TableGen/FileLexer.cpp.cvs:1.2 --- llvm/utils/TableGen/FileLexer.cpp.cvs:1.1 Mon Feb 13 23:13:13 2006 +++ llvm/utils/TableGen/FileLexer.cpp.cvs Wed Feb 15 01:24:01 2006 @@ -21,7 +21,7 @@ /* A lexical scanner generated by flex */ /* Scanner skeleton version: - * $Header: /home/vadve/shared/PublicCVS/llvm/utils/TableGen/FileLexer.cpp.cvs,v 1.1 2006/02/14 05:13:13 lattner Exp $ + * $Header: /home/vadve/shared/PublicCVS/llvm/utils/TableGen/FileLexer.cpp.cvs,v 1.2 2006/02/15 07:24:01 lattner Exp $ */ #define FLEX_SCANNER From lattner at cs.uiuc.edu Wed Feb 15 01:26:19 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 15 Feb 2006 01:26:19 -0600 Subject: [llvm-commits] CVS: llvm/projects/Stacker/lib/compiler/Lexer.cpp.cvs Lexer.l.cvs StackerParser.cpp.cvs StackerParser.h.cvs StackerParser.y.cvs Lexer.cpp StackerParser.cpp StackerParser.h Message-ID: <200602150726.BAA18695@zion.cs.uiuc.edu> Changes in directory llvm/projects/Stacker/lib/compiler: Lexer.cpp.cvs added (r1.1) Lexer.l.cvs added (r1.1) StackerParser.cpp.cvs added (r1.1) StackerParser.h.cvs added (r1.1) StackerParser.y.cvs added (r1.1) Lexer.cpp (r1.1) removed StackerParser.cpp (r1.1) removed StackerParser.h (r1.1) removed --- Log message: Convert over to the new way of handling lex/bison checked into cvs --- Diffs of the changes: (+4726 -0) Lexer.cpp.cvs | 2195 ++++++++++++++++++++++++++++++++++++++++++++++++++ Lexer.l.cvs | 234 +++++ StackerParser.cpp.cvs | 1909 +++++++++++++++++++++++++++++++++++++++++++ StackerParser.h.cvs | 203 ++++ StackerParser.y.cvs | 185 ++++ 5 files changed, 4726 insertions(+) Index: llvm/projects/Stacker/lib/compiler/Lexer.cpp.cvs diff -c /dev/null llvm/projects/Stacker/lib/compiler/Lexer.cpp.cvs:1.1 *** /dev/null Wed Feb 15 01:26:17 2006 --- llvm/projects/Stacker/lib/compiler/Lexer.cpp.cvs Wed Feb 15 01:26:07 2006 *************** *** 0 **** --- 1,2195 ---- + #define yy_create_buffer Stacker_create_buffer + #define yy_delete_buffer Stacker_delete_buffer + #define yy_scan_buffer Stacker_scan_buffer + #define yy_scan_string Stacker_scan_string + #define yy_scan_bytes Stacker_scan_bytes + #define yy_flex_debug Stacker_flex_debug + #define yy_init_buffer Stacker_init_buffer + #define yy_flush_buffer Stacker_flush_buffer + #define yy_load_buffer_state Stacker_load_buffer_state + #define yy_switch_to_buffer Stacker_switch_to_buffer + #define yyin Stackerin + #define yyleng Stackerleng + #define yylex Stackerlex + #define yyout Stackerout + #define yyrestart Stackerrestart + #define yytext Stackertext + #define yylineno Stackerlineno + + #line 20 "Lexer.cpp" + /* A lexical scanner generated by flex */ + + /* Scanner skeleton version: + * $Header: /home/vadve/shared/PublicCVS/llvm/projects/Stacker/lib/compiler/Lexer.cpp.cvs,v 1.1 2006/02/15 07:26:07 lattner Exp $ + */ + + #define FLEX_SCANNER + #define YY_FLEX_MAJOR_VERSION 2 + #define YY_FLEX_MINOR_VERSION 5 + + #include + #include + + + /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ + #ifdef c_plusplus + #ifndef __cplusplus + #define __cplusplus + #endif + #endif + + + #ifdef __cplusplus + + #include + + /* Use prototypes in function declarations. */ + #define YY_USE_PROTOS + + /* The "const" storage-class-modifier is valid. */ + #define YY_USE_CONST + + #else /* ! __cplusplus */ + + #if __STDC__ + + #define YY_USE_PROTOS + #define YY_USE_CONST + + #endif /* __STDC__ */ + #endif /* ! __cplusplus */ + + #ifdef __TURBOC__ + #pragma warn -rch + #pragma warn -use + #include + #include + #define YY_USE_CONST + #define YY_USE_PROTOS + #endif + + #ifdef YY_USE_CONST + #define yyconst const + #else + #define yyconst + #endif + + + #ifdef YY_USE_PROTOS + #define YY_PROTO(proto) proto + #else + #define YY_PROTO(proto) () + #endif + + /* Returned upon end-of-file. */ + #define YY_NULL 0 + + /* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ + #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + + /* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ + #define BEGIN yy_start = 1 + 2 * + + /* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ + #define YY_START ((yy_start - 1) / 2) + #define YYSTATE YY_START + + /* Action number for EOF rule of a given start state. */ + #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + + /* Special action meaning "start processing a new file". */ + #define YY_NEW_FILE yyrestart( yyin ) + + #define YY_END_OF_BUFFER_CHAR 0 + + /* Size of default input buffer. */ + #define YY_BUF_SIZE (16384*64) + + typedef struct yy_buffer_state *YY_BUFFER_STATE; + + extern int yyleng; + extern FILE *yyin, *yyout; + + #define EOB_ACT_CONTINUE_SCAN 0 + #define EOB_ACT_END_OF_FILE 1 + #define EOB_ACT_LAST_MATCH 2 + + /* The funky do-while in the following #define is used to turn the definition + * int a single C statement (which needs a semi-colon terminator). This + * avoids problems with code like: + * + * if ( condition_holds ) + * yyless( 5 ); + * else + * do_something_else(); + * + * Prior to using the do-while the compiler would get upset at the + * "else" because it interpreted the "if" statement as being all + * done when it reached the ';' after the yyless() call. + */ + + /* Return all but the first 'n' matched characters back to the input stream. */ + + #define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + *yy_cp = yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ + yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + + #define unput(c) yyunput( c, yytext_ptr ) + + /* The following is because we cannot portably get our hands on size_t + * (without autoconf's help, which isn't available because we want + * flex-generated scanners to compile on their own). + */ + typedef unsigned int yy_size_t; + + + struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + #define YY_BUFFER_NEW 0 + #define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ + #define YY_BUFFER_EOF_PENDING 2 + }; + + static YY_BUFFER_STATE yy_current_buffer = 0; + + /* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + */ + #define YY_CURRENT_BUFFER yy_current_buffer + + + /* yy_hold_char holds the character lost when yytext is formed. */ + static char yy_hold_char; + + static int yy_n_chars; /* number of characters read into yy_ch_buf */ + + + int yyleng; + + /* Points to current character in buffer. */ + static char *yy_c_buf_p = (char *) 0; + static int yy_init = 1; /* whether we need to initialize */ + static int yy_start = 0; /* start state number */ + + /* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ + static int yy_did_buffer_switch_on_eof; + + void yyrestart YY_PROTO(( FILE *input_file )); + + void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); + void yy_load_buffer_state YY_PROTO(( void )); + YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); + void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); + void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); + void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); + #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) + + YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); + YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); + YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); + + static void *yy_flex_alloc YY_PROTO(( yy_size_t )); + static inline void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); + static void yy_flex_free YY_PROTO(( void * )); + + #define yy_new_buffer yy_create_buffer + + #define yy_set_interactive(is_interactive) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_is_interactive = is_interactive; \ + } + + #define yy_set_bol(at_bol) \ + { \ + if ( ! yy_current_buffer ) \ + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ + yy_current_buffer->yy_at_bol = at_bol; \ + } + + #define YY_AT_BOL() (yy_current_buffer->yy_at_bol) + + + #define YY_USES_REJECT + + #define yywrap() 1 + #define YY_SKIP_YYWRAP + typedef unsigned char YY_CHAR; + FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; + typedef int yy_state_type; + extern int yylineno; + int yylineno = 1; + extern char *yytext; + #define yytext_ptr yytext + + static yy_state_type yy_get_previous_state YY_PROTO(( void )); + static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); + static int yy_get_next_buffer YY_PROTO(( void )); + static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); + + /* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ + #define YY_DO_BEFORE_ACTION \ + yytext_ptr = yy_bp; \ + yyleng = (int) (yy_cp - yy_bp); \ + yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yy_c_buf_p = yy_cp; + + #define YY_NUM_RULES 89 + #define YY_END_OF_BUFFER 90 + static yyconst short int yy_acclist[266] = + { 0, + 90, 89, 88, 89, 89, 89, 89, 89, 25, 89, + 21, 89, 22, 89, 26, 89, 83, 89, 83, 89, + 3, 89, 4, 89, 9, 89, 19, 89, 11, 89, + 87, 89, 87, 89, 87, 89, 87, 89, 87, 89, + 87, 89, 87, 89, 87, 89, 87, 89, 87, 89, + 87, 89, 87, 89, 87, 89, 87, 89, 87, 89, + 87, 89, 87, 89, 87, 89, 81, 86, 1, 2, + 32, 23, 83, 24, 84, 36, 13, 17, 75, 74, + 73, 82, 15, 37, 78, 77, 76, 87, 87, 87, + 72, 87, 87, 87, 87, 87, 20, 87, 87, 87, + + 87, 87, 16, 87, 12, 87, 61, 87, 14, 87, + 10, 87, 87, 87, 87, 18, 87, 87, 87, 7, + 87, 34, 87, 87, 87, 87, 87, 87, 87, 87, + 87, 87, 87, 87, 87, 87, 87, 85, 29, 87, + 33, 87, 87, 87, 40, 87, 87, 65, 87, 87, + 87, 87, 87, 59, 87, 87, 87, 31, 87, 30, + 87, 27, 87, 28, 87, 39, 87, 8, 87, 87, + 87, 60, 87, 87, 87, 87, 45, 87, 87, 87, + 87, 87, 70, 87, 87, 87, 87, 35, 87, 38, + 87, 80, 87, 51, 87, 62, 87, 87, 68, 87, + + 87, 87, 58, 87, 79, 87, 87, 50, 87, 42, + 87, 43, 87, 87, 87, 47, 87, 55, 87, 46, + 87, 87, 87, 41, 87, 5, 87, 48, 87, 87, + 49, 87, 63, 87, 6, 87, 87, 87, 53, 87, + 87, 87, 56, 87, 87, 71, 87, 52, 87, 54, + 87, 64, 87, 87, 57, 87, 87, 67, 87, 44, + 87, 69, 87, 66, 87 + } ; + + static yyconst short int yy_accept[189] = + { 0, + 1, 1, 1, 2, 3, 5, 6, 7, 8, 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, 68, + 68, 69, 69, 70, 70, 71, 72, 73, 74, 75, + 76, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 93, 94, 95, + 96, 97, 99, 100, 101, 102, 103, 105, 107, 109, + 111, 113, 114, 115, 116, 118, 119, 120, 122, 124, + 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, + + 135, 136, 137, 138, 139, 141, 143, 144, 145, 147, + 148, 150, 151, 152, 153, 154, 156, 157, 158, 160, + 162, 164, 166, 168, 170, 171, 172, 174, 175, 176, + 177, 179, 180, 181, 182, 183, 185, 186, 187, 188, + 190, 192, 194, 196, 198, 199, 201, 202, 203, 205, + 207, 208, 210, 212, 214, 215, 216, 218, 220, 222, + 223, 224, 226, 228, 230, 231, 233, 235, 237, 238, + 239, 241, 242, 243, 245, 246, 248, 250, 252, 254, + 255, 257, 258, 260, 262, 264, 266, 266 + } ; + + static yyconst int yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 4, 5, 6, 1, 1, 1, 1, 7, + 8, 9, 10, 1, 11, 1, 12, 13, 14, 15, + 14, 14, 14, 14, 14, 14, 14, 16, 17, 18, + 19, 20, 1, 1, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 30, 30, + 1, 1, 1, 1, 45, 1, 46, 46, 47, 48, + + 46, 46, 30, 30, 30, 30, 30, 30, 30, 30, + 30, 30, 30, 30, 49, 30, 30, 30, 30, 50, + 30, 30, 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, 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 + } ; + + static yyconst int yy_meta[51] = + { 0, + 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, + 3, 1, 4, 4, 4, 1, 1, 1, 1, 1, + 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 4, 4, 4, 3, 3 + } ; + + static yyconst short int yy_base[193] = + { 0, + 0, 0, 228, 229, 229, 208, 221, 222, 216, 211, + 41, 46, 229, 49, 52, 229, 229, 53, 203, 33, + 36, 0, 183, 36, 51, 54, 44, 194, 51, 58, + 61, 70, 65, 72, 73, 82, 191, 183, 229, 212, + 229, 213, 229, 207, 206, 229, 229, 100, 229, 104, + 0, 229, 229, 229, 229, 229, 229, 229, 229, 229, + 229, 229, 229, 0, 174, 188, 0, 176, 88, 171, + 185, 0, 179, 175, 168, 180, 164, 0, 0, 0, + 0, 93, 169, 178, 174, 164, 173, 0, 0, 173, + 174, 156, 88, 94, 160, 162, 172, 171, 169, 149, + + 166, 159, 149, 0, 0, 0, 150, 149, 169, 158, + 153, 141, 141, 136, 153, 0, 143, 144, 0, 0, + 0, 0, 160, 0, 136, 142, 0, 131, 130, 138, + 154, 128, 142, 143, 129, 0, 139, 132, 130, 0, + 146, 0, 0, 0, 134, 0, 134, 137, 0, 0, + 122, 0, 141, 0, 117, 116, 0, 0, 138, 129, + 122, 121, 0, 120, 108, 0, 0, 0, 94, 108, + 0, 91, 95, 0, 87, 0, 0, 0, 0, 81, + 0, 53, 0, 0, 0, 0, 229, 137, 141, 145, + 147, 64 + + } ; + + static yyconst short int yy_def[193] = + { 0, + 187, 1, 187, 187, 187, 187, 188, 189, 190, 187, + 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, + 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, + 191, 191, 191, 191, 191, 191, 191, 191, 187, 188, + 187, 189, 187, 190, 190, 187, 187, 187, 187, 187, + 192, 187, 187, 187, 187, 187, 187, 187, 187, 187, + 187, 187, 187, 191, 191, 191, 191, 191, 191, 191, + 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, + 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, + 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, + + 191, 191, 191, 192, 191, 191, 191, 191, 191, 191, + 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, + 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, + 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, + 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, + 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, + 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, + 191, 191, 191, 191, 191, 191, 191, 191, 191, 191, + 191, 191, 191, 191, 191, 191, 0, 187, 187, 187, + 187, 187 + + } ; + + static yyconst short int yy_nxt[280] = + { 0, + 4, 5, 5, 6, 7, 8, 9, 4, 10, 11, + 12, 13, 14, 15, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 22, 28, 22, + 22, 29, 30, 31, 32, 33, 22, 34, 35, 36, + 22, 22, 37, 38, 4, 22, 22, 22, 22, 22, + 47, 59, 60, 48, 48, 48, 49, 65, 50, 50, + 50, 48, 48, 48, 48, 48, 48, 104, 77, 66, + 52, 53, 54, 68, 74, 80, 69, 186, 82, 61, + 62, 63, 70, 78, 71, 85, 83, 72, 75, 86, + 81, 76, 84, 91, 73, 87, 93, 96, 51, 55, + + 56, 57, 99, 88, 185, 92, 94, 89, 97, 95, + 128, 90, 48, 48, 48, 98, 50, 50, 50, 100, + 108, 117, 101, 109, 118, 130, 184, 129, 183, 182, + 181, 180, 179, 131, 178, 177, 119, 40, 40, 40, + 40, 42, 42, 42, 42, 44, 176, 44, 44, 64, + 64, 175, 174, 173, 172, 171, 170, 169, 168, 167, + 166, 165, 164, 163, 162, 161, 160, 159, 158, 157, + 156, 155, 154, 153, 152, 151, 150, 149, 148, 147, + 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, + 136, 135, 134, 133, 132, 127, 126, 125, 124, 123, + + 122, 121, 120, 116, 115, 114, 113, 112, 111, 110, + 107, 106, 105, 45, 45, 43, 41, 103, 102, 79, + 67, 58, 46, 45, 43, 41, 39, 187, 3, 187, + 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, + 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, + 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, + 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, + 187, 187, 187, 187, 187, 187, 187, 187, 187 + } ; + + static yyconst short int yy_chk[280] = + { 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, + 11, 20, 20, 11, 11, 11, 12, 21, 12, 12, + 12, 14, 14, 14, 15, 15, 15, 192, 27, 21, + 18, 18, 18, 24, 26, 29, 24, 182, 30, 20, + 20, 20, 25, 27, 25, 31, 30, 25, 26, 31, + 29, 26, 30, 33, 25, 32, 34, 35, 14, 18, + + 18, 18, 36, 32, 180, 33, 34, 32, 35, 34, + 93, 32, 48, 48, 48, 35, 50, 50, 50, 36, + 69, 82, 36, 69, 82, 94, 175, 93, 173, 172, + 170, 169, 165, 94, 164, 162, 82, 188, 188, 188, + 188, 189, 189, 189, 189, 190, 161, 190, 190, 191, + 191, 160, 159, 156, 155, 153, 151, 148, 147, 145, + 141, 139, 138, 137, 135, 134, 133, 132, 131, 130, + 129, 128, 126, 125, 123, 118, 117, 115, 114, 113, + 112, 111, 110, 109, 108, 107, 103, 102, 101, 100, + 99, 98, 97, 96, 95, 92, 91, 90, 87, 86, + + 85, 84, 83, 77, 76, 75, 74, 73, 71, 70, + 68, 66, 65, 45, 44, 42, 40, 38, 37, 28, + 23, 19, 10, 9, 8, 7, 6, 3, 187, 187, + 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, + 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, + 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, + 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, + 187, 187, 187, 187, 187, 187, 187, 187, 187 + } ; + + static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr; + static char *yy_full_match; + static int yy_lp; + #define REJECT \ + { \ + *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \ + yy_cp = yy_full_match; /* restore poss. backed-over text */ \ + ++yy_lp; \ + goto find_rule; \ + } + #define yymore() yymore_used_but_not_detected + #define YY_MORE_ADJ 0 + #define YY_RESTORE_YY_MORE_OFFSET + char *yytext; + #line 1 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + #define INITIAL 0 + /*===-- Lexer.l - Scanner for Stacker language -----------------*- C++ -*--===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and donated to the LLVM research + // group and is distributed under the University of Illinois Open Source + // License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file implements the flex scanner for Stacker languages files. + // + //===----------------------------------------------------------------------===*/ + #define YY_NEVER_INTERACTIVE 1 + #line 29 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + + #include "StackerCompiler.h" + #include "StackerParser.h" + + /* Conversion of text ints to binary */ + static int64_t IntToVal(const char *Buffer) { + int64_t Result = 0; + for (; *Buffer; Buffer++) { + int64_t OldRes = Result; + Result *= 10; + Result += *Buffer-'0'; + if (Result < OldRes) // Uh, oh, overflow detected!!! + StackerCompiler::ThrowException("constant bigger than 64 bits detected!"); + } + return Result; + } + + /* Conversion of text hexadecimal ints to binary */ + static int64_t HexIntToVal(const char *Buffer) { + int64_t Result = 0; + for (; *Buffer; ++Buffer) { + int64_t OldRes = Result; + Result *= 16; + char C = *Buffer; + if (C >= '0' && C <= '9') + Result += C-'0'; + else if (C >= 'A' && C <= 'F') + Result += C-'A'+10; + else if (C >= 'a' && C <= 'f') + Result += C-'a'+10; + + if (Result < OldRes) // Uh, oh, overflow detected!!! + StackerCompiler::ThrowException("constant bigger than 64 bits detected!"); + } + return Result; + } + + #define YY_NEVER_INTERACTIVE 1 + /* Comments start with a ; and go till end of line */ + /* You can also embed them in ( ... ) */ + /* We ignore white space */ + /* jdentifiers start with a % sign */ + /* Strings can contain any character except " and \ */ + /* Positive and negative integer constants*/ + /* Special Characters - name them to avoid flex confusion */ + #line 608 "Lexer.cpp" + + /* Macros after this point can all be overridden by user definitions in + * section 1. + */ + + #ifndef YY_SKIP_YYWRAP + #ifdef __cplusplus + extern "C" int yywrap YY_PROTO(( void )); + #else + extern int yywrap YY_PROTO(( void )); + #endif + #endif + + #ifndef YY_NO_UNPUT + static inline void yyunput YY_PROTO(( int c, char *buf_ptr )); + #endif + + #ifndef yytext_ptr + static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); + #endif + + #ifdef YY_NEED_STRLEN + static int yy_flex_strlen YY_PROTO(( yyconst char * )); + #endif + + #ifndef YY_NO_INPUT + #ifdef __cplusplus + static int yyinput YY_PROTO(( void )); + #else + static int input YY_PROTO(( void )); + #endif + #endif + + #if YY_STACK_USED + static int yy_start_stack_ptr = 0; + static int yy_start_stack_depth = 0; + static int *yy_start_stack = 0; + #ifndef YY_NO_PUSH_STATE + static void yy_push_state YY_PROTO(( int new_state )); + #endif + #ifndef YY_NO_POP_STATE + static void yy_pop_state YY_PROTO(( void )); + #endif + #ifndef YY_NO_TOP_STATE + static int yy_top_state YY_PROTO(( void )); + #endif + + #else + #define YY_NO_PUSH_STATE 1 + #define YY_NO_POP_STATE 1 + #define YY_NO_TOP_STATE 1 + #endif + + #ifdef YY_MALLOC_DECL + YY_MALLOC_DECL + #else + #if __STDC__ + #ifndef __cplusplus + #include + #endif + #else + /* Just try to get by without declaring the routines. This will fail + * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) + * or sizeof(void*) != sizeof(int). + */ + #endif + #endif + + /* Amount of stuff to slurp up with each read. */ + #ifndef YY_READ_BUF_SIZE + #define YY_READ_BUF_SIZE 8192 + #endif + + /* Copy whatever the last rule matched to the standard output. */ + + #ifndef ECHO + /* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ + #define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) + #endif + + /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ + #ifndef YY_INPUT + #define YY_INPUT(buf,result,max_size) \ + if ( yy_current_buffer->yy_is_interactive ) \ + { \ + int c = '*', n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ + && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); + #endif + + /* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ + #ifndef yyterminate + #define yyterminate() return YY_NULL + #endif + + /* Number of entries by which start-condition stack grows. */ + #ifndef YY_START_STACK_INCR + #define YY_START_STACK_INCR 25 + #endif + + /* Report a fatal error. */ + #ifndef YY_FATAL_ERROR + #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) + #endif + + /* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ + #ifndef YY_DECL + #define YY_DECL int yylex YY_PROTO(( void )) + #endif + + /* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ + #ifndef YY_USER_ACTION + #define YY_USER_ACTION + #endif + + /* Code executed at the end of each rule. */ + #ifndef YY_BREAK + #define YY_BREAK break; + #endif + + #define YY_RULE_SETUP \ + YY_USER_ACTION + + YY_DECL + { + register yy_state_type yy_current_state; + register char *yy_cp = NULL, *yy_bp = NULL; + register int yy_act; + + #line 112 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + + + #line 762 "Lexer.cpp" + + if ( yy_init ) + { + yy_init = 0; + + #ifdef YY_USER_INIT + YY_USER_INIT; + #endif + + if ( ! yy_start ) + yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! yy_current_buffer ) + yy_current_buffer = + yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_load_buffer_state(); + } + + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = yy_start; + yy_state_ptr = yy_state_buf; + *yy_state_ptr++ = yy_current_state; + yy_match: + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 188 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + *yy_state_ptr++ = yy_current_state; + ++yy_cp; + } + while ( yy_current_state != 187 ); + + yy_find_action: + yy_current_state = *--yy_state_ptr; + yy_lp = yy_accept[yy_current_state]; + find_rule: /* we branch to this label when backing up */ + for ( ; ; ) /* until we find what rule we matched */ + { + if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] ) + { + yy_act = yy_acclist[yy_lp]; + { + yy_full_match = yy_cp; + break; + } + } + --yy_cp; + yy_current_state = *--yy_state_ptr; + yy_lp = yy_accept[yy_current_state]; + } + + YY_DO_BEFORE_ACTION; + + if ( yy_act != YY_END_OF_BUFFER ) + { + int yyl; + for ( yyl = 0; yyl < yyleng; ++yyl ) + if ( yytext[yyl] == '\n' ) + ++yylineno; + } + + do_action: /* This label is used only to access EOF actions. */ + + + switch ( yy_act ) + { /* beginning of action switch */ + case 1: + *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ + yy_c_buf_p = yy_cp -= 1; + YY_DO_BEFORE_ACTION; /* set up yytext again */ + YY_RULE_SETUP + #line 114 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { /* Ignore comments */ } + YY_BREAK + case 2: + YY_RULE_SETUP + #line 115 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { /* Ignore comments */ } + YY_BREAK + case 3: + YY_RULE_SETUP + #line 117 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return COLON; } + YY_BREAK + case 4: + YY_RULE_SETUP + #line 118 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return SEMI; } + YY_BREAK + case 5: + YY_RULE_SETUP + #line 120 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return TRUETOK; } + YY_BREAK + case 6: + YY_RULE_SETUP + #line 121 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return FALSETOK; } + YY_BREAK + case 7: + YY_RULE_SETUP + #line 122 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return TRUETOK; } + YY_BREAK + case 8: + YY_RULE_SETUP + #line 123 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return FALSETOK; } + YY_BREAK + case 9: + YY_RULE_SETUP + #line 124 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return LESS; } + YY_BREAK + case 10: + YY_RULE_SETUP + #line 125 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return LESS; } + YY_BREAK + case 11: + YY_RULE_SETUP + #line 126 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return MORE; } + YY_BREAK + case 12: + YY_RULE_SETUP + #line 127 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return MORE; } + YY_BREAK + case 13: + YY_RULE_SETUP + #line 128 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return LESS_EQUAL; } + YY_BREAK + case 14: + YY_RULE_SETUP + #line 129 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return LESS_EQUAL; } + YY_BREAK + case 15: + YY_RULE_SETUP + #line 130 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return MORE_EQUAL; } + YY_BREAK + case 16: + YY_RULE_SETUP + #line 131 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return MORE_EQUAL; } + YY_BREAK + case 17: + YY_RULE_SETUP + #line 132 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return NOT_EQUAL; } + YY_BREAK + case 18: + YY_RULE_SETUP + #line 133 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return NOT_EQUAL; } + YY_BREAK + case 19: + YY_RULE_SETUP + #line 134 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return EQUAL; } + YY_BREAK + case 20: + YY_RULE_SETUP + #line 135 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return EQUAL; } + YY_BREAK + case 21: + YY_RULE_SETUP + #line 137 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return PLUS; } + YY_BREAK + case 22: + YY_RULE_SETUP + #line 138 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return MINUS; } + YY_BREAK + case 23: + YY_RULE_SETUP + #line 139 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return INCR; } + YY_BREAK + case 24: + YY_RULE_SETUP + #line 140 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return DECR; } + YY_BREAK + case 25: + YY_RULE_SETUP + #line 141 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return MULT; } + YY_BREAK + case 26: + YY_RULE_SETUP + #line 142 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return DIV; } + YY_BREAK + case 27: + YY_RULE_SETUP + #line 143 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return MODULUS; } + YY_BREAK + case 28: + YY_RULE_SETUP + #line 144 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return NEGATE; } + YY_BREAK + case 29: + YY_RULE_SETUP + #line 145 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return ABS; } + YY_BREAK + case 30: + YY_RULE_SETUP + #line 146 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return MIN; } + YY_BREAK + case 31: + YY_RULE_SETUP + #line 147 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return MAX; } + YY_BREAK + case 32: + YY_RULE_SETUP + #line 148 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return STAR_SLASH; } + YY_BREAK + case 33: + YY_RULE_SETUP + #line 150 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return AND; } + YY_BREAK + case 34: + YY_RULE_SETUP + #line 151 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return OR; } + YY_BREAK + case 35: + YY_RULE_SETUP + #line 152 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return XOR; } + YY_BREAK + case 36: + YY_RULE_SETUP + #line 153 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return LSHIFT; } + YY_BREAK + case 37: + YY_RULE_SETUP + #line 154 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return RSHIFT; } + YY_BREAK + case 38: + YY_RULE_SETUP + #line 156 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return DROP; } + YY_BREAK + case 39: + YY_RULE_SETUP + #line 157 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return NIP; } + YY_BREAK + case 40: + YY_RULE_SETUP + #line 158 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return DUP; } + YY_BREAK + case 41: + YY_RULE_SETUP + #line 159 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return SWAP; } + YY_BREAK + case 42: + YY_RULE_SETUP + #line 160 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return OVER; } + YY_BREAK + case 43: + YY_RULE_SETUP + #line 161 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return PICK; } + YY_BREAK + case 44: + YY_RULE_SETUP + #line 162 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return SELECT; } + YY_BREAK + case 45: + YY_RULE_SETUP + #line 163 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return ROT; } + YY_BREAK + case 46: + YY_RULE_SETUP + #line 164 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return RROT; } + YY_BREAK + case 47: + YY_RULE_SETUP + #line 165 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return ROLL; } + YY_BREAK + case 48: + YY_RULE_SETUP + #line 166 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return TUCK; } + YY_BREAK + case 49: + YY_RULE_SETUP + #line 167 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return DROP2; } + YY_BREAK + case 50: + YY_RULE_SETUP + #line 168 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return NIP2; } + YY_BREAK + case 51: + YY_RULE_SETUP + #line 169 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return DUP2; } + YY_BREAK + case 52: + YY_RULE_SETUP + #line 170 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return SWAP2; } + YY_BREAK + case 53: + YY_RULE_SETUP + #line 171 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return OVER2; } + YY_BREAK + case 54: + YY_RULE_SETUP + #line 172 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return TUCK2; } + YY_BREAK + case 55: + YY_RULE_SETUP + #line 173 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return ROT2; } + YY_BREAK + case 56: + YY_RULE_SETUP + #line 174 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return RROT2; } + YY_BREAK + case 57: + YY_RULE_SETUP + #line 176 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return MALLOC; } + YY_BREAK + case 58: + YY_RULE_SETUP + #line 177 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return FREE; } + YY_BREAK + case 59: + YY_RULE_SETUP + #line 178 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return GET; } + YY_BREAK + case 60: + YY_RULE_SETUP + #line 179 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return PUT; } + YY_BREAK + case 61: + YY_RULE_SETUP + #line 181 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return IF; } + YY_BREAK + case 62: + YY_RULE_SETUP + #line 182 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return ELSE; } + YY_BREAK + case 63: + YY_RULE_SETUP + #line 183 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return ENDIF; } + YY_BREAK + case 64: + YY_RULE_SETUP + #line 184 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return WHILE; } + YY_BREAK + case 65: + YY_RULE_SETUP + #line 185 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return END; } + YY_BREAK + case 66: + YY_RULE_SETUP + #line 187 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return RECURSE; } + YY_BREAK + case 67: + YY_RULE_SETUP + #line 188 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return RETURN; } + YY_BREAK + case 68: + YY_RULE_SETUP + #line 189 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return EXIT; } + YY_BREAK + case 69: + YY_RULE_SETUP + #line 190 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return FORWARD; } + YY_BREAK + case 70: + YY_RULE_SETUP + #line 191 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return TAB; } + YY_BREAK + case 71: + YY_RULE_SETUP + #line 192 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return SPACE; } + YY_BREAK + case 72: + YY_RULE_SETUP + #line 193 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return CR; } + YY_BREAK + case 73: + YY_RULE_SETUP + #line 195 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return IN_STR; } + YY_BREAK + case 74: + YY_RULE_SETUP + #line 196 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return IN_NUM; } + YY_BREAK + case 75: + YY_RULE_SETUP + #line 197 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return IN_CHAR; } + YY_BREAK + case 76: + YY_RULE_SETUP + #line 199 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return OUT_STR; } + YY_BREAK + case 77: + YY_RULE_SETUP + #line 200 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return OUT_NUM; } + YY_BREAK + case 78: + YY_RULE_SETUP + #line 201 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return OUT_CHAR; } + YY_BREAK + case 79: + YY_RULE_SETUP + #line 203 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return MAIN; } + YY_BREAK + case 80: + YY_RULE_SETUP + #line 205 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { return DUMP; } + YY_BREAK + case 81: + YY_RULE_SETUP + #line 207 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { StackerCompiler::ThrowException( + "You probably meant to use a <> instead of !=" ); } + YY_BREAK + case 82: + YY_RULE_SETUP + #line 210 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { StackerCompiler::ThrowException( + "You probably meant to use a single = .. this isn't C"); } + YY_BREAK + case 83: + YY_RULE_SETUP + #line 213 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { Stackerlval.IntegerVal = IntToVal(yytext); return INTEGER; } + YY_BREAK + case 84: + YY_RULE_SETUP + #line 214 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { uint64_t Val = IntToVal(yytext+1); + // +1: we have bigger negative range + if (Val > (uint64_t)INT64_MAX+1) + StackerCompiler::ThrowException( + "Constant too large for signed 64 bits!"); + Stackerlval.IntegerVal = -Val; + return INTEGER; + } + YY_BREAK + case 85: + YY_RULE_SETUP + #line 222 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { Stackerlval.IntegerVal = HexIntToVal(yytext+3); + return INTEGER; + } + YY_BREAK + case 86: + YY_RULE_SETUP + #line 226 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { yytext[strlen(yytext)-1] = 0; // nuke end quote + Stackerlval.StringVal = strdup(yytext+1); // Nuke start quote + return STRING; + } + YY_BREAK + case 87: + YY_RULE_SETUP + #line 231 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { Stackerlval.StringVal = strdup(yytext); return IDENTIFIER; } + YY_BREAK + case 88: + YY_RULE_SETUP + #line 233 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + { /* Ignore whitespace */ } + YY_BREAK + case 89: + YY_RULE_SETUP + #line 234 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + YY_FATAL_ERROR( "flex scanner jammed" ); + YY_BREAK + #line 1315 "Lexer.cpp" + case YY_STATE_EOF(INITIAL): + yyterminate(); + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yy_hold_char; + YY_RESTORE_YY_MORE_OFFSET + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between yy_current_buffer and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yy_n_chars = yy_current_buffer->yy_n_chars; + yy_current_buffer->yy_input_file = yyin; + yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = yytext_ptr + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = yy_c_buf_p; + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer() ) + { + case EOB_ACT_END_OF_FILE: + { + yy_did_buffer_switch_on_eof = 0; + + if ( yywrap() ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = + yytext_ptr + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + yy_c_buf_p = + &yy_current_buffer->yy_ch_buf[yy_n_chars]; + + yy_current_state = yy_get_previous_state(); + + yy_cp = yy_c_buf_p; + yy_bp = yytext_ptr + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of yylex */ + + + /* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ + + static int yy_get_next_buffer() + { + register char *dest = yy_current_buffer->yy_ch_buf; + register char *source = yytext_ptr; + register int number_to_move, i; + int ret_val; + + if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( yy_current_buffer->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + yy_current_buffer->yy_n_chars = yy_n_chars = 0; + + else + { + int num_to_read = + yy_current_buffer->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + #ifdef YY_USES_REJECT + YY_FATAL_ERROR( + "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); + #else + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = yy_current_buffer; + + int yy_c_buf_p_offset = + (int) (yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yy_flex_realloc( (void *) b->yy_ch_buf, + b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = yy_current_buffer->yy_buf_size - + number_to_move - 1; + #endif + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), + yy_n_chars, num_to_read ); + + yy_current_buffer->yy_n_chars = yy_n_chars; + } + + if ( yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart( yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + yy_current_buffer->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + yy_n_chars += number_to_move; + yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; + yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; + + return ret_val; + } + + + /* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state() + { + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = yy_start; + yy_state_ptr = yy_state_buf; + *yy_state_ptr++ = yy_current_state; + + for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 188 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + *yy_state_ptr++ = yy_current_state; + } + + return yy_current_state; + } + + + /* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + + #ifdef YY_USE_PROTOS + static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) + #else + static yy_state_type yy_try_NUL_trans( yy_current_state ) + yy_state_type yy_current_state; + #endif + { + register int yy_is_jam; + + register YY_CHAR yy_c = 1; + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 188 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 187); + if ( ! yy_is_jam ) + *yy_state_ptr++ = yy_current_state; + + return yy_is_jam ? 0 : yy_current_state; + } + + + #ifndef YY_NO_UNPUT + #ifdef YY_USE_PROTOS + static inline void yyunput( int c, register char *yy_bp ) + #else + static inline void yyunput( c, yy_bp ) + int c; + register char *yy_bp; + #endif + { + register char *yy_cp = yy_c_buf_p; + + /* undo effects of setting up yytext */ + *yy_cp = yy_hold_char; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = yy_n_chars + 2; + register char *dest = &yy_current_buffer->yy_ch_buf[ + yy_current_buffer->yy_buf_size + 2]; + register char *source = + &yy_current_buffer->yy_ch_buf[number_to_move]; + + while ( source > yy_current_buffer->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + yy_current_buffer->yy_n_chars = + yy_n_chars = yy_current_buffer->yy_buf_size; + + if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + if ( c == '\n' ) + --yylineno; + + yytext_ptr = yy_bp; + yy_hold_char = *yy_cp; + yy_c_buf_p = yy_cp; + } + #endif /* ifndef YY_NO_UNPUT */ + + + #ifndef YY_NO_INPUT + #ifdef __cplusplus + static int yyinput() + #else + static int input() + #endif + { + int c; + + *yy_c_buf_p = yy_hold_char; + + if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + /* This was really a NUL. */ + *yy_c_buf_p = '\0'; + + else + { /* need more input */ + int offset = yy_c_buf_p - yytext_ptr; + ++yy_c_buf_p; + + switch ( yy_get_next_buffer() ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart( yyin ); + + /* fall through */ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap() ) + return EOF; + + if ( ! yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + #ifdef __cplusplus + return yyinput(); + #else + return input(); + #endif + } + + case EOB_ACT_CONTINUE_SCAN: + yy_c_buf_p = yytext_ptr + offset; + break; + } + } + } + + c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ + *yy_c_buf_p = '\0'; /* preserve yytext */ + yy_hold_char = *++yy_c_buf_p; + + if ( c == '\n' ) + ++yylineno; + + return c; + } + #endif /* YY_NO_INPUT */ + + #ifdef YY_USE_PROTOS + void yyrestart( FILE *input_file ) + #else + void yyrestart( input_file ) + FILE *input_file; + #endif + { + if ( ! yy_current_buffer ) + yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); + + yy_init_buffer( yy_current_buffer, input_file ); + yy_load_buffer_state(); + } + + + #ifdef YY_USE_PROTOS + void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) + #else + void yy_switch_to_buffer( new_buffer ) + YY_BUFFER_STATE new_buffer; + #endif + { + if ( yy_current_buffer == new_buffer ) + return; + + if ( yy_current_buffer ) + { + /* Flush out information for old buffer. */ + *yy_c_buf_p = yy_hold_char; + yy_current_buffer->yy_buf_pos = yy_c_buf_p; + yy_current_buffer->yy_n_chars = yy_n_chars; + } + + yy_current_buffer = new_buffer; + yy_load_buffer_state(); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + yy_did_buffer_switch_on_eof = 1; + } + + + #ifdef YY_USE_PROTOS + void yy_load_buffer_state( void ) + #else + void yy_load_buffer_state() + #endif + { + yy_n_chars = yy_current_buffer->yy_n_chars; + yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; + yyin = yy_current_buffer->yy_input_file; + yy_hold_char = *yy_c_buf_p; + } + + + #ifdef YY_USE_PROTOS + YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) + #else + YY_BUFFER_STATE yy_create_buffer( file, size ) + FILE *file; + int size; + #endif + { + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer( b, file ); + + return b; + } + + + #ifdef YY_USE_PROTOS + void yy_delete_buffer( YY_BUFFER_STATE b ) + #else + void yy_delete_buffer( b ) + YY_BUFFER_STATE b; + #endif + { + if ( ! b ) + return; + + if ( b == yy_current_buffer ) + yy_current_buffer = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yy_flex_free( (void *) b->yy_ch_buf ); + + yy_flex_free( (void *) b ); + } + + + + #ifdef YY_USE_PROTOS + void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) + #else + void yy_init_buffer( b, file ) + YY_BUFFER_STATE b; + FILE *file; + #endif + + + { + yy_flush_buffer( b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + #if YY_ALWAYS_INTERACTIVE + b->yy_is_interactive = 1; + #else + #if YY_NEVER_INTERACTIVE + b->yy_is_interactive = 0; + #else + b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; + #endif + #endif + } + + + #ifdef YY_USE_PROTOS + void yy_flush_buffer( YY_BUFFER_STATE b ) + #else + void yy_flush_buffer( b ) + YY_BUFFER_STATE b; + #endif + + { + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == yy_current_buffer ) + yy_load_buffer_state(); + } + + + #ifndef YY_NO_SCAN_BUFFER + #ifdef YY_USE_PROTOS + YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) + #else + YY_BUFFER_STATE yy_scan_buffer( base, size ) + char *base; + yy_size_t size; + #endif + { + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer( b ); + + return b; + } + #endif + + + #ifndef YY_NO_SCAN_STRING + #ifdef YY_USE_PROTOS + YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) + #else + YY_BUFFER_STATE yy_scan_string( yy_str ) + yyconst char *yy_str; + #endif + { + int len; + for ( len = 0; yy_str[len]; ++len ) + ; + + return yy_scan_bytes( yy_str, len ); + } + #endif + + + #ifndef YY_NO_SCAN_BYTES + #ifdef YY_USE_PROTOS + YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) + #else + YY_BUFFER_STATE yy_scan_bytes( bytes, len ) + yyconst char *bytes; + int len; + #endif + { + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = len + 2; + buf = (char *) yy_flex_alloc( n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < len; ++i ) + buf[i] = bytes[i]; + + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer( buf, n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; + } + #endif + + + #ifndef YY_NO_PUSH_STATE + #ifdef YY_USE_PROTOS + static void yy_push_state( int new_state ) + #else + static void yy_push_state( new_state ) + int new_state; + #endif + { + if ( yy_start_stack_ptr >= yy_start_stack_depth ) + { + yy_size_t new_size; + + yy_start_stack_depth += YY_START_STACK_INCR; + new_size = yy_start_stack_depth * sizeof( int ); + + if ( ! yy_start_stack ) + yy_start_stack = (int *) yy_flex_alloc( new_size ); + + else + yy_start_stack = (int *) yy_flex_realloc( + (void *) yy_start_stack, new_size ); + + if ( ! yy_start_stack ) + YY_FATAL_ERROR( + "out of memory expanding start-condition stack" ); + } + + yy_start_stack[yy_start_stack_ptr++] = YY_START; + + BEGIN(new_state); + } + #endif + + + #ifndef YY_NO_POP_STATE + static void yy_pop_state() + { + if ( --yy_start_stack_ptr < 0 ) + YY_FATAL_ERROR( "start-condition stack underflow" ); + + BEGIN(yy_start_stack[yy_start_stack_ptr]); + } + #endif + + + #ifndef YY_NO_TOP_STATE + static int yy_top_state() + { + return yy_start_stack[yy_start_stack_ptr - 1]; + } + #endif + + #ifndef YY_EXIT_FAILURE + #define YY_EXIT_FAILURE 2 + #endif + + #ifdef YY_USE_PROTOS + static void yy_fatal_error( yyconst char msg[] ) + #else + static void yy_fatal_error( msg ) + char msg[]; + #endif + { + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); + } + + + + /* Redefine yyless() so it works in section 3 code. */ + + #undef yyless + #define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + yytext[yyleng] = yy_hold_char; \ + yy_c_buf_p = yytext + n; \ + yy_hold_char = *yy_c_buf_p; \ + *yy_c_buf_p = '\0'; \ + yyleng = n; \ + } \ + while ( 0 ) + + + /* Internal utility routines. */ + + #ifndef yytext_ptr + #ifdef YY_USE_PROTOS + static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) + #else + static void yy_flex_strncpy( s1, s2, n ) + char *s1; + yyconst char *s2; + int n; + #endif + { + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; + } + #endif + + #ifdef YY_NEED_STRLEN + #ifdef YY_USE_PROTOS + static int yy_flex_strlen( yyconst char *s ) + #else + static int yy_flex_strlen( s ) + yyconst char *s; + #endif + { + register int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; + } + #endif + + + #ifdef YY_USE_PROTOS + static void *yy_flex_alloc( yy_size_t size ) + #else + static void *yy_flex_alloc( size ) + yy_size_t size; + #endif + { + return (void *) malloc( size ); + } + + #ifdef YY_USE_PROTOS + static inline void *yy_flex_realloc( void *ptr, yy_size_t size ) + #else + static inline void *yy_flex_realloc( ptr, size ) + void *ptr; + yy_size_t size; + #endif + { + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); + } + + #ifdef YY_USE_PROTOS + static void yy_flex_free( void *ptr ) + #else + static void yy_flex_free( ptr ) + void *ptr; + #endif + { + free( ptr ); + } + + #if YY_MAIN + int main() + { + yylex(); + return 0; + } + #endif + #line 234 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/Lexer.l" + Index: llvm/projects/Stacker/lib/compiler/Lexer.l.cvs diff -c /dev/null llvm/projects/Stacker/lib/compiler/Lexer.l.cvs:1.1 *** /dev/null Wed Feb 15 01:26:19 2006 --- llvm/projects/Stacker/lib/compiler/Lexer.l.cvs Wed Feb 15 01:26:07 2006 *************** *** 0 **** --- 1,234 ---- + /*===-- Lexer.l - Scanner for Stacker language -----------------*- C++ -*--===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Reid Spencer and donated to the LLVM research + // group and is distributed under the University of Illinois Open Source + // License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file implements the flex scanner for Stacker languages files. + // + //===----------------------------------------------------------------------===*/ + + %option prefix="Stacker" + %option yylineno + %option nostdinit + %option never-interactive + %option batch + %option noyywrap + %option nodefault + %option 8bit + %option outfile="Lexer.cpp" + %option ecs + %option noreject + %option noyymore + + %{ + + #include "StackerCompiler.h" + #include "StackerParser.h" + + /* Conversion of text ints to binary */ + static int64_t IntToVal(const char *Buffer) { + int64_t Result = 0; + for (; *Buffer; Buffer++) { + int64_t OldRes = Result; + Result *= 10; + Result += *Buffer-'0'; + if (Result < OldRes) // Uh, oh, overflow detected!!! + StackerCompiler::ThrowException("constant bigger than 64 bits detected!"); + } + return Result; + } + + /* Conversion of text hexadecimal ints to binary */ + static int64_t HexIntToVal(const char *Buffer) { + int64_t Result = 0; + for (; *Buffer; ++Buffer) { + int64_t OldRes = Result; + Result *= 16; + char C = *Buffer; + if (C >= '0' && C <= '9') + Result += C-'0'; + else if (C >= 'A' && C <= 'F') + Result += C-'A'+10; + else if (C >= 'a' && C <= 'f') + Result += C-'a'+10; + + if (Result < OldRes) // Uh, oh, overflow detected!!! + StackerCompiler::ThrowException("constant bigger than 64 bits detected!"); + } + return Result; + } + + #define YY_NEVER_INTERACTIVE 1 + %} + + /* Comments start with a ; and go till end of line */ + Comment1 [#].*$ + /* You can also embed them in ( ... ) */ + Comment2 \(.*\) + /* We ignore white space */ + White [ \t\r\n] + + /* jdentifiers start with a % sign */ + Identifier [A-Za-z][-A-Za-z0-9_]* + + /* Strings can contain any character except " and \ */ + String \"[^\"]*\" + + /* Positive and negative integer constants*/ + PInteger [+]?[0-9]+ + NInteger -[0-9]+ + HexInteger 0x[0-9A-Fa-f]+ + + /* Special Characters - name them to avoid flex confusion */ + Semi [;] + Colon [:] + Less \< + More \> + LessEq \<\= + MoreEq \>\= + NotEq \<\> + Equal \= + Plus \+ + Minus \- + Incr \+\+ + Decr \-\- + Mult \* + Div \/ + StarSlash \*\/ + LShift \<\< + RShift \>\> + InStr \s + OutNum \>d + OutChar \>c + + %% + + {Comment1} { /* Ignore comments */ } + {Comment2} { /* Ignore comments */ } + + {Colon} { return COLON; } + {Semi} { return SEMI; } + + TRUE { return TRUETOK; } + FALSE { return FALSETOK; } + ON { return TRUETOK; } + OFF { return FALSETOK; } + {Less} { return LESS; } + LT { return LESS; } + {More} { return MORE; } + GT { return MORE; } + {LessEq} { return LESS_EQUAL; } + LE { return LESS_EQUAL; } + {MoreEq} { return MORE_EQUAL; } + GE { return MORE_EQUAL; } + {NotEq} { return NOT_EQUAL; } + NE { return NOT_EQUAL; } + {Equal} { return EQUAL; } + EQ { return EQUAL; } + + {Plus} { return PLUS; } + {Minus} { return MINUS; } + {Incr} { return INCR; } + {Decr} { return DECR; } + {Mult} { return MULT; } + {Div} { return DIV; } + MOD { return MODULUS; } + NEG { return NEGATE; } + ABS { return ABS; } + MIN { return MIN; } + MAX { return MAX; } + {StarSlash} { return STAR_SLASH; } + + AND { return AND; } + OR { return OR; } + XOR { return XOR; } + {LShift} { return LSHIFT; } + {RShift} { return RSHIFT; } + + DROP { return DROP; } + NIP { return NIP; } + DUP { return DUP; } + SWAP { return SWAP; } + OVER { return OVER; } + PICK { return PICK; } + SELECT { return SELECT; } + ROT { return ROT; } + RROT { return RROT; } + ROLL { return ROLL; } + TUCK { return TUCK; } + DROP2 { return DROP2; } + NIP2 { return NIP2; } + DUP2 { return DUP2; } + SWAP2 { return SWAP2; } + OVER2 { return OVER2; } + TUCK2 { return TUCK2; } + ROT2 { return ROT2; } + RROT2 { return RROT2; } + + MALLOC { return MALLOC; } + FREE { return FREE; } + GET { return GET; } + PUT { return PUT; } + + IF { return IF; } + ELSE { return ELSE; } + ENDIF { return ENDIF; } + WHILE { return WHILE; } + END { return END; } + + RECURSE { return RECURSE; } + RETURN { return RETURN; } + EXIT { return EXIT; } + FORWARD { return FORWARD; } + TAB { return TAB; } + SPACE { return SPACE; } + CR { return CR; } + + {InStr} { return IN_STR; } + {InNum} { return IN_NUM; } + {InChar} { return IN_CHAR; } + + {OutStr} { return OUT_STR; } + {OutNum} { return OUT_NUM; } + {OutChar} { return OUT_CHAR; } + + MAIN { return MAIN; } + + DUMP { return DUMP; } + + != { StackerCompiler::ThrowException( + "You probably meant to use a <> instead of !=" ); } + + == { StackerCompiler::ThrowException( + "You probably meant to use a single = .. this isn't C"); } + + {PInteger} { Stackerlval.IntegerVal = IntToVal(yytext); return INTEGER; } + {NInteger} { uint64_t Val = IntToVal(yytext+1); + // +1: we have bigger negative range + if (Val > (uint64_t)INT64_MAX+1) + StackerCompiler::ThrowException( + "Constant too large for signed 64 bits!"); + Stackerlval.IntegerVal = -Val; + return INTEGER; + } + {HexInteger} { Stackerlval.IntegerVal = HexIntToVal(yytext+3); + return INTEGER; + } + + {String} { yytext[strlen(yytext)-1] = 0; // nuke end quote + Stackerlval.StringVal = strdup(yytext+1); // Nuke start quote + return STRING; + } + + {Identifier} { Stackerlval.StringVal = strdup(yytext); return IDENTIFIER; } + + {White} { /* Ignore whitespace */ } + %% Index: llvm/projects/Stacker/lib/compiler/StackerParser.cpp.cvs diff -c /dev/null llvm/projects/Stacker/lib/compiler/StackerParser.cpp.cvs:1.1 *** /dev/null Wed Feb 15 01:26:19 2006 --- llvm/projects/Stacker/lib/compiler/StackerParser.cpp.cvs Wed Feb 15 01:26:07 2006 *************** *** 0 **** --- 1,1909 ---- + /* A Bison parser, made by GNU Bison 1.875c. */ + + /* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 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., 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. */ + + /* 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 + + /* Skeleton name. */ + #define YYSKELETON_NAME "yacc.c" + + /* Pure parsers. */ + #define YYPURE 0 + + /* Using locations. */ + #define YYLSP_NEEDED 0 + + /* If NAME_PREFIX is specified substitute the variables and functions + names. */ + #define yyparse Stackerparse + #define yylex Stackerlex + #define yyerror Stackererror + #define yylval Stackerlval + #define yychar Stackerchar + #define yydebug Stackerdebug + #define yynerrs Stackernerrs + + + /* Tokens. */ + #ifndef YYTOKENTYPE + # define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + INTEGER = 258, + STRING = 259, + IDENTIFIER = 260, + SEMI = 261, + COLON = 262, + FORWARD = 263, + MAIN = 264, + DUMP = 265, + TRUETOK = 266, + FALSETOK = 267, + LESS = 268, + MORE = 269, + LESS_EQUAL = 270, + MORE_EQUAL = 271, + NOT_EQUAL = 272, + EQUAL = 273, + PLUS = 274, + MINUS = 275, + INCR = 276, + DECR = 277, + MULT = 278, + DIV = 279, + MODULUS = 280, + NEGATE = 281, + ABS = 282, + MIN = 283, + MAX = 284, + STAR_SLASH = 285, + AND = 286, + OR = 287, + XOR = 288, + LSHIFT = 289, + RSHIFT = 290, + DROP = 291, + DROP2 = 292, + NIP = 293, + NIP2 = 294, + DUP = 295, + DUP2 = 296, + SWAP = 297, + SWAP2 = 298, + OVER = 299, + OVER2 = 300, + ROT = 301, + ROT2 = 302, + RROT = 303, + RROT2 = 304, + TUCK = 305, + TUCK2 = 306, + ROLL = 307, + PICK = 308, + SELECT = 309, + MALLOC = 310, + FREE = 311, + GET = 312, + PUT = 313, + IF = 314, + ELSE = 315, + ENDIF = 316, + WHILE = 317, + END = 318, + RECURSE = 319, + RETURN = 320, + EXIT = 321, + TAB = 322, + SPACE = 323, + CR = 324, + IN_STR = 325, + IN_NUM = 326, + IN_CHAR = 327, + OUT_STR = 328, + OUT_NUM = 329, + OUT_CHAR = 330 + }; + #endif + #define INTEGER 258 + #define STRING 259 + #define IDENTIFIER 260 + #define SEMI 261 + #define COLON 262 + #define FORWARD 263 + #define MAIN 264 + #define DUMP 265 + #define TRUETOK 266 + #define FALSETOK 267 + #define LESS 268 + #define MORE 269 + #define LESS_EQUAL 270 + #define MORE_EQUAL 271 + #define NOT_EQUAL 272 + #define EQUAL 273 + #define PLUS 274 + #define MINUS 275 + #define INCR 276 + #define DECR 277 + #define MULT 278 + #define DIV 279 + #define MODULUS 280 + #define NEGATE 281 + #define ABS 282 + #define MIN 283 + #define MAX 284 + #define STAR_SLASH 285 + #define AND 286 + #define OR 287 + #define XOR 288 + #define LSHIFT 289 + #define RSHIFT 290 + #define DROP 291 + #define DROP2 292 + #define NIP 293 + #define NIP2 294 + #define DUP 295 + #define DUP2 296 + #define SWAP 297 + #define SWAP2 298 + #define OVER 299 + #define OVER2 300 + #define ROT 301 + #define ROT2 302 + #define RROT 303 + #define RROT2 304 + #define TUCK 305 + #define TUCK2 306 + #define ROLL 307 + #define PICK 308 + #define SELECT 309 + #define MALLOC 310 + #define FREE 311 + #define GET 312 + #define PUT 313 + #define IF 314 + #define ELSE 315 + #define ENDIF 316 + #define WHILE 317 + #define END 318 + #define RECURSE 319 + #define RETURN 320 + #define EXIT 321 + #define TAB 322 + #define SPACE 323 + #define CR 324 + #define IN_STR 325 + #define IN_NUM 326 + #define IN_CHAR 327 + #define OUT_STR 328 + #define OUT_NUM 329 + #define OUT_CHAR 330 + + + + + /* Copy the first part of user declarations. */ + #line 14 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + + #include "StackerCompiler.h" + #include "llvm/SymbolTable.h" + #include "llvm/Module.h" + #include "llvm/Instructions.h" + #include "llvm/ADT/STLExtras.h" + #include "llvm/ADT/DepthFirstIterator.h" + #include + #include + #include + + #define YYERROR_VERBOSE 1 + #define SCI StackerCompiler::TheInstance + + int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit + int yylex(); // declaration" of xxx warnings. + int yyparse(); + + + + /* 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 + + #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) + #line 35 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + typedef union YYSTYPE { + llvm::Module* ModuleVal; + llvm::Function* FunctionVal; + llvm::BasicBlock* BasicBlockVal; + int64_t IntegerVal; + char* StringVal; + } YYSTYPE; + /* Line 191 of yacc.c. */ + #line 263 "StackerParser.tab.c" + # define yystype YYSTYPE /* obsolescent; will be withdrawn */ + # define YYSTYPE_IS_DECLARED 1 + # define YYSTYPE_IS_TRIVIAL 1 + #endif + + + + /* Copy the second part of user declarations. */ + + + /* Line 214 of yacc.c. */ + #line 275 "StackerParser.tab.c" + + #if ! defined (yyoverflow) || YYERROR_VERBOSE + + # ifndef YYFREE + # define YYFREE free + # endif + # ifndef YYMALLOC + # define YYMALLOC malloc + # endif + + /* The parser invokes alloca or malloc; define the necessary symbols. */ + + # ifdef YYSTACK_USE_ALLOCA + # if YYSTACK_USE_ALLOCA + # define YYSTACK_ALLOC alloca + # endif + # else + # if defined (alloca) || defined (_ALLOCA_H) + # define YYSTACK_ALLOC alloca + # else + # ifdef __GNUC__ + # define YYSTACK_ALLOC __builtin_alloca + # endif + # endif + # endif + + # ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ + # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) + # else + # if defined (__STDC__) || defined (__cplusplus) + # include /* INFRINGES ON USER NAME SPACE */ + # define YYSIZE_T size_t + # endif + # define YYSTACK_ALLOC YYMALLOC + # define YYSTACK_FREE YYFREE + # 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 + { + short 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 (short) + 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 \ + { \ + register YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (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 (0) + + #endif + + #if defined (__STDC__) || defined (__cplusplus) + typedef signed char yysigned_char; + #else + typedef short yysigned_char; + #endif + + /* YYFINAL -- State number of the termination state. */ + #define YYFINAL 3 + /* YYLAST -- Last index in YYTABLE. */ + #define YYLAST 150 + + /* YYNTOKENS -- Number of terminals. */ + #define YYNTOKENS 76 + /* YYNNTS -- Number of nonterminals. */ + #define YYNNTS 10 + /* YYNRULES -- Number of rules. */ + #define YYNRULES 80 + /* YYNRULES -- Number of states. */ + #define YYNSTATES 93 + + /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ + #define YYUNDEFTOK 2 + #define YYMAXUTOK 330 + + #define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + + /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ + static const unsigned char 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, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 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 + }; + + #if YYDEBUG + /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ + static const unsigned char yyprhs[] = + { + 0, 0, 3, 4, 7, 10, 11, 13, 15, 17, + 21, 26, 31, 34, 35, 41, 45, 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, 163, 165, 167, 169, 171, 173, + 175 + }; + + /* YYRHS -- A `-1'-separated list of the rules' RHS. */ + static const yysigned_char yyrhs[] = + { + 77, 0, -1, -1, 78, 79, -1, 79, 80, -1, + -1, 81, -1, 83, -1, 82, -1, 8, 5, 6, + -1, 7, 9, 84, 6, -1, 7, 5, 84, 6, + -1, 84, 85, -1, -1, 59, 5, 60, 5, 61, + -1, 59, 5, 61, -1, 62, 5, 63, -1, 5, + -1, 4, -1, 3, -1, 11, -1, 12, -1, 13, + -1, 14, -1, 15, -1, 16, -1, 17, -1, 18, + -1, 19, -1, 20, -1, 21, -1, 22, -1, 23, + -1, 24, -1, 25, -1, 26, -1, 27, -1, 28, + -1, 29, -1, 30, -1, 31, -1, 32, -1, 33, + -1, 34, -1, 35, -1, 36, -1, 37, -1, 38, + -1, 39, -1, 40, -1, 41, -1, 42, -1, 43, + -1, 44, -1, 45, -1, 46, -1, 47, -1, 48, + -1, 49, -1, 50, -1, 51, -1, 52, -1, 53, + -1, 54, -1, 55, -1, 56, -1, 57, -1, 58, + -1, 64, -1, 65, -1, 66, -1, 67, -1, 68, + -1, 69, -1, 70, -1, 71, -1, 72, -1, 73, + -1, 74, -1, 75, -1, 10, -1 + }; + + /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ + static const unsigned char yyrline[] = + { + 0, 70, 70, 70, 74, 75, 78, 79, 80, 83, + 86, 89, 92, 93, 99, 100, 101, 104, 105, 106, + 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, 152, 153, 154, 155, 156, 157, 158, + 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, + 169 + }; + #endif + + #if YYDEBUG || YYERROR_VERBOSE + /* YYTNME[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", "INTEGER", "STRING", "IDENTIFIER", + "SEMI", "COLON", "FORWARD", "MAIN", "DUMP", "TRUETOK", "FALSETOK", + "LESS", "MORE", "LESS_EQUAL", "MORE_EQUAL", "NOT_EQUAL", "EQUAL", "PLUS", + "MINUS", "INCR", "DECR", "MULT", "DIV", "MODULUS", "NEGATE", "ABS", + "MIN", "MAX", "STAR_SLASH", "AND", "OR", "XOR", "LSHIFT", "RSHIFT", + "DROP", "DROP2", "NIP", "NIP2", "DUP", "DUP2", "SWAP", "SWAP2", "OVER", + "OVER2", "ROT", "ROT2", "RROT", "RROT2", "TUCK", "TUCK2", "ROLL", "PICK", + "SELECT", "MALLOC", "FREE", "GET", "PUT", "IF", "ELSE", "ENDIF", "WHILE", + "END", "RECURSE", "RETURN", "EXIT", "TAB", "SPACE", "CR", "IN_STR", + "IN_NUM", "IN_CHAR", "OUT_STR", "OUT_NUM", "OUT_CHAR", "$accept", + "Module", "@1", "DefinitionList", "Definition", "ForwardDef", "MainDef", + "ColonDef", "WordList", "Word", 0 + }; + #endif + + # ifdef YYPRINT + /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ + static const unsigned short 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 + }; + # endif + + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ + static const unsigned char yyr1[] = + { + 0, 76, 78, 77, 79, 79, 80, 80, 80, 81, + 82, 83, 84, 84, 85, 85, 85, 85, 85, 85, + 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, + 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, + 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, + 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, + 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, + 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, + 85 + }; + + /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ + static const unsigned char yyr2[] = + { + 0, 2, 0, 2, 2, 0, 1, 1, 1, 3, + 4, 4, 2, 0, 5, 3, 3, 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 + }; + + /* 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 unsigned char yydefact[] = + { + 2, 0, 5, 1, 3, 0, 0, 4, 6, 8, + 7, 13, 13, 0, 0, 0, 9, 19, 18, 17, + 11, 80, 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, + 0, 0, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 12, 10, 0, 0, 0, 15, + 16, 0, 14 + }; + + /* YYDEFGOTO[NTERM-NUM]. */ + static const yysigned_char yydefgoto[] = + { + -1, 1, 2, 4, 7, 8, 9, 10, 14, 84 + }; + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ + #define YYPACT_NINF -4 + static const short yypact[] = + { + -4, 4, -4, -4, -2, 141, 52, -4, -4, -4, + -4, -4, -4, 54, -3, 70, -4, -4, -4, -4, + -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, + -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, + -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, + -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, + -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, + 53, 74, -4, -4, -4, -4, -4, -4, -4, -4, + -4, -4, -4, -4, -4, -4, 17, 67, 126, -4, + -4, 72, -4 + }; + + /* YYPGOTO[NTERM-NUM]. */ + static const short yypgoto[] = + { + -4, -4, -4, -4, -4, -4, -4, -4, 135, -4 + }; + + /* 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 -1 + static const unsigned char yytable[] = + { + 17, 18, 19, 20, 3, 5, 6, 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, 13, 86, 71, + 16, 72, 73, 74, 75, 76, 77, 78, 79, 80, + 81, 82, 83, 17, 18, 19, 85, 88, 89, 87, + 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, + 90, 91, 71, 92, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, 11, 15, 0, 0, + 12 + }; + + static const yysigned_char yycheck[] = + { + 3, 4, 5, 6, 0, 7, 8, 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, 5, 5, 62, + 6, 64, 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 3, 4, 5, 6, 60, 61, 5, + 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, + 63, 5, 62, 61, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 5, 12, -1, -1, + 9 + }; + + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ + static const unsigned char yystos[] = + { + 0, 77, 78, 0, 79, 7, 8, 80, 81, 82, + 83, 5, 9, 5, 84, 84, 6, 3, 4, 5, + 6, 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, 62, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 85, 6, 5, 5, 60, 61, + 63, 5, 61 + }; + + #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) + # define YYSIZE_T __SIZE_TYPE__ + #endif + #if ! defined (YYSIZE_T) && defined (size_t) + # define YYSIZE_T size_t + #endif + #if ! defined (YYSIZE_T) + # if defined (__STDC__) || defined (__cplusplus) + # include /* INFRINGES ON USER NAME SPACE */ + # define YYSIZE_T size_t + # endif + #endif + #if ! defined (YYSIZE_T) + # define YYSIZE_T unsigned int + #endif + + #define yyerrok (yyerrstatus = 0) + #define yyclearin (yychar = YYEMPTY) + #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. + Once GCC version 2 has supplanted version 1, this can go. */ + + #define YYFAIL goto yyerrlab + + #define YYRECOVERING() (!!yyerrstatus) + + #define YYBACKUP(Token, Value) \ + do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror ("syntax error: cannot back up");\ + YYERROR; \ + } \ + while (0) + + #define YYTERROR 1 + #define YYERRCODE 256 + + /* YYLLOC_DEFAULT -- Compute the default location (before the actions + are run). */ + + #ifndef YYLLOC_DEFAULT + # define YYLLOC_DEFAULT(Current, Rhs, N) \ + ((Current).first_line = (Rhs)[1].first_line, \ + (Current).first_column = (Rhs)[1].first_column, \ + (Current).last_line = (Rhs)[N].last_line, \ + (Current).last_column = (Rhs)[N].last_column) + #endif + + /* YYLEX -- calling `yylex' with the right arguments. */ + + #ifdef YYLEX_PARAM + # define YYLEX yylex (YYLEX_PARAM) + #else + # define YYLEX yylex () + #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 (0) + + # define YYDSYMPRINT(Args) \ + do { \ + if (yydebug) \ + yysymprint Args; \ + } while (0) + + # define YYDSYMPRINTF(Title, Token, Value, Location) \ + do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yysymprint (stderr, \ + Token, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ + } while (0) + + /*------------------------------------------------------------------. + | yy_stack_print -- Print the state stack from its BOTTOM up to its | + | TOP (included). | + `------------------------------------------------------------------*/ + + #if defined (__STDC__) || defined (__cplusplus) + static void + yy_stack_print (short *bottom, short *top) + #else + static void + yy_stack_print (bottom, top) + short *bottom; + short *top; + #endif + { + YYFPRINTF (stderr, "Stack now"); + for (/* Nothing. */; bottom <= top; ++bottom) + YYFPRINTF (stderr, " %d", *bottom); + YYFPRINTF (stderr, "\n"); + } + + # define YY_STACK_PRINT(Bottom, Top) \ + do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ + } while (0) + + + /*------------------------------------------------. + | Report that the YYRULE is going to be reduced. | + `------------------------------------------------*/ + + #if defined (__STDC__) || defined (__cplusplus) + static void + yy_reduce_print (int yyrule) + #else + static void + yy_reduce_print (yyrule) + int yyrule; + #endif + { + int yyi; + unsigned int yylno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", + yyrule - 1, yylno); + /* Print the symbols being reduced, and their result. */ + for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) + YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); + YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); + } + + # define YY_REDUCE_PRINT(Rule) \ + do { \ + if (yydebug) \ + yy_reduce_print (Rule); \ + } while (0) + + /* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ + int yydebug; + #else /* !YYDEBUG */ + # define YYDPRINTF(Args) + # define YYDSYMPRINT(Args) + # define YYDSYMPRINTF(Title, Token, Value, Location) + # define YY_STACK_PRINT(Bottom, Top) + # define YY_REDUCE_PRINT(Rule) + #endif /* !YYDEBUG */ + + + /* YYINITDEPTH -- initial size of the parser's stacks. */ + #ifndef YYINITDEPTH + # define YYINITDEPTH 200 + #endif + + /* YYMAXDEPTH -- 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 + SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + + #if defined (YYMAXDEPTH) && YYMAXDEPTH == 0 + # undef YYMAXDEPTH + #endif + + #ifndef YYMAXDEPTH + # define YYMAXDEPTH 10000 + #endif + + + + #if YYERROR_VERBOSE + + # ifndef yystrlen + # if defined (__GLIBC__) && defined (_STRING_H) + # define yystrlen strlen + # else + /* Return the length of YYSTR. */ + static YYSIZE_T + # if defined (__STDC__) || defined (__cplusplus) + yystrlen (const char *yystr) + # else + yystrlen (yystr) + const char *yystr; + # endif + { + register const char *yys = yystr; + + while (*yys++ != '\0') + continue; + + return yys - yystr - 1; + } + # 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. */ + static char * + # if defined (__STDC__) || defined (__cplusplus) + yystpcpy (char *yydest, const char *yysrc) + # else + yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; + # endif + { + register char *yyd = yydest; + register const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; + } + # endif + # endif + + #endif /* !YYERROR_VERBOSE */ + + + + #if YYDEBUG + /*--------------------------------. + | Print this symbol on YYOUTPUT. | + `--------------------------------*/ + + #if defined (__STDC__) || defined (__cplusplus) + static void + yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) + #else + static void + yysymprint (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE *yyvaluep; + #endif + { + /* Pacify ``unused variable'' warnings. */ + (void) yyvaluep; + + if (yytype < YYNTOKENS) + { + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + # ifdef YYPRINT + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); + # endif + } + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + switch (yytype) + { + default: + break; + } + YYFPRINTF (yyoutput, ")"); + } + + #endif /* ! YYDEBUG */ + /*-----------------------------------------------. + | Release the memory associated to this symbol. | + `-----------------------------------------------*/ + + #if defined (__STDC__) || defined (__cplusplus) + static void + yydestruct (int yytype, YYSTYPE *yyvaluep) + #else + static void + yydestruct (yytype, yyvaluep) + int yytype; + YYSTYPE *yyvaluep; + #endif + { + /* Pacify ``unused variable'' warnings. */ + (void) yyvaluep; + + switch (yytype) + { + + default: + break; + } + } + + + /* 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 lookahead symbol. */ + int yychar; + + /* The semantic value of the lookahead symbol. */ + YYSTYPE yylval; + + /* Number of syntax errors so far. */ + int yynerrs; + + + + /*----------. + | yyparse. | + `----------*/ + + #ifdef YYPARSE_PARAM + # if defined (__STDC__) || defined (__cplusplus) + int yyparse (void *YYPARSE_PARAM) + # else + int yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; + # endif + #else /* ! YYPARSE_PARAM */ + #if defined (__STDC__) || defined (__cplusplus) + int + yyparse (void) + #else + int + yyparse () + + #endif + #endif + { + + register int yystate; + register int yyn; + int yyresult; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Lookahead token as an internal (translated) token number. */ + int yytoken = 0; + + /* 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. */ + short yyssa[YYINITDEPTH]; + short *yyss = yyssa; + register short *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + register YYSTYPE *yyvsp; + + + + #define YYPOPSTACK (yyvsp--, yyssp--) + + YYSIZE_T yystacksize = YYINITDEPTH; + + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + + + /* When reducing, the number of symbols on the RHS of the reduced + rule. */ + int yylen; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + + /* Initialize stack pointers. + Waste one element of value and location stack + so that they stay on the same level as the state stack. + The wasted elements are never initialized. */ + + yyssp = yyss; + yyvsp = yyvs; + + 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++; + + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { + /* Get the current used size of the three stacks, in elements. */ + YYSIZE_T yysize = 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; + short *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 ("parser stack overflow", + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } + #else /* no yyoverflow */ + # ifndef YYSTACK_RELOCATE + goto yyoverflowlab; + # else + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + goto yyoverflowlab; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + short *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyoverflowlab; + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); + + # undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } + # endif + #endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + goto 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: */ + + /* First try to decide what to do without reference to lookahead token. */ + + yyn = yypact[yystate]; + if (yyn == YYPACT_NINF) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; + } + + if (yychar <= YYEOF) + { + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else + { + yytoken = YYTRANSLATE (yychar); + YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); + } + + /* 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) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yyn == 0 || yyn == YYTABLE_NINF) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + if (yyn == YYFINAL) + YYACCEPT; + + /* Shift the lookahead token. */ + YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); + + /* Discard the token being shifted unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + + *++yyvsp = yylval; + + + /* 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. | + `-----------------------------------------------------------*/ + yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + + /*-----------------------------. + | yyreduce -- Do a reduction. | + `-----------------------------*/ + yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* 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) + { + case 2: + #line 70 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { SCI->handle_module_start( ); ;} + break; + + case 3: + #line 71 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.ModuleVal = SCI->handle_module_end( yyvsp[0].ModuleVal ); ;} + break; + + case 4: + #line 74 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.ModuleVal = SCI->handle_definition_list_end( yyvsp[-1].ModuleVal, yyvsp[0].FunctionVal ); ;} + break; + + case 5: + #line 75 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.ModuleVal = SCI->handle_definition_list_start(); ;} + break; + + case 6: + #line 78 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.FunctionVal = yyvsp[0].FunctionVal; ;} + break; + + case 7: + #line 79 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.FunctionVal = yyvsp[0].FunctionVal; ;} + break; + + case 8: + #line 80 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.FunctionVal = yyvsp[0].FunctionVal; ;} + break; + + case 9: + #line 83 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.FunctionVal = SCI->handle_forward( yyvsp[-1].StringVal ); ;} + break; + + case 10: + #line 86 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.FunctionVal = SCI->handle_main_definition(yyvsp[-1].FunctionVal); ;} + break; + + case 11: + #line 89 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.FunctionVal = SCI->handle_definition( yyvsp[-2].StringVal, yyvsp[-1].FunctionVal ); ;} + break; + + case 12: + #line 92 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.FunctionVal = SCI->handle_word_list_end( yyvsp[-1].FunctionVal, yyvsp[0].BasicBlockVal ); ;} + break; + + case 13: + #line 93 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.FunctionVal = SCI->handle_word_list_start(); ;} + break; + + case 14: + #line 99 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_if( yyvsp[-3].StringVal, yyvsp[-1].StringVal ); ;} + break; + + case 15: + #line 100 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_if( yyvsp[-1].StringVal ); ;} + break; + + case 16: + #line 101 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_while( yyvsp[-1].StringVal ); ;} + break; + + case 17: + #line 104 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_identifier( yyvsp[0].StringVal ); ;} + break; + + case 18: + #line 105 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_string( yyvsp[0].StringVal ); ;} + break; + + case 19: + #line 106 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_integer( yyvsp[0].IntegerVal ); ;} + break; + + case 20: + #line 109 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( TRUETOK ); ;} + break; + + case 21: + #line 110 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( FALSETOK ); ;} + break; + + case 22: + #line 111 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( LESS ); ;} + break; + + case 23: + #line 112 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( MORE ); ;} + break; + + case 24: + #line 113 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( LESS_EQUAL ); ;} + break; + + case 25: + #line 114 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( MORE_EQUAL ); ;} + break; + + case 26: + #line 115 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( NOT_EQUAL ); ;} + break; + + case 27: + #line 116 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( EQUAL ); ;} + break; + + case 28: + #line 117 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( PLUS ); ;} + break; + + case 29: + #line 118 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( MINUS ); ;} + break; + + case 30: + #line 119 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( INCR ); ;} + break; + + case 31: + #line 120 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( DECR ); ;} + break; + + case 32: + #line 121 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( MULT ); ;} + break; + + case 33: + #line 122 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( DIV ); ;} + break; + + case 34: + #line 123 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( MODULUS ); ;} + break; + + case 35: + #line 124 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( NEGATE ); ;} + break; + + case 36: + #line 125 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( ABS ); ;} + break; + + case 37: + #line 126 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( MIN ); ;} + break; + + case 38: + #line 127 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( MAX ); ;} + break; + + case 39: + #line 128 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( STAR_SLASH ); ;} + break; + + case 40: + #line 129 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( AND ); ;} + break; + + case 41: + #line 130 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( OR ); ;} + break; + + case 42: + #line 131 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( XOR ); ;} + break; + + case 43: + #line 132 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( LSHIFT ); ;} + break; + + case 44: + #line 133 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( RSHIFT ); ;} + break; + + case 45: + #line 134 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( DROP ); ;} + break; + + case 46: + #line 135 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( DROP2 ); ;} + break; + + case 47: + #line 136 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( NIP ); ;} + break; + + case 48: + #line 137 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( NIP2 ); ;} + break; + + case 49: + #line 138 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( DUP ); ;} + break; + + case 50: + #line 139 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( DUP2 ); ;} + break; + + case 51: + #line 140 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( SWAP ); ;} + break; + + case 52: + #line 141 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( SWAP2 ); ;} + break; + + case 53: + #line 142 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( OVER ); ;} + break; + + case 54: + #line 143 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( OVER2 ); ;} + break; + + case 55: + #line 144 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( ROT ); ;} + break; + + case 56: + #line 145 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( ROT2 ); ;} + break; + + case 57: + #line 146 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( RROT ); ;} + break; + + case 58: + #line 147 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( RROT2 ); ;} + break; + + case 59: + #line 148 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( TUCK ); ;} + break; + + case 60: + #line 149 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( TUCK2 ); ;} + break; + + case 61: + #line 150 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( ROLL ); ;} + break; + + case 62: + #line 151 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( PICK ); ;} + break; + + case 63: + #line 152 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( SELECT ); ;} + break; + + case 64: + #line 153 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( MALLOC ); ;} + break; + + case 65: + #line 154 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( FREE ); ;} + break; + + case 66: + #line 155 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( GET ); ;} + break; + + case 67: + #line 156 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( PUT ); ;} + break; + + case 68: + #line 157 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( RECURSE ); ;} + break; + + case 69: + #line 158 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( RETURN ); ;} + break; + + case 70: + #line 159 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( EXIT ); ;} + break; + + case 71: + #line 160 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( TAB ); ;} + break; + + case 72: + #line 161 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( SPACE ); ;} + break; + + case 73: + #line 162 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( CR ); ;} + break; + + case 74: + #line 163 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( IN_STR ); ;} + break; + + case 75: + #line 164 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( IN_NUM ); ;} + break; + + case 76: + #line 165 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( IN_CHAR ); ;} + break; + + case 77: + #line 166 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( OUT_STR ); ;} + break; + + case 78: + #line 167 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( OUT_NUM ); ;} + break; + + case 79: + #line 168 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( OUT_CHAR ); ;} + break; + + case 80: + #line 169 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + { yyval.BasicBlockVal = SCI->handle_word( DUMP ); ;} + break; + + + } + + /* Line 1000 of yacc.c. */ + #line 1669 "StackerParser.tab.c" + + yyvsp -= yylen; + yyssp -= yylen; + + + YY_STACK_PRINT (yyss, yyssp); + + *++yyvsp = yyval; + + + /* 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 = yytable[yystate]; + else + yystate = yydefgoto[yyn - YYNTOKENS]; + + goto yynewstate; + + + /*------------------------------------. + | yyerrlab -- here on detecting error | + `------------------------------------*/ + yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; + #if YYERROR_VERBOSE + yyn = yypact[yystate]; + + if (YYPACT_NINF < yyn && yyn < YYLAST) + { + YYSIZE_T yysize = 0; + int yytype = YYTRANSLATE (yychar); + const char* yyprefix; + char *yymsg; + int yyx; + + /* 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; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 0; + + yyprefix = ", expecting "; + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]); + yycount += 1; + if (yycount == 5) + { + yysize = 0; + break; + } + } + yysize += (sizeof ("syntax error, unexpected ") + + yystrlen (yytname[yytype])); + yymsg = (char *) YYSTACK_ALLOC (yysize); + if (yymsg != 0) + { + char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); + yyp = yystpcpy (yyp, yytname[yytype]); + + if (yycount < 5) + { + yyprefix = ", expecting "; + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + yyp = yystpcpy (yyp, yyprefix); + yyp = yystpcpy (yyp, yytname[yyx]); + yyprefix = " or "; + } + } + yyerror (yymsg); + YYSTACK_FREE (yymsg); + } + else + yyerror ("syntax error; also virtual memory exhausted"); + } + else + #endif /* YYERROR_VERBOSE */ + yyerror ("syntax error"); + } + + + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* If at end of input, pop the error token, + then the rest of the stack, then return failure. */ + if (yychar == YYEOF) + for (;;) + { + YYPOPSTACK; + if (yyssp == yyss) + YYABORT; + YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); + yydestruct (yystos[*yyssp], yyvsp); + } + } + else + { + YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); + yydestruct (yytoken, &yylval); + yychar = YYEMPTY; + + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + + /*---------------------------------------------------. + | yyerrorlab -- error raised explicitly by YYERROR. | + `---------------------------------------------------*/ + yyerrorlab: + + #ifdef __GNUC__ + /* Pacify GCC when the user code never invokes YYERROR and the label + yyerrorlab therefore never appears in user code. */ + if (0) + goto yyerrorlab; + #endif + + yyvsp -= yylen; + yyssp -= yylen; + yystate = *yyssp; + goto yyerrlab1; + + + /*-------------------------------------------------------------. + | yyerrlab1 -- common code for both syntax error and YYERROR. | + `-------------------------------------------------------------*/ + yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + for (;;) + { + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); + yydestruct (yystos[yystate], yyvsp); + YYPOPSTACK; + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + if (yyn == YYFINAL) + YYACCEPT; + + YYDPRINTF ((stderr, "Shifting error token, ")); + + *++yyvsp = yylval; + + + yystate = yyn; + goto yynewstate; + + + /*-------------------------------------. + | yyacceptlab -- YYACCEPT comes here. | + `-------------------------------------*/ + yyacceptlab: + yyresult = 0; + goto yyreturn; + + /*-----------------------------------. + | yyabortlab -- YYABORT comes here. | + `-----------------------------------*/ + yyabortlab: + yyresult = 1; + goto yyreturn; + + #ifndef yyoverflow + /*----------------------------------------------. + | yyoverflowlab -- parser overflow comes here. | + `----------------------------------------------*/ + yyoverflowlab: + yyerror ("parser stack overflow"); + yyresult = 2; + /* Fall through. */ + #endif + + yyreturn: + #ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); + #endif + return yyresult; + } + + + #line 171 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + + + /* Handle messages a little more nicely than the default yyerror */ + int yyerror(const char *ErrorMsg) { + std::string where + = std::string((SCI->filename() == "-") ? std::string("") : SCI->filename()) + + ":" + utostr((unsigned) Stackerlineno ) + ": "; + std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading "; + if (yychar == YYEMPTY) + errMsg += "end-of-file."; + else + errMsg += "token: '" + std::string(Stackertext, Stackerleng) + "'"; + StackerCompiler::ThrowException(errMsg); + return 0; + } + Index: llvm/projects/Stacker/lib/compiler/StackerParser.h.cvs diff -c /dev/null llvm/projects/Stacker/lib/compiler/StackerParser.h.cvs:1.1 *** /dev/null Wed Feb 15 01:26:19 2006 --- llvm/projects/Stacker/lib/compiler/StackerParser.h.cvs Wed Feb 15 01:26:07 2006 *************** *** 0 **** --- 1,203 ---- + /* A Bison parser, made by GNU Bison 1.875c. */ + + /* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 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., 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. */ + + /* Tokens. */ + #ifndef YYTOKENTYPE + # define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + INTEGER = 258, + STRING = 259, + IDENTIFIER = 260, + SEMI = 261, + COLON = 262, + FORWARD = 263, + MAIN = 264, + DUMP = 265, + TRUETOK = 266, + FALSETOK = 267, + LESS = 268, + MORE = 269, + LESS_EQUAL = 270, + MORE_EQUAL = 271, + NOT_EQUAL = 272, + EQUAL = 273, + PLUS = 274, + MINUS = 275, + INCR = 276, + DECR = 277, + MULT = 278, + DIV = 279, + MODULUS = 280, + NEGATE = 281, + ABS = 282, + MIN = 283, + MAX = 284, + STAR_SLASH = 285, + AND = 286, + OR = 287, + XOR = 288, + LSHIFT = 289, + RSHIFT = 290, + DROP = 291, + DROP2 = 292, + NIP = 293, + NIP2 = 294, + DUP = 295, + DUP2 = 296, + SWAP = 297, + SWAP2 = 298, + OVER = 299, + OVER2 = 300, + ROT = 301, + ROT2 = 302, + RROT = 303, + RROT2 = 304, + TUCK = 305, + TUCK2 = 306, + ROLL = 307, + PICK = 308, + SELECT = 309, + MALLOC = 310, + FREE = 311, + GET = 312, + PUT = 313, + IF = 314, + ELSE = 315, + ENDIF = 316, + WHILE = 317, + END = 318, + RECURSE = 319, + RETURN = 320, + EXIT = 321, + TAB = 322, + SPACE = 323, + CR = 324, + IN_STR = 325, + IN_NUM = 326, + IN_CHAR = 327, + OUT_STR = 328, + OUT_NUM = 329, + OUT_CHAR = 330 + }; + #endif + #define INTEGER 258 + #define STRING 259 + #define IDENTIFIER 260 + #define SEMI 261 + #define COLON 262 + #define FORWARD 263 + #define MAIN 264 + #define DUMP 265 + #define TRUETOK 266 + #define FALSETOK 267 + #define LESS 268 + #define MORE 269 + #define LESS_EQUAL 270 + #define MORE_EQUAL 271 + #define NOT_EQUAL 272 + #define EQUAL 273 + #define PLUS 274 + #define MINUS 275 + #define INCR 276 + #define DECR 277 + #define MULT 278 + #define DIV 279 + #define MODULUS 280 + #define NEGATE 281 + #define ABS 282 + #define MIN 283 + #define MAX 284 + #define STAR_SLASH 285 + #define AND 286 + #define OR 287 + #define XOR 288 + #define LSHIFT 289 + #define RSHIFT 290 + #define DROP 291 + #define DROP2 292 + #define NIP 293 + #define NIP2 294 + #define DUP 295 + #define DUP2 296 + #define SWAP 297 + #define SWAP2 298 + #define OVER 299 + #define OVER2 300 + #define ROT 301 + #define ROT2 302 + #define RROT 303 + #define RROT2 304 + #define TUCK 305 + #define TUCK2 306 + #define ROLL 307 + #define PICK 308 + #define SELECT 309 + #define MALLOC 310 + #define FREE 311 + #define GET 312 + #define PUT 313 + #define IF 314 + #define ELSE 315 + #define ENDIF 316 + #define WHILE 317 + #define END 318 + #define RECURSE 319 + #define RETURN 320 + #define EXIT 321 + #define TAB 322 + #define SPACE 323 + #define CR 324 + #define IN_STR 325 + #define IN_NUM 326 + #define IN_CHAR 327 + #define OUT_STR 328 + #define OUT_NUM 329 + #define OUT_CHAR 330 + + + + + #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) + #line 35 "/proj/llvm/build/projects/Stacker/../../../llvm/projects/Stacker/lib/compiler/StackerParser.y" + typedef union YYSTYPE { + llvm::Module* ModuleVal; + llvm::Function* FunctionVal; + llvm::BasicBlock* BasicBlockVal; + int64_t IntegerVal; + char* StringVal; + } YYSTYPE; + /* Line 1275 of yacc.c. */ + #line 195 "StackerParser.tab.h" + # define yystype YYSTYPE /* obsolescent; will be withdrawn */ + # define YYSTYPE_IS_DECLARED 1 + # define YYSTYPE_IS_TRIVIAL 1 + #endif + + extern YYSTYPE Stackerlval; + + + Index: llvm/projects/Stacker/lib/compiler/StackerParser.y.cvs diff -c /dev/null llvm/projects/Stacker/lib/compiler/StackerParser.y.cvs:1.1 *** /dev/null Wed Feb 15 01:26:19 2006 --- llvm/projects/Stacker/lib/compiler/StackerParser.y.cvs Wed Feb 15 01:26:07 2006 *************** *** 0 **** --- 1,185 ---- + //===-- StackerParser.y - Parser for Stacker programs -----------*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by the LLVM research group and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file implements the bison parser for Stacker programs. + // + //===----------------------------------------------------------------------===// + + %{ + #include "StackerCompiler.h" + #include "llvm/SymbolTable.h" + #include "llvm/Module.h" + #include "llvm/Instructions.h" + #include "llvm/ADT/STLExtras.h" + #include "llvm/ADT/DepthFirstIterator.h" + #include + #include + #include + + #define YYERROR_VERBOSE 1 + #define SCI StackerCompiler::TheInstance + + int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit + int yylex(); // declaration" of xxx warnings. + int yyparse(); + + %} + + %union + { + llvm::Module* ModuleVal; + llvm::Function* FunctionVal; + llvm::BasicBlock* BasicBlockVal; + int64_t IntegerVal; + char* StringVal; + } + + /* Typed Productions */ + %type Module DefinitionList + %type Definition ForwardDef ColonDef MainDef + %type WordList + %type Word + + /* Typed Tokens */ + %token INTEGER + %token STRING IDENTIFIER + + /* Terminal Tokens */ + %token SEMI COLON FORWARD MAIN DUMP + %token TRUETOK FALSETOK LESS MORE LESS_EQUAL MORE_EQUAL NOT_EQUAL EQUAL + %token PLUS MINUS INCR DECR MULT DIV MODULUS NEGATE ABS MIN MAX STAR_SLASH + %token AND OR XOR LSHIFT RSHIFT + %token DROP DROP2 NIP NIP2 DUP DUP2 SWAP SWAP2 OVER OVER2 ROT ROT2 + %token RROT RROT2 TUCK TUCK2 ROLL PICK SELECT + %token MALLOC FREE GET PUT + %token IF ELSE ENDIF WHILE END RECURSE RETURN EXIT + %token TAB SPACE CR IN_STR IN_NUM IN_CHAR OUT_STR OUT_NUM OUT_CHAR + + /* Start Token */ + %start Module + + %% + + /* A module is just a DefinitionList */ + Module : { SCI->handle_module_start( ); } + DefinitionList { $$ = SCI->handle_module_end( $2 ); } ; + + /* A Definitionlist is just a sequence of definitions */ + DefinitionList : DefinitionList Definition { $$ = SCI->handle_definition_list_end( $1, $2 ); } + | /* empty */ { $$ = SCI->handle_definition_list_start(); } ; + + /* A definition can be one of three flavors */ + Definition : ForwardDef { $$ = $1; } + | ColonDef { $$ = $1; } + | MainDef { $$ = $1; } ; + + /* Forward definitions just introduce a name */ + ForwardDef : FORWARD IDENTIFIER SEMI { $$ = SCI->handle_forward( $2 ); } ; + + /* The main definition has to generate additional code so we treat it specially */ + MainDef : COLON MAIN WordList SEMI { $$ = SCI->handle_main_definition($3); } ; + + /* Regular definitions have a name and a WordList */ + ColonDef : COLON IDENTIFIER WordList SEMI { $$ = SCI->handle_definition( $2, $3 ); } ; + + /* A WordList is just a sequence of words */ + WordList : WordList Word { $$ = SCI->handle_word_list_end( $1, $2 ); } + | /* empty */ { $$ = SCI->handle_word_list_start(); } ; + + /* A few "words" have a funky syntax */ + /* FIXME: The body of compound words can currently only be function calls */ + /* This is not acceptable, it should be a WordList, but that produces a Function */ + /* Which is hard to merge into the function the compound statement is working on */ + Word : IF IDENTIFIER ELSE IDENTIFIER ENDIF { $$ = SCI->handle_if( $2, $4 ); } + | IF IDENTIFIER ENDIF { $$ = SCI->handle_if( $2 ); } + | WHILE IDENTIFIER END { $$ = SCI->handle_while( $2 ); } ; + + /* A few words are handled specially */ + Word : IDENTIFIER { $$ = SCI->handle_identifier( $1 ); } ; + Word : STRING { $$ = SCI->handle_string( $1 ); } ; + Word : INTEGER { $$ = SCI->handle_integer( $1 ); } ; + + /* Everything else is a terminal symbol and goes to handle_word */ + Word : TRUETOK { $$ = SCI->handle_word( TRUETOK ); } ; + Word : FALSETOK { $$ = SCI->handle_word( FALSETOK ); } ; + Word : LESS { $$ = SCI->handle_word( LESS ); } ; + Word : MORE { $$ = SCI->handle_word( MORE ); } ; + Word : LESS_EQUAL { $$ = SCI->handle_word( LESS_EQUAL ); } ; + Word : MORE_EQUAL { $$ = SCI->handle_word( MORE_EQUAL ); } ; + Word : NOT_EQUAL { $$ = SCI->handle_word( NOT_EQUAL ); } ; + Word : EQUAL { $$ = SCI->handle_word( EQUAL ); } ; + Word : PLUS { $$ = SCI->handle_word( PLUS ); } ; + Word : MINUS { $$ = SCI->handle_word( MINUS ); } ; + Word : INCR { $$ = SCI->handle_word( INCR ); } ; + Word : DECR { $$ = SCI->handle_word( DECR ); } ; + Word : MULT { $$ = SCI->handle_word( MULT ); } ; + Word : DIV { $$ = SCI->handle_word( DIV ); } ; + Word : MODULUS { $$ = SCI->handle_word( MODULUS ); } ; + Word : NEGATE { $$ = SCI->handle_word( NEGATE ); } ; + Word : ABS { $$ = SCI->handle_word( ABS ); } ; + Word : MIN { $$ = SCI->handle_word( MIN ); } ; + Word : MAX { $$ = SCI->handle_word( MAX ); } ; + Word : STAR_SLASH { $$ = SCI->handle_word( STAR_SLASH ); } ; + Word : AND { $$ = SCI->handle_word( AND ); } ; + Word : OR { $$ = SCI->handle_word( OR ); } ; + Word : XOR { $$ = SCI->handle_word( XOR ); } ; + Word : LSHIFT { $$ = SCI->handle_word( LSHIFT ); } ; + Word : RSHIFT { $$ = SCI->handle_word( RSHIFT ); } ; + Word : DROP { $$ = SCI->handle_word( DROP ); } ; + Word : DROP2 { $$ = SCI->handle_word( DROP2 ); } ; + Word : NIP { $$ = SCI->handle_word( NIP ); } ; + Word : NIP2 { $$ = SCI->handle_word( NIP2 ); } ; + Word : DUP { $$ = SCI->handle_word( DUP ); } ; + Word : DUP2 { $$ = SCI->handle_word( DUP2 ); } ; + Word : SWAP { $$ = SCI->handle_word( SWAP ); } ; + Word : SWAP2 { $$ = SCI->handle_word( SWAP2 ); } ; + Word : OVER { $$ = SCI->handle_word( OVER ); } ; + Word : OVER2 { $$ = SCI->handle_word( OVER2 ); } ; + Word : ROT { $$ = SCI->handle_word( ROT ); } ; + Word : ROT2 { $$ = SCI->handle_word( ROT2 ); } ; + Word : RROT { $$ = SCI->handle_word( RROT ); } ; + Word : RROT2 { $$ = SCI->handle_word( RROT2 ); } ; + Word : TUCK { $$ = SCI->handle_word( TUCK ); } ; + Word : TUCK2 { $$ = SCI->handle_word( TUCK2 ); } ; + Word : ROLL { $$ = SCI->handle_word( ROLL ); } ; + Word : PICK { $$ = SCI->handle_word( PICK ); } ; + Word : SELECT { $$ = SCI->handle_word( SELECT ); } ; + Word : MALLOC { $$ = SCI->handle_word( MALLOC ); } ; + Word : FREE { $$ = SCI->handle_word( FREE ); } ; + Word : GET { $$ = SCI->handle_word( GET ); } ; + Word : PUT { $$ = SCI->handle_word( PUT ); } ; + Word : RECURSE { $$ = SCI->handle_word( RECURSE ); } ; + Word : RETURN { $$ = SCI->handle_word( RETURN ); } ; + Word : EXIT { $$ = SCI->handle_word( EXIT ); } ; + Word : TAB { $$ = SCI->handle_word( TAB ); }; + Word : SPACE { $$ = SCI->handle_word( SPACE ); } ; + Word : CR { $$ = SCI->handle_word( CR ); } ; + Word : IN_STR { $$ = SCI->handle_word( IN_STR ); } ; + Word : IN_NUM { $$ = SCI->handle_word( IN_NUM ); } ; + Word : IN_CHAR { $$ = SCI->handle_word( IN_CHAR ); } ; + Word : OUT_STR { $$ = SCI->handle_word( OUT_STR ); } ; + Word : OUT_NUM { $$ = SCI->handle_word( OUT_NUM ); } ; + Word : OUT_CHAR { $$ = SCI->handle_word( OUT_CHAR ); } ; + Word : DUMP { $$ = SCI->handle_word( DUMP ); } ; + + %% + + /* Handle messages a little more nicely than the default yyerror */ + int yyerror(const char *ErrorMsg) { + std::string where + = std::string((SCI->filename() == "-") ? std::string("") : SCI->filename()) + + ":" + utostr((unsigned) Stackerlineno ) + ": "; + std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading "; + if (yychar == YYEMPTY) + errMsg += "end-of-file."; + else + errMsg += "token: '" + std::string(Stackertext, Stackerleng) + "'"; + StackerCompiler::ThrowException(errMsg); + return 0; + } From lattner at cs.uiuc.edu Wed Feb 15 01:38:49 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 15 Feb 2006 01:38:49 -0600 Subject: [llvm-commits] CVS: llvm-test/MultiSource/Applications/JM/lencod/q_matrix.c q_offsets.c Message-ID: <200602150738.BAA18790@zion.cs.uiuc.edu> Changes in directory llvm-test/MultiSource/Applications/JM/lencod: q_matrix.c updated: 1.1 -> 1.2 q_offsets.c updated: 1.1 -> 1.2 --- Log message: Fix prototypes to match the definition --- Diffs of the changes: (+4 -4) q_matrix.c | 4 ++-- q_offsets.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) Index: llvm-test/MultiSource/Applications/JM/lencod/q_matrix.c diff -u llvm-test/MultiSource/Applications/JM/lencod/q_matrix.c:1.1 llvm-test/MultiSource/Applications/JM/lencod/q_matrix.c:1.2 --- llvm-test/MultiSource/Applications/JM/lencod/q_matrix.c:1.1 Sat Feb 11 04:33:22 2006 +++ llvm-test/MultiSource/Applications/JM/lencod/q_matrix.c Wed Feb 15 01:38:36 2006 @@ -14,7 +14,7 @@ #include "global.h" #include "memalloc.h" -extern char *GetConfigFileContent (char *Filename, int error_type); +extern char *GetConfigFileContent (char *Filename); #define MAX_ITEMS_TO_PARSE 1000 @@ -402,7 +402,7 @@ if(input->ScalingMatrixPresentFlag) { printf ("Parsing QMatrix file %s ", input->QmatrixFile); - content = GetConfigFileContent(input->QmatrixFile, 0); + content = GetConfigFileContent(input->QmatrixFile); if(content!='\0') ParseMatrix(content, strlen (content)); else Index: llvm-test/MultiSource/Applications/JM/lencod/q_offsets.c diff -u llvm-test/MultiSource/Applications/JM/lencod/q_offsets.c:1.1 llvm-test/MultiSource/Applications/JM/lencod/q_offsets.c:1.2 --- llvm-test/MultiSource/Applications/JM/lencod/q_offsets.c:1.1 Sat Feb 11 04:33:22 2006 +++ llvm-test/MultiSource/Applications/JM/lencod/q_offsets.c Wed Feb 15 01:38:36 2006 @@ -14,7 +14,7 @@ #include "global.h" #include "memalloc.h" -extern char *GetConfigFileContent (char *Filename, int error_type); +extern char *GetConfigFileContent (char *Filename); #define MAX_ITEMS_TO_PARSE 1000 @@ -339,7 +339,7 @@ { printf ("Parsing Quantization Offset Matrix file %s ", input->QOffsetMatrixFile); - content = GetConfigFileContent (input->QOffsetMatrixFile, 0); + content = GetConfigFileContent (input->QOffsetMatrixFile); if (content != '\0') ParseQOffsetMatrix (content, strlen (content)); else From duraid at octopus.com.au Wed Feb 15 01:42:44 2006 From: duraid at octopus.com.au (duraid at octopus.com.au) Date: Wed, 15 Feb 2006 18:42:44 +1100 (EST) Subject: [llvm-commits] CVS: llvm/autoconf/configure.ac In-Reply-To: References: <200602150316.VAA17105@zion.cs.uiuc.edu> <1139983724.5130.33.camel@bashful.x10sys.com> Message-ID: <55053.129.94.176.241.1139989364.squirrel@secure.octopus.com.au> > On Tue, 14 Feb 2006, Reid Spencer wrote: >> Rather than just kill this checking, I would prefer it if the aCC >> compiler was added to the check for supported compilers. This >> configuration check (that you've deleted) can prevent really bad things >> happening downstream. Not trying to be picky, but what kind of really bad things are we talking about? The worst thing I can imagine is that a build fails because there's some issue between the source/makefiles and the user's toolchain. > FWIW, I agree with reid. I did ask..! :) For now, I'll just revert it and add aCC-specific stuff later (the get-rid-of-hash-tables patch is still to come) but the intention was that with a little bit of work LLVM could be made and kept standard-compliant and so "any good compiler" should work, in theory. Should we insist on known-good compilers, abort on known-bad compilers, spit out scary warning messages, or something else again? Anyway, for now I'll just revert this. Sorry guys! :) Duraid > -Chris > >> On Tue, 2006-02-14 at 21:16 -0600, Duraid Madina wrote: >>> >>> Changes in directory llvm/autoconf: >>> >>> configure.ac updated: 1.207 -> 1.208 >>> --- >>> Log message: >>> >>> previously, configure would die if GCC or ICC was not found. Now it'll >>> go through, but we do want to know if we're using GCC/ICC since they >>> share certain funky command line options (for dependency generation >>> stuff) >>> >>> >>> >>> --- >>> Diffs of the changes: (+0 -11) >>> >>> configure.ac | 11 ----------- >>> 1 files changed, 11 deletions(-) >>> >>> >>> Index: llvm/autoconf/configure.ac >>> diff -u llvm/autoconf/configure.ac:1.207 >>> llvm/autoconf/configure.ac:1.208 >>> --- llvm/autoconf/configure.ac:1.207 Sat Feb 4 23:56:51 2006 >>> +++ llvm/autoconf/configure.ac Tue Feb 14 21:15:55 2006 >>> @@ -412,17 +412,6 @@ >>> ;; >>> esac >>> >>> -if test "$GCC" != "yes" && test "$ICC" != "yes" >>> -then >>> - AC_MSG_ERROR([gcc|icc required but not found]) >>> -fi >>> - >>> -dnl Ensure that compilation tools are GCC; we use GCC specific >>> extensions >>> -if test "$GXX" != "yes" && test "$IXX" != "yes" >>> -then >>> - AC_MSG_ERROR([g++|icc required but not found]) >>> -fi >>> - >>> dnl Verify that GCC is version 3.0 or higher >>> if test "$GCC" = "yes" >>> then >>> >>> >>> >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> > > -Chris > > -- > http://nondot.org/sabre/ > http://llvm.org/ > From duraid at octopus.com.au Wed Feb 15 01:56:51 2006 From: duraid at octopus.com.au (Duraid Madina) Date: Wed, 15 Feb 2006 01:56:51 -0600 Subject: [llvm-commits] CVS: llvm/configure Message-ID: <200602150756.BAA18895@zion.cs.uiuc.edu> Changes in directory llvm: configure updated: 1.210 -> 1.211 --- Log message: reverting previous change, will add support for other compilers later --- Diffs of the changes: (+14 -0) configure | 14 ++++++++++++++ 1 files changed, 14 insertions(+) Index: llvm/configure diff -u llvm/configure:1.210 llvm/configure:1.211 --- llvm/configure:1.210 Tue Feb 14 21:16:52 2006 +++ llvm/configure Wed Feb 15 01:56:38 2006 @@ -24870,6 +24870,20 @@ ;; esac +if test "$GCC" != "yes" && test "$ICC" != "yes" +then + { { echo "$as_me:$LINENO: error: gcc|icc required but not found" >&5 +echo "$as_me: error: gcc|icc required but not found" >&2;} + { (exit 1); exit 1; }; } +fi + +if test "$GXX" != "yes" && test "$IXX" != "yes" +then + { { echo "$as_me:$LINENO: error: g++|icc required but not found" >&5 +echo "$as_me: error: g++|icc required but not found" >&2;} + { (exit 1); exit 1; }; } +fi + if test "$GCC" = "yes" then gccmajor=`$CC --version | head -n 1 | sed 's/[^0-9]*\([0-9.]\).*/\1/'` From duraid at octopus.com.au Wed Feb 15 01:57:54 2006 From: duraid at octopus.com.au (Duraid Madina) Date: Wed, 15 Feb 2006 01:57:54 -0600 Subject: [llvm-commits] CVS: llvm/autoconf/configure.ac Message-ID: <200602150757.BAA18907@zion.cs.uiuc.edu> Changes in directory llvm/autoconf: configure.ac updated: 1.208 -> 1.209 --- Log message: reverting previous change, will add support for other compilers later --- Diffs of the changes: (+11 -0) configure.ac | 11 +++++++++++ 1 files changed, 11 insertions(+) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.208 llvm/autoconf/configure.ac:1.209 --- llvm/autoconf/configure.ac:1.208 Tue Feb 14 21:15:55 2006 +++ llvm/autoconf/configure.ac Wed Feb 15 01:57:42 2006 @@ -412,6 +412,17 @@ ;; esac +if test "$GCC" != "yes" && test "$ICC" != "yes" +then + AC_MSG_ERROR([gcc|icc required but not found]) +fi + +dnl Ensure that compilation tools are GCC; we use GCC specific extensions +if test "$GXX" != "yes" && test "$IXX" != "yes" +then + AC_MSG_ERROR([g++|icc required but not found]) +fi + dnl Verify that GCC is version 3.0 or higher if test "$GCC" = "yes" then From reid at x10sys.com Wed Feb 15 09:30:32 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 15 Feb 2006 07:30:32 -0800 Subject: [llvm-commits] CVS: llvm/autoconf/configure.ac In-Reply-To: <55053.129.94.176.241.1139989364.squirrel@secure.octopus.com.au> References: <200602150316.VAA17105@zion.cs.uiuc.edu> <1139983724.5130.33.camel@bashful.x10sys.com> <55053.129.94.176.241.1139989364.squirrel@secure.octopus.com.au> Message-ID: <1140017432.5130.43.camel@bashful.x10sys.com> On Wed, 2006-02-15 at 18:42 +1100, duraid at octopus.com.au wrote: > > On Tue, 14 Feb 2006, Reid Spencer wrote: > >> Rather than just kill this checking, I would prefer it if the aCC > >> compiler was added to the check for supported compilers. This > >> configuration check (that you've deleted) can prevent really bad things > >> happening downstream. > > Not trying to be picky, but what kind of really bad things are we talking > about? The worst thing I can imagine is that a build fails because there's > some issue between the source/makefiles and the user's toolchain. configure by default depends on gcc options in order to test the capabilities of the system being configured. So, what will happen is that you'll most likely get a misconfiguration of the HPUX system (lots of missing capabilities) which could make it impossible to get LLVM working on that platform. Its possible to use another compiler for the configuration checks but not without a lot of setup that we don't have in the configure.ac script right now. > > > FWIW, I agree with reid. > > I did ask..! :) For now, I'll just revert it and add aCC-specific stuff > later Okay, but its going to require that you ensure the aCC compiler can be used for all the configuration tests. Please test this thoroughly before committing it again. In particular you need to make sure that the include/llvm/Config/config.h.in file is generated correctly for your HPUX system. > (the get-rid-of-hash-tables patch is still to come) do you mean the configure test for them? or, are you planning to rid LLVM of hashtables altogether? If the latter, I suggest we talk a bit about this because hashtables are the right choice in a few places. > but the > intention was that with a little bit of work LLVM could be made and kept > standard-compliant and so "any good compiler" should work, in theory. Theory is one thing, practice is another. While its *possible* to configure for a non-GCC compliant compiler, its not easy. You need to understand how autoconf works to do that. > Should we insist on known-good compilers, yes. > abort on known-bad compilers, yes, but lets just say "non-known-good-compilers" > spit out scary warning messages, warnings should only be done if there's a hope of the configuration and compilation being done correctly. If not, the correct thing to do is stop with a hard error. Its better the user understand the problem early rather than later. > or something else again? I'm open to ideas. > Anyway, for now I'll just revert this. Sorry guys! :) Thanks. Reid -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20060215/f0217d32/attachment.bin From alenhar2 at cs.uiuc.edu Wed Feb 15 11:14:08 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Wed, 15 Feb 2006 11:14:08 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/Regressions/ Message-ID: <200602151714.LAA01936@zion.cs.uiuc.edu> Changes in directory llvm-poolalloc/Regressions: --- Log message: Directory /home/vadve/shared/PublicCVS/llvm-poolalloc/Regressions added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From alenhar2 at cs.uiuc.edu Wed Feb 15 11:17:04 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Wed, 15 Feb 2006 11:17:04 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/Regressions/2006-02-13.ArrayOfObjects.ll Message-ID: <200602151717.LAA01962@zion.cs.uiuc.edu> Changes in directory llvm-poolalloc/Regressions: 2006-02-13.ArrayOfObjects.ll added (r1.1) --- Log message: An error reduced from Shootout/lists. Patch exists. --- Diffs of the changes: (+0 -0) 0 files changed From jlaskey at apple.com Wed Feb 15 11:21:22 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 15 Feb 2006 11:21:22 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/Generic/DebugStuff.ll Message-ID: <200602151721.LAA02095@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/Generic: DebugStuff.ll updated: 1.3 -> 1.4 --- Log message: Code sufficiently protected against this test. --- Diffs of the changes: (+0 -1) DebugStuff.ll | 1 - 1 files changed, 1 deletion(-) Index: llvm/test/Regression/CodeGen/Generic/DebugStuff.ll diff -u llvm/test/Regression/CodeGen/Generic/DebugStuff.ll:1.3 llvm/test/Regression/CodeGen/Generic/DebugStuff.ll:1.4 --- llvm/test/Regression/CodeGen/Generic/DebugStuff.ll:1.3 Thu Feb 9 01:12:13 2006 +++ llvm/test/Regression/CodeGen/Generic/DebugStuff.ll Wed Feb 15 11:20:59 2006 @@ -1,6 +1,5 @@ ; Verify debugger intrinsics are ignored or accepted. ; RUN: llvm-as < %s | llc -; XFAIL: powerpc ;; Debugger type declarations %lldb.compile_unit = type { uint, ushort, ushort, sbyte*, sbyte*, sbyte*, {}* } From alenhar2 at cs.uiuc.edu Wed Feb 15 11:27:17 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Wed, 15 Feb 2006 11:27:17 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/Regressions/2006-02-13.ArrayOfObjects.ll Message-ID: <200602151727.LAA02368@zion.cs.uiuc.edu> Changes in directory llvm-poolalloc/Regressions: 2006-02-13.ArrayOfObjects.ll updated: 1.1 -> 1.2 --- Log message: note this is pointer compression --- Diffs of the changes: (+0 -0) 0 files changed From lattner at cs.uiuc.edu Wed Feb 15 13:06:03 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 15 Feb 2006 13:06:03 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Message-ID: <200602151906.NAA03800@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LoopUnswitch.cpp updated: 1.20 -> 1.21 --- Log message: Checking the wrong value. This caused us to emit silly code like Y = seteq bool X, true instead of just using X :) --- Diffs of the changes: (+1 -1) LoopUnswitch.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.20 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.21 --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.20 Tue Feb 14 19:44:42 2006 +++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Wed Feb 15 13:05:52 2006 @@ -442,7 +442,7 @@ // Insert a conditional branch on LIC to the two preheaders. The original // code is the true version and the new code is the false version. Value *BranchVal = LIC; - if (!isa(BranchVal)) { + if (!isa(Val)) { BranchVal = BinaryOperator::createSetEQ(LIC, Val, "tmp", InsertPt); } else if (Val != ConstantBool::True) { // We want to enter the new loop when the condition is true. From jlaskey at apple.com Wed Feb 15 13:34:56 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 15 Feb 2006 13:34:56 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp LegalizeDAG.cpp Message-ID: <200602151934.NAA04034@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.100 -> 1.101 LegalizeDAG.cpp updated: 1.303 -> 1.304 --- Log message: Should not combine ISD::LOCATIONs until we have scheme to remove from MachineDebugInfo tables. --- Diffs of the changes: (+2 -36) DAGCombiner.cpp | 34 ---------------------------------- LegalizeDAG.cpp | 4 ++-- 2 files changed, 2 insertions(+), 36 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.100 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.101 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.100 Tue Feb 7 20:13:15 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed Feb 15 13:34:44 2006 @@ -175,9 +175,6 @@ SDOperand visitLOAD(SDNode *N); SDOperand visitSTORE(SDNode *N); - SDOperand visitLOCATION(SDNode *N); - SDOperand visitDEBUGLOC(SDNode *N); - SDOperand ReassociateOps(unsigned Opc, SDOperand LHS, SDOperand RHS); bool SimplifySelectOps(SDNode *SELECT, SDOperand LHS, SDOperand RHS); @@ -568,8 +565,6 @@ case ISD::BRTWOWAY_CC: return visitBRTWOWAY_CC(N); case ISD::LOAD: return visitLOAD(N); case ISD::STORE: return visitSTORE(N); - case ISD::LOCATION: return visitLOCATION(N); - case ISD::DEBUG_LOC: return visitDEBUGLOC(N); } return SDOperand(); } @@ -2162,35 +2157,6 @@ return SDOperand(); } -SDOperand DAGCombiner::visitLOCATION(SDNode *N) { - SDOperand Chain = N->getOperand(0); - - // Remove redundant locations (last one holds) - if (Chain.getOpcode() == ISD::LOCATION && Chain.hasOneUse()) { - return DAG.getNode(ISD::LOCATION, MVT::Other, Chain.getOperand(0), - N->getOperand(1), - N->getOperand(2), - N->getOperand(3), - N->getOperand(4)); - } - - return SDOperand(); -} - -SDOperand DAGCombiner::visitDEBUGLOC(SDNode *N) { - SDOperand Chain = N->getOperand(0); - - // Remove redundant debug locations (last one holds) - if (Chain.getOpcode() == ISD::DEBUG_LOC && Chain.hasOneUse()) { - return DAG.getNode(ISD::DEBUG_LOC, MVT::Other, Chain.getOperand(0), - N->getOperand(1), - N->getOperand(2), - N->getOperand(3)); - } - - return SDOperand(); -} - SDOperand DAGCombiner::SimplifySelect(SDOperand N0, SDOperand N1, SDOperand N2){ assert(N0.getOpcode() ==ISD::SETCC && "First argument must be a SetCC node!"); Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.303 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.304 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.303 Mon Feb 13 18:55:02 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Wed Feb 15 13:34:44 2006 @@ -519,8 +519,8 @@ Ops.push_back(DAG.getConstant(SrcFile, MVT::i32)); // source file id Result = DAG.getNode(ISD::DEBUG_LOC, MVT::Other, Ops); } else { - unsigned Line = dyn_cast(LineOp)->getValue(); - unsigned Col = dyn_cast(ColOp)->getValue(); + unsigned Line = cast(LineOp)->getValue(); + unsigned Col = cast(ColOp)->getValue(); unsigned ID = DebugInfo->RecordLabel(Line, Col, SrcFile); Ops.push_back(DAG.getConstant(ID, MVT::i32)); Result = DAG.getNode(ISD::DEBUG_LABEL, MVT::Other, Ops); From lattner at cs.uiuc.edu Wed Feb 15 13:52:18 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 15 Feb 2006 13:52:18 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/README.txt Message-ID: <200602151952.NAA19456@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: README.txt updated: 1.5 -> 1.6 --- Log message: new test --- Diffs of the changes: (+12 -0) README.txt | 12 ++++++++++++ 1 files changed, 12 insertions(+) Index: llvm/lib/Target/README.txt diff -u llvm/lib/Target/README.txt:1.5 llvm/lib/Target/README.txt:1.6 --- llvm/lib/Target/README.txt:1.5 Sun Feb 5 02:26:16 2006 +++ llvm/lib/Target/README.txt Wed Feb 15 13:52:06 2006 @@ -64,3 +64,15 @@ //===---------------------------------------------------------------------===// +DAG combine this into mul A, 8: + +int %test(int %A) { + %B = mul int %A, 8 ;; shift + %C = add int %B, 7 ;; dead, no demanded bits. + %D = and int %C, -8 ;; dead once add is gone. + ret int %D +} + +This sort of thing occurs in the alloca lowering code and other places that +are generating alignment of an already aligned value. + From alenhar2 at cs.uiuc.edu Wed Feb 15 15:13:59 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Wed, 15 Feb 2006 15:13:59 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp Message-ID: <200602152113.PAA28911@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: SimplifyLibCalls.cpp updated: 1.61 -> 1.62 --- Log message: fix a bunch of alpha regressions. see bug 709: http://llvm.cs.uiuc.edu/PR709 --- Diffs of the changes: (+6 -6) SimplifyLibCalls.cpp | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) Index: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp diff -u llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.61 llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.62 --- llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.61 Mon Jan 23 00:24:46 2006 +++ llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp Wed Feb 15 15:13:37 2006 @@ -284,7 +284,7 @@ if (!memcpy_func) { const Type *SBP = PointerType::get(Type::SByteTy); memcpy_func = M->getOrInsertFunction("llvm.memcpy", Type::VoidTy,SBP, SBP, - Type::UIntTy, Type::UIntTy, NULL); + TD->getIntPtrType(), Type::UIntTy, NULL); } return memcpy_func; } @@ -483,7 +483,7 @@ std::vector vals; vals.push_back(gep); // destination vals.push_back(ci->getOperand(2)); // source - vals.push_back(ConstantUInt::get(Type::UIntTy,len)); // length + vals.push_back(ConstantUInt::get(SLC.getIntPtrType(),len)); // length vals.push_back(ConstantUInt::get(Type::UIntTy,1)); // alignment new CallInst(SLC.get_memcpy(), vals, "", ci); @@ -812,7 +812,7 @@ std::vector vals; vals.push_back(dest); // destination vals.push_back(src); // source - vals.push_back(ConstantUInt::get(Type::UIntTy,len)); // length + vals.push_back(ConstantUInt::get(SLC.getIntPtrType(),len)); // length vals.push_back(ConstantUInt::get(Type::UIntTy,1)); // alignment new CallInst(SLC.get_memcpy(), vals, "", ci); @@ -1444,7 +1444,7 @@ std::vector args; args.push_back(ci->getOperand(1)); args.push_back(ci->getOperand(2)); - args.push_back(ConstantUInt::get(Type::UIntTy,len)); + args.push_back(ConstantUInt::get(SLC.getIntPtrType(),len)); args.push_back(ConstantUInt::get(Type::UIntTy,1)); new CallInst(memcpy_func,args,"",ci); ci->replaceAllUsesWith(ConstantSInt::get(Type::IntTy,len)); @@ -1477,8 +1477,8 @@ Value *Len1 = BinaryOperator::createAdd(Len, ConstantInt::get(Len->getType(), 1), Len->getName()+"1", ci); - if (Len1->getType() != Type::UIntTy) - Len1 = new CastInst(Len1, Type::UIntTy, Len1->getName(), ci); + if (Len1->getType() != SLC.getIntPtrType()) + Len1 = new CastInst(Len1, SLC.getIntPtrType(), Len1->getName(), ci); std::vector args; args.push_back(CastToCStr(ci->getOperand(1), *ci)); args.push_back(CastToCStr(ci->getOperand(3), *ci)); From evan.cheng at apple.com Wed Feb 15 15:59:16 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 15 Feb 2006 15:59:16 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200602152159.PAA22982@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.160 -> 1.161 --- Log message: Turn a memcpy from string constant into a series of stores of constant values. --- Diffs of the changes: (+69 -47) SelectionDAGISel.cpp | 116 ++++++++++++++++++++++++++++++--------------------- 1 files changed, 69 insertions(+), 47 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.160 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.161 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.160 Tue Feb 14 19:54:51 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Feb 15 15:59:04 2006 @@ -807,36 +807,15 @@ /// getStringValue - Turn an LLVM constant pointer that eventually points to a /// global into a string value. Return an empty string if we can't do it. /// -static std::string getStringValue(Value *V, unsigned Offset = 0) { - if (GlobalVariable *GV = dyn_cast(V)) { - if (GV->hasInitializer() && isa(GV->getInitializer())) { - ConstantArray *Init = cast(GV->getInitializer()); - if (Init->isString()) { - std::string Result = Init->getAsString(); - if (Offset < Result.size()) { - // If we are pointing INTO The string, erase the beginning... - Result.erase(Result.begin(), Result.begin()+Offset); - - // Take off the null terminator, and any string fragments after it. - std::string::size_type NullPos = Result.find_first_of((char)0); - if (NullPos != std::string::npos) - Result.erase(Result.begin()+NullPos, Result.end()); - return Result; - } - } - } - } else if (Constant *C = dyn_cast(V)) { - if (GlobalValue *GV = dyn_cast(C)) - return getStringValue(GV, Offset); - else if (ConstantExpr *CE = dyn_cast(C)) { - if (CE->getOpcode() == Instruction::GetElementPtr) { - // Turn a gep into the specified offset. - if (CE->getNumOperands() == 3 && - cast(CE->getOperand(1))->isNullValue() && - isa(CE->getOperand(2))) { - return getStringValue(CE->getOperand(0), - Offset+cast(CE->getOperand(2))->getRawValue()); - } +static std::string getStringValue(GlobalVariable *GV, unsigned Offset = 0) { + if (GV->hasInitializer() && isa(GV->getInitializer())) { + ConstantArray *Init = cast(GV->getInitializer()); + if (Init->isString()) { + std::string Result = Init->getAsString(); + if (Offset < Result.size()) { + // If we are pointing INTO The string, erase the beginning... + Result.erase(Result.begin(), Result.begin()+Offset); + return Result; } } } @@ -1523,13 +1502,10 @@ DAG.setRoot(Result.second); } -/// getMemSetValue - Vectorized representation of the memset value +/// getMemsetValue - Vectorized representation of the memset value /// operand. static SDOperand getMemsetValue(SDOperand Value, MVT::ValueType VT, - SelectionDAG &DAG) { - if (VT == MVT::i8) - return Value; - + SelectionDAG &DAG, TargetLowering &TLI) { MVT::ValueType CurVT = VT; if (ConstantSDNode *C = dyn_cast(Value)) { uint64_t Val = C->getValue() & 255; @@ -1556,6 +1532,24 @@ } } +/// getMemsetStringVal - Similar to getMemsetValue. Except this is only +/// used when a memcpy is turned into a memset when the source is a constant +/// string ptr. +static SDOperand getMemsetStringVal(MVT::ValueType VT, + SelectionDAG &DAG, TargetLowering &TLI, + std::string &Str, unsigned Offset) { + MVT::ValueType CurVT = VT; + uint64_t Val = 0; + unsigned MSB = getSizeInBits(VT) / 8; + if (TLI.isLittleEndian()) + Offset = Offset + MSB - 1; + for (unsigned i = 0; i != MSB; ++i) { + Val = (Val << 8) | Str[Offset]; + Offset += TLI.isLittleEndian() ? -1 : 1; + } + return DAG.getConstant(Val, VT); +} + /// getMemBasePlusOffset - Returns base and offset node for the static SDOperand getMemBasePlusOffset(SDOperand Base, unsigned Offset, SelectionDAG &DAG, TargetLowering &TLI) { @@ -1640,7 +1634,7 @@ for (unsigned i = 0; i < NumMemOps; i++) { MVT::ValueType VT = MemOps[i]; unsigned VTSize = getSizeInBits(VT) / 8; - SDOperand Value = getMemsetValue(Op2, VT, DAG); + SDOperand Value = getMemsetValue(Op2, VT, DAG, TLI); SDOperand Store = DAG.getNode(ISD::STORE, MVT::Other, getRoot(), Value, getMemBasePlusOffset(Op1, Offset, DAG, TLI), @@ -1655,21 +1649,49 @@ if (MeetsMaxMemopRequirement(MemOps, TLI.getMaxStoresPerMemcpy(), Size->getValue(), Align, TLI)) { unsigned NumMemOps = MemOps.size(); - unsigned Offset = 0; + unsigned SrcOff = 0, DstOff = 0; + GlobalAddressSDNode *G = NULL; + std::string Str; + + if (Op2.getOpcode() == ISD::GlobalAddress) + G = cast(Op2); + else if (Op2.getOpcode() == ISD::ADD && + Op2.getOperand(0).getOpcode() == ISD::GlobalAddress && + Op2.getOperand(1).getOpcode() == ISD::Constant) { + G = cast(Op2.getOperand(0)); + SrcOff += cast(Op2.getOperand(1))->getValue(); + } + if (G) { + GlobalVariable *GV = dyn_cast(G->getGlobal()); + if (GV) + Str = getStringValue(GV); + } + for (unsigned i = 0; i < NumMemOps; i++) { MVT::ValueType VT = MemOps[i]; unsigned VTSize = getSizeInBits(VT) / 8; - SDOperand Value = - DAG.getLoad(VT, getRoot(), - getMemBasePlusOffset(Op2, Offset, DAG, TLI), - DAG.getSrcValue(I.getOperand(2), Offset)); - SDOperand Store = - DAG.getNode(ISD::STORE, MVT::Other, Value.getValue(1), - Value, - getMemBasePlusOffset(Op1, Offset, DAG, TLI), - DAG.getSrcValue(I.getOperand(1), Offset)); + SDOperand Value, Chain, Store; + + if (!Str.empty()) { + Value = getMemsetStringVal(VT, DAG, TLI, Str, SrcOff); + Chain = getRoot(); + Store = + DAG.getNode(ISD::STORE, MVT::Other, Chain, Value, + getMemBasePlusOffset(Op1, DstOff, DAG, TLI), + DAG.getSrcValue(I.getOperand(1), DstOff)); + } else { + Value = DAG.getLoad(VT, getRoot(), + getMemBasePlusOffset(Op2, SrcOff, DAG, TLI), + DAG.getSrcValue(I.getOperand(2), SrcOff)); + Chain = Value.getValue(1); + Store = + DAG.getNode(ISD::STORE, MVT::Other, Chain, Value, + getMemBasePlusOffset(Op1, DstOff, DAG, TLI), + DAG.getSrcValue(I.getOperand(1), DstOff)); + } OutChains.push_back(Store); - Offset += VTSize; + SrcOff += VTSize; + DstOff += VTSize; } } break; From lattner at cs.uiuc.edu Wed Feb 15 16:03:47 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 15 Feb 2006 16:03:47 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Message-ID: <200602152203.QAA23093@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LoopUnswitch.cpp updated: 1.21 -> 1.22 --- Log message: make "trivial" unswitching significantly more general. It can now handle this for example: for (j = 0; j < N; ++j) { // trivial unswitch if (C) P[i+j] = 0; } turning it into the obvious code without bothering to duplicate an empty loop. --- Diffs of the changes: (+79 -47) LoopUnswitch.cpp | 126 ++++++++++++++++++++++++++++++++++--------------------- 1 files changed, 79 insertions(+), 47 deletions(-) Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.21 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.22 --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.21 Wed Feb 15 13:05:52 2006 +++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Wed Feb 15 16:03:36 2006 @@ -75,6 +75,7 @@ void VersionLoop(Value *LIC, Constant *OnVal, Loop *L, Loop *&Out1, Loop *&Out2); BasicBlock *SplitEdge(BasicBlock *From, BasicBlock *To); + BasicBlock *SplitBlock(BasicBlock *Old, Instruction *SplitPt); void RewriteLoopBodyWithConditionConstant(Loop *L, Value *LIC,Constant *Val, bool isEqual); void UnswitchTrivialCondition(Loop *L, Value *Cond, Constant *Val, @@ -123,26 +124,50 @@ return false; } -/// FindTrivialLoopExitBlock - We know that we have a branch from the loop -/// header to the specified latch block. See if one of the successors of the -/// latch block is an exit, and if so what block it is. -static BasicBlock *FindTrivialLoopExitBlock(Loop *L, BasicBlock *Latch) { +/// isTrivialLoopExitBlock - Check to see if all paths from BB either: +/// 1. Exit the loop with no side effects. +/// 2. Branch to the latch block with no side-effects. +/// +/// If these conditions are true, we return true and set ExitBB to the block we +/// exit through. +/// +static bool isTrivialLoopExitBlockHelper(Loop *L, BasicBlock *BB, + BasicBlock *&ExitBB, + std::set &Visited) { BasicBlock *Header = L->getHeader(); - BranchInst *LatchBranch = dyn_cast(Latch->getTerminator()); - if (!LatchBranch || !LatchBranch->isConditional()) return 0; - - // Simple case, the latch block is a conditional branch. The target that - // doesn't go to the loop header is our block if it is not in the loop. - if (LatchBranch->getSuccessor(0) == Header) { - if (L->contains(LatchBranch->getSuccessor(1))) return false; - return LatchBranch->getSuccessor(1); - } else { - assert(LatchBranch->getSuccessor(1) == Header); - if (L->contains(LatchBranch->getSuccessor(0))) return false; - return LatchBranch->getSuccessor(0); + for (succ_iterator SI = succ_begin(BB), E = succ_end(BB); SI != E; ++SI) { + if (!Visited.insert(*SI).second) { + // Already visited and Ok, end of recursion. + } else if (L->contains(*SI)) { + // Check to see if the successor is a trivial loop exit. + if (!isTrivialLoopExitBlockHelper(L, *SI, ExitBB, Visited)) + return false; + } else { + // Otherwise, this is a loop exit, this is fine so long as this is the + // first exit. + if (ExitBB != 0) return false; + ExitBB = *SI; + } } + + // Okay, everything after this looks good, check to make sure that this block + // doesn't include any side effects. + for (BasicBlock::iterator I = Header->begin(), E = Header->end(); I != E; ++I) + if (I->mayWriteToMemory()) + return false; + + return true; } +static BasicBlock *isTrivialLoopExitBlock(Loop *L, BasicBlock *BB) { + std::set Visited; + Visited.insert(L->getHeader()); // Branches to header are ok. + Visited.insert(BB); // Don't revisit BB after we do. + BasicBlock *ExitBB = 0; + if (isTrivialLoopExitBlockHelper(L, BB, ExitBB, Visited)) + return ExitBB; + return 0; +} /// IsTrivialUnswitchCondition - Check to see if this unswitch condition is /// trivial: that is, that the condition controls whether or not the loop does @@ -165,33 +190,30 @@ HeaderTerm->getCondition() != Cond) return false; - // Check to see if the conditional branch goes to the latch block. If not, - // it's not trivial. This also determines the value of Cond that will execute - // the loop. - BasicBlock *Latch = L->getLoopLatch(); - if (HeaderTerm->getSuccessor(1) == Latch) { + // Check to see if a successor of the branch is guaranteed to go to the latch + // block or exit through a one exit block without having any side-effects. If + // so, determine the value of Cond that causes it to do this. + BasicBlock *LoopExitBlock = 0; + if ((LoopExitBlock = isTrivialLoopExitBlock(L, HeaderTerm->getSuccessor(0)))){ if (Val) *Val = ConstantBool::True; - } else if (HeaderTerm->getSuccessor(0) == Latch) + } else if ((LoopExitBlock = + isTrivialLoopExitBlock(L, HeaderTerm->getSuccessor(1)))) { if (Val) *Val = ConstantBool::False; - else - return false; // Doesn't branch to latch block. + } + + if (!LoopExitBlock) + return false; // Can't handle this. - // The latch block must end with a conditional branch where one edge goes to - // the header (this much we know) and one edge goes OUT of the loop. - BasicBlock *LoopExitBlock = FindTrivialLoopExitBlock(L, Latch); - if (!LoopExitBlock) return 0; if (LoopExit) *LoopExit = LoopExitBlock; // We already know that nothing uses any scalar values defined inside of this // loop. As such, we just have to check to see if this loop will execute any // side-effecting instructions (e.g. stores, calls, volatile loads) in the - // part of the loop that the code *would* execute. + // part of the loop that the code *would* execute. We already checked the + // tail, check the header now. for (BasicBlock::iterator I = Header->begin(), E = Header->end(); I != E; ++I) if (I->mayWriteToMemory()) return false; - for (BasicBlock::iterator I = Latch->begin(), E = Latch->end(); I != E; ++I) - if (I->mayWriteToMemory()) - return false; return true; } @@ -350,6 +372,24 @@ return true; } +/// SplitBlock - Split the specified block at the specified instruction - every +/// thing before SplitPt stays in Old and everything starting with SplitPt moves +/// to a new block. The two blocks are joined by an unconditional branch and +/// the loop info is updated. +/// +BasicBlock *LoopUnswitch::SplitBlock(BasicBlock *Old, Instruction *SplitPt) { + while (isa(SplitPt)) + ++SplitPt; + BasicBlock *New = Old->splitBasicBlock(SplitPt, Old->getName()+".split"); + + // The new block lives in whichever loop the old one did. + if (Loop *L = LI->getLoopFor(Old)) + L->addBasicBlockToLoop(New, *LI); + + return New; +} + + BasicBlock *LoopUnswitch::SplitEdge(BasicBlock *BB, BasicBlock *Succ) { TerminatorInst *LatchTerm = BB->getTerminator(); unsigned SuccNum = 0; @@ -373,24 +413,14 @@ // If the successor only has a single pred, split the top of the successor // block. assert(SP == BB && "CFG broken"); - BlockToSplit = Succ; - SplitPoint = Succ->begin(); + return SplitBlock(Succ, Succ->begin()); } else { // Otherwise, if BB has a single successor, split it at the bottom of the // block. assert(BB->getTerminator()->getNumSuccessors() == 1 && "Should have a single succ!"); - BlockToSplit = BB; - SplitPoint = BB->getTerminator(); + return SplitBlock(BB, BB->getTerminator()); } - - BasicBlock *New = - BlockToSplit->splitBasicBlock(SplitPoint, - BlockToSplit->getName()+".tail"); - // New now lives in whichever loop that BB used to. - if (Loop *L = LI->getLoopFor(BlockToSplit)) - L->addBasicBlockToLoop(New, *LI); - return New; } @@ -477,10 +507,12 @@ // to branch to: this is the exit block out of the loop that we should // short-circuit to. - // Split this edge now, so that the loop maintains its exit block. + // Split this block now, so that the loop maintains its exit block, and so + // that the jump from the preheader can execute the contents of the exit block + // without actually branching to it (the exit block should be dominated by the + // loop header, not the preheader). assert(!L->contains(ExitBlock) && "Exit block is in the loop?"); - BasicBlock *NewExit = SplitEdge(L->getLoopLatch(), ExitBlock); - assert(NewExit != ExitBlock && "Edge not split!"); + BasicBlock *NewExit = SplitBlock(ExitBlock, ExitBlock->begin()); // Okay, now we have a position to branch from and a position to branch to, // insert the new conditional branch. From evan.cheng at apple.com Wed Feb 15 16:12:47 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 15 Feb 2006 16:12:47 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200602152212.QAA23209@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.161 -> 1.162 --- Log message: Remove an unused function parameter. --- Diffs of the changes: (+2 -2) SelectionDAGISel.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.161 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.162 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.161 Wed Feb 15 15:59:04 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Feb 15 16:12:35 2006 @@ -1505,7 +1505,7 @@ /// getMemsetValue - Vectorized representation of the memset value /// operand. static SDOperand getMemsetValue(SDOperand Value, MVT::ValueType VT, - SelectionDAG &DAG, TargetLowering &TLI) { + SelectionDAG &DAG) { MVT::ValueType CurVT = VT; if (ConstantSDNode *C = dyn_cast(Value)) { uint64_t Val = C->getValue() & 255; @@ -1634,7 +1634,7 @@ for (unsigned i = 0; i < NumMemOps; i++) { MVT::ValueType VT = MemOps[i]; unsigned VTSize = getSizeInBits(VT) / 8; - SDOperand Value = getMemsetValue(Op2, VT, DAG, TLI); + SDOperand Value = getMemsetValue(Op2, VT, DAG); SDOperand Store = DAG.getNode(ISD::STORE, MVT::Other, getRoot(), Value, getMemBasePlusOffset(Op1, Offset, DAG, TLI), From evan.cheng at apple.com Wed Feb 15 16:14:46 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 15 Feb 2006 16:14:46 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/README.txt Message-ID: <200602152214.QAA23236@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: README.txt updated: 1.6 -> 1.7 --- Log message: Remove an entry. --- Diffs of the changes: (+0 -8) README.txt | 8 -------- 1 files changed, 8 deletions(-) Index: llvm/lib/Target/README.txt diff -u llvm/lib/Target/README.txt:1.6 llvm/lib/Target/README.txt:1.7 --- llvm/lib/Target/README.txt:1.6 Wed Feb 15 13:52:06 2006 +++ llvm/lib/Target/README.txt Wed Feb 15 16:14:34 2006 @@ -22,14 +22,6 @@ Get the C front-end to expand hypot(x,y) -> llvm.sqrt(x*x+y*y) when errno and precision don't matter (ffastmath). Misc/mandel will like this. :) -===-------------------------------------------------------------------------=== - -For all targets, not just X86: -When llvm.memcpy, llvm.memset, or llvm.memmove are lowered, they should be -optimized to a few store instructions if the source is constant and the length -is smallish (< 8). This will greatly help some tests like Shootout/strcat.c -and fldry. - //===---------------------------------------------------------------------===// Solve this DAG isel folding deficiency: From lattner at cs.uiuc.edu Wed Feb 15 16:52:17 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 15 Feb 2006 16:52:17 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Message-ID: <200602152252.QAA23580@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LoopUnswitch.cpp updated: 1.22 -> 1.23 --- Log message: Implement trivial unswitching for switch stmts. This allows us to trivial unswitch this loop on 2 before sweating to unswitch on 1/3. void test4(int N, int i, int C, int*P, int*Q) { int j; for (j = 0; j < N; ++j) { switch (C) { // general unswitching. default: P[i+j] = 0; break; case 1: Q[i+j] = 0; break; case 3: P[i+j] = Q[i+j]; break; case 2: break; // TRIVIAL UNSWITCH on C==2 } } } --- Diffs of the changes: (+51 -27) LoopUnswitch.cpp | 78 +++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 51 insertions(+), 27 deletions(-) Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.22 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.23 --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.22 Wed Feb 15 16:03:36 2006 +++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Wed Feb 15 16:52:05 2006 @@ -79,7 +79,7 @@ void RewriteLoopBodyWithConditionConstant(Loop *L, Value *LIC,Constant *Val, bool isEqual); void UnswitchTrivialCondition(Loop *L, Value *Cond, Constant *Val, - BasicBlock *ExitBlock); + bool EntersWhenTrue, BasicBlock *ExitBlock); }; RegisterOpt X("loop-unswitch", "Unswitch loops"); } @@ -152,7 +152,7 @@ // Okay, everything after this looks good, check to make sure that this block // doesn't include any side effects. - for (BasicBlock::iterator I = Header->begin(), E = Header->end(); I != E; ++I) + for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) if (I->mayWriteToMemory()) return false; @@ -180,31 +180,48 @@ /// condition is false. Otherwise, return null to indicate a complex condition. static bool IsTrivialUnswitchCondition(Loop *L, Value *Cond, Constant **Val = 0, + bool *EntersWhenTrue = 0, BasicBlock **LoopExit = 0) { BasicBlock *Header = L->getHeader(); - BranchInst *HeaderTerm = dyn_cast(Header->getTerminator()); - - // If the header block doesn't end with a conditional branch on Cond, we can't - // handle it. - if (!HeaderTerm || !HeaderTerm->isConditional() || - HeaderTerm->getCondition() != Cond) - return false; + TerminatorInst *HeaderTerm = Header->getTerminator(); + + BasicBlock *LoopExitBB = 0; + if (BranchInst *BI = dyn_cast(HeaderTerm)) { + // If the header block doesn't end with a conditional branch on Cond, we + // can't handle it. + if (!BI->isConditional() || BI->getCondition() != Cond) + return false; - // Check to see if a successor of the branch is guaranteed to go to the latch - // block or exit through a one exit block without having any side-effects. If - // so, determine the value of Cond that causes it to do this. - BasicBlock *LoopExitBlock = 0; - if ((LoopExitBlock = isTrivialLoopExitBlock(L, HeaderTerm->getSuccessor(0)))){ - if (Val) *Val = ConstantBool::True; - } else if ((LoopExitBlock = - isTrivialLoopExitBlock(L, HeaderTerm->getSuccessor(1)))) { - if (Val) *Val = ConstantBool::False; + // Check to see if a successor of the branch is guaranteed to go to the + // latch block or exit through a one exit block without having any + // side-effects. If so, determine the value of Cond that causes it to do + // this. + if ((LoopExitBB = isTrivialLoopExitBlock(L, BI->getSuccessor(0)))) { + if (Val) *Val = ConstantBool::True; + } else if ((LoopExitBB = isTrivialLoopExitBlock(L, BI->getSuccessor(1)))) { + if (Val) *Val = ConstantBool::False; + } + } else if (SwitchInst *SI = dyn_cast(HeaderTerm)) { + // If this isn't a switch on Cond, we can't handle it. + if (SI->getCondition() != Cond) return false; + + // Check to see if a successor of the switch is guaranteed to go to the + // latch block or exit through a one exit block without having any + // side-effects. If so, determine the value of Cond that causes it to do + // this. Note that we can't trivially unswitch on the default case. + for (unsigned i = 1, e = SI->getNumSuccessors(); i != e; ++i) + if ((LoopExitBB = isTrivialLoopExitBlock(L, SI->getSuccessor(i)))) { + // Okay, we found a trivial case, remember the value that is trivial. + if (Val) *Val = SI->getCaseValue(i); + if (EntersWhenTrue) *EntersWhenTrue = false; + break; + } } - if (!LoopExitBlock) + if (!LoopExitBB) return false; // Can't handle this. - if (LoopExit) *LoopExit = LoopExitBlock; + if (LoopExit) *LoopExit = LoopExitBB; // We already know that nothing uses any scalar values defined inside of this // loop. As such, we just have to check to see if this loop will execute any @@ -356,9 +373,11 @@ // If this is a trivial condition to unswitch (which results in no code // duplication), do it now. Constant *CondVal; + bool EntersWhenTrue = true; BasicBlock *ExitBlock; - if (IsTrivialUnswitchCondition(L, LoopCond, &CondVal, &ExitBlock)){ - UnswitchTrivialCondition(L, LoopCond, CondVal, ExitBlock); + if (IsTrivialUnswitchCondition(L, LoopCond, &CondVal, + &EntersWhenTrue, &ExitBlock)) { + UnswitchTrivialCondition(L, LoopCond, CondVal, EntersWhenTrue, ExitBlock); NewLoop1 = L; } else { VersionLoop(LoopCond, Val, L, NewLoop1, NewLoop2); @@ -490,12 +509,13 @@ /// side-effects), unswitch it. This doesn't involve any code duplication, just /// moving the conditional branch outside of the loop and updating loop info. void LoopUnswitch::UnswitchTrivialCondition(Loop *L, Value *Cond, - Constant *Val, + Constant *Val, bool EntersWhenTrue, BasicBlock *ExitBlock) { DEBUG(std::cerr << "loop-unswitch: Trivial-Unswitch loop %" << L->getHeader()->getName() << " [" << L->getBlocks().size() << " blocks] in Function " << L->getHeader()->getParent()->getName() - << " on cond:" << *Cond << "\n"); + << " on cond: " << *Val << (EntersWhenTrue ? " == " : " != ") << + *Cond << "\n"); // First step, split the preheader, so that we know that there is a safe place // to insert the conditional branch. We will change 'OrigPH' to have a @@ -516,14 +536,18 @@ // Okay, now we have a position to branch from and a position to branch to, // insert the new conditional branch. - EmitPreheaderBranchOnCondition(Cond, Val, NewPH, NewExit, - OrigPH->getTerminator()); + { + BasicBlock *TrueDest = NewPH, *FalseDest = NewExit; + if (!EntersWhenTrue) std::swap(TrueDest, FalseDest); + EmitPreheaderBranchOnCondition(Cond, Val, TrueDest, FalseDest, + OrigPH->getTerminator()); + } OrigPH->getTerminator()->eraseFromParent(); // Now that we know that the loop is never entered when this condition is a // particular value, rewrite the loop with this info. We know that this will // at least eliminate the old branch. - RewriteLoopBodyWithConditionConstant(L, Cond, Val, true); + RewriteLoopBodyWithConditionConstant(L, Cond, Val, EntersWhenTrue); ++NumTrivial; } From evan.cheng at apple.com Wed Feb 15 18:21:19 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 15 Feb 2006 18:21:19 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp X86Subtarget.cpp X86Subtarget.h Message-ID: <200602160021.SAA23834@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.82 -> 1.83 X86Subtarget.cpp updated: 1.24 -> 1.25 X86Subtarget.h updated: 1.10 -> 1.11 --- Log message: A bit more memset / memcpy optimization. Turns them into calls to memset / memcpy if 1) buffer(s) are not DWORD aligned, 2) size is not known to be greater or equal to some minimum value (currently 128). --- Diffs of the changes: (+53 -7) X86ISelLowering.cpp | 49 ++++++++++++++++++++++++++++++++++++++++++------- X86Subtarget.cpp | 2 ++ X86Subtarget.h | 9 +++++++++ 3 files changed, 53 insertions(+), 7 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.82 llvm/lib/Target/X86/X86ISelLowering.cpp:1.83 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.82 Tue Feb 14 02:38:30 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Wed Feb 15 18:21:07 2006 @@ -1772,6 +1772,25 @@ (unsigned)cast(Op.getOperand(4))->getValue(); if (Align == 0) Align = 1; + ConstantSDNode *I = dyn_cast(Op.getOperand(3)); + // If not DWORD aligned, call memset if size is less than the threshold. + // It knows how to align to the right boundary first. + if ((Align & 3) != 0 && + !(I && I->getValue() >= Subtarget->getMinRepStrSizeThreshold())) { + MVT::ValueType IntPtr = getPointerTy(); + const Type *IntPtrTy = getTargetData().getIntPtrType(); + std::vector > Args; + Args.push_back(std::make_pair(Op.getOperand(1), IntPtrTy)); + // Extend the ubyte argument to be an int value for the call. + SDOperand Val = DAG.getNode(ISD::ZERO_EXTEND, MVT::i32, Op.getOperand(2)); + Args.push_back(std::make_pair(Val, IntPtrTy)); + Args.push_back(std::make_pair(Op.getOperand(3), IntPtrTy)); + std::pair CallResult = + LowerCallTo(Chain, Type::VoidTy, false, CallingConv::C, false, + DAG.getExternalSymbol("memset", IntPtr), Args, DAG); + return CallResult.second; + } + MVT::ValueType AVT; SDOperand Count; if (ConstantSDNode *ValC = dyn_cast(Op.getOperand(2))) { @@ -1782,7 +1801,7 @@ switch (Align & 3) { case 2: // WORD aligned AVT = MVT::i16; - if (ConstantSDNode *I = dyn_cast(Op.getOperand(3))) + if (I) Count = DAG.getConstant(I->getValue() / 2, MVT::i32); else Count = DAG.getNode(ISD::SRL, MVT::i32, Op.getOperand(3), @@ -1792,7 +1811,7 @@ break; case 0: // DWORD aligned AVT = MVT::i32; - if (ConstantSDNode *I = dyn_cast(Op.getOperand(3))) + if (I) Count = DAG.getConstant(I->getValue() / 4, MVT::i32); else Count = DAG.getNode(ISD::SRL, MVT::i32, Op.getOperand(3), @@ -1812,7 +1831,7 @@ InFlag); InFlag = Chain.getValue(1); } else { - AVT = MVT::i8; + AVT = MVT::i8; Count = Op.getOperand(3); Chain = DAG.getCopyToReg(Chain, X86::AL, Op.getOperand(2), InFlag); InFlag = Chain.getValue(1); @@ -1832,20 +1851,36 @@ (unsigned)cast(Op.getOperand(4))->getValue(); if (Align == 0) Align = 1; + ConstantSDNode *I = dyn_cast(Op.getOperand(3)); + // If not DWORD aligned, call memcpy if size is less than the threshold. + // It knows how to align to the right boundary first. + if ((Align & 3) != 0 && + !(I && I->getValue() >= Subtarget->getMinRepStrSizeThreshold())) { + MVT::ValueType IntPtr = getPointerTy(); + const Type *IntPtrTy = getTargetData().getIntPtrType(); + std::vector > Args; + Args.push_back(std::make_pair(Op.getOperand(1), IntPtrTy)); + Args.push_back(std::make_pair(Op.getOperand(2), IntPtrTy)); + Args.push_back(std::make_pair(Op.getOperand(3), IntPtrTy)); + std::pair CallResult = + LowerCallTo(Chain, Type::VoidTy, false, CallingConv::C, false, + DAG.getExternalSymbol("memcpy", IntPtr), Args, DAG); + return CallResult.second; + } + MVT::ValueType AVT; SDOperand Count; switch (Align & 3) { case 2: // WORD aligned AVT = MVT::i16; - if (ConstantSDNode *I = dyn_cast(Op.getOperand(3))) + if (I) Count = DAG.getConstant(I->getValue() / 2, MVT::i32); else - Count = DAG.getNode(ISD::SRL, MVT::i32, Op.getOperand(3), - DAG.getConstant(1, MVT::i8)); + Count = DAG.getConstant(I->getValue() / 2, MVT::i32); break; case 0: // DWORD aligned AVT = MVT::i32; - if (ConstantSDNode *I = dyn_cast(Op.getOperand(3))) + if (I) Count = DAG.getConstant(I->getValue() / 4, MVT::i32); else Count = DAG.getNode(ISD::SRL, MVT::i32, Op.getOperand(3), Index: llvm/lib/Target/X86/X86Subtarget.cpp diff -u llvm/lib/Target/X86/X86Subtarget.cpp:1.24 llvm/lib/Target/X86/X86Subtarget.cpp:1.25 --- llvm/lib/Target/X86/X86Subtarget.cpp:1.24 Tue Feb 14 14:37:37 2006 +++ llvm/lib/Target/X86/X86Subtarget.cpp Wed Feb 15 18:21:07 2006 @@ -146,6 +146,8 @@ X86Subtarget::X86Subtarget(const Module &M, const std::string &FS) { stackAlignment = 8; + // FIXME: this is a known good value for Yonah. Not sure about others. + MinRepStrSizeThreshold = 128; indirectExternAndWeakGlobals = false; X86SSELevel = NoMMXSSE; X863DNowLevel = NoThreeDNow; Index: llvm/lib/Target/X86/X86Subtarget.h diff -u llvm/lib/Target/X86/X86Subtarget.h:1.10 llvm/lib/Target/X86/X86Subtarget.h:1.11 --- llvm/lib/Target/X86/X86Subtarget.h:1.10 Tue Jan 31 13:43:35 2006 +++ llvm/lib/Target/X86/X86Subtarget.h Wed Feb 15 18:21:07 2006 @@ -44,6 +44,9 @@ /// entry to the function and which must be maintained by every function. unsigned stackAlignment; + /// Min. memset / memcpy size that is turned into rep/movs, rep/stos ops. + unsigned MinRepStrSizeThreshold; + /// Used by instruction selector bool indirectExternAndWeakGlobals; @@ -62,6 +65,12 @@ /// function for this subtarget. unsigned getStackAlignment() const { return stackAlignment; } + /// getMinRepStrSizeThreshold - Returns the minimum memset / memcpy size + /// required to turn the operation into a X86 rep/movs or rep/stos + /// instruction. This is only used if the src / dst alignment is not DWORD + /// aligned. + unsigned getMinRepStrSizeThreshold() const { return MinRepStrSizeThreshold; } + /// Returns true if the instruction selector should treat global values /// referencing external or weak symbols as indirect rather than direct /// references. From lattner at cs.uiuc.edu Wed Feb 15 19:24:53 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 15 Feb 2006 19:24:53 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Message-ID: <200602160124.TAA24155@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LoopUnswitch.cpp updated: 1.23 -> 1.24 --- Log message: fix a bug where we unswitched the wrong way --- Diffs of the changes: (+2 -2) LoopUnswitch.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.23 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.24 --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.23 Wed Feb 15 16:52:05 2006 +++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Wed Feb 15 19:24:41 2006 @@ -197,9 +197,9 @@ // side-effects. If so, determine the value of Cond that causes it to do // this. if ((LoopExitBB = isTrivialLoopExitBlock(L, BI->getSuccessor(0)))) { - if (Val) *Val = ConstantBool::True; - } else if ((LoopExitBB = isTrivialLoopExitBlock(L, BI->getSuccessor(1)))) { if (Val) *Val = ConstantBool::False; + } else if ((LoopExitBB = isTrivialLoopExitBlock(L, BI->getSuccessor(1)))) { + if (Val) *Val = ConstantBool::True; } } else if (SwitchInst *SI = dyn_cast(HeaderTerm)) { // If this isn't a switch on Cond, we can't handle it. From evan.cheng at apple.com Wed Feb 15 19:50:14 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 15 Feb 2006 19:50:14 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86RegisterInfo.cpp Message-ID: <200602160150.TAA24211@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86RegisterInfo.cpp updated: 1.121 -> 1.122 --- Log message: Use movaps / movapd (instead of movss / movsd) to do FR32 / FR64 reg to reg transfer. According to the Intel P4 Optimization Manual: Moves that write a portion of a register can introduce unwanted dependences. The movsd reg, reg instruction writes only the bottom 64 bits of a register, not to all 128 bits. This introduces a dependence on the preceding instruction that produces the upper 64 bits (even if those bits are not longer wanted). The dependence inhibits register renaming, and thereby reduces parallelism. Not to mention movaps is shorter than movss. --- Diffs of the changes: (+2 -2) X86RegisterInfo.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Target/X86/X86RegisterInfo.cpp diff -u llvm/lib/Target/X86/X86RegisterInfo.cpp:1.121 llvm/lib/Target/X86/X86RegisterInfo.cpp:1.122 --- llvm/lib/Target/X86/X86RegisterInfo.cpp:1.121 Fri Feb 3 12:20:04 2006 +++ llvm/lib/Target/X86/X86RegisterInfo.cpp Wed Feb 15 19:50:02 2006 @@ -106,9 +106,9 @@ } else if (RC == &X86::RFPRegClass || RC == &X86::RSTRegClass) { Opc = X86::FpMOV; } else if (RC == &X86::FR32RegClass || RC == &X86::V4F4RegClass) { - Opc = X86::MOVSSrr; + Opc = X86::MOVAPSrr; } else if (RC == &X86::FR64RegClass || RC == &X86::V2F8RegClass) { - Opc = X86::MOVSDrr; + Opc = X86::MOVAPDrr; } else { assert(0 && "Unknown regclass"); abort(); From jeffc at jolt-lang.org Wed Feb 15 22:07:15 2006 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Wed, 15 Feb 2006 22:07:15 -0600 Subject: [llvm-commits] CVS: llvm/win32/dobison.cmd Message-ID: <200602160407.WAA24902@zion.cs.uiuc.edu> Changes in directory llvm/win32: dobison.cmd updated: 1.2 -> 1.3 --- Log message: Visual Studio enters the future of bisoning. --- Diffs of the changes: (+2 -2) dobison.cmd | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/win32/dobison.cmd diff -u llvm/win32/dobison.cmd:1.2 llvm/win32/dobison.cmd:1.3 --- llvm/win32/dobison.cmd:1.2 Wed Oct 26 20:10:37 2005 +++ llvm/win32/dobison.cmd Wed Feb 15 22:07:03 2006 @@ -17,6 +17,6 @@ :nobison echo Bison not found. Using pre-generated files. -copy %~pn4.cpp %3.cpp -copy %~pn4.h %3.h +copy %~pn4.cpp.cvs %3.cpp +copy %~pn4.h.cvs %3.h exit From jeffc at jolt-lang.org Wed Feb 15 22:07:49 2006 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Wed, 15 Feb 2006 22:07:49 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Message-ID: <200602160407.WAA24917@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LoopUnswitch.cpp updated: 1.24 -> 1.25 --- Log message: Fix VC++ warning. --- Diffs of the changes: (+0 -1) LoopUnswitch.cpp | 1 - 1 files changed, 1 deletion(-) Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.24 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.25 --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.24 Wed Feb 15 19:24:41 2006 +++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Wed Feb 15 22:07:37 2006 @@ -426,7 +426,6 @@ // If the edge isn't critical, then BB has a single successor or Succ has a // single pred. Split the block. - BasicBlock *BlockToSplit; BasicBlock::iterator SplitPoint; if (BasicBlock *SP = Succ->getSinglePredecessor()) { // If the successor only has a single pred, split the top of the successor From lattner at cs.uiuc.edu Wed Feb 15 23:11:40 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Wed, 15 Feb 2006 23:11:40 -0600 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200602160511.XAA25227@zion.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.346 -> 1.347 --- Log message: Fix a minor makefile bug with lex/yacc handling that nate noticed. We don't want to copy the files when the .cpp file changes, we want to copy them to the .cvs versions when the .l/.y file change (like the comments even say). This avoids having bogus changes show up in diffs. --- Diffs of the changes: (+2 -2) Makefile.rules | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.346 llvm/Makefile.rules:1.347 --- llvm/Makefile.rules:1.346 Wed Feb 15 01:23:05 2006 +++ llvm/Makefile.rules Wed Feb 15 23:10:48 2006 @@ -1231,7 +1231,7 @@ # source location and building them. $(LexFiles:%.l=$(PROJ_SRC_DIR)/%.cpp.cvs): \ $(PROJ_SRC_DIR)/%.cpp.cvs: $(PROJ_SRC_DIR)/%.cpp - $(Verb) $(CMP) -s $@ $< || \ + $(Verb) $(CMP) -s $(PROJ_SRC_DIR)/$*.l $(PROJ_SRC_DIR)/$*.l.cvs || \ ($(CP) $< $@; $(CP) $(PROJ_SRC_DIR)/$*.l $(PROJ_SRC_DIR)/$*.l.cvs) $(LexFiles:%.l=$(ObjDir)/%.o) : \ @@ -1272,7 +1272,7 @@ # to the source location and building them. $(YaccFiles:%.y=$(PROJ_SRC_DIR)/%.cpp.cvs): \ $(PROJ_SRC_DIR)/%.cpp.cvs: $(PROJ_SRC_DIR)/%.cpp - $(Verb) $(CMP) -s $@ $< || \ + $(Verb) $(CMP) -s $(PROJ_SRC_DIR)/$*.y $(PROJ_SRC_DIR)/$*.y.cvs || \ ($(CP) $< $@; \ $(CP) $(PROJ_SRC_DIR)/$*.y $(PROJ_SRC_DIR)/$*.y.cvs; \ $(CP) $(PROJ_SRC_DIR)/$*.h $(PROJ_SRC_DIR)/$*.h.cvs) From lattner at cs.uiuc.edu Thu Feb 16 02:03:29 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 16 Feb 2006 02:03:29 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200602160803.CAA25939@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.101 -> 1.102 --- Log message: Lowering of sdiv X, pow2 was broken, this fixes it. This patch is written by Nate, I'm just committing it for him. --- Diffs of the changes: (+12 -6) DAGCombiner.cpp | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.101 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.102 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.101 Wed Feb 15 13:34:44 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu Feb 16 02:02:36 2006 @@ -725,7 +725,7 @@ if (TLI.MaskedValueIsZero(N1, SignBit) && TLI.MaskedValueIsZero(N0, SignBit)) return DAG.getNode(ISD::UDIV, N1.getValueType(), N0, N1); - // fold (sdiv X, pow2) -> (add (sra X, log(pow2)), (srl X, sizeof(X)-1)) + // fold (sdiv X, pow2) -> simple ops. if (N1C && N1C->getValue() && !TLI.isIntDivCheap() && (isPowerOf2_64(N1C->getSignExtended()) || isPowerOf2_64(-N1C->getSignExtended()))) { @@ -735,15 +735,21 @@ return SDOperand(); int64_t pow2 = N1C->getSignExtended(); int64_t abs2 = pow2 > 0 ? pow2 : -pow2; - SDOperand SRL = DAG.getNode(ISD::SRL, VT, N0, + unsigned lg2 = Log2_64(abs2); + // Splat the sign bit into the register + SDOperand SGN = DAG.getNode(ISD::SRA, VT, N0, DAG.getConstant(MVT::getSizeInBits(VT)-1, TLI.getShiftAmountTy())); - WorkList.push_back(SRL.Val); - SDOperand SGN = DAG.getNode(ISD::ADD, VT, N0, SRL); WorkList.push_back(SGN.Val); - SDOperand SRA = DAG.getNode(ISD::SRA, VT, SGN, - DAG.getConstant(Log2_64(abs2), + // Add (N0 < 0) ? abs2 - 1 : 0; + SDOperand SRL = DAG.getNode(ISD::SRL, VT, SGN, + DAG.getConstant(MVT::getSizeInBits(VT)-lg2, TLI.getShiftAmountTy())); + SDOperand ADD = DAG.getNode(ISD::ADD, VT, N0, SRL); + WorkList.push_back(SRL.Val); + WorkList.push_back(ADD.Val); // Divide by pow2 + SDOperand SRA = DAG.getNode(ISD::SRA, VT, ADD, + DAG.getConstant(lg2, TLI.getShiftAmountTy())); // If we're dividing by a positive value, we're done. Otherwise, we must // negate the result. if (pow2 > 0) From evan.cheng at apple.com Thu Feb 16 02:28:32 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 16 Feb 2006 02:28:32 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200602160828.CAA32504@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.162 -> 1.163 --- Log message: If the false case is the current basic block, then this is a self loop. We do not want to emit "Loop: ... brcond Out; br Loop", as it adds an extra instruction in the loop. Instead, invert the condition and emit "Loop: ... br!cond Loop; br Out. Generalize the fix by moving it from PPCDAGToDAGISel to SelectionDAGLowering. --- Diffs of the changes: (+9 -0) SelectionDAGISel.cpp | 9 +++++++++ 1 files changed, 9 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.162 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.163 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.162 Wed Feb 15 16:12:35 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Thu Feb 16 02:27:55 2006 @@ -562,6 +562,15 @@ } else { std::vector Ops; Ops.push_back(getRoot()); + // If the false case is the current basic block, then this is a self + // loop. We do not want to emit "Loop: ... brcond Out; br Loop", as it + // adds an extra instruction in the loop. Instead, invert the + // condition and emit "Loop: ... br!cond Loop; br Out. + if (CurMBB == Succ1MBB) { + std::swap(Succ0MBB, Succ1MBB); + SDOperand True = DAG.getConstant(1, Cond.getValueType()); + Cond = DAG.getNode(ISD::XOR, Cond.getValueType(), Cond, True); + } Ops.push_back(Cond); Ops.push_back(DAG.getBasicBlock(Succ0MBB)); Ops.push_back(DAG.getBasicBlock(Succ1MBB)); From evan.cheng at apple.com Thu Feb 16 02:28:32 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 16 Feb 2006 02:28:32 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Message-ID: <200602160828.CAA32505@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCISelDAGToDAG.cpp updated: 1.157 -> 1.158 --- Log message: If the false case is the current basic block, then this is a self loop. We do not want to emit "Loop: ... brcond Out; br Loop", as it adds an extra instruction in the loop. Instead, invert the condition and emit "Loop: ... br!cond Loop; br Out. Generalize the fix by moving it from PPCDAGToDAGISel to SelectionDAGLowering. --- Diffs of the changes: (+0 -11) PPCISelDAGToDAG.cpp | 11 ----------- 1 files changed, 11 deletions(-) Index: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp diff -u llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.157 llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.158 --- llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.157 Thu Feb 9 01:17:49 2006 +++ llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Thu Feb 16 02:27:56 2006 @@ -1046,17 +1046,6 @@ if (N->getOpcode() == ISD::BRTWOWAY_CC) { SDOperand CondTrueBlock = N->getOperand(4); SDOperand CondFalseBlock = N->getOperand(5); - - // If the false case is the current basic block, then this is a self loop. - // We do not want to emit "Loop: ... brcond Out; br Loop", as it adds an - // extra dispatch group to the loop. Instead, invert the condition and - // emit "Loop: ... br!cond Loop; br Out - if (cast(CondFalseBlock)->getBasicBlock() == BB) { - std::swap(CondTrueBlock, CondFalseBlock); - CC = getSetCCInverse(CC, - MVT::isInteger(N->getOperand(2).getValueType())); - } - unsigned Opc = getBCCForSetCC(CC); SDOperand CB = SDOperand(CurDAG->getTargetNode(PPC::COND_BRANCH, MVT::Other, From duraid at octopus.com.au Thu Feb 16 07:13:20 2006 From: duraid at octopus.com.au (Duraid Madina) Date: Thu, 16 Feb 2006 07:13:20 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/IA64/IA64AsmPrinter.cpp Message-ID: <200602161313.HAA02258@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/IA64: IA64AsmPrinter.cpp updated: 1.22 -> 1.23 --- Log message: distinguish between objects and register names, now we can have stuff with names like "f84", "in6" etc etc. this should fix one or two tests --- Diffs of the changes: (+12 -6) IA64AsmPrinter.cpp | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-) Index: llvm/lib/Target/IA64/IA64AsmPrinter.cpp diff -u llvm/lib/Target/IA64/IA64AsmPrinter.cpp:1.22 llvm/lib/Target/IA64/IA64AsmPrinter.cpp:1.23 --- llvm/lib/Target/IA64/IA64AsmPrinter.cpp:1.22 Sun Jan 22 17:37:17 2006 +++ llvm/lib/Target/IA64/IA64AsmPrinter.cpp Thu Feb 16 07:12:57 2006 @@ -235,10 +235,16 @@ if (Needfptr) O << "@fptr("; O << Mang->getValueName(MO.getGlobal()); - if (Needfptr) - O << ")"; // close fptr( - if (!isBRCALLinsn) - O << ")"; // close ltoff( + + if (Needfptr && !isBRCALLinsn) + O << "#))"; // close both fptr( and ltoff( + else { + if (Needfptr) + O << "#)"; // close only fptr( + if (!isBRCALLinsn) + O << "#)"; // close only ltoff( + } + int Offset = MO.getOffset(); if (Offset > 0) O << " + " << Offset; @@ -293,11 +299,11 @@ I->hasWeakLinkage() /* FIXME: Verify correct */)) { SwitchSection(".data", I); if (I->hasInternalLinkage()) { - O << "\t.lcomm " << name << "," << TD.getTypeSize(C->getType()) + O << "\t.lcomm " << name << "#," << TD.getTypeSize(C->getType()) << "," << (1 << Align); O << "\t\t// "; } else { - O << "\t.common " << name << "," << TD.getTypeSize(C->getType()) + O << "\t.common " << name << "#," << TD.getTypeSize(C->getType()) << "," << (1 << Align); O << "\t\t// "; } From alenhar2 at cs.uiuc.edu Thu Feb 16 09:50:31 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Thu, 16 Feb 2006 09:50:31 -0600 Subject: [llvm-commits] CVS: llvm-poolalloc/runtime/FL2Allocator/PoolAllocator.cpp Message-ID: <200602161550.JAA10357@zion.cs.uiuc.edu> Changes in directory llvm-poolalloc/runtime/FL2Allocator: PoolAllocator.cpp updated: 1.50 -> 1.51 --- Log message: some programs call memalign, so there should be one --- Diffs of the changes: (+7 -0) PoolAllocator.cpp | 7 +++++++ 1 files changed, 7 insertions(+) Index: llvm-poolalloc/runtime/FL2Allocator/PoolAllocator.cpp diff -u llvm-poolalloc/runtime/FL2Allocator/PoolAllocator.cpp:1.50 llvm-poolalloc/runtime/FL2Allocator/PoolAllocator.cpp:1.51 --- llvm-poolalloc/runtime/FL2Allocator/PoolAllocator.cpp:1.50 Fri May 27 15:46:20 2005 +++ llvm-poolalloc/runtime/FL2Allocator/PoolAllocator.cpp Thu Feb 16 09:50:09 2006 @@ -854,6 +854,13 @@ return poolalloc_internal(Pool, NumBytes); } +void *poolmemalign(PoolTy *Pool, + unsigned Alignment, unsigned NumBytes) { + //punt and use pool alloc. + //I don't know if this is safe or breaks any assumptions in the runtime + intptr_t base = (intptr_t)poolalloc_internal(Pool, NumBytes + Alignment - 1); + return (void*)((base + (Alignment - 1)) & ~((intptr_t)Alignment -1)); +} void poolfree(PoolTy *Pool, void *Node) { DO_IF_FORCE_MALLOCFREE(free(Node); return); From evan.cheng at apple.com Thu Feb 16 13:34:53 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 16 Feb 2006 13:34:53 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86InstrInfo.td Message-ID: <200602161934.NAA12451@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86InstrInfo.td updated: 1.233 -> 1.234 --- Log message: MOVAPSrr and MOVAPDrr instruction format should be MRMSrcReg. --- Diffs of the changes: (+2 -2) X86InstrInfo.td | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Target/X86/X86InstrInfo.td diff -u llvm/lib/Target/X86/X86InstrInfo.td:1.233 llvm/lib/Target/X86/X86InstrInfo.td:1.234 --- llvm/lib/Target/X86/X86InstrInfo.td:1.233 Tue Feb 14 18:31:03 2006 +++ llvm/lib/Target/X86/X86InstrInfo.td Thu Feb 16 13:34:41 2006 @@ -3013,10 +3013,10 @@ // XMM Packed Floating point support (requires SSE / SSE2) //===----------------------------------------------------------------------===// -def MOVAPSrr : I<0x28, MRMSrcMem, (ops V4F4:$dst, V4F4:$src), +def MOVAPSrr : I<0x28, MRMSrcReg, (ops V4F4:$dst, V4F4:$src), "movaps {$src, $dst|$dst, $src}", []>, Requires<[HasSSE1]>, TB; -def MOVAPDrr : I<0x28, MRMSrcMem, (ops V2F8:$dst, V2F8:$src), +def MOVAPDrr : I<0x28, MRMSrcReg, (ops V2F8:$dst, V2F8:$src), "movapd {$src, $dst|$dst, $src}", []>, Requires<[HasSSE2]>, TB, OpSize; From lattner at cs.uiuc.edu Thu Feb 16 13:36:34 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 16 Feb 2006 13:36:34 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Message-ID: <200602161936.NAA12522@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LoopUnswitch.cpp updated: 1.25 -> 1.26 --- Log message: Change SplitBlock to increment a BasicBlock::iterator, not an Instruction*. Apparently they do different things :) This fixes a testcase that nate reduced from spass. Also included are a couple minor code changes that don't affect the generated code at all. --- Diffs of the changes: (+27 -23) LoopUnswitch.cpp | 50 +++++++++++++++++++++++++++----------------------- 1 files changed, 27 insertions(+), 23 deletions(-) Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.25 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.26 --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.25 Wed Feb 15 22:07:37 2006 +++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Thu Feb 16 13:36:22 2006 @@ -397,9 +397,10 @@ /// the loop info is updated. /// BasicBlock *LoopUnswitch::SplitBlock(BasicBlock *Old, Instruction *SplitPt) { - while (isa(SplitPt)) - ++SplitPt; - BasicBlock *New = Old->splitBasicBlock(SplitPt, Old->getName()+".split"); + BasicBlock::iterator SplitIt = SplitPt; + while (isa(SplitIt)) + ++SplitIt; + BasicBlock *New = Old->splitBasicBlock(SplitIt, Old->getName()+".split"); // The new block lives in whichever loop the old one did. if (Loop *L = LI->getLoopFor(Old)) @@ -703,27 +704,30 @@ // Haha, this loop could be unswitched. Get it? The unswitch pass could // unswitch itself. Amazing. for (unsigned i = 0, e = Users.size(); i != e; ++i) - if (Instruction *U = cast(Users[i])) - if (L->contains(U->getParent())) - if (IsEqual) { - U->replaceUsesOfWith(LIC, Val); - } else if (NotVal) { - U->replaceUsesOfWith(LIC, NotVal); - } else { - // If we know that LIC is not Val, use this info to simplify code. - if (SwitchInst *SI = dyn_cast(U)) { - for (unsigned i = 1, e = SI->getNumCases(); i != e; ++i) { - if (SI->getCaseValue(i) == Val) { - // Found a dead case value. Don't remove PHI nodes in the - // successor if they become single-entry, those PHI nodes may - // be in the Users list. - SI->getSuccessor(i)->removePredecessor(SI->getParent(), true); - SI->removeCase(i); - break; - } + if (Instruction *U = cast(Users[i])) { + if (!L->contains(U->getParent())) + continue; + + if (IsEqual) { + U->replaceUsesOfWith(LIC, Val); + } else if (NotVal) { + U->replaceUsesOfWith(LIC, NotVal); + } else { + // If we know that LIC is not Val, use this info to simplify code. + if (SwitchInst *SI = dyn_cast(U)) { + for (unsigned i = 1, e = SI->getNumCases(); i != e; ++i) { + if (SI->getCaseValue(i) == Val) { + // Found a dead case value. Don't remove PHI nodes in the + // successor if they become single-entry, those PHI nodes may + // be in the Users list. + SI->getSuccessor(i)->removePredecessor(SI->getParent(), true); + SI->removeCase(i); + break; } } - - // TODO: We could simplify stuff like X == C. } + + // TODO: We could simplify stuff like X == C. + } + } } From lattner at cs.uiuc.edu Thu Feb 16 15:11:09 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 16 Feb 2006 15:11:09 -0600 Subject: [llvm-commits] CVS: llvm/tools/llc/Makefile Message-ID: <200602162111.PAA13563@zion.cs.uiuc.edu> Changes in directory llvm/tools/llc: Makefile updated: 1.78 -> 1.79 --- Log message: remove support for the skeleton target --- Diffs of the changes: (+0 -5) Makefile | 5 ----- 1 files changed, 5 deletions(-) Index: llvm/tools/llc/Makefile diff -u llvm/tools/llc/Makefile:1.78 llvm/tools/llc/Makefile:1.79 --- llvm/tools/llc/Makefile:1.78 Sun Feb 5 02:30:45 2006 +++ llvm/tools/llc/Makefile Thu Feb 16 15:10:57 2006 @@ -23,11 +23,6 @@ USEDLIBS += LLVMCBackend endif -# Check for Skeleton target -ifneq ($(strip $(filter Skeleton,$(TARGETS_TO_BUILD))),) -USEDLIB += LLVMSkeleton -endif - # Check for Sparc target ifneq ($(strip $(filter SparcV9,$(TARGETS_TO_BUILD))),) USEDLIBS += \ From lattner at cs.uiuc.edu Thu Feb 16 15:12:02 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 16 Feb 2006 15:12:02 -0600 Subject: [llvm-commits] CVS: llvm/autoconf/configure.ac Message-ID: <200602162112.PAA13629@zion.cs.uiuc.edu> Changes in directory llvm/autoconf: configure.ac updated: 1.209 -> 1.210 --- Log message: don't build the skeleton target --- Diffs of the changes: (+1 -2) configure.ac | 3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.209 llvm/autoconf/configure.ac:1.210 --- llvm/autoconf/configure.ac:1.209 Wed Feb 15 01:57:42 2006 +++ llvm/autoconf/configure.ac Thu Feb 16 15:11:49 2006 @@ -258,7 +258,7 @@ [Build specific host targets: all,host-only,{target-name} (default=all)]),, enableval=all) case "$enableval" in - all) TARGETS_TO_BUILD="X86 Sparc SparcV9 PowerPC Alpha IA64 Skeleton" ;; + all) TARGETS_TO_BUILD="X86 Sparc SparcV9 PowerPC Alpha IA64" ;; host-only) case "$llvm_cv_target_arch" in x86) TARGETS_TO_BUILD="X86" ;; @@ -278,7 +278,6 @@ powerpc) TARGETS_TO_BUILD="PowerPC $TARGETS_TO_BUILD" ;; alpha) TARGETS_TO_BUILD="Alpha $TARGETS_TO_BUILD" ;; ia64) TARGETS_TO_BUILD="IA64 $TARGETS_TO_BUILD" ;; - skeleton)TARGETS_TO_BUILD="Skeleton $TARGETS_TO_BUILD";; *) AC_MSG_ERROR([Unrecognized target $a_target]) ;; esac done From natebegeman at mac.com Thu Feb 16 15:12:06 2006 From: natebegeman at mac.com (Nate Begeman) Date: Thu, 16 Feb 2006 15:12:06 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetLowering.h Message-ID: <200602162112.PAA13633@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetLowering.h updated: 1.49 -> 1.50 --- Log message: Rework the SelectionDAG-based implementations of SimplifyDemandedBits and ComputeMaskedBits to match the new improved versions in instcombine. Tested against all of multisource/benchmarks on ppc. --- Diffs of the changes: (+56 -18) TargetLowering.h | 74 +++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 56 insertions(+), 18 deletions(-) Index: llvm/include/llvm/Target/TargetLowering.h diff -u llvm/include/llvm/Target/TargetLowering.h:1.49 llvm/include/llvm/Target/TargetLowering.h:1.50 --- llvm/include/llvm/Target/TargetLowering.h:1.49 Tue Feb 14 02:38:30 2006 +++ llvm/include/llvm/Target/TargetLowering.h Thu Feb 16 15:11:51 2006 @@ -23,6 +23,7 @@ #define LLVM_TARGET_TARGETLOWERING_H #include "llvm/Type.h" +#include "llvm/CodeGen/SelectionDAGNodes.h" #include "llvm/CodeGen/ValueTypes.h" #include "llvm/Support/DataTypes.h" #include @@ -284,22 +285,55 @@ // TargetLowering Optimization Methods // + /// TargetLoweringOpt - A convenience struct that encapsulates a DAG, and two + /// SDOperands for returning information from TargetLowering to its clients + /// that want to combine + struct TargetLoweringOpt { + SelectionDAG &DAG; + SDOperand Old; + SDOperand New; + + TargetLoweringOpt::TargetLoweringOpt(SelectionDAG &InDAG) : DAG(InDAG) {} + + bool CombineTo(SDOperand O, SDOperand N) { + Old = O; + New = N; + return true; + } + + /// ShrinkDemandedConstant - Check to see if the specified operand of the + /// specified instruction is a constant integer. If so, check to see if there + /// are any bits set in the constant that are not demanded. If so, shrink the + /// constant and return true. + bool ShrinkDemandedConstant(SDOperand Op, uint64_t Demanded); + }; + /// MaskedValueIsZero - Return true if 'Op & Mask' is known to be zero. We /// use this predicate to simplify operations downstream. Op and Mask are - /// known to be the same type. Targets can implement the - /// isMaskedValueZeroForTargetNode method, to allow target nodes to be - /// understood. - bool MaskedValueIsZero(const SDOperand &Op, uint64_t Mask) const; - - /// DemandedBitsAreZero - Return true if 'Op & Mask' demands no bits from a - /// bit set operation such as a sign extend or or/xor with constant whose only - /// use is Op. If it returns true, the old node that sets bits which are - /// not demanded is returned in Old, and its replacement node is returned in - /// New, such that callers of SetBitsAreZero may call CombineTo on them if - /// desired. - bool DemandedBitsAreZero(const SDOperand &Op, uint64_t Mask, SDOperand &Old, - SDOperand &New, SelectionDAG &DAG) const; - + /// known to be the same type. + bool MaskedValueIsZero(SDOperand Op, uint64_t Mask, unsigned Depth = 0) + const; + + /// ComputeMaskedBits - Determine which of the bits specified in Mask are + /// known to be either zero or one and return them in the KnownZero/KnownOne + /// bitsets. This code only analyzes bits in Mask, in order to short-circuit + /// processing. Targets can implement the computeMaskedBitsForTargetNode + /// method, to allow target nodes to be understood. + void ComputeMaskedBits(SDOperand Op, uint64_t Mask, uint64_t &KnownZero, + uint64_t &KnownOne, unsigned Depth = 0) const; + + /// SimplifyDemandedBits - Look at Op. At this point, we know that only the + /// DemandedMask bits of the result of Op are ever used downstream. If we can + /// use this information to simplify Op, create a new simplified DAG node and + /// return true, returning the original and new nodes in Old and New. + /// Otherwise, analyze the expression and return a mask of KnownOne and + /// KnownZero bits for the expression (used to simplify the caller). + /// The KnownZero/One bits may only be accurate for those bits in the + /// DemandedMask. + bool SimplifyDemandedBits(SDOperand Op, uint64_t DemandedMask, + uint64_t &KnownZero, uint64_t &KnownOne, + TargetLoweringOpt &TLO, unsigned Depth = 0) const; + //===--------------------------------------------------------------------===// // TargetLowering Configuration Methods - These methods should be invoked by // the derived class constructor to configure this object for the target. @@ -433,10 +467,14 @@ /// DAG node. virtual const char *getTargetNodeName(unsigned Opcode) const; - /// isMaskedValueZeroForTargetNode - Return true if 'Op & Mask' is known to - /// be zero. Op is expected to be a target specific node. - virtual bool isMaskedValueZeroForTargetNode(const SDOperand &Op, - uint64_t Mask) const; + /// computeMaskedBitsForTargetNode - Determine which of the bits specified in + /// Mask are known to be either zero or one and return them in the + /// KnownZero/KnownOne bitsets. + virtual void computeMaskedBitsForTargetNode(const SDOperand Op, + uint64_t Mask, + uint64_t &KnownZero, + uint64_t &KnownOne, + unsigned Depth = 0) const; //===--------------------------------------------------------------------===// // Inline Asm Support hooks From natebegeman at mac.com Thu Feb 16 15:12:06 2006 From: natebegeman at mac.com (Nate Begeman) Date: Thu, 16 Feb 2006 15:12:06 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp X86ISelLowering.h Message-ID: <200602162112.PAA13643@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.83 -> 1.84 X86ISelLowering.h updated: 1.25 -> 1.26 --- Log message: Rework the SelectionDAG-based implementations of SimplifyDemandedBits and ComputeMaskedBits to match the new improved versions in instcombine. Tested against all of multisource/benchmarks on ppc. --- Diffs of the changes: (+18 -11) X86ISelLowering.cpp | 14 +++++++++----- X86ISelLowering.h | 15 +++++++++------ 2 files changed, 18 insertions(+), 11 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.83 llvm/lib/Target/X86/X86ISelLowering.cpp:1.84 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.83 Wed Feb 15 18:21:07 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Thu Feb 16 15:11:51 2006 @@ -2035,19 +2035,23 @@ } } -bool X86TargetLowering::isMaskedValueZeroForTargetNode(const SDOperand &Op, - uint64_t Mask) const { +void X86TargetLowering::computeMaskedBitsForTargetNode(const SDOperand Op, + uint64_t Mask, + uint64_t &KnownZero, + uint64_t &KnownOne, + unsigned Depth) const { unsigned Opc = Op.getOpcode(); + KnownZero = KnownOne = 0; // Don't know anything. switch (Opc) { default: assert(Opc >= ISD::BUILTIN_OP_END && "Expected a target specific node"); break; - case X86ISD::SETCC: return (Mask & 1) == 0; + case X86ISD::SETCC: + KnownZero |= (MVT::getIntVTBitMask(Op.getValueType()) ^ 1ULL); + break; } - - return false; } std::vector X86TargetLowering:: Index: llvm/lib/Target/X86/X86ISelLowering.h diff -u llvm/lib/Target/X86/X86ISelLowering.h:1.25 llvm/lib/Target/X86/X86ISelLowering.h:1.26 --- llvm/lib/Target/X86/X86ISelLowering.h:1.25 Fri Feb 3 20:20:30 2006 +++ llvm/lib/Target/X86/X86ISelLowering.h Thu Feb 16 15:11:51 2006 @@ -218,12 +218,15 @@ /// DAG node. virtual const char *getTargetNodeName(unsigned Opcode) const; - /// isMaskedValueZeroForTargetNode - Return true if 'Op & Mask' is known to - /// be zero. Op is expected to be a target specific node. Used by DAG - /// combiner. - virtual bool isMaskedValueZeroForTargetNode(const SDOperand &Op, - uint64_t Mask) const; - + /// computeMaskedBitsForTargetNode - Determine which of the bits specified + /// in Mask are known to be either zero or one and return them in the + /// KnownZero/KnownOne bitsets. + virtual void computeMaskedBitsForTargetNode(const SDOperand Op, + uint64_t Mask, + uint64_t &KnownZero, + uint64_t &KnownOne, + unsigned Depth = 0) const; + SDOperand getReturnAddressFrameIndex(SelectionDAG &DAG); std::vector From natebegeman at mac.com Thu Feb 16 15:12:07 2006 From: natebegeman at mac.com (Nate Begeman) Date: Thu, 16 Feb 2006 15:12:07 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp Message-ID: <200602162112.PAA13651@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: SparcISelDAGToDAG.cpp updated: 1.85 -> 1.86 --- Log message: Rework the SelectionDAG-based implementations of SimplifyDemandedBits and ComputeMaskedBits to match the new improved versions in instcombine. Tested against all of multisource/benchmarks on ppc. --- Diffs of the changes: (+26 -13) SparcISelDAGToDAG.cpp | 39 ++++++++++++++++++++++++++------------- 1 files changed, 26 insertions(+), 13 deletions(-) Index: llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp diff -u llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp:1.85 llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp:1.86 --- llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp:1.85 Wed Feb 15 00:41:34 2006 +++ llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp Thu Feb 16 15:11:51 2006 @@ -98,11 +98,14 @@ SparcTargetLowering(TargetMachine &TM); virtual SDOperand LowerOperation(SDOperand Op, SelectionDAG &DAG); - /// isMaskedValueZeroForTargetNode - Return true if 'Op & Mask' is known to - /// be zero. Op is expected to be a target specific node. Used by DAG - /// combiner. - virtual bool isMaskedValueZeroForTargetNode(const SDOperand &Op, - uint64_t Mask) const; + /// computeMaskedBitsForTargetNode - Determine which of the bits specified + /// in Mask are known to be either zero or one and return them in the + /// KnownZero/KnownOne bitsets. + virtual void computeMaskedBitsForTargetNode(const SDOperand Op, + uint64_t Mask, + uint64_t &KnownZero, + uint64_t &KnownOne, + unsigned Depth = 0) const; virtual std::vector LowerArguments(Function &F, SelectionDAG &DAG); @@ -246,20 +249,30 @@ /// isMaskedValueZeroForTargetNode - Return true if 'Op & Mask' is known to /// be zero. Op is expected to be a target specific node. Used by DAG /// combiner. -bool SparcTargetLowering:: -isMaskedValueZeroForTargetNode(const SDOperand &Op, uint64_t Mask) const { +void SparcTargetLowering::computeMaskedBitsForTargetNode(const SDOperand Op, + uint64_t Mask, + uint64_t &KnownZero, + uint64_t &KnownOne, + unsigned Depth) const { + uint64_t KnownZero2, KnownOne2; + KnownZero = KnownOne = 0; // Don't know anything. + switch (Op.getOpcode()) { - default: return false; + default: break; case SPISD::SELECT_ICC: case SPISD::SELECT_FCC: - assert(MVT::isInteger(Op.getValueType()) && "Not an integer select!"); - // These operations are masked zero if both the left and the right are zero. - return MaskedValueIsZero(Op.getOperand(0), Mask) && - MaskedValueIsZero(Op.getOperand(1), Mask); + ComputeMaskedBits(Op.getOperand(1), Mask, KnownZero, KnownOne, Depth+1); + ComputeMaskedBits(Op.getOperand(0), Mask, KnownZero2, KnownOne2, Depth+1); + assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); + assert((KnownZero2 & KnownOne2) == 0 && "Bits known to be one AND zero?"); + + // Only known if known in both the LHS and RHS. + KnownOne &= KnownOne2; + KnownZero &= KnownZero2; + break; } } - /// LowerArguments - V8 uses a very simple ABI, where all values are passed in /// either one or two GPRs, including FP values. TODO: we should pass FP values /// in FP registers for fastcc functions. From natebegeman at mac.com Thu Feb 16 15:12:06 2006 From: natebegeman at mac.com (Nate Begeman) Date: Thu, 16 Feb 2006 15:12:06 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200602162112.PAA13637@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.435 -> 1.436 --- Log message: Rework the SelectionDAG-based implementations of SimplifyDemandedBits and ComputeMaskedBits to match the new improved versions in instcombine. Tested against all of multisource/benchmarks on ppc. --- Diffs of the changes: (+3 -3) InstructionCombining.cpp | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.435 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.436 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.435 Mon Feb 13 17:07:23 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Thu Feb 16 15:11:51 2006 @@ -767,9 +767,9 @@ if ((DemandedMask & (~KnownZero) & KnownOne2) == (DemandedMask & (~KnownZero))) return UpdateValueUsesWith(I, I->getOperand(0)); - if ((DemandedMask & (~KnownZero2) & KnownOne) == - (DemandedMask & (~KnownZero2))) - return UpdateValueUsesWith(I, I->getOperand(1)); + if ((DemandedMask & (~KnownZero2) & KnownOne) == + (DemandedMask & (~KnownZero2))) + return UpdateValueUsesWith(I, I->getOperand(1)); // If the RHS is a constant, see if we can simplify it. if (ShrinkDemandedConstant(I, 1, DemandedMask)) From natebegeman at mac.com Thu Feb 16 15:12:07 2006 From: natebegeman at mac.com (Nate Begeman) Date: Thu, 16 Feb 2006 15:12:07 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200602162112.PAA13655@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.102 -> 1.103 --- Log message: Rework the SelectionDAG-based implementations of SimplifyDemandedBits and ComputeMaskedBits to match the new improved versions in instcombine. Tested against all of multisource/benchmarks on ppc. --- Diffs of the changes: (+17 -35) DAGCombiner.cpp | 52 +++++++++++++++++----------------------------------- 1 files changed, 17 insertions(+), 35 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.102 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.103 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.102 Thu Feb 16 02:02:36 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu Feb 16 15:11:51 2006 @@ -98,6 +98,18 @@ DAG.DeleteNode(N); return SDOperand(N, 0); } + + bool DemandedBitsAreZero(SDOperand Op, uint64_t DemandedMask, + SDOperand &Old, SDOperand &New) const { + TargetLowering::TargetLoweringOpt TLO(DAG); + uint64_t KnownZero, KnownOne; + if (TLI.SimplifyDemandedBits(Op, DemandedMask, KnownZero, KnownOne, TLO)){ + Old = TLO.Old; + New = TLO.New; + return true; + } + return false; + } SDOperand CombineTo(SDNode *N, SDOperand Res) { std::vector To; @@ -897,12 +909,8 @@ if (N1C && N1C->isAllOnesValue()) return N0; // if (and x, c) is known to be zero, return 0 - if (N1C && TLI.MaskedValueIsZero(SDOperand(N, 0), ~0ULL >> (64-OpSizeInBits))) + if (N1C && TLI.MaskedValueIsZero(SDOperand(N, 0), MVT::getIntVTBitMask(VT))) return DAG.getConstant(0, VT); - // fold (and x, c) -> x iff (x & ~c) == 0 - if (N1C && - TLI.MaskedValueIsZero(N0, ~N1C->getValue() & (~0ULL>>(64-OpSizeInBits)))) - return N0; // reassociate and SDOperand RAND = ReassociateOps(ISD::AND, N0, N1); if (RAND.Val != 0) @@ -984,38 +992,12 @@ } // fold (and (sign_extend_inreg x, i16 to i32), 1) -> (and x, 1) // fold (and (sra)) -> (and (srl)) when possible. - if (TLI.DemandedBitsAreZero(SDOperand(N, 0), ~0ULL >> (64-OpSizeInBits), Old, - New, DAG)) { + if (DemandedBitsAreZero(SDOperand(N, 0), MVT::getIntVTBitMask(VT), Old, + New)) { WorkList.push_back(N); CombineTo(Old.Val, New); return SDOperand(); } - // FIXME: DemandedBitsAreZero cannot currently handle AND with non-constant - // RHS and propagate known cleared bits to LHS. For this reason, we must keep - // this fold, for now, for the following testcase: - // - //int %test2(uint %mode.0.i.0) { - // %tmp.79 = cast uint %mode.0.i.0 to int - // %tmp.80 = shr int %tmp.79, ubyte 15 - // %tmp.81 = shr uint %mode.0.i.0, ubyte 16 - // %tmp.82 = cast uint %tmp.81 to int - // %tmp.83 = and int %tmp.80, %tmp.82 - // ret int %tmp.83 - //} - // fold (and (sra)) -> (and (srl)) when possible. - if (N0.getOpcode() == ISD::SRA && N0.Val->hasOneUse()) { - if (ConstantSDNode *N01C = dyn_cast(N0.getOperand(1))) { - // If the RHS of the AND has zeros where the sign bits of the SRA will - // land, turn the SRA into an SRL. - if (TLI.MaskedValueIsZero(N1, (~0ULL << (OpSizeInBits-N01C->getValue())) & - (~0ULL>>(64-OpSizeInBits)))) { - WorkList.push_back(N); - CombineTo(N0.Val, DAG.getNode(ISD::SRL, VT, N0.getOperand(0), - N0.getOperand(1))); - return SDOperand(); - } - } - } // fold (zext_inreg (extload x)) -> (zextload x) if (N0.getOpcode() == ISD::EXTLOAD) { MVT::ValueType EVT = cast(N0.getOperand(3))->getVT(); @@ -1298,8 +1280,8 @@ // if (shl x, c) is known to be zero, return 0 if (N1C && TLI.MaskedValueIsZero(SDOperand(N, 0), ~0ULL >> (64-OpSizeInBits))) return DAG.getConstant(0, VT); - if (N1C && TLI.DemandedBitsAreZero(SDOperand(N,0), ~0ULL >> (64-OpSizeInBits), - Old, New, DAG)) { + if (N1C && DemandedBitsAreZero(SDOperand(N,0), ~0ULL >> (64-OpSizeInBits), + Old, New)) { WorkList.push_back(N); CombineTo(Old.Val, New); return SDOperand(); From natebegeman at mac.com Thu Feb 16 15:12:07 2006 From: natebegeman at mac.com (Nate Begeman) Date: Thu, 16 Feb 2006 15:12:07 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/TargetLowering.cpp Message-ID: <200602162112.PAA13647@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: TargetLowering.cpp updated: 1.30 -> 1.31 --- Log message: Rework the SelectionDAG-based implementations of SimplifyDemandedBits and ComputeMaskedBits to match the new improved versions in instcombine. Tested against all of multisource/benchmarks on ppc. --- Diffs of the changes: (+506 -122) TargetLowering.cpp | 628 ++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 506 insertions(+), 122 deletions(-) Index: llvm/lib/Target/TargetLowering.cpp diff -u llvm/lib/Target/TargetLowering.cpp:1.30 llvm/lib/Target/TargetLowering.cpp:1.31 --- llvm/lib/Target/TargetLowering.cpp:1.30 Tue Feb 14 02:38:30 2006 +++ llvm/lib/Target/TargetLowering.cpp Thu Feb 16 15:11:51 2006 @@ -135,175 +135,559 @@ // Optimization Methods //===----------------------------------------------------------------------===// -/// DemandedBitsAreZero - Return true if 'Op & Mask' demands no bits from a bit -/// set operation such as a sign extend or or/xor with constant whose only -/// use is Op. If it returns true, the old node that sets bits which are -/// not demanded is returned in Old, and its replacement node is returned in -/// New, such that callers of DemandedBitsAreZero may call CombineTo on them if -/// desired. -bool TargetLowering::DemandedBitsAreZero(const SDOperand &Op, uint64_t Mask, - SDOperand &Old, SDOperand &New, - SelectionDAG &DAG) const { - // If the operation has more than one use, we're not interested in it. - // Tracking down and checking all uses would be problematic and slow. - if (!Op.Val->hasOneUse()) +/// ShrinkDemandedConstant - Check to see if the specified operand of the +/// specified instruction is a constant integer. If so, check to see if there +/// are any bits set in the constant that are not demanded. If so, shrink the +/// constant and return true. +bool TargetLowering::TargetLoweringOpt::ShrinkDemandedConstant(SDOperand Op, + uint64_t Demanded) { + // FIXME: ISD::SELECT + switch(Op.getOpcode()) { + default: break; + case ISD::AND: + case ISD::OR: + case ISD::XOR: + if (ConstantSDNode *C = dyn_cast(Op.getOperand(1))) + if ((~Demanded & C->getValue()) != 0) { + MVT::ValueType VT = Op.getValueType(); + SDOperand New = DAG.getNode(Op.getOpcode(), VT, Op.getOperand(0), + DAG.getConstant(Demanded & C->getValue(), + VT)); + return CombineTo(Op, New); + } + break; + } + return false; +} + +/// SimplifyDemandedBits - Look at Op. At this point, we know that only the +/// DemandedMask bits of the result of Op are ever used downstream. If we can +/// use this information to simplify Op, create a new simplified DAG node and +/// return true, returning the original and new nodes in Old and New. Otherwise, +/// analyze the expression and return a mask of KnownOne and KnownZero bits for +/// the expression (used to simplify the caller). The KnownZero/One bits may +/// only be accurate for those bits in the DemandedMask. +bool TargetLowering::SimplifyDemandedBits(SDOperand Op, uint64_t DemandedMask, + uint64_t &KnownZero, + uint64_t &KnownOne, + TargetLoweringOpt &TLO, + unsigned Depth) const { + KnownZero = KnownOne = 0; // Don't know anything. + // Other users may use these bits. + if (!Op.Val->hasOneUse()) { + if (Depth != 0) { + // If not at the root, Just compute the KnownZero/KnownOne bits to + // simplify things downstream. + ComputeMaskedBits(Op, DemandedMask, KnownZero, KnownOne, Depth); + return false; + } + // If this is the root being simplified, allow it to have multiple uses, + // just set the DemandedMask to all bits. + DemandedMask = MVT::getIntVTBitMask(Op.getValueType()); + } else if (DemandedMask == 0) { + // Not demanding any bits from Op. + if (Op.getOpcode() != ISD::UNDEF) + return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::UNDEF, Op.getValueType())); return false; - + } else if (Depth == 6) { // Limit search depth. + return false; + } + + uint64_t KnownZero2, KnownOne2, KnownZeroOut, KnownOneOut; switch (Op.getOpcode()) { + case ISD::Constant: + // We know all of the bits for a constant! + KnownOne = cast(Op)->getValue() & DemandedMask; + KnownZero = ~KnownOne & DemandedMask; + return false; case ISD::AND: - // (X & C1) & C2 == 0 iff C1 & C2 == 0. - if (ConstantSDNode *AndRHS = dyn_cast(Op.getOperand(1))) { - uint64_t NewVal = Mask & AndRHS->getValue(); - return DemandedBitsAreZero(Op.getOperand(0), NewVal, Old, New, DAG); + // If either the LHS or the RHS are Zero, the result is zero. + if (SimplifyDemandedBits(Op.getOperand(1), DemandedMask, KnownZero, + KnownOne, TLO, Depth+1)) + return true; + assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); + // If something is known zero on the RHS, the bits aren't demanded on the + // LHS. + if (SimplifyDemandedBits(Op.getOperand(0), DemandedMask & ~KnownZero, + KnownZero2, KnownOne2, TLO, Depth+1)) + return true; + assert((KnownZero2 & KnownOne2) == 0 && "Bits known to be one AND zero?"); + + // If all of the demanded bits are known one on one side, return the other. + // These bits cannot contribute to the result of the 'and'. + if ((DemandedMask & ~KnownZero2 & KnownOne)==(DemandedMask & ~KnownZero2)) + return TLO.CombineTo(Op, Op.getOperand(0)); + if ((DemandedMask & ~KnownZero & KnownOne2)==(DemandedMask & ~KnownZero)) + return TLO.CombineTo(Op, Op.getOperand(1)); + // If all of the demanded bits in the inputs are known zeros, return zero. + if ((DemandedMask & (KnownZero|KnownZero2)) == DemandedMask) + return TLO.CombineTo(Op, TLO.DAG.getConstant(0, Op.getValueType())); + // If the RHS is a constant, see if we can simplify it. + if (TLO.ShrinkDemandedConstant(Op, DemandedMask & ~KnownZero2)) + return true; + + // Output known-1 bits are only known if set in both the LHS & RHS. + KnownOne &= KnownOne2; + // Output known-0 are known to be clear if zero in either the LHS | RHS. + KnownZero |= KnownZero2; + break; + case ISD::OR: + if (SimplifyDemandedBits(Op.getOperand(1), DemandedMask, KnownZero, + KnownOne, TLO, Depth+1)) + return true; + assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); + if (SimplifyDemandedBits(Op.getOperand(0), DemandedMask & ~KnownOne, + KnownZero2, KnownOne2, TLO, Depth+1)) + return true; + assert((KnownZero2 & KnownOne2) == 0 && "Bits known to be one AND zero?"); + + // If all of the demanded bits are known zero on one side, return the other. + // These bits cannot contribute to the result of the 'or'. + if ((DemandedMask & ~KnownOne2 & KnownZero) == DemandedMask & ~KnownOne2) + return TLO.CombineTo(Op, Op.getOperand(0)); + if ((DemandedMask & ~KnownOne & KnownZero2) == DemandedMask & ~KnownOne) + return TLO.CombineTo(Op, Op.getOperand(1)); + // If all of the potentially set bits on one side are known to be set on + // the other side, just use the 'other' side. + if ((DemandedMask & (~KnownZero) & KnownOne2) == + (DemandedMask & (~KnownZero))) + return TLO.CombineTo(Op, Op.getOperand(0)); + if ((DemandedMask & (~KnownZero2) & KnownOne) == + (DemandedMask & (~KnownZero2))) + return TLO.CombineTo(Op, Op.getOperand(1)); + // If the RHS is a constant, see if we can simplify it. + if (TLO.ShrinkDemandedConstant(Op, DemandedMask)) + return true; + + // Output known-0 bits are only known if clear in both the LHS & RHS. + KnownZero &= KnownZero2; + // Output known-1 are known to be set if set in either the LHS | RHS. + KnownOne |= KnownOne2; + break; + case ISD::XOR: + if (SimplifyDemandedBits(Op.getOperand(1), DemandedMask, KnownZero, + KnownOne, TLO, Depth+1)) + return true; + assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); + if (SimplifyDemandedBits(Op.getOperand(0), DemandedMask, KnownZero2, + KnownOne2, TLO, Depth+1)) + return true; + assert((KnownZero2 & KnownOne2) == 0 && "Bits known to be one AND zero?"); + + // If all of the demanded bits are known zero on one side, return the other. + // These bits cannot contribute to the result of the 'xor'. + if ((DemandedMask & KnownZero) == DemandedMask) + return TLO.CombineTo(Op, Op.getOperand(0)); + if ((DemandedMask & KnownZero2) == DemandedMask) + return TLO.CombineTo(Op, Op.getOperand(1)); + + // Output known-0 bits are known if clear or set in both the LHS & RHS. + KnownZeroOut = (KnownZero & KnownZero2) | (KnownOne & KnownOne2); + // Output known-1 are known to be set if set in only one of the LHS, RHS. + KnownOneOut = (KnownZero & KnownOne2) | (KnownOne & KnownZero2); + + // If all of the unknown bits are known to be zero on one side or the other + // (but not both) turn this into an *inclusive* or. + // e.g. (A & C1)^(B & C2) -> (A & C1)|(B & C2) iff C1&C2 == 0 + if (uint64_t UnknownBits = DemandedMask & ~(KnownZeroOut|KnownOneOut)) + if ((UnknownBits & (KnownZero|KnownZero2)) == UnknownBits) + return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::OR, Op.getValueType(), + Op.getOperand(0), + Op.getOperand(1))); + // If all of the demanded bits on one side are known, and all of the set + // bits on that side are also known to be set on the other side, turn this + // into an AND, as we know the bits will be cleared. + // e.g. (X | C1) ^ C2 --> (X | C1) & ~C2 iff (C1&C2) == C2 + if ((DemandedMask & (KnownZero|KnownOne)) == DemandedMask) { // all known + if ((KnownOne & KnownOne2) == KnownOne) { + MVT::ValueType VT = Op.getValueType(); + SDOperand ANDC = TLO.DAG.getConstant(~KnownOne & DemandedMask, VT); + return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::AND, VT, Op.getOperand(0), + ANDC)); + } } + + // If the RHS is a constant, see if we can simplify it. + // FIXME: for XOR, we prefer to force bits to 1 if they will make a -1. + if (TLO.ShrinkDemandedConstant(Op, DemandedMask)) + return true; + + KnownZero = KnownZeroOut; + KnownOne = KnownOneOut; + break; + case ISD::SETCC: + // If we know the result of a setcc has the top bits zero, use this info. + if (getSetCCResultContents() == TargetLowering::ZeroOrOneSetCCResult) + KnownZero |= (MVT::getIntVTBitMask(Op.getValueType()) ^ 1ULL); + break; + case ISD::SELECT: + if (SimplifyDemandedBits(Op.getOperand(2), DemandedMask, KnownZero, + KnownOne, TLO, Depth+1)) + return true; + if (SimplifyDemandedBits(Op.getOperand(1), DemandedMask, KnownZero2, + KnownOne2, TLO, Depth+1)) + return true; + assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); + assert((KnownZero2 & KnownOne2) == 0 && "Bits known to be one AND zero?"); + + // If the operands are constants, see if we can simplify them. + if (TLO.ShrinkDemandedConstant(Op, DemandedMask)) + return true; + + // Only known if known in both the LHS and RHS. + KnownOne &= KnownOne2; + KnownZero &= KnownZero2; break; case ISD::SHL: - // (ushl X, C1) & C2 == 0 iff X & (C2 >> C1) == 0 - if (ConstantSDNode *ShAmt = dyn_cast(Op.getOperand(1))) { - uint64_t NewVal = Mask >> ShAmt->getValue(); - return DemandedBitsAreZero(Op.getOperand(0), NewVal, Old, New, DAG); + if (ConstantSDNode *SA = dyn_cast(Op.getOperand(1))) { + if (SimplifyDemandedBits(Op.getOperand(0), DemandedMask >> SA->getValue(), + KnownZero, KnownOne, TLO, Depth+1)) + return true; + KnownZero <<= SA->getValue(); + KnownOne <<= SA->getValue(); + KnownZero |= (1ULL << SA->getValue())-1; // low bits known zero. + } + break; + case ISD::SRL: + if (ConstantSDNode *SA = dyn_cast(Op.getOperand(1))) { + MVT::ValueType VT = Op.getValueType(); + unsigned ShAmt = SA->getValue(); + + // Compute the new bits that are at the top now. + uint64_t HighBits = (1ULL << ShAmt)-1; + HighBits <<= MVT::getSizeInBits(VT) - ShAmt; + uint64_t TypeMask = MVT::getIntVTBitMask(VT); + + if (SimplifyDemandedBits(Op.getOperand(0), + (DemandedMask << ShAmt) & TypeMask, + KnownZero, KnownOne, TLO, Depth+1)) + return true; + assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); + KnownZero &= TypeMask; + KnownOne &= TypeMask; + KnownZero >>= ShAmt; + KnownOne >>= ShAmt; + KnownZero |= HighBits; // high bits known zero. + } + break; + case ISD::SRA: + if (ConstantSDNode *SA = dyn_cast(Op.getOperand(1))) { + MVT::ValueType VT = Op.getValueType(); + unsigned ShAmt = SA->getValue(); + + // Compute the new bits that are at the top now. + uint64_t HighBits = (1ULL << ShAmt)-1; + HighBits <<= MVT::getSizeInBits(VT) - ShAmt; + uint64_t TypeMask = MVT::getIntVTBitMask(VT); + + if (SimplifyDemandedBits(Op.getOperand(0), + (DemandedMask << ShAmt) & TypeMask, + KnownZero, KnownOne, TLO, Depth+1)) + return true; + assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); + KnownZero &= TypeMask; + KnownOne &= TypeMask; + KnownZero >>= SA->getValue(); + KnownOne >>= SA->getValue(); + + // Handle the sign bits. + uint64_t SignBit = MVT::getIntVTSignBit(VT); + SignBit >>= SA->getValue(); // Adjust to where it is now in the mask. + + // If the input sign bit is known to be zero, or if none of the top bits + // are demanded, turn this into an unsigned shift right. + if ((KnownZero & SignBit) || (HighBits & ~DemandedMask) == HighBits) { + return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::SRL, VT, Op.getOperand(0), + Op.getOperand(1))); + } else if (KnownOne & SignBit) { // New bits are known one. + KnownOne |= HighBits; + } } break; case ISD::SIGN_EXTEND_INREG: { + MVT::ValueType VT = Op.getValueType(); MVT::ValueType EVT = cast(Op.getOperand(1))->getVT(); - unsigned ExtendBits = MVT::getSizeInBits(EVT); - // If we're extending from something smaller than MVT::i64 and all of the - // sign extension bits are masked, return true and set New to be the - // first operand, since we no longer care what the high bits are. - if (ExtendBits < 64 && ((Mask & (~0ULL << ExtendBits)) == 0)) { - Old = Op; - New = Op.getOperand(0); + + // Sign or Zero extension. Compute the bits in the result that are not + // present in the input. + uint64_t NotIn = ~MVT::getIntVTBitMask(EVT); + uint64_t NewBits = MVT::getIntVTBitMask(VT) & NotIn; + + // Sign extension. + uint64_t InSignBit = MVT::getIntVTSignBit(EVT); + int64_t InputDemandedBits = DemandedMask & MVT::getIntVTBitMask(EVT); + + // If any of the sign extended bits are demanded, we know that the sign + // bit is demanded. + if (NewBits & DemandedMask) + InputDemandedBits |= InSignBit; + + if (SimplifyDemandedBits(Op.getOperand(0), InputDemandedBits, + KnownZero, KnownOne, TLO, Depth+1)) return true; + assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); + + // If the sign bit of the input is known set or clear, then we know the + // top bits of the result. + + // If the input sign bit is known zero, or if the NewBits are not demanded + // convert this into a zero extension. + if ((KnownZero & InSignBit) || (NewBits & ~DemandedMask) == NewBits) { + return TLO.CombineTo(Op, Op.getOperand(0)); + } else if (KnownOne & InSignBit) { // Input sign bit known set + KnownOne |= NewBits; + KnownZero &= ~NewBits; + } else { // Input sign bit unknown + KnownZero &= ~NewBits; + KnownOne &= ~NewBits; } break; } - case ISD::SRA: - if (ConstantSDNode *ShAmt = dyn_cast(Op.getOperand(1))) { - unsigned OpBits = MVT::getSizeInBits(Op.getValueType()); - unsigned SH = ShAmt->getValue(); - if (SH && ((Mask & (~0ULL << (OpBits-SH))) == 0)) { - Old = Op; - New = DAG.getNode(ISD::SRL, Op.getValueType(), Op.getOperand(0), - Op.getOperand(1)); + case ISD::ADD: + if (ConstantSDNode *AA = dyn_cast(Op.getOperand(1))) { + if (SimplifyDemandedBits(Op.getOperand(0), DemandedMask, KnownZero, + KnownOne, TLO, Depth+1)) return true; - } + // Compute the KnownOne/KnownZero masks for the constant, so we can set + // KnownZero appropriately if we're adding a constant that has all low + // bits cleared. + ComputeMaskedBits(Op.getOperand(1), + MVT::getIntVTBitMask(Op.getValueType()), + KnownZero2, KnownOne2, Depth+1); + + uint64_t KnownZeroOut = std::min(CountTrailingZeros_64(~KnownZero), + CountTrailingZeros_64(~KnownZero2)); + KnownZero = (1ULL << KnownZeroOut) - 1; + KnownOne = 0; } break; + case ISD::CTTZ: + case ISD::CTLZ: + case ISD::CTPOP: { + MVT::ValueType VT = Op.getValueType(); + unsigned LowBits = Log2_32(MVT::getSizeInBits(VT))+1; + KnownZero = ~((1ULL << LowBits)-1) & MVT::getIntVTBitMask(VT); + KnownOne = 0; + break; + } } return false; } -/// MaskedValueIsZero - Return true if 'Op & Mask' is known to be zero. We use -/// this predicate to simplify operations downstream. Op and Mask are known to -/// be the same type. -bool TargetLowering::MaskedValueIsZero(const SDOperand &Op, - uint64_t Mask) const { - unsigned SrcBits; - if (Mask == 0) return true; +/// MaskedValueIsZero - Return true if 'V & Mask' is known to be zero. We use +/// this predicate to simplify operations downstream. Mask is known to be zero +/// for bits that V cannot have. +bool TargetLowering::MaskedValueIsZero(SDOperand Op, uint64_t Mask, + unsigned Depth) const { + uint64_t KnownZero, KnownOne; + ComputeMaskedBits(Op, Mask, KnownZero, KnownOne, Depth); + assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); + return (KnownZero & Mask) == Mask; +} + +/// ComputeMaskedBits - Determine which of the bits specified in Mask are +/// known to be either zero or one and return them in the KnownZero/KnownOne +/// bitsets. This code only analyzes bits in Mask, in order to short-circuit +/// processing. +void TargetLowering::ComputeMaskedBits(SDOperand Op, uint64_t Mask, + uint64_t &KnownZero, uint64_t &KnownOne, + unsigned Depth) const { + KnownZero = KnownOne = 0; // Don't know anything. + if (Depth == 6 || Mask == 0) + return; // Limit search depth. - // If we know the result of a setcc has the top bits zero, use this info. + uint64_t KnownZero2, KnownOne2; + switch (Op.getOpcode()) { case ISD::Constant: - return (cast(Op)->getValue() & Mask) == 0; - case ISD::SETCC: - return ((Mask & 1) == 0) && - getSetCCResultContents() == TargetLowering::ZeroOrOneSetCCResult; - case ISD::ZEXTLOAD: - SrcBits = MVT::getSizeInBits(cast(Op.getOperand(3))->getVT()); - return (Mask & ((1ULL << SrcBits)-1)) == 0; // Returning only the zext bits. - case ISD::ZERO_EXTEND: - SrcBits = MVT::getSizeInBits(Op.getOperand(0).getValueType()); - return MaskedValueIsZero(Op.getOperand(0),Mask & (~0ULL >> (64-SrcBits))); - case ISD::ANY_EXTEND: - // If the mask only includes bits in the low part, recurse. - SrcBits = MVT::getSizeInBits(Op.getOperand(0).getValueType()); - if (Mask >> SrcBits) return false; // Use of unknown top bits. - return MaskedValueIsZero(Op.getOperand(0), Mask); - case ISD::AssertZext: - SrcBits = MVT::getSizeInBits(cast(Op.getOperand(1))->getVT()); - return (Mask & ((1ULL << SrcBits)-1)) == 0; // Returning only the zext bits. + // We know all of the bits for a constant! + KnownOne = cast(Op)->getValue() & Mask; + KnownZero = ~KnownOne & Mask; + return; case ISD::AND: - // If either of the operands has zero bits, the result will too. - if (MaskedValueIsZero(Op.getOperand(1), Mask) || - MaskedValueIsZero(Op.getOperand(0), Mask)) - return true; - // (X & C1) & C2 == 0 iff C1 & C2 == 0. - if (ConstantSDNode *AndRHS = dyn_cast(Op.getOperand(1))) - return MaskedValueIsZero(Op.getOperand(0),AndRHS->getValue() & Mask); - return false; + // If either the LHS or the RHS are Zero, the result is zero. + ComputeMaskedBits(Op.getOperand(1), Mask, KnownZero, KnownOne, Depth+1); + Mask &= ~KnownZero; + ComputeMaskedBits(Op.getOperand(0), Mask, KnownZero2, KnownOne2, Depth+1); + assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); + assert((KnownZero2 & KnownOne2) == 0 && "Bits known to be one AND zero?"); + + // Output known-1 bits are only known if set in both the LHS & RHS. + KnownOne &= KnownOne2; + // Output known-0 are known to be clear if zero in either the LHS | RHS. + KnownZero |= KnownZero2; + return; case ISD::OR: - case ISD::XOR: - return MaskedValueIsZero(Op.getOperand(0), Mask) && - MaskedValueIsZero(Op.getOperand(1), Mask); + ComputeMaskedBits(Op.getOperand(1), Mask, KnownZero, KnownOne, Depth+1); + Mask &= ~KnownOne; + ComputeMaskedBits(Op.getOperand(0), Mask, KnownZero2, KnownOne2, Depth+1); + assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); + assert((KnownZero2 & KnownOne2) == 0 && "Bits known to be one AND zero?"); + + // Output known-0 bits are only known if clear in both the LHS & RHS. + KnownZero &= KnownZero2; + // Output known-1 are known to be set if set in either the LHS | RHS. + KnownOne |= KnownOne2; + return; + case ISD::XOR: { + ComputeMaskedBits(Op.getOperand(1), Mask, KnownZero, KnownOne, Depth+1); + ComputeMaskedBits(Op.getOperand(0), Mask, KnownZero2, KnownOne2, Depth+1); + assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); + assert((KnownZero2 & KnownOne2) == 0 && "Bits known to be one AND zero?"); + + // Output known-0 bits are known if clear or set in both the LHS & RHS. + uint64_t KnownZeroOut = (KnownZero & KnownZero2) | (KnownOne & KnownOne2); + // Output known-1 are known to be set if set in only one of the LHS, RHS. + KnownOne = (KnownZero & KnownOne2) | (KnownOne & KnownZero2); + KnownZero = KnownZeroOut; + return; + } case ISD::SELECT: - return MaskedValueIsZero(Op.getOperand(1), Mask) && - MaskedValueIsZero(Op.getOperand(2), Mask); + ComputeMaskedBits(Op.getOperand(2), Mask, KnownZero, KnownOne, Depth+1); + ComputeMaskedBits(Op.getOperand(1), Mask, KnownZero2, KnownOne2, Depth+1); + assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); + assert((KnownZero2 & KnownOne2) == 0 && "Bits known to be one AND zero?"); + + // Only known if known in both the LHS and RHS. + KnownOne &= KnownOne2; + KnownZero &= KnownZero2; + return; case ISD::SELECT_CC: - return MaskedValueIsZero(Op.getOperand(2), Mask) && - MaskedValueIsZero(Op.getOperand(3), Mask); - case ISD::SRL: - // (ushr X, C1) & C2 == 0 iff X & (C2 << C1) == 0 - if (ConstantSDNode *ShAmt = dyn_cast(Op.getOperand(1))) { - uint64_t NewVal = Mask << ShAmt->getValue(); - SrcBits = MVT::getSizeInBits(Op.getValueType()); - if (SrcBits != 64) NewVal &= (1ULL << SrcBits)-1; - return MaskedValueIsZero(Op.getOperand(0), NewVal); - } - return false; + ComputeMaskedBits(Op.getOperand(3), Mask, KnownZero, KnownOne, Depth+1); + ComputeMaskedBits(Op.getOperand(2), Mask, KnownZero2, KnownOne2, Depth+1); + assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); + assert((KnownZero2 & KnownOne2) == 0 && "Bits known to be one AND zero?"); + + // Only known if known in both the LHS and RHS. + KnownOne &= KnownOne2; + KnownZero &= KnownZero2; + return; + case ISD::SETCC: + // If we know the result of a setcc has the top bits zero, use this info. + if (getSetCCResultContents() == TargetLowering::ZeroOrOneSetCCResult) + KnownZero |= (MVT::getIntVTBitMask(Op.getValueType()) ^ 1ULL); + return; case ISD::SHL: - // (ushl X, C1) & C2 == 0 iff X & (C2 >> C1) == 0 - if (ConstantSDNode *ShAmt = dyn_cast(Op.getOperand(1))) { - uint64_t NewVal = Mask >> ShAmt->getValue(); - return MaskedValueIsZero(Op.getOperand(0), NewVal); + // (shl X, C1) & C2 == 0 iff (X & C2 >>u C1) == 0 + if (ConstantSDNode *SA = dyn_cast(Op.getOperand(1))) { + Mask >>= SA->getValue(); + ComputeMaskedBits(Op.getOperand(0), Mask, KnownZero, KnownOne, Depth+1); + assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); + KnownZero <<= SA->getValue(); + KnownOne <<= SA->getValue(); + KnownZero |= (1ULL << SA->getValue())-1; // low bits known zero. } - return false; - case ISD::ADD: - // (add X, Y) & C == 0 iff (X&C)|(Y&C) == 0 and all bits are low bits. - if ((Mask&(Mask+1)) == 0) { // All low bits - if (MaskedValueIsZero(Op.getOperand(0), Mask) && - MaskedValueIsZero(Op.getOperand(1), Mask)) - return true; + break; + case ISD::SRL: + // (ushr X, C1) & C2 == 0 iff (-1 >> C1) & C2 == 0 + if (ConstantSDNode *SA = dyn_cast(Op.getOperand(1))) { + uint64_t HighBits = (1ULL << SA->getValue())-1; + HighBits <<= MVT::getSizeInBits(Op.getValueType())-SA->getValue(); + Mask <<= SA->getValue(); + ComputeMaskedBits(Op.getOperand(0), Mask, KnownZero, KnownOne, Depth+1); + assert((KnownZero & KnownOne) == 0&&"Bits known to be one AND zero?"); + KnownZero >>= SA->getValue(); + KnownOne >>= SA->getValue(); + KnownZero |= HighBits; // high bits known zero. } break; - case ISD::SUB: - if (ConstantSDNode *CLHS = dyn_cast(Op.getOperand(0))) { - // We know that the top bits of C-X are clear if X contains less bits - // than C (i.e. no wrap-around can happen). For example, 20-X is - // positive if we can prove that X is >= 0 and < 16. - unsigned Bits = MVT::getSizeInBits(CLHS->getValueType(0)); - if ((CLHS->getValue() & (1 << (Bits-1))) == 0) { // sign bit clear - unsigned NLZ = CountLeadingZeros_64(CLHS->getValue()+1); - uint64_t MaskV = (1ULL << (63-NLZ))-1; - if (MaskedValueIsZero(Op.getOperand(1), ~MaskV)) { - // High bits are clear this value is known to be >= C. - unsigned NLZ2 = CountLeadingZeros_64(CLHS->getValue()); - if ((Mask & ((1ULL << (64-NLZ2))-1)) == 0) - return true; - } + case ISD::SRA: + if (ConstantSDNode *SA = dyn_cast(Op.getOperand(1))) { + uint64_t HighBits = (1ULL << SA->getValue())-1; + HighBits <<= MVT::getSizeInBits(Op.getValueType())-SA->getValue(); + Mask <<= SA->getValue(); + ComputeMaskedBits(Op.getOperand(0), Mask, KnownZero, KnownOne, Depth+1); + assert((KnownZero & KnownOne) == 0&&"Bits known to be one AND zero?"); + KnownZero >>= SA->getValue(); + KnownOne >>= SA->getValue(); + + // Handle the sign bits. + uint64_t SignBit = 1ULL << (MVT::getSizeInBits(Op.getValueType())-1); + SignBit >>= SA->getValue(); // Adjust to where it is now in the mask. + + if (KnownZero & SignBit) { // New bits are known zero. + KnownZero |= HighBits; + } else if (KnownOne & SignBit) { // New bits are known one. + KnownOne |= HighBits; } } break; case ISD::CTTZ: case ISD::CTLZ: - case ISD::CTPOP: - // Bit counting instructions can not set the high bits of the result - // register. The max number of bits sets depends on the input. - return (Mask & (MVT::getSizeInBits(Op.getValueType())*2-1)) == 0; + case ISD::CTPOP: { + MVT::ValueType VT = Op.getValueType(); + unsigned LowBits = Log2_32(MVT::getSizeInBits(VT))+1; + KnownZero = ~((1ULL << LowBits)-1) & MVT::getIntVTBitMask(VT); + KnownOne = 0; + return; + } + case ISD::ZEXTLOAD: { + unsigned SrcBits = + MVT::getSizeInBits(cast(Op.getOperand(3))->getVT()); + KnownZero |= ~((1ULL << SrcBits)-1); + return; + } + case ISD::ZERO_EXTEND: { + unsigned SrcBits = + MVT::getSizeInBits(Op.getOperand(0).getValueType()); + KnownZero |= ~((1ULL << SrcBits)-1); + return; + } + case ISD::ANY_EXTEND: { + unsigned SrcBits = + MVT::getSizeInBits(Op.getOperand(0).getValueType()); + KnownZero &= ((1ULL << SrcBits)-1); + KnownOne &= ((1ULL << SrcBits)-1); + return; + } + case ISD::AssertZext: { + unsigned SrcBits = + MVT::getSizeInBits(cast(Op.getOperand(1))->getVT()); + KnownZero |= ~((1ULL << SrcBits)-1); + return; + } + case ISD::ADD: { + // If either the LHS or the RHS are Zero, the result is zero. + ComputeMaskedBits(Op.getOperand(1), Mask, KnownZero, KnownOne, Depth+1); + ComputeMaskedBits(Op.getOperand(0), Mask, KnownZero2, KnownOne2, Depth+1); + assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); + assert((KnownZero2 & KnownOne2) == 0 && "Bits known to be one AND zero?"); + + // Output known-0 bits are known if clear or set in both the low clear bits + // common to both LHS & RHS; + uint64_t KnownZeroOut = std::min(CountTrailingZeros_64(~KnownZero), + CountTrailingZeros_64(~KnownZero2)); + + KnownZero = (1ULL << KnownZeroOut) - 1; + KnownOne = 0; + return; + } + case ISD::SUB: + // We know that the top bits of C-X are clear if X contains less bits + // than C (i.e. no wrap-around can happen). For example, 20-X is + // positive if we can prove that X is >= 0 and < 16. + break; default: // Allow the target to implement this method for its nodes. if (Op.getOpcode() >= ISD::BUILTIN_OP_END) - return isMaskedValueZeroForTargetNode(Op, Mask); + computeMaskedBitsForTargetNode(Op, Mask, KnownZero, KnownOne); break; } - return false; } -bool TargetLowering::isMaskedValueZeroForTargetNode(const SDOperand &Op, - uint64_t Mask) const { +/// computeMaskedBitsForTargetNode - Determine which of the bits specified +/// in Mask are known to be either zero or one and return them in the +/// KnownZero/KnownOne bitsets. +void TargetLowering::computeMaskedBitsForTargetNode(const SDOperand Op, + uint64_t Mask, + uint64_t &KnownZero, + uint64_t &KnownOne, + unsigned Depth) const { assert(Op.getOpcode() >= ISD::BUILTIN_OP_END && "Should use MaskedValueIsZero if you don't know whether Op" " is a target node!"); - return false; + KnownZero = 0; + KnownOne = 0; } //===----------------------------------------------------------------------===// From lattner at cs.uiuc.edu Thu Feb 16 15:13:06 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 16 Feb 2006 15:13:06 -0600 Subject: [llvm-commits] CVS: llvm/configure Message-ID: <200602162113.PAA13691@zion.cs.uiuc.edu> Changes in directory llvm: configure updated: 1.211 -> 1.212 --- Log message: remove skeleton target --- Diffs of the changes: (+1 -2) configure | 3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/configure diff -u llvm/configure:1.211 llvm/configure:1.212 --- llvm/configure:1.211 Wed Feb 15 01:56:38 2006 +++ llvm/configure Thu Feb 16 15:12:54 2006 @@ -3078,7 +3078,7 @@ enableval=all fi; case "$enableval" in - all) TARGETS_TO_BUILD="X86 Sparc SparcV9 PowerPC Alpha IA64 Skeleton" ;; + all) TARGETS_TO_BUILD="X86 Sparc SparcV9 PowerPC Alpha IA64" ;; host-only) case "$llvm_cv_target_arch" in x86) TARGETS_TO_BUILD="X86" ;; @@ -3100,7 +3100,6 @@ powerpc) TARGETS_TO_BUILD="PowerPC $TARGETS_TO_BUILD" ;; alpha) TARGETS_TO_BUILD="Alpha $TARGETS_TO_BUILD" ;; ia64) TARGETS_TO_BUILD="IA64 $TARGETS_TO_BUILD" ;; - skeleton)TARGETS_TO_BUILD="Skeleton $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; }; } ;; From evan.cheng at apple.com Thu Feb 16 15:20:38 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 16 Feb 2006 15:20:38 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86RegisterInfo.cpp Message-ID: <200602162120.PAA13768@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86RegisterInfo.cpp updated: 1.122 -> 1.123 --- Log message: Use movaps / movapd to spill / restore V4F4 / V2F8 registers. --- Diffs of the changes: (+12 -4) X86RegisterInfo.cpp | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-) Index: llvm/lib/Target/X86/X86RegisterInfo.cpp diff -u llvm/lib/Target/X86/X86RegisterInfo.cpp:1.122 llvm/lib/Target/X86/X86RegisterInfo.cpp:1.123 --- llvm/lib/Target/X86/X86RegisterInfo.cpp:1.122 Wed Feb 15 19:50:02 2006 +++ llvm/lib/Target/X86/X86RegisterInfo.cpp Thu Feb 16 15:20:26 2006 @@ -57,10 +57,14 @@ Opc = X86::MOV16mr; } else if (RC == &X86::RFPRegClass || RC == &X86::RSTRegClass) { Opc = X86::FpST64m; - } else if (RC == &X86::FR32RegClass || RC == &X86::V4F4RegClass) { + } else if (RC == &X86::FR32RegClass) { Opc = X86::MOVSSmr; - } else if (RC == &X86::FR64RegClass || RC == &X86::V2F8RegClass) { + } else if (RC == &X86::FR64RegClass) { Opc = X86::MOVSDmr; + } else if (RC == &X86::V4F4RegClass) { + Opc = X86::MOVAPSmr; + } else if (RC == &X86::V2F8RegClass) { + Opc = X86::MOVAPDmr; } else { assert(0 && "Unknown regclass"); abort(); @@ -81,10 +85,14 @@ Opc = X86::MOV16rm; } else if (RC == &X86::RFPRegClass || RC == &X86::RSTRegClass) { Opc = X86::FpLD64m; - } else if (RC == &X86::FR32RegClass || RC == &X86::V4F4RegClass) { + } else if (RC == &X86::FR32RegClass) { Opc = X86::MOVSSrm; - } else if (RC == &X86::FR64RegClass || RC == &X86::V2F8RegClass) { + } else if (RC == &X86::FR64RegClass) { Opc = X86::MOVSDrm; + } else if (RC == &X86::V4F4RegClass) { + Opc = X86::MOVAPSrm; + } else if (RC == &X86::V2F8RegClass) { + Opc = X86::MOVAPDrm; } else { assert(0 && "Unknown regclass"); abort(); From evan.cheng at apple.com Thu Feb 16 16:45:28 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 16 Feb 2006 16:45:28 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86InstrInfo.cpp X86InstrInfo.td X86RegisterInfo.cpp Message-ID: <200602162245.QAA14264@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86InstrInfo.cpp updated: 1.44 -> 1.45 X86InstrInfo.td updated: 1.234 -> 1.235 X86RegisterInfo.cpp updated: 1.123 -> 1.124 --- Log message: 1. Use pxor instead of xoraps / xorapd to clear FR32 / FR64 registers. This proves to be worth 20% on Ptrdist/ks. Might be related to dependency breaking support. 2. Added FsMOVAPSrr and FsMOVAPDrr as aliases to MOVAPSrr and MOVAPDrr. These are used for FR32 / FR64 reg-to-reg copies. 3. Tell reg-allocator to generate MOVSSrm / MOVSDrm and MOVSSmr / MOVSDmr to spill / restore FsMOVAPSrr and FsMOVAPDrr. --- Diffs of the changes: (+29 -13) X86InstrInfo.cpp | 1 + X86InstrInfo.td | 31 ++++++++++++++++++++----------- X86RegisterInfo.cpp | 10 ++++++++-- 3 files changed, 29 insertions(+), 13 deletions(-) Index: llvm/lib/Target/X86/X86InstrInfo.cpp diff -u llvm/lib/Target/X86/X86InstrInfo.cpp:1.44 llvm/lib/Target/X86/X86InstrInfo.cpp:1.45 --- llvm/lib/Target/X86/X86InstrInfo.cpp:1.44 Thu Feb 2 14:38:12 2006 +++ llvm/lib/Target/X86/X86InstrInfo.cpp Thu Feb 16 16:45:16 2006 @@ -29,6 +29,7 @@ MachineOpCode oc = MI.getOpcode(); if (oc == X86::MOV8rr || oc == X86::MOV16rr || oc == X86::MOV32rr || oc == X86::FpMOV || oc == X86::MOVSSrr || oc == X86::MOVSDrr || + oc == X86::FsMOVAPSrr || oc == X86::FsMOVAPDrr || oc == X86::MOVAPSrr || oc == X86::MOVAPDrr) { assert(MI.getNumOperands() == 2 && MI.getOperand(0).isRegister() && Index: llvm/lib/Target/X86/X86InstrInfo.td diff -u llvm/lib/Target/X86/X86InstrInfo.td:1.234 llvm/lib/Target/X86/X86InstrInfo.td:1.235 --- llvm/lib/Target/X86/X86InstrInfo.td:1.234 Thu Feb 16 13:34:41 2006 +++ llvm/lib/Target/X86/X86InstrInfo.td Thu Feb 16 16:45:17 2006 @@ -2487,13 +2487,13 @@ [(X86cmp FR64:$src1, (loadf64 addr:$src2))]>, Requires<[HasSSE2]>, TB, OpSize; -// Pseudo-instructions that map fld0 to xorps/xorpd for sse. +// Pseudo-instructions that map fld0 to pxor for sse. // FIXME: remove when we can teach regalloc that xor reg, reg is ok. -def FLD0SS : I<0x57, MRMInitReg, (ops FR32:$dst), - "xorps $dst, $dst", [(set FR32:$dst, fp32imm0)]>, +def FLD0SS : I<0xEF, MRMInitReg, (ops FR32:$dst), + "pxor $dst, $dst", [(set FR32:$dst, fp32imm0)]>, Requires<[HasSSE1]>, TB; -def FLD0SD : I<0x57, MRMInitReg, (ops FR64:$dst), - "xorpd $dst, $dst", [(set FR64:$dst, fp64imm0)]>, +def FLD0SD : I<0xEF, MRMInitReg, (ops FR64:$dst), + "pxor $dst, $dst", [(set FR64:$dst, fp64imm0)]>, Requires<[HasSSE2]>, TB, OpSize; let isTwoAddress = 1 in { @@ -3033,13 +3033,22 @@ "movapd {$src, $dst|$dst, $src}",[]>, Requires<[HasSSE2]>, TB, OpSize; -// Pseudo-instructions to load FR32 / FR64 from f128mem using movaps / movapd. +// Alias instructions to do FR32 / FR64 reg-to-reg copy using movaps / movapd. // Upper bits are disregarded. -def MOVSAPSrm : I<0x28, MRMSrcMem, (ops FR32:$dst, f128mem:$src), - "movaps {$src, $dst|$dst, $src}", - [(set FR32:$dst, (X86loadpf32 addr:$src))]>, - Requires<[HasSSE1]>, TB; -def MOVSAPDrm : I<0x28, MRMSrcMem, (ops FR64:$dst, f128mem:$src), +def FsMOVAPSrr : I<0x28, MRMSrcReg, (ops V4F4:$dst, V4F4:$src), + "movaps {$src, $dst|$dst, $src}", []>, + Requires<[HasSSE1]>, TB; +def FsMOVAPDrr : I<0x28, MRMSrcReg, (ops V2F8:$dst, V2F8:$src), + "movapd {$src, $dst|$dst, $src}", []>, + Requires<[HasSSE2]>, TB, OpSize; + +// Alias instructions to load FR32 / FR64 from f128mem using movaps / movapd. +// Upper bits are disregarded. +def FsMOVAPSrm : I<0x28, MRMSrcMem, (ops FR32:$dst, f128mem:$src), + "movaps {$src, $dst|$dst, $src}", + [(set FR32:$dst, (X86loadpf32 addr:$src))]>, + Requires<[HasSSE1]>, TB; +def FsMOVAPDrm : I<0x28, MRMSrcMem, (ops FR64:$dst, f128mem:$src), "movapd {$src, $dst|$dst, $src}", [(set FR64:$dst, (X86loadpf64 addr:$src))]>, Requires<[HasSSE2]>, TB, OpSize; Index: llvm/lib/Target/X86/X86RegisterInfo.cpp diff -u llvm/lib/Target/X86/X86RegisterInfo.cpp:1.123 llvm/lib/Target/X86/X86RegisterInfo.cpp:1.124 --- llvm/lib/Target/X86/X86RegisterInfo.cpp:1.123 Thu Feb 16 15:20:26 2006 +++ llvm/lib/Target/X86/X86RegisterInfo.cpp Thu Feb 16 16:45:17 2006 @@ -114,9 +114,9 @@ } else if (RC == &X86::RFPRegClass || RC == &X86::RSTRegClass) { Opc = X86::FpMOV; } else if (RC == &X86::FR32RegClass || RC == &X86::V4F4RegClass) { - Opc = X86::MOVAPSrr; + Opc = X86::FsMOVAPSrr; } else if (RC == &X86::FR64RegClass || RC == &X86::V2F8RegClass) { - Opc = X86::MOVAPDrr; + Opc = X86::FsMOVAPDrr; } else { assert(0 && "Unknown regclass"); abort(); @@ -313,6 +313,9 @@ case X86::CMP8ri: return MakeMIInst(X86::CMP8mi , FrameIndex, MI); case X86::CMP16ri: return MakeMIInst(X86::CMP16mi, FrameIndex, MI); case X86::CMP32ri: return MakeMIInst(X86::CMP32mi, FrameIndex, MI); + // Alias scalar SSE instructions + case X86::FsMOVAPSrr: return MakeMRInst(X86::MOVSSmr, FrameIndex, MI); + case X86::FsMOVAPDrr: return MakeMRInst(X86::MOVSDmr, FrameIndex, MI); // Scalar SSE instructions case X86::MOVSSrr: return MakeMRInst(X86::MOVSSmr, FrameIndex, MI); case X86::MOVSDrr: return MakeMRInst(X86::MOVSDmr, FrameIndex, MI); @@ -393,6 +396,9 @@ case X86::MOVZX16rr8:return MakeRMInst(X86::MOVZX16rm8 , FrameIndex, MI); case X86::MOVZX32rr8:return MakeRMInst(X86::MOVZX32rm8, FrameIndex, MI); case X86::MOVZX32rr16:return MakeRMInst(X86::MOVZX32rm16, FrameIndex, MI); + // Alias scalar SSE instructions + case X86::FsMOVAPSrr:return MakeRMInst(X86::MOVSSrm, FrameIndex, MI); + case X86::FsMOVAPDrr:return MakeRMInst(X86::MOVSDrm, FrameIndex, MI); // Scalar SSE instructions case X86::MOVSSrr: return MakeRMInst(X86::MOVSSrm, FrameIndex, MI); case X86::MOVSDrr: return MakeRMInst(X86::MOVSDrm, FrameIndex, MI); From evan.cheng at apple.com Thu Feb 16 17:11:54 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 16 Feb 2006 17:11:54 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200602162311.RAA14465@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.163 -> 1.164 --- Log message: Dumb bug. Code sees a memcpy from X+c so it increments src offset. But it turns out not to point to a constant string but it forgot change the offset back. --- Diffs of the changes: (+10 -4) SelectionDAGISel.cpp | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.163 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.164 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.163 Thu Feb 16 02:27:55 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Thu Feb 16 17:11:42 2006 @@ -1658,9 +1658,10 @@ if (MeetsMaxMemopRequirement(MemOps, TLI.getMaxStoresPerMemcpy(), Size->getValue(), Align, TLI)) { unsigned NumMemOps = MemOps.size(); - unsigned SrcOff = 0, DstOff = 0; + unsigned SrcOff = 0, DstOff = 0, SrcDelta = 0; GlobalAddressSDNode *G = NULL; std::string Str; + bool CopyFromStr = false; if (Op2.getOpcode() == ISD::GlobalAddress) G = cast(Op2); @@ -1668,12 +1669,17 @@ Op2.getOperand(0).getOpcode() == ISD::GlobalAddress && Op2.getOperand(1).getOpcode() == ISD::Constant) { G = cast(Op2.getOperand(0)); - SrcOff += cast(Op2.getOperand(1))->getValue(); + SrcDelta = cast(Op2.getOperand(1))->getValue(); } if (G) { GlobalVariable *GV = dyn_cast(G->getGlobal()); - if (GV) + if (GV) { Str = getStringValue(GV); + if (!Str.empty()) { + CopyFromStr = true; + SrcOff += SrcDelta; + } + } } for (unsigned i = 0; i < NumMemOps; i++) { @@ -1681,7 +1687,7 @@ unsigned VTSize = getSizeInBits(VT) / 8; SDOperand Value, Chain, Store; - if (!Str.empty()) { + if (CopyFromStr) { Value = getMemsetStringVal(VT, DAG, TLI, Str, SrcOff); Chain = getRoot(); Store = From lattner at cs.uiuc.edu Thu Feb 16 17:15:24 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 16 Feb 2006 17:15:24 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Skeleton/Makefile README.txt Skeleton.h Skeleton.td SkeletonInstrInfo.cpp SkeletonInstrInfo.h SkeletonInstrInfo.td SkeletonJITInfo.cpp SkeletonJITInfo.h SkeletonRegisterInfo.cpp SkeletonRegisterInfo.h SkeletonRegisterInfo.td SkeletonTargetMachine.cpp SkeletonTargetMachine.h Message-ID: <200602162315.RAA14562@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Skeleton: Makefile (r1.4) removed README.txt (r1.2) removed Skeleton.h (r1.2) removed Skeleton.td (r1.4) removed SkeletonInstrInfo.cpp (r1.2) removed SkeletonInstrInfo.h (r1.2) removed SkeletonInstrInfo.td (r1.4) removed SkeletonJITInfo.cpp (r1.3) removed SkeletonJITInfo.h (r1.3) removed SkeletonRegisterInfo.cpp (r1.7) removed SkeletonRegisterInfo.h (r1.8) removed SkeletonRegisterInfo.td (r1.6) removed SkeletonTargetMachine.cpp (r1.6) removed SkeletonTargetMachine.h (r1.5) removed --- Log message: Remove the skeleton target, it doesn't produce useful code and there are other small targets that do that can be learned from. They also have the added advantage of being tested :) --- Diffs of the changes: (+0 -0) 0 files changed From evan.cheng at apple.com Thu Feb 16 17:59:42 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 16 Feb 2006 17:59:42 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86InstrInfo.td Message-ID: <200602162359.RAA29548@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86InstrInfo.td updated: 1.235 -> 1.236 --- Log message: pxor (for FLD0SS) encoding was missing the OpSize prefix. --- Diffs of the changes: (+1 -1) X86InstrInfo.td | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/X86/X86InstrInfo.td diff -u llvm/lib/Target/X86/X86InstrInfo.td:1.235 llvm/lib/Target/X86/X86InstrInfo.td:1.236 --- llvm/lib/Target/X86/X86InstrInfo.td:1.235 Thu Feb 16 16:45:17 2006 +++ llvm/lib/Target/X86/X86InstrInfo.td Thu Feb 16 17:59:30 2006 @@ -2491,7 +2491,7 @@ // FIXME: remove when we can teach regalloc that xor reg, reg is ok. def FLD0SS : I<0xEF, MRMInitReg, (ops FR32:$dst), "pxor $dst, $dst", [(set FR32:$dst, fp32imm0)]>, - Requires<[HasSSE1]>, TB; + Requires<[HasSSE1]>, TB, OpSize; def FLD0SD : I<0xEF, MRMInitReg, (ops FR64:$dst), "pxor $dst, $dst", [(set FR64:$dst, fp64imm0)]>, Requires<[HasSSE2]>, TB, OpSize; From evan.cheng at apple.com Thu Feb 16 18:01:10 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 16 Feb 2006 18:01:10 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/README.txt Message-ID: <200602170001.SAA29603@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: README.txt updated: 1.54 -> 1.55 --- Log message: Remove the entry about using movapd for SSE reg-reg moves. --- Diffs of the changes: (+0 -6) README.txt | 6 ------ 1 files changed, 6 deletions(-) Index: llvm/lib/Target/X86/README.txt diff -u llvm/lib/Target/X86/README.txt:1.54 llvm/lib/Target/X86/README.txt:1.55 --- llvm/lib/Target/X86/README.txt:1.54 Tue Feb 14 19:56:48 2006 +++ llvm/lib/Target/X86/README.txt Thu Feb 16 18:00:58 2006 @@ -356,12 +356,6 @@ //===---------------------------------------------------------------------===// -Evaluate whether using movapd for SSE reg-reg moves is faster than using -movsd/movss for them. It may eliminate false partial register dependences by -writing the whole result register. - -//===---------------------------------------------------------------------===// - SSE should implement 'select_cc' using 'emulated conditional moves' that use pcmp/pand/pandn/por to do a selection instead of a conditional branch: From natebegeman at mac.com Thu Feb 16 18:03:15 2006 From: natebegeman at mac.com (Nate Begeman) Date: Thu, 16 Feb 2006 18:03:15 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86.h X86ISelLowering.cpp X86TargetMachine.cpp X86ISelPattern.cpp Message-ID: <200602170003.SAA29624@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86.h updated: 1.43 -> 1.44 X86ISelLowering.cpp updated: 1.84 -> 1.85 X86TargetMachine.cpp updated: 1.102 -> 1.103 X86ISelPattern.cpp (r1.204) removed --- Log message: Kill the x86 pattern isel. boom. --- Diffs of the changes: (+211 -325) X86.h | 8 X86ISelLowering.cpp | 511 ++++++++++++++++++++------------------------------- X86TargetMachine.cpp | 17 - 3 files changed, 211 insertions(+), 325 deletions(-) Index: llvm/lib/Target/X86/X86.h diff -u llvm/lib/Target/X86/X86.h:1.43 llvm/lib/Target/X86/X86.h:1.44 --- llvm/lib/Target/X86/X86.h:1.43 Fri Feb 3 12:54:24 2006 +++ llvm/lib/Target/X86/X86.h Thu Feb 16 18:03:04 2006 @@ -25,14 +25,6 @@ class IntrinsicLowering; class MachineCodeEmitter; -extern bool X86PatIsel; - -/// createX86ISelPattern - This pass converts an LLVM function into a -/// machine code representation using pattern matching and a machine -/// description file. -/// -FunctionPass *createX86ISelPattern(TargetMachine &TM); - /// createX86ISelDag - This pass converts a legalized DAG into a /// X86-specific DAG, ready for instruction scheduling. /// Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.84 llvm/lib/Target/X86/X86ISelLowering.cpp:1.85 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.84 Thu Feb 16 15:11:51 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Thu Feb 16 18:03:04 2006 @@ -70,13 +70,9 @@ // this operation. setOperationAction(ISD::SINT_TO_FP , MVT::i1 , Promote); setOperationAction(ISD::SINT_TO_FP , MVT::i8 , Promote); + // SSE has no i16 to fp conversion, only i32 if (X86ScalarSSE) - // SSE has no i16 to fp conversion, only i32 setOperationAction(ISD::SINT_TO_FP , MVT::i16 , Promote); - else if (!X86PatIsel) { - setOperationAction(ISD::SINT_TO_FP , MVT::i16 , Custom); - setOperationAction(ISD::SINT_TO_FP , MVT::i32 , Custom); - } // We can handle SINT_TO_FP and FP_TO_SINT from/to i64 even though i64 // isn't legal. @@ -112,9 +108,7 @@ setOperationAction(ISD::BIT_CONVERT , MVT::f32 , Expand); setOperationAction(ISD::BIT_CONVERT , MVT::i32 , Expand); - if (!X86PatIsel) { - setOperationAction(ISD::BRCOND , MVT::Other, Custom); - } + setOperationAction(ISD::BRCOND , MVT::Other, Custom); setOperationAction(ISD::BRCONDTWOWAY , MVT::Other, Expand); setOperationAction(ISD::BRTWOWAY_CC , MVT::Other, Expand); setOperationAction(ISD::BR_CC , MVT::Other, Expand); @@ -136,16 +130,6 @@ setOperationAction(ISD::CTTZ , MVT::i32 , Expand); setOperationAction(ISD::CTLZ , MVT::i32 , Expand); setOperationAction(ISD::READCYCLECOUNTER , MVT::i64 , Custom); - - if (X86PatIsel) { - setOperationAction(ISD::BSWAP , MVT::i32 , Expand); - setOperationAction(ISD::ROTL , MVT::i8 , Expand); - setOperationAction(ISD::ROTR , MVT::i8 , Expand); - setOperationAction(ISD::ROTL , MVT::i16 , Expand); - setOperationAction(ISD::ROTR , MVT::i16 , Expand); - setOperationAction(ISD::ROTL , MVT::i32 , Expand); - setOperationAction(ISD::ROTR , MVT::i32 , Expand); - } setOperationAction(ISD::BSWAP , MVT::i16 , Expand); setOperationAction(ISD::READIO , MVT::i1 , Expand); @@ -160,31 +144,30 @@ // These should be promoted to a larger select which is supported. setOperationAction(ISD::SELECT , MVT::i1 , Promote); setOperationAction(ISD::SELECT , MVT::i8 , Promote); - if (!X86PatIsel) { - // X86 wants to expand cmov itself. - setOperationAction(ISD::SELECT , MVT::i16 , Custom); - setOperationAction(ISD::SELECT , MVT::i32 , Custom); - setOperationAction(ISD::SELECT , MVT::f32 , Custom); - setOperationAction(ISD::SELECT , MVT::f64 , Custom); - setOperationAction(ISD::SETCC , MVT::i8 , Custom); - setOperationAction(ISD::SETCC , MVT::i16 , Custom); - setOperationAction(ISD::SETCC , MVT::i32 , Custom); - setOperationAction(ISD::SETCC , MVT::f32 , Custom); - setOperationAction(ISD::SETCC , MVT::f64 , Custom); - // X86 ret instruction may pop stack. - setOperationAction(ISD::RET , MVT::Other, Custom); - // Darwin ABI issue. - setOperationAction(ISD::GlobalAddress , MVT::i32 , Custom); - // 64-bit addm sub, shl, sra, srl (iff 32-bit x86) - setOperationAction(ISD::ADD_PARTS , MVT::i32 , Custom); - setOperationAction(ISD::SUB_PARTS , MVT::i32 , Custom); - setOperationAction(ISD::SHL_PARTS , MVT::i32 , Custom); - setOperationAction(ISD::SRA_PARTS , MVT::i32 , Custom); - setOperationAction(ISD::SRL_PARTS , MVT::i32 , Custom); - // X86 wants to expand memset / memcpy itself. - setOperationAction(ISD::MEMSET , MVT::Other, Custom); - setOperationAction(ISD::MEMCPY , MVT::Other, Custom); - } + + // X86 wants to expand cmov itself. + setOperationAction(ISD::SELECT , MVT::i16 , Custom); + setOperationAction(ISD::SELECT , MVT::i32 , Custom); + setOperationAction(ISD::SELECT , MVT::f32 , Custom); + setOperationAction(ISD::SELECT , MVT::f64 , Custom); + setOperationAction(ISD::SETCC , MVT::i8 , Custom); + setOperationAction(ISD::SETCC , MVT::i16 , Custom); + setOperationAction(ISD::SETCC , MVT::i32 , Custom); + setOperationAction(ISD::SETCC , MVT::f32 , Custom); + setOperationAction(ISD::SETCC , MVT::f64 , Custom); + // X86 ret instruction may pop stack. + setOperationAction(ISD::RET , MVT::Other, Custom); + // Darwin ABI issue. + setOperationAction(ISD::GlobalAddress , MVT::i32 , Custom); + // 64-bit addm sub, shl, sra, srl (iff 32-bit x86) + setOperationAction(ISD::ADD_PARTS , MVT::i32 , Custom); + setOperationAction(ISD::SUB_PARTS , MVT::i32 , Custom); + setOperationAction(ISD::SHL_PARTS , MVT::i32 , Custom); + setOperationAction(ISD::SRA_PARTS , MVT::i32 , Custom); + setOperationAction(ISD::SRL_PARTS , MVT::i32 , Custom); + // X86 wants to expand memset / memcpy itself. + setOperationAction(ISD::MEMSET , MVT::Other, Custom); + setOperationAction(ISD::MEMCPY , MVT::Other, Custom); // We don't have line number support yet. setOperationAction(ISD::LOCATION, MVT::Other, Expand); @@ -473,134 +456,98 @@ break; } - if (!X86PatIsel) { - std::vector NodeTys; - NodeTys.push_back(MVT::Other); // Returns a chain - NodeTys.push_back(MVT::Flag); // Returns a flag for retval copy to use. - std::vector Ops; - Ops.push_back(Chain); - Ops.push_back(Callee); - - // FIXME: Do not generate X86ISD::TAILCALL for now. - Chain = DAG.getNode(X86ISD::CALL, NodeTys, Ops); - SDOperand InFlag = Chain.getValue(1); - - NodeTys.clear(); - NodeTys.push_back(MVT::Other); // Returns a chain - NodeTys.push_back(MVT::Flag); // Returns a flag for retval copy to use. - Ops.clear(); - Ops.push_back(Chain); - Ops.push_back(DAG.getConstant(NumBytes, getPointerTy())); - Ops.push_back(DAG.getConstant(0, getPointerTy())); - Ops.push_back(InFlag); - Chain = DAG.getNode(ISD::CALLSEQ_END, NodeTys, Ops); - InFlag = Chain.getValue(1); - - SDOperand RetVal; - if (RetTyVT != MVT::isVoid) { - switch (RetTyVT) { - default: assert(0 && "Unknown value type to return!"); - case MVT::i1: - case MVT::i8: - RetVal = DAG.getCopyFromReg(Chain, X86::AL, MVT::i8, InFlag); - Chain = RetVal.getValue(1); - if (RetTyVT == MVT::i1) - RetVal = DAG.getNode(ISD::TRUNCATE, MVT::i1, RetVal); - break; - case MVT::i16: - RetVal = DAG.getCopyFromReg(Chain, X86::AX, MVT::i16, InFlag); - Chain = RetVal.getValue(1); - break; - case MVT::i32: - RetVal = DAG.getCopyFromReg(Chain, X86::EAX, MVT::i32, InFlag); - Chain = RetVal.getValue(1); - break; - case MVT::i64: { - SDOperand Lo = DAG.getCopyFromReg(Chain, X86::EAX, MVT::i32, InFlag); - SDOperand Hi = DAG.getCopyFromReg(Lo.getValue(1), X86::EDX, MVT::i32, - Lo.getValue(2)); - RetVal = DAG.getNode(ISD::BUILD_PAIR, MVT::i64, Lo, Hi); - Chain = Hi.getValue(1); - break; - } - case MVT::f32: - case MVT::f64: { - std::vector Tys; - Tys.push_back(MVT::f64); - Tys.push_back(MVT::Other); - Tys.push_back(MVT::Flag); - std::vector Ops; - Ops.push_back(Chain); - Ops.push_back(InFlag); - RetVal = DAG.getNode(X86ISD::FP_GET_RESULT, Tys, Ops); - Chain = RetVal.getValue(1); - InFlag = RetVal.getValue(2); - if (X86ScalarSSE) { - // FIXME: Currently the FST is flagged to the FP_GET_RESULT. This - // shouldn't be necessary except that RFP cannot be live across - // multiple blocks. When stackifier is fixed, they can be uncoupled. - MachineFunction &MF = DAG.getMachineFunction(); - int SSFI = MF.getFrameInfo()->CreateStackObject(8, 8); - SDOperand StackSlot = DAG.getFrameIndex(SSFI, getPointerTy()); - Tys.clear(); - Tys.push_back(MVT::Other); - Ops.clear(); - Ops.push_back(Chain); - Ops.push_back(RetVal); - Ops.push_back(StackSlot); - Ops.push_back(DAG.getValueType(RetTyVT)); - Ops.push_back(InFlag); - Chain = DAG.getNode(X86ISD::FST, Tys, Ops); - RetVal = DAG.getLoad(RetTyVT, Chain, StackSlot, - DAG.getSrcValue(NULL)); - Chain = RetVal.getValue(1); - } - - if (RetTyVT == MVT::f32 && !X86ScalarSSE) - // FIXME: we would really like to remember that this FP_ROUND - // operation is okay to eliminate if we allow excess FP precision. - RetVal = DAG.getNode(ISD::FP_ROUND, MVT::f32, RetVal); - break; - } - } - } - - return std::make_pair(RetVal, Chain); - } else { - std::vector Ops; - Ops.push_back(Chain); - Ops.push_back(Callee); - Ops.push_back(DAG.getConstant(NumBytes, getPointerTy())); - Ops.push_back(DAG.getConstant(0, getPointerTy())); - - SDOperand TheCall = DAG.getNode(isTailCall ? X86ISD::TAILCALL :X86ISD::CALL, - RetVals, Ops); - - SDOperand ResultVal; + std::vector NodeTys; + NodeTys.push_back(MVT::Other); // Returns a chain + NodeTys.push_back(MVT::Flag); // Returns a flag for retval copy to use. + std::vector Ops; + Ops.push_back(Chain); + Ops.push_back(Callee); + + // FIXME: Do not generate X86ISD::TAILCALL for now. + Chain = DAG.getNode(X86ISD::CALL, NodeTys, Ops); + SDOperand InFlag = Chain.getValue(1); + + NodeTys.clear(); + NodeTys.push_back(MVT::Other); // Returns a chain + NodeTys.push_back(MVT::Flag); // Returns a flag for retval copy to use. + Ops.clear(); + Ops.push_back(Chain); + Ops.push_back(DAG.getConstant(NumBytes, getPointerTy())); + Ops.push_back(DAG.getConstant(0, getPointerTy())); + Ops.push_back(InFlag); + Chain = DAG.getNode(ISD::CALLSEQ_END, NodeTys, Ops); + InFlag = Chain.getValue(1); + + SDOperand RetVal; + if (RetTyVT != MVT::isVoid) { switch (RetTyVT) { - case MVT::isVoid: break; - default: - ResultVal = TheCall.getValue(1); - break; + default: assert(0 && "Unknown value type to return!"); case MVT::i1: case MVT::i8: + RetVal = DAG.getCopyFromReg(Chain, X86::AL, MVT::i8, InFlag); + Chain = RetVal.getValue(1); + if (RetTyVT == MVT::i1) + RetVal = DAG.getNode(ISD::TRUNCATE, MVT::i1, RetVal); + break; case MVT::i16: - ResultVal = DAG.getNode(ISD::TRUNCATE, RetTyVT, TheCall.getValue(1)); + RetVal = DAG.getCopyFromReg(Chain, X86::AX, MVT::i16, InFlag); + Chain = RetVal.getValue(1); break; - case MVT::f32: - // FIXME: we would really like to remember that this FP_ROUND operation is - // okay to eliminate if we allow excess FP precision. - ResultVal = DAG.getNode(ISD::FP_ROUND, MVT::f32, TheCall.getValue(1)); + case MVT::i32: + RetVal = DAG.getCopyFromReg(Chain, X86::EAX, MVT::i32, InFlag); + Chain = RetVal.getValue(1); break; - case MVT::i64: - ResultVal = DAG.getNode(ISD::BUILD_PAIR, MVT::i64, TheCall.getValue(1), - TheCall.getValue(2)); + case MVT::i64: { + SDOperand Lo = DAG.getCopyFromReg(Chain, X86::EAX, MVT::i32, InFlag); + SDOperand Hi = DAG.getCopyFromReg(Lo.getValue(1), X86::EDX, MVT::i32, + Lo.getValue(2)); + RetVal = DAG.getNode(ISD::BUILD_PAIR, MVT::i64, Lo, Hi); + Chain = Hi.getValue(1); break; } + case MVT::f32: + case MVT::f64: { + std::vector Tys; + Tys.push_back(MVT::f64); + Tys.push_back(MVT::Other); + Tys.push_back(MVT::Flag); + std::vector Ops; + Ops.push_back(Chain); + Ops.push_back(InFlag); + RetVal = DAG.getNode(X86ISD::FP_GET_RESULT, Tys, Ops); + Chain = RetVal.getValue(1); + InFlag = RetVal.getValue(2); + if (X86ScalarSSE) { + // FIXME: Currently the FST is flagged to the FP_GET_RESULT. This + // shouldn't be necessary except that RFP cannot be live across + // multiple blocks. When stackifier is fixed, they can be uncoupled. + MachineFunction &MF = DAG.getMachineFunction(); + int SSFI = MF.getFrameInfo()->CreateStackObject(8, 8); + SDOperand StackSlot = DAG.getFrameIndex(SSFI, getPointerTy()); + Tys.clear(); + Tys.push_back(MVT::Other); + Ops.clear(); + Ops.push_back(Chain); + Ops.push_back(RetVal); + Ops.push_back(StackSlot); + Ops.push_back(DAG.getValueType(RetTyVT)); + Ops.push_back(InFlag); + Chain = DAG.getNode(X86ISD::FST, Tys, Ops); + RetVal = DAG.getLoad(RetTyVT, Chain, StackSlot, + DAG.getSrcValue(NULL)); + Chain = RetVal.getValue(1); + } - Chain = DAG.getNode(ISD::CALLSEQ_END, MVT::Other, TheCall); - return std::make_pair(ResultVal, Chain); + if (RetTyVT == MVT::f32 && !X86ScalarSSE) + // FIXME: we would really like to remember that this FP_ROUND + // operation is okay to eliminate if we allow excess FP precision. + RetVal = DAG.getNode(ISD::FP_ROUND, MVT::f32, RetVal); + break; + } + } } + + return std::make_pair(RetVal, Chain); } //===----------------------------------------------------------------------===// @@ -947,163 +894,123 @@ break; } - if (!X86PatIsel) { - // Build a sequence of copy-to-reg nodes chained together with token chain - // and flag operands which copy the outgoing args into registers. - SDOperand InFlag; - for (unsigned i = 0, e = RegValuesToPass.size(); i != e; ++i) { - unsigned CCReg; - SDOperand RegToPass = RegValuesToPass[i]; - switch (RegToPass.getValueType()) { - default: assert(0 && "Bad thing to pass in regs"); - case MVT::i8: - CCReg = (i == 0) ? X86::AL : X86::DL; - break; - case MVT::i16: - CCReg = (i == 0) ? X86::AX : X86::DX; - break; - case MVT::i32: - CCReg = (i == 0) ? X86::EAX : X86::EDX; - break; - } - - Chain = DAG.getCopyToReg(Chain, CCReg, RegToPass, InFlag); - InFlag = Chain.getValue(1); + // Build a sequence of copy-to-reg nodes chained together with token chain + // and flag operands which copy the outgoing args into registers. + SDOperand InFlag; + for (unsigned i = 0, e = RegValuesToPass.size(); i != e; ++i) { + unsigned CCReg; + SDOperand RegToPass = RegValuesToPass[i]; + switch (RegToPass.getValueType()) { + default: assert(0 && "Bad thing to pass in regs"); + case MVT::i8: + CCReg = (i == 0) ? X86::AL : X86::DL; + break; + case MVT::i16: + CCReg = (i == 0) ? X86::AX : X86::DX; + break; + case MVT::i32: + CCReg = (i == 0) ? X86::EAX : X86::EDX; + break; } - std::vector NodeTys; - NodeTys.push_back(MVT::Other); // Returns a chain - NodeTys.push_back(MVT::Flag); // Returns a flag for retval copy to use. - std::vector Ops; - Ops.push_back(Chain); - Ops.push_back(Callee); - if (InFlag.Val) - Ops.push_back(InFlag); - - // FIXME: Do not generate X86ISD::TAILCALL for now. - Chain = DAG.getNode(X86ISD::CALL, NodeTys, Ops); + Chain = DAG.getCopyToReg(Chain, CCReg, RegToPass, InFlag); InFlag = Chain.getValue(1); + } - NodeTys.clear(); - NodeTys.push_back(MVT::Other); // Returns a chain - NodeTys.push_back(MVT::Flag); // Returns a flag for retval copy to use. - Ops.clear(); - Ops.push_back(Chain); - Ops.push_back(DAG.getConstant(ArgOffset, getPointerTy())); - Ops.push_back(DAG.getConstant(ArgOffset, getPointerTy())); + std::vector NodeTys; + NodeTys.push_back(MVT::Other); // Returns a chain + NodeTys.push_back(MVT::Flag); // Returns a flag for retval copy to use. + std::vector Ops; + Ops.push_back(Chain); + Ops.push_back(Callee); + if (InFlag.Val) Ops.push_back(InFlag); - Chain = DAG.getNode(ISD::CALLSEQ_END, NodeTys, Ops); - InFlag = Chain.getValue(1); - - SDOperand RetVal; - if (RetTyVT != MVT::isVoid) { - switch (RetTyVT) { - default: assert(0 && "Unknown value type to return!"); - case MVT::i1: - case MVT::i8: - RetVal = DAG.getCopyFromReg(Chain, X86::AL, MVT::i8, InFlag); - Chain = RetVal.getValue(1); - if (RetTyVT == MVT::i1) - RetVal = DAG.getNode(ISD::TRUNCATE, MVT::i1, RetVal); - break; - case MVT::i16: - RetVal = DAG.getCopyFromReg(Chain, X86::AX, MVT::i16, InFlag); - Chain = RetVal.getValue(1); - break; - case MVT::i32: - RetVal = DAG.getCopyFromReg(Chain, X86::EAX, MVT::i32, InFlag); - Chain = RetVal.getValue(1); - break; - case MVT::i64: { - SDOperand Lo = DAG.getCopyFromReg(Chain, X86::EAX, MVT::i32, InFlag); - SDOperand Hi = DAG.getCopyFromReg(Lo.getValue(1), X86::EDX, MVT::i32, - Lo.getValue(2)); - RetVal = DAG.getNode(ISD::BUILD_PAIR, MVT::i64, Lo, Hi); - Chain = Hi.getValue(1); - break; - } - case MVT::f32: - case MVT::f64: { - std::vector Tys; - Tys.push_back(MVT::f64); - Tys.push_back(MVT::Other); - Tys.push_back(MVT::Flag); - std::vector Ops; - Ops.push_back(Chain); - Ops.push_back(InFlag); - RetVal = DAG.getNode(X86ISD::FP_GET_RESULT, Tys, Ops); - Chain = RetVal.getValue(1); - InFlag = RetVal.getValue(2); - if (X86ScalarSSE) { - // FIXME: Currently the FST is flagged to the FP_GET_RESULT. This - // shouldn't be necessary except that RFP cannot be live across - // multiple blocks. When stackifier is fixed, they can be uncoupled. - MachineFunction &MF = DAG.getMachineFunction(); - int SSFI = MF.getFrameInfo()->CreateStackObject(8, 8); - SDOperand StackSlot = DAG.getFrameIndex(SSFI, getPointerTy()); - Tys.clear(); - Tys.push_back(MVT::Other); - Ops.clear(); - Ops.push_back(Chain); - Ops.push_back(RetVal); - Ops.push_back(StackSlot); - Ops.push_back(DAG.getValueType(RetTyVT)); - Ops.push_back(InFlag); - Chain = DAG.getNode(X86ISD::FST, Tys, Ops); - RetVal = DAG.getLoad(RetTyVT, Chain, StackSlot, - DAG.getSrcValue(NULL)); - Chain = RetVal.getValue(1); - } - - if (RetTyVT == MVT::f32 && !X86ScalarSSE) - // FIXME: we would really like to remember that this FP_ROUND - // operation is okay to eliminate if we allow excess FP precision. - RetVal = DAG.getNode(ISD::FP_ROUND, MVT::f32, RetVal); - break; - } - } - } - return std::make_pair(RetVal, Chain); - } else { - std::vector Ops; - Ops.push_back(Chain); - Ops.push_back(Callee); - Ops.push_back(DAG.getConstant(ArgOffset, getPointerTy())); - // Callee pops all arg values on the stack. - Ops.push_back(DAG.getConstant(ArgOffset, getPointerTy())); - - // Pass register arguments as needed. - Ops.insert(Ops.end(), RegValuesToPass.begin(), RegValuesToPass.end()); - - SDOperand TheCall = DAG.getNode(isTailCall ? X86ISD::TAILCALL :X86ISD::CALL, - RetVals, Ops); - Chain = DAG.getNode(ISD::CALLSEQ_END, MVT::Other, TheCall); - - SDOperand ResultVal; + // FIXME: Do not generate X86ISD::TAILCALL for now. + Chain = DAG.getNode(X86ISD::CALL, NodeTys, Ops); + InFlag = Chain.getValue(1); + + NodeTys.clear(); + NodeTys.push_back(MVT::Other); // Returns a chain + NodeTys.push_back(MVT::Flag); // Returns a flag for retval copy to use. + Ops.clear(); + Ops.push_back(Chain); + Ops.push_back(DAG.getConstant(ArgOffset, getPointerTy())); + Ops.push_back(DAG.getConstant(ArgOffset, getPointerTy())); + Ops.push_back(InFlag); + Chain = DAG.getNode(ISD::CALLSEQ_END, NodeTys, Ops); + InFlag = Chain.getValue(1); + + SDOperand RetVal; + if (RetTyVT != MVT::isVoid) { switch (RetTyVT) { - case MVT::isVoid: break; - default: - ResultVal = TheCall.getValue(1); - break; + default: assert(0 && "Unknown value type to return!"); case MVT::i1: case MVT::i8: + RetVal = DAG.getCopyFromReg(Chain, X86::AL, MVT::i8, InFlag); + Chain = RetVal.getValue(1); + if (RetTyVT == MVT::i1) + RetVal = DAG.getNode(ISD::TRUNCATE, MVT::i1, RetVal); + break; case MVT::i16: - ResultVal = DAG.getNode(ISD::TRUNCATE, RetTyVT, TheCall.getValue(1)); + RetVal = DAG.getCopyFromReg(Chain, X86::AX, MVT::i16, InFlag); + Chain = RetVal.getValue(1); break; - case MVT::f32: - // FIXME: we would really like to remember that this FP_ROUND operation is - // okay to eliminate if we allow excess FP precision. - ResultVal = DAG.getNode(ISD::FP_ROUND, MVT::f32, TheCall.getValue(1)); + case MVT::i32: + RetVal = DAG.getCopyFromReg(Chain, X86::EAX, MVT::i32, InFlag); + Chain = RetVal.getValue(1); break; - case MVT::i64: - ResultVal = DAG.getNode(ISD::BUILD_PAIR, MVT::i64, TheCall.getValue(1), - TheCall.getValue(2)); + case MVT::i64: { + SDOperand Lo = DAG.getCopyFromReg(Chain, X86::EAX, MVT::i32, InFlag); + SDOperand Hi = DAG.getCopyFromReg(Lo.getValue(1), X86::EDX, MVT::i32, + Lo.getValue(2)); + RetVal = DAG.getNode(ISD::BUILD_PAIR, MVT::i64, Lo, Hi); + Chain = Hi.getValue(1); break; } + case MVT::f32: + case MVT::f64: { + std::vector Tys; + Tys.push_back(MVT::f64); + Tys.push_back(MVT::Other); + Tys.push_back(MVT::Flag); + std::vector Ops; + Ops.push_back(Chain); + Ops.push_back(InFlag); + RetVal = DAG.getNode(X86ISD::FP_GET_RESULT, Tys, Ops); + Chain = RetVal.getValue(1); + InFlag = RetVal.getValue(2); + if (X86ScalarSSE) { + // FIXME: Currently the FST is flagged to the FP_GET_RESULT. This + // shouldn't be necessary except that RFP cannot be live across + // multiple blocks. When stackifier is fixed, they can be uncoupled. + MachineFunction &MF = DAG.getMachineFunction(); + int SSFI = MF.getFrameInfo()->CreateStackObject(8, 8); + SDOperand StackSlot = DAG.getFrameIndex(SSFI, getPointerTy()); + Tys.clear(); + Tys.push_back(MVT::Other); + Ops.clear(); + Ops.push_back(Chain); + Ops.push_back(RetVal); + Ops.push_back(StackSlot); + Ops.push_back(DAG.getValueType(RetTyVT)); + Ops.push_back(InFlag); + Chain = DAG.getNode(X86ISD::FST, Tys, Ops); + RetVal = DAG.getLoad(RetTyVT, Chain, StackSlot, + DAG.getSrcValue(NULL)); + Chain = RetVal.getValue(1); + } - return std::make_pair(ResultVal, Chain); + if (RetTyVT == MVT::f32 && !X86ScalarSSE) + // FIXME: we would really like to remember that this FP_ROUND + // operation is okay to eliminate if we allow excess FP precision. + RetVal = DAG.getNode(ISD::FP_ROUND, MVT::f32, RetVal); + break; + } + } } + + return std::make_pair(RetVal, Chain); } SDOperand X86TargetLowering::getReturnAddressFrameIndex(SelectionDAG &DAG) { Index: llvm/lib/Target/X86/X86TargetMachine.cpp diff -u llvm/lib/Target/X86/X86TargetMachine.cpp:1.102 llvm/lib/Target/X86/X86TargetMachine.cpp:1.103 --- llvm/lib/Target/X86/X86TargetMachine.cpp:1.102 Fri Feb 3 12:59:39 2006 +++ llvm/lib/Target/X86/X86TargetMachine.cpp Thu Feb 16 18:03:04 2006 @@ -26,8 +26,6 @@ #include using namespace llvm; -bool llvm::X86PatIsel = true; - /// X86TargetMachineModule - Note that this is used on hosts that cannot link /// in a library unless there are references into the library. In particular, /// it seems that it is not possible to get things to work on Win32 without @@ -39,11 +37,6 @@ cl::opt DisableOutput("disable-x86-llc-output", cl::Hidden, cl::desc("Disable the X86 asm printer, for use " "when profiling the code generator.")); - cl::opt EnableX86PatISel("enable-x86-pattern-isel", cl::Hidden, - cl::desc("Enable the pattern based isel for X86"), - cl::location(X86PatIsel), - cl::init(false)); - // Register the target. RegisterTarget X("x86", " IA-32 (Pentium and above)"); } @@ -107,10 +100,7 @@ PM.add(createUnreachableBlockEliminationPass()); // Install an instruction selector. - if (X86PatIsel) - PM.add(createX86ISelPattern(*this)); - else - PM.add(createX86ISelDag(*this)); + PM.add(createX86ISelDag(*this)); // Print the instruction selected machine code... if (PrintMachineCode) @@ -172,10 +162,7 @@ PM.add(createUnreachableBlockEliminationPass()); // Install an instruction selector. - if (X86PatIsel) - PM.add(createX86ISelPattern(TM)); - else - PM.add(createX86ISelDag(TM)); + PM.add(createX86ISelDag(TM)); // Print the instruction selected machine code... if (PrintMachineCode) From evan.cheng at apple.com Thu Feb 16 18:04:39 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 16 Feb 2006 18:04:39 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/README.txt Message-ID: <200602170004.SAA29638@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: README.txt updated: 1.55 -> 1.56 --- Log message: Remind ourselves to revisit the "pxor vs. xorps/xorpd to clear XMM registers" issue. Need to do more experiments. --- Diffs of the changes: (+6 -0) README.txt | 6 ++++++ 1 files changed, 6 insertions(+) Index: llvm/lib/Target/X86/README.txt diff -u llvm/lib/Target/X86/README.txt:1.55 llvm/lib/Target/X86/README.txt:1.56 --- llvm/lib/Target/X86/README.txt:1.55 Thu Feb 16 18:00:58 2006 +++ llvm/lib/Target/X86/README.txt Thu Feb 16 18:04:28 2006 @@ -437,3 +437,9 @@ movw al, 8(%edx) when we can spare a register. It reduces code size. + +//===---------------------------------------------------------------------===// + +It's not clear whether we should use pxor or xorps / xorpd to clear XMM +registers. The choice may depend on subtarget information. We should do some +more experiments on different x86 machines. From lattner at cs.uiuc.edu Thu Feb 16 18:31:18 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 16 Feb 2006 18:31:18 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Message-ID: <200602170031.SAA29800@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LoopUnswitch.cpp updated: 1.26 -> 1.27 --- Log message: start of some new simplification code, not thoroughly tested, use at your own risk :) --- Diffs of the changes: (+161 -14) LoopUnswitch.cpp | 175 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 161 insertions(+), 14 deletions(-) Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.26 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.27 --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.26 Thu Feb 16 13:36:22 2006 +++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Thu Feb 16 18:31:07 2006 @@ -49,6 +49,8 @@ Statistic<> NumSelects ("loop-unswitch", "Number of selects unswitched"); Statistic<> NumTrivial ("loop-unswitch", "Number of unswitches that are trivial"); + Statistic<> NumSimplify("loop-unswitch", + "Number of simplifications of unswitched code"); cl::opt Threshold("loop-unswitch-threshold", cl::desc("Max loop size to unswitch"), cl::init(10), cl::Hidden); @@ -677,6 +679,42 @@ Out2 = NewLoop; } +/// RemoveFromWorklist - Remove all instances of I from the worklist vector +/// specified. +static void RemoveFromWorklist(Instruction *I, + std::vector &Worklist) { + std::vector::iterator WI = std::find(Worklist.begin(), + Worklist.end(), I); + while (WI != Worklist.end()) { + unsigned Offset = WI-Worklist.begin(); + Worklist.erase(WI); + WI = std::find(Worklist.begin()+Offset, Worklist.end(), I); + } +} + +/// ReplaceUsesOfWith - When we find that I really equals V, remove I from the +/// program, replacing all uses with V and update the worklist. +static void ReplaceUsesOfWith(Instruction *I, Value *V, + std::vector &Worklist) { + DEBUG(std::cerr << "Replace with '" << *V << "': " << *I); + + // Add uses to the worklist, which may be dead now. + for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) + if (Instruction *Use = dyn_cast(I->getOperand(i))) + Worklist.push_back(Use); + + // Add users to the worklist which may be simplified now. + for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); + UI != E; ++UI) + Worklist.push_back(cast(*UI)); + I->replaceAllUsesWith(V); + I->eraseFromParent(); + RemoveFromWorklist(I, Worklist); + ++NumSimplify; +} + + + // RewriteLoopBodyWithConditionConstant - We know either that the value LIC has // the value specified by Val in the specified loop, or we know it does NOT have // that value. Rewrite any uses of LIC or of properties correlated to it. @@ -700,19 +738,32 @@ // FOLD boolean conditions (X|LIC), (X&LIC). Fold conditional branches, // selects, switches. std::vector Users(LIC->use_begin(), LIC->use_end()); + + std::vector Worklist; - // Haha, this loop could be unswitched. Get it? The unswitch pass could - // unswitch itself. Amazing. - for (unsigned i = 0, e = Users.size(); i != e; ++i) - if (Instruction *U = cast(Users[i])) { - if (!L->contains(U->getParent())) - continue; - - if (IsEqual) { - U->replaceUsesOfWith(LIC, Val); - } else if (NotVal) { - U->replaceUsesOfWith(LIC, NotVal); - } else { + // If we know that LIC == Val, or that LIC == NotVal, just replace uses of LIC + // in the loop with the appropriate one directly. + if (IsEqual || NotVal) { + Value *Replacement = NotVal ? NotVal : Val; + + for (unsigned i = 0, e = Users.size(); i != e; ++i) + if (Instruction *U = cast(Users[i])) { + if (!L->contains(U->getParent())) + continue; + U->replaceUsesOfWith(LIC, Replacement); + Worklist.push_back(U); + } + } else { + // Otherwise, we don't know the precise value of LIC, but we do know that it + // is certainly NOT "Val". As such, simplify any uses in the loop that we + // can. This case occurs when we unswitch switch statements. + for (unsigned i = 0, e = Users.size(); i != e; ++i) + if (Instruction *U = cast(Users[i])) { + if (!L->contains(U->getParent())) + continue; + + Worklist.push_back(U); + // If we know that LIC is not Val, use this info to simplify code. if (SwitchInst *SI = dyn_cast(U)) { for (unsigned i = 1, e = SI->getNumCases(); i != e; ++i) { @@ -726,8 +777,104 @@ } } } - - // TODO: We could simplify stuff like X == C. + + // TODO: We could do other simplifications, for example, turning + // LIC == Val -> false. + } + } + + // Okay, now that we have simplified some instructions in the loop, walk over + // it and constant prop, dce, and fold control flow where possible. Note that + // this is effectively a very simple loop-structure-aware optimizer. + while (!Worklist.empty()) { + Instruction *I = Worklist.back(); + Worklist.pop_back(); + + // Simple constant folding. + if (Constant *C = ConstantFoldInstruction(I)) { + ReplaceUsesOfWith(I, C, Worklist); + continue; + } + + // Simple DCE. + if (isInstructionTriviallyDead(I)) { + DEBUG(std::cerr << "Remove dead instruction '" << *I); + + // Add uses to the worklist, which may be dead now. + for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i) + if (Instruction *Use = dyn_cast(I->getOperand(i))) + Worklist.push_back(Use); + I->eraseFromParent(); + RemoveFromWorklist(I, Worklist); + ++NumSimplify; + continue; + } + + // Special case hacks that appear commonly in unswitched code. + switch (I->getOpcode()) { + case Instruction::Select: + if (ConstantBool *CB = dyn_cast(I->getOperand(0))) { + ReplaceUsesOfWith(I, I->getOperand(!CB->getValue()+1), Worklist); + continue; + } + break; + case Instruction::And: + if (isa(I->getOperand(0))) // constant -> RHS + cast(I)->swapOperands(); + if (ConstantBool *CB = dyn_cast(I->getOperand(1))) { + if (CB->getValue()) // X & 1 -> X + ReplaceUsesOfWith(I, I->getOperand(0), Worklist); + else // X & 0 -> 0 + ReplaceUsesOfWith(I, I->getOperand(1), Worklist); + continue; + } + break; + case Instruction::Or: + if (isa(I->getOperand(0))) // constant -> RHS + cast(I)->swapOperands(); + if (ConstantBool *CB = dyn_cast(I->getOperand(1))) { + if (CB->getValue()) // X | 1 -> 1 + ReplaceUsesOfWith(I, I->getOperand(1), Worklist); + else // X | 0 -> X + ReplaceUsesOfWith(I, I->getOperand(0), Worklist); + continue; + } + break; + case Instruction::Br: { + BranchInst *BI = cast(I); + if (BI->isUnconditional()) { + // If BI's parent is the only pred of the successor, fold the two blocks + // together. + BasicBlock *Pred = BI->getParent(); + BasicBlock *Succ = BI->getSuccessor(0); + BasicBlock *SinglePred = Succ->getSinglePredecessor(); + if (!SinglePred) continue; // Nothing to do. + assert(SinglePred == Pred && "CFG broken"); + + DEBUG(std::cerr << "Merging blocks: " << Pred->getName() << " <- " + << Succ->getName() << "\n"); + + // Resolve any single entry PHI nodes in Succ. + while (PHINode *PN = dyn_cast(Succ->begin())) + ReplaceUsesOfWith(PN, PN->getIncomingValue(0), Worklist); + + // Move all of the successor contents from Succ to Pred. + Pred->getInstList().splice(BI, Succ->getInstList(), Succ->begin(), + Succ->end()); + BI->eraseFromParent(); + RemoveFromWorklist(BI, Worklist); + + // If Succ has any successors with PHI nodes, update them to have + // entries coming from Pred instead of Succ. + Succ->replaceAllUsesWith(Pred); + + // Remove Succ from the loop tree. + LI->removeBlock(Succ); + Succ->eraseFromParent(); + break; } + break; } + } + } } From natebegeman at mac.com Thu Feb 16 18:51:18 2006 From: natebegeman at mac.com (Nate Begeman) Date: Thu, 16 Feb 2006 18:51:18 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/TargetSelectionDAG.td Message-ID: <200602170051.SAA29935@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: TargetSelectionDAG.td updated: 1.45 -> 1.46 --- Log message: Add a missing and useful pat frag --- Diffs of the changes: (+9 -2) TargetSelectionDAG.td | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) Index: llvm/lib/Target/TargetSelectionDAG.td diff -u llvm/lib/Target/TargetSelectionDAG.td:1.45 llvm/lib/Target/TargetSelectionDAG.td:1.46 --- llvm/lib/Target/TargetSelectionDAG.td:1.45 Sun Jan 29 00:26:07 2006 +++ llvm/lib/Target/TargetSelectionDAG.td Thu Feb 16 18:51:06 2006 @@ -164,7 +164,6 @@ SDTCisPtrTy<1>, SDTCisVT<2, OtherVT>, SDTCisVT<3, OtherVT> ]>; - //===----------------------------------------------------------------------===// // Selection DAG Node Properties. // @@ -239,6 +238,14 @@ [SDNPCommutative, SDNPAssociative]>; def xor : SDNode<"ISD::XOR" , SDTIntBinOp, [SDNPCommutative, SDNPAssociative]>; +def addc : SDNode<"ISD::ADDC" , SDTIntBinOp, + [SDNPCommutative, SDNPOutFlag]>; +def adde : SDNode<"ISD::ADDE" , SDTIntBinOp, + [SDNPCommutative, SDNPOutFlag, SDNPInFlag]>; +def subc : SDNode<"ISD::SUBC" , SDTIntBinOp, + [SDNPOutFlag]>; +def sube : SDNode<"ISD::SUBE" , SDTIntBinOp, + [SDNPOutFlag, SDNPInFlag]>; def sext_inreg : SDNode<"ISD::SIGN_EXTEND_INREG", SDTExtInreg>; def bswap : SDNode<"ISD::BSWAP" , SDTIntUnaryOp>; @@ -347,7 +354,7 @@ // Leaf fragments. def immAllOnes : PatLeaf<(imm), [{ return N->isAllOnesValue(); }]>; - +def immZero : PatLeaf<(imm), [{ return N->isNullValue(); }]>; def vtInt : PatLeaf<(vt), [{ return MVT::isInteger(N->getVT()); }]>; def vtFP : PatLeaf<(vt), [{ return MVT::isFloatingPoint(N->getVT()); }]>; From natebegeman at mac.com Thu Feb 16 18:56:31 2006 From: natebegeman at mac.com (Nate Begeman) Date: Thu, 16 Feb 2006 18:56:31 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/TargetSelectionDAG.td Message-ID: <200602170056.SAA29959@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: TargetSelectionDAG.td updated: 1.46 -> 1.47 --- Log message: Whoops, didn't mean to check this in yet. --- Diffs of the changes: (+0 -8) TargetSelectionDAG.td | 8 -------- 1 files changed, 8 deletions(-) Index: llvm/lib/Target/TargetSelectionDAG.td diff -u llvm/lib/Target/TargetSelectionDAG.td:1.46 llvm/lib/Target/TargetSelectionDAG.td:1.47 --- llvm/lib/Target/TargetSelectionDAG.td:1.46 Thu Feb 16 18:51:06 2006 +++ llvm/lib/Target/TargetSelectionDAG.td Thu Feb 16 18:56:19 2006 @@ -238,14 +238,6 @@ [SDNPCommutative, SDNPAssociative]>; def xor : SDNode<"ISD::XOR" , SDTIntBinOp, [SDNPCommutative, SDNPAssociative]>; -def addc : SDNode<"ISD::ADDC" , SDTIntBinOp, - [SDNPCommutative, SDNPOutFlag]>; -def adde : SDNode<"ISD::ADDE" , SDTIntBinOp, - [SDNPCommutative, SDNPOutFlag, SDNPInFlag]>; -def subc : SDNode<"ISD::SUBC" , SDTIntBinOp, - [SDNPOutFlag]>; -def sube : SDNode<"ISD::SUBE" , SDTIntBinOp, - [SDNPOutFlag, SDNPInFlag]>; def sext_inreg : SDNode<"ISD::SIGN_EXTEND_INREG", SDTExtInreg>; def bswap : SDNode<"ISD::BSWAP" , SDTIntUnaryOp>; From jeffc at jolt-lang.org Thu Feb 16 20:11:46 2006 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Thu, 16 Feb 2006 20:11:46 -0600 Subject: [llvm-commits] CVS: llvm/win32/x86/x86.vcproj Message-ID: <200602170211.UAA30664@zion.cs.uiuc.edu> Changes in directory llvm/win32/x86: x86.vcproj updated: 1.20 -> 1.21 --- Log message: Inform Visual Studio of deleted file. --- Diffs of the changes: (+0 -3) x86.vcproj | 3 --- 1 files changed, 3 deletions(-) Index: llvm/win32/x86/x86.vcproj diff -u llvm/win32/x86/x86.vcproj:1.20 llvm/win32/x86/x86.vcproj:1.21 --- llvm/win32/x86/x86.vcproj:1.20 Fri Feb 3 21:27:04 2006 +++ llvm/win32/x86/x86.vcproj Thu Feb 16 20:11:34 2006 @@ -176,9 +176,6 @@ RelativePath="..\..\lib\Target\X86\X86ISelLowering.cpp"> - - Changes in directory llvm/lib/Target: TargetLowering.cpp updated: 1.31 -> 1.32 --- Log message: Fix bug noticed by VC++. --- Diffs of the changes: (+2 -2) TargetLowering.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Target/TargetLowering.cpp diff -u llvm/lib/Target/TargetLowering.cpp:1.31 llvm/lib/Target/TargetLowering.cpp:1.32 --- llvm/lib/Target/TargetLowering.cpp:1.31 Thu Feb 16 15:11:51 2006 +++ llvm/lib/Target/TargetLowering.cpp Thu Feb 16 20:12:18 2006 @@ -243,9 +243,9 @@ // If all of the demanded bits are known zero on one side, return the other. // These bits cannot contribute to the result of the 'or'. - if ((DemandedMask & ~KnownOne2 & KnownZero) == DemandedMask & ~KnownOne2) + if ((DemandedMask & ~KnownOne2 & KnownZero) == (DemandedMask & ~KnownOne2)) return TLO.CombineTo(Op, Op.getOperand(0)); - if ((DemandedMask & ~KnownOne & KnownZero2) == DemandedMask & ~KnownOne) + if ((DemandedMask & ~KnownOne & KnownZero2) == (DemandedMask & ~KnownOne)) return TLO.CombineTo(Op, Op.getOperand(1)); // If all of the potentially set bits on one side are known to be set on // the other side, just use the 'other' side. From lattner at cs.uiuc.edu Thu Feb 16 22:20:25 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 16 Feb 2006 22:20:25 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/README.txt Message-ID: <200602170420.WAA31272@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: README.txt updated: 1.56 -> 1.57 --- Log message: add note about div by power of 2 --- Diffs of the changes: (+32 -0) README.txt | 32 ++++++++++++++++++++++++++++++++ 1 files changed, 32 insertions(+) Index: llvm/lib/Target/X86/README.txt diff -u llvm/lib/Target/X86/README.txt:1.56 llvm/lib/Target/X86/README.txt:1.57 --- llvm/lib/Target/X86/README.txt:1.56 Thu Feb 16 18:04:28 2006 +++ llvm/lib/Target/X86/README.txt Thu Feb 16 22:20:13 2006 @@ -443,3 +443,35 @@ It's not clear whether we should use pxor or xorps / xorpd to clear XMM registers. The choice may depend on subtarget information. We should do some more experiments on different x86 machines. + +//===---------------------------------------------------------------------===// + +Evaluate what the best way to codegen sdiv X, (2^C) is. For X/8, we currently +get this: + +int %test1(int %X) { + %Y = div int %X, 8 + ret int %Y +} + +_test1: + movl 4(%esp), %eax + movl %eax, %ecx + sarl $31, %ecx + shrl $29, %ecx + addl %ecx, %eax + sarl $3, %eax + ret + +GCC knows several different ways to codegen it, one of which is this: + +_test1: + movl 4(%esp), %eax + cmpl $-1, %eax + leal 7(%eax), %ecx + cmovle %ecx, %eax + sarl $3, %eax + ret + +which is probably slower, but it's interesting at least :) + From lattner at cs.uiuc.edu Thu Feb 16 22:32:45 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Thu, 16 Feb 2006 22:32:45 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200602170432.WAA31347@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.304 -> 1.305 --- Log message: Fix another miscompilation exposed by lencode, where we lowered i64->f32 conversions to __floatdidf instead of __floatdisf on targets that support f32 but not i64 (e.g. sparc). --- Diffs of the changes: (+1 -1) LegalizeDAG.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.304 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.305 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.304 Wed Feb 15 13:34:44 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Thu Feb 16 22:32:33 2006 @@ -3132,7 +3132,7 @@ Source = DAG.getNode(ISD::SINT_TO_FP, DestTy, Source); SDOperand UnusedHiPart; - return ExpandLibCall("__floatdidf", Source.Val, UnusedHiPart); + return ExpandLibCall(FnName, Source.Val, UnusedHiPart); } /// ExpandLegalINT_TO_FP - This function is responsible for legalizing a From natebegeman at mac.com Thu Feb 16 23:44:11 2006 From: natebegeman at mac.com (Nate Begeman) Date: Thu, 16 Feb 2006 23:44:11 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/TargetSelectionDAG.td Message-ID: <200602170544.XAA31808@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: TargetSelectionDAG.td updated: 1.47 -> 1.48 --- Log message: kill ADD_PARTS & SUB_PARTS and replace them with fancy new ADDC, ADDE, SUBC and SUBE nodes that actually expose what's going on and allow for significant simplifications in the targets. --- Diffs of the changes: (+8 -1) TargetSelectionDAG.td | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletion(-) Index: llvm/lib/Target/TargetSelectionDAG.td diff -u llvm/lib/Target/TargetSelectionDAG.td:1.47 llvm/lib/Target/TargetSelectionDAG.td:1.48 --- llvm/lib/Target/TargetSelectionDAG.td:1.47 Thu Feb 16 18:56:19 2006 +++ llvm/lib/Target/TargetSelectionDAG.td Thu Feb 16 23:43:56 2006 @@ -238,6 +238,14 @@ [SDNPCommutative, SDNPAssociative]>; def xor : SDNode<"ISD::XOR" , SDTIntBinOp, [SDNPCommutative, SDNPAssociative]>; +def addc : SDNode<"ISD::ADDC" , SDTIntBinOp, + [SDNPCommutative, SDNPOutFlag]>; +def adde : SDNode<"ISD::ADDE" , SDTIntBinOp, + [SDNPCommutative, SDNPOutFlag, SDNPInFlag]>; +def subc : SDNode<"ISD::SUBC" , SDTIntBinOp, + [SDNPOutFlag]>; +def sube : SDNode<"ISD::SUBE" , SDTIntBinOp, + [SDNPOutFlag, SDNPInFlag]>; def sext_inreg : SDNode<"ISD::SIGN_EXTEND_INREG", SDTExtInreg>; def bswap : SDNode<"ISD::BSWAP" , SDTIntUnaryOp>; @@ -346,7 +354,6 @@ // Leaf fragments. def immAllOnes : PatLeaf<(imm), [{ return N->isAllOnesValue(); }]>; -def immZero : PatLeaf<(imm), [{ return N->isNullValue(); }]>; def vtInt : PatLeaf<(vt), [{ return MVT::isInteger(N->getVT()); }]>; def vtFP : PatLeaf<(vt), [{ return MVT::isFloatingPoint(N->getVT()); }]>; From natebegeman at mac.com Thu Feb 16 23:44:11 2006 From: natebegeman at mac.com (Nate Begeman) Date: Thu, 16 Feb 2006 23:44:11 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAGNodes.h Message-ID: <200602170544.XAA31818@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: SelectionDAGNodes.h updated: 1.101 -> 1.102 --- Log message: kill ADD_PARTS & SUB_PARTS and replace them with fancy new ADDC, ADDE, SUBC and SUBE nodes that actually expose what's going on and allow for significant simplifications in the targets. --- Diffs of the changes: (+15 -7) SelectionDAGNodes.h | 22 +++++++++++++++------- 1 files changed, 15 insertions(+), 7 deletions(-) Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.101 llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.102 --- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.101 Wed Feb 8 20:10:15 2006 +++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h Thu Feb 16 23:43:56 2006 @@ -118,6 +118,21 @@ // Simple integer binary arithmetic operators. ADD, SUB, MUL, SDIV, UDIV, SREM, UREM, + // Carry-setting nodes for multiple precision addition and subtraction. + // These nodes take two operands of the same value type, and produce two + // results. The first result is the normal add or sub result, the second + // result is the carry flag result. + ADDC, SUBC, + + // Carry-using nodes for multiple precision addition and subtraction. These + // nodes take three operands: The first two are the normal lhs and rhs to + // the add or sub, and the third is the input carry flag. These nodes + // produce two results; the normal result of the add or sub, and the output + // carry flag. These nodes both read and write a carry flag to allow them + // to them to be chained together for add and sub of arbitrarily large + // values. + ADDE, SUBE, + // Simple binary floating point operators. FADD, FSUB, FMUL, FDIV, FREM, @@ -156,13 +171,6 @@ // (op #2) as a CondCodeSDNode. SETCC, - // ADD_PARTS/SUB_PARTS - These operators take two logical operands which are - // broken into a multiple pieces each, and return the resulting pieces of - // doing an atomic add/sub operation. This is used to handle add/sub of - // expanded types. The operation ordering is: - // [Lo,Hi] = op [LoLHS,HiLHS], [LoRHS,HiRHS] - ADD_PARTS, SUB_PARTS, - // SHL_PARTS/SRA_PARTS/SRL_PARTS - These operators are used for expanded // integer shift operations, just like ADD/SUB_PARTS. The operation // ordering is: From natebegeman at mac.com Thu Feb 16 23:44:11 2006 From: natebegeman at mac.com (Nate Begeman) Date: Thu, 16 Feb 2006 23:44:11 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp PPCInstrInfo.td Message-ID: <200602170544.XAA31814@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCISelDAGToDAG.cpp updated: 1.158 -> 1.159 PPCInstrInfo.td updated: 1.176 -> 1.177 --- Log message: kill ADD_PARTS & SUB_PARTS and replace them with fancy new ADDC, ADDE, SUBC and SUBE nodes that actually expose what's going on and allow for significant simplifications in the targets. --- Diffs of the changes: (+14 -83) PPCISelDAGToDAG.cpp | 75 ---------------------------------------------------- PPCInstrInfo.td | 22 +++++++++------ 2 files changed, 14 insertions(+), 83 deletions(-) Index: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp diff -u llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.158 llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.159 --- llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.158 Thu Feb 16 02:27:56 2006 +++ llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Thu Feb 16 23:43:56 2006 @@ -535,75 +535,6 @@ return 0; } - -SDOperand PPCDAGToDAGISel::SelectADD_PARTS(SDOperand Op) { - SDNode *N = Op.Val; - SDOperand LHSL, LHSH; - Select(LHSL, N->getOperand(0)); - Select(LHSH, N->getOperand(1)); - - unsigned Imm; - bool ME = false, ZE = false; - if (isIntImmediate(N->getOperand(3), Imm)) { - ME = (signed)Imm == -1; - ZE = Imm == 0; - } - - std::vector Result; - SDOperand Tmp; - SDNode *CarryFromLo; - if (isIntImmediate(N->getOperand(2), Imm) && - ((signed)Imm >= -32768 || (signed)Imm < 32768)) { - // Codegen the low 32 bits of the add. Interestingly, there is no - // shifted form of add immediate carrying. - CarryFromLo = CurDAG->getTargetNode(PPC::ADDIC, MVT::i32, MVT::Flag, - LHSL, getI32Imm(Imm)); - } else { - Select(Tmp, N->getOperand(2)); - CarryFromLo = CurDAG->getTargetNode(PPC::ADDC, MVT::i32, MVT::Flag, - LHSL, Tmp); - } - - // Codegen the high 32 bits, adding zero, minus one, or the full value - // along with the carry flag produced by addc/addic. - SDOperand ResultHi; - if (ZE) - ResultHi = SDOperand(CurDAG->getTargetNode(PPC::ADDZE, MVT::i32, LHSH, - SDOperand(CarryFromLo, 1)), 0); - else if (ME) - ResultHi = SDOperand(CurDAG->getTargetNode(PPC::ADDME, MVT::i32, LHSH, - SDOperand(CarryFromLo, 1)), 0); - else { - Select(Tmp, N->getOperand(3)); - ResultHi = SDOperand(CurDAG->getTargetNode(PPC::ADDE, MVT::i32, LHSH, - Tmp, SDOperand(CarryFromLo, 1)), 0); - } - Result.push_back(SDOperand(CarryFromLo, 0)); - Result.push_back(ResultHi); - - CodeGenMap[Op.getValue(0)] = Result[0]; - CodeGenMap[Op.getValue(1)] = Result[1]; - return Result[Op.ResNo]; -} -SDOperand PPCDAGToDAGISel::SelectSUB_PARTS(SDOperand Op) { - SDNode *N = Op.Val; - SDOperand LHSL, LHSH, RHSL, RHSH; - Select(LHSL, N->getOperand(0)); - Select(LHSH, N->getOperand(1)); - Select(RHSL, N->getOperand(2)); - Select(RHSH, N->getOperand(3)); - - std::vector Result; - Result.push_back(SDOperand(CurDAG->getTargetNode(PPC::SUBFC, MVT::i32, - MVT::Flag, RHSL, LHSL), 0)); - Result.push_back(SDOperand(CurDAG->getTargetNode(PPC::SUBFE, MVT::i32, - RHSH, LHSH, - Result[0].getValue(1)), 0)); - CodeGenMap[Op.getValue(0)] = Result[0]; - CodeGenMap[Op.getValue(1)] = Result[1]; - return Result[Op.ResNo]; -} - SDOperand PPCDAGToDAGISel::SelectSETCC(SDOperand Op) { SDNode *N = Op.Val; unsigned Imm; @@ -846,12 +777,6 @@ switch (N->getOpcode()) { default: break; - case ISD::ADD_PARTS: - Result = SelectADD_PARTS(Op); - return; - case ISD::SUB_PARTS: - Result = SelectSUB_PARTS(Op); - return; case ISD::SETCC: Result = SelectSETCC(Op); return; Index: llvm/lib/Target/PowerPC/PPCInstrInfo.td diff -u llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.176 llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.177 --- llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.176 Sun Feb 12 03:09:52 2006 +++ llvm/lib/Target/PowerPC/PPCInstrInfo.td Thu Feb 16 23:43:56 2006 @@ -302,7 +302,7 @@ [(set GPRC:$rD, (add GPRC:$rA, immSExt16:$imm))]>; def ADDIC : DForm_2<12, (ops GPRC:$rD, GPRC:$rA, s16imm:$imm), "addic $rD, $rA, $imm", IntGeneral, - []>; + [(set GPRC:$rD, (addc GPRC:$rA, immSExt16:$imm))]>; def ADDICo : DForm_2<13, (ops GPRC:$rD, GPRC:$rA, s16imm:$imm), "addic. $rD, $rA, $imm", IntGeneral, []>; @@ -684,10 +684,10 @@ [(set G8RC:$rT, (add G8RC:$rA, G8RC:$rB))]>; def ADDC : XOForm_1<31, 10, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB), "addc $rT, $rA, $rB", IntGeneral, - []>; + [(set GPRC:$rT, (addc GPRC:$rA, GPRC:$rB))]>; def ADDE : XOForm_1<31, 138, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB), "adde $rT, $rA, $rB", IntGeneral, - []>; + [(set GPRC:$rT, (adde GPRC:$rA, GPRC:$rB))]>; def DIVD : XOForm_1<31, 489, 0, (ops G8RC:$rT, G8RC:$rA, G8RC:$rB), "divd $rT, $rA, $rB", IntDivD, [(set G8RC:$rT, (sdiv G8RC:$rA, G8RC:$rB))]>, isPPC64; @@ -723,22 +723,25 @@ [(set GPRC:$rT, (sub GPRC:$rB, GPRC:$rA))]>; def SUBFC : XOForm_1<31, 8, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB), "subfc $rT, $rA, $rB", IntGeneral, - []>; + [(set GPRC:$rT, (subc GPRC:$rB, GPRC:$rA))]>; def SUBFE : XOForm_1<31, 136, 0, (ops GPRC:$rT, GPRC:$rA, GPRC:$rB), "subfe $rT, $rA, $rB", IntGeneral, - []>; + [(set GPRC:$rT, (sube GPRC:$rB, GPRC:$rA))]>; def ADDME : XOForm_3<31, 234, 0, (ops GPRC:$rT, GPRC:$rA), "addme $rT, $rA", IntGeneral, - []>; + [(set GPRC:$rT, (adde GPRC:$rA, immAllOnes))]>; def ADDZE : XOForm_3<31, 202, 0, (ops GPRC:$rT, GPRC:$rA), "addze $rT, $rA", IntGeneral, - []>; + [(set GPRC:$rT, (adde GPRC:$rA, 0))]>; def NEG : XOForm_3<31, 104, 0, (ops GPRC:$rT, GPRC:$rA), "neg $rT, $rA", IntGeneral, [(set GPRC:$rT, (ineg GPRC:$rA))]>; +def SUBFME : XOForm_3<31, 232, 0, (ops GPRC:$rT, GPRC:$rA), + "subfme $rT, $rA", IntGeneral, + [(set GPRC:$rT, (sube immAllOnes, GPRC:$rA))]>; def SUBFZE : XOForm_3<31, 200, 0, (ops GPRC:$rT, GPRC:$rA), "subfze $rT, $rA", IntGeneral, - []>; + [(set GPRC:$rT, (sube 0, GPRC:$rA))]>; // A-Form instructions. Most of the instructions executed in the FPU are of // this type. @@ -983,6 +986,9 @@ // XOR an arbitrary immediate. def : Pat<(xor GPRC:$in, imm:$imm), (XORIS (XORI GPRC:$in, (LO16 imm:$imm)), (HI16 imm:$imm))>; +// SUBFIC +def : Pat<(subc immSExt16:$imm, GPRC:$in), + (SUBFIC GPRC:$in, imm:$imm)>; // Return void support. def : Pat<(ret), (BLR)>; From natebegeman at mac.com Thu Feb 16 23:44:11 2006 From: natebegeman at mac.com (Nate Begeman) Date: Thu, 16 Feb 2006 23:44:11 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp SparcInstrInfo.td Message-ID: <200602170544.XAA31824@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: SparcISelDAGToDAG.cpp updated: 1.86 -> 1.87 SparcInstrInfo.td updated: 1.121 -> 1.122 --- Log message: kill ADD_PARTS & SUB_PARTS and replace them with fancy new ADDC, ADDE, SUBC and SUBE nodes that actually expose what's going on and allow for significant simplifications in the targets. --- Diffs of the changes: (+18 -41) SparcISelDAGToDAG.cpp | 35 ----------------------------------- SparcInstrInfo.td | 24 ++++++++++++++++++------ 2 files changed, 18 insertions(+), 41 deletions(-) Index: llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp diff -u llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp:1.86 llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp:1.87 --- llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp:1.86 Thu Feb 16 15:11:51 2006 +++ llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp Thu Feb 16 23:43:56 2006 @@ -1075,41 +1075,6 @@ switch (N->getOpcode()) { default: break; - case ISD::ADD_PARTS: { - SDOperand LHSL, LHSH, RHSL, RHSH; - Select(LHSL, N->getOperand(0)); - Select(LHSH, N->getOperand(1)); - Select(RHSL, N->getOperand(2)); - Select(RHSH, N->getOperand(3)); - // FIXME, handle immediate RHS. - SDOperand Low = - SDOperand(CurDAG->getTargetNode(SP::ADDCCrr, MVT::i32, MVT::Flag, - LHSL, RHSL), 0); - SDOperand Hi = - SDOperand(CurDAG->getTargetNode(SP::ADDXrr, MVT::i32, LHSH, RHSH, - Low.getValue(1)), 0); - CodeGenMap[SDOperand(N, 0)] = Low; - CodeGenMap[SDOperand(N, 1)] = Hi; - Result = Op.ResNo ? Hi : Low; - return; - } - case ISD::SUB_PARTS: { - SDOperand LHSL, LHSH, RHSL, RHSH; - Select(LHSL, N->getOperand(0)); - Select(LHSH, N->getOperand(1)); - Select(RHSL, N->getOperand(2)); - Select(RHSH, N->getOperand(3)); - SDOperand Low = - SDOperand(CurDAG->getTargetNode(SP::SUBCCrr, MVT::i32, MVT::Flag, - LHSL, RHSL), 0); - SDOperand Hi = - SDOperand(CurDAG->getTargetNode(SP::SUBXrr, MVT::i32, LHSH, RHSH, - Low.getValue(1)), 0); - CodeGenMap[SDOperand(N, 0)] = Low; - CodeGenMap[SDOperand(N, 1)] = Hi; - Result = Op.ResNo ? Hi : Low; - return; - } case ISD::SDIV: case ISD::UDIV: { // FIXME: should use a custom expander to expose the SRA to the dag. Index: llvm/lib/Target/Sparc/SparcInstrInfo.td diff -u llvm/lib/Target/Sparc/SparcInstrInfo.td:1.121 llvm/lib/Target/Sparc/SparcInstrInfo.td:1.122 --- llvm/lib/Target/Sparc/SparcInstrInfo.td:1.121 Fri Feb 10 01:35:42 2006 +++ llvm/lib/Target/Sparc/SparcInstrInfo.td Thu Feb 16 23:43:56 2006 @@ -453,16 +453,20 @@ def ADDCCrr : F3_1<2, 0b010000, (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c), - "addcc $b, $c, $dst", []>; + "addcc $b, $c, $dst", + [(set IntRegs:$dst, (addc IntRegs:$b, IntRegs:$c))]>; def ADDCCri : F3_2<2, 0b010000, (ops IntRegs:$dst, IntRegs:$b, i32imm:$c), - "addcc $b, $c, $dst", []>; + "addcc $b, $c, $dst", + [(set IntRegs:$dst, (addc IntRegs:$b, simm13:$c))]>; def ADDXrr : F3_1<2, 0b001000, (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c), - "addx $b, $c, $dst", []>; + "addx $b, $c, $dst", + [(set IntRegs:$dst, (adde IntRegs:$b, IntRegs:$c))]>; def ADDXri : F3_2<2, 0b001000, (ops IntRegs:$dst, IntRegs:$b, i32imm:$c), - "addx $b, $c, $dst", []>; + "addx $b, $c, $dst", + [(set IntRegs:$dst, (adde IntRegs:$b, simm13:$c))]>; // Section B.15 - Subtract Instructions, p. 110 def SUBrr : F3_1<2, 0b000100, @@ -475,10 +479,12 @@ [(set IntRegs:$dst, (sub IntRegs:$b, simm13:$c))]>; def SUBXrr : F3_1<2, 0b001100, (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c), - "subx $b, $c, $dst", []>; + "subx $b, $c, $dst", + [(set IntRegs:$dst, (sube IntRegs:$b, IntRegs:$c))]>; def SUBXri : F3_2<2, 0b001100, (ops IntRegs:$dst, IntRegs:$b, i32imm:$c), - "subx $b, $c, $dst", []>; + "subx $b, $c, $dst", + [(set IntRegs:$dst, (sube IntRegs:$b, simm13:$c))]>; def SUBCCrr : F3_1<2, 0b010100, (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c), "subcc $b, $c, $dst", @@ -866,6 +872,12 @@ def : Pat<(i32 imm:$val), (ORri (SETHIi (HI22 imm:$val)), (LO10 imm:$val))>; +// subc +def : Pat<(subc IntRegs:$b, IntRegs:$c), + (SUBCCrr IntRegs:$b, IntRegs:$c)>; +def : Pat<(subc IntRegs:$b, simm13:$val), + (SUBCCri IntRegs:$b, imm:$val)>; + // Global addresses, constant pool entries def : Pat<(SPhi tglobaladdr:$in), (SETHIi tglobaladdr:$in)>; def : Pat<(SPlo tglobaladdr:$in), (ORri G0, tglobaladdr:$in)>; From natebegeman at mac.com Thu Feb 16 23:44:12 2006 From: natebegeman at mac.com (Nate Begeman) Date: Thu, 16 Feb 2006 23:44:12 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp LegalizeDAG.cpp SelectionDAG.cpp Message-ID: <200602170544.XAA31840@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.103 -> 1.104 LegalizeDAG.cpp updated: 1.305 -> 1.306 SelectionDAG.cpp updated: 1.256 -> 1.257 --- Log message: kill ADD_PARTS & SUB_PARTS and replace them with fancy new ADDC, ADDE, SUBC and SUBE nodes that actually expose what's going on and allow for significant simplifications in the targets. --- Diffs of the changes: (+47 -62) DAGCombiner.cpp | 46 -------------------------------------------- LegalizeDAG.cpp | 57 +++++++++++++++++++++++++++++++++++++++++-------------- SelectionDAG.cpp | 6 +++-- 3 files changed, 47 insertions(+), 62 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.103 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.104 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.103 Thu Feb 16 15:11:51 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu Feb 16 23:43:56 2006 @@ -157,14 +157,11 @@ SDOperand visitSELECT(SDNode *N); SDOperand visitSELECT_CC(SDNode *N); SDOperand visitSETCC(SDNode *N); - SDOperand visitADD_PARTS(SDNode *N); - SDOperand visitSUB_PARTS(SDNode *N); SDOperand visitSIGN_EXTEND(SDNode *N); SDOperand visitZERO_EXTEND(SDNode *N); SDOperand visitSIGN_EXTEND_INREG(SDNode *N); SDOperand visitTRUNCATE(SDNode *N); SDOperand visitBIT_CONVERT(SDNode *N); - SDOperand visitFADD(SDNode *N); SDOperand visitFSUB(SDNode *N); SDOperand visitFMUL(SDNode *N); @@ -183,7 +180,6 @@ SDOperand visitBRCONDTWOWAY(SDNode *N); SDOperand visitBR_CC(SDNode *N); SDOperand visitBRTWOWAY_CC(SDNode *N); - SDOperand visitLOAD(SDNode *N); SDOperand visitSTORE(SDNode *N); @@ -550,8 +546,6 @@ case ISD::SELECT: return visitSELECT(N); case ISD::SELECT_CC: return visitSELECT_CC(N); case ISD::SETCC: return visitSETCC(N); - case ISD::ADD_PARTS: return visitADD_PARTS(N); - case ISD::SUB_PARTS: return visitSUB_PARTS(N); case ISD::SIGN_EXTEND: return visitSIGN_EXTEND(N); case ISD::ZERO_EXTEND: return visitZERO_EXTEND(N); case ISD::SIGN_EXTEND_INREG: return visitSIGN_EXTEND_INREG(N); @@ -1509,46 +1503,6 @@ cast(N->getOperand(2))->get()); } -SDOperand DAGCombiner::visitADD_PARTS(SDNode *N) { - SDOperand LHSLo = N->getOperand(0); - SDOperand RHSLo = N->getOperand(2); - MVT::ValueType VT = LHSLo.getValueType(); - - // fold (a_Hi, 0) + (b_Hi, b_Lo) -> (b_Hi + a_Hi, b_Lo) - if (TLI.MaskedValueIsZero(LHSLo, (1ULL << MVT::getSizeInBits(VT))-1)) { - SDOperand Hi = DAG.getNode(ISD::ADD, VT, N->getOperand(1), - N->getOperand(3)); - WorkList.push_back(Hi.Val); - CombineTo(N, RHSLo, Hi); - return SDOperand(); - } - // fold (a_Hi, a_Lo) + (b_Hi, 0) -> (a_Hi + b_Hi, a_Lo) - if (TLI.MaskedValueIsZero(RHSLo, (1ULL << MVT::getSizeInBits(VT))-1)) { - SDOperand Hi = DAG.getNode(ISD::ADD, VT, N->getOperand(1), - N->getOperand(3)); - WorkList.push_back(Hi.Val); - CombineTo(N, LHSLo, Hi); - return SDOperand(); - } - return SDOperand(); -} - -SDOperand DAGCombiner::visitSUB_PARTS(SDNode *N) { - SDOperand LHSLo = N->getOperand(0); - SDOperand RHSLo = N->getOperand(2); - MVT::ValueType VT = LHSLo.getValueType(); - - // fold (a_Hi, a_Lo) - (b_Hi, 0) -> (a_Hi - b_Hi, a_Lo) - if (TLI.MaskedValueIsZero(RHSLo, (1ULL << MVT::getSizeInBits(VT))-1)) { - SDOperand Hi = DAG.getNode(ISD::SUB, VT, N->getOperand(1), - N->getOperand(3)); - WorkList.push_back(Hi.Val); - CombineTo(N, LHSLo, Hi); - return SDOperand(); - } - return SDOperand(); -} - SDOperand DAGCombiner::visitSIGN_EXTEND(SDNode *N) { SDOperand N0 = N->getOperand(0); ConstantSDNode *N0C = dyn_cast(N0); Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.305 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.306 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.305 Thu Feb 16 22:32:33 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Thu Feb 16 23:43:56 2006 @@ -575,7 +575,7 @@ Result = DAG.UpdateNodeOperands(Result, Tmp1, Tmp2); break; } - break; + break; case ISD::Constant: // We know we don't need to expand constants here, constants only have one @@ -1749,8 +1749,6 @@ } break; - case ISD::ADD_PARTS: - case ISD::SUB_PARTS: case ISD::SHL_PARTS: case ISD::SRA_PARTS: case ISD::SRL_PARTS: { @@ -1830,7 +1828,32 @@ break; } break; + + case ISD::ADDC: + case ISD::SUBC: + Tmp1 = LegalizeOp(Node->getOperand(0)); + Tmp2 = LegalizeOp(Node->getOperand(1)); + Result = DAG.UpdateNodeOperands(Result, Tmp1, Tmp2); + // Since this produces two values, make sure to remember that we legalized + // both of them. + AddLegalizedOperand(SDOperand(Node, 0), Result.getValue(0)); + AddLegalizedOperand(SDOperand(Node, 1), Result.getValue(1)); + return Result; + break; + case ISD::ADDE: + case ISD::SUBE: + Tmp1 = LegalizeOp(Node->getOperand(0)); + Tmp2 = LegalizeOp(Node->getOperand(1)); + Tmp3 = LegalizeOp(Node->getOperand(2)); + Result = DAG.UpdateNodeOperands(Result, Tmp1, Tmp2, Tmp3); + // Since this produces two values, make sure to remember that we legalized + // both of them. + AddLegalizedOperand(SDOperand(Node, 0), Result.getValue(0)); + AddLegalizedOperand(SDOperand(Node, 1), Result.getValue(1)); + return Result; + break; + case ISD::BUILD_PAIR: { MVT::ValueType PairTy = Node->getValueType(0); // TODO: handle the case where the Lo and Hi operands are not of legal type @@ -3980,17 +4003,23 @@ SDOperand LHSL, LHSH, RHSL, RHSH; ExpandOp(Node->getOperand(0), LHSL, LHSH); ExpandOp(Node->getOperand(1), RHSL, RHSH); - - std::vector Ops; - Ops.push_back(LHSL); - Ops.push_back(LHSH); - Ops.push_back(RHSL); - Ops.push_back(RHSH); - std::vector VTs(2, LHSL.getValueType()); - unsigned Opc = - Node->getOpcode() == ISD::ADD ? ISD::ADD_PARTS : ISD::SUB_PARTS; - Lo = DAG.getNode(Opc, VTs, Ops); - Hi = Lo.getValue(1); + std::vector VTs; + std::vector LoOps, HiOps; + VTs.push_back(LHSL.getValueType()); + VTs.push_back(MVT::Flag); + LoOps.push_back(LHSL); + LoOps.push_back(RHSL); + HiOps.push_back(LHSH); + HiOps.push_back(RHSH); + if (Node->getOpcode() == ISD::ADD) { + Lo = DAG.getNode(ISD::ADDC, VTs, LoOps); + HiOps.push_back(Lo.getValue(1)); + Hi = DAG.getNode(ISD::ADDE, VTs, HiOps); + } else { + Lo = DAG.getNode(ISD::SUBC, VTs, LoOps); + HiOps.push_back(Lo.getValue(1)); + Hi = DAG.getNode(ISD::SUBE, VTs, HiOps); + } break; } case ISD::MUL: { Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.256 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.257 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.256 Thu Feb 9 16:11:03 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Feb 16 23:43:56 2006 @@ -2552,8 +2552,10 @@ case ISD::SETCC: return "setcc"; case ISD::SELECT: return "select"; case ISD::SELECT_CC: return "select_cc"; - case ISD::ADD_PARTS: return "add_parts"; - case ISD::SUB_PARTS: return "sub_parts"; + case ISD::ADDC: return "addc"; + case ISD::ADDE: return "adde"; + case ISD::SUBC: return "subc"; + case ISD::SUBE: return "sube"; case ISD::SHL_PARTS: return "shl_parts"; case ISD::SRA_PARTS: return "sra_parts"; case ISD::SRL_PARTS: return "srl_parts"; From natebegeman at mac.com Thu Feb 16 23:44:12 2006 From: natebegeman at mac.com (Nate Begeman) Date: Thu, 16 Feb 2006 23:44:12 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp X86ISelLowering.h X86InstrInfo.td Message-ID: <200602170544.XAA31832@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.85 -> 1.86 X86ISelLowering.h updated: 1.26 -> 1.27 X86InstrInfo.td updated: 1.236 -> 1.237 --- Log message: kill ADD_PARTS & SUB_PARTS and replace them with fancy new ADDC, ADDE, SUBC and SUBE nodes that actually expose what's going on and allow for significant simplifications in the targets. --- Diffs of the changes: (+28 -77) X86ISelLowering.cpp | 30 ------------------------ X86ISelLowering.h | 10 -------- X86InstrInfo.td | 65 ++++++++++++++++++++++------------------------------ 3 files changed, 28 insertions(+), 77 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.85 llvm/lib/Target/X86/X86ISelLowering.cpp:1.86 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.85 Thu Feb 16 18:03:04 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Thu Feb 16 23:43:56 2006 @@ -160,8 +160,6 @@ // Darwin ABI issue. setOperationAction(ISD::GlobalAddress , MVT::i32 , Custom); // 64-bit addm sub, shl, sra, srl (iff 32-bit x86) - setOperationAction(ISD::ADD_PARTS , MVT::i32 , Custom); - setOperationAction(ISD::SUB_PARTS , MVT::i32 , Custom); setOperationAction(ISD::SHL_PARTS , MVT::i32 , Custom); setOperationAction(ISD::SRA_PARTS , MVT::i32 , Custom); setOperationAction(ISD::SRL_PARTS , MVT::i32 , Custom); @@ -1270,30 +1268,6 @@ SDOperand X86TargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) { switch (Op.getOpcode()) { default: assert(0 && "Should not custom lower this!"); - case ISD::ADD_PARTS: - case ISD::SUB_PARTS: { - assert(Op.getNumOperands() == 4 && Op.getValueType() == MVT::i32 && - "Not an i64 add/sub!"); - bool isAdd = Op.getOpcode() == ISD::ADD_PARTS; - std::vector Tys; - Tys.push_back(MVT::i32); - Tys.push_back(MVT::Flag); - std::vector Ops; - Ops.push_back(Op.getOperand(0)); - Ops.push_back(Op.getOperand(2)); - SDOperand Lo = DAG.getNode(isAdd ? X86ISD::ADD_FLAG : X86ISD::SUB_FLAG, - Tys, Ops); - SDOperand Hi = DAG.getNode(isAdd ? X86ISD::ADC : X86ISD::SBB, MVT::i32, - Op.getOperand(1), Op.getOperand(3), - Lo.getValue(1)); - Tys.clear(); - Tys.push_back(MVT::i32); - Tys.push_back(MVT::i32); - Ops.clear(); - Ops.push_back(Lo); - Ops.push_back(Hi); - return DAG.getNode(ISD::MERGE_VALUES, Tys, Ops); - } case ISD::SHL_PARTS: case ISD::SRA_PARTS: case ISD::SRL_PARTS: { @@ -1910,10 +1884,6 @@ const char *X86TargetLowering::getTargetNodeName(unsigned Opcode) const { switch (Opcode) { default: return NULL; - case X86ISD::ADD_FLAG: return "X86ISD::ADD_FLAG"; - case X86ISD::SUB_FLAG: return "X86ISD::SUB_FLAG"; - case X86ISD::ADC: return "X86ISD::ADC"; - case X86ISD::SBB: return "X86ISD::SBB"; case X86ISD::SHLD: return "X86ISD::SHLD"; case X86ISD::SHRD: return "X86ISD::SHRD"; case X86ISD::FAND: return "X86ISD::FAND"; Index: llvm/lib/Target/X86/X86ISelLowering.h diff -u llvm/lib/Target/X86/X86ISelLowering.h:1.26 llvm/lib/Target/X86/X86ISelLowering.h:1.27 --- llvm/lib/Target/X86/X86ISelLowering.h:1.26 Thu Feb 16 15:11:51 2006 +++ llvm/lib/Target/X86/X86ISelLowering.h Thu Feb 16 23:43:56 2006 @@ -26,16 +26,6 @@ // Start the numbering where the builtin ops leave off. FIRST_NUMBER = ISD::BUILTIN_OP_END+X86::INSTRUCTION_LIST_END, - /// ADD_FLAG, SUB_FLAG - Same as ISD::ADD and ISD::SUB except it also - /// produces a flag result. - ADD_FLAG, - SUB_FLAG, - - /// ADC, SBB - Add with carry and subtraction with borrow. These - /// correspond to X86::ADCxx and X86::SBBxx instructions. - ADC, - SBB, - /// SHLD, SHRD - Double shift instructions. These correspond to /// X86::SHLDxx and X86::SHRDxx instructions. SHLD, Index: llvm/lib/Target/X86/X86InstrInfo.td diff -u llvm/lib/Target/X86/X86InstrInfo.td:1.236 llvm/lib/Target/X86/X86InstrInfo.td:1.237 --- llvm/lib/Target/X86/X86InstrInfo.td:1.236 Thu Feb 16 17:59:30 2006 +++ llvm/lib/Target/X86/X86InstrInfo.td Thu Feb 16 23:43:56 2006 @@ -56,15 +56,6 @@ def SDTX86RdTsc : SDTypeProfile<0, 0, []>; -def X86addflag : SDNode<"X86ISD::ADD_FLAG", SDTIntBinOp , - [SDNPCommutative, SDNPAssociative, SDNPOutFlag]>; -def X86subflag : SDNode<"X86ISD::SUB_FLAG", SDTIntBinOp, - [SDNPOutFlag]>; -def X86adc : SDNode<"X86ISD::ADC" , SDTIntBinOp , - [SDNPCommutative, SDNPAssociative, SDNPInFlag]>; -def X86sbb : SDNode<"X86ISD::SBB" , SDTIntBinOp, - [SDNPInFlag]>; - def X86shld : SDNode<"X86ISD::SHLD", SDTIntShiftDOp>; def X86shrd : SDNode<"X86ISD::SHRD", SDTIntShiftDOp>; @@ -1873,28 +1864,28 @@ let isCommutable = 1 in { // X = ADC Y, Z --> X = ADC Z, Y def ADC32rr : I<0x11, MRMDestReg, (ops R32:$dst, R32:$src1, R32:$src2), "adc{l} {$src2, $dst|$dst, $src2}", - [(set R32:$dst, (X86adc R32:$src1, R32:$src2))]>; + [(set R32:$dst, (adde R32:$src1, R32:$src2))]>; } def ADC32rm : I<0x13, MRMSrcMem , (ops R32:$dst, R32:$src1, i32mem:$src2), "adc{l} {$src2, $dst|$dst, $src2}", - [(set R32:$dst, (X86adc R32:$src1, (load addr:$src2)))]>; + [(set R32:$dst, (adde R32:$src1, (load addr:$src2)))]>; def ADC32ri : Ii32<0x81, MRM2r, (ops R32:$dst, R32:$src1, i32imm:$src2), "adc{l} {$src2, $dst|$dst, $src2}", - [(set R32:$dst, (X86adc R32:$src1, imm:$src2))]>; + [(set R32:$dst, (adde R32:$src1, imm:$src2))]>; def ADC32ri8 : Ii8<0x83, MRM2r, (ops R32:$dst, R32:$src1, i32i8imm:$src2), "adc{l} {$src2, $dst|$dst, $src2}", - [(set R32:$dst, (X86adc R32:$src1, i32immSExt8:$src2))]>; + [(set R32:$dst, (adde R32:$src1, i32immSExt8:$src2))]>; let isTwoAddress = 0 in { def ADC32mr : I<0x11, MRMDestMem, (ops i32mem:$dst, R32:$src2), "adc{l} {$src2, $dst|$dst, $src2}", - [(store (X86adc (load addr:$dst), R32:$src2), addr:$dst)]>; + [(store (adde (load addr:$dst), R32:$src2), addr:$dst)]>; def ADC32mi : Ii32<0x81, MRM2m, (ops i32mem:$dst, i32imm:$src2), "adc{l} {$src2, $dst|$dst, $src2}", - [(store (X86adc (loadi32 addr:$dst), imm:$src2), addr:$dst)]>; + [(store (adde (loadi32 addr:$dst), imm:$src2), addr:$dst)]>; def ADC32mi8 : Ii8<0x83, MRM2m, (ops i32mem:$dst, i32i8imm :$src2), "adc{l} {$src2, $dst|$dst, $src2}", - [(store (X86adc (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>; + [(store (adde (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>; } def SUB8rr : I<0x28, MRMDestReg, (ops R8 :$dst, R8 :$src1, R8 :$src2), @@ -1964,51 +1955,51 @@ def SBB32rr : I<0x19, MRMDestReg, (ops R32:$dst, R32:$src1, R32:$src2), "sbb{l} {$src2, $dst|$dst, $src2}", - [(set R32:$dst, (X86sbb R32:$src1, R32:$src2))]>; + [(set R32:$dst, (sube R32:$src1, R32:$src2))]>; let isTwoAddress = 0 in { def SBB32mr : I<0x19, MRMDestMem, (ops i32mem:$dst, R32:$src2), "sbb{l} {$src2, $dst|$dst, $src2}", - [(store (X86sbb (load addr:$dst), R32:$src2), addr:$dst)]>; + [(store (sube (load addr:$dst), R32:$src2), addr:$dst)]>; def SBB8mi : Ii32<0x80, MRM3m, (ops i8mem:$dst, i8imm:$src2), "sbb{b} {$src2, $dst|$dst, $src2}", - [(store (X86sbb (loadi8 addr:$dst), imm:$src2), addr:$dst)]>; + [(store (sube (loadi8 addr:$dst), imm:$src2), addr:$dst)]>; def SBB16mi : Ii32<0x81, MRM3m, (ops i16mem:$dst, i16imm:$src2), "sbb{w} {$src2, $dst|$dst, $src2}", - [(store (X86sbb (loadi16 addr:$dst), imm:$src2), addr:$dst)]>, + [(store (sube (loadi16 addr:$dst), imm:$src2), addr:$dst)]>, OpSize; def SBB32mi : Ii32<0x81, MRM3m, (ops i32mem:$dst, i32imm:$src2), "sbb{l} {$src2, $dst|$dst, $src2}", - [(store (X86sbb (loadi32 addr:$dst), imm:$src2), addr:$dst)]>; + [(store (sube (loadi32 addr:$dst), imm:$src2), addr:$dst)]>; def SBB16mi8 : Ii8<0x83, MRM3m, (ops i16mem:$dst, i16i8imm :$src2), "sbb{w} {$src2, $dst|$dst, $src2}", - [(store (X86sbb (load addr:$dst), i16immSExt8:$src2), addr:$dst)]>, + [(store (sube (load addr:$dst), i16immSExt8:$src2), addr:$dst)]>, OpSize; def SBB32mi8 : Ii8<0x83, MRM3m, (ops i32mem:$dst, i32i8imm :$src2), "sbb{l} {$src2, $dst|$dst, $src2}", - [(store (X86sbb (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>; + [(store (sube (load addr:$dst), i32immSExt8:$src2), addr:$dst)]>; } def SBB8ri : Ii8<0x80, MRM3r, (ops R8:$dst, R8:$src1, i8imm:$src2), "sbb{b} {$src2, $dst|$dst, $src2}", - [(set R8:$dst, (X86sbb R8:$src1, imm:$src2))]>; + [(set R8:$dst, (sube R8:$src1, imm:$src2))]>; def SBB16ri : Ii16<0x81, MRM3r, (ops R16:$dst, R16:$src1, i16imm:$src2), "sbb{w} {$src2, $dst|$dst, $src2}", - [(set R16:$dst, (X86sbb R16:$src1, imm:$src2))]>, OpSize; + [(set R16:$dst, (sube R16:$src1, imm:$src2))]>, OpSize; def SBB32rm : I<0x1B, MRMSrcMem, (ops R32:$dst, R32:$src1, i32mem:$src2), "sbb{l} {$src2, $dst|$dst, $src2}", - [(set R32:$dst, (X86sbb R32:$src1, (load addr:$src2)))]>; + [(set R32:$dst, (sube R32:$src1, (load addr:$src2)))]>; def SBB32ri : Ii32<0x81, MRM3r, (ops R32:$dst, R32:$src1, i32imm:$src2), "sbb{l} {$src2, $dst|$dst, $src2}", - [(set R32:$dst, (X86sbb R32:$src1, imm:$src2))]>; + [(set R32:$dst, (sube R32:$src1, imm:$src2))]>; def SBB16ri8 : Ii8<0x83, MRM3r, (ops R16:$dst, R16:$src1, i16i8imm:$src2), "sbb{w} {$src2, $dst|$dst, $src2}", - [(set R16:$dst, (X86sbb R16:$src1, i16immSExt8:$src2))]>, + [(set R16:$dst, (sube R16:$src1, i16immSExt8:$src2))]>, OpSize; def SBB32ri8 : Ii8<0x83, MRM3r, (ops R32:$dst, R32:$src1, i32i8imm:$src2), "sbb{l} {$src2, $dst|$dst, $src2}", - [(set R32:$dst, (X86sbb R32:$src1, i32immSExt8:$src2))]>; + [(set R32:$dst, (sube R32:$src1, i32immSExt8:$src2))]>; let isCommutable = 1 in { // X = IMUL Y, Z --> X = IMUL Z, Y def IMUL16rr : I<0xAF, MRMSrcReg, (ops R16:$dst, R16:$src1, R16:$src2), @@ -3077,22 +3068,22 @@ (CALLpcrel32 texternalsym:$dst)>; // X86 specific add which produces a flag. -def : Pat<(X86addflag R32:$src1, R32:$src2), +def : Pat<(addc R32:$src1, R32:$src2), (ADD32rr R32:$src1, R32:$src2)>; -def : Pat<(X86addflag R32:$src1, (load addr:$src2)), +def : Pat<(addc R32:$src1, (load addr:$src2)), (ADD32rm R32:$src1, addr:$src2)>; -def : Pat<(X86addflag R32:$src1, imm:$src2), +def : Pat<(addc R32:$src1, imm:$src2), (ADD32ri R32:$src1, imm:$src2)>; -def : Pat<(X86addflag R32:$src1, i32immSExt8:$src2), +def : Pat<(addc R32:$src1, i32immSExt8:$src2), (ADD32ri8 R32:$src1, i32immSExt8:$src2)>; -def : Pat<(X86subflag R32:$src1, R32:$src2), +def : Pat<(subc R32:$src1, R32:$src2), (SUB32rr R32:$src1, R32:$src2)>; -def : Pat<(X86subflag R32:$src1, (load addr:$src2)), +def : Pat<(subc R32:$src1, (load addr:$src2)), (SUB32rm R32:$src1, addr:$src2)>; -def : Pat<(X86subflag R32:$src1, imm:$src2), +def : Pat<(subc R32:$src1, imm:$src2), (SUB32ri R32:$src1, imm:$src2)>; -def : Pat<(X86subflag R32:$src1, i32immSExt8:$src2), +def : Pat<(subc R32:$src1, i32immSExt8:$src2), (SUB32ri8 R32:$src1, i32immSExt8:$src2)>; def : Pat<(truncstore (i8 imm:$src), addr:$dst, i1), From natebegeman at mac.com Fri Feb 17 00:17:08 2006 From: natebegeman at mac.com (Nate Begeman) Date: Fri, 17 Feb 2006 00:17:08 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/PowerPC/addc.ll subc.ll Message-ID: <200602170617.AAA31984@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/PowerPC: addc.ll added (r1.1) subc.ll added (r1.1) --- Log message: A couple new regression tests to make sure we always pattern match the new opcodes on ppc. --- Diffs of the changes: (+51 -0) addc.ll | 26 ++++++++++++++++++++++++++ subc.ll | 25 +++++++++++++++++++++++++ 2 files changed, 51 insertions(+) Index: llvm/test/Regression/CodeGen/PowerPC/addc.ll diff -c /dev/null llvm/test/Regression/CodeGen/PowerPC/addc.ll:1.1 *** /dev/null Fri Feb 17 00:17:06 2006 --- llvm/test/Regression/CodeGen/PowerPC/addc.ll Fri Feb 17 00:16:56 2006 *************** *** 0 **** --- 1,26 ---- + ; All of these ands and shifts should be folded into rlwimi's + ; RUN: llvm-as < %s | llc -march=ppc32 | grep addc | wc -l | grep 1 && + ; RUN: llvm-as < %s | llc -march=ppc32 | grep adde | wc -l | grep 1 && + ; RUN: llvm-as < %s | llc -march=ppc32 | grep addze | wc -l | grep 1 && + ; RUN: llvm-as < %s | llc -march=ppc32 | grep addme | wc -l | grep 1 && + ; RUN: llvm-as < %s | llc -march=ppc32 | grep addic | wc -l | grep 2 + + implementation ; Functions: + + long %add_ll(long %a, long %b) { + entry: + %tmp.2 = add long %b, %a ; [#uses=1] + ret long %tmp.2 + } + + long %add_l_5(long %a) { + entry: + %tmp.1 = add long %a, 5 ; [#uses=1] + ret long %tmp.1 + } + + long %add_l_m5(long %a) { + entry: + %tmp.1 = add long %a, -5 ; [#uses=1] + ret long %tmp.1 + } Index: llvm/test/Regression/CodeGen/PowerPC/subc.ll diff -c /dev/null llvm/test/Regression/CodeGen/PowerPC/subc.ll:1.1 *** /dev/null Fri Feb 17 00:17:08 2006 --- llvm/test/Regression/CodeGen/PowerPC/subc.ll Fri Feb 17 00:16:56 2006 *************** *** 0 **** --- 1,25 ---- + ; All of these ands and shifts should be folded into rlwimi's + ; RUN: llvm-as < %s | llc -march=ppc32 | grep subfc | wc -l | grep 1 && + ; RUN: llvm-as < %s | llc -march=ppc32 | grep subfe | wc -l | grep 1 && + ; RUN: llvm-as < %s | llc -march=ppc32 | grep subfze | wc -l | grep 1 && + ; RUN: llvm-as < %s | llc -march=ppc32 | grep subfme | wc -l | grep 1 && + ; RUN: llvm-as < %s | llc -march=ppc32 | grep subfic | wc -l | grep 2 + implementation ; Functions: + + long %sub_ll(long %a, long %b) { + entry: + %tmp.2 = sub long %a, %b ; [#uses=1] + ret long %tmp.2 + } + + long %sub_l_5(long %a) { + entry: + %tmp.1 = sub long 5, %a ; [#uses=1] + ret long %tmp.1 + } + + long %sub_l_m5(long %a) { + entry: + %tmp.1 = sub long -5, %a ; [#uses=1] + ret long %tmp.1 + } From natebegeman at mac.com Fri Feb 17 00:24:43 2006 From: natebegeman at mac.com (Nate Begeman) Date: Fri, 17 Feb 2006 00:24:43 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/PowerPC/addc.ll subc.ll Message-ID: <200602170624.AAA32005@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/PowerPC: addc.ll updated: 1.1 -> 1.2 subc.ll updated: 1.1 -> 1.2 --- Log message: Fix a comment sabre noticed :) --- Diffs of the changes: (+2 -2) addc.ll | 2 +- subc.ll | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/test/Regression/CodeGen/PowerPC/addc.ll diff -u llvm/test/Regression/CodeGen/PowerPC/addc.ll:1.1 llvm/test/Regression/CodeGen/PowerPC/addc.ll:1.2 --- llvm/test/Regression/CodeGen/PowerPC/addc.ll:1.1 Fri Feb 17 00:16:56 2006 +++ llvm/test/Regression/CodeGen/PowerPC/addc.ll Fri Feb 17 00:24:31 2006 @@ -1,4 +1,4 @@ -; All of these ands and shifts should be folded into rlwimi's +; All of these should be codegen'd without loading immediates ; RUN: llvm-as < %s | llc -march=ppc32 | grep addc | wc -l | grep 1 && ; RUN: llvm-as < %s | llc -march=ppc32 | grep adde | wc -l | grep 1 && ; RUN: llvm-as < %s | llc -march=ppc32 | grep addze | wc -l | grep 1 && Index: llvm/test/Regression/CodeGen/PowerPC/subc.ll diff -u llvm/test/Regression/CodeGen/PowerPC/subc.ll:1.1 llvm/test/Regression/CodeGen/PowerPC/subc.ll:1.2 --- llvm/test/Regression/CodeGen/PowerPC/subc.ll:1.1 Fri Feb 17 00:16:56 2006 +++ llvm/test/Regression/CodeGen/PowerPC/subc.ll Fri Feb 17 00:24:31 2006 @@ -1,4 +1,4 @@ -; All of these ands and shifts should be folded into rlwimi's +; All of these should be codegen'd without loading immediates ; RUN: llvm-as < %s | llc -march=ppc32 | grep subfc | wc -l | grep 1 && ; RUN: llvm-as < %s | llc -march=ppc32 | grep subfe | wc -l | grep 1 && ; RUN: llvm-as < %s | llc -march=ppc32 | grep subfze | wc -l | grep 1 && From lattner at cs.uiuc.edu Fri Feb 17 00:40:08 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 17 Feb 2006 00:40:08 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Message-ID: <200602170640.AAA32102@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LoopUnswitch.cpp updated: 1.27 -> 1.28 --- Log message: Fix loops where the header has an exit, fixing a loop-unswitch crash on crafty --- Diffs of the changes: (+15 -13) LoopUnswitch.cpp | 28 +++++++++++++++------------- 1 files changed, 15 insertions(+), 13 deletions(-) Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.27 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.28 --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.27 Thu Feb 16 18:31:07 2006 +++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Fri Feb 17 00:39:56 2006 @@ -136,20 +136,22 @@ static bool isTrivialLoopExitBlockHelper(Loop *L, BasicBlock *BB, BasicBlock *&ExitBB, std::set &Visited) { - BasicBlock *Header = L->getHeader(); + if (!Visited.insert(BB).second) { + // Already visited and Ok, end of recursion. + return true; + } else if (!L->contains(BB)) { + // Otherwise, this is a loop exit, this is fine so long as this is the + // first exit. + if (ExitBB != 0) return false; + ExitBB = BB; + return true; + } + + // Otherwise, this is an unvisited intra-loop node. Check all successors. for (succ_iterator SI = succ_begin(BB), E = succ_end(BB); SI != E; ++SI) { - if (!Visited.insert(*SI).second) { - // Already visited and Ok, end of recursion. - } else if (L->contains(*SI)) { - // Check to see if the successor is a trivial loop exit. - if (!isTrivialLoopExitBlockHelper(L, *SI, ExitBB, Visited)) - return false; - } else { - // Otherwise, this is a loop exit, this is fine so long as this is the - // first exit. - if (ExitBB != 0) return false; - ExitBB = *SI; - } + // Check to see if the successor is a trivial loop exit. + if (!isTrivialLoopExitBlockHelper(L, *SI, ExitBB, Visited)) + return false; } // Okay, everything after this looks good, check to make sure that this block From evan.cheng at apple.com Fri Feb 17 01:02:03 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 17 Feb 2006 01:02:03 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200602170702.BAA32228@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.86 -> 1.87 --- Log message: Unbreak x86 be --- Diffs of the changes: (+22 -17) X86ISelLowering.cpp | 39 ++++++++++++++++++++++----------------- 1 files changed, 22 insertions(+), 17 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.86 llvm/lib/Target/X86/X86ISelLowering.cpp:1.87 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.86 Thu Feb 16 23:43:56 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Fri Feb 17 01:01:52 2006 @@ -73,6 +73,10 @@ // SSE has no i16 to fp conversion, only i32 if (X86ScalarSSE) setOperationAction(ISD::SINT_TO_FP , MVT::i16 , Promote); + else { + setOperationAction(ISD::SINT_TO_FP , MVT::i16 , Custom); + setOperationAction(ISD::SINT_TO_FP , MVT::i32 , Custom); + } // We can handle SINT_TO_FP and FP_TO_SINT from/to i64 even though i64 // isn't legal. @@ -108,7 +112,7 @@ setOperationAction(ISD::BIT_CONVERT , MVT::f32 , Expand); setOperationAction(ISD::BIT_CONVERT , MVT::i32 , Expand); - setOperationAction(ISD::BRCOND , MVT::Other, Custom); + setOperationAction(ISD::BRCOND , MVT::Other, Custom); setOperationAction(ISD::BRCONDTWOWAY , MVT::Other, Expand); setOperationAction(ISD::BRTWOWAY_CC , MVT::Other, Expand); setOperationAction(ISD::BR_CC , MVT::Other, Expand); @@ -146,26 +150,27 @@ setOperationAction(ISD::SELECT , MVT::i8 , Promote); // X86 wants to expand cmov itself. - setOperationAction(ISD::SELECT , MVT::i16 , Custom); - setOperationAction(ISD::SELECT , MVT::i32 , Custom); - setOperationAction(ISD::SELECT , MVT::f32 , Custom); - setOperationAction(ISD::SELECT , MVT::f64 , Custom); - setOperationAction(ISD::SETCC , MVT::i8 , Custom); - setOperationAction(ISD::SETCC , MVT::i16 , Custom); - setOperationAction(ISD::SETCC , MVT::i32 , Custom); - setOperationAction(ISD::SETCC , MVT::f32 , Custom); - setOperationAction(ISD::SETCC , MVT::f64 , Custom); + setOperationAction(ISD::SELECT , MVT::i16 , Custom); + setOperationAction(ISD::SELECT , MVT::i32 , Custom); + setOperationAction(ISD::SELECT , MVT::f32 , Custom); + setOperationAction(ISD::SELECT , MVT::f64 , Custom); + setOperationAction(ISD::SETCC , MVT::i8 , Custom); + setOperationAction(ISD::SETCC , MVT::i16 , Custom); + setOperationAction(ISD::SETCC , MVT::i32 , Custom); + setOperationAction(ISD::SETCC , MVT::f32 , Custom); + setOperationAction(ISD::SETCC , MVT::f64 , Custom); // X86 ret instruction may pop stack. - setOperationAction(ISD::RET , MVT::Other, Custom); + setOperationAction(ISD::RET , MVT::Other, Custom); // Darwin ABI issue. - setOperationAction(ISD::GlobalAddress , MVT::i32 , Custom); + setOperationAction(ISD::GlobalAddress , MVT::i32 , Custom); // 64-bit addm sub, shl, sra, srl (iff 32-bit x86) - setOperationAction(ISD::SHL_PARTS , MVT::i32 , Custom); - setOperationAction(ISD::SRA_PARTS , MVT::i32 , Custom); - setOperationAction(ISD::SRL_PARTS , MVT::i32 , Custom); + setOperationAction(ISD::SUB_PARTS , MVT::i32 , Custom); + setOperationAction(ISD::SHL_PARTS , MVT::i32 , Custom); + setOperationAction(ISD::SRA_PARTS , MVT::i32 , Custom); + setOperationAction(ISD::SRL_PARTS , MVT::i32 , Custom); // X86 wants to expand memset / memcpy itself. - setOperationAction(ISD::MEMSET , MVT::Other, Custom); - setOperationAction(ISD::MEMCPY , MVT::Other, Custom); + setOperationAction(ISD::MEMSET , MVT::Other, Custom); + setOperationAction(ISD::MEMCPY , MVT::Other, Custom); // We don't have line number support yet. setOperationAction(ISD::LOCATION, MVT::Other, Expand); From lattner at cs.uiuc.edu Fri Feb 17 01:09:38 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 17 Feb 2006 01:09:38 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200602170709.BAA32348@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.87 -> 1.88 --- Log message: unbreak the build --- Diffs of the changes: (+0 -1) X86ISelLowering.cpp | 1 - 1 files changed, 1 deletion(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.87 llvm/lib/Target/X86/X86ISelLowering.cpp:1.88 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.87 Fri Feb 17 01:01:52 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Fri Feb 17 01:09:27 2006 @@ -164,7 +164,6 @@ // Darwin ABI issue. setOperationAction(ISD::GlobalAddress , MVT::i32 , Custom); // 64-bit addm sub, shl, sra, srl (iff 32-bit x86) - setOperationAction(ISD::SUB_PARTS , MVT::i32 , Custom); setOperationAction(ISD::SHL_PARTS , MVT::i32 , Custom); setOperationAction(ISD::SRA_PARTS , MVT::i32 , Custom); setOperationAction(ISD::SRL_PARTS , MVT::i32 , Custom); From natebegeman at mac.com Fri Feb 17 01:26:32 2006 From: natebegeman at mac.com (Nate Begeman) Date: Fri, 17 Feb 2006 01:26:32 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200602170726.BAA32400@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.104 -> 1.105 --- Log message: Don't expand sdiv by power of two before legalize, since it will likely generate illegal nodes. --- Diffs of the changes: (+2 -2) DAGCombiner.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.104 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.105 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.104 Thu Feb 16 23:43:56 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Fri Feb 17 01:26:20 2006 @@ -731,8 +731,8 @@ if (TLI.MaskedValueIsZero(N1, SignBit) && TLI.MaskedValueIsZero(N0, SignBit)) return DAG.getNode(ISD::UDIV, N1.getValueType(), N0, N1); - // fold (sdiv X, pow2) -> simple ops. - if (N1C && N1C->getValue() && !TLI.isIntDivCheap() && + // fold (sdiv X, pow2) -> simple ops after legalize + if (N1C && N1C->getValue() && !TLI.isIntDivCheap() && AfterLegalize && (isPowerOf2_64(N1C->getSignExtended()) || isPowerOf2_64(-N1C->getSignExtended()))) { // If dividing by powers of two is cheap, then don't perform the following From bocchino at persephone.cs.uiuc.edu Fri Feb 17 11:58:16 2006 From: bocchino at persephone.cs.uiuc.edu (Robert L. Bocchino Jr.) Date: Fri, 17 Feb 2006 11:58:16 -0600 (CST) Subject: [llvm-commits] CVS: llvm-www/developers.txt Message-ID: <20060217175816.8A9F71F22693@persephone.cs.uiuc.edu> Changes in directory llvm-www: developers.txt updated: 1.5 -> 1.6 --- Log message: Added a link to my web page on the Developers list. --- Diffs of the changes: (+1 -1) developers.txt | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-www/developers.txt diff -u llvm-www/developers.txt:1.5 llvm-www/developers.txt:1.6 --- llvm-www/developers.txt:1.5 Sat Dec 17 00:49:45 2005 +++ llvm-www/developers.txt Fri Feb 17 11:57:35 2006 @@ -1,7 +1,7 @@ Vikram Adve href=http://www-sal.cs.uiuc.edu/~vadve/ img=PhotoVikram.jpg width=120 height=120 alt=vadve Henrik Bach href=mailto:henrik_bach_llvm at hotmail.com img=PhotoHenrik.jpg width=156 height=178 alt=Henrik Nate Begeman href=http://sampo.lasthome.net/ img=PhotoNate.jpg width=160 height=130 alt=Sampo -Rob Bocchino img=PhotoRob.jpg width=140 height=187 alt=Rob +Rob Bocchino href=http://llvm.cs.uiuc.edu/~bocchino img=PhotoRob.jpg width=140 height=187 alt=Rob Misha Brukman href=http://misha.brukman.net/code/llvm/ img=PhotoMisha.png width=175 height=198 alt=Misha Evan Cheng href=mailto:evan.cheng at apple.com img=PhotoEvan.jpg width=152 height=198 alt=Grawp Jeff Cohen href=http://jolt-lang.org/ img=PhotoJeffCohen.jpg width=165 height=134 alt=jeffc From natebegeman at mac.com Fri Feb 17 12:06:31 2006 From: natebegeman at mac.com (Nate Begeman) Date: Fri, 17 Feb 2006 12:06:31 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetLowering.h Message-ID: <200602171806.MAA14277@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetLowering.h updated: 1.50 -> 1.51 --- Log message: Fix a nit sabre noticed --- Diffs of the changes: (+1 -1) TargetLowering.h | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/Target/TargetLowering.h diff -u llvm/include/llvm/Target/TargetLowering.h:1.50 llvm/include/llvm/Target/TargetLowering.h:1.51 --- llvm/include/llvm/Target/TargetLowering.h:1.50 Thu Feb 16 15:11:51 2006 +++ llvm/include/llvm/Target/TargetLowering.h Fri Feb 17 12:06:19 2006 @@ -293,7 +293,7 @@ SDOperand Old; SDOperand New; - TargetLoweringOpt::TargetLoweringOpt(SelectionDAG &InDAG) : DAG(InDAG) {} + TargetLoweringOpt(SelectionDAG &InDAG) : DAG(InDAG) {} bool CombineTo(SDOperand O, SDOperand N) { Old = O; From natebegeman at mac.com Fri Feb 17 13:54:19 2006 From: natebegeman at mac.com (Nate Begeman) Date: Fri, 17 Feb 2006 13:54:19 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200602171954.NAA15468@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.105 -> 1.106 --- Log message: Clean up DemandedBitsAreZero interface Make more use of the new mask helpers in valuetypes.h Combine (sra (srl x, c1), c1) -> sext_inreg if legal --- Diffs of the changes: (+26 -22) DAGCombiner.cpp | 48 ++++++++++++++++++++++++++---------------------- 1 files changed, 26 insertions(+), 22 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.105 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.106 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.105 Fri Feb 17 01:26:20 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Fri Feb 17 13:54:08 2006 @@ -99,13 +99,12 @@ return SDOperand(N, 0); } - bool DemandedBitsAreZero(SDOperand Op, uint64_t DemandedMask, - SDOperand &Old, SDOperand &New) const { + bool DemandedBitsAreZero(SDOperand Op, uint64_t DemandedMask) { TargetLowering::TargetLoweringOpt TLO(DAG); uint64_t KnownZero, KnownOne; if (TLI.SimplifyDemandedBits(Op, DemandedMask, KnownZero, KnownOne, TLO)){ - Old = TLO.Old; - New = TLO.New; + WorkList.push_back(Op.Val); + CombineTo(TLO.Old.Val, TLO.New); return true; } return false; @@ -732,7 +731,7 @@ TLI.MaskedValueIsZero(N0, SignBit)) return DAG.getNode(ISD::UDIV, N1.getValueType(), N0, N1); // fold (sdiv X, pow2) -> simple ops after legalize - if (N1C && N1C->getValue() && !TLI.isIntDivCheap() && AfterLegalize && + if (N1C && N1C->getValue() && !TLI.isIntDivCheap() && (isPowerOf2_64(N1C->getSignExtended()) || isPowerOf2_64(-N1C->getSignExtended()))) { // If dividing by powers of two is cheap, then don't perform the following @@ -887,7 +886,7 @@ SDOperand DAGCombiner::visitAND(SDNode *N) { SDOperand N0 = N->getOperand(0); SDOperand N1 = N->getOperand(1); - SDOperand LL, LR, RL, RR, CC0, CC1, Old, New; + SDOperand LL, LR, RL, RR, CC0, CC1; ConstantSDNode *N0C = dyn_cast(N0); ConstantSDNode *N1C = dyn_cast(N1); MVT::ValueType VT = N1.getValueType(); @@ -986,12 +985,8 @@ } // fold (and (sign_extend_inreg x, i16 to i32), 1) -> (and x, 1) // fold (and (sra)) -> (and (srl)) when possible. - if (DemandedBitsAreZero(SDOperand(N, 0), MVT::getIntVTBitMask(VT), Old, - New)) { - WorkList.push_back(N); - CombineTo(Old.Val, New); + if (DemandedBitsAreZero(SDOperand(N, 0), MVT::getIntVTBitMask(VT))) return SDOperand(); - } // fold (zext_inreg (extload x)) -> (zextload x) if (N0.getOpcode() == ISD::EXTLOAD) { MVT::ValueType EVT = cast(N0.getOperand(3))->getVT(); @@ -1252,8 +1247,6 @@ SDOperand DAGCombiner::visitSHL(SDNode *N) { SDOperand N0 = N->getOperand(0); SDOperand N1 = N->getOperand(1); - SDOperand Old = SDOperand(); - SDOperand New = SDOperand(); ConstantSDNode *N0C = dyn_cast(N0); ConstantSDNode *N1C = dyn_cast(N1); MVT::ValueType VT = N0.getValueType(); @@ -1272,14 +1265,10 @@ if (N1C && N1C->isNullValue()) return N0; // if (shl x, c) is known to be zero, return 0 - if (N1C && TLI.MaskedValueIsZero(SDOperand(N, 0), ~0ULL >> (64-OpSizeInBits))) + if (TLI.MaskedValueIsZero(SDOperand(N, 0), MVT::getIntVTBitMask(VT))) return DAG.getConstant(0, VT); - if (N1C && DemandedBitsAreZero(SDOperand(N,0), ~0ULL >> (64-OpSizeInBits), - Old, New)) { - WorkList.push_back(N); - CombineTo(Old.Val, New); + if (DemandedBitsAreZero(SDOperand(N,0), MVT::getIntVTBitMask(VT))) return SDOperand(); - } // fold (shl (shl x, c1), c2) -> 0 or (shl x, c1+c2) if (N1C && N0.getOpcode() == ISD::SHL && N0.getOperand(1).getOpcode() == ISD::Constant) { @@ -1318,7 +1307,6 @@ ConstantSDNode *N0C = dyn_cast(N0); ConstantSDNode *N1C = dyn_cast(N1); MVT::ValueType VT = N0.getValueType(); - unsigned OpSizeInBits = MVT::getSizeInBits(VT); // fold (sra c1, c2) -> c1>>c2 if (N0C && N1C) @@ -1330,13 +1318,29 @@ if (N0C && N0C->isAllOnesValue()) return N0; // fold (sra x, c >= size(x)) -> undef - if (N1C && N1C->getValue() >= OpSizeInBits) + if (N1C && N1C->getValue() >= MVT::getSizeInBits(VT)) return DAG.getNode(ISD::UNDEF, VT); // fold (sra x, 0) -> x if (N1C && N1C->isNullValue()) return N0; + // fold (sra (shl x, c1), c1) -> sext_inreg for some c1 and target supports + // sext_inreg. + if (N1C && N0.getOpcode() == ISD::SHL && N1 == N0.getOperand(1)) { + unsigned LowBits = MVT::getSizeInBits(VT) - (unsigned)N1C->getValue(); + MVT::ValueType EVT; + switch (LowBits) { + default: EVT = MVT::Other; break; + case 1: EVT = MVT::i1; break; + case 8: EVT = MVT::i8; break; + case 16: EVT = MVT::i16; break; + case 32: EVT = MVT::i32; break; + } + if (EVT > MVT::Other && TLI.isOperationLegal(ISD::SIGN_EXTEND_INREG, EVT)) + return DAG.getNode(ISD::SIGN_EXTEND_INREG, VT, N0.getOperand(0), + DAG.getValueType(EVT)); + } // If the sign bit is known to be zero, switch this to a SRL. - if (TLI.MaskedValueIsZero(N0, (1ULL << (OpSizeInBits-1)))) + if (TLI.MaskedValueIsZero(N0, MVT::getIntVTSignBit(VT))) return DAG.getNode(ISD::SRL, VT, N0, N1); return SDOperand(); } From bocchino at persephone.cs.uiuc.edu Fri Feb 17 15:18:40 2006 From: bocchino at persephone.cs.uiuc.edu (Robert L. Bocchino Jr.) Date: Fri, 17 Feb 2006 15:18:40 -0600 (CST) Subject: [llvm-commits] CVS: llvm/docs/LangRef.html Message-ID: <20060217211840.E7CF91F22A4D@persephone.cs.uiuc.edu> Changes in directory llvm/docs: LangRef.html updated: 1.134 -> 1.135 --- Log message: Added documentation for vset and vselect. --- Diffs of the changes: (+159 -5) LangRef.html | 164 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 159 insertions(+), 5 deletions(-) Index: llvm/docs/LangRef.html diff -u llvm/docs/LangRef.html:1.134 llvm/docs/LangRef.html:1.135 --- llvm/docs/LangRef.html:1.134 Wed Jan 25 17:47:57 2006 +++ llvm/docs/LangRef.html Fri Feb 17 15:18:08 2006 @@ -29,7 +29,7 @@
  • Type System
      -
    1. Primitive Types +
    2. Primitive Types
      1. Type Classifications
      @@ -96,9 +96,9 @@
    3. 'malloc' Instruction
    4. 'free' Instruction
    5. 'alloca' Instruction
    6. -
    7. 'load' Instruction
    8. -
    9. 'store' Instruction
    10. -
    11. 'getelementptr' Instruction
    12. +
    13. 'load' Instruction
    14. +
    15. 'store' Instruction
    16. +
    17. 'getelementptr' Instruction
  • Other Operations @@ -106,6 +106,8 @@
  • 'phi' Instruction
  • 'cast .. to' Instruction
  • 'select' Instruction
  • +
  • 'vset' Instruction
  • +
  • 'vselect' Instruction
  • 'extractelement' Instruction
  • 'insertelement' Instruction
  • 'call' Instruction
  • @@ -1619,6 +1621,7 @@
    Example:
      <result> = rem int 4, %var          ; yields {int}:result = 4 % %var
     
    + + @@ -2333,6 +2337,156 @@ + + +
    +
    Syntax:
    +
    <result> = vset <op>, <n x <ty>> <var1>, <var2>   ; yields <n x bool>
    +
    + +
    Overview:
    + +

    The 'vset' instruction returns a vector of boolean +values representing, at each position, the result of the comparison +between the values at that position in the two operands.

    + +
    Arguments:
    + +

    The arguments to a 'vset' instruction are a comparison +operation and two value arguments. The value arguments must be of packed type, and they must have identical types. +For value arguments of integral element type, the operation argument +must be one of eq, ne, lt, gt, +le, ge, ult, ugt, ule, +uge, true, and false. For value arguments +of floating point element type, the operation argument must be one of +eq, ne, lt, gt, le, +ge, oeq, one, olt, ogt, +ole, oge, ueq, une, ult, +ugt, ule, uge, o, u, +true, and false. The result is a packed +bool value with the same length as each operand.

    + +
    Semantics:
    + +

    The following table shows the semantics of 'vset' for +integral value arguments. For each position of the result, the +comparison is done on the corresponding positions of the two value +arguments. Note that the signedness of the comparison depends on the +comparison opcode and not on the signedness of the value +operands. E.g., vset lt <4 x unsigned> %x, %y does an +elementwise signed comparison of %x and +%y.

    + + + + + + + + + + + + + + + + + +
    OperationResult is true iffComparison is
    eqvar1 == var2--
    nevar1 != var2--
    ltvar1 < var2signed
    gtvar1 > var2signed
    levar1 <= var2signed
    gevar1 >= var2signed
    ultvar1 < var2unsigned
    ugtvar1 > var2unsigned
    ulevar1 <= var2unsigned
    ugevar1 >= var2unsigned
    truealways--
    falsenever--
    + +

    The following table shows the semantics of 'vset' for +floating point types. If either operand is a floating point Not a +Number (NaN) value, the operation is unordered, and the value in the +first column below is produced at that position. Otherwise, the +operation is ordered, and the value in the second column is +produced.

    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    OperationIf unorderedOtherwise true iff
    equndefinedvar1 == var2
    neundefinedvar1 != var2
    ltundefinedvar1 < var2
    gtundefinedvar1 > var2
    leundefinedvar1 <= var2
    geundefinedvar1 >= var2
    oeqfalsevar1 == var2
    onefalsevar1 != var2
    oltfalsevar1 < var2
    ogtfalsevar1 > var2
    olefalsevar1 <= var2
    ogefalsevar1 >= var2
    ueqtruevar1 == var2
    unetruevar1 != var2
    ulttruevar1 < var2
    ugttruevar1 > var2
    uletruevar1 <= var2
    ugetruevar1 >= var2
    ofalsealways
    utruenever
    truetruealways
    falsefalsenever
    + +
    Example:
    +
      <result> = vset eq <2 x int> <int 0, int 1>, <int 1, int 0>      ; yields {<2 x bool>}:result = false, false
    +  <result> = vset ne <2 x int> <int 0, int 1>, <int 1, int 0>      ; yields {<2 x bool>}:result = true, true
    +  <result> = vset lt <2 x int> <int 0, int 1>, <int 1, int 0>      ; yields {<2 x bool>}:result = true, false
    +  <result> = vset gt <2 x int> <int 0, int 1>, <int 1, int 0>      ; yields {<2 x bool>}:result = false, true
    +  <result> = vset le <2 x int> <int 0, int 1>, <int 1, int 0>      ; yields {<2 x bool>}:result = true, false
    +  <result> = vset ge <2 x int> <int 0, int 1>, <int 1, int 0>      ; yields {<2 x bool>}:result = false, true
    +
    +
    + + + + +
    + +
    Syntax:
    + +
    +  <result> = vselect <n x bool> <cond>, <n x <ty>> <val1>, <n x <ty>> <val2> ; yields <n x <ty>>
    +
    + +
    Overview:
    + +

    +The 'vselect' instruction chooses one value at each position +of a vector based on a condition. +

    + + +
    Arguments:
    + +

    +The 'vselect' instruction requires a packed bool value indicating the +condition at each vector position, and two values of the same packed +type. All three operands must have the same length. The type of the +result is the same as the type of the two value operands.

    + +
    Semantics:
    + +

    +At each position where the bool vector is true, that position +of the result gets its value from the first value argument; otherwise, +it gets its value from the second value argument. +

    + +
    Example:
    + +
    +  %X = vselect bool <2 x bool> <bool true, bool false>, <2 x ubyte> <ubyte 17, ubyte 17>, 
    +    <2 x ubyte> <ubyte 42, ubyte 42>      ; yields <2 x ubyte>:17, 42
    +
    +
    @@ -3734,7 +3888,7 @@ Chris Lattner
    The LLVM Compiler Infrastructure
    - Last modified: $Date: 2006/01/25 23:47:57 $ + Last modified: $Date: 2006/02/17 21:18:08 $ From natebegeman at mac.com Fri Feb 17 15:22:20 2006 From: natebegeman at mac.com (Nate Begeman) Date: Fri, 17 Feb 2006 15:22:20 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/PowerPC/and_sext.ll and_sra.ll extsh.ll Message-ID: <200602172122.PAA30086@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/PowerPC: and_sext.ll added (r1.1) and_sra.ll added (r1.1) extsh.ll added (r1.1) --- Log message: New tests! --- Diffs of the changes: (+34 -0) and_sext.ll | 9 +++++++++ and_sra.ll | 18 ++++++++++++++++++ extsh.ll | 7 +++++++ 3 files changed, 34 insertions(+) Index: llvm/test/Regression/CodeGen/PowerPC/and_sext.ll diff -c /dev/null llvm/test/Regression/CodeGen/PowerPC/and_sext.ll:1.1 *** /dev/null Fri Feb 17 15:22:18 2006 --- llvm/test/Regression/CodeGen/PowerPC/and_sext.ll Fri Feb 17 15:22:08 2006 *************** *** 0 **** --- 1,9 ---- + ; This test should not contain a sign extend + ; RUN: llvm-as < %s | llc -march=ppc32 | not grep extsh + + int %test(uint %mode.0.i.0) { + %tmp.79 = cast uint %mode.0.i.0 to short ; [#uses=1] + %tmp.80 = cast short %tmp.79 to int ; [#uses=1] + %tmp.81 = and int %tmp.80, 24 ; [#uses=1] + ret int %tmp.81 + } Index: llvm/test/Regression/CodeGen/PowerPC/and_sra.ll diff -c /dev/null llvm/test/Regression/CodeGen/PowerPC/and_sra.ll:1.1 *** /dev/null Fri Feb 17 15:22:20 2006 --- llvm/test/Regression/CodeGen/PowerPC/and_sra.ll Fri Feb 17 15:22:08 2006 *************** *** 0 **** --- 1,18 ---- + ; Neither of these functions should contain algebraic right shifts + ; RUN: llvm-as < %s | llc -march=ppc32 | not grep srawi + + int %test1(uint %mode.0.i.0) { + %tmp.79 = cast uint %mode.0.i.0 to int ; [#uses=1] + %tmp.80 = shr int %tmp.79, ubyte 15 ; [#uses=1] + %tmp.81 = and int %tmp.80, 24 ; [#uses=1] + ret int %tmp.81 + } + + int %test2(uint %mode.0.i.0) { + %tmp.79 = cast uint %mode.0.i.0 to int ; [#uses=1] + %tmp.80 = shr int %tmp.79, ubyte 15 ; [#uses=1] + %tmp.81 = shr uint %mode.0.i.0, ubyte 16 + %tmp.82 = cast uint %tmp.81 to int + %tmp.83 = and int %tmp.80, %tmp.82 ; [#uses=1] + ret int %tmp.83 + } Index: llvm/test/Regression/CodeGen/PowerPC/extsh.ll diff -c /dev/null llvm/test/Regression/CodeGen/PowerPC/extsh.ll:1.1 *** /dev/null Fri Feb 17 15:22:20 2006 --- llvm/test/Regression/CodeGen/PowerPC/extsh.ll Fri Feb 17 15:22:08 2006 *************** *** 0 **** --- 1,7 ---- + ; This should turn into a single extsh + ; RUN: llvm-as < %s | llc -march=ppc32 | grep extsh | wc -l | grep 1 + int %test(int %X) { + %tmp.81 = shl int %X, ubyte 16 ; [#uses=1] + %tmp.82 = shr int %tmp.81, ubyte 16 ; [#uses=1] + ret int %tmp.82 + } From natebegeman at mac.com Fri Feb 17 15:32:57 2006 From: natebegeman at mac.com (Nate Begeman) Date: Fri, 17 Feb 2006 15:32:57 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/PowerPC/shl_sext.ll Message-ID: <200602172132.PAA30151@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/PowerPC: shl_sext.ll added (r1.1) --- Log message: Yet another test --- Diffs of the changes: (+9 -0) shl_sext.ll | 9 +++++++++ 1 files changed, 9 insertions(+) Index: llvm/test/Regression/CodeGen/PowerPC/shl_sext.ll diff -c /dev/null llvm/test/Regression/CodeGen/PowerPC/shl_sext.ll:1.1 *** /dev/null Fri Feb 17 15:32:56 2006 --- llvm/test/Regression/CodeGen/PowerPC/shl_sext.ll Fri Feb 17 15:32:46 2006 *************** *** 0 **** --- 1,9 ---- + ; This test should not contain a sign extend + ; RUN: llvm-as < %s | llc -march=ppc32 | not grep extsb + + int %test(uint %mode.0.i.0) { + %tmp.79 = cast uint %mode.0.i.0 to sbyte ; [#uses=1] + %tmp.80 = cast sbyte %tmp.79 to int ; [#uses=1] + %tmp.81 = shl int %tmp.80, ubyte 24 ; [#uses=1] + ret int %tmp.81 + } From natebegeman at mac.com Fri Feb 17 15:38:57 2006 From: natebegeman at mac.com (Nate Begeman) Date: Fri, 17 Feb 2006 15:38:57 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/PowerPC/and_sra.ll shl_sext.ll Message-ID: <200602172138.PAA30180@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/PowerPC: and_sra.ll updated: 1.1 -> 1.2 shl_sext.ll updated: 1.1 -> 1.2 --- Log message: A few final (for now) tests --- Diffs of the changes: (+16 -0) and_sra.ll | 8 ++++++++ shl_sext.ll | 8 ++++++++ 2 files changed, 16 insertions(+) Index: llvm/test/Regression/CodeGen/PowerPC/and_sra.ll diff -u llvm/test/Regression/CodeGen/PowerPC/and_sra.ll:1.1 llvm/test/Regression/CodeGen/PowerPC/and_sra.ll:1.2 --- llvm/test/Regression/CodeGen/PowerPC/and_sra.ll:1.1 Fri Feb 17 15:22:08 2006 +++ llvm/test/Regression/CodeGen/PowerPC/and_sra.ll Fri Feb 17 15:38:45 2006 @@ -16,3 +16,11 @@ %tmp.83 = and int %tmp.80, %tmp.82 ; [#uses=1] ret int %tmp.83 } + +uint %test3(int %specbits.6.1) { + %tmp.2540 = shr int %specbits.6.1, ubyte 11 ; [#uses=1] + %tmp.2541 = cast int %tmp.2540 to uint ; [#uses=1] + %tmp.2542 = shl uint %tmp.2541, ubyte 13 ; [#uses=1] + %tmp.2543 = and uint %tmp.2542, 8192 ; [#uses=1] + ret uint %tmp.2543 +} Index: llvm/test/Regression/CodeGen/PowerPC/shl_sext.ll diff -u llvm/test/Regression/CodeGen/PowerPC/shl_sext.ll:1.1 llvm/test/Regression/CodeGen/PowerPC/shl_sext.ll:1.2 --- llvm/test/Regression/CodeGen/PowerPC/shl_sext.ll:1.1 Fri Feb 17 15:32:46 2006 +++ llvm/test/Regression/CodeGen/PowerPC/shl_sext.ll Fri Feb 17 15:38:45 2006 @@ -7,3 +7,11 @@ %tmp.81 = shl int %tmp.80, ubyte 24 ; [#uses=1] ret int %tmp.81 } + +int %test2(uint %mode.0.i.0) { + %tmp.79 = cast uint %mode.0.i.0 to sbyte ; [#uses=1] + %tmp.80 = cast sbyte %tmp.79 to int ; [#uses=1] + %tmp.81 = shl int %tmp.80, ubyte 16 ; [#uses=1] + %tmp.82 = and int %tmp.81, 16711680 + ret int %tmp.82 +} From lattner at cs.uiuc.edu Fri Feb 17 15:57:12 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 17 Feb 2006 15:57:12 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAG.h Message-ID: <200602172157.PAA30275@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: SelectionDAG.h updated: 1.98 -> 1.99 --- Log message: add a new method --- Diffs of the changes: (+7 -0) SelectionDAG.h | 7 +++++++ 1 files changed, 7 insertions(+) Index: llvm/include/llvm/CodeGen/SelectionDAG.h diff -u llvm/include/llvm/CodeGen/SelectionDAG.h:1.98 llvm/include/llvm/CodeGen/SelectionDAG.h:1.99 --- llvm/include/llvm/CodeGen/SelectionDAG.h:1.98 Mon Feb 13 02:54:46 2006 +++ llvm/include/llvm/CodeGen/SelectionDAG.h Fri Feb 17 15:57:00 2006 @@ -408,6 +408,13 @@ void ReplaceAllUsesWith(SDNode *From, const std::vector &To, std::vector *Deleted = 0); + /// ReplaceAllUsesOfValueWith - Replace any uses of From with To, leaving + /// uses of other values produced by From.Val alone. The Deleted vector is + /// handled the same was as for ReplaceAllUsesWith, but it is required for + /// this method. + void ReplaceAllUsesOfValueWith(SDOperand From, SDOperand To, + std::vector &Deleted); + /// DeleteNode - Remove the specified node from the system. This node must /// have no referrers. void DeleteNode(SDNode *N); From lattner at cs.uiuc.edu Fri Feb 17 15:58:13 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 17 Feb 2006 15:58:13 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp SelectionDAG.cpp Message-ID: <200602172158.PAA30340@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.106 -> 1.107 SelectionDAG.cpp updated: 1.257 -> 1.258 --- Log message: Fix a tricky issue in the SimplifyDemandedBits code where CombineTo wasn't exactly the API we wanted to call into. This fixes the crash on crafty last night. --- Diffs of the changes: (+95 -9) DAGCombiner.cpp | 43 ++++++++++++++++++++++++++++++-------- SelectionDAG.cpp | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+), 9 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.106 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.107 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.106 Fri Feb 17 13:54:08 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Fri Feb 17 15:58:01 2006 @@ -99,15 +99,40 @@ return SDOperand(N, 0); } - bool DemandedBitsAreZero(SDOperand Op, uint64_t DemandedMask) { + /// SimplifyDemandedBits - Check the specified integer node value to see if + /// it can be simplified or if things is uses can be simplified by bit + /// propagation. If so, return true. + bool SimplifyDemandedBits(SDOperand Op) { TargetLowering::TargetLoweringOpt TLO(DAG); uint64_t KnownZero, KnownOne; - if (TLI.SimplifyDemandedBits(Op, DemandedMask, KnownZero, KnownOne, TLO)){ - WorkList.push_back(Op.Val); - CombineTo(TLO.Old.Val, TLO.New); - return true; - } - return false; + uint64_t Demanded = MVT::getIntVTBitMask(Op.getValueType()); + if (!TLI.SimplifyDemandedBits(Op, Demanded, KnownZero, KnownOne, TLO)) + return false; + + // Revisit the node. + WorkList.push_back(Op.Val); + + // Replace the old value with the new one. + ++NodesCombined; + DEBUG(std::cerr << "\nReplacing "; TLO.Old.Val->dump(); + std::cerr << "\nWith: "; TLO.New.Val->dump()); + + std::vector NowDead; + DAG.ReplaceAllUsesOfValueWith(TLO.Old, TLO.New, NowDead); + + // Push the new node and any (now) users onto the worklist. + WorkList.push_back(TLO.New.Val); + AddUsersToWorkList(TLO.New.Val); + + // Nodes can end up on the worklist more than once. Make sure we do + // not process a node that has been replaced. + removeFromWorkList(TLO.Old.Val); + for (unsigned i = 0, e = NowDead.size(); i != e; ++i) + removeFromWorkList(NowDead[i]); + + // Finally, since the node is now dead, remove it from the graph. + DAG.DeleteNode(TLO.Old.Val); + return true; } SDOperand CombineTo(SDNode *N, SDOperand Res) { @@ -985,7 +1010,7 @@ } // fold (and (sign_extend_inreg x, i16 to i32), 1) -> (and x, 1) // fold (and (sra)) -> (and (srl)) when possible. - if (DemandedBitsAreZero(SDOperand(N, 0), MVT::getIntVTBitMask(VT))) + if (SimplifyDemandedBits(SDOperand(N, 0))) return SDOperand(); // fold (zext_inreg (extload x)) -> (zextload x) if (N0.getOpcode() == ISD::EXTLOAD) { @@ -1267,7 +1292,7 @@ // if (shl x, c) is known to be zero, return 0 if (TLI.MaskedValueIsZero(SDOperand(N, 0), MVT::getIntVTBitMask(VT))) return DAG.getConstant(0, VT); - if (DemandedBitsAreZero(SDOperand(N,0), MVT::getIntVTBitMask(VT))) + if (SimplifyDemandedBits(SDOperand(N, 0))) return SDOperand(); // fold (shl (shl x, c1), c2) -> 0 or (shl x, c1+c2) if (N1C && N0.getOpcode() == ISD::SHL && Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.257 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.258 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.257 Thu Feb 16 23:43:56 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Feb 17 15:58:01 2006 @@ -21,6 +21,7 @@ #include "llvm/Target/TargetLowering.h" #include "llvm/Target/TargetInstrInfo.h" #include "llvm/Target/TargetMachine.h" +#include "llvm/ADT/SetVector.h" #include "llvm/ADT/StringExtras.h" #include #include @@ -2403,6 +2404,66 @@ } } +/// ReplaceAllUsesOfValueWith - Replace any uses of From with To, leaving +/// uses of other values produced by From.Val alone. The Deleted vector is +/// handled the same was as for ReplaceAllUsesWith. +void SelectionDAG::ReplaceAllUsesOfValueWith(SDOperand From, SDOperand To, + std::vector &Deleted) { + assert(From != To && "Cannot replace a value with itself"); + // Handle the simple, trivial, case efficiently. + if (From.Val->getNumValues() == 1 && To.Val->getNumValues() == 1) { + ReplaceAllUsesWith(From, To, &Deleted); + return; + } + + // Get all of the users in a nice, deterministically ordered, uniqued set. + SetVector Users(From.Val->use_begin(), From.Val->use_end()); + + while (!Users.empty()) { + // We know that this user uses some value of From. If it is the right + // value, update it. + SDNode *User = Users.back(); + Users.pop_back(); + + for (SDOperand *Op = User->OperandList, + *E = User->OperandList+User->NumOperands; Op != E; ++Op) { + if (*Op == From) { + // Okay, we know this user needs to be updated. Remove its old self + // from the CSE maps. + RemoveNodeFromCSEMaps(User); + + // Update all operands that match "From". + for (; Op != E; ++Op) { + if (*Op == From) { + From.Val->removeUser(User); + *Op = To; + To.Val->addUser(User); + } + } + + // Now that we have modified User, add it back to the CSE maps. If it + // already exists there, recursively merge the results together. + if (SDNode *Existing = AddNonLeafNodeToCSEMaps(User)) { + unsigned NumDeleted = Deleted.size(); + ReplaceAllUsesWith(User, Existing, &Deleted); + + // User is now dead. + Deleted.push_back(User); + DeleteNodeNotInCSEMaps(User); + + // We have to be careful here, because ReplaceAllUsesWith could have + // deleted a user of From, which means there may be dangling pointers + // in the "Users" setvector. Scan over the deleted node pointers and + // remove them from the setvector. + for (unsigned i = NumDeleted, e = Deleted.size(); i != e; ++i) + Users.remove(Deleted[i]); + } + break; // Exit the operand scanning loop. + } + } + } +} + //===----------------------------------------------------------------------===// // SDNode Class From evan.cheng at apple.com Fri Feb 17 18:02:45 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 17 Feb 2006 18:02:45 -0600 Subject: [llvm-commits] CVS: llvm-test/SingleSource/Makefile.singlesrc Message-ID: <200602180002.SAA01407@zion.cs.uiuc.edu> Changes in directory llvm-test/SingleSource: Makefile.singlesrc updated: 1.28 -> 1.29 --- Log message: Add -mdynamic-no-pic to native compiler (gcc) options for Darwin. --- Diffs of the changes: (+2 -2) Makefile.singlesrc | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-test/SingleSource/Makefile.singlesrc diff -u llvm-test/SingleSource/Makefile.singlesrc:1.28 llvm-test/SingleSource/Makefile.singlesrc:1.29 --- llvm-test/SingleSource/Makefile.singlesrc:1.28 Sun May 15 14:46:42 2005 +++ llvm-test/SingleSource/Makefile.singlesrc Fri Feb 17 18:02:32 2006 @@ -35,6 +35,6 @@ # FIXME: LIBS should be specified, not hardcoded to -lm Output/%.native: $(SourceDir)/%.c Output/.dir - -$(CC) $(CFLAGS) -O2 $< -lm -o $@ $(LDFLAGS) + -$(CC) $(CFLAGS) -O2 $(TARGET_CFLAGS) $< -lm -o $@ $(LDFLAGS) Output/%.native: $(SourceDir)/%.cpp Output/.dir - -$(CXX) $(CXXFLAGS) -O2 $< -lm -o $@ $(LDFLAGS) + -$(CXX) $(CXXFLAGS) -O2 $(TARGET_CFLAGS) $< -lm -o $@ $(LDFLAGS) From evan.cheng at apple.com Fri Feb 17 18:02:45 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 17 Feb 2006 18:02:45 -0600 Subject: [llvm-commits] CVS: llvm-test/MultiSource/Makefile.multisrc Message-ID: <200602180002.SAA01403@zion.cs.uiuc.edu> Changes in directory llvm-test/MultiSource: Makefile.multisrc updated: 1.50 -> 1.51 --- Log message: Add -mdynamic-no-pic to native compiler (gcc) options for Darwin. --- Diffs of the changes: (+3 -3) Makefile.multisrc | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm-test/MultiSource/Makefile.multisrc diff -u llvm-test/MultiSource/Makefile.multisrc:1.50 llvm-test/MultiSource/Makefile.multisrc:1.51 --- llvm-test/MultiSource/Makefile.multisrc:1.50 Wed Feb 1 00:50:56 2006 +++ llvm-test/MultiSource/Makefile.multisrc Fri Feb 17 18:02:32 2006 @@ -29,13 +29,13 @@ .PRECIOUS: $(LObjects) $(NObjects) Output/%.linked.rll Output/%.o: %.c Output/.dir - -$(CC) $(CPPFLAGS) $(CFLAGS) -O2 -c $< -o $@ + -$(CC) $(CPPFLAGS) $(CFLAGS) -O2 $(TARGET_CFLAGS) -c $< -o $@ Output/%.o: %.cpp Output/.dir - -$(CC) $(CPPFLAGS) $(CXXFLAGS) -O2 -c $< -o $@ + -$(CC) $(CPPFLAGS) $(CXXFLAGS) -O2 $(TARGET_CFLAGS) -c $< -o $@ Output/%.o: %.cc Output/.dir - -$(CC) $(CPPFLAGS) $(CXXFLAGS) -O2 -c $< -o $@ + -$(CC) $(CPPFLAGS) $(CXXFLAGS) -O2 $(TARGET_CFLAGS) -c $< -o $@ bugpoint-gccas: Output/$(PROG).bugpoint-gccas bugpoint-gccld: Output/$(PROG).bugpoint-gccld From evan.cheng at apple.com Fri Feb 17 18:02:45 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 17 Feb 2006 18:02:45 -0600 Subject: [llvm-commits] CVS: llvm-test/Makefile.programs Message-ID: <200602180002.SAA01411@zion.cs.uiuc.edu> Changes in directory llvm-test: Makefile.programs updated: 1.192 -> 1.193 --- Log message: Add -mdynamic-no-pic to native compiler (gcc) options for Darwin. --- Diffs of the changes: (+4 -0) Makefile.programs | 4 ++++ 1 files changed, 4 insertions(+) Index: llvm-test/Makefile.programs diff -u llvm-test/Makefile.programs:1.192 llvm-test/Makefile.programs:1.193 --- llvm-test/Makefile.programs:1.192 Tue Feb 14 02:09:05 2006 +++ llvm-test/Makefile.programs Fri Feb 17 18:02:32 2006 @@ -203,6 +203,10 @@ LLCBETAOPTION := -enable-sparc-v9-insts endif +ifeq ($(OS),Darwin) +TARGET_CFLAGS := -mdynamic-no-pic +endif + # Given a version of the entire program linked together into a single unit of # raw output from the C frontend, optimize it. $(PROGRAMS_TO_TEST:%=Output/%.linked.bc): \ From evan.cheng at apple.com Fri Feb 17 18:06:15 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 17 Feb 2006 18:06:15 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetOptions.h Message-ID: <200602180006.SAA01491@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetOptions.h updated: 1.6 -> 1.7 --- Log message: Move PICEnabled declaration here. --- Diffs of the changes: (+6 -0) TargetOptions.h | 6 ++++++ 1 files changed, 6 insertions(+) Index: llvm/include/llvm/Target/TargetOptions.h diff -u llvm/include/llvm/Target/TargetOptions.h:1.6 llvm/include/llvm/Target/TargetOptions.h:1.7 --- llvm/include/llvm/Target/TargetOptions.h:1.6 Thu Aug 18 18:53:15 2005 +++ llvm/include/llvm/Target/TargetOptions.h Fri Feb 17 18:06:03 2006 @@ -40,6 +40,12 @@ /// produce results that are "less precise" than IEEE allows. This includes /// use of X86 instructions like FSIN and FCOS instead of libcalls. extern bool UnsafeFPMath; + + /// PICEnabled - This flag is enabled when the -enable-pic flag is specified + /// on the command line. When this flag is on, the code generator produces + /// position independant code. + extern bool PICEnabled; + } // End llvm namespace #endif From evan.cheng at apple.com Fri Feb 17 18:09:10 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 17 Feb 2006 18:09:10 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPC.h PPCAsmPrinter.cpp PPCCodeEmitter.cpp PPCISelLowering.cpp Message-ID: <200602180009.SAA01560@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPC.h updated: 1.25 -> 1.26 PPCAsmPrinter.cpp updated: 1.151 -> 1.152 PPCCodeEmitter.cpp updated: 1.45 -> 1.46 PPCISelLowering.cpp updated: 1.87 -> 1.88 --- Log message: Moved PICEnabled to include/llvm/Target/TargetOptions.h --- Diffs of the changes: (+3 -1) PPC.h | 1 - PPCAsmPrinter.cpp | 1 + PPCCodeEmitter.cpp | 1 + PPCISelLowering.cpp | 1 + 4 files changed, 3 insertions(+), 1 deletion(-) Index: llvm/lib/Target/PowerPC/PPC.h diff -u llvm/lib/Target/PowerPC/PPC.h:1.25 llvm/lib/Target/PowerPC/PPC.h:1.26 --- llvm/lib/Target/PowerPC/PPC.h:1.25 Wed Jan 11 19:46:07 2006 +++ llvm/lib/Target/PowerPC/PPC.h Fri Feb 17 18:08:58 2006 @@ -31,7 +31,6 @@ FunctionPass *createDarwinAsmPrinter(std::ostream &OS, TargetMachine &TM); FunctionPass *createAIXAsmPrinter(std::ostream &OS, TargetMachine &TM); -extern bool PICEnabled; extern bool PPCGenerateStaticCode; extern PPCTargetEnum PPCTarget; } // end namespace llvm; Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.151 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.152 --- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.151 Tue Feb 14 16:18:23 2006 +++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp Fri Feb 17 18:08:58 2006 @@ -35,6 +35,7 @@ #include "llvm/Support/Debug.h" #include "llvm/Target/MRegisterInfo.h" #include "llvm/Target/TargetInstrInfo.h" +#include "llvm/Target/TargetOptions.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/StringExtras.h" #include Index: llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp diff -u llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp:1.45 llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp:1.46 --- llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp:1.45 Sun Jan 29 14:49:17 2006 +++ llvm/lib/Target/PowerPC/PPCCodeEmitter.cpp Fri Feb 17 18:08:58 2006 @@ -22,6 +22,7 @@ #include "llvm/CodeGen/MachineInstrBuilder.h" #include "llvm/CodeGen/Passes.h" #include "llvm/Support/Debug.h" +#include "llvm/Target/TargetOptions.h" #include using namespace llvm; Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.87 llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.88 --- llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.87 Mon Feb 13 02:55:29 2006 +++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp Fri Feb 17 18:08:58 2006 @@ -22,6 +22,7 @@ #include "llvm/Constants.h" #include "llvm/Function.h" #include "llvm/Support/MathExtras.h" +#include "llvm/Target/TargetOptions.h" using namespace llvm; PPCTargetLowering::PPCTargetLowering(TargetMachine &TM) From evan.cheng at apple.com Fri Feb 17 18:15:17 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 17 Feb 2006 18:15:17 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp X86ATTAsmPrinter.h X86ISelDAGToDAG.cpp X86ISelLowering.cpp X86ISelLowering.h X86InstrInfo.td X86IntelAsmPrinter.cpp X86IntelAsmPrinter.h X86Subtarget.cpp X86Subtarget.h Message-ID: <200602180015.SAA01696@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ATTAsmPrinter.cpp updated: 1.22 -> 1.23 X86ATTAsmPrinter.h updated: 1.6 -> 1.7 X86ISelDAGToDAG.cpp updated: 1.49 -> 1.50 X86ISelLowering.cpp updated: 1.88 -> 1.89 X86ISelLowering.h updated: 1.27 -> 1.28 X86InstrInfo.td updated: 1.237 -> 1.238 X86IntelAsmPrinter.cpp updated: 1.16 -> 1.17 X86IntelAsmPrinter.h updated: 1.7 -> 1.8 X86Subtarget.cpp updated: 1.25 -> 1.26 X86Subtarget.h updated: 1.11 -> 1.12 --- Log message: x86 / Darwin PIC support. --- Diffs of the changes: (+143 -36) X86ATTAsmPrinter.cpp | 23 +++++++++++++---------- X86ATTAsmPrinter.h | 1 + X86ISelDAGToDAG.cpp | 39 +++++++++++++++++++++++++++++++++++++++ X86ISelLowering.cpp | 40 ++++++++++++++++++++++++++++++++-------- X86ISelLowering.h | 4 ++++ X86InstrInfo.td | 7 +++++++ X86IntelAsmPrinter.cpp | 47 +++++++++++++++++++++++++++++++++++++++++++---- X86IntelAsmPrinter.h | 1 + X86Subtarget.cpp | 5 +---- X86Subtarget.h | 12 ++---------- 10 files changed, 143 insertions(+), 36 deletions(-) Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.22 llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.23 --- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.22 Tue Feb 7 02:38:37 2006 +++ llvm/lib/Target/X86/X86ATTAsmPrinter.cpp Fri Feb 17 18:15:05 2006 @@ -18,6 +18,7 @@ #include "X86TargetMachine.h" #include "llvm/Module.h" #include "llvm/Support/Mangler.h" +#include "llvm/Target/TargetOptions.h" #include using namespace llvm; using namespace x86; @@ -116,9 +117,9 @@ case MachineOperand::MO_GlobalAddress: { bool isCallOp = Modifier && !strcmp(Modifier, "call"); bool isMemOp = Modifier && !strcmp(Modifier, "mem"); + if (!isMemOp && !isCallOp) O << '$'; // Darwin block shameless ripped from PPCAsmPrinter.cpp if (forDarwin) { - if (!isMemOp && !isCallOp) O << '$'; GlobalValue *GV = MO.getGlobal(); std::string Name = Mang->getValueName(GV); // Link-once, External, or Weakly-linked global variables need @@ -132,19 +133,14 @@ } else { GVStubs.insert(Name); O << "L" << Name << "$non_lazy_ptr"; + if (PICEnabled) + O << "-\"L" << getFunctionNumber() << "$pb\""; } } else { O << Mang->getValueName(GV); } - int Offset = MO.getOffset(); - if (Offset > 0) - O << "+" << Offset; - else if (Offset < 0) - O << Offset; - return; - } - if (!isMemOp && !isCallOp) O << '$'; - O << Mang->getValueName(MO.getGlobal()); + } else + O << Mang->getValueName(MO.getGlobal()); int Offset = MO.getOffset(); if (Offset > 0) O << "+" << Offset; @@ -202,6 +198,8 @@ } else if (BaseReg.isConstantPoolIndex()) { O << PrivateGlobalPrefix << "CPI" << getFunctionNumber() << "_" << BaseReg.getConstantPoolIndex(); + if (forDarwin && PICEnabled) + O << "-\"L" << getFunctionNumber() << "$pb\""; if (DispSpec.getImmedValue()) O << "+" << DispSpec.getImmedValue(); if (IndexReg.getReg()) { @@ -238,6 +236,11 @@ } } +void X86ATTAsmPrinter::printPICLabel(const MachineInstr *MI, unsigned Op) { + O << "\"L" << getFunctionNumber() << "$pb\"\n"; + O << "\"L" << getFunctionNumber() << "$pb\":"; +} + /// printMachineInstruction -- Print out a single X86 LLVM instruction /// MI in Intel syntax to the current output stream. /// Index: llvm/lib/Target/X86/X86ATTAsmPrinter.h diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.h:1.6 llvm/lib/Target/X86/X86ATTAsmPrinter.h:1.7 --- llvm/lib/Target/X86/X86ATTAsmPrinter.h:1.6 Mon Feb 6 17:41:19 2006 +++ llvm/lib/Target/X86/X86ATTAsmPrinter.h Fri Feb 17 18:15:05 2006 @@ -62,6 +62,7 @@ void printMachineInstruction(const MachineInstr *MI); void printSSECC(const MachineInstr *MI, unsigned Op); void printMemReference(const MachineInstr *MI, unsigned Op); + void printPICLabel(const MachineInstr *MI, unsigned Op); bool runOnMachineFunction(MachineFunction &F); }; Index: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp diff -u llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.49 llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.50 --- llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.49 Fri Feb 10 20:05:36 2006 +++ llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Fri Feb 17 18:15:05 2006 @@ -85,12 +85,20 @@ /// Subtarget - Keep a pointer to the X86Subtarget around so that we can /// make the right decision when generating code for different targets. const X86Subtarget *Subtarget; + + unsigned GlobalBaseReg; public: X86DAGToDAGISel(TargetMachine &TM) : SelectionDAGISel(X86Lowering), X86Lowering(TM) { Subtarget = &TM.getSubtarget(); } + virtual bool runOnFunction(Function &Fn) { + // Make sure we re-emit a set of the global base reg if necessary + GlobalBaseReg = 0; + return SelectionDAGISel::runOnFunction(Fn); + } + virtual const char *getPassName() const { return "X86 DAG->DAG Instruction Selection"; } @@ -145,6 +153,10 @@ return CurDAG->getTargetConstant(Imm, MVT::i32); } + /// getGlobalBaseReg - insert code into the entry mbb to materialize the PIC + /// base register. Return the virtual register that holds this value. + SDOperand getGlobalBaseReg(); + #ifndef NDEBUG unsigned Indent; #endif @@ -283,6 +295,7 @@ break; case ISD::ConstantPool: + case ISD::TargetConstantPool: if (AM.BaseType == X86ISelAddressMode::RegBase && AM.Base.Reg.Val == 0) { if (ConstantPoolSDNode *CP = dyn_cast(N)) { AM.BaseType = X86ISelAddressMode::ConstantPoolBase; @@ -377,6 +390,10 @@ // Is the base register already occupied? if (AM.BaseType != X86ISelAddressMode::RegBase || AM.Base.Reg.Val) { + // TargetConstantPool cannot be anything but the base. + if (N.getOpcode() == ISD::TargetConstantPool) + return true; + // If so, check to see if the scale index register is set. if (AM.IndexReg.Val == 0) { AM.IndexReg = N; @@ -478,6 +495,24 @@ return false; } +/// getGlobalBaseReg - Output the instructions required to put the +/// base address to use for accessing globals into a register. +/// +SDOperand X86DAGToDAGISel::getGlobalBaseReg() { + if (!GlobalBaseReg) { + // Insert the set of GlobalBaseReg into the first MBB of the function + MachineBasicBlock &FirstMBB = BB->getParent()->front(); + MachineBasicBlock::iterator MBBI = FirstMBB.begin(); + SSARegMap *RegMap = BB->getParent()->getSSARegMap(); + // FIXME: when we get to LP64, we will need to create the appropriate + // type of register here. + GlobalBaseReg = RegMap->createVirtualRegister(X86::R32RegisterClass); + BuildMI(FirstMBB, MBBI, X86::MovePCtoStack, 0); + BuildMI(FirstMBB, MBBI, X86::POP32r, 1, GlobalBaseReg); + } + return CurDAG->getRegister(GlobalBaseReg, MVT::i32); +} + void X86DAGToDAGISel::Select(SDOperand &Result, SDOperand N) { SDNode *Node = N.Val; MVT::ValueType NVT = Node->getValueType(0); @@ -603,6 +638,10 @@ #endif return; } + + case X86ISD::GlobalBaseReg: + Result = getGlobalBaseReg(); + return; case ISD::SDIV: case ISD::UDIV: Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.88 llvm/lib/Target/X86/X86ISelLowering.cpp:1.89 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.88 Fri Feb 17 01:09:27 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Fri Feb 17 18:15:05 2006 @@ -162,6 +162,7 @@ // X86 ret instruction may pop stack. setOperationAction(ISD::RET , MVT::Other, Custom); // Darwin ABI issue. + setOperationAction(ISD::ConstantPool , MVT::i32 , Custom); setOperationAction(ISD::GlobalAddress , MVT::i32 , Custom); // 64-bit addm sub, shl, sra, srl (iff 32-bit x86) setOperationAction(ISD::SHL_PARTS , MVT::i32 , Custom); @@ -1788,21 +1789,43 @@ return DAG.getNode(X86ISD::REP_MOVS, MVT::Other, Chain, DAG.getValueType(AVT), InFlag); } + case ISD::ConstantPool: { + ConstantPoolSDNode *CP = cast(Op); + SDOperand Result = + DAG.getTargetConstantPool(CP->get(), getPointerTy(), CP->getAlignment()); + // Only lower ConstantPool on Darwin. + if (getTargetMachine(). + getSubtarget().isTargetDarwin()) { + // With PIC, the address is actually $g + Offset. + if (PICEnabled) + Result = DAG.getNode(ISD::ADD, getPointerTy(), + DAG.getNode(X86ISD::GlobalBaseReg, getPointerTy()), Result); + } + + return Result; + } case ISD::GlobalAddress: { SDOperand Result; - GlobalValue *GV = cast(Op)->getGlobal(); - // For Darwin, external and weak symbols are indirect, so we want to load - // the value at address GV, not the value of GV itself. This means that - // the GlobalAddress must be in the base or index register of the address, - // not the GV offset field. + // Only lower GlobalAddress on Darwin. if (getTargetMachine(). - getSubtarget().getIndirectExternAndWeakGlobals()) { + getSubtarget().isTargetDarwin()) { + GlobalValue *GV = cast(Op)->getGlobal(); + SDOperand Addr = DAG.getTargetGlobalAddress(GV, getPointerTy()); + // With PIC, the address is actually $g + Offset. + if (PICEnabled) + Addr = DAG.getNode(ISD::ADD, getPointerTy(), + DAG.getNode(X86ISD::GlobalBaseReg, getPointerTy()), Addr); + + // For Darwin, external and weak symbols are indirect, so we want to load + // the value at address GV, not the value of GV itself. This means that + // the GlobalAddress must be in the base or index register of the address, + // not the GV offset field. if (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() || (GV->isExternal() && !GV->hasNotBeenReadFromBytecode())) Result = DAG.getLoad(MVT::i32, DAG.getEntryNode(), - DAG.getTargetGlobalAddress(GV, getPointerTy()), - DAG.getSrcValue(NULL)); + Addr, DAG.getSrcValue(NULL)); } + return Result; } case ISD::VASTART: { @@ -1913,6 +1936,7 @@ case X86ISD::REP_STOS: return "X86ISD::RET_STOS"; case X86ISD::REP_MOVS: return "X86ISD::RET_MOVS"; case X86ISD::LOAD_PACK: return "X86ISD::LOAD_PACK"; + case X86ISD::GlobalBaseReg: return "X86ISD::GlobalBaseReg"; } } Index: llvm/lib/Target/X86/X86ISelLowering.h diff -u llvm/lib/Target/X86/X86ISelLowering.h:1.27 llvm/lib/Target/X86/X86ISelLowering.h:1.28 --- llvm/lib/Target/X86/X86ISelLowering.h:1.27 Thu Feb 16 23:43:56 2006 +++ llvm/lib/Target/X86/X86ISelLowering.h Fri Feb 17 18:15:05 2006 @@ -137,6 +137,10 @@ /// LOAD_PACK Load a 128-bit packed float / double value. It has the same /// operands as a normal load. LOAD_PACK, + + /// GlobalBaseReg - On Darwin, this node represents the result of the popl + /// at function entry, used for PIC code. + GlobalBaseReg, }; // X86 specific condition code. These correspond to X86_*_COND in Index: llvm/lib/Target/X86/X86InstrInfo.td diff -u llvm/lib/Target/X86/X86InstrInfo.td:1.237 llvm/lib/Target/X86/X86InstrInfo.td:1.238 --- llvm/lib/Target/X86/X86InstrInfo.td:1.237 Thu Feb 16 23:43:56 2006 +++ llvm/lib/Target/X86/X86InstrInfo.td Fri Feb 17 18:15:05 2006 @@ -144,6 +144,10 @@ let PrintMethod = "printSSECC"; } +def piclabel: Operand { + let PrintMethod = "printPICLabel"; +} + // A couple of more descriptive operand definitions. // 16-bits but only 8 bits are significant. def i16i8imm : Operand; @@ -537,6 +541,9 @@ def POP32r : I<0x58, AddRegFrm, (ops R32:$reg), "pop{l} $reg", []>, Imp<[ESP],[ESP]>; +def MovePCtoStack : I<0, Pseudo, (ops piclabel:$label), + "call $label", []>; + let isTwoAddress = 1 in // R32 = bswap R32 def BSWAP32r : I<0xC8, AddRegFrm, (ops R32:$dst, R32:$src), Index: llvm/lib/Target/X86/X86IntelAsmPrinter.cpp diff -u llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.16 llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.17 --- llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.16 Tue Feb 7 02:38:37 2006 +++ llvm/lib/Target/X86/X86IntelAsmPrinter.cpp Fri Feb 17 18:15:05 2006 @@ -18,6 +18,7 @@ #include "llvm/Module.h" #include "llvm/Assembly/Writer.h" #include "llvm/Support/Mangler.h" +#include "llvm/Target/TargetOptions.h" using namespace llvm; using namespace x86; @@ -109,9 +110,32 @@ abort (); return; case MachineOperand::MO_GlobalAddress: { - if (!Modifier || strcmp(Modifier, "call") || strcmp(Modifier, "mem")) - O << "OFFSET "; - O << Mang->getValueName(MO.getGlobal()); + bool isCallOp = Modifier && !strcmp(Modifier, "call"); + bool isMemOp = Modifier && !strcmp(Modifier, "mem"); + if (!isMemOp && !isCallOp) O << "OFFSET "; + if (forDarwin) { + GlobalValue *GV = MO.getGlobal(); + std::string Name = Mang->getValueName(GV); + if (!isMemOp && !isCallOp) O << '$'; + // Link-once, External, or Weakly-linked global variables need + // non-lazily-resolved stubs + if (GV->isExternal() || GV->hasWeakLinkage() || + GV->hasLinkOnceLinkage()) { + // Dynamically-resolved functions need a stub for the function. + if (isCallOp && isa(GV) && cast(GV)->isExternal()) { + FnStubs.insert(Name); + O << "L" << Name << "$stub"; + } else { + GVStubs.insert(Name); + O << "L" << Name << "$non_lazy_ptr"; + if (PICEnabled) + O << "-\"L" << getFunctionNumber() << "$pb\""; + } + } else { + O << Mang->getValueName(GV); + } + } else + O << Mang->getValueName(MO.getGlobal()); int Offset = MO.getOffset(); if (Offset > 0) O << " + " << Offset; @@ -119,9 +143,18 @@ O << Offset; return; } - case MachineOperand::MO_ExternalSymbol: + case MachineOperand::MO_ExternalSymbol: { + bool isCallOp = Modifier && !strcmp(Modifier, "call"); + bool isMemOp = Modifier && !strcmp(Modifier, "mem"); + if (isCallOp && forDarwin) { + std::string Name(GlobalPrefix); Name += MO.getSymbolName(); + FnStubs.insert(Name); + O << "L" << Name << "$stub"; + return; + } O << GlobalPrefix << MO.getSymbolName(); return; + } default: O << ""; return; } @@ -144,6 +177,8 @@ } else if (BaseReg.isConstantPoolIndex()) { O << "[" << PrivateGlobalPrefix << "CPI" << getFunctionNumber() << "_" << BaseReg.getConstantPoolIndex(); + if (forDarwin && PICEnabled) + O << "-\"L" << getFunctionNumber() << "$pb\""; if (IndexReg.getReg()) { O << " + "; @@ -193,6 +228,10 @@ O << "]"; } +void X86IntelAsmPrinter::printPICLabel(const MachineInstr *MI, unsigned Op) { + O << "\"L" << getFunctionNumber() << "$pb\"\n"; + O << "\"L" << getFunctionNumber() << "$pb\":"; +} /// printMachineInstruction -- Print out a single X86 LLVM instruction /// MI in Intel syntax to the current output stream. Index: llvm/lib/Target/X86/X86IntelAsmPrinter.h diff -u llvm/lib/Target/X86/X86IntelAsmPrinter.h:1.7 llvm/lib/Target/X86/X86IntelAsmPrinter.h:1.8 --- llvm/lib/Target/X86/X86IntelAsmPrinter.h:1.7 Mon Feb 6 17:41:19 2006 +++ llvm/lib/Target/X86/X86IntelAsmPrinter.h Fri Feb 17 18:15:05 2006 @@ -82,6 +82,7 @@ void printOp(const MachineOperand &MO, const char *Modifier = 0); void printSSECC(const MachineInstr *MI, unsigned Op); void printMemReference(const MachineInstr *MI, unsigned Op); + void printPICLabel(const MachineInstr *MI, unsigned Op); bool runOnMachineFunction(MachineFunction &F); bool doInitialization(Module &M); }; Index: llvm/lib/Target/X86/X86Subtarget.cpp diff -u llvm/lib/Target/X86/X86Subtarget.cpp:1.25 llvm/lib/Target/X86/X86Subtarget.cpp:1.26 --- llvm/lib/Target/X86/X86Subtarget.cpp:1.25 Wed Feb 15 18:21:07 2006 +++ llvm/lib/Target/X86/X86Subtarget.cpp Fri Feb 17 18:15:05 2006 @@ -148,7 +148,6 @@ stackAlignment = 8; // FIXME: this is a known good value for Yonah. Not sure about others. MinRepStrSizeThreshold = 128; - indirectExternAndWeakGlobals = false; X86SSELevel = NoMMXSSE; X863DNowLevel = NoThreeDNow; Is64Bit = false; @@ -183,8 +182,6 @@ #endif } - if (TargetType == isDarwin) { + if (TargetType == isDarwin) stackAlignment = 16; - indirectExternAndWeakGlobals = true; - } } Index: llvm/lib/Target/X86/X86Subtarget.h diff -u llvm/lib/Target/X86/X86Subtarget.h:1.11 llvm/lib/Target/X86/X86Subtarget.h:1.12 --- llvm/lib/Target/X86/X86Subtarget.h:1.11 Wed Feb 15 18:21:07 2006 +++ llvm/lib/Target/X86/X86Subtarget.h Fri Feb 17 18:15:05 2006 @@ -47,9 +47,6 @@ /// Min. memset / memcpy size that is turned into rep/movs, rep/stos ops. unsigned MinRepStrSizeThreshold; - /// Used by instruction selector - bool indirectExternAndWeakGlobals; - public: enum { isELF, isCygwin, isDarwin, isWindows @@ -71,13 +68,6 @@ /// aligned. unsigned getMinRepStrSizeThreshold() const { return MinRepStrSizeThreshold; } - /// Returns true if the instruction selector should treat global values - /// referencing external or weak symbols as indirect rather than direct - /// references. - bool getIndirectExternAndWeakGlobals() const { - return indirectExternAndWeakGlobals; - } - /// ParseSubtargetFeatures - Parses features string setting specified /// subtarget options. Definition of function is auto generated by tblgen. void ParseSubtargetFeatures(const std::string &FS, const std::string &CPU); @@ -90,6 +80,8 @@ bool hasSSE3() const { return X86SSELevel >= SSE3; } bool has3DNow() const { return X863DNowLevel >= ThreeDNow; } bool has3DNowA() const { return X863DNowLevel >= ThreeDNowA; } + + bool isTargetDarwin() const { return TargetType == isDarwin; } }; } // End llvm namespace From lattner at cs.uiuc.edu Fri Feb 17 18:32:56 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 17 Feb 2006 18:32:56 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/SimplifyCFG/2006-02-17-InfiniteUnroll.ll Message-ID: <200602180032.SAA03820@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/SimplifyCFG: 2006-02-17-InfiniteUnroll.ll added (r1.1) --- Log message: new testcase that crashes simplifycfg --- Diffs of the changes: (+35 -0) 2006-02-17-InfiniteUnroll.ll | 35 +++++++++++++++++++++++++++++++++++ 1 files changed, 35 insertions(+) Index: llvm/test/Regression/Transforms/SimplifyCFG/2006-02-17-InfiniteUnroll.ll diff -c /dev/null llvm/test/Regression/Transforms/SimplifyCFG/2006-02-17-InfiniteUnroll.ll:1.1 *** /dev/null Fri Feb 17 18:32:54 2006 --- llvm/test/Regression/Transforms/SimplifyCFG/2006-02-17-InfiniteUnroll.ll Fri Feb 17 18:32:44 2006 *************** *** 0 **** --- 1,35 ---- + ; RUN: llvm-as < %s | opt -simplifycfg -disable-output + + void %polnel_() { + entry: + %tmp595 = setlt int 0, 0 ; [#uses=4] + br bool %tmp595, label %bb148.critedge, label %cond_true40 + + bb36: ; preds = %bb43 + br bool %tmp595, label %bb43, label %cond_true40 + + cond_true40: ; preds = %bb46, %cond_true40, %bb36, %entry + %tmp397 = setgt int 0, 0 ; [#uses=1] + br bool %tmp397, label %bb43, label %cond_true40 + + bb43: ; preds = %cond_true40, %bb36 + br bool false, label %bb53, label %bb36 + + bb46: ; preds = %bb53 + br bool %tmp595, label %bb53, label %cond_true40 + + bb53: ; preds = %bb46, %bb43 + br bool false, label %bb102, label %bb46 + + bb92.preheader: ; preds = %bb102 + ret void + + bb102: ; preds = %bb53 + br bool %tmp595, label %bb148, label %bb92.preheader + + bb148.critedge: ; preds = %entry + ret void + + bb148: ; preds = %bb102 + ret void + } From lattner at cs.uiuc.edu Fri Feb 17 18:33:29 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 17 Feb 2006 18:33:29 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/SimplifyCFG.cpp Message-ID: <200602180033.SAA03861@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: SimplifyCFG.cpp updated: 1.94 -> 1.95 --- Log message: Fix Transforms/SimplifyCFG/2006-02-17-InfiniteUnroll.ll --- Diffs of the changes: (+8 -2) SimplifyCFG.cpp | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) Index: llvm/lib/Transforms/Utils/SimplifyCFG.cpp diff -u llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.94 llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.95 --- llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.94 Sun Jan 22 16:53:01 2006 +++ llvm/lib/Transforms/Utils/SimplifyCFG.cpp Fri Feb 17 18:33:17 2006 @@ -1426,8 +1426,8 @@ PBI->setSuccessor(1, OldTrue); } - if (PBI->getSuccessor(0) == TrueDest || - PBI->getSuccessor(1) == FalseDest) { + if ((PBI->getSuccessor(0) == TrueDest && FalseDest != BB) || + (PBI->getSuccessor(1) == FalseDest && TrueDest != BB)) { // Clone Cond into the predecessor basic block, and or/and the // two conditions together. Instruction *New = Cond->clone(); @@ -1512,6 +1512,12 @@ PBIOp = BIOp = -1; } + // Check to make sure that the other destination of this branch + // isn't BB itself. If so, this is an infinite loop that will + // keep getting unwound. + if (PBIOp != -1 && PBI->getSuccessor(PBIOp) == BB) + PBIOp = BIOp = -1; + // Finally, if everything is ok, fold the branches to logical ops. if (PBIOp != -1) { BasicBlock *CommonDest = PBI->getSuccessor(PBIOp); From evan.cheng at apple.com Fri Feb 17 18:35:34 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 17 Feb 2006 18:35:34 -0600 Subject: [llvm-commits] CVS: llvm-test/MultiSource/Applications/JM/ldecod/data/test.264 test_dec.yuv Message-ID: <200602180035.SAA03884@zion.cs.uiuc.edu> Changes in directory llvm-test/MultiSource/Applications/JM/ldecod/data: test.264 updated: 1.1 -> 1.2 test_dec.yuv (r1.1) removed --- Log message: Replace the original test.264 with a larger CIF / 15 frame bitstream. --- Diffs of the changes: (+0 -0) test.264 | 0 1 files changed Index: llvm-test/MultiSource/Applications/JM/ldecod/data/test.264 From lattner at cs.uiuc.edu Fri Feb 17 18:55:44 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 17 Feb 2006 18:55:44 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Message-ID: <200602180055.SAA04030@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LoopUnswitch.cpp updated: 1.28 -> 1.29 --- Log message: When unswitching a loop, make sure to update loop info with exit blocks in the right loop. --- Diffs of the changes: (+4 -2) LoopUnswitch.cpp | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.28 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.29 --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.28 Fri Feb 17 00:39:56 2006 +++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Fri Feb 17 18:55:32 2006 @@ -590,6 +590,7 @@ // Split all of the edges from inside the loop to their exit blocks. This // unswitching trivial: no phi nodes to update. unsigned NumBlocks = L->getBlocks().size(); + for (unsigned i = 0, e = ExitBlocks.size(); i != e; ++i) { BasicBlock *ExitBlock = ExitBlocks[i]; std::vector Preds(pred_begin(ExitBlock), pred_end(ExitBlock)); @@ -639,8 +640,9 @@ for (unsigned i = 0, e = ExitBlocks.size(); i != e; ++i) { BasicBlock *NewExit = cast(ValueMap[ExitBlocks[i]]); - if (ParentLoop) - ParentLoop->addBasicBlockToLoop(cast(NewExit), *LI); + // The new exit block should be in the same loop as the old one. + if (Loop *ExitBBLoop = LI->getLoopFor(ExitBlocks[i])) + ExitBBLoop->addBasicBlockToLoop(NewExit, *LI); assert(NewExit->getTerminator()->getNumSuccessors() == 1 && "Exit block should have been split to have one successor!"); From evan.cheng at apple.com Fri Feb 17 18:57:22 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 17 Feb 2006 18:57:22 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86CodeEmitter.cpp Message-ID: <200602180057.SAA04056@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86CodeEmitter.cpp updated: 1.89 -> 1.90 --- Log message: Jit does not support PIC yet. --- Diffs of the changes: (+2 -0) X86CodeEmitter.cpp | 2 ++ 1 files changed, 2 insertions(+) Index: llvm/lib/Target/X86/X86CodeEmitter.cpp diff -u llvm/lib/Target/X86/X86CodeEmitter.cpp:1.89 llvm/lib/Target/X86/X86CodeEmitter.cpp:1.90 --- llvm/lib/Target/X86/X86CodeEmitter.cpp:1.89 Tue Feb 14 15:52:51 2006 +++ llvm/lib/Target/X86/X86CodeEmitter.cpp Fri Feb 17 18:57:10 2006 @@ -22,6 +22,7 @@ #include "llvm/CodeGen/Passes.h" #include "llvm/Function.h" #include "llvm/ADT/Statistic.h" +#include "llvm/Target/TargetOptions.h" #include using namespace llvm; @@ -96,6 +97,7 @@ } void Emitter::emitBasicBlock(const MachineBasicBlock &MBB) { + assert(!PICEnabled && "CodeEmitter does not support PIC!"); if (uint64_t Addr = MCE.getCurrentPCValue()) BasicBlockAddrs[&MBB] = Addr; From lattner at cs.uiuc.edu Fri Feb 17 19:27:56 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 17 Feb 2006 19:27:56 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Message-ID: <200602180127.TAA04220@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LoopUnswitch.cpp updated: 1.29 -> 1.30 --- Log message: initial trivial support for folding branches that have now-constant destinations. --- Diffs of the changes: (+34 -3) LoopUnswitch.cpp | 37 ++++++++++++++++++++++++++++++++++--- 1 files changed, 34 insertions(+), 3 deletions(-) Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.29 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.30 --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.29 Fri Feb 17 18:55:32 2006 +++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Fri Feb 17 19:27:45 2006 @@ -76,12 +76,14 @@ unsigned getLoopUnswitchCost(Loop *L, Value *LIC); void VersionLoop(Value *LIC, Constant *OnVal, Loop *L, Loop *&Out1, Loop *&Out2); + void UnswitchTrivialCondition(Loop *L, Value *Cond, Constant *Val, + bool EntersWhenTrue, BasicBlock *ExitBlock); BasicBlock *SplitEdge(BasicBlock *From, BasicBlock *To); BasicBlock *SplitBlock(BasicBlock *Old, Instruction *SplitPt); void RewriteLoopBodyWithConditionConstant(Loop *L, Value *LIC,Constant *Val, bool isEqual); - void UnswitchTrivialCondition(Loop *L, Value *Cond, Constant *Val, - bool EntersWhenTrue, BasicBlock *ExitBlock); + bool TryToRemoveEdge(TerminatorInst *TI, unsigned SuccNo, + std::vector &Worklist); }; RegisterOpt X("loop-unswitch", "Unswitch loops"); } @@ -717,7 +719,25 @@ ++NumSimplify; } - +/// TryToRemoveEdge - Determine whether this is a case where we're smart enough +/// to remove the specified edge from the CFG and know how to update loop +/// information. If it is, update SSA and the loop information for the future +/// change, then return true. If not, return false. +bool LoopUnswitch::TryToRemoveEdge(TerminatorInst *TI, unsigned DeadSuccNo, + std::vector &Worklist) { + BasicBlock *BB = TI->getParent(), *Succ = TI->getSuccessor(DeadSuccNo); + Loop *BBLoop = LI->getLoopFor(BB); + Loop *SuccLoop = LI->getLoopFor(Succ); + + // If this edge is not in a loop, or if this edge is leaving a loop to a + // non-loop area, this is trivial. + if (SuccLoop == 0) { + Succ->removePredecessor(BB, true); + return true; + } + + return false; +} // RewriteLoopBodyWithConditionConstant - We know either that the value LIC has // the value specified by Val in the specified loop, or we know it does NOT have @@ -875,7 +895,18 @@ // Remove Succ from the loop tree. LI->removeBlock(Succ); Succ->eraseFromParent(); + ++NumSimplify; break; + } else if (ConstantBool *CB = dyn_cast(BI->getCondition())){ + // Conditional branch. + if (TryToRemoveEdge(BI, CB->getValue(), Worklist)) { + DEBUG(std::cerr << "Folded branch: " << *BI); + new BranchInst(BI->getSuccessor(!CB->getValue()), BI); + BI->eraseFromParent(); + RemoveFromWorklist(BI, Worklist); + ++NumSimplify; + break; + } } break; } From lattner at cs.uiuc.edu Fri Feb 17 19:32:15 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 17 Feb 2006 19:32:15 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Message-ID: <200602180132.TAA04300@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LoopUnswitch.cpp updated: 1.30 -> 1.31 --- Log message: a previous patch completely disabled trivial unswitching, this fixees it. Thanks to nate for pointing this out :) --- Diffs of the changes: (+0 -1) LoopUnswitch.cpp | 1 - 1 files changed, 1 deletion(-) Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.30 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.31 --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.30 Fri Feb 17 19:27:45 2006 +++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Fri Feb 17 19:32:04 2006 @@ -168,7 +168,6 @@ static BasicBlock *isTrivialLoopExitBlock(Loop *L, BasicBlock *BB) { std::set Visited; Visited.insert(L->getHeader()); // Branches to header are ok. - Visited.insert(BB); // Don't revisit BB after we do. BasicBlock *ExitBB = 0; if (isTrivialLoopExitBlockHelper(L, BB, ExitBB, Visited)) return ExitBB; From evan.cheng at apple.com Fri Feb 17 19:49:36 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 17 Feb 2006 19:49:36 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86TargetMachine.cpp Message-ID: <200602180149.TAA04351@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86TargetMachine.cpp updated: 1.103 -> 1.104 --- Log message: Disable PIC for JIT. --- Diffs of the changes: (+3 -0) X86TargetMachine.cpp | 3 +++ 1 files changed, 3 insertions(+) Index: llvm/lib/Target/X86/X86TargetMachine.cpp diff -u llvm/lib/Target/X86/X86TargetMachine.cpp:1.103 llvm/lib/Target/X86/X86TargetMachine.cpp:1.104 --- llvm/lib/Target/X86/X86TargetMachine.cpp:1.103 Thu Feb 16 18:03:04 2006 +++ llvm/lib/Target/X86/X86TargetMachine.cpp Fri Feb 17 19:49:25 2006 @@ -149,6 +149,9 @@ /// not supported for this target. /// void X86JITInfo::addPassesToJITCompile(FunctionPassManager &PM) { + // The JIT does not support or need PIC. + PICEnabled = false; + // FIXME: Implement efficient support for garbage collection intrinsics. PM.add(createLowerGCPass()); From evan.cheng at apple.com Fri Feb 17 20:33:21 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 17 Feb 2006 20:33:21 -0600 Subject: [llvm-commits] CVS: llvm/utils/TableGen/DAGISelEmitter.cpp Message-ID: <200602180233.UAA04624@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: DAGISelEmitter.cpp updated: 1.172 -> 1.173 --- Log message: Bump up pattern cost if the resulting instruction is marked usesCustomDAGSchedInserter. --- Diffs of the changes: (+14 -7) DAGISelEmitter.cpp | 21 ++++++++++++++------- 1 files changed, 14 insertions(+), 7 deletions(-) Index: llvm/utils/TableGen/DAGISelEmitter.cpp diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.172 llvm/utils/TableGen/DAGISelEmitter.cpp:1.173 --- llvm/utils/TableGen/DAGISelEmitter.cpp:1.172 Thu Feb 9 16:12:27 2006 +++ llvm/utils/TableGen/DAGISelEmitter.cpp Fri Feb 17 20:33:09 2006 @@ -1749,12 +1749,19 @@ /// getResultPatternCost - Compute the number of instructions for this pattern. /// This is a temporary hack. We should really include the instruction /// latencies in this calculation. -static unsigned getResultPatternCost(TreePatternNode *P) { +static unsigned getResultPatternCost(TreePatternNode *P, DAGISelEmitter &ISE) { if (P->isLeaf()) return 0; - unsigned Cost = P->getOperator()->isSubClassOf("Instruction"); + unsigned Cost = 0; + Record *Op = P->getOperator(); + if (Op->isSubClassOf("Instruction")) { + Cost++; + CodeGenInstruction &II = ISE.getTargetInfo().getInstruction(Op->getName()); + if (II.usesCustomDAGSchedInserter) + Cost += 10; + } for (unsigned i = 0, e = P->getNumChildren(); i != e; ++i) - Cost += getResultPatternCost(P->getChild(i)); + Cost += getResultPatternCost(P->getChild(i), ISE); return Cost; } @@ -1773,8 +1780,8 @@ if (LHSSize < RHSSize) return false; // If the patterns have equal complexity, compare generated instruction cost - return getResultPatternCost(LHS->getDstPattern()) < - getResultPatternCost(RHS->getDstPattern()); + return getResultPatternCost(LHS->getDstPattern(), ISE) < + getResultPatternCost(RHS->getDstPattern(), ISE); } }; @@ -2748,7 +2755,7 @@ OS << "\n"; OS << std::string(Indent, ' ') << "// Pattern complexity = " << getPatternSize(Pattern.getSrcPattern(), *this) << " cost = " - << getResultPatternCost(Pattern.getDstPattern()) << "\n"; + << getResultPatternCost(Pattern.getDstPattern(), *this) << "\n"; } if (!FirstCodeLine.first) { OS << std::string(Indent, ' ') << "{\n"; @@ -2769,7 +2776,7 @@ OS << "\n"; OS << std::string(Indent, ' ') << "// Pattern complexity = " << getPatternSize(Pattern.getSrcPattern(), *this) << " cost = " - << getResultPatternCost(Pattern.getDstPattern()) << "\n"; + << getResultPatternCost(Pattern.getDstPattern(), *this) << "\n"; } EmitPatterns(Other, Indent, OS); return; From evan.cheng at apple.com Fri Feb 17 20:36:40 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 17 Feb 2006 20:36:40 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86FloatingPoint.cpp X86InstrInfo.td Message-ID: <200602180236.UAA04652@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86FloatingPoint.cpp updated: 1.49 -> 1.50 X86InstrInfo.td updated: 1.238 -> 1.239 --- Log message: Added fisttp for fp to int conversion. --- Diffs of the changes: (+29 -3) X86FloatingPoint.cpp | 17 ++++++++++++++--- X86InstrInfo.td | 15 +++++++++++++++ 2 files changed, 29 insertions(+), 3 deletions(-) Index: llvm/lib/Target/X86/X86FloatingPoint.cpp diff -u llvm/lib/Target/X86/X86FloatingPoint.cpp:1.49 llvm/lib/Target/X86/X86FloatingPoint.cpp:1.50 --- llvm/lib/Target/X86/X86FloatingPoint.cpp:1.49 Thu Jan 26 14:41:32 2006 +++ llvm/lib/Target/X86/X86FloatingPoint.cpp Fri Feb 17 20:36:28 2006 @@ -357,6 +357,9 @@ { X86::FpIST16m , X86::FIST16m }, { X86::FpIST32m , X86::FIST32m }, { X86::FpIST64m , X86::FISTP64m }, + { X86::FpISTT16m , X86::FISTTP16m}, + { X86::FpISTT32m , X86::FISTTP32m}, + { X86::FpISTT64m , X86::FISTTP64m}, { X86::FpISUB16m , X86::FISUB16m }, { X86::FpISUB32m , X86::FISUB32m }, { X86::FpISUBR16m, X86::FISUBR16m}, @@ -502,12 +505,17 @@ unsigned Reg = getFPReg(MI->getOperand(MI->getNumOperands()-1)); bool KillsSrc = LV->KillsRegister(MI, X86::FP0+Reg); - // FISTP64r is strange because there isn't a non-popping versions. + // FISTP64m is strange because there isn't a non-popping versions. // If we have one _and_ we don't want to pop the operand, duplicate the value // on the stack instead of moving it. This ensure that popping the value is // always ok. + // Ditto FISTTP16m, FISTTP32m, FISTTP64m. // - if (MI->getOpcode() == X86::FpIST64m && !KillsSrc) { + if (!KillsSrc && + (MI->getOpcode() == X86::FpIST64m || + MI->getOpcode() == X86::FpISTT16m || + MI->getOpcode() == X86::FpISTT32m || + MI->getOpcode() == X86::FpISTT64m)) { duplicateToTop(Reg, 7 /*temp register*/, I); } else { moveToTop(Reg, I); // Move to the top of the stack... @@ -517,7 +525,10 @@ MI->RemoveOperand(MI->getNumOperands()-1); // Remove explicit ST(0) operand MI->setOpcode(getConcreteOpcode(MI->getOpcode())); - if (MI->getOpcode() == X86::FISTP64m) { + if (MI->getOpcode() == X86::FISTP64m || + MI->getOpcode() == X86::FISTTP16m || + MI->getOpcode() == X86::FISTTP32m || + MI->getOpcode() == X86::FISTTP64m) { assert(StackTop > 0 && "Stack empty??"); --StackTop; } else if (KillsSrc) { // Last use of operand? Index: llvm/lib/Target/X86/X86InstrInfo.td diff -u llvm/lib/Target/X86/X86InstrInfo.td:1.238 llvm/lib/Target/X86/X86InstrInfo.td:1.239 --- llvm/lib/Target/X86/X86InstrInfo.td:1.238 Fri Feb 17 18:15:05 2006 +++ llvm/lib/Target/X86/X86InstrInfo.td Fri Feb 17 20:36:28 2006 @@ -2957,6 +2957,21 @@ def FISTP32m : FPI<0xDB, MRM3m, (ops i32mem:$dst), "fistp{l} $dst">; def FISTP64m : FPI<0xDF, MRM7m, (ops i64mem:$dst), "fistp{ll} $dst">; +// FISTTP requires SSE3 even though it's a FPStack op. +def FpISTT16m : FpI_<(ops i16mem:$op, RFP:$src), OneArgFP, + [(X86fp_to_i16mem RFP:$src, addr:$op)]>, + Requires<[HasSSE3]>; +def FpISTT32m : FpI_<(ops i32mem:$op, RFP:$src), OneArgFP, + [(X86fp_to_i32mem RFP:$src, addr:$op)]>, + Requires<[HasSSE3]>; +def FpISTT64m : FpI_<(ops i64mem:$op, RFP:$src), OneArgFP, + [(X86fp_to_i64mem RFP:$src, addr:$op)]>, + Requires<[HasSSE3]>; + +def FISTTP16m : FPI<0xDF, MRM1m, (ops i16mem:$dst), "fisttp{s} $dst">; +def FISTTP32m : FPI<0xDB, MRM1m, (ops i32mem:$dst), "fisttp{l} $dst">; +def FISTTP64m : FPI<0xDD, MRM1m, (ops i64mem:$dst), "fisttp{ll} $dst">; + // FP Stack manipulation instructions. def FLDrr : FPI<0xC0, AddRegFrm, (ops RST:$op), "fld $op">, D9; def FSTrr : FPI<0xD0, AddRegFrm, (ops RST:$op), "fst $op">, DD; From natebegeman at mac.com Fri Feb 17 20:41:10 2006 From: natebegeman at mac.com (Nate Begeman) Date: Fri, 17 Feb 2006 20:41:10 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp SelectionDAG.cpp Message-ID: <200602180241.UAA04723@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.107 -> 1.108 SelectionDAG.cpp updated: 1.258 -> 1.259 --- Log message: Add checks to make sure we don't create bogus extend nodes, and fix a bug where we were doing exactly that which was causing failures on x86 and alpha. --- Diffs of the changes: (+14 -4) DAGCombiner.cpp | 14 ++++++++++---- SelectionDAG.cpp | 4 ++++ 2 files changed, 14 insertions(+), 4 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.107 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.108 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.107 Fri Feb 17 15:58:01 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Fri Feb 17 20:40:58 2006 @@ -665,6 +665,9 @@ // fold (A+(B-A)) -> B if (N1.getOpcode() == ISD::SUB && N0 == N1.getOperand(1)) return N1.getOperand(0); + // + if (SimplifyDemandedBits(SDOperand(N, 0))) + return SDOperand(); return SDOperand(); } @@ -2297,13 +2300,16 @@ // Get a SetCC of the condition // FIXME: Should probably make sure that setcc is legal if we ever have a // target where it isn't. - SDOperand Temp, SCC = DAG.getSetCC(TLI.getSetCCResultTy(), N0, N1, CC); - WorkList.push_back(SCC.Val); + SDOperand Temp, SCC; // cast from setcc result type to select result type - if (AfterLegalize) + if (AfterLegalize) { + SCC = DAG.getSetCC(TLI.getSetCCResultTy(), N0, N1, CC); Temp = DAG.getZeroExtendInReg(SCC, N2.getValueType()); - else + } else { + SCC = DAG.getSetCC(MVT::i1, N0, N1, CC); Temp = DAG.getNode(ISD::ZERO_EXTEND, N2.getValueType(), SCC); + } + WorkList.push_back(SCC.Val); WorkList.push_back(Temp.Val); // shl setcc result by log2 n2c return DAG.getNode(ISD::SHL, N2.getValueType(), Temp, Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.258 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.259 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.258 Fri Feb 17 15:58:01 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Feb 17 20:40:58 2006 @@ -1047,22 +1047,26 @@ return Operand; // Factor of one node? No factor. case ISD::SIGN_EXTEND: if (Operand.getValueType() == VT) return Operand; // noop extension + assert(Operand.getValueType() < VT && "Invalid sext node, dst < src!"); if (OpOpcode == ISD::SIGN_EXTEND || OpOpcode == ISD::ZERO_EXTEND) return getNode(OpOpcode, VT, Operand.Val->getOperand(0)); break; case ISD::ZERO_EXTEND: if (Operand.getValueType() == VT) return Operand; // noop extension + assert(Operand.getValueType() < VT && "Invalid zext node, dst < src!"); if (OpOpcode == ISD::ZERO_EXTEND) // (zext (zext x)) -> (zext x) return getNode(ISD::ZERO_EXTEND, VT, Operand.Val->getOperand(0)); break; case ISD::ANY_EXTEND: if (Operand.getValueType() == VT) return Operand; // noop extension + assert(Operand.getValueType() < VT && "Invalid anyext node, dst < src!"); if (OpOpcode == ISD::ZERO_EXTEND || OpOpcode == ISD::SIGN_EXTEND) // (ext (zext x)) -> (zext x) and (ext (sext x)) -> (sext x) return getNode(OpOpcode, VT, Operand.Val->getOperand(0)); break; case ISD::TRUNCATE: if (Operand.getValueType() == VT) return Operand; // noop truncate + assert(Operand.getValueType() > VT && "Invalid truncate node, src < dst!"); if (OpOpcode == ISD::TRUNCATE) return getNode(ISD::TRUNCATE, VT, Operand.Val->getOperand(0)); else if (OpOpcode == ISD::ZERO_EXTEND || OpOpcode == ISD::SIGN_EXTEND || From lattner at cs.uiuc.edu Fri Feb 17 20:42:46 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Fri, 17 Feb 2006 20:42:46 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Message-ID: <200602180242.UAA04791@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LoopUnswitch.cpp updated: 1.31 -> 1.32 --- Log message: Implement deletion of dead blocks, currently disabled. --- Diffs of the changes: (+75 -28) LoopUnswitch.cpp | 103 ++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 75 insertions(+), 28 deletions(-) Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.31 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.32 --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.31 Fri Feb 17 19:32:04 2006 +++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Fri Feb 17 20:42:34 2006 @@ -82,8 +82,8 @@ BasicBlock *SplitBlock(BasicBlock *Old, Instruction *SplitPt); void RewriteLoopBodyWithConditionConstant(Loop *L, Value *LIC,Constant *Val, bool isEqual); - bool TryToRemoveEdge(TerminatorInst *TI, unsigned SuccNo, - std::vector &Worklist); + void RemoveBlockIfDead(BasicBlock *BB, + std::vector &Worklist); }; RegisterOpt X("loop-unswitch", "Unswitch loops"); } @@ -718,24 +718,68 @@ ++NumSimplify; } -/// TryToRemoveEdge - Determine whether this is a case where we're smart enough -/// to remove the specified edge from the CFG and know how to update loop -/// information. If it is, update SSA and the loop information for the future -/// change, then return true. If not, return false. -bool LoopUnswitch::TryToRemoveEdge(TerminatorInst *TI, unsigned DeadSuccNo, - std::vector &Worklist) { - BasicBlock *BB = TI->getParent(), *Succ = TI->getSuccessor(DeadSuccNo); - Loop *BBLoop = LI->getLoopFor(BB); - Loop *SuccLoop = LI->getLoopFor(Succ); - - // If this edge is not in a loop, or if this edge is leaving a loop to a - // non-loop area, this is trivial. - if (SuccLoop == 0) { - Succ->removePredecessor(BB, true); - return true; +/// RemoveBlockIfDead - If the specified block is dead, remove it, update loop +/// information, and remove any dead successors it has. +/// +void LoopUnswitch::RemoveBlockIfDead(BasicBlock *BB, + std::vector &Worklist) { + if (pred_begin(BB) != pred_end(BB)) return; // not dead. + + DEBUG(std::cerr << "Nuking dead block: " << *BB); + + // Remove the instructions in the basic block from the worklist. + for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) + RemoveFromWorklist(I, Worklist); + + // If this is the header block for a loop, remove the loop and all subloops. + // We leave all of the blocks that used to be part of this loop in the parent + // loop if any. + if (Loop *BBLoop = LI->getLoopFor(BB)) { + if (BBLoop->getHeader() == BB) { + if (Loop *ParentLoop = BBLoop->getParentLoop()) { // not a top-level loop. + for (Loop::iterator I = ParentLoop->begin(), E = ParentLoop->end();; + ++I) { + assert(I != E && "Couldn't find loop"); + if (*I == BBLoop) { + ParentLoop->removeChildLoop(I); + break; + } + } + } else { + for (LoopInfo::iterator I = LI->begin(), E = LI->end();; ++I) { + assert(I != E && "Couldn't find loop"); + if (*I == BBLoop) { + LI->removeLoop(I); + break; + } + } + } + delete BBLoop; + } } + + // Remove the block from the loop info, which removes it from any loops it + // was in. + LI->removeBlock(BB); - return false; + + // Remove phi node entries in successors for this block. + TerminatorInst *TI = BB->getTerminator(); + std::vector Succs; + for (unsigned i = 0, e = TI->getNumSuccessors(); i != e; ++i) { + Succs.push_back(TI->getSuccessor(i)); + TI->getSuccessor(i)->removePredecessor(BB); + } + + // Unique the successors. + std::sort(Succs.begin(), Succs.end()); + Succs.erase(std::unique(Succs.begin(), Succs.end()), Succs.end()); + + // Remove the basic block, including all of the instructions contained in it. + BB->eraseFromParent(); + + for (unsigned i = 0, e = Succs.size(); i != e; ++i) + RemoveBlockIfDead(Succs[i], Worklist); } // RewriteLoopBodyWithConditionConstant - We know either that the value LIC has @@ -895,17 +939,20 @@ LI->removeBlock(Succ); Succ->eraseFromParent(); ++NumSimplify; - break; } else if (ConstantBool *CB = dyn_cast(BI->getCondition())){ - // Conditional branch. - if (TryToRemoveEdge(BI, CB->getValue(), Worklist)) { - DEBUG(std::cerr << "Folded branch: " << *BI); - new BranchInst(BI->getSuccessor(!CB->getValue()), BI); - BI->eraseFromParent(); - RemoveFromWorklist(BI, Worklist); - ++NumSimplify; - break; - } + break; // FIXME: disabled + // Conditional branch. Turn it into an unconditional branch, then + // remove dead blocks. + DEBUG(std::cerr << "Folded branch: " << *BI); + BasicBlock *DeadSucc = BI->getSuccessor(CB->getValue()); + BasicBlock *LiveSucc = BI->getSuccessor(!CB->getValue()); + DeadSucc->removePredecessor(BI->getParent(), true); + Worklist.push_back(new BranchInst(LiveSucc, BI)); + BI->eraseFromParent(); + RemoveFromWorklist(BI, Worklist); + ++NumSimplify; + + RemoveBlockIfDead(DeadSucc, Worklist); } break; } From natebegeman at mac.com Fri Feb 17 20:43:37 2006 From: natebegeman at mac.com (Nate Begeman) Date: Fri, 17 Feb 2006 20:43:37 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/TargetLowering.cpp Message-ID: <200602180243.UAA04805@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: TargetLowering.cpp updated: 1.32 -> 1.33 --- Log message: Add a fold for add that exchanges it with a constant shift if possible, so that the shift may be more easily folded into other operations. --- Diffs of the changes: (+24 -6) TargetLowering.cpp | 30 ++++++++++++++++++++++++------ 1 files changed, 24 insertions(+), 6 deletions(-) Index: llvm/lib/Target/TargetLowering.cpp diff -u llvm/lib/Target/TargetLowering.cpp:1.32 llvm/lib/Target/TargetLowering.cpp:1.33 --- llvm/lib/Target/TargetLowering.cpp:1.32 Thu Feb 16 20:12:18 2006 +++ llvm/lib/Target/TargetLowering.cpp Fri Feb 17 20:43:25 2006 @@ -459,6 +459,24 @@ CountTrailingZeros_64(~KnownZero2)); KnownZero = (1ULL << KnownZeroOut) - 1; KnownOne = 0; + + SDOperand SH = Op.getOperand(0); + // fold (add (shl x, c1), (shl c2, c1)) -> (shl (add x, c2), c1) + if (KnownZero && SH.getOpcode() == ISD::SHL && SH.Val->hasOneUse() && + Op.Val->hasOneUse()) { + if (ConstantSDNode *SA = dyn_cast(SH.getOperand(1))) { + MVT::ValueType VT = Op.getValueType(); + unsigned ShiftAmt = SA->getValue(); + uint64_t AddAmt = AA->getValue(); + uint64_t AddShr = AddAmt >> ShiftAmt; + if (AddAmt == (AddShr << ShiftAmt)) { + SDOperand ADD = TLO.DAG.getNode(ISD::ADD, VT, SH.getOperand(0), + TLO.DAG.getConstant(AddShr, VT)); + SDOperand SHL = TLO.DAG.getNode(ISD::SHL, VT, ADD,SH.getOperand(1)); + return TLO.CombineTo(Op, SHL); + } + } + } } break; case ISD::CTTZ: @@ -577,7 +595,7 @@ KnownOne <<= SA->getValue(); KnownZero |= (1ULL << SA->getValue())-1; // low bits known zero. } - break; + return; case ISD::SRL: // (ushr X, C1) & C2 == 0 iff (-1 >> C1) & C2 == 0 if (ConstantSDNode *SA = dyn_cast(Op.getOperand(1))) { @@ -585,12 +603,12 @@ HighBits <<= MVT::getSizeInBits(Op.getValueType())-SA->getValue(); Mask <<= SA->getValue(); ComputeMaskedBits(Op.getOperand(0), Mask, KnownZero, KnownOne, Depth+1); - assert((KnownZero & KnownOne) == 0&&"Bits known to be one AND zero?"); + assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); KnownZero >>= SA->getValue(); KnownOne >>= SA->getValue(); KnownZero |= HighBits; // high bits known zero. } - break; + return; case ISD::SRA: if (ConstantSDNode *SA = dyn_cast(Op.getOperand(1))) { uint64_t HighBits = (1ULL << SA->getValue())-1; @@ -611,7 +629,7 @@ KnownOne |= HighBits; } } - break; + return; case ISD::CTTZ: case ISD::CTLZ: case ISD::CTPOP: { @@ -666,12 +684,12 @@ // We know that the top bits of C-X are clear if X contains less bits // than C (i.e. no wrap-around can happen). For example, 20-X is // positive if we can prove that X is >= 0 and < 16. - break; + return; default: // Allow the target to implement this method for its nodes. if (Op.getOpcode() >= ISD::BUILTIN_OP_END) computeMaskedBitsForTargetNode(Op, Mask, KnownZero, KnownOne); - break; + return; } } From jeffc at jolt-lang.org Fri Feb 17 21:20:47 2006 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Fri, 17 Feb 2006 21:20:47 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200602180320.VAA04943@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.436 -> 1.437 --- Log message: Fix bugs identified by VC++. --- Diffs of the changes: (+2 -2) InstructionCombining.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.436 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.437 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.436 Thu Feb 16 15:11:51 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Fri Feb 17 21:20:33 2006 @@ -757,9 +757,9 @@ // If all of the demanded bits are known zero on one side, return the other. // These bits cannot contribute to the result of the 'or'. - if ((DemandedMask & ~KnownOne2 & KnownZero) == DemandedMask & ~KnownOne2) + if ((DemandedMask & ~KnownOne2 & KnownZero) == (DemandedMask & ~KnownOne2)) return UpdateValueUsesWith(I, I->getOperand(0)); - if ((DemandedMask & ~KnownOne & KnownZero2) == DemandedMask & ~KnownOne) + if ((DemandedMask & ~KnownOne & KnownZero2) == (DemandedMask & ~KnownOne)) return UpdateValueUsesWith(I, I->getOperand(1)); // If all of the potentially set bits on one side are known to be set on From jeffc at jolt-lang.org Fri Feb 17 21:20:47 2006 From: jeffc at jolt-lang.org (Jeff Cohen) Date: Fri, 17 Feb 2006 21:20:47 -0600 Subject: [llvm-commits] CVS: llvm/utils/TableGen/Record.cpp Message-ID: <200602180320.VAA04947@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: Record.cpp updated: 1.50 -> 1.51 --- Log message: Fix bugs identified by VC++. --- Diffs of the changes: (+2 -2) Record.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/utils/TableGen/Record.cpp diff -u llvm/utils/TableGen/Record.cpp:1.50 llvm/utils/TableGen/Record.cpp:1.51 --- llvm/utils/TableGen/Record.cpp:1.50 Tue Jan 31 00:02:35 2006 +++ llvm/utils/TableGen/Record.cpp Fri Feb 17 21:20:33 2006 @@ -69,13 +69,13 @@ if (Value & ~((1LL << Size)-1)) return 0; } else { - if ((Value >> Size) != -1 || ((Value & (1 << (Size-1))) == 0)) + if ((Value >> Size) != -1 || ((Value & (1LL << (Size-1))) == 0)) return 0; } BitsInit *Ret = new BitsInit(Size); for (unsigned i = 0; i != Size; ++i) - Ret->setBit(i, new BitInit(Value & (1 << i))); + Ret->setBit(i, new BitInit(Value & (1LL << i))); return Ret; } From evan.cheng at apple.com Sat Feb 18 01:26:29 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Sat, 18 Feb 2006 01:26:29 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200602180726.BAA05946@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.89 -> 1.90 --- Log message: If SSE3 is available, promote FP_TO_UINT i32 to FP_TO_SINT i64 to take advantage of fisttpll. --- Diffs of the changes: (+2 -1) X86ISelLowering.cpp | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.89 llvm/lib/Target/X86/X86ISelLowering.cpp:1.90 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.89 Fri Feb 17 18:15:05 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Sat Feb 18 01:26:17 2006 @@ -101,12 +101,13 @@ setOperationAction(ISD::FP_TO_UINT , MVT::i8 , Promote); setOperationAction(ISD::FP_TO_UINT , MVT::i16 , Promote); - if (X86ScalarSSE) + if (X86ScalarSSE && !Subtarget->hasSSE3()) // Expand FP_TO_UINT into a select. // FIXME: We would like to use a Custom expander here eventually to do // the optimal thing for SSE vs. the default expansion in the legalizer. setOperationAction(ISD::FP_TO_UINT , MVT::i32 , Expand); else + // With SSE3 we can use fisttpll to convert to a signed i64. setOperationAction(ISD::FP_TO_UINT , MVT::i32 , Promote); setOperationAction(ISD::BIT_CONVERT , MVT::f32 , Expand); From lattner at cs.uiuc.edu Sat Feb 18 01:57:50 2006 From: lattner at cs.uiuc.edu (Chris Lattner) Date: Sat, 18 Feb 2006 01:57:50 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Message-ID: <200602180757.BAA06156@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: LoopUnswitch.cpp updated: 1.32 -> 1.33 --- Log message: improved support for branch folding, still not enabled. --- Diffs of the changes: (+269 -143) LoopUnswitch.cpp | 412 +++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 269 insertions(+), 143 deletions(-) Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.32 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.33 --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.32 Fri Feb 17 20:42:34 2006 +++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Sat Feb 18 01:57:38 2006 @@ -36,6 +36,7 @@ #include "llvm/Transforms/Utils/Local.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" #include "llvm/ADT/Statistic.h" +#include "llvm/ADT/PostOrderIterator.h" #include "llvm/Support/Debug.h" #include "llvm/Support/CommandLine.h" #include @@ -57,6 +58,9 @@ class LoopUnswitch : public FunctionPass { LoopInfo *LI; // Loop information + + // LoopProcessWorklist - List of loops we need to process. + std::vector LoopProcessWorklist; public: virtual bool runOnFunction(Function &F); bool visitLoop(Loop *L); @@ -72,18 +76,30 @@ } private: + /// RemoveLoopFromWorklist - If the specified loop is on the loop worklist, + /// remove it. + void RemoveLoopFromWorklist(Loop *L) { + std::vector::iterator I = std::find(LoopProcessWorklist.begin(), + LoopProcessWorklist.end(), L); + if (I != LoopProcessWorklist.end()) + LoopProcessWorklist.erase(I); + } + bool UnswitchIfProfitable(Value *LoopCond, Constant *Val,Loop *L); unsigned getLoopUnswitchCost(Loop *L, Value *LIC); - void VersionLoop(Value *LIC, Constant *OnVal, - Loop *L, Loop *&Out1, Loop *&Out2); void UnswitchTrivialCondition(Loop *L, Value *Cond, Constant *Val, bool EntersWhenTrue, BasicBlock *ExitBlock); + void UnswitchNontrivialCondition(Value *LIC, Constant *OnVal, Loop *L); BasicBlock *SplitEdge(BasicBlock *From, BasicBlock *To); BasicBlock *SplitBlock(BasicBlock *Old, Instruction *SplitPt); - void RewriteLoopBodyWithConditionConstant(Loop *L, Value *LIC,Constant *Val, - bool isEqual); + + void RewriteLoopBodyWithConditionConstant(Loop *L, Value *LIC, + Constant *Val, bool isEqual); + + void SimplifyCode(std::vector &Worklist); void RemoveBlockIfDead(BasicBlock *BB, std::vector &Worklist); + void RemoveLoopFromHierarchy(Loop *L); }; RegisterOpt X("loop-unswitch", "Unswitch loops"); } @@ -94,12 +110,95 @@ bool Changed = false; LI = &getAnalysis(); - // Transform all the top-level loops. Copy the loop list so that the child - // can update the loop tree if it needs to delete the loop. - std::vector SubLoops(LI->begin(), LI->end()); - for (unsigned i = 0, e = SubLoops.size(); i != e; ++i) - Changed |= visitLoop(SubLoops[i]); + // Populate the worklist of loops to process in post-order. + for (LoopInfo::iterator I = LI->begin(), E = LI->end(); I != E; ++I) + for (po_iterator LI = po_begin(*I), E = po_end(*I); LI != E; ++LI) + LoopProcessWorklist.push_back(*LI); + + // Process the loops in worklist order, this is a post-order visitation of + // the loops. We use a worklist of loops so that loops can be removed at any + // time if they are deleted (e.g. the backedge of a loop is removed). + while (!LoopProcessWorklist.empty()) { + Loop *L = LoopProcessWorklist.back(); + LoopProcessWorklist.pop_back(); + Changed |= visitLoop(L); + } + + return Changed; +} +/// FindLIVLoopCondition - Cond is a condition that occurs in L. If it is +/// invariant in the loop, or has an invariant piece, return the invariant. +/// Otherwise, return null. +static Value *FindLIVLoopCondition(Value *Cond, Loop *L, bool &Changed) { + // Constants should be folded, not unswitched on! + if (isa(Cond)) return false; + + // TODO: Handle: br (VARIANT|INVARIANT). + // TODO: Hoist simple expressions out of loops. + if (L->isLoopInvariant(Cond)) return Cond; + + if (BinaryOperator *BO = dyn_cast(Cond)) + if (BO->getOpcode() == Instruction::And || + BO->getOpcode() == Instruction::Or) { + // If either the left or right side is invariant, we can unswitch on this, + // which will cause the branch to go away in one loop and the condition to + // simplify in the other one. + if (Value *LHS = FindLIVLoopCondition(BO->getOperand(0), L, Changed)) + return LHS; + if (Value *RHS = FindLIVLoopCondition(BO->getOperand(1), L, Changed)) + return RHS; + } + + return 0; +} + +bool LoopUnswitch::visitLoop(Loop *L) { + bool Changed = false; + + // Loop over all of the basic blocks in the loop. If we find an interior + // block that is branching on a loop-invariant condition, we can unswitch this + // loop. + for (Loop::block_iterator I = L->block_begin(), E = L->block_end(); + I != E; ++I) { + TerminatorInst *TI = (*I)->getTerminator(); + if (BranchInst *BI = dyn_cast(TI)) { + // If this isn't branching on an invariant condition, we can't unswitch + // it. + if (BI->isConditional()) { + // See if this, or some part of it, is loop invariant. If so, we can + // unswitch on it if we desire. + Value *LoopCond = FindLIVLoopCondition(BI->getCondition(), L, Changed); + if (LoopCond && UnswitchIfProfitable(LoopCond, ConstantBool::True, L)) { + ++NumBranches; + return true; + } + } + } else if (SwitchInst *SI = dyn_cast(TI)) { + Value *LoopCond = FindLIVLoopCondition(SI->getCondition(), L, Changed); + if (LoopCond && SI->getNumCases() > 1) { + // Find a value to unswitch on: + // FIXME: this should chose the most expensive case! + Constant *UnswitchVal = SI->getCaseValue(1); + if (UnswitchIfProfitable(LoopCond, UnswitchVal, L)) { + ++NumSwitches; + return true; + } + } + } + + // Scan the instructions to check for unswitchable values. + for (BasicBlock::iterator BBI = (*I)->begin(), E = (*I)->end(); + BBI != E; ++BBI) + if (SelectInst *SI = dyn_cast(BBI)) { + Value *LoopCond = FindLIVLoopCondition(SI->getCondition(), L, Changed); + if (LoopCond && UnswitchIfProfitable(LoopCond, ConstantBool::True, L)) { + ++NumSelects; + return true; + } + } + } + return Changed; } @@ -165,6 +264,9 @@ return true; } +/// isTrivialLoopExitBlock - Return true if the specified block unconditionally +/// leads to an exit from the specified loop, and has no side-effects in the +/// process. If so, return the block that is exited to, otherwise return null. static BasicBlock *isTrivialLoopExitBlock(Loop *L, BasicBlock *BB) { std::set Visited; Visited.insert(L->getHeader()); // Branches to header are ok. @@ -266,88 +368,6 @@ return Cost; } -/// FindLIVLoopCondition - Cond is a condition that occurs in L. If it is -/// invariant in the loop, or has an invariant piece, return the invariant. -/// Otherwise, return null. -static Value *FindLIVLoopCondition(Value *Cond, Loop *L, bool &Changed) { - // Constants should be folded, not unswitched on! - if (isa(Cond)) return false; - - // TODO: Handle: br (VARIANT|INVARIANT). - // TODO: Hoist simple expressions out of loops. - if (L->isLoopInvariant(Cond)) return Cond; - - if (BinaryOperator *BO = dyn_cast(Cond)) - if (BO->getOpcode() == Instruction::And || - BO->getOpcode() == Instruction::Or) { - // If either the left or right side is invariant, we can unswitch on this, - // which will cause the branch to go away in one loop and the condition to - // simplify in the other one. - if (Value *LHS = FindLIVLoopCondition(BO->getOperand(0), L, Changed)) - return LHS; - if (Value *RHS = FindLIVLoopCondition(BO->getOperand(1), L, Changed)) - return RHS; - } - - return 0; -} - -bool LoopUnswitch::visitLoop(Loop *L) { - bool Changed = false; - - // Recurse through all subloops before we process this loop. Copy the loop - // list so that the child can update the loop tree if it needs to delete the - // loop. - std::vector SubLoops(L->begin(), L->end()); - for (unsigned i = 0, e = SubLoops.size(); i != e; ++i) - Changed |= visitLoop(SubLoops[i]); - - // Loop over all of the basic blocks in the loop. If we find an interior - // block that is branching on a loop-invariant condition, we can unswitch this - // loop. - for (Loop::block_iterator I = L->block_begin(), E = L->block_end(); - I != E; ++I) { - TerminatorInst *TI = (*I)->getTerminator(); - if (BranchInst *BI = dyn_cast(TI)) { - // If this isn't branching on an invariant condition, we can't unswitch - // it. - if (BI->isConditional()) { - // See if this, or some part of it, is loop invariant. If so, we can - // unswitch on it if we desire. - Value *LoopCond = FindLIVLoopCondition(BI->getCondition(), L, Changed); - if (LoopCond && UnswitchIfProfitable(LoopCond, ConstantBool::True, L)) { - ++NumBranches; - return true; - } - } - } else if (SwitchInst *SI = dyn_cast(TI)) { - Value *LoopCond = FindLIVLoopCondition(SI->getCondition(), L, Changed); - if (LoopCond && SI->getNumCases() > 1) { - // Find a value to unswitch on: - // FIXME: this should chose the most expensive case! - Constant *UnswitchVal = SI->getCaseValue(1); - if (UnswitchIfProfitable(LoopCond, UnswitchVal, L)) { - ++NumSwitches; - return true; - } - } - } - - // Scan the instructions to check for unswitchable values. - for (BasicBlock::iterator BBI = (*I)->begin(), E = (*I)->end(); - BBI != E; ++BBI) - if (SelectInst *SI = dyn_cast(BBI)) { - Value *LoopCond = FindLIVLoopCondition(SI->getCondition(), L, Changed); - if (LoopCond && UnswitchIfProfitable(LoopCond, ConstantBool::True, L)) { - ++NumSelects; - return true; - } - } - } - - return Changed; -} - /// UnswitchIfProfitable - We have found that we can unswitch L when /// LoopCond == Val to simplify the loop. If we decide that this is profitable, /// unswitch the loop, reprocess the pieces, then return true. @@ -372,9 +392,6 @@ return false; } - //std::cerr << "BEFORE:\n"; LI->dump(); - Loop *NewLoop1 = 0, *NewLoop2 = 0; - // If this is a trivial condition to unswitch (which results in no code // duplication), do it now. Constant *CondVal; @@ -383,16 +400,10 @@ if (IsTrivialUnswitchCondition(L, LoopCond, &CondVal, &EntersWhenTrue, &ExitBlock)) { UnswitchTrivialCondition(L, LoopCond, CondVal, EntersWhenTrue, ExitBlock); - NewLoop1 = L; } else { - VersionLoop(LoopCond, Val, L, NewLoop1, NewLoop2); + UnswitchNontrivialCondition(LoopCond, Val, L); } - - //std::cerr << "AFTER:\n"; LI->dump(); - - // Try to unswitch each of our new loops now! - if (NewLoop1) visitLoop(NewLoop1); - if (NewLoop2) visitLoop(NewLoop2); + return true; } @@ -549,6 +560,9 @@ } OrigPH->getTerminator()->eraseFromParent(); + // We need to reprocess this loop, it could be unswitched again. + LoopProcessWorklist.push_back(L); + // Now that we know that the loop is never entered when this condition is a // particular value, rewrite the loop with this info. We know that this will // at least eliminate the old branch. @@ -560,10 +574,9 @@ /// VersionLoop - We determined that the loop is profitable to unswitch when LIC /// equal Val. Split it into loop versions and test the condition outside of /// either loop. Return the loops created as Out1/Out2. -void LoopUnswitch::VersionLoop(Value *LIC, Constant *Val, Loop *L, - Loop *&Out1, Loop *&Out2) { +void LoopUnswitch::UnswitchNontrivialCondition(Value *LIC, Constant *Val, + Loop *L) { Function *F = L->getHeader()->getParent(); - DEBUG(std::cerr << "loop-unswitch: Unswitching loop %" << L->getHeader()->getName() << " [" << L->getBlocks().size() << " blocks] in Function " << F->getName() @@ -675,13 +688,18 @@ // Emit the new branch that selects between the two versions of this loop. EmitPreheaderBranchOnCondition(LIC, Val, NewBlocks[0], LoopBlocks[0], OldBR); OldBR->eraseFromParent(); + + LoopProcessWorklist.push_back(L); + LoopProcessWorklist.push_back(NewLoop); // Now we rewrite the original code to know that the condition is true and the // new code to know that the condition is false. - RewriteLoopBodyWithConditionConstant(L, LIC, Val, false); - RewriteLoopBodyWithConditionConstant(NewLoop, LIC, Val, true); - Out1 = L; - Out2 = NewLoop; + RewriteLoopBodyWithConditionConstant(L , LIC, Val, false); + + // It's possible that simplifying one loop could cause the other to be + // deleted. If so, don't simplify it. + if (!LoopProcessWorklist.empty() && LoopProcessWorklist.back() == NewLoop) + RewriteLoopBodyWithConditionConstant(NewLoop, LIC, Val, true); } /// RemoveFromWorklist - Remove all instances of I from the worklist vector @@ -723,39 +741,60 @@ /// void LoopUnswitch::RemoveBlockIfDead(BasicBlock *BB, std::vector &Worklist) { - if (pred_begin(BB) != pred_end(BB)) return; // not dead. + if (pred_begin(BB) != pred_end(BB)) { + // This block isn't dead, since an edge to BB was just removed, see if there + // are any easy simplifications we can do now. + if (BasicBlock *Pred = BB->getSinglePredecessor()) { + // If it has one pred, fold phi nodes in BB. + while (isa(BB->begin())) + ReplaceUsesOfWith(BB->begin(), + cast(BB->begin())->getIncomingValue(0), + Worklist); + + // If this is the header of a loop and the only pred is the latch, we now + // have an unreachable loop. + if (Loop *L = LI->getLoopFor(BB)) + if (L->getHeader() == BB && L->contains(Pred)) { + // Remove the branch from the latch to the header block, this makes + // the header dead, which will make the latch dead (because the header + // dominates the latch). + Pred->getTerminator()->eraseFromParent(); + new UnreachableInst(Pred); + + // The loop is now broken, remove it from LI. + RemoveLoopFromHierarchy(L); + + // Reprocess the header, which now IS dead. + RemoveBlockIfDead(BB, Worklist); + return; + } + + // If pred ends in a uncond branch, add uncond branch to worklist so that + // the two blocks will get merged. + if (BranchInst *BI = dyn_cast(Pred->getTerminator())) + if (BI->isUnconditional()) + Worklist.push_back(BI); + } + return; + } DEBUG(std::cerr << "Nuking dead block: " << *BB); // Remove the instructions in the basic block from the worklist. - for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) + for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) { RemoveFromWorklist(I, Worklist); + + // Anything that uses the instructions in this basic block should have their + // uses replaced with undefs. + if (!I->use_empty()) + I->replaceAllUsesWith(UndefValue::get(I->getType())); + } - // If this is the header block for a loop, remove the loop and all subloops. - // We leave all of the blocks that used to be part of this loop in the parent - // loop if any. + // If this is the edge to the header block for a loop, remove the loop and + // promote all subloops. if (Loop *BBLoop = LI->getLoopFor(BB)) { - if (BBLoop->getHeader() == BB) { - if (Loop *ParentLoop = BBLoop->getParentLoop()) { // not a top-level loop. - for (Loop::iterator I = ParentLoop->begin(), E = ParentLoop->end();; - ++I) { - assert(I != E && "Couldn't find loop"); - if (*I == BBLoop) { - ParentLoop->removeChildLoop(I); - break; - } - } - } else { - for (LoopInfo::iterator I = LI->begin(), E = LI->end();; ++I) { - assert(I != E && "Couldn't find loop"); - if (*I == BBLoop) { - LI->removeLoop(I); - break; - } - } - } - delete BBLoop; - } + if (BBLoop->getLoopLatch() == BB) + RemoveLoopFromHierarchy(BBLoop); } // Remove the block from the loop info, which removes it from any loops it @@ -771,17 +810,94 @@ TI->getSuccessor(i)->removePredecessor(BB); } - // Unique the successors. + // Unique the successors, remove anything with multiple uses. std::sort(Succs.begin(), Succs.end()); Succs.erase(std::unique(Succs.begin(), Succs.end()), Succs.end()); // Remove the basic block, including all of the instructions contained in it. BB->eraseFromParent(); + // Remove successor blocks here that are not dead, so that we know we only + // have dead blocks in this list. Nondead blocks have a way of becoming dead, + // then getting removed before we revisit them, which is badness. + // + for (unsigned i = 0; i != Succs.size(); ++i) + if (pred_begin(Succs[i]) != pred_end(Succs[i])) { + // One exception is loop headers. If this block was the preheader for a + // loop, then we DO want to visit the loop so the loop gets deleted. + // We know that if the successor is a loop header, that this loop had to + // be the preheader: the case where this was the latch block was handled + // above and headers can only have two predecessors. + if (!LI->isLoopHeader(Succs[i])) { + Succs.erase(Succs.begin()+i); + --i; + } + } + for (unsigned i = 0, e = Succs.size(); i != e; ++i) RemoveBlockIfDead(Succs[i], Worklist); } +/// RemoveLoopFromHierarchy - We have discovered that the specified loop has +/// become unwrapped, either because the backedge was deleted, or because the +/// edge into the header was removed. If the edge into the header from the +/// latch block was removed, the loop is unwrapped but subloops are still alive, +/// so they just reparent loops. If the loops are actually dead, they will be +/// removed later. +void LoopUnswitch::RemoveLoopFromHierarchy(Loop *L) { + if (Loop *ParentLoop = L->getParentLoop()) { // Not a top-level loop. + // Reparent all of the blocks in this loop. Since BBLoop had a parent, + // they are now all in it. + for (Loop::block_iterator I = L->block_begin(), E = L->block_end(); + I != E; ++I) + if (LI->getLoopFor(*I) == L) // Don't change blocks in subloops. + LI->changeLoopFor(*I, ParentLoop); + + // Remove the loop from its parent loop. + for (Loop::iterator I = ParentLoop->begin(), E = ParentLoop->end();; + ++I) { + assert(I != E && "Couldn't find loop"); + if (*I == L) { + ParentLoop->removeChildLoop(I); + break; + } + } + + // Move all subloops into the parent loop. + while (L->begin() != L->end()) + ParentLoop->addChildLoop(L->removeChildLoop(L->end()-1)); + } else { + // Reparent all of the blocks in this loop. Since BBLoop had no parent, + // they no longer in a loop at all. + + for (unsigned i = 0; i != L->getBlocks().size(); ++i) { + // Don't change blocks in subloops. + if (LI->getLoopFor(L->getBlocks()[i]) == L) { + LI->removeBlock(L->getBlocks()[i]); + --i; + } + } + + // Remove the loop from the top-level LoopInfo object. + for (LoopInfo::iterator I = LI->begin(), E = LI->end();; ++I) { + assert(I != E && "Couldn't find loop"); + if (*I == L) { + LI->removeLoop(I); + break; + } + } + + // Move all of the subloops to the top-level. + while (L->begin() != L->end()) + LI->addTopLevelLoop(L->removeChildLoop(L->end()-1)); + } + + delete L; + RemoveLoopFromWorklist(L); +} + + + // RewriteLoopBodyWithConditionConstant - We know either that the value LIC has // the value specified by Val in the specified loop, or we know it does NOT have // that value. Rewrite any uses of LIC or of properties correlated to it. @@ -805,9 +921,8 @@ // FOLD boolean conditions (X|LIC), (X&LIC). Fold conditional branches, // selects, switches. std::vector Users(LIC->use_begin(), LIC->use_end()); - std::vector Worklist; - + // If we know that LIC == Val, or that LIC == NotVal, just replace uses of LIC // in the loop with the appropriate one directly. if (IsEqual || NotVal) { @@ -849,10 +964,21 @@ // LIC == Val -> false. } } - - // Okay, now that we have simplified some instructions in the loop, walk over - // it and constant prop, dce, and fold control flow where possible. Note that - // this is effectively a very simple loop-structure-aware optimizer. + + SimplifyCode(Worklist); +} + +/// SimplifyCode - Okay, now that we have simplified some instructions in the +/// loop, walk over it and constant prop, dce, and fold control flow where +/// possible. Note that this is effectively a very simple loop-structure-aware +/// optimizer. During processing of this loop, L could very well be deleted, so +/// it must not be used. +/// +/// FIXME: When the loop optimizer is more mature, separate this out to a new +/// pass. +/// +void LoopUnswitch::SimplifyCode(std::vector &Worklist) { + Worklist.back()->getParent()->getParent()->viewCFG(); while (!Worklist.empty()) { Instruction *I = Worklist.back(); Worklist.pop_back(); @@ -940,7 +1066,7 @@ Succ->eraseFromParent(); ++NumSimplify; } else if (ConstantBool *CB = dyn_cast(BI->getCondition())){ - break; // FIXME: disabled + break; // FIXME: Enable. // Conditional branch. Turn it into an unconditional branch, then // remove dead blocks. DEBUG(std::cerr << "Folded branch: " << *BI);