From alenhar2 at cs.uiuc.edu Mon Sep 25 09:05:07 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Mon, 25 Sep 2006 09:05:07 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/Alpha/jmp_table.ll Message-ID: <200609251405.k8PE572a028756@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/Alpha: jmp_table.ll updated: 1.1 -> 1.2 --- Log message: Fix --- Diffs of the changes: (+2 -2) jmp_table.ll | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/test/Regression/CodeGen/Alpha/jmp_table.ll diff -u llvm/test/Regression/CodeGen/Alpha/jmp_table.ll:1.1 llvm/test/Regression/CodeGen/Alpha/jmp_table.ll:1.2 --- llvm/test/Regression/CodeGen/Alpha/jmp_table.ll:1.1 Sun Sep 24 14:42:02 2006 +++ llvm/test/Regression/CodeGen/Alpha/jmp_table.ll Mon Sep 25 09:04:53 2006 @@ -1,6 +1,6 @@ ; try to check that we have the most important instructions, which shouldn't appear otherwise -; RUN: llvm-as < %s | llc -march=alpha | grep 'jmp' -; RUN: llvm-as < %s | llc -march=alpha | grep 'gprel32' +; RUN: llvm-as < %s | llc -march=alpha | grep 'jmp' && +; RUN: llvm-as < %s | llc -march=alpha | grep 'gprel32' && ; RUN: llvm-as < %s | llc -march=alpha | grep 'ldl' target endian = little From jlaskey at apple.com Mon Sep 25 11:30:08 2006 From: jlaskey at apple.com (Jim Laskey) Date: Mon, 25 Sep 2006 11:30:08 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200609251630.k8PGU82o031121@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.197 -> 1.198 --- Log message: Core antialiasing for load and store. --- Diffs of the changes: (+282 -53) DAGCombiner.cpp | 335 +++++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 282 insertions(+), 53 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.197 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.198 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.197 Thu Sep 21 14:04:05 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Sep 25 11:29:54 2006 @@ -39,6 +39,7 @@ #include #include #include +#include using namespace llvm; namespace { @@ -132,7 +133,8 @@ // Replace the old value with the new one. ++NodesCombined; DEBUG(std::cerr << "\nReplacing "; TLO.Old.Val->dump(); - std::cerr << "\nWith: "; TLO.New.Val->dump(&DAG)); + std::cerr << "\nWith: "; TLO.New.Val->dump(&DAG); + std::cerr << '\n'); std::vector NowDead; DAG.ReplaceAllUsesOfValueWith(TLO.Old, TLO.New, NowDead); @@ -237,7 +239,31 @@ SDOperand BuildSDIV(SDNode *N); SDOperand BuildUDIV(SDNode *N); SDNode *MatchRotate(SDOperand LHS, SDOperand RHS); - bool isNotAlias(SDOperand Ptr1, SDOperand Ptr2); + + /// FindBaseOffset - Return true if we can determine base and offset + /// information from a given pointer operand. Provides base and offset as a + /// result. + static bool FindBaseOffset(SDOperand Ptr, + SDOperand &Object, int64_t &Offset); + + /// isAlias - Return true if there is the possibility that the two addresses + /// overlap. + static bool isAlias(SDOperand Ptr1, int64_t Size1, SDOperand SrcValue1, + SDOperand Ptr2, int64_t Size2, SDOperand SrcValue2); + + /// FindAliasInfo - Extracts the relevant alias information from the memory + /// node. + static void FindAliasInfo(SDNode *N, + SDOperand &Ptr, int64_t &Size, SDOperand &SrcValue); + + /// hasChain - Return true if Op has a chain. Provides chain if present. + /// + static bool hasChain(SDOperand Op, SDOperand &Chain); + + /// FindBetterChain - Walk up chain skipping non-aliasing memory nodes, + /// looking for a better chain. + SDOperand FindBetterChain(SDNode *N, SDOperand Chain); + public: DAGCombiner(SelectionDAG &D) : DAG(D), TLI(D.getTargetLoweringInfo()), AfterLegalize(false) {} @@ -507,9 +533,6 @@ } SDOperand DAGCombiner::visitTokenFactor(SDNode *N) { - SmallVector Ops; - bool Changed = false; - // If the token factor has two operands and one is the entry token, replace // the token factor with the other operand. if (N->getNumOperands() == 2) { @@ -520,23 +543,69 @@ return N->getOperand(0); } - // fold (tokenfactor (tokenfactor)) -> tokenfactor - for (unsigned i = 0, e = N->getNumOperands(); i != e; ++i) { + SmallVector TFs; // Set of token factor nodes. + SmallVector Ops; // Ops for replacing token factor. + + // Add this ndoe to the token factor set. + TFs.push_back(N); + + // Separate token factors from other operands. + for (unsigned i = 0, ie = N->getNumOperands(); i != ie; ++i) { SDOperand Op = N->getOperand(i); - if (Op.getOpcode() == ISD::TokenFactor && Op.hasOneUse()) { - AddToWorkList(Op.Val); // Remove dead node. - Changed = true; - for (unsigned j = 0, e = Op.getNumOperands(); j != e; ++j) - Ops.push_back(Op.getOperand(j)); - } else if (i == 0 || N->getOperand(i) != N->getOperand(i-1)) { + if (Op.getOpcode() == ISD::TokenFactor) + TFs.push_back(Op.Val); + else if (Op.getOpcode() != ISD::EntryToken) Ops.push_back(Op); - } else { - // Deleted an operand that was the same as the last one. - Changed = true; + } + + // If there are token factor operands. + if (TFs.size() > 1) { + bool Changed = false; // If we should replace this token factor. + + // For each token factor. + for (unsigned j = 1, je = TFs.size(); j != je; ++j) { + SDNode *TF = TFs[j]; + bool CanMerge = true; // Can we merge this token factor. + + if (CombinerAA) { + if (!TF->hasOneUse()) { + // Check to see if all users point to members of the token factor set. + for (SDNode::use_iterator UI = TF->use_begin(), UE = TF->use_end(); + CanMerge && UI != UE; ++UI) { + SDNode *User = *UI; + CanMerge = User->getOpcode() == ISD::TokenFactor && + std::find(TFs.begin(), TFs.end(), User) != TFs.end(); + } + } + } else { + CanMerge = TF->hasOneUse(); + } + + // If it's valid to merge. + if (CanMerge) { + // Remove dead token factor node. + AddToWorkList(TF); + + // Make sure we don't duplicate operands. + unsigned m = Ops.size(); // Number of prior operands. + for (unsigned l = 0, le = TF->getNumOperands(); l != le; ++l) { + SDOperand Op = TF->getOperand(l); + if (std::find(Ops.begin(), Ops.end(), Op) == Ops.end()) + Ops.push_back(Op); + } + Changed = true; + } else { + // Can't merge this token factor. + Ops.push_back(SDOperand(TF, 0)); + } + } + + // If we've change things around then replace token factor. + if (Changed) { + return DAG.getNode(ISD::TokenFactor, MVT::Other, &Ops[0], Ops.size()); } } - if (Changed) - return DAG.getNode(ISD::TokenFactor, MVT::Other, &Ops[0], Ops.size()); + return SDOperand(); } @@ -2571,6 +2640,27 @@ Chain.getOperand(1).getValueType() == N->getValueType(0)) return CombineTo(N, Chain.getOperand(1), Chain); + if (CombinerAA) { + // Walk up chain skipping non-aliasing memory nodes. + SDOperand BetterChain = FindBetterChain(N, Chain); + + // If the there is a better chain. + if (Chain != BetterChain) { + // Replace the chain to void dependency. + SDOperand ReplLoad = DAG.getLoad(N->getValueType(0), BetterChain, Ptr, + SrcValue); + + // Replace uses with token. + CombineTo(N, ReplLoad.getValue(0), ReplLoad.getValue(1)); + + // Old chain needs to be cleaned up. + AddToWorkList(Chain.Val); + + // Don't recombine on token. + return SDOperand(N, 0); + } + } + return SDOperand(); } @@ -2589,27 +2679,6 @@ return SDOperand(); } -/// isNotAlias - Return true if we have definitive knowlege that the two -/// addresses don't overlap. -bool DAGCombiner::isNotAlias(SDOperand Ptr1, SDOperand Ptr2) { - // Mind the flag. - if (!CombinerAA) return false; - - // If they are the same then they must be aliases. - if (Ptr1 == Ptr2) return false; - - // If both operands are frame values (not the same location from above test) - // then they can't alias. - FrameIndexSDNode *FI1 = dyn_cast(Ptr1); - FrameIndexSDNode *FI2 = dyn_cast(Ptr2); - if (FI1 && FI2) { - return true; - } - - // Otherwise we don't know and have to play it safe. - return false; -} - SDOperand DAGCombiner::visitSTORE(SDNode *N) { SDOperand Chain = N->getOperand(0); SDOperand Value = N->getOperand(1); @@ -2637,22 +2706,33 @@ // If this is a store of a bit convert, store the input value. // FIXME: This needs to know that the resultant store does not need a // higher alignment than the original. - if (0 && Value.getOpcode() == ISD::BIT_CONVERT) + if (Value.getOpcode() == ISD::BIT_CONVERT) { return DAG.getNode(ISD::STORE, MVT::Other, Chain, Value.getOperand(0), Ptr, SrcValue); - - // If the previous store is not an alias then break artificial chain. - if (Chain.getOpcode() == ISD::STORE && isNotAlias(Ptr, Chain.getOperand(2))) { - // Replace the chain to void dependency. - SDNode *PrevStore = Chain.Val; - SDOperand ReplStore = DAG.getNode(ISD::STORE, MVT::Other, - PrevStore->getOperand(0), Value, Ptr, - SrcValue); - // Create token to keep both stores around. - SDOperand Token = DAG.getNode(ISD::TokenFactor, MVT::Other, - Chain, ReplStore); - // Replace uses with token. - return Token; + } + + if (CombinerAA) { + // Walk up chain skipping non-aliasing memory nodes. + SDOperand BetterChain = FindBetterChain(N, Chain); + + // If the there is a better chain. + if (Chain != BetterChain) { + // Replace the chain to void dependency. + SDOperand ReplStore = DAG.getNode(ISD::STORE, MVT::Other, + BetterChain, Value, Ptr, + SrcValue); + // Create token to keep both nodes around. + SDOperand Token = DAG.getNode(ISD::TokenFactor, MVT::Other, + Chain, ReplStore); + + // Make sure we merge token factors. + AddUsersToWorkList(N); + + // Old chain needs to be cleaned up. + AddToWorkList(Chain.Val); + + return Token; + } } return SDOperand(); @@ -3860,6 +3940,155 @@ return S; } +/// FindBaseOffset - Return true if we can determine base and offset information +/// from a given pointer operand. Provides base and offset as a result. +bool DAGCombiner::FindBaseOffset(SDOperand Ptr, + SDOperand &Object, int64_t &Offset) { + + // Is it a frame variable, global or constant. + if (isa(Ptr) || + isa(Ptr) || + isa(Ptr)) { + Object = Ptr; Offset = 0; + return true; + } else if (Ptr.getOpcode() == ISD::ADD && + FindBaseOffset(Ptr.getOperand(0), Object, Offset)) { + // If it's an add of an simple constant then include it in the offset. + if (ConstantSDNode *C = dyn_cast(Ptr.getOperand(1))) { + Offset += C->getValue(); + return true; + } + } + + return false; +} + +/// isAlias - Return true if there is the possibility that the two addresses +/// overlap. +bool DAGCombiner::isAlias(SDOperand Ptr1, int64_t Size1, + SDOperand SrcValue1, + SDOperand Ptr2, int64_t Size2, + SDOperand SrcValue2) { + // If they are the same then they must be aliases. + if (Ptr1 == Ptr2) return true; + + // Gather base offset information. Objects can be frame variables, globals + // or constants. + SDOperand Object1, Object2; + int64_t Offset1, Offset2; + if (FindBaseOffset(Ptr1, Object1, Offset1) && + FindBaseOffset(Ptr2, Object2, Offset2)) { + // If they have a different base address, then they can't alias. + if (Object1 != Object2) return false; + + // Check to see if the addresses overlap. + if ((Offset1 + Size1) <= Offset2 || (Offset2 + Size2) <= Offset1) + return false; + } + + // Otherwise we don't know and have to play it safe. + return true; +} + +/// FindAliasInfo - Extracts the relevant alias information from the memory +/// node. +void DAGCombiner::FindAliasInfo(SDNode *N, + SDOperand &Ptr, int64_t &Size, SDOperand &SrcValue) { + switch (N->getOpcode()) { + case ISD::LOAD: + Ptr = N->getOperand(1); + Size = MVT::getSizeInBits(N->getOperand(1).getValueType()) >> 3; + SrcValue = N->getOperand(2); + break; + case ISD::STORE: + Ptr = N->getOperand(2); + Size = MVT::getSizeInBits(N->getOperand(1).getValueType()) >> 3; + SrcValue = N->getOperand(3); + break; + default: + assert(0 && "getAliasInfo expected a memory op"); + } +} + +/// hasChain - Return true if Op has a chain. Provides chain if present. +/// +bool DAGCombiner::hasChain(SDOperand Op, SDOperand &Chain) { + if (Op.getNumOperands() == 0) return false; + Chain = Op.getOperand(0); + return Chain.getValueType() == MVT::Other; +} + +/// FindBetterChain - Walk up chain skipping non-aliasing memory nodes, looking +/// for a better chain. +SDOperand DAGCombiner::FindBetterChain(SDNode *N, SDOperand Chain) { + // Get alias information for node. + SDOperand Ptr; + int64_t Size; + SDOperand SrcValue; + FindAliasInfo(N, Ptr, Size, SrcValue); + + // While we don't encounter any aliasing memory nodes walk up chain. + while (true) { + switch (Chain.getOpcode()) { + case ISD::EntryToken: + // Entry token is ideal chain operand. + return Chain; + case ISD::LOAD: + case ISD::STORE: { + // Get alias information for chain. + SDOperand ChainPtr; + int64_t ChainSize; + SDOperand ChainSrcValue; + FindAliasInfo(Chain.Val, ChainPtr, ChainSize, ChainSrcValue); + + // If chain is alias then stop here, otherwise continue up chain. + if (isAlias(Ptr, Size, SrcValue, ChainPtr, ChainSize, ChainSrcValue)) + return Chain; + else + Chain = Chain.getOperand(0); + + break; + } + case ISD::TokenFactor: { + // Continue up each of token factor operand and accumulate results in + // a new token factor. CSE will handle duplicate elimination. + SmallVector Ops; // Ops for replacing token factor. + bool Change = false; + + // For each token factor operand. + for (unsigned i = 0, e = Chain.getNumOperands(); i != e; ++i) { + SDOperand Op = Chain.getOperand(i); + SDOperand OpChain = FindBetterChain(N, Op); + + // Make sure we don't duplicate an operand. + if (OpChain.getOpcode() != ISD::EntryToken && + std::find(Ops.begin(), Ops.end(), OpChain) == Ops.end()) { + Ops.push_back(OpChain); + } + + // If we added a new operand. + Change = Change || Op != OpChain; + } + + // If we have new operands. + if (Change) { + // Create a specialized token factor for this chain. getNode CSE will + // handle duplicates. If it's a single operand, getNode will just + // return the opernand instead of a new token factor. + return DAG.getNode(ISD::TokenFactor, MVT::Other, &Ops[0], Ops.size()); + } + + // Leave things alone. + return Chain; + } + // For all other instructions we will just have to take what we can get. + default: return Chain; + } + } + + return Chain; +} + // SelectionDAG::Combine - This is the entry point for the file. // void SelectionDAG::Combine(bool RunningAfterLegalize) { From sabre at nondot.org Mon Sep 25 12:12:28 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 25 Sep 2006 12:12:28 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/README.txt Message-ID: <200609251712.k8PHCSB0031965@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: README.txt updated: 1.40 -> 1.41 --- Log message: more notes --- Diffs of the changes: (+22 -0) README.txt | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+) Index: llvm/lib/Target/README.txt diff -u llvm/lib/Target/README.txt:1.40 llvm/lib/Target/README.txt:1.41 --- llvm/lib/Target/README.txt:1.40 Tue Sep 19 01:19:03 2006 +++ llvm/lib/Target/README.txt Mon Sep 25 12:12:14 2006 @@ -264,3 +264,25 @@ alas... //===---------------------------------------------------------------------===// + +This isn't recognized as bswap by instcombine: + +unsigned int swap_32(unsigned int v) { + v = ((v & 0x00ff00ffU) << 8) | ((v & 0xff00ff00U) >> 8); + v = ((v & 0x0000ffffU) << 16) | ((v & 0xffff0000U) >> 16); + return v; +} + +//===---------------------------------------------------------------------===// + +These should turn into single 16-bit (unaligned?) loads on little/big endian +processors. + +unsigned short read_16_le(const unsigned char *adr) { + return adr[0] | (adr[1] << 8); +} +unsigned short read_16_be(const unsigned char *adr) { + return (adr[0] << 8) | adr[1]; +} + +//===---------------------------------------------------------------------===// From criswell at cs.uiuc.edu Mon Sep 25 13:12:10 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Mon, 25 Sep 2006 13:12:10 -0500 Subject: [llvm-commits] CVS: llvm-gcc/gcc/llvm-out.c Message-ID: <200609251812.NAA31236@choi.cs.uiuc.edu> Changes in directory llvm-gcc/gcc: llvm-out.c updated: 1.10 -> 1.11 --- Log message: Fix for PR#922. Do not re-assign the input locations when expanding statements; the original GCC code does not do this, and removing this statement generates correct filename output for LLVM debugging intrinsics. --- Diffs of the changes: (+0 -1) llvm-out.c | 1 - 1 files changed, 1 deletion(-) Index: llvm-gcc/gcc/llvm-out.c diff -u llvm-gcc/gcc/llvm-out.c:1.10 llvm-gcc/gcc/llvm-out.c:1.11 --- llvm-gcc/gcc/llvm-out.c:1.10 Wed Dec 1 01:09:25 2004 +++ llvm-gcc/gcc/llvm-out.c Mon Sep 25 13:11:43 2006 @@ -136,7 +136,6 @@ assert(nested_p == 0 && "Does not handle nested functions yet!"); current_function_decl = fndecl; - input_location = DECL_SOURCE_LOCATION (fndecl); /* Warn if this value is an aggregate type, regardless of which calling convention we are using for it. */ From criswell at cs.uiuc.edu Mon Sep 25 14:12:27 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Mon, 25 Sep 2006 14:12:27 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CFrontend/2006-09-25-DebugFilename.c.tr 2006-09-25-DebugFilename.h Message-ID: <200609251912.OAA04493@choi.cs.uiuc.edu> Changes in directory llvm/test/Regression/CFrontend: 2006-09-25-DebugFilename.c.tr added (r1.1) 2006-09-25-DebugFilename.h added (r1.1) --- Log message: Regression test for PR#922. --- Diffs of the changes: (+11 -0) 2006-09-25-DebugFilename.c.tr | 5 +++++ 2006-09-25-DebugFilename.h | 6 ++++++ 2 files changed, 11 insertions(+) Index: llvm/test/Regression/CFrontend/2006-09-25-DebugFilename.c.tr diff -c /dev/null llvm/test/Regression/CFrontend/2006-09-25-DebugFilename.c.tr:1.1 *** /dev/null Mon Sep 25 14:12:11 2006 --- llvm/test/Regression/CFrontend/2006-09-25-DebugFilename.c.tr Mon Sep 25 14:12:01 2006 *************** *** 0 **** --- 1,5 ---- + // RUN: %llvmgcc -xc %s -S -o /dev/null 2>&1 | grep fluffy | grep '2006-09-25-DebugFilename.c.tr' + #include "2006-09-25-DebugFilename.h" + int func1() { return hfunc1(); } + int func2() { fluffy; return hfunc1(); } + Index: llvm/test/Regression/CFrontend/2006-09-25-DebugFilename.h diff -c /dev/null llvm/test/Regression/CFrontend/2006-09-25-DebugFilename.h:1.1 *** /dev/null Mon Sep 25 14:12:27 2006 --- llvm/test/Regression/CFrontend/2006-09-25-DebugFilename.h Mon Sep 25 14:12:01 2006 *************** *** 0 **** --- 1,6 ---- + extern int exfunc(int a); + + static inline int hfunc1() + { + return exfunc(1); + } From jlaskey at apple.com Mon Sep 25 14:33:12 2006 From: jlaskey at apple.com (Jim Laskey) Date: Mon, 25 Sep 2006 14:33:12 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200609251933.k8PJXCS3001979@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.198 -> 1.199 --- Log message: Fix chain dropping in load and drop unused stores in ret blocks. --- Diffs of the changes: (+14 -7) DAGCombiner.cpp | 21 ++++++++++++++------- 1 files changed, 14 insertions(+), 7 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.198 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.199 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.198 Mon Sep 25 11:29:54 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Sep 25 14:32:58 2006 @@ -2650,13 +2650,13 @@ SDOperand ReplLoad = DAG.getLoad(N->getValueType(0), BetterChain, Ptr, SrcValue); - // Replace uses with token. - CombineTo(N, ReplLoad.getValue(0), ReplLoad.getValue(1)); - - // Old chain needs to be cleaned up. - AddToWorkList(Chain.Val); - - // Don't recombine on token. + // Create token factor to keep chain around. + SDOperand Token = DAG.getNode(ISD::TokenFactor, MVT::Other, + Chain, ReplLoad.getValue(1)); + + // Replace uses with load and token factor. + CombineTo(N, ReplLoad.getValue(0), Token); + return SDOperand(N, 0); } } @@ -2712,6 +2712,13 @@ } if (CombinerAA) { + // If the store ptr is a frame index and the frame index has a use of one + // and this is a return block, then the store is redundant. + if (Ptr.hasOneUse() && isa(Ptr) && + DAG.getRoot().getOpcode() == ISD::RET) { + return Chain; + } + // Walk up chain skipping non-aliasing memory nodes. SDOperand BetterChain = FindBetterChain(N, Chain); From jlaskey at apple.com Mon Sep 25 16:11:46 2006 From: jlaskey at apple.com (Jim Laskey) Date: Mon, 25 Sep 2006 16:11:46 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200609252111.k8PLBk13003831@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.199 -> 1.200 --- Log message: Accidental enable of bad code --- Diffs of the changes: (+1 -1) DAGCombiner.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.199 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.200 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.199 Mon Sep 25 14:32:58 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Sep 25 16:11:32 2006 @@ -2706,7 +2706,7 @@ // If this is a store of a bit convert, store the input value. // FIXME: This needs to know that the resultant store does not need a // higher alignment than the original. - if (Value.getOpcode() == ISD::BIT_CONVERT) { + if (0 && Value.getOpcode() == ISD::BIT_CONVERT) { return DAG.getNode(ISD::STORE, MVT::Other, Chain, Value.getOperand(0), Ptr, SrcValue); } From sabre at nondot.org Mon Sep 25 17:23:03 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 25 Sep 2006 17:23:03 -0500 Subject: [llvm-commits] CVS: llvm-test/Makefile.tests Message-ID: <200609252223.k8PMN3OG004988@zion.cs.uiuc.edu> Changes in directory llvm-test: Makefile.tests updated: 1.8 -> 1.9 --- Log message: Make llvm-test results more closely match the performance a person would get by running llvm-gcc -O4. In particular, do not run the compile-time optimizer both within llvm-gcc and as a separate gccas invocation. --- Diffs of the changes: (+4 -4) Makefile.tests | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm-test/Makefile.tests diff -u llvm-test/Makefile.tests:1.8 llvm-test/Makefile.tests:1.9 --- llvm-test/Makefile.tests:1.8 Tue Jun 6 19:05:16 2006 +++ llvm-test/Makefile.tests Mon Sep 25 17:22:49 2006 @@ -50,19 +50,19 @@ # Compile from X.c to Output/X.ll Output/%.ll: %.c $(LCC1) Output/.dir $(INCLUDES) - -$(LLVMGCC) $(CPPFLAGS) $(LCCFLAGS) $(TARGET_FLAGS) -S $< -o $@ -emit-llvm + -$(LLVMGCC) $(CPPFLAGS) $(LCCFLAGS) $(TARGET_FLAGS) -O0 -S $< -o $@ -emit-llvm # Compile from X.cpp to Output/X.ll Output/%.ll: %.cpp $(LCC1XX) Output/.dir $(INCLUDES) - -$(LLVMGXX) $(CPPFLAGS) $(LCXXFLAGS) $(TARGET_FLAGS) -S $< -o $@ -emit-llvm + -$(LLVMGXX) $(CPPFLAGS) $(LCXXFLAGS) $(TARGET_FLAGS) -O0 -S $< -o $@ -emit-llvm # Compile from X.cc to Output/X.ll Output/%.ll: %.cc $(LCC1XX) Output/.dir $(INCLUDES) - -$(LLVMGXX) $(CPPFLAGS) $(LCXXFLAGS) $(TARGET_FLAGS) -S $< -o $@ -emit-llvm + -$(LLVMGXX) $(CPPFLAGS) $(LCXXFLAGS) $(TARGET_FLAGS) -O0 -S $< -o $@ -emit-llvm # Compile from X.C to Output/X.ll Output/%.ll: %.C $(LCC1XX) Output/.dir $(INCLUDES) - -$(LLVMGXX) $(CPPFLAGS) $(LCXXFLAGS) $(TARGET_FLAGS) -S $< -o $@ -emit-llvm + -$(LLVMGXX) $(CPPFLAGS) $(LCXXFLAGS) $(TARGET_FLAGS) -O0 -S $< -o $@ -emit-llvm # LLVM Assemble from Output/X.ll to Output/X.bc. Output/X.ll must have come # from GCC output, so use GCCAS. From sabre at nondot.org Mon Sep 25 17:38:50 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 25 Sep 2006 17:38:50 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetAsmInfo.h Message-ID: <200609252238.k8PMcoxi005353@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetAsmInfo.h updated: 1.3 -> 1.4 --- Log message: order this properly to avoid warnings in TargetAsmInfo.cpp. Add a comment in a format that matches every other ivars in this class. --- Diffs of the changes: (+4 -1) TargetAsmInfo.h | 5 ++++- 1 files changed, 4 insertions(+), 1 deletion(-) Index: llvm/include/llvm/Target/TargetAsmInfo.h diff -u llvm/include/llvm/Target/TargetAsmInfo.h:1.3 llvm/include/llvm/Target/TargetAsmInfo.h:1.4 --- llvm/include/llvm/Target/TargetAsmInfo.h:1.3 Sun Sep 24 14:43:29 2006 +++ llvm/include/llvm/Target/TargetAsmInfo.h Mon Sep 25 17:38:36 2006 @@ -108,7 +108,6 @@ const char *Data16bitsDirective; // Defaults to "\t.short\t" const char *Data32bitsDirective; // Defaults to "\t.long\t" const char *Data64bitsDirective; // Defaults to "\t.quad\t" - const char *JumpTableDirective; // if used, the jump table reloc flag //===--- Alignment Information ----------------------------------------===// @@ -156,6 +155,10 @@ /// is PIC. const char *JumpTableTextSection; // Defaults to "\t.text\n" + /// JumpTableDirective - if non-null, the directive to emit before a jump + /// table. + const char *JumpTableDirective; + /// StaticCtorsSection - This is the directive that is emitted to switch to /// a section to emit the static constructor list. /// Defaults to "\t.section .ctors,\"aw\", at progbits". From sabre at nondot.org Mon Sep 25 22:38:36 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 25 Sep 2006 22:38:36 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/TargetAsmInfo.cpp Message-ID: <200609260338.k8Q3caje010005@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: TargetAsmInfo.cpp updated: 1.3 -> 1.4 --- Log message: Add support for targets that want to do something with the llvm.used list, because they have an aggressive linker that does dead code stripping. --- Diffs of the changes: (+1 -0) TargetAsmInfo.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Target/TargetAsmInfo.cpp diff -u llvm/lib/Target/TargetAsmInfo.cpp:1.3 llvm/lib/Target/TargetAsmInfo.cpp:1.4 --- llvm/lib/Target/TargetAsmInfo.cpp:1.3 Sun Sep 24 14:45:58 2006 +++ llvm/lib/Target/TargetAsmInfo.cpp Mon Sep 25 22:38:18 2006 @@ -58,6 +58,7 @@ COMMDirective("\t.comm\t"), COMMDirectiveTakesAlignment(true), HasDotTypeDotSizeDirective(true), + UsedDirective(0), HasLEB128(false), HasDotLoc(false), HasDotFile(false), From sabre at nondot.org Mon Sep 25 22:38:36 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 25 Sep 2006 22:38:36 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/AsmPrinter.h Message-ID: <200609260338.k8Q3caOf010010@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: AsmPrinter.h updated: 1.48 -> 1.49 --- Log message: Add support for targets that want to do something with the llvm.used list, because they have an aggressive linker that does dead code stripping. --- Diffs of the changes: (+1 -0) AsmPrinter.h | 1 + 1 files changed, 1 insertion(+) Index: llvm/include/llvm/CodeGen/AsmPrinter.h diff -u llvm/include/llvm/CodeGen/AsmPrinter.h:1.48 llvm/include/llvm/CodeGen/AsmPrinter.h:1.49 --- llvm/include/llvm/CodeGen/AsmPrinter.h:1.48 Tue Sep 12 15:59:22 2006 +++ llvm/include/llvm/CodeGen/AsmPrinter.h Mon Sep 25 22:38:18 2006 @@ -197,6 +197,7 @@ void printDataDirective(const Type *type); private: + void EmitLLVMUsedList(Constant *List); void EmitXXStructorList(Constant *List); void EmitConstantPool(unsigned Alignment, const char *Section, std::vector > &CP); From sabre at nondot.org Mon Sep 25 22:38:38 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 25 Sep 2006 22:38:38 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetAsmInfo.h Message-ID: <200609260338.k8Q3cc8J010020@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetAsmInfo.h updated: 1.4 -> 1.5 --- Log message: Add support for targets that want to do something with the llvm.used list, because they have an aggressive linker that does dead code stripping. --- Diffs of the changes: (+8 -0) TargetAsmInfo.h | 8 ++++++++ 1 files changed, 8 insertions(+) Index: llvm/include/llvm/Target/TargetAsmInfo.h diff -u llvm/include/llvm/Target/TargetAsmInfo.h:1.4 llvm/include/llvm/Target/TargetAsmInfo.h:1.5 --- llvm/include/llvm/Target/TargetAsmInfo.h:1.4 Mon Sep 25 17:38:36 2006 +++ llvm/include/llvm/Target/TargetAsmInfo.h Mon Sep 25 22:38:18 2006 @@ -199,6 +199,11 @@ /// directives, this is true for most ELF targets. bool HasDotTypeDotSizeDirective; // Defaults to true. + /// UsedDirective - This directive, if non-null, is used to declare a global + /// as being used somehow that the assembler can't see. This prevents dead + /// code elimination on some targets. + const char *UsedDirective; // Defaults to null. + //===--- Dwarf Emission Directives -----------------------------------===// /// HasLEB128 - True if target asm supports leb128 directives. @@ -387,6 +392,9 @@ bool hasDotTypeDotSizeDirective() const { return HasDotTypeDotSizeDirective; } + const char *getUsedDirective() const { + return UsedDirective; + } bool hasLEB128() const { return HasLEB128; } From sabre at nondot.org Mon Sep 25 22:38:37 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 25 Sep 2006 22:38:37 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp Message-ID: <200609260338.k8Q3cbeM010015@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: AsmPrinter.cpp updated: 1.98 -> 1.99 --- Log message: Add support for targets that want to do something with the llvm.used list, because they have an aggressive linker that does dead code stripping. --- Diffs of the changes: (+21 -2) AsmPrinter.cpp | 23 +++++++++++++++++++++-- 1 files changed, 21 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/AsmPrinter.cpp diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.98 llvm/lib/CodeGen/AsmPrinter.cpp:1.99 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.98 Sun Sep 24 14:44:59 2006 +++ llvm/lib/CodeGen/AsmPrinter.cpp Mon Sep 25 22:38:18 2006 @@ -253,8 +253,11 @@ assert(GV->hasInitializer() && "Not a special LLVM global!"); - if (GV->getName() == "llvm.used") - return true; // No need to emit this at all. + if (GV->getName() == "llvm.used") { + if (TAI->getUsedDirective() != 0) // No need to emit this at all. + EmitLLVMUsedList(GV->getInitializer()); + return true; + } if (GV->getName() == "llvm.global_ctors" && GV->use_empty()) { SwitchToDataSection(TAI->getStaticCtorsSection(), 0); @@ -273,6 +276,22 @@ return false; } +/// EmitLLVMUsedList - For targets that define a TAI::UsedDirective, mark each +/// global in the specified llvm.used list as being used with this directive. +void AsmPrinter::EmitLLVMUsedList(Constant *List) { + const char *Directive = TAI->getUsedDirective(); + + // Should be an array of 'sbyte*'. + ConstantArray *InitList = dyn_cast(List); + if (InitList == 0) return; + + for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i) { + O << Directive; + EmitConstantValueOnly(InitList->getOperand(i)); + O << "\n"; + } +} + /// EmitXXStructorList - Emit the ctor or dtor list. This just prints out the /// function pointers, ignoring the init priority. void AsmPrinter::EmitXXStructorList(Constant *List) { From sabre at nondot.org Mon Sep 25 22:40:07 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 25 Sep 2006 22:40:07 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Message-ID: <200609260340.k8Q3e7Ac010099@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCTargetAsmInfo.cpp updated: 1.2 -> 1.3 --- Log message: Compile: int x __attribute__((used)); to: .data .comm _x,4 ; 'x' .no_dead_strip _x on both x86 and ppc darwin targets. --- Diffs of the changes: (+1 -0) PPCTargetAsmInfo.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp diff -u llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.2 llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.3 --- llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp:1.2 Fri Sep 8 08:06:56 2006 +++ llvm/lib/Target/PowerPC/PPCTargetAsmInfo.cpp Mon Sep 25 22:39:53 2006 @@ -32,6 +32,7 @@ LCOMMDirective = "\t.lcomm\t"; StaticCtorsSection = ".mod_init_func"; StaticDtorsSection = ".mod_term_func"; + UsedDirective = "\t.no_dead_strip\t"; InlineAsmStart = "# InlineAsm Start"; InlineAsmEnd = "# InlineAsm End"; From sabre at nondot.org Mon Sep 25 22:40:08 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 25 Sep 2006 22:40:08 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86TargetAsmInfo.cpp Message-ID: <200609260340.k8Q3e8JX010104@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86TargetAsmInfo.cpp updated: 1.2 -> 1.3 --- Log message: Compile: int x __attribute__((used)); to: .data .comm _x,4 ; 'x' .no_dead_strip _x on both x86 and ppc darwin targets. --- Diffs of the changes: (+1 -0) X86TargetAsmInfo.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Target/X86/X86TargetAsmInfo.cpp diff -u llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.2 llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.3 --- llvm/lib/Target/X86/X86TargetAsmInfo.cpp:1.2 Fri Sep 8 01:48:29 2006 +++ llvm/lib/Target/X86/X86TargetAsmInfo.cpp Mon Sep 25 22:39:53 2006 @@ -44,6 +44,7 @@ InlineAsmStart = "# InlineAsm Start"; InlineAsmEnd = "# InlineAsm End"; SetDirective = "\t.set"; + UsedDirective = "\t.no_dead_strip\t"; NeedsSet = true; DwarfAbbrevSection = ".section __DWARF,__debug_abbrev,regular,debug"; From sabre at nondot.org Mon Sep 25 22:42:14 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 25 Sep 2006 22:42:14 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/MachineBasicBlock.cpp Message-ID: <200609260342.k8Q3gESx010179@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: MachineBasicBlock.cpp updated: 1.28 -> 1.29 --- Log message: print the preds of each MBB --- Diffs of the changes: (+8 -0) MachineBasicBlock.cpp | 8 ++++++++ 1 files changed, 8 insertions(+) Index: llvm/lib/CodeGen/MachineBasicBlock.cpp diff -u llvm/lib/CodeGen/MachineBasicBlock.cpp:1.28 llvm/lib/CodeGen/MachineBasicBlock.cpp:1.29 --- llvm/lib/CodeGen/MachineBasicBlock.cpp:1.28 Fri May 12 01:33:48 2006 +++ llvm/lib/CodeGen/MachineBasicBlock.cpp Mon Sep 25 22:41:59 2006 @@ -97,6 +97,14 @@ if (LBB) OS << "\n" << LBB->getName() << " (" << (const void*)this << ", LLVM BB @" << (const void*) LBB << "):\n"; + // Print the preds of this block according to the CFG. + if (!pred_empty()) { + OS << " Predecessors according to CFG:"; + for (const_pred_iterator PI = pred_begin(), E = pred_end(); PI != E; ++PI) + OS << " " << *PI; + OS << "\n"; + } + for (const_iterator I = begin(); I != end(); ++I) { OS << "\t"; I->print(OS, &getParent()->getTarget()); From sabre at nondot.org Mon Sep 25 22:44:34 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 25 Sep 2006 22:44:34 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/darwin-no-dead-strip.ll Message-ID: <200609260344.k8Q3iY7M010266@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/X86: darwin-no-dead-strip.ll added (r1.1) --- Log message: test that the no_dead_strip directive is emitted on darwin-x86 --- Diffs of the changes: (+7 -0) darwin-no-dead-strip.ll | 7 +++++++ 1 files changed, 7 insertions(+) Index: llvm/test/Regression/CodeGen/X86/darwin-no-dead-strip.ll diff -c /dev/null llvm/test/Regression/CodeGen/X86/darwin-no-dead-strip.ll:1.1 *** /dev/null Mon Sep 25 22:44:30 2006 --- llvm/test/Regression/CodeGen/X86/darwin-no-dead-strip.ll Mon Sep 25 22:44:20 2006 *************** *** 0 **** --- 1,7 ---- + ; RUN: llvm-as < %s | llc | grep no_dead_strip + + target endian = little + target pointersize = 32 + target triple = "i686-apple-darwin8.7.2" + %x = weak global int 0 ; [#uses=1] + %llvm.used = appending global [1 x sbyte*] [ sbyte* cast (int* %x to sbyte*) ] From sabre at nondot.org Mon Sep 25 22:58:07 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 25 Sep 2006 22:58:07 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp X86AsmPrinter.cpp X86AsmPrinter.h X86ISelLowering.cpp X86IntelAsmPrinter.cpp X86MachineFunctionInfo.h Message-ID: <200609260358.k8Q3w7JR010530@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ATTAsmPrinter.cpp updated: 1.64 -> 1.65 X86AsmPrinter.cpp updated: 1.199 -> 1.200 X86AsmPrinter.h updated: 1.32 -> 1.33 X86ISelLowering.cpp updated: 1.263 -> 1.264 X86IntelAsmPrinter.cpp updated: 1.57 -> 1.58 X86MachineFunctionInfo.h updated: 1.3 -> 1.4 --- Log message: Various random and minor code cleanups. --- Diffs of the changes: (+39 -56) X86ATTAsmPrinter.cpp | 7 ++-- X86AsmPrinter.cpp | 67 ++++++++++++++++++----------------------------- X86AsmPrinter.h | 7 ++-- X86ISelLowering.cpp | 5 +-- X86IntelAsmPrinter.cpp | 7 ++-- X86MachineFunctionInfo.h | 2 - 6 files changed, 39 insertions(+), 56 deletions(-) Index: llvm/lib/Target/X86/X86ATTAsmPrinter.cpp diff -u llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.64 llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.65 --- llvm/lib/Target/X86/X86ATTAsmPrinter.cpp:1.64 Wed Sep 20 17:03:51 2006 +++ llvm/lib/Target/X86/X86ATTAsmPrinter.cpp Mon Sep 25 22:57:53 2006 @@ -48,9 +48,8 @@ // Populate function information map. Actually, We don't want to populate // non-stdcall or non-fastcall functions' information right now. - if (CC == CallingConv::X86_StdCall || CC == CallingConv::X86_FastCall) { - FunctionInfoMap[F] = *(MF.getInfo()); - } + if (CC == CallingConv::X86_StdCall || CC == CallingConv::X86_FastCall) + FunctionInfoMap[F] = *MF.getInfo(); X86SharedAsmPrinter::decorateName(CurrentFnName, F); @@ -200,7 +199,7 @@ bool isExt = (GV->isExternal() || GV->hasWeakLinkage() || GV->hasLinkOnceLinkage()); - X86SharedAsmPrinter::decorateName(Name, (Function*)GV); + X86SharedAsmPrinter::decorateName(Name, GV); if (X86PICStyle == PICStyle::Stub && TM.getRelocationModel() != Reloc::Static) { Index: llvm/lib/Target/X86/X86AsmPrinter.cpp diff -u llvm/lib/Target/X86/X86AsmPrinter.cpp:1.199 llvm/lib/Target/X86/X86AsmPrinter.cpp:1.200 --- llvm/lib/Target/X86/X86AsmPrinter.cpp:1.199 Wed Sep 20 17:03:51 2006 +++ llvm/lib/Target/X86/X86AsmPrinter.cpp Mon Sep 25 22:57:53 2006 @@ -33,88 +33,75 @@ Statistic<> llvm::EmittedInsts("asm-printer", "Number of machine instrs printed"); -static X86FunctionInfo calculateFunctionInfo(const Function* F, - const TargetData* TD) -{ +static X86FunctionInfo calculateFunctionInfo(const Function *F, + const TargetData *TD) { X86FunctionInfo Info; - uint64_t size = 0; + uint64_t Size = 0; switch (F->getCallingConv()) { - case CallingConv::X86_StdCall: + case CallingConv::X86_StdCall: Info.setDecorationStyle(StdCall); break; - case CallingConv::X86_FastCall: + case CallingConv::X86_FastCall: Info.setDecorationStyle(FastCall); break; - default: + default: return Info; } - for (Function::const_arg_iterator AI = F->arg_begin(), - AE = F->arg_end(); - AI != AE; - ++AI) { - size += TD->getTypeSize(AI->getType()); - } + for (Function::const_arg_iterator AI = F->arg_begin(), AE = F->arg_end(); + AI != AE; ++AI) + Size += TD->getTypeSize(AI->getType()); // We're not supporting tooooo huge arguments :) - Info.setBytesToPopOnReturn((unsigned int)size); - + Info.setBytesToPopOnReturn((unsigned int)Size); return Info; } -// Query FunctionInfoMap and use this information for various name decoration -void X86SharedAsmPrinter::decorateName(std::string& Name, const GlobalValue* GV) -{ - const X86FunctionInfo* Info; - const Function* F; - - if ((F = dyn_cast(GV)) == NULL) { - return; - } - - unsigned CC = F->getCallingConv(); +/// decorateName - Query FunctionInfoMap and use this information for various +/// name decoration. +void X86SharedAsmPrinter::decorateName(std::string &Name, + const GlobalValue *GV) { + const Function *F = dyn_cast(GV); + if (!F) return; // We don't want to decorate non-stdcall or non-fastcall functions right now - if (CC != CallingConv::X86_StdCall && CC != CallingConv::X86_FastCall) { + unsigned CC = F->getCallingConv(); + if (CC != CallingConv::X86_StdCall && CC != CallingConv::X86_FastCall) return; - } FMFInfoMap::const_iterator info_item = FunctionInfoMap.find(F); + const X86FunctionInfo *Info; if (info_item == FunctionInfoMap.end()) { // Calculate apropriate function info and populate map FunctionInfoMap[F] = calculateFunctionInfo(F, TM.getTargetData()); Info = &FunctionInfoMap[F]; } else { - Info = &(info_item->second); + Info = &info_item->second; } switch (Info->getDecorationStyle()) { - case None: + case None: break; - case StdCall: - if (!F->isVarArg()) { - // Variadic functions do not receive @0 suffix + case StdCall: + if (!F->isVarArg()) // Variadic functions do not receive @0 suffix. Name += '@' + utostr_32(Info->getBytesToPopOnReturn()); - } break; - case FastCall: - if (!F->isVarArg()) { - // Variadic functions do not receive @0 suffix + case FastCall: + if (!F->isVarArg()) // Variadic functions do not receive @0 suffix. Name += '@' + utostr_32(Info->getBytesToPopOnReturn()); - } + if (Name[0] == '_') { Name[0] = '@'; } else { Name = '@' + Name; } break; - default: + default: assert(0 && "Unsupported DecorationStyle"); } - } /// doInitialization Index: llvm/lib/Target/X86/X86AsmPrinter.h diff -u llvm/lib/Target/X86/X86AsmPrinter.h:1.32 llvm/lib/Target/X86/X86AsmPrinter.h:1.33 --- llvm/lib/Target/X86/X86AsmPrinter.h:1.32 Wed Sep 20 17:03:51 2006 +++ llvm/lib/Target/X86/X86AsmPrinter.h Mon Sep 25 22:57:53 2006 @@ -46,19 +46,18 @@ Subtarget = &TM.getSubtarget(); } - typedef std::map FMFInfoMap ; - // We have to propagate some information about MachineFunction to // AsmPrinter. It's ok, when we're printing the function, since we have - // access to MachineFunction and can get the appropriate MachineFunctionInfo. + // access to MachineFunction and can get the appropriate MachineFunctionInfo. // Unfortunately, this is not possible when we're printing reference to // Function (e.g. calling it and so on). Even more, there is no way to get the // corresponding MachineFunctions: it can even be not created at all. That's // why we should use additional structure, when we're collecting all necessary // information. - + // // This structure is using e.g. for name decoration for stdcall & fastcall'ed // function, since we have to use arguments' size for decoration. + typedef std::map FMFInfoMap; FMFInfoMap FunctionInfoMap; void decorateName(std::string& Name, const GlobalValue* GV); Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.263 llvm/lib/Target/X86/X86ISelLowering.cpp:1.264 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.263 Wed Sep 20 21:08:31 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Mon Sep 25 22:57:53 2006 @@ -1523,9 +1523,8 @@ return DAG.getNode(ISD::MERGE_VALUES, RetVTs, &ArgValues[0],ArgValues.size()); } -SDOperand X86TargetLowering::LowerFastCCCallTo(SDOperand Op, - SelectionDAG &DAG, - bool isFastCall){ +SDOperand X86TargetLowering::LowerFastCCCallTo(SDOperand Op, SelectionDAG &DAG, + bool isFastCall) { SDOperand Chain = Op.getOperand(0); unsigned CallingConv= cast(Op.getOperand(1))->getValue(); bool isVarArg = cast(Op.getOperand(2))->getValue() != 0; Index: llvm/lib/Target/X86/X86IntelAsmPrinter.cpp diff -u llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.57 llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.58 --- llvm/lib/Target/X86/X86IntelAsmPrinter.cpp:1.57 Wed Sep 20 17:03:51 2006 +++ llvm/lib/Target/X86/X86IntelAsmPrinter.cpp Mon Sep 25 22:57:53 2006 @@ -36,14 +36,13 @@ EmitConstantPool(MF.getConstantPool()); // Print out labels for the function. - const Function* F = MF.getFunction(); + const Function *F = MF.getFunction(); unsigned CC = F->getCallingConv(); // Populate function information map. Actually, We don't want to populate // non-stdcall or non-fastcall functions' information right now. - if (CC == CallingConv::X86_StdCall || CC == CallingConv::X86_FastCall) { - FunctionInfoMap[F] = *(MF.getInfo()); - } + if (CC == CallingConv::X86_StdCall || CC == CallingConv::X86_FastCall) + FunctionInfoMap[F] = *MF.getInfo(); X86SharedAsmPrinter::decorateName(CurrentFnName, F); Index: llvm/lib/Target/X86/X86MachineFunctionInfo.h diff -u llvm/lib/Target/X86/X86MachineFunctionInfo.h:1.3 llvm/lib/Target/X86/X86MachineFunctionInfo.h:1.4 --- llvm/lib/Target/X86/X86MachineFunctionInfo.h:1.3 Wed Sep 20 17:03:51 2006 +++ llvm/lib/Target/X86/X86MachineFunctionInfo.h Mon Sep 25 22:57:53 2006 @@ -46,7 +46,7 @@ BytesToPopOnReturn(0), DecorationStyle(None) {} - X86FunctionInfo(MachineFunction& MF) : ForceFramePointer(false), + X86FunctionInfo(MachineFunction &MF) : ForceFramePointer(false), BytesToPopOnReturn(0), DecorationStyle(None) {} From jlaskey at apple.com Tue Sep 26 02:38:02 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 26 Sep 2006 02:38:02 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200609260738.k8Q7c2wj022297@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.200 -> 1.201 --- Log message: Can't move a load node if it's chain is not used. --- Diffs of the changes: (+22 -1) DAGCombiner.cpp | 23 ++++++++++++++++++++++- 1 files changed, 22 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.200 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.201 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.200 Mon Sep 25 16:11:32 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Sep 26 02:37:42 2006 @@ -240,6 +240,10 @@ SDOperand BuildUDIV(SDNode *N); SDNode *MatchRotate(SDOperand LHS, SDOperand RHS); + /// hasChainUsers - Returns true if one of the users of a load node has the + /// chain result as an operand. + bool hasChainUsers(SDNode *Load); + /// FindBaseOffset - Return true if we can determine base and offset /// information from a given pointer operand. Provides base and offset as a /// result. @@ -2640,7 +2644,7 @@ Chain.getOperand(1).getValueType() == N->getValueType(0)) return CombineTo(N, Chain.getOperand(1), Chain); - if (CombinerAA) { + if (CombinerAA && hasChainUsers(N)) { // Walk up chain skipping non-aliasing memory nodes. SDOperand BetterChain = FindBetterChain(N, Chain); @@ -3947,6 +3951,23 @@ return S; } +/// hasChainUsers - Returns true if one of the users of a load node has the +/// chain result as an operand. +bool DAGCombiner::hasChainUsers(SDNode *Load) { + // Don't even bother if the load only has one user (conservatively the value.) + if (!Load->hasOneUse()) { + SDOperand Chain(Load, 1); + + for (SDNode::use_iterator UI = Load->use_begin(), UE = Load->use_end(); + UI != UE; ++UI) { + if ((*UI)->getOperand(0) == Chain) + return true; + } + } + + return false; +} + /// FindBaseOffset - Return true if we can determine base and offset information /// from a given pointer operand. Provides base and offset as a result. bool DAGCombiner::FindBaseOffset(SDOperand Ptr, From jlaskey at apple.com Tue Sep 26 03:14:20 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 26 Sep 2006 03:14:20 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200609260814.k8Q8EKem022956@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.201 -> 1.202 --- Log message: Wrong size for load --- Diffs of the changes: (+8 -2) DAGCombiner.cpp | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.201 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.202 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.201 Tue Sep 26 02:37:42 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Sep 26 03:14:06 2006 @@ -2644,6 +2644,8 @@ Chain.getOperand(1).getValueType() == N->getValueType(0)) return CombineTo(N, Chain.getOperand(1), Chain); + // We can only move the load if it has a user of it's chain result. Otherwise + // there is no place to attach it's old chain. if (CombinerAA && hasChainUsers(N)) { // Walk up chain skipping non-aliasing memory nodes. SDOperand BetterChain = FindBetterChain(N, Chain); @@ -3956,15 +3958,19 @@ bool DAGCombiner::hasChainUsers(SDNode *Load) { // Don't even bother if the load only has one user (conservatively the value.) if (!Load->hasOneUse()) { - SDOperand Chain(Load, 1); + SDOperand Chain(Load, 1); // The load's chain result. + // For each user of the load. for (SDNode::use_iterator UI = Load->use_begin(), UE = Load->use_end(); UI != UE; ++UI) { + + // Chain will be the first operand. if ((*UI)->getOperand(0) == Chain) return true; } } + // No luck. return false; } @@ -4025,7 +4031,7 @@ switch (N->getOpcode()) { case ISD::LOAD: Ptr = N->getOperand(1); - Size = MVT::getSizeInBits(N->getOperand(1).getValueType()) >> 3; + Size = MVT::getSizeInBits(N->getValueType(0)) >> 3; SrcValue = N->getOperand(2); break; case ISD::STORE: From jlaskey at apple.com Tue Sep 26 04:33:01 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 26 Sep 2006 04:33:01 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200609260933.k8Q9X1Mg019668@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.202 -> 1.203 --- Log message: Chain can be any operand --- Diffs of the changes: (+9 -11) DAGCombiner.cpp | 20 +++++++++----------- 1 files changed, 9 insertions(+), 11 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.202 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.203 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.202 Tue Sep 26 03:14:06 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Sep 26 04:32:41 2006 @@ -3956,17 +3956,15 @@ /// hasChainUsers - Returns true if one of the users of a load node has the /// chain result as an operand. bool DAGCombiner::hasChainUsers(SDNode *Load) { - // Don't even bother if the load only has one user (conservatively the value.) - if (!Load->hasOneUse()) { - SDOperand Chain(Load, 1); // The load's chain result. - - // For each user of the load. - for (SDNode::use_iterator UI = Load->use_begin(), UE = Load->use_end(); - UI != UE; ++UI) { - - // Chain will be the first operand. - if ((*UI)->getOperand(0) == Chain) - return true; + SDOperand Chain(Load, 1); // The load's chain result. + + // For each user of the load. + for (SDNode::use_iterator UI = Load->use_begin(), UE = Load->use_end(); + UI != UE; ++UI) { + const SDNode *User = *UI; + + for (unsigned i = 0, e = User->getNumOperands(); i != e; ++i) { + if (User->getOperand(i) == Chain) return true; } } From jlaskey at apple.com Tue Sep 26 07:07:20 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 26 Sep 2006 07:07:20 -0500 Subject: [llvm-commits] CVS: nightlytest-serverside/NightlyTestAccept.php testers.php Message-ID: <200609261207.k8QC7KFD028858@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: NightlyTestAccept.php updated: 1.58 -> 1.59 testers.php updated: 1.2 -> 1.3 --- Log message: Odds and sods --- Diffs of the changes: (+3 -3) NightlyTestAccept.php | 2 -- testers.php | 4 +++- 2 files changed, 3 insertions(+), 3 deletions(-) Index: nightlytest-serverside/NightlyTestAccept.php diff -u nightlytest-serverside/NightlyTestAccept.php:1.58 nightlytest-serverside/NightlyTestAccept.php:1.59 --- nightlytest-serverside/NightlyTestAccept.php:1.58 Wed Sep 20 06:31:36 2006 +++ nightlytest-serverside/NightlyTestAccept.php Tue Sep 26 07:07:06 2006 @@ -957,8 +957,6 @@ chdir("$cwd/machines/$machine_id"); WriteFile("$db_date-Build-Log.txt", $build_log); -// WriteFile("$db_date-O-files.txt", $o_file_size); -// WriteFile("$db_date-A-files.txt", $a_file_size); $sentdata=""; foreach ($_GET as $key => $value) { Index: nightlytest-serverside/testers.php diff -u nightlytest-serverside/testers.php:1.2 nightlytest-serverside/testers.php:1.3 --- nightlytest-serverside/testers.php:1.2 Fri Sep 8 17:47:25 2006 +++ nightlytest-serverside/testers.php Tue Sep 26 07:07:06 2006 @@ -36,8 +36,9 @@ print "\t\tID\n"; print "\t\tNickname\n"; print "\t\tMachine name\n"; - print "\t\tOperating System\n"; + print "\t\tOperating system\n"; print "\t\tHardware\n"; + print "\t\tGCC version\n"; print "\t\tTime of last test\n"; print "\t\tBuild status of last test\n"; print "\t\n"; @@ -61,6 +62,7 @@ print "\t\t{$row['name']}\n"; print "\t\t{$row['os']}\n"; print "\t\t{$row['hardware']}\n"; + print "\t\t{$row['gcc']}\n"; print "\t\t{$latest_test['added']}\n"; print "\t\t{$latest_test['buildstatus']}\n"; print "\t\n"; From jlaskey at apple.com Tue Sep 26 12:45:13 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 26 Sep 2006 12:45:13 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200609261745.k8QHjDlc001579@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.203 -> 1.204 --- Log message: Load chain check is not needed --- Diffs of the changes: (+1 -24) DAGCombiner.cpp | 25 +------------------------ 1 files changed, 1 insertion(+), 24 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.203 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.204 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.203 Tue Sep 26 04:32:41 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Sep 26 12:44:58 2006 @@ -240,10 +240,6 @@ SDOperand BuildUDIV(SDNode *N); SDNode *MatchRotate(SDOperand LHS, SDOperand RHS); - /// hasChainUsers - Returns true if one of the users of a load node has the - /// chain result as an operand. - bool hasChainUsers(SDNode *Load); - /// FindBaseOffset - Return true if we can determine base and offset /// information from a given pointer operand. Provides base and offset as a /// result. @@ -2646,7 +2642,7 @@ // We can only move the load if it has a user of it's chain result. Otherwise // there is no place to attach it's old chain. - if (CombinerAA && hasChainUsers(N)) { + if (CombinerAA) { // Walk up chain skipping non-aliasing memory nodes. SDOperand BetterChain = FindBetterChain(N, Chain); @@ -3953,25 +3949,6 @@ return S; } -/// hasChainUsers - Returns true if one of the users of a load node has the -/// chain result as an operand. -bool DAGCombiner::hasChainUsers(SDNode *Load) { - SDOperand Chain(Load, 1); // The load's chain result. - - // For each user of the load. - for (SDNode::use_iterator UI = Load->use_begin(), UE = Load->use_end(); - UI != UE; ++UI) { - const SDNode *User = *UI; - - for (unsigned i = 0, e = User->getNumOperands(); i != e; ++i) { - if (User->getOperand(i) == Chain) return true; - } - } - - // No luck. - return false; -} - /// FindBaseOffset - Return true if we can determine base and offset information /// from a given pointer operand. Provides base and offset as a result. bool DAGCombiner::FindBaseOffset(SDOperand Ptr, From jlaskey at apple.com Tue Sep 26 12:47:33 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 26 Sep 2006 12:47:33 -0500 Subject: [llvm-commits] CVS: llvm-test/Makefile.programs Message-ID: <200609261747.k8QHlXQB001621@zion.cs.uiuc.edu> Changes in directory llvm-test: Makefile.programs updated: 1.226 -> 1.227 --- Log message: Set combiner-alias-analysis as llc-beta for PPC and x86 --- Diffs of the changes: (+2 -2) Makefile.programs | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-test/Makefile.programs diff -u llvm-test/Makefile.programs:1.226 llvm-test/Makefile.programs:1.227 --- llvm-test/Makefile.programs:1.226 Fri Sep 15 12:11:45 2006 +++ llvm-test/Makefile.programs Tue Sep 26 12:47:19 2006 @@ -193,7 +193,7 @@ endif#DISABLE_DIFFS ifeq ($(ARCH),PowerPC) -LLCBETAOPTION := -regalloc=local -fast +LLCBETAOPTION := -combiner-alias-analysis endif ifeq ($(ARCH),Alpha) LLCBETAOPTION := -sched=list-td @@ -203,7 +203,7 @@ LLCBETAOPTION := -sched=simple endif ifeq ($(ARCH),x86) -LLCBETAOPTION := -regalloc=local -fast +LLCBETAOPTION := -combiner-alias-analysis endif ifeq ($(ARCH),Sparc) LLCBETAOPTION := -enable-sparc-v9-insts From alenhar2 at cs.uiuc.edu Tue Sep 26 15:02:56 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Tue, 26 Sep 2006 15:02:56 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp SelectionDAGISel.cpp Message-ID: <200609262002.k8QK2uMG005951@apoc.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAG.cpp updated: 1.340 -> 1.341 SelectionDAGISel.cpp updated: 1.279 -> 1.280 --- Log message: Comments on JumpTableness --- Diffs of the changes: (+4 -0) SelectionDAG.cpp | 1 + SelectionDAGISel.cpp | 3 +++ 2 files changed, 4 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.340 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.341 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.340 Tue Sep 19 00:02:39 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Tue Sep 26 15:02:30 2006 @@ -2403,6 +2403,7 @@ case ISD::GlobalAddress: return "GlobalAddress"; case ISD::FrameIndex: return "FrameIndex"; case ISD::JumpTable: return "JumpTable"; + case ISD::JumpTableRelocBase: return "JumpTableRelocBase"; case ISD::ConstantPool: return "ConstantPool"; case ISD::ExternalSymbol: return "ExternalSymbol"; case ISD::INTRINSIC_WO_CHAIN: { Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.279 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.280 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.279 Sun Sep 24 14:44:59 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Tue Sep 26 15:02:30 2006 @@ -868,6 +868,9 @@ SDOperand LD = DAG.getLoad(isPIC ? MVT::i32 : PTy, Copy.getValue(1), ADD, DAG.getSrcValue(0)); if (isPIC) { + // For Pic, the sequence is: + // BRIND(load(Jumptable + index) + RelocBase) + // RelocBase is the JumpTable on PPC and X86, GOT on Alpha SDOperand Reloc = DAG.getNode(ISD::JumpTableRelocBase, PTy, TAB); ADD = DAG.getNode(ISD::ADD, PTy, ((PTy != MVT::i32) ? DAG.getNode(ISD::SIGN_EXTEND, PTy, LD) : LD), Reloc); From evan.cheng at apple.com Tue Sep 26 17:29:45 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 26 Sep 2006 17:29:45 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/PrologEpilogInserter.cpp Message-ID: <200609262229.k8QMTj5q006228@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: PrologEpilogInserter.cpp updated: 1.58 -> 1.59 --- Log message: Rename function. It's determining which callee-save registers to save. --- Diffs of the changes: (+7 -7) PrologEpilogInserter.cpp | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) Index: llvm/lib/CodeGen/PrologEpilogInserter.cpp diff -u llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.58 llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.59 --- llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.58 Sun Aug 27 07:54:01 2006 +++ llvm/lib/CodeGen/PrologEpilogInserter.cpp Tue Sep 26 17:29:31 2006 @@ -43,11 +43,11 @@ Fn.getFrameInfo()->setMachineDebugInfo(DI); } - // Scan the function for modified caller saved registers and insert spill - // code for any caller saved registers that are modified. Also calculate + // Scan the function for modified callee saved registers and insert spill + // code for any callee saved registers that are modified. Also calculate // the MaxCallFrameSize and HasCalls variables for the function's frame // information and eliminates call frame pseudo instructions. - calculateCallerSavedRegisters(Fn); + calculateCalleeSavedRegisters(Fn); // Add the code to save and restore the caller saved registers saveCallerSavedRegisters(Fn); @@ -61,7 +61,7 @@ // Add prolog and epilog code to the function. This function is required // to align the stack frame as necessary for any stack variables or - // called functions. Because of this, calculateCallerSavedRegisters + // called functions. Because of this, calculateCalleeSavedRegisters // must be called before this function in order to set the HasCalls // and MaxCallFrameSize variables. insertPrologEpilogCode(Fn); @@ -75,7 +75,7 @@ } private: - void calculateCallerSavedRegisters(MachineFunction &Fn); + void calculateCalleeSavedRegisters(MachineFunction &Fn); void saveCallerSavedRegisters(MachineFunction &Fn); void calculateFrameObjectOffsets(MachineFunction &Fn); void replaceFrameIndices(MachineFunction &Fn); @@ -90,12 +90,12 @@ FunctionPass *llvm::createPrologEpilogCodeInserter() { return new PEI(); } -/// calculateCallerSavedRegisters - Scan the function for modified caller saved +/// calculateCalleeSavedRegisters - Scan the function for modified caller saved /// registers. Also calculate the MaxCallFrameSize and HasCalls variables for /// the function's frame information and eliminates call frame pseudo /// instructions. /// -void PEI::calculateCallerSavedRegisters(MachineFunction &Fn) { +void PEI::calculateCalleeSavedRegisters(MachineFunction &Fn) { const MRegisterInfo *RegInfo = Fn.getTarget().getRegisterInfo(); const TargetFrameInfo *TFI = Fn.getTarget().getFrameInfo(); From sabre at nondot.org Tue Sep 26 18:45:23 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 26 Sep 2006 18:45:23 -0500 Subject: [llvm-commits] CVS: llvm/utils/TableGen/AsmWriterEmitter.cpp Message-ID: <200609262345.k8QNjNsf007325@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: AsmWriterEmitter.cpp updated: 1.41 -> 1.42 --- Log message: Add support for ${:foo} syntax, where "foo" is passed into "printSpecial" and has no associated operand. This is useful for portably encoding stuff like the comment character into an asm string. --- Diffs of the changes: (+25 -16) AsmWriterEmitter.cpp | 41 +++++++++++++++++++++++++---------------- 1 files changed, 25 insertions(+), 16 deletions(-) Index: llvm/utils/TableGen/AsmWriterEmitter.cpp diff -u llvm/utils/TableGen/AsmWriterEmitter.cpp:1.41 llvm/utils/TableGen/AsmWriterEmitter.cpp:1.42 --- llvm/utils/TableGen/AsmWriterEmitter.cpp:1.41 Mon Sep 4 21:12:02 2006 +++ llvm/utils/TableGen/AsmWriterEmitter.cpp Tue Sep 26 18:45:08 2006 @@ -98,7 +98,9 @@ if (OperandType == isLiteralTextOperand) return "O << \"" + Str + "\"; "; - std::string Result = Str + "(MI, " + utostr(MIOpNo); + std::string Result = Str + "(MI"; + if (MIOpNo != ~0U) + Result += ", " + utostr(MIOpNo); if (!MiModifier.empty()) Result += ", \"" + MiModifier + '"'; return Result + "); "; @@ -172,7 +174,8 @@ AsmString.begin()+VarEnd); // Modifier - Support ${foo:modifier} syntax, where "modifier" is passed - // into printOperand. + // into printOperand. Also support ${:feature}, which is passed into + // printSpecial. std::string Modifier; // In order to avoid starting the next string at the terminating curly @@ -204,23 +207,29 @@ + CGI.TheDef->getName() + "'"; ++VarEnd; } - if (VarName.empty()) + if (VarName.empty() && Modifier.empty()) throw "Stray '$' in '" + CGI.TheDef->getName() + "' asm string, maybe you want $$?"; - unsigned OpNo = CGI.getOperandNamed(VarName); - CodeGenInstruction::OperandInfo OpInfo = CGI.OperandList[OpNo]; - - // If this is a two-address instruction, verify the second operand isn't - // used. - unsigned MIOp = OpInfo.MIOperandNo; - if (CGI.isTwoAddress && MIOp == 1) - throw "Should refer to operand #0 instead of #1 for two-address" - " instruction '" + CGI.TheDef->getName() + "'!"; - - if (CurVariant == Variant || CurVariant == ~0U) - Operands.push_back(AsmWriterOperand(OpInfo.PrinterMethodName, MIOp, - Modifier)); + if (VarName.empty()) { + // Just a modifier, pass this into printSpecial. + Operands.push_back(AsmWriterOperand("printSpecial", ~0U, Modifier)); + } else { + // Otherwise, normal operand. + unsigned OpNo = CGI.getOperandNamed(VarName); + CodeGenInstruction::OperandInfo OpInfo = CGI.OperandList[OpNo]; + + // If this is a two-address instruction, verify the second operand isn't + // used. + unsigned MIOp = OpInfo.MIOperandNo; + if (CGI.isTwoAddress && MIOp == 1) + throw "Should refer to operand #0 instead of #1 for two-address" + " instruction '" + CGI.TheDef->getName() + "'!"; + + if (CurVariant == Variant || CurVariant == ~0U) + Operands.push_back(AsmWriterOperand(OpInfo.PrinterMethodName, MIOp, + Modifier)); + } LastEmitted = VarEnd; } } From sabre at nondot.org Tue Sep 26 18:47:25 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 26 Sep 2006 18:47:25 -0500 Subject: [llvm-commits] CVS: llvm/utils/TableGen/AsmWriterEmitter.cpp Message-ID: <200609262347.k8QNlPVg007402@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: AsmWriterEmitter.cpp updated: 1.42 -> 1.43 --- Log message: Actually, name the method PrintSpecial to match other stuff in AsmPrinter.h --- Diffs of the changes: (+3 -3) AsmWriterEmitter.cpp | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/utils/TableGen/AsmWriterEmitter.cpp diff -u llvm/utils/TableGen/AsmWriterEmitter.cpp:1.42 llvm/utils/TableGen/AsmWriterEmitter.cpp:1.43 --- llvm/utils/TableGen/AsmWriterEmitter.cpp:1.42 Tue Sep 26 18:45:08 2006 +++ llvm/utils/TableGen/AsmWriterEmitter.cpp Tue Sep 26 18:47:10 2006 @@ -175,7 +175,7 @@ // Modifier - Support ${foo:modifier} syntax, where "modifier" is passed // into printOperand. Also support ${:feature}, which is passed into - // printSpecial. + // PrintSpecial. std::string Modifier; // In order to avoid starting the next string at the terminating curly @@ -212,8 +212,8 @@ "' asm string, maybe you want $$?"; if (VarName.empty()) { - // Just a modifier, pass this into printSpecial. - Operands.push_back(AsmWriterOperand("printSpecial", ~0U, Modifier)); + // Just a modifier, pass this into PrintSpecial. + Operands.push_back(AsmWriterOperand("PrintSpecial", ~0U, Modifier)); } else { // Otherwise, normal operand. unsigned OpNo = CGI.getOperandNamed(VarName); From sabre at nondot.org Tue Sep 26 19:00:05 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 26 Sep 2006 19:00:05 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/AsmPrinter.h Message-ID: <200609270000.k8R005oI007688@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: AsmPrinter.h updated: 1.49 -> 1.50 --- Log message: Add support for ${:comment}, which expands to the current target's comment character, and ${:uid} which expands to a unique ID for the MachineInstr. More can be added if/when they are needed. --- Diffs of the changes: (+8 -0) AsmPrinter.h | 8 ++++++++ 1 files changed, 8 insertions(+) Index: llvm/include/llvm/CodeGen/AsmPrinter.h diff -u llvm/include/llvm/CodeGen/AsmPrinter.h:1.49 llvm/include/llvm/CodeGen/AsmPrinter.h:1.50 --- llvm/include/llvm/CodeGen/AsmPrinter.h:1.49 Mon Sep 25 22:38:18 2006 +++ llvm/include/llvm/CodeGen/AsmPrinter.h Tue Sep 26 18:59:50 2006 @@ -108,6 +108,14 @@ /// doFinalization - Shut down the asmprinter. If you override this in your /// pass, you must make sure to call it explicitly. bool doFinalization(Module &M); + + /// PrintSpecial - Print information related to the specified machine instr + /// that is independent of the operand, and may be independent of the instr + /// itself. This can be useful for portably encoding the comment character + /// or other bits of target-specific knowledge into the asmstrings. The + /// syntax used is ${:comment}. Targets can override this to add support + /// for their own strange codes. + virtual void PrintSpecial(const MachineInstr *MI, const char *Code); /// PrintAsmOperand - Print the specified operand of MI, an INLINEASM /// instruction, using the specified assembler variant. Targets should From sabre at nondot.org Tue Sep 26 19:00:06 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 26 Sep 2006 19:00:06 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp Message-ID: <200609270000.k8R006JW007693@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: AsmPrinter.cpp updated: 1.99 -> 1.100 --- Log message: Add support for ${:comment}, which expands to the current target's comment character, and ${:uid} which expands to a unique ID for the MachineInstr. More can be added if/when they are needed. --- Diffs of the changes: (+24 -0) AsmPrinter.cpp | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+) Index: llvm/lib/CodeGen/AsmPrinter.cpp diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.99 llvm/lib/CodeGen/AsmPrinter.cpp:1.100 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.99 Mon Sep 25 22:38:18 2006 +++ llvm/lib/CodeGen/AsmPrinter.cpp Tue Sep 26 18:59:50 2006 @@ -619,6 +619,30 @@ abort(); } +/// PrintSpecial - Print information related to the specified machine instr +/// that is independent of the operand, and may be independent of the instr +/// itself. This can be useful for portably encoding the comment character +/// or other bits of target-specific knowledge into the asmstrings. The +/// syntax used is ${:comment}. Targets can override this to add support +/// for their own strange codes. +void AsmPrinter::PrintSpecial(const MachineInstr *MI, const char *Code) { + if (!strcmp(Code, "comment")) { + O << TAI->getCommentString(); + } else if (!strcmp(Code, "uid")) { + // Assign a unique ID to this machine instruction. + static const MachineInstr *LastMI = 0; + static unsigned Counter = 0U-1; + // If this is a new machine instruction, bump the counter. + if (LastMI != MI) { ++Counter; LastMI = MI; } + O << Counter; + } else { + std::cerr << "Unknown special formatter '" << Code + << "' for machine instr: " << *MI; + exit(1); + } +} + + /// printInlineAsm - This method formats and prints the specified machine /// instruction that is an inline asm. void AsmPrinter::printInlineAsm(const MachineInstr *MI) const { From sabre at nondot.org Tue Sep 26 19:06:21 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 26 Sep 2006 19:06:21 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp Message-ID: <200609270006.k8R06Luk007848@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: AsmPrinter.cpp updated: 1.100 -> 1.101 --- Log message: Add support for ${:private} which prints "L" on darwin. --- Diffs of the changes: (+3 -1) AsmPrinter.cpp | 4 +++- 1 files changed, 3 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/AsmPrinter.cpp diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.100 llvm/lib/CodeGen/AsmPrinter.cpp:1.101 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.100 Tue Sep 26 18:59:50 2006 +++ llvm/lib/CodeGen/AsmPrinter.cpp Tue Sep 26 19:06:07 2006 @@ -626,7 +626,9 @@ /// syntax used is ${:comment}. Targets can override this to add support /// for their own strange codes. void AsmPrinter::PrintSpecial(const MachineInstr *MI, const char *Code) { - if (!strcmp(Code, "comment")) { + if (!strcmp(Code, "private")) { + O << TAI->getPrivateGlobalPrefix(); + } else if (!strcmp(Code, "comment")) { O << TAI->getCommentString(); } else if (!strcmp(Code, "uid")) { // Assign a unique ID to this machine instruction. From sabre at nondot.org Tue Sep 26 21:55:35 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 26 Sep 2006 21:55:35 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCInstrInfo.td Message-ID: <200609270255.k8R2tZEs010586@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCInstrInfo.td updated: 1.242 -> 1.243 --- Log message: Use abstract private/comment directives, to increase portability to ppc/linux --- Diffs of the changes: (+18 -13) PPCInstrInfo.td | 31 ++++++++++++++++++------------- 1 files changed, 18 insertions(+), 13 deletions(-) Index: llvm/lib/Target/PowerPC/PPCInstrInfo.td diff -u llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.242 llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.243 --- llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.242 Fri Sep 22 00:01:56 2006 +++ llvm/lib/Target/PowerPC/PPCInstrInfo.td Tue Sep 26 21:55:21 2006 @@ -275,20 +275,20 @@ let hasCtrlDep = 1 in { def ADJCALLSTACKDOWN : Pseudo<(ops u16imm:$amt), - "; ADJCALLSTACKDOWN", + "${:comment} ADJCALLSTACKDOWN", [(callseq_start imm:$amt)]>; def ADJCALLSTACKUP : Pseudo<(ops u16imm:$amt), - "; ADJCALLSTACKUP", + "${:comment} ADJCALLSTACKUP", [(callseq_end imm:$amt)]>; def UPDATE_VRSAVE : Pseudo<(ops GPRC:$rD, GPRC:$rS), "UPDATE_VRSAVE $rD, $rS", []>; } -def IMPLICIT_DEF_GPRC: Pseudo<(ops GPRC:$rD), "; IMPLICIT_DEF_GPRC $rD", +def IMPLICIT_DEF_GPRC: Pseudo<(ops GPRC:$rD),"${:comment}IMPLICIT_DEF_GPRC $rD", [(set GPRC:$rD, (undef))]>; -def IMPLICIT_DEF_F8 : Pseudo<(ops F8RC:$rD), "; IMPLICIT_DEF_F8 $rD", +def IMPLICIT_DEF_F8 : Pseudo<(ops F8RC:$rD), "${:comment} IMPLICIT_DEF_F8 $rD", [(set F8RC:$rD, (undef))]>; -def IMPLICIT_DEF_F4 : Pseudo<(ops F4RC:$rD), "; IMPLICIT_DEF_F4 $rD", +def IMPLICIT_DEF_F4 : Pseudo<(ops F4RC:$rD), "${:comment} IMPLICIT_DEF_F4 $rD", [(set F4RC:$rD, (undef))]>; // SELECT_CC_* - Used to implement the SELECT_CC DAG operation. Expanded by the @@ -296,15 +296,20 @@ let usesCustomDAGSchedInserter = 1, // Expanded by the scheduler. PPC970_Single = 1 in { def SELECT_CC_I4 : Pseudo<(ops GPRC:$dst, CRRC:$cond, GPRC:$T, GPRC:$F, - i32imm:$BROPC), "; SELECT_CC PSEUDO!", []>; + i32imm:$BROPC), "${:comment} SELECT_CC PSEUDO!", + []>; def SELECT_CC_I8 : Pseudo<(ops G8RC:$dst, CRRC:$cond, G8RC:$T, G8RC:$F, - i32imm:$BROPC), "; SELECT_CC PSEUDO!", []>; + i32imm:$BROPC), "${:comment} SELECT_CC PSEUDO!", + []>; def SELECT_CC_F4 : Pseudo<(ops F4RC:$dst, CRRC:$cond, F4RC:$T, F4RC:$F, - i32imm:$BROPC), "; SELECT_CC PSEUDO!", []>; + i32imm:$BROPC), "${:comment} SELECT_CC PSEUDO!", + []>; def SELECT_CC_F8 : Pseudo<(ops F8RC:$dst, CRRC:$cond, F8RC:$T, F8RC:$F, - i32imm:$BROPC), "; SELECT_CC PSEUDO!", []>; + i32imm:$BROPC), "${:comment} SELECT_CC PSEUDO!", + []>; def SELECT_CC_VRRC: Pseudo<(ops VRRC:$dst, CRRC:$cond, VRRC:$T, VRRC:$F, - i32imm:$BROPC), "; SELECT_CC PSEUDO!", []>; + i32imm:$BROPC), "${:comment} SELECT_CC PSEUDO!", + []>; } let isTerminator = 1, noResults = 1, PPC970_Unit = 7 in { @@ -320,7 +325,7 @@ let isBranch = 1, isTerminator = 1, hasCtrlDep = 1, noResults = 1, PPC970_Unit = 7 in { def COND_BRANCH : Pseudo<(ops CRRC:$crS, u16imm:$opc, target:$dst), - "; COND_BRANCH $crS, $opc, $dst", + "${:comment} COND_BRANCH $crS, $opc, $dst", [(PPCcondbranch CRRC:$crS, imm:$opc, bb:$dst)]>; def B : IForm<18, 0, 0, (ops target:$dst), "b $dst", BrB, @@ -895,12 +900,12 @@ // def DWARF_LOC : Pseudo<(ops i32imm:$line, i32imm:$col, i32imm:$file), - "; .loc $file, $line, $col", + "${:comment} .loc $file, $line, $col", [(dwarf_loc (i32 imm:$line), (i32 imm:$col), (i32 imm:$file))]>; def DWARF_LABEL : Pseudo<(ops i32imm:$id), - "\nLdebug_loc$id:", + "\n${:private}debug_loc$id:", [(dwarf_label (i32 imm:$id))]>; //===----------------------------------------------------------------------===// From dpatel at apple.com Tue Sep 26 21:58:58 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 26 Sep 2006 21:58:58 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Analysis/Dominators/2006-09-26-PostDominanceFrontier.ll Message-ID: <200609270258.k8R2ww0S010704@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Analysis/Dominators: 2006-09-26-PostDominanceFrontier.ll added (r1.1) --- Log message: Add http://llvm.org/bugs/show_bug.cgi?id=923 test case. --- Diffs of the changes: (+100 -0) 2006-09-26-PostDominanceFrontier.ll | 100 ++++++++++++++++++++++++++++++++++++ 1 files changed, 100 insertions(+) Index: llvm/test/Regression/Analysis/Dominators/2006-09-26-PostDominanceFrontier.ll diff -c /dev/null llvm/test/Regression/Analysis/Dominators/2006-09-26-PostDominanceFrontier.ll:1.1 *** /dev/null Tue Sep 26 21:58:54 2006 --- llvm/test/Regression/Analysis/Dominators/2006-09-26-PostDominanceFrontier.ll Tue Sep 26 21:58:44 2006 *************** *** 0 **** --- 1,100 ---- + ; RUN: llvm-as < %s | opt -analyze -postdomfrontier -disable-verify + ; + ; ModuleID = '2006-09-26-PostDominanceFrontier.bc' + target endian = little + target pointersize = 64 + target triple = "alphaev67-unknown-linux-gnu" + %struct.FILE = type { int, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, %struct._IO_marker*, %struct.FILE*, int, int, long, ushort, sbyte, [1 x sbyte], sbyte*, long, sbyte*, sbyte*, int, [44 x sbyte] } + %struct._IO_marker = type { %struct._IO_marker*, %struct.FILE*, int } + %TOP = external global ulong* ; [#uses=1] + %BOT = external global ulong* ; [#uses=1] + %str = external global [2 x sbyte] ; <[2 x sbyte]*> [#uses=0] + + implementation ; Functions: + + declare void %fopen() + + void %main(sbyte** %argv) { + entry: + %netSelect.i507 = alloca ulong, align 8 ; [#uses=0] + %topStart.i = alloca ulong, align 8 ; [#uses=0] + %topEnd.i = alloca ulong, align 8 ; [#uses=0] + %botStart.i = alloca ulong, align 8 ; [#uses=0] + %botEnd.i = alloca ulong, align 8 ; [#uses=0] + %c1.i154 = alloca uint, align 4 ; [#uses=0] + %b1.i155 = alloca uint, align 4 ; [#uses=0] + %t1.i156 = alloca uint, align 4 ; [#uses=0] + %c1.i = alloca uint, align 4 ; [#uses=0] + %b1.i = alloca uint, align 4 ; [#uses=0] + %t1.i = alloca uint, align 4 ; [#uses=0] + %netSelect.i5 = alloca ulong, align 8 ; [#uses=0] + %netSelect.i = alloca ulong, align 8 ; [#uses=0] + %tmp2.i = getelementptr sbyte** %argv, int 1 ; [#uses=1] + %tmp3.i4 = load sbyte** %tmp2.i ; [#uses=0] + call void %fopen( ) + br bool false, label %DimensionChannel.exit, label %bb.backedge.i + + bb.backedge.i: ; preds = %entry + ret void + + DimensionChannel.exit: ; preds = %entry + %tmp13.i137 = malloc ulong, uint 0 ; [#uses=1] + %tmp610.i = malloc ulong, uint 0 ; [#uses=1] + br label %cond_true.i143 + + cond_true.i143: ; preds = %cond_true.i143, %DimensionChannel.exit + %tmp9.i140 = getelementptr ulong* %tmp13.i137, ulong 0 ; [#uses=0] + %tmp12.i = getelementptr ulong* %tmp610.i, ulong 0 ; [#uses=0] + br bool false, label %bb18.i144, label %cond_true.i143 + + bb18.i144: ; preds = %cond_true.i143 + call void %fopen( ) + %tmp76.i105 = malloc ulong, uint 0 ; [#uses=3] + %tmp674.i = malloc ulong, uint 0 ; [#uses=2] + %tmp1072.i = malloc ulong, uint 0 ; [#uses=2] + %tmp1470.i = malloc ulong, uint 0 ; [#uses=1] + br label %cond_true.i114 + + cond_true.i114: ; preds = %cond_true.i114, %bb18.i144 + %tmp17.i108 = getelementptr ulong* %tmp76.i105, ulong 0 ; [#uses=0] + %tmp20.i = getelementptr ulong* %tmp674.i, ulong 0 ; [#uses=0] + %tmp23.i111 = getelementptr ulong* %tmp1470.i, ulong 0 ; [#uses=0] + br bool false, label %cond_true40.i, label %cond_true.i114 + + cond_true40.i: ; preds = %cond_true40.i, %cond_true.i114 + %tmp33.i115 = getelementptr ulong* %tmp1072.i, ulong 0 ; [#uses=0] + br bool false, label %bb142.i, label %cond_true40.i + + cond_next54.i: ; preds = %cond_true76.i + %tmp57.i = getelementptr ulong* %tmp55.i, ulong 0 ; [#uses=0] + br bool false, label %bb64.i, label %bb69.i + + bb64.i: ; preds = %cond_true76.i, %cond_next54.i + %tmp67.i117 = getelementptr ulong* %tmp76.i105, ulong 0 ; [#uses=0] + br bool false, label %bb114.i, label %cond_true111.i + + bb69.i: ; preds = %cond_next54.i + br bool false, label %bb79.i, label %cond_true76.i + + cond_true76.i: ; preds = %bb142.i, %bb69.i + %tmp48.i = getelementptr ulong* %tmp46.i, ulong 0 ; [#uses=0] + br bool false, label %bb64.i, label %cond_next54.i + + bb79.i: ; preds = %bb69.i + br bool false, label %bb114.i, label %cond_true111.i + + cond_true111.i: ; preds = %bb79.i, %bb64.i + %tmp84.i127 = getelementptr ulong* %tmp46.i, ulong 0 ; [#uses=0] + ret void + + bb114.i: ; preds = %bb142.i, %bb79.i, %bb64.i + %tmp117.i = getelementptr ulong* %tmp76.i105, ulong 0 ; [#uses=0] + %tmp132.i131 = getelementptr ulong* %tmp674.i, ulong 0 ; [#uses=0] + %tmp122.i = getelementptr ulong* %tmp1072.i, ulong 0 ; [#uses=0] + ret void + + bb142.i: ; preds = %cond_true40.i + %tmp46.i = load ulong** %BOT ; [#uses=2] + %tmp55.i = load ulong** %TOP ; [#uses=1] + br bool false, label %bb114.i, label %cond_true76.i + } From sabre at nondot.org Tue Sep 26 23:58:37 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 26 Sep 2006 23:58:37 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/TailDuplication.cpp Message-ID: <200609270458.k8R4wbM2012489@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: TailDuplication.cpp updated: 1.32 -> 1.33 --- Log message: set DEBUG_TYPE right --- Diffs of the changes: (+1 -0) TailDuplication.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Transforms/Scalar/TailDuplication.cpp diff -u llvm/lib/Transforms/Scalar/TailDuplication.cpp:1.32 llvm/lib/Transforms/Scalar/TailDuplication.cpp:1.33 --- llvm/lib/Transforms/Scalar/TailDuplication.cpp:1.32 Sun Sep 10 13:17:58 2006 +++ llvm/lib/Transforms/Scalar/TailDuplication.cpp Tue Sep 26 23:58:23 2006 @@ -18,6 +18,7 @@ // //===----------------------------------------------------------------------===// +#define DEBUG_TYPE "tailduplicate" #include "llvm/Transforms/Scalar.h" #include "llvm/Constant.h" #include "llvm/Function.h" From isanbard at gmail.com Wed Sep 27 04:04:30 2006 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 27 Sep 2006 04:04:30 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/PHIElimination.cpp Message-ID: <200609270904.k8R94UIC011238@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: PHIElimination.cpp updated: 1.45 -> 1.46 --- Log message: PR878: http://llvm.org/PR878 : Instead of calculating the vreg to PHI use count everytime we get a function, do it up front in linear time (going through all of the instructions once). We create a map out of them. Then it's no problem to use the information in it during elimination... --- Diffs of the changes: (+44 -24) PHIElimination.cpp | 68 ++++++++++++++++++++++++++++++++++------------------- 1 files changed, 44 insertions(+), 24 deletions(-) Index: llvm/lib/CodeGen/PHIElimination.cpp diff -u llvm/lib/CodeGen/PHIElimination.cpp:1.45 llvm/lib/CodeGen/PHIElimination.cpp:1.46 --- llvm/lib/CodeGen/PHIElimination.cpp:1.45 Sun Aug 27 07:54:01 2006 +++ llvm/lib/CodeGen/PHIElimination.cpp Wed Sep 27 04:04:15 2006 @@ -34,12 +34,15 @@ struct VISIBILITY_HIDDEN PNE : public MachineFunctionPass { bool runOnMachineFunction(MachineFunction &Fn) { + analyzePHINodes(Fn); + bool Changed = false; // Eliminate PHI instructions by inserting copies into predecessor blocks. for (MachineFunction::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I) Changed |= EliminatePHINodes(Fn, *I); + VRegPHIUseCount.clear(); return Changed; } @@ -54,15 +57,26 @@ /// bool EliminatePHINodes(MachineFunction &MF, MachineBasicBlock &MBB); void LowerAtomicPHINode(MachineBasicBlock &MBB, - MachineBasicBlock::iterator AfterPHIsIt, - DenseMap &VUC); + MachineBasicBlock::iterator AfterPHIsIt); + + /// analyzePHINodes - Gather information about the PHI nodes in + /// here. In particular, we want to map the number of uses of a virtual + /// register which is used in a PHI node. We map that to the BB the + /// vreg is coming from. This is used later to determine when the vreg + /// is killed in the BB. + /// + void analyzePHINodes(const MachineFunction& Fn); + + typedef std::pair BBVRegPair; + typedef std::map VRegPHIUse; + + VRegPHIUse VRegPHIUseCount; }; RegisterPass X("phi-node-elimination", "Eliminate PHI nodes for register allocation"); } - const PassInfo *llvm::PHIEliminationID = X.getPassInfo(); /// EliminatePHINodes - Eliminate phi nodes by inserting copy instructions in @@ -72,20 +86,6 @@ if (MBB.empty() || MBB.front().getOpcode() != TargetInstrInfo::PHI) return false; // Quick exit for basic blocks without PHIs. - // VRegPHIUseCount - Keep track of the number of times each virtual register - // is used by PHI nodes in successors of this block. - DenseMap VRegPHIUseCount; - VRegPHIUseCount.grow(MF.getSSARegMap()->getLastVirtReg()); - - for (MachineBasicBlock::pred_iterator PI = MBB.pred_begin(), - E = MBB.pred_end(); PI != E; ++PI) - for (MachineBasicBlock::succ_iterator SI = (*PI)->succ_begin(), - E = (*PI)->succ_end(); SI != E; ++SI) - for (MachineBasicBlock::iterator BBI = (*SI)->begin(), E = (*SI)->end(); - BBI != E && BBI->getOpcode() == TargetInstrInfo::PHI; ++BBI) - for (unsigned i = 1, e = BBI->getNumOperands(); i != e; i += 2) - VRegPHIUseCount[BBI->getOperand(i).getReg()]++; - // Get an iterator to the first instruction after the last PHI node (this may // also be the end of the basic block). MachineBasicBlock::iterator AfterPHIsIt = MBB.begin(); @@ -93,9 +93,9 @@ AfterPHIsIt->getOpcode() == TargetInstrInfo::PHI) ++AfterPHIsIt; // Skip over all of the PHI nodes... - while (MBB.front().getOpcode() == TargetInstrInfo::PHI) { - LowerAtomicPHINode(MBB, AfterPHIsIt, VRegPHIUseCount); - } + while (MBB.front().getOpcode() == TargetInstrInfo::PHI) + LowerAtomicPHINode(MBB, AfterPHIsIt); + return true; } @@ -115,8 +115,7 @@ /// atomic execution of PHIs. This lowering method is always correct all of the /// time. void PNE::LowerAtomicPHINode(MachineBasicBlock &MBB, - MachineBasicBlock::iterator AfterPHIsIt, - DenseMap &VRegPHIUseCount) { + MachineBasicBlock::iterator AfterPHIsIt) { // Unlink the PHI node from the basic block, but don't delete the PHI yet. MachineInstr *MPhi = MBB.remove(MBB.begin()); @@ -167,7 +166,9 @@ // node. unsigned NumPreds = (MPhi->getNumOperands()-1)/2; for (unsigned i = 1; i != MPhi->getNumOperands(); i += 2) - VRegPHIUseCount[MPhi->getOperand(i).getReg()] -= NumPreds; + VRegPHIUseCount[BBVRegPair( + MPhi->getOperand(i + 1).getMachineBasicBlock(), + MPhi->getOperand(i).getReg())] -= NumPreds; // Now loop over all of the incoming arguments, changing them to copy into // the IncomingReg register in the corresponding predecessor basic block. @@ -219,7 +220,10 @@ // // Is it used by any PHI instructions in this block? - bool ValueIsLive = VRegPHIUseCount[SrcReg] != 0; + bool ValueIsLive = + VRegPHIUseCount[BBVRegPair( + MPhi->getOperand(i).getMachineBasicBlock(), + SrcReg)] != 0; std::vector OpSuccBlocks; @@ -317,3 +321,19 @@ delete MPhi; ++NumAtomic; } + +/// analyzePHINodes - Gather information about the PHI nodes in here. In +/// particular, we want to map the number of uses of a virtual register which is +/// used in a PHI node. We map that to the BB the vreg is coming from. This is +/// used later to determine when the vreg is killed in the BB. +/// +void PNE::analyzePHINodes(const MachineFunction& Fn) { + for (MachineFunction::const_iterator I = Fn.begin(), E = Fn.end(); + I != E; ++I) + for (MachineBasicBlock::const_iterator BBI = I->begin(), BBE = I->end(); + BBI != BBE && BBI->getOpcode() == TargetInstrInfo::PHI; ++BBI) + for (unsigned i = 1, e = BBI->getNumOperands(); i != e; i += 2) + VRegPHIUseCount[BBVRegPair( + BBI->getOperand(i + 1).getMachineBasicBlock(), + BBI->getOperand(i).getReg())]++; +} From sabre at nondot.org Wed Sep 27 11:44:26 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 27 Sep 2006 11:44:26 -0500 Subject: [llvm-commits] CVS: llvm/utils/TableGen/AsmWriterEmitter.cpp Message-ID: <200609271644.k8RGiQ8A009679@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: AsmWriterEmitter.cpp updated: 1.43 -> 1.44 --- Log message: This: AggregateString += "\0\0"; Doesn't add two nuls to the AggregateString (for obvious reasons), which broke the asmprinter when the first character of an asm string was not literal text. --- Diffs of the changes: (+3 -2) AsmWriterEmitter.cpp | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) Index: llvm/utils/TableGen/AsmWriterEmitter.cpp diff -u llvm/utils/TableGen/AsmWriterEmitter.cpp:1.43 llvm/utils/TableGen/AsmWriterEmitter.cpp:1.44 --- llvm/utils/TableGen/AsmWriterEmitter.cpp:1.43 Tue Sep 26 18:47:10 2006 +++ llvm/utils/TableGen/AsmWriterEmitter.cpp Wed Sep 27 11:44:09 2006 @@ -484,9 +484,10 @@ // Build an aggregate string, and build a table of offsets into it. std::map StringOffset; std::string AggregateString; - AggregateString += "\0\0"; + AggregateString.push_back(0); // "\0" + AggregateString.push_back(0); // "\0" - /// OpcodeInfo - Theis encodes the index of the string to use for the first + /// OpcodeInfo - This encodes the index of the string to use for the first /// chunk of the output as well as indices used for operand printing. std::vector OpcodeInfo; From jlaskey at apple.com Wed Sep 27 11:55:34 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 27 Sep 2006 11:55:34 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/C++Frontend/2006-09-27-Debug-Protection.cpp Message-ID: <200609271655.k8RGtYmd009847@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/C++Frontend: 2006-09-27-Debug-Protection.cpp added (r1.1) --- Log message: Make sure C++ protection shows up in debug info --- Diffs of the changes: (+13 -0) 2006-09-27-Debug-Protection.cpp | 13 +++++++++++++ 1 files changed, 13 insertions(+) Index: llvm/test/Regression/C++Frontend/2006-09-27-Debug-Protection.cpp diff -c /dev/null llvm/test/Regression/C++Frontend/2006-09-27-Debug-Protection.cpp:1.1 *** /dev/null Wed Sep 27 11:55:29 2006 --- llvm/test/Regression/C++Frontend/2006-09-27-Debug-Protection.cpp Wed Sep 27 11:55:19 2006 *************** *** 0 **** --- 1,13 ---- + // RUN: %llvmgxx -O0 -emit-llvm -S -g -o - %s | grep 'uint 1,' && + // RUN: %llvmgxx -O0 -emit-llvm -S -g -o - %s | grep 'uint 2,' + + class A { + public: + int x; + protected: + int y; + private: + int z; + }; + + A a; From jlaskey at apple.com Wed Sep 27 11:58:43 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 27 Sep 2006 11:58:43 -0500 Subject: [llvm-commits] CVS: llvm-test/Makefile.programs Message-ID: <200609271658.k8RGwhoN010022@zion.cs.uiuc.edu> Changes in directory llvm-test: Makefile.programs updated: 1.227 -> 1.228 --- Log message: Disable -combiner-alias-analysis LLCBETA for the time being --- Diffs of the changes: (+2 -2) Makefile.programs | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-test/Makefile.programs diff -u llvm-test/Makefile.programs:1.227 llvm-test/Makefile.programs:1.228 --- llvm-test/Makefile.programs:1.227 Tue Sep 26 12:47:19 2006 +++ llvm-test/Makefile.programs Wed Sep 27 11:58:28 2006 @@ -193,7 +193,7 @@ endif#DISABLE_DIFFS ifeq ($(ARCH),PowerPC) -LLCBETAOPTION := -combiner-alias-analysis +#LLCBETAOPTION := -combiner-alias-analysis endif ifeq ($(ARCH),Alpha) LLCBETAOPTION := -sched=list-td @@ -203,7 +203,7 @@ LLCBETAOPTION := -sched=simple endif ifeq ($(ARCH),x86) -LLCBETAOPTION := -combiner-alias-analysis +#LLCBETAOPTION := -combiner-alias-analysis endif ifeq ($(ARCH),Sparc) LLCBETAOPTION := -enable-sparc-v9-insts From sabre at nondot.org Wed Sep 27 11:59:31 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 27 Sep 2006 11:59:31 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/PHIElimination.cpp Message-ID: <200609271659.k8RGxVwn010103@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: PHIElimination.cpp updated: 1.46 -> 1.47 --- Log message: Temporarily revert this. This breaks Olden/bisort on PPC --- Diffs of the changes: (+24 -44) PHIElimination.cpp | 68 ++++++++++++++++++----------------------------------- 1 files changed, 24 insertions(+), 44 deletions(-) Index: llvm/lib/CodeGen/PHIElimination.cpp diff -u llvm/lib/CodeGen/PHIElimination.cpp:1.46 llvm/lib/CodeGen/PHIElimination.cpp:1.47 --- llvm/lib/CodeGen/PHIElimination.cpp:1.46 Wed Sep 27 04:04:15 2006 +++ llvm/lib/CodeGen/PHIElimination.cpp Wed Sep 27 11:59:16 2006 @@ -34,15 +34,12 @@ struct VISIBILITY_HIDDEN PNE : public MachineFunctionPass { bool runOnMachineFunction(MachineFunction &Fn) { - analyzePHINodes(Fn); - bool Changed = false; // Eliminate PHI instructions by inserting copies into predecessor blocks. for (MachineFunction::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I) Changed |= EliminatePHINodes(Fn, *I); - VRegPHIUseCount.clear(); return Changed; } @@ -57,26 +54,15 @@ /// bool EliminatePHINodes(MachineFunction &MF, MachineBasicBlock &MBB); void LowerAtomicPHINode(MachineBasicBlock &MBB, - MachineBasicBlock::iterator AfterPHIsIt); - - /// analyzePHINodes - Gather information about the PHI nodes in - /// here. In particular, we want to map the number of uses of a virtual - /// register which is used in a PHI node. We map that to the BB the - /// vreg is coming from. This is used later to determine when the vreg - /// is killed in the BB. - /// - void analyzePHINodes(const MachineFunction& Fn); - - typedef std::pair BBVRegPair; - typedef std::map VRegPHIUse; - - VRegPHIUse VRegPHIUseCount; + MachineBasicBlock::iterator AfterPHIsIt, + DenseMap &VUC); }; RegisterPass X("phi-node-elimination", "Eliminate PHI nodes for register allocation"); } + const PassInfo *llvm::PHIEliminationID = X.getPassInfo(); /// EliminatePHINodes - Eliminate phi nodes by inserting copy instructions in @@ -86,6 +72,20 @@ if (MBB.empty() || MBB.front().getOpcode() != TargetInstrInfo::PHI) return false; // Quick exit for basic blocks without PHIs. + // VRegPHIUseCount - Keep track of the number of times each virtual register + // is used by PHI nodes in successors of this block. + DenseMap VRegPHIUseCount; + VRegPHIUseCount.grow(MF.getSSARegMap()->getLastVirtReg()); + + for (MachineBasicBlock::pred_iterator PI = MBB.pred_begin(), + E = MBB.pred_end(); PI != E; ++PI) + for (MachineBasicBlock::succ_iterator SI = (*PI)->succ_begin(), + E = (*PI)->succ_end(); SI != E; ++SI) + for (MachineBasicBlock::iterator BBI = (*SI)->begin(), E = (*SI)->end(); + BBI != E && BBI->getOpcode() == TargetInstrInfo::PHI; ++BBI) + for (unsigned i = 1, e = BBI->getNumOperands(); i != e; i += 2) + VRegPHIUseCount[BBI->getOperand(i).getReg()]++; + // Get an iterator to the first instruction after the last PHI node (this may // also be the end of the basic block). MachineBasicBlock::iterator AfterPHIsIt = MBB.begin(); @@ -93,9 +93,9 @@ AfterPHIsIt->getOpcode() == TargetInstrInfo::PHI) ++AfterPHIsIt; // Skip over all of the PHI nodes... - while (MBB.front().getOpcode() == TargetInstrInfo::PHI) - LowerAtomicPHINode(MBB, AfterPHIsIt); - + while (MBB.front().getOpcode() == TargetInstrInfo::PHI) { + LowerAtomicPHINode(MBB, AfterPHIsIt, VRegPHIUseCount); + } return true; } @@ -115,7 +115,8 @@ /// atomic execution of PHIs. This lowering method is always correct all of the /// time. void PNE::LowerAtomicPHINode(MachineBasicBlock &MBB, - MachineBasicBlock::iterator AfterPHIsIt) { + MachineBasicBlock::iterator AfterPHIsIt, + DenseMap &VRegPHIUseCount) { // Unlink the PHI node from the basic block, but don't delete the PHI yet. MachineInstr *MPhi = MBB.remove(MBB.begin()); @@ -166,9 +167,7 @@ // node. unsigned NumPreds = (MPhi->getNumOperands()-1)/2; for (unsigned i = 1; i != MPhi->getNumOperands(); i += 2) - VRegPHIUseCount[BBVRegPair( - MPhi->getOperand(i + 1).getMachineBasicBlock(), - MPhi->getOperand(i).getReg())] -= NumPreds; + VRegPHIUseCount[MPhi->getOperand(i).getReg()] -= NumPreds; // Now loop over all of the incoming arguments, changing them to copy into // the IncomingReg register in the corresponding predecessor basic block. @@ -220,10 +219,7 @@ // // Is it used by any PHI instructions in this block? - bool ValueIsLive = - VRegPHIUseCount[BBVRegPair( - MPhi->getOperand(i).getMachineBasicBlock(), - SrcReg)] != 0; + bool ValueIsLive = VRegPHIUseCount[SrcReg] != 0; std::vector OpSuccBlocks; @@ -321,19 +317,3 @@ delete MPhi; ++NumAtomic; } - -/// analyzePHINodes - Gather information about the PHI nodes in here. In -/// particular, we want to map the number of uses of a virtual register which is -/// used in a PHI node. We map that to the BB the vreg is coming from. This is -/// used later to determine when the vreg is killed in the BB. -/// -void PNE::analyzePHINodes(const MachineFunction& Fn) { - for (MachineFunction::const_iterator I = Fn.begin(), E = Fn.end(); - I != E; ++I) - for (MachineBasicBlock::const_iterator BBI = I->begin(), BBE = I->end(); - BBI != BBE && BBI->getOpcode() == TargetInstrInfo::PHI; ++BBI) - for (unsigned i = 1, e = BBI->getNumOperands(); i != e; i += 2) - VRegPHIUseCount[BBVRegPair( - BBI->getOperand(i + 1).getMachineBasicBlock(), - BBI->getOperand(i).getReg())]++; -} From jlaskey at apple.com Wed Sep 27 12:11:35 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 27 Sep 2006 12:11:35 -0500 Subject: [llvm-commits] CVS: llvm-test/Makefile.programs Message-ID: <200609271711.k8RHBZSe010301@zion.cs.uiuc.edu> Changes in directory llvm-test: Makefile.programs updated: 1.228 -> 1.229 --- Log message: Setting LLCBETAOPTION to something useful --- Diffs of the changes: (+2 -2) Makefile.programs | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm-test/Makefile.programs diff -u llvm-test/Makefile.programs:1.228 llvm-test/Makefile.programs:1.229 --- llvm-test/Makefile.programs:1.228 Wed Sep 27 11:58:28 2006 +++ llvm-test/Makefile.programs Wed Sep 27 12:11:19 2006 @@ -193,7 +193,7 @@ endif#DISABLE_DIFFS ifeq ($(ARCH),PowerPC) -#LLCBETAOPTION := -combiner-alias-analysis +LLCBETAOPTION := -fast -regalloc=local endif ifeq ($(ARCH),Alpha) LLCBETAOPTION := -sched=list-td @@ -203,7 +203,7 @@ LLCBETAOPTION := -sched=simple endif ifeq ($(ARCH),x86) -#LLCBETAOPTION := -combiner-alias-analysis +LLCBETAOPTION := -fast -regalloc=local endif ifeq ($(ARCH),Sparc) LLCBETAOPTION := -enable-sparc-v9-insts From dpatel at apple.com Wed Sep 27 12:18:20 2006 From: dpatel at apple.com (Devang Patel) Date: Wed, 27 Sep 2006 12:18:20 -0500 Subject: [llvm-commits] CVS: llvm/lib/Analysis/PostDominators.cpp Message-ID: <200609271718.k8RHIK1X010419@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: PostDominators.cpp updated: 1.60 -> 1.61 --- Log message: Fix DFS walk. Fix http://llvm.org/bugs/show_bug.cgi?id=923 --- Diffs of the changes: (+27 -14) PostDominators.cpp | 41 +++++++++++++++++++++++++++-------------- 1 files changed, 27 insertions(+), 14 deletions(-) Index: llvm/lib/Analysis/PostDominators.cpp diff -u llvm/lib/Analysis/PostDominators.cpp:1.60 llvm/lib/Analysis/PostDominators.cpp:1.61 --- llvm/lib/Analysis/PostDominators.cpp:1.60 Thu Sep 7 18:29:19 2006 +++ llvm/lib/Analysis/PostDominators.cpp Wed Sep 27 12:18:05 2006 @@ -28,36 +28,49 @@ unsigned ImmediatePostDominators::DFSPass(BasicBlock *V, InfoRec &VInfo, unsigned N) { - std::vector > workStack; + std::set visited; workStack.push_back(std::make_pair(V, &VInfo)); do { BasicBlock *currentBB = workStack.back().first; InfoRec *currentVInfo = workStack.back().second; - workStack.pop_back(); - currentVInfo->Semi = ++N; - currentVInfo->Label = currentBB; + // Visit each block only once. + if (visited.count(currentBB) == 0) { - Vertex.push_back(currentBB); // Vertex[n] = current; - // Info[currentBB].Ancestor = 0; - // Ancestor[n] = 0 - // Child[currentBB] = 0; - currentVInfo->Size = 1; // Size[currentBB] = 1 + visited.insert(currentBB); + currentVInfo->Semi = ++N; + currentVInfo->Label = currentBB; + + Vertex.push_back(currentBB); // Vertex[n] = current; + // Info[currentBB].Ancestor = 0; + // Ancestor[n] = 0 + // Child[currentBB] = 0; + currentVInfo->Size = 1; // Size[currentBB] = 1 + } - // For PostDominators, we want to walk predecessors rather than successors - // as we do in forward Dominators. + // Visit children + bool visitChild = false; for (pred_iterator PI = pred_begin(currentBB), PE = pred_end(currentBB); - PI != PE; ++PI) { + PI != PE && !visitChild; ++PI) { InfoRec &SuccVInfo = Info[*PI]; if (SuccVInfo.Semi == 0) { SuccVInfo.Parent = currentBB; - - workStack.push_back(std::make_pair(*PI, &SuccVInfo)); + if (visited.count (*PI) == 0) { + workStack.push_back(std::make_pair(*PI, &SuccVInfo)); + visitChild = true; + } } } + + // If all children are visited or if this block has no child then pop this + // block out of workStack. + if (!visitChild) + workStack.pop_back(); + } while (!workStack.empty()); + return N; } From sabre at nondot.org Wed Sep 27 13:29:54 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 27 Sep 2006 13:29:54 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200609271829.k8RITs32011803@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.264 -> 1.265 --- Log message: silence warnings in release build --- Diffs of the changes: (+14 -14) X86ISelLowering.cpp | 28 ++++++++++++++-------------- 1 files changed, 14 insertions(+), 14 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.264 llvm/lib/Target/X86/X86ISelLowering.cpp:1.265 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.264 Mon Sep 25 22:57:53 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Wed Sep 27 13:29:38 2006 @@ -4286,20 +4286,20 @@ return LowerX86_64CCCCallTo(Op, DAG); else switch (CallingConv) { - case CallingConv::Fast: + default: + assert(0 && "Unsupported calling convention"); + case CallingConv::Fast: if (EnableFastCC) { return LowerFastCCCallTo(Op, DAG, false); } // Falls through - case CallingConv::C: - case CallingConv::CSRet: + case CallingConv::C: + case CallingConv::CSRet: return LowerCCCCallTo(Op, DAG); - case CallingConv::X86_StdCall: + case CallingConv::X86_StdCall: return LowerStdCallCCCallTo(Op, DAG); - case CallingConv::X86_FastCall: + case CallingConv::X86_FastCall: return LowerFastCCCallTo(Op, DAG, true); - default: - assert(0 && "Unsupported calling convention"); } } @@ -4421,22 +4421,22 @@ return LowerX86_64CCCArguments(Op, DAG); else switch(CC) { - case CallingConv::Fast: + default: + assert(0 && "Unsupported calling convention"); + case CallingConv::Fast: if (EnableFastCC) { return LowerFastCCArguments(Op, DAG); } // Falls through - case CallingConv::C: - case CallingConv::CSRet: + case CallingConv::C: + case CallingConv::CSRet: return LowerCCCArguments(Op, DAG); - case CallingConv::X86_StdCall: + case CallingConv::X86_StdCall: MF.getInfo()->setDecorationStyle(StdCall); return LowerStdCallCCArguments(Op, DAG); - case CallingConv::X86_FastCall: + case CallingConv::X86_FastCall: MF.getInfo()->setDecorationStyle(FastCall); return LowerFastCallCCArguments(Op, DAG); - default: - assert(0 && "Unsupported calling convention"); } } From isanbard at gmail.com Wed Sep 27 16:57:31 2006 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 27 Sep 2006 16:57:31 -0500 Subject: [llvm-commits] CVS: llvm-test/External/SPEC/CFP2006/454.calculix/Makefile Message-ID: <200609272157.k8RLvVBY015540@zion.cs.uiuc.edu> Changes in directory llvm-test/External/SPEC/CFP2006/454.calculix: Makefile updated: 1.3 -> 1.4 --- Log message: Was outputing the wrong filename. Needed to have the correct recipe for some of the files. --- Diffs of the changes: (+11 -3) Makefile | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) Index: llvm-test/External/SPEC/CFP2006/454.calculix/Makefile diff -u llvm-test/External/SPEC/CFP2006/454.calculix/Makefile:1.3 llvm-test/External/SPEC/CFP2006/454.calculix/Makefile:1.4 --- llvm-test/External/SPEC/CFP2006/454.calculix/Makefile:1.3 Thu Sep 7 19:59:14 2006 +++ llvm-test/External/SPEC/CFP2006/454.calculix/Makefile Wed Sep 27 16:57:16 2006 @@ -241,15 +241,20 @@ -I$(SPEC_BENCH_DIR)/src \ -I$(SPEC_BENCH_DIR)/src/include +NAGFORTRAN_FLAGS += \ + -I$(SPEC_BENCH_DIR)/src \ + -I$(SPEC_BENCH_DIR)/src/SPOOLES \ + -maxcontin=256 + include ../../Makefile.spec2006 include $(PROJ_SRC_ROOT)/Makefile.FORTRAN ifeq ($(RUN_TYPE),test) RUN_OPTIONS := -i beampic - STDOUT_FILENAME := beampic.log + STDOUT_FILENAME := beampic.dat else RUN_OPTIONS := -i stairs - STDOUT_FILENAME := stairs.log + STDOUT_FILENAME := stairs.dat endif ##===----------------------------------------------------------------------===## @@ -282,6 +287,9 @@ $(addprefix dstree_,$(notdir $(DSTREESources))) : dstree_% : \ $(SPEC_BENCH_DIR)/src/SPOOLES/DSTree/src/% cp $< $@ +$(addprefix dv_,$(notdir $(DVSources))) : dv_% : \ +$(SPEC_BENCH_DIR)/src/SPOOLES/DV/src/% + cp $< $@ $(addprefix dmtx_,$(notdir $(DENSEMTXSources))) : dmtx_% : \ $(SPEC_BENCH_DIR)/src/SPOOLES/DenseMtx/src/% cp $< $@ @@ -312,7 +320,7 @@ $(addprefix ivl_,$(notdir $(IVLSources))) : ivl_% : \ $(SPEC_BENCH_DIR)/src/SPOOLES/IVL/src/% cp $< $@ -$(addprefix ideq_,$(notdir $(IEQSources))) : ideq_% : \ +$(addprefix ideq_,$(notdir $(IDEQSources))) : ideq_% : \ $(SPEC_BENCH_DIR)/src/SPOOLES/Ideq/src/% cp $< $@ $(addprefix inpmtx_,$(notdir $(INPMTXSources))) : inpmtx_% : \ From isanbard at gmail.com Wed Sep 27 17:37:50 2006 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 27 Sep 2006 17:37:50 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/PHIElimination.cpp Message-ID: <200609272237.k8RMbo0M016240@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: PHIElimination.cpp updated: 1.47 -> 1.48 --- Log message: Reapplying this patch. With the newest commits, the error in Olden/bisort has disappeared. --- Diffs of the changes: (+44 -24) PHIElimination.cpp | 68 ++++++++++++++++++++++++++++++++++------------------- 1 files changed, 44 insertions(+), 24 deletions(-) Index: llvm/lib/CodeGen/PHIElimination.cpp diff -u llvm/lib/CodeGen/PHIElimination.cpp:1.47 llvm/lib/CodeGen/PHIElimination.cpp:1.48 --- llvm/lib/CodeGen/PHIElimination.cpp:1.47 Wed Sep 27 11:59:16 2006 +++ llvm/lib/CodeGen/PHIElimination.cpp Wed Sep 27 17:37:35 2006 @@ -34,12 +34,15 @@ struct VISIBILITY_HIDDEN PNE : public MachineFunctionPass { bool runOnMachineFunction(MachineFunction &Fn) { + analyzePHINodes(Fn); + bool Changed = false; // Eliminate PHI instructions by inserting copies into predecessor blocks. for (MachineFunction::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I) Changed |= EliminatePHINodes(Fn, *I); + VRegPHIUseCount.clear(); return Changed; } @@ -54,15 +57,26 @@ /// bool EliminatePHINodes(MachineFunction &MF, MachineBasicBlock &MBB); void LowerAtomicPHINode(MachineBasicBlock &MBB, - MachineBasicBlock::iterator AfterPHIsIt, - DenseMap &VUC); + MachineBasicBlock::iterator AfterPHIsIt); + + /// analyzePHINodes - Gather information about the PHI nodes in + /// here. In particular, we want to map the number of uses of a virtual + /// register which is used in a PHI node. We map that to the BB the + /// vreg is coming from. This is used later to determine when the vreg + /// is killed in the BB. + /// + void analyzePHINodes(const MachineFunction& Fn); + + typedef std::pair BBVRegPair; + typedef std::map VRegPHIUse; + + VRegPHIUse VRegPHIUseCount; }; RegisterPass X("phi-node-elimination", "Eliminate PHI nodes for register allocation"); } - const PassInfo *llvm::PHIEliminationID = X.getPassInfo(); /// EliminatePHINodes - Eliminate phi nodes by inserting copy instructions in @@ -72,20 +86,6 @@ if (MBB.empty() || MBB.front().getOpcode() != TargetInstrInfo::PHI) return false; // Quick exit for basic blocks without PHIs. - // VRegPHIUseCount - Keep track of the number of times each virtual register - // is used by PHI nodes in successors of this block. - DenseMap VRegPHIUseCount; - VRegPHIUseCount.grow(MF.getSSARegMap()->getLastVirtReg()); - - for (MachineBasicBlock::pred_iterator PI = MBB.pred_begin(), - E = MBB.pred_end(); PI != E; ++PI) - for (MachineBasicBlock::succ_iterator SI = (*PI)->succ_begin(), - E = (*PI)->succ_end(); SI != E; ++SI) - for (MachineBasicBlock::iterator BBI = (*SI)->begin(), E = (*SI)->end(); - BBI != E && BBI->getOpcode() == TargetInstrInfo::PHI; ++BBI) - for (unsigned i = 1, e = BBI->getNumOperands(); i != e; i += 2) - VRegPHIUseCount[BBI->getOperand(i).getReg()]++; - // Get an iterator to the first instruction after the last PHI node (this may // also be the end of the basic block). MachineBasicBlock::iterator AfterPHIsIt = MBB.begin(); @@ -93,9 +93,9 @@ AfterPHIsIt->getOpcode() == TargetInstrInfo::PHI) ++AfterPHIsIt; // Skip over all of the PHI nodes... - while (MBB.front().getOpcode() == TargetInstrInfo::PHI) { - LowerAtomicPHINode(MBB, AfterPHIsIt, VRegPHIUseCount); - } + while (MBB.front().getOpcode() == TargetInstrInfo::PHI) + LowerAtomicPHINode(MBB, AfterPHIsIt); + return true; } @@ -115,8 +115,7 @@ /// atomic execution of PHIs. This lowering method is always correct all of the /// time. void PNE::LowerAtomicPHINode(MachineBasicBlock &MBB, - MachineBasicBlock::iterator AfterPHIsIt, - DenseMap &VRegPHIUseCount) { + MachineBasicBlock::iterator AfterPHIsIt) { // Unlink the PHI node from the basic block, but don't delete the PHI yet. MachineInstr *MPhi = MBB.remove(MBB.begin()); @@ -167,7 +166,9 @@ // node. unsigned NumPreds = (MPhi->getNumOperands()-1)/2; for (unsigned i = 1; i != MPhi->getNumOperands(); i += 2) - VRegPHIUseCount[MPhi->getOperand(i).getReg()] -= NumPreds; + VRegPHIUseCount[BBVRegPair( + MPhi->getOperand(i + 1).getMachineBasicBlock(), + MPhi->getOperand(i).getReg())] -= NumPreds; // Now loop over all of the incoming arguments, changing them to copy into // the IncomingReg register in the corresponding predecessor basic block. @@ -219,7 +220,10 @@ // // Is it used by any PHI instructions in this block? - bool ValueIsLive = VRegPHIUseCount[SrcReg] != 0; + bool ValueIsLive = + VRegPHIUseCount[BBVRegPair( + MPhi->getOperand(i).getMachineBasicBlock(), + SrcReg)] != 0; std::vector OpSuccBlocks; @@ -317,3 +321,19 @@ delete MPhi; ++NumAtomic; } + +/// analyzePHINodes - Gather information about the PHI nodes in here. In +/// particular, we want to map the number of uses of a virtual register which is +/// used in a PHI node. We map that to the BB the vreg is coming from. This is +/// used later to determine when the vreg is killed in the BB. +/// +void PNE::analyzePHINodes(const MachineFunction& Fn) { + for (MachineFunction::const_iterator I = Fn.begin(), E = Fn.end(); + I != E; ++I) + for (MachineBasicBlock::const_iterator BBI = I->begin(), BBE = I->end(); + BBI != BBE && BBI->getOpcode() == TargetInstrInfo::PHI; ++BBI) + for (unsigned i = 1, e = BBI->getNumOperands(); i != e; i += 2) + VRegPHIUseCount[BBVRegPair( + BBI->getOperand(i + 1).getMachineBasicBlock(), + BBI->getOperand(i).getReg())]++; +} From sabre at nondot.org Wed Sep 27 19:04:36 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 27 Sep 2006 19:04:36 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/PHIElimination.cpp Message-ID: <200609280004.k8S04aYJ017656@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: PHIElimination.cpp updated: 1.48 -> 1.49 --- Log message: re-revert this patch, bisort and mst are still broken in Olden. --- Diffs of the changes: (+3 -3) PHIElimination.cpp | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/lib/CodeGen/PHIElimination.cpp diff -u llvm/lib/CodeGen/PHIElimination.cpp:1.48 llvm/lib/CodeGen/PHIElimination.cpp:1.49 --- llvm/lib/CodeGen/PHIElimination.cpp:1.48 Wed Sep 27 17:37:35 2006 +++ llvm/lib/CodeGen/PHIElimination.cpp Wed Sep 27 19:04:21 2006 @@ -64,7 +64,7 @@ /// register which is used in a PHI node. We map that to the BB the /// vreg is coming from. This is used later to determine when the vreg /// is killed in the BB. - /// + /// void analyzePHINodes(const MachineFunction& Fn); typedef std::pair BBVRegPair; @@ -220,7 +220,7 @@ // // Is it used by any PHI instructions in this block? - bool ValueIsLive = + bool ValueIsLive = VRegPHIUseCount[BBVRegPair( MPhi->getOperand(i).getMachineBasicBlock(), SrcReg)] != 0; @@ -326,7 +326,7 @@ /// particular, we want to map the number of uses of a virtual register which is /// used in a PHI node. We map that to the BB the vreg is coming from. This is /// used later to determine when the vreg is killed in the BB. -/// +/// void PNE::analyzePHINodes(const MachineFunction& Fn) { for (MachineFunction::const_iterator I = Fn.begin(), E = Fn.end(); I != E; ++I) From evan.cheng at apple.com Wed Sep 27 19:07:35 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 27 Sep 2006 19:07:35 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/MRegisterInfo.h Message-ID: <200609280007.k8S07Z2a017716@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: MRegisterInfo.h updated: 1.83 -> 1.84 --- Log message: - Added a hook processFunctionBeforeCalleeSaveScn(). This is called by PEI just before it determines which callee-save registers are to be spilled. This allows the target to make changes such as forcing certain physical registers to be spilled. - Modified comments. It's important to note the order of registers in the array returns by getCalleeSaveRegs() determines the order of callee save spill code. --- Diffs of the changes: (+10 -4) MRegisterInfo.h | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-) Index: llvm/include/llvm/Target/MRegisterInfo.h diff -u llvm/include/llvm/Target/MRegisterInfo.h:1.83 llvm/include/llvm/Target/MRegisterInfo.h:1.84 --- llvm/include/llvm/Target/MRegisterInfo.h:1.83 Wed Aug 23 19:21:32 2006 +++ llvm/include/llvm/Target/MRegisterInfo.h Wed Sep 27 19:07:19 2006 @@ -283,7 +283,9 @@ } /// getCalleeSaveRegs - Return a null-terminated list of all of the - /// callee-save registers on this target. + /// callee-save registers on this target. The register should be in the + /// order of desired callee-save stack frame offset. The first register is + /// closed to the incoming stack pointer if stack grows down, and vice versa. virtual const unsigned* getCalleeSaveRegs() const = 0; /// getCalleeSaveRegClasses - Return a null-terminated list of the preferred @@ -371,12 +373,16 @@ assert(0 && "Call Frame Pseudo Instructions do not exist on this target!"); } + /// processFunctionBeforeCalleeSaveScan - This method is called immediately + /// before PrologEpilogInserter scans the physical registers used to determine + /// what callee-save registers should be spilled. This method is optional. + virtual void processFunctionBeforeCalleeSaveScan(MachineFunction &MF) const { + } + /// processFunctionBeforeFrameFinalized - This method is called immediately /// before the specified functions frame layout (MF.getFrameInfo()) is /// finalized. Once the frame is finalized, MO_FrameIndex operands are - /// replaced with direct constants. This method is optional. The return value - /// is the number of instructions added to (negative if removed from) the - /// basic block + /// replaced with direct constants. This method is optional. /// virtual void processFunctionBeforeFrameFinalized(MachineFunction &MF) const { } From evan.cheng at apple.com Wed Sep 27 19:10:42 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 27 Sep 2006 19:10:42 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/PrologEpilogInserter.cpp Message-ID: <200609280010.k8S0AgKq017783@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: PrologEpilogInserter.cpp updated: 1.59 -> 1.60 --- Log message: PEI now place callee save spills closest to the address pointed to by the incoming stack. This allows X86 backend to use push / pop in epilogue / prologue. --- Diffs of the changes: (+67 -11) PrologEpilogInserter.cpp | 78 ++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 67 insertions(+), 11 deletions(-) Index: llvm/lib/CodeGen/PrologEpilogInserter.cpp diff -u llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.59 llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.60 --- llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.59 Tue Sep 26 17:29:31 2006 +++ llvm/lib/CodeGen/PrologEpilogInserter.cpp Wed Sep 27 19:10:27 2006 @@ -25,6 +25,7 @@ #include "llvm/Target/TargetFrameInfo.h" #include "llvm/Target/TargetInstrInfo.h" #include "llvm/Support/Compiler.h" +#include using namespace llvm; namespace { @@ -42,15 +43,19 @@ if (MachineDebugInfo *DI = getAnalysisToUpdate()) { Fn.getFrameInfo()->setMachineDebugInfo(DI); } - + + // Allow the target machine to make some adjustments to the function + // e.g. UsedPhysRegs before calculateCalleeSavedRegisters. + Fn.getTarget().getRegisterInfo()->processFunctionBeforeCalleeSaveScan(Fn); + // Scan the function for modified callee saved registers and insert spill // code for any callee saved registers that are modified. Also calculate // the MaxCallFrameSize and HasCalls variables for the function's frame // information and eliminates call frame pseudo instructions. calculateCalleeSavedRegisters(Fn); - // Add the code to save and restore the caller saved registers - saveCallerSavedRegisters(Fn); + // Add the code to save and restore the callee saved registers + saveCalleeSavedRegisters(Fn); // Allow the target machine to make final modifications to the function // before the frame layout is finalized. @@ -75,8 +80,12 @@ } private: + // MinCSFrameIndex, MaxCSFrameIndex - Keeps the range of callee save + // stack frame indexes. + unsigned MinCSFrameIndex, MaxCSFrameIndex; + void calculateCalleeSavedRegisters(MachineFunction &Fn); - void saveCallerSavedRegisters(MachineFunction &Fn); + void saveCalleeSavedRegisters(MachineFunction &Fn); void calculateFrameObjectOffsets(MachineFunction &Fn); void replaceFrameIndices(MachineFunction &Fn); void insertPrologEpilogCode(MachineFunction &Fn); @@ -90,7 +99,7 @@ FunctionPass *llvm::createPrologEpilogCodeInserter() { return new PEI(); } -/// calculateCalleeSavedRegisters - Scan the function for modified caller saved +/// calculateCalleeSavedRegisters - Scan the function for modified callee saved /// registers. Also calculate the MaxCallFrameSize and HasCalls variables for /// the function's frame information and eliminates call frame pseudo /// instructions. @@ -157,7 +166,7 @@ } if (CSI.empty()) - return; // Early exit if no caller saved registers are modified! + return; // Early exit if no callee saved registers are modified! unsigned NumFixedSpillSlots; const std::pair *FixedSpillSlots = @@ -165,6 +174,8 @@ // Now that we know which registers need to be saved and restored, allocate // stack slots for them. + MinCSFrameIndex = INT_MAX; + MaxCSFrameIndex = 0; for (unsigned i = 0, e = CSI.size(); i != e; ++i) { unsigned Reg = CSI[i].getReg(); const TargetRegisterClass *RC = CSI[i].getRegClass(); @@ -180,6 +191,8 @@ if (FixedSlot == FixedSpillSlots+NumFixedSpillSlots) { // Nope, just spill it anywhere convenient. FrameIdx = FFI->CreateStackObject(RC->getSize(), RC->getAlignment()); + if ((unsigned)FrameIdx < MinCSFrameIndex) MinCSFrameIndex = FrameIdx; + if ((unsigned)FrameIdx > MaxCSFrameIndex) MaxCSFrameIndex = FrameIdx; } else { // Spill it to the stack where we must. FrameIdx = FFI->CreateFixedObject(RC->getSize(), FixedSlot->second); @@ -190,15 +203,15 @@ FFI->setCalleeSavedInfo(CSI); } -/// saveCallerSavedRegisters - Insert spill code for any caller saved registers +/// saveCalleeSavedRegisters - Insert spill code for any callee saved registers /// that are modified in the function. /// -void PEI::saveCallerSavedRegisters(MachineFunction &Fn) { +void PEI::saveCalleeSavedRegisters(MachineFunction &Fn) { // Get callee saved register information. MachineFrameInfo *FFI = Fn.getFrameInfo(); const std::vector &CSI = FFI->getCalleeSavedInfo(); - // Early exit if no caller saved registers are modified! + // Early exit if no callee saved registers are modified! if (CSI.empty()) return; @@ -298,7 +311,49 @@ if (FixedOff > Offset) Offset = FixedOff; } + // First assign frame offsets to stack objects that are used to spill + // callee save registers. + if (StackGrowsDown) { + for (unsigned i = 0, e = FFI->getObjectIndexEnd(); i != e; ++i) { + if (i < MinCSFrameIndex || i > MaxCSFrameIndex) + continue; + + // If stack grows down, we need to add size of find the lowest + // address of the object. + Offset += FFI->getObjectSize(i); + + unsigned Align = FFI->getObjectAlignment(i); + // If the alignment of this object is greater than that of the stack, then + // increase the stack alignment to match. + MaxAlign = std::max(MaxAlign, Align); + // Adjust to alignment boundary + Offset = (Offset+Align-1)/Align*Align; + + FFI->setObjectOffset(i, -Offset); // Set the computed offset + } + } else { + for (int i = FFI->getObjectIndexEnd()-1; i >= 0; --i) { + if ((unsigned)i < MinCSFrameIndex || (unsigned)i > MaxCSFrameIndex) + continue; + + unsigned Align = FFI->getObjectAlignment(i); + // If the alignment of this object is greater than that of the stack, then + // increase the stack alignment to match. + MaxAlign = std::max(MaxAlign, Align); + // Adjust to alignment boundary + Offset = (Offset+Align-1)/Align*Align; + + FFI->setObjectOffset(i, Offset); + Offset += FFI->getObjectSize(i); + } + } + + // Then assign frame offsets to stack objects that are not used to spill + // callee save registers. for (unsigned i = 0, e = FFI->getObjectIndexEnd(); i != e; ++i) { + if (i >= MinCSFrameIndex && i <= MaxCSFrameIndex) + continue; + // If stack grows down, we need to add size of find the lowest // address of the object. if (StackGrowsDown) @@ -319,6 +374,7 @@ } } + // Align the final stack pointer offset, but only if there are calls in the // function. This ensures that any calls to subroutines have their stack // frames suitable aligned. @@ -335,8 +391,8 @@ } -/// insertPrologEpilogCode - Scan the function for modified caller saved -/// registers, insert spill code for these caller saved registers, then add +/// insertPrologEpilogCode - Scan the function for modified callee saved +/// registers, insert spill code for these callee saved registers, then add /// prolog and epilog code to the function. /// void PEI::insertPrologEpilogCode(MachineFunction &Fn) { From sabre at nondot.org Wed Sep 27 19:12:09 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 27 Sep 2006 19:12:09 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/PHIElimination.cpp Message-ID: <200609280012.k8S0C96R017872@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: PHIElimination.cpp updated: 1.49 -> 1.50 --- Log message: re-re-revert this, back to the right revision. It currently breaks bisort/mst in olden among others. --- Diffs of the changes: (+24 -44) PHIElimination.cpp | 68 ++++++++++++++++++----------------------------------- 1 files changed, 24 insertions(+), 44 deletions(-) Index: llvm/lib/CodeGen/PHIElimination.cpp diff -u llvm/lib/CodeGen/PHIElimination.cpp:1.49 llvm/lib/CodeGen/PHIElimination.cpp:1.50 --- llvm/lib/CodeGen/PHIElimination.cpp:1.49 Wed Sep 27 19:04:21 2006 +++ llvm/lib/CodeGen/PHIElimination.cpp Wed Sep 27 19:11:54 2006 @@ -34,15 +34,12 @@ struct VISIBILITY_HIDDEN PNE : public MachineFunctionPass { bool runOnMachineFunction(MachineFunction &Fn) { - analyzePHINodes(Fn); - bool Changed = false; // Eliminate PHI instructions by inserting copies into predecessor blocks. for (MachineFunction::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I) Changed |= EliminatePHINodes(Fn, *I); - VRegPHIUseCount.clear(); return Changed; } @@ -57,26 +54,15 @@ /// bool EliminatePHINodes(MachineFunction &MF, MachineBasicBlock &MBB); void LowerAtomicPHINode(MachineBasicBlock &MBB, - MachineBasicBlock::iterator AfterPHIsIt); - - /// analyzePHINodes - Gather information about the PHI nodes in - /// here. In particular, we want to map the number of uses of a virtual - /// register which is used in a PHI node. We map that to the BB the - /// vreg is coming from. This is used later to determine when the vreg - /// is killed in the BB. - /// - void analyzePHINodes(const MachineFunction& Fn); - - typedef std::pair BBVRegPair; - typedef std::map VRegPHIUse; - - VRegPHIUse VRegPHIUseCount; + MachineBasicBlock::iterator AfterPHIsIt, + DenseMap &VUC); }; RegisterPass X("phi-node-elimination", "Eliminate PHI nodes for register allocation"); } + const PassInfo *llvm::PHIEliminationID = X.getPassInfo(); /// EliminatePHINodes - Eliminate phi nodes by inserting copy instructions in @@ -86,6 +72,20 @@ if (MBB.empty() || MBB.front().getOpcode() != TargetInstrInfo::PHI) return false; // Quick exit for basic blocks without PHIs. + // VRegPHIUseCount - Keep track of the number of times each virtual register + // is used by PHI nodes in successors of this block. + DenseMap VRegPHIUseCount; + VRegPHIUseCount.grow(MF.getSSARegMap()->getLastVirtReg()); + + for (MachineBasicBlock::pred_iterator PI = MBB.pred_begin(), + E = MBB.pred_end(); PI != E; ++PI) + for (MachineBasicBlock::succ_iterator SI = (*PI)->succ_begin(), + E = (*PI)->succ_end(); SI != E; ++SI) + for (MachineBasicBlock::iterator BBI = (*SI)->begin(), E = (*SI)->end(); + BBI != E && BBI->getOpcode() == TargetInstrInfo::PHI; ++BBI) + for (unsigned i = 1, e = BBI->getNumOperands(); i != e; i += 2) + VRegPHIUseCount[BBI->getOperand(i).getReg()]++; + // Get an iterator to the first instruction after the last PHI node (this may // also be the end of the basic block). MachineBasicBlock::iterator AfterPHIsIt = MBB.begin(); @@ -93,9 +93,9 @@ AfterPHIsIt->getOpcode() == TargetInstrInfo::PHI) ++AfterPHIsIt; // Skip over all of the PHI nodes... - while (MBB.front().getOpcode() == TargetInstrInfo::PHI) - LowerAtomicPHINode(MBB, AfterPHIsIt); - + while (MBB.front().getOpcode() == TargetInstrInfo::PHI) { + LowerAtomicPHINode(MBB, AfterPHIsIt, VRegPHIUseCount); + } return true; } @@ -115,7 +115,8 @@ /// atomic execution of PHIs. This lowering method is always correct all of the /// time. void PNE::LowerAtomicPHINode(MachineBasicBlock &MBB, - MachineBasicBlock::iterator AfterPHIsIt) { + MachineBasicBlock::iterator AfterPHIsIt, + DenseMap &VRegPHIUseCount) { // Unlink the PHI node from the basic block, but don't delete the PHI yet. MachineInstr *MPhi = MBB.remove(MBB.begin()); @@ -166,9 +167,7 @@ // node. unsigned NumPreds = (MPhi->getNumOperands()-1)/2; for (unsigned i = 1; i != MPhi->getNumOperands(); i += 2) - VRegPHIUseCount[BBVRegPair( - MPhi->getOperand(i + 1).getMachineBasicBlock(), - MPhi->getOperand(i).getReg())] -= NumPreds; + VRegPHIUseCount[MPhi->getOperand(i).getReg()] -= NumPreds; // Now loop over all of the incoming arguments, changing them to copy into // the IncomingReg register in the corresponding predecessor basic block. @@ -220,10 +219,7 @@ // // Is it used by any PHI instructions in this block? - bool ValueIsLive = - VRegPHIUseCount[BBVRegPair( - MPhi->getOperand(i).getMachineBasicBlock(), - SrcReg)] != 0; + bool ValueIsLive = VRegPHIUseCount[SrcReg] != 0; std::vector OpSuccBlocks; @@ -321,19 +317,3 @@ delete MPhi; ++NumAtomic; } - -/// analyzePHINodes - Gather information about the PHI nodes in here. In -/// particular, we want to map the number of uses of a virtual register which is -/// used in a PHI node. We map that to the BB the vreg is coming from. This is -/// used later to determine when the vreg is killed in the BB. -/// -void PNE::analyzePHINodes(const MachineFunction& Fn) { - for (MachineFunction::const_iterator I = Fn.begin(), E = Fn.end(); - I != E; ++I) - for (MachineBasicBlock::const_iterator BBI = I->begin(), BBE = I->end(); - BBI != BBE && BBI->getOpcode() == TargetInstrInfo::PHI; ++BBI) - for (unsigned i = 1, e = BBI->getNumOperands(); i != e; i += 2) - VRegPHIUseCount[BBVRegPair( - BBI->getOperand(i + 1).getMachineBasicBlock(), - BBI->getOperand(i).getReg())]++; -} From sabre at nondot.org Wed Sep 27 19:32:11 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 27 Sep 2006 19:32:11 -0500 Subject: [llvm-commits] CVS: llvm/lib/Support/ManagedStatic.cpp Message-ID: <200609280032.k8S0WB4f018226@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: ManagedStatic.cpp added (r1.1) --- Log message: new helper class to provide more explicit management of static ctor/dtors. --- Diffs of the changes: (+53 -0) ManagedStatic.cpp | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 53 insertions(+) Index: llvm/lib/Support/ManagedStatic.cpp diff -c /dev/null llvm/lib/Support/ManagedStatic.cpp:1.1 *** /dev/null Wed Sep 27 19:32:05 2006 --- llvm/lib/Support/ManagedStatic.cpp Wed Sep 27 19:31:55 2006 *************** *** 0 **** --- 1,53 ---- + //===-- ManagedStatic.cpp - Static Global wrapper -------------------------===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Chris Lattner and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file implements the ManagedStatic class and llvm_shutdown(). + // + //===----------------------------------------------------------------------===// + + #include "llvm/Support/ManagedStatic.h" + #include + using namespace llvm; + + static const ManagedStaticBase *StaticList = 0; + + void ManagedStaticBase::RegisterManagedStatic(void *ObjPtr, + void (*Deleter)(void*)) const { + assert(Ptr == 0 && DeleterFn == 0 && Next == 0 && + "Partially init static?"); + Ptr = ObjPtr; + DeleterFn = Deleter; + + // Add to list of managed statics. + Next = StaticList; + StaticList = this; + } + + void ManagedStaticBase::destroy() const { + assert(Ptr && DeleterFn && "ManagedStatic not initialized correctly!"); + assert(StaticList == this && + "Not destroyed in reverse order of construction?"); + // Unlink from list. + StaticList = Next; + Next = 0; + + // Destroy memory. + DeleterFn(Ptr); + + // Cleanup. + Ptr = 0; + DeleterFn = 0; + } + + /// llvm_shutdown - Deallocate and destroy all ManagedStatic variables. + void llvm_shutdown() { + while (StaticList) + StaticList->destroy(); + } + From sabre at nondot.org Wed Sep 27 19:32:10 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 27 Sep 2006 19:32:10 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/ManagedStatic.h Message-ID: <200609280032.k8S0WAuo018221@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Support: ManagedStatic.h added (r1.1) --- Log message: new helper class to provide more explicit management of static ctor/dtors. --- Diffs of the changes: (+79 -0) ManagedStatic.h | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 79 insertions(+) Index: llvm/include/llvm/Support/ManagedStatic.h diff -c /dev/null llvm/include/llvm/Support/ManagedStatic.h:1.1 *** /dev/null Wed Sep 27 19:32:05 2006 --- llvm/include/llvm/Support/ManagedStatic.h Wed Sep 27 19:31:55 2006 *************** *** 0 **** --- 1,79 ---- + //===-- llvm/Support/ManagedStatic.h - Static Global wrapper ----*- C++ -*-===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by Chris Lattner and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file defines the ManagedStatic class and the llvm_shutdown() function. + // + //===----------------------------------------------------------------------===// + + #ifndef LLVM_SUPPORT_MANAGED_STATIC_H + #define LLVM_SUPPORT_MANAGED_STATIC_H + + namespace llvm { + + /// object_deleter - Helper method for ManagedStatic. + /// + template + void object_deleter(void *Ptr) { + delete (C*)Ptr; + } + + /// ManagedStaticBase - Common base class for ManagedStatic instances. + class ManagedStaticBase { + protected: + // This should only be used as a static variable, which guarantees that this + // will be zero initialized. + mutable void *Ptr; + mutable void (*DeleterFn)(void*); + mutable const ManagedStaticBase *Next; + + void RegisterManagedStatic(void *ObjPtr, void (*deleter)(void*)) const; + public: + void destroy() const; + }; + + /// ManagedStatic - This transparently changes the behavior of global statics to + /// be lazily constructed on demand (good for reducing startup times of dynamic + /// libraries that link in LLVM components) and for making destruction be + /// explicit through the llvm_shutdown() function call. + /// + template + class ManagedStatic : public ManagedStaticBase { + public: + + // Accessors. + C &operator*() { + if (!Ptr) LazyInit(); + return *static_cast(Ptr); + } + C *operator->() { + if (!Ptr) LazyInit(); + return static_cast(Ptr); + } + const C &operator*() const { + if (!Ptr) LazyInit(); + return *static_cast(Ptr); + } + const C *operator->() const { + if (!Ptr) LazyInit(); + return static_cast(Ptr); + } + + public: + void LazyInit() const { + RegisterManagedStatic(new C(), object_deleter); + } + }; + + + /// llvm_shutdown - Deallocate and destroy all ManagedStatic variables. + void llvm_shutdown(); + + } + + #endif From sabre at nondot.org Wed Sep 27 19:35:21 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 27 Sep 2006 19:35:21 -0500 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp Message-ID: <200609280035.k8S0ZLbn018318@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Constants.cpp updated: 1.160 -> 1.161 --- Log message: Use the new ManagedStatic class to explicitly manage static variables, eliminating static ctors/dtors --- Diffs of the changes: (+47 -71) Constants.cpp | 118 +++++++++++++++++++++++----------------------------------- 1 files changed, 47 insertions(+), 71 deletions(-) Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.160 llvm/lib/VMCore/Constants.cpp:1.161 --- llvm/lib/VMCore/Constants.cpp:1.160 Sun Sep 17 14:14:47 2006 +++ llvm/lib/VMCore/Constants.cpp Wed Sep 27 19:35:06 2006 @@ -21,6 +21,7 @@ #include "llvm/ADT/StringExtras.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/Compiler.h" +#include "llvm/Support/ManagedStatic.h" #include #include using namespace llvm; @@ -879,15 +880,15 @@ //---- ConstantUInt::get() and ConstantSInt::get() implementations... // -static ValueMap< int64_t, Type, ConstantSInt> SIntConstants; -static ValueMap UIntConstants; +static ManagedStatic > SIntConstants; +static ManagedStatic > UIntConstants; ConstantSInt *ConstantSInt::get(const Type *Ty, int64_t V) { - return SIntConstants.getOrCreate(Ty, V); + return SIntConstants->getOrCreate(Ty, V); } ConstantUInt *ConstantUInt::get(const Type *Ty, uint64_t V) { - return UIntConstants.getOrCreate(Ty, V); + return UIntConstants->getOrCreate(Ty, V); } ConstantInt *ConstantInt::get(const Type *Ty, unsigned char V) { @@ -915,8 +916,8 @@ }; } -static ValueMap DoubleConstants; -static ValueMap FloatConstants; +static ManagedStatic > DoubleConstants; +static ManagedStatic > FloatConstants; bool ConstantFP::isNullValue() const { return DoubleToBits(Val) == 0; @@ -930,10 +931,10 @@ ConstantFP *ConstantFP::get(const Type *Ty, double V) { if (Ty == Type::FloatTy) { // Force the value through memory to normalize it. - return FloatConstants.getOrCreate(Ty, FloatToBits(V)); + return FloatConstants->getOrCreate(Ty, FloatToBits(V)); } else { assert(Ty == Type::DoubleTy); - return DoubleConstants.getOrCreate(Ty, DoubleToBits(V)); + return DoubleConstants->getOrCreate(Ty, DoubleToBits(V)); } } @@ -960,20 +961,21 @@ }; } -static ValueMap AggZeroConstants; +static ManagedStatic > AggZeroConstants; static char getValType(ConstantAggregateZero *CPZ) { return 0; } Constant *ConstantAggregateZero::get(const Type *Ty) { assert((isa(Ty) || isa(Ty) || isa(Ty)) && "Cannot create an aggregate zero of non-aggregate type!"); - return AggZeroConstants.getOrCreate(Ty, 0); + return AggZeroConstants->getOrCreate(Ty, 0); } // destroyConstant - Remove the constant from the constant table... // void ConstantAggregateZero::destroyConstant() { - AggZeroConstants.remove(this); + AggZeroConstants->remove(this); destroyConstantImpl(); } @@ -1005,7 +1007,7 @@ typedef ValueMap, ArrayType, ConstantArray, true /*largekey*/> ArrayConstantsTy; -static ArrayConstantsTy ArrayConstants; +static ManagedStatic ArrayConstants; Constant *ConstantArray::get(const ArrayType *Ty, const std::vector &V) { @@ -1013,10 +1015,10 @@ if (!V.empty()) { Constant *C = V[0]; if (!C->isNullValue()) - return ArrayConstants.getOrCreate(Ty, V); + return ArrayConstants->getOrCreate(Ty, V); for (unsigned i = 1, e = V.size(); i != e; ++i) if (V[i] != C) - return ArrayConstants.getOrCreate(Ty, V); + return ArrayConstants->getOrCreate(Ty, V); } return ConstantAggregateZero::get(Ty); } @@ -1024,7 +1026,7 @@ // destroyConstant - Remove the constant from the constant table... // void ConstantArray::destroyConstant() { - ArrayConstants.remove(this); + ArrayConstants->remove(this); destroyConstantImpl(); } @@ -1098,7 +1100,7 @@ typedef ValueMap, StructType, ConstantStruct, true /*largekey*/> StructConstantsTy; -static StructConstantsTy StructConstants; +static ManagedStatic StructConstants; static std::vector getValType(ConstantStruct *CS) { std::vector Elements; @@ -1113,7 +1115,7 @@ // Create a ConstantAggregateZero value if all elements are zeros... for (unsigned i = 0, e = V.size(); i != e; ++i) if (!V[i]->isNullValue()) - return StructConstants.getOrCreate(Ty, V); + return StructConstants->getOrCreate(Ty, V); return ConstantAggregateZero::get(Ty); } @@ -1129,7 +1131,7 @@ // destroyConstant - Remove the constant from the constant table... // void ConstantStruct::destroyConstant() { - StructConstants.remove(this); + StructConstants->remove(this); destroyConstantImpl(); } @@ -1159,8 +1161,8 @@ return Elements; } -static ValueMap, PackedType, - ConstantPacked> PackedConstants; +static ManagedStatic, PackedType, + ConstantPacked> > PackedConstants; Constant *ConstantPacked::get(const PackedType *Ty, const std::vector &V) { @@ -1168,10 +1170,10 @@ if (!V.empty()) { Constant *C = V[0]; if (!C->isNullValue()) - return PackedConstants.getOrCreate(Ty, V); + return PackedConstants->getOrCreate(Ty, V); for (unsigned i = 1, e = V.size(); i != e; ++i) if (V[i] != C) - return PackedConstants.getOrCreate(Ty, V); + return PackedConstants->getOrCreate(Ty, V); } return ConstantAggregateZero::get(Ty); } @@ -1184,7 +1186,7 @@ // destroyConstant - Remove the constant from the constant table... // void ConstantPacked::destroyConstant() { - PackedConstants.remove(this); + PackedConstants->remove(this); destroyConstantImpl(); } @@ -1212,7 +1214,8 @@ }; } -static ValueMap NullPtrConstants; +static ManagedStatic > NullPtrConstants; static char getValType(ConstantPointerNull *) { return 0; @@ -1220,13 +1223,13 @@ ConstantPointerNull *ConstantPointerNull::get(const PointerType *Ty) { - return NullPtrConstants.getOrCreate(Ty, 0); + return NullPtrConstants->getOrCreate(Ty, 0); } // destroyConstant - Remove the constant from the constant table... // void ConstantPointerNull::destroyConstant() { - NullPtrConstants.remove(this); + NullPtrConstants->remove(this); destroyConstantImpl(); } @@ -1255,7 +1258,7 @@ }; } -static ValueMap UndefValueConstants; +static ManagedStatic > UndefValueConstants; static char getValType(UndefValue *) { return 0; @@ -1263,13 +1266,13 @@ UndefValue *UndefValue::get(const Type *Ty) { - return UndefValueConstants.getOrCreate(Ty, 0); + return UndefValueConstants->getOrCreate(Ty, 0); } // destroyConstant - Remove the constant from the constant table. // void UndefValue::destroyConstant() { - UndefValueConstants.remove(this); + UndefValueConstants->remove(this); destroyConstantImpl(); } @@ -1355,7 +1358,8 @@ return ExprMapKeyType(CE->getOpcode(), Operands); } -static ValueMap ExprConstants; +static ManagedStatic > ExprConstants; Constant *ConstantExpr::getCast(Constant *C, const Type *Ty) { assert(Ty->isFirstClassType() && "Cannot cast to an aggregate type!"); @@ -1366,7 +1370,7 @@ // Look up the constant in the table first to ensure uniqueness std::vector argVec(1, C); ExprMapKeyType Key = std::make_pair(Instruction::Cast, argVec); - return ExprConstants.getOrCreate(Ty, Key); + return ExprConstants->getOrCreate(Ty, Key); } Constant *ConstantExpr::getSignExtend(Constant *C, const Type *Ty) { @@ -1426,7 +1430,7 @@ std::vector argVec(1, C1); argVec.push_back(C2); ExprMapKeyType Key = std::make_pair(Opcode, argVec); - return ExprConstants.getOrCreate(ReqTy, Key); + return ExprConstants->getOrCreate(ReqTy, Key); } Constant *ConstantExpr::get(unsigned Opcode, Constant *C1, Constant *C2) { @@ -1482,7 +1486,7 @@ argVec[1] = V1; argVec[2] = V2; ExprMapKeyType Key = std::make_pair(Instruction::Select, argVec); - return ExprConstants.getOrCreate(ReqTy, Key); + return ExprConstants->getOrCreate(ReqTy, Key); } /// getShiftTy - Return a shift left or shift right constant expr @@ -1501,7 +1505,7 @@ // Look up the constant in the table first to ensure uniqueness std::vector argVec(1, C1); argVec.push_back(C2); ExprMapKeyType Key = std::make_pair(Opcode, argVec); - return ExprConstants.getOrCreate(ReqTy, Key); + return ExprConstants->getOrCreate(ReqTy, Key); } @@ -1522,7 +1526,7 @@ for (unsigned i = 0, e = IdxList.size(); i != e; ++i) ArgVec.push_back(cast(IdxList[i])); const ExprMapKeyType &Key = std::make_pair(Instruction::GetElementPtr,ArgVec); - return ExprConstants.getOrCreate(ReqTy, Key); + return ExprConstants->getOrCreate(ReqTy, Key); } Constant *ConstantExpr::getGetElementPtr(Constant *C, @@ -1553,7 +1557,7 @@ std::vector ArgVec(1, Val); ArgVec.push_back(Idx); const ExprMapKeyType &Key = std::make_pair(Instruction::ExtractElement,ArgVec); - return ExprConstants.getOrCreate(ReqTy, Key); + return ExprConstants->getOrCreate(ReqTy, Key); } Constant *ConstantExpr::getExtractElement(Constant *Val, Constant *Idx) { @@ -1574,7 +1578,7 @@ ArgVec.push_back(Elt); ArgVec.push_back(Idx); const ExprMapKeyType &Key = std::make_pair(Instruction::InsertElement,ArgVec); - return ExprConstants.getOrCreate(ReqTy, Key); + return ExprConstants->getOrCreate(ReqTy, Key); } Constant *ConstantExpr::getInsertElement(Constant *Val, Constant *Elt, @@ -1598,7 +1602,7 @@ ArgVec.push_back(V2); ArgVec.push_back(Mask); const ExprMapKeyType &Key = std::make_pair(Instruction::ShuffleVector,ArgVec); - return ExprConstants.getOrCreate(ReqTy, Key); + return ExprConstants->getOrCreate(ReqTy, Key); } Constant *ConstantExpr::getShuffleVector(Constant *V1, Constant *V2, @@ -1612,7 +1616,7 @@ // destroyConstant - Remove the constant from the constant table... // void ConstantExpr::destroyConstant() { - ExprConstants.remove(this); + ExprConstants->remove(this); destroyConstantImpl(); } @@ -1661,7 +1665,7 @@ // Check to see if we have this array type already. bool Exists; ArrayConstantsTy::MapTy::iterator I = - ArrayConstants.InsertOrGetItem(Lookup, Exists); + ArrayConstants->InsertOrGetItem(Lookup, Exists); if (Exists) { Replacement = I->second; @@ -1670,7 +1674,7 @@ // creating a new constant array, inserting it, replaceallusesof'ing the // old with the new, then deleting the old... just update the current one // in place! - ArrayConstants.MoveConstantToNewSlot(this, I); + ArrayConstants->MoveConstantToNewSlot(this, I); // Update to the new value. setOperand(OperandToUpdate, ToC); @@ -1726,7 +1730,7 @@ // Check to see if we have this array type already. bool Exists; StructConstantsTy::MapTy::iterator I = - StructConstants.InsertOrGetItem(Lookup, Exists); + StructConstants->InsertOrGetItem(Lookup, Exists); if (Exists) { Replacement = I->second; @@ -1735,7 +1739,7 @@ // creating a new constant struct, inserting it, replaceallusesof'ing the // old with the new, then deleting the old... just update the current one // in place! - StructConstants.MoveConstantToNewSlot(this, I); + StructConstants->MoveConstantToNewSlot(this, I); // Update to the new value. setOperand(OperandToUpdate, ToC); @@ -1846,34 +1850,6 @@ } - -/// clearAllValueMaps - This method frees all internal memory used by the -/// constant subsystem, which can be used in environments where this memory -/// is otherwise reported as a leak. -void Constant::clearAllValueMaps() { - std::vector Constants; - - DoubleConstants.clear(Constants); - FloatConstants.clear(Constants); - SIntConstants.clear(Constants); - UIntConstants.clear(Constants); - AggZeroConstants.clear(Constants); - ArrayConstants.clear(Constants); - StructConstants.clear(Constants); - PackedConstants.clear(Constants); - NullPtrConstants.clear(Constants); - UndefValueConstants.clear(Constants); - ExprConstants.clear(Constants); - - for (std::vector::iterator I = Constants.begin(), - E = Constants.end(); I != E; ++I) - (*I)->dropAllReferences(); - for (std::vector::iterator I = Constants.begin(), - E = Constants.end(); I != E; ++I) - (*I)->destroyConstantImpl(); - Constants.clear(); -} - /// 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. /// Parameter Chop determines if the result is chopped at the first null From sabre at nondot.org Wed Sep 27 19:37:59 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 27 Sep 2006 19:37:59 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Constant.h Message-ID: <200609280037.k8S0bxrR018423@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Constant.h updated: 1.30 -> 1.31 --- Log message: remove dead method --- Diffs of the changes: (+0 -5) Constant.h | 5 ----- 1 files changed, 5 deletions(-) Index: llvm/include/llvm/Constant.h diff -u llvm/include/llvm/Constant.h:1.30 llvm/include/llvm/Constant.h:1.31 --- llvm/include/llvm/Constant.h:1.30 Mon Jun 5 11:29:06 2006 +++ llvm/include/llvm/Constant.h Wed Sep 27 19:37:43 2006 @@ -103,11 +103,6 @@ assert(0 && "Constants that do not have operands cannot be using 'From'!"); } - /// clearAllValueMaps - This method frees all internal memory used by the - /// constant subsystem, which can be used in environments where this memory - /// is otherwise reported as a leak. - static void clearAllValueMaps(); - /// 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. /// Parameter Chop determines if the result is chopped at the first null From sabre at nondot.org Wed Sep 27 19:38:34 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 27 Sep 2006 19:38:34 -0500 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp Message-ID: <200609280038.k8S0cYTK018460@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Constants.cpp updated: 1.161 -> 1.162 --- Log message: remove reference to dead method --- Diffs of the changes: (+0 -1) Constants.cpp | 1 - 1 files changed, 1 deletion(-) Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.161 llvm/lib/VMCore/Constants.cpp:1.162 --- llvm/lib/VMCore/Constants.cpp:1.161 Wed Sep 27 19:35:06 2006 +++ llvm/lib/VMCore/Constants.cpp Wed Sep 27 19:38:19 2006 @@ -681,7 +681,6 @@ /// AbstractTypeMapTy AbstractTypeMap; - friend void Constant::clearAllValueMaps(); private: void clear(std::vector &Constants) { for(typename MapTy::iterator I = Map.begin(); I != Map.end(); ++I) From rspencer at reidspencer.com Wed Sep 27 20:21:49 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Wed, 27 Sep 2006 18:21:49 -0700 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/ManagedStatic.h In-Reply-To: <200609280032.k8S0WAuo018221@zion.cs.uiuc.edu> References: <200609280032.k8S0WAuo018221@zion.cs.uiuc.edu> Message-ID: <1159406509.20547.155.camel@bashful.x10sys.com> On Wed, 2006-09-27 at 19:32 -0500, Chris Lattner wrote: > > Changes in directory llvm/include/llvm/Support: > > ManagedStatic.h added (r1.1) > --- > Log message: > > new helper class to provide more explicit management of static ctor/dtors. Looks like an interesting approach to this problem. One question .. below > > > --- > Diffs of the changes: (+79 -0) > > ManagedStatic.h | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 files changed, 79 insertions(+) > > > Index: llvm/include/llvm/Support/ManagedStatic.h > diff -c /dev/null llvm/include/llvm/Support/ManagedStatic.h:1.1 > *** /dev/null Wed Sep 27 19:32:05 2006 > --- llvm/include/llvm/Support/ManagedStatic.h Wed Sep 27 19:31:55 2006 > *************** > *** 0 **** > --- 1,79 ---- > + //===-- llvm/Support/ManagedStatic.h - Static Global wrapper ----*- C++ -*-===// > + // > + // The LLVM Compiler Infrastructure > + // > + // This file was developed by Chris Lattner and is distributed under > + // the University of Illinois Open Source License. See LICENSE.TXT for details. > + // > + //===----------------------------------------------------------------------===// > + // > + // This file defines the ManagedStatic class and the llvm_shutdown() function. > + // > + //===----------------------------------------------------------------------===// > + > + #ifndef LLVM_SUPPORT_MANAGED_STATIC_H > + #define LLVM_SUPPORT_MANAGED_STATIC_H > + > + namespace llvm { > + > + /// object_deleter - Helper method for ManagedStatic. > + /// > + template > + void object_deleter(void *Ptr) { > + delete (C*)Ptr; > + } > + > + /// ManagedStaticBase - Common base class for ManagedStatic instances. > + class ManagedStaticBase { > + protected: > + // This should only be used as a static variable, which guarantees that this > + // will be zero initialized. > + mutable void *Ptr; > + mutable void (*DeleterFn)(void*); > + mutable const ManagedStaticBase *Next; > + > + void RegisterManagedStatic(void *ObjPtr, void (*deleter)(void*)) const; > + public: > + void destroy() const; > + }; > + > + /// ManagedStatic - This transparently changes the behavior of global statics to > + /// be lazily constructed on demand (good for reducing startup times of dynamic > + /// libraries that link in LLVM components) and for making destruction be > + /// explicit through the llvm_shutdown() function call. > + /// > + template > + class ManagedStatic : public ManagedStaticBase { > + public: > + > + // Accessors. > + C &operator*() { > + if (!Ptr) LazyInit(); > + return *static_cast(Ptr); > + } > + C *operator->() { > + if (!Ptr) LazyInit(); > + return static_cast(Ptr); > + } > + const C &operator*() const { > + if (!Ptr) LazyInit(); > + return *static_cast(Ptr); > + } > + const C *operator->() const { > + if (!Ptr) LazyInit(); > + return static_cast(Ptr); > + } > + > + public: > + void LazyInit() const { > + RegisterManagedStatic(new C(), object_deleter); This requires a default constructor for class "C". How would that work for things like: static PrimType TheVoidTy ("void" , Type::VoidTyID); in Type.cpp ? Reid. From clattner at apple.com Wed Sep 27 23:29:17 2006 From: clattner at apple.com (Chris Lattner) Date: Wed, 27 Sep 2006 21:29:17 -0700 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/ManagedStatic.h In-Reply-To: <1159406509.20547.155.camel@bashful.x10sys.com> References: <200609280032.k8S0WAuo018221@zion.cs.uiuc.edu> <1159406509.20547.155.camel@bashful.x10sys.com> Message-ID: >> + void LazyInit() const { >> + RegisterManagedStatic(new C(), object_deleter); > > This requires a default constructor for class "C". How would that work > for things like: > > static PrimType TheVoidTy ("void" , Type::VoidTyID); It doesn't. That specific case can be handled by making a type derived from PrimType whose default ctor passes down the values. The uglier case to handle is stuff like the initializer for "ConstantBool::True". -Chris From sabre at nondot.org Thu Sep 28 01:01:33 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 28 Sep 2006 01:01:33 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/README.txt Message-ID: <200609280601.k8S61XDc023253@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: README.txt updated: 1.41 -> 1.42 --- Log message: add a note about a general improvement to the code generator --- Diffs of the changes: (+15 -1) README.txt | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletion(-) Index: llvm/lib/Target/README.txt diff -u llvm/lib/Target/README.txt:1.41 llvm/lib/Target/README.txt:1.42 --- llvm/lib/Target/README.txt:1.41 Mon Sep 25 12:12:14 2006 +++ llvm/lib/Target/README.txt Thu Sep 28 01:01:17 2006 @@ -1,6 +1,20 @@ Target Independent Opportunities: -===-------------------------------------------------------------------------=== +//===---------------------------------------------------------------------===// + +We should make the following changes to clean up MachineInstr: + +1. Add an Opcode field to TargetInstrDescriptor, so you can tell the opcode of + an instruction with just a TargetInstrDescriptor*. +2. Remove the Opcode field from MachineInstr, replacing it with a + TargetInstrDescriptor*. +3. Getting information about a machine instr then becomes: + MI->getInfo()->isTwoAddress() + instead of: + const TargetInstrInfo &TII = ... + TII.isTwoAddrInstr(MI->getOpcode()) + +//===---------------------------------------------------------------------===// FreeBench/mason contains code like this: From sabre at nondot.org Thu Sep 28 01:17:26 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 28 Sep 2006 01:17:26 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAGISel.h Message-ID: <200609280617.k8S6HQNs023543@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: SelectionDAGISel.h updated: 1.24 -> 1.25 --- Log message: refactor critical edge breaking out into the SplitCritEdgesForPHIConstants method. This is a baby step towards fixing PR925: http://llvm.org/PR925 . --- Diffs of the changes: (+1 -0) SelectionDAGISel.h | 1 + 1 files changed, 1 insertion(+) Index: llvm/include/llvm/CodeGen/SelectionDAGISel.h diff -u llvm/include/llvm/CodeGen/SelectionDAGISel.h:1.24 llvm/include/llvm/CodeGen/SelectionDAGISel.h:1.25 --- llvm/include/llvm/CodeGen/SelectionDAGISel.h:1.24 Mon Aug 7 17:16:08 2006 +++ llvm/include/llvm/CodeGen/SelectionDAGISel.h Thu Sep 28 01:17:10 2006 @@ -124,6 +124,7 @@ SelectionDAG &DAG); private: + void SplitCritEdgesForPHIConstants(BasicBlock *BB); SDOperand CopyValueToVirtualRegister(SelectionDAGLowering &SDL, Value *V, unsigned Reg); void SelectBasicBlock(BasicBlock *BB, MachineFunction &MF, From sabre at nondot.org Thu Sep 28 01:17:27 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 28 Sep 2006 01:17:27 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200609280617.k8S6HRYI023548@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.280 -> 1.281 --- Log message: refactor critical edge breaking out into the SplitCritEdgesForPHIConstants method. This is a baby step towards fixing PR925: http://llvm.org/PR925 . --- Diffs of the changes: (+20 -9) SelectionDAGISel.cpp | 29 ++++++++++++++++++++--------- 1 files changed, 20 insertions(+), 9 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.280 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.281 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.280 Tue Sep 26 15:02:30 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Thu Sep 28 01:17:10 2006 @@ -845,8 +845,6 @@ CurMBB->addSuccessor(CB.RHSBB); } -/// visitSwitchCase - Emits the necessary code to represent a single node in -/// the binary search tree resulting from lowering a switch instruction. void SelectionDAGLowering::visitJumpTable(SelectionDAGISel::JumpTable &JT) { // FIXME: Need to emit different code for PIC vs. Non-PIC, specifically, // we need to add the address of the jump table to the value loaded, since @@ -3207,6 +3205,21 @@ return true; } +/// SplitCritEdgesForPHIConstants - If this block has any PHI nodes with +/// constant operands, and if any of the edges feeding the PHI node are +/// critical, split them so that the assignments of a constant to a register +/// will not be executed on a path that isn't relevant. +void SelectionDAGISel::SplitCritEdgesForPHIConstants(BasicBlock *BB) { + PHINode *PN; + BasicBlock::iterator BBI = BB->begin(); + while ((PN = dyn_cast(BBI++))) { + for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) + if (isa(PN->getIncomingValue(i))) + SplitCriticalEdge(PN->getIncomingBlock(i), BB); + } +} + + bool SelectionDAGISel::runOnFunction(Function &Fn) { MachineFunction &MF = MachineFunction::construct(&Fn, TLI.getTargetMachine()); RegMap = MF.getSSARegMap(); @@ -3225,14 +3238,12 @@ while (MadeChange) { MadeChange = false; for (Function::iterator BB = Fn.begin(), E = Fn.end(); BB != E; ++BB) { - PHINode *PN; - BasicBlock::iterator BBI; - for (BBI = BB->begin(); (PN = dyn_cast(BBI)); ++BBI) - for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) - if (isa(PN->getIncomingValue(i))) - SplitCriticalEdge(PN->getIncomingBlock(i), BB); + // If this block has any PHI nodes with constant operands, and if any of the + // edges feeding the PHI node are critical, split them. + if (isa(BB->begin())) + SplitCritEdgesForPHIConstants(BB); - for (BasicBlock::iterator E = BB->end(); BBI != E; ) { + for (BasicBlock::iterator BBI = BB->begin(), E = BB->end(); BBI != E; ) { Instruction *I = BBI++; if (GetElementPtrInst *GEPI = dyn_cast(I)) { MadeChange |= OptimizeGEPExpression(GEPI, TLI.getTargetData()); From isanbard at gmail.com Thu Sep 28 02:10:40 2006 From: isanbard at gmail.com (Bill Wendling) Date: Thu, 28 Sep 2006 02:10:40 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/PHIElimination.cpp Message-ID: <200609280710.k8S7AeWx027041@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: PHIElimination.cpp updated: 1.50 -> 1.51 --- Log message: "Once more into the breach, dear friends, once more, or fill the wall up with our English dead." No! Really! Serious this time...It was how the vreg uses were being adjusted that was causing hte Olden tests to fail. I corrected this and the Olden and Regression tests all passed. --- Diffs of the changes: (+42 -26) PHIElimination.cpp | 68 ++++++++++++++++++++++++++++++++--------------------- 1 files changed, 42 insertions(+), 26 deletions(-) Index: llvm/lib/CodeGen/PHIElimination.cpp diff -u llvm/lib/CodeGen/PHIElimination.cpp:1.50 llvm/lib/CodeGen/PHIElimination.cpp:1.51 --- llvm/lib/CodeGen/PHIElimination.cpp:1.50 Wed Sep 27 19:11:54 2006 +++ llvm/lib/CodeGen/PHIElimination.cpp Thu Sep 28 02:10:24 2006 @@ -34,12 +34,15 @@ struct VISIBILITY_HIDDEN PNE : public MachineFunctionPass { bool runOnMachineFunction(MachineFunction &Fn) { + analyzePHINodes(Fn); + bool Changed = false; // Eliminate PHI instructions by inserting copies into predecessor blocks. for (MachineFunction::iterator I = Fn.begin(), E = Fn.end(); I != E; ++I) Changed |= EliminatePHINodes(Fn, *I); + VRegPHIUseCount.clear(); return Changed; } @@ -54,15 +57,26 @@ /// bool EliminatePHINodes(MachineFunction &MF, MachineBasicBlock &MBB); void LowerAtomicPHINode(MachineBasicBlock &MBB, - MachineBasicBlock::iterator AfterPHIsIt, - DenseMap &VUC); + MachineBasicBlock::iterator AfterPHIsIt); + + /// analyzePHINodes - Gather information about the PHI nodes in + /// here. In particular, we want to map the number of uses of a virtual + /// register which is used in a PHI node. We map that to the BB the + /// vreg is coming from. This is used later to determine when the vreg + /// is killed in the BB. + /// + void analyzePHINodes(const MachineFunction& Fn); + + typedef std::pair BBVRegPair; + typedef std::map VRegPHIUse; + + VRegPHIUse VRegPHIUseCount; }; RegisterPass X("phi-node-elimination", "Eliminate PHI nodes for register allocation"); } - const PassInfo *llvm::PHIEliminationID = X.getPassInfo(); /// EliminatePHINodes - Eliminate phi nodes by inserting copy instructions in @@ -72,20 +86,6 @@ if (MBB.empty() || MBB.front().getOpcode() != TargetInstrInfo::PHI) return false; // Quick exit for basic blocks without PHIs. - // VRegPHIUseCount - Keep track of the number of times each virtual register - // is used by PHI nodes in successors of this block. - DenseMap VRegPHIUseCount; - VRegPHIUseCount.grow(MF.getSSARegMap()->getLastVirtReg()); - - for (MachineBasicBlock::pred_iterator PI = MBB.pred_begin(), - E = MBB.pred_end(); PI != E; ++PI) - for (MachineBasicBlock::succ_iterator SI = (*PI)->succ_begin(), - E = (*PI)->succ_end(); SI != E; ++SI) - for (MachineBasicBlock::iterator BBI = (*SI)->begin(), E = (*SI)->end(); - BBI != E && BBI->getOpcode() == TargetInstrInfo::PHI; ++BBI) - for (unsigned i = 1, e = BBI->getNumOperands(); i != e; i += 2) - VRegPHIUseCount[BBI->getOperand(i).getReg()]++; - // Get an iterator to the first instruction after the last PHI node (this may // also be the end of the basic block). MachineBasicBlock::iterator AfterPHIsIt = MBB.begin(); @@ -93,9 +93,9 @@ AfterPHIsIt->getOpcode() == TargetInstrInfo::PHI) ++AfterPHIsIt; // Skip over all of the PHI nodes... - while (MBB.front().getOpcode() == TargetInstrInfo::PHI) { - LowerAtomicPHINode(MBB, AfterPHIsIt, VRegPHIUseCount); - } + while (MBB.front().getOpcode() == TargetInstrInfo::PHI) + LowerAtomicPHINode(MBB, AfterPHIsIt); + return true; } @@ -115,14 +115,13 @@ /// atomic execution of PHIs. This lowering method is always correct all of the /// time. void PNE::LowerAtomicPHINode(MachineBasicBlock &MBB, - MachineBasicBlock::iterator AfterPHIsIt, - DenseMap &VRegPHIUseCount) { + MachineBasicBlock::iterator AfterPHIsIt) { // Unlink the PHI node from the basic block, but don't delete the PHI yet. MachineInstr *MPhi = MBB.remove(MBB.begin()); unsigned DestReg = MPhi->getOperand(0).getReg(); - // Create a new register for the incoming PHI arguments/ + // Create a new register for the incoming PHI arguments. MachineFunction &MF = *MBB.getParent(); const TargetRegisterClass *RC = MF.getSSARegMap()->getRegClass(DestReg); unsigned IncomingReg = MF.getSSARegMap()->createVirtualRegister(RC); @@ -165,9 +164,10 @@ // Adjust the VRegPHIUseCount map to account for the removal of this PHI // node. - unsigned NumPreds = (MPhi->getNumOperands()-1)/2; for (unsigned i = 1; i != MPhi->getNumOperands(); i += 2) - VRegPHIUseCount[MPhi->getOperand(i).getReg()] -= NumPreds; + --VRegPHIUseCount[BBVRegPair( + MPhi->getOperand(i + 1).getMachineBasicBlock(), + MPhi->getOperand(i).getReg())]; // Now loop over all of the incoming arguments, changing them to copy into // the IncomingReg register in the corresponding predecessor basic block. @@ -219,7 +219,7 @@ // // Is it used by any PHI instructions in this block? - bool ValueIsLive = VRegPHIUseCount[SrcReg] != 0; + bool ValueIsLive = VRegPHIUseCount[BBVRegPair(&opBlock, SrcReg)] != 0; std::vector OpSuccBlocks; @@ -317,3 +317,19 @@ delete MPhi; ++NumAtomic; } + +/// analyzePHINodes - Gather information about the PHI nodes in here. In +/// particular, we want to map the number of uses of a virtual register which is +/// used in a PHI node. We map that to the BB the vreg is coming from. This is +/// used later to determine when the vreg is killed in the BB. +/// +void PNE::analyzePHINodes(const MachineFunction& Fn) { + for (MachineFunction::const_iterator I = Fn.begin(), E = Fn.end(); + I != E; ++I) + for (MachineBasicBlock::const_iterator BBI = I->begin(), BBE = I->end(); + BBI != BBE && BBI->getOpcode() == TargetInstrInfo::PHI; ++BBI) + for (unsigned i = 1, e = BBI->getNumOperands(); i != e; i += 2) + ++VRegPHIUseCount[BBVRegPair( + BBI->getOperand(i + 1).getMachineBasicBlock(), + BBI->getOperand(i).getReg())]; +} From reid at x10sys.com Thu Sep 28 11:54:02 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 28 Sep 2006 11:54:02 -0500 Subject: [llvm-commits] CVS: llvm/docs/WritingAnLLVMPass.html Message-ID: <200609281654.k8SGs2FY012151@zion.cs.uiuc.edu> Changes in directory llvm/docs: WritingAnLLVMPass.html updated: 1.49 -> 1.50 --- Log message: Provide a gdb usage fix provided by Zhongzing Xu. --- Diffs of the changes: (+2 -2) WritingAnLLVMPass.html | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/docs/WritingAnLLVMPass.html diff -u llvm/docs/WritingAnLLVMPass.html:1.49 llvm/docs/WritingAnLLVMPass.html:1.50 --- llvm/docs/WritingAnLLVMPass.html:1.49 Sun Aug 27 19:45:38 2006 +++ llvm/docs/WritingAnLLVMPass.html Thu Sep 28 11:53:47 2006 @@ -1593,7 +1593,7 @@ want:

-(gdb) break PassManager::run
+(gdb) break llvm::PassManager::run
 Breakpoint 1 at 0x2413bc: file Pass.cpp, line 70.
 (gdb) run test.bc -load $(LLVMTOP)/llvm/Debug/lib/[libname].so -[passoption]
 Starting program: opt test.bc -load $(LLVMTOP)/llvm/Debug/lib/[libname].so -[passoption]
@@ -1711,7 +1711,7 @@
 
   Chris Lattner
The LLVM Compiler Infrastructure
- Last modified: $Date: 2006/08/28 00:45:38 $ + Last modified: $Date: 2006/09/28 16:53:47 $ From jlaskey at apple.com Thu Sep 28 12:49:35 2006 From: jlaskey at apple.com (Jim Laskey) Date: Thu, 28 Sep 2006 12:49:35 -0500 Subject: [llvm-commits] CVS: llvm/utils/NewNightlyTest.pl Message-ID: <200609281749.k8SHnZ9m013139@zion.cs.uiuc.edu> Changes in directory llvm/utils: NewNightlyTest.pl updated: 1.60 -> 1.61 --- Log message: Add support for -release-asserts. --- Diffs of the changes: (+9 -1) NewNightlyTest.pl | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletion(-) Index: llvm/utils/NewNightlyTest.pl diff -u llvm/utils/NewNightlyTest.pl:1.60 llvm/utils/NewNightlyTest.pl:1.61 --- llvm/utils/NewNightlyTest.pl:1.60 Wed Sep 20 04:20:22 2006 +++ llvm/utils/NewNightlyTest.pl Thu Sep 28 12:49:20 2006 @@ -29,6 +29,7 @@ # -nodejagnu Do not run feature or regression tests # -parallel Run two parallel jobs with GNU Make. # -release Build an LLVM Release version +# -release-asserts Build an LLVM ReleaseAsserts version # -enable-llcbeta Enable testing of beta features in llc. # -disable-llc Disable LLC tests in the nightly tester. # -disable-jit Disable JIT tests in the nightly tester. @@ -133,6 +134,9 @@ if (/^-parallel$/) { $MAKEOPTS = "$MAKEOPTS -j2 -l3.0"; next; } if (/^-release$/) { $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ". "OPTIMIZE_OPTION=-O2"; $BUILDTYPE="release"; next;} + if (/^-release-asserts$/){ $MAKEOPTS = "$MAKEOPTS ENABLE_OPTIMIZED=1 ". + "DISABLE-ASSERTIONS=1 ". + "OPTIMIZE_OPTION=-O2"; $BUILDTYPE="release-asserts"; next;} if (/^-enable-llcbeta$/) { $PROGTESTOPTS .= " ENABLE_LLCBETA=1"; next; } if (/^-disable-llc$/) { $PROGTESTOPTS .= " DISABLE_LLC=1"; $CONFIGUREARGS .= " --disable-llc_diffs"; next; } @@ -206,7 +210,7 @@ "\"-nickname \""); } -if ($BUILDTYPE ne "release") { +if ($BUILDTYPE ne "release" && $BUILDTYPE ne "release-asserts") { $BUILDTYPE = "debug"; } @@ -657,6 +661,8 @@ $afiles.= `find tools/ -iname '*.a' -ls`; if($BUILDTYPE eq "release"){ $afiles.= `find Release/ -iname '*.a' -ls`; + } elsif($BUILDTYPE eq "release-asserts") { + $afiles.= `find Release-Asserts/ -iname '*.a' -ls`; } else { $afiles.= `find Debug/ -iname '*.a' -ls`; } @@ -666,6 +672,8 @@ $ofiles.= `find tools/ -iname '*.o' -ls`; if($BUILDTYPE eq "release"){ $ofiles.= `find Release/ -iname '*.o' -ls`; + } elsif($BUILDTYPE eq "release-asserts") { + $ofiles.= `find Release-Asserts/ -iname '*.o' -ls`; } else { $ofiles.= `find Debug/ -iname '*.o' -ls`; } From jlaskey at apple.com Thu Sep 28 13:45:26 2006 From: jlaskey at apple.com (Jim Laskey) Date: Thu, 28 Sep 2006 13:45:26 -0500 Subject: [llvm-commits] CVS: llvm/utils/NewNightlyTest.pl Message-ID: <200609281845.k8SIjQrD014046@zion.cs.uiuc.edu> Changes in directory llvm/utils: NewNightlyTest.pl updated: 1.61 -> 1.62 --- Log message: Fix search file for -release. --- Diffs of the changes: (+2 -2) NewNightlyTest.pl | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/utils/NewNightlyTest.pl diff -u llvm/utils/NewNightlyTest.pl:1.61 llvm/utils/NewNightlyTest.pl:1.62 --- llvm/utils/NewNightlyTest.pl:1.61 Thu Sep 28 12:49:20 2006 +++ llvm/utils/NewNightlyTest.pl Thu Sep 28 13:45:11 2006 @@ -660,7 +660,7 @@ $afiles.= `find lib/ -iname '*.a' -ls`; $afiles.= `find tools/ -iname '*.a' -ls`; if($BUILDTYPE eq "release"){ - $afiles.= `find Release/ -iname '*.a' -ls`; + $afiles.= `find Release+Asserts/ -iname '*.a' -ls`; } elsif($BUILDTYPE eq "release-asserts") { $afiles.= `find Release-Asserts/ -iname '*.a' -ls`; } else { @@ -671,7 +671,7 @@ $ofiles.= `find lib/ -iname '*.o' -ls`; $ofiles.= `find tools/ -iname '*.o' -ls`; if($BUILDTYPE eq "release"){ - $ofiles.= `find Release/ -iname '*.o' -ls`; + $ofiles.= `find Release+Asserts/ -iname '*.o' -ls`; } elsif($BUILDTYPE eq "release-asserts") { $ofiles.= `find Release-Asserts/ -iname '*.o' -ls`; } else { From evan.cheng at apple.com Thu Sep 28 13:52:48 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 28 Sep 2006 13:52:48 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/PrologEpilogInserter.cpp Message-ID: <200609281852.k8SIqmki014336@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: PrologEpilogInserter.cpp updated: 1.60 -> 1.61 --- Log message: TargetRegisterClass specifies the desired spill alignment. However, it cannot be honored if stack alignment is smaller. --- Diffs of the changes: (+6 -1) PrologEpilogInserter.cpp | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/PrologEpilogInserter.cpp diff -u llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.60 llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.61 --- llvm/lib/CodeGen/PrologEpilogInserter.cpp:1.60 Wed Sep 27 19:10:27 2006 +++ llvm/lib/CodeGen/PrologEpilogInserter.cpp Thu Sep 28 13:52:32 2006 @@ -190,7 +190,12 @@ int FrameIdx; if (FixedSlot == FixedSpillSlots+NumFixedSpillSlots) { // Nope, just spill it anywhere convenient. - FrameIdx = FFI->CreateStackObject(RC->getSize(), RC->getAlignment()); + unsigned Align = RC->getAlignment(); + unsigned StackAlign = TFI->getStackAlignment(); + // We may not be able to sastify the desired alignment specification of + // the TargetRegisterClass if the stack alignment is smaller. Use the min. + Align = std::min(Align, StackAlign); + FrameIdx = FFI->CreateStackObject(RC->getSize(), Align); if ((unsigned)FrameIdx < MinCSFrameIndex) MinCSFrameIndex = FrameIdx; if ((unsigned)FrameIdx > MaxCSFrameIndex) MaxCSFrameIndex = FrameIdx; } else { From sabre at nondot.org Thu Sep 28 13:58:18 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 28 Sep 2006 13:58:18 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CFrontend/2006-09-28-SimpleAsm.c Message-ID: <200609281858.k8SIwIfE014462@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CFrontend: 2006-09-28-SimpleAsm.c added (r1.1) --- Log message: Testcase for PR924: http://llvm.org/PR924 --- Diffs of the changes: (+11 -0) 2006-09-28-SimpleAsm.c | 11 +++++++++++ 1 files changed, 11 insertions(+) Index: llvm/test/Regression/CFrontend/2006-09-28-SimpleAsm.c diff -c /dev/null llvm/test/Regression/CFrontend/2006-09-28-SimpleAsm.c:1.1 *** /dev/null Thu Sep 28 13:58:12 2006 --- llvm/test/Regression/CFrontend/2006-09-28-SimpleAsm.c Thu Sep 28 13:58:02 2006 *************** *** 0 **** --- 1,11 ---- + // RUN: %llvmgcc %s -S -o /dev/null && + // RUN: %llvmgcc %s -S -o - | grep 'ext: xorl %eax, eax; movl' && + // RUN: %llvmgcc %s -S -o - | grep 'nonext: xorl %eax, %eax; mov' + // PR924 + + void bar() { + // Extended asm + asm volatile ("ext: xorl %%eax, eax; movl eax, fs; movl eax, gs %%blah %= %% " : : "r"(1)); + // Non-extended asm. + asm volatile ("nonext: xorl %eax, %eax; movl %eax, %fs; movl %eax, %gs %%blah %= %% "); + } From reid at x10sys.com Thu Sep 28 14:28:40 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 28 Sep 2006 14:28:40 -0500 Subject: [llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.cpp.cvs llvmAsmParser.h.cvs llvmAsmParser.y llvmAsmParser.y.cvs Message-ID: <200609281928.k8SJSepQ014990@zion.cs.uiuc.edu> Changes in directory llvm/lib/AsmParser: llvmAsmParser.cpp.cvs updated: 1.13 -> 1.14 llvmAsmParser.h.cvs updated: 1.8 -> 1.9 llvmAsmParser.y updated: 1.261 -> 1.262 llvmAsmParser.y.cvs updated: 1.13 -> 1.14 --- Log message: Fix PR902: http://llvm.org/PR902 : Errors are generated with the YYERROR macro which can only be called from a production (inside yyparse) because of the goto statement in the macro. This lead to several situations where GEN_ERROR was not called but GenerateError was used instead (because it doesn't use YYERROR). However, in such situations, catching the error much later (e.g. at the end of the production) is not sufficient because LLVM can assert on invalid data before the end of the production is reached. The solution is to ensure that the CHECK_FOR_ERROR macro (which invokes YYERROR if there's an error) is used as soon as possible after a call to GenerateError has been made. --- Diffs of the changes: (+1420 -1291) llvmAsmParser.cpp.cvs | 2189 ++++++++++++++++++++++++-------------------------- llvmAsmParser.h.cvs | 40 llvmAsmParser.y | 241 +++-- llvmAsmParser.y.cvs | 241 +++-- 4 files changed, 1420 insertions(+), 1291 deletions(-) Index: llvm/lib/AsmParser/llvmAsmParser.cpp.cvs diff -u llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.13 llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.14 --- llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.13 Sun Sep 17 15:25:45 2006 +++ llvm/lib/AsmParser/llvmAsmParser.cpp.cvs Thu Sep 28 14:28:24 2006 @@ -1,9 +1,7 @@ -/* A Bison parser, made by GNU Bison 2.2. */ +/* A Bison parser, made by GNU Bison 2.1. */ -/* Skeleton implementation for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. +/* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 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 @@ -20,21 +18,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ +/* 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. */ -/* C LALR(1) parser skeleton written by Richard Stallman, by - simplifying the original so-called "semantic" parser. */ +/* 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 @@ -47,7 +37,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.2" +#define YYBISON_VERSION "2.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -292,7 +282,7 @@ /* Copy the first part of user declarations. */ -#line 14 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 14 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" #include "ParserInternals.h" #include "llvm/CallingConv.h" @@ -388,6 +378,8 @@ // are resolved when the constant pool has been completely parsed. // ResolveDefinitions(LateResolveValues); + if (TriggerError) + return; // Check to make sure that all global value forward references have been // resolved! @@ -401,6 +393,7 @@ I->first.second.getName() + "\n"; } GenerateError(UndefinedReferences); + return; } // Look for intrinsic functions and CallInst that need to be upgraded @@ -458,9 +451,11 @@ NumberedBlocks.clear(); // Any forward referenced blocks left? - if (!BBForwardRefs.empty()) + if (!BBForwardRefs.empty()) { GenerateError("Undefined reference to label " + BBForwardRefs.begin()->first->getName()); + return; + } // Resolve all forward references now. ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues); @@ -504,6 +499,7 @@ break; default: GenerateError("Internal parser error: Invalid symbol type reference!"); + return 0; } // If we reached here, we referenced either a symbol that we don't know about @@ -514,10 +510,13 @@ if (inFunctionScope()) { - if (D.Type == ValID::NameVal) + if (D.Type == ValID::NameVal) { GenerateError("Reference to an undefined type: '" + D.getName() + "'"); - else + return 0; + } else { GenerateError("Reference to an undefined type: #" + itostr(D.Num)); + return 0; + } } std::map::iterator I =CurModule.LateResolveTypes.find(D); @@ -541,9 +540,11 @@ // it. Otherwise return null. // static Value *getValNonImprovising(const Type *Ty, const ValID &D) { - if (isa(Ty)) + if (isa(Ty)) { GenerateError("Functions are not values and " "must be referenced as pointers"); + return 0; + } switch (D.Type) { case ValID::NumberVal: { // Is it a numbered definition? @@ -578,10 +579,12 @@ // 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)) + if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64)) { GenerateError("Signed integral constant '" + itostr(D.ConstPool64) + "' is invalid for type '" + Ty->getDescription() + "'!"); + return 0; + } return ConstantSInt::get(Ty, D.ConstPool64); case ValID::ConstUIntVal: // Is it an unsigned const pool reference? @@ -589,6 +592,7 @@ if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64)) { GenerateError("Integral constant '" + utostr(D.UConstPool64) + "' is invalid or out of range!"); + return 0; } else { // This is really a signed reference. Transmogrify. return ConstantSInt::get(Ty, D.ConstPool64); } @@ -597,13 +601,17 @@ } case ValID::ConstFPVal: // Is it a floating point const pool reference? - if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) + if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) { GenerateError("FP constant invalid for type!!"); + return 0; + } return ConstantFP::get(Ty, D.ConstPoolFP); case ValID::ConstNullVal: // Is it a null value? - if (!isa(Ty)) + if (!isa(Ty)) { GenerateError("Cannot create a a non pointer null!"); + return 0; + } return ConstantPointerNull::get(cast(Ty)); case ValID::ConstUndefVal: // Is it an undef value? @@ -613,16 +621,20 @@ return Constant::getNullValue(Ty); case ValID::ConstantVal: // Fully resolved constant? - if (D.ConstantValue->getType() != Ty) + if (D.ConstantValue->getType() != Ty) { GenerateError("Constant expression type different from required type!"); + return 0; + } 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)) + if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) { GenerateError("Invalid type for asm constraint string!"); + return 0; + } InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints, D.IAD->HasSideEffects); D.destroy(); // Free InlineAsmDescriptor. @@ -644,15 +656,20 @@ // real thing. // static Value *getVal(const Type *Ty, const ValID &ID) { - if (Ty == Type::LabelTy) + if (Ty == Type::LabelTy) { GenerateError("Cannot use a basic block here"); + return 0; + } // See if the value has already been defined. Value *V = getValNonImprovising(Ty, ID); if (V) return V; + if (TriggerError) return 0; - if (!Ty->isFirstClassType() && !isa(Ty)) + if (!Ty->isFirstClassType() && !isa(Ty)) { GenerateError("Invalid use of a composite type!"); + return 0; + } // 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 @@ -684,7 +701,9 @@ std::string Name; BasicBlock *BB = 0; switch (ID.Type) { - default: GenerateError("Illegal label reference " + ID.getName()); + default: + GenerateError("Illegal label reference " + ID.getName()); + return 0; case ValID::NumberVal: // Is it a numbered definition? if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size()) CurFun.NumberedBlocks.resize(ID.Num+1); @@ -703,9 +722,11 @@ // 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)) + if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) { // The existing value was a definition, not a forward reference. GenerateError("Redefinition of label " + ID.getName()); + return 0; + } ID.destroy(); // Free strdup'd memory. return BB; @@ -769,6 +790,8 @@ ValID &DID = PHI->second.first; Value *TheRealValue = getValNonImprovising(LRI->first, DID); + if (TriggerError) + return; if (TheRealValue) { V->replaceAllUsesWith(TheRealValue); delete V; @@ -778,15 +801,18 @@ // resolver table InsertValue(V, *FutureLateResolvers); } else { - if (DID.Type == ValID::NameVal) + if (DID.Type == ValID::NameVal) { GenerateError("Reference to an invalid definition: '" +DID.getName()+ "' of type '" + V->getType()->getDescription() + "'", PHI->second.second); - else + return; + } else { GenerateError("Reference to an invalid definition: #" + itostr(DID.Num) + " of type '" + V->getType()->getDescription() + "'", PHI->second.second); + return; + } } } } @@ -820,14 +846,18 @@ std::string Name(NameStr); // Copy string free(NameStr); // Free old string - if (V->getType() == Type::VoidTy) + if (V->getType() == Type::VoidTy) { GenerateError("Can't assign name '" + Name+"' to value with void type!"); + return; + } assert(inFunctionScope() && "Must be in function scope!"); SymbolTable &ST = CurFun.CurrentFunction->getSymbolTable(); - if (ST.lookup(V->getType(), Name)) + if (ST.lookup(V->getType(), Name)) { GenerateError("Redefinition of value named '" + Name + "' in the '" + V->getType()->getDescription() + "' type plane!"); + return; + } // Set the name. V->setName(Name); @@ -840,8 +870,10 @@ ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage, bool isConstantGlobal, const Type *Ty, Constant *Initializer) { - if (isa(Ty)) + if (isa(Ty)) { GenerateError("Cannot declare global vars of function type!"); + return 0; + } const PointerType *PTy = PointerType::get(Ty); @@ -900,6 +932,7 @@ GenerateError("Redefinition of global variable named '" + Name + "' in the '" + Ty->getDescription() + "' type plane!"); + return 0; } } @@ -926,8 +959,10 @@ free(NameStr); // Free old string // We don't allow assigning names to void type - if (T == Type::VoidTy) + if (T == Type::VoidTy) { GenerateError("Can't assign name '" + Name + "' to the void type!"); + return false; + } // Set the type name, checking for conflicts as we do so. bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T); @@ -1052,7 +1087,7 @@ // common code from the two 'RunVMAsmParser' functions - static Module * RunParser(Module * M) { +static Module* RunParser(Module * M) { llvmAsmlineno = 1; // Reset the current line number... ObsoleteVarArgs = false; @@ -1077,13 +1112,18 @@ ObsoleteVarArgs = true; } - if (ObsoleteVarArgs && NewVarArgs) - GenerateError("This file is corrupt: it uses both new and old style varargs"); + if (ObsoleteVarArgs && NewVarArgs) { + GenerateError( + "This file is corrupt: it uses both new and old style varargs"); + return 0; + } if(ObsoleteVarArgs) { if(Function* F = Result->getNamedFunction("llvm.va_start")) { - if (F->arg_size() != 0) + if (F->arg_size() != 0) { GenerateError("Obsolete va_start takes 0 argument!"); + return 0; + } //foo = va_start() // -> @@ -1109,8 +1149,10 @@ } if(Function* F = Result->getNamedFunction("llvm.va_end")) { - if(F->arg_size() != 1) + if(F->arg_size() != 1) { GenerateError("Obsolete va_end takes 1 argument!"); + return 0; + } //vaend foo // -> @@ -1133,8 +1175,10 @@ } if(Function* F = Result->getNamedFunction("llvm.va_copy")) { - if(F->arg_size() != 1) + if(F->arg_size() != 1) { GenerateError("Obsolete va_copy takes 1 argument!"); + return 0; + } //foo = vacopy(bar) // -> //a = alloca 1 of typeof(foo) @@ -1165,8 +1209,7 @@ } return Result; - - } +} //===----------------------------------------------------------------------===// // RunVMAsmParser - Define an interface to this parser @@ -1210,10 +1253,9 @@ # define YYTOKEN_TABLE 0 #endif -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -#line 913 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" -{ +#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +#line 966 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +typedef union YYSTYPE { llvm::Module *ModuleVal; llvm::Function *FunctionVal; std::pair *ArgVal; @@ -1251,10 +1293,9 @@ llvm::Instruction::MemoryOps MemOpVal; llvm::Instruction::OtherOps OtherOpVal; llvm::Module::Endianness Endianness; -} -/* Line 193 of yacc.c. */ -#line 1257 "llvmAsmParser.tab.c" - YYSTYPE; +} YYSTYPE; +/* Line 196 of yacc.c. */ +#line 1299 "llvmAsmParser.tab.c" # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 @@ -1265,56 +1306,23 @@ /* Copy the second part of user declarations. */ -/* Line 216 of yacc.c. */ -#line 1270 "llvmAsmParser.tab.c" +/* Line 219 of yacc.c. */ +#line 1311 "llvmAsmParser.tab.c" -#ifdef short -# undef short -#endif - -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; +#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) +# define YYSIZE_T __SIZE_TYPE__ #endif - -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; -#else -typedef short int yytype_int8; -#endif - -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; -#else -typedef unsigned short int yytype_uint16; +#if ! defined (YYSIZE_T) && defined (size_t) +# define YYSIZE_T size_t #endif - -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; -#else -typedef short int yytype_int16; +#if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t #endif - -#ifndef YYSIZE_T -# ifdef __SIZE_TYPE__ -# define YYSIZE_T __SIZE_TYPE__ -# elif defined size_t -# define YYSIZE_T size_t -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# else -# define YYSIZE_T unsigned int -# endif +#if ! defined (YYSIZE_T) +# define YYSIZE_T unsigned int #endif -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) - #ifndef YY_ # if YYENABLE_NLS # if ENABLE_NLS @@ -1327,32 +1335,7 @@ # endif #endif -/* Suppress unused-variable warnings by "using" E. */ -#if ! defined lint || defined __GNUC__ -# define YYUSE(e) ((void) (e)) -#else -# define YYUSE(e) /* empty */ -#endif - -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(n) (n) -#else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID (int i) -#else -static int -YYID (i) - int i; -#endif -{ - return i; -} -#endif - -#if ! defined yyoverflow || YYERROR_VERBOSE +#if ! defined (yyoverflow) || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ @@ -1360,76 +1343,64 @@ # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca -# elif defined __BUILTIN_VA_ARG_INCR -# include /* INFRINGES ON USER NAME SPACE */ -# elif defined _AIX -# define YYSTACK_ALLOC __alloca -# elif defined _MSC_VER -# include /* INFRINGES ON USER NAME SPACE */ -# define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if defined (__STDC__) || defined (__cplusplus) # include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 -# endif +# define YYINCLUDED_STDLIB_H # endif # endif # endif # endif # ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM -# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1) # endif -# if (defined __cplusplus && ! defined _STDLIB_H \ - && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) -# include /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 -# endif +# ifdef __cplusplus +extern "C" { # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ + && (defined (__STDC__) || defined (__cplusplus))) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ + && (defined (__STDC__) || defined (__cplusplus))) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif +# ifdef __cplusplus +} +# endif # endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ +#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ -#if (! defined yyoverflow \ - && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) +#if (! defined (yyoverflow) \ + && (! defined (__cplusplus) \ + || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss; + short int yyss; YYSTYPE yyvs; }; @@ -1439,13 +1410,13 @@ /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + ((N) * (sizeof (short int) + 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__ +# if defined (__GNUC__) && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else @@ -1456,7 +1427,7 @@ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ - while (YYID (0)) + while (0) # endif # endif @@ -1474,22 +1445,28 @@ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ - while (YYID (0)) + while (0) + +#endif +#if defined (__STDC__) || defined (__cplusplus) + typedef signed char yysigned_char; +#else + typedef short int yysigned_char; #endif -/* YYFINAL -- State number of the termination state. */ +/* YYFINAL -- State number of the termination state. */ #define YYFINAL 4 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 1330 -/* YYNTOKENS -- Number of terminals. */ +/* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 122 -/* YYNNTS -- Number of nonterminals. */ +/* YYNNTS -- Number of nonterminals. */ #define YYNNTS 75 -/* YYNRULES -- Number of rules. */ +/* YYNRULES -- Number of rules. */ #define YYNRULES 251 -/* YYNRULES -- Number of states. */ +/* YYNRULES -- Number of states. */ #define YYNSTATES 514 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ @@ -1500,7 +1477,7 @@ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ -static const yytype_uint8 yytranslate[] = +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, @@ -1544,7 +1521,7 @@ #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ -static const yytype_uint16 yyprhs[] = +static const unsigned short int yyprhs[] = { 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, @@ -1574,8 +1551,8 @@ 804, 811 }; -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int16 yyrhs[] = +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const short int yyrhs[] = { 153, 0, -1, 5, -1, 6, -1, 3, -1, 4, -1, 77, -1, 78, -1, 79, -1, 80, -1, 81, @@ -1662,40 +1639,40 @@ }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = +static const unsigned short int yyrline[] = { - 0, 1035, 1035, 1036, 1044, 1045, 1055, 1055, 1055, 1055, - 1055, 1056, 1056, 1056, 1057, 1057, 1057, 1057, 1057, 1057, - 1059, 1059, 1063, 1063, 1063, 1063, 1064, 1064, 1064, 1064, - 1065, 1065, 1066, 1066, 1069, 1073, 1078, 1079, 1080, 1081, - 1082, 1083, 1084, 1085, 1087, 1088, 1089, 1090, 1091, 1092, - 1093, 1094, 1103, 1104, 1110, 1111, 1119, 1127, 1128, 1133, - 1134, 1135, 1140, 1154, 1154, 1155, 1155, 1157, 1167, 1167, - 1167, 1167, 1167, 1167, 1167, 1168, 1168, 1168, 1168, 1168, - 1168, 1169, 1173, 1177, 1184, 1192, 1205, 1210, 1222, 1232, - 1236, 1245, 1250, 1256, 1257, 1261, 1265, 1276, 1302, 1316, - 1346, 1372, 1393, 1406, 1416, 1421, 1481, 1488, 1497, 1503, - 1509, 1513, 1517, 1525, 1536, 1568, 1576, 1598, 1609, 1615, - 1623, 1629, 1635, 1644, 1648, 1656, 1656, 1666, 1674, 1679, - 1683, 1687, 1691, 1706, 1727, 1730, 1733, 1733, 1740, 1740, - 1748, 1748, 1756, 1756, 1764, 1767, 1770, 1774, 1787, 1788, - 1790, 1794, 1803, 1809, 1811, 1816, 1821, 1830, 1830, 1831, - 1831, 1833, 1840, 1846, 1853, 1857, 1863, 1868, 1873, 1967, - 1967, 1969, 1977, 1977, 1979, 1984, 1985, 1986, 1988, 1988, - 1998, 2002, 2007, 2011, 2015, 2019, 2023, 2027, 2031, 2035, - 2039, 2064, 2068, 2082, 2086, 2092, 2092, 2098, 2103, 2107, - 2116, 2126, 2131, 2142, 2154, 2158, 2162, 2166, 2170, 2185, - 2190, 2244, 2248, 2255, 2264, 2275, 2283, 2289, 2297, 2302, - 2309, 2309, 2311, 2315, 2322, 2335, 2347, 2358, 2371, 2379, - 2387, 2395, 2401, 2421, 2444, 2450, 2456, 2462, 2477, 2535, - 2542, 2545, 2550, 2554, 2561, 2566, 2571, 2576, 2581, 2589, - 2600, 2614 + 0, 1088, 1088, 1089, 1097, 1098, 1108, 1108, 1108, 1108, + 1108, 1109, 1109, 1109, 1110, 1110, 1110, 1110, 1110, 1110, + 1112, 1112, 1116, 1116, 1116, 1116, 1117, 1117, 1117, 1117, + 1118, 1118, 1119, 1119, 1122, 1126, 1131, 1132, 1133, 1134, + 1135, 1136, 1137, 1138, 1140, 1141, 1142, 1143, 1144, 1145, + 1146, 1147, 1156, 1157, 1163, 1164, 1172, 1180, 1181, 1186, + 1187, 1188, 1193, 1207, 1207, 1208, 1208, 1210, 1220, 1220, + 1220, 1220, 1220, 1220, 1220, 1221, 1221, 1221, 1221, 1221, + 1221, 1222, 1226, 1230, 1238, 1246, 1259, 1264, 1276, 1286, + 1290, 1299, 1304, 1310, 1311, 1315, 1319, 1330, 1356, 1370, + 1400, 1426, 1447, 1460, 1470, 1475, 1536, 1543, 1552, 1558, + 1564, 1568, 1572, 1580, 1591, 1623, 1631, 1653, 1664, 1670, + 1678, 1684, 1690, 1699, 1703, 1711, 1711, 1721, 1729, 1734, + 1738, 1742, 1746, 1761, 1783, 1786, 1789, 1789, 1797, 1797, + 1805, 1805, 1813, 1813, 1822, 1825, 1828, 1832, 1845, 1846, + 1848, 1852, 1861, 1867, 1869, 1874, 1879, 1888, 1888, 1889, + 1889, 1891, 1898, 1904, 1911, 1915, 1921, 1926, 1931, 2026, + 2026, 2028, 2036, 2036, 2038, 2043, 2044, 2045, 2047, 2047, + 2057, 2061, 2066, 2070, 2074, 2078, 2082, 2086, 2090, 2094, + 2098, 2123, 2127, 2141, 2145, 2151, 2151, 2157, 2162, 2166, + 2175, 2186, 2191, 2203, 2216, 2220, 2224, 2229, 2238, 2257, + 2266, 2322, 2326, 2333, 2344, 2357, 2366, 2375, 2385, 2389, + 2396, 2396, 2398, 2402, 2407, 2423, 2438, 2452, 2465, 2473, + 2481, 2489, 2495, 2515, 2538, 2544, 2550, 2556, 2571, 2630, + 2637, 2640, 2645, 2649, 2656, 2661, 2667, 2672, 2678, 2686, + 2698, 2713 }; #endif #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "SINTVAL", @@ -1738,7 +1715,7 @@ # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ -static const yytype_uint16 yytoknum[] = +static const unsigned short int yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, @@ -1757,7 +1734,7 @@ # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = +static const unsigned char yyr1[] = { 0, 122, 123, 123, 124, 124, 125, 125, 125, 125, 125, 126, 126, 126, 127, 127, 127, 127, 127, 127, @@ -1788,7 +1765,7 @@ }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = +static const unsigned char yyr2[] = { 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -1821,7 +1798,7 @@ /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ -static const yytype_uint8 yydefact[] = +static const unsigned char yydefact[] = { 146, 0, 43, 132, 1, 131, 178, 36, 37, 38, 39, 40, 41, 42, 0, 44, 202, 128, 129, 202, @@ -1877,8 +1854,8 @@ 0, 0, 213, 210 }; -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int16 yydefgoto[] = +/* YYDEFGOTO[NTERM-NUM]. */ +static const short int yydefgoto[] = { -1, 85, 253, 269, 270, 271, 272, 191, 192, 221, 193, 25, 15, 37, 441, 305, 386, 405, 328, 387, @@ -1893,7 +1870,7 @@ /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -428 -static const yytype_int16 yypact[] = +static const short int yypact[] = { -428, 45, 194, 602, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, 26, 14, 85, -428, -428, -13, @@ -1950,7 +1927,7 @@ }; /* YYPGOTO[NTERM-NUM]. */ -static const yytype_int16 yypgoto[] = +static const short int yypgoto[] = { -428, -428, -428, 307, 308, 309, 311, -127, -126, -427, -428, 365, 383, -117, -428, -221, 55, -428, -241, -428, @@ -1967,7 +1944,7 @@ number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -128 -static const yytype_int16 yytable[] = +static const short int yytable[] = { 88, 219, 220, 307, 104, 26, 329, 330, 195, 93, 39, 362, 222, 394, 198, 88, 117, 42, 364, 340, @@ -2105,7 +2082,7 @@ 160 }; -static const yytype_int16 yycheck[] = +static const short int yycheck[] = { 37, 128, 128, 224, 52, 3, 247, 248, 110, 29, 23, 15, 129, 109, 109, 52, 84, 30, 15, 266, @@ -2245,7 +2222,7 @@ /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = +static const unsigned char yystos[] = { 0, 153, 154, 155, 0, 25, 31, 41, 42, 43, 44, 45, 46, 47, 62, 134, 172, 174, 176, 183, @@ -2326,7 +2303,7 @@ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK (1); \ + YYPOPSTACK; \ goto yybackup; \ } \ else \ @@ -2334,7 +2311,7 @@ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ -while (YYID (0)) +while (0) #define YYTERROR 1 @@ -2349,7 +2326,7 @@ #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ - if (YYID (N)) \ + if (N) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ @@ -2363,7 +2340,7 @@ (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ - while (YYID (0)) + while (0) #endif @@ -2375,8 +2352,8 @@ # if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif @@ -2403,96 +2380,36 @@ do { \ if (yydebug) \ YYFPRINTF Args; \ -} while (YYID (0)) - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (YYID (0)) +} while (0) - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_value_print (FILE *yyoutput, int yytype, const YYSTYPE * const yyvaluep) -#else -static void -yy_symbol_value_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - const YYSTYPE * const yyvaluep; -#endif -{ - if (!yyvaluep) - return; -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# else - YYUSE (yyoutput); -# endif - switch (yytype) - { - default: - break; - } -} - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_print (FILE *yyoutput, int yytype, const YYSTYPE * const yyvaluep) -#else -static void -yy_symbol_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - const YYSTYPE * const yyvaluep; -#endif -{ - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); - - yy_symbol_value_print (yyoutput, yytype, yyvaluep); - YYFPRINTF (yyoutput, ")"); -} +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yysymprint (stderr, \ + Type, 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 __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +#if defined (__STDC__) || defined (__cplusplus) static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) +yy_stack_print (short int *bottom, short int *top) #else static void yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; + short int *bottom; + short int *top; #endif { YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) + for (/* Nothing. */; bottom <= top; ++bottom) YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } @@ -2501,48 +2418,37 @@ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ -} while (YYID (0)) +} while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +#if defined (__STDC__) || defined (__cplusplus) static void -yy_reduce_print (YYSTYPE *yyvsp, - int yyrule) +yy_reduce_print (int yyrule) #else static void -yy_reduce_print (yyvsp, yyrule - ) - YYSTYPE *yyvsp; - - int yyrule; +yy_reduce_print (yyrule) + int yyrule; #endif { - int yynrhs = yyr2[yyrule]; int yyi; unsigned long int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); - /* The symbols being reduced. */ - for (yyi = 0; yyi < yynrhs; yyi++) - { - fprintf (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &(yyvsp[(yyi + 1) - (yynrhs)]) - ); - fprintf (stderr, "\n"); - } + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ", + 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 (yyvsp, Rule); \ -} while (YYID (0)) + yy_reduce_print (Rule); \ +} while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ @@ -2576,44 +2482,42 @@ #if YYERROR_VERBOSE # ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H +# if defined (__GLIBC__) && defined (_STRING_H) # define yystrlen strlen # else /* Return the length of YYSTR. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static YYSIZE_T +# if defined (__STDC__) || defined (__cplusplus) yystrlen (const char *yystr) -#else -static YYSIZE_T +# else yystrlen (yystr) - const char *yystr; -#endif + const char *yystr; +# endif { - YYSIZE_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) + const char *yys = yystr; + + while (*yys++ != '\0') continue; - return yylen; + + return yys - yystr - 1; } # endif # endif # ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static char * +# if defined (__STDC__) || defined (__cplusplus) yystpcpy (char *yydest, const char *yysrc) -#else -static char * +# else yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -#endif + char *yydest; + const char *yysrc; +# endif { char *yyd = yydest; const char *yys = yysrc; @@ -2639,7 +2543,7 @@ { if (*yystr == '"') { - YYSIZE_T yyn = 0; + size_t yyn = 0; char const *yyp = yystr; for (;;) @@ -2674,123 +2578,53 @@ } # endif -/* Copy into YYRESULT an error message about the unexpected token - YYCHAR while in state YYSTATE. Return the number of bytes copied, - including the terminating null byte. If YYRESULT is null, do not - copy anything; just return the number of bytes that would be - copied. As a special case, return 0 if an ordinary "syntax error" - message will do. Return YYSIZE_MAXIMUM if overflow occurs during - size calculation. */ -static YYSIZE_T -yysyntax_error (char *yyresult, int yystate, int yychar) -{ - int yyn = yypact[yystate]; +#endif /* YYERROR_VERBOSE */ - if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) - return 0; - else - { - int yytype = YYTRANSLATE (yychar); - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; - -# if 0 - /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ - YY_("syntax error, unexpected %s"); - YY_("syntax error, unexpected %s, expecting %s"); - YY_("syntax error, unexpected %s, expecting %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); -# endif - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; + - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy (yyformat, yyunexpected); +#if YYDEBUG +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; - } +#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; - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen (yyf); - yysize_overflow |= (yysize1 < yysize); - yysize = yysize1; + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); - if (yysize_overflow) - return YYSIZE_MAXIMUM; - if (yyresult) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yyresult; - int yyi = 0; - while ((*yyp = *yyf) != '\0') - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - } - return yysize; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif + switch (yytype) + { + default: + break; } + YYFPRINTF (yyoutput, ")"); } -#endif /* YYERROR_VERBOSE */ - +#endif /* ! YYDEBUG */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +#if defined (__STDC__) || defined (__cplusplus) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) #else @@ -2801,7 +2635,8 @@ YYSTYPE *yyvaluep; #endif { - YYUSE (yyvaluep); + /* Pacify ``unused variable'' warnings. */ + (void) yyvaluep; if (!yymsg) yymsg = "Deleting"; @@ -2811,7 +2646,7 @@ { default: - break; + break; } } @@ -2819,13 +2654,13 @@ /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus +# if defined (__STDC__) || defined (__cplusplus) int yyparse (void *YYPARSE_PARAM); -#else +# else int yyparse (); -#endif +# endif #else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus +#if defined (__STDC__) || defined (__cplusplus) int yyparse (void); #else int yyparse (); @@ -2850,18 +2685,14 @@ `----------*/ #ifdef YYPARSE_PARAM -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void *YYPARSE_PARAM) -#else -int -yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -#endif +# 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 __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +#if defined (__STDC__) || defined (__cplusplus) int yyparse (void) #else @@ -2879,12 +2710,6 @@ int yyerrstatus; /* Look-ahead token as an internal (translated) token number. */ int yytoken = 0; -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif /* Three stacks and their tools: `yyss': related to states, @@ -2895,9 +2720,9 @@ to reallocate them elsewhere. */ /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; + short int yyssa[YYINITDEPTH]; + short int *yyss = yyssa; + short int *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; @@ -2906,7 +2731,7 @@ -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) +#define YYPOPSTACK (yyvsp--, yyssp--) YYSIZE_T yystacksize = YYINITDEPTH; @@ -2915,9 +2740,9 @@ YYSTYPE yyval; - /* The number of symbols on the RHS of the reduced rule. - Keep to zero when no symbol should be popped. */ - int yylen = 0; + /* When reducing, the number of symbols on the RHS of the reduced + rule. */ + int yylen; YYDPRINTF ((stderr, "Starting parse\n")); @@ -2941,7 +2766,8 @@ `------------------------------------------------------------*/ 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. */ + have just been pushed. so pushing a state here evens the stacks. + */ yyssp++; yysetstate: @@ -2954,11 +2780,11 @@ #ifdef yyoverflow { - /* Give user a chance to reallocate the stack. Use copies of + /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; + short int *yyss1 = yyss; /* Each stack pointer address is followed by the size of the @@ -2986,7 +2812,7 @@ yystacksize = YYMAXDEPTH; { - yytype_int16 *yyss1 = yyss; + short int *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) @@ -3021,10 +2847,12 @@ `-----------*/ yybackup: - /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ +/* Do appropriate processing given the current state. */ +/* Read a look-ahead token if we need one and don't already have one. */ +/* yyresume: */ /* First try to decide what to do without reference to look-ahead token. */ + yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; @@ -3066,21 +2894,22 @@ if (yyn == YYFINAL) YYACCEPT; - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; - /* Shift the look-ahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token unless it is eof. */ + /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; - yystate = yyn; *++yyvsp = yylval; + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + yystate = yyn; goto yynewstate; @@ -3116,35 +2945,35 @@ switch (yyn) { case 3: -#line 1036 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1089 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - if ((yyvsp[(1) - (1)].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range! + if ((yyvsp[0].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range! GEN_ERROR("Value too large for type!"); - (yyval.SIntVal) = (int32_t)(yyvsp[(1) - (1)].UIntVal); + (yyval.SIntVal) = (int32_t)(yyvsp[0].UIntVal); CHECK_FOR_ERROR ;} break; case 5: -#line 1045 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1098 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - if ((yyvsp[(1) - (1)].UInt64Val) > (uint64_t)INT64_MAX) // Outside of my range! + if ((yyvsp[0].UInt64Val) > (uint64_t)INT64_MAX) // Outside of my range! GEN_ERROR("Value too large for type!"); - (yyval.SInt64Val) = (int64_t)(yyvsp[(1) - (1)].UInt64Val); + (yyval.SInt64Val) = (int64_t)(yyvsp[0].UInt64Val); CHECK_FOR_ERROR ;} break; case 34: -#line 1069 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1122 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - (yyval.StrVal) = (yyvsp[(1) - (2)].StrVal); + (yyval.StrVal) = (yyvsp[-1].StrVal); CHECK_FOR_ERROR ;} break; case 35: -#line 1073 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1126 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; CHECK_FOR_ERROR @@ -3152,99 +2981,99 @@ break; case 36: -#line 1078 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1131 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} break; case 37: -#line 1079 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1132 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} break; case 38: -#line 1080 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1133 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} break; case 39: -#line 1081 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1134 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} break; case 40: -#line 1082 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1135 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} break; case 41: -#line 1083 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1136 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} break; case 42: -#line 1084 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1137 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} break; case 43: -#line 1085 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1138 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} break; case 44: -#line 1087 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1140 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::C; ;} break; case 45: -#line 1088 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1141 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::C; ;} break; case 46: -#line 1089 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1142 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::CSRet; ;} break; case 47: -#line 1090 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1143 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::Fast; ;} break; case 48: -#line 1091 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1144 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::Cold; ;} break; case 49: -#line 1092 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1145 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} break; case 50: -#line 1093 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1146 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} break; case 51: -#line 1094 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1147 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - if ((unsigned)(yyvsp[(2) - (2)].UInt64Val) != (yyvsp[(2) - (2)].UInt64Val)) + if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val)) GEN_ERROR("Calling conv too large!"); - (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val); + (yyval.UIntVal) = (yyvsp[0].UInt64Val); CHECK_FOR_ERROR ;} break; case 52: -#line 1103 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1156 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = 0; ;} break; case 53: -#line 1104 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1157 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - (yyval.UIntVal) = (yyvsp[(2) - (2)].UInt64Val); + (yyval.UIntVal) = (yyvsp[0].UInt64Val); if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) GEN_ERROR("Alignment must be a power of two!"); CHECK_FOR_ERROR @@ -3252,14 +3081,14 @@ break; case 54: -#line 1110 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1163 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.UIntVal) = 0; ;} break; case 55: -#line 1111 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1164 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - (yyval.UIntVal) = (yyvsp[(3) - (3)].UInt64Val); + (yyval.UIntVal) = (yyvsp[0].UInt64Val); if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) GEN_ERROR("Alignment must be a power of two!"); CHECK_FOR_ERROR @@ -3267,77 +3096,77 @@ break; case 56: -#line 1119 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1172 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - for (unsigned i = 0, e = strlen((yyvsp[(2) - (2)].StrVal)); i != e; ++i) - if ((yyvsp[(2) - (2)].StrVal)[i] == '"' || (yyvsp[(2) - (2)].StrVal)[i] == '\\') + for (unsigned i = 0, e = strlen((yyvsp[0].StrVal)); i != e; ++i) + if ((yyvsp[0].StrVal)[i] == '"' || (yyvsp[0].StrVal)[i] == '\\') GEN_ERROR("Invalid character in section name!"); - (yyval.StrVal) = (yyvsp[(2) - (2)].StrVal); + (yyval.StrVal) = (yyvsp[0].StrVal); CHECK_FOR_ERROR ;} break; case 57: -#line 1127 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1180 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; ;} break; case 58: -#line 1128 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" - { (yyval.StrVal) = (yyvsp[(1) - (1)].StrVal); ;} +#line 1181 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.StrVal) = (yyvsp[0].StrVal); ;} break; case 59: -#line 1133 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1186 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" {;} break; case 60: -#line 1134 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1187 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" {;} break; case 61: -#line 1135 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1188 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - CurGV->setSection((yyvsp[(1) - (1)].StrVal)); - free((yyvsp[(1) - (1)].StrVal)); + CurGV->setSection((yyvsp[0].StrVal)); + free((yyvsp[0].StrVal)); CHECK_FOR_ERROR ;} break; case 62: -#line 1140 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1193 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - if ((yyvsp[(2) - (2)].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[(2) - (2)].UInt64Val))) + if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val))) GEN_ERROR("Alignment must be a power of two!"); - CurGV->setAlignment((yyvsp[(2) - (2)].UInt64Val)); + CurGV->setAlignment((yyvsp[0].UInt64Val)); CHECK_FOR_ERROR ;} break; case 64: -#line 1154 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" - { (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType)); ;} +#line 1207 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;} break; case 66: -#line 1155 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" - { (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType)); ;} +#line 1208 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" + { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;} break; case 67: -#line 1157 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1210 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[(1) - (1)].TypeVal))->getDescription()); - (yyval.TypeVal) = (yyvsp[(1) - (1)].TypeVal); + GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); + (yyval.TypeVal) = (yyvsp[0].TypeVal); CHECK_FOR_ERROR ;} break; case 81: -#line 1169 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1222 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); CHECK_FOR_ERROR @@ -3345,27 +3174,28 @@ break; case 82: -#line 1173 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1226 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - (yyval.TypeVal) = new PATypeHolder((yyvsp[(1) - (1)].PrimType)); + (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); CHECK_FOR_ERROR ;} break; case 83: -#line 1177 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1230 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Named types are also simple types... - (yyval.TypeVal) = new PATypeHolder(getTypeVal((yyvsp[(1) - (1)].ValIDVal))); + const Type* tmp = getTypeVal((yyvsp[0].ValIDVal)); CHECK_FOR_ERROR + (yyval.TypeVal) = new PATypeHolder(tmp); ;} break; case 84: -#line 1184 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1238 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Type UpReference - if ((yyvsp[(2) - (2)].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range!"); + if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range!"); OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder - UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[(2) - (2)].UInt64Val), OT)); // Add to vector... + UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector... (yyval.TypeVal) = new PATypeHolder(OT); UR_OUT("New Upreference!\n"); CHECK_FOR_ERROR @@ -3373,63 +3203,63 @@ break; case 85: -#line 1192 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1246 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Function derived type? std::vector Params; - for (std::list::iterator I = (yyvsp[(3) - (4)].TypeList)->begin(), - E = (yyvsp[(3) - (4)].TypeList)->end(); I != E; ++I) + for (std::list::iterator I = (yyvsp[-1].TypeList)->begin(), + E = (yyvsp[-1].TypeList)->end(); I != E; ++I) Params.push_back(*I); bool isVarArg = Params.size() && Params.back() == Type::VoidTy; if (isVarArg) Params.pop_back(); - (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(FunctionType::get(*(yyvsp[(1) - (4)].TypeVal),Params,isVarArg))); - delete (yyvsp[(3) - (4)].TypeList); // Delete the argument list - delete (yyvsp[(1) - (4)].TypeVal); // Delete the return type handle + (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 CHECK_FOR_ERROR ;} break; case 86: -#line 1205 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1259 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Sized array type? - (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val)))); - delete (yyvsp[(4) - (5)].TypeVal); + (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val)))); + delete (yyvsp[-1].TypeVal); CHECK_FOR_ERROR ;} break; case 87: -#line 1210 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1264 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Packed array type? - const llvm::Type* ElemTy = (yyvsp[(4) - (5)].TypeVal)->get(); - if ((unsigned)(yyvsp[(2) - (5)].UInt64Val) != (yyvsp[(2) - (5)].UInt64Val)) + const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get(); + if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val)) GEN_ERROR("Unsigned result not equal to signed result"); if (!ElemTy->isPrimitiveType()) GEN_ERROR("Elemental type of a PackedType must be primitive"); - if (!isPowerOf2_32((yyvsp[(2) - (5)].UInt64Val))) + if (!isPowerOf2_32((yyvsp[-3].UInt64Val))) GEN_ERROR("Vector length should be a power of 2!"); - (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PackedType::get(*(yyvsp[(4) - (5)].TypeVal), (unsigned)(yyvsp[(2) - (5)].UInt64Val)))); - delete (yyvsp[(4) - (5)].TypeVal); + (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PackedType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val)))); + delete (yyvsp[-1].TypeVal); CHECK_FOR_ERROR ;} break; case 88: -#line 1222 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1276 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Structure type? std::vector Elements; - for (std::list::iterator I = (yyvsp[(2) - (3)].TypeList)->begin(), - E = (yyvsp[(2) - (3)].TypeList)->end(); I != E; ++I) + for (std::list::iterator I = (yyvsp[-1].TypeList)->begin(), + E = (yyvsp[-1].TypeList)->end(); I != E; ++I) Elements.push_back(*I); (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); - delete (yyvsp[(2) - (3)].TypeList); + delete (yyvsp[-1].TypeList); CHECK_FOR_ERROR ;} break; case 89: -#line 1232 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1286 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Empty structure type? (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector())); CHECK_FOR_ERROR @@ -3437,41 +3267,41 @@ break; case 90: -#line 1236 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1290 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Pointer type? - (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[(1) - (2)].TypeVal)))); - delete (yyvsp[(1) - (2)].TypeVal); + (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal)))); + delete (yyvsp[-1].TypeVal); CHECK_FOR_ERROR ;} break; case 91: -#line 1245 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1299 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeList) = new std::list(); - (yyval.TypeList)->push_back(*(yyvsp[(1) - (1)].TypeVal)); delete (yyvsp[(1) - (1)].TypeVal); + (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); CHECK_FOR_ERROR ;} break; case 92: -#line 1250 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1304 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(*(yyvsp[(3) - (3)].TypeVal)); delete (yyvsp[(3) - (3)].TypeVal); + ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); CHECK_FOR_ERROR ;} break; case 94: -#line 1257 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1311 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - ((yyval.TypeList)=(yyvsp[(1) - (3)].TypeList))->push_back(Type::VoidTy); + ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(Type::VoidTy); CHECK_FOR_ERROR ;} break; case 95: -#line 1261 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1315 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { ((yyval.TypeList) = new std::list())->push_back(Type::VoidTy); CHECK_FOR_ERROR @@ -3479,7 +3309,7 @@ break; case 96: -#line 1265 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1319 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TypeList) = new std::list(); CHECK_FOR_ERROR @@ -3487,186 +3317,186 @@ break; case 97: -#line 1276 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1330 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr - const ArrayType *ATy = dyn_cast((yyvsp[(1) - (4)].TypeVal)->get()); + const ArrayType *ATy = dyn_cast((yyvsp[-3].TypeVal)->get()); if (ATy == 0) GEN_ERROR("Cannot make array constant with type: '" + - (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'!"); + (*(yyvsp[-3].TypeVal))->getDescription() + "'!"); const Type *ETy = ATy->getElementType(); int NumElements = ATy->getNumElements(); // Verify that we have the correct size... - if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size()) + if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size()) GEN_ERROR("Type mismatch: constant sized array initialized with " + - utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " + + utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " + itostr(NumElements) + "!"); // Verify all elements are correct type! - for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) { - if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()) + for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { + if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) GEN_ERROR("Element #" + utostr(i) + " is not of type '" + ETy->getDescription() +"' as required!\nIt is of type '"+ - (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'."); + (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); } - (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[(3) - (4)].ConstVector)); - delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector); + (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector)); + delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); CHECK_FOR_ERROR ;} break; case 98: -#line 1302 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1356 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - const ArrayType *ATy = dyn_cast((yyvsp[(1) - (3)].TypeVal)->get()); + const ArrayType *ATy = dyn_cast((yyvsp[-2].TypeVal)->get()); if (ATy == 0) GEN_ERROR("Cannot make array constant with type: '" + - (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'!"); + (*(yyvsp[-2].TypeVal))->getDescription() + "'!"); int NumElements = ATy->getNumElements(); if (NumElements != -1 && NumElements != 0) GEN_ERROR("Type mismatch: constant sized array initialized with 0" " arguments, but has size of " + itostr(NumElements) +"!"); (yyval.ConstVal) = ConstantArray::get(ATy, std::vector()); - delete (yyvsp[(1) - (3)].TypeVal); + delete (yyvsp[-2].TypeVal); CHECK_FOR_ERROR ;} break; case 99: -#line 1316 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1370 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - const ArrayType *ATy = dyn_cast((yyvsp[(1) - (3)].TypeVal)->get()); + const ArrayType *ATy = dyn_cast((yyvsp[-2].TypeVal)->get()); if (ATy == 0) GEN_ERROR("Cannot make array constant with type: '" + - (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'!"); + (*(yyvsp[-2].TypeVal))->getDescription() + "'!"); int NumElements = ATy->getNumElements(); const Type *ETy = ATy->getElementType(); - char *EndStr = UnEscapeLexed((yyvsp[(3) - (3)].StrVal), true); - if (NumElements != -1 && NumElements != (EndStr-(yyvsp[(3) - (3)].StrVal))) + char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true); + if (NumElements != -1 && NumElements != (EndStr-(yyvsp[0].StrVal))) GEN_ERROR("Can't build string constant of size " + - itostr((int)(EndStr-(yyvsp[(3) - (3)].StrVal))) + + 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[(3) - (3)].StrVal); C != (signed char *)EndStr; ++C) + 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[(3) - (3)].StrVal); + for (unsigned char *C = (unsigned char *)(yyvsp[0].StrVal); C != (unsigned char*)EndStr; ++C) Vals.push_back(ConstantUInt::get(ETy, *C)); } else { - free((yyvsp[(3) - (3)].StrVal)); + free((yyvsp[0].StrVal)); GEN_ERROR("Cannot build string arrays of non byte sized elements!"); } - free((yyvsp[(3) - (3)].StrVal)); + free((yyvsp[0].StrVal)); (yyval.ConstVal) = ConstantArray::get(ATy, Vals); - delete (yyvsp[(1) - (3)].TypeVal); + delete (yyvsp[-2].TypeVal); CHECK_FOR_ERROR ;} break; case 100: -#line 1346 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1400 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized arr - const PackedType *PTy = dyn_cast((yyvsp[(1) - (4)].TypeVal)->get()); + const PackedType *PTy = dyn_cast((yyvsp[-3].TypeVal)->get()); if (PTy == 0) GEN_ERROR("Cannot make packed constant with type: '" + - (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'!"); + (*(yyvsp[-3].TypeVal))->getDescription() + "'!"); const Type *ETy = PTy->getElementType(); int NumElements = PTy->getNumElements(); // Verify that we have the correct size... - if (NumElements != -1 && NumElements != (int)(yyvsp[(3) - (4)].ConstVector)->size()) + if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size()) GEN_ERROR("Type mismatch: constant sized packed initialized with " + - utostr((yyvsp[(3) - (4)].ConstVector)->size()) + " arguments, but has size of " + + utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " + itostr(NumElements) + "!"); // Verify all elements are correct type! - for (unsigned i = 0; i < (yyvsp[(3) - (4)].ConstVector)->size(); i++) { - if (ETy != (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()) + for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { + if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) GEN_ERROR("Element #" + utostr(i) + " is not of type '" + ETy->getDescription() +"' as required!\nIt is of type '"+ - (*(yyvsp[(3) - (4)].ConstVector))[i]->getType()->getDescription() + "'."); + (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); } - (yyval.ConstVal) = ConstantPacked::get(PTy, *(yyvsp[(3) - (4)].ConstVector)); - delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector); + (yyval.ConstVal) = ConstantPacked::get(PTy, *(yyvsp[-1].ConstVector)); + delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); CHECK_FOR_ERROR ;} break; case 101: -#line 1372 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1426 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - const StructType *STy = dyn_cast((yyvsp[(1) - (4)].TypeVal)->get()); + const StructType *STy = dyn_cast((yyvsp[-3].TypeVal)->get()); if (STy == 0) GEN_ERROR("Cannot make struct constant with type: '" + - (*(yyvsp[(1) - (4)].TypeVal))->getDescription() + "'!"); + (*(yyvsp[-3].TypeVal))->getDescription() + "'!"); - if ((yyvsp[(3) - (4)].ConstVector)->size() != STy->getNumContainedTypes()) + if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes()) GEN_ERROR("Illegal number of initializers for structure type!"); // Check to ensure that constants are compatible with the type initializer! - for (unsigned i = 0, e = (yyvsp[(3) - (4)].ConstVector)->size(); i != e; ++i) - if ((*(yyvsp[(3) - (4)].ConstVector))[i]->getType() != STy->getElementType(i)) + for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i) + if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i)) GEN_ERROR("Expected type '" + STy->getElementType(i)->getDescription() + "' for element #" + utostr(i) + " of structure initializer!"); - (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[(3) - (4)].ConstVector)); - delete (yyvsp[(1) - (4)].TypeVal); delete (yyvsp[(3) - (4)].ConstVector); + (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector)); + delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); CHECK_FOR_ERROR ;} break; case 102: -#line 1393 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1447 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - const StructType *STy = dyn_cast((yyvsp[(1) - (3)].TypeVal)->get()); + const StructType *STy = dyn_cast((yyvsp[-2].TypeVal)->get()); if (STy == 0) GEN_ERROR("Cannot make struct constant with type: '" + - (*(yyvsp[(1) - (3)].TypeVal))->getDescription() + "'!"); + (*(yyvsp[-2].TypeVal))->getDescription() + "'!"); if (STy->getNumContainedTypes() != 0) GEN_ERROR("Illegal number of initializers for structure type!"); (yyval.ConstVal) = ConstantStruct::get(STy, std::vector()); - delete (yyvsp[(1) - (3)].TypeVal); + delete (yyvsp[-2].TypeVal); CHECK_FOR_ERROR ;} break; case 103: -#line 1406 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1460 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - const PointerType *PTy = dyn_cast((yyvsp[(1) - (2)].TypeVal)->get()); + const PointerType *PTy = dyn_cast((yyvsp[-1].TypeVal)->get()); if (PTy == 0) GEN_ERROR("Cannot make null pointer constant with type: '" + - (*(yyvsp[(1) - (2)].TypeVal))->getDescription() + "'!"); + (*(yyvsp[-1].TypeVal))->getDescription() + "'!"); (yyval.ConstVal) = ConstantPointerNull::get(PTy); - delete (yyvsp[(1) - (2)].TypeVal); + delete (yyvsp[-1].TypeVal); CHECK_FOR_ERROR ;} break; case 104: -#line 1416 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1470 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - (yyval.ConstVal) = UndefValue::get((yyvsp[(1) - (2)].TypeVal)->get()); - delete (yyvsp[(1) - (2)].TypeVal); + (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get()); + delete (yyvsp[-1].TypeVal); CHECK_FOR_ERROR ;} break; case 105: -#line 1421 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1475 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - const PointerType *Ty = dyn_cast((yyvsp[(1) - (2)].TypeVal)->get()); + const PointerType *Ty = dyn_cast((yyvsp[-1].TypeVal)->get()); if (Ty == 0) GEN_ERROR("Global const reference must be a pointer type!"); @@ -3680,7 +3510,8 @@ Function *SavedCurFn = CurFun.CurrentFunction; CurFun.CurrentFunction = 0; - Value *V = getValNonImprovising(Ty, (yyvsp[(2) - (2)].ValIDVal)); + Value *V = getValNonImprovising(Ty, (yyvsp[0].ValIDVal)); + CHECK_FOR_ERROR CurFun.CurrentFunction = SavedCurFn; @@ -3694,14 +3525,14 @@ // First check to see if the forward references value is already created! PerModuleInfo::GlobalRefsType::iterator I = - CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal))); + CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal))); if (I != CurModule.GlobalRefs.end()) { V = I->second; // Placeholder already exists, use it... - (yyvsp[(2) - (2)].ValIDVal).destroy(); + (yyvsp[0].ValIDVal).destroy(); } else { std::string Name; - if ((yyvsp[(2) - (2)].ValIDVal).Type == ValID::NameVal) Name = (yyvsp[(2) - (2)].ValIDVal).Name; + if ((yyvsp[0].ValIDVal).Type == ValID::NameVal) Name = (yyvsp[0].ValIDVal).Name; // Create the forward referenced global. GlobalValue *GV; @@ -3716,62 +3547,62 @@ } // Keep track of the fact that we have a forward ref to recycle it - CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[(2) - (2)].ValIDVal)), GV)); + CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, (yyvsp[0].ValIDVal)), GV)); V = GV; } } (yyval.ConstVal) = cast(V); - delete (yyvsp[(1) - (2)].TypeVal); // Free the type handle + delete (yyvsp[-1].TypeVal); // Free the type handle CHECK_FOR_ERROR ;} break; case 106: -#line 1481 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1536 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - if ((yyvsp[(1) - (2)].TypeVal)->get() != (yyvsp[(2) - (2)].ConstVal)->getType()) + if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType()) GEN_ERROR("Mismatched types for constant expression!"); - (yyval.ConstVal) = (yyvsp[(2) - (2)].ConstVal); - delete (yyvsp[(1) - (2)].TypeVal); + (yyval.ConstVal) = (yyvsp[0].ConstVal); + delete (yyvsp[-1].TypeVal); CHECK_FOR_ERROR ;} break; case 107: -#line 1488 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1543 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - const Type *Ty = (yyvsp[(1) - (2)].TypeVal)->get(); + const Type *Ty = (yyvsp[-1].TypeVal)->get(); if (isa(Ty) || Ty == Type::LabelTy || isa(Ty)) GEN_ERROR("Cannot create a null initialized value of this type!"); (yyval.ConstVal) = Constant::getNullValue(Ty); - delete (yyvsp[(1) - (2)].TypeVal); + delete (yyvsp[-1].TypeVal); CHECK_FOR_ERROR ;} break; case 108: -#line 1497 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1552 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // integral constants - if (!ConstantSInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val))) + if (!ConstantSInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val))) GEN_ERROR("Constant value doesn't fit in type!"); - (yyval.ConstVal) = ConstantSInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].SInt64Val)); + (yyval.ConstVal) = ConstantSInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)); CHECK_FOR_ERROR ;} break; case 109: -#line 1503 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1558 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // integral constants - if (!ConstantUInt::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val))) + if (!ConstantUInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val))) GEN_ERROR("Constant value doesn't fit in type!"); - (yyval.ConstVal) = ConstantUInt::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].UInt64Val)); + (yyval.ConstVal) = ConstantUInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)); CHECK_FOR_ERROR ;} break; case 110: -#line 1509 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1564 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Boolean constants (yyval.ConstVal) = ConstantBool::True; CHECK_FOR_ERROR @@ -3779,7 +3610,7 @@ break; case 111: -#line 1513 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1568 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Boolean constants (yyval.ConstVal) = ConstantBool::False; CHECK_FOR_ERROR @@ -3787,89 +3618,89 @@ break; case 112: -#line 1517 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1572 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Float & Double constants - if (!ConstantFP::isValueValidForType((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].FPVal))) + if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal))) GEN_ERROR("Floating point constant invalid for type!!"); - (yyval.ConstVal) = ConstantFP::get((yyvsp[(1) - (2)].PrimType), (yyvsp[(2) - (2)].FPVal)); + (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal)); CHECK_FOR_ERROR ;} break; case 113: -#line 1525 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1580 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isFirstClassType()) + if (!(yyvsp[-3].ConstVal)->getType()->isFirstClassType()) GEN_ERROR("cast constant expression from a non-primitive type: '" + - (yyvsp[(3) - (6)].ConstVal)->getType()->getDescription() + "'!"); - if (!(yyvsp[(5) - (6)].TypeVal)->get()->isFirstClassType()) + (yyvsp[-3].ConstVal)->getType()->getDescription() + "'!"); + if (!(yyvsp[-1].TypeVal)->get()->isFirstClassType()) GEN_ERROR("cast constant expression to a non-primitive type: '" + - (yyvsp[(5) - (6)].TypeVal)->get()->getDescription() + "'!"); - (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].TypeVal)->get()); - delete (yyvsp[(5) - (6)].TypeVal); + (yyvsp[-1].TypeVal)->get()->getDescription() + "'!"); + (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-3].ConstVal), (yyvsp[-1].TypeVal)->get()); + delete (yyvsp[-1].TypeVal); CHECK_FOR_ERROR ;} break; case 114: -#line 1536 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1591 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - if (!isa((yyvsp[(3) - (5)].ConstVal)->getType())) + if (!isa((yyvsp[-2].ConstVal)->getType())) GEN_ERROR("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[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end()), - GTE = gep_type_end((yyvsp[(3) - (5)].ConstVal)->getType(), (yyvsp[(4) - (5)].ValueList)->begin(), (yyvsp[(4) - (5)].ValueList)->end()); - for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e && GTI != GTE; ++i, ++GTI) + 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[(4) - (5)].ValueList))[i])) + if (ConstantUInt *CUI = dyn_cast((*(yyvsp[-1].ValueList))[i])) if (CUI->getType() == Type::UByteTy) - (*(yyvsp[(4) - (5)].ValueList))[i] = ConstantExpr::getCast(CUI, Type::UIntTy); + (*(yyvsp[-1].ValueList))[i] = ConstantExpr::getCast(CUI, Type::UIntTy); const Type *IdxTy = - GetElementPtrInst::getIndexedType((yyvsp[(3) - (5)].ConstVal)->getType(), *(yyvsp[(4) - (5)].ValueList), true); + GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), *(yyvsp[-1].ValueList), true); if (!IdxTy) GEN_ERROR("Index list invalid for constant getelementptr!"); std::vector IdxVec; - for (unsigned i = 0, e = (yyvsp[(4) - (5)].ValueList)->size(); i != e; ++i) - if (Constant *C = dyn_cast((*(yyvsp[(4) - (5)].ValueList))[i])) + for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i) + if (Constant *C = dyn_cast((*(yyvsp[-1].ValueList))[i])) IdxVec.push_back(C); else GEN_ERROR("Indices to constant getelementptr must be constants!"); - delete (yyvsp[(4) - (5)].ValueList); + delete (yyvsp[-1].ValueList); - (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[(3) - (5)].ConstVal), IdxVec); + (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), IdxVec); CHECK_FOR_ERROR ;} break; case 115: -#line 1568 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1623 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - if ((yyvsp[(3) - (8)].ConstVal)->getType() != Type::BoolTy) + if ((yyvsp[-5].ConstVal)->getType() != Type::BoolTy) GEN_ERROR("Select condition must be of boolean type!"); - if ((yyvsp[(5) - (8)].ConstVal)->getType() != (yyvsp[(7) - (8)].ConstVal)->getType()) + if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) GEN_ERROR("Select operand types must match!"); - (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)); + (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); CHECK_FOR_ERROR ;} break; case 116: -#line 1576 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1631 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) + if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) GEN_ERROR("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) - (6)].ConstVal)->getType())) { - (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); + 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()) { @@ -3877,152 +3708,152 @@ case Module::Pointer64: IntPtrTy = Type::LongTy; break; default: GEN_ERROR("invalid pointer binary constant expr!"); } - (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), ConstantExpr::getCast((yyvsp[(3) - (6)].ConstVal), IntPtrTy), - ConstantExpr::getCast((yyvsp[(5) - (6)].ConstVal), IntPtrTy)); - (yyval.ConstVal) = ConstantExpr::getCast((yyval.ConstVal), (yyvsp[(3) - (6)].ConstVal)->getType()); + (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()); } CHECK_FOR_ERROR ;} break; case 117: -#line 1598 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1653 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) + if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) GEN_ERROR("Logical operator types must match!"); - if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isIntegral()) { - if (!isa((yyvsp[(3) - (6)].ConstVal)->getType()) || - !cast((yyvsp[(3) - (6)].ConstVal)->getType())->getElementType()->isIntegral()) + if (!(yyvsp[-3].ConstVal)->getType()->isIntegral()) { + if (!isa((yyvsp[-3].ConstVal)->getType()) || + !cast((yyvsp[-3].ConstVal)->getType())->getElementType()->isIntegral()) GEN_ERROR("Logical operator requires integral operands!"); } - (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); + (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); CHECK_FOR_ERROR ;} break; case 118: -#line 1609 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1664 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - if ((yyvsp[(3) - (6)].ConstVal)->getType() != (yyvsp[(5) - (6)].ConstVal)->getType()) + if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) GEN_ERROR("setcc operand types must match!"); - (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].BinaryOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); + (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); CHECK_FOR_ERROR ;} break; case 119: -#line 1615 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1670 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - if ((yyvsp[(5) - (6)].ConstVal)->getType() != Type::UByteTy) + if ((yyvsp[-1].ConstVal)->getType() != Type::UByteTy) GEN_ERROR("Shift count for shift constant must be unsigned byte!"); - if (!(yyvsp[(3) - (6)].ConstVal)->getType()->isInteger()) + if (!(yyvsp[-3].ConstVal)->getType()->isInteger()) GEN_ERROR("Shift constant expression requires integer operand!"); - (yyval.ConstVal) = ConstantExpr::get((yyvsp[(1) - (6)].OtherOpVal), (yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); + (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].OtherOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); CHECK_FOR_ERROR ;} break; case 120: -#line 1623 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1678 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - if (!ExtractElementInst::isValidOperands((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal))) + if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) GEN_ERROR("Invalid extractelement operands!"); - (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[(3) - (6)].ConstVal), (yyvsp[(5) - (6)].ConstVal)); + (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); CHECK_FOR_ERROR ;} break; case 121: -#line 1629 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1684 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - if (!InsertElementInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal))) + if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) GEN_ERROR("Invalid insertelement operands!"); - (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)); + (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); CHECK_FOR_ERROR ;} break; case 122: -#line 1635 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1690 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - if (!ShuffleVectorInst::isValidOperands((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal))) + if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) GEN_ERROR("Invalid shufflevector operands!"); - (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[(3) - (8)].ConstVal), (yyvsp[(5) - (8)].ConstVal), (yyvsp[(7) - (8)].ConstVal)); + (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); CHECK_FOR_ERROR ;} break; case 123: -#line 1644 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1699 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - ((yyval.ConstVector) = (yyvsp[(1) - (3)].ConstVector))->push_back((yyvsp[(3) - (3)].ConstVal)); + ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal)); CHECK_FOR_ERROR ;} break; case 124: -#line 1648 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1703 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ConstVector) = new std::vector(); - (yyval.ConstVector)->push_back((yyvsp[(1) - (1)].ConstVal)); + (yyval.ConstVector)->push_back((yyvsp[0].ConstVal)); CHECK_FOR_ERROR ;} break; case 125: -#line 1656 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1711 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; ;} break; case 126: -#line 1656 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1711 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; ;} break; case 127: -#line 1666 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1721 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - (yyval.ModuleVal) = ParserResult = (yyvsp[(1) - (1)].ModuleVal); + (yyval.ModuleVal) = ParserResult = (yyvsp[0].ModuleVal); CurModule.ModuleDone(); CHECK_FOR_ERROR ;} break; case 128: -#line 1674 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1729 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - (yyval.ModuleVal) = (yyvsp[(1) - (2)].ModuleVal); + (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); CurFun.FunctionDone(); CHECK_FOR_ERROR ;} break; case 129: -#line 1679 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1734 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - (yyval.ModuleVal) = (yyvsp[(1) - (2)].ModuleVal); + (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); CHECK_FOR_ERROR ;} break; case 130: -#line 1683 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1738 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - (yyval.ModuleVal) = (yyvsp[(1) - (4)].ModuleVal); + (yyval.ModuleVal) = (yyvsp[-3].ModuleVal); CHECK_FOR_ERROR ;} break; case 131: -#line 1687 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1742 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - (yyval.ModuleVal) = (yyvsp[(1) - (2)].ModuleVal); + (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); CHECK_FOR_ERROR ;} break; case 132: -#line 1691 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1746 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ModuleVal) = CurModule.CurrentModule; // Emit an error if there are any unresolved types left. @@ -4039,7 +3870,7 @@ break; case 133: -#line 1706 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1761 "/proj/llvm/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: @@ -4050,60 +3881,62 @@ // If types are not resolved eagerly, then the two types will not be // determined to be the same type! // - ResolveTypeTo((yyvsp[(2) - (4)].StrVal), *(yyvsp[(4) - (4)].TypeVal)); + ResolveTypeTo((yyvsp[-2].StrVal), *(yyvsp[0].TypeVal)); - if (!setTypeName(*(yyvsp[(4) - (4)].TypeVal), (yyvsp[(2) - (4)].StrVal)) && !(yyvsp[(2) - (4)].StrVal)) { + if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) { + CHECK_FOR_ERROR // If this is a named type that is not a redefinition, add it to the slot // table. - CurModule.Types.push_back(*(yyvsp[(4) - (4)].TypeVal)); + CurModule.Types.push_back(*(yyvsp[0].TypeVal)); } - delete (yyvsp[(4) - (4)].TypeVal); + delete (yyvsp[0].TypeVal); CHECK_FOR_ERROR ;} break; case 134: -#line 1727 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1783 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Function prototypes can be in const pool CHECK_FOR_ERROR ;} break; case 135: -#line 1730 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1786 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Asm blocks can be in the const pool CHECK_FOR_ERROR ;} break; case 136: -#line 1733 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1789 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - if ((yyvsp[(5) - (5)].ConstVal) == 0) GEN_ERROR("Global value initializer is not a constant!"); - CurGV = ParseGlobalVariable((yyvsp[(2) - (5)].StrVal), (yyvsp[(3) - (5)].Linkage), (yyvsp[(4) - (5)].BoolVal), (yyvsp[(5) - (5)].ConstVal)->getType(), (yyvsp[(5) - (5)].ConstVal)); - ;} + if ((yyvsp[0].ConstVal) == 0) + GEN_ERROR("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)); + CHECK_FOR_ERROR + ;} break; case 137: -#line 1736 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1794 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; - CHECK_FOR_ERROR ;} break; case 138: -#line 1740 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1797 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - CurGV = ParseGlobalVariable((yyvsp[(2) - (5)].StrVal), - GlobalValue::ExternalLinkage, (yyvsp[(4) - (5)].BoolVal), *(yyvsp[(5) - (5)].TypeVal), 0); - delete (yyvsp[(5) - (5)].TypeVal); - ;} + CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); + CHECK_FOR_ERROR + delete (yyvsp[0].TypeVal); + ;} break; case 139: -#line 1744 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1801 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; CHECK_FOR_ERROR @@ -4111,16 +3944,16 @@ break; case 140: -#line 1748 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1805 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - CurGV = ParseGlobalVariable((yyvsp[(2) - (5)].StrVal), - GlobalValue::DLLImportLinkage, (yyvsp[(4) - (5)].BoolVal), *(yyvsp[(5) - (5)].TypeVal), 0); - delete (yyvsp[(5) - (5)].TypeVal); - ;} + CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::DLLImportLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); + CHECK_FOR_ERROR + delete (yyvsp[0].TypeVal); + ;} break; case 141: -#line 1752 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1809 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; CHECK_FOR_ERROR @@ -4128,16 +3961,17 @@ break; case 142: -#line 1756 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1813 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - CurGV = ParseGlobalVariable((yyvsp[(2) - (5)].StrVal), - GlobalValue::ExternalWeakLinkage, (yyvsp[(4) - (5)].BoolVal), *(yyvsp[(5) - (5)].TypeVal), 0); - delete (yyvsp[(5) - (5)].TypeVal); - ;} + CurGV = + ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalWeakLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); + CHECK_FOR_ERROR + delete (yyvsp[0].TypeVal); + ;} break; case 143: -#line 1760 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1818 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurGV = 0; CHECK_FOR_ERROR @@ -4145,32 +3979,32 @@ break; case 144: -#line 1764 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1822 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 145: -#line 1767 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1825 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 146: -#line 1770 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1828 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { ;} break; case 147: -#line 1774 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1832 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); - char *EndStr = UnEscapeLexed((yyvsp[(1) - (1)].StrVal), true); - std::string NewAsm((yyvsp[(1) - (1)].StrVal), EndStr); - free((yyvsp[(1) - (1)].StrVal)); + char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true); + std::string NewAsm((yyvsp[0].StrVal), EndStr); + free((yyvsp[0].StrVal)); if (AsmSoFar.empty()) CurModule.CurrentModule->setModuleInlineAsm(NewAsm); @@ -4181,117 +4015,117 @@ break; case 148: -#line 1787 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1845 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Endianness) = Module::BigEndian; ;} break; case 149: -#line 1788 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1846 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.Endianness) = Module::LittleEndian; ;} break; case 150: -#line 1790 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1848 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - CurModule.CurrentModule->setEndianness((yyvsp[(3) - (3)].Endianness)); + CurModule.CurrentModule->setEndianness((yyvsp[0].Endianness)); CHECK_FOR_ERROR ;} break; case 151: -#line 1794 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1852 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - if ((yyvsp[(3) - (3)].UInt64Val) == 32) + if ((yyvsp[0].UInt64Val) == 32) CurModule.CurrentModule->setPointerSize(Module::Pointer32); - else if ((yyvsp[(3) - (3)].UInt64Val) == 64) + else if ((yyvsp[0].UInt64Val) == 64) CurModule.CurrentModule->setPointerSize(Module::Pointer64); else - GEN_ERROR("Invalid pointer size: '" + utostr((yyvsp[(3) - (3)].UInt64Val)) + "'!"); + GEN_ERROR("Invalid pointer size: '" + utostr((yyvsp[0].UInt64Val)) + "'!"); CHECK_FOR_ERROR ;} break; case 152: -#line 1803 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1861 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - CurModule.CurrentModule->setTargetTriple((yyvsp[(3) - (3)].StrVal)); - free((yyvsp[(3) - (3)].StrVal)); + CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal)); + free((yyvsp[0].StrVal)); CHECK_FOR_ERROR ;} break; case 154: -#line 1811 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1869 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - CurModule.CurrentModule->addLibrary((yyvsp[(3) - (3)].StrVal)); - free((yyvsp[(3) - (3)].StrVal)); + CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); + free((yyvsp[0].StrVal)); CHECK_FOR_ERROR ;} break; case 155: -#line 1816 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1874 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - CurModule.CurrentModule->addLibrary((yyvsp[(1) - (1)].StrVal)); - free((yyvsp[(1) - (1)].StrVal)); + CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); + free((yyvsp[0].StrVal)); CHECK_FOR_ERROR ;} break; case 156: -#line 1821 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1879 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CHECK_FOR_ERROR ;} break; case 160: -#line 1831 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1889 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.StrVal) = 0; ;} break; case 161: -#line 1833 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1891 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - if (*(yyvsp[(1) - (2)].TypeVal) == Type::VoidTy) + if (*(yyvsp[-1].TypeVal) == Type::VoidTy) GEN_ERROR("void typed arguments are invalid!"); - (yyval.ArgVal) = new std::pair((yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].StrVal)); + (yyval.ArgVal) = new std::pair((yyvsp[-1].TypeVal), (yyvsp[0].StrVal)); CHECK_FOR_ERROR ;} break; case 162: -#line 1840 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1898 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList); - (yyvsp[(1) - (3)].ArgList)->push_back(*(yyvsp[(3) - (3)].ArgVal)); - delete (yyvsp[(3) - (3)].ArgVal); + (yyval.ArgList) = (yyvsp[-2].ArgList); + (yyvsp[-2].ArgList)->push_back(*(yyvsp[0].ArgVal)); + delete (yyvsp[0].ArgVal); CHECK_FOR_ERROR ;} break; case 163: -#line 1846 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1904 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = new std::vector >(); - (yyval.ArgList)->push_back(*(yyvsp[(1) - (1)].ArgVal)); - delete (yyvsp[(1) - (1)].ArgVal); + (yyval.ArgList)->push_back(*(yyvsp[0].ArgVal)); + delete (yyvsp[0].ArgVal); CHECK_FOR_ERROR ;} break; case 164: -#line 1853 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1911 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - (yyval.ArgList) = (yyvsp[(1) - (1)].ArgList); + (yyval.ArgList) = (yyvsp[0].ArgList); CHECK_FOR_ERROR ;} break; case 165: -#line 1857 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1915 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - (yyval.ArgList) = (yyvsp[(1) - (3)].ArgList); + (yyval.ArgList) = (yyvsp[-2].ArgList); (yyval.ArgList)->push_back(std::pair(new PATypeHolder(Type::VoidTy), 0)); CHECK_FOR_ERROR @@ -4299,7 +4133,7 @@ break; case 166: -#line 1863 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1921 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = new std::vector >(); (yyval.ArgList)->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0)); @@ -4308,7 +4142,7 @@ break; case 167: -#line 1868 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1926 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ArgList) = 0; CHECK_FOR_ERROR @@ -4316,28 +4150,28 @@ break; case 168: -#line 1874 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 1932 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - UnEscapeLexed((yyvsp[(3) - (8)].StrVal)); - std::string FunctionName((yyvsp[(3) - (8)].StrVal)); - free((yyvsp[(3) - (8)].StrVal)); // Free strdup'd memory! + UnEscapeLexed((yyvsp[-5].StrVal)); + std::string FunctionName((yyvsp[-5].StrVal)); + free((yyvsp[-5].StrVal)); // Free strdup'd memory! - if (!(*(yyvsp[(2) - (8)].TypeVal))->isFirstClassType() && *(yyvsp[(2) - (8)].TypeVal) != Type::VoidTy) + if (!(*(yyvsp[-6].TypeVal))->isFirstClassType() && *(yyvsp[-6].TypeVal) != Type::VoidTy) GEN_ERROR("LLVM functions cannot return aggregate types!"); std::vector ParamTypeList; - if ((yyvsp[(5) - (8)].ArgList)) { // If there are arguments... - for (std::vector >::iterator I = (yyvsp[(5) - (8)].ArgList)->begin(); - I != (yyvsp[(5) - (8)].ArgList)->end(); ++I) + 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[(2) - (8)].TypeVal), ParamTypeList, isVarArg); + const FunctionType *FT = FunctionType::get(*(yyvsp[-6].TypeVal), ParamTypeList, isVarArg); const PointerType *PFT = PointerType::get(FT); - delete (yyvsp[(2) - (8)].TypeVal); + delete (yyvsp[-6].TypeVal); ValID ID; if (!FunctionName.empty()) { @@ -4381,72 +4215,73 @@ // another function. Fn->setLinkage(CurFun.Linkage); } - Fn->setCallingConv((yyvsp[(1) - (8)].UIntVal)); - Fn->setAlignment((yyvsp[(8) - (8)].UIntVal)); - if ((yyvsp[(7) - (8)].StrVal)) { - Fn->setSection((yyvsp[(7) - (8)].StrVal)); - free((yyvsp[(7) - (8)].StrVal)); + Fn->setCallingConv((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[(5) - (8)].ArgList)) { // Is null if empty... + if ((yyvsp[-3].ArgList)) { // Is null if empty... if (isVarArg) { // Nuke the last entry - assert((yyvsp[(5) - (8)].ArgList)->back().first->get() == Type::VoidTy && (yyvsp[(5) - (8)].ArgList)->back().second == 0&& + assert((yyvsp[-3].ArgList)->back().first->get() == Type::VoidTy && (yyvsp[-3].ArgList)->back().second == 0&& "Not a varargs marker!"); - delete (yyvsp[(5) - (8)].ArgList)->back().first; - (yyvsp[(5) - (8)].ArgList)->pop_back(); // Delete the last entry + 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[(5) - (8)].ArgList)->begin(); - I != (yyvsp[(5) - (8)].ArgList)->end(); ++I, ++ArgIt) { + 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... + CHECK_FOR_ERROR InsertValue(ArgIt); } - delete (yyvsp[(5) - (8)].ArgList); // We're now done with the argument list + delete (yyvsp[-3].ArgList); // We're now done with the argument list } CHECK_FOR_ERROR ;} break; case 171: -#line 1969 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2028 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = CurFun.CurrentFunction; // Make sure that we keep track of the linkage type even if there was a // previous "declare". - (yyval.FunctionVal)->setLinkage((yyvsp[(1) - (3)].Linkage)); + (yyval.FunctionVal)->setLinkage((yyvsp[-2].Linkage)); ;} break; case 174: -#line 1979 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2038 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); + (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); CHECK_FOR_ERROR ;} break; case 176: -#line 1985 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2044 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.Linkage = GlobalValue::DLLImportLinkage ;} break; case 177: -#line 1986 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2045 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.Linkage = GlobalValue::DLLImportLinkage ;} break; case 178: -#line 1988 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2047 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { CurFun.isDeclare = true; ;} break; case 179: -#line 1988 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2047 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.FunctionVal) = CurFun.CurrentFunction; CurFun.FunctionDone(); @@ -4455,7 +4290,7 @@ break; case 180: -#line 1998 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2057 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR @@ -4463,7 +4298,7 @@ break; case 181: -#line 2002 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2061 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR @@ -4471,31 +4306,31 @@ break; case 182: -#line 2007 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2066 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // A reference to a direct constant - (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SInt64Val)); + (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val)); CHECK_FOR_ERROR ;} break; case 183: -#line 2011 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2070 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].UInt64Val)); + (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val)); CHECK_FOR_ERROR ;} break; case 184: -#line 2015 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2074 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Perhaps it's an FP constant? - (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].FPVal)); + (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal)); CHECK_FOR_ERROR ;} break; case 185: -#line 2019 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2078 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create(ConstantBool::True); CHECK_FOR_ERROR @@ -4503,7 +4338,7 @@ break; case 186: -#line 2023 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2082 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::create(ConstantBool::False); CHECK_FOR_ERROR @@ -4511,7 +4346,7 @@ break; case 187: -#line 2027 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2086 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createNull(); CHECK_FOR_ERROR @@ -4519,7 +4354,7 @@ break; case 188: -#line 2031 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2090 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValIDVal) = ValID::createUndef(); CHECK_FOR_ERROR @@ -4527,7 +4362,7 @@ break; case 189: -#line 2035 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2094 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // A vector zero constant. (yyval.ValIDVal) = ValID::createZeroInit(); CHECK_FOR_ERROR @@ -4535,10 +4370,10 @@ break; case 190: -#line 2039 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2098 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Nonempty unsized packed vector - const Type *ETy = (*(yyvsp[(2) - (3)].ConstVector))[0]->getType(); - int NumElements = (yyvsp[(2) - (3)].ConstVector)->size(); + const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType(); + int NumElements = (yyvsp[-1].ConstVector)->size(); PackedType* pt = PackedType::get(ETy, NumElements); PATypeHolder* PTy = new PATypeHolder( @@ -4550,107 +4385,109 @@ ); // Verify all elements are correct type! - for (unsigned i = 0; i < (yyvsp[(2) - (3)].ConstVector)->size(); i++) { - if (ETy != (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()) + for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { + if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) GEN_ERROR("Element #" + utostr(i) + " is not of type '" + ETy->getDescription() +"' as required!\nIt is of type '" + - (*(yyvsp[(2) - (3)].ConstVector))[i]->getType()->getDescription() + "'."); + (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); } - (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, *(yyvsp[(2) - (3)].ConstVector))); - delete PTy; delete (yyvsp[(2) - (3)].ConstVector); + (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, *(yyvsp[-1].ConstVector))); + delete PTy; delete (yyvsp[-1].ConstVector); CHECK_FOR_ERROR ;} break; case 191: -#line 2064 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2123 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].ConstVal)); + (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal)); CHECK_FOR_ERROR ;} break; case 192: -#line 2068 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2127 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - char *End = UnEscapeLexed((yyvsp[(3) - (5)].StrVal), true); - std::string AsmStr = std::string((yyvsp[(3) - (5)].StrVal), End); - End = UnEscapeLexed((yyvsp[(5) - (5)].StrVal), true); - std::string Constraints = std::string((yyvsp[(5) - (5)].StrVal), End); - (yyval.ValIDVal) = ValID::createInlineAsm(AsmStr, Constraints, (yyvsp[(2) - (5)].BoolVal)); - free((yyvsp[(3) - (5)].StrVal)); - free((yyvsp[(5) - (5)].StrVal)); + 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)); CHECK_FOR_ERROR ;} break; case 193: -#line 2082 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2141 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it an integer reference...? - (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].SIntVal)); + (yyval.ValIDVal) = ValID::create((yyvsp[0].SIntVal)); CHECK_FOR_ERROR ;} break; case 194: -#line 2086 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2145 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Is it a named reference...? - (yyval.ValIDVal) = ValID::create((yyvsp[(1) - (1)].StrVal)); + (yyval.ValIDVal) = ValID::create((yyvsp[0].StrVal)); CHECK_FOR_ERROR ;} break; case 197: -#line 2098 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2157 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - (yyval.ValueVal) = getVal(*(yyvsp[(1) - (2)].TypeVal), (yyvsp[(2) - (2)].ValIDVal)); delete (yyvsp[(1) - (2)].TypeVal); + (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); delete (yyvsp[-1].TypeVal); CHECK_FOR_ERROR ;} break; case 198: -#line 2103 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2162 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); + (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); CHECK_FOR_ERROR ;} break; case 199: -#line 2107 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2166 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Do not allow functions with 0 basic blocks - (yyval.FunctionVal) = (yyvsp[(1) - (2)].FunctionVal); + (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); CHECK_FOR_ERROR ;} break; case 200: -#line 2116 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2175 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - setValueName((yyvsp[(3) - (3)].TermInstVal), (yyvsp[(2) - (3)].StrVal)); - InsertValue((yyvsp[(3) - (3)].TermInstVal)); + setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal)); + CHECK_FOR_ERROR + InsertValue((yyvsp[0].TermInstVal)); - (yyvsp[(1) - (3)].BasicBlockVal)->getInstList().push_back((yyvsp[(3) - (3)].TermInstVal)); - InsertValue((yyvsp[(1) - (3)].BasicBlockVal)); - (yyval.BasicBlockVal) = (yyvsp[(1) - (3)].BasicBlockVal); + (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal)); + InsertValue((yyvsp[-2].BasicBlockVal)); + (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal); CHECK_FOR_ERROR ;} break; case 201: -#line 2126 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2186 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - (yyvsp[(1) - (2)].BasicBlockVal)->getInstList().push_back((yyvsp[(2) - (2)].InstVal)); - (yyval.BasicBlockVal) = (yyvsp[(1) - (2)].BasicBlockVal); + (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal)); + (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal); CHECK_FOR_ERROR ;} break; case 202: -#line 2131 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2191 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((int)CurFun.NextBBNum++), true); + CHECK_FOR_ERROR // Make sure to move the basic block to the correct location in the // function, instead of leaving it inserted wherever it was first @@ -4663,9 +4500,10 @@ break; case 203: -#line 2142 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2203 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((yyvsp[(1) - (1)].StrVal)), true); + (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((yyvsp[0].StrVal)), true); + CHECK_FOR_ERROR // Make sure to move the basic block to the correct location in the // function, instead of leaving it inserted wherever it was first @@ -4678,15 +4516,15 @@ break; case 204: -#line 2154 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2216 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Return with a result... - (yyval.TermInstVal) = new ReturnInst((yyvsp[(2) - (2)].ValueVal)); + (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal)); CHECK_FOR_ERROR ;} break; case 205: -#line 2158 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2220 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Return with no result... (yyval.TermInstVal) = new ReturnInst(); CHECK_FOR_ERROR @@ -4694,61 +4532,75 @@ break; case 206: -#line 2162 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2224 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Unconditional Branch... - (yyval.TermInstVal) = new BranchInst(getBBVal((yyvsp[(3) - (3)].ValIDVal))); + BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); CHECK_FOR_ERROR + (yyval.TermInstVal) = new BranchInst(tmpBB); ;} break; case 207: -#line 2166 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2229 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - (yyval.TermInstVal) = new BranchInst(getBBVal((yyvsp[(6) - (9)].ValIDVal)), getBBVal((yyvsp[(9) - (9)].ValIDVal)), getVal(Type::BoolTy, (yyvsp[(3) - (9)].ValIDVal))); + BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal)); + CHECK_FOR_ERROR + BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal)); CHECK_FOR_ERROR + Value* tmpVal = getVal(Type::BoolTy, (yyvsp[-6].ValIDVal)); + CHECK_FOR_ERROR + (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal); ;} break; case 208: -#line 2170 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2238 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - SwitchInst *S = new SwitchInst(getVal((yyvsp[(2) - (9)].PrimType), (yyvsp[(3) - (9)].ValIDVal)), getBBVal((yyvsp[(6) - (9)].ValIDVal)), (yyvsp[(8) - (9)].JumpTable)->size()); + Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal)); + CHECK_FOR_ERROR + BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal)); + CHECK_FOR_ERROR + SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size()); (yyval.TermInstVal) = S; - std::vector >::iterator I = (yyvsp[(8) - (9)].JumpTable)->begin(), - E = (yyvsp[(8) - (9)].JumpTable)->end(); + std::vector >::iterator I = (yyvsp[-1].JumpTable)->begin(), + E = (yyvsp[-1].JumpTable)->end(); for (; I != E; ++I) { if (ConstantInt *CI = dyn_cast(I->first)) S->addCase(CI, I->second); else GEN_ERROR("Switch case is constant, but not a simple integer!"); } - delete (yyvsp[(8) - (9)].JumpTable); + delete (yyvsp[-1].JumpTable); CHECK_FOR_ERROR ;} break; case 209: -#line 2185 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2257 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - SwitchInst *S = new SwitchInst(getVal((yyvsp[(2) - (8)].PrimType), (yyvsp[(3) - (8)].ValIDVal)), getBBVal((yyvsp[(6) - (8)].ValIDVal)), 0); + Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal)); + CHECK_FOR_ERROR + BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal)); + CHECK_FOR_ERROR + SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0); (yyval.TermInstVal) = S; CHECK_FOR_ERROR ;} break; case 210: -#line 2191 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2267 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const PointerType *PFTy; const FunctionType *Ty; - if (!(PFTy = dyn_cast((yyvsp[(3) - (13)].TypeVal)->get())) || + 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[(6) - (13)].ValueList)) { - for (std::vector::iterator I = (yyvsp[(6) - (13)].ValueList)->begin(), E = (yyvsp[(6) - (13)].ValueList)->end(); + 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()); } @@ -4756,17 +4608,19 @@ bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy; if (isVarArg) ParamTypes.pop_back(); - Ty = FunctionType::get((yyvsp[(3) - (13)].TypeVal)->get(), ParamTypes, isVarArg); + Ty = FunctionType::get((yyvsp[-10].TypeVal)->get(), ParamTypes, isVarArg); PFTy = PointerType::get(Ty); } - Value *V = getVal(PFTy, (yyvsp[(4) - (13)].ValIDVal)); // Get the function we're calling... - - BasicBlock *Normal = getBBVal((yyvsp[(10) - (13)].ValIDVal)); - BasicBlock *Except = getBBVal((yyvsp[(13) - (13)].ValIDVal)); + Value *V = getVal(PFTy, (yyvsp[-9].ValIDVal)); // Get the function we're calling... + CHECK_FOR_ERROR + BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal)); + CHECK_FOR_ERROR + BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal)); + CHECK_FOR_ERROR // Create the call node... - if (!(yyvsp[(6) - (13)].ValueList)) { // Has no arguments? + 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 @@ -4774,7 +4628,7 @@ // FunctionType::param_iterator I = Ty->param_begin(); FunctionType::param_iterator E = Ty->param_end(); - std::vector::iterator ArgI = (yyvsp[(6) - (13)].ValueList)->begin(), ArgE = (yyvsp[(6) - (13)].ValueList)->end(); + std::vector::iterator ArgI = (yyvsp[-7].ValueList)->begin(), ArgE = (yyvsp[-7].ValueList)->end(); for (; ArgI != ArgE && I != E; ++ArgI, ++I) if ((*ArgI)->getType() != *I) @@ -4784,18 +4638,18 @@ if (I != E || (ArgI != ArgE && !Ty->isVarArg())) GEN_ERROR("Invalid number of parameters detected!"); - (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, *(yyvsp[(6) - (13)].ValueList)); + (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, *(yyvsp[-7].ValueList)); } - cast((yyval.TermInstVal))->setCallingConv((yyvsp[(2) - (13)].UIntVal)); + cast((yyval.TermInstVal))->setCallingConv((yyvsp[-11].UIntVal)); - delete (yyvsp[(3) - (13)].TypeVal); - delete (yyvsp[(6) - (13)].ValueList); + delete (yyvsp[-10].TypeVal); + delete (yyvsp[-7].ValueList); CHECK_FOR_ERROR ;} break; case 211: -#line 2244 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2322 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TermInstVal) = new UnwindInst(); CHECK_FOR_ERROR @@ -4803,7 +4657,7 @@ break; case 212: -#line 2248 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2326 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.TermInstVal) = new UnreachableInst(); CHECK_FOR_ERROR @@ -4811,88 +4665,97 @@ break; case 213: -#line 2255 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2333 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - (yyval.JumpTable) = (yyvsp[(1) - (6)].JumpTable); - Constant *V = cast(getValNonImprovising((yyvsp[(2) - (6)].PrimType), (yyvsp[(3) - (6)].ValIDVal))); + (yyval.JumpTable) = (yyvsp[-5].JumpTable); + Constant *V = cast(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); + CHECK_FOR_ERROR if (V == 0) GEN_ERROR("May only switch on a constant pool value!"); - (yyval.JumpTable)->push_back(std::make_pair(V, getBBVal((yyvsp[(6) - (6)].ValIDVal)))); + BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); CHECK_FOR_ERROR + (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); ;} break; case 214: -#line 2264 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2344 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.JumpTable) = new std::vector >(); - Constant *V = cast(getValNonImprovising((yyvsp[(1) - (5)].PrimType), (yyvsp[(2) - (5)].ValIDVal))); + Constant *V = cast(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); + CHECK_FOR_ERROR if (V == 0) GEN_ERROR("May only switch on a constant pool value!"); - (yyval.JumpTable)->push_back(std::make_pair(V, getBBVal((yyvsp[(5) - (5)].ValIDVal)))); + BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); CHECK_FOR_ERROR + (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); ;} break; case 215: -#line 2275 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2357 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Is this definition named?? if so, assign the name... - setValueName((yyvsp[(2) - (2)].InstVal), (yyvsp[(1) - (2)].StrVal)); - InsertValue((yyvsp[(2) - (2)].InstVal)); - (yyval.InstVal) = (yyvsp[(2) - (2)].InstVal); + setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal)); + CHECK_FOR_ERROR + InsertValue((yyvsp[0].InstVal)); + (yyval.InstVal) = (yyvsp[0].InstVal); CHECK_FOR_ERROR ;} break; case 216: -#line 2283 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2366 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Used for PHI nodes (yyval.PHIList) = new std::list >(); - (yyval.PHIList)->push_back(std::make_pair(getVal(*(yyvsp[(1) - (6)].TypeVal), (yyvsp[(3) - (6)].ValIDVal)), getBBVal((yyvsp[(5) - (6)].ValIDVal)))); - delete (yyvsp[(1) - (6)].TypeVal); + Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal)); + CHECK_FOR_ERROR + BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal)); CHECK_FOR_ERROR + (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); + delete (yyvsp[-5].TypeVal); ;} break; case 217: -#line 2289 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2375 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - (yyval.PHIList) = (yyvsp[(1) - (7)].PHIList); - (yyvsp[(1) - (7)].PHIList)->push_back(std::make_pair(getVal((yyvsp[(1) - (7)].PHIList)->front().first->getType(), (yyvsp[(4) - (7)].ValIDVal)), - getBBVal((yyvsp[(6) - (7)].ValIDVal)))); + (yyval.PHIList) = (yyvsp[-6].PHIList); + Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal)); + CHECK_FOR_ERROR + BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal)); CHECK_FOR_ERROR + (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); ;} break; case 218: -#line 2297 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2385 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { // Used for call statements, and memory insts... (yyval.ValueList) = new std::vector(); - (yyval.ValueList)->push_back((yyvsp[(1) - (1)].ValueVal)); - CHECK_FOR_ERROR + (yyval.ValueList)->push_back((yyvsp[0].ValueVal)); ;} break; case 219: -#line 2302 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2389 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - (yyval.ValueList) = (yyvsp[(1) - (3)].ValueList); - (yyvsp[(1) - (3)].ValueList)->push_back((yyvsp[(3) - (3)].ValueVal)); + (yyval.ValueList) = (yyvsp[-2].ValueList); + (yyvsp[-2].ValueList)->push_back((yyvsp[0].ValueVal)); CHECK_FOR_ERROR ;} break; case 221: -#line 2309 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2396 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = 0; ;} break; case 222: -#line 2311 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2398 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR @@ -4900,7 +4763,7 @@ break; case 223: -#line 2315 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2402 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR @@ -4908,64 +4771,73 @@ break; case 224: -#line 2322 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2407 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - if (!(*(yyvsp[(2) - (5)].TypeVal))->isInteger() && !(*(yyvsp[(2) - (5)].TypeVal))->isFloatingPoint() && - !isa((*(yyvsp[(2) - (5)].TypeVal)).get())) + if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() && + !isa((*(yyvsp[-3].TypeVal)).get())) GEN_ERROR( "Arithmetic operator requires integer, FP, or packed operands!"); - if (isa((*(yyvsp[(2) - (5)].TypeVal)).get()) && (yyvsp[(1) - (5)].BinaryOpVal) == Instruction::Rem) + if (isa((*(yyvsp[-3].TypeVal)).get()) && (yyvsp[-4].BinaryOpVal) == Instruction::Rem) GEN_ERROR("Rem not supported on packed types!"); - (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal)), getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal))); + Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); + CHECK_FOR_ERROR + Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); + CHECK_FOR_ERROR + (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2); if ((yyval.InstVal) == 0) GEN_ERROR("binary operator returned null!"); - delete (yyvsp[(2) - (5)].TypeVal); - CHECK_FOR_ERROR + delete (yyvsp[-3].TypeVal); ;} break; case 225: -#line 2335 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2423 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - if (!(*(yyvsp[(2) - (5)].TypeVal))->isIntegral()) { - if (!isa((yyvsp[(2) - (5)].TypeVal)->get()) || - !cast((yyvsp[(2) - (5)].TypeVal)->get())->getElementType()->isIntegral()) + if (!(*(yyvsp[-3].TypeVal))->isIntegral()) { + if (!isa((yyvsp[-3].TypeVal)->get()) || + !cast((yyvsp[-3].TypeVal)->get())->getElementType()->isIntegral()) GEN_ERROR("Logical operator requires integral operands!"); } - (yyval.InstVal) = BinaryOperator::create((yyvsp[(1) - (5)].BinaryOpVal), getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal)), getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal))); + Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); + CHECK_FOR_ERROR + Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); + CHECK_FOR_ERROR + (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2); if ((yyval.InstVal) == 0) GEN_ERROR("binary operator returned null!"); - delete (yyvsp[(2) - (5)].TypeVal); - CHECK_FOR_ERROR + delete (yyvsp[-3].TypeVal); ;} break; case 226: -#line 2347 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2438 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - if(isa((*(yyvsp[(2) - (5)].TypeVal)).get())) { + if(isa((*(yyvsp[-3].TypeVal)).get())) { GEN_ERROR( "PackedTypes currently not supported in setcc instructions!"); } - (yyval.InstVal) = new SetCondInst((yyvsp[(1) - (5)].BinaryOpVal), getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(3) - (5)].ValIDVal)), getVal(*(yyvsp[(2) - (5)].TypeVal), (yyvsp[(5) - (5)].ValIDVal))); + Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); + CHECK_FOR_ERROR + Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); + CHECK_FOR_ERROR + (yyval.InstVal) = new SetCondInst((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2); if ((yyval.InstVal) == 0) GEN_ERROR("binary operator returned null!"); - delete (yyvsp[(2) - (5)].TypeVal); - CHECK_FOR_ERROR + delete (yyvsp[-3].TypeVal); ;} break; case 227: -#line 2358 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2452 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { std::cerr << "WARNING: Use of eliminated 'not' instruction:" << " Replacing with 'xor'.\n"; - Value *Ones = ConstantIntegral::getAllOnesValue((yyvsp[(2) - (2)].ValueVal)->getType()); + Value *Ones = ConstantIntegral::getAllOnesValue((yyvsp[0].ValueVal)->getType()); if (Ones == 0) GEN_ERROR("Expected integral type for not instruction!"); - (yyval.InstVal) = BinaryOperator::create(Instruction::Xor, (yyvsp[(2) - (2)].ValueVal), Ones); + (yyval.InstVal) = BinaryOperator::create(Instruction::Xor, (yyvsp[0].ValueVal), Ones); if ((yyval.InstVal) == 0) GEN_ERROR("Could not create a xor instruction!"); CHECK_FOR_ERROR @@ -4973,56 +4845,56 @@ break; case 228: -#line 2371 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2465 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - if ((yyvsp[(4) - (4)].ValueVal)->getType() != Type::UByteTy) + if ((yyvsp[0].ValueVal)->getType() != Type::UByteTy) GEN_ERROR("Shift amount must be ubyte!"); - if (!(yyvsp[(2) - (4)].ValueVal)->getType()->isInteger()) + if (!(yyvsp[-2].ValueVal)->getType()->isInteger()) GEN_ERROR("Shift constant expression requires integer operand!"); - (yyval.InstVal) = new ShiftInst((yyvsp[(1) - (4)].OtherOpVal), (yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)); + (yyval.InstVal) = new ShiftInst((yyvsp[-3].OtherOpVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); CHECK_FOR_ERROR ;} break; case 229: -#line 2379 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2473 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - if (!(yyvsp[(4) - (4)].TypeVal)->get()->isFirstClassType()) + if (!(yyvsp[0].TypeVal)->get()->isFirstClassType()) GEN_ERROR("cast instruction to a non-primitive type: '" + - (yyvsp[(4) - (4)].TypeVal)->get()->getDescription() + "'!"); - (yyval.InstVal) = new CastInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal)); - delete (yyvsp[(4) - (4)].TypeVal); + (yyvsp[0].TypeVal)->get()->getDescription() + "'!"); + (yyval.InstVal) = new CastInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal)); + delete (yyvsp[0].TypeVal); CHECK_FOR_ERROR ;} break; case 230: -#line 2387 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2481 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - if ((yyvsp[(2) - (6)].ValueVal)->getType() != Type::BoolTy) + if ((yyvsp[-4].ValueVal)->getType() != Type::BoolTy) GEN_ERROR("select condition must be boolean!"); - if ((yyvsp[(4) - (6)].ValueVal)->getType() != (yyvsp[(6) - (6)].ValueVal)->getType()) + if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType()) GEN_ERROR("select value types should match!"); - (yyval.InstVal) = new SelectInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)); + (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); CHECK_FOR_ERROR ;} break; case 231: -#line 2395 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2489 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { NewVarArgs = true; - (yyval.InstVal) = new VAArgInst((yyvsp[(2) - (4)].ValueVal), *(yyvsp[(4) - (4)].TypeVal)); - delete (yyvsp[(4) - (4)].TypeVal); + (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal)); + delete (yyvsp[0].TypeVal); CHECK_FOR_ERROR ;} break; case 232: -#line 2401 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2495 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { ObsoleteVarArgs = true; - const Type* ArgTy = (yyvsp[(2) - (4)].ValueVal)->getType(); + const Type* ArgTy = (yyvsp[-2].ValueVal)->getType(); Function* NF = CurModule.CurrentModule-> getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0); @@ -5033,20 +4905,20 @@ //b = vaarg foo, t AllocaInst* foo = new AllocaInst(ArgTy, 0, "vaarg.fix"); CurBB->getInstList().push_back(foo); - CallInst* bar = new CallInst(NF, (yyvsp[(2) - (4)].ValueVal)); + 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[(4) - (4)].TypeVal)); - delete (yyvsp[(4) - (4)].TypeVal); + (yyval.InstVal) = new VAArgInst(foo, *(yyvsp[0].TypeVal)); + delete (yyvsp[0].TypeVal); CHECK_FOR_ERROR ;} break; case 233: -#line 2421 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2515 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { ObsoleteVarArgs = true; - const Type* ArgTy = (yyvsp[(2) - (4)].ValueVal)->getType(); + const Type* ArgTy = (yyvsp[-2].ValueVal)->getType(); Function* NF = CurModule.CurrentModule-> getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0); @@ -5058,78 +4930,78 @@ //b = load foo AllocaInst* foo = new AllocaInst(ArgTy, 0, "vanext.fix"); CurBB->getInstList().push_back(foo); - CallInst* bar = new CallInst(NF, (yyvsp[(2) - (4)].ValueVal)); + 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[(4) - (4)].TypeVal)); + Instruction* tmp = new VAArgInst(foo, *(yyvsp[0].TypeVal)); CurBB->getInstList().push_back(tmp); (yyval.InstVal) = new LoadInst(foo); - delete (yyvsp[(4) - (4)].TypeVal); + delete (yyvsp[0].TypeVal); CHECK_FOR_ERROR ;} break; case 234: -#line 2444 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2538 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - if (!ExtractElementInst::isValidOperands((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal))) + if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) GEN_ERROR("Invalid extractelement operands!"); - (yyval.InstVal) = new ExtractElementInst((yyvsp[(2) - (4)].ValueVal), (yyvsp[(4) - (4)].ValueVal)); + (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); CHECK_FOR_ERROR ;} break; case 235: -#line 2450 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2544 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - if (!InsertElementInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal))) + if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) GEN_ERROR("Invalid insertelement operands!"); - (yyval.InstVal) = new InsertElementInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)); + (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); CHECK_FOR_ERROR ;} break; case 236: -#line 2456 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2550 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - if (!ShuffleVectorInst::isValidOperands((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal))) + if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) GEN_ERROR("Invalid shufflevector operands!"); - (yyval.InstVal) = new ShuffleVectorInst((yyvsp[(2) - (6)].ValueVal), (yyvsp[(4) - (6)].ValueVal), (yyvsp[(6) - (6)].ValueVal)); + (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); CHECK_FOR_ERROR ;} break; case 237: -#line 2462 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2556 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - const Type *Ty = (yyvsp[(2) - (2)].PHIList)->front().first->getType(); + const Type *Ty = (yyvsp[0].PHIList)->front().first->getType(); if (!Ty->isFirstClassType()) GEN_ERROR("PHI node operands must be of first class type!"); (yyval.InstVal) = new PHINode(Ty); - ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[(2) - (2)].PHIList)->size()); - while ((yyvsp[(2) - (2)].PHIList)->begin() != (yyvsp[(2) - (2)].PHIList)->end()) { - if ((yyvsp[(2) - (2)].PHIList)->front().first->getType() != Ty) + ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size()); + while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) { + if ((yyvsp[0].PHIList)->front().first->getType() != Ty) GEN_ERROR("All elements of a PHI node must be of the same type!"); - cast((yyval.InstVal))->addIncoming((yyvsp[(2) - (2)].PHIList)->front().first, (yyvsp[(2) - (2)].PHIList)->front().second); - (yyvsp[(2) - (2)].PHIList)->pop_front(); + cast((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second); + (yyvsp[0].PHIList)->pop_front(); } - delete (yyvsp[(2) - (2)].PHIList); // Free the list... + delete (yyvsp[0].PHIList); // Free the list... CHECK_FOR_ERROR ;} break; case 238: -#line 2477 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2571 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { const PointerType *PFTy; const FunctionType *Ty; - if (!(PFTy = dyn_cast((yyvsp[(3) - (7)].TypeVal)->get())) || + 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[(6) - (7)].ValueList)) { - for (std::vector::iterator I = (yyvsp[(6) - (7)].ValueList)->begin(), E = (yyvsp[(6) - (7)].ValueList)->end(); + 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()); } @@ -5137,17 +5009,18 @@ bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy; if (isVarArg) ParamTypes.pop_back(); - if (!(*(yyvsp[(3) - (7)].TypeVal))->isFirstClassType() && *(yyvsp[(3) - (7)].TypeVal) != Type::VoidTy) + if (!(*(yyvsp[-4].TypeVal))->isFirstClassType() && *(yyvsp[-4].TypeVal) != Type::VoidTy) GEN_ERROR("LLVM functions cannot return aggregate types!"); - Ty = FunctionType::get((yyvsp[(3) - (7)].TypeVal)->get(), ParamTypes, isVarArg); + Ty = FunctionType::get((yyvsp[-4].TypeVal)->get(), ParamTypes, isVarArg); PFTy = PointerType::get(Ty); } - Value *V = getVal(PFTy, (yyvsp[(4) - (7)].ValIDVal)); // Get the function we're calling... + Value *V = getVal(PFTy, (yyvsp[-3].ValIDVal)); // Get the function we're calling... + CHECK_FOR_ERROR // Create the call node... - if (!(yyvsp[(6) - (7)].ValueList)) { // Has no arguments? + if (!(yyvsp[-1].ValueList)) { // Has no arguments? // Make sure no arguments is a good thing! if (Ty->getNumParams() != 0) GEN_ERROR("No arguments passed to a function that " @@ -5160,7 +5033,7 @@ // FunctionType::param_iterator I = Ty->param_begin(); FunctionType::param_iterator E = Ty->param_end(); - std::vector::iterator ArgI = (yyvsp[(6) - (7)].ValueList)->begin(), ArgE = (yyvsp[(6) - (7)].ValueList)->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) @@ -5170,34 +5043,34 @@ if (I != E || (ArgI != ArgE && !Ty->isVarArg())) GEN_ERROR("Invalid number of parameters detected!"); - (yyval.InstVal) = new CallInst(V, *(yyvsp[(6) - (7)].ValueList)); + (yyval.InstVal) = new CallInst(V, *(yyvsp[-1].ValueList)); } - cast((yyval.InstVal))->setTailCall((yyvsp[(1) - (7)].BoolVal)); - cast((yyval.InstVal))->setCallingConv((yyvsp[(2) - (7)].UIntVal)); - delete (yyvsp[(3) - (7)].TypeVal); - delete (yyvsp[(6) - (7)].ValueList); + cast((yyval.InstVal))->setTailCall((yyvsp[-6].BoolVal)); + cast((yyval.InstVal))->setCallingConv((yyvsp[-5].UIntVal)); + delete (yyvsp[-4].TypeVal); + delete (yyvsp[-1].ValueList); CHECK_FOR_ERROR ;} break; case 239: -#line 2535 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2630 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - (yyval.InstVal) = (yyvsp[(1) - (1)].InstVal); + (yyval.InstVal) = (yyvsp[0].InstVal); CHECK_FOR_ERROR ;} break; case 240: -#line 2542 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2637 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - (yyval.ValueList) = (yyvsp[(2) - (2)].ValueList); + (yyval.ValueList) = (yyvsp[0].ValueList); CHECK_FOR_ERROR ;} break; case 241: -#line 2545 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2640 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.ValueList) = new std::vector(); CHECK_FOR_ERROR @@ -5205,7 +5078,7 @@ break; case 242: -#line 2550 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2645 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = true; CHECK_FOR_ERROR @@ -5213,7 +5086,7 @@ break; case 243: -#line 2554 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2649 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { (yyval.BoolVal) = false; CHECK_FOR_ERROR @@ -5221,120 +5094,128 @@ break; case 244: -#line 2561 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2656 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal)); - delete (yyvsp[(2) - (3)].TypeVal); + (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); + delete (yyvsp[-1].TypeVal); CHECK_FOR_ERROR ;} break; case 245: -#line 2566 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2661 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - (yyval.InstVal) = new MallocInst(*(yyvsp[(2) - (6)].TypeVal), getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal)), (yyvsp[(6) - (6)].UIntVal)); - delete (yyvsp[(2) - (6)].TypeVal); + Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); CHECK_FOR_ERROR + (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal)); + delete (yyvsp[-4].TypeVal); ;} break; case 246: -#line 2571 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2667 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (3)].TypeVal), 0, (yyvsp[(3) - (3)].UIntVal)); - delete (yyvsp[(2) - (3)].TypeVal); + (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); + delete (yyvsp[-1].TypeVal); CHECK_FOR_ERROR ;} break; case 247: -#line 2576 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2672 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - (yyval.InstVal) = new AllocaInst(*(yyvsp[(2) - (6)].TypeVal), getVal((yyvsp[(4) - (6)].PrimType), (yyvsp[(5) - (6)].ValIDVal)), (yyvsp[(6) - (6)].UIntVal)); - delete (yyvsp[(2) - (6)].TypeVal); + Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); CHECK_FOR_ERROR + (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal)); + delete (yyvsp[-4].TypeVal); ;} break; case 248: -#line 2581 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2678 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - if (!isa((yyvsp[(2) - (2)].ValueVal)->getType())) + if (!isa((yyvsp[0].ValueVal)->getType())) GEN_ERROR("Trying to free nonpointer type " + - (yyvsp[(2) - (2)].ValueVal)->getType()->getDescription() + "!"); - (yyval.InstVal) = new FreeInst((yyvsp[(2) - (2)].ValueVal)); + (yyvsp[0].ValueVal)->getType()->getDescription() + "!"); + (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal)); CHECK_FOR_ERROR ;} break; case 249: -#line 2589 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2686 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - if (!isa((yyvsp[(3) - (4)].TypeVal)->get())) + if (!isa((yyvsp[-1].TypeVal)->get())) GEN_ERROR("Can't load from nonpointer type: " + - (*(yyvsp[(3) - (4)].TypeVal))->getDescription()); - if (!cast((yyvsp[(3) - (4)].TypeVal)->get())->getElementType()->isFirstClassType()) + (*(yyvsp[-1].TypeVal))->getDescription()); + if (!cast((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType()) GEN_ERROR("Can't load from pointer of non-first-class type: " + - (*(yyvsp[(3) - (4)].TypeVal))->getDescription()); - (yyval.InstVal) = new LoadInst(getVal(*(yyvsp[(3) - (4)].TypeVal), (yyvsp[(4) - (4)].ValIDVal)), "", (yyvsp[(1) - (4)].BoolVal)); - delete (yyvsp[(3) - (4)].TypeVal); + (*(yyvsp[-1].TypeVal))->getDescription()); + Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); CHECK_FOR_ERROR + (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal)); + delete (yyvsp[-1].TypeVal); ;} break; case 250: -#line 2600 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2698 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - const PointerType *PT = dyn_cast((yyvsp[(5) - (6)].TypeVal)->get()); + const PointerType *PT = dyn_cast((yyvsp[-1].TypeVal)->get()); if (!PT) GEN_ERROR("Can't store to a nonpointer type: " + - (*(yyvsp[(5) - (6)].TypeVal))->getDescription()); + (*(yyvsp[-1].TypeVal))->getDescription()); const Type *ElTy = PT->getElementType(); - if (ElTy != (yyvsp[(3) - (6)].ValueVal)->getType()) - GEN_ERROR("Can't store '" + (yyvsp[(3) - (6)].ValueVal)->getType()->getDescription() + + if (ElTy != (yyvsp[-3].ValueVal)->getType()) + GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() + "' into space of type '" + ElTy->getDescription() + "'!"); - (yyval.InstVal) = new StoreInst((yyvsp[(3) - (6)].ValueVal), getVal(*(yyvsp[(5) - (6)].TypeVal), (yyvsp[(6) - (6)].ValIDVal)), (yyvsp[(1) - (6)].BoolVal)); - delete (yyvsp[(5) - (6)].TypeVal); + Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); CHECK_FOR_ERROR + (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), tmpVal, (yyvsp[-5].BoolVal)); + delete (yyvsp[-1].TypeVal); ;} break; case 251: -#line 2614 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2713 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" { - if (!isa((yyvsp[(2) - (4)].TypeVal)->get())) + if (!isa((yyvsp[-2].TypeVal)->get())) GEN_ERROR("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) - (4)].TypeVal)->get(), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()), - GTE = gep_type_end((yyvsp[(2) - (4)].TypeVal)->get(), (yyvsp[(4) - (4)].ValueList)->begin(), (yyvsp[(4) - (4)].ValueList)->end()); - for (unsigned i = 0, e = (yyvsp[(4) - (4)].ValueList)->size(); i != e && GTI != GTE; ++i, ++GTI) + 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[(4) - (4)].ValueList))[i])) + if (ConstantUInt *CUI = dyn_cast((*(yyvsp[0].ValueList))[i])) if (CUI->getType() == Type::UByteTy) - (*(yyvsp[(4) - (4)].ValueList))[i] = ConstantExpr::getCast(CUI, Type::UIntTy); + (*(yyvsp[0].ValueList))[i] = ConstantExpr::getCast(CUI, Type::UIntTy); - if (!GetElementPtrInst::getIndexedType(*(yyvsp[(2) - (4)].TypeVal), *(yyvsp[(4) - (4)].ValueList), true)) + if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), *(yyvsp[0].ValueList), true)) GEN_ERROR("Invalid getelementptr indices for type '" + - (*(yyvsp[(2) - (4)].TypeVal))->getDescription()+ "'!"); - (yyval.InstVal) = new GetElementPtrInst(getVal(*(yyvsp[(2) - (4)].TypeVal), (yyvsp[(3) - (4)].ValIDVal)), *(yyvsp[(4) - (4)].ValueList)); - delete (yyvsp[(2) - (4)].TypeVal); delete (yyvsp[(4) - (4)].ValueList); + (*(yyvsp[-2].TypeVal))->getDescription()+ "'!"); + Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal)); CHECK_FOR_ERROR + (yyval.InstVal) = new GetElementPtrInst(tmpVal, *(yyvsp[0].ValueList)); + delete (yyvsp[-2].TypeVal); + delete (yyvsp[0].ValueList); ;} break; -/* Line 1267 of yacc.c. */ -#line 5332 "llvmAsmParser.tab.c" default: break; } - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); - YYPOPSTACK (yylen); - yylen = 0; +/* Line 1126 of yacc.c. */ +#line 5214 "llvmAsmParser.tab.c" + + yyvsp -= yylen; + yyssp -= yylen; + + YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; @@ -5363,41 +5244,110 @@ if (!yyerrstatus) { ++yynerrs; -#if ! YYERROR_VERBOSE - yyerror (YY_("syntax error")); -#else - { - YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); - if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) - { - YYSIZE_T yyalloc = 2 * yysize; - if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) - yyalloc = YYSTACK_ALLOC_MAXIMUM; - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yyalloc); - if (yymsg) - yymsg_alloc = yyalloc; - else +#if YYERROR_VERBOSE + yyn = yypact[yystate]; + + if (YYPACT_NINF < yyn && yyn < YYLAST) + { + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + char *yymsg = 0; +# define YYERROR_VERBOSE_ARGS_MAXIMUM 5 + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +#if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +#endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= yysize1 < yysize; + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; } - } - if (0 < yysize && yysize <= yymsg_alloc) - { - (void) yysyntax_error (yymsg, yystate, yychar); - yyerror (yymsg); - } - else - { - yyerror (YY_("syntax error")); - if (yysize != 0) + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= yysize1 < yysize; + yysize = yysize1; + + if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM) + yymsg = (char *) YYSTACK_ALLOC (yysize); + if (yymsg) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yymsg; + int yyi = 0; + while ((*yyp = *yyf)) + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + yyerror (yymsg); + YYSTACK_FREE (yymsg); + } + else + { + yyerror (YY_("syntax error")); goto yyexhaustedlab; - } - } -#endif + } + } + else +#endif /* YYERROR_VERBOSE */ + yyerror (YY_("syntax error")); } @@ -5408,15 +5358,14 @@ error, discard it. */ if (yychar <= YYEOF) - { + { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; - } + } else { - yydestruct ("Error: discarding", - yytoken, &yylval); + yydestruct ("Error: discarding", yytoken, &yylval); yychar = YYEMPTY; } } @@ -5434,14 +5383,11 @@ /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ - if (/*CONSTCOND*/ 0) + if (0) goto yyerrorlab; - /* Do not reclaim the symbols of the rule which action triggered - this YYERROR. */ - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); +yyvsp -= yylen; + yyssp -= yylen; yystate = *yyssp; goto yyerrlab1; @@ -5471,9 +5417,8 @@ YYABORT; - yydestruct ("Error: popping", - yystos[yystate], yyvsp); - YYPOPSTACK (1); + yydestruct ("Error: popping", yystos[yystate], yyvsp); + YYPOPSTACK; yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } @@ -5484,7 +5429,7 @@ *++yyvsp = yylval; - /* Shift the error token. */ + /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; @@ -5519,29 +5464,21 @@ if (yychar != YYEOF && yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); - /* Do not reclaim the symbols of the rule which action triggered - this YYABORT or YYACCEPT. */ - YYPOPSTACK (yylen); - YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp); - YYPOPSTACK (1); + YYPOPSTACK; } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif -#if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); -#endif return yyresult; } -#line 2638 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 2739 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" void llvm::GenerateError(const std::string &message, int LineNo) { Index: llvm/lib/AsmParser/llvmAsmParser.h.cvs diff -u llvm/lib/AsmParser/llvmAsmParser.h.cvs:1.8 llvm/lib/AsmParser/llvmAsmParser.h.cvs:1.9 --- llvm/lib/AsmParser/llvmAsmParser.h.cvs:1.8 Sun Sep 17 15:25:45 2006 +++ llvm/lib/AsmParser/llvmAsmParser.h.cvs Thu Sep 28 14:28:24 2006 @@ -1,9 +1,7 @@ -/* A Bison parser, made by GNU Bison 2.2. */ +/* A Bison parser, made by GNU Bison 2.1. */ -/* Skeleton interface for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. +/* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 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 @@ -20,18 +18,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ +/* 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 @@ -256,10 +246,9 @@ -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -#line 913 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" -{ +#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +#line 966 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +typedef union YYSTYPE { llvm::Module *ModuleVal; llvm::Function *FunctionVal; std::pair *ArgVal; @@ -297,10 +286,9 @@ llvm::Instruction::MemoryOps MemOpVal; llvm::Instruction::OtherOps OtherOpVal; llvm::Module::Endianness Endianness; -} -/* Line 1528 of yacc.c. */ -#line 303 "llvmAsmParser.tab.h" - YYSTYPE; +} YYSTYPE; +/* Line 1447 of yacc.c. */ +#line 292 "llvmAsmParser.tab.h" # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 @@ -308,3 +296,5 @@ extern YYSTYPE llvmAsmlval; + + Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.261 llvm/lib/AsmParser/llvmAsmParser.y:1.262 --- llvm/lib/AsmParser/llvmAsmParser.y:1.261 Sun Sep 17 15:25:45 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y Thu Sep 28 14:28:24 2006 @@ -106,6 +106,8 @@ // are resolved when the constant pool has been completely parsed. // ResolveDefinitions(LateResolveValues); + if (TriggerError) + return; // Check to make sure that all global value forward references have been // resolved! @@ -119,6 +121,7 @@ I->first.second.getName() + "\n"; } GenerateError(UndefinedReferences); + return; } // Look for intrinsic functions and CallInst that need to be upgraded @@ -176,9 +179,11 @@ NumberedBlocks.clear(); // Any forward referenced blocks left? - if (!BBForwardRefs.empty()) + if (!BBForwardRefs.empty()) { GenerateError("Undefined reference to label " + BBForwardRefs.begin()->first->getName()); + return; + } // Resolve all forward references now. ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues); @@ -222,6 +227,7 @@ break; default: GenerateError("Internal parser error: Invalid symbol type reference!"); + return 0; } // If we reached here, we referenced either a symbol that we don't know about @@ -232,10 +238,13 @@ if (inFunctionScope()) { - if (D.Type == ValID::NameVal) + if (D.Type == ValID::NameVal) { GenerateError("Reference to an undefined type: '" + D.getName() + "'"); - else + return 0; + } else { GenerateError("Reference to an undefined type: #" + itostr(D.Num)); + return 0; + } } std::map::iterator I =CurModule.LateResolveTypes.find(D); @@ -259,9 +268,11 @@ // it. Otherwise return null. // static Value *getValNonImprovising(const Type *Ty, const ValID &D) { - if (isa(Ty)) + if (isa(Ty)) { GenerateError("Functions are not values and " "must be referenced as pointers"); + return 0; + } switch (D.Type) { case ValID::NumberVal: { // Is it a numbered definition? @@ -296,10 +307,12 @@ // 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)) + if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64)) { GenerateError("Signed integral constant '" + itostr(D.ConstPool64) + "' is invalid for type '" + Ty->getDescription() + "'!"); + return 0; + } return ConstantSInt::get(Ty, D.ConstPool64); case ValID::ConstUIntVal: // Is it an unsigned const pool reference? @@ -307,6 +320,7 @@ if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64)) { GenerateError("Integral constant '" + utostr(D.UConstPool64) + "' is invalid or out of range!"); + return 0; } else { // This is really a signed reference. Transmogrify. return ConstantSInt::get(Ty, D.ConstPool64); } @@ -315,13 +329,17 @@ } case ValID::ConstFPVal: // Is it a floating point const pool reference? - if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) + if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) { GenerateError("FP constant invalid for type!!"); + return 0; + } return ConstantFP::get(Ty, D.ConstPoolFP); case ValID::ConstNullVal: // Is it a null value? - if (!isa(Ty)) + if (!isa(Ty)) { GenerateError("Cannot create a a non pointer null!"); + return 0; + } return ConstantPointerNull::get(cast(Ty)); case ValID::ConstUndefVal: // Is it an undef value? @@ -331,16 +349,20 @@ return Constant::getNullValue(Ty); case ValID::ConstantVal: // Fully resolved constant? - if (D.ConstantValue->getType() != Ty) + if (D.ConstantValue->getType() != Ty) { GenerateError("Constant expression type different from required type!"); + return 0; + } 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)) + if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) { GenerateError("Invalid type for asm constraint string!"); + return 0; + } InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints, D.IAD->HasSideEffects); D.destroy(); // Free InlineAsmDescriptor. @@ -362,15 +384,20 @@ // real thing. // static Value *getVal(const Type *Ty, const ValID &ID) { - if (Ty == Type::LabelTy) + if (Ty == Type::LabelTy) { GenerateError("Cannot use a basic block here"); + return 0; + } // See if the value has already been defined. Value *V = getValNonImprovising(Ty, ID); if (V) return V; + if (TriggerError) return 0; - if (!Ty->isFirstClassType() && !isa(Ty)) + if (!Ty->isFirstClassType() && !isa(Ty)) { GenerateError("Invalid use of a composite type!"); + return 0; + } // 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 @@ -402,7 +429,9 @@ std::string Name; BasicBlock *BB = 0; switch (ID.Type) { - default: GenerateError("Illegal label reference " + ID.getName()); + default: + GenerateError("Illegal label reference " + ID.getName()); + return 0; case ValID::NumberVal: // Is it a numbered definition? if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size()) CurFun.NumberedBlocks.resize(ID.Num+1); @@ -421,9 +450,11 @@ // 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)) + if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) { // The existing value was a definition, not a forward reference. GenerateError("Redefinition of label " + ID.getName()); + return 0; + } ID.destroy(); // Free strdup'd memory. return BB; @@ -487,6 +518,8 @@ ValID &DID = PHI->second.first; Value *TheRealValue = getValNonImprovising(LRI->first, DID); + if (TriggerError) + return; if (TheRealValue) { V->replaceAllUsesWith(TheRealValue); delete V; @@ -496,15 +529,18 @@ // resolver table InsertValue(V, *FutureLateResolvers); } else { - if (DID.Type == ValID::NameVal) + if (DID.Type == ValID::NameVal) { GenerateError("Reference to an invalid definition: '" +DID.getName()+ "' of type '" + V->getType()->getDescription() + "'", PHI->second.second); - else + return; + } else { GenerateError("Reference to an invalid definition: #" + itostr(DID.Num) + " of type '" + V->getType()->getDescription() + "'", PHI->second.second); + return; + } } } } @@ -538,14 +574,18 @@ std::string Name(NameStr); // Copy string free(NameStr); // Free old string - if (V->getType() == Type::VoidTy) + if (V->getType() == Type::VoidTy) { GenerateError("Can't assign name '" + Name+"' to value with void type!"); + return; + } assert(inFunctionScope() && "Must be in function scope!"); SymbolTable &ST = CurFun.CurrentFunction->getSymbolTable(); - if (ST.lookup(V->getType(), Name)) + if (ST.lookup(V->getType(), Name)) { GenerateError("Redefinition of value named '" + Name + "' in the '" + V->getType()->getDescription() + "' type plane!"); + return; + } // Set the name. V->setName(Name); @@ -558,8 +598,10 @@ ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage, bool isConstantGlobal, const Type *Ty, Constant *Initializer) { - if (isa(Ty)) + if (isa(Ty)) { GenerateError("Cannot declare global vars of function type!"); + return 0; + } const PointerType *PTy = PointerType::get(Ty); @@ -618,6 +660,7 @@ GenerateError("Redefinition of global variable named '" + Name + "' in the '" + Ty->getDescription() + "' type plane!"); + return 0; } } @@ -644,8 +687,10 @@ free(NameStr); // Free old string // We don't allow assigning names to void type - if (T == Type::VoidTy) + if (T == Type::VoidTy) { GenerateError("Can't assign name '" + Name + "' to the void type!"); + return false; + } // Set the type name, checking for conflicts as we do so. bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T); @@ -770,7 +815,7 @@ // common code from the two 'RunVMAsmParser' functions - static Module * RunParser(Module * M) { +static Module* RunParser(Module * M) { llvmAsmlineno = 1; // Reset the current line number... ObsoleteVarArgs = false; @@ -795,13 +840,18 @@ ObsoleteVarArgs = true; } - if (ObsoleteVarArgs && NewVarArgs) - GenerateError("This file is corrupt: it uses both new and old style varargs"); + if (ObsoleteVarArgs && NewVarArgs) { + GenerateError( + "This file is corrupt: it uses both new and old style varargs"); + return 0; + } if(ObsoleteVarArgs) { if(Function* F = Result->getNamedFunction("llvm.va_start")) { - if (F->arg_size() != 0) + if (F->arg_size() != 0) { GenerateError("Obsolete va_start takes 0 argument!"); + return 0; + } //foo = va_start() // -> @@ -827,8 +877,10 @@ } if(Function* F = Result->getNamedFunction("llvm.va_end")) { - if(F->arg_size() != 1) + if(F->arg_size() != 1) { GenerateError("Obsolete va_end takes 1 argument!"); + return 0; + } //vaend foo // -> @@ -851,8 +903,10 @@ } if(Function* F = Result->getNamedFunction("llvm.va_copy")) { - if(F->arg_size() != 1) + if(F->arg_size() != 1) { GenerateError("Obsolete va_copy takes 1 argument!"); + return 0; + } //foo = vacopy(bar) // -> //a = alloca 1 of typeof(foo) @@ -883,8 +937,7 @@ } return Result; - - } +} //===----------------------------------------------------------------------===// // RunVMAsmParser - Define an interface to this parser @@ -1175,8 +1228,9 @@ CHECK_FOR_ERROR }; UpRTypes : SymbolicValueRef { // Named types are also simple types... - $$ = new PATypeHolder(getTypeVal($1)); + const Type* tmp = getTypeVal($1); CHECK_FOR_ERROR + $$ = new PATypeHolder(tmp); }; // Include derived types in the Types production. @@ -1434,6 +1488,7 @@ CurFun.CurrentFunction = 0; Value *V = getValNonImprovising(Ty, $2); + CHECK_FOR_ERROR CurFun.CurrentFunction = SavedCurFn; @@ -1716,6 +1771,7 @@ ResolveTypeTo($2, *$4); if (!setTypeName(*$4, $2) && !$2) { + CHECK_FOR_ERROR // If this is a named type that is not a redefinition, add it to the slot // table. CurModule.Types.push_back(*$4); @@ -1731,33 +1787,35 @@ CHECK_FOR_ERROR } | ConstPool OptAssign OptLinkage GlobalType ConstVal { - if ($5 == 0) GEN_ERROR("Global value initializer is not a constant!"); + if ($5 == 0) + GEN_ERROR("Global value initializer is not a constant!"); CurGV = ParseGlobalVariable($2, $3, $4, $5->getType(), $5); - } GlobalVarAttributes { - CurGV = 0; CHECK_FOR_ERROR + } GlobalVarAttributes { + CurGV = 0; } | ConstPool OptAssign EXTERNAL GlobalType Types { - CurGV = ParseGlobalVariable($2, - GlobalValue::ExternalLinkage, $4, *$5, 0); + CurGV = ParseGlobalVariable($2, GlobalValue::ExternalLinkage, $4, *$5, 0); + CHECK_FOR_ERROR delete $5; - } GlobalVarAttributes { + } GlobalVarAttributes { CurGV = 0; CHECK_FOR_ERROR } | ConstPool OptAssign DLLIMPORT GlobalType Types { - CurGV = ParseGlobalVariable($2, - GlobalValue::DLLImportLinkage, $4, *$5, 0); + CurGV = ParseGlobalVariable($2, GlobalValue::DLLImportLinkage, $4, *$5, 0); + CHECK_FOR_ERROR delete $5; - } GlobalVarAttributes { + } GlobalVarAttributes { CurGV = 0; CHECK_FOR_ERROR } | ConstPool OptAssign EXTERN_WEAK GlobalType Types { - CurGV = ParseGlobalVariable($2, - GlobalValue::ExternalWeakLinkage, $4, *$5, 0); + CurGV = + ParseGlobalVariable($2, GlobalValue::ExternalWeakLinkage, $4, *$5, 0); + CHECK_FOR_ERROR delete $5; - } GlobalVarAttributes { + } GlobalVarAttributes { CurGV = 0; CHECK_FOR_ERROR } @@ -1956,6 +2014,7 @@ delete I->first; // Delete the typeholder... setValueName(ArgIt, I->second); // Insert arg into symtab... + CHECK_FOR_ERROR InsertValue(ArgIt); } @@ -2115,6 +2174,7 @@ // BasicBlock : InstructionList OptAssign BBTerminatorInst { setValueName($3, $2); + CHECK_FOR_ERROR InsertValue($3); $1->getInstList().push_back($3); @@ -2130,6 +2190,7 @@ } | /* empty */ { $$ = CurBB = getBBVal(ValID::create((int)CurFun.NextBBNum++), true); + CHECK_FOR_ERROR // Make sure to move the basic block to the correct location in the // function, instead of leaving it inserted wherever it was first @@ -2141,6 +2202,7 @@ } | LABELSTR { $$ = CurBB = getBBVal(ValID::create($1), true); + CHECK_FOR_ERROR // Make sure to move the basic block to the correct location in the // function, instead of leaving it inserted wherever it was first @@ -2160,15 +2222,25 @@ CHECK_FOR_ERROR } | BR LABEL ValueRef { // Unconditional Branch... - $$ = new BranchInst(getBBVal($3)); + BasicBlock* tmpBB = getBBVal($3); CHECK_FOR_ERROR + $$ = new BranchInst(tmpBB); } // Conditional Branch... | BR BOOL ValueRef ',' LABEL ValueRef ',' LABEL ValueRef { - $$ = new BranchInst(getBBVal($6), getBBVal($9), getVal(Type::BoolTy, $3)); + BasicBlock* tmpBBA = getBBVal($6); + CHECK_FOR_ERROR + BasicBlock* tmpBBB = getBBVal($9); + CHECK_FOR_ERROR + Value* tmpVal = getVal(Type::BoolTy, $3); CHECK_FOR_ERROR + $$ = new BranchInst(tmpBBA, tmpBBB, tmpVal); } | SWITCH IntType ValueRef ',' LABEL ValueRef '[' JumpTable ']' { - SwitchInst *S = new SwitchInst(getVal($2, $3), getBBVal($6), $8->size()); + Value* tmpVal = getVal($2, $3); + CHECK_FOR_ERROR + BasicBlock* tmpBB = getBBVal($6); + CHECK_FOR_ERROR + SwitchInst *S = new SwitchInst(tmpVal, tmpBB, $8->size()); $$ = S; std::vector >::iterator I = $8->begin(), @@ -2183,7 +2255,11 @@ CHECK_FOR_ERROR } | SWITCH IntType ValueRef ',' LABEL ValueRef '[' ']' { - SwitchInst *S = new SwitchInst(getVal($2, $3), getBBVal($6), 0); + Value* tmpVal = getVal($2, $3); + CHECK_FOR_ERROR + BasicBlock* tmpBB = getBBVal($6); + CHECK_FOR_ERROR + SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0); $$ = S; CHECK_FOR_ERROR } @@ -2210,9 +2286,11 @@ } Value *V = getVal(PFTy, $4); // Get the function we're calling... - + CHECK_FOR_ERROR BasicBlock *Normal = getBBVal($10); + CHECK_FOR_ERROR BasicBlock *Except = getBBVal($13); + CHECK_FOR_ERROR // Create the call node... if (!$6) { // Has no arguments? @@ -2255,26 +2333,31 @@ JumpTable : JumpTable IntType ConstValueRef ',' LABEL ValueRef { $$ = $1; Constant *V = cast(getValNonImprovising($2, $3)); + CHECK_FOR_ERROR if (V == 0) GEN_ERROR("May only switch on a constant pool value!"); - $$->push_back(std::make_pair(V, getBBVal($6))); + BasicBlock* tmpBB = getBBVal($6); CHECK_FOR_ERROR + $$->push_back(std::make_pair(V, tmpBB)); } | IntType ConstValueRef ',' LABEL ValueRef { $$ = new std::vector >(); Constant *V = cast(getValNonImprovising($1, $2)); + CHECK_FOR_ERROR if (V == 0) GEN_ERROR("May only switch on a constant pool value!"); - $$->push_back(std::make_pair(V, getBBVal($5))); + BasicBlock* tmpBB = getBBVal($5); CHECK_FOR_ERROR + $$->push_back(std::make_pair(V, tmpBB)); }; Inst : OptAssign InstVal { // Is this definition named?? if so, assign the name... setValueName($2, $1); + CHECK_FOR_ERROR InsertValue($2); $$ = $2; CHECK_FOR_ERROR @@ -2282,22 +2365,26 @@ PHIList : Types '[' ValueRef ',' ValueRef ']' { // Used for PHI nodes $$ = new std::list >(); - $$->push_back(std::make_pair(getVal(*$1, $3), getBBVal($5))); - delete $1; + Value* tmpVal = getVal(*$1, $3); CHECK_FOR_ERROR + BasicBlock* tmpBB = getBBVal($5); + CHECK_FOR_ERROR + $$->push_back(std::make_pair(tmpVal, tmpBB)); + delete $1; } | PHIList ',' '[' ValueRef ',' ValueRef ']' { $$ = $1; - $1->push_back(std::make_pair(getVal($1->front().first->getType(), $4), - getBBVal($6))); + Value* tmpVal = getVal($1->front().first->getType(), $4); + CHECK_FOR_ERROR + BasicBlock* tmpBB = getBBVal($6); CHECK_FOR_ERROR + $1->push_back(std::make_pair(tmpVal, tmpBB)); }; ValueRefList : ResolvedVal { // Used for call statements, and memory insts... $$ = new std::vector(); $$->push_back($1); - CHECK_FOR_ERROR } | ValueRefList ',' ResolvedVal { $$ = $1; @@ -2317,8 +2404,6 @@ CHECK_FOR_ERROR }; - - InstVal : ArithmeticOps Types ValueRef ',' ValueRef { if (!(*$2)->isInteger() && !(*$2)->isFloatingPoint() && !isa((*$2).get())) @@ -2326,11 +2411,14 @@ "Arithmetic operator requires integer, FP, or packed operands!"); if (isa((*$2).get()) && $1 == Instruction::Rem) GEN_ERROR("Rem not supported on packed types!"); - $$ = BinaryOperator::create($1, getVal(*$2, $3), getVal(*$2, $5)); + Value* val1 = getVal(*$2, $3); + CHECK_FOR_ERROR + Value* val2 = getVal(*$2, $5); + CHECK_FOR_ERROR + $$ = BinaryOperator::create($1, val1, val2); if ($$ == 0) GEN_ERROR("binary operator returned null!"); delete $2; - CHECK_FOR_ERROR } | LogicalOps Types ValueRef ',' ValueRef { if (!(*$2)->isIntegral()) { @@ -2338,22 +2426,28 @@ !cast($2->get())->getElementType()->isIntegral()) GEN_ERROR("Logical operator requires integral operands!"); } - $$ = BinaryOperator::create($1, getVal(*$2, $3), getVal(*$2, $5)); + Value* tmpVal1 = getVal(*$2, $3); + CHECK_FOR_ERROR + Value* tmpVal2 = getVal(*$2, $5); + CHECK_FOR_ERROR + $$ = BinaryOperator::create($1, tmpVal1, tmpVal2); if ($$ == 0) GEN_ERROR("binary operator returned null!"); delete $2; - CHECK_FOR_ERROR } | SetCondOps Types ValueRef ',' ValueRef { if(isa((*$2).get())) { GEN_ERROR( "PackedTypes currently not supported in setcc instructions!"); } - $$ = new SetCondInst($1, getVal(*$2, $3), getVal(*$2, $5)); + Value* tmpVal1 = getVal(*$2, $3); + CHECK_FOR_ERROR + Value* tmpVal2 = getVal(*$2, $5); + CHECK_FOR_ERROR + $$ = new SetCondInst($1, tmpVal1, tmpVal2); if ($$ == 0) GEN_ERROR("binary operator returned null!"); delete $2; - CHECK_FOR_ERROR } | NOT ResolvedVal { std::cerr << "WARNING: Use of eliminated 'not' instruction:" @@ -2499,6 +2593,7 @@ } Value *V = getVal(PFTy, $4); // Get the function we're calling... + CHECK_FOR_ERROR // Create the call node... if (!$6) { // Has no arguments? @@ -2564,9 +2659,10 @@ CHECK_FOR_ERROR } | MALLOC Types ',' UINT ValueRef OptCAlign { - $$ = new MallocInst(*$2, getVal($4, $5), $6); - delete $2; + Value* tmpVal = getVal($4, $5); CHECK_FOR_ERROR + $$ = new MallocInst(*$2, tmpVal, $6); + delete $2; } | ALLOCA Types OptCAlign { $$ = new AllocaInst(*$2, 0, $3); @@ -2574,9 +2670,10 @@ CHECK_FOR_ERROR } | ALLOCA Types ',' UINT ValueRef OptCAlign { - $$ = new AllocaInst(*$2, getVal($4, $5), $6); - delete $2; + Value* tmpVal = getVal($4, $5); CHECK_FOR_ERROR + $$ = new AllocaInst(*$2, tmpVal, $6); + delete $2; } | FREE ResolvedVal { if (!isa($2->getType())) @@ -2593,9 +2690,10 @@ if (!cast($3->get())->getElementType()->isFirstClassType()) GEN_ERROR("Can't load from pointer of non-first-class type: " + (*$3)->getDescription()); - $$ = new LoadInst(getVal(*$3, $4), "", $1); - delete $3; + Value* tmpVal = getVal(*$3, $4); CHECK_FOR_ERROR + $$ = new LoadInst(tmpVal, "", $1); + delete $3; } | OptVolatile STORE ResolvedVal ',' Types ValueRef { const PointerType *PT = dyn_cast($5->get()); @@ -2607,9 +2705,10 @@ GEN_ERROR("Can't store '" + $3->getType()->getDescription() + "' into space of type '" + ElTy->getDescription() + "'!"); - $$ = new StoreInst($3, getVal(*$5, $6), $1); - delete $5; + Value* tmpVal = getVal(*$5, $6); CHECK_FOR_ERROR + $$ = new StoreInst($3, tmpVal, $1); + delete $5; } | GETELEMENTPTR Types ValueRef IndexList { if (!isa($2->get())) @@ -2629,9 +2728,11 @@ if (!GetElementPtrInst::getIndexedType(*$2, *$4, true)) GEN_ERROR("Invalid getelementptr indices for type '" + (*$2)->getDescription()+ "'!"); - $$ = new GetElementPtrInst(getVal(*$2, $3), *$4); - delete $2; delete $4; + Value* tmpVal = getVal(*$2, $3); CHECK_FOR_ERROR + $$ = new GetElementPtrInst(tmpVal, *$4); + delete $2; + delete $4; }; Index: llvm/lib/AsmParser/llvmAsmParser.y.cvs diff -u llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.13 llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.14 --- llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.13 Sun Sep 17 15:25:45 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y.cvs Thu Sep 28 14:28:24 2006 @@ -106,6 +106,8 @@ // are resolved when the constant pool has been completely parsed. // ResolveDefinitions(LateResolveValues); + if (TriggerError) + return; // Check to make sure that all global value forward references have been // resolved! @@ -119,6 +121,7 @@ I->first.second.getName() + "\n"; } GenerateError(UndefinedReferences); + return; } // Look for intrinsic functions and CallInst that need to be upgraded @@ -176,9 +179,11 @@ NumberedBlocks.clear(); // Any forward referenced blocks left? - if (!BBForwardRefs.empty()) + if (!BBForwardRefs.empty()) { GenerateError("Undefined reference to label " + BBForwardRefs.begin()->first->getName()); + return; + } // Resolve all forward references now. ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues); @@ -222,6 +227,7 @@ break; default: GenerateError("Internal parser error: Invalid symbol type reference!"); + return 0; } // If we reached here, we referenced either a symbol that we don't know about @@ -232,10 +238,13 @@ if (inFunctionScope()) { - if (D.Type == ValID::NameVal) + if (D.Type == ValID::NameVal) { GenerateError("Reference to an undefined type: '" + D.getName() + "'"); - else + return 0; + } else { GenerateError("Reference to an undefined type: #" + itostr(D.Num)); + return 0; + } } std::map::iterator I =CurModule.LateResolveTypes.find(D); @@ -259,9 +268,11 @@ // it. Otherwise return null. // static Value *getValNonImprovising(const Type *Ty, const ValID &D) { - if (isa(Ty)) + if (isa(Ty)) { GenerateError("Functions are not values and " "must be referenced as pointers"); + return 0; + } switch (D.Type) { case ValID::NumberVal: { // Is it a numbered definition? @@ -296,10 +307,12 @@ // 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)) + if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64)) { GenerateError("Signed integral constant '" + itostr(D.ConstPool64) + "' is invalid for type '" + Ty->getDescription() + "'!"); + return 0; + } return ConstantSInt::get(Ty, D.ConstPool64); case ValID::ConstUIntVal: // Is it an unsigned const pool reference? @@ -307,6 +320,7 @@ if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64)) { GenerateError("Integral constant '" + utostr(D.UConstPool64) + "' is invalid or out of range!"); + return 0; } else { // This is really a signed reference. Transmogrify. return ConstantSInt::get(Ty, D.ConstPool64); } @@ -315,13 +329,17 @@ } case ValID::ConstFPVal: // Is it a floating point const pool reference? - if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) + if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) { GenerateError("FP constant invalid for type!!"); + return 0; + } return ConstantFP::get(Ty, D.ConstPoolFP); case ValID::ConstNullVal: // Is it a null value? - if (!isa(Ty)) + if (!isa(Ty)) { GenerateError("Cannot create a a non pointer null!"); + return 0; + } return ConstantPointerNull::get(cast(Ty)); case ValID::ConstUndefVal: // Is it an undef value? @@ -331,16 +349,20 @@ return Constant::getNullValue(Ty); case ValID::ConstantVal: // Fully resolved constant? - if (D.ConstantValue->getType() != Ty) + if (D.ConstantValue->getType() != Ty) { GenerateError("Constant expression type different from required type!"); + return 0; + } 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)) + if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) { GenerateError("Invalid type for asm constraint string!"); + return 0; + } InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints, D.IAD->HasSideEffects); D.destroy(); // Free InlineAsmDescriptor. @@ -362,15 +384,20 @@ // real thing. // static Value *getVal(const Type *Ty, const ValID &ID) { - if (Ty == Type::LabelTy) + if (Ty == Type::LabelTy) { GenerateError("Cannot use a basic block here"); + return 0; + } // See if the value has already been defined. Value *V = getValNonImprovising(Ty, ID); if (V) return V; + if (TriggerError) return 0; - if (!Ty->isFirstClassType() && !isa(Ty)) + if (!Ty->isFirstClassType() && !isa(Ty)) { GenerateError("Invalid use of a composite type!"); + return 0; + } // 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 @@ -402,7 +429,9 @@ std::string Name; BasicBlock *BB = 0; switch (ID.Type) { - default: GenerateError("Illegal label reference " + ID.getName()); + default: + GenerateError("Illegal label reference " + ID.getName()); + return 0; case ValID::NumberVal: // Is it a numbered definition? if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size()) CurFun.NumberedBlocks.resize(ID.Num+1); @@ -421,9 +450,11 @@ // 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)) + if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) { // The existing value was a definition, not a forward reference. GenerateError("Redefinition of label " + ID.getName()); + return 0; + } ID.destroy(); // Free strdup'd memory. return BB; @@ -487,6 +518,8 @@ ValID &DID = PHI->second.first; Value *TheRealValue = getValNonImprovising(LRI->first, DID); + if (TriggerError) + return; if (TheRealValue) { V->replaceAllUsesWith(TheRealValue); delete V; @@ -496,15 +529,18 @@ // resolver table InsertValue(V, *FutureLateResolvers); } else { - if (DID.Type == ValID::NameVal) + if (DID.Type == ValID::NameVal) { GenerateError("Reference to an invalid definition: '" +DID.getName()+ "' of type '" + V->getType()->getDescription() + "'", PHI->second.second); - else + return; + } else { GenerateError("Reference to an invalid definition: #" + itostr(DID.Num) + " of type '" + V->getType()->getDescription() + "'", PHI->second.second); + return; + } } } } @@ -538,14 +574,18 @@ std::string Name(NameStr); // Copy string free(NameStr); // Free old string - if (V->getType() == Type::VoidTy) + if (V->getType() == Type::VoidTy) { GenerateError("Can't assign name '" + Name+"' to value with void type!"); + return; + } assert(inFunctionScope() && "Must be in function scope!"); SymbolTable &ST = CurFun.CurrentFunction->getSymbolTable(); - if (ST.lookup(V->getType(), Name)) + if (ST.lookup(V->getType(), Name)) { GenerateError("Redefinition of value named '" + Name + "' in the '" + V->getType()->getDescription() + "' type plane!"); + return; + } // Set the name. V->setName(Name); @@ -558,8 +598,10 @@ ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage, bool isConstantGlobal, const Type *Ty, Constant *Initializer) { - if (isa(Ty)) + if (isa(Ty)) { GenerateError("Cannot declare global vars of function type!"); + return 0; + } const PointerType *PTy = PointerType::get(Ty); @@ -618,6 +660,7 @@ GenerateError("Redefinition of global variable named '" + Name + "' in the '" + Ty->getDescription() + "' type plane!"); + return 0; } } @@ -644,8 +687,10 @@ free(NameStr); // Free old string // We don't allow assigning names to void type - if (T == Type::VoidTy) + if (T == Type::VoidTy) { GenerateError("Can't assign name '" + Name + "' to the void type!"); + return false; + } // Set the type name, checking for conflicts as we do so. bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T); @@ -770,7 +815,7 @@ // common code from the two 'RunVMAsmParser' functions - static Module * RunParser(Module * M) { +static Module* RunParser(Module * M) { llvmAsmlineno = 1; // Reset the current line number... ObsoleteVarArgs = false; @@ -795,13 +840,18 @@ ObsoleteVarArgs = true; } - if (ObsoleteVarArgs && NewVarArgs) - GenerateError("This file is corrupt: it uses both new and old style varargs"); + if (ObsoleteVarArgs && NewVarArgs) { + GenerateError( + "This file is corrupt: it uses both new and old style varargs"); + return 0; + } if(ObsoleteVarArgs) { if(Function* F = Result->getNamedFunction("llvm.va_start")) { - if (F->arg_size() != 0) + if (F->arg_size() != 0) { GenerateError("Obsolete va_start takes 0 argument!"); + return 0; + } //foo = va_start() // -> @@ -827,8 +877,10 @@ } if(Function* F = Result->getNamedFunction("llvm.va_end")) { - if(F->arg_size() != 1) + if(F->arg_size() != 1) { GenerateError("Obsolete va_end takes 1 argument!"); + return 0; + } //vaend foo // -> @@ -851,8 +903,10 @@ } if(Function* F = Result->getNamedFunction("llvm.va_copy")) { - if(F->arg_size() != 1) + if(F->arg_size() != 1) { GenerateError("Obsolete va_copy takes 1 argument!"); + return 0; + } //foo = vacopy(bar) // -> //a = alloca 1 of typeof(foo) @@ -883,8 +937,7 @@ } return Result; - - } +} //===----------------------------------------------------------------------===// // RunVMAsmParser - Define an interface to this parser @@ -1175,8 +1228,9 @@ CHECK_FOR_ERROR }; UpRTypes : SymbolicValueRef { // Named types are also simple types... - $$ = new PATypeHolder(getTypeVal($1)); + const Type* tmp = getTypeVal($1); CHECK_FOR_ERROR + $$ = new PATypeHolder(tmp); }; // Include derived types in the Types production. @@ -1434,6 +1488,7 @@ CurFun.CurrentFunction = 0; Value *V = getValNonImprovising(Ty, $2); + CHECK_FOR_ERROR CurFun.CurrentFunction = SavedCurFn; @@ -1716,6 +1771,7 @@ ResolveTypeTo($2, *$4); if (!setTypeName(*$4, $2) && !$2) { + CHECK_FOR_ERROR // If this is a named type that is not a redefinition, add it to the slot // table. CurModule.Types.push_back(*$4); @@ -1731,33 +1787,35 @@ CHECK_FOR_ERROR } | ConstPool OptAssign OptLinkage GlobalType ConstVal { - if ($5 == 0) GEN_ERROR("Global value initializer is not a constant!"); + if ($5 == 0) + GEN_ERROR("Global value initializer is not a constant!"); CurGV = ParseGlobalVariable($2, $3, $4, $5->getType(), $5); - } GlobalVarAttributes { - CurGV = 0; CHECK_FOR_ERROR + } GlobalVarAttributes { + CurGV = 0; } | ConstPool OptAssign EXTERNAL GlobalType Types { - CurGV = ParseGlobalVariable($2, - GlobalValue::ExternalLinkage, $4, *$5, 0); + CurGV = ParseGlobalVariable($2, GlobalValue::ExternalLinkage, $4, *$5, 0); + CHECK_FOR_ERROR delete $5; - } GlobalVarAttributes { + } GlobalVarAttributes { CurGV = 0; CHECK_FOR_ERROR } | ConstPool OptAssign DLLIMPORT GlobalType Types { - CurGV = ParseGlobalVariable($2, - GlobalValue::DLLImportLinkage, $4, *$5, 0); + CurGV = ParseGlobalVariable($2, GlobalValue::DLLImportLinkage, $4, *$5, 0); + CHECK_FOR_ERROR delete $5; - } GlobalVarAttributes { + } GlobalVarAttributes { CurGV = 0; CHECK_FOR_ERROR } | ConstPool OptAssign EXTERN_WEAK GlobalType Types { - CurGV = ParseGlobalVariable($2, - GlobalValue::ExternalWeakLinkage, $4, *$5, 0); + CurGV = + ParseGlobalVariable($2, GlobalValue::ExternalWeakLinkage, $4, *$5, 0); + CHECK_FOR_ERROR delete $5; - } GlobalVarAttributes { + } GlobalVarAttributes { CurGV = 0; CHECK_FOR_ERROR } @@ -1956,6 +2014,7 @@ delete I->first; // Delete the typeholder... setValueName(ArgIt, I->second); // Insert arg into symtab... + CHECK_FOR_ERROR InsertValue(ArgIt); } @@ -2115,6 +2174,7 @@ // BasicBlock : InstructionList OptAssign BBTerminatorInst { setValueName($3, $2); + CHECK_FOR_ERROR InsertValue($3); $1->getInstList().push_back($3); @@ -2130,6 +2190,7 @@ } | /* empty */ { $$ = CurBB = getBBVal(ValID::create((int)CurFun.NextBBNum++), true); + CHECK_FOR_ERROR // Make sure to move the basic block to the correct location in the // function, instead of leaving it inserted wherever it was first @@ -2141,6 +2202,7 @@ } | LABELSTR { $$ = CurBB = getBBVal(ValID::create($1), true); + CHECK_FOR_ERROR // Make sure to move the basic block to the correct location in the // function, instead of leaving it inserted wherever it was first @@ -2160,15 +2222,25 @@ CHECK_FOR_ERROR } | BR LABEL ValueRef { // Unconditional Branch... - $$ = new BranchInst(getBBVal($3)); + BasicBlock* tmpBB = getBBVal($3); CHECK_FOR_ERROR + $$ = new BranchInst(tmpBB); } // Conditional Branch... | BR BOOL ValueRef ',' LABEL ValueRef ',' LABEL ValueRef { - $$ = new BranchInst(getBBVal($6), getBBVal($9), getVal(Type::BoolTy, $3)); + BasicBlock* tmpBBA = getBBVal($6); + CHECK_FOR_ERROR + BasicBlock* tmpBBB = getBBVal($9); + CHECK_FOR_ERROR + Value* tmpVal = getVal(Type::BoolTy, $3); CHECK_FOR_ERROR + $$ = new BranchInst(tmpBBA, tmpBBB, tmpVal); } | SWITCH IntType ValueRef ',' LABEL ValueRef '[' JumpTable ']' { - SwitchInst *S = new SwitchInst(getVal($2, $3), getBBVal($6), $8->size()); + Value* tmpVal = getVal($2, $3); + CHECK_FOR_ERROR + BasicBlock* tmpBB = getBBVal($6); + CHECK_FOR_ERROR + SwitchInst *S = new SwitchInst(tmpVal, tmpBB, $8->size()); $$ = S; std::vector >::iterator I = $8->begin(), @@ -2183,7 +2255,11 @@ CHECK_FOR_ERROR } | SWITCH IntType ValueRef ',' LABEL ValueRef '[' ']' { - SwitchInst *S = new SwitchInst(getVal($2, $3), getBBVal($6), 0); + Value* tmpVal = getVal($2, $3); + CHECK_FOR_ERROR + BasicBlock* tmpBB = getBBVal($6); + CHECK_FOR_ERROR + SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0); $$ = S; CHECK_FOR_ERROR } @@ -2210,9 +2286,11 @@ } Value *V = getVal(PFTy, $4); // Get the function we're calling... - + CHECK_FOR_ERROR BasicBlock *Normal = getBBVal($10); + CHECK_FOR_ERROR BasicBlock *Except = getBBVal($13); + CHECK_FOR_ERROR // Create the call node... if (!$6) { // Has no arguments? @@ -2255,26 +2333,31 @@ JumpTable : JumpTable IntType ConstValueRef ',' LABEL ValueRef { $$ = $1; Constant *V = cast(getValNonImprovising($2, $3)); + CHECK_FOR_ERROR if (V == 0) GEN_ERROR("May only switch on a constant pool value!"); - $$->push_back(std::make_pair(V, getBBVal($6))); + BasicBlock* tmpBB = getBBVal($6); CHECK_FOR_ERROR + $$->push_back(std::make_pair(V, tmpBB)); } | IntType ConstValueRef ',' LABEL ValueRef { $$ = new std::vector >(); Constant *V = cast(getValNonImprovising($1, $2)); + CHECK_FOR_ERROR if (V == 0) GEN_ERROR("May only switch on a constant pool value!"); - $$->push_back(std::make_pair(V, getBBVal($5))); + BasicBlock* tmpBB = getBBVal($5); CHECK_FOR_ERROR + $$->push_back(std::make_pair(V, tmpBB)); }; Inst : OptAssign InstVal { // Is this definition named?? if so, assign the name... setValueName($2, $1); + CHECK_FOR_ERROR InsertValue($2); $$ = $2; CHECK_FOR_ERROR @@ -2282,22 +2365,26 @@ PHIList : Types '[' ValueRef ',' ValueRef ']' { // Used for PHI nodes $$ = new std::list >(); - $$->push_back(std::make_pair(getVal(*$1, $3), getBBVal($5))); - delete $1; + Value* tmpVal = getVal(*$1, $3); CHECK_FOR_ERROR + BasicBlock* tmpBB = getBBVal($5); + CHECK_FOR_ERROR + $$->push_back(std::make_pair(tmpVal, tmpBB)); + delete $1; } | PHIList ',' '[' ValueRef ',' ValueRef ']' { $$ = $1; - $1->push_back(std::make_pair(getVal($1->front().first->getType(), $4), - getBBVal($6))); + Value* tmpVal = getVal($1->front().first->getType(), $4); + CHECK_FOR_ERROR + BasicBlock* tmpBB = getBBVal($6); CHECK_FOR_ERROR + $1->push_back(std::make_pair(tmpVal, tmpBB)); }; ValueRefList : ResolvedVal { // Used for call statements, and memory insts... $$ = new std::vector(); $$->push_back($1); - CHECK_FOR_ERROR } | ValueRefList ',' ResolvedVal { $$ = $1; @@ -2317,8 +2404,6 @@ CHECK_FOR_ERROR }; - - InstVal : ArithmeticOps Types ValueRef ',' ValueRef { if (!(*$2)->isInteger() && !(*$2)->isFloatingPoint() && !isa((*$2).get())) @@ -2326,11 +2411,14 @@ "Arithmetic operator requires integer, FP, or packed operands!"); if (isa((*$2).get()) && $1 == Instruction::Rem) GEN_ERROR("Rem not supported on packed types!"); - $$ = BinaryOperator::create($1, getVal(*$2, $3), getVal(*$2, $5)); + Value* val1 = getVal(*$2, $3); + CHECK_FOR_ERROR + Value* val2 = getVal(*$2, $5); + CHECK_FOR_ERROR + $$ = BinaryOperator::create($1, val1, val2); if ($$ == 0) GEN_ERROR("binary operator returned null!"); delete $2; - CHECK_FOR_ERROR } | LogicalOps Types ValueRef ',' ValueRef { if (!(*$2)->isIntegral()) { @@ -2338,22 +2426,28 @@ !cast($2->get())->getElementType()->isIntegral()) GEN_ERROR("Logical operator requires integral operands!"); } - $$ = BinaryOperator::create($1, getVal(*$2, $3), getVal(*$2, $5)); + Value* tmpVal1 = getVal(*$2, $3); + CHECK_FOR_ERROR + Value* tmpVal2 = getVal(*$2, $5); + CHECK_FOR_ERROR + $$ = BinaryOperator::create($1, tmpVal1, tmpVal2); if ($$ == 0) GEN_ERROR("binary operator returned null!"); delete $2; - CHECK_FOR_ERROR } | SetCondOps Types ValueRef ',' ValueRef { if(isa((*$2).get())) { GEN_ERROR( "PackedTypes currently not supported in setcc instructions!"); } - $$ = new SetCondInst($1, getVal(*$2, $3), getVal(*$2, $5)); + Value* tmpVal1 = getVal(*$2, $3); + CHECK_FOR_ERROR + Value* tmpVal2 = getVal(*$2, $5); + CHECK_FOR_ERROR + $$ = new SetCondInst($1, tmpVal1, tmpVal2); if ($$ == 0) GEN_ERROR("binary operator returned null!"); delete $2; - CHECK_FOR_ERROR } | NOT ResolvedVal { std::cerr << "WARNING: Use of eliminated 'not' instruction:" @@ -2499,6 +2593,7 @@ } Value *V = getVal(PFTy, $4); // Get the function we're calling... + CHECK_FOR_ERROR // Create the call node... if (!$6) { // Has no arguments? @@ -2564,9 +2659,10 @@ CHECK_FOR_ERROR } | MALLOC Types ',' UINT ValueRef OptCAlign { - $$ = new MallocInst(*$2, getVal($4, $5), $6); - delete $2; + Value* tmpVal = getVal($4, $5); CHECK_FOR_ERROR + $$ = new MallocInst(*$2, tmpVal, $6); + delete $2; } | ALLOCA Types OptCAlign { $$ = new AllocaInst(*$2, 0, $3); @@ -2574,9 +2670,10 @@ CHECK_FOR_ERROR } | ALLOCA Types ',' UINT ValueRef OptCAlign { - $$ = new AllocaInst(*$2, getVal($4, $5), $6); - delete $2; + Value* tmpVal = getVal($4, $5); CHECK_FOR_ERROR + $$ = new AllocaInst(*$2, tmpVal, $6); + delete $2; } | FREE ResolvedVal { if (!isa($2->getType())) @@ -2593,9 +2690,10 @@ if (!cast($3->get())->getElementType()->isFirstClassType()) GEN_ERROR("Can't load from pointer of non-first-class type: " + (*$3)->getDescription()); - $$ = new LoadInst(getVal(*$3, $4), "", $1); - delete $3; + Value* tmpVal = getVal(*$3, $4); CHECK_FOR_ERROR + $$ = new LoadInst(tmpVal, "", $1); + delete $3; } | OptVolatile STORE ResolvedVal ',' Types ValueRef { const PointerType *PT = dyn_cast($5->get()); @@ -2607,9 +2705,10 @@ GEN_ERROR("Can't store '" + $3->getType()->getDescription() + "' into space of type '" + ElTy->getDescription() + "'!"); - $$ = new StoreInst($3, getVal(*$5, $6), $1); - delete $5; + Value* tmpVal = getVal(*$5, $6); CHECK_FOR_ERROR + $$ = new StoreInst($3, tmpVal, $1); + delete $5; } | GETELEMENTPTR Types ValueRef IndexList { if (!isa($2->get())) @@ -2629,9 +2728,11 @@ if (!GetElementPtrInst::getIndexedType(*$2, *$4, true)) GEN_ERROR("Invalid getelementptr indices for type '" + (*$2)->getDescription()+ "'!"); - $$ = new GetElementPtrInst(getVal(*$2, $3), *$4); - delete $2; delete $4; + Value* tmpVal = getVal(*$2, $3); CHECK_FOR_ERROR + $$ = new GetElementPtrInst(tmpVal, *$4); + delete $2; + delete $4; }; From sabre at nondot.org Thu Sep 28 15:48:32 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 28 Sep 2006 15:48:32 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/PowerPC/2006-09-28-shift_64.ll Message-ID: <200609282048.k8SKmW2l016382@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/PowerPC: 2006-09-28-shift_64.ll added (r1.1) --- Log message: new testcase --- Diffs of the changes: (+27 -0) 2006-09-28-shift_64.ll | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+) Index: llvm/test/Regression/CodeGen/PowerPC/2006-09-28-shift_64.ll diff -c /dev/null llvm/test/Regression/CodeGen/PowerPC/2006-09-28-shift_64.ll:1.1 *** /dev/null Thu Sep 28 15:48:27 2006 --- llvm/test/Regression/CodeGen/PowerPC/2006-09-28-shift_64.ll Thu Sep 28 15:48:17 2006 *************** *** 0 **** --- 1,27 ---- + ; RUN: llvm-as < %s | llc -march=ppc64 + target endian = big + target pointersize = 64 + target triple = "powerpc64-apple-darwin8" + + implementation ; Functions: + + void %glArrayElement_CompExec() { + entry: + %tmp3 = and ulong 0, 18446744073701163007 ; [#uses=1] + br label %cond_true24 + + cond_false: ; preds = %cond_true24 + ret void + + cond_true24: ; preds = %cond_true24, %entry + %indvar.ph = phi uint [ 0, %entry ], [ %indvar.next, %cond_true24 ] ; [#uses=1] + %indvar = add uint 0, %indvar.ph ; [#uses=2] + %code.0 = cast uint %indvar to ubyte ; [#uses=1] + %tmp5 = add ubyte %code.0, 16 ; [#uses=1] + %tmp7 = shr ulong %tmp3, ubyte %tmp5 ; [#uses=1] + %tmp7 = cast ulong %tmp7 to int ; [#uses=1] + %tmp8 = and int %tmp7, 1 ; [#uses=1] + %tmp8 = seteq int %tmp8, 0 ; [#uses=1] + %indvar.next = add uint %indvar, 1 ; [#uses=1] + br bool %tmp8, label %cond_false, label %cond_true24 + } From sabre at nondot.org Thu Sep 28 15:49:01 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 28 Sep 2006 15:49:01 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCInstr64Bit.td Message-ID: <200609282049.k8SKn1uR016400@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCInstr64Bit.td updated: 1.19 -> 1.20 --- Log message: Shift amounts are always 32-bits, even in 64-bit mode. This fixes CodeGen/PowerPC/2006-09-28-shift_64.ll --- Diffs of the changes: (+6 -6) PPCInstr64Bit.td | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) Index: llvm/lib/Target/PowerPC/PPCInstr64Bit.td diff -u llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.19 llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.20 --- llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.19 Tue Jul 18 11:33:26 2006 +++ llvm/lib/Target/PowerPC/PPCInstr64Bit.td Thu Sep 28 15:48:45 2006 @@ -168,15 +168,15 @@ def CMPLDI : DForm_6_ext<10, (ops CRRC:$dst, G8RC:$src1, u16imm:$src2), "cmpldi $dst, $src1, $src2", IntCompare>, isPPC64; -def SLD : XForm_6<31, 27, (ops G8RC:$rA, G8RC:$rS, G8RC:$rB), +def SLD : XForm_6<31, 27, (ops G8RC:$rA, G8RC:$rS, GPRC:$rB), "sld $rA, $rS, $rB", IntRotateD, - [(set G8RC:$rA, (shl G8RC:$rS, G8RC:$rB))]>, isPPC64; -def SRD : XForm_6<31, 539, (ops G8RC:$rA, G8RC:$rS, G8RC:$rB), + [(set G8RC:$rA, (shl G8RC:$rS, GPRC:$rB))]>, isPPC64; +def SRD : XForm_6<31, 539, (ops G8RC:$rA, G8RC:$rS, GPRC:$rB), "srd $rA, $rS, $rB", IntRotateD, - [(set G8RC:$rA, (srl G8RC:$rS, G8RC:$rB))]>, isPPC64; -def SRAD : XForm_6<31, 794, (ops G8RC:$rA, G8RC:$rS, G8RC:$rB), + [(set G8RC:$rA, (srl G8RC:$rS, GPRC:$rB))]>, isPPC64; +def SRAD : XForm_6<31, 794, (ops G8RC:$rA, G8RC:$rS, GPRC:$rB), "srad $rA, $rS, $rB", IntRotateD, - [(set G8RC:$rA, (sra G8RC:$rS, G8RC:$rB))]>, isPPC64; + [(set G8RC:$rA, (sra G8RC:$rS, GPRC:$rB))]>, isPPC64; def EXTSW : XForm_11<31, 986, (ops G8RC:$rA, G8RC:$rS), "extsw $rA, $rS", IntGeneral, [(set G8RC:$rA, (sext_inreg G8RC:$rS, i32))]>, isPPC64; From reid at x10sys.com Thu Sep 28 16:20:21 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 28 Sep 2006 16:20:21 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Assembler/2006-09-28-CrashOnInvalid.ll Message-ID: <200609282120.k8SLKL3P020706@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Assembler: 2006-09-28-CrashOnInvalid.ll added (r1.1) --- Log message: Add a test case for PR902: http://llvm.org/PR902 . --- Diffs of the changes: (+7 -0) 2006-09-28-CrashOnInvalid.ll | 7 +++++++ 1 files changed, 7 insertions(+) Index: llvm/test/Regression/Assembler/2006-09-28-CrashOnInvalid.ll diff -c /dev/null llvm/test/Regression/Assembler/2006-09-28-CrashOnInvalid.ll:1.1 *** /dev/null Thu Sep 28 16:20:16 2006 --- llvm/test/Regression/Assembler/2006-09-28-CrashOnInvalid.ll Thu Sep 28 16:20:05 2006 *************** *** 0 **** --- 1,7 ---- + ; Test for PR902. This program is erroneous, but should not crash llvm-as. + ; This tests that a simple error is caught and processed correctly. + ; RUN: (llvm-as < %s) 2>&1 | grep 'FP constant invalid for type' + void %test() { + add int 1, 2.0 + ret void + } From reid at x10sys.com Thu Sep 28 16:36:36 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 28 Sep 2006 16:36:36 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CFrontend/2005-12-04-AttributeUsed.c Message-ID: <200609282136.k8SLaa6u023342@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CFrontend: 2005-12-04-AttributeUsed.c updated: 1.1 -> 1.2 --- Log message: Use the -emit-llvm switch to generate LLVM assembly that can be parsed by the test case. --- Diffs of the changes: (+1 -1) 2005-12-04-AttributeUsed.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/Regression/CFrontend/2005-12-04-AttributeUsed.c diff -u llvm/test/Regression/CFrontend/2005-12-04-AttributeUsed.c:1.1 llvm/test/Regression/CFrontend/2005-12-04-AttributeUsed.c:1.2 --- llvm/test/Regression/CFrontend/2005-12-04-AttributeUsed.c:1.1 Sun Dec 4 22:48:12 2005 +++ llvm/test/Regression/CFrontend/2005-12-04-AttributeUsed.c Thu Sep 28 16:36:21 2006 @@ -1,4 +1,4 @@ -// RUN: %llvmgcc %s -S -o - | llvm-as | llvm-dis | grep llvm.used | grep foo | grep X +// RUN: %llvmgcc %s -S -emit-llvm -o - | llvm-as | llvm-dis | grep llvm.used | grep foo | grep X int X __attribute__((used)); int Y; From sabre at nondot.org Thu Sep 28 17:50:49 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 28 Sep 2006 17:50:49 -0500 Subject: [llvm-commits] CVS: llvm/lib/VMCore/AsmWriter.cpp Message-ID: <200609282250.k8SMonl5004505@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: AsmWriter.cpp updated: 1.206 -> 1.207 --- Log message: simplify code --- Diffs of the changes: (+1 -1) AsmWriter.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/VMCore/AsmWriter.cpp diff -u llvm/lib/VMCore/AsmWriter.cpp:1.206 llvm/lib/VMCore/AsmWriter.cpp:1.207 --- llvm/lib/VMCore/AsmWriter.cpp:1.206 Wed Sep 20 17:03:51 2006 +++ llvm/lib/VMCore/AsmWriter.cpp Thu Sep 28 17:50:29 2006 @@ -421,7 +421,7 @@ const int IndentSize = 4; static std::string Indent = "\n"; if (const ConstantBool *CB = dyn_cast(CV)) { - Out << (CB == ConstantBool::True ? "true" : "false"); + Out << (CB->getValue() ? "true" : "false"); } else if (const ConstantSInt *CI = dyn_cast(CV)) { Out << CI->getValue(); } else if (const ConstantUInt *CI = dyn_cast(CV)) { From sabre at nondot.org Thu Sep 28 17:58:39 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 28 Sep 2006 17:58:39 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/CodeExtractor.cpp Message-ID: <200609282258.k8SMwd17004660@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: CodeExtractor.cpp updated: 1.39 -> 1.40 --- Log message: simplify code --- Diffs of the changes: (+1 -1) CodeExtractor.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Transforms/Utils/CodeExtractor.cpp diff -u llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.39 llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.40 --- llvm/lib/Transforms/Utils/CodeExtractor.cpp:1.39 Sun Jan 22 16:53:01 2006 +++ llvm/lib/Transforms/Utils/CodeExtractor.cpp Thu Sep 28 17:58:25 2006 @@ -470,7 +470,7 @@ case 0: case 1: break; // No value needed. case 2: // Conditional branch, return a bool - brVal = SuccNum ? ConstantBool::False : ConstantBool::True; + brVal = ConstantBool::get(!SuccNum); break; default: brVal = ConstantUInt::get(Type::UShortTy, SuccNum); From resistor at mac.com Thu Sep 28 18:02:36 2006 From: resistor at mac.com (Owen Anderson) Date: Thu, 28 Sep 2006 18:02:36 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/ArgumentPromotion.cpp Message-ID: <200609282302.k8SN2aOb004757@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: ArgumentPromotion.cpp updated: 1.25 -> 1.26 --- Log message: Another attempt at making ArgPromotion smarter. This patch no longer breaks Burg. --- Diffs of the changes: (+49 -1) ArgumentPromotion.cpp | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 49 insertions(+), 1 deletion(-) Index: llvm/lib/Transforms/IPO/ArgumentPromotion.cpp diff -u llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.25 llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.26 --- llvm/lib/Transforms/IPO/ArgumentPromotion.cpp:1.25 Fri Sep 15 12:24:45 2006 +++ llvm/lib/Transforms/IPO/ArgumentPromotion.cpp Thu Sep 28 18:02:22 2006 @@ -179,6 +179,53 @@ return true; } +/// AccessOccursOnPath - Returns true if and only if a load or GEP instruction +/// on Pointer occurs in Path, or in every control-flow path that succeeds it. +bool AccessOccursOnPath(Value* V, BasicBlock* Start) { + std::vector Worklist; + Worklist.push_back(Start); + + std::set Visited; + + while (!Worklist.empty()) { + BasicBlock* BB = Worklist.back(); + Worklist.pop_back(); + Visited.insert(BB); + + bool ContainsAccess = false; + for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) { + if (isa(I)) { + for (Instruction::op_iterator OI = I->op_begin(), OE = I->op_end(); OI != OE; ++OI) + if (*OI == V) { + ContainsAccess = true; + break; + } + } else if (isa(I)) { + for (Instruction::op_iterator OI = I->op_begin(), OE = I->op_end(); OI != OE; ++OI) + if (*OI == V) { + ContainsAccess = AccessOccursOnPath(I, I->getParent()); + break; + } + } + + if (ContainsAccess) + break; + } + + if (ContainsAccess) continue; + + TerminatorInst* TI = BB->getTerminator(); + if (isa(TI) || isa(TI)) { + for (unsigned i = 0; i < TI->getNumSuccessors(); ++i) + if (!Visited.count(TI->getSuccessor(i))) + Worklist.push_back(TI->getSuccessor(i)); + } else { + return false; + } + } + + return true; +} /// isSafeToPromoteArgument - As you might guess from the name of this method, /// it checks to see if it is both safe and useful to promote the argument. @@ -252,7 +299,8 @@ // of the pointer in the entry block of the function) or if we can prove that // all pointers passed in are always to legal locations (for example, no null // pointers are passed in, no pointers to free'd memory, etc). - if (!HasLoadInEntryBlock && !AllCalleesPassInValidPointerForArgument(Arg)) + if (!AccessOccursOnPath(Arg, Arg->getParent()->begin()) && + !AllCalleesPassInValidPointerForArgument(Arg)) return false; // Cannot prove that this is safe!! // Okay, now we know that the argument is only used by load instructions and From sabre at nondot.org Thu Sep 28 18:14:43 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 28 Sep 2006 18:14:43 -0500 Subject: [llvm-commits] CVS: llvm/lib/Analysis/ConstantRange.cpp Message-ID: <200609282314.k8SNEh3H004981@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: ConstantRange.cpp updated: 1.14 -> 1.15 --- Log message: Simplify some code --- Diffs of the changes: (+2 -2) ConstantRange.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Analysis/ConstantRange.cpp diff -u llvm/lib/Analysis/ConstantRange.cpp:1.14 llvm/lib/Analysis/ConstantRange.cpp:1.15 --- llvm/lib/Analysis/ConstantRange.cpp:1.14 Thu Apr 21 18:46:51 2005 +++ llvm/lib/Analysis/ConstantRange.cpp Thu Sep 28 18:14:29 2006 @@ -30,8 +30,8 @@ using namespace llvm; static ConstantIntegral *Next(ConstantIntegral *CI) { - if (CI->getType() == Type::BoolTy) - return CI == ConstantBool::True ? ConstantBool::False : ConstantBool::True; + if (ConstantBool *CB = dyn_cast(CI)) + return ConstantBool::get(!CB->getValue()); Constant *Result = ConstantExpr::getAdd(CI, ConstantInt::get(CI->getType(), 1)); From sabre at nondot.org Thu Sep 28 18:17:56 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 28 Sep 2006 18:17:56 -0500 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/AsmPrinter.cpp Message-ID: <200609282317.k8SNHuri005084@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: AsmPrinter.cpp updated: 1.101 -> 1.102 --- Log message: simplify code --- Diffs of the changes: (+1 -1) AsmPrinter.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/AsmPrinter.cpp diff -u llvm/lib/CodeGen/AsmPrinter.cpp:1.101 llvm/lib/CodeGen/AsmPrinter.cpp:1.102 --- llvm/lib/CodeGen/AsmPrinter.cpp:1.101 Tue Sep 26 19:06:07 2006 +++ llvm/lib/CodeGen/AsmPrinter.cpp Thu Sep 28 18:17:41 2006 @@ -364,7 +364,7 @@ if (CV->isNullValue() || isa(CV)) O << "0"; else if (const ConstantBool *CB = dyn_cast(CV)) { - assert(CB == ConstantBool::True); + assert(CB->getValue()); O << "1"; } else if (const ConstantSInt *CI = dyn_cast(CV)) if (((CI->getValue() << 32) >> 32) == CI->getValue()) From sabre at nondot.org Thu Sep 28 18:19:43 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 28 Sep 2006 18:19:43 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp Message-ID: <200609282319.k8SNJhX7005164@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/CBackend: Writer.cpp updated: 1.271 -> 1.272 --- Log message: Simplify some code, reformat break's --- Diffs of the changes: (+12 -6) Writer.cpp | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-) Index: llvm/lib/Target/CBackend/Writer.cpp diff -u llvm/lib/Target/CBackend/Writer.cpp:1.271 llvm/lib/Target/CBackend/Writer.cpp:1.272 --- llvm/lib/Target/CBackend/Writer.cpp:1.271 Sun Sep 17 15:25:45 2006 +++ llvm/lib/Target/CBackend/Writer.cpp Thu Sep 28 18:19:29 2006 @@ -638,10 +638,12 @@ switch (CPV->getType()->getTypeID()) { case Type::BoolTyID: - Out << (CPV == ConstantBool::False ? '0' : '1'); break; + Out << (cast(CPV)->getValue() ? '1' : '0'); + break; case Type::SByteTyID: case Type::ShortTyID: - Out << cast(CPV)->getValue(); break; + Out << cast(CPV)->getValue(); + break; case Type::IntTyID: if ((int)cast(CPV)->getValue() == (int)0x80000000) Out << "((int)0x80000000U)"; // Handle MININT specially to avoid warning @@ -653,15 +655,19 @@ if (cast(CPV)->isMinValue()) Out << "(/*INT64_MIN*/(-9223372036854775807LL)-1)"; else - Out << cast(CPV)->getValue() << "ll"; break; + Out << cast(CPV)->getValue() << "ll"; + break; case Type::UByteTyID: case Type::UShortTyID: - Out << cast(CPV)->getValue(); break; + Out << cast(CPV)->getValue(); + break; case Type::UIntTyID: - Out << cast(CPV)->getValue() << 'u'; break; + Out << cast(CPV)->getValue() << 'u'; + break; case Type::ULongTyID: - Out << cast(CPV)->getValue() << "ull"; break; + Out << cast(CPV)->getValue() << "ull"; + break; case Type::FloatTyID: case Type::DoubleTyID: { From sabre at nondot.org Thu Sep 28 18:25:02 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 28 Sep 2006 18:25:02 -0500 Subject: [llvm-commits] CVS: llvm/tools/llvm2cpp/CppWriter.cpp Message-ID: <200609282325.k8SNP21g005277@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm2cpp: CppWriter.cpp updated: 1.15 -> 1.16 --- Log message: simplify code --- Diffs of the changes: (+1 -2) CppWriter.cpp | 3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/tools/llvm2cpp/CppWriter.cpp diff -u llvm/tools/llvm2cpp/CppWriter.cpp:1.15 llvm/tools/llvm2cpp/CppWriter.cpp:1.16 --- llvm/tools/llvm2cpp/CppWriter.cpp:1.15 Thu Sep 14 13:23:27 2006 +++ llvm/tools/llvm2cpp/CppWriter.cpp Thu Sep 28 18:24:48 2006 @@ -677,8 +677,7 @@ } if (const ConstantBool *CB = dyn_cast(CV)) { Out << "ConstantBool* " << constName << " = ConstantBool::get(" - << (CB == ConstantBool::True ? "true" : "false") - << ");"; + << (CB->getValue() ? "true" : "false") << ");"; } else if (const ConstantSInt *CI = dyn_cast(CV)) { Out << "ConstantSInt* " << constName << " = ConstantSInt::get(" << typeName << ", " << CI->getValue() << ");"; From sabre at nondot.org Thu Sep 28 18:32:57 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 28 Sep 2006 18:32:57 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCJITInfo.cpp Message-ID: <200609282332.k8SNWvWn005512@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCJITInfo.cpp updated: 1.29 -> 1.30 --- Log message: wrap long lines --- Diffs of the changes: (+4 -2) PPCJITInfo.cpp | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm/lib/Target/PowerPC/PPCJITInfo.cpp diff -u llvm/lib/Target/PowerPC/PPCJITInfo.cpp:1.29 llvm/lib/Target/PowerPC/PPCJITInfo.cpp:1.30 --- llvm/lib/Target/PowerPC/PPCJITInfo.cpp:1.29 Fri Sep 8 17:42:09 2006 +++ llvm/lib/Target/PowerPC/PPCJITInfo.cpp Thu Sep 28 18:32:43 2006 @@ -70,7 +70,8 @@ extern "C" void PPC32CompilationCallback(); extern "C" void PPC64CompilationCallback(); -#if (defined(__POWERPC__) || defined (__ppc__) || defined(_POWER)) && !defined(__ppc64__) +#if (defined(__POWERPC__) || defined (__ppc__) || defined(_POWER)) && \ + !defined(__ppc64__) // CompilationCallback stub - We can't use a C function with inline assembly in // it, because we the prolog/epilog inserted by GCC won't work for us. Instead, // write our own wrapper, which does things our way, so we have complete control @@ -135,7 +136,8 @@ } #endif -#if (defined(__POWERPC__) || defined (__ppc__) || defined(_POWER)) && defined(__ppc64__) +#if (defined(__POWERPC__) || defined (__ppc__) || defined(_POWER)) && \ + defined(__ppc64__) asm( ".text\n" ".align 2\n" From sabre at nondot.org Thu Sep 28 18:33:27 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 28 Sep 2006 18:33:27 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.h X86InstrInfo.cpp Message-ID: <200609282333.k8SNXRxE005550@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelLowering.h updated: 1.73 -> 1.74 X86InstrInfo.cpp updated: 1.60 -> 1.61 --- Log message: update comments --- Diffs of the changes: (+2 -1) X86ISelLowering.h | 2 +- X86InstrInfo.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/Target/X86/X86ISelLowering.h diff -u llvm/lib/Target/X86/X86ISelLowering.h:1.73 llvm/lib/Target/X86/X86ISelLowering.h:1.74 --- llvm/lib/Target/X86/X86ISelLowering.h:1.73 Wed Sep 20 17:03:51 2006 +++ llvm/lib/Target/X86/X86ISelLowering.h Thu Sep 28 18:33:12 2006 @@ -146,7 +146,7 @@ /// at function entry, used for PIC code. GlobalBaseReg, - /// TCPWrapper - A wrapper node for TargetConstantPool, + /// Wrapper - A wrapper node for TargetConstantPool, /// TargetExternalSymbol, and TargetGlobalAddress. Wrapper, Index: llvm/lib/Target/X86/X86InstrInfo.cpp diff -u llvm/lib/Target/X86/X86InstrInfo.cpp:1.60 llvm/lib/Target/X86/X86InstrInfo.cpp:1.61 --- llvm/lib/Target/X86/X86InstrInfo.cpp:1.60 Fri Sep 8 01:48:29 2006 +++ llvm/lib/Target/X86/X86InstrInfo.cpp Thu Sep 28 18:33:12 2006 @@ -213,6 +213,7 @@ /// commute them. /// MachineInstr *X86InstrInfo::commuteInstruction(MachineInstr *MI) const { + // FIXME: Can commute cmoves by changing the condition! switch (MI->getOpcode()) { case X86::SHRD16rri8: // A = SHRD16rri8 B, C, I -> A = SHLD16rri8 C, B, (16-I) case X86::SHLD16rri8: // A = SHLD16rri8 B, C, I -> A = SHRD16rri8 C, B, (16-I) From sabre at nondot.org Thu Sep 28 18:34:41 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 28 Sep 2006 18:34:41 -0500 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Constants.cpp Message-ID: <200609282334.k8SNYf1C005600@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Constants.cpp updated: 1.162 -> 1.163 --- Log message: Eliminate ConstantBool::True and ConstantBool::False. Instead, provide ConstantBool::getTrue() and ConstantBool::getFalse(). --- Diffs of the changes: (+18 -8) Constants.cpp | 26 ++++++++++++++++++-------- 1 files changed, 18 insertions(+), 8 deletions(-) Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.162 llvm/lib/VMCore/Constants.cpp:1.163 --- llvm/lib/VMCore/Constants.cpp:1.162 Wed Sep 27 19:38:19 2006 +++ llvm/lib/VMCore/Constants.cpp Thu Sep 28 18:34:27 2006 @@ -26,10 +26,6 @@ #include using namespace llvm; -ConstantBool *ConstantBool::True = new ConstantBool(true); -ConstantBool *ConstantBool::False = new ConstantBool(false); - - //===----------------------------------------------------------------------===// // Constant Class //===----------------------------------------------------------------------===// @@ -128,7 +124,7 @@ // Static constructor to create the maximum constant of an integral type... ConstantIntegral *ConstantIntegral::getMaxValue(const Type *Ty) { switch (Ty->getTypeID()) { - case Type::BoolTyID: return ConstantBool::True; + case Type::BoolTyID: return ConstantBool::getTrue(); case Type::SByteTyID: case Type::ShortTyID: case Type::IntTyID: @@ -152,7 +148,7 @@ // Static constructor to create the minimum constant for an integral type... ConstantIntegral *ConstantIntegral::getMinValue(const Type *Ty) { switch (Ty->getTypeID()) { - case Type::BoolTyID: return ConstantBool::False; + case Type::BoolTyID: return ConstantBool::getFalse(); case Type::SByteTyID: case Type::ShortTyID: case Type::IntTyID: @@ -176,7 +172,7 @@ // Static constructor to create an integral constant with all bits set ConstantIntegral *ConstantIntegral::getAllOnesValue(const Type *Ty) { switch (Ty->getTypeID()) { - case Type::BoolTyID: return ConstantBool::True; + case Type::BoolTyID: return ConstantBool::getTrue(); case Type::SByteTyID: case Type::ShortTyID: case Type::IntTyID: @@ -877,6 +873,20 @@ }; } + +//---- ConstantBool::get*() implementation. + +ConstantBool *ConstantBool::getTrue() { + static ConstantBool *T = 0; + if (T) return T; + return T = new ConstantBool(true); +} +ConstantBool *ConstantBool::getFalse() { + static ConstantBool *F = 0; + if (F) return F; + return F = new ConstantBool(false); +} + //---- ConstantUInt::get() and ConstantSInt::get() implementations... // static ManagedStatic > SIntConstants; @@ -1380,7 +1390,7 @@ C = ConstantExpr::getCast(C, C->getType()->getSignedVersion()); return ConstantExpr::getCast(C, Ty); } else { - if (C == ConstantBool::True) + if (C == ConstantBool::getTrue()) return ConstantIntegral::getAllOnesValue(Ty); else return ConstantIntegral::getNullValue(Ty); From sabre at nondot.org Thu Sep 28 18:35:03 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 28 Sep 2006 18:35:03 -0500 Subject: [llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp Message-ID: <200609282335.k8SNZ3hn005633@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: ConstantFolding.cpp updated: 1.91 -> 1.92 --- Log message: Eliminate ConstantBool::True and ConstantBool::False. Instead, provideConstantBool::getTrue() and ConstantBool::getFalse(). --- Diffs of the changes: (+15 -17) ConstantFolding.cpp | 32 +++++++++++++++----------------- 1 files changed, 15 insertions(+), 17 deletions(-) Index: llvm/lib/VMCore/ConstantFolding.cpp diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.91 llvm/lib/VMCore/ConstantFolding.cpp:1.92 --- llvm/lib/VMCore/ConstantFolding.cpp:1.91 Sun Sep 17 14:14:47 2006 +++ llvm/lib/VMCore/ConstantFolding.cpp Thu Sep 28 18:34:49 2006 @@ -225,7 +225,7 @@ struct VISIBILITY_HIDDEN EmptyRules : public TemplateRules { static Constant *EqualTo(const Constant *V1, const Constant *V2) { - if (V1 == V2) return ConstantBool::True; + if (V1 == V2) return ConstantBool::getTrue(); return 0; } }; @@ -296,10 +296,10 @@ struct VISIBILITY_HIDDEN NullPointerRules : public TemplateRules { static Constant *EqualTo(const Constant *V1, const Constant *V2) { - return ConstantBool::True; // Null pointers are always equal + return ConstantBool::getTrue(); // Null pointers are always equal } static Constant *CastToBool(const Constant *V) { - return ConstantBool::False; + return ConstantBool::getFalse(); } static Constant *CastToSByte (const Constant *V) { return ConstantSInt::get(Type::SByteTy, 0); @@ -729,7 +729,7 @@ // FIXME: When we support 'external weak' references, we have to prevent // this transformation from happening. This code will need to be updated // to ignore external weak symbols when we support it. - return ConstantBool::True; + return ConstantBool::getTrue(); } else if (const ConstantExpr *CE = dyn_cast(V)) { if (CE->getOpcode() == Instruction::Cast) { Constant *Op = const_cast(CE->getOperand(0)); @@ -842,10 +842,8 @@ Constant *llvm::ConstantFoldSelectInstruction(const Constant *Cond, const Constant *V1, const Constant *V2) { - if (Cond == ConstantBool::True) - return const_cast(V1); - else if (Cond == ConstantBool::False) - return const_cast(V2); + if (const ConstantBool *CB = dyn_cast(Cond)) + return const_cast(CB->getValue() ? V1 : V2); if (isa(V1)) return const_cast(V2); if (isa(V2)) return const_cast(V1); @@ -1011,11 +1009,11 @@ // We distilled this down to a simple case, use the standard constant // folder. ConstantBool *R = dyn_cast(ConstantExpr::getSetEQ(V1, V2)); - if (R == ConstantBool::True) return Instruction::SetEQ; + if (R && R->getValue()) return Instruction::SetEQ; R = dyn_cast(ConstantExpr::getSetLT(V1, V2)); - if (R == ConstantBool::True) return Instruction::SetLT; + if (R && R->getValue()) return Instruction::SetLT; R = dyn_cast(ConstantExpr::getSetGT(V1, V2)); - if (R == ConstantBool::True) return Instruction::SetGT; + if (R && R->getValue()) return Instruction::SetGT; // If we couldn't figure it out, bail. return Instruction::BinaryOpsEnd; @@ -1240,20 +1238,20 @@ Opcode == Instruction::SetGE); case Instruction::SetLE: // If we know that V1 <= V2, we can only partially decide this relation. - if (Opcode == Instruction::SetGT) return ConstantBool::False; - if (Opcode == Instruction::SetLT) return ConstantBool::True; + if (Opcode == Instruction::SetGT) return ConstantBool::getFalse(); + if (Opcode == Instruction::SetLT) return ConstantBool::getTrue(); break; case Instruction::SetGE: // If we know that V1 >= V2, we can only partially decide this relation. - if (Opcode == Instruction::SetLT) return ConstantBool::False; - if (Opcode == Instruction::SetGT) return ConstantBool::True; + if (Opcode == Instruction::SetLT) return ConstantBool::getFalse(); + if (Opcode == Instruction::SetGT) return ConstantBool::getTrue(); break; case Instruction::SetNE: // If we know that V1 != V2, we can only partially decide this relation. - if (Opcode == Instruction::SetEQ) return ConstantBool::False; - if (Opcode == Instruction::SetNE) return ConstantBool::True; + if (Opcode == Instruction::SetEQ) return ConstantBool::getFalse(); + if (Opcode == Instruction::SetNE) return ConstantBool::getTrue(); break; } } From sabre at nondot.org Thu Sep 28 18:35:38 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 28 Sep 2006 18:35:38 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/GlobalOpt.cpp Message-ID: <200609282335.k8SNZcLE005695@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: GlobalOpt.cpp updated: 1.64 -> 1.65 --- Log message: Eliminate ConstantBool::True and ConstantBool::False. Instead, provide ConstantBool::getTrue() and ConstantBool::getFalse(). --- Diffs of the changes: (+5 -4) GlobalOpt.cpp | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp diff -u llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.64 llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.65 --- llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.64 Thu Sep 14 13:23:27 2006 +++ llvm/lib/Transforms/IPO/GlobalOpt.cpp Thu Sep 28 18:35:21 2006 @@ -709,7 +709,7 @@ // keep track of whether the global was initialized yet or not. GlobalVariable *InitBool = new GlobalVariable(Type::BoolTy, false, GlobalValue::InternalLinkage, - ConstantBool::False, GV->getName()+".init"); + ConstantBool::getFalse(), GV->getName()+".init"); bool InitBoolUsed = false; // Loop over all uses of GV, processing them in turn. @@ -728,7 +728,7 @@ switch (SCI->getOpcode()) { default: assert(0 && "Unknown opcode!"); case Instruction::SetLT: - LV = ConstantBool::False; // X < null -> always false + LV = ConstantBool::getFalse(); // X < null -> always false break; case Instruction::SetEQ: case Instruction::SetLE: @@ -747,7 +747,7 @@ } else { StoreInst *SI = cast(GV->use_back()); // The global is initialized when the store to it occurs. - new StoreInst(ConstantBool::True, InitBool, SI); + new StoreInst(ConstantBool::getTrue(), InitBool, SI); SI->eraseFromParent(); } @@ -859,7 +859,8 @@ static void ShrinkGlobalToBoolean(GlobalVariable *GV, Constant *OtherVal) { // Create the new global, initializing it to false. GlobalVariable *NewGV = new GlobalVariable(Type::BoolTy, false, - GlobalValue::InternalLinkage, ConstantBool::False, GV->getName()+".b"); + GlobalValue::InternalLinkage, ConstantBool::getFalse(), + GV->getName()+".b"); GV->getParent()->getGlobalList().insert(GV, NewGV); Constant *InitVal = GV->getInitializer(); From sabre at nondot.org Thu Sep 28 18:35:38 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 28 Sep 2006 18:35:38 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp InstructionCombining.cpp LoopUnswitch.cpp PredicateSimplifier.cpp SCCP.cpp Message-ID: <200609282335.k8SNZco7005690@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: CorrelatedExprs.cpp updated: 1.34 -> 1.35 InstructionCombining.cpp updated: 1.515 -> 1.516 LoopUnswitch.cpp updated: 1.47 -> 1.48 PredicateSimplifier.cpp updated: 1.15 -> 1.16 SCCP.cpp updated: 1.131 -> 1.132 --- Log message: Eliminate ConstantBool::True and ConstantBool::False. Instead, provide ConstantBool::getTrue() and ConstantBool::getFalse(). --- Diffs of the changes: (+108 -115) CorrelatedExprs.cpp | 7 +-- InstructionCombining.cpp | 109 ++++++++++++++++++++++++----------------------- LoopUnswitch.cpp | 19 ++++---- PredicateSimplifier.cpp | 73 ++++++++++++++----------------- SCCP.cpp | 15 ++---- 5 files changed, 108 insertions(+), 115 deletions(-) Index: llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp diff -u llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.34 llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.35 --- llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp:1.34 Sun Aug 27 17:42:52 2006 +++ llvm/lib/Transforms/Scalar/CorrelatedExprs.cpp Thu Sep 28 18:35:21 2006 @@ -788,12 +788,12 @@ // Propagate information into the true block... // - PropagateEquality(BI->getCondition(), ConstantBool::True, + PropagateEquality(BI->getCondition(), ConstantBool::getTrue(), getRegionInfo(BI->getSuccessor(0))); // Propagate information into the false block... // - PropagateEquality(BI->getCondition(), ConstantBool::False, + PropagateEquality(BI->getCondition(), ConstantBool::getFalse(), getRegionInfo(BI->getSuccessor(1))); } @@ -971,8 +971,7 @@ // See if we can figure out a result for this instruction... Relation::KnownResult Result = getSetCCResult(SCI, RI); if (Result != Relation::Unknown) { - PropagateEquality(SCI, Result ? ConstantBool::True : ConstantBool::False, - RI); + PropagateEquality(SCI, ConstantBool::get(Result != 0), RI); } } } Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.515 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.516 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.515 Wed Sep 20 10:37:57 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Thu Sep 28 18:35:21 2006 @@ -1989,7 +1989,7 @@ if (ST->isNullValue()) { Instruction *CondI = dyn_cast(SI->getOperand(0)); if (CondI && CondI->getParent() == I.getParent()) - UpdateValueUsesWith(CondI, ConstantBool::False); + UpdateValueUsesWith(CondI, ConstantBool::getFalse()); else if (I.getParent() != SI->getParent() || SI->hasOneUse()) I.setOperand(1, SI->getOperand(2)); else @@ -2001,7 +2001,7 @@ if (ST->isNullValue()) { Instruction *CondI = dyn_cast(SI->getOperand(0)); if (CondI && CondI->getParent() == I.getParent()) - UpdateValueUsesWith(CondI, ConstantBool::True); + UpdateValueUsesWith(CondI, ConstantBool::getTrue()); else if (I.getParent() != SI->getParent() || SI->hasOneUse()) I.setOperand(1, SI->getOperand(1)); else @@ -2213,7 +2213,7 @@ if (ST->isNullValue()) { Instruction *CondI = dyn_cast(SI->getOperand(0)); if (CondI && CondI->getParent() == I.getParent()) - UpdateValueUsesWith(CondI, ConstantBool::False); + UpdateValueUsesWith(CondI, ConstantBool::getFalse()); else if (I.getParent() != SI->getParent() || SI->hasOneUse()) I.setOperand(1, SI->getOperand(2)); else @@ -2225,7 +2225,7 @@ if (ST->isNullValue()) { Instruction *CondI = dyn_cast(SI->getOperand(0)); if (CondI && CondI->getParent() == I.getParent()) - UpdateValueUsesWith(CondI, ConstantBool::True); + UpdateValueUsesWith(CondI, ConstantBool::getTrue()); else if (I.getParent() != SI->getParent() || SI->hasOneUse()) I.setOperand(1, SI->getOperand(1)); else @@ -2344,14 +2344,14 @@ /// SetCC instruction. static Value *getSetCCValue(unsigned Opcode, Value *LHS, Value *RHS) { switch (Opcode) { - case 0: return ConstantBool::False; + case 0: return ConstantBool::getFalse(); case 1: return new SetCondInst(Instruction::SetGT, LHS, RHS); case 2: return new SetCondInst(Instruction::SetEQ, LHS, RHS); case 3: return new SetCondInst(Instruction::SetGE, LHS, RHS); case 4: return new SetCondInst(Instruction::SetLT, LHS, RHS); case 5: return new SetCondInst(Instruction::SetNE, LHS, RHS); case 6: return new SetCondInst(Instruction::SetLE, LHS, RHS); - case 7: return ConstantBool::True; + case 7: return ConstantBool::getTrue(); default: assert(0 && "Illegal SetCCCode!"); return 0; } } @@ -2851,7 +2851,7 @@ default: assert(0 && "Unknown integer condition code!"); case Instruction::SetEQ: // (X == 13 & X == 15) -> false case Instruction::SetGT: // (X == 13 & X > 15) -> false - return ReplaceInstUsesWith(I, ConstantBool::False); + return ReplaceInstUsesWith(I, ConstantBool::getFalse()); case Instruction::SetNE: // (X == 13 & X != 15) -> X == 13 case Instruction::SetLT: // (X == 13 & X < 15) -> X == 13 return ReplaceInstUsesWith(I, LHS); @@ -2886,7 +2886,7 @@ default: assert(0 && "Unknown integer condition code!"); case Instruction::SetEQ: // (X < 13 & X == 15) -> false case Instruction::SetGT: // (X < 13 & X > 15) -> false - return ReplaceInstUsesWith(I, ConstantBool::False); + return ReplaceInstUsesWith(I, ConstantBool::getFalse()); case Instruction::SetNE: // (X < 13 & X != 15) -> X < 13 case Instruction::SetLT: // (X < 13 & X < 15) -> X < 13 return ReplaceInstUsesWith(I, LHS); @@ -3254,7 +3254,7 @@ return ReplaceInstUsesWith(I, LHS); case Instruction::SetNE: // (X != 13 | X != 15) -> true case Instruction::SetLT: // (X != 13 | X < 15) -> true - return ReplaceInstUsesWith(I, ConstantBool::True); + return ReplaceInstUsesWith(I, ConstantBool::getTrue()); } break; case Instruction::SetLT: @@ -3277,7 +3277,7 @@ return ReplaceInstUsesWith(I, LHS); case Instruction::SetNE: // (X > 13 | X != 15) -> true case Instruction::SetLT: // (X > 13 | X < 15) -> true - return ReplaceInstUsesWith(I, ConstantBool::True); + return ReplaceInstUsesWith(I, ConstantBool::getTrue()); } } } @@ -3339,7 +3339,7 @@ if (BinaryOperator *Op0I = dyn_cast(Op0)) { // xor (setcc A, B), true = not (setcc A, B) = setncc A, B if (SetCondInst *SCI = dyn_cast(Op0I)) - if (RHS == ConstantBool::True && SCI->hasOneUse()) + if (RHS == ConstantBool::getTrue() && SCI->hasOneUse()) return new SetCondInst(SCI->getInverseCondition(), SCI->getOperand(0), SCI->getOperand(1)); @@ -3781,9 +3781,9 @@ // Check to see if we are comparing against the minimum or maximum value... if (CI->isMinValue()) { if (I.getOpcode() == Instruction::SetLT) // A < MIN -> FALSE - return ReplaceInstUsesWith(I, ConstantBool::False); + return ReplaceInstUsesWith(I, ConstantBool::getFalse()); if (I.getOpcode() == Instruction::SetGE) // A >= MIN -> TRUE - return ReplaceInstUsesWith(I, ConstantBool::True); + return ReplaceInstUsesWith(I, ConstantBool::getTrue()); if (I.getOpcode() == Instruction::SetLE) // A <= MIN -> A == MIN return BinaryOperator::createSetEQ(Op0, Op1); if (I.getOpcode() == Instruction::SetGT) // A > MIN -> A != MIN @@ -3791,9 +3791,9 @@ } else if (CI->isMaxValue()) { if (I.getOpcode() == Instruction::SetGT) // A > MAX -> FALSE - return ReplaceInstUsesWith(I, ConstantBool::False); + return ReplaceInstUsesWith(I, ConstantBool::getFalse()); if (I.getOpcode() == Instruction::SetLE) // A <= MAX -> TRUE - return ReplaceInstUsesWith(I, ConstantBool::True); + return ReplaceInstUsesWith(I, ConstantBool::getTrue()); if (I.getOpcode() == Instruction::SetGE) // A >= MAX -> A == MAX return BinaryOperator::createSetEQ(Op0, Op1); if (I.getOpcode() == Instruction::SetLT) // A < MAX -> A != MAX @@ -3842,19 +3842,23 @@ default: assert(0 && "Unknown setcc opcode!"); case Instruction::SetEQ: if (Max < RHSVal || Min > RHSVal) - return ReplaceInstUsesWith(I, ConstantBool::False); + return ReplaceInstUsesWith(I, ConstantBool::getFalse()); break; case Instruction::SetNE: if (Max < RHSVal || Min > RHSVal) - return ReplaceInstUsesWith(I, ConstantBool::True); + return ReplaceInstUsesWith(I, ConstantBool::getTrue()); break; case Instruction::SetLT: - if (Max < RHSVal) return ReplaceInstUsesWith(I, ConstantBool::True); - if (Min > RHSVal) return ReplaceInstUsesWith(I, ConstantBool::False); + if (Max < RHSVal) + return ReplaceInstUsesWith(I, ConstantBool::getTrue()); + if (Min > RHSVal) + return ReplaceInstUsesWith(I, ConstantBool::getFalse()); break; case Instruction::SetGT: - if (Min > RHSVal) return ReplaceInstUsesWith(I, ConstantBool::True); - if (Max < RHSVal) return ReplaceInstUsesWith(I, ConstantBool::False); + if (Min > RHSVal) + return ReplaceInstUsesWith(I, ConstantBool::getTrue()); + if (Max < RHSVal) + return ReplaceInstUsesWith(I, ConstantBool::getFalse()); break; } } else { // Signed comparison. @@ -3866,19 +3870,23 @@ default: assert(0 && "Unknown setcc opcode!"); case Instruction::SetEQ: if (Max < RHSVal || Min > RHSVal) - return ReplaceInstUsesWith(I, ConstantBool::False); + return ReplaceInstUsesWith(I, ConstantBool::getFalse()); break; case Instruction::SetNE: if (Max < RHSVal || Min > RHSVal) - return ReplaceInstUsesWith(I, ConstantBool::True); + return ReplaceInstUsesWith(I, ConstantBool::getTrue()); break; case Instruction::SetLT: - if (Max < RHSVal) return ReplaceInstUsesWith(I, ConstantBool::True); - if (Min > RHSVal) return ReplaceInstUsesWith(I, ConstantBool::False); + if (Max < RHSVal) + return ReplaceInstUsesWith(I, ConstantBool::getTrue()); + if (Min > RHSVal) + return ReplaceInstUsesWith(I, ConstantBool::getFalse()); break; case Instruction::SetGT: - if (Min > RHSVal) return ReplaceInstUsesWith(I, ConstantBool::True); - if (Max < RHSVal) return ReplaceInstUsesWith(I, ConstantBool::False); + if (Min > RHSVal) + return ReplaceInstUsesWith(I, ConstantBool::getTrue()); + if (Max < RHSVal) + return ReplaceInstUsesWith(I, ConstantBool::getFalse()); break; } } @@ -3978,9 +3986,9 @@ // As a special case, check to see if this means that the // result is always true or false now. if (I.getOpcode() == Instruction::SetEQ) - return ReplaceInstUsesWith(I, ConstantBool::False); + return ReplaceInstUsesWith(I, ConstantBool::getFalse()); if (I.getOpcode() == Instruction::SetNE) - return ReplaceInstUsesWith(I, ConstantBool::True); + return ReplaceInstUsesWith(I, ConstantBool::getTrue()); } else { I.setOperand(1, NewCst); Constant *NewAndCST; @@ -4200,7 +4208,7 @@ default: assert(0 && "Unhandled setcc opcode!"); case Instruction::SetEQ: if (LoOverflow && HiOverflow) - return ReplaceInstUsesWith(I, ConstantBool::False); + return ReplaceInstUsesWith(I, ConstantBool::getFalse()); else if (HiOverflow) return new SetCondInst(Instruction::SetGE, X, LoBound); else if (LoOverflow) @@ -4209,7 +4217,7 @@ return InsertRangeTest(X, LoBound, HiBound, true, I); case Instruction::SetNE: if (LoOverflow && HiOverflow) - return ReplaceInstUsesWith(I, ConstantBool::True); + return ReplaceInstUsesWith(I, ConstantBool::getTrue()); else if (HiOverflow) return new SetCondInst(Instruction::SetLT, X, LoBound); else if (LoOverflow) @@ -4218,11 +4226,11 @@ return InsertRangeTest(X, LoBound, HiBound, false, I); case Instruction::SetLT: if (LoOverflow) - return ReplaceInstUsesWith(I, ConstantBool::False); + return ReplaceInstUsesWith(I, ConstantBool::getFalse()); return new SetCondInst(Instruction::SetLT, X, LoBound); case Instruction::SetGT: if (HiOverflow) - return ReplaceInstUsesWith(I, ConstantBool::False); + return ReplaceInstUsesWith(I, ConstantBool::getFalse()); return new SetCondInst(Instruction::SetGE, X, HiBound); } } @@ -4558,9 +4566,9 @@ // If the value cannot be represented in the shorter type, we cannot emit // a simple comparison. if (SCI.getOpcode() == Instruction::SetEQ) - return ReplaceInstUsesWith(SCI, ConstantBool::False); + return ReplaceInstUsesWith(SCI, ConstantBool::getFalse()); if (SCI.getOpcode() == Instruction::SetNE) - return ReplaceInstUsesWith(SCI, ConstantBool::True); + return ReplaceInstUsesWith(SCI, ConstantBool::getTrue()); // Evaluate the comparison for LT. Value *Result; @@ -4569,21 +4577,21 @@ if (isSignSrc) { // Signed extend and signed comparison. if (cast(CI)->getValue() < 0) // X < (small) --> false - Result = ConstantBool::False; + Result = ConstantBool::getFalse(); else - Result = ConstantBool::True; // X < (large) --> true + Result = ConstantBool::getTrue(); // X < (large) --> true } else { // Unsigned extend and signed comparison. if (cast(CI)->getValue() < 0) - Result = ConstantBool::False; + Result = ConstantBool::getFalse(); else - Result = ConstantBool::True; + Result = ConstantBool::getTrue(); } } else { // We're performing an unsigned comparison. if (!isSignSrc) { // Unsigned extend & compare -> always true. - Result = ConstantBool::True; + Result = ConstantBool::getTrue(); } else { // We're performing an unsigned comp with a sign extended value. // This is true if the input is >= 0. [aka >s -1] @@ -5389,7 +5397,7 @@ // cast (xor bool X, true) to int --> xor (cast bool X to int), 1 if (SrcBitSize == 1 && SrcI->getOpcode() == Instruction::Xor && - Op1 == ConstantBool::True && + Op1 == ConstantBool::getTrue() && (!Op0->hasOneUse() || !isa(Op0))) { Value *New = InsertOperandCastBefore(Op0, DestTy, &CI); return BinaryOperator::createXor(New, @@ -5648,12 +5656,7 @@ // select true, X, Y -> X // select false, X, Y -> Y if (ConstantBool *C = dyn_cast(CondVal)) - if (C == ConstantBool::True) - return ReplaceInstUsesWith(SI, TrueVal); - else { - assert(C == ConstantBool::False); - return ReplaceInstUsesWith(SI, FalseVal); - } + return ReplaceInstUsesWith(SI, C->getValue() ? TrueVal : FalseVal); // select C, X, X -> X if (TrueVal == FalseVal) @@ -5672,7 +5675,7 @@ if (SI.getType() == Type::BoolTy) if (ConstantBool *C = dyn_cast(TrueVal)) { - if (C == ConstantBool::True) { + if (C->getValue()) { // Change: A = select B, true, C --> A = or B, C return BinaryOperator::createOr(CondVal, FalseVal); } else { @@ -5683,7 +5686,7 @@ return BinaryOperator::createAnd(NotCond, FalseVal); } } else if (ConstantBool *C = dyn_cast(FalseVal)) { - if (C == ConstantBool::False) { + if (C->getValue() == false) { // Change: A = select B, C, false --> A = and B, C return BinaryOperator::createAnd(CondVal, TrueVal); } else { @@ -6193,7 +6196,7 @@ Instruction *OldCall = CS.getInstruction(); // If the call and callee calling conventions don't match, this call must // be unreachable, as the call is undefined. - new StoreInst(ConstantBool::True, + new StoreInst(ConstantBool::getTrue(), UndefValue::get(PointerType::get(Type::BoolTy)), OldCall); if (!OldCall->use_empty()) OldCall->replaceAllUsesWith(UndefValue::get(OldCall->getType())); @@ -6206,7 +6209,7 @@ // This instruction is not reachable, just remove it. We insert a store to // undef so that we know that this code is not reachable, despite the fact // that we can't modify the CFG here. - new StoreInst(ConstantBool::True, + new StoreInst(ConstantBool::getTrue(), UndefValue::get(PointerType::get(Type::BoolTy)), CS.getInstruction()); @@ -6217,7 +6220,7 @@ if (InvokeInst *II = dyn_cast(CS.getInstruction())) { // Don't break the CFG, insert a dummy cond branch. new BranchInst(II->getNormalDest(), II->getUnwindDest(), - ConstantBool::True, II); + ConstantBool::getTrue(), II); } return EraseInstFromFunction(*CS.getInstruction()); } @@ -6901,7 +6904,7 @@ // free undef -> unreachable. if (isa(Op)) { // Insert a new store to null because we cannot modify the CFG here. - new StoreInst(ConstantBool::True, + new StoreInst(ConstantBool::getTrue(), UndefValue::get(PointerType::get(Type::BoolTy)), &FI); return EraseInstFromFunction(FI); } Index: llvm/lib/Transforms/Scalar/LoopUnswitch.cpp diff -u llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.47 llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.48 --- llvm/lib/Transforms/Scalar/LoopUnswitch.cpp:1.47 Tue Aug 29 17:29:16 2006 +++ llvm/lib/Transforms/Scalar/LoopUnswitch.cpp Thu Sep 28 18:35:21 2006 @@ -173,7 +173,8 @@ // 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::getTrue(), + L)) { ++NumBranches; return true; } @@ -196,7 +197,8 @@ 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::getTrue(), + L)) { ++NumSelects; return true; } @@ -286,9 +288,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; + if (Val) *Val = ConstantBool::getTrue(); } else if ((LoopExitBB = isTrivialLoopExitBlock(L, BI->getSuccessor(1)))) { - if (Val) *Val = ConstantBool::False; + if (Val) *Val = ConstantBool::getFalse(); } } else if (SwitchInst *SI = dyn_cast(HeaderTerm)) { // If this isn't a switch on Cond, we can't handle it. @@ -488,7 +490,7 @@ Value *BranchVal = LIC; if (!isa(Val)) { BranchVal = BinaryOperator::createSetEQ(LIC, Val, "tmp", InsertPt); - } else if (Val != ConstantBool::True) { + } else if (Val != ConstantBool::getTrue()) { // We want to enter the new loop when the condition is true. std::swap(TrueDest, FalseDest); } @@ -964,10 +966,9 @@ BasicBlock* Split = SplitBlock(Old, SI); Instruction* OldTerm = Old->getTerminator(); - BranchInst* Branch = new BranchInst(Split, - SI->getSuccessor(i), - ConstantBool::True, - OldTerm); + BranchInst* Branch = new BranchInst(Split, SI->getSuccessor(i), + ConstantBool::getTrue(), + OldTerm); Old->getTerminator()->eraseFromParent(); Index: llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp diff -u llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.15 llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.16 --- llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp:1.15 Sat Sep 23 10:13:08 2006 +++ llvm/lib/Transforms/Scalar/PredicateSimplifier.cpp Thu Sep 28 18:35:21 2006 @@ -315,51 +315,47 @@ if (BinaryOperator *BO = dyn_cast(V2)) { switch (BO->getOpcode()) { case Instruction::SetEQ: - if (V1 == ConstantBool::True) - add(Opcode, BO->getOperand(0), BO->getOperand(1), false); - if (V1 == ConstantBool::False) - add(Opcode, BO->getOperand(0), BO->getOperand(1), true); + if (ConstantBool *V1CB = dyn_cast(V1)) + add(Opcode, BO->getOperand(0), BO->getOperand(1),!V1CB->getValue()); break; case Instruction::SetNE: - if (V1 == ConstantBool::True) - add(Opcode, BO->getOperand(0), BO->getOperand(1), true); - if (V1 == ConstantBool::False) - add(Opcode, BO->getOperand(0), BO->getOperand(1), false); + if (ConstantBool *V1CB = dyn_cast(V1)) + add(Opcode, BO->getOperand(0), BO->getOperand(1), V1CB->getValue()); break; case Instruction::SetLT: case Instruction::SetGT: - if (V1 == ConstantBool::True) + if (V1 == ConstantBool::getTrue()) add(Opcode, BO->getOperand(0), BO->getOperand(1), true); break; case Instruction::SetLE: case Instruction::SetGE: - if (V1 == ConstantBool::False) + if (V1 == ConstantBool::getFalse()) add(Opcode, BO->getOperand(0), BO->getOperand(1), true); break; case Instruction::And: - if (V1 == ConstantBool::True) { - add(Opcode, ConstantBool::True, BO->getOperand(0), false); - add(Opcode, ConstantBool::True, BO->getOperand(1), false); + if (V1 == ConstantBool::getTrue()) { + add(Opcode, V1, BO->getOperand(0), false); + add(Opcode, V1, BO->getOperand(1), false); } break; case Instruction::Or: - if (V1 == ConstantBool::False) { - add(Opcode, ConstantBool::False, BO->getOperand(0), false); - add(Opcode, ConstantBool::False, BO->getOperand(1), false); + if (V1 == ConstantBool::getFalse()) { + add(Opcode, V1, BO->getOperand(0), false); + add(Opcode, V1, BO->getOperand(1), false); } break; case Instruction::Xor: - if (V1 == ConstantBool::True) { - if (BO->getOperand(0) == ConstantBool::True) - add(Opcode, ConstantBool::False, BO->getOperand(1), false); - if (BO->getOperand(1) == ConstantBool::True) - add(Opcode, ConstantBool::False, BO->getOperand(0), false); + if (V1 == ConstantBool::getTrue()) { + if (BO->getOperand(0) == V1) + add(Opcode, ConstantBool::getFalse(), BO->getOperand(1), false); + if (BO->getOperand(1) == V1) + add(Opcode, ConstantBool::getFalse(), BO->getOperand(0), false); } - if (V1 == ConstantBool::False) { - if (BO->getOperand(0) == ConstantBool::True) - add(Opcode, ConstantBool::True, BO->getOperand(1), false); - if (BO->getOperand(1) == ConstantBool::True) - add(Opcode, ConstantBool::True, BO->getOperand(0), false); + if (V1 == ConstantBool::getFalse()) { + if (BO->getOperand(0) == ConstantBool::getTrue()) + add(Opcode, ConstantBool::getTrue(), BO->getOperand(1), false); + if (BO->getOperand(1) == ConstantBool::getTrue()) + add(Opcode, ConstantBool::getTrue(), BO->getOperand(0), false); } break; default: @@ -368,10 +364,8 @@ } else if (SelectInst *SI = dyn_cast(V2)) { if (Opcode != EQ && Opcode != NE) return; - ConstantBool *True = (Opcode==EQ) ? ConstantBool::True - : ConstantBool::False, - *False = (Opcode==EQ) ? ConstantBool::False - : ConstantBool::True; + ConstantBool *True = ConstantBool::get(Opcode==EQ), + *False = ConstantBool::get(Opcode!=EQ); if (V1 == SI->getTrueValue()) addEqual(SI->getCondition(), True); @@ -525,8 +519,8 @@ if (NE != KP.Properties.end()) { switch (SCI->getOpcode()) { - case Instruction::SetEQ: return ConstantBool::False; - case Instruction::SetNE: return ConstantBool::True; + case Instruction::SetEQ: return ConstantBool::getFalse(); + case Instruction::SetNE: return ConstantBool::getTrue(); case Instruction::SetLE: case Instruction::SetGE: case Instruction::SetLT: @@ -558,10 +552,9 @@ Value *PredicateSimplifier::resolve(SelectInst *SI, const PropertySet &KP) { Value *Condition = resolve(SI->getCondition(), KP); - if (Condition == ConstantBool::True) - return resolve(SI->getTrueValue(), KP); - else if (Condition == ConstantBool::False) - return resolve(SI->getFalseValue(), KP); + if (ConstantBool *CB = dyn_cast(Condition)) + return resolve(CB->getValue() ? SI->getTrueValue() : SI->getFalseValue(), + KP); return SI; } @@ -674,10 +667,10 @@ BasicBlock *TrueDest = BI->getSuccessor(0), *FalseDest = BI->getSuccessor(1); - if (Condition == ConstantBool::True || TrueDest == FalseDest) { + if (Condition == ConstantBool::getTrue() || TrueDest == FalseDest) { proceedToSuccessors(KP, BB); return; - } else if (Condition == ConstantBool::False) { + } else if (Condition == ConstantBool::getFalse()) { proceedToSuccessors(KP, BB); return; } @@ -686,14 +679,14 @@ for (DTNodeType::iterator I = Node->begin(), E = Node->end(); I != E; ++I) { if ((*I)->getBlock() == TrueDest) { PropertySet TrueProperties(KP); - TrueProperties.addEqual(ConstantBool::True, Condition); + TrueProperties.addEqual(ConstantBool::getTrue(), Condition); proceedToSuccessor(BI, 0, KP, TrueProperties); continue; } if ((*I)->getBlock() == FalseDest) { PropertySet FalseProperties(KP); - FalseProperties.addEqual(ConstantBool::False, Condition); + FalseProperties.addEqual(ConstantBool::getFalse(), Condition); proceedToSuccessor(BI, 1, KP, FalseProperties); continue; } Index: llvm/lib/Transforms/Scalar/SCCP.cpp diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.131 llvm/lib/Transforms/Scalar/SCCP.cpp:1.132 --- llvm/lib/Transforms/Scalar/SCCP.cpp:1.131 Sun Aug 27 17:42:52 2006 +++ llvm/lib/Transforms/Scalar/SCCP.cpp Thu Sep 28 18:35:21 2006 @@ -374,7 +374,7 @@ Succs[0] = Succs[1] = true; } else if (BCValue.isConstant()) { // Constant condition variables mean the branch can only go a single way - Succs[BCValue.getConstant() == ConstantBool::False] = true; + Succs[BCValue.getConstant() == ConstantBool::getFalse()] = true; } } } else if (InvokeInst *II = dyn_cast(&TI)) { @@ -432,7 +432,7 @@ // Constant condition variables mean the branch can only go a single way return BI->getSuccessor(BCValue.getConstant() == - ConstantBool::False) == To; + ConstantBool::getFalse()) == To; } return false; } @@ -598,12 +598,9 @@ if (CondValue.isUndefined()) return; if (CondValue.isConstant()) { - Value *InVal = 0; - if (CondValue.getConstant() == ConstantBool::True) { - mergeInValue(&I, getValueState(I.getTrueValue())); - return; - } else if (CondValue.getConstant() == ConstantBool::False) { - mergeInValue(&I, getValueState(I.getFalseValue())); + if (ConstantBool *CondCB = dyn_cast(CondValue.getConstant())){ + mergeInValue(&I, getValueState(CondCB->getValue() ? I.getTrueValue() + : I.getFalseValue())); return; } } @@ -1035,7 +1032,7 @@ if (BI->isConditional()) { LatticeVal &BCValue = getValueState(BI->getCondition()); if (BCValue.isUndefined()) { - BI->setCondition(ConstantBool::True); + BI->setCondition(ConstantBool::getTrue()); BranchesResolved = true; visit(BI); } From sabre at nondot.org Thu Sep 28 18:35:38 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 28 Sep 2006 18:35:38 -0500 Subject: [llvm-commits] CVS: llvm/lib/AsmParser/ParserInternals.h llvmAsmParser.cpp.cvs llvmAsmParser.h.cvs llvmAsmParser.y llvmAsmParser.y.cvs Message-ID: <200609282335.k8SNZc1j005708@zion.cs.uiuc.edu> Changes in directory llvm/lib/AsmParser: ParserInternals.h updated: 1.44 -> 1.45 llvmAsmParser.cpp.cvs updated: 1.14 -> 1.15 llvmAsmParser.h.cvs updated: 1.9 -> 1.10 llvmAsmParser.y updated: 1.262 -> 1.263 llvmAsmParser.y.cvs updated: 1.14 -> 1.15 --- Log message: Eliminate ConstantBool::True and ConstantBool::False. Instead, provide ConstantBool::getTrue() and ConstantBool::getFalse(). --- Diffs of the changes: (+2863 -3855) ParserInternals.h | 4 llvmAsmParser.cpp.cvs | 6331 +++++++++++++++++++++----------------------------- llvmAsmParser.h.cvs | 367 -- llvmAsmParser.y | 8 llvmAsmParser.y.cvs | 8 5 files changed, 2863 insertions(+), 3855 deletions(-) Index: llvm/lib/AsmParser/ParserInternals.h diff -u llvm/lib/AsmParser/ParserInternals.h:1.44 llvm/lib/AsmParser/ParserInternals.h:1.45 --- llvm/lib/AsmParser/ParserInternals.h:1.44 Fri Aug 18 03:43:06 2006 +++ llvm/lib/AsmParser/ParserInternals.h Thu Sep 28 18:35:21 2006 @@ -172,8 +172,8 @@ case ConstUIntVal : case ConstSIntVal : return std::string("%") + itostr(ConstPool64); case ConstantVal: - if (ConstantValue == ConstantBool::True) return "true"; - if (ConstantValue == ConstantBool::False) return "false"; + if (ConstantValue == ConstantBool::getTrue()) return "true"; + if (ConstantValue == ConstantBool::getFalse()) return "false"; return ""; default: assert(0 && "Unknown value!"); Index: llvm/lib/AsmParser/llvmAsmParser.cpp.cvs diff -u llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.14 llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.15 --- llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.14 Thu Sep 28 14:28:24 2006 +++ llvm/lib/AsmParser/llvmAsmParser.cpp.cvs Thu Sep 28 18:35:21 2006 @@ -1,288 +1,123 @@ -/* A Bison parser, made by GNU Bison 2.1. */ -/* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +/* A Bison parser, made from /Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y + by GNU Bison version 1.28 */ - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ - -/* As a special exception, 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 - -/* Bison version. */ -#define YYBISON_VERSION "2.1" - -/* Skeleton name. */ -#define YYSKELETON_NAME "yacc.c" - -/* Pure parsers. */ -#define YYPURE 0 - -/* Using locations. */ -#define YYLSP_NEEDED 0 +#define YYBISON 1 /* Identify Bison output. */ -/* Substitute the variable and function names. */ #define yyparse llvmAsmparse -#define yylex llvmAsmlex +#define yylex llvmAsmlex #define yyerror llvmAsmerror -#define yylval llvmAsmlval -#define yychar llvmAsmchar +#define yylval llvmAsmlval +#define yychar llvmAsmchar #define yydebug llvmAsmdebug #define yynerrs llvmAsmnerrs +#define ESINT64VAL 257 +#define EUINT64VAL 258 +#define SINTVAL 259 +#define UINTVAL 260 +#define FPVAL 261 +#define VOID 262 +#define BOOL 263 +#define SBYTE 264 +#define UBYTE 265 +#define SHORT 266 +#define USHORT 267 +#define INT 268 +#define UINT 269 +#define LONG 270 +#define ULONG 271 +#define FLOAT 272 +#define DOUBLE 273 +#define TYPE 274 +#define LABEL 275 +#define VAR_ID 276 +#define LABELSTR 277 +#define STRINGCONSTANT 278 +#define IMPLEMENTATION 279 +#define ZEROINITIALIZER 280 +#define TRUETOK 281 +#define FALSETOK 282 +#define BEGINTOK 283 +#define ENDTOK 284 +#define DECLARE 285 +#define GLOBAL 286 +#define CONSTANT 287 +#define SECTION 288 +#define VOLATILE 289 +#define TO 290 +#define DOTDOTDOT 291 +#define NULL_TOK 292 +#define UNDEF 293 +#define CONST 294 +#define INTERNAL 295 +#define LINKONCE 296 +#define WEAK 297 +#define APPENDING 298 +#define DLLIMPORT 299 +#define DLLEXPORT 300 +#define EXTERN_WEAK 301 +#define OPAQUE 302 +#define NOT 303 +#define EXTERNAL 304 +#define TARGET 305 +#define TRIPLE 306 +#define ENDIAN 307 +#define POINTERSIZE 308 +#define LITTLE 309 +#define BIG 310 +#define ALIGN 311 +#define DEPLIBS 312 +#define CALL 313 +#define TAIL 314 +#define ASM_TOK 315 +#define MODULE 316 +#define SIDEEFFECT 317 +#define CC_TOK 318 +#define CCC_TOK 319 +#define CSRETCC_TOK 320 +#define FASTCC_TOK 321 +#define COLDCC_TOK 322 +#define X86_STDCALLCC_TOK 323 +#define X86_FASTCALLCC_TOK 324 +#define RET 325 +#define BR 326 +#define SWITCH 327 +#define INVOKE 328 +#define UNWIND 329 +#define UNREACHABLE 330 +#define ADD 331 +#define SUB 332 +#define MUL 333 +#define DIV 334 +#define REM 335 +#define AND 336 +#define OR 337 +#define XOR 338 +#define SETLE 339 +#define SETGE 340 +#define SETLT 341 +#define SETGT 342 +#define SETEQ 343 +#define SETNE 344 +#define MALLOC 345 +#define ALLOCA 346 +#define FREE 347 +#define LOAD 348 +#define STORE 349 +#define GETELEMENTPTR 350 +#define PHI_TOK 351 +#define CAST 352 +#define SELECT 353 +#define SHL 354 +#define SHR 355 +#define VAARG 356 +#define EXTRACTELEMENT 357 +#define INSERTELEMENT 358 +#define SHUFFLEVECTOR 359 +#define VAARG_old 360 +#define VANEXT_old 361 - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - ESINT64VAL = 258, - EUINT64VAL = 259, - SINTVAL = 260, - UINTVAL = 261, - FPVAL = 262, - VOID = 263, - BOOL = 264, - SBYTE = 265, - UBYTE = 266, - SHORT = 267, - USHORT = 268, - INT = 269, - UINT = 270, - LONG = 271, - ULONG = 272, - FLOAT = 273, - DOUBLE = 274, - TYPE = 275, - LABEL = 276, - VAR_ID = 277, - LABELSTR = 278, - STRINGCONSTANT = 279, - IMPLEMENTATION = 280, - ZEROINITIALIZER = 281, - TRUETOK = 282, - FALSETOK = 283, - BEGINTOK = 284, - ENDTOK = 285, - DECLARE = 286, - GLOBAL = 287, - CONSTANT = 288, - SECTION = 289, - VOLATILE = 290, - TO = 291, - DOTDOTDOT = 292, - NULL_TOK = 293, - UNDEF = 294, - CONST = 295, - INTERNAL = 296, - LINKONCE = 297, - WEAK = 298, - APPENDING = 299, - DLLIMPORT = 300, - DLLEXPORT = 301, - EXTERN_WEAK = 302, - OPAQUE = 303, - NOT = 304, - EXTERNAL = 305, - TARGET = 306, - TRIPLE = 307, - ENDIAN = 308, - POINTERSIZE = 309, - LITTLE = 310, - BIG = 311, - ALIGN = 312, - DEPLIBS = 313, - CALL = 314, - TAIL = 315, - ASM_TOK = 316, - MODULE = 317, - SIDEEFFECT = 318, - CC_TOK = 319, - CCC_TOK = 320, - CSRETCC_TOK = 321, - FASTCC_TOK = 322, - COLDCC_TOK = 323, - X86_STDCALLCC_TOK = 324, - X86_FASTCALLCC_TOK = 325, - RET = 326, - BR = 327, - SWITCH = 328, - INVOKE = 329, - UNWIND = 330, - UNREACHABLE = 331, - ADD = 332, - SUB = 333, - MUL = 334, - DIV = 335, - REM = 336, - AND = 337, - OR = 338, - XOR = 339, - SETLE = 340, - SETGE = 341, - SETLT = 342, - SETGT = 343, - SETEQ = 344, - SETNE = 345, - MALLOC = 346, - ALLOCA = 347, - FREE = 348, - LOAD = 349, - STORE = 350, - GETELEMENTPTR = 351, - PHI_TOK = 352, - CAST = 353, - SELECT = 354, - SHL = 355, - SHR = 356, - VAARG = 357, - EXTRACTELEMENT = 358, - INSERTELEMENT = 359, - SHUFFLEVECTOR = 360, - VAARG_old = 361, - VANEXT_old = 362 - }; -#endif -/* Tokens. */ -#define ESINT64VAL 258 -#define EUINT64VAL 259 -#define SINTVAL 260 -#define UINTVAL 261 -#define FPVAL 262 -#define VOID 263 -#define BOOL 264 -#define SBYTE 265 -#define UBYTE 266 -#define SHORT 267 -#define USHORT 268 -#define INT 269 -#define UINT 270 -#define LONG 271 -#define ULONG 272 -#define FLOAT 273 -#define DOUBLE 274 -#define TYPE 275 -#define LABEL 276 -#define VAR_ID 277 -#define LABELSTR 278 -#define STRINGCONSTANT 279 -#define IMPLEMENTATION 280 -#define ZEROINITIALIZER 281 -#define TRUETOK 282 -#define FALSETOK 283 -#define BEGINTOK 284 -#define ENDTOK 285 -#define DECLARE 286 -#define GLOBAL 287 -#define CONSTANT 288 -#define SECTION 289 -#define VOLATILE 290 -#define TO 291 -#define DOTDOTDOT 292 -#define NULL_TOK 293 -#define UNDEF 294 -#define CONST 295 -#define INTERNAL 296 -#define LINKONCE 297 -#define WEAK 298 -#define APPENDING 299 -#define DLLIMPORT 300 -#define DLLEXPORT 301 -#define EXTERN_WEAK 302 -#define OPAQUE 303 -#define NOT 304 -#define EXTERNAL 305 -#define TARGET 306 -#define TRIPLE 307 -#define ENDIAN 308 -#define POINTERSIZE 309 -#define LITTLE 310 -#define BIG 311 -#define ALIGN 312 -#define DEPLIBS 313 -#define CALL 314 -#define TAIL 315 -#define ASM_TOK 316 -#define MODULE 317 -#define SIDEEFFECT 318 -#define CC_TOK 319 -#define CCC_TOK 320 -#define CSRETCC_TOK 321 -#define FASTCC_TOK 322 -#define COLDCC_TOK 323 -#define X86_STDCALLCC_TOK 324 -#define X86_FASTCALLCC_TOK 325 -#define RET 326 -#define BR 327 -#define SWITCH 328 -#define INVOKE 329 -#define UNWIND 330 -#define UNREACHABLE 331 -#define ADD 332 -#define SUB 333 -#define MUL 334 -#define DIV 335 -#define REM 336 -#define AND 337 -#define OR 338 -#define XOR 339 -#define SETLE 340 -#define SETGE 341 -#define SETLT 342 -#define SETGT 343 -#define SETEQ 344 -#define SETNE 345 -#define MALLOC 346 -#define ALLOCA 347 -#define FREE 348 -#define LOAD 349 -#define STORE 350 -#define GETELEMENTPTR 351 -#define PHI_TOK 352 -#define CAST 353 -#define SELECT 354 -#define SHL 355 -#define SHR 356 -#define VAARG 357 -#define EXTRACTELEMENT 358 -#define INSERTELEMENT 359 -#define SHUFFLEVECTOR 360 -#define VAARG_old 361 -#define VANEXT_old 362 - - - - -/* Copy the first part of user declarations. */ -#line 14 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 14 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" #include "ParserInternals.h" #include "llvm/CallingConv.h" @@ -1234,28 +1069,8 @@ } - -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif - -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 -#endif - -#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 966 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" -typedef union YYSTYPE { +#line 966 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +typedef union { llvm::Module *ModuleVal; llvm::Function *FunctionVal; std::pair *ArgVal; @@ -1294,1457 +1109,997 @@ llvm::Instruction::OtherOps OtherOpVal; llvm::Module::Endianness Endianness; } YYSTYPE; -/* Line 196 of yacc.c. */ -#line 1299 "llvmAsmParser.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 219 of yacc.c. */ -#line 1311 "llvmAsmParser.tab.c" - -#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) && (defined (__STDC__) || defined (__cplusplus)) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -#endif -#if ! defined (YYSIZE_T) -# define YYSIZE_T unsigned int -#endif - -#ifndef YY_ -# if YYENABLE_NLS -# if ENABLE_NLS -# include /* INFRINGES ON USER NAME SPACE */ -# define YY_(msgid) dgettext ("bison-runtime", msgid) -# endif -# endif -# ifndef YY_ -# define YY_(msgid) msgid -# endif -#endif - -#if ! defined (yyoverflow) || YYERROR_VERBOSE - -/* The parser invokes alloca or malloc; define the necessary symbols. */ - -# ifdef YYSTACK_USE_ALLOCA -# if YYSTACK_USE_ALLOCA -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# else -# define YYSTACK_ALLOC alloca -# if defined (__STDC__) || defined (__cplusplus) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYINCLUDED_STDLIB_H -# endif -# endif -# endif -# endif - -# ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) -# ifndef YYSTACK_ALLOC_MAXIMUM - /* The OS might guarantee only one guard page at the bottom of the stack, - and a page size can be as small as 4096 bytes. So we cannot safely - invoke alloca (N) if N exceeds 4096. Use a slightly smaller number - to allow for a few compiler-allocated temporary stack slots. */ -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */ -# endif -# else -# define YYSTACK_ALLOC YYMALLOC -# define YYSTACK_FREE YYFREE -# ifndef YYSTACK_ALLOC_MAXIMUM -# define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1) -# endif -# ifdef __cplusplus -extern "C" { -# endif -# ifndef YYMALLOC -# define YYMALLOC malloc -# if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ - && (defined (__STDC__) || defined (__cplusplus))) -void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# ifndef YYFREE -# define YYFREE free -# if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ - && (defined (__STDC__) || defined (__cplusplus))) -void free (void *); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# ifdef __cplusplus -} -# endif -# endif -#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ +#include +#ifndef __cplusplus +#ifndef __STDC__ +#define const +#endif +#endif -#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 int yyss; - YYSTYPE yyvs; - }; -/* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) +#define YYFINAL 514 +#define YYFLAG -32768 +#define YYNTBASE 122 + +#define YYTRANSLATE(x) ((unsigned)(x) <= 361 ? yytranslate[x] : 196) + +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, 111, + 112, 120, 2, 109, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 116, + 108, 117, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 113, 110, 115, 2, 2, 2, 2, 2, 121, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 114, + 2, 2, 118, 2, 119, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107 +}; -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ - + YYSTACK_GAP_MAXIMUM) - -/* Copy COUNT objects from FROM to TO. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined (__GNUC__) && 1 < __GNUC__ -# define YYCOPY(To, From, Count) \ - __builtin_memcpy (To, From, (Count) * sizeof (*(From))) -# else -# define YYCOPY(To, From, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (To)[yyi] = (From)[yyi]; \ - } \ - while (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) +#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, 78, + 80, 82, 83, 84, 86, 88, 90, 92, 94, 96, + 99, 100, 103, 104, 108, 111, 112, 114, 115, 119, + 121, 124, 126, 128, 130, 132, 134, 136, 138, 140, + 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, + 162, 164, 166, 169, 174, 180, 186, 190, 193, 196, + 198, 202, 204, 208, 210, 211, 216, 220, 224, 229, + 234, 238, 241, 244, 247, 250, 253, 256, 259, 262, + 265, 268, 275, 281, 290, 297, 304, 311, 318, 325, + 334, 343, 347, 349, 351, 353, 355, 358, 361, 366, + 369, 371, 376, 379, 384, 385, 393, 394, 402, 403, + 411, 412, 420, 424, 429, 430, 432, 434, 436, 440, + 444, 448, 452, 456, 458, 459, 461, 463, 465, 466, + 469, 473, 475, 477, 481, 483, 484, 493, 495, 497, + 501, 503, 505, 508, 509, 511, 513, 514, 519, 520, + 522, 524, 526, 528, 530, 532, 534, 536, 538, 542, + 544, 550, 552, 554, 556, 558, 561, 564, 567, 571, + 574, 575, 577, 580, 583, 587, 597, 607, 616, 630, + 632, 634, 641, 647, 650, 657, 665, 667, 671, 673, + 674, 677, 679, 685, 691, 697, 700, 705, 710, 717, + 722, 727, 732, 737, 744, 751, 754, 762, 764, 767, + 768, 770, 771, 775, 782, 786, 793, 796, 801, 808 +}; -#endif +static const short yyrhs[] = { 5, + 0, 6, 0, 3, 0, 4, 0, 77, 0, 78, + 0, 79, 0, 80, 0, 81, 0, 82, 0, 83, + 0, 84, 0, 85, 0, 86, 0, 87, 0, 88, + 0, 89, 0, 90, 0, 100, 0, 101, 0, 16, + 0, 14, 0, 12, 0, 10, 0, 17, 0, 15, + 0, 13, 0, 11, 0, 128, 0, 129, 0, 18, + 0, 19, 0, 164, 108, 0, 0, 41, 0, 42, + 0, 43, 0, 44, 0, 45, 0, 46, 0, 47, + 0, 0, 0, 65, 0, 66, 0, 67, 0, 68, + 0, 69, 0, 70, 0, 64, 4, 0, 0, 57, + 4, 0, 0, 109, 57, 4, 0, 34, 24, 0, + 0, 137, 0, 0, 109, 140, 139, 0, 137, 0, + 57, 4, 0, 143, 0, 8, 0, 145, 0, 8, + 0, 145, 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, 48, + 0, 144, 0, 179, 0, 110, 4, 0, 142, 111, + 147, 112, 0, 113, 4, 114, 145, 115, 0, 116, + 4, 114, 145, 117, 0, 118, 146, 119, 0, 118, + 119, 0, 145, 120, 0, 145, 0, 146, 109, 145, + 0, 146, 0, 146, 109, 37, 0, 37, 0, 0, + 143, 113, 150, 115, 0, 143, 113, 115, 0, 143, + 121, 24, 0, 143, 116, 150, 117, 0, 143, 118, + 150, 119, 0, 143, 118, 119, 0, 143, 38, 0, + 143, 39, 0, 143, 179, 0, 143, 149, 0, 143, + 26, 0, 128, 123, 0, 129, 4, 0, 9, 27, + 0, 9, 28, 0, 131, 7, 0, 98, 111, 148, + 36, 143, 112, 0, 96, 111, 148, 193, 112, 0, + 99, 111, 148, 109, 148, 109, 148, 112, 0, 124, + 111, 148, 109, 148, 112, 0, 125, 111, 148, 109, + 148, 112, 0, 126, 111, 148, 109, 148, 112, 0, + 127, 111, 148, 109, 148, 112, 0, 103, 111, 148, + 109, 148, 112, 0, 104, 111, 148, 109, 148, 109, + 148, 112, 0, 105, 111, 148, 109, 148, 109, 148, + 112, 0, 150, 109, 148, 0, 148, 0, 32, 0, + 33, 0, 153, 0, 153, 173, 0, 153, 175, 0, + 153, 62, 61, 159, 0, 153, 25, 0, 154, 0, + 154, 132, 20, 141, 0, 154, 175, 0, 154, 62, + 61, 159, 0, 0, 154, 132, 133, 151, 148, 155, + 139, 0, 0, 154, 132, 50, 151, 143, 156, 139, + 0, 0, 154, 132, 45, 151, 143, 157, 139, 0, + 0, 154, 132, 47, 151, 143, 158, 139, 0, 154, + 51, 161, 0, 154, 58, 108, 162, 0, 0, 24, + 0, 56, 0, 55, 0, 53, 108, 160, 0, 54, + 108, 4, 0, 52, 108, 24, 0, 113, 163, 115, + 0, 163, 109, 24, 0, 24, 0, 0, 22, 0, + 24, 0, 164, 0, 0, 143, 165, 0, 167, 109, + 166, 0, 166, 0, 167, 0, 167, 109, 37, 0, + 37, 0, 0, 134, 141, 164, 111, 168, 112, 138, + 135, 0, 29, 0, 118, 0, 133, 169, 170, 0, + 30, 0, 119, 0, 182, 172, 0, 0, 45, 0, + 47, 0, 0, 31, 176, 174, 169, 0, 0, 63, + 0, 3, 0, 4, 0, 7, 0, 27, 0, 28, + 0, 38, 0, 39, 0, 26, 0, 116, 150, 117, + 0, 149, 0, 61, 177, 24, 109, 24, 0, 122, + 0, 164, 0, 179, 0, 178, 0, 143, 180, 0, + 182, 183, 0, 171, 183, 0, 184, 132, 185, 0, + 184, 187, 0, 0, 23, 0, 71, 181, 0, 71, + 8, 0, 72, 21, 180, 0, 72, 9, 180, 109, + 21, 180, 109, 21, 180, 0, 73, 130, 180, 109, + 21, 180, 113, 186, 115, 0, 73, 130, 180, 109, + 21, 180, 113, 115, 0, 74, 134, 141, 180, 111, + 190, 112, 36, 21, 180, 75, 21, 180, 0, 75, + 0, 76, 0, 186, 130, 178, 109, 21, 180, 0, + 130, 178, 109, 21, 180, 0, 132, 192, 0, 143, + 113, 180, 109, 180, 115, 0, 188, 109, 113, 180, + 109, 180, 115, 0, 181, 0, 189, 109, 181, 0, + 189, 0, 0, 60, 59, 0, 59, 0, 124, 143, + 180, 109, 180, 0, 125, 143, 180, 109, 180, 0, + 126, 143, 180, 109, 180, 0, 49, 181, 0, 127, + 181, 109, 181, 0, 98, 181, 36, 143, 0, 99, + 181, 109, 181, 109, 181, 0, 102, 181, 109, 143, + 0, 106, 181, 109, 143, 0, 107, 181, 109, 143, + 0, 103, 181, 109, 181, 0, 104, 181, 109, 181, + 109, 181, 0, 105, 181, 109, 181, 109, 181, 0, + 97, 188, 0, 191, 134, 141, 180, 111, 190, 112, + 0, 195, 0, 109, 189, 0, 0, 35, 0, 0, + 91, 143, 136, 0, 91, 143, 109, 15, 180, 136, + 0, 92, 143, 136, 0, 92, 143, 109, 15, 180, + 136, 0, 93, 181, 0, 194, 94, 143, 180, 0, + 194, 95, 181, 109, 143, 180, 0, 96, 143, 180, + 193, 0 +}; -#if defined (__STDC__) || defined (__cplusplus) - typedef signed char yysigned_char; -#else - typedef short int yysigned_char; #endif -/* YYFINAL -- State number of the termination state. */ -#define YYFINAL 4 -/* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 1330 - -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 122 -/* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 75 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 251 -/* YYNRULES -- Number of states. */ -#define YYNSTATES 514 - -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ -#define YYUNDEFTOK 2 -#define YYMAXUTOK 362 - -#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, - 111, 112, 120, 2, 109, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 116, 108, 117, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 113, 110, 115, 2, 2, 2, 2, 2, 121, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 114, 2, 2, 118, 2, 119, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107 +#if YYDEBUG != 0 +static const short yyrline[] = { 0, + 1088, 1089, 1097, 1098, 1108, 1108, 1108, 1108, 1108, 1109, + 1109, 1109, 1110, 1110, 1110, 1110, 1110, 1110, 1112, 1112, + 1116, 1116, 1116, 1116, 1117, 1117, 1117, 1117, 1118, 1118, + 1119, 1119, 1122, 1126, 1131, 1131, 1132, 1133, 1134, 1135, + 1136, 1137, 1140, 1140, 1141, 1142, 1143, 1144, 1145, 1146, + 1156, 1156, 1163, 1163, 1172, 1180, 1180, 1186, 1186, 1188, + 1193, 1207, 1207, 1208, 1208, 1210, 1220, 1220, 1220, 1220, + 1220, 1220, 1220, 1221, 1221, 1221, 1221, 1221, 1221, 1222, + 1226, 1230, 1238, 1246, 1259, 1264, 1276, 1286, 1290, 1299, + 1304, 1310, 1311, 1315, 1319, 1330, 1356, 1370, 1400, 1426, + 1447, 1460, 1470, 1475, 1536, 1543, 1552, 1558, 1564, 1568, + 1572, 1580, 1591, 1623, 1631, 1653, 1664, 1670, 1678, 1684, + 1690, 1699, 1703, 1711, 1711, 1721, 1729, 1734, 1738, 1742, + 1746, 1761, 1783, 1786, 1789, 1794, 1797, 1801, 1805, 1809, + 1813, 1818, 1822, 1825, 1828, 1832, 1845, 1846, 1848, 1852, + 1861, 1867, 1869, 1874, 1879, 1888, 1888, 1889, 1889, 1891, + 1898, 1904, 1911, 1915, 1921, 1926, 1931, 2026, 2026, 2028, + 2036, 2036, 2038, 2043, 2043, 2044, 2047, 2047, 2057, 2061, + 2066, 2070, 2074, 2078, 2082, 2086, 2090, 2094, 2098, 2123, + 2127, 2141, 2145, 2151, 2151, 2157, 2162, 2166, 2175, 2186, + 2191, 2203, 2216, 2220, 2224, 2229, 2238, 2257, 2266, 2322, + 2326, 2333, 2344, 2357, 2366, 2375, 2385, 2389, 2396, 2396, + 2398, 2402, 2407, 2423, 2438, 2452, 2465, 2473, 2481, 2489, + 2495, 2515, 2538, 2544, 2550, 2556, 2571, 2630, 2637, 2640, + 2645, 2649, 2656, 2661, 2667, 2672, 2678, 2686, 2698, 2713 }; +#endif -#if YYDEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const unsigned short int yyprhs[] = -{ - 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, - 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, - 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, - 59, 61, 63, 65, 67, 70, 71, 73, 75, 77, - 79, 81, 83, 85, 86, 87, 89, 91, 93, 95, - 97, 99, 102, 103, 106, 107, 111, 114, 115, 117, - 118, 122, 124, 127, 129, 131, 133, 135, 137, 139, - 141, 143, 145, 147, 149, 151, 153, 155, 157, 159, - 161, 163, 165, 167, 169, 172, 177, 183, 189, 193, - 196, 199, 201, 205, 207, 211, 213, 214, 219, 223, - 227, 232, 237, 241, 244, 247, 250, 253, 256, 259, - 262, 265, 268, 271, 278, 284, 293, 300, 307, 314, - 321, 328, 337, 346, 350, 352, 354, 356, 358, 361, - 364, 369, 372, 374, 379, 382, 387, 388, 396, 397, - 405, 406, 414, 415, 423, 427, 432, 433, 435, 437, - 439, 443, 447, 451, 455, 459, 461, 462, 464, 466, - 468, 469, 472, 476, 478, 480, 484, 486, 487, 496, - 498, 500, 504, 506, 508, 511, 512, 514, 516, 517, - 522, 523, 525, 527, 529, 531, 533, 535, 537, 539, - 541, 545, 547, 553, 555, 557, 559, 561, 564, 567, - 570, 574, 577, 578, 580, 583, 586, 590, 600, 610, - 619, 633, 635, 637, 644, 650, 653, 660, 668, 670, - 674, 676, 677, 680, 682, 688, 694, 700, 703, 708, - 713, 720, 725, 730, 735, 740, 747, 754, 757, 765, - 767, 770, 771, 773, 774, 778, 785, 789, 796, 799, - 804, 811 -}; -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const short int yyrhs[] = -{ - 153, 0, -1, 5, -1, 6, -1, 3, -1, 4, - -1, 77, -1, 78, -1, 79, -1, 80, -1, 81, - -1, 82, -1, 83, -1, 84, -1, 85, -1, 86, - -1, 87, -1, 88, -1, 89, -1, 90, -1, 100, - -1, 101, -1, 16, -1, 14, -1, 12, -1, 10, - -1, 17, -1, 15, -1, 13, -1, 11, -1, 129, - -1, 130, -1, 18, -1, 19, -1, 165, 108, -1, - -1, 41, -1, 42, -1, 43, -1, 44, -1, 45, - -1, 46, -1, 47, -1, -1, -1, 65, -1, 66, - -1, 67, -1, 68, -1, 69, -1, 70, -1, 64, - 4, -1, -1, 57, 4, -1, -1, 109, 57, 4, - -1, 34, 24, -1, -1, 138, -1, -1, 109, 141, - 140, -1, 138, -1, 57, 4, -1, 144, -1, 8, - -1, 146, -1, 8, -1, 146, -1, 9, -1, 10, - -1, 11, -1, 12, -1, 13, -1, 14, -1, 15, - -1, 16, -1, 17, -1, 18, -1, 19, -1, 20, - -1, 21, -1, 48, -1, 145, -1, 180, -1, 110, - 4, -1, 143, 111, 148, 112, -1, 113, 4, 114, - 146, 115, -1, 116, 4, 114, 146, 117, -1, 118, - 147, 119, -1, 118, 119, -1, 146, 120, -1, 146, - -1, 147, 109, 146, -1, 147, -1, 147, 109, 37, - -1, 37, -1, -1, 144, 113, 151, 115, -1, 144, - 113, 115, -1, 144, 121, 24, -1, 144, 116, 151, - 117, -1, 144, 118, 151, 119, -1, 144, 118, 119, - -1, 144, 38, -1, 144, 39, -1, 144, 180, -1, - 144, 150, -1, 144, 26, -1, 129, 124, -1, 130, - 4, -1, 9, 27, -1, 9, 28, -1, 132, 7, - -1, 98, 111, 149, 36, 144, 112, -1, 96, 111, - 149, 194, 112, -1, 99, 111, 149, 109, 149, 109, - 149, 112, -1, 125, 111, 149, 109, 149, 112, -1, - 126, 111, 149, 109, 149, 112, -1, 127, 111, 149, - 109, 149, 112, -1, 128, 111, 149, 109, 149, 112, - -1, 103, 111, 149, 109, 149, 112, -1, 104, 111, - 149, 109, 149, 109, 149, 112, -1, 105, 111, 149, - 109, 149, 109, 149, 112, -1, 151, 109, 149, -1, - 149, -1, 32, -1, 33, -1, 154, -1, 154, 174, - -1, 154, 176, -1, 154, 62, 61, 160, -1, 154, - 25, -1, 155, -1, 155, 133, 20, 142, -1, 155, - 176, -1, 155, 62, 61, 160, -1, -1, 155, 133, - 134, 152, 149, 156, 140, -1, -1, 155, 133, 50, - 152, 144, 157, 140, -1, -1, 155, 133, 45, 152, - 144, 158, 140, -1, -1, 155, 133, 47, 152, 144, - 159, 140, -1, 155, 51, 162, -1, 155, 58, 108, - 163, -1, -1, 24, -1, 56, -1, 55, -1, 53, - 108, 161, -1, 54, 108, 4, -1, 52, 108, 24, - -1, 113, 164, 115, -1, 164, 109, 24, -1, 24, - -1, -1, 22, -1, 24, -1, 165, -1, -1, 144, - 166, -1, 168, 109, 167, -1, 167, -1, 168, -1, - 168, 109, 37, -1, 37, -1, -1, 135, 142, 165, - 111, 169, 112, 139, 136, -1, 29, -1, 118, -1, - 134, 170, 171, -1, 30, -1, 119, -1, 183, 173, - -1, -1, 45, -1, 47, -1, -1, 31, 177, 175, - 170, -1, -1, 63, -1, 3, -1, 4, -1, 7, - -1, 27, -1, 28, -1, 38, -1, 39, -1, 26, - -1, 116, 151, 117, -1, 150, -1, 61, 178, 24, - 109, 24, -1, 123, -1, 165, -1, 180, -1, 179, - -1, 144, 181, -1, 183, 184, -1, 172, 184, -1, - 185, 133, 186, -1, 185, 188, -1, -1, 23, -1, - 71, 182, -1, 71, 8, -1, 72, 21, 181, -1, - 72, 9, 181, 109, 21, 181, 109, 21, 181, -1, - 73, 131, 181, 109, 21, 181, 113, 187, 115, -1, - 73, 131, 181, 109, 21, 181, 113, 115, -1, 74, - 135, 142, 181, 111, 191, 112, 36, 21, 181, 75, - 21, 181, -1, 75, -1, 76, -1, 187, 131, 179, - 109, 21, 181, -1, 131, 179, 109, 21, 181, -1, - 133, 193, -1, 144, 113, 181, 109, 181, 115, -1, - 189, 109, 113, 181, 109, 181, 115, -1, 182, -1, - 190, 109, 182, -1, 190, -1, -1, 60, 59, -1, - 59, -1, 125, 144, 181, 109, 181, -1, 126, 144, - 181, 109, 181, -1, 127, 144, 181, 109, 181, -1, - 49, 182, -1, 128, 182, 109, 182, -1, 98, 182, - 36, 144, -1, 99, 182, 109, 182, 109, 182, -1, - 102, 182, 109, 144, -1, 106, 182, 109, 144, -1, - 107, 182, 109, 144, -1, 103, 182, 109, 182, -1, - 104, 182, 109, 182, 109, 182, -1, 105, 182, 109, - 182, 109, 182, -1, 97, 189, -1, 192, 135, 142, - 181, 111, 191, 112, -1, 196, -1, 109, 190, -1, - -1, 35, -1, -1, 91, 144, 137, -1, 91, 144, - 109, 15, 181, 137, -1, 92, 144, 137, -1, 92, - 144, 109, 15, 181, 137, -1, 93, 182, -1, 195, - 94, 144, 181, -1, 195, 95, 182, 109, 144, 181, - -1, 96, 144, 181, 194, -1 -}; +#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const unsigned short int yyrline[] = -{ - 0, 1088, 1088, 1089, 1097, 1098, 1108, 1108, 1108, 1108, - 1108, 1109, 1109, 1109, 1110, 1110, 1110, 1110, 1110, 1110, - 1112, 1112, 1116, 1116, 1116, 1116, 1117, 1117, 1117, 1117, - 1118, 1118, 1119, 1119, 1122, 1126, 1131, 1132, 1133, 1134, - 1135, 1136, 1137, 1138, 1140, 1141, 1142, 1143, 1144, 1145, - 1146, 1147, 1156, 1157, 1163, 1164, 1172, 1180, 1181, 1186, - 1187, 1188, 1193, 1207, 1207, 1208, 1208, 1210, 1220, 1220, - 1220, 1220, 1220, 1220, 1220, 1221, 1221, 1221, 1221, 1221, - 1221, 1222, 1226, 1230, 1238, 1246, 1259, 1264, 1276, 1286, - 1290, 1299, 1304, 1310, 1311, 1315, 1319, 1330, 1356, 1370, - 1400, 1426, 1447, 1460, 1470, 1475, 1536, 1543, 1552, 1558, - 1564, 1568, 1572, 1580, 1591, 1623, 1631, 1653, 1664, 1670, - 1678, 1684, 1690, 1699, 1703, 1711, 1711, 1721, 1729, 1734, - 1738, 1742, 1746, 1761, 1783, 1786, 1789, 1789, 1797, 1797, - 1805, 1805, 1813, 1813, 1822, 1825, 1828, 1832, 1845, 1846, - 1848, 1852, 1861, 1867, 1869, 1874, 1879, 1888, 1888, 1889, - 1889, 1891, 1898, 1904, 1911, 1915, 1921, 1926, 1931, 2026, - 2026, 2028, 2036, 2036, 2038, 2043, 2044, 2045, 2047, 2047, - 2057, 2061, 2066, 2070, 2074, 2078, 2082, 2086, 2090, 2094, - 2098, 2123, 2127, 2141, 2145, 2151, 2151, 2157, 2162, 2166, - 2175, 2186, 2191, 2203, 2216, 2220, 2224, 2229, 2238, 2257, - 2266, 2322, 2326, 2333, 2344, 2357, 2366, 2375, 2385, 2389, - 2396, 2396, 2398, 2402, 2407, 2423, 2438, 2452, 2465, 2473, - 2481, 2489, 2495, 2515, 2538, 2544, 2550, 2556, 2571, 2630, - 2637, 2640, 2645, 2649, 2656, 2661, 2667, 2672, 2678, 2686, - 2698, 2713 +static const char * const yytname[] = { "$","error","$undefined.","ESINT64VAL", +"EUINT64VAL","SINTVAL","UINTVAL","FPVAL","VOID","BOOL","SBYTE","UBYTE","SHORT", +"USHORT","INT","UINT","LONG","ULONG","FLOAT","DOUBLE","TYPE","LABEL","VAR_ID", +"LABELSTR","STRINGCONSTANT","IMPLEMENTATION","ZEROINITIALIZER","TRUETOK","FALSETOK", +"BEGINTOK","ENDTOK","DECLARE","GLOBAL","CONSTANT","SECTION","VOLATILE","TO", +"DOTDOTDOT","NULL_TOK","UNDEF","CONST","INTERNAL","LINKONCE","WEAK","APPENDING", +"DLLIMPORT","DLLEXPORT","EXTERN_WEAK","OPAQUE","NOT","EXTERNAL","TARGET","TRIPLE", +"ENDIAN","POINTERSIZE","LITTLE","BIG","ALIGN","DEPLIBS","CALL","TAIL","ASM_TOK", +"MODULE","SIDEEFFECT","CC_TOK","CCC_TOK","CSRETCC_TOK","FASTCC_TOK","COLDCC_TOK", +"X86_STDCALLCC_TOK","X86_FASTCALLCC_TOK","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", +"SHUFFLEVECTOR","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","@3", +"@4","AsmBlock","BigOrLittle","TargetDefinition","LibrariesDefinition","LibList", +"Name","OptName","ArgVal","ArgListH","ArgList","FunctionHeaderH","BEGIN","FunctionHeader", +"END","Function","FnDeclareLinkage","FunctionProto","@5","OptSideEffect","ConstValueRef", +"SymbolicValueRef","ValueRef","ResolvedVal","BasicBlockList","BasicBlock","InstructionList", +"BBTerminatorInst","JumpTable","Inst","PHIList","ValueRefList","ValueRefListE", +"OptTailCall","InstVal","IndexList","OptVolatile","MemoryInst", NULL }; #endif -#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE -/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ -static const char *const yytname[] = -{ - "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "SINTVAL", - "UINTVAL", "FPVAL", "VOID", "BOOL", "SBYTE", "UBYTE", "SHORT", "USHORT", - "INT", "UINT", "LONG", "ULONG", "FLOAT", "DOUBLE", "TYPE", "LABEL", - "VAR_ID", "LABELSTR", "STRINGCONSTANT", "IMPLEMENTATION", - "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK", - "DECLARE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO", - "DOTDOTDOT", "NULL_TOK", "UNDEF", "CONST", "INTERNAL", "LINKONCE", - "WEAK", "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE", - "NOT", "EXTERNAL", "TARGET", "TRIPLE", "ENDIAN", "POINTERSIZE", "LITTLE", - "BIG", "ALIGN", "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE", - "SIDEEFFECT", "CC_TOK", "CCC_TOK", "CSRETCC_TOK", "FASTCC_TOK", - "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "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", "SHUFFLEVECTOR", "VAARG_old", "VANEXT_old", "'='", - "','", "'\\\\'", "'('", "')'", "'['", "'x'", "']'", "'<'", "'>'", "'{'", - "'}'", "'*'", "'c'", "$accept", "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", "@3", "@4", "AsmBlock", "BigOrLittle", - "TargetDefinition", "LibrariesDefinition", "LibList", "Name", "OptName", - "ArgVal", "ArgListH", "ArgList", "FunctionHeaderH", "BEGIN", - "FunctionHeader", "END", "Function", "FnDeclareLinkage", "FunctionProto", - "@5", "OptSideEffect", "ConstValueRef", "SymbolicValueRef", "ValueRef", - "ResolvedVal", "BasicBlockList", "BasicBlock", "InstructionList", - "BBTerminatorInst", "JumpTable", "Inst", "PHIList", "ValueRefList", - "ValueRefListE", "OptTailCall", "InstVal", "IndexList", "OptVolatile", - "MemoryInst", 0 +static const short yyr1[] = { 0, + 122, 122, 123, 123, 124, 124, 124, 124, 124, 125, + 125, 125, 126, 126, 126, 126, 126, 126, 127, 127, + 128, 128, 128, 128, 129, 129, 129, 129, 130, 130, + 131, 131, 132, 132, 133, 133, 133, 133, 133, 133, + 133, 133, 134, 134, 134, 134, 134, 134, 134, 134, + 135, 135, 136, 136, 137, 138, 138, 139, 139, 140, + 140, 141, 141, 142, 142, 143, 144, 144, 144, 144, + 144, 144, 144, 144, 144, 144, 144, 144, 144, 145, + 145, 145, 145, 145, 145, 145, 145, 145, 145, 146, + 146, 147, 147, 147, 147, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, + 148, 149, 149, 149, 149, 149, 149, 149, 149, 149, + 149, 150, 150, 151, 151, 152, 153, 153, 153, 153, + 153, 154, 154, 154, 155, 154, 156, 154, 157, 154, + 158, 154, 154, 154, 154, 159, 160, 160, 161, 161, + 161, 162, 163, 163, 163, 164, 164, 165, 165, 166, + 167, 167, 168, 168, 168, 168, 169, 170, 170, 171, + 172, 172, 173, 174, 174, 174, 176, 175, 177, 177, + 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, + 178, 179, 179, 180, 180, 181, 182, 182, 183, 184, + 184, 184, 185, 185, 185, 185, 185, 185, 185, 185, + 185, 186, 186, 187, 188, 188, 189, 189, 190, 190, + 191, 191, 192, 192, 192, 192, 192, 192, 192, 192, + 192, 192, 192, 192, 192, 192, 192, 192, 193, 193, + 194, 194, 195, 195, 195, 195, 195, 195, 195, 195 }; -#endif -# ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ -static const unsigned short int yytoknum[] = -{ - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, - 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, - 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, - 355, 356, 357, 358, 359, 360, 361, 362, 61, 44, - 92, 40, 41, 91, 120, 93, 60, 62, 123, 125, - 42, 99 +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, 1, 1, + 1, 0, 0, 1, 1, 1, 1, 1, 1, 2, + 0, 2, 0, 3, 2, 0, 1, 0, 3, 1, + 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 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, 8, + 8, 3, 1, 1, 1, 1, 2, 2, 4, 2, + 1, 4, 2, 4, 0, 7, 0, 7, 0, 7, + 0, 7, 3, 4, 0, 1, 1, 1, 3, 3, + 3, 3, 3, 1, 0, 1, 1, 1, 0, 2, + 3, 1, 1, 3, 1, 0, 8, 1, 1, 3, + 1, 1, 2, 0, 1, 1, 0, 4, 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, 6, 2, 7, 1, 2, 0, + 1, 0, 3, 6, 3, 6, 2, 4, 6, 4 }; -# endif -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const unsigned char yyr1[] = -{ - 0, 122, 123, 123, 124, 124, 125, 125, 125, 125, - 125, 126, 126, 126, 127, 127, 127, 127, 127, 127, - 128, 128, 129, 129, 129, 129, 130, 130, 130, 130, - 131, 131, 132, 132, 133, 133, 134, 134, 134, 134, - 134, 134, 134, 134, 135, 135, 135, 135, 135, 135, - 135, 135, 136, 136, 137, 137, 138, 139, 139, 140, - 140, 141, 141, 142, 142, 143, 143, 144, 145, 145, - 145, 145, 145, 145, 145, 145, 145, 145, 145, 145, - 145, 146, 146, 146, 146, 146, 146, 146, 146, 146, - 146, 147, 147, 148, 148, 148, 148, 149, 149, 149, - 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, - 149, 149, 149, 150, 150, 150, 150, 150, 150, 150, - 150, 150, 150, 151, 151, 152, 152, 153, 154, 154, - 154, 154, 154, 155, 155, 155, 156, 155, 157, 155, - 158, 155, 159, 155, 155, 155, 155, 160, 161, 161, - 162, 162, 162, 163, 164, 164, 164, 165, 165, 166, - 166, 167, 168, 168, 169, 169, 169, 169, 170, 171, - 171, 172, 173, 173, 174, 175, 175, 175, 177, 176, - 178, 178, 179, 179, 179, 179, 179, 179, 179, 179, - 179, 179, 179, 180, 180, 181, 181, 182, 183, 183, - 184, 185, 185, 185, 186, 186, 186, 186, 186, 186, - 186, 186, 186, 187, 187, 188, 189, 189, 190, 190, - 191, 191, 192, 192, 193, 193, 193, 193, 193, 193, - 193, 193, 193, 193, 193, 193, 193, 193, 193, 193, - 194, 194, 195, 195, 196, 196, 196, 196, 196, 196, - 196, 196 +static const short yydefact[] = { 145, + 42, 131, 130, 177, 35, 36, 37, 38, 39, 40, + 41, 0, 43, 201, 127, 128, 201, 156, 157, 0, + 0, 0, 42, 0, 133, 174, 0, 0, 44, 45, + 46, 47, 48, 49, 0, 0, 202, 198, 34, 171, + 172, 173, 197, 0, 0, 0, 143, 0, 0, 0, + 0, 0, 0, 0, 33, 175, 176, 43, 146, 129, + 50, 1, 2, 63, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 80, 0, 0, + 0, 0, 192, 0, 0, 62, 81, 66, 193, 82, + 168, 169, 170, 242, 200, 0, 0, 0, 155, 144, + 134, 132, 124, 125, 0, 0, 0, 0, 178, 83, + 0, 0, 65, 88, 90, 0, 0, 95, 89, 241, + 0, 222, 0, 0, 0, 0, 43, 210, 211, 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, 0, 199, 43, 214, 0, 238, 151, 148, 147, + 149, 150, 154, 0, 139, 141, 137, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 0, 0, + 0, 0, 135, 0, 0, 0, 87, 166, 94, 92, + 0, 0, 226, 221, 204, 203, 0, 0, 24, 28, + 23, 27, 22, 26, 21, 25, 29, 30, 0, 0, + 53, 53, 247, 0, 0, 236, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 152, 58, 58, 58, 109, 110, 3, 4, + 107, 108, 111, 106, 102, 103, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 105, 104, 58, 64, 64, 91, 165, 159, 162, 163, + 0, 0, 84, 181, 182, 183, 188, 184, 185, 186, + 187, 179, 0, 190, 195, 194, 196, 0, 205, 0, + 0, 0, 243, 0, 245, 240, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 153, 0, 140, 142, 138, 0, 0, + 0, 0, 0, 0, 97, 123, 0, 0, 101, 0, + 98, 0, 0, 0, 0, 136, 85, 86, 158, 160, + 0, 56, 93, 180, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 250, 0, 0, 228, 0, 230, 233, + 0, 0, 231, 232, 0, 0, 0, 227, 0, 248, + 0, 0, 0, 60, 58, 240, 0, 0, 0, 0, + 0, 0, 96, 99, 100, 0, 0, 0, 0, 164, + 161, 57, 51, 0, 189, 0, 0, 220, 53, 54, + 53, 217, 239, 0, 0, 0, 0, 0, 223, 224, + 225, 220, 0, 55, 61, 59, 0, 0, 0, 0, + 0, 0, 122, 0, 0, 0, 0, 0, 167, 0, + 0, 0, 219, 0, 0, 244, 246, 0, 0, 0, + 229, 234, 235, 0, 249, 113, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 52, 191, 0, 0, 0, + 218, 215, 0, 237, 112, 0, 119, 0, 0, 115, + 116, 117, 118, 0, 208, 0, 0, 0, 216, 0, + 0, 0, 206, 0, 207, 0, 0, 114, 120, 121, + 0, 0, 0, 0, 0, 0, 213, 0, 0, 212, + 209, 0, 0, 0 }; -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const unsigned char yyr2[] = -{ - 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, - 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, - 1, 2, 0, 2, 0, 3, 2, 0, 1, 0, - 3, 1, 2, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 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, 8, 8, 3, 1, 1, 1, 1, 2, 2, - 4, 2, 1, 4, 2, 4, 0, 7, 0, 7, - 0, 7, 0, 7, 3, 4, 0, 1, 1, 1, - 3, 3, 3, 3, 3, 1, 0, 1, 1, 1, - 0, 2, 3, 1, 1, 3, 1, 0, 8, 1, - 1, 3, 1, 1, 2, 0, 1, 1, 0, 4, - 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, 6, 2, 7, 1, - 2, 0, 1, 0, 3, 6, 3, 6, 2, 4, - 6, 4 +static const short yydefgoto[] = { 83, + 251, 267, 268, 269, 270, 189, 190, 219, 191, 23, + 13, 35, 439, 303, 384, 403, 326, 385, 84, 85, + 192, 87, 88, 116, 201, 336, 294, 337, 105, 512, + 1, 2, 273, 246, 244, 245, 60, 171, 47, 100, + 174, 89, 350, 279, 280, 281, 36, 93, 14, 42, + 15, 58, 16, 26, 355, 295, 90, 297, 412, 17, + 38, 39, 163, 487, 95, 226, 443, 444, 164, 165, + 364, 166, 167 }; -/* 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[] = -{ - 146, 0, 43, 132, 1, 131, 178, 36, 37, 38, - 39, 40, 41, 42, 0, 44, 202, 128, 129, 202, - 157, 158, 0, 0, 0, 43, 0, 134, 175, 0, - 0, 45, 46, 47, 48, 49, 50, 0, 0, 203, - 199, 35, 172, 173, 174, 198, 0, 0, 0, 144, - 0, 0, 0, 0, 0, 0, 0, 34, 176, 177, - 44, 147, 130, 51, 2, 3, 64, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - 81, 0, 0, 0, 0, 193, 0, 0, 63, 82, - 67, 194, 83, 169, 170, 171, 243, 201, 0, 0, - 0, 156, 145, 135, 133, 125, 126, 0, 0, 0, - 0, 179, 84, 0, 0, 66, 89, 91, 0, 0, - 96, 90, 242, 0, 223, 0, 0, 0, 0, 44, - 211, 212, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 0, 0, 0, 0, - 0, 0, 0, 20, 21, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 200, 44, 215, 0, 239, - 152, 149, 148, 150, 151, 155, 0, 140, 142, 138, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 0, 0, 0, 0, 136, 0, 0, 0, 88, - 167, 95, 93, 0, 0, 227, 222, 205, 204, 0, - 0, 25, 29, 24, 28, 23, 27, 22, 26, 30, - 31, 0, 0, 54, 54, 248, 0, 0, 237, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 153, 59, 59, 59, 110, - 111, 4, 5, 108, 109, 112, 107, 103, 104, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 106, 105, 59, 65, 65, 92, 166, - 160, 163, 164, 0, 0, 85, 182, 183, 184, 189, - 185, 186, 187, 188, 180, 0, 191, 196, 195, 197, - 0, 206, 0, 0, 0, 244, 0, 246, 241, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 154, 0, 141, 143, - 139, 0, 0, 0, 0, 0, 0, 98, 124, 0, - 0, 102, 0, 99, 0, 0, 0, 0, 137, 86, - 87, 159, 161, 0, 57, 94, 181, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 251, 0, 0, 229, - 0, 231, 234, 0, 0, 232, 233, 0, 0, 0, - 228, 0, 249, 0, 0, 0, 61, 59, 241, 0, - 0, 0, 0, 0, 0, 97, 100, 101, 0, 0, - 0, 0, 165, 162, 58, 52, 0, 190, 0, 0, - 221, 54, 55, 54, 218, 240, 0, 0, 0, 0, - 0, 224, 225, 226, 221, 0, 56, 62, 60, 0, - 0, 0, 0, 0, 0, 123, 0, 0, 0, 0, - 0, 168, 0, 0, 0, 220, 0, 0, 245, 247, - 0, 0, 0, 230, 235, 236, 0, 250, 114, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 53, 192, - 0, 0, 0, 219, 216, 0, 238, 113, 0, 120, - 0, 0, 116, 117, 118, 119, 0, 209, 0, 0, - 0, 217, 0, 0, 0, 207, 0, 208, 0, 0, - 115, 121, 122, 0, 0, 0, 0, 0, 0, 214, - 0, 0, 213, 210 +static const short yypact[] = {-32768, + 194, 602,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, +-32768, -20, 38, 59,-32768,-32768, -18,-32768,-32768, 13, + -8, 75, 115, 58,-32768, 40, 124, 163,-32768,-32768, +-32768,-32768,-32768,-32768, 1052, -22,-32768,-32768, -3,-32768, +-32768,-32768,-32768, 60, 65, 67,-32768, 57, 124, 1052, + 62, 62, 62, 62,-32768,-32768,-32768, 38,-32768,-32768, +-32768,-32768,-32768, 61,-32768,-32768,-32768,-32768,-32768,-32768, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 167, 172, + 173, 569,-32768, -3, 68,-32768,-32768, -30,-32768,-32768, +-32768,-32768,-32768, 1223,-32768, 159, 42, 180, 162,-32768, +-32768,-32768,-32768,-32768, 1093, 1093, 1093, 1134,-32768,-32768, + 73, 74,-32768,-32768, -30, -75, 78, 847,-32768,-32768, + 1093,-32768, 132, 1175, 14, 185, 38,-32768,-32768,-32768, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, +-32768,-32768,-32768, 1093, 1093, 1093, 1093, 1093, 1093, 1093, +-32768,-32768, 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, + 1093, 1093,-32768, 38,-32768, 22,-32768,-32768,-32768,-32768, +-32768,-32768,-32768, -47,-32768,-32768,-32768, 111, 137, 199, + 140, 203, 142, 204, 147, 205, 210, 211, 151, 206, + 213, 412,-32768, 1093, 1093, 1093,-32768, 888,-32768, 103, + 110, 635,-32768,-32768, 61,-32768, 635, 635,-32768,-32768, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 635, 1052, + 114, 117,-32768, 635, 134, 118, 188, 119, 139, 141, + 144, 145, 146, 148, 635, 635, 635, 149, 1052, 1093, + 1093, 225,-32768, 150, 150, 150,-32768,-32768,-32768,-32768, +-32768,-32768,-32768,-32768,-32768,-32768, 152, 153, 154, 157, + 158, 175, 929, 1134, 589, 227, 176, 178, 179, 182, +-32768,-32768, 150, -51, -72, -30,-32768, -3,-32768, 161, + 183, 970,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, +-32768, 197, 1134,-32768,-32768,-32768,-32768, 164,-32768, 187, + 635, -4,-32768, 3,-32768, 189, 635, 171, 1093, 1093, + 1093, 1093, 1093, 1093, 1093, 1093, 193, 195, 200, 1093, + 635, 635, 201,-32768, -17,-32768,-32768,-32768, 1134, 1134, + 1134, 1134, 1134, 1134,-32768,-32768, -16, -26,-32768, -73, +-32768, 1134, 1134, 1134, 1134,-32768,-32768,-32768,-32768,-32768, + 1011, 228,-32768,-32768, 237, -25, 270, 273, 186, 635, + 299, 635, 1093,-32768, 214, 635,-32768, 215,-32768,-32768, + 216, 217,-32768,-32768, 635, 635, 635,-32768, 202,-32768, + 1093, 282, 304,-32768, 150, 189, 276, 218, 224, 229, + 230, 1134,-32768,-32768,-32768, 231, 232, 233, 234,-32768, +-32768,-32768, 257, 238,-32768, 635, 635, 1093, 239,-32768, + 239,-32768, 241, 635, 244, 1093, 1093, 1093,-32768,-32768, +-32768, 1093, 635,-32768,-32768,-32768, 242, 1093, 1134, 1134, + 1134, 1134,-32768, 1134, 1134, 1134, 1134, 311,-32768, 331, + 247, 245, 241, 248, 300,-32768,-32768, 1093, 246, 635, +-32768,-32768,-32768, 252,-32768,-32768, 254, 258, 260, 261, + 265, 263, 268, 272, 277,-32768,-32768, 348, 16, 341, +-32768,-32768, 275,-32768,-32768, 1134,-32768, 1134, 1134,-32768, +-32768,-32768,-32768, 635,-32768, 738, 63, 367,-32768, 279, + 280, 284,-32768, 285,-32768, 738, 635,-32768,-32768,-32768, + 376, 289, 324, 635, 379, 380,-32768, 635, 635,-32768, +-32768, 402, 403,-32768 }; -/* YYDEFGOTO[NTERM-NUM]. */ -static const short int yydefgoto[] = -{ - -1, 85, 253, 269, 270, 271, 272, 191, 192, 221, - 193, 25, 15, 37, 441, 305, 386, 405, 328, 387, - 86, 87, 194, 89, 90, 118, 203, 338, 296, 339, - 107, 1, 2, 3, 275, 248, 246, 247, 62, 173, - 49, 102, 176, 91, 352, 281, 282, 283, 38, 95, - 16, 44, 17, 60, 18, 28, 357, 297, 92, 299, - 414, 19, 40, 41, 165, 489, 97, 228, 445, 446, - 166, 167, 366, 168, 169 +static const short yypgoto[] = {-32768, +-32768, 310, 312, 313, 314, -125, -124, -449,-32768, 366, + 386, -103,-32768, -219, 69,-32768, -236,-32768, -46,-32768, + -35,-32768, -66, 292,-32768, -100, 219, -251, 80,-32768, +-32768,-32768,-32768,-32768,-32768,-32768, 363,-32768,-32768,-32768, +-32768, 4,-32768, 71,-32768,-32768, 356,-32768,-32768,-32768, +-32768,-32768, 413,-32768,-32768, -447, -55, 64, -99,-32768, + 399,-32768,-32768,-32768,-32768,-32768, 56, -2,-32768,-32768, + 37,-32768,-32768 }; -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -428 -static const short int yypact[] = -{ - -428, 45, 194, 602, -428, -428, -428, -428, -428, -428, - -428, -428, -428, -428, 26, 14, 85, -428, -428, -13, - -428, -428, 91, 28, 90, 49, 33, -428, 21, 155, - 158, -428, -428, -428, -428, -428, -428, 1052, -20, -428, - -428, 80, -428, -428, -428, -428, 75, 76, 79, -428, - 73, 155, 1052, 84, 84, 84, 84, -428, -428, -428, - 14, -428, -428, -428, -428, -428, 77, -428, -428, -428, - -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, - -428, 185, 187, 191, 569, -428, 80, 86, -428, -428, - -44, -428, -428, -428, -428, -428, 1223, -428, 175, 78, - 192, 176, -428, -428, -428, -428, -428, 1093, 1093, 1093, - 1134, -428, -428, 87, 88, -428, -428, -44, -95, 92, - 847, -428, -428, 1093, -428, 139, 1175, 52, 144, 14, - -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, - -428, -428, -428, -428, -428, -428, 1093, 1093, 1093, 1093, - 1093, 1093, 1093, -428, -428, 1093, 1093, 1093, 1093, 1093, - 1093, 1093, 1093, 1093, 1093, -428, 14, -428, 44, -428, - -428, -428, -428, -428, -428, -428, -12, -428, -428, -428, - 138, 164, 203, 167, 204, 169, 205, 172, 206, 210, - 211, 174, 208, 213, 412, -428, 1093, 1093, 1093, -428, - 888, -428, 113, 111, 635, -428, -428, 77, -428, 635, - 635, -428, -428, -428, -428, -428, -428, -428, -428, -428, - -428, 635, 1052, 115, 117, -428, 635, 114, 119, 212, - 140, 141, 142, 145, 146, 148, 149, 635, 635, 635, - 150, 1052, 1093, 1093, 223, -428, 151, 151, 151, -428, - -428, -428, -428, -428, -428, -428, -428, -428, -428, 152, - 153, 154, 157, 159, 162, 929, 1134, 589, 229, 173, - 178, 179, 180, -428, -428, 151, -15, 15, -44, -428, - 80, -428, 160, 181, 970, -428, -428, -428, -428, -428, - -428, -428, -428, -428, 198, 1134, -428, -428, -428, -428, - 177, -428, 186, 635, -4, -428, 3, -428, 188, 635, - 183, 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, 189, - 193, 195, 1093, 635, 635, 197, -428, -11, -428, -428, - -428, 1134, 1134, 1134, 1134, 1134, 1134, -428, -428, -8, - -96, -428, -45, -428, 1134, 1134, 1134, 1134, -428, -428, - -428, -428, -428, 1011, 228, -428, -428, 263, -32, 273, - 282, 199, 635, 304, 635, 1093, -428, 200, 635, -428, - 214, -428, -428, 215, 216, -428, -428, 635, 635, 635, - -428, 201, -428, 1093, 289, 310, -428, 151, 188, 279, - 217, 218, 224, 230, 1134, -428, -428, -428, 231, 232, - 233, 234, -428, -428, -428, 281, 238, -428, 635, 635, - 1093, 239, -428, 239, -428, 241, 635, 244, 1093, 1093, - 1093, -428, -428, -428, 1093, 635, -428, -428, -428, 242, - 1093, 1134, 1134, 1134, 1134, -428, 1134, 1134, 1134, 1134, - 351, -428, 332, 248, 245, 241, 249, 303, -428, -428, - 1093, 251, 635, -428, -428, -428, 252, -428, -428, 255, - 260, 258, 265, 266, 268, 272, 276, 277, -428, -428, - 356, 16, 336, -428, -428, 275, -428, -428, 1134, -428, - 1134, 1134, -428, -428, -428, -428, 635, -428, 738, 25, - 370, -428, 280, 284, 285, -428, 290, -428, 738, 635, - -428, -428, -428, 373, 291, 323, 635, 380, 381, -428, - 635, 635, -428, -428 -}; -/* YYPGOTO[NTERM-NUM]. */ -static const short int yypgoto[] = -{ - -428, -428, -428, 307, 308, 309, 311, -127, -126, -427, - -428, 365, 383, -117, -428, -221, 55, -428, -241, -428, - -48, -428, -37, -428, -68, 292, -428, -102, 220, -247, - 94, -428, -428, -428, -428, -428, -428, -428, 359, -428, - -428, -428, -428, 2, -428, 58, -428, -428, 355, -428, - -428, -428, -428, -428, 413, -428, -428, -423, -57, 62, - -101, -428, 400, -428, -428, -428, -428, -428, 56, -2, - -428, -428, 32, -428, -428 -}; +#define YYLAST 1330 -/* 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 -128 -static const short int yytable[] = -{ - 88, 219, 220, 307, 104, 26, 329, 330, 195, 93, - 39, 362, 222, 394, 198, 88, 117, 42, 364, 340, - 342, 396, 205, 384, 199, 208, 211, 212, 213, 214, - 215, 216, 217, 218, 348, 211, 212, 213, 214, 215, - 216, 217, 218, 26, 488, 4, 385, 225, 358, 241, - 229, 230, 117, 363, 231, 232, 233, 234, 235, 236, - 363, 209, 498, 240, 394, 496, 58, -65, 59, 52, - 177, 178, 179, 210, 397, 504, 121, 394, 30, 31, - 32, 33, 34, 35, 36, 407, 204, 29, 119, 204, - 7, 8, 9, 10, 53, 12, 54, 244, 94, 55, - 349, 394, 20, 245, 21, 121, 43, 395, 39, 223, - 224, 204, 226, 227, 204, 204, 105, 106, 204, 204, - 204, 204, 204, 204, 237, 238, 239, 204, 276, 277, - 278, 487, 350, 171, 172, 121, 50, 274, 242, 243, - 497, 57, 325, 46, 47, 48, 428, 298, 108, 109, - 110, 51, 298, 298, 211, 212, 213, 214, 215, 216, - 217, 218, 63, 280, 298, 249, 250, -25, -25, 298, - -24, -24, -23, -23, 303, -22, -22, 251, 252, 61, - 298, 298, 298, 98, 99, 88, 101, 100, -66, 112, - 448, 113, 449, 323, -127, 114, 174, 120, 206, 170, - 175, 196, 197, 200, 88, 324, 204, -29, -28, -27, - -26, 370, 254, 372, 373, 374, 278, -32, -33, 5, - 255, 380, 284, 285, 304, 6, 306, 309, 310, 388, - 389, 390, 391, 392, 393, 7, 8, 9, 10, 11, - 12, 13, 398, 399, 400, 401, 298, 326, 311, 312, - 313, 314, 298, 343, 315, 316, 14, 317, 318, 322, - 327, 356, 384, 331, 332, 333, 298, 298, 334, 353, - 335, 300, 301, 336, 369, 204, 371, 204, 204, 204, - 375, 376, 351, 302, 344, 204, 359, 406, 308, 345, - 346, 347, 435, 354, 408, 360, 368, 365, 377, 319, - 320, 321, 378, 409, 379, 298, 383, 298, 412, 416, - 410, 298, 424, 426, 427, 430, 280, 453, 454, 455, - 298, 298, 298, 418, 419, 420, 431, 432, 204, 460, - 461, 462, 463, 433, 464, 465, 466, 467, 440, 434, - 436, 437, 438, 439, 219, 220, 425, 442, 447, 473, - 450, 298, 298, 452, 458, 468, 469, 470, 471, 298, - 363, 472, 219, 220, 476, 361, 474, 477, 298, 478, - 479, 367, 490, 204, 480, 481, 492, 486, 493, 494, - 482, 204, 204, 204, 483, 381, 382, 204, 484, 485, - 491, 499, 500, 459, 506, 298, 501, 502, 508, 503, - 507, 510, 511, 161, 162, 163, 96, 164, 56, 404, - 103, 403, 202, 204, 273, 111, 27, 64, 65, 45, - 429, 415, 456, 0, 411, 0, 413, 0, 0, 298, - 417, 0, 0, 0, 20, 0, 21, 0, 256, 421, - 422, 423, 298, 0, 0, 0, 0, 0, 0, 298, - 257, 258, 0, 298, 298, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 443, 444, 0, 0, 0, 0, 0, 0, 451, 0, - 0, 0, 0, 0, 0, 0, 0, 457, 0, 132, - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 0, 0, 0, 0, 0, 259, 0, - 260, 261, 153, 154, 475, 262, 263, 264, 0, 0, - 0, 0, 0, 0, 0, 265, 0, 0, 266, 0, - 267, 0, 0, 268, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 495, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 505, 0, 0, 0, 0, 0, 0, 509, 0, - 0, 0, 512, 513, 64, 65, 0, 115, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - 79, 20, 0, 21, 64, 65, 0, 115, 180, 181, - 182, 183, 184, 185, 186, 187, 188, 189, 190, 78, - 79, 20, 0, 21, 0, 0, 0, 80, 0, 0, - 0, 0, -35, 0, 20, 0, 21, 0, 0, 0, - 0, 0, 0, 6, -35, -35, 0, 80, 286, 287, - 64, 65, 288, -35, -35, -35, -35, -35, -35, -35, - 0, 0, -35, 22, 0, 0, 0, 20, 0, 21, - 23, 289, 290, 291, 24, 0, 0, 0, 0, 0, - 0, 0, 0, 292, 293, 0, 0, 0, 0, 81, - 0, 0, 82, 0, 0, 83, 0, 84, 116, 0, - 0, 0, 0, 0, 0, 0, 294, 0, 0, 81, - 0, 0, 82, 0, 0, 83, 0, 84, 341, 0, - 0, 0, 132, 133, 134, 135, 136, 137, 138, 139, - 140, 141, 142, 143, 144, 145, 0, 0, 0, 0, - 0, 259, 0, 260, 261, 153, 154, 0, 262, 263, - 264, 286, 287, 0, 0, 288, 0, 0, 0, 0, - 0, 295, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 289, 290, 291, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 292, 293, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 294, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 132, 133, 134, 135, 136, - 137, 138, 139, 140, 141, 142, 143, 144, 145, 0, - 0, 0, 0, 0, 259, 0, 260, 261, 153, 154, - 0, 262, 263, 264, 0, 0, 0, 0, 0, 0, - 0, 0, 64, 65, 295, 115, 67, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, 78, 79, 20, - 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 201, 0, 0, 0, 0, 0, - 0, 0, 0, 64, 65, 80, 115, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 20, 0, 21, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 279, 0, 0, 0, 0, - 0, 0, 0, 0, 64, 65, 80, 115, 180, 181, - 182, 183, 184, 185, 186, 187, 188, 189, 190, 78, - 79, 20, 0, 21, 0, 0, 0, 81, 0, 0, - 82, 0, 0, 83, 0, 84, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 64, 65, 80, 115, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 20, 0, 21, 0, 0, 0, 81, 0, - 0, 82, 0, 0, 83, 0, 84, 355, 0, 0, - 0, 0, 0, 0, 0, 0, 64, 65, 80, 115, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 20, 0, 21, 0, 0, 0, 81, - 0, 0, 82, 0, 337, 83, 0, 84, 402, 0, - 0, 0, 0, 0, 0, 0, 0, 64, 65, 80, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 20, 0, 21, 0, 0, 0, - 81, 0, 0, 82, 0, 0, 83, 0, 84, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 64, 65, - 80, 115, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 20, 0, 21, 0, 0, - 0, 81, 0, 0, 82, 0, 0, 83, 0, 84, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, - 65, 80, 115, 180, 181, 182, 183, 184, 185, 186, - 187, 188, 189, 190, 78, 79, 20, 0, 21, 0, - 0, 0, 81, 0, 0, 82, 0, 0, 83, 0, - 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 64, 65, 80, 207, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 20, 0, 21, - 0, 0, 0, 81, 0, 0, 82, 0, 0, 83, - 0, 84, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 80, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 81, 0, 0, 82, 0, 0, - 83, 0, 84, 0, 0, 0, 0, 0, 122, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 123, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 124, 125, 0, 81, 0, 0, 82, 0, - 0, 83, 0, 84, 126, 127, 128, 129, 130, 131, - 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, - 142, 143, 144, 145, 146, 147, 148, 0, 0, 149, - 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, - 160 -}; -static const short int yycheck[] = -{ - 37, 128, 128, 224, 52, 3, 247, 248, 110, 29, - 23, 15, 129, 109, 109, 52, 84, 30, 15, 266, - 267, 117, 123, 34, 119, 126, 10, 11, 12, 13, - 14, 15, 16, 17, 275, 10, 11, 12, 13, 14, - 15, 16, 17, 41, 471, 0, 57, 148, 295, 166, - 151, 152, 120, 57, 155, 156, 157, 158, 159, 160, - 57, 9, 489, 164, 109, 488, 45, 111, 47, 20, - 107, 108, 109, 21, 119, 498, 120, 109, 64, 65, - 66, 67, 68, 69, 70, 117, 123, 61, 86, 126, - 41, 42, 43, 44, 45, 46, 47, 109, 118, 50, - 115, 109, 22, 115, 24, 120, 119, 115, 23, 146, - 147, 148, 149, 150, 151, 152, 32, 33, 155, 156, - 157, 158, 159, 160, 161, 162, 163, 164, 196, 197, - 198, 115, 117, 55, 56, 120, 108, 194, 94, 95, - 115, 108, 243, 52, 53, 54, 387, 204, 54, 55, - 56, 61, 209, 210, 10, 11, 12, 13, 14, 15, - 16, 17, 4, 200, 221, 27, 28, 3, 4, 226, - 3, 4, 3, 4, 222, 3, 4, 3, 4, 24, - 237, 238, 239, 108, 108, 222, 113, 108, 111, 4, - 411, 4, 413, 241, 0, 4, 4, 111, 59, 24, - 24, 114, 114, 111, 241, 242, 243, 4, 4, 4, - 4, 312, 4, 314, 315, 316, 284, 7, 7, 25, - 7, 322, 109, 112, 109, 31, 109, 113, 109, 331, - 332, 333, 334, 335, 336, 41, 42, 43, 44, 45, - 46, 47, 344, 345, 346, 347, 303, 24, 36, 109, - 109, 109, 309, 24, 109, 109, 62, 109, 109, 109, - 109, 63, 34, 111, 111, 111, 323, 324, 111, 109, - 111, 209, 210, 111, 311, 312, 313, 314, 315, 316, - 317, 318, 280, 221, 111, 322, 109, 24, 226, 111, - 111, 111, 394, 112, 21, 109, 113, 109, 109, 237, - 238, 239, 109, 21, 109, 362, 109, 364, 4, 109, - 111, 368, 111, 24, 4, 36, 353, 418, 419, 420, - 377, 378, 379, 109, 109, 109, 109, 109, 365, 431, - 432, 433, 434, 109, 436, 437, 438, 439, 57, 109, - 109, 109, 109, 109, 471, 471, 383, 109, 109, 450, - 109, 408, 409, 109, 112, 4, 24, 109, 113, 416, - 57, 112, 489, 489, 112, 303, 115, 112, 425, 109, - 112, 309, 36, 410, 109, 109, 478, 21, 480, 481, - 112, 418, 419, 420, 112, 323, 324, 424, 112, 112, - 115, 21, 112, 430, 21, 452, 112, 112, 75, 109, - 109, 21, 21, 96, 96, 96, 41, 96, 25, 354, - 51, 353, 120, 450, 194, 60, 3, 5, 6, 19, - 388, 365, 424, -1, 362, -1, 364, -1, -1, 486, - 368, -1, -1, -1, 22, -1, 24, -1, 26, 377, - 378, 379, 499, -1, -1, -1, -1, -1, -1, 506, - 38, 39, -1, 510, 511, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 408, 409, -1, -1, -1, -1, -1, -1, 416, -1, - -1, -1, -1, -1, -1, -1, -1, 425, -1, 77, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, -1, -1, -1, -1, -1, 96, -1, - 98, 99, 100, 101, 452, 103, 104, 105, -1, -1, - -1, -1, -1, -1, -1, 113, -1, -1, 116, -1, - 118, -1, -1, 121, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 486, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 499, -1, -1, -1, -1, -1, -1, 506, -1, - -1, -1, 510, 511, 5, 6, -1, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, -1, 24, 5, 6, -1, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, -1, 24, -1, -1, -1, 48, -1, -1, - -1, -1, 20, -1, 22, -1, 24, -1, -1, -1, - -1, -1, -1, 31, 32, 33, -1, 48, 3, 4, - 5, 6, 7, 41, 42, 43, 44, 45, 46, 47, - -1, -1, 50, 51, -1, -1, -1, 22, -1, 24, - 58, 26, 27, 28, 62, -1, -1, -1, -1, -1, - -1, -1, -1, 38, 39, -1, -1, -1, -1, 110, - -1, -1, 113, -1, -1, 116, -1, 118, 119, -1, - -1, -1, -1, -1, -1, -1, 61, -1, -1, 110, - -1, -1, 113, -1, -1, 116, -1, 118, 119, -1, - -1, -1, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, -1, -1, -1, -1, - -1, 96, -1, 98, 99, 100, 101, -1, 103, 104, - 105, 3, 4, -1, -1, 7, -1, -1, -1, -1, - -1, 116, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 26, 27, 28, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 38, 39, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 77, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, 90, -1, - -1, -1, -1, -1, 96, -1, 98, 99, 100, 101, - -1, 103, 104, 105, -1, -1, -1, -1, -1, -1, - -1, -1, 5, 6, 116, 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, - -1, -1, -1, 5, 6, 48, 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, -1, -1, -1, 5, 6, 48, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, -1, 24, -1, -1, -1, 110, -1, -1, - 113, -1, -1, 116, -1, 118, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 5, 6, 48, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, -1, 24, -1, -1, -1, 110, -1, - -1, 113, -1, -1, 116, -1, 118, 37, -1, -1, - -1, -1, -1, -1, -1, -1, 5, 6, 48, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, -1, 24, -1, -1, -1, 110, - -1, -1, 113, -1, 115, 116, -1, 118, 37, -1, - -1, -1, -1, -1, -1, -1, -1, 5, 6, 48, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, -1, 24, -1, -1, -1, - 110, -1, -1, 113, -1, -1, 116, -1, 118, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 5, 6, - 48, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, -1, 24, -1, -1, - -1, 110, -1, -1, 113, -1, -1, 116, -1, 118, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, - 6, 48, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, -1, 24, -1, - -1, -1, 110, -1, -1, 113, -1, -1, 116, -1, - 118, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 5, 6, 48, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, -1, 24, - -1, -1, -1, 110, -1, -1, 113, -1, -1, 116, - -1, 118, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 48, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 110, -1, -1, 113, -1, -1, - 116, -1, 118, -1, -1, -1, -1, -1, 35, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 49, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 59, 60, -1, 110, -1, -1, 113, -1, - -1, 116, -1, 118, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, 92, 93, -1, -1, 96, - 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - 107 +static const short yytable[] = { 86, + 217, 218, 305, 102, 37, 24, 91, 193, 327, 328, + 360, 40, 338, 340, 86, 115, 382, 362, 18, 486, + 19, 203, 207, 220, 206, 209, 210, 211, 212, 213, + 214, 215, 216, 196, 208, 392, 346, 496, 494, 383, + 27, 356, 24, 197, 348, 395, 223, 119, 502, 227, + 228, 115, 361, 229, 230, 231, 232, 233, 234, 361, + 239, 242, 238, 347, 44, 45, 46, 243, 119, 175, + 176, 177, 209, 210, 211, 212, 213, 214, 215, 216, + -64, 37, 392, 392, 56, 202, 57, 117, 202, 119, + 394, 405, 392, 103, 104, 92, 169, 170, 393, 48, + 41, 28, 29, 30, 31, 32, 33, 34, 221, 222, + 202, 224, 225, 202, 202, 240, 241, 202, 202, 202, + 202, 202, 202, 235, 236, 237, 202, 274, 275, 276, + 485, 106, 107, 108, 50, 49, 272, 247, 248, -24, + -24, 323, -23, -23, -22, -22, 296, 59, 426, -21, + -21, 296, 296, 249, 250, 5, 6, 7, 8, 51, + 10, 52, 278, 296, 53, 55, 61, 96, 296, 99, + 110, -65, 97, 301, 98, 111, 112, 495, 118, 296, + 296, 296, 168, 172, 86, 173, 194, 195, 198, 446, + 204, 447, 321, -126, 209, 210, 211, 212, 213, 214, + 215, 216, -28, 86, 322, 202, -27, -26, -25, 252, + 368, 282, 370, 371, 372, 276, -31, -32, 3, 253, + 378, 283, 302, 309, 4, 304, 308, 310, 386, 387, + 388, 389, 390, 391, 5, 6, 7, 8, 9, 10, + 11, 396, 397, 398, 399, 296, 307, 311, 324, 312, + 341, 296, 313, 314, 315, 12, 316, 320, 325, 354, + 404, 382, 329, 330, 331, 296, 296, 332, 333, 351, + 298, 299, 357, 367, 202, 369, 202, 202, 202, 373, + 374, 349, 300, 366, 202, 334, 342, 306, 343, 344, + 406, 433, 345, 407, 352, 358, 408, 363, 317, 318, + 319, 375, 410, 376, 296, 424, 296, 425, 377, 381, + 296, 428, 422, 438, 466, 278, 451, 452, 453, 296, + 296, 296, 414, 416, 417, 418, 429, 202, 458, 459, + 460, 461, 430, 462, 463, 464, 465, 431, 432, 434, + 435, 436, 437, 217, 218, 423, 440, 445, 471, 448, + 296, 296, 450, 456, 467, 468, 361, 469, 296, 470, + 472, 217, 218, 474, 359, 475, 476, 296, 484, 478, + 365, 477, 202, 479, 480, 490, 488, 491, 492, 481, + 202, 202, 202, 482, 379, 380, 202, 497, 483, 489, + 498, 499, 457, 501, 296, 500, 504, 505, 506, 508, + 509, 513, 514, 159, 94, 160, 161, 162, 54, 200, + 271, 101, 202, 109, 25, 43, 62, 63, 413, 454, + 402, 401, 427, 409, 0, 411, 0, 0, 296, 415, + 0, 0, 0, 18, 0, 19, 0, 254, 419, 420, + 421, 296, 0, 0, 0, 0, 0, 0, 296, 255, + 256, 0, 296, 296, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 441, + 442, 0, 0, 0, 0, 0, 0, 449, 0, 0, + 0, 0, 0, 0, 0, 0, 455, 0, 130, 131, + 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, + 142, 143, 0, 0, 0, 0, 0, 257, 0, 258, + 259, 151, 152, 473, 260, 261, 262, 0, 0, 0, + 0, 0, 0, 0, 263, 0, 0, 264, 0, 265, + 0, 0, 266, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 493, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 503, 0, 0, 0, 0, 0, 0, 507, 0, 0, + 0, 510, 511, 62, 63, 0, 113, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 18, 0, 19, 62, 63, 0, 113, 178, 179, 180, + 181, 182, 183, 184, 185, 186, 187, 188, 76, 77, + 18, 0, 19, 0, 0, 0, 78, 0, 0, 0, + 0, -34, 0, 18, 0, 19, 0, 0, 0, 0, + 0, 0, 4, -34, -34, 0, 78, 284, 285, 62, + 63, 286, -34, -34, -34, -34, -34, -34, -34, 0, + 0, -34, 20, 0, 0, 0, 18, 0, 19, 21, + 287, 288, 289, 22, 0, 0, 0, 0, 0, 0, + 0, 0, 290, 291, 0, 0, 0, 0, 79, 0, + 0, 80, 0, 0, 81, 0, 82, 114, 0, 0, + 0, 0, 0, 0, 0, 292, 0, 0, 79, 0, + 0, 80, 0, 0, 81, 0, 82, 339, 0, 0, + 0, 130, 131, 132, 133, 134, 135, 136, 137, 138, + 139, 140, 141, 142, 143, 0, 0, 0, 0, 0, + 257, 0, 258, 259, 151, 152, 0, 260, 261, 262, + 284, 285, 0, 0, 286, 0, 0, 0, 0, 0, + 293, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 287, 288, 289, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 290, 291, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 292, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 130, 131, 132, 133, 134, 135, + 136, 137, 138, 139, 140, 141, 142, 143, 0, 0, + 0, 0, 0, 257, 0, 258, 259, 151, 152, 0, + 260, 261, 262, 0, 0, 0, 0, 0, 0, 0, + 0, 62, 63, 293, 113, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 18, 0, + 19, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 199, 0, 0, 0, 0, 0, 0, + 0, 0, 62, 63, 78, 113, 65, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 18, + 0, 19, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 277, 0, 0, 0, 0, 0, + 0, 0, 0, 62, 63, 78, 113, 178, 179, 180, + 181, 182, 183, 184, 185, 186, 187, 188, 76, 77, + 18, 0, 19, 0, 0, 0, 79, 0, 0, 80, + 0, 0, 81, 0, 82, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 62, 63, 78, 113, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 18, 0, 19, 0, 0, 0, 79, 0, 0, + 80, 0, 0, 81, 0, 82, 353, 0, 0, 0, + 0, 0, 0, 0, 0, 62, 63, 78, 113, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, 18, 0, 19, 0, 0, 0, 79, 0, + 0, 80, 0, 335, 81, 0, 82, 400, 0, 0, + 0, 0, 0, 0, 0, 0, 62, 63, 78, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 18, 0, 19, 0, 0, 0, 79, + 0, 0, 80, 0, 0, 81, 0, 82, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 62, 63, 78, + 113, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 77, 18, 0, 19, 0, 0, 0, + 79, 0, 0, 80, 0, 0, 81, 0, 82, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 62, 63, + 78, 113, 178, 179, 180, 181, 182, 183, 184, 185, + 186, 187, 188, 76, 77, 18, 0, 19, 0, 0, + 0, 79, 0, 0, 80, 0, 0, 81, 0, 82, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, + 63, 78, 205, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 18, 0, 19, 0, + 0, 0, 79, 0, 0, 80, 0, 0, 81, 0, + 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 78, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 79, 0, 0, 80, 0, 0, 81, + 0, 82, 0, 0, 0, 0, 0, 120, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 121, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 122, 123, 0, 79, 0, 0, 80, 0, 0, + 81, 0, 82, 124, 125, 126, 127, 128, 129, 130, + 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, + 141, 142, 143, 144, 145, 146, 0, 0, 147, 148, + 149, 150, 151, 152, 153, 154, 155, 156, 157, 158 }; -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const unsigned char yystos[] = -{ - 0, 153, 154, 155, 0, 25, 31, 41, 42, 43, - 44, 45, 46, 47, 62, 134, 172, 174, 176, 183, - 22, 24, 51, 58, 62, 133, 165, 176, 177, 61, - 64, 65, 66, 67, 68, 69, 70, 135, 170, 23, - 184, 185, 30, 119, 173, 184, 52, 53, 54, 162, - 108, 61, 20, 45, 47, 50, 134, 108, 45, 47, - 175, 24, 160, 4, 5, 6, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 48, 110, 113, 116, 118, 123, 142, 143, 144, 145, - 146, 165, 180, 29, 118, 171, 133, 188, 108, 108, - 108, 113, 163, 160, 142, 32, 33, 152, 152, 152, - 152, 170, 4, 4, 4, 8, 119, 146, 147, 165, - 111, 120, 35, 49, 59, 60, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 96, - 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 125, 126, 127, 128, 186, 192, 193, 195, 196, - 24, 55, 56, 161, 4, 24, 164, 144, 144, 144, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 129, 130, 132, 144, 149, 114, 114, 109, 119, - 111, 37, 147, 148, 144, 182, 59, 8, 182, 9, - 21, 10, 11, 12, 13, 14, 15, 16, 17, 129, - 130, 131, 135, 144, 144, 182, 144, 144, 189, 182, - 182, 182, 182, 182, 182, 182, 182, 144, 144, 144, - 182, 135, 94, 95, 109, 115, 158, 159, 157, 27, - 28, 3, 4, 124, 4, 7, 26, 38, 39, 96, - 98, 99, 103, 104, 105, 113, 116, 118, 121, 125, - 126, 127, 128, 150, 180, 156, 146, 146, 146, 37, - 144, 167, 168, 169, 109, 112, 3, 4, 7, 26, - 27, 28, 38, 39, 61, 116, 150, 179, 180, 181, - 181, 181, 181, 142, 109, 137, 109, 137, 181, 113, - 109, 36, 109, 109, 109, 109, 109, 109, 109, 181, - 181, 181, 109, 142, 144, 182, 24, 109, 140, 140, - 140, 111, 111, 111, 111, 111, 111, 115, 149, 151, - 151, 119, 151, 24, 111, 111, 111, 111, 140, 115, - 117, 165, 166, 109, 112, 37, 63, 178, 151, 109, - 109, 181, 15, 57, 15, 109, 194, 181, 113, 144, - 182, 144, 182, 182, 182, 144, 144, 109, 109, 109, - 182, 181, 181, 109, 34, 57, 138, 141, 149, 149, - 149, 149, 149, 149, 109, 115, 117, 119, 149, 149, - 149, 149, 37, 167, 138, 139, 24, 117, 21, 21, - 111, 181, 4, 181, 182, 190, 109, 181, 109, 109, - 109, 181, 181, 181, 111, 144, 24, 4, 140, 194, - 36, 109, 109, 109, 109, 149, 109, 109, 109, 109, - 57, 136, 109, 181, 181, 190, 191, 109, 137, 137, - 109, 181, 109, 182, 182, 182, 191, 181, 112, 144, - 149, 149, 149, 149, 149, 149, 149, 149, 4, 24, - 109, 113, 112, 182, 115, 181, 112, 112, 109, 112, - 109, 109, 112, 112, 112, 112, 21, 115, 131, 187, - 36, 115, 149, 149, 149, 181, 179, 115, 131, 21, - 112, 112, 112, 109, 179, 181, 21, 109, 75, 181, - 21, 21, 181, 181 +static const short yycheck[] = { 35, + 126, 126, 222, 50, 23, 2, 29, 108, 245, 246, + 15, 30, 264, 265, 50, 82, 34, 15, 22, 469, + 24, 121, 9, 127, 124, 10, 11, 12, 13, 14, + 15, 16, 17, 109, 21, 109, 273, 487, 486, 57, + 61, 293, 39, 119, 117, 119, 146, 120, 496, 149, + 150, 118, 57, 153, 154, 155, 156, 157, 158, 57, + 164, 109, 162, 115, 52, 53, 54, 115, 120, 105, + 106, 107, 10, 11, 12, 13, 14, 15, 16, 17, + 111, 23, 109, 109, 45, 121, 47, 84, 124, 120, + 117, 117, 109, 32, 33, 118, 55, 56, 115, 108, + 119, 64, 65, 66, 67, 68, 69, 70, 144, 145, + 146, 147, 148, 149, 150, 94, 95, 153, 154, 155, + 156, 157, 158, 159, 160, 161, 162, 194, 195, 196, + 115, 52, 53, 54, 20, 61, 192, 27, 28, 3, + 4, 241, 3, 4, 3, 4, 202, 24, 385, 3, + 4, 207, 208, 3, 4, 41, 42, 43, 44, 45, + 46, 47, 198, 219, 50, 108, 4, 108, 224, 113, + 4, 111, 108, 220, 108, 4, 4, 115, 111, 235, + 236, 237, 24, 4, 220, 24, 114, 114, 111, 409, + 59, 411, 239, 0, 10, 11, 12, 13, 14, 15, + 16, 17, 4, 239, 240, 241, 4, 4, 4, 4, + 310, 109, 312, 313, 314, 282, 7, 7, 25, 7, + 320, 112, 109, 36, 31, 109, 109, 109, 329, 330, + 331, 332, 333, 334, 41, 42, 43, 44, 45, 46, + 47, 342, 343, 344, 345, 301, 113, 109, 24, 109, + 24, 307, 109, 109, 109, 62, 109, 109, 109, 63, + 24, 34, 111, 111, 111, 321, 322, 111, 111, 109, + 207, 208, 109, 309, 310, 311, 312, 313, 314, 315, + 316, 278, 219, 113, 320, 111, 111, 224, 111, 111, + 21, 392, 111, 21, 112, 109, 111, 109, 235, 236, + 237, 109, 4, 109, 360, 24, 362, 4, 109, 109, + 366, 36, 111, 57, 4, 351, 416, 417, 418, 375, + 376, 377, 109, 109, 109, 109, 109, 363, 429, 430, + 431, 432, 109, 434, 435, 436, 437, 109, 109, 109, + 109, 109, 109, 469, 469, 381, 109, 109, 448, 109, + 406, 407, 109, 112, 24, 109, 57, 113, 414, 112, + 115, 487, 487, 112, 301, 112, 109, 423, 21, 109, + 307, 112, 408, 109, 112, 476, 36, 478, 479, 112, + 416, 417, 418, 112, 321, 322, 422, 21, 112, 115, + 112, 112, 428, 109, 450, 112, 21, 109, 75, 21, + 21, 0, 0, 94, 39, 94, 94, 94, 23, 118, + 192, 49, 448, 58, 2, 17, 5, 6, 363, 422, + 352, 351, 386, 360, -1, 362, -1, -1, 484, 366, + -1, -1, -1, 22, -1, 24, -1, 26, 375, 376, + 377, 497, -1, -1, -1, -1, -1, -1, 504, 38, + 39, -1, 508, 509, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 406, + 407, -1, -1, -1, -1, -1, -1, 414, -1, -1, + -1, -1, -1, -1, -1, -1, 423, -1, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, + 89, 90, -1, -1, -1, -1, -1, 96, -1, 98, + 99, 100, 101, 450, 103, 104, 105, -1, -1, -1, + -1, -1, -1, -1, 113, -1, -1, 116, -1, 118, + -1, -1, 121, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 484, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 497, -1, -1, -1, -1, -1, -1, 504, -1, -1, + -1, 508, 509, 5, 6, -1, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, -1, 24, 5, 6, -1, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, -1, 24, -1, -1, -1, 48, -1, -1, -1, + -1, 20, -1, 22, -1, 24, -1, -1, -1, -1, + -1, -1, 31, 32, 33, -1, 48, 3, 4, 5, + 6, 7, 41, 42, 43, 44, 45, 46, 47, -1, + -1, 50, 51, -1, -1, -1, 22, -1, 24, 58, + 26, 27, 28, 62, -1, -1, -1, -1, -1, -1, + -1, -1, 38, 39, -1, -1, -1, -1, 110, -1, + -1, 113, -1, -1, 116, -1, 118, 119, -1, -1, + -1, -1, -1, -1, -1, 61, -1, -1, 110, -1, + -1, 113, -1, -1, 116, -1, 118, 119, -1, -1, + -1, 77, 78, 79, 80, 81, 82, 83, 84, 85, + 86, 87, 88, 89, 90, -1, -1, -1, -1, -1, + 96, -1, 98, 99, 100, 101, -1, 103, 104, 105, + 3, 4, -1, -1, 7, -1, -1, -1, -1, -1, + 116, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 26, 27, 28, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 38, 39, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 61, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 77, 78, 79, 80, 81, 82, + 83, 84, 85, 86, 87, 88, 89, 90, -1, -1, + -1, -1, -1, 96, -1, 98, 99, 100, 101, -1, + 103, 104, 105, -1, -1, -1, -1, -1, -1, -1, + -1, 5, 6, 116, 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, -1, + -1, -1, 5, 6, 48, 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, + -1, -1, -1, 5, 6, 48, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, -1, 24, -1, -1, -1, 110, -1, -1, 113, + -1, -1, 116, -1, 118, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 5, 6, 48, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, -1, 24, -1, -1, -1, 110, -1, -1, + 113, -1, -1, 116, -1, 118, 37, -1, -1, -1, + -1, -1, -1, -1, -1, 5, 6, 48, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, -1, 24, -1, -1, -1, 110, -1, + -1, 113, -1, 115, 116, -1, 118, 37, -1, -1, + -1, -1, -1, -1, -1, -1, 5, 6, 48, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, -1, 24, -1, -1, -1, 110, + -1, -1, 113, -1, -1, 116, -1, 118, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 5, 6, 48, + 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, -1, 24, -1, -1, -1, + 110, -1, -1, 113, -1, -1, 116, -1, 118, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 5, 6, + 48, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, -1, 24, -1, -1, + -1, 110, -1, -1, 113, -1, -1, 116, -1, 118, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, + 6, 48, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, -1, 24, -1, + -1, -1, 110, -1, -1, 113, -1, -1, 116, -1, + 118, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 48, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 110, -1, -1, 113, -1, -1, 116, + -1, 118, -1, -1, -1, -1, -1, 35, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 49, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 59, 60, -1, 110, -1, -1, 113, -1, -1, + 116, -1, 118, 71, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, -1, -1, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107 }; +/* -*-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 YYEMPTY -2 #define YYEOF 0 - #define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab - - -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrlab1 +/* Like YYERROR except do call yyerror. + This remains here temporarily to ease the + transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ - #define YYFAIL goto yyerrlab - #define YYRECOVERING() (!!yyerrstatus) - -#define YYBACKUP(Token, Value) \ +#define YYBACKUP(token, value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - yytoken = YYTRANSLATE (yychar); \ + { yychar = (token), yylval = (value); \ + yychar1 = YYTRANSLATE (yychar); \ YYPOPSTACK; \ goto yybackup; \ } \ else \ - { \ - yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ + { yyerror ("syntax error: cannot back up"); YYERROR; } \ while (0) - #define YYTERROR 1 #define YYERRCODE 256 - -/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. - If N is 0, then set CURRENT to the empty location which ends - the previous symbol: RHS[0] (always defined). */ - -#define YYRHSLOC(Rhs, K) ((Rhs)[K]) -#ifndef YYLLOC_DEFAULT -# define YYLLOC_DEFAULT(Current, Rhs, N) \ - do \ - if (N) \ - { \ - (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ - (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ - (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ - (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ - } \ - else \ - { \ - (Current).first_line = (Current).last_line = \ - YYRHSLOC (Rhs, 0).last_line; \ - (Current).first_column = (Current).last_column = \ - YYRHSLOC (Rhs, 0).last_column; \ - } \ - while (0) +#ifndef YYPURE +#define YYLEX yylex() #endif - -/* YY_LOCATION_PRINT -- Print the location on the stream. - This macro was not mandated originally: define only if we know - we won't break user code: when these are the locations we know. */ - -#ifndef YY_LOCATION_PRINT -# if YYLTYPE_IS_TRIVIAL -# define YY_LOCATION_PRINT(File, Loc) \ - fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) -# else -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -# endif +#ifdef YYPURE +#ifdef YYLSP_NEEDED +#ifdef YYLEX_PARAM +#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) +#else +#define YYLEX yylex(&yylval, &yylloc) #endif - - -/* YYLEX -- calling `yylex' with the right arguments. */ - +#else /* not YYLSP_NEEDED */ #ifdef YYLEX_PARAM -# define YYLEX yylex (YYLEX_PARAM) +#define YYLEX yylex(&yylval, YYLEX_PARAM) #else -# define YYLEX yylex () +#define YYLEX yylex(&yylval) +#endif +#endif /* not YYLSP_NEEDED */ #endif -/* Enable debugging if requested. */ -#if YYDEBUG +/* If nonreentrant, generate the variables here */ -# ifndef YYFPRINTF -# include /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (0) - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yysymprint (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (0) +#ifndef YYPURE -/*------------------------------------------------------------------. -| yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (included). | -`------------------------------------------------------------------*/ +int yychar; /* the lookahead symbol */ +YYSTYPE yylval; /* the semantic value of the */ + /* lookahead symbol */ -#if defined (__STDC__) || defined (__cplusplus) -static void -yy_stack_print (short int *bottom, short int *top) -#else -static void -yy_stack_print (bottom, top) - short int *bottom; - short int *top; +#ifdef YYLSP_NEEDED +YYLTYPE yylloc; /* location data for the lookahead */ + /* symbol */ #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) +int yynerrs; /* number of parse errors so far */ +#endif /* not YYPURE */ -/*------------------------------------------------. -| 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; +#if YYDEBUG != 0 +int yydebug; /* nonzero means print parse trace */ +/* Since this is uninitialized, it does not stop multiple parsers + from coexisting. */ #endif -{ - int yyi; - unsigned long int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ", - 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 YY_SYMBOL_PRINT(Title, Type, Value, Location) -# define YY_STACK_PRINT(Bottom, Top) -# define YY_REDUCE_PRINT(Rule) -#endif /* !YYDEBUG */ +/* YYINITDEPTH indicates the initial size of the parser's stacks */ - -/* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH -# define YYINITDEPTH 200 +#define YYINITDEPTH 200 #endif -/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only - if the built-in stack extension method is used). +/* YYMAXDEPTH is the maximum size the stacks can grow to + (effective only if the built-in stack extension method is used). */ - Do not make this value too large; the results are undefined if - YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) - evaluated with infinite-precision integer arithmetic. */ +#if YYMAXDEPTH == 0 +#undef YYMAXDEPTH +#endif #ifndef YYMAXDEPTH -# define YYMAXDEPTH 10000 +#define YYMAXDEPTH 10000 #endif - +/* Define __yy_memcpy. Note that the size argument + should be passed with type unsigned int, because that is what the non-GCC + definitions require. With GCC, __builtin_memcpy takes an arg + of type size_t, but it can handle unsigned int. */ + +#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ +#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) +#else /* not GNU C or C++ */ +#ifndef __cplusplus -#if YYERROR_VERBOSE - -# ifndef yystrlen -# if defined (__GLIBC__) && defined (_STRING_H) -# define yystrlen strlen -# else -/* Return the length of YYSTR. */ -static YYSIZE_T -# if defined (__STDC__) || defined (__cplusplus) -yystrlen (const char *yystr) -# else -yystrlen (yystr) - const char *yystr; -# endif -{ - 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 -{ - char *yyd = yydest; - const char *yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; -} -# endif -# endif - -# ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static YYSIZE_T -yytnamerr (char *yyres, const char *yystr) +/* 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; { - if (*yystr == '"') - { - size_t yyn = 0; - char const *yyp = yystr; - - for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes: ; - } + register char *f = from; + register char *t = to; + register int i = count; - if (! yyres) - return yystrlen (yystr); - - return yystpcpy (yyres, yystr) - yyres; + while (i-- > 0) + *t++ = *f++; } -# endif - -#endif /* YYERROR_VERBOSE */ - - -#if YYDEBUG -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ +#else /* __cplusplus */ -#if defined (__STDC__) || defined (__cplusplus) -static void -yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) -#else +/* This is the most reliable way to avoid incompatibilities + in available built-in functions on various systems. */ static void -yysymprint (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE *yyvaluep; -#endif +__yy_memcpy (char *to, char *from, unsigned int count) { - /* Pacify ``unused variable'' warnings. */ - (void) yyvaluep; + register char *t = to; + register char *f = from; + register int i = count; - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); - - -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# endif - switch (yytype) - { - default: - break; - } - YYFPRINTF (yyoutput, ")"); + while (i-- > 0) + *t++ = *f++; } -#endif /* ! YYDEBUG */ -/*-----------------------------------------------. -| Release the memory associated to this symbol. | -`-----------------------------------------------*/ - -#if defined (__STDC__) || defined (__cplusplus) -static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) -#else -static void -yydestruct (yymsg, yytype, yyvaluep) - const char *yymsg; - int yytype; - YYSTYPE *yyvaluep; #endif -{ - /* Pacify ``unused variable'' warnings. */ - (void) yyvaluep; - - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - - switch (yytype) - { - - default: - break; - } -} +#endif +#line 217 "/usr/share/bison.simple" -/* Prevent warnings from -Wmissing-prototypes. */ +/* The user can define YYPARSE_PARAM as the name of an argument to be passed + into yyparse. The argument should have type void *. + It should actually point to an object. + Grammar actions can access the variable by casting it + to the proper pointer type. */ #ifdef YYPARSE_PARAM -# if defined (__STDC__) || defined (__cplusplus) -int yyparse (void *YYPARSE_PARAM); -# else -int yyparse (); -# endif -#else /* ! YYPARSE_PARAM */ -#if defined (__STDC__) || defined (__cplusplus) -int yyparse (void); -#else -int yyparse (); -#endif -#endif /* ! YYPARSE_PARAM */ - - - -/* The look-ahead symbol. */ -int yychar; - -/* The semantic value of the look-ahead symbol. */ -YYSTYPE yylval; - -/* Number of syntax errors so far. */ -int yynerrs; - - - -/*----------. -| yyparse. | -`----------*/ +#ifdef __cplusplus +#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM +#define YYPARSE_PARAM_DECL +#else /* not __cplusplus */ +#define YYPARSE_PARAM_ARG YYPARSE_PARAM +#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; +#endif /* not __cplusplus */ +#else /* not YYPARSE_PARAM */ +#define YYPARSE_PARAM_ARG +#define YYPARSE_PARAM_DECL +#endif /* not YYPARSE_PARAM */ +/* Prevent warning if -Wstrict-prototypes. */ +#ifdef __GNUC__ #ifdef YYPARSE_PARAM -# if defined (__STDC__) || defined (__cplusplus) -int yyparse (void *YYPARSE_PARAM) -# else -int yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -# endif -#else /* ! YYPARSE_PARAM */ -#if defined (__STDC__) || defined (__cplusplus) -int -yyparse (void) +int yyparse (void *); #else -int -yyparse () - +int yyparse (void); #endif #endif -{ - - int yystate; - int yyn; - int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; - - /* 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 int yyssa[YYINITDEPTH]; - short int *yyss = yyssa; - short int *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; - +int +yyparse(YYPARSE_PARAM_ARG) + YYPARSE_PARAM_DECL +{ + register int yystate; + register int yyn; + register short *yyssp; + register YYSTYPE *yyvsp; + int yyerrstatus; /* number of tokens to shift before error messages enabled */ + int yychar1 = 0; /* lookahead token as an internal (translated) token number */ + + short yyssa[YYINITDEPTH]; /* the state stack */ + YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ + + short *yyss = yyssa; /* refer to the stacks thru separate pointers */ + YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ + +#ifdef YYLSP_NEEDED + YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ + YYLTYPE *yyls = yylsa; + YYLTYPE *yylsp; +#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) +#else #define YYPOPSTACK (yyvsp--, yyssp--) +#endif - YYSIZE_T yystacksize = YYINITDEPTH; + int yystacksize = YYINITDEPTH; + int yyfree_stacks = 0; - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; +#ifdef YYPURE + int yychar; + YYSTYPE yylval; + int yynerrs; +#ifdef YYLSP_NEEDED + YYLTYPE yylloc; +#endif +#endif + YYSTYPE yyval; /* the variable used to return */ + /* semantic values from the action */ + /* routines */ - /* When reducing, the number of symbols on the RHS of the reduced - rule. */ int yylen; - YYDPRINTF ((stderr, "Starting parse\n")); +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Starting parse\n"); +#endif yystate = 0; yyerrstatus = 0; @@ -2756,747 +2111,740 @@ so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss; + yyssp = yyss - 1; yyvsp = yyvs; +#ifdef YYLSP_NEEDED + yylsp = yyls; +#endif - goto yysetstate; - -/*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | -`------------------------------------------------------------*/ - yynewstate: - /* In all cases, when you get here, the value and location stacks - have just been pushed. so pushing a state here evens the stacks. - */ - yyssp++; - - yysetstate: - *yyssp = yystate; +/* 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 - if (yyss + yystacksize - 1 <= yyssp) - { /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; + int size = yyssp - yyss + 1; #ifdef yyoverflow - { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - short int *yyss1 = yyss; - - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - - &yystacksize); + /* Each stack pointer address is followed by the size of + the data in use in that stack, in bytes. */ +#ifdef YYLSP_NEEDED + /* This used to be a conditional around just the two extra args, + but that might be undefined if yyoverflow is a macro. */ + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yyls1, size * sizeof (*yylsp), + &yystacksize); +#else + yyoverflow("parser stack overflow", + &yyss1, size * sizeof (*yyssp), + &yyvs1, size * sizeof (*yyvsp), + &yystacksize); +#endif - yyss = yyss1; - yyvs = yyvs1; - } + yyss = yyss1; yyvs = yyvs1; +#ifdef YYLSP_NEEDED + yyls = yyls1; +#endif #else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; + if (yystacksize >= YYMAXDEPTH) + { + yyerror("parser stack overflow"); + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } + return 2; + } yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) + if (yystacksize > YYMAXDEPTH) yystacksize = YYMAXDEPTH; - - { - short int *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - -# undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); - } -# endif +#ifndef YYSTACK_USE_ALLOCA + yyfree_stacks = 1; +#endif + yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); + __yy_memcpy ((char *)yyss, (char *)yyss1, + size * (unsigned int) sizeof (*yyssp)); + yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); + __yy_memcpy ((char *)yyvs, (char *)yyvs1, + size * (unsigned int) sizeof (*yyvsp)); +#ifdef YYLSP_NEEDED + yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); + __yy_memcpy ((char *)yyls, (char *)yyls1, + size * (unsigned int) sizeof (*yylsp)); +#endif #endif /* no yyoverflow */ - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; - + yyssp = yyss + size - 1; + yyvsp = yyvs + size - 1; +#ifdef YYLSP_NEEDED + yylsp = yyls + size - 1; +#endif - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Stack size increased to %d\n", yystacksize); +#endif - if (yyss + yystacksize - 1 <= yyssp) + if (yyssp >= yyss + yystacksize - 1) YYABORT; } - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Entering state %d\n", yystate); +#endif goto yybackup; - -/*-----------. -| yybackup. | -`-----------*/ -yybackup: + yybackup: /* Do appropriate processing given the current state. */ -/* Read a look-ahead token if we need one and don't already have one. */ +/* 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 look-ahead token. */ + /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; - if (yyn == YYPACT_NINF) + if (yyn == YYFLAG) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ + + /* yychar is either YYEMPTY or YYEOF + or a valid token in external form. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { - YYDPRINTF ((stderr, "Reading a token: ")); +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Reading a token: "); +#endif yychar = YYLEX; } - if (yychar <= YYEOF) + /* Convert token to internal form (in yychar1) for indexing tables with */ + + if (yychar <= 0) /* This means end of input. */ { - yychar = yytoken = YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); + yychar1 = 0; + yychar = YYEOF; /* Don't call YYLEX any more */ + +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Now at end of input.\n"); +#endif } else { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + yychar1 = YYTRANSLATE(yychar); + +#if YYDEBUG != 0 + if (yydebug) + { + fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); + /* Give the individual parser a way to print the precise meaning + of a token, for further debugging info. */ +#ifdef YYPRINT + YYPRINT (stderr, yychar, yylval); +#endif + fprintf (stderr, ")\n"); + } +#endif } - /* If the proper action on seeing token YYTOKEN is to reduce or to - detect an error, take that action. */ - yyn += yytoken; - if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + yyn += yychar1; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) goto yydefault; + yyn = yytable[yyn]; - if (yyn <= 0) + + /* yyn is what to do for this token type in this state. + Negative => reduce, -yyn is rule number. + Positive => shift, yyn is new state. + New state is final state => don't bother to shift, + just return success. + 0, or most negative number => error. */ + + if (yyn < 0) { - if (yyn == 0 || yyn == YYTABLE_NINF) + if (yyn == YYFLAG) goto yyerrlab; yyn = -yyn; goto yyreduce; } + else if (yyn == 0) + goto yyerrlab; if (yyn == YYFINAL) YYACCEPT; - /* Shift the look-ahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + /* 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--; + /* count tokens shifted since error; after three, turn off error status. */ + if (yyerrstatus) yyerrstatus--; yystate = yyn; goto yynewstate; - -/*-----------------------------------------------------------. -| yydefault -- do the default action for the current state. | -`-----------------------------------------------------------*/ +/* Do the default action for the current state. */ yydefault: + yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; - goto yyreduce; - -/*-----------------------------. -| yyreduce -- Do a reduction. | -`-----------------------------*/ +/* Do a reduction. yyn is the number of a rule to reduce with. */ yyreduce: - /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; + if (yylen > 0) + yyval = yyvsp[1-yylen]; /* implement default value of the action */ + +#if YYDEBUG != 0 + if (yydebug) + { + int i; - /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. + fprintf (stderr, "Reducing via rule %d (line %d), ", + yyn, yyrline[yyn]); - 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]; + /* Print the symbols being reduced, and their result. */ + for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) + fprintf (stderr, "%s ", yytname[yyrhs[i]]); + fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); + } +#endif - YY_REDUCE_PRINT (yyn); - switch (yyn) - { - case 3: -#line 1089 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[0].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range! + switch (yyn) { + +case 2: +#line 1089 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + if (yyvsp[0].UIntVal > (uint32_t)INT32_MAX) // Outside of my range! GEN_ERROR("Value too large for type!"); - (yyval.SIntVal) = (int32_t)(yyvsp[0].UIntVal); + yyval.SIntVal = (int32_t)yyvsp[0].UIntVal; CHECK_FOR_ERROR -;} - break; - - case 5: -#line 1098 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[0].UInt64Val) > (uint64_t)INT64_MAX) // Outside of my range! +; + break;} +case 4: +#line 1098 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + if (yyvsp[0].UInt64Val > (uint64_t)INT64_MAX) // Outside of my range! GEN_ERROR("Value too large for type!"); - (yyval.SInt64Val) = (int64_t)(yyvsp[0].UInt64Val); + yyval.SInt64Val = (int64_t)yyvsp[0].UInt64Val; CHECK_FOR_ERROR -;} - break; - - case 34: -#line 1122 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.StrVal) = (yyvsp[-1].StrVal); +; + break;} +case 33: +#line 1122 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.StrVal = yyvsp[-1].StrVal; CHECK_FOR_ERROR - ;} - break; - - case 35: -#line 1126 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.StrVal) = 0; + ; + break;} +case 34: +#line 1126 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.StrVal = 0; CHECK_FOR_ERROR - ;} - break; - - case 36: -#line 1131 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} - break; - - case 37: -#line 1132 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} - break; - - case 38: -#line 1133 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} - break; - - case 39: -#line 1134 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} - break; - - case 40: -#line 1135 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} - break; - - case 41: -#line 1136 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} - break; - - case 42: -#line 1137 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} - break; - - case 43: -#line 1138 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} - break; - - case 44: -#line 1140 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.UIntVal) = CallingConv::C; ;} - break; - - case 45: -#line 1141 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.UIntVal) = CallingConv::C; ;} - break; - - case 46: -#line 1142 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.UIntVal) = CallingConv::CSRet; ;} - break; - - case 47: -#line 1143 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.UIntVal) = CallingConv::Fast; ;} - break; - - case 48: -#line 1144 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.UIntVal) = CallingConv::Cold; ;} - break; - - case 49: -#line 1145 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} - break; - - case 50: -#line 1146 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} - break; - - case 51: -#line 1147 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val)) + ; + break;} +case 35: +#line 1131 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.Linkage = GlobalValue::InternalLinkage; ; + break;} +case 36: +#line 1132 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.Linkage = GlobalValue::LinkOnceLinkage; ; + break;} +case 37: +#line 1133 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.Linkage = GlobalValue::WeakLinkage; ; + break;} +case 38: +#line 1134 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.Linkage = GlobalValue::AppendingLinkage; ; + break;} +case 39: +#line 1135 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.Linkage = GlobalValue::DLLImportLinkage; ; + break;} +case 40: +#line 1136 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.Linkage = GlobalValue::DLLExportLinkage; ; + break;} +case 41: +#line 1137 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.Linkage = GlobalValue::ExternalWeakLinkage; ; + break;} +case 42: +#line 1138 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.Linkage = GlobalValue::ExternalLinkage; ; + break;} +case 43: +#line 1140 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.UIntVal = CallingConv::C; ; + break;} +case 44: +#line 1141 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.UIntVal = CallingConv::C; ; + break;} +case 45: +#line 1142 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.UIntVal = CallingConv::CSRet; ; + break;} +case 46: +#line 1143 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.UIntVal = CallingConv::Fast; ; + break;} +case 47: +#line 1144 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.UIntVal = CallingConv::Cold; ; + break;} +case 48: +#line 1145 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.UIntVal = CallingConv::X86_StdCall; ; + break;} +case 49: +#line 1146 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.UIntVal = CallingConv::X86_FastCall; ; + break;} +case 50: +#line 1147 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + if ((unsigned)yyvsp[0].UInt64Val != yyvsp[0].UInt64Val) GEN_ERROR("Calling conv too large!"); - (yyval.UIntVal) = (yyvsp[0].UInt64Val); + yyval.UIntVal = yyvsp[0].UInt64Val; CHECK_FOR_ERROR - ;} - break; - - case 52: -#line 1156 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.UIntVal) = 0; ;} - break; - - case 53: -#line 1157 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.UIntVal) = (yyvsp[0].UInt64Val); - if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) + ; + break;} +case 51: +#line 1156 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.UIntVal = 0; ; + break;} +case 52: +#line 1157 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.UIntVal = yyvsp[0].UInt64Val; + if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal)) GEN_ERROR("Alignment must be a power of two!"); CHECK_FOR_ERROR -;} - break; - - case 54: -#line 1163 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.UIntVal) = 0; ;} - break; - - case 55: -#line 1164 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.UIntVal) = (yyvsp[0].UInt64Val); - if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) +; + break;} +case 53: +#line 1163 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.UIntVal = 0; ; + break;} +case 54: +#line 1164 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.UIntVal = yyvsp[0].UInt64Val; + if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal)) GEN_ERROR("Alignment must be a power of two!"); CHECK_FOR_ERROR -;} - break; - - case 56: -#line 1172 "/proj/llvm/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] == '\\') +; + break;} +case 55: +#line 1172 "/Volumes/ProjectsDisk/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] == '\\') GEN_ERROR("Invalid character in section name!"); - (yyval.StrVal) = (yyvsp[0].StrVal); + yyval.StrVal = yyvsp[0].StrVal; CHECK_FOR_ERROR -;} - break; - - case 57: -#line 1180 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.StrVal) = 0; ;} - break; - - case 58: -#line 1181 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.StrVal) = (yyvsp[0].StrVal); ;} - break; - - case 59: -#line 1186 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - {;} - break; - - case 60: -#line 1187 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - {;} - break; - - case 61: -#line 1188 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - CurGV->setSection((yyvsp[0].StrVal)); - free((yyvsp[0].StrVal)); +; + break;} +case 56: +#line 1180 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.StrVal = 0; ; + break;} +case 57: +#line 1181 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.StrVal = yyvsp[0].StrVal; ; + break;} +case 58: +#line 1186 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{; + break;} +case 59: +#line 1187 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{; + break;} +case 60: +#line 1188 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + CurGV->setSection(yyvsp[0].StrVal); + free(yyvsp[0].StrVal); CHECK_FOR_ERROR - ;} - break; - - case 62: -#line 1193 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val))) + ; + break;} +case 61: +#line 1193 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + if (yyvsp[0].UInt64Val != 0 && !isPowerOf2_32(yyvsp[0].UInt64Val)) GEN_ERROR("Alignment must be a power of two!"); - CurGV->setAlignment((yyvsp[0].UInt64Val)); + CurGV->setAlignment(yyvsp[0].UInt64Val); CHECK_FOR_ERROR - ;} - break; - - case 64: -#line 1207 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;} - break; - - case 66: -#line 1208 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;} - break; - - case 67: -#line 1210 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 63: +#line 1207 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); ; + break;} +case 65: +#line 1208 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); ; + break;} +case 66: +#line 1210 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*(yyvsp[0].TypeVal))->getDescription()); - (yyval.TypeVal) = (yyvsp[0].TypeVal); + GEN_ERROR("Invalid upreference in type: " + (*yyvsp[0].TypeVal)->getDescription()); + yyval.TypeVal = yyvsp[0].TypeVal; CHECK_FOR_ERROR - ;} - break; - - case 81: -#line 1222 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); + ; + break;} +case 80: +#line 1222 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.TypeVal = new PATypeHolder(OpaqueType::get()); CHECK_FOR_ERROR - ;} - break; - - case 82: -#line 1226 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); + ; + break;} +case 81: +#line 1226 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); CHECK_FOR_ERROR - ;} - break; - - case 83: -#line 1230 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { // Named types are also simple types... - const Type* tmp = getTypeVal((yyvsp[0].ValIDVal)); + ; + break;} +case 82: +#line 1230 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Named types are also simple types... + const Type* tmp = getTypeVal(yyvsp[0].ValIDVal); CHECK_FOR_ERROR - (yyval.TypeVal) = new PATypeHolder(tmp); -;} - break; - - case 84: -#line 1238 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { // Type UpReference - if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range!"); + yyval.TypeVal = new PATypeHolder(tmp); +; + break;} +case 83: +#line 1238 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Type UpReference + if (yyvsp[0].UInt64Val > (uint64_t)~0U) GEN_ERROR("Value out of range!"); OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder - UpRefs.push_back(UpRefRecord((unsigned)(yyvsp[0].UInt64Val), OT)); // Add to vector... - (yyval.TypeVal) = new PATypeHolder(OT); + UpRefs.push_back(UpRefRecord((unsigned)yyvsp[0].UInt64Val, OT)); // Add to vector... + yyval.TypeVal = new PATypeHolder(OT); UR_OUT("New Upreference!\n"); CHECK_FOR_ERROR - ;} - break; - - case 85: -#line 1246 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { // Function derived type? + ; + break;} +case 84: +#line 1246 "/Volumes/ProjectsDisk/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) + 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 - CHECK_FOR_ERROR - ;} - break; - - case 86: -#line 1259 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { // Sized array type? - (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val)))); - delete (yyvsp[-1].TypeVal); - CHECK_FOR_ERROR - ;} - break; - - case 87: -#line 1264 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { // Packed array type? - const llvm::Type* ElemTy = (yyvsp[-1].TypeVal)->get(); - if ((unsigned)(yyvsp[-3].UInt64Val) != (yyvsp[-3].UInt64Val)) + 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 + CHECK_FOR_ERROR + ; + break;} +case 85: +#line 1259 "/Volumes/ProjectsDisk/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; + CHECK_FOR_ERROR + ; + break;} +case 86: +#line 1264 "/Volumes/ProjectsDisk/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) GEN_ERROR("Unsigned result not equal to signed result"); if (!ElemTy->isPrimitiveType()) GEN_ERROR("Elemental type of a PackedType must be primitive"); - if (!isPowerOf2_32((yyvsp[-3].UInt64Val))) + if (!isPowerOf2_32(yyvsp[-3].UInt64Val)) GEN_ERROR("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); + yyval.TypeVal = new PATypeHolder(HandleUpRefs(PackedType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val))); + delete yyvsp[-1].TypeVal; CHECK_FOR_ERROR - ;} - break; - - case 88: -#line 1276 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { // Structure type? + ; + break;} +case 87: +#line 1276 "/Volumes/ProjectsDisk/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) + 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); - CHECK_FOR_ERROR - ;} - break; - - case 89: -#line 1286 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { // Empty structure type? - (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector())); + yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); + delete yyvsp[-1].TypeList; CHECK_FOR_ERROR - ;} - break; - - case 90: -#line 1290 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { // Pointer type? - (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal)))); - delete (yyvsp[-1].TypeVal); - CHECK_FOR_ERROR - ;} - break; - - case 91: -#line 1299 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.TypeList) = new std::list(); - (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); + ; + break;} +case 88: +#line 1286 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Empty structure type? + yyval.TypeVal = new PATypeHolder(StructType::get(std::vector())); + CHECK_FOR_ERROR + ; + break;} +case 89: +#line 1290 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Pointer type? + yyval.TypeVal = new PATypeHolder(HandleUpRefs(PointerType::get(*yyvsp[-1].TypeVal))); + delete yyvsp[-1].TypeVal; + CHECK_FOR_ERROR + ; + break;} +case 90: +#line 1299 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.TypeList = new std::list(); + yyval.TypeList->push_back(*yyvsp[0].TypeVal); delete yyvsp[0].TypeVal; CHECK_FOR_ERROR - ;} - break; - - case 92: -#line 1304 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); + ; + break;} +case 91: +#line 1304 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + (yyval.TypeList=yyvsp[-2].TypeList)->push_back(*yyvsp[0].TypeVal); delete yyvsp[0].TypeVal; CHECK_FOR_ERROR - ;} - break; - - case 94: -#line 1311 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(Type::VoidTy); + ; + break;} +case 93: +#line 1311 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + (yyval.TypeList=yyvsp[-2].TypeList)->push_back(Type::VoidTy); CHECK_FOR_ERROR - ;} - break; - - case 95: -#line 1315 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - ((yyval.TypeList) = new std::list())->push_back(Type::VoidTy); + ; + break;} +case 94: +#line 1315 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + (yyval.TypeList = new std::list())->push_back(Type::VoidTy); CHECK_FOR_ERROR - ;} - break; - - case 96: -#line 1319 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.TypeList) = new std::list(); + ; + break;} +case 95: +#line 1319 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.TypeList = new std::list(); CHECK_FOR_ERROR - ;} - break; - - case 97: -#line 1330 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { // Nonempty unsized arr - const ArrayType *ATy = dyn_cast((yyvsp[-3].TypeVal)->get()); + ; + break;} +case 96: +#line 1330 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Nonempty unsized arr + const ArrayType *ATy = dyn_cast(yyvsp[-3].TypeVal->get()); if (ATy == 0) GEN_ERROR("Cannot make array constant with type: '" + - (*(yyvsp[-3].TypeVal))->getDescription() + "'!"); + (*yyvsp[-3].TypeVal)->getDescription() + "'!"); const Type *ETy = ATy->getElementType(); int NumElements = ATy->getNumElements(); // Verify that we have the correct size... - if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size()) + if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size()) GEN_ERROR("Type mismatch: constant sized array initialized with " + - utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " + + utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " + itostr(NumElements) + "!"); // Verify all elements are correct type! - for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { - if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) + for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) { + if (ETy != (*yyvsp[-1].ConstVector)[i]->getType()) GEN_ERROR("Element #" + utostr(i) + " is not of type '" + ETy->getDescription() +"' as required!\nIt is of type '"+ - (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); + (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'."); } - (yyval.ConstVal) = ConstantArray::get(ATy, *(yyvsp[-1].ConstVector)); - delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); + yyval.ConstVal = ConstantArray::get(ATy, *yyvsp[-1].ConstVector); + delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector; CHECK_FOR_ERROR - ;} - break; - - case 98: -#line 1356 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - const ArrayType *ATy = dyn_cast((yyvsp[-2].TypeVal)->get()); + ; + break;} +case 97: +#line 1356 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + const ArrayType *ATy = dyn_cast(yyvsp[-2].TypeVal->get()); if (ATy == 0) GEN_ERROR("Cannot make array constant with type: '" + - (*(yyvsp[-2].TypeVal))->getDescription() + "'!"); + (*yyvsp[-2].TypeVal)->getDescription() + "'!"); int NumElements = ATy->getNumElements(); if (NumElements != -1 && NumElements != 0) GEN_ERROR("Type mismatch: constant sized array initialized with 0" " arguments, but has size of " + itostr(NumElements) +"!"); - (yyval.ConstVal) = ConstantArray::get(ATy, std::vector()); - delete (yyvsp[-2].TypeVal); + yyval.ConstVal = ConstantArray::get(ATy, std::vector()); + delete yyvsp[-2].TypeVal; CHECK_FOR_ERROR - ;} - break; - - case 99: -#line 1370 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - const ArrayType *ATy = dyn_cast((yyvsp[-2].TypeVal)->get()); + ; + break;} +case 98: +#line 1370 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + const ArrayType *ATy = dyn_cast(yyvsp[-2].TypeVal->get()); if (ATy == 0) GEN_ERROR("Cannot make array constant with type: '" + - (*(yyvsp[-2].TypeVal))->getDescription() + "'!"); + (*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))) + char *EndStr = UnEscapeLexed(yyvsp[0].StrVal, true); + if (NumElements != -1 && NumElements != (EndStr-yyvsp[0].StrVal)) GEN_ERROR("Can't build string constant of size " + - itostr((int)(EndStr-(yyvsp[0].StrVal))) + + 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) + 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); + 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)); + free(yyvsp[0].StrVal); GEN_ERROR("Cannot build string arrays of non byte sized elements!"); } - free((yyvsp[0].StrVal)); - (yyval.ConstVal) = ConstantArray::get(ATy, Vals); - delete (yyvsp[-2].TypeVal); - CHECK_FOR_ERROR - ;} - break; - - case 100: -#line 1400 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { // Nonempty unsized arr - const PackedType *PTy = dyn_cast((yyvsp[-3].TypeVal)->get()); + free(yyvsp[0].StrVal); + yyval.ConstVal = ConstantArray::get(ATy, Vals); + delete yyvsp[-2].TypeVal; + CHECK_FOR_ERROR + ; + break;} +case 99: +#line 1400 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Nonempty unsized arr + const PackedType *PTy = dyn_cast(yyvsp[-3].TypeVal->get()); if (PTy == 0) GEN_ERROR("Cannot make packed constant with type: '" + - (*(yyvsp[-3].TypeVal))->getDescription() + "'!"); + (*yyvsp[-3].TypeVal)->getDescription() + "'!"); const Type *ETy = PTy->getElementType(); int NumElements = PTy->getNumElements(); // Verify that we have the correct size... - if (NumElements != -1 && NumElements != (int)(yyvsp[-1].ConstVector)->size()) + if (NumElements != -1 && NumElements != (int)yyvsp[-1].ConstVector->size()) GEN_ERROR("Type mismatch: constant sized packed initialized with " + - utostr((yyvsp[-1].ConstVector)->size()) + " arguments, but has size of " + + utostr(yyvsp[-1].ConstVector->size()) + " arguments, but has size of " + itostr(NumElements) + "!"); // Verify all elements are correct type! - for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { - if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) + for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) { + if (ETy != (*yyvsp[-1].ConstVector)[i]->getType()) GEN_ERROR("Element #" + utostr(i) + " is not of type '" + ETy->getDescription() +"' as required!\nIt is of type '"+ - (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); + (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'."); } - (yyval.ConstVal) = ConstantPacked::get(PTy, *(yyvsp[-1].ConstVector)); - delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); + yyval.ConstVal = ConstantPacked::get(PTy, *yyvsp[-1].ConstVector); + delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector; CHECK_FOR_ERROR - ;} - break; - - case 101: -#line 1426 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - const StructType *STy = dyn_cast((yyvsp[-3].TypeVal)->get()); + ; + break;} +case 100: +#line 1426 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + const StructType *STy = dyn_cast(yyvsp[-3].TypeVal->get()); if (STy == 0) GEN_ERROR("Cannot make struct constant with type: '" + - (*(yyvsp[-3].TypeVal))->getDescription() + "'!"); + (*yyvsp[-3].TypeVal)->getDescription() + "'!"); - if ((yyvsp[-1].ConstVector)->size() != STy->getNumContainedTypes()) + if (yyvsp[-1].ConstVector->size() != STy->getNumContainedTypes()) GEN_ERROR("Illegal number of initializers for structure type!"); // Check to ensure that constants are compatible with the type initializer! - for (unsigned i = 0, e = (yyvsp[-1].ConstVector)->size(); i != e; ++i) - if ((*(yyvsp[-1].ConstVector))[i]->getType() != STy->getElementType(i)) + for (unsigned i = 0, e = yyvsp[-1].ConstVector->size(); i != e; ++i) + if ((*yyvsp[-1].ConstVector)[i]->getType() != STy->getElementType(i)) GEN_ERROR("Expected type '" + STy->getElementType(i)->getDescription() + "' for element #" + utostr(i) + " of structure initializer!"); - (yyval.ConstVal) = ConstantStruct::get(STy, *(yyvsp[-1].ConstVector)); - delete (yyvsp[-3].TypeVal); delete (yyvsp[-1].ConstVector); + yyval.ConstVal = ConstantStruct::get(STy, *yyvsp[-1].ConstVector); + delete yyvsp[-3].TypeVal; delete yyvsp[-1].ConstVector; CHECK_FOR_ERROR - ;} - break; - - case 102: -#line 1447 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - const StructType *STy = dyn_cast((yyvsp[-2].TypeVal)->get()); + ; + break;} +case 101: +#line 1447 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + const StructType *STy = dyn_cast(yyvsp[-2].TypeVal->get()); if (STy == 0) GEN_ERROR("Cannot make struct constant with type: '" + - (*(yyvsp[-2].TypeVal))->getDescription() + "'!"); + (*yyvsp[-2].TypeVal)->getDescription() + "'!"); if (STy->getNumContainedTypes() != 0) GEN_ERROR("Illegal number of initializers for structure type!"); - (yyval.ConstVal) = ConstantStruct::get(STy, std::vector()); - delete (yyvsp[-2].TypeVal); + yyval.ConstVal = ConstantStruct::get(STy, std::vector()); + delete yyvsp[-2].TypeVal; CHECK_FOR_ERROR - ;} - break; - - case 103: -#line 1460 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - const PointerType *PTy = dyn_cast((yyvsp[-1].TypeVal)->get()); + ; + break;} +case 102: +#line 1460 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + const PointerType *PTy = dyn_cast(yyvsp[-1].TypeVal->get()); if (PTy == 0) GEN_ERROR("Cannot make null pointer constant with type: '" + - (*(yyvsp[-1].TypeVal))->getDescription() + "'!"); + (*yyvsp[-1].TypeVal)->getDescription() + "'!"); - (yyval.ConstVal) = ConstantPointerNull::get(PTy); - delete (yyvsp[-1].TypeVal); + yyval.ConstVal = ConstantPointerNull::get(PTy); + delete yyvsp[-1].TypeVal; CHECK_FOR_ERROR - ;} - break; - - case 104: -#line 1470 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get()); - delete (yyvsp[-1].TypeVal); + ; + break;} +case 103: +#line 1470 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ConstVal = UndefValue::get(yyvsp[-1].TypeVal->get()); + delete yyvsp[-1].TypeVal; CHECK_FOR_ERROR - ;} - break; - - case 105: -#line 1475 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - const PointerType *Ty = dyn_cast((yyvsp[-1].TypeVal)->get()); + ; + break;} +case 104: +#line 1475 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + const PointerType *Ty = dyn_cast(yyvsp[-1].TypeVal->get()); if (Ty == 0) GEN_ERROR("Global const reference must be a pointer type!"); @@ -3510,7 +2858,7 @@ Function *SavedCurFn = CurFun.CurrentFunction; CurFun.CurrentFunction = 0; - Value *V = getValNonImprovising(Ty, (yyvsp[0].ValIDVal)); + Value *V = getValNonImprovising(Ty, yyvsp[0].ValIDVal); CHECK_FOR_ERROR CurFun.CurrentFunction = SavedCurFn; @@ -3525,14 +2873,14 @@ // First check to see if the forward references value is already created! PerModuleInfo::GlobalRefsType::iterator I = - CurModule.GlobalRefs.find(std::make_pair(PT, (yyvsp[0].ValIDVal))); + CurModule.GlobalRefs.find(std::make_pair(PT, yyvsp[0].ValIDVal)); if (I != CurModule.GlobalRefs.end()) { V = I->second; // Placeholder already exists, use it... - (yyvsp[0].ValIDVal).destroy(); + yyvsp[0].ValIDVal.destroy(); } else { std::string Name; - if ((yyvsp[0].ValIDVal).Type == ValID::NameVal) Name = (yyvsp[0].ValIDVal).Name; + if (yyvsp[0].ValIDVal.Type == ValID::NameVal) Name = yyvsp[0].ValIDVal.Name; // Create the forward referenced global. GlobalValue *GV; @@ -3547,160 +2895,149 @@ } // 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)); + 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 + yyval.ConstVal = cast(V); + delete yyvsp[-1].TypeVal; // Free the type handle CHECK_FOR_ERROR - ;} - break; - - case 106: -#line 1536 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType()) + ; + break;} +case 105: +#line 1536 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + if (yyvsp[-1].TypeVal->get() != yyvsp[0].ConstVal->getType()) GEN_ERROR("Mismatched types for constant expression!"); - (yyval.ConstVal) = (yyvsp[0].ConstVal); - delete (yyvsp[-1].TypeVal); + yyval.ConstVal = yyvsp[0].ConstVal; + delete yyvsp[-1].TypeVal; CHECK_FOR_ERROR - ;} - break; - - case 107: -#line 1543 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - const Type *Ty = (yyvsp[-1].TypeVal)->get(); + ; + break;} +case 106: +#line 1543 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + const Type *Ty = yyvsp[-1].TypeVal->get(); if (isa(Ty) || Ty == Type::LabelTy || isa(Ty)) GEN_ERROR("Cannot create a null initialized value of this type!"); - (yyval.ConstVal) = Constant::getNullValue(Ty); - delete (yyvsp[-1].TypeVal); + yyval.ConstVal = Constant::getNullValue(Ty); + delete yyvsp[-1].TypeVal; CHECK_FOR_ERROR - ;} - break; - - case 108: -#line 1552 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { // integral constants - if (!ConstantSInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val))) + ; + break;} +case 107: +#line 1552 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // integral constants + if (!ConstantSInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].SInt64Val)) GEN_ERROR("Constant value doesn't fit in type!"); - (yyval.ConstVal) = ConstantSInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)); + yyval.ConstVal = ConstantSInt::get(yyvsp[-1].PrimType, yyvsp[0].SInt64Val); CHECK_FOR_ERROR - ;} - break; - - case 109: -#line 1558 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { // integral constants - if (!ConstantUInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val))) + ; + break;} +case 108: +#line 1558 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // integral constants + if (!ConstantUInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].UInt64Val)) GEN_ERROR("Constant value doesn't fit in type!"); - (yyval.ConstVal) = ConstantUInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)); - CHECK_FOR_ERROR - ;} - break; - - case 110: -#line 1564 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { // Boolean constants - (yyval.ConstVal) = ConstantBool::True; - CHECK_FOR_ERROR - ;} - break; - - case 111: -#line 1568 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { // Boolean constants - (yyval.ConstVal) = ConstantBool::False; + yyval.ConstVal = ConstantUInt::get(yyvsp[-1].PrimType, yyvsp[0].UInt64Val); CHECK_FOR_ERROR - ;} - break; - - case 112: -#line 1572 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { // Float & Double constants - if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal))) + ; + break;} +case 109: +#line 1564 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Boolean constants + yyval.ConstVal = ConstantBool::getTrue(); + CHECK_FOR_ERROR + ; + break;} +case 110: +#line 1568 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Boolean constants + yyval.ConstVal = ConstantBool::getFalse(); + CHECK_FOR_ERROR + ; + break;} +case 111: +#line 1572 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Float & Double constants + if (!ConstantFP::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].FPVal)) GEN_ERROR("Floating point constant invalid for type!!"); - (yyval.ConstVal) = ConstantFP::get((yyvsp[-1].PrimType), (yyvsp[0].FPVal)); + yyval.ConstVal = ConstantFP::get(yyvsp[-1].PrimType, yyvsp[0].FPVal); CHECK_FOR_ERROR - ;} - break; - - case 113: -#line 1580 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - if (!(yyvsp[-3].ConstVal)->getType()->isFirstClassType()) + ; + break;} +case 112: +#line 1580 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + if (!yyvsp[-3].ConstVal->getType()->isFirstClassType()) GEN_ERROR("cast constant expression from a non-primitive type: '" + - (yyvsp[-3].ConstVal)->getType()->getDescription() + "'!"); - if (!(yyvsp[-1].TypeVal)->get()->isFirstClassType()) + yyvsp[-3].ConstVal->getType()->getDescription() + "'!"); + if (!yyvsp[-1].TypeVal->get()->isFirstClassType()) GEN_ERROR("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); - CHECK_FOR_ERROR - ;} - break; - - case 114: -#line 1591 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - if (!isa((yyvsp[-2].ConstVal)->getType())) + yyvsp[-1].TypeVal->get()->getDescription() + "'!"); + yyval.ConstVal = ConstantExpr::getCast(yyvsp[-3].ConstVal, yyvsp[-1].TypeVal->get()); + delete yyvsp[-1].TypeVal; + CHECK_FOR_ERROR + ; + break;} +case 113: +#line 1591 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + if (!isa(yyvsp[-2].ConstVal->getType())) GEN_ERROR("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) + 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 (ConstantUInt *CUI = dyn_cast((*yyvsp[-1].ValueList)[i])) if (CUI->getType() == Type::UByteTy) - (*(yyvsp[-1].ValueList))[i] = ConstantExpr::getCast(CUI, Type::UIntTy); + (*yyvsp[-1].ValueList)[i] = ConstantExpr::getCast(CUI, Type::UIntTy); const Type *IdxTy = - GetElementPtrInst::getIndexedType((yyvsp[-2].ConstVal)->getType(), *(yyvsp[-1].ValueList), true); + GetElementPtrInst::getIndexedType(yyvsp[-2].ConstVal->getType(), *yyvsp[-1].ValueList, true); if (!IdxTy) GEN_ERROR("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])) + for (unsigned i = 0, e = yyvsp[-1].ValueList->size(); i != e; ++i) + if (Constant *C = dyn_cast((*yyvsp[-1].ValueList)[i])) IdxVec.push_back(C); else GEN_ERROR("Indices to constant getelementptr must be constants!"); - delete (yyvsp[-1].ValueList); + delete yyvsp[-1].ValueList; - (yyval.ConstVal) = ConstantExpr::getGetElementPtr((yyvsp[-2].ConstVal), IdxVec); + yyval.ConstVal = ConstantExpr::getGetElementPtr(yyvsp[-2].ConstVal, IdxVec); CHECK_FOR_ERROR - ;} - break; - - case 115: -#line 1623 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[-5].ConstVal)->getType() != Type::BoolTy) + ; + break;} +case 114: +#line 1623 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + if (yyvsp[-5].ConstVal->getType() != Type::BoolTy) GEN_ERROR("Select condition must be of boolean type!"); - if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) + if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) GEN_ERROR("Select operand types must match!"); - (yyval.ConstVal) = ConstantExpr::getSelect((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); + yyval.ConstVal = ConstantExpr::getSelect(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); CHECK_FOR_ERROR - ;} - break; - - case 116: -#line 1631 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) + ; + break;} +case 115: +#line 1631 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) GEN_ERROR("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)); + 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()) { @@ -3708,154 +3045,138 @@ case Module::Pointer64: IntPtrTy = Type::LongTy; break; default: GEN_ERROR("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()); + 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()); } CHECK_FOR_ERROR - ;} - break; - - case 117: -#line 1653 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) + ; + break;} +case 116: +#line 1653 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) GEN_ERROR("Logical operator types must match!"); - if (!(yyvsp[-3].ConstVal)->getType()->isIntegral()) { - if (!isa((yyvsp[-3].ConstVal)->getType()) || - !cast((yyvsp[-3].ConstVal)->getType())->getElementType()->isIntegral()) + if (!yyvsp[-3].ConstVal->getType()->isIntegral()) { + if (!isa(yyvsp[-3].ConstVal->getType()) || + !cast(yyvsp[-3].ConstVal->getType())->getElementType()->isIntegral()) GEN_ERROR("Logical operator requires integral operands!"); } - (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); + yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); CHECK_FOR_ERROR - ;} - break; - - case 118: -#line 1664 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) + ; + break;} +case 117: +#line 1664 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) GEN_ERROR("setcc operand types must match!"); - (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); + yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); CHECK_FOR_ERROR - ;} - break; - - case 119: -#line 1670 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[-1].ConstVal)->getType() != Type::UByteTy) + ; + break;} +case 118: +#line 1670 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + if (yyvsp[-1].ConstVal->getType() != Type::UByteTy) GEN_ERROR("Shift count for shift constant must be unsigned byte!"); - if (!(yyvsp[-3].ConstVal)->getType()->isInteger()) + if (!yyvsp[-3].ConstVal->getType()->isInteger()) GEN_ERROR("Shift constant expression requires integer operand!"); - (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].OtherOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); + yyval.ConstVal = ConstantExpr::get(yyvsp[-5].OtherOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); CHECK_FOR_ERROR - ;} - break; - - case 120: -#line 1678 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) + ; + break;} +case 119: +#line 1678 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + if (!ExtractElementInst::isValidOperands(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal)) GEN_ERROR("Invalid extractelement operands!"); - (yyval.ConstVal) = ConstantExpr::getExtractElement((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); + yyval.ConstVal = ConstantExpr::getExtractElement(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); CHECK_FOR_ERROR - ;} - break; - - case 121: -#line 1684 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) + ; + break;} +case 120: +#line 1684 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + if (!InsertElementInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal)) GEN_ERROR("Invalid insertelement operands!"); - (yyval.ConstVal) = ConstantExpr::getInsertElement((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); + yyval.ConstVal = ConstantExpr::getInsertElement(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); CHECK_FOR_ERROR - ;} - break; - - case 122: -#line 1690 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) + ; + break;} +case 121: +#line 1690 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + if (!ShuffleVectorInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal)) GEN_ERROR("Invalid shufflevector operands!"); - (yyval.ConstVal) = ConstantExpr::getShuffleVector((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); + yyval.ConstVal = ConstantExpr::getShuffleVector(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); CHECK_FOR_ERROR - ;} - break; - - case 123: -#line 1699 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal)); + ; + break;} +case 122: +#line 1699 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(yyvsp[0].ConstVal); CHECK_FOR_ERROR - ;} - break; - - case 124: -#line 1703 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ConstVector) = new std::vector(); - (yyval.ConstVector)->push_back((yyvsp[0].ConstVal)); + ; + break;} +case 123: +#line 1703 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ConstVector = new std::vector(); + yyval.ConstVector->push_back(yyvsp[0].ConstVal); CHECK_FOR_ERROR - ;} - break; - - case 125: -#line 1711 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.BoolVal) = false; ;} - break; - - case 126: -#line 1711 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.BoolVal) = true; ;} - break; - - case 127: -#line 1721 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ModuleVal) = ParserResult = (yyvsp[0].ModuleVal); + ; + break;} +case 124: +#line 1711 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.BoolVal = false; ; + break;} +case 125: +#line 1711 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.BoolVal = true; ; + break;} +case 126: +#line 1721 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ModuleVal = ParserResult = yyvsp[0].ModuleVal; CurModule.ModuleDone(); CHECK_FOR_ERROR -;} - break; - - case 128: -#line 1729 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); +; + break;} +case 127: +#line 1729 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ModuleVal = yyvsp[-1].ModuleVal; CurFun.FunctionDone(); CHECK_FOR_ERROR - ;} - break; - - case 129: -#line 1734 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); + ; + break;} +case 128: +#line 1734 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ModuleVal = yyvsp[-1].ModuleVal; CHECK_FOR_ERROR - ;} - break; - - case 130: -#line 1738 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ModuleVal) = (yyvsp[-3].ModuleVal); + ; + break;} +case 129: +#line 1738 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ModuleVal = yyvsp[-3].ModuleVal; CHECK_FOR_ERROR - ;} - break; - - case 131: -#line 1742 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); + ; + break;} +case 130: +#line 1742 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ModuleVal = yyvsp[-1].ModuleVal; CHECK_FOR_ERROR - ;} - break; - - case 132: -#line 1746 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ModuleVal) = CurModule.CurrentModule; + ; + break;} +case 131: +#line 1746 "/Volumes/ProjectsDisk/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; @@ -3866,12 +3187,11 @@ } } CHECK_FOR_ERROR - ;} - break; - - case 133: -#line 1761 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 132: +#line 1761 "/Volumes/ProjectsDisk/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: // @@ -3881,297 +3201,266 @@ // 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)); + ResolveTypeTo(yyvsp[-2].StrVal, *yyvsp[0].TypeVal); - if (!setTypeName(*(yyvsp[0].TypeVal), (yyvsp[-2].StrVal)) && !(yyvsp[-2].StrVal)) { + if (!setTypeName(*yyvsp[0].TypeVal, yyvsp[-2].StrVal) && !yyvsp[-2].StrVal) { CHECK_FOR_ERROR // If this is a named type that is not a redefinition, add it to the slot // table. - CurModule.Types.push_back(*(yyvsp[0].TypeVal)); + CurModule.Types.push_back(*yyvsp[0].TypeVal); } - delete (yyvsp[0].TypeVal); - CHECK_FOR_ERROR - ;} - break; - - case 134: -#line 1783 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { // Function prototypes can be in const pool + delete yyvsp[0].TypeVal; CHECK_FOR_ERROR - ;} - break; - - case 135: -#line 1786 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { // Asm blocks can be in the const pool - CHECK_FOR_ERROR - ;} - break; - - case 136: -#line 1789 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[0].ConstVal) == 0) + ; + break;} +case 133: +#line 1783 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Function prototypes can be in const pool + CHECK_FOR_ERROR + ; + break;} +case 134: +#line 1786 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Asm blocks can be in the const pool + CHECK_FOR_ERROR + ; + break;} +case 135: +#line 1789 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + if (yyvsp[0].ConstVal == 0) GEN_ERROR("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)); + CurGV = ParseGlobalVariable(yyvsp[-3].StrVal, yyvsp[-2].Linkage, yyvsp[-1].BoolVal, yyvsp[0].ConstVal->getType(), yyvsp[0].ConstVal); CHECK_FOR_ERROR - ;} - break; - - case 137: -#line 1794 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 136: +#line 1794 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ CurGV = 0; - ;} - break; - - case 138: -#line 1797 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); + ; + break;} +case 137: +#line 1797 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + CurGV = ParseGlobalVariable(yyvsp[-3].StrVal, GlobalValue::ExternalLinkage, yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0); CHECK_FOR_ERROR - delete (yyvsp[0].TypeVal); - ;} - break; - - case 139: -#line 1801 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { + delete yyvsp[0].TypeVal; + ; + break;} +case 138: +#line 1801 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ CurGV = 0; CHECK_FOR_ERROR - ;} - break; - - case 140: -#line 1805 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::DLLImportLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); + ; + break;} +case 139: +#line 1805 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + CurGV = ParseGlobalVariable(yyvsp[-3].StrVal, GlobalValue::DLLImportLinkage, yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0); CHECK_FOR_ERROR - delete (yyvsp[0].TypeVal); - ;} - break; - - case 141: -#line 1809 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { + delete yyvsp[0].TypeVal; + ; + break;} +case 140: +#line 1809 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ CurGV = 0; CHECK_FOR_ERROR - ;} - break; - - case 142: -#line 1813 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 141: +#line 1813 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ CurGV = - ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalWeakLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); + ParseGlobalVariable(yyvsp[-3].StrVal, GlobalValue::ExternalWeakLinkage, yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0); CHECK_FOR_ERROR - delete (yyvsp[0].TypeVal); - ;} - break; - - case 143: -#line 1818 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { + delete yyvsp[0].TypeVal; + ; + break;} +case 142: +#line 1818 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ CurGV = 0; CHECK_FOR_ERROR - ;} - break; - - case 144: -#line 1822 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - CHECK_FOR_ERROR - ;} - break; - - case 145: -#line 1825 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 143: +#line 1822 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + CHECK_FOR_ERROR + ; + break;} +case 144: +#line 1825 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ CHECK_FOR_ERROR - ;} - break; - - case 146: -#line 1828 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - ;} - break; - - case 147: -#line 1832 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 145: +#line 1828 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + ; + break;} +case 146: +#line 1832 "/Volumes/ProjectsDisk/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)); + 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); CHECK_FOR_ERROR -;} - break; - - case 148: -#line 1845 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.Endianness) = Module::BigEndian; ;} - break; - - case 149: -#line 1846 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.Endianness) = Module::LittleEndian; ;} - break; - - case 150: -#line 1848 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - CurModule.CurrentModule->setEndianness((yyvsp[0].Endianness)); +; + break;} +case 147: +#line 1845 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.Endianness = Module::BigEndian; ; + break;} +case 148: +#line 1846 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.Endianness = Module::LittleEndian; ; + break;} +case 149: +#line 1848 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + CurModule.CurrentModule->setEndianness(yyvsp[0].Endianness); CHECK_FOR_ERROR - ;} - break; - - case 151: -#line 1852 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[0].UInt64Val) == 32) + ; + break;} +case 150: +#line 1852 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + if (yyvsp[0].UInt64Val == 32) CurModule.CurrentModule->setPointerSize(Module::Pointer32); - else if ((yyvsp[0].UInt64Val) == 64) + else if (yyvsp[0].UInt64Val == 64) CurModule.CurrentModule->setPointerSize(Module::Pointer64); else - GEN_ERROR("Invalid pointer size: '" + utostr((yyvsp[0].UInt64Val)) + "'!"); + GEN_ERROR("Invalid pointer size: '" + utostr(yyvsp[0].UInt64Val) + "'!"); CHECK_FOR_ERROR - ;} - break; - - case 152: -#line 1861 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal)); - free((yyvsp[0].StrVal)); + ; + break;} +case 151: +#line 1861 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + CurModule.CurrentModule->setTargetTriple(yyvsp[0].StrVal); + free(yyvsp[0].StrVal); CHECK_FOR_ERROR - ;} - break; - - case 154: -#line 1869 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); - free((yyvsp[0].StrVal)); + ; + break;} +case 153: +#line 1869 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal); + free(yyvsp[0].StrVal); CHECK_FOR_ERROR - ;} - break; - - case 155: -#line 1874 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); - free((yyvsp[0].StrVal)); + ; + break;} +case 154: +#line 1874 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal); + free(yyvsp[0].StrVal); CHECK_FOR_ERROR - ;} - break; - - case 156: -#line 1879 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 155: +#line 1879 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ CHECK_FOR_ERROR - ;} - break; - - case 160: -#line 1889 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.StrVal) = 0; ;} - break; - - case 161: -#line 1891 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - if (*(yyvsp[-1].TypeVal) == Type::VoidTy) + ; + break;} +case 159: +#line 1889 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.StrVal = 0; ; + break;} +case 160: +#line 1891 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + if (*yyvsp[-1].TypeVal == Type::VoidTy) GEN_ERROR("void typed arguments are invalid!"); - (yyval.ArgVal) = new std::pair((yyvsp[-1].TypeVal), (yyvsp[0].StrVal)); + yyval.ArgVal = new std::pair(yyvsp[-1].TypeVal, yyvsp[0].StrVal); CHECK_FOR_ERROR -;} - break; - - case 162: -#line 1898 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ArgList) = (yyvsp[-2].ArgList); - (yyvsp[-2].ArgList)->push_back(*(yyvsp[0].ArgVal)); - delete (yyvsp[0].ArgVal); - CHECK_FOR_ERROR - ;} - break; - - case 163: -#line 1904 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ArgList) = new std::vector >(); - (yyval.ArgList)->push_back(*(yyvsp[0].ArgVal)); - delete (yyvsp[0].ArgVal); - CHECK_FOR_ERROR - ;} - break; - - case 164: -#line 1911 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ArgList) = (yyvsp[0].ArgList); +; + break;} +case 161: +#line 1898 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ArgList = yyvsp[-2].ArgList; + yyvsp[-2].ArgList->push_back(*yyvsp[0].ArgVal); + delete yyvsp[0].ArgVal; + CHECK_FOR_ERROR + ; + break;} +case 162: +#line 1904 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ArgList = new std::vector >(); + yyval.ArgList->push_back(*yyvsp[0].ArgVal); + delete yyvsp[0].ArgVal; + CHECK_FOR_ERROR + ; + break;} +case 163: +#line 1911 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ArgList = yyvsp[0].ArgList; CHECK_FOR_ERROR - ;} - break; - - case 165: -#line 1915 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ArgList) = (yyvsp[-2].ArgList); - (yyval.ArgList)->push_back(std::pairpush_back(std::pair(new PATypeHolder(Type::VoidTy), 0)); CHECK_FOR_ERROR - ;} - break; - - case 166: -#line 1921 "/proj/llvm/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 165: +#line 1921 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ArgList = new std::vector >(); + yyval.ArgList->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0)); CHECK_FOR_ERROR - ;} - break; - - case 167: -#line 1926 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ArgList) = 0; + ; + break;} +case 166: +#line 1926 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ArgList = 0; CHECK_FOR_ERROR - ;} - break; - - case 168: -#line 1932 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - UnEscapeLexed((yyvsp[-5].StrVal)); - std::string FunctionName((yyvsp[-5].StrVal)); - free((yyvsp[-5].StrVal)); // Free strdup'd memory! + ; + break;} +case 167: +#line 1932 "/Volumes/ProjectsDisk/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) + if (!(*yyvsp[-6].TypeVal)->isFirstClassType() && *yyvsp[-6].TypeVal != Type::VoidTy) GEN_ERROR("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) + 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 FunctionType *FT = FunctionType::get(*yyvsp[-6].TypeVal, ParamTypeList, isVarArg); const PointerType *PFT = PointerType::get(FT); - delete (yyvsp[-6].TypeVal); + delete yyvsp[-6].TypeVal; ValID ID; if (!FunctionName.empty()) { @@ -4215,24 +3504,24 @@ // another function. Fn->setLinkage(CurFun.Linkage); } - Fn->setCallingConv((yyvsp[-7].UIntVal)); - Fn->setAlignment((yyvsp[0].UIntVal)); - if ((yyvsp[-1].StrVal)) { - Fn->setSection((yyvsp[-1].StrVal)); - free((yyvsp[-1].StrVal)); + 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 (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&& + 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 + 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) { + 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... @@ -4240,140 +3529,123 @@ InsertValue(ArgIt); } - delete (yyvsp[-3].ArgList); // We're now done with the argument list + delete yyvsp[-3].ArgList; // We're now done with the argument list } CHECK_FOR_ERROR -;} - break; - - case 171: -#line 2028 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.FunctionVal) = CurFun.CurrentFunction; +; + break;} +case 170: +#line 2028 "/Volumes/ProjectsDisk/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 174: -#line 2038 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); + yyval.FunctionVal->setLinkage(yyvsp[-2].Linkage); +; + break;} +case 173: +#line 2038 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.FunctionVal = yyvsp[-1].FunctionVal; CHECK_FOR_ERROR -;} - break; - - case 176: -#line 2044 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { CurFun.Linkage = GlobalValue::DLLImportLinkage ;} - break; - - case 177: -#line 2045 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { CurFun.Linkage = GlobalValue::DLLImportLinkage ;} - break; - - case 178: -#line 2047 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { CurFun.isDeclare = true; ;} - break; - - case 179: -#line 2047 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.FunctionVal) = CurFun.CurrentFunction; +; + break;} +case 175: +#line 2044 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ CurFun.Linkage = GlobalValue::DLLImportLinkage ; + break;} +case 176: +#line 2045 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ CurFun.Linkage = GlobalValue::DLLImportLinkage ; + break;} +case 177: +#line 2047 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ CurFun.isDeclare = true; ; + break;} +case 178: +#line 2047 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.FunctionVal = CurFun.CurrentFunction; CurFun.FunctionDone(); CHECK_FOR_ERROR - ;} - break; - - case 180: -#line 2057 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.BoolVal) = false; - CHECK_FOR_ERROR - ;} - break; - - case 181: -#line 2061 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.BoolVal) = true; - CHECK_FOR_ERROR - ;} - break; - - case 182: -#line 2066 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { // A reference to a direct constant - (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val)); - CHECK_FOR_ERROR - ;} - break; - - case 183: -#line 2070 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val)); + ; + break;} +case 179: +#line 2057 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.BoolVal = false; CHECK_FOR_ERROR - ;} - break; - - case 184: -#line 2074 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { // Perhaps it's an FP constant? - (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal)); + ; + break;} +case 180: +#line 2061 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.BoolVal = true; CHECK_FOR_ERROR - ;} - break; - - case 185: -#line 2078 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ValIDVal) = ValID::create(ConstantBool::True); + ; + break;} +case 181: +#line 2066 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // A reference to a direct constant + yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val); + CHECK_FOR_ERROR + ; + break;} +case 182: +#line 2070 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val); CHECK_FOR_ERROR - ;} - break; - - case 186: -#line 2082 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ValIDVal) = ValID::create(ConstantBool::False); + ; + break;} +case 183: +#line 2074 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Perhaps it's an FP constant? + yyval.ValIDVal = ValID::create(yyvsp[0].FPVal); + CHECK_FOR_ERROR + ; + break;} +case 184: +#line 2078 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ValIDVal = ValID::create(ConstantBool::getTrue()); CHECK_FOR_ERROR - ;} - break; - - case 187: -#line 2086 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ValIDVal) = ValID::createNull(); + ; + break;} +case 185: +#line 2082 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ValIDVal = ValID::create(ConstantBool::getFalse()); CHECK_FOR_ERROR - ;} - break; - - case 188: -#line 2090 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ValIDVal) = ValID::createUndef(); + ; + break;} +case 186: +#line 2086 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ValIDVal = ValID::createNull(); CHECK_FOR_ERROR - ;} - break; - - case 189: -#line 2094 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { // A vector zero constant. - (yyval.ValIDVal) = ValID::createZeroInit(); + ; + break;} +case 187: +#line 2090 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ValIDVal = ValID::createUndef(); CHECK_FOR_ERROR - ;} - break; - - case 190: -#line 2098 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { // Nonempty unsized packed vector - const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType(); - int NumElements = (yyvsp[-1].ConstVector)->size(); + ; + break;} +case 188: +#line 2094 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // A vector zero constant. + yyval.ValIDVal = ValID::createZeroInit(); + CHECK_FOR_ERROR + ; + break;} +case 189: +#line 2098 "/Volumes/ProjectsDisk/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( @@ -4385,108 +3657,98 @@ ); // Verify all elements are correct type! - for (unsigned i = 0; i < (yyvsp[-1].ConstVector)->size(); i++) { - if (ETy != (*(yyvsp[-1].ConstVector))[i]->getType()) + for (unsigned i = 0; i < yyvsp[-1].ConstVector->size(); i++) { + if (ETy != (*yyvsp[-1].ConstVector)[i]->getType()) GEN_ERROR("Element #" + utostr(i) + " is not of type '" + ETy->getDescription() +"' as required!\nIt is of type '" + - (*(yyvsp[-1].ConstVector))[i]->getType()->getDescription() + "'."); + (*yyvsp[-1].ConstVector)[i]->getType()->getDescription() + "'."); } - (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, *(yyvsp[-1].ConstVector))); - delete PTy; delete (yyvsp[-1].ConstVector); - CHECK_FOR_ERROR - ;} - break; - - case 191: -#line 2123 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal)); - CHECK_FOR_ERROR - ;} - break; - - case 192: -#line 2127 "/proj/llvm/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)); + yyval.ValIDVal = ValID::create(ConstantPacked::get(pt, *yyvsp[-1].ConstVector)); + delete PTy; delete yyvsp[-1].ConstVector; CHECK_FOR_ERROR - ;} - break; - - case 193: -#line 2141 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { // Is it an integer reference...? - (yyval.ValIDVal) = ValID::create((yyvsp[0].SIntVal)); - CHECK_FOR_ERROR - ;} - break; - - case 194: -#line 2145 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { // Is it a named reference...? - (yyval.ValIDVal) = ValID::create((yyvsp[0].StrVal)); - CHECK_FOR_ERROR - ;} - break; - - case 197: -#line 2157 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); delete (yyvsp[-1].TypeVal); - CHECK_FOR_ERROR - ;} - break; - - case 198: -#line 2162 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); - CHECK_FOR_ERROR - ;} - break; - - case 199: -#line 2166 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { // Do not allow functions with 0 basic blocks - (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); + ; + break;} +case 190: +#line 2123 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ValIDVal = ValID::create(yyvsp[0].ConstVal); CHECK_FOR_ERROR - ;} - break; - - case 200: -#line 2175 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal)); + ; + break;} +case 191: +#line 2127 "/Volumes/ProjectsDisk/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); + CHECK_FOR_ERROR + ; + break;} +case 192: +#line 2141 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Is it an integer reference...? + yyval.ValIDVal = ValID::create(yyvsp[0].SIntVal); + CHECK_FOR_ERROR + ; + break;} +case 193: +#line 2145 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Is it a named reference...? + yyval.ValIDVal = ValID::create(yyvsp[0].StrVal); + CHECK_FOR_ERROR + ; + break;} +case 196: +#line 2157 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ValueVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal); delete yyvsp[-1].TypeVal; CHECK_FOR_ERROR - InsertValue((yyvsp[0].TermInstVal)); - - (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal)); - InsertValue((yyvsp[-2].BasicBlockVal)); - (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal); + ; + break;} +case 197: +#line 2162 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.FunctionVal = yyvsp[-1].FunctionVal; CHECK_FOR_ERROR - ;} - break; - - case 201: -#line 2186 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal)); - (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal); + ; + break;} +case 198: +#line 2166 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Do not allow functions with 0 basic blocks + yyval.FunctionVal = yyvsp[-1].FunctionVal; + CHECK_FOR_ERROR + ; + break;} +case 199: +#line 2175 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + setValueName(yyvsp[0].TermInstVal, yyvsp[-1].StrVal); CHECK_FOR_ERROR - ;} - break; + InsertValue(yyvsp[0].TermInstVal); - case 202: -#line 2191 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((int)CurFun.NextBBNum++), true); + yyvsp[-2].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal); + InsertValue(yyvsp[-2].BasicBlockVal); + yyval.BasicBlockVal = yyvsp[-2].BasicBlockVal; + CHECK_FOR_ERROR + ; + break;} +case 200: +#line 2186 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal); + yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal; + CHECK_FOR_ERROR + ; + break;} +case 201: +#line 2191 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.BasicBlockVal = CurBB = getBBVal(ValID::create((int)CurFun.NextBBNum++), true); CHECK_FOR_ERROR // Make sure to move the basic block to the correct location in the @@ -4494,15 +3756,14 @@ // referenced. Function::BasicBlockListType &BBL = CurFun.CurrentFunction->getBasicBlockList(); - BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal)); + BBL.splice(BBL.end(), BBL, yyval.BasicBlockVal); CHECK_FOR_ERROR - ;} - break; - - case 203: -#line 2203 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((yyvsp[0].StrVal)), true); + ; + break;} +case 202: +#line 2203 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.BasicBlockVal = CurBB = getBBVal(ValID::create(yyvsp[0].StrVal), true); CHECK_FOR_ERROR // Make sure to move the basic block to the correct location in the @@ -4510,97 +3771,90 @@ // referenced. Function::BasicBlockListType &BBL = CurFun.CurrentFunction->getBasicBlockList(); - BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal)); - CHECK_FOR_ERROR - ;} - break; - - case 204: -#line 2216 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { // Return with a result... - (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal)); - CHECK_FOR_ERROR - ;} - break; - - case 205: -#line 2220 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { // Return with no result... - (yyval.TermInstVal) = new ReturnInst(); - CHECK_FOR_ERROR - ;} - break; - - case 206: -#line 2224 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { // Unconditional Branch... - BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); - CHECK_FOR_ERROR - (yyval.TermInstVal) = new BranchInst(tmpBB); - ;} - break; - - case 207: -#line 2229 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal)); - CHECK_FOR_ERROR - BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal)); + BBL.splice(BBL.end(), BBL, yyval.BasicBlockVal); CHECK_FOR_ERROR - Value* tmpVal = getVal(Type::BoolTy, (yyvsp[-6].ValIDVal)); - CHECK_FOR_ERROR - (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal); - ;} - break; - - case 208: -#line 2238 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal)); + ; + break;} +case 203: +#line 2216 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Return with a result... + yyval.TermInstVal = new ReturnInst(yyvsp[0].ValueVal); + CHECK_FOR_ERROR + ; + break;} +case 204: +#line 2220 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Return with no result... + yyval.TermInstVal = new ReturnInst(); + CHECK_FOR_ERROR + ; + break;} +case 205: +#line 2224 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Unconditional Branch... + BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal); + CHECK_FOR_ERROR + yyval.TermInstVal = new BranchInst(tmpBB); + ; + break;} +case 206: +#line 2229 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + BasicBlock* tmpBBA = getBBVal(yyvsp[-3].ValIDVal); + CHECK_FOR_ERROR + BasicBlock* tmpBBB = getBBVal(yyvsp[0].ValIDVal); + CHECK_FOR_ERROR + Value* tmpVal = getVal(Type::BoolTy, yyvsp[-6].ValIDVal); + CHECK_FOR_ERROR + yyval.TermInstVal = new BranchInst(tmpBBA, tmpBBB, tmpVal); + ; + break;} +case 207: +#line 2238 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + Value* tmpVal = getVal(yyvsp[-7].PrimType, yyvsp[-6].ValIDVal); CHECK_FOR_ERROR - BasicBlock* tmpBB = getBBVal((yyvsp[-3].ValIDVal)); + BasicBlock* tmpBB = getBBVal(yyvsp[-3].ValIDVal); CHECK_FOR_ERROR - SwitchInst *S = new SwitchInst(tmpVal, tmpBB, (yyvsp[-1].JumpTable)->size()); - (yyval.TermInstVal) = S; + SwitchInst *S = new SwitchInst(tmpVal, tmpBB, yyvsp[-1].JumpTable->size()); + yyval.TermInstVal = S; - std::vector >::iterator I = (yyvsp[-1].JumpTable)->begin(), - E = (yyvsp[-1].JumpTable)->end(); + std::vector >::iterator I = yyvsp[-1].JumpTable->begin(), + E = yyvsp[-1].JumpTable->end(); for (; I != E; ++I) { if (ConstantInt *CI = dyn_cast(I->first)) S->addCase(CI, I->second); else GEN_ERROR("Switch case is constant, but not a simple integer!"); } - delete (yyvsp[-1].JumpTable); + delete yyvsp[-1].JumpTable; CHECK_FOR_ERROR - ;} - break; - - case 209: -#line 2257 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal)); + ; + break;} +case 208: +#line 2257 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + Value* tmpVal = getVal(yyvsp[-6].PrimType, yyvsp[-5].ValIDVal); CHECK_FOR_ERROR - BasicBlock* tmpBB = getBBVal((yyvsp[-2].ValIDVal)); + BasicBlock* tmpBB = getBBVal(yyvsp[-2].ValIDVal); CHECK_FOR_ERROR SwitchInst *S = new SwitchInst(tmpVal, tmpBB, 0); - (yyval.TermInstVal) = S; + yyval.TermInstVal = S; CHECK_FOR_ERROR - ;} - break; - - case 210: -#line 2267 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 209: +#line 2267 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ const PointerType *PFTy; const FunctionType *Ty; - if (!(PFTy = dyn_cast((yyvsp[-10].TypeVal)->get())) || + 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(); + 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()); } @@ -4608,27 +3862,27 @@ bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy; if (isVarArg) ParamTypes.pop_back(); - Ty = FunctionType::get((yyvsp[-10].TypeVal)->get(), ParamTypes, isVarArg); + 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... + Value *V = getVal(PFTy, yyvsp[-9].ValIDVal); // Get the function we're calling... CHECK_FOR_ERROR - BasicBlock *Normal = getBBVal((yyvsp[-3].ValIDVal)); + BasicBlock *Normal = getBBVal(yyvsp[-3].ValIDVal); CHECK_FOR_ERROR - BasicBlock *Except = getBBVal((yyvsp[0].ValIDVal)); + BasicBlock *Except = getBBVal(yyvsp[0].ValIDVal); CHECK_FOR_ERROR // Create the call node... - if (!(yyvsp[-7].ValueList)) { // Has no arguments? - (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, std::vector()); + 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(); + std::vector::iterator ArgI = yyvsp[-7].ValueList->begin(), ArgE = yyvsp[-7].ValueList->end(); for (; ArgI != ArgE && I != E; ++ArgI, ++I) if ((*ArgI)->getType() != *I) @@ -4638,263 +3892,242 @@ if (I != E || (ArgI != ArgE && !Ty->isVarArg())) GEN_ERROR("Invalid number of parameters detected!"); - (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, *(yyvsp[-7].ValueList)); + yyval.TermInstVal = new InvokeInst(V, Normal, Except, *yyvsp[-7].ValueList); } - cast((yyval.TermInstVal))->setCallingConv((yyvsp[-11].UIntVal)); + cast(yyval.TermInstVal)->setCallingConv(yyvsp[-11].UIntVal); - delete (yyvsp[-10].TypeVal); - delete (yyvsp[-7].ValueList); + delete yyvsp[-10].TypeVal; + delete yyvsp[-7].ValueList; CHECK_FOR_ERROR - ;} - break; - - case 211: -#line 2322 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.TermInstVal) = new UnwindInst(); + ; + break;} +case 210: +#line 2322 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.TermInstVal = new UnwindInst(); CHECK_FOR_ERROR - ;} - break; - - case 212: -#line 2326 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.TermInstVal) = new UnreachableInst(); + ; + break;} +case 211: +#line 2326 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.TermInstVal = new UnreachableInst(); CHECK_FOR_ERROR - ;} - break; - - case 213: -#line 2333 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.JumpTable) = (yyvsp[-5].JumpTable); - Constant *V = cast(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); + ; + break;} +case 212: +#line 2333 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.JumpTable = yyvsp[-5].JumpTable; + Constant *V = cast(getValNonImprovising(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal)); CHECK_FOR_ERROR if (V == 0) GEN_ERROR("May only switch on a constant pool value!"); - BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); + BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal); CHECK_FOR_ERROR - (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); - ;} - break; - - case 214: -#line 2344 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.JumpTable) = new std::vector >(); - Constant *V = cast(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); + yyval.JumpTable->push_back(std::make_pair(V, tmpBB)); + ; + break;} +case 213: +#line 2344 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.JumpTable = new std::vector >(); + Constant *V = cast(getValNonImprovising(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal)); CHECK_FOR_ERROR if (V == 0) GEN_ERROR("May only switch on a constant pool value!"); - BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); + BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal); CHECK_FOR_ERROR - (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); - ;} - break; - - case 215: -#line 2357 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { + yyval.JumpTable->push_back(std::make_pair(V, tmpBB)); + ; + break;} +case 214: +#line 2357 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Is this definition named?? if so, assign the name... - setValueName((yyvsp[0].InstVal), (yyvsp[-1].StrVal)); + setValueName(yyvsp[0].InstVal, yyvsp[-1].StrVal); CHECK_FOR_ERROR - InsertValue((yyvsp[0].InstVal)); - (yyval.InstVal) = (yyvsp[0].InstVal); + InsertValue(yyvsp[0].InstVal); + yyval.InstVal = yyvsp[0].InstVal; CHECK_FOR_ERROR -;} - break; - - case 216: -#line 2366 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { // Used for PHI nodes - (yyval.PHIList) = new std::list >(); - Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal)); - CHECK_FOR_ERROR - BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal)); - CHECK_FOR_ERROR - (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); - delete (yyvsp[-5].TypeVal); - ;} - break; - - case 217: -#line 2375 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.PHIList) = (yyvsp[-6].PHIList); - Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal)); +; + break;} +case 215: +#line 2366 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Used for PHI nodes + yyval.PHIList = new std::list >(); + Value* tmpVal = getVal(*yyvsp[-5].TypeVal, yyvsp[-3].ValIDVal); + CHECK_FOR_ERROR + BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal); + CHECK_FOR_ERROR + yyval.PHIList->push_back(std::make_pair(tmpVal, tmpBB)); + delete yyvsp[-5].TypeVal; + ; + break;} +case 216: +#line 2375 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.PHIList = yyvsp[-6].PHIList; + Value* tmpVal = getVal(yyvsp[-6].PHIList->front().first->getType(), yyvsp[-3].ValIDVal); CHECK_FOR_ERROR - BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal)); + BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal); CHECK_FOR_ERROR - (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB)); - ;} - break; - - case 218: -#line 2385 "/proj/llvm/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 219: -#line 2389 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ValueList) = (yyvsp[-2].ValueList); - (yyvsp[-2].ValueList)->push_back((yyvsp[0].ValueVal)); + yyvsp[-6].PHIList->push_back(std::make_pair(tmpVal, tmpBB)); + ; + break;} +case 217: +#line 2385 "/Volumes/ProjectsDisk/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 218: +#line 2389 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ValueList = yyvsp[-2].ValueList; + yyvsp[-2].ValueList->push_back(yyvsp[0].ValueVal); CHECK_FOR_ERROR - ;} - break; - - case 221: -#line 2396 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { (yyval.ValueList) = 0; ;} - break; - - case 222: -#line 2398 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.BoolVal) = true; + ; + break;} +case 220: +#line 2396 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.ValueList = 0; ; + break;} +case 221: +#line 2398 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.BoolVal = true; CHECK_FOR_ERROR - ;} - break; - - case 223: -#line 2402 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.BoolVal) = false; + ; + break;} +case 222: +#line 2402 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.BoolVal = false; CHECK_FOR_ERROR - ;} - break; - - case 224: -#line 2407 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() && - !isa((*(yyvsp[-3].TypeVal)).get())) + ; + break;} +case 223: +#line 2407 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + if (!(*yyvsp[-3].TypeVal)->isInteger() && !(*yyvsp[-3].TypeVal)->isFloatingPoint() && + !isa((*yyvsp[-3].TypeVal).get())) GEN_ERROR( "Arithmetic operator requires integer, FP, or packed operands!"); - if (isa((*(yyvsp[-3].TypeVal)).get()) && (yyvsp[-4].BinaryOpVal) == Instruction::Rem) + if (isa((*yyvsp[-3].TypeVal).get()) && yyvsp[-4].BinaryOpVal == Instruction::Rem) GEN_ERROR("Rem not supported on packed types!"); - Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); + Value* val1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal); CHECK_FOR_ERROR - Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); + Value* val2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal); CHECK_FOR_ERROR - (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2); - if ((yyval.InstVal) == 0) + yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, val1, val2); + if (yyval.InstVal == 0) GEN_ERROR("binary operator returned null!"); - delete (yyvsp[-3].TypeVal); - ;} - break; - - case 225: -#line 2423 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - if (!(*(yyvsp[-3].TypeVal))->isIntegral()) { - if (!isa((yyvsp[-3].TypeVal)->get()) || - !cast((yyvsp[-3].TypeVal)->get())->getElementType()->isIntegral()) + delete yyvsp[-3].TypeVal; + ; + break;} +case 224: +#line 2423 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + if (!(*yyvsp[-3].TypeVal)->isIntegral()) { + if (!isa(yyvsp[-3].TypeVal->get()) || + !cast(yyvsp[-3].TypeVal->get())->getElementType()->isIntegral()) GEN_ERROR("Logical operator requires integral operands!"); } - Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); + Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal); CHECK_FOR_ERROR - Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); + Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal); CHECK_FOR_ERROR - (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2); - if ((yyval.InstVal) == 0) + yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, tmpVal1, tmpVal2); + if (yyval.InstVal == 0) GEN_ERROR("binary operator returned null!"); - delete (yyvsp[-3].TypeVal); - ;} - break; - - case 226: -#line 2438 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - if(isa((*(yyvsp[-3].TypeVal)).get())) { + delete yyvsp[-3].TypeVal; + ; + break;} +case 225: +#line 2438 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + if(isa((*yyvsp[-3].TypeVal).get())) { GEN_ERROR( "PackedTypes currently not supported in setcc instructions!"); } - Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal)); + Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal); CHECK_FOR_ERROR - Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal)); + Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal); CHECK_FOR_ERROR - (yyval.InstVal) = new SetCondInst((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2); - if ((yyval.InstVal) == 0) + yyval.InstVal = new SetCondInst(yyvsp[-4].BinaryOpVal, tmpVal1, tmpVal2); + if (yyval.InstVal == 0) GEN_ERROR("binary operator returned null!"); - delete (yyvsp[-3].TypeVal); - ;} - break; - - case 227: -#line 2452 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { + delete yyvsp[-3].TypeVal; + ; + break;} +case 226: +#line 2452 "/Volumes/ProjectsDisk/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()); + Value *Ones = ConstantIntegral::getAllOnesValue(yyvsp[0].ValueVal->getType()); if (Ones == 0) GEN_ERROR("Expected integral type for not instruction!"); - (yyval.InstVal) = BinaryOperator::create(Instruction::Xor, (yyvsp[0].ValueVal), Ones); - if ((yyval.InstVal) == 0) + yyval.InstVal = BinaryOperator::create(Instruction::Xor, yyvsp[0].ValueVal, Ones); + if (yyval.InstVal == 0) GEN_ERROR("Could not create a xor instruction!"); CHECK_FOR_ERROR - ;} - break; - - case 228: -#line 2465 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[0].ValueVal)->getType() != Type::UByteTy) + ; + break;} +case 227: +#line 2465 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + if (yyvsp[0].ValueVal->getType() != Type::UByteTy) GEN_ERROR("Shift amount must be ubyte!"); - if (!(yyvsp[-2].ValueVal)->getType()->isInteger()) + if (!yyvsp[-2].ValueVal->getType()->isInteger()) GEN_ERROR("Shift constant expression requires integer operand!"); - (yyval.InstVal) = new ShiftInst((yyvsp[-3].OtherOpVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); + yyval.InstVal = new ShiftInst(yyvsp[-3].OtherOpVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal); CHECK_FOR_ERROR - ;} - break; - - case 229: -#line 2473 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - if (!(yyvsp[0].TypeVal)->get()->isFirstClassType()) + ; + break;} +case 228: +#line 2473 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + if (!yyvsp[0].TypeVal->get()->isFirstClassType()) GEN_ERROR("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); - CHECK_FOR_ERROR - ;} - break; - - case 230: -#line 2481 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[-4].ValueVal)->getType() != Type::BoolTy) + yyvsp[0].TypeVal->get()->getDescription() + "'!"); + yyval.InstVal = new CastInst(yyvsp[-2].ValueVal, *yyvsp[0].TypeVal); + delete yyvsp[0].TypeVal; + CHECK_FOR_ERROR + ; + break;} +case 229: +#line 2481 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + if (yyvsp[-4].ValueVal->getType() != Type::BoolTy) GEN_ERROR("select condition must be boolean!"); - if ((yyvsp[-2].ValueVal)->getType() != (yyvsp[0].ValueVal)->getType()) + if (yyvsp[-2].ValueVal->getType() != yyvsp[0].ValueVal->getType()) GEN_ERROR("select value types should match!"); - (yyval.InstVal) = new SelectInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); + yyval.InstVal = new SelectInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal); CHECK_FOR_ERROR - ;} - break; - - case 231: -#line 2489 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 230: +#line 2489 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ NewVarArgs = true; - (yyval.InstVal) = new VAArgInst((yyvsp[-2].ValueVal), *(yyvsp[0].TypeVal)); - delete (yyvsp[0].TypeVal); + yyval.InstVal = new VAArgInst(yyvsp[-2].ValueVal, *yyvsp[0].TypeVal); + delete yyvsp[0].TypeVal; CHECK_FOR_ERROR - ;} - break; - - case 232: -#line 2495 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 231: +#line 2495 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ ObsoleteVarArgs = true; - const Type* ArgTy = (yyvsp[-2].ValueVal)->getType(); + const Type* ArgTy = yyvsp[-2].ValueVal->getType(); Function* NF = CurModule.CurrentModule-> getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0); @@ -4905,20 +4138,19 @@ //b = vaarg foo, t AllocaInst* foo = new AllocaInst(ArgTy, 0, "vaarg.fix"); CurBB->getInstList().push_back(foo); - CallInst* bar = new CallInst(NF, (yyvsp[-2].ValueVal)); + 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); + yyval.InstVal = new VAArgInst(foo, *yyvsp[0].TypeVal); + delete yyvsp[0].TypeVal; CHECK_FOR_ERROR - ;} - break; - - case 233: -#line 2515 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 232: +#line 2515 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ ObsoleteVarArgs = true; - const Type* ArgTy = (yyvsp[-2].ValueVal)->getType(); + const Type* ArgTy = yyvsp[-2].ValueVal->getType(); Function* NF = CurModule.CurrentModule-> getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0); @@ -4930,78 +4162,73 @@ //b = load foo AllocaInst* foo = new AllocaInst(ArgTy, 0, "vanext.fix"); CurBB->getInstList().push_back(foo); - CallInst* bar = new CallInst(NF, (yyvsp[-2].ValueVal)); + 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)); + Instruction* tmp = new VAArgInst(foo, *yyvsp[0].TypeVal); CurBB->getInstList().push_back(tmp); - (yyval.InstVal) = new LoadInst(foo); - delete (yyvsp[0].TypeVal); + yyval.InstVal = new LoadInst(foo); + delete yyvsp[0].TypeVal; CHECK_FOR_ERROR - ;} - break; - - case 234: -#line 2538 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) + ; + break;} +case 233: +#line 2538 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + if (!ExtractElementInst::isValidOperands(yyvsp[-2].ValueVal, yyvsp[0].ValueVal)) GEN_ERROR("Invalid extractelement operands!"); - (yyval.InstVal) = new ExtractElementInst((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); + yyval.InstVal = new ExtractElementInst(yyvsp[-2].ValueVal, yyvsp[0].ValueVal); CHECK_FOR_ERROR - ;} - break; - - case 235: -#line 2544 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) + ; + break;} +case 234: +#line 2544 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + if (!InsertElementInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal)) GEN_ERROR("Invalid insertelement operands!"); - (yyval.InstVal) = new InsertElementInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); + yyval.InstVal = new InsertElementInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal); CHECK_FOR_ERROR - ;} - break; - - case 236: -#line 2550 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) + ; + break;} +case 235: +#line 2550 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + if (!ShuffleVectorInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal)) GEN_ERROR("Invalid shufflevector operands!"); - (yyval.InstVal) = new ShuffleVectorInst((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); + yyval.InstVal = new ShuffleVectorInst(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal); CHECK_FOR_ERROR - ;} - break; - - case 237: -#line 2556 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - const Type *Ty = (yyvsp[0].PHIList)->front().first->getType(); + ; + break;} +case 236: +#line 2556 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + const Type *Ty = yyvsp[0].PHIList->front().first->getType(); if (!Ty->isFirstClassType()) GEN_ERROR("PHI node operands must be of first class type!"); - (yyval.InstVal) = new PHINode(Ty); - ((PHINode*)(yyval.InstVal))->reserveOperandSpace((yyvsp[0].PHIList)->size()); - while ((yyvsp[0].PHIList)->begin() != (yyvsp[0].PHIList)->end()) { - if ((yyvsp[0].PHIList)->front().first->getType() != Ty) + yyval.InstVal = new PHINode(Ty); + ((PHINode*)yyval.InstVal)->reserveOperandSpace(yyvsp[0].PHIList->size()); + while (yyvsp[0].PHIList->begin() != yyvsp[0].PHIList->end()) { + if (yyvsp[0].PHIList->front().first->getType() != Ty) GEN_ERROR("All elements of a PHI node must be of the same type!"); - cast((yyval.InstVal))->addIncoming((yyvsp[0].PHIList)->front().first, (yyvsp[0].PHIList)->front().second); - (yyvsp[0].PHIList)->pop_front(); + 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... + delete yyvsp[0].PHIList; // Free the list... CHECK_FOR_ERROR - ;} - break; - - case 238: -#line 2571 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 237: +#line 2571 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ const PointerType *PFTy; const FunctionType *Ty; - if (!(PFTy = dyn_cast((yyvsp[-4].TypeVal)->get())) || + 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(); + 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()); } @@ -5009,31 +4236,31 @@ bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy; if (isVarArg) ParamTypes.pop_back(); - if (!(*(yyvsp[-4].TypeVal))->isFirstClassType() && *(yyvsp[-4].TypeVal) != Type::VoidTy) + if (!(*yyvsp[-4].TypeVal)->isFirstClassType() && *yyvsp[-4].TypeVal != Type::VoidTy) GEN_ERROR("LLVM functions cannot return aggregate types!"); - Ty = FunctionType::get((yyvsp[-4].TypeVal)->get(), ParamTypes, isVarArg); + 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... + Value *V = getVal(PFTy, yyvsp[-3].ValIDVal); // Get the function we're calling... CHECK_FOR_ERROR // Create the call node... - if (!(yyvsp[-1].ValueList)) { // Has no arguments? + if (!yyvsp[-1].ValueList) { // Has no arguments? // Make sure no arguments is a good thing! if (Ty->getNumParams() != 0) GEN_ERROR("No arguments passed to a function that " "expects arguments!"); - (yyval.InstVal) = new CallInst(V, std::vector()); + 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(); + std::vector::iterator ArgI = yyvsp[-1].ValueList->begin(), ArgE = yyvsp[-1].ValueList->end(); for (; ArgI != ArgE && I != E; ++ArgI, ++I) if ((*ArgI)->getType() != *I) @@ -5043,442 +4270,377 @@ if (I != E || (ArgI != ArgE && !Ty->isVarArg())) GEN_ERROR("Invalid number of parameters detected!"); - (yyval.InstVal) = new CallInst(V, *(yyvsp[-1].ValueList)); + 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); - CHECK_FOR_ERROR - ;} - break; - - case 239: -#line 2630 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.InstVal) = (yyvsp[0].InstVal); - CHECK_FOR_ERROR - ;} - break; - - case 240: -#line 2637 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ValueList) = (yyvsp[0].ValueList); - CHECK_FOR_ERROR - ;} - break; - - case 241: -#line 2640 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ValueList) = new std::vector(); + cast(yyval.InstVal)->setTailCall(yyvsp[-6].BoolVal); + cast(yyval.InstVal)->setCallingConv(yyvsp[-5].UIntVal); + delete yyvsp[-4].TypeVal; + delete yyvsp[-1].ValueList; + CHECK_FOR_ERROR + ; + break;} +case 238: +#line 2630 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.InstVal = yyvsp[0].InstVal; CHECK_FOR_ERROR - ;} - break; - - case 242: -#line 2645 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.BoolVal) = true; + ; + break;} +case 239: +#line 2637 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ValueList = yyvsp[0].ValueList; + CHECK_FOR_ERROR + ; + break;} +case 240: +#line 2640 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ValueList = new std::vector(); + CHECK_FOR_ERROR + ; + break;} +case 241: +#line 2645 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.BoolVal = true; CHECK_FOR_ERROR - ;} - break; - - case 243: -#line 2649 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.BoolVal) = false; + ; + break;} +case 242: +#line 2649 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.BoolVal = false; CHECK_FOR_ERROR - ;} - break; - - case 244: -#line 2656 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); - delete (yyvsp[-1].TypeVal); + ; + break;} +case 243: +#line 2656 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.InstVal = new MallocInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal); + delete yyvsp[-1].TypeVal; CHECK_FOR_ERROR - ;} - break; - - case 245: -#line 2661 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); + ; + break;} +case 244: +#line 2661 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal); CHECK_FOR_ERROR - (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal)); - delete (yyvsp[-4].TypeVal); - ;} - break; - - case 246: -#line 2667 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); - delete (yyvsp[-1].TypeVal); + yyval.InstVal = new MallocInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal); + delete yyvsp[-4].TypeVal; + ; + break;} +case 245: +#line 2667 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.InstVal = new AllocaInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal); + delete yyvsp[-1].TypeVal; CHECK_FOR_ERROR - ;} - break; - - case 247: -#line 2672 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); + ; + break;} +case 246: +#line 2672 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal); CHECK_FOR_ERROR - (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal)); - delete (yyvsp[-4].TypeVal); - ;} - break; - - case 248: -#line 2678 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - if (!isa((yyvsp[0].ValueVal)->getType())) + yyval.InstVal = new AllocaInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal); + delete yyvsp[-4].TypeVal; + ; + break;} +case 247: +#line 2678 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + if (!isa(yyvsp[0].ValueVal->getType())) GEN_ERROR("Trying to free nonpointer type " + - (yyvsp[0].ValueVal)->getType()->getDescription() + "!"); - (yyval.InstVal) = new FreeInst((yyvsp[0].ValueVal)); + yyvsp[0].ValueVal->getType()->getDescription() + "!"); + yyval.InstVal = new FreeInst(yyvsp[0].ValueVal); CHECK_FOR_ERROR - ;} - break; - - case 249: -#line 2686 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - if (!isa((yyvsp[-1].TypeVal)->get())) + ; + break;} +case 248: +#line 2686 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + if (!isa(yyvsp[-1].TypeVal->get())) GEN_ERROR("Can't load from nonpointer type: " + - (*(yyvsp[-1].TypeVal))->getDescription()); - if (!cast((yyvsp[-1].TypeVal)->get())->getElementType()->isFirstClassType()) + (*yyvsp[-1].TypeVal)->getDescription()); + if (!cast(yyvsp[-1].TypeVal->get())->getElementType()->isFirstClassType()) GEN_ERROR("Can't load from pointer of non-first-class type: " + - (*(yyvsp[-1].TypeVal))->getDescription()); - Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); + (*yyvsp[-1].TypeVal)->getDescription()); + Value* tmpVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal); CHECK_FOR_ERROR - (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal)); - delete (yyvsp[-1].TypeVal); - ;} - break; - - case 250: -#line 2698 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - const PointerType *PT = dyn_cast((yyvsp[-1].TypeVal)->get()); + yyval.InstVal = new LoadInst(tmpVal, "", yyvsp[-3].BoolVal); + delete yyvsp[-1].TypeVal; + ; + break;} +case 249: +#line 2698 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + const PointerType *PT = dyn_cast(yyvsp[-1].TypeVal->get()); if (!PT) GEN_ERROR("Can't store to a nonpointer type: " + - (*(yyvsp[-1].TypeVal))->getDescription()); + (*yyvsp[-1].TypeVal)->getDescription()); const Type *ElTy = PT->getElementType(); - if (ElTy != (yyvsp[-3].ValueVal)->getType()) - GEN_ERROR("Can't store '" + (yyvsp[-3].ValueVal)->getType()->getDescription() + + if (ElTy != yyvsp[-3].ValueVal->getType()) + GEN_ERROR("Can't store '" + yyvsp[-3].ValueVal->getType()->getDescription() + "' into space of type '" + ElTy->getDescription() + "'!"); - Value* tmpVal = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); + Value* tmpVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal); CHECK_FOR_ERROR - (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), tmpVal, (yyvsp[-5].BoolVal)); - delete (yyvsp[-1].TypeVal); - ;} - break; - - case 251: -#line 2713 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" - { - if (!isa((yyvsp[-2].TypeVal)->get())) + yyval.InstVal = new StoreInst(yyvsp[-3].ValueVal, tmpVal, yyvsp[-5].BoolVal); + delete yyvsp[-1].TypeVal; + ; + break;} +case 250: +#line 2713 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + if (!isa(yyvsp[-2].TypeVal->get())) GEN_ERROR("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) + 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 (ConstantUInt *CUI = dyn_cast((*yyvsp[0].ValueList)[i])) if (CUI->getType() == Type::UByteTy) - (*(yyvsp[0].ValueList))[i] = ConstantExpr::getCast(CUI, Type::UIntTy); + (*yyvsp[0].ValueList)[i] = ConstantExpr::getCast(CUI, Type::UIntTy); - if (!GetElementPtrInst::getIndexedType(*(yyvsp[-2].TypeVal), *(yyvsp[0].ValueList), true)) + if (!GetElementPtrInst::getIndexedType(*yyvsp[-2].TypeVal, *yyvsp[0].ValueList, true)) GEN_ERROR("Invalid getelementptr indices for type '" + - (*(yyvsp[-2].TypeVal))->getDescription()+ "'!"); - Value* tmpVal = getVal(*(yyvsp[-2].TypeVal), (yyvsp[-1].ValIDVal)); + (*yyvsp[-2].TypeVal)->getDescription()+ "'!"); + Value* tmpVal = getVal(*yyvsp[-2].TypeVal, yyvsp[-1].ValIDVal); CHECK_FOR_ERROR - (yyval.InstVal) = new GetElementPtrInst(tmpVal, *(yyvsp[0].ValueList)); - delete (yyvsp[-2].TypeVal); - delete (yyvsp[0].ValueList); - ;} - break; - - - default: break; - } - -/* Line 1126 of yacc.c. */ -#line 5214 "llvmAsmParser.tab.c" + yyval.InstVal = new GetElementPtrInst(tmpVal, *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 - - YY_STACK_PRINT (yyss, yyssp); +#if YYDEBUG != 0 + if (yydebug) + { + short *ssp1 = yyss - 1; + fprintf (stderr, "state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); + } +#endif *++yyvsp = yyval; +#ifdef YYLSP_NEEDED + yylsp++; + if (yylen == 0) + { + yylsp->first_line = yylloc.first_line; + yylsp->first_column = yylloc.first_column; + yylsp->last_line = (yylsp-1)->last_line; + yylsp->last_column = (yylsp-1)->last_column; + yylsp->text = 0; + } + else + { + yylsp->last_line = (yylsp+yylen-1)->last_line; + yylsp->last_column = (yylsp+yylen-1)->last_column; + } +#endif - /* Now `shift' the result of the reduction. Determine what state - that goes to, based on the state we popped back to and the rule - number reduced by. */ + /* Now "shift" the result of the reduction. + Determine what state that goes to, + based on the state we popped back to + and the rule number reduced by. */ yyn = yyr1[yyn]; - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yypgoto[yyn - YYNTBASE] + *yyssp; + if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else - yystate = yydefgoto[yyn - YYNTOKENS]; + yystate = yydefgoto[yyn - YYNTBASE]; goto yynewstate; +yyerrlab: /* here on detecting error */ -/*------------------------------------. -| yyerrlab -- here on detecting error | -`------------------------------------*/ -yyerrlab: - /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) + if (! yyerrstatus) + /* If not already recovering from an error, report this error. */ { ++yynerrs; -#if YYERROR_VERBOSE + +#ifdef YYERROR_VERBOSE yyn = yypact[yystate]; - if (YYPACT_NINF < yyn && yyn < YYLAST) + if (yyn > YYFLAG && yyn < YYLAST) { - int yytype = YYTRANSLATE (yychar); - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - char *yymsg = 0; -# define YYERROR_VERBOSE_ARGS_MAXIMUM 5 - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; - -#if 0 - /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ - YY_("syntax error, unexpected %s"); - YY_("syntax error, unexpected %s, expecting %s"); - YY_("syntax error, unexpected %s, expecting %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); -#endif - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy (yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= yysize1 < yysize; - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; - } - - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen (yyf); - yysize_overflow |= yysize1 < yysize; - yysize = yysize1; - - if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM) - yymsg = (char *) YYSTACK_ALLOC (yysize); - if (yymsg) + 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) { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yymsg; - int yyi = 0; - while ((*yyp = *yyf)) + strcpy(msg, "parse error"); + + if (count < 5) { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } + 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 (yymsg); - YYSTACK_FREE (yymsg); + yyerror(msg); + free(msg); } else - { - yyerror (YY_("syntax error")); - goto yyexhaustedlab; - } + yyerror ("parse error; also virtual memory exceeded"); } else #endif /* YYERROR_VERBOSE */ - yyerror (YY_("syntax error")); + yyerror("parse error"); } - + goto yyerrlab1; +yyerrlab1: /* here on error raised explicitly by an action */ if (yyerrstatus == 3) { - /* If just tried and failed to reuse look-ahead token after an - error, discard it. */ + /* if just tried and failed to reuse lookahead token after an error, discard it. */ - if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } - else - { - yydestruct ("Error: discarding", yytoken, &yylval); - yychar = YYEMPTY; - } + /* 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 look-ahead token after shifting the error - token. */ - goto yyerrlab1; + /* Else will try to reuse lookahead token + after shifting the error token. */ + yyerrstatus = 3; /* Each real token shifted decrements this */ -/*---------------------------------------------------. -| yyerrorlab -- error raised explicitly by YYERROR. | -`---------------------------------------------------*/ -yyerrorlab: - - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (0) - goto yyerrorlab; + goto yyerrhandle; -yyvsp -= yylen; - yyssp -= yylen; - yystate = *yyssp; - goto yyerrlab1; +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 */ -/*-------------------------------------------------------------. -| yyerrlab1 -- common code for both syntax error and YYERROR. | -`-------------------------------------------------------------*/ -yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ + if (yyssp == yyss) YYABORT; + yyvsp--; + yystate = *--yyssp; +#ifdef YYLSP_NEEDED + yylsp--; +#endif - for (;;) +#if YYDEBUG != 0 + if (yydebug) { - yyn = yypact[yystate]; - if (yyn != YYPACT_NINF) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } + short *ssp1 = yyss - 1; + fprintf (stderr, "Error: state stack now"); + while (ssp1 != yyssp) + fprintf (stderr, " %d", *++ssp1); + fprintf (stderr, "\n"); + } +#endif - /* Pop the current state because it cannot handle the error token. */ - if (yyssp == yyss) - YYABORT; +yyerrhandle: + + yyn = yypact[yystate]; + if (yyn == YYFLAG) + goto yyerrdefault; + yyn += YYTERROR; + if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) + goto yyerrdefault; - yydestruct ("Error: popping", yystos[yystate], yyvsp); - YYPOPSTACK; - yystate = *yyssp; - YY_STACK_PRINT (yyss, yyssp); + yyn = yytable[yyn]; + if (yyn < 0) + { + if (yyn == YYFLAG) + goto yyerrpop; + yyn = -yyn; + goto yyreduce; } + else if (yyn == 0) + goto yyerrpop; if (yyn == YYFINAL) YYACCEPT; - *++yyvsp = yylval; - +#if YYDEBUG != 0 + if (yydebug) + fprintf(stderr, "Shifting error token, "); +#endif - /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + *++yyvsp = yylval; +#ifdef YYLSP_NEEDED + *++yylsp = yylloc; +#endif yystate = yyn; goto yynewstate; + yyacceptlab: + /* YYACCEPT comes here. */ + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); +#endif + } + return 0; -/*-------------------------------------. -| yyacceptlab -- YYACCEPT comes here. | -`-------------------------------------*/ -yyacceptlab: - yyresult = 0; - goto yyreturn; - -/*-----------------------------------. -| yyabortlab -- YYABORT comes here. | -`-----------------------------------*/ -yyabortlab: - yyresult = 1; - goto yyreturn; - -#ifndef yyoverflow -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ -yyexhaustedlab: - yyerror (YY_("memory exhausted")); - yyresult = 2; - /* Fall through. */ -#endif - -yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); - while (yyssp != yyss) - { - yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); - YYPOPSTACK; - } -#ifndef yyoverflow - if (yyss != yyssa) - YYSTACK_FREE (yyss); + yyabortlab: + /* YYABORT comes here. */ + if (yyfree_stacks) + { + free (yyss); + free (yyvs); +#ifdef YYLSP_NEEDED + free (yyls); #endif - return yyresult; + } + return 1; } - - -#line 2739 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +#line 2739 "/Volumes/ProjectsDisk/cvs/llvm/lib/AsmParser/llvmAsmParser.y" void llvm::GenerateError(const std::string &message, int LineNo) { @@ -5501,4 +4663,3 @@ GenerateError(errMsg); return 0; } - Index: llvm/lib/AsmParser/llvmAsmParser.h.cvs diff -u llvm/lib/AsmParser/llvmAsmParser.h.cvs:1.9 llvm/lib/AsmParser/llvmAsmParser.h.cvs:1.10 --- llvm/lib/AsmParser/llvmAsmParser.h.cvs:1.9 Thu Sep 28 14:28:24 2006 +++ llvm/lib/AsmParser/llvmAsmParser.h.cvs Thu Sep 28 18:35:22 2006 @@ -1,254 +1,4 @@ -/* A Bison parser, made by GNU Bison 2.1. */ - -/* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ - -/* As a special exception, 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 { - ESINT64VAL = 258, - EUINT64VAL = 259, - SINTVAL = 260, - UINTVAL = 261, - FPVAL = 262, - VOID = 263, - BOOL = 264, - SBYTE = 265, - UBYTE = 266, - SHORT = 267, - USHORT = 268, - INT = 269, - UINT = 270, - LONG = 271, - ULONG = 272, - FLOAT = 273, - DOUBLE = 274, - TYPE = 275, - LABEL = 276, - VAR_ID = 277, - LABELSTR = 278, - STRINGCONSTANT = 279, - IMPLEMENTATION = 280, - ZEROINITIALIZER = 281, - TRUETOK = 282, - FALSETOK = 283, - BEGINTOK = 284, - ENDTOK = 285, - DECLARE = 286, - GLOBAL = 287, - CONSTANT = 288, - SECTION = 289, - VOLATILE = 290, - TO = 291, - DOTDOTDOT = 292, - NULL_TOK = 293, - UNDEF = 294, - CONST = 295, - INTERNAL = 296, - LINKONCE = 297, - WEAK = 298, - APPENDING = 299, - DLLIMPORT = 300, - DLLEXPORT = 301, - EXTERN_WEAK = 302, - OPAQUE = 303, - NOT = 304, - EXTERNAL = 305, - TARGET = 306, - TRIPLE = 307, - ENDIAN = 308, - POINTERSIZE = 309, - LITTLE = 310, - BIG = 311, - ALIGN = 312, - DEPLIBS = 313, - CALL = 314, - TAIL = 315, - ASM_TOK = 316, - MODULE = 317, - SIDEEFFECT = 318, - CC_TOK = 319, - CCC_TOK = 320, - CSRETCC_TOK = 321, - FASTCC_TOK = 322, - COLDCC_TOK = 323, - X86_STDCALLCC_TOK = 324, - X86_FASTCALLCC_TOK = 325, - RET = 326, - BR = 327, - SWITCH = 328, - INVOKE = 329, - UNWIND = 330, - UNREACHABLE = 331, - ADD = 332, - SUB = 333, - MUL = 334, - DIV = 335, - REM = 336, - AND = 337, - OR = 338, - XOR = 339, - SETLE = 340, - SETGE = 341, - SETLT = 342, - SETGT = 343, - SETEQ = 344, - SETNE = 345, - MALLOC = 346, - ALLOCA = 347, - FREE = 348, - LOAD = 349, - STORE = 350, - GETELEMENTPTR = 351, - PHI_TOK = 352, - CAST = 353, - SELECT = 354, - SHL = 355, - SHR = 356, - VAARG = 357, - EXTRACTELEMENT = 358, - INSERTELEMENT = 359, - SHUFFLEVECTOR = 360, - VAARG_old = 361, - VANEXT_old = 362 - }; -#endif -/* Tokens. */ -#define ESINT64VAL 258 -#define EUINT64VAL 259 -#define SINTVAL 260 -#define UINTVAL 261 -#define FPVAL 262 -#define VOID 263 -#define BOOL 264 -#define SBYTE 265 -#define UBYTE 266 -#define SHORT 267 -#define USHORT 268 -#define INT 269 -#define UINT 270 -#define LONG 271 -#define ULONG 272 -#define FLOAT 273 -#define DOUBLE 274 -#define TYPE 275 -#define LABEL 276 -#define VAR_ID 277 -#define LABELSTR 278 -#define STRINGCONSTANT 279 -#define IMPLEMENTATION 280 -#define ZEROINITIALIZER 281 -#define TRUETOK 282 -#define FALSETOK 283 -#define BEGINTOK 284 -#define ENDTOK 285 -#define DECLARE 286 -#define GLOBAL 287 -#define CONSTANT 288 -#define SECTION 289 -#define VOLATILE 290 -#define TO 291 -#define DOTDOTDOT 292 -#define NULL_TOK 293 -#define UNDEF 294 -#define CONST 295 -#define INTERNAL 296 -#define LINKONCE 297 -#define WEAK 298 -#define APPENDING 299 -#define DLLIMPORT 300 -#define DLLEXPORT 301 -#define EXTERN_WEAK 302 -#define OPAQUE 303 -#define NOT 304 -#define EXTERNAL 305 -#define TARGET 306 -#define TRIPLE 307 -#define ENDIAN 308 -#define POINTERSIZE 309 -#define LITTLE 310 -#define BIG 311 -#define ALIGN 312 -#define DEPLIBS 313 -#define CALL 314 -#define TAIL 315 -#define ASM_TOK 316 -#define MODULE 317 -#define SIDEEFFECT 318 -#define CC_TOK 319 -#define CCC_TOK 320 -#define CSRETCC_TOK 321 -#define FASTCC_TOK 322 -#define COLDCC_TOK 323 -#define X86_STDCALLCC_TOK 324 -#define X86_FASTCALLCC_TOK 325 -#define RET 326 -#define BR 327 -#define SWITCH 328 -#define INVOKE 329 -#define UNWIND 330 -#define UNREACHABLE 331 -#define ADD 332 -#define SUB 333 -#define MUL 334 -#define DIV 335 -#define REM 336 -#define AND 337 -#define OR 338 -#define XOR 339 -#define SETLE 340 -#define SETGE 341 -#define SETLT 342 -#define SETGT 343 -#define SETEQ 344 -#define SETNE 345 -#define MALLOC 346 -#define ALLOCA 347 -#define FREE 348 -#define LOAD 349 -#define STORE 350 -#define GETELEMENTPTR 351 -#define PHI_TOK 352 -#define CAST 353 -#define SELECT 354 -#define SHL 355 -#define SHR 356 -#define VAARG 357 -#define EXTRACTELEMENT 358 -#define INSERTELEMENT 359 -#define SHUFFLEVECTOR 360 -#define VAARG_old 361 -#define VANEXT_old 362 - - - - -#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 966 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" -typedef union YYSTYPE { +typedef union { llvm::Module *ModuleVal; llvm::Function *FunctionVal; std::pair *ArgVal; @@ -287,14 +37,111 @@ llvm::Instruction::OtherOps OtherOpVal; llvm::Module::Endianness Endianness; } YYSTYPE; -/* Line 1447 of yacc.c. */ -#line 292 "llvmAsmParser.tab.h" -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ -# define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 -#endif - -extern YYSTYPE llvmAsmlval; - +#define ESINT64VAL 257 +#define EUINT64VAL 258 +#define SINTVAL 259 +#define UINTVAL 260 +#define FPVAL 261 +#define VOID 262 +#define BOOL 263 +#define SBYTE 264 +#define UBYTE 265 +#define SHORT 266 +#define USHORT 267 +#define INT 268 +#define UINT 269 +#define LONG 270 +#define ULONG 271 +#define FLOAT 272 +#define DOUBLE 273 +#define TYPE 274 +#define LABEL 275 +#define VAR_ID 276 +#define LABELSTR 277 +#define STRINGCONSTANT 278 +#define IMPLEMENTATION 279 +#define ZEROINITIALIZER 280 +#define TRUETOK 281 +#define FALSETOK 282 +#define BEGINTOK 283 +#define ENDTOK 284 +#define DECLARE 285 +#define GLOBAL 286 +#define CONSTANT 287 +#define SECTION 288 +#define VOLATILE 289 +#define TO 290 +#define DOTDOTDOT 291 +#define NULL_TOK 292 +#define UNDEF 293 +#define CONST 294 +#define INTERNAL 295 +#define LINKONCE 296 +#define WEAK 297 +#define APPENDING 298 +#define DLLIMPORT 299 +#define DLLEXPORT 300 +#define EXTERN_WEAK 301 +#define OPAQUE 302 +#define NOT 303 +#define EXTERNAL 304 +#define TARGET 305 +#define TRIPLE 306 +#define ENDIAN 307 +#define POINTERSIZE 308 +#define LITTLE 309 +#define BIG 310 +#define ALIGN 311 +#define DEPLIBS 312 +#define CALL 313 +#define TAIL 314 +#define ASM_TOK 315 +#define MODULE 316 +#define SIDEEFFECT 317 +#define CC_TOK 318 +#define CCC_TOK 319 +#define CSRETCC_TOK 320 +#define FASTCC_TOK 321 +#define COLDCC_TOK 322 +#define X86_STDCALLCC_TOK 323 +#define X86_FASTCALLCC_TOK 324 +#define RET 325 +#define BR 326 +#define SWITCH 327 +#define INVOKE 328 +#define UNWIND 329 +#define UNREACHABLE 330 +#define ADD 331 +#define SUB 332 +#define MUL 333 +#define DIV 334 +#define REM 335 +#define AND 336 +#define OR 337 +#define XOR 338 +#define SETLE 339 +#define SETGE 340 +#define SETLT 341 +#define SETGT 342 +#define SETEQ 343 +#define SETNE 344 +#define MALLOC 345 +#define ALLOCA 346 +#define FREE 347 +#define LOAD 348 +#define STORE 349 +#define GETELEMENTPTR 350 +#define PHI_TOK 351 +#define CAST 352 +#define SELECT 353 +#define SHL 354 +#define SHR 355 +#define VAARG 356 +#define EXTRACTELEMENT 357 +#define INSERTELEMENT 358 +#define SHUFFLEVECTOR 359 +#define VAARG_old 360 +#define VANEXT_old 361 +extern YYSTYPE llvmAsmlval; Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.262 llvm/lib/AsmParser/llvmAsmParser.y:1.263 --- llvm/lib/AsmParser/llvmAsmParser.y:1.262 Thu Sep 28 14:28:24 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y Thu Sep 28 18:35:22 2006 @@ -1562,11 +1562,11 @@ CHECK_FOR_ERROR } | BOOL TRUETOK { // Boolean constants - $$ = ConstantBool::True; + $$ = ConstantBool::getTrue(); CHECK_FOR_ERROR } | BOOL FALSETOK { // Boolean constants - $$ = ConstantBool::False; + $$ = ConstantBool::getFalse(); CHECK_FOR_ERROR } | FPType FPVAL { // Float & Double constants @@ -2076,11 +2076,11 @@ CHECK_FOR_ERROR } | TRUETOK { - $$ = ValID::create(ConstantBool::True); + $$ = ValID::create(ConstantBool::getTrue()); CHECK_FOR_ERROR } | FALSETOK { - $$ = ValID::create(ConstantBool::False); + $$ = ValID::create(ConstantBool::getFalse()); CHECK_FOR_ERROR } | NULL_TOK { Index: llvm/lib/AsmParser/llvmAsmParser.y.cvs diff -u llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.14 llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.15 --- llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.14 Thu Sep 28 14:28:24 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y.cvs Thu Sep 28 18:35:22 2006 @@ -1562,11 +1562,11 @@ CHECK_FOR_ERROR } | BOOL TRUETOK { // Boolean constants - $$ = ConstantBool::True; + $$ = ConstantBool::getTrue(); CHECK_FOR_ERROR } | BOOL FALSETOK { // Boolean constants - $$ = ConstantBool::False; + $$ = ConstantBool::getFalse(); CHECK_FOR_ERROR } | FPType FPVAL { // Float & Double constants @@ -2076,11 +2076,11 @@ CHECK_FOR_ERROR } | TRUETOK { - $$ = ValID::create(ConstantBool::True); + $$ = ValID::create(ConstantBool::getTrue()); CHECK_FOR_ERROR } | FALSETOK { - $$ = ValID::create(ConstantBool::False); + $$ = ValID::create(ConstantBool::getFalse()); CHECK_FOR_ERROR } | NULL_TOK { From sabre at nondot.org Thu Sep 28 18:36:03 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 28 Sep 2006 18:36:03 -0500 Subject: [llvm-commits] CVS: llvm/lib/Analysis/ScalarEvolution.cpp Message-ID: <200609282336.k8SNa38J005745@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: ScalarEvolution.cpp updated: 1.51 -> 1.52 --- Log message: Eliminate ConstantBool::True and ConstantBool::False. Instead, provide ConstantBool::getTrue() and ConstantBool::getFalse(). --- Diffs of the changes: (+4 -4) ScalarEvolution.cpp | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm/lib/Analysis/ScalarEvolution.cpp diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.51 llvm/lib/Analysis/ScalarEvolution.cpp:1.52 --- llvm/lib/Analysis/ScalarEvolution.cpp:1.51 Sun Aug 27 17:30:17 2006 +++ llvm/lib/Analysis/ScalarEvolution.cpp Thu Sep 28 18:35:49 2006 @@ -1689,7 +1689,7 @@ // Evaluate the condition for this iteration. Result = ConstantExpr::get(SetCCOpcode, Result, RHS); if (!isa(Result)) break; // Couldn't decide for sure - if (Result == ConstantBool::False) { + if (cast(Result)->getValue() == false) { #if 0 std::cerr << "\n***\n*** Computed loop count " << *ItCst << "\n*** From global " << *GV << "*** BB: " << *L->getHeader() @@ -2168,7 +2168,7 @@ if (ConstantBool *CB = dyn_cast(ConstantExpr::getSetLT(R1->getValue(), R2->getValue()))) { - if (CB != ConstantBool::True) + if (CB->getValue() == false) std::swap(R1, R2); // R1 is the minimum root now. // We can only use this value if the chrec ends up with an exact zero @@ -2198,7 +2198,7 @@ if (SCEVConstant *C = dyn_cast(V)) { Constant *Zero = Constant::getNullValue(C->getValue()->getType()); Constant *NonZero = ConstantExpr::getSetNE(C->getValue(), Zero); - if (NonZero == ConstantBool::True) + if (NonZero == ConstantBool::getTrue()) return getSCEV(Zero); return UnknownValue; // Otherwise it will loop infinitely. } @@ -2386,7 +2386,7 @@ if (ConstantBool *CB = dyn_cast(ConstantExpr::getSetLT(R1->getValue(), R2->getValue()))) { - if (CB != ConstantBool::True) + if (CB->getValue() == false) std::swap(R1, R2); // R1 is the minimum root now. // Make sure the root is not off by one. The returned iteration should From sabre at nondot.org Thu Sep 28 18:36:35 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 28 Sep 2006 18:36:35 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Constants.h Message-ID: <200609282336.k8SNaZJn005801@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Constants.h updated: 1.87 -> 1.88 --- Log message: Eliminate ConstantBool::True and ConstantBool::False. Instead, provide ConstantBool::getTrue() and ConstantBool::getFalse(). --- Diffs of the changes: (+11 -7) Constants.h | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-) Index: llvm/include/llvm/Constants.h diff -u llvm/include/llvm/Constants.h:1.87 llvm/include/llvm/Constants.h:1.88 --- llvm/include/llvm/Constants.h:1.87 Sun Sep 17 23:58:06 2006 +++ llvm/include/llvm/Constants.h Thu Sep 28 18:36:21 2006 @@ -125,12 +125,14 @@ class ConstantBool : public ConstantIntegral { ConstantBool(bool V); public: - static ConstantBool *True, *False; ///< The True & False values + /// getTrue/getFalse - Return the singleton true/false values. + static ConstantBool *getTrue(); + static ConstantBool *getFalse(); /// This method is provided mostly for compatibility with the other /// ConstantIntegral subclasses. /// @brief Static factory method for getting a ConstantBool instance. - static ConstantBool *get(bool Value) { return Value ? True : False; } + static ConstantBool *get(bool Value) { return Value ? getTrue() : getFalse();} /// This method is provided mostly for compatibility with the other /// ConstantIntegral subclasses. @@ -139,7 +141,9 @@ /// Returns the opposite value of this ConstantBool value. /// @brief Get inverse value. - inline ConstantBool *inverted() const { return (this==True) ? False : True; } + inline ConstantBool *inverted() const { + return getValue() ? getFalse() : getTrue(); + } /// @returns the value of this ConstantBool /// @brief return the boolean value of this constant. @@ -147,10 +151,10 @@ /// @see ConstantIntegral for details /// @brief Implement overrides - virtual bool isNullValue() const { return this == False; } - virtual bool isMaxValue() const { return this == True; } - virtual bool isMinValue() const { return this == False; } - virtual bool isAllOnesValue() const { return this == True; } + virtual bool isNullValue() const { return getValue() == false; } + virtual bool isMaxValue() const { return getValue() == true; } + virtual bool isMinValue() const { return getValue() == false; } + virtual bool isAllOnesValue() const { return getValue() == true; } /// @brief Methods to support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const ConstantBool *) { return true; } From sabre at nondot.org Thu Sep 28 18:38:21 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 28 Sep 2006 18:38:21 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/Type.h Message-ID: <200609282338.k8SNcLgP005860@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Type.h updated: 1.89 -> 1.90 --- Log message: Now that ConstantBool::True/False are gone, we can modify Type.cpp to eliminate its static dtors, without having code that depends on order of initialization. Eliminate static ctors/dtors from Type.cpp. --- Diffs of the changes: (+0 -5) Type.h | 5 ----- 1 files changed, 5 deletions(-) Index: llvm/include/llvm/Type.h diff -u llvm/include/llvm/Type.h:1.89 llvm/include/llvm/Type.h:1.90 --- llvm/include/llvm/Type.h:1.89 Sat Sep 23 01:09:45 2006 +++ llvm/include/llvm/Type.h Thu Sep 28 18:38:07 2006 @@ -347,11 +347,6 @@ /// void removeAbstractTypeUser(AbstractTypeUser *U) const; - /// clearAllTypeMaps - This method frees all internal memory used by the - /// type subsystem, which can be used in environments where this memory is - /// otherwise reported as a leak. - static void clearAllTypeMaps(); - private: /// isSizedDerivedType - Derived types like structures and arrays are sized /// iff all of the members of the type are sized as well. Since asking for From sabre at nondot.org Thu Sep 28 18:38:23 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 28 Sep 2006 18:38:23 -0500 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Type.cpp Message-ID: <200609282338.k8SNcNQO005867@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Type.cpp updated: 1.144 -> 1.145 --- Log message: Now that ConstantBool::True/False are gone, we can modify Type.cpp to eliminate its static dtors, without having code that depends on order of initialization. Eliminate static ctors/dtors from Type.cpp. --- Diffs of the changes: (+73 -91) Type.cpp | 164 ++++++++++++++++++++++++++++----------------------------------- 1 files changed, 73 insertions(+), 91 deletions(-) Index: llvm/lib/VMCore/Type.cpp diff -u llvm/lib/VMCore/Type.cpp:1.144 llvm/lib/VMCore/Type.cpp:1.145 --- llvm/lib/VMCore/Type.cpp:1.144 Sun Aug 27 07:54:02 2006 +++ llvm/lib/VMCore/Type.cpp Thu Sep 28 18:38:07 2006 @@ -21,6 +21,7 @@ #include "llvm/ADT/STLExtras.h" #include "llvm/Support/MathExtras.h" #include "llvm/Support/Compiler.h" +#include "llvm/Support/ManagedStatic.h" #include #include using namespace llvm; @@ -57,13 +58,15 @@ // for types as they are needed. Because resolution of types must invalidate // all of the abstract type descriptions, we keep them in a seperate map to make // this easy. -static std::map ConcreteTypeDescriptions; -static std::map AbstractTypeDescriptions; +static ManagedStatic > ConcreteTypeDescriptions; +static ManagedStatic > AbstractTypeDescriptions; Type::Type(const char *Name, TypeID id) : ID(id), Abstract(false), RefCount(0), ForwardType(0) { assert(Name && Name[0] && "Should use other ctor if no name!"); - ConcreteTypeDescriptions[this] = Name; + (*ConcreteTypeDescriptions)[this] = Name; } @@ -250,18 +253,18 @@ std::vector &TypeStack) { if (isa(Ty)) { // Base case for the recursion std::map::iterator I = - AbstractTypeDescriptions.lower_bound(Ty); - if (I != AbstractTypeDescriptions.end() && I->first == Ty) + AbstractTypeDescriptions->lower_bound(Ty); + if (I != AbstractTypeDescriptions->end() && I->first == Ty) return I->second; std::string Desc = "opaque"; - AbstractTypeDescriptions.insert(std::make_pair(Ty, Desc)); + AbstractTypeDescriptions->insert(std::make_pair(Ty, Desc)); return Desc; } if (!Ty->isAbstract()) { // Base case for the recursion std::map::iterator I = - ConcreteTypeDescriptions.find(Ty); - if (I != ConcreteTypeDescriptions.end()) return I->second; + ConcreteTypeDescriptions->find(Ty); + if (I != ConcreteTypeDescriptions->end()) return I->second; } // Check to see if the Type is already on the stack... @@ -354,9 +357,9 @@ const std::string &Type::getDescription() const { if (isAbstract()) - return getOrCreateDesc(AbstractTypeDescriptions, this); + return getOrCreateDesc(*AbstractTypeDescriptions, this); else - return getOrCreateDesc(ConcreteTypeDescriptions, this); + return getOrCreateDesc(*ConcreteTypeDescriptions, this); } @@ -382,39 +385,41 @@ // Static 'Type' data //===----------------------------------------------------------------------===// -namespace { - struct VISIBILITY_HIDDEN PrimType : public Type { - PrimType(const char *S, TypeID ID) : Type(S, ID) {} - }; -} +#define DeclarePrimType(TY, Str) \ + struct VISIBILITY_HIDDEN TY##Type : public Type { \ + TY##Type() : Type(Str, Type::TY##TyID) {} \ + }; \ + static ManagedStatic The##TY##Ty -static PrimType TheVoidTy ("void" , Type::VoidTyID); -static PrimType TheBoolTy ("bool" , Type::BoolTyID); -static PrimType TheSByteTy ("sbyte" , Type::SByteTyID); -static PrimType TheUByteTy ("ubyte" , Type::UByteTyID); -static PrimType TheShortTy ("short" , Type::ShortTyID); -static PrimType TheUShortTy("ushort", Type::UShortTyID); -static PrimType TheIntTy ("int" , Type::IntTyID); -static PrimType TheUIntTy ("uint" , Type::UIntTyID); -static PrimType TheLongTy ("long" , Type::LongTyID); -static PrimType TheULongTy ("ulong" , Type::ULongTyID); -static PrimType TheFloatTy ("float" , Type::FloatTyID); -static PrimType TheDoubleTy("double", Type::DoubleTyID); -static PrimType TheLabelTy ("label" , Type::LabelTyID); - -Type *Type::VoidTy = &TheVoidTy; -Type *Type::BoolTy = &TheBoolTy; -Type *Type::SByteTy = &TheSByteTy; -Type *Type::UByteTy = &TheUByteTy; -Type *Type::ShortTy = &TheShortTy; -Type *Type::UShortTy = &TheUShortTy; -Type *Type::IntTy = &TheIntTy; -Type *Type::UIntTy = &TheUIntTy; -Type *Type::LongTy = &TheLongTy; -Type *Type::ULongTy = &TheULongTy; -Type *Type::FloatTy = &TheFloatTy; -Type *Type::DoubleTy = &TheDoubleTy; -Type *Type::LabelTy = &TheLabelTy; +namespace { + DeclarePrimType(Void, "void"); + DeclarePrimType(Bool, "bool"); + DeclarePrimType(SByte, "sbyte"); + DeclarePrimType(UByte, "ubyte"); + DeclarePrimType(Short, "short"); + DeclarePrimType(UShort, "ushort"); + DeclarePrimType(Int, "int"); + DeclarePrimType(UInt, "uint"); + DeclarePrimType(Long, "long"); + DeclarePrimType(ULong, "ulong"); + DeclarePrimType(Float, "float"); + DeclarePrimType(Double, "double"); + DeclarePrimType(Label, "label"); +} + +Type *Type::VoidTy = &*TheVoidTy; +Type *Type::BoolTy = &*TheBoolTy; +Type *Type::SByteTy = &*TheSByteTy; +Type *Type::UByteTy = &*TheUByteTy; +Type *Type::ShortTy = &*TheShortTy; +Type *Type::UShortTy = &*TheUShortTy; +Type *Type::IntTy = &*TheIntTy; +Type *Type::UIntTy = &*TheUIntTy; +Type *Type::LongTy = &*TheLongTy; +Type *Type::ULongTy = &*TheULongTy; +Type *Type::FloatTy = &*TheFloatTy; +Type *Type::DoubleTy = &*TheDoubleTy; +Type *Type::LabelTy = &*TheLabelTy; //===----------------------------------------------------------------------===// @@ -990,7 +995,7 @@ } // Define the actual map itself now... -static TypeMap FunctionTypes; +static ManagedStatic > FunctionTypes; FunctionValType FunctionValType::get(const FunctionType *FT) { // Build up a FunctionValType @@ -1007,10 +1012,10 @@ const std::vector &Params, bool isVarArg) { FunctionValType VT(ReturnType, Params, isVarArg); - FunctionType *MT = FunctionTypes.get(VT); + FunctionType *MT = FunctionTypes->get(VT); if (MT) return MT; - FunctionTypes.add(VT, MT = new FunctionType(ReturnType, Params, isVarArg)); + FunctionTypes->add(VT, MT = new FunctionType(ReturnType, Params, isVarArg)); #ifdef DEBUG_MERGE_TYPES std::cerr << "Derived new type: " << MT << "\n"; @@ -1048,18 +1053,18 @@ } }; } -static TypeMap ArrayTypes; +static ManagedStatic > ArrayTypes; ArrayType *ArrayType::get(const Type *ElementType, uint64_t NumElements) { assert(ElementType && "Can't get array of null types!"); ArrayValType AVT(ElementType, NumElements); - ArrayType *AT = ArrayTypes.get(AVT); + ArrayType *AT = ArrayTypes->get(AVT); if (AT) return AT; // Found a match, return it! // Value not found. Derive a new type! - ArrayTypes.add(AVT, AT = new ArrayType(ElementType, NumElements)); + ArrayTypes->add(AVT, AT = new ArrayType(ElementType, NumElements)); #ifdef DEBUG_MERGE_TYPES std::cerr << "Derived new type: " << *AT << "\n"; @@ -1098,7 +1103,7 @@ } }; } -static TypeMap PackedTypes; +static ManagedStatic > PackedTypes; PackedType *PackedType::get(const Type *ElementType, unsigned NumElements) { @@ -1106,11 +1111,11 @@ assert(isPowerOf2_32(NumElements) && "Vector length should be a power of 2!"); PackedValType PVT(ElementType, NumElements); - PackedType *PT = PackedTypes.get(PVT); + PackedType *PT = PackedTypes->get(PVT); if (PT) return PT; // Found a match, return it! // Value not found. Derive a new type! - PackedTypes.add(PVT, PT = new PackedType(ElementType, NumElements)); + PackedTypes->add(PVT, PT = new PackedType(ElementType, NumElements)); #ifdef DEBUG_MERGE_TYPES std::cerr << "Derived new type: " << *PT << "\n"; @@ -1155,15 +1160,15 @@ }; } -static TypeMap StructTypes; +static ManagedStatic > StructTypes; StructType *StructType::get(const std::vector &ETypes) { StructValType STV(ETypes); - StructType *ST = StructTypes.get(STV); + StructType *ST = StructTypes->get(STV); if (ST) return ST; // Value not found. Derive a new type! - StructTypes.add(STV, ST = new StructType(ETypes)); + StructTypes->add(STV, ST = new StructType(ETypes)); #ifdef DEBUG_MERGE_TYPES std::cerr << "Derived new type: " << *ST << "\n"; @@ -1205,7 +1210,7 @@ }; } -static TypeMap PointerTypes; +static ManagedStatic > PointerTypes; PointerType *PointerType::get(const Type *ValueType) { assert(ValueType && "Can't get a pointer to type!"); @@ -1213,11 +1218,11 @@ "Pointer to void is not valid, use sbyte* instead!"); PointerValType PVT(ValueType); - PointerType *PT = PointerTypes.get(PVT); + PointerType *PT = PointerTypes->get(PVT); if (PT) return PT; // Value not found. Derive a new type! - PointerTypes.add(PVT, PT = new PointerType(ValueType)); + PointerTypes->add(PVT, PT = new PointerType(ValueType)); #ifdef DEBUG_MERGE_TYPES std::cerr << "Derived new type: " << *PT << "\n"; @@ -1274,7 +1279,7 @@ assert(ForwardType == 0 && "This type has already been refined!"); // The descriptions may be out of date. Conservatively clear them all! - AbstractTypeDescriptions.clear(); + AbstractTypeDescriptions->clear(); #ifdef DEBUG_MERGE_TYPES std::cerr << "REFINING abstract type [" << (void*)this << " " @@ -1356,11 +1361,11 @@ // void FunctionType::refineAbstractType(const DerivedType *OldType, const Type *NewType) { - FunctionTypes.RefineAbstractType(this, OldType, NewType); + FunctionTypes->RefineAbstractType(this, OldType, NewType); } void FunctionType::typeBecameConcrete(const DerivedType *AbsTy) { - FunctionTypes.TypeBecameConcrete(this, AbsTy); + FunctionTypes->TypeBecameConcrete(this, AbsTy); } @@ -1370,11 +1375,11 @@ // void ArrayType::refineAbstractType(const DerivedType *OldType, const Type *NewType) { - ArrayTypes.RefineAbstractType(this, OldType, NewType); + ArrayTypes->RefineAbstractType(this, OldType, NewType); } void ArrayType::typeBecameConcrete(const DerivedType *AbsTy) { - ArrayTypes.TypeBecameConcrete(this, AbsTy); + ArrayTypes->TypeBecameConcrete(this, AbsTy); } // refineAbstractType - Called when a contained type is found to be more @@ -1383,11 +1388,11 @@ // void PackedType::refineAbstractType(const DerivedType *OldType, const Type *NewType) { - PackedTypes.RefineAbstractType(this, OldType, NewType); + PackedTypes->RefineAbstractType(this, OldType, NewType); } void PackedType::typeBecameConcrete(const DerivedType *AbsTy) { - PackedTypes.TypeBecameConcrete(this, AbsTy); + PackedTypes->TypeBecameConcrete(this, AbsTy); } // refineAbstractType - Called when a contained type is found to be more @@ -1396,11 +1401,11 @@ // void StructType::refineAbstractType(const DerivedType *OldType, const Type *NewType) { - StructTypes.RefineAbstractType(this, OldType, NewType); + StructTypes->RefineAbstractType(this, OldType, NewType); } void StructType::typeBecameConcrete(const DerivedType *AbsTy) { - StructTypes.TypeBecameConcrete(this, AbsTy); + StructTypes->TypeBecameConcrete(this, AbsTy); } // refineAbstractType - Called when a contained type is found to be more @@ -1409,11 +1414,11 @@ // void PointerType::refineAbstractType(const DerivedType *OldType, const Type *NewType) { - PointerTypes.RefineAbstractType(this, OldType, NewType); + PointerTypes->RefineAbstractType(this, OldType, NewType); } void PointerType::typeBecameConcrete(const DerivedType *AbsTy) { - PointerTypes.TypeBecameConcrete(this, AbsTy); + PointerTypes->TypeBecameConcrete(this, AbsTy); } bool SequentialType::indexValid(const Value *V) const { @@ -1443,26 +1448,3 @@ return OS; } } - -/// clearAllTypeMaps - This method frees all internal memory used by the -/// type subsystem, which can be used in environments where this memory is -/// otherwise reported as a leak. -void Type::clearAllTypeMaps() { - std::vector DerivedTypes; - - FunctionTypes.clear(DerivedTypes); - PointerTypes.clear(DerivedTypes); - StructTypes.clear(DerivedTypes); - ArrayTypes.clear(DerivedTypes); - PackedTypes.clear(DerivedTypes); - - for(std::vector::iterator I = DerivedTypes.begin(), - E = DerivedTypes.end(); I != E; ++I) - (*I)->ContainedTys.clear(); - for(std::vector::iterator I = DerivedTypes.begin(), - E = DerivedTypes.end(); I != E; ++I) - delete *I; - DerivedTypes.clear(); -} - -// vim: sw=2 From sabre at nondot.org Thu Sep 28 18:45:14 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 28 Sep 2006 18:45:14 -0500 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Type.cpp Message-ID: <200609282345.k8SNjEQf006024@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Type.cpp updated: 1.145 -> 1.146 --- Log message: Minor cleanups --- Diffs of the changes: (+24 -36) Type.cpp | 60 ++++++++++++++++++++++++------------------------------------ 1 files changed, 24 insertions(+), 36 deletions(-) Index: llvm/lib/VMCore/Type.cpp diff -u llvm/lib/VMCore/Type.cpp:1.145 llvm/lib/VMCore/Type.cpp:1.146 --- llvm/lib/VMCore/Type.cpp:1.145 Thu Sep 28 18:38:07 2006 +++ llvm/lib/VMCore/Type.cpp Thu Sep 28 18:45:00 2006 @@ -382,44 +382,32 @@ //===----------------------------------------------------------------------===// -// Static 'Type' data +// Primitive 'Type' data //===----------------------------------------------------------------------===// -#define DeclarePrimType(TY, Str) \ - struct VISIBILITY_HIDDEN TY##Type : public Type { \ - TY##Type() : Type(Str, Type::TY##TyID) {} \ - }; \ - static ManagedStatic The##TY##Ty - -namespace { - DeclarePrimType(Void, "void"); - DeclarePrimType(Bool, "bool"); - DeclarePrimType(SByte, "sbyte"); - DeclarePrimType(UByte, "ubyte"); - DeclarePrimType(Short, "short"); - DeclarePrimType(UShort, "ushort"); - DeclarePrimType(Int, "int"); - DeclarePrimType(UInt, "uint"); - DeclarePrimType(Long, "long"); - DeclarePrimType(ULong, "ulong"); - DeclarePrimType(Float, "float"); - DeclarePrimType(Double, "double"); - DeclarePrimType(Label, "label"); -} - -Type *Type::VoidTy = &*TheVoidTy; -Type *Type::BoolTy = &*TheBoolTy; -Type *Type::SByteTy = &*TheSByteTy; -Type *Type::UByteTy = &*TheUByteTy; -Type *Type::ShortTy = &*TheShortTy; -Type *Type::UShortTy = &*TheUShortTy; -Type *Type::IntTy = &*TheIntTy; -Type *Type::UIntTy = &*TheUIntTy; -Type *Type::LongTy = &*TheLongTy; -Type *Type::ULongTy = &*TheULongTy; -Type *Type::FloatTy = &*TheFloatTy; -Type *Type::DoubleTy = &*TheDoubleTy; -Type *Type::LabelTy = &*TheLabelTy; +#define DeclarePrimType(TY, Str) \ + namespace { \ + struct VISIBILITY_HIDDEN TY##Type : public Type { \ + TY##Type() : Type(Str, Type::TY##TyID) {} \ + }; \ + } \ + static ManagedStatic The##TY##Ty; \ + Type *Type::TY##Ty = &*The##TY##Ty + +DeclarePrimType(Void, "void"); +DeclarePrimType(Bool, "bool"); +DeclarePrimType(SByte, "sbyte"); +DeclarePrimType(UByte, "ubyte"); +DeclarePrimType(Short, "short"); +DeclarePrimType(UShort, "ushort"); +DeclarePrimType(Int, "int"); +DeclarePrimType(UInt, "uint"); +DeclarePrimType(Long, "long"); +DeclarePrimType(ULong, "ulong"); +DeclarePrimType(Float, "float"); +DeclarePrimType(Double, "double"); +DeclarePrimType(Label, "label"); +#undef DeclarePrimType //===----------------------------------------------------------------------===// From clattner at apple.com Thu Sep 28 19:01:51 2006 From: clattner at apple.com (Chris Lattner) Date: Thu, 28 Sep 2006 17:01:51 -0700 Subject: [llvm-commits] llvm-gcc patch Message-ID: <9EAD6AF3-8661-4E4B-8A1B-8A0572A4D2CE@apple.com> FYI, this updates llvm-gcc to work with recent llvm cvs changes. -Chris Index: llvm-backend.cpp =================================================================== --- llvm-backend.cpp (revision 118395) +++ llvm-backend.cpp (working copy) @@ -575,10 +575,10 @@ bool ValidateRegisterVariable(tree decl) if (TREE_THIS_VOLATILE(decl)) warning("volatile register variables don%'t work as you might wish"); - SET_DECL_LLVM(decl, ConstantBool::False); + SET_DECL_LLVM(decl, ConstantBool::getFalse()); return false; // Everything ok. } - SET_DECL_LLVM(decl, ConstantBool::True); + SET_DECL_LLVM(decl, ConstantBool::getTrue()); return true; } From jlaskey at apple.com Fri Sep 29 12:32:04 2006 From: jlaskey at apple.com (Jim Laskey) Date: Fri, 29 Sep 2006 12:32:04 -0500 Subject: [llvm-commits] CVS: llvm/utils/NewNightlyTest.pl Message-ID: <200609291732.k8THW4Zl001680@zion.cs.uiuc.edu> Changes in directory llvm/utils: NewNightlyTest.pl updated: 1.62 -> 1.63 --- Log message: Wrong directory. --- Diffs of the changes: (+2 -2) NewNightlyTest.pl | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/utils/NewNightlyTest.pl diff -u llvm/utils/NewNightlyTest.pl:1.62 llvm/utils/NewNightlyTest.pl:1.63 --- llvm/utils/NewNightlyTest.pl:1.62 Thu Sep 28 13:45:11 2006 +++ llvm/utils/NewNightlyTest.pl Fri Sep 29 12:31:45 2006 @@ -660,7 +660,7 @@ $afiles.= `find lib/ -iname '*.a' -ls`; $afiles.= `find tools/ -iname '*.a' -ls`; if($BUILDTYPE eq "release"){ - $afiles.= `find Release+Asserts/ -iname '*.a' -ls`; + $afiles.= `find Release/ -iname '*.a' -ls`; } elsif($BUILDTYPE eq "release-asserts") { $afiles.= `find Release-Asserts/ -iname '*.a' -ls`; } else { @@ -671,7 +671,7 @@ $ofiles.= `find lib/ -iname '*.o' -ls`; $ofiles.= `find tools/ -iname '*.o' -ls`; if($BUILDTYPE eq "release"){ - $ofiles.= `find Release+Asserts/ -iname '*.o' -ls`; + $ofiles.= `find Release/ -iname '*.o' -ls`; } elsif($BUILDTYPE eq "release-asserts") { $ofiles.= `find Release-Asserts/ -iname '*.o' -ls`; } else { From sabre at nondot.org Fri Sep 29 12:35:10 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 29 Sep 2006 12:35:10 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CFrontend/2005-12-04-AttributeUsed.c Message-ID: <200609291735.k8THZAd5001775@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CFrontend: 2005-12-04-AttributeUsed.c updated: 1.2 -> 1.3 --- Log message: Adjust this to the wonky syntax that GCC expects. --- Diffs of the changes: (+1 -2) 2005-12-04-AttributeUsed.c | 3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/test/Regression/CFrontend/2005-12-04-AttributeUsed.c diff -u llvm/test/Regression/CFrontend/2005-12-04-AttributeUsed.c:1.2 llvm/test/Regression/CFrontend/2005-12-04-AttributeUsed.c:1.3 --- llvm/test/Regression/CFrontend/2005-12-04-AttributeUsed.c:1.2 Thu Sep 28 16:36:21 2006 +++ llvm/test/Regression/CFrontend/2005-12-04-AttributeUsed.c Fri Sep 29 12:34:56 2006 @@ -3,6 +3,5 @@ int X __attribute__((used)); int Y; -void foo() __attribute__((used)); +__attribute__((used)) void foo() {} -void foo() {} From sabre at nondot.org Fri Sep 29 13:43:28 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 29 Sep 2006 13:43:28 -0500 Subject: [llvm-commits] CVS: llvm/lib/Support/ManagedStatic.cpp Message-ID: <200609291843.k8TIhSam003075@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: ManagedStatic.cpp updated: 1.1 -> 1.2 --- Log message: Define this in the correct n/s --- Diffs of the changes: (+1 -1) ManagedStatic.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Support/ManagedStatic.cpp diff -u llvm/lib/Support/ManagedStatic.cpp:1.1 llvm/lib/Support/ManagedStatic.cpp:1.2 --- llvm/lib/Support/ManagedStatic.cpp:1.1 Wed Sep 27 19:31:55 2006 +++ llvm/lib/Support/ManagedStatic.cpp Fri Sep 29 13:43:14 2006 @@ -46,7 +46,7 @@ } /// llvm_shutdown - Deallocate and destroy all ManagedStatic variables. -void llvm_shutdown() { +void llvm::llvm_shutdown() { while (StaticList) StaticList->destroy(); } From sabre at nondot.org Fri Sep 29 13:47:27 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 29 Sep 2006 13:47:27 -0500 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200609291847.k8TIlRuf003189@zion.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.405 -> 1.406 --- Log message: Move CompileCommonOpts to the end of the list so that EXTRA_OPTIONS=-O0 will override the optimization level. --- Diffs of the changes: (+7 -7) Makefile.rules | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.405 llvm/Makefile.rules:1.406 --- llvm/Makefile.rules:1.405 Mon Sep 4 01:39:52 2006 +++ llvm/Makefile.rules Fri Sep 29 13:47:13 2006 @@ -426,16 +426,16 @@ -I$(LLVM_SRC_ROOT)/include \ $(CPP.BaseFlags) -Compile.C = $(CC) $(CPP.Flags) $(CompileCommonOpts) -c $(C.Flags) +Compile.C = $(CC) $(CPP.Flags) $(C.Flags) $(CompileCommonOpts) -c LTCompile.C = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.C) -BCCompile.C = $(LLVMGCCWITHPATH) $(CPP.Flags) $(CompileCommonOpts) \ - $(C.Flags) -Preprocess.C = $(CC) $(CPP.Flags) $(CompileCommonOpts) -E $(C.Flags) +BCCompile.C = $(LLVMGCCWITHPATH) $(CPP.Flags) $(C.Flags) $(CompileCommonOpts) +Preprocess.C = $(CC) $(CPP.Flags) $(C.Flags) $(CompileCommonOpts) -E -Compile.CXX = $(CXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -c +Compile.CXX = $(CXX) $(CPP.Flags) $(CXX.Flags) $(CompileCommonOpts) -c LTCompile.CXX = $(LIBTOOL) $(LibTool.Flags) --mode=compile $(Compile.CXX) -BCCompile.CXX = $(LLVMGXXWITHPATH) $(CPP.Flags) $(CompileCommonOpts) \ - $(CXX.Flags) +BCCompile.CXX = $(LLVMGXXWITHPATH) $(CPP.Flags) $(CXX.Flags) \ + $(CompileCommonOpts) + Preprocess.CXX= $(CXX) $(CPP.Flags) $(CompileCommonOpts) $(CXX.Flags) -E Link = $(CXX) $(CPP.Flags) $(CXX.Flags) $(CompileCommonOpts) \ $(LD.Flags) $(Strip) From rafael.espindola at gmail.com Fri Sep 29 16:20:32 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Fri, 29 Sep 2006 16:20:32 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/ARM/fp.ll Message-ID: <200609292120.k8TLKWac005736@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/ARM: fp.ll added (r1.1) --- Log message: add floating point registers implement SINT_TO_FP --- Diffs of the changes: (+10 -0) fp.ll | 10 ++++++++++ 1 files changed, 10 insertions(+) Index: llvm/test/Regression/CodeGen/ARM/fp.ll diff -c /dev/null llvm/test/Regression/CodeGen/ARM/fp.ll:1.1 *** /dev/null Fri Sep 29 16:20:26 2006 --- llvm/test/Regression/CodeGen/ARM/fp.ll Fri Sep 29 16:20:16 2006 *************** *** 0 **** --- 1,10 ---- + ; RUN: llvm-as < %s | llc -march=arm && + ; RUN: llvm-as < %s | llc -march=arm | grep fmsr && + ; RUN: llvm-as < %s | llc -march=arm | grep fsitos && + ; RUN: llvm-as < %s | llc -march=arm | grep fmrs + + float %f(int %a) { + entry: + %tmp = cast int %a to float ; [#uses=1] + ret float %tmp + } From rafael.espindola at gmail.com Fri Sep 29 16:20:32 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Fri, 29 Sep 2006 16:20:32 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp ARMInstrInfo.td ARMRegisterInfo.td Message-ID: <200609292120.k8TLKWt1005745@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMISelDAGToDAG.cpp updated: 1.47 -> 1.48 ARMInstrInfo.td updated: 1.28 -> 1.29 ARMRegisterInfo.td updated: 1.3 -> 1.4 --- Log message: add floating point registers implement SINT_TO_FP --- Diffs of the changes: (+137 -23) ARMISelDAGToDAG.cpp | 32 ++++++++++++-- ARMInstrInfo.td | 16 +++++++ ARMRegisterInfo.td | 112 +++++++++++++++++++++++++++++++++++++++++++--------- 3 files changed, 137 insertions(+), 23 deletions(-) Index: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp diff -u llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.47 llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.48 --- llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.47 Thu Sep 21 08:06:26 2006 +++ llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Fri Sep 29 16:20:15 2006 @@ -45,9 +45,10 @@ ARMTargetLowering::ARMTargetLowering(TargetMachine &TM) : TargetLowering(TM) { addRegisterClass(MVT::i32, ARM::IntRegsRegisterClass); + addRegisterClass(MVT::f32, ARM::FPRegsRegisterClass); + addRegisterClass(MVT::f64, ARM::DFPRegsRegisterClass); - //LLVM requires that a register class supports MVT::f64! - addRegisterClass(MVT::f64, ARM::IntRegsRegisterClass); + setOperationAction(ISD::SINT_TO_FP, MVT::i32, Custom); setOperationAction(ISD::RET, MVT::Other, Custom); setOperationAction(ISD::GlobalAddress, MVT::i32, Custom); @@ -79,7 +80,9 @@ SELECT, - BR + BR, + + FSITOS }; } } @@ -111,6 +114,7 @@ case ARMISD::SELECT: return "ARMISD::SELECT"; case ARMISD::CMP: return "ARMISD::CMP"; case ARMISD::BR: return "ARMISD::BR"; + case ARMISD::FSITOS: return "ARMISD::FSITOS"; } } @@ -241,11 +245,18 @@ SDOperand LR = DAG.getRegister(ARM::R14, MVT::i32); return DAG.getNode(ARMISD::RET_FLAG, MVT::Other, Chain); } - case 3: - Copy = DAG.getCopyToReg(Chain, ARM::R0, Op.getOperand(1), SDOperand()); + case 3: { + SDOperand Val = Op.getOperand(1); + assert(Val.getValueType() == MVT::i32 || + Val.getValueType() == MVT::f32); + + if (Val.getValueType() == MVT::f32) + Val = DAG.getNode(ISD::BIT_CONVERT, MVT::i32, Val); + Copy = DAG.getCopyToReg(Chain, ARM::R0, Val, SDOperand()); if (DAG.getMachineFunction().liveout_empty()) DAG.getMachineFunction().addLiveOut(ARM::R0); break; + } case 5: Copy = DAG.getCopyToReg(Chain, ARM::R1, Op.getOperand(3), SDOperand()); Copy = DAG.getCopyToReg(Copy, ARM::R0, Op.getOperand(1), Copy.getValue(1)); @@ -409,6 +420,15 @@ return DAG.getNode(ARMISD::BR, MVT::Other, Chain, Dest, ARMCC, Cmp); } +static SDOperand LowerSINT_TO_FP(SDOperand Op, SelectionDAG &DAG) { + SDOperand IntVal = Op.getOperand(0); + assert(IntVal.getValueType() == MVT::i32); + assert(Op.getValueType() == MVT::f32); + + SDOperand Tmp = DAG.getNode(ISD::BIT_CONVERT, MVT::f32, IntVal); + return DAG.getNode(ARMISD::FSITOS, MVT::f32, Tmp); +} + SDOperand ARMTargetLowering::LowerOperation(SDOperand Op, SelectionDAG &DAG) { switch (Op.getOpcode()) { default: @@ -418,6 +438,8 @@ return LowerConstantPool(Op, DAG); case ISD::GlobalAddress: return LowerGlobalAddress(Op, DAG); + case ISD::SINT_TO_FP: + return LowerSINT_TO_FP(Op, DAG); case ISD::FORMAL_ARGUMENTS: return LowerFORMAL_ARGUMENTS(Op, DAG, VarArgsFrameIndex); case ISD::CALL: Index: llvm/lib/Target/ARM/ARMInstrInfo.td diff -u llvm/lib/Target/ARM/ARMInstrInfo.td:1.28 llvm/lib/Target/ARM/ARMInstrInfo.td:1.29 --- llvm/lib/Target/ARM/ARMInstrInfo.td:1.28 Wed Sep 13 07:09:43 2006 +++ llvm/lib/Target/ARM/ARMInstrInfo.td Fri Sep 29 16:20:15 2006 @@ -74,6 +74,8 @@ def SDTVoidBinOp : SDTypeProfile<0, 2, [SDTCisSameAs<0, 1>]>; def armcmp : SDNode<"ARMISD::CMP", SDTVoidBinOp, [SDNPOutFlag]>; +def armfsitos : SDNode<"ARMISD::FSITOS", SDTUnaryOp>; + def ADJCALLSTACKUP : InstARM<(ops i32imm:$amt), "!ADJCALLSTACKUP $amt", [(callseq_end imm:$amt)]>; @@ -150,3 +152,17 @@ def cmp : InstARM<(ops IntRegs:$a, op_addr_mode1:$b), "cmp $a, $b", [(armcmp IntRegs:$a, addr_mode1:$b)]>; + + +// Floating Point Conversion +// We use bitconvert for moving the data between the register classes. +// The format conversion is done with ARM specific nodes + +def FMSR : InstARM<(ops FPRegs:$dst, IntRegs:$src), + "fmsr $dst, $src", [(set FPRegs:$dst, (bitconvert IntRegs:$src))]>; + +def FMRS : InstARM<(ops IntRegs:$dst, FPRegs:$src), + "fmrs $dst, $src", [(set IntRegs:$dst, (bitconvert FPRegs:$src))]>; + +def FSITOS : InstARM<(ops FPRegs:$dst, FPRegs:$src), + "fsitos $dst, $src", [(set FPRegs:$dst, (armfsitos FPRegs:$src))]>; Index: llvm/lib/Target/ARM/ARMRegisterInfo.td diff -u llvm/lib/Target/ARM/ARMRegisterInfo.td:1.3 llvm/lib/Target/ARM/ARMRegisterInfo.td:1.4 --- llvm/lib/Target/ARM/ARMRegisterInfo.td:1.3 Thu Aug 17 17:00:07 2006 +++ llvm/lib/Target/ARM/ARMRegisterInfo.td Fri Sep 29 16:20:16 2006 @@ -13,28 +13,97 @@ //===----------------------------------------------------------------------===// // Registers are identified with 4-bit ID numbers. -class ARMReg num, string n> : Register { - field bits<4> Num; +class ARMReg : Register { let Namespace = "ARM"; } +// Ri - 32-bit integer registers +class Ri num, string n> : ARMReg { + field bits<4> Num; + let Num = num; +} +// Rf - 32-bit floating-point registers +class Rf num, string n> : ARMReg { + field bits<5> Num; + let Num = num; +} +// Rd - Slots in the FP register file for 64-bit floating-point values. +class Rd num, string n, list aliases> : ARMReg { + field bits<5> Num; + let Num = num; + let Aliases = aliases; +} + // Integer registers -def R0 : ARMReg< 0, "R0">, DwarfRegNum<0>; -def R1 : ARMReg< 1, "R1">, DwarfRegNum<1>; -def R2 : ARMReg< 2, "R2">, DwarfRegNum<2>; -def R3 : ARMReg< 3, "R3">, DwarfRegNum<3>; -def R4 : ARMReg< 4, "R4">, DwarfRegNum<4>; -def R5 : ARMReg< 5, "R5">, DwarfRegNum<5>; -def R6 : ARMReg< 6, "R6">, DwarfRegNum<6>; -def R7 : ARMReg< 7, "R7">, DwarfRegNum<7>; -def R8 : ARMReg< 8, "R8">, DwarfRegNum<8>; -def R9 : ARMReg< 9, "R9">, DwarfRegNum<9>; -def R10 : ARMReg<10, "R10">, DwarfRegNum<10>; -def R11 : ARMReg<11, "R11">, DwarfRegNum<11>; -def R12 : ARMReg<12, "R12">, DwarfRegNum<12>; -def R13 : ARMReg<13, "R13">, DwarfRegNum<13>; -def R14 : ARMReg<14, "R14">, DwarfRegNum<14>; -def R15 : ARMReg<15, "R15">, DwarfRegNum<15>; +def R0 : Ri< 0, "R0">, DwarfRegNum<0>; +def R1 : Ri< 1, "R1">, DwarfRegNum<1>; +def R2 : Ri< 2, "R2">, DwarfRegNum<2>; +def R3 : Ri< 3, "R3">, DwarfRegNum<3>; +def R4 : Ri< 4, "R4">, DwarfRegNum<4>; +def R5 : Ri< 5, "R5">, DwarfRegNum<5>; +def R6 : Ri< 6, "R6">, DwarfRegNum<6>; +def R7 : Ri< 7, "R7">, DwarfRegNum<7>; +def R8 : Ri< 8, "R8">, DwarfRegNum<8>; +def R9 : Ri< 9, "R9">, DwarfRegNum<9>; +def R10 : Ri<10, "R10">, DwarfRegNum<10>; +def R11 : Ri<11, "R11">, DwarfRegNum<11>; +def R12 : Ri<12, "R12">, DwarfRegNum<12>; +def R13 : Ri<13, "R13">, DwarfRegNum<13>; +def R14 : Ri<14, "R14">, DwarfRegNum<14>; +def R15 : Ri<15, "R15">, DwarfRegNum<15>; + +// TODO: update to VFP-v3 +// Floating-point registers +def S0 : Rf< 0, "S0">, DwarfRegNum<64>; +def S1 : Rf< 1, "S1">, DwarfRegNum<65>; +def S2 : Rf< 2, "S2">, DwarfRegNum<66>; +def S3 : Rf< 3, "S3">, DwarfRegNum<67>; +def S4 : Rf< 4, "S4">, DwarfRegNum<68>; +def S5 : Rf< 5, "S5">, DwarfRegNum<69>; +def S6 : Rf< 6, "S6">, DwarfRegNum<70>; +def S7 : Rf< 7, "S7">, DwarfRegNum<71>; +def S8 : Rf< 8, "S8">, DwarfRegNum<72>; +def S9 : Rf< 9, "S9">, DwarfRegNum<73>; +def S10 : Rf<10, "S10">, DwarfRegNum<74>; +def S11 : Rf<11, "S11">, DwarfRegNum<75>; +def S12 : Rf<12, "S12">, DwarfRegNum<76>; +def S13 : Rf<13, "S13">, DwarfRegNum<77>; +def S14 : Rf<14, "S14">, DwarfRegNum<78>; +def S15 : Rf<15, "S15">, DwarfRegNum<79>; +def S16 : Rf<16, "S16">, DwarfRegNum<80>; +def S17 : Rf<17, "S17">, DwarfRegNum<81>; +def S18 : Rf<18, "S18">, DwarfRegNum<82>; +def S19 : Rf<19, "S19">, DwarfRegNum<83>; +def S20 : Rf<20, "S20">, DwarfRegNum<84>; +def S21 : Rf<21, "S21">, DwarfRegNum<85>; +def S22 : Rf<22, "S22">, DwarfRegNum<86>; +def S23 : Rf<23, "S23">, DwarfRegNum<87>; +def S24 : Rf<24, "S24">, DwarfRegNum<88>; +def S25 : Rf<25, "S25">, DwarfRegNum<89>; +def S26 : Rf<26, "S26">, DwarfRegNum<90>; +def S27 : Rf<27, "S27">, DwarfRegNum<91>; +def S28 : Rf<28, "S28">, DwarfRegNum<92>; +def S29 : Rf<29, "S29">, DwarfRegNum<93>; +def S30 : Rf<30, "S30">, DwarfRegNum<94>; +def S31 : Rf<31, "S31">, DwarfRegNum<95>; + +// Aliases of the S* registers used to hold 64-bit fp values (doubles) +def D0 : Rd< 0, "S0", [S0, S1]>, DwarfRegNum<64>; +def D1 : Rd< 2, "S2", [S2, S3]>, DwarfRegNum<66>; +def D2 : Rd< 4, "S4", [S4, S5]>, DwarfRegNum<68>; +def D3 : Rd< 6, "S6", [S6, S7]>, DwarfRegNum<70>; +def D4 : Rd< 8, "S8", [S8, S9]>, DwarfRegNum<72>; +def D5 : Rd<10, "S10", [S10, S11]>, DwarfRegNum<74>; +def D6 : Rd<12, "S12", [S12, S13]>, DwarfRegNum<76>; +def D7 : Rd<14, "S14", [S14, S15]>, DwarfRegNum<78>; +def D8 : Rd<16, "S16", [S16, S17]>, DwarfRegNum<80>; +def D9 : Rd<18, "S18", [S18, S19]>, DwarfRegNum<82>; +def D10 : Rd<20, "S20", [S20, S21]>, DwarfRegNum<84>; +def D11 : Rd<22, "S22", [S22, S23]>, DwarfRegNum<86>; +def D12 : Rd<24, "S24", [S24, S25]>, DwarfRegNum<88>; +def D13 : Rd<26, "S26", [S26, S27]>, DwarfRegNum<90>; +def D14 : Rd<28, "S28", [S28, S29]>, DwarfRegNum<92>; +def D15 : Rd<30, "S30", [S30, S31]>, DwarfRegNum<94>; // Register classes. // @@ -60,3 +129,10 @@ } }]; } + +def FPRegs : RegisterClass<"ARM", [f32], 32, [S0, S1, S2, S3, S4, S5, S6, S7, S8, + S9, S10, S11, S12, S13, S14, S15, S16, S17, S18, S19, S20, S21, S22, + S23, S24, S25, S26, S27, S28, S29, S30, S31]>; + +def DFPRegs : RegisterClass<"ARM", [f64], 64, [D0, D1, D2, D3, D4, D5, D6, D7, + D8, D9, D10, D11, D12, D13, D14, D15]>; From evan.cheng at apple.com Fri Sep 29 17:05:24 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 29 Sep 2006 17:05:24 -0500 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Message-ID: <200609292205.k8TM5Odp006622@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelDAGToDAG.cpp updated: 1.109 -> 1.110 --- Log message: Not needed. --- Diffs of the changes: (+0 -1) X86ISelDAGToDAG.cpp | 1 - 1 files changed, 1 deletion(-) Index: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp diff -u llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.109 llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.110 --- llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.109 Sun Sep 17 15:25:45 2006 +++ llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Fri Sep 29 17:05:10 2006 @@ -34,7 +34,6 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/MathExtras.h" #include "llvm/ADT/Statistic.h" -#include #include #include #include From sabre at nondot.org Fri Sep 29 19:24:34 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 29 Sep 2006 19:24:34 -0500 Subject: [llvm-commits] CVS: llvm/projects/Makefile Message-ID: <200609300024.k8U0OYsk008739@zion.cs.uiuc.edu> Changes in directory llvm/projects: Makefile updated: 1.14 -> 1.15 --- Log message: Stacker doesn't build universal right. --- Diffs of the changes: (+6 -0) Makefile | 6 ++++++ 1 files changed, 6 insertions(+) Index: llvm/projects/Makefile diff -u llvm/projects/Makefile:1.14 llvm/projects/Makefile:1.15 --- llvm/projects/Makefile:1.14 Sat Jan 15 20:21:29 2005 +++ llvm/projects/Makefile Fri Sep 29 19:24:20 2006 @@ -18,4 +18,10 @@ DIRS := $(filter-out sample, $(DIRS)) endif + +# Universal builds can't build stacker, which uses llvm-gcc -S. +ifdef UNIVERSAL +DIRS := $(filter-out Stacker, $(DIRS)) +endif + include $(PROJ_SRC_ROOT)/Makefile.rules From sabre at nondot.org Sat Sep 30 14:40:44 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 30 Sep 2006 14:40:44 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/GlobalOpt.cpp Message-ID: <200609301940.k8UJeiR1005745@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: GlobalOpt.cpp updated: 1.65 -> 1.66 --- Log message: Add some ifdef'd out debug info --- Diffs of the changes: (+30 -3) GlobalOpt.cpp | 33 ++++++++++++++++++++++++++++++--- 1 files changed, 30 insertions(+), 3 deletions(-) Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp diff -u llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.65 llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.66 --- llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.65 Thu Sep 28 18:35:21 2006 +++ llvm/lib/Transforms/IPO/GlobalOpt.cpp Sat Sep 30 14:40:30 2006 @@ -831,6 +831,10 @@ if (OptimizeAwayTrappingUsesOfLoads(GV, SOVC)) return true; } else if (MallocInst *MI = dyn_cast(StoredOnceVal)) { + // If this is a malloc of an abstract type, don't touch it. + if (!MI->getAllocatedType()->isSized()) + return false; + // If we have a global that is only initialized with a fixed size malloc, // and if all users of the malloc trap, and if the malloc'd address is not // put anywhere else, transform the program to use global memory instead @@ -839,15 +843,15 @@ // that we restrict this transformation to only working on small // allocations (2048 bytes currently), as we don't want to introduce a 16M // global or something. - if (ConstantInt *NElements = dyn_cast(MI->getArraySize())) - if (MI->getAllocatedType()->isSized() && - NElements->getRawValue()* + if (ConstantInt *NElements = dyn_cast(MI->getArraySize())) { + if (NElements->getRawValue()* TD.getTypeSize(MI->getAllocatedType()) < 2048 && AllUsesOfLoadedValueWillTrapIfNull(GV) && ValueIsOnlyUsedLocallyOrStoredToOneGlobal(MI, GV)) { GVI = OptimizeGlobalAddressOfMalloc(GV, MI); return true; } + } } } @@ -938,6 +942,28 @@ } if (!AnalyzeGlobal(GV, GS, PHIUsers)) { +#if 0 + std::cerr << "Global: " << *GV; + std::cerr << " isLoaded = " << GS.isLoaded << "\n"; + std::cerr << " StoredType = "; + switch (GS.StoredType) { + case GlobalStatus::NotStored: std::cerr << "NEVER STORED\n"; break; + case GlobalStatus::isInitializerStored: std::cerr << "INIT STORED\n"; break; + case GlobalStatus::isStoredOnce: std::cerr << "STORED ONCE\n"; break; + case GlobalStatus::isStored: std::cerr << "stored\n"; break; + } + if (GS.StoredType == GlobalStatus::isStoredOnce && GS.StoredOnceValue) + std::cerr << " StoredOnceValue = " << *GS.StoredOnceValue << "\n"; + if (GS.AccessingFunction && !GS.HasMultipleAccessingFunctions) + std::cerr << " AccessingFunction = " << GS.AccessingFunction->getName() + << "\n"; + std::cerr << " HasMultipleAccessingFunctions = " + << GS.HasMultipleAccessingFunctions << "\n"; + std::cerr << " HasNonInstructionUser = " << GS.HasNonInstructionUser<<"\n"; + std::cerr << " isNotSuitableForSRA = " << GS.isNotSuitableForSRA << "\n"; + std::cerr << "\n"; +#endif + // If this is a first class global and has only one accessing function // and this function is main (which we know is not recursive we can make // this global a local variable) we replace the global with a local alloca @@ -963,6 +989,7 @@ ++NumLocalized; return true; } + // If the global is never loaded (but may be stored to), it is dead. // Delete it now. if (!GS.isLoaded) { From sabre at nondot.org Sat Sep 30 16:31:43 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 30 Sep 2006 16:31:43 -0500 Subject: [llvm-commits] CVS: llvm/lib/VMCore/Globals.cpp Message-ID: <200609302131.k8ULVhHO007484@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: Globals.cpp updated: 1.13 -> 1.14 --- Log message: Add a version of the globalvariable ctor that inserts at a specific location. --- Diffs of the changes: (+21 -0) Globals.cpp | 21 +++++++++++++++++++++ 1 files changed, 21 insertions(+) Index: llvm/lib/VMCore/Globals.cpp diff -u llvm/lib/VMCore/Globals.cpp:1.13 llvm/lib/VMCore/Globals.cpp:1.14 --- llvm/lib/VMCore/Globals.cpp:1.13 Mon Jan 23 22:13:11 2006 +++ llvm/lib/VMCore/Globals.cpp Sat Sep 30 16:31:26 2006 @@ -91,6 +91,27 @@ ParentModule->getGlobalList().push_back(this); } +GlobalVariable::GlobalVariable(const Type *Ty, bool constant, LinkageTypes Link, + Constant *InitVal, + const std::string &Name, GlobalVariable *Before) + : GlobalValue(PointerType::get(Ty), Value::GlobalVariableVal, + &Initializer, InitVal != 0, Link, Name), + isConstantGlobal(constant) { + if (InitVal) { + assert(InitVal->getType() == Ty && + "Initializer should be the same type as the GlobalVariable!"); + Initializer.init(InitVal, this); + } else { + Initializer.init(0, this); + } + + LeakDetector::addGarbageObject(this); + + if (Before) + Before->getParent()->getGlobalList().insert(Before, this); +} + + void GlobalVariable::setParent(Module *parent) { if (getParent()) LeakDetector::addGarbageObject(this); From sabre at nondot.org Sat Sep 30 16:31:43 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 30 Sep 2006 16:31:43 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/GlobalVariable.h Message-ID: <200609302131.k8ULVhWB007479@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: GlobalVariable.h updated: 1.36 -> 1.37 --- Log message: Add a version of the globalvariable ctor that inserts at a specific location. --- Diffs of the changes: (+6 -2) GlobalVariable.h | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) Index: llvm/include/llvm/GlobalVariable.h diff -u llvm/include/llvm/GlobalVariable.h:1.36 llvm/include/llvm/GlobalVariable.h:1.37 --- llvm/include/llvm/GlobalVariable.h:1.36 Fri Dec 16 18:19:22 2005 +++ llvm/include/llvm/GlobalVariable.h Sat Sep 30 16:31:26 2006 @@ -49,11 +49,15 @@ public: /// GlobalVariable ctor - If a parent module is specified, the global is /// automatically inserted into the end of the specified modules global list. - /// GlobalVariable(const Type *Ty, bool isConstant, LinkageTypes Linkage, Constant *Initializer = 0, const std::string &Name = "", Module *Parent = 0); - + /// GlobalVariable ctor - This creates a global and inserts it before the + /// specified other global. + GlobalVariable(const Type *Ty, bool isConstant, LinkageTypes Linkage, + Constant *Initializer, const std::string &Name, + GlobalVariable *InsertBefore); + /// isExternal - Is this global variable lacking an initializer? If so, the /// global variable is defined in some other translation unit, and is thus /// externally defined here. From sabre at nondot.org Sat Sep 30 17:20:48 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 30 Sep 2006 17:20:48 -0500 Subject: [llvm-commits] CVS: llvm/include/llvm/BasicBlock.h Instruction.h Message-ID: <200609302220.k8UMKmnj008255@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: BasicBlock.h updated: 1.60 -> 1.61 Instruction.h updated: 1.73 -> 1.74 --- Log message: Override use_back in instruction/basicblock to provide more type information. --- Diffs of the changes: (+10 -1) BasicBlock.h | 5 +++++ Instruction.h | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) Index: llvm/include/llvm/BasicBlock.h diff -u llvm/include/llvm/BasicBlock.h:1.60 llvm/include/llvm/BasicBlock.h:1.61 --- llvm/include/llvm/BasicBlock.h:1.60 Fri Sep 22 23:03:45 2006 +++ llvm/include/llvm/BasicBlock.h Sat Sep 30 17:20:34 2006 @@ -85,6 +85,11 @@ BasicBlock *getPrev() { return Prev; } const BasicBlock *getPrev() const { return Prev; } + /// use_back - Specialize the methods defined in Value, as we know that an + /// BasicBlock can only be used by Instructions (specifically PHI and terms). + Instruction *use_back() { return cast(*use_begin());} + const Instruction *use_back() const { return cast(*use_begin());} + /// getTerminator() - If this is a well formed basic block, then this returns /// a pointer to the terminator instruction. If it is not, then you get a /// null pointer back. Index: llvm/include/llvm/Instruction.h diff -u llvm/include/llvm/Instruction.h:1.73 llvm/include/llvm/Instruction.h:1.74 --- llvm/include/llvm/Instruction.h:1.73 Sun Sep 17 14:14:47 2006 +++ llvm/include/llvm/Instruction.h Sat Sep 30 17:20:34 2006 @@ -71,7 +71,11 @@ /// extra information (e.g. load is volatile) agree. bool isIdenticalTo(Instruction *I) const; - + /// use_back - Specialize the methods defined in Value, as we know that an + /// instruction can only be used by other instructions. + Instruction *use_back() { return cast(*use_begin());} + const Instruction *use_back() const { return cast(*use_begin());} + // Accessor methods... // inline const BasicBlock *getParent() const { return Parent; } From sabre at nondot.org Sat Sep 30 18:32:23 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 30 Sep 2006 18:32:23 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/GlobalOpt.cpp Message-ID: <200609302332.k8UNWNFo009348@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: GlobalOpt.cpp updated: 1.66 -> 1.67 --- Log message: Implement SRA of heap allocations. --- Diffs of the changes: (+266 -10) GlobalOpt.cpp | 276 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 266 insertions(+), 10 deletions(-) Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp diff -u llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.66 llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.67 --- llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.66 Sat Sep 30 14:40:30 2006 +++ llvm/lib/Transforms/IPO/GlobalOpt.cpp Sat Sep 30 18:32:09 2006 @@ -36,6 +36,7 @@ Statistic<> NumMarked ("globalopt", "Number of globals marked constant"); Statistic<> NumSRA ("globalopt", "Number of aggregate globals broken " "into scalars"); + Statistic<> NumHeapSRA ("globalopt", "Number of heap objects SRA'd"); Statistic<> NumSubstitute("globalopt", "Number of globals with initializers stored into them"); Statistic<> NumDeleted ("globalopt", "Number of globals deleted"); @@ -794,9 +795,235 @@ return false; } return true; +} +/// ReplaceUsesOfMallocWithGlobal - The Alloc pointer is stored into GV +/// somewhere. Transform all uses of the allocation into loads from the +/// global and uses of the resultant pointer. Further, delete the store into +/// GV. This assumes that these value pass the +/// 'ValueIsOnlyUsedLocallyOrStoredToOneGlobal' predicate. +static void ReplaceUsesOfMallocWithGlobal(Instruction *Alloc, + GlobalVariable *GV) { + while (!Alloc->use_empty()) { + Instruction *U = Alloc->use_back(); + if (StoreInst *SI = dyn_cast(U)) { + // If this is the store of the allocation into the global, remove it. + if (SI->getOperand(1) == GV) { + SI->eraseFromParent(); + continue; + } + } + + // Insert a load from the global, and use it instead of the malloc. + Value *NL = new LoadInst(GV, GV->getName()+".val", U); + U->replaceUsesOfWith(Alloc, NL); + } } +/// GlobalLoadUsesSimpleEnoughForHeapSRA - If all users of values loaded from +/// GV are simple enough to perform HeapSRA, return true. +static bool GlobalLoadUsesSimpleEnoughForHeapSRA(GlobalVariable *GV) { + for (Value::use_iterator UI = GV->use_begin(), E = GV->use_end(); UI != E; + ++UI) + if (LoadInst *LI = dyn_cast(*UI)) { + // We permit two users of the load: setcc comparing against the null + // pointer, and a getelementptr of a specific form. + for (Value::use_iterator UI = LI->use_begin(), E = LI->use_end(); UI != E; + ++UI) { + // Comparison against null is ok. + if (SetCondInst *SCI = dyn_cast(*UI)) { + if (!isa(SCI->getOperand(1))) + return false; + continue; + } + + // getelementptr is also ok, but only a simple form. + GetElementPtrInst *GEPI = dyn_cast(*UI); + if (!GEPI) return false; + + // Must index into the array and into the struct. + if (GEPI->getNumOperands() < 3) + return false; + + // Otherwise the GEP is ok. + continue; + } + } + return true; +} + +/// RewriteUsesOfLoadForHeapSRoA - We are performing Heap SRoA on a global. Ptr +/// is a value loaded from the global. Eliminate all uses of Ptr, making them +/// use FieldGlobals instead. All uses of loaded values satisfy +/// GlobalLoadUsesSimpleEnoughForHeapSRA. +static void RewriteUsesOfLoadForHeapSRoA(LoadInst *Ptr, + const std::vector &FieldGlobals) { + std::vector InsertedLoadsForPtr; + //InsertedLoadsForPtr.resize(FieldGlobals.size()); + while (!Ptr->use_empty()) { + Instruction *User = Ptr->use_back(); + + // If this is a comparison against null, handle it. + if (SetCondInst *SCI = dyn_cast(User)) { + assert(isa(SCI->getOperand(1))); + // If we have a setcc of the loaded pointer, we can use a setcc of any + // field. + Value *NPtr; + if (InsertedLoadsForPtr.empty()) { + NPtr = new LoadInst(FieldGlobals[0], Ptr->getName()+".f0", Ptr); + InsertedLoadsForPtr.push_back(Ptr); + } else { + NPtr = InsertedLoadsForPtr.back(); + } + + Value *New = new SetCondInst(SCI->getOpcode(), NPtr, + Constant::getNullValue(NPtr->getType()), + SCI->getName(), SCI); + SCI->replaceAllUsesWith(New); + SCI->eraseFromParent(); + continue; + } + + // Otherwise, this should be: 'getelementptr Ptr, Idx, uint FieldNo ...' + GetElementPtrInst *GEPI = cast(User); + assert(GEPI->getNumOperands() >= 3 && isa(GEPI->getOperand(2)) + && "Unexpected GEPI!"); + + // Load the pointer for this field. + unsigned FieldNo = cast(GEPI->getOperand(2))->getValue(); + if (InsertedLoadsForPtr.size() <= FieldNo) + InsertedLoadsForPtr.resize(FieldNo+1); + if (InsertedLoadsForPtr[FieldNo] == 0) + InsertedLoadsForPtr[FieldNo] = new LoadInst(FieldGlobals[FieldNo], + Ptr->getName()+".f" + + utostr(FieldNo), Ptr); + Value *NewPtr = InsertedLoadsForPtr[FieldNo]; + + // Create the new GEP idx vector. + std::vector GEPIdx; + GEPIdx.push_back(GEPI->getOperand(1)); + GEPIdx.insert(GEPIdx.end(), GEPI->op_begin()+3, GEPI->op_end()); + + Value *NGEPI = new GetElementPtrInst(NewPtr, GEPIdx, GEPI->getName(), GEPI); + GEPI->replaceAllUsesWith(NGEPI); + GEPI->eraseFromParent(); + } +} + +/// PerformHeapAllocSRoA - MI is an allocation of an array of structures. Break +/// it up into multiple allocations of arrays of the fields. +static GlobalVariable *PerformHeapAllocSRoA(GlobalVariable *GV, MallocInst *MI){ + /*DEBUG*/(std::cerr << "SROA HEAP ALLOC: " << *GV << " MALLOC = " << *MI); + const StructType *STy = cast(MI->getAllocatedType()); + + // There is guaranteed to be at least one use of the malloc (storing + // it into GV). If there are other uses, change them to be uses of + // the global to simplify later code. This also deletes the store + // into GV. + ReplaceUsesOfMallocWithGlobal(MI, GV); + + // Okay, at this point, there are no users of the malloc. Insert N + // new mallocs at the same place as MI, and N globals. + std::vector FieldGlobals; + std::vector FieldMallocs; + + for (unsigned FieldNo = 0, e = STy->getNumElements(); FieldNo != e;++FieldNo){ + const Type *FieldTy = STy->getElementType(FieldNo); + const Type *PFieldTy = PointerType::get(FieldTy); + + GlobalVariable *NGV = + new GlobalVariable(PFieldTy, false, GlobalValue::InternalLinkage, + Constant::getNullValue(PFieldTy), + GV->getName() + ".f" + utostr(FieldNo), GV); + FieldGlobals.push_back(NGV); + + MallocInst *NMI = new MallocInst(FieldTy, MI->getArraySize(), + MI->getName() + ".f" + utostr(FieldNo),MI); + FieldMallocs.push_back(NMI); + new StoreInst(NMI, NGV, MI); + } + + // The tricky aspect of this transformation is handling the case when malloc + // fails. In the original code, malloc failing would set the result pointer + // of malloc to null. In this case, some mallocs could succeed and others + // could fail. As such, we emit code that looks like this: + // F0 = malloc(field0) + // F1 = malloc(field1) + // F2 = malloc(field2) + // if (F0 == 0 || F1 == 0 || F2 == 0) { + // if (F0) { free(F0); F0 = 0; } + // if (F1) { free(F1); F1 = 0; } + // if (F2) { free(F2); F2 = 0; } + // } + Value *RunningOr = 0; + for (unsigned i = 0, e = FieldMallocs.size(); i != e; ++i) { + Value *Cond = new SetCondInst(Instruction::SetEQ, FieldMallocs[i], + Constant::getNullValue(FieldMallocs[i]->getType()), + "isnull", MI); + if (!RunningOr) + RunningOr = Cond; // First seteq + else + RunningOr = BinaryOperator::createOr(RunningOr, Cond, "tmp", MI); + } + + // Split the basic block at the old malloc. + BasicBlock *OrigBB = MI->getParent(); + BasicBlock *ContBB = OrigBB->splitBasicBlock(MI, "malloc_cont"); + + // Create the block to check the first condition. Put all these blocks at the + // end of the function as they are unlikely to be executed. + BasicBlock *NullPtrBlock = new BasicBlock("malloc_ret_null", + OrigBB->getParent()); + + // Remove the uncond branch from OrigBB to ContBB, turning it into a cond + // branch on RunningOr. + OrigBB->getTerminator()->eraseFromParent(); + new BranchInst(NullPtrBlock, ContBB, RunningOr, OrigBB); + + // Within the NullPtrBlock, we need to emit a comparison and branch for each + // pointer, because some may be null while others are not. + for (unsigned i = 0, e = FieldGlobals.size(); i != e; ++i) { + Value *GVVal = new LoadInst(FieldGlobals[i], "tmp", NullPtrBlock); + Value *Cmp = new SetCondInst(Instruction::SetNE, GVVal, + Constant::getNullValue(GVVal->getType()), + "tmp", NullPtrBlock); + BasicBlock *FreeBlock = new BasicBlock("free_it", OrigBB->getParent()); + BasicBlock *NextBlock = new BasicBlock("next", OrigBB->getParent()); + new BranchInst(FreeBlock, NextBlock, Cmp, NullPtrBlock); + + // Fill in FreeBlock. + new FreeInst(GVVal, FreeBlock); + new StoreInst(Constant::getNullValue(GVVal->getType()), FieldGlobals[i], + FreeBlock); + new BranchInst(NextBlock, FreeBlock); + + NullPtrBlock = NextBlock; + } + + new BranchInst(ContBB, NullPtrBlock); + + + // MI is no longer needed, remove it. + MI->eraseFromParent(); + + + // Okay, the malloc site is completely handled. All of the uses of GV are now + // loads, and all uses of those loads are simple. Rewrite them to use loads + // of the per-field globals instead. + while (!GV->use_empty()) { + LoadInst *LI = cast(GV->use_back()); + RewriteUsesOfLoadForHeapSRoA(LI, FieldGlobals); + LI->eraseFromParent(); + } + + // The old global is now dead, remove it. + GV->eraseFromParent(); + + ++NumHeapSRA; + return FieldGlobals[0]; +} + + // OptimizeOnceStoredGlobal - Try to optimize globals based on the knowledge // that only one value (besides its initializer) is ever stored to the global. static bool OptimizeOnceStoredGlobal(GlobalVariable *GV, Value *StoredOnceVal, @@ -835,23 +1062,52 @@ if (!MI->getAllocatedType()->isSized()) return false; + // We can't optimize this global unless all uses of it are *known* to be + // of the malloc value, not of the null initializer value (consider a use + // that compares the global's value against zero to see if the malloc has + // been reached). To do this, we check to see if all uses of the global + // would trap if the global were null: this proves that they must all + // happen after the malloc. + if (!AllUsesOfLoadedValueWillTrapIfNull(GV)) + return false; + + // We can't optimize this if the malloc itself is used in a complex way, + // for example, being stored into multiple globals. This allows the + // malloc to be stored into the specified global, loaded setcc'd, and + // GEP'd. These are all things we could transform to using the global + // for. + if (!ValueIsOnlyUsedLocallyOrStoredToOneGlobal(MI, GV)) + return false; + + // If we have a global that is only initialized with a fixed size malloc, - // and if all users of the malloc trap, and if the malloc'd address is not - // put anywhere else, transform the program to use global memory instead - // of malloc'd memory. This eliminates dynamic allocation (good) and - // exposes the resultant global to further GlobalOpt (even better). Note - // that we restrict this transformation to only working on small - // allocations (2048 bytes currently), as we don't want to introduce a 16M - // global or something. + // transform the program to use global memory instead of malloc'd memory. + // This eliminates dynamic allocation, avoids an indirection accessing the + // data, and exposes the resultant global to further GlobalOpt. if (ConstantInt *NElements = dyn_cast(MI->getArraySize())) { + // Restrict this transformation to only working on small allocations + // (2048 bytes currently), as we don't want to introduce a 16M global or + // something. if (NElements->getRawValue()* - TD.getTypeSize(MI->getAllocatedType()) < 2048 && - AllUsesOfLoadedValueWillTrapIfNull(GV) && - ValueIsOnlyUsedLocallyOrStoredToOneGlobal(MI, GV)) { + TD.getTypeSize(MI->getAllocatedType()) < 2048) { GVI = OptimizeGlobalAddressOfMalloc(GV, MI); return true; } } + + // If the allocation is an array of structures, consider transforming this + // into multiple malloc'd arrays, one for each field. This is basically + // SRoA for malloc'd memory. + if (const StructType *AllocTy = + dyn_cast(MI->getAllocatedType())) { + // This the structure has an unreasonable number of fields, leave it + // alone. + if (AllocTy->getNumElements() <= 16 && AllocTy->getNumElements() > 0 && + GlobalLoadUsesSimpleEnoughForHeapSRA(GV)) { + GVI = PerformHeapAllocSRoA(GV, MI); + return true; + } + } } } From sabre at nondot.org Sat Sep 30 18:33:05 2006 From: sabre at nondot.org (Chris Lattner) Date: Sat, 30 Sep 2006 18:33:05 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/GlobalOpt.cpp Message-ID: <200609302333.k8UNX5XF009387@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: GlobalOpt.cpp updated: 1.67 -> 1.68 --- Log message: Fix debug output --- Diffs of the changes: (+1 -2) GlobalOpt.cpp | 3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp diff -u llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.67 llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.68 --- llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.67 Sat Sep 30 18:32:09 2006 +++ llvm/lib/Transforms/IPO/GlobalOpt.cpp Sat Sep 30 18:32:50 2006 @@ -913,7 +913,7 @@ /// PerformHeapAllocSRoA - MI is an allocation of an array of structures. Break /// it up into multiple allocations of arrays of the fields. static GlobalVariable *PerformHeapAllocSRoA(GlobalVariable *GV, MallocInst *MI){ - /*DEBUG*/(std::cerr << "SROA HEAP ALLOC: " << *GV << " MALLOC = " << *MI); + DEBUG(std::cerr << "SROA HEAP ALLOC: " << *GV << " MALLOC = " << *MI); const StructType *STy = cast(MI->getAllocatedType()); // There is guaranteed to be at least one use of the malloc (storing @@ -1872,7 +1872,6 @@ - /// OptimizeGlobalCtorsList - Simplify and evaluation global ctors if possible. /// Return true if anything changed. bool GlobalOpt::OptimizeGlobalCtorsList(GlobalVariable *&GCL) { From sabre at nondot.org Sun Oct 1 14:39:59 2006 From: sabre at nondot.org (Chris Lattner) Date: Sun, 1 Oct 2006 14:39:59 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/cast.ll Message-ID: <200610011939.k91Jdxg4031490@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/InstCombine: cast.ll updated: 1.30 -> 1.31 --- Log message: new testcase, malloc should be promoted to [2 x double]. --- Diffs of the changes: (+8 -0) cast.ll | 8 ++++++++ 1 files changed, 8 insertions(+) Index: llvm/test/Regression/Transforms/InstCombine/cast.ll diff -u llvm/test/Regression/Transforms/InstCombine/cast.ll:1.30 llvm/test/Regression/Transforms/InstCombine/cast.ll:1.31 --- llvm/test/Regression/Transforms/InstCombine/cast.ll:1.30 Mon Sep 18 00:25:10 2006 +++ llvm/test/Regression/Transforms/InstCombine/cast.ll Sun Oct 1 14:39:45 2006 @@ -199,3 +199,11 @@ ret bool %D } + +void %test32(double** %tmp) { + %tmp8 = malloc [16 x sbyte] + %tmp8 = cast [16 x sbyte]* %tmp8 to double* + store double* %tmp8, double** %tmp + ret void +} + From sabre at nondot.org Sun Oct 1 14:41:12 2006 From: sabre at nondot.org (Chris Lattner) Date: Sun, 1 Oct 2006 14:41:12 -0500 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200610011941.k91JfCuB031560@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.516 -> 1.517 --- Log message: Fix a bug from r1.391 of this file, where we checked the size instead of the alignment when promoting allocations. This implements InstCombine/cast.ll:test32 --- 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.516 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.517 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.516 Thu Sep 28 18:35:21 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Sun Oct 1 14:40:58 2006 @@ -5053,8 +5053,8 @@ const Type *CastElTy = PTy->getElementType(); if (!AllocElTy->isSized() || !CastElTy->isSized()) return 0; - unsigned AllocElTyAlign = TD->getTypeSize(AllocElTy); - unsigned CastElTyAlign = TD->getTypeSize(CastElTy); + unsigned AllocElTyAlign = TD->getTypeAlignment(AllocElTy); + unsigned CastElTyAlign = TD->getTypeAlignment(CastElTy); if (CastElTyAlign < AllocElTyAlign) return 0; // If the allocation has multiple uses, only promote it if we are strictly From sabre at nondot.org Sun Oct 1 17:35:59 2006 From: sabre at nondot.org (Chris Lattner) Date: Sun, 1 Oct 2006 17:35:59 -0500 Subject: [llvm-commits] CVS: llvm/test/Regression/Analysis/GlobalsModRef/indirect-global.ll Message-ID: <200610012235.k91MZx3V001965@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Analysis/GlobalsModRef: indirect-global.ll added (r1.1) --- Log message: New testcase --- Diffs of the changes: (+23 -0) indirect-global.ll | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+) Index: llvm/test/Regression/Analysis/GlobalsModRef/indirect-global.ll diff -c /dev/null llvm/test/Regression/Analysis/GlobalsModRef/indirect-global.ll:1.1 *** /dev/null Sun Oct 1 17:35:55 2006 --- llvm/test/Regression/Analysis/GlobalsModRef/indirect-global.ll Sun Oct 1 17:35:45 2006 *************** *** 0 **** --- 1,23 ---- + ; RUN: llvm-as < %s | opt -globalsmodref-aa -load-vn -gcse -instcombine | llvm-dis | grep 'ret int 0' + %G = internal global int* null + + implementation + + void %test() { + %A = malloc int + store int* %A, int** %G + ret void + } + + int %test1(int *%P) { + %g1 = load int** %G + %h1 = load int* %g1 + + ; This store cannot alias either G or g1. + store int 123, int* %P + + %g2 = load int** %G + %h2 = load int* %g1 + %X = sub int %h1, %h2 ;; -> 0 + ret int %X + } From sabre at nondot.org Sun Oct 1 17:36:59 2006 From: sabre at nondot.org (Chris Lattner) Date: Sun, 1 Oct 2006 17:36:59 -0500 Subject: [llvm-commits] CVS: llvm/lib/Analysis/IPA/GlobalsModRef.cpp Message-ID: <200610012236.k91Maxj4001990@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/IPA: GlobalsModRef.cpp updated: 1.21 -> 1.22 --- Log message: Teach globalsmodref-aa to track scalar pointer global variables which point to unaliased allocations. Use this information to disambiguate pointers loaded from them. This is a very common case, so it's worthwhile to handle efficiently. This implements Analysis/GlobalsModRef/indirect-global.ll --- Diffs of the changes: (+208 -51) GlobalsModRef.cpp | 259 +++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 208 insertions(+), 51 deletions(-) Index: llvm/lib/Analysis/IPA/GlobalsModRef.cpp diff -u llvm/lib/Analysis/IPA/GlobalsModRef.cpp:1.21 llvm/lib/Analysis/IPA/GlobalsModRef.cpp:1.22 --- llvm/lib/Analysis/IPA/GlobalsModRef.cpp:1.21 Sun Aug 27 19:42:29 2006 +++ llvm/lib/Analysis/IPA/GlobalsModRef.cpp Sun Oct 1 17:36:45 2006 @@ -19,6 +19,7 @@ #include "llvm/Pass.h" #include "llvm/Instructions.h" #include "llvm/Constants.h" +#include "llvm/DerivedTypes.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/CallGraph.h" #include "llvm/Support/InstIterator.h" @@ -41,7 +42,10 @@ Statistic<> NumReadMemFunctions("globalsmodref-aa", "Number of functions that only read memory"); - + Statistic<> + NumIndirectGlobalVars("globalsmodref-aa", + "Number of indirect global objects"); + /// FunctionRecord - One instance of this structure is stored for every /// function in the program. Later, the entries for these functions are /// removed if the function is found to call an external function (in which @@ -72,6 +76,14 @@ /// taken. std::set NonAddressTakenGlobals; + /// IndirectGlobals - The memory pointed to by this global is known to be + /// 'owned' by the global. + std::set IndirectGlobals; + + /// AllocsForIndirectGlobals - If an instruction allocates memory for an + /// indirect global, this map indicates which one. + std::map AllocsForIndirectGlobals; + /// FunctionInfo - For each function, keep track of what globals are /// modified or read. std::map FunctionInfo; @@ -131,8 +143,10 @@ void AnalyzeGlobals(Module &M); void AnalyzeCallGraph(CallGraph &CG, Module &M); void AnalyzeSCC(std::vector &SCC); - bool AnalyzeUsesOfGlobal(Value *V, std::vector &Readers, - std::vector &Writers); + bool AnalyzeUsesOfPointer(Value *V, std::vector &Readers, + std::vector &Writers, + GlobalValue *OkayStoreDest = 0); + bool AnalyzeIndirectGlobalMemory(GlobalValue *GV); }; RegisterPass X("globalsmodref-aa", @@ -142,8 +156,30 @@ Pass *llvm::createGlobalsModRefPass() { return new GlobalsModRef(); } +/// getUnderlyingObject - This traverses the use chain to figure out what object +/// the specified value points to. If the value points to, or is derived from, +/// a global object, return it. +static Value *getUnderlyingObject(Value *V) { + if (!isa(V->getType())) return V; + + // If we are at some type of object... return it. + if (GlobalValue *GV = dyn_cast(V)) return GV; + + // Traverse through different addressing mechanisms. + if (Instruction *I = dyn_cast(V)) { + if (isa(I) || isa(I)) + return getUnderlyingObject(I->getOperand(0)); + } else if (ConstantExpr *CE = dyn_cast(V)) { + if (CE->getOpcode() == Instruction::Cast || + CE->getOpcode() == Instruction::GetElementPtr) + return getUnderlyingObject(CE->getOperand(0)); + } + + // Othewise, we don't know what this is, return it as the base pointer. + return V; +} -/// AnalyzeGlobalUses - Scan through the users of all of the internal +/// AnalyzeGlobals - Scan through the users of all of the internal /// GlobalValue's in the program. If none of them have their "Address taken" /// (really, their address passed to something nontrivial), record this fact, /// and record the functions that they are used directly in. @@ -151,7 +187,7 @@ std::vector Readers, Writers; for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) if (I->hasInternalLinkage()) { - if (!AnalyzeUsesOfGlobal(I, Readers, Writers)) { + if (!AnalyzeUsesOfPointer(I, Readers, Writers)) { // Remember that we are tracking this global. NonAddressTakenGlobals.insert(I); ++NumNonAddrTakenFunctions; @@ -162,7 +198,7 @@ for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I) if (I->hasInternalLinkage()) { - if (!AnalyzeUsesOfGlobal(I, Readers, Writers)) { + if (!AnalyzeUsesOfPointer(I, Readers, Writers)) { // Remember that we are tracking this global, and the mod/ref fns NonAddressTakenGlobals.insert(I); for (unsigned i = 0, e = Readers.size(); i != e; ++i) @@ -172,28 +208,39 @@ for (unsigned i = 0, e = Writers.size(); i != e; ++i) FunctionInfo[Writers[i]].GlobalInfo[I] |= Mod; ++NumNonAddrTakenGlobalVars; + + // If this global holds a pointer type, see if it is an indirect global. + if (isa(I->getType()->getElementType()) && + AnalyzeIndirectGlobalMemory(I)) + ++NumIndirectGlobalVars; } Readers.clear(); Writers.clear(); } } -/// AnalyzeUsesOfGlobal - Look at all of the users of the specified global value -/// derived pointer. If this is used by anything complex (i.e., the address -/// escapes), return true. Also, while we are at it, keep track of those -/// functions that read and write to the value. -bool GlobalsModRef::AnalyzeUsesOfGlobal(Value *V, - std::vector &Readers, - std::vector &Writers) { +/// AnalyzeUsesOfPointer - Look at all of the users of the specified pointer. +/// If this is used by anything complex (i.e., the address escapes), return +/// true. Also, while we are at it, keep track of those functions that read and +/// write to the value. +/// +/// If OkayStoreDest is non-null, stores into this global are allowed. +bool GlobalsModRef::AnalyzeUsesOfPointer(Value *V, + std::vector &Readers, + std::vector &Writers, + GlobalValue *OkayStoreDest) { if (!isa(V->getType())) return true; for (Value::use_iterator UI = V->use_begin(), E = V->use_end(); UI != E; ++UI) if (LoadInst *LI = dyn_cast(*UI)) { Readers.push_back(LI->getParent()->getParent()); } else if (StoreInst *SI = dyn_cast(*UI)) { - if (V == SI->getOperand(0)) return true; // Storing the pointer - Writers.push_back(SI->getParent()->getParent()); + if (V == SI->getOperand(1)) { + Writers.push_back(SI->getParent()->getParent()); + } else if (SI->getOperand(1) != OkayStoreDest) { + return true; // Storing the pointer + } } else if (GetElementPtrInst *GEP = dyn_cast(*UI)) { - if (AnalyzeUsesOfGlobal(GEP, Readers, Writers)) return true; + if (AnalyzeUsesOfPointer(GEP, Readers, Writers)) return true; } else if (CallInst *CI = dyn_cast(*UI)) { // Make sure that this is just the function being called, not that it is // passing into the function. @@ -207,19 +254,91 @@ } else if (ConstantExpr *CE = dyn_cast(*UI)) { if (CE->getOpcode() == Instruction::GetElementPtr || CE->getOpcode() == Instruction::Cast) { - if (AnalyzeUsesOfGlobal(CE, Readers, Writers)) + if (AnalyzeUsesOfPointer(CE, Readers, Writers)) return true; } else { return true; } - } else if (GlobalValue *GV = dyn_cast(*UI)) { - if (AnalyzeUsesOfGlobal(GV, Readers, Writers)) return true; + } else if (SetCondInst *SCI = dyn_cast(*UI)) { + if (!isa(SCI->getOperand(1))) + return true; // Allow comparison against null. + } else if (FreeInst *F = dyn_cast(*UI)) { + Writers.push_back(F->getParent()->getParent()); } else { return true; } return false; } +/// AnalyzeIndirectGlobalMemory - We found an non-address-taken global variable +/// which holds a pointer type. See if the global always points to non-aliased +/// heap memory: that is, all initializers of the globals are allocations, and +/// those allocations have no use other than initialization of the global. +/// Further, all loads out of GV must directly use the memory, not store the +/// pointer somewhere. If this is true, we consider the memory pointed to by +/// GV to be owned by GV and can disambiguate other pointers from it. +bool GlobalsModRef::AnalyzeIndirectGlobalMemory(GlobalValue *GV) { + // Keep track of values related to the allocation of the memory, f.e. the + // value produced by the malloc call and any casts. + std::vector AllocRelatedValues; + + // Walk the user list of the global. If we find anything other than a direct + // load or store, bail out. + for (Value::use_iterator I = GV->use_begin(), E = GV->use_end(); I != E; ++I){ + if (LoadInst *LI = dyn_cast(*I)) { + // The pointer loaded from the global can only be used in simple ways: + // we allow addressing of it and loading storing to it. We do *not* allow + // storing the loaded pointer somewhere else or passing to a function. + std::vector ReadersWriters; + if (AnalyzeUsesOfPointer(LI, ReadersWriters, ReadersWriters)) + return false; // Loaded pointer escapes. + // TODO: Could try some IP mod/ref of the loaded pointer. + } else if (StoreInst *SI = dyn_cast(*I)) { + // Storing the global itself. + if (SI->getOperand(0) == GV) return false; + + // If storing the null pointer, ignore it. + if (isa(SI->getOperand(0))) + continue; + + // Check the value being stored. + Value *Ptr = getUnderlyingObject(SI->getOperand(0)); + + // FIXME: handle calloc. + if (isa(Ptr)) { + // Okay, easy case. + } else if (CallInst *CI = dyn_cast(Ptr)) { + Function *F = CI->getCalledFunction(); + if (!F || !F->isExternal()) return false; // Too hard to analyze. + if (F->getName() != "calloc") return false; // Not calloc. + } else { + return false; // Too hard to analyze. + } + + // Analyze all uses of the allocation. If any of them are used in a + // non-simple way (e.g. stored to another global) bail out. + std::vector ReadersWriters; + if (AnalyzeUsesOfPointer(Ptr, ReadersWriters, ReadersWriters, GV)) + return false; // Loaded pointer escapes. + + // Remember that this allocation is related to the indirect global. + AllocRelatedValues.push_back(Ptr); + } else { + // Something complex, bail out. + return false; + } + } + + // Okay, this is an indirect global. Remember all of the allocations for + // this global in AllocsForIndirectGlobals. + while (!AllocRelatedValues.empty()) { + AllocsForIndirectGlobals[AllocRelatedValues.back()] = GV; + AllocRelatedValues.pop_back(); + } + IndirectGlobals.insert(GV); + return true; +} + /// AnalyzeCallGraph - At this point, we know the functions where globals are /// immediately stored to and read from. Propagate this information up the call /// graph to all callers and compute the mod/ref info for all memory for each @@ -328,44 +447,62 @@ -/// getUnderlyingObject - This traverses the use chain to figure out what object -/// the specified value points to. If the value points to, or is derived from, -/// a global object, return it. -static const GlobalValue *getUnderlyingObject(const Value *V) { - if (!isa(V->getType())) return 0; - - // If we are at some type of object... return it. - if (const GlobalValue *GV = dyn_cast(V)) return GV; - - // Traverse through different addressing mechanisms... - if (const Instruction *I = dyn_cast(V)) { - if (isa(I) || isa(I)) - return getUnderlyingObject(I->getOperand(0)); - } else if (const ConstantExpr *CE = dyn_cast(V)) { - if (CE->getOpcode() == Instruction::Cast || - CE->getOpcode() == Instruction::GetElementPtr) - return getUnderlyingObject(CE->getOperand(0)); - } - return 0; -} - /// alias - If one of the pointers is to a global that we are tracking, and the /// other is some random pointer, we know there cannot be an alias, because the /// address of the global isn't taken. AliasAnalysis::AliasResult GlobalsModRef::alias(const Value *V1, unsigned V1Size, const Value *V2, unsigned V2Size) { - GlobalValue *GV1 = const_cast(getUnderlyingObject(V1)); - GlobalValue *GV2 = const_cast(getUnderlyingObject(V2)); - - // If the global's address is taken, pretend we don't know it's a pointer to - // the global. - if (GV1 && !NonAddressTakenGlobals.count(GV1)) GV1 = 0; - if (GV2 && !NonAddressTakenGlobals.count(GV2)) GV2 = 0; + // Get the base object these pointers point to. + Value *UV1 = getUnderlyingObject(const_cast(V1)); + Value *UV2 = getUnderlyingObject(const_cast(V2)); + + // If either of the underlying values is a global, they may be non-addr-taken + // globals, which we can answer queries about. + GlobalValue *GV1 = dyn_cast(UV1); + GlobalValue *GV2 = dyn_cast(UV2); + if (GV1 || GV2) { + // If the global's address is taken, pretend we don't know it's a pointer to + // the global. + if (GV1 && !NonAddressTakenGlobals.count(GV1)) GV1 = 0; + if (GV2 && !NonAddressTakenGlobals.count(GV2)) GV2 = 0; + + // If the the two pointers are derived from two different non-addr-taken + // globals, or if one is and the other isn't, we know these can't alias. + if ((GV1 || GV2) && GV1 != GV2) + return NoAlias; + // Otherwise if they are both derived from the same addr-taken global, we + // can't know the two accesses don't overlap. + } + + // These pointers may be based on the memory owned by an indirect global. If + // so, we may be able to handle this. First check to see if the base pointer + // is a direct load from an indirect global. + GV1 = GV2 = 0; + if (LoadInst *LI = dyn_cast(UV1)) + if (GlobalVariable *GV = dyn_cast(LI->getOperand(0))) + if (IndirectGlobals.count(GV)) + GV1 = GV; + if (LoadInst *LI = dyn_cast(UV2)) + if (GlobalVariable *GV = dyn_cast(LI->getOperand(0))) + if (IndirectGlobals.count(GV)) + GV2 = GV; + + // These pointers may also be from an allocation for the indirect global. If + // so, also handle them. + if (AllocsForIndirectGlobals.count(UV1)) + GV1 = AllocsForIndirectGlobals[UV1]; + if (AllocsForIndirectGlobals.count(UV2)) + GV2 = AllocsForIndirectGlobals[UV2]; + + // Now that we know whether the two pointers are related to indirect globals, + // use this to disambiguate the pointers. If either pointer is based on an + // indirect global and if they are not both based on the same indirect global, + // they cannot alias. if ((GV1 || GV2) && GV1 != GV2) return NoAlias; - + return AliasAnalysis::alias(V1, V1Size, V2, V2Size); } @@ -375,7 +512,7 @@ // If we are asking for mod/ref info of a direct call with a pointer to a // global we are tracking, return information if we have it. - if (GlobalValue *GV = const_cast(getUnderlyingObject(P))) + if (GlobalValue *GV = dyn_cast(getUnderlyingObject(P))) if (GV->hasInternalLinkage()) if (Function *F = CS.getCalledFunction()) if (NonAddressTakenGlobals.count(GV)) @@ -392,8 +529,28 @@ // Methods to update the analysis as a result of the client transformation. // void GlobalsModRef::deleteValue(Value *V) { - if (GlobalValue *GV = dyn_cast(V)) - NonAddressTakenGlobals.erase(GV); + if (GlobalValue *GV = dyn_cast(V)) { + if (NonAddressTakenGlobals.erase(GV)) { + // This global might be an indirect global. If so, remove it and remove + // any AllocRelatedValues for it. + if (IndirectGlobals.erase(GV)) { + // Remove any entries in AllocsForIndirectGlobals for this global. + for (std::map::iterator + I = AllocsForIndirectGlobals.begin(), + E = AllocsForIndirectGlobals.end(); I != E; ) { + if (I->second == GV) { + AllocsForIndirectGlobals.erase(I++); + } else { + ++I; + } + } + } + } + } + + // Otherwise, if this is an allocation related to an indirect global, remove + // it. + AllocsForIndirectGlobals.erase(V); } void GlobalsModRef::copyValue(Value *From, Value *To) { From sabre at nondot.org Sun Oct 1 17:46:47 2006 From: sabre at nondot.org (Chris Lattner) Date: Sun, 1 Oct 2006 17:46:47 -0500 Subject: [llvm-commits] CVS: llvm/lib/Analysis/IPA/GlobalsModRef.cpp Message-ID: <200610012246.k91Mkl8V002163@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/IPA: GlobalsModRef.cpp updated: 1.22 -> 1.23 --- Log message: Fixme is already done --- Diffs of the changes: (+0 -1) GlobalsModRef.cpp | 1 - 1 files changed, 1 deletion(-) Index: llvm/lib/Analysis/IPA/GlobalsModRef.cpp diff -u llvm/lib/Analysis/IPA/GlobalsModRef.cpp:1.22 llvm/lib/Analysis/IPA/GlobalsModRef.cpp:1.23 --- llvm/lib/Analysis/IPA/GlobalsModRef.cpp:1.22 Sun Oct 1 17:36:45 2006 +++ llvm/lib/Analysis/IPA/GlobalsModRef.cpp Sun Oct 1 17:46:33 2006 @@ -304,7 +304,6 @@ // Check the value being stored. Value *Ptr = getUnderlyingObject(SI->getOperand(0)); - // FIXME: handle calloc. if (isa(Ptr)) { // Okay, easy case. } else if (CallInst *CI = dyn_cast(Ptr)) {