From evan.cheng at apple.com Mon Nov 6 02:14:46 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 6 Nov 2006 02:14:46 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200611060814.kA68Ek5T027703@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.237 -> 1.238 --- Log message: Add comment. --- Diffs of the changes: (+10 -4) DAGCombiner.cpp | 14 ++++++++++---- 1 files changed, 10 insertions(+), 4 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.237 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.238 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.237 Sun Nov 5 13:31:28 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Nov 6 02:14:30 2006 @@ -174,7 +174,13 @@ return true; } - bool CombineToIndexedLoadStore(SDNode *N) { + /// CombineToPreIndexedLoadStore - Try turning a load / store into a + /// pre-indexed load store when the base pointer is a add or subtract + /// and it has other uses besides the load / store. When the + /// transformation is done, the new indexed load / store effectively + /// folded the add / subtract in and all of its other uses are redirected + /// to the new load / store. + bool CombineToPreIndexedLoadStore(SDNode *N) { bool isLoad = true; SDOperand Ptr; if (LoadSDNode *LD = dyn_cast(N)) { @@ -811,7 +817,7 @@ return DAG.getNode(ISD::OR, VT, N0, N1); } } - + return SDOperand(); } @@ -2871,7 +2877,7 @@ } // Try transforming N to an indexed load. - if (CombineToIndexedLoadStore(N)) + if (CombineToPreIndexedLoadStore(N)) return SDOperand(N, 0); return SDOperand(); @@ -2917,7 +2923,7 @@ } // Try transforming N to an indexed store. - if (CombineToIndexedLoadStore(N)) + if (CombineToPreIndexedLoadStore(N)) return SDOperand(N, 0); return SDOperand(); From jlaskey at apple.com Mon Nov 6 07:20:43 2006 From: jlaskey at apple.com (Jim Laskey) Date: Mon, 6 Nov 2006 07:20:43 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/MachineDebugInfo.cpp Message-ID: <200611061320.kA6DKh9P003580@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: MachineDebugInfo.cpp updated: 1.53 -> 1.54 --- Log message: D'oh - reversed logic. --- Diffs of the changes: (+1 -1) MachineDebugInfo.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/MachineDebugInfo.cpp diff -u llvm/lib/CodeGen/MachineDebugInfo.cpp:1.53 llvm/lib/CodeGen/MachineDebugInfo.cpp:1.54 --- llvm/lib/CodeGen/MachineDebugInfo.cpp:1.53 Tue Oct 24 06:50:43 2006 +++ llvm/lib/CodeGen/MachineDebugInfo.cpp Mon Nov 6 07:20:29 2006 @@ -1570,7 +1570,7 @@ bool MachineDebugInfo::isLabelValid(unsigned LabelID) { std::vector::iterator I = std::lower_bound(DeletedLabelIDs.begin(), DeletedLabelIDs.end(), LabelID); - return I != DeletedLabelIDs.end() && *I == LabelID; + return I == DeletedLabelIDs.end() || *I != LabelID; } /// RecordSource - Register a source file with debug info. Returns an source From jlaskey at apple.com Mon Nov 6 10:24:15 2006 From: jlaskey at apple.com (Jim Laskey) Date: Mon, 6 Nov 2006 10:24:15 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/DwarfWriter.cpp Message-ID: <200611061624.kA6GOF5B015387@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: DwarfWriter.cpp updated: 1.96 -> 1.97 --- Log message: Tab interferes with uniqueness. NOTE: There doesn't seem to be consistency for whether a leading tab is present in a section heading. --- Diffs of the changes: (+1 -1) DwarfWriter.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/DwarfWriter.cpp diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.96 llvm/lib/CodeGen/DwarfWriter.cpp:1.97 --- llvm/lib/CodeGen/DwarfWriter.cpp:1.96 Sat Nov 4 04:48:07 2006 +++ llvm/lib/CodeGen/DwarfWriter.cpp Mon Nov 6 10:23:59 2006 @@ -2678,7 +2678,7 @@ ConstructSubprogramDIEs(); // Prime section data. - SectionMap.insert(std::string("\t") + TAI->getTextSection()); + SectionMap.insert(TAI->getTextSection()); } } From reid at x10sys.com Mon Nov 6 12:47:29 2006 From: reid at x10sys.com (Reid Spencer) Date: Mon, 6 Nov 2006 12:47:29 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/PatternMatch.h Message-ID: <200611061847.kA6IlTHG017022@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Support: PatternMatch.h updated: 1.11 -> 1.12 --- Log message: Fix a small bug noticed on code review. --- Diffs of the changes: (+1 -1) PatternMatch.h | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/Support/PatternMatch.h diff -u llvm/include/llvm/Support/PatternMatch.h:1.11 llvm/include/llvm/Support/PatternMatch.h:1.12 --- llvm/include/llvm/Support/PatternMatch.h:1.11 Wed Nov 1 19:53:58 2006 +++ llvm/include/llvm/Support/PatternMatch.h Mon Nov 6 12:47:14 2006 @@ -310,7 +310,7 @@ return Op.match(I->getOperand(0)); } else if (ConstantExpr *CE = dyn_cast(V)) { if (CE->getOpcode() == Instruction::Cast) { - if (DestTy) *DestTy = I->getType(); + if (DestTy) *DestTy = CE->getType(); return Op.match(CE->getOperand(0)); } } From sabre at nondot.org Mon Nov 6 15:27:10 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 6 Nov 2006 15:27:10 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/README.txt Message-ID: <200611062127.kA6LRAF9018867@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: README.txt updated: 1.45 -> 1.46 --- Log message: add a note --- Diffs of the changes: (+16 -0) README.txt | 16 ++++++++++++++++ 1 files changed, 16 insertions(+) Index: llvm/lib/Target/README.txt diff -u llvm/lib/Target/README.txt:1.45 llvm/lib/Target/README.txt:1.46 --- llvm/lib/Target/README.txt:1.45 Fri Nov 3 16:27:39 2006 +++ llvm/lib/Target/README.txt Mon Nov 6 15:26:49 2006 @@ -287,6 +287,22 @@ return v; } +Nor is this: + +ushort %bad(ushort %a) { +entry: + %tmp = cast ushort %a to uint ; [#uses=1] + %tmp2 = shr uint %tmp, ubyte 8 ; [#uses=1] + %tmp2 = cast uint %tmp2 to ushort ; [#uses=1] + %tmp5 = shl ushort %a, ubyte 8 ; [#uses=1] + %tmp6 = or ushort %tmp2, %tmp5 ; [#uses=1] + ret ushort %tmp6 +} + +unsigned short bad(unsigned short a) { + return ((a & 0xff00) >> 8 | (a & 0x00ff) << 8); +} + //===---------------------------------------------------------------------===// These should turn into single 16-bit (unaligned?) loads on little/big endian From evan.cheng at apple.com Mon Nov 6 15:34:08 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Mon, 6 Nov 2006 15:34:08 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Message-ID: <200611062134.kA6LY8Hr009838@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: ScheduleDAGRRList.cpp updated: 1.20 -> 1.21 --- Log message: Remove dead code; added a missing null ptr check. --- Diffs of the changes: (+1 -32) ScheduleDAGRRList.cpp | 33 +-------------------------------- 1 files changed, 1 insertion(+), 32 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp diff -u llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1.20 llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1.21 --- llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1.20 Sat Nov 4 03:44:31 2006 +++ llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp Mon Nov 6 15:33:46 2006 @@ -685,7 +685,6 @@ /// first (lower in the schedule). template void BURegReductionPriorityQueue::AddPseudoTwoAddrDeps() { -#if 1 for (unsigned i = 0, e = SUnits->size(); i != e; ++i) { SUnit *SU = (SUnit *)&((*SUnits)[i]); if (!SU->isTwoAddress) @@ -703,6 +702,7 @@ TargetInstrInfo::TIED_TO) != -1) { SDNode *DU = SU->Node->getOperand(j).Val; SUnit *DUSU = (*SUnitMap)[DU]; + if (!DUSU) continue; for (SUnit::succ_iterator I = DUSU->Succs.begin(),E = DUSU->Succs.end(); I != E; ++I) { if (I->second) continue; @@ -723,37 +723,6 @@ } } } -#else - for (unsigned i = 0, e = SUnits->size(); i != e; ++i) { - SUnit *SU = (SUnit *)&((*SUnits)[i]); - SDNode *Node = SU->Node; - if (!Node->isTargetOpcode()) - continue; - - if (SU->isTwoAddress) { - SUnit *DUSU = getDefUsePredecessor(SU, TII); - if (!DUSU) continue; - - for (SUnit::succ_iterator I = DUSU->Succs.begin(), E = DUSU->Succs.end(); - I != E; ++I) { - if (I->second) continue; - SUnit *SuccSU = I->first; - if (SuccSU != SU && - (!canClobber(SuccSU, DUSU, TII) || - (!SU->isCommutable && SuccSU->isCommutable))){ - if (SuccSU->Depth == SU->Depth && !isReachable(SuccSU, SU)) { - DEBUG(std::cerr << "Adding an edge from SU # " << SU->NodeNum - << " to SU #" << SuccSU->NodeNum << "\n"); - if (SU->addPred(SuccSU, true)) - SU->NumChainPredsLeft++; - if (SuccSU->addSucc(SU, true)) - SuccSU->NumChainSuccsLeft++; - } - } - } - } - } -#endif } /// CalcNodePriority - Priority is the Sethi Ullman number. From sabre at nondot.org Mon Nov 6 15:45:26 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 6 Nov 2006 15:45:26 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetInstrInfo.h Message-ID: <200611062145.kA6LjQNd010152@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetInstrInfo.h updated: 1.102 -> 1.103 --- Log message: add a flag so that predicated instructions can be recognized by branch folding --- Diffs of the changes: (+8 -0) TargetInstrInfo.h | 8 ++++++++ 1 files changed, 8 insertions(+) Index: llvm/include/llvm/Target/TargetInstrInfo.h diff -u llvm/include/llvm/Target/TargetInstrInfo.h:1.102 llvm/include/llvm/Target/TargetInstrInfo.h:1.103 --- llvm/include/llvm/Target/TargetInstrInfo.h:1.102 Wed Nov 1 17:14:00 2006 +++ llvm/include/llvm/Target/TargetInstrInfo.h Mon Nov 6 15:44:17 2006 @@ -80,6 +80,11 @@ // operands in addition to the minimum number operands specified. const unsigned M_VARIABLE_OPS = 1 << 12; +// M_PREDICATED - Set if this instruction has a predicate that controls its +// execution. +const unsigned M_PREDICATED = 1 << 13; + + // Machine operand flags // M_LOOK_UP_PTR_REG_CLASS - Set if this operand is a pointer value and it // requires a callback to look up its register class. @@ -177,6 +182,9 @@ bool isTwoAddrInstr(MachineOpCode Opcode) const { return get(Opcode).Flags & M_2_ADDR_FLAG; } + bool isPredicated(MachineOpCode Opcode) const { + return get(Opcode).Flags & M_PREDICATED; + } bool isCommutableInstr(MachineOpCode Opcode) const { return get(Opcode).Flags & M_COMMUTABLE; } From sabre at nondot.org Mon Nov 6 15:45:56 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 6 Nov 2006 15:45:56 -0600 Subject: [llvm-commits] CVS: llvm/utils/TableGen/CodeGenInstruction.h CodeGenTarget.cpp InstrInfoEmitter.cpp Message-ID: <200611062145.kA6Ljuuc010174@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: CodeGenInstruction.h updated: 1.21 -> 1.22 CodeGenTarget.cpp updated: 1.73 -> 1.74 InstrInfoEmitter.cpp updated: 1.47 -> 1.48 --- Log message: recognize ppc's blr instruction as predicated --- Diffs of the changes: (+4 -0) CodeGenInstruction.h | 1 + CodeGenTarget.cpp | 2 ++ InstrInfoEmitter.cpp | 1 + 3 files changed, 4 insertions(+) Index: llvm/utils/TableGen/CodeGenInstruction.h diff -u llvm/utils/TableGen/CodeGenInstruction.h:1.21 llvm/utils/TableGen/CodeGenInstruction.h:1.22 --- llvm/utils/TableGen/CodeGenInstruction.h:1.21 Sun Nov 5 13:31:28 2006 +++ llvm/utils/TableGen/CodeGenInstruction.h Mon Nov 6 15:44:53 2006 @@ -87,6 +87,7 @@ bool isLoad; bool isStore; bool isTwoAddress; + bool isPredicated; bool isConvertibleToThreeAddress; bool isCommutable; bool isTerminator; Index: llvm/utils/TableGen/CodeGenTarget.cpp diff -u llvm/utils/TableGen/CodeGenTarget.cpp:1.73 llvm/utils/TableGen/CodeGenTarget.cpp:1.74 --- llvm/utils/TableGen/CodeGenTarget.cpp:1.73 Sat Nov 4 03:40:23 2006 +++ llvm/utils/TableGen/CodeGenTarget.cpp Mon Nov 6 15:44:54 2006 @@ -335,6 +335,7 @@ isLoad = R->getValueAsBit("isLoad"); isStore = R->getValueAsBit("isStore"); isTwoAddress = R->getValueAsBit("isTwoAddress"); + isPredicated = false; // set below. isConvertibleToThreeAddress = R->getValueAsBit("isConvertibleToThreeAddress"); isCommutable = R->getValueAsBit("isCommutable"); isTerminator = R->getValueAsBit("isTerminator"); @@ -381,6 +382,7 @@ if (unsigned NumArgs = MIOpInfo->getNumArgs()) NumOps = NumArgs; + isPredicated |= Rec->isSubClassOf("PredicateOperand"); } else if (Rec->getName() == "variable_ops") { hasVariableNumberOfOperands = true; continue; Index: llvm/utils/TableGen/InstrInfoEmitter.cpp diff -u llvm/utils/TableGen/InstrInfoEmitter.cpp:1.47 llvm/utils/TableGen/InstrInfoEmitter.cpp:1.48 --- llvm/utils/TableGen/InstrInfoEmitter.cpp:1.47 Sat Nov 4 03:40:23 2006 +++ llvm/utils/TableGen/InstrInfoEmitter.cpp Mon Nov 6 15:44:54 2006 @@ -225,6 +225,7 @@ if (Inst.isLoad) OS << "|M_LOAD_FLAG"; if (Inst.isStore || isStore) OS << "|M_STORE_FLAG"; if (Inst.isTwoAddress) OS << "|M_2_ADDR_FLAG"; + if (Inst.isPredicated) OS << "|M_PREDICATED"; if (Inst.isConvertibleToThreeAddress) OS << "|M_CONVERTIBLE_TO_3_ADDR"; if (Inst.isCommutable) OS << "|M_COMMUTABLE"; if (Inst.isTerminator) OS << "|M_TERMINATOR_FLAG"; From sabre at nondot.org Mon Nov 6 17:50:14 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 6 Nov 2006 17:50:14 -0600 Subject: [llvm-commits] CVS: llvm/utils/TableGen/CodeGenInstruction.h CodeGenTarget.cpp InstrInfoEmitter.cpp InstrInfoEmitter.h Message-ID: <200611062350.kA6NoEiW021412@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: CodeGenInstruction.h updated: 1.22 -> 1.23 CodeGenTarget.cpp updated: 1.74 -> 1.75 InstrInfoEmitter.cpp updated: 1.48 -> 1.49 InstrInfoEmitter.h updated: 1.14 -> 1.15 --- Log message: simplify the way operand flags and constraints are handled, making it easier to extend. --- Diffs of the changes: (+79 -70) CodeGenInstruction.h | 11 +----- CodeGenTarget.cpp | 51 ++++++++++++++++++------------ InstrInfoEmitter.cpp | 84 ++++++++++++++++++++++++++------------------------- InstrInfoEmitter.h | 3 + 4 files changed, 79 insertions(+), 70 deletions(-) Index: llvm/utils/TableGen/CodeGenInstruction.h diff -u llvm/utils/TableGen/CodeGenInstruction.h:1.22 llvm/utils/TableGen/CodeGenInstruction.h:1.23 --- llvm/utils/TableGen/CodeGenInstruction.h:1.22 Mon Nov 6 15:44:53 2006 +++ llvm/utils/TableGen/CodeGenInstruction.h Mon Nov 6 17:49:51 2006 @@ -60,6 +60,9 @@ /// MIOperandInfo - Default MI operand type. Note an operand may be made /// up of multiple MI operands. DagInit *MIOperandInfo; + + /// Constraint info for this operand. + std::string Constraint; OperandInfo(Record *R, const std::string &N, const std::string &PMN, unsigned MION, unsigned MINO, DagInit *MIOI) @@ -71,14 +74,6 @@ /// type (which is a record). std::vector OperandList; - /// ConstraintStr - The operand constraints string. - /// - std::string ConstraintStr; - - /// ConstraintsList - List of constraints, encoded into one unsigned int per - /// operand. - std::vector ConstraintsList; - // Various boolean values we track for the instruction. bool isReturn; bool isBranch; Index: llvm/utils/TableGen/CodeGenTarget.cpp diff -u llvm/utils/TableGen/CodeGenTarget.cpp:1.74 llvm/utils/TableGen/CodeGenTarget.cpp:1.75 --- llvm/utils/TableGen/CodeGenTarget.cpp:1.74 Mon Nov 6 15:44:54 2006 +++ llvm/utils/TableGen/CodeGenTarget.cpp Mon Nov 6 17:49:51 2006 @@ -19,7 +19,6 @@ #include "Record.h" #include "llvm/ADT/StringExtras.h" #include "llvm/Support/CommandLine.h" -#include "llvm/Target/TargetInstrInfo.h" #include #include using namespace llvm; @@ -274,8 +273,8 @@ return getInstructionSet()->getValueAsBit("isLittleEndianEncoding"); } -static std::pair parseConstraint(const std::string &CStr, - CodeGenInstruction *I) { +static std::string ParseConstraint(const std::string &CStr, + CodeGenInstruction *I, unsigned &DestOp) { const std::string ops("="); // FIXME: Only supports TIED_TO for now. std::string::size_type pos = CStr.find_first_of(ops); assert(pos != std::string::npos && "Unrecognized constraint"); @@ -286,26 +285,24 @@ std::string::size_type wpos = Name.find_first_of(delims); if (wpos != std::string::npos) Name = Name.substr(0, wpos); - unsigned FIdx = I->getOperandNamed(Name); + DestOp = I->getOperandNamed(Name); Name = CStr.substr(pos+1); wpos = Name.find_first_not_of(delims); if (wpos != std::string::npos) Name = Name.substr(wpos+1); + unsigned TIdx = I->getOperandNamed(Name); - if (TIdx >= FIdx) + if (TIdx >= DestOp) throw "Illegal tied-to operand constraint '" + CStr + "'"; - return std::make_pair(FIdx, (TIdx << 16) | - (1 << (unsigned)TargetInstrInfo::TIED_TO)); + + // Build the string. + return "((" + utostr(TIdx) + " << 16) | TargetInstrInfo::TIED_TO)"; } -static std::vector parseConstraints(const std::string &CStr, - CodeGenInstruction *I) { - unsigned NumOps = I->OperandList.size(); - std::vector Res(NumOps, 0); - if (CStr == "") - return Res; - +static void ParseConstraints(const std::string &CStr, CodeGenInstruction *I) { + if (CStr.empty()) return; + const std::string delims(","); std::string::size_type bidx, eidx; @@ -314,13 +311,16 @@ eidx = CStr.find_first_of(delims, bidx); if (eidx == std::string::npos) eidx = CStr.length(); - std::pair C = - parseConstraint(CStr.substr(bidx, eidx), I); - Res[C.first] = C.second; + + unsigned OpNo; + std::string Constr = ParseConstraint(CStr.substr(bidx, eidx), I, OpNo); + assert(OpNo < I->OperandList.size() && "Invalid operand no?"); + + if (!I->OperandList[OpNo].Constraint.empty()) + throw "Operand #" + utostr(OpNo) + " cannot have multiple constraints!"; + I->OperandList[OpNo].Constraint = Constr; bidx = CStr.find_first_not_of(delims, eidx); } - - return Res; } CodeGenInstruction::CodeGenInstruction(Record *R, const std::string &AsmStr) @@ -403,8 +403,17 @@ MIOperandNo += NumOps; } - ConstraintStr = R->getValueAsString("Constraints"); - ConstraintsList = parseConstraints(ConstraintStr, this); + ParseConstraints(R->getValueAsString("Constraints"), this); + + // For backward compatibility: isTwoAddress means operand 1 is tied to + // operand 0. + if (isTwoAddress && OperandList[1].Constraint.empty()) + OperandList[1].Constraint = "((0 << 16) | TargetInstrInfo::TIED_TO)"; + + // Any operands with unset constraints get 0 as their constraint. + for (unsigned op = 0, e = OperandList.size(); op != e; ++op) + if (OperandList[op].Constraint.empty()) + OperandList[op].Constraint = "0"; } Index: llvm/utils/TableGen/InstrInfoEmitter.cpp diff -u llvm/utils/TableGen/InstrInfoEmitter.cpp:1.48 llvm/utils/TableGen/InstrInfoEmitter.cpp:1.49 --- llvm/utils/TableGen/InstrInfoEmitter.cpp:1.48 Mon Nov 6 15:44:54 2006 +++ llvm/utils/TableGen/InstrInfoEmitter.cpp Mon Nov 6 17:49:51 2006 @@ -63,35 +63,52 @@ OS << "0 };\n"; } -static std::vector > -GetOperandInfo(const CodeGenInstruction &Inst) { - std::vector > Result; +std::vector +InstrInfoEmitter::GetOperandInfo(const CodeGenInstruction &Inst) { + std::vector Result; for (unsigned i = 0, e = Inst.OperandList.size(); i != e; ++i) { if (Inst.OperandList[i].Rec->isSubClassOf("RegisterClass")) { - Result.push_back(std::make_pair(Inst.OperandList[i].Rec, - Inst.ConstraintsList[i])); + std::string OpStr = getQualifiedName(Inst.OperandList[i].Rec); + OpStr += "RegClassID, 0, "; + OpStr += Inst.OperandList[i].Constraint; + + Result.push_back(OpStr); } else { - // This might be a multiple operand thing. - // Targets like X86 have registers in their multi-operand operands. + // This might be a multiple operand thing. Targets like X86 have + // registers in their multi-operand operands. It may also be an anonymous + // operand, which has a single operand, but no declared class for the + // operand. DagInit *MIOI = Inst.OperandList[i].MIOperandInfo; - unsigned NumDefs = MIOI->getNumArgs(); + for (unsigned j = 0, e = Inst.OperandList[i].MINumOperands; j != e; ++j) { - if (NumDefs <= j) { - Result.push_back(std::make_pair((Record*)0, Inst.ConstraintsList[i])); - } else { - DefInit *Def = dynamic_cast(MIOI->getArg(j)); - Result.push_back(std::make_pair(Def ? Def->getDef() : 0, - Inst.ConstraintsList[i])); - } + Record *OpR = 0; + if (MIOI && j < MIOI->getNumArgs()) + if (DefInit *Def = dynamic_cast(MIOI->getArg(j))) + OpR = Def->getDef(); + + + std::string Res; + + if (OpR && OpR->isSubClassOf("RegisterClass")) + Res += getQualifiedName(OpR) + "RegClassID, "; + else + Res += "0, "; + + // Fill in applicable flags. + Res += "0"; + + // Ptr value whose register class is resolved via callback. + if (OpR && OpR->getName() == "ptr_rc") + Res += "|M_LOOK_UP_PTR_REG_CLASS"; + + // fill in constraint info. + Res += ", " + Inst.OperandList[i].Constraint; + + Result.push_back(Res); } } } - // For backward compatibility: isTwoAddress means operand 1 is tied to - // operand 0. - if (Inst.isTwoAddress) - Result[1].second |= (0 << 16) | (1 << (unsigned)TargetInstrInfo::TIED_TO); - return Result; } @@ -127,34 +144,21 @@ } } - std::map >, unsigned> - OperandInfosEmitted; + std::map, unsigned> OperandInfosEmitted; unsigned OperandListNum = 0; - OperandInfosEmitted[std::vector >()] = - ++OperandListNum; + OperandInfosEmitted[std::vector()] = ++OperandListNum; // Emit all of the operand info records. OS << "\n"; for (CodeGenTarget::inst_iterator II = Target.inst_begin(), E = Target.inst_end(); II != E; ++II) { - std::vector > OperandInfo = - GetOperandInfo(II->second); + std::vector OperandInfo = GetOperandInfo(II->second); unsigned &N = OperandInfosEmitted[OperandInfo]; if (N == 0) { N = ++OperandListNum; OS << "static const TargetOperandInfo OperandInfo" << N << "[] = { "; - for (unsigned i = 0, e = OperandInfo.size(); i != e; ++i) { - Record *RC = OperandInfo[i].first; - // FIXME: We only care about register operands for now. - if (RC && RC->isSubClassOf("RegisterClass")) - OS << "{ " << getQualifiedName(RC) << "RegClassID, 0, "; - else if (RC && RC->getName() == "ptr_rc") - // Ptr value whose register class is resolved via callback. - OS << "{ 0, 1, "; - else - OS << "{ 0, 0, "; - OS << OperandInfo[i].second << " }, "; - } + for (unsigned i = 0, e = OperandInfo.size(); i != e; ++i) + OS << "{ " << OperandInfo[i] << " }, "; OS << "};\n"; } } @@ -176,7 +180,7 @@ void InstrInfoEmitter::emitRecord(const CodeGenInstruction &Inst, unsigned Num, Record *InstrInfo, std::map, unsigned> &EmittedLists, - std::map >, unsigned> &OpInfo, + std::map, unsigned> &OpInfo, std::ostream &OS) { int MinOperands; if (!Inst.OperandList.empty()) @@ -262,7 +266,7 @@ OS << "ImplicitList" << EmittedLists[DefList] << ", "; // Emit the operand info. - std::vector > OperandInfo = GetOperandInfo(Inst); + std::vector OperandInfo = GetOperandInfo(Inst); if (OperandInfo.empty()) OS << "0"; else Index: llvm/utils/TableGen/InstrInfoEmitter.h diff -u llvm/utils/TableGen/InstrInfoEmitter.h:1.14 llvm/utils/TableGen/InstrInfoEmitter.h:1.15 --- llvm/utils/TableGen/InstrInfoEmitter.h:1.14 Sun Nov 5 13:31:28 2006 +++ llvm/utils/TableGen/InstrInfoEmitter.h Mon Nov 6 17:49:51 2006 @@ -45,12 +45,13 @@ void emitRecord(const CodeGenInstruction &Inst, unsigned Num, Record *InstrInfo, std::map, unsigned> &EL, - std::map >, unsigned> &OpInfo, + std::map, unsigned> &OpInfo, std::ostream &OS); void GatherItinClasses(); unsigned ItinClassNumber(std::string ItinName); void emitShiftedValue(Record *R, StringInit *Val, IntInit *Shift, std::ostream &OS); + std::vector GetOperandInfo(const CodeGenInstruction &Inst); }; } // End llvm namespace From sabre at nondot.org Mon Nov 6 17:53:46 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 6 Nov 2006 17:53:46 -0600 Subject: [llvm-commits] CVS: llvm/utils/TableGen/InstrInfoEmitter.cpp Message-ID: <200611062353.kA6Nrklx021554@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: InstrInfoEmitter.cpp updated: 1.49 -> 1.50 --- Log message: Mark predicate operands as such in operand info. --- Diffs of the changes: (+4 -0) InstrInfoEmitter.cpp | 4 ++++ 1 files changed, 4 insertions(+) Index: llvm/utils/TableGen/InstrInfoEmitter.cpp diff -u llvm/utils/TableGen/InstrInfoEmitter.cpp:1.49 llvm/utils/TableGen/InstrInfoEmitter.cpp:1.50 --- llvm/utils/TableGen/InstrInfoEmitter.cpp:1.49 Mon Nov 6 17:49:51 2006 +++ llvm/utils/TableGen/InstrInfoEmitter.cpp Mon Nov 6 17:53:31 2006 @@ -100,6 +100,10 @@ // Ptr value whose register class is resolved via callback. if (OpR && OpR->getName() == "ptr_rc") Res += "|M_LOOK_UP_PTR_REG_CLASS"; + + // Predicate operands. + if (j == 0 && Inst.OperandList[i].Rec->isSubClassOf("PredicateOperand")) + Res += "|M_PREDICATE_OPERAND"; // fill in constraint info. Res += ", " + Inst.OperandList[i].Constraint; From sabre at nondot.org Mon Nov 6 17:53:23 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 6 Nov 2006 17:53:23 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetInstrInfo.h Message-ID: <200611062353.kA6NrNkH021521@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetInstrInfo.h updated: 1.103 -> 1.104 --- Log message: Add a new operand flag to mark which operand is the first predicate operand of an M_PREDICATED instruction. --- Diffs of the changes: (+5 -0) TargetInstrInfo.h | 5 +++++ 1 files changed, 5 insertions(+) Index: llvm/include/llvm/Target/TargetInstrInfo.h diff -u llvm/include/llvm/Target/TargetInstrInfo.h:1.103 llvm/include/llvm/Target/TargetInstrInfo.h:1.104 --- llvm/include/llvm/Target/TargetInstrInfo.h:1.103 Mon Nov 6 15:44:17 2006 +++ llvm/include/llvm/Target/TargetInstrInfo.h Mon Nov 6 17:53:08 2006 @@ -90,6 +90,11 @@ // requires a callback to look up its register class. const unsigned M_LOOK_UP_PTR_REG_CLASS = 1 << 0; +/// M_PREDICATE_OPERAND - Set if this is the first operand of a predicate +/// operand that controls an M_PREDICATED instruction. +const unsigned M_PREDICATE_OPERAND = 1 << 1; + + /// TargetOperandInfo - This holds information about one operand of a machine /// instruction, indicating the register class for register operands, etc. /// From sabre at nondot.org Mon Nov 6 19:28:09 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 6 Nov 2006 19:28:09 -0600 Subject: [llvm-commits] CVS: llvm/utils/TableGen/CodeGenTarget.cpp Message-ID: <200611070128.kA71S9G6022975@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: CodeGenTarget.cpp updated: 1.75 -> 1.76 --- Log message: emit TIED_TO correctly --- Diffs of the changes: (+2 -2) CodeGenTarget.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/utils/TableGen/CodeGenTarget.cpp diff -u llvm/utils/TableGen/CodeGenTarget.cpp:1.75 llvm/utils/TableGen/CodeGenTarget.cpp:1.76 --- llvm/utils/TableGen/CodeGenTarget.cpp:1.75 Mon Nov 6 17:49:51 2006 +++ llvm/utils/TableGen/CodeGenTarget.cpp Mon Nov 6 19:27:55 2006 @@ -297,7 +297,7 @@ throw "Illegal tied-to operand constraint '" + CStr + "'"; // Build the string. - return "((" + utostr(TIdx) + " << 16) | TargetInstrInfo::TIED_TO)"; + return "((" + utostr(TIdx) + " << 16) | (1 << TargetInstrInfo::TIED_TO))"; } static void ParseConstraints(const std::string &CStr, CodeGenInstruction *I) { @@ -408,7 +408,7 @@ // For backward compatibility: isTwoAddress means operand 1 is tied to // operand 0. if (isTwoAddress && OperandList[1].Constraint.empty()) - OperandList[1].Constraint = "((0 << 16) | TargetInstrInfo::TIED_TO)"; + OperandList[1].Constraint = "((0 << 16) | (1 << TargetInstrInfo::TIED_TO))"; // Any operands with unset constraints get 0 as their constraint. for (unsigned op = 0, e = OperandList.size(); op != e; ++op) From sabre at nondot.org Mon Nov 6 19:52:04 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 6 Nov 2006 19:52:04 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCInstrFormats.td Message-ID: <200611070152.kA71q4qR023474@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCInstrFormats.td updated: 1.80 -> 1.81 --- Log message: fix encoding of BLR --- Diffs of the changes: (+2 -2) PPCInstrFormats.td | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Target/PowerPC/PPCInstrFormats.td diff -u llvm/lib/Target/PowerPC/PPCInstrFormats.td:1.80 llvm/lib/Target/PowerPC/PPCInstrFormats.td:1.81 --- llvm/lib/Target/PowerPC/PPCInstrFormats.td:1.80 Fri Nov 3 23:42:48 2006 +++ llvm/lib/Target/PowerPC/PPCInstrFormats.td Mon Nov 6 19:51:50 2006 @@ -405,8 +405,8 @@ bits<7> BIBO; // 2 bits of BI and 5 bits of BO. bits<3> CR; - let BO = BIBO{0-4}; - let BI{0-1} = BIBO{5-6}; + let BO = BIBO{2-6}; + let BI{0-1} = BIBO{0-1}; let BI{2-4} = CR; let BH = 0; } From sabre at nondot.org Mon Nov 6 22:11:36 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 6 Nov 2006 22:11:36 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/Generic/2006-11-06-MemIntrinsicExpand.ll Message-ID: <200611070411.kA74Bafe025950@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/Generic: 2006-11-06-MemIntrinsicExpand.ll added (r1.1) --- Log message: new testcase --- Diffs of the changes: (+12 -0) 2006-11-06-MemIntrinsicExpand.ll | 12 ++++++++++++ 1 files changed, 12 insertions(+) Index: llvm/test/Regression/CodeGen/Generic/2006-11-06-MemIntrinsicExpand.ll diff -c /dev/null llvm/test/Regression/CodeGen/Generic/2006-11-06-MemIntrinsicExpand.ll:1.1 *** /dev/null Mon Nov 6 22:11:24 2006 --- llvm/test/Regression/CodeGen/Generic/2006-11-06-MemIntrinsicExpand.ll Mon Nov 6 22:11:14 2006 *************** *** 0 **** --- 1,12 ---- + ; RUN: llvm-as < %s | llc -march=x86 && + ; RUN: llvm-as < %s | llc -march=x86 | not grep adc + + ; PR988 + + declare void %llvm.memcpy.i64(sbyte*, sbyte*, ulong, uint) + + void %foo(ulong %a) { + %b = add ulong %a, 1 + call void %llvm.memcpy.i64( sbyte* null, sbyte* null, ulong %b, uint 1 ) + ret void + } From sabre at nondot.org Mon Nov 6 22:11:59 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 6 Nov 2006 22:11:59 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Message-ID: <200611070411.kA74BxGk025968@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: LegalizeDAG.cpp updated: 1.416 -> 1.417 --- Log message: Fix PR988: http://llvm.org/PR988 and CodeGen/Generic/2006-11-06-MemIntrinsicExpand.ll. The low part goes in the first operand of expandop, not the second one. --- Diffs of the changes: (+1 -1) LegalizeDAG.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.416 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.417 --- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.416 Thu Nov 2 14:25:49 2006 +++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Mon Nov 6 22:11:44 2006 @@ -2039,7 +2039,7 @@ case Expand: { // Length is too big, just take the lo-part of the length. SDOperand HiPart; - ExpandOp(Node->getOperand(3), HiPart, Tmp4); + ExpandOp(Node->getOperand(3), Tmp4, HiPart); break; } case Legal: From sabre at nondot.org Mon Nov 6 22:12:17 2006 From: sabre at nondot.org (Chris Lattner) Date: Mon, 6 Nov 2006 22:12:17 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/Generic/2006-11-06-MemIntrinsicExpand.ll Message-ID: <200611070412.kA74CH4U026000@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/Generic: 2006-11-06-MemIntrinsicExpand.ll updated: 1.1 -> 1.2 --- Log message: wrong bug # --- Diffs of the changes: (+1 -1) 2006-11-06-MemIntrinsicExpand.ll | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/Regression/CodeGen/Generic/2006-11-06-MemIntrinsicExpand.ll diff -u llvm/test/Regression/CodeGen/Generic/2006-11-06-MemIntrinsicExpand.ll:1.1 llvm/test/Regression/CodeGen/Generic/2006-11-06-MemIntrinsicExpand.ll:1.2 --- llvm/test/Regression/CodeGen/Generic/2006-11-06-MemIntrinsicExpand.ll:1.1 Mon Nov 6 22:11:14 2006 +++ llvm/test/Regression/CodeGen/Generic/2006-11-06-MemIntrinsicExpand.ll Mon Nov 6 22:12:03 2006 @@ -1,7 +1,7 @@ ; RUN: llvm-as < %s | llc -march=x86 && ; RUN: llvm-as < %s | llc -march=x86 | not grep adc -; PR988 +; PR987 declare void %llvm.memcpy.i64(sbyte*, sbyte*, ulong, uint) From tonic at nondot.org Mon Nov 6 23:25:34 2006 From: tonic at nondot.org (Tanya Lattner) Date: Mon, 6 Nov 2006 23:25:34 -0600 Subject: [llvm-commits] [release_19] CVS: llvm/autoconf/configure.ac Message-ID: <200611070525.kA75PYeU027393@zion.cs.uiuc.edu> Changes in directory llvm/autoconf: configure.ac updated: 1.249 -> 1.249.2.1 --- Log message: This is the 1.9 release --- Diffs of the changes: (+1 -1) configure.ac | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.249 llvm/autoconf/configure.ac:1.249.2.1 --- llvm/autoconf/configure.ac:1.249 Sun Nov 5 11:08:18 2006 +++ llvm/autoconf/configure.ac Mon Nov 6 23:25:12 2006 @@ -31,7 +31,7 @@ dnl===-----------------------------------------------------------------------=== dnl Initialize autoconf and define the package name, version number and dnl email address for reporting bugs. -AC_INIT([[llvm]],[[1.9cvs]],[llvmbugs at cs.uiuc.edu]) +AC_INIT([[llvm]],[[1.9]],[llvmbugs at cs.uiuc.edu]) dnl Provide a copyright substitution and ensure the copyright notice is included dnl in the output of --version option of the generated configure script. From tonic at nondot.org Mon Nov 6 23:31:12 2006 From: tonic at nondot.org (Tanya Lattner) Date: Mon, 6 Nov 2006 23:31:12 -0600 Subject: [llvm-commits] CVS: llvm/autoconf/configure.ac Message-ID: <200611070531.kA75VCNl027513@zion.cs.uiuc.edu> Changes in directory llvm/autoconf: configure.ac updated: 1.249 -> 1.250 --- Log message: Bumping version number --- Diffs of the changes: (+1 -1) configure.ac | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/autoconf/configure.ac diff -u llvm/autoconf/configure.ac:1.249 llvm/autoconf/configure.ac:1.250 --- llvm/autoconf/configure.ac:1.249 Sun Nov 5 11:08:18 2006 +++ llvm/autoconf/configure.ac Mon Nov 6 23:31:00 2006 @@ -31,7 +31,7 @@ dnl===-----------------------------------------------------------------------=== dnl Initialize autoconf and define the package name, version number and dnl email address for reporting bugs. -AC_INIT([[llvm]],[[1.9cvs]],[llvmbugs at cs.uiuc.edu]) +AC_INIT([[llvm]],[[2.0cvs]],[llvmbugs at cs.uiuc.edu]) dnl Provide a copyright substitution and ensure the copyright notice is included dnl in the output of --version option of the generated configure script. From reid at x10sys.com Tue Nov 7 00:37:10 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 7 Nov 2006 00:37:10 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/DwarfWriter.cpp Message-ID: <200611070637.kA76bATg028556@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: DwarfWriter.cpp updated: 1.97 -> 1.98 --- Log message: Unbreak X86/ELF Debugging. Somehow this line got lost in Jim's cleanup. --- Diffs of the changes: (+2 -0) DwarfWriter.cpp | 2 ++ 1 files changed, 2 insertions(+) Index: llvm/lib/CodeGen/DwarfWriter.cpp diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.97 llvm/lib/CodeGen/DwarfWriter.cpp:1.98 --- llvm/lib/CodeGen/DwarfWriter.cpp:1.97 Mon Nov 6 10:23:59 2006 +++ llvm/lib/CodeGen/DwarfWriter.cpp Tue Nov 7 00:36:36 2006 @@ -2418,6 +2418,8 @@ /// EmitFunctionDebugFrame - Emit per function frame info into a debug frame /// section. void EmitFunctionDebugFrame() { + if (!TAI->getDwarfRequiresFrameSection()) + return; // Start the dwarf frame section. Asm->SwitchToDataSection(TAI->getDwarfFrameSection()); From llvm at cs.uiuc.edu Tue Nov 7 00:56:45 2006 From: llvm at cs.uiuc.edu (LLVM) Date: Tue, 7 Nov 2006 00:56:45 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/DebugInfo/ Message-ID: <200611070656.kA76ujnM028890@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/DebugInfo: --- Log message: Directory /var/cvs/llvm/llvm/test/Regression/DebugInfo added to the repository --- Diffs of the changes: (+0 -0) 0 files changed From sabre at nondot.org Tue Nov 7 01:19:01 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 7 Nov 2006 01:19:01 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Message-ID: <200611070719.kA77J1i4029292@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveIntervalAnalysis.cpp updated: 1.189 -> 1.190 --- Log message: Add a new llcbeta option. This speeds up viterbi from 12.34 to 8.76s on X86. If happy, I'll enable this by default. --- Diffs of the changes: (+19 -4) LiveIntervalAnalysis.cpp | 23 +++++++++++++++++++---- 1 files changed, 19 insertions(+), 4 deletions(-) Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.189 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.190 --- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.189 Thu Nov 2 21:04:46 2006 +++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Tue Nov 7 01:18:40 2006 @@ -59,6 +59,9 @@ EnableJoining("join-liveintervals", cl::desc("Coallesce copies (default=true)"), cl::init(true)); + static cl::opt + EnableReweight("enable-majik-f00"); + } void LiveIntervals::getAnalysisUsage(AnalysisUsage &AU) const { @@ -208,14 +211,26 @@ } } + for (iterator I = begin(), E = end(); I != E; ++I) { - LiveInterval &li = I->second; - if (MRegisterInfo::isVirtualRegister(li.reg)) { + LiveInterval &LI = I->second; + if (MRegisterInfo::isVirtualRegister(LI.reg)) { // If the live interval length is essentially zero, i.e. in every live // range the use follows def immediately, it doesn't make sense to spill // it and hope it will be easier to allocate for this li. - if (isZeroLengthInterval(&li)) - li.weight = float(HUGE_VAL); + if (isZeroLengthInterval(&LI)) + LI.weight = float(HUGE_VAL); + + if (EnableReweight) { + // Divide the weight of the interval by its size. This encourages + // spilling of intervals that are large and have few uses, and + // discourages spilling of small intervals with many uses. + unsigned Size = 0; + for (LiveInterval::iterator II = LI.begin(), E = LI.end(); II != E;++II) + Size += II->end - II->start; + + LI.weight /= Size; + } } } From sabre at nondot.org Tue Nov 7 01:19:17 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 7 Nov 2006 01:19:17 -0600 Subject: [llvm-commits] CVS: llvm-test/Makefile.programs Message-ID: <200611070719.kA77JH63029306@zion.cs.uiuc.edu> Changes in directory llvm-test: Makefile.programs updated: 1.235 -> 1.236 --- Log message: regalloc hack = llc-beta tonight. --- Diffs of the changes: (+4 -2) Makefile.programs | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm-test/Makefile.programs diff -u llvm-test/Makefile.programs:1.235 llvm-test/Makefile.programs:1.236 --- llvm-test/Makefile.programs:1.235 Tue Oct 31 19:36:08 2006 +++ llvm-test/Makefile.programs Tue Nov 7 01:19:03 2006 @@ -193,7 +193,8 @@ endif#DISABLE_DIFFS ifeq ($(ARCH),PowerPC) -LLCBETAOPTION := --enable-tail-merge +LLCBETAOPTION := -enable-majik-f00 +#--enable-tail-merge #-regalloc=local -fast endif ifeq ($(ARCH),Alpha) @@ -204,7 +205,8 @@ LLCBETAOPTION := -sched=simple endif ifeq ($(ARCH),x86) -LLCBETAOPTION := --enable-tail-merge +LLCBETAOPTION := -enable-majik-f00 +#--enable-tail-merge #-regalloc=local -fast endif ifeq ($(ARCH),Sparc) From reid at x10sys.com Tue Nov 7 01:31:58 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 7 Nov 2006 01:31:58 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp dg.exp Message-ID: <200611070731.kA77VwwK029618@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/DebugInfo: 2006-11-06-StackTrace.cpp added (r1.1) dg.exp added (r1.1) --- Log message: Add a test case for making sure gdb can get a stack trace with our debug information. --- Diffs of the changes: (+32 -0) 2006-11-06-StackTrace.cpp | 29 +++++++++++++++++++++++++++++ dg.exp | 3 +++ 2 files changed, 32 insertions(+) Index: llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp diff -c /dev/null llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp:1.1 *** /dev/null Tue Nov 7 01:31:48 2006 --- llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp Tue Nov 7 01:31:37 2006 *************** *** 0 **** --- 1,29 ---- + // This is a regression test on debug info to make sure that we can get a + // meaningful stack trace from a C++ program. + // RUN: %llvmgcc -S -O0 -g %s -o Output/%s.ll + // RUN: llvm-as < Output/%s.ll | llc -o Output/%s.s + // RUN: gcc -g Output/%s.s -o Output/%s.exe + // RUN: ( echo "break DeepStack::deepest"; echo "run 17" ; echo "where" ) | gdb Output/%s.exe | grep '#0 DeepStack::deepest (this=.*,x=33)' + + #include + + class DeepStack { + int seedVal; + public: + DeepStack(int seed) : seedVal(seed) {} + + int shallowest( int x ) { return shallower(x + 1); } + int shallower ( int x ) { return shallow(x + 2); } + int shallow ( int x ) { return deep(x + 3); } + int deep ( int x ) { return deeper(x + 4); } + int deeper ( int x ) { return deepest(x + 6); } + int deepest ( int x ) { return x + 7; } + + int runit() { return shallowest(seedVal); } + }; + + int main ( int argc, char** argv) { + + DeepStack DS9( (argc > 1 ? atoi(argv[1]) : 0) ); + return DS9.runit(); + } Index: llvm/test/Regression/DebugInfo/dg.exp diff -c /dev/null llvm/test/Regression/DebugInfo/dg.exp:1.1 *** /dev/null Tue Nov 7 01:31:58 2006 --- llvm/test/Regression/DebugInfo/dg.exp Tue Nov 7 01:31:37 2006 *************** *** 0 **** --- 1,3 ---- + load_lib llvm-dg.exp + + llvm-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] $objdir $srcdir $subdir $target_triplet $llvmgcc $llvmgxx $prcontext $llvmgcc_version From reid at x10sys.com Tue Nov 7 01:35:11 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 7 Nov 2006 01:35:11 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/DebugInfo/.cvsignore Message-ID: <200611070735.kA77ZBMu029684@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/DebugInfo: .cvsignore added (r1.1) --- Log message: Ignore the Output dir. --- Diffs of the changes: (+1 -0) .cvsignore | 1 + 1 files changed, 1 insertion(+) Index: llvm/test/Regression/DebugInfo/.cvsignore diff -c /dev/null llvm/test/Regression/DebugInfo/.cvsignore:1.1 *** /dev/null Tue Nov 7 01:35:06 2006 --- llvm/test/Regression/DebugInfo/.cvsignore Tue Nov 7 01:34:56 2006 *************** *** 0 **** --- 1 ---- + Output From reid at x10sys.com Tue Nov 7 01:58:28 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 7 Nov 2006 01:58:28 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp Message-ID: <200611070758.kA77wSWT030021@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/DebugInfo: 2006-11-06-StackTrace.cpp updated: 1.1 -> 1.2 --- Log message: Make some corrections to this test case. --- Diffs of the changes: (+6 -4) 2006-11-06-StackTrace.cpp | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) Index: llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp diff -u llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp:1.1 llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp:1.2 --- llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp:1.1 Tue Nov 7 01:31:37 2006 +++ llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp Tue Nov 7 01:58:02 2006 @@ -1,9 +1,11 @@ // This is a regression test on debug info to make sure that we can get a // meaningful stack trace from a C++ program. -// RUN: %llvmgcc -S -O0 -g %s -o Output/%s.ll -// RUN: llvm-as < Output/%s.ll | llc -o Output/%s.s -// RUN: gcc -g Output/%s.s -o Output/%s.exe -// RUN: ( echo "break DeepStack::deepest"; echo "run 17" ; echo "where" ) | gdb Output/%s.exe | grep '#0 DeepStack::deepest (this=.*,x=33)' +// RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | llc -o Output/StackTrace.s -f +// RUN: gcc -g Output/StackTrace.s -o Output/StackTrace.exe -lstdc++ +// RUN: ( echo "break DeepStack::deepest"; echo "run 17" ; echo "where" ) > Output/StackTrace.gdbin +// RUN: gdb -q -batch -n -x Output/StackTrace.gdbin Output/StackTrace.exe | tee Output/StackTrace.out | grep '#0 DeepStack::deepest (this=.*,x=33)' +// RUN: gdb -q -batch -n -x Output/StackTrace.gdbin Output/StackTrace.exe | grep '#7 0x.* in main(argc=1, argv=.*)' + #include From evan.cheng at apple.com Tue Nov 7 03:03:30 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 7 Nov 2006 03:03:30 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200611070903.kA793UoN007164@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.238 -> 1.239 --- Log message: Add post-indexed load / store transformations. --- Diffs of the changes: (+199 -50) DAGCombiner.cpp | 249 ++++++++++++++++++++++++++++++++++++++++++++------------ 1 files changed, 199 insertions(+), 50 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.238 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.239 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.238 Mon Nov 6 02:14:30 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Nov 7 03:03:05 2006 @@ -47,6 +47,11 @@ static Statistic<> NodesCombined ("dagcombiner", "Number of dag nodes combined"); + static Statistic<> PreIndexedNodes ("pre_indexed_ops", + "Number of pre-indexed nodes created"); + static Statistic<> PostIndexedNodes ("post_indexed_ops", + "Number of post-indexed nodes created"); + static cl::opt CombinerAA("combiner-alias-analysis", cl::Hidden, cl::desc("Turn on alias analysis during testing")); @@ -174,13 +179,16 @@ return true; } - /// CombineToPreIndexedLoadStore - Try turning a load / store into a - /// pre-indexed load store when the base pointer is a add or subtract - /// and it has other uses besides the load / store. When the - /// transformation is done, the new indexed load / store effectively - /// folded the add / subtract in and all of its other uses are redirected - /// to the new load / store. + /// CombineToPreIndexedLoadStore - Try turning a load / store and a + /// pre-indexed load / store when the base pointer is a add or subtract + /// and it has other uses besides the load / store. After the + /// transformation, the new indexed load / store has effectively folded + /// the add / subtract in and all of its other uses are redirected to the + /// new load / store. bool CombineToPreIndexedLoadStore(SDNode *N) { + if (!AfterLegalize) + return false; + bool isLoad = true; SDOperand Ptr; if (LoadSDNode *LD = dyn_cast(N)) { @@ -191,8 +199,7 @@ } else return false; - if (AfterLegalize && - (Ptr.getOpcode() == ISD::ADD || Ptr.getOpcode() == ISD::SUB) && + if ((Ptr.getOpcode() == ISD::ADD || Ptr.getOpcode() == ISD::SUB) && Ptr.Val->use_size() > 1) { SDOperand BasePtr; SDOperand Offset; @@ -203,57 +210,56 @@ // that would create a cycle. // 2) All uses are load / store ops that use it as base ptr and offset // is just an addressing mode immediate. - // 3) If the would-be new base may not to be dead at N. FIXME: The - // proper check is too expensive (in turns of compile time) to - // check. Just make sure other uses of the new base are not also - // themselves use of loads / stores. - - bool OffIsAMImm = Offset.getOpcode() == ISD::Constant && - TLI.isLegalAddressImmediate( - cast(Offset)->getValue()); + // 3) If the would-be new base may not to be dead at N. + + bool OffIsAMImm = Offset.getOpcode() == ISD::Constant && TLI. + isLegalAddressImmediate(cast(Offset)->getValue()); // Check for #3. - if (OffIsAMImm && BasePtr.Val->use_size() > 1) { - for (SDNode::use_iterator I = BasePtr.Val->use_begin(), - E = BasePtr.Val->use_end(); I != E; ++I) { - SDNode *Use = *I; - if (Use == Ptr.Val) - continue; - if (Use->getOpcode() == ISD::ADD || Use->getOpcode() == ISD::SUB){ - for (SDNode::use_iterator II = Use->use_begin(), - EE = Use->use_end(); II != EE; ++II) { - SDNode *UseUse = *II; - if (UseUse->getOpcode() == ISD::LOAD && - cast(UseUse)->getBasePtr().Val == Use) - return false; - else if (UseUse->getOpcode() == ISD::STORE && - cast(UseUse)->getBasePtr().Val == Use) - return false; - } + for (SDNode::use_iterator I = BasePtr.Val->use_begin(), + E = BasePtr.Val->use_end(); I != E; ++I) { + SDNode *Use = *I; + if (Use == Ptr.Val) + continue; + if (Use->getOpcode() == ISD::CopyToReg) + return false; + if (OffIsAMImm && (Use->getOpcode() == ISD::ADD || + Use->getOpcode() == ISD::SUB)) { + for (SDNode::use_iterator II = Use->use_begin(), + EE = Use->use_end(); II != EE; ++II) { + SDNode *UseUse = *II; + if (UseUse->getOpcode() == ISD::LOAD && + cast(UseUse)->getBasePtr().Val == Use) + return false; + else if (UseUse->getOpcode() == ISD::STORE && + cast(UseUse)->getBasePtr().Val == Use) + return false; } } } // Now check for #1 and #2. unsigned NumRealUses = 0; - for (SDNode::use_iterator I = Ptr.Val->use_begin(), - E = Ptr.Val->use_end(); I != E; ++I) { - SDNode *Use = *I; - if (Use == N) - continue; - if (Use->isPredecessor(N)) - return false; + if (OffIsAMImm) { + for (SDNode::use_iterator I = Ptr.Val->use_begin(), + E = Ptr.Val->use_end(); I != E; ++I) { + SDNode *Use = *I; + if (Use == N) + continue; + if (Use->isPredecessor(N)) + return false; - if (!OffIsAMImm) { - NumRealUses++; - } else if (Use->getOpcode() == ISD::LOAD) { - if (cast(Use)->getBasePtr().Val != Ptr.Val) + if (!OffIsAMImm) { NumRealUses++; - } else if (Use->getOpcode() == ISD::STORE) { - if (cast(Use)->getBasePtr().Val != Ptr.Val) + } else if (Use->getOpcode() == ISD::LOAD) { + if (cast(Use)->getBasePtr().Val != Ptr.Val) + NumRealUses++; + } else if (Use->getOpcode() == ISD::STORE) { + if (cast(Use)->getBasePtr().Val != Ptr.Val) + NumRealUses++; + } else NumRealUses++; - } else - NumRealUses++; + } } if (NumRealUses == 0) return false; @@ -261,6 +267,7 @@ SDOperand Result = isLoad ? DAG.getIndexedLoad(SDOperand(N,0), BasePtr, Offset, AM) : DAG.getIndexedStore(SDOperand(N,0), BasePtr, Offset, AM); + ++PreIndexedNodes; ++NodesCombined; DEBUG(std::cerr << "\nReplacing.4 "; N->dump(); std::cerr << "\nWith: "; Result.Val->dump(&DAG); @@ -294,7 +301,149 @@ return true; } } + return false; + } + + /// CombineToPostIndexedLoadStore - Try combine a load / store with a + /// add / sub of the base pointer node into a post-indexed load / store. + /// The transformation folded the add / subtract into the new indexed + /// load / store effectively and all of its uses are redirected to the + /// new load / store. + bool CombineToPostIndexedLoadStore(SDNode *N) { + if (!AfterLegalize) + return false; + + bool isLoad = true; + SDOperand Ptr; + MVT::ValueType VT; + if (LoadSDNode *LD = dyn_cast(N)) { + Ptr = LD->getBasePtr(); + VT = LD->getLoadedVT(); + } else if (StoreSDNode *ST = dyn_cast(N)) { + Ptr = ST->getBasePtr(); + VT = ST->getStoredVT(); + isLoad = false; + } else + return false; + + if (Ptr.Val->use_size() > 1) { + for (SDNode::use_iterator I = Ptr.Val->use_begin(), + E = Ptr.Val->use_end(); I != E; ++I) { + SDNode *Op = *I; + if (Op == N || + (Op->getOpcode() != ISD::ADD && Op->getOpcode() != ISD::SUB)) + continue; + + SDOperand BasePtr; + SDOperand Offset; + ISD::MemOpAddrMode AM = ISD::UNINDEXED; + if (TLI.getPostIndexedAddressParts(Op, VT, BasePtr, Offset, AM,DAG) && + BasePtr.Val == Ptr.Val) { + // Try turning it into a post-indexed load / store except when + // 1) Op must be independent of N, i.e. Op is neither a predecessor + // nor a successor of N. Otherwise, if Op is folded that would + // create a cycle. + // 2) All uses are load / store ops that use it as base ptr and offset + // is just an addressing mode immediate. + // 3) If the would-be new base may not to be dead at N. + + bool OffIsAMImm = Offset.getOpcode() == ISD::Constant && TLI. + isLegalAddressImmediate(cast(Offset)->getValue()); + + // Check for #3. + bool TryNext = false; + for (SDNode::use_iterator II = BasePtr.Val->use_begin(), + EE = BasePtr.Val->use_end(); II != EE; ++II) { + SDNode *Use = *II; + if (Use == Ptr.Val) + continue; + if (Use->getOpcode() == ISD::CopyToReg) { + TryNext = true; + break; + } + + if (OffIsAMImm && (Use->getOpcode() == ISD::ADD || + Use->getOpcode() == ISD::SUB)) { + for (SDNode::use_iterator III = Use->use_begin(), + EEE = Use->use_end(); III != EEE; ++III) { + SDNode *UseUse = *III; + if (UseUse->getOpcode() == ISD::LOAD && + cast(UseUse)->getBasePtr().Val == Use) { + TryNext = true; + break; + } else if (UseUse->getOpcode() == ISD::STORE && + cast(UseUse)->getBasePtr().Val == Use) { + + TryNext = true; + break; + } + } + } + } + if (TryNext) + continue; + if (OffIsAMImm) { + // Check for #2. + unsigned NumRealUses = 0; + for (SDNode::use_iterator II = Op->use_begin(), EE = Op->use_end(); + II != EE; ++II) { + SDNode *Use = *II; + if (Use->getOpcode() == ISD::LOAD) { + if (cast(Use)->getBasePtr().Val != Op) + NumRealUses++; + } else if (Use->getOpcode() == ISD::STORE) { + if (cast(Use)->getBasePtr().Val != Op) + NumRealUses++; + } else + NumRealUses++; + } + if (NumRealUses == 0) + continue; + } + + // Check for #1 + if (!Op->isPredecessor(N) && !N->isPredecessor(Op)) { + SDOperand Result = isLoad + ? DAG.getIndexedLoad(SDOperand(N,0), BasePtr, Offset, AM) + : DAG.getIndexedStore(SDOperand(N,0), BasePtr, Offset, AM); + ++PostIndexedNodes; + ++NodesCombined; + DEBUG(std::cerr << "\nReplacing.5 "; N->dump(); + std::cerr << "\nWith: "; Result.Val->dump(&DAG); + std::cerr << '\n'); + std::vector NowDead; + if (isLoad) { + DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 0), Result.getValue(0), + NowDead); + DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 1), Result.getValue(2), + NowDead); + } else { + DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 0), Result.getValue(1), + NowDead); + } + + // Nodes can end up on the worklist more than once. Make sure we do + // not process a node that has been replaced. + for (unsigned i = 0, e = NowDead.size(); i != e; ++i) + removeFromWorkList(NowDead[i]); + // Finally, since the node is now dead, remove it from the graph. + DAG.DeleteNode(N); + + // Replace the uses of Use with uses of the updated base value. + DAG.ReplaceAllUsesOfValueWith(SDOperand(Op, 0), + Result.getValue(isLoad ? 1 : 0), + NowDead); + removeFromWorkList(Op); + for (unsigned i = 0, e = NowDead.size(); i != e; ++i) + removeFromWorkList(NowDead[i]); + DAG.DeleteNode(Op); + + return true; + } + } + } + } return false; } @@ -2877,7 +3026,7 @@ } // Try transforming N to an indexed load. - if (CombineToPreIndexedLoadStore(N)) + if (CombineToPreIndexedLoadStore(N) || CombineToPostIndexedLoadStore(N)) return SDOperand(N, 0); return SDOperand(); @@ -2923,7 +3072,7 @@ } // Try transforming N to an indexed store. - if (CombineToPreIndexedLoadStore(N)) + if (CombineToPreIndexedLoadStore(N) || CombineToPostIndexedLoadStore(N)) return SDOperand(N, 0); return SDOperand(); From evan.cheng at apple.com Tue Nov 7 03:04:30 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 7 Nov 2006 03:04:30 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetLowering.h Message-ID: <200611070904.kA794Ubq007198@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetLowering.h updated: 1.86 -> 1.87 --- Log message: Added target hook for post-indexed memory ops transformation. --- Diffs of the changes: (+10 -0) TargetLowering.h | 10 ++++++++++ 1 files changed, 10 insertions(+) Index: llvm/include/llvm/Target/TargetLowering.h diff -u llvm/include/llvm/Target/TargetLowering.h:1.86 llvm/include/llvm/Target/TargetLowering.h:1.87 --- llvm/include/llvm/Target/TargetLowering.h:1.86 Fri Nov 3 01:19:02 2006 +++ llvm/include/llvm/Target/TargetLowering.h Tue Nov 7 03:04:16 2006 @@ -382,6 +382,16 @@ return false; } + /// getPostIndexedAddressParts - returns true by value, base pointer and + /// offset pointer and addressing mode by reference if this node can be + /// combined with a load / store to form a post-indexed load / store. + virtual bool getPostIndexedAddressParts(SDNode *N, MVT::ValueType VT, + SDOperand &Base, SDOperand &Offset, + ISD::MemOpAddrMode &AM, + SelectionDAG &DAG) { + return false; + } + //===--------------------------------------------------------------------===// // TargetLowering Optimization Methods // From jlaskey at apple.com Tue Nov 7 06:26:05 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 7 Nov 2006 06:26:05 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp RegAllocLinearScan.cpp Message-ID: <200611071226.kA7CQ5v8011213@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveIntervalAnalysis.cpp updated: 1.190 -> 1.191 RegAllocLinearScan.cpp updated: 1.129 -> 1.130 --- Log message: Use correct value for float HUGH_VAL. --- Diffs of the changes: (+6 -6) LiveIntervalAnalysis.cpp | 8 ++++---- RegAllocLinearScan.cpp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.190 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.191 --- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.190 Tue Nov 7 01:18:40 2006 +++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Tue Nov 7 06:25:45 2006 @@ -219,7 +219,7 @@ // range the use follows def immediately, it doesn't make sense to spill // it and hope it will be easier to allocate for this li. if (isZeroLengthInterval(&LI)) - LI.weight = float(HUGE_VAL); + LI.weight = HUGE_VALF; if (EnableReweight) { // Divide the weight of the interval by its size. This encourages @@ -265,7 +265,7 @@ std::vector added; - assert(li.weight != HUGE_VAL && + assert(li.weight != HUGE_VALF && "attempt to spill already spilled interval!"); DEBUG(std::cerr << "\t\t\t\tadding intervals for spills for interval: "; @@ -340,7 +340,7 @@ // the spill weight is now infinity as it // cannot be spilled again - nI.weight = float(HUGE_VAL); + nI.weight = HUGE_VALF; if (HasUse) { LiveRange LR(getLoadIndex(index), getUseIndex(index), @@ -1362,6 +1362,6 @@ LiveInterval LiveIntervals::createInterval(unsigned reg) { float Weight = MRegisterInfo::isPhysicalRegister(reg) ? - (float)HUGE_VAL : 0.0F; + HUGE_VALF : 0.0F; return LiveInterval(reg, Weight); } Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.129 llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.130 --- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.129 Tue Oct 24 09:35:25 2006 +++ llvm/lib/CodeGen/RegAllocLinearScan.cpp Tue Nov 7 06:25:45 2006 @@ -545,7 +545,7 @@ DEBUG(std::cerr << "\tassigning stack slot at interval "<< *cur << ":\n"); // Find a register to spill. - float minWeight = float(HUGE_VAL); + float minWeight = HUGE_VALF; unsigned minReg = 0; for (TargetRegisterClass::iterator i = RC->allocation_order_begin(*mf_), e = RC->allocation_order_end(*mf_); i != e; ++i) { @@ -582,7 +582,7 @@ // if the current has the minimum weight, we need to spill it and // add any added intervals back to unhandled, and restart // linearscan. - if (cur->weight != float(HUGE_VAL) && cur->weight <= minWeight) { + if (cur->weight != HUGE_VALF && cur->weight <= minWeight) { DEBUG(std::cerr << "\t\t\tspilling(c): " << *cur << '\n';); int slot = vrm_->assignVirt2StackSlot(cur->reg); std::vector added = From alenhar2 at cs.uiuc.edu Tue Nov 7 10:33:24 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Tue, 7 Nov 2006 10:33:24 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/Alpha/add.ll Message-ID: <200611071633.kA7GXOuo031655@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/Alpha: add.ll updated: 1.1 -> 1.2 --- Log message: Fix this test --- Diffs of the changes: (+14 -14) add.ll | 28 ++++++++++++++-------------- 1 files changed, 14 insertions(+), 14 deletions(-) Index: llvm/test/Regression/CodeGen/Alpha/add.ll diff -u llvm/test/Regression/CodeGen/Alpha/add.ll:1.1 llvm/test/Regression/CodeGen/Alpha/add.ll:1.2 --- llvm/test/Regression/CodeGen/Alpha/add.ll:1.1 Tue Oct 31 13:50:55 2006 +++ llvm/test/Regression/CodeGen/Alpha/add.ll Tue Nov 7 10:32:55 2006 @@ -1,19 +1,19 @@ ;test all the shifted and signextending adds and subs with and without consts -; RUN: llvm-as < %s | llc -march=alpha | grep ' addl' |wc -l |grep 2 -; RUN: llvm-as < %s | llc -march=alpha | grep ' addq' |wc -l |grep 2 -; RUN: llvm-as < %s | llc -march=alpha | grep ' subl' |wc -l |grep 2 -; RUN: llvm-as < %s | llc -march=alpha | grep ' subq' |wc -l |grep 1 -; RUN: llvm-as < %s | llc -march=alpha | grep 'lda $0,-100($16)' |wc -l |grep 1 - -; RUN: llvm-as < %s | llc -march=alpha | grep 's4addl' |wc -l |grep 2 -; RUN: llvm-as < %s | llc -march=alpha | grep 's8addl' |wc -l |grep 2 -; RUN: llvm-as < %s | llc -march=alpha | grep 's4addq' |wc -l |grep 2 -; RUN: llvm-as < %s | llc -march=alpha | grep 's8addq' |wc -l |grep 2 - -; RUN: llvm-as < %s | llc -march=alpha | grep 's4subl' |wc -l |grep 2 -; RUN: llvm-as < %s | llc -march=alpha | grep 's8subl' |wc -l |grep 2 -; RUN: llvm-as < %s | llc -march=alpha | grep 's4subq' |wc -l |grep 2 +; RUN: llvm-as < %s | llc -march=alpha | grep ' addl' |wc -l |grep 2 && +; RUN: llvm-as < %s | llc -march=alpha | grep ' addq' |wc -l |grep 2 && +; RUN: llvm-as < %s | llc -march=alpha | grep ' subl' |wc -l |grep 2 && +; RUN: llvm-as < %s | llc -march=alpha | grep ' subq' |wc -l |grep 1 && +; RUN: llvm-as < %s | llc -march=alpha | grep 'lda $0,-100($16)' |wc -l |grep 1 && + +; RUN: llvm-as < %s | llc -march=alpha | grep 's4addl' |wc -l |grep 2 && +; RUN: llvm-as < %s | llc -march=alpha | grep 's8addl' |wc -l |grep 2 && +; RUN: llvm-as < %s | llc -march=alpha | grep 's4addq' |wc -l |grep 2 && +; RUN: llvm-as < %s | llc -march=alpha | grep 's8addq' |wc -l |grep 2 && + +; RUN: llvm-as < %s | llc -march=alpha | grep 's4subl' |wc -l |grep 2 && +; RUN: llvm-as < %s | llc -march=alpha | grep 's8subl' |wc -l |grep 2 && +; RUN: llvm-as < %s | llc -march=alpha | grep 's4subq' |wc -l |grep 2 && ; RUN: llvm-as < %s | llc -march=alpha | grep 's8subq' |wc -l |grep 2 implementation ; Functions: From alenhar2 at cs.uiuc.edu Tue Nov 7 10:40:47 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Tue, 7 Nov 2006 10:40:47 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/2006-11-03-Memmove64.ll 2007-11-03-Memmove64.ll Message-ID: <200611071640.kA7Gelq8031778@apoc.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/InstCombine: 2006-11-03-Memmove64.ll added (r1.1) 2007-11-03-Memmove64.ll (r1.1) removed --- Log message: Got a little ahead of myself here --- Diffs of the changes: (+18 -0) 2006-11-03-Memmove64.ll | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+) Index: llvm/test/Regression/Transforms/InstCombine/2006-11-03-Memmove64.ll diff -c /dev/null llvm/test/Regression/Transforms/InstCombine/2006-11-03-Memmove64.ll:1.1 *** /dev/null Tue Nov 7 10:40:30 2006 --- llvm/test/Regression/Transforms/InstCombine/2006-11-03-Memmove64.ll Tue Nov 7 10:40:19 2006 *************** *** 0 **** --- 1,18 ---- + ;RUN: llvm-as < %s | opt -instcombine | llvm-dis |not grep memmove.i32 + ; Instcombine was trying to turn this into a memmove.i32 + + target datalayout = "e-p:64:64" + target endian = little + target pointersize = 64 + target triple = "alphaev67-unknown-linux-gnu" + %str10 = internal constant [1 x sbyte] zeroinitializer ; <[1 x sbyte]*> [#uses=1] + + implementation ; Functions: + + void %do_join(sbyte* %b) { + entry: + call void %llvm.memmove.i64( sbyte* %b, sbyte* getelementptr ([1 x sbyte]* %str10, int 0, ulong 0), ulong 1, uint 1 ) + ret void + } + + declare void %llvm.memmove.i64(sbyte*, sbyte*, ulong, uint) From sabre at nondot.org Tue Nov 7 11:58:09 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 7 Nov 2006 11:58:09 -0600 Subject: [llvm-commits] CVS: llvm-test/Makefile.programs Message-ID: <200611071758.kA7Hw9x6017109@zion.cs.uiuc.edu> Changes in directory llvm-test: Makefile.programs updated: 1.236 -> 1.237 --- Log message: disable majik-f00 --- Diffs of the changes: (+2 -4) Makefile.programs | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) Index: llvm-test/Makefile.programs diff -u llvm-test/Makefile.programs:1.236 llvm-test/Makefile.programs:1.237 --- llvm-test/Makefile.programs:1.236 Tue Nov 7 01:19:03 2006 +++ llvm-test/Makefile.programs Tue Nov 7 11:57:53 2006 @@ -193,8 +193,7 @@ endif#DISABLE_DIFFS ifeq ($(ARCH),PowerPC) -LLCBETAOPTION := -enable-majik-f00 -#--enable-tail-merge +LLCBETAOPTION := --enable-tail-merge #-regalloc=local -fast endif ifeq ($(ARCH),Alpha) @@ -205,8 +204,7 @@ LLCBETAOPTION := -sched=simple endif ifeq ($(ARCH),x86) -LLCBETAOPTION := -enable-majik-f00 -#--enable-tail-merge +LLCBETAOPTION := --enable-tail-merge #-regalloc=local -fast endif ifeq ($(ARCH),Sparc) From sabre at nondot.org Tue Nov 7 12:05:13 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 7 Nov 2006 12:05:13 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Message-ID: <200611071805.kA7I5DUv017363@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveIntervalAnalysis.cpp updated: 1.191 -> 1.192 --- Log message: Enable improved spilling costs by default. This speeds up viterbi on x86 by 40%, FreeBench/fourinarow by 20%, and many other programs 10-25%. On PPC, this speeds up fourinarow by 18%, and probably other things as well. --- Diffs of the changes: (+7 -12) LiveIntervalAnalysis.cpp | 19 +++++++------------ 1 files changed, 7 insertions(+), 12 deletions(-) Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.191 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.192 --- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.191 Tue Nov 7 06:25:45 2006 +++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Tue Nov 7 12:04:58 2006 @@ -59,9 +59,6 @@ EnableJoining("join-liveintervals", cl::desc("Coallesce copies (default=true)"), cl::init(true)); - static cl::opt - EnableReweight("enable-majik-f00"); - } void LiveIntervals::getAnalysisUsage(AnalysisUsage &AU) const { @@ -221,16 +218,14 @@ if (isZeroLengthInterval(&LI)) LI.weight = HUGE_VALF; - if (EnableReweight) { - // Divide the weight of the interval by its size. This encourages - // spilling of intervals that are large and have few uses, and - // discourages spilling of small intervals with many uses. - unsigned Size = 0; - for (LiveInterval::iterator II = LI.begin(), E = LI.end(); II != E;++II) - Size += II->end - II->start; + // Divide the weight of the interval by its size. This encourages + // spilling of intervals that are large and have few uses, and + // discourages spilling of small intervals with many uses. + unsigned Size = 0; + for (LiveInterval::iterator II = LI.begin(), E = LI.end(); II != E;++II) + Size += II->end - II->start; - LI.weight /= Size; - } + LI.weight /= Size; } } From sabre at nondot.org Tue Nov 7 12:13:15 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 7 Nov 2006 12:13:15 -0600 Subject: [llvm-commits] CVS: llvm-test/MultiSource/Applications/viterbi/dec_viterbi_F.c Message-ID: <200611071813.kA7IDFMU017560@zion.cs.uiuc.edu> Changes in directory llvm-test/MultiSource/Applications/viterbi: dec_viterbi_F.c updated: 1.2 -> 1.3 --- Log message: patch by Anton, which 'fixes viterbi algorithm on coderates other than 1/2'. This shouldn't affect performance. --- Diffs of the changes: (+4 -4) dec_viterbi_F.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm-test/MultiSource/Applications/viterbi/dec_viterbi_F.c diff -u llvm-test/MultiSource/Applications/viterbi/dec_viterbi_F.c:1.2 llvm-test/MultiSource/Applications/viterbi/dec_viterbi_F.c:1.3 --- llvm-test/MultiSource/Applications/viterbi/dec_viterbi_F.c:1.2 Tue Oct 3 18:31:21 2006 +++ llvm-test/MultiSource/Applications/viterbi/dec_viterbi_F.c Tue Nov 7 12:13:00 2006 @@ -55,10 +55,6 @@ fflush(stdout); } #endif /* 0 */ - if (i_punct == param->n_in) { - i_punct = 0; - } - memcpy(Metr0, Metr, Metr_mem->length*sizeof(double)); memcpy(Metr1, Metr, Metr_mem->length*sizeof(double)); @@ -129,6 +125,10 @@ history[i][j] = history_new[i][j]; } } + + if (++i_punct == param->n_in) { + i_punct = 0; + } } bit_stream->data = (unsigned char*)realloc(bit_stream->data, bv*sizeof(unsigned char)); From sabre at nondot.org Tue Nov 7 12:30:35 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 7 Nov 2006 12:30:35 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/README.txt Message-ID: <200611071830.kA7IUZ3x017936@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: README.txt updated: 1.103 -> 1.104 --- Log message: add a note from viterbi --- Diffs of the changes: (+29 -0) README.txt | 29 +++++++++++++++++++++++++++++ 1 files changed, 29 insertions(+) Index: llvm/lib/Target/PowerPC/README.txt diff -u llvm/lib/Target/PowerPC/README.txt:1.103 llvm/lib/Target/PowerPC/README.txt:1.104 --- llvm/lib/Target/PowerPC/README.txt:1.103 Fri Oct 27 17:02:19 2006 +++ llvm/lib/Target/PowerPC/README.txt Tue Nov 7 12:30:21 2006 @@ -11,6 +11,35 @@ ===-------------------------------------------------------------------------=== +We compile the hottest inner loop of viterbi to: + + li r6, 0 + b LBB1_84 ;bb432.i +LBB1_83: ;bb420.i + lbzx r8, r5, r7 + addi r6, r7, 1 + stbx r8, r4, r7 +LBB1_84: ;bb432.i + mr r7, r6 + cmplwi cr0, r7, 143 + bne cr0, LBB1_83 ;bb420.i + +The CBE manages to produce: + + li r0, 143 + mtctr r0 +loop: + lbzx r2, r2, r11 + stbx r0, r2, r9 + addi r2, r2, 1 + bdz later + b loop + +This could be much better (bdnz instead of bdz) but it still beats us. If we +produced this with bdnz, the loop would be a single dispatch group. + +===-------------------------------------------------------------------------=== + Compile: void foo(int *P) { From jlaskey at apple.com Tue Nov 7 13:34:03 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 7 Nov 2006 13:34:03 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineDebugInfo.h Passes.h Message-ID: <200611071934.kA7JY3EJ004731@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineDebugInfo.h updated: 1.44 -> 1.45 Passes.h updated: 1.21 -> 1.22 --- Log message: 1. Add a pass to fold debug label instructions so a debug info client can detect empty ranges. 2. Reorg how MachineDebugInfo maintains changes to debug labels. 3. Have dwarf writer use debug label info to simplify scopes and source line coorespondence. 4. Revert the merging of compile units until I can get the bugs ironed out. --- Diffs of the changes: (+30 -11) MachineDebugInfo.h | 36 +++++++++++++++++++++++++----------- Passes.h | 5 +++++ 2 files changed, 30 insertions(+), 11 deletions(-) Index: llvm/include/llvm/CodeGen/MachineDebugInfo.h diff -u llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.44 llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.45 --- llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.44 Tue Oct 24 06:50:43 2006 +++ llvm/include/llvm/CodeGen/MachineDebugInfo.h Tue Nov 7 13:33:46 2006 @@ -969,8 +969,11 @@ // Lines - List of of source line correspondence. std::vector Lines; - // LabelID - Current number assigned to unique label numbers. - unsigned LabelID; + // LabelIDList - One entry per assigned label. Normally the entry is equal to + // the list index(+1). If the entry is zero then the label has been deleted. + // Any other value indicates the label has been deleted by is mapped to + // another label. + std::vector LabelIDList; // ScopeMap - Tracks the scopes in the current function. std::map ScopeMap; @@ -979,10 +982,6 @@ // DebugScope *RootScope; - // DeletedLabelIDs - Sorted list of label IDs that have been removed from the - // module. - std::vector DeletedLabelIDs; - // FrameMoves - List of moves done by a function's prolog. Used to construct // frame maps by debug consumers. std::vector FrameMoves; @@ -1026,7 +1025,11 @@ /// NextLabelID - Return the next unique label id. /// - unsigned NextLabelID() { return ++LabelID; } + unsigned NextLabelID() { + unsigned ID = LabelIDList.size() + 1; + LabelIDList.push_back(ID); + return ID; + } /// RecordLabel - Records location information and associates it with a /// debug label. Returns a unique label ID used to generate a label and @@ -1035,11 +1038,22 @@ /// InvalidateLabel - Inhibit use of the specified label # from /// MachineDebugInfo, for example because the code was deleted. - void InvalidateLabel(unsigned LabelID); + void InvalidateLabel(unsigned LabelID) { + // Remap to zero to indicate deletion. + RemapLabel(LabelID, 0); + } + + /// RemapLabel - Indicate that a label has been merged into another. + /// + void RemapLabel(unsigned OldLabelID, unsigned NewLabelID) { + LabelIDList[OldLabelID - 1] = NewLabelID; + } - /// isLabelValid - Check to make sure the label is still valid before - /// attempting to use. - bool isLabelValid(unsigned LabelID); + /// MappedLabel - Find out the label's final ID. Zero indicates deletion. + /// ID != Mapped ID indicates that the label was folded into another label. + unsigned MappedLabel(unsigned LabelID) const { + return LabelIDList[LabelID - 1]; + } /// RecordSource - Register a source file with debug info. Returns an source /// ID. Index: llvm/include/llvm/CodeGen/Passes.h diff -u llvm/include/llvm/CodeGen/Passes.h:1.21 llvm/include/llvm/CodeGen/Passes.h:1.22 --- llvm/include/llvm/CodeGen/Passes.h:1.21 Sun Oct 23 23:13:21 2005 +++ llvm/include/llvm/CodeGen/Passes.h Tue Nov 7 13:33:46 2006 @@ -81,6 +81,11 @@ /// branches. FunctionPass *createBranchFoldingPass(); + /// DebugLabelFoldingPass - This pass prunes out redundant debug labels. This + /// allows a debug emitter to determine if the range of two labels is empty, + /// by seeing if the labels map to the same reduced label. + FunctionPass *createDebugLabelFoldingPass(); + /// MachineCodeDeletion Pass - This pass deletes all of the machine code for /// the current function, which should happen after the function has been /// emitted to a .s file or to memory. From jlaskey at apple.com Tue Nov 7 14:00:22 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 7 Nov 2006 14:00:22 -0600 Subject: [llvm-commits] CVS: nightlytest-serverside/ProgramResults.php Message-ID: <200611072000.kA7K0MOT017764@zion.cs.uiuc.edu> Changes in directory nightlytest-serverside: ProgramResults.php updated: 1.100 -> 1.101 --- Log message: Fix heading selector. --- Diffs of the changes: (+1 -1) ProgramResults.php | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: nightlytest-serverside/ProgramResults.php diff -u nightlytest-serverside/ProgramResults.php:1.100 nightlytest-serverside/ProgramResults.php:1.101 --- nightlytest-serverside/ProgramResults.php:1.100 Fri Nov 3 13:52:02 2006 +++ nightlytest-serverside/ProgramResults.php Tue Nov 7 14:00:07 2006 @@ -36,7 +36,7 @@ $category_array=array("GCCAS","Bytecode","LLC compile","LLC\-BETA compile", "JIT codegen","GCC","CBE","LLC", "LLC\-BETA","JIT","GCC\/\s*CBE", "GCC\/\s*LLC", - "GCC\/\s*LLC\-BETA","LLC\/ LLC\-BETA"); + "GCC\/\s*LLC\-BETA","LLC\/\s*LLC\-BETA"); $category_print_array=array("GCCAS","Bytecode","LLC compile","LLC-BETA compile", "JIT codegen","GCC","CBE","LLC", "LLC-BETA","JIT","GCC/ CBE", "GCC/ LLC", From jlaskey at apple.com Tue Nov 7 13:34:03 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 7 Nov 2006 13:34:03 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/MachineDebugInfo.cpp LLVMTargetMachine.cpp DwarfWriter.cpp Message-ID: <200611071934.kA7JY3S9004740@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: MachineDebugInfo.cpp updated: 1.54 -> 1.55 LLVMTargetMachine.cpp updated: 1.4 -> 1.5 DwarfWriter.cpp updated: 1.98 -> 1.99 --- Log message: 1. Add a pass to fold debug label instructions so a debug info client can detect empty ranges. 2. Reorg how MachineDebugInfo maintains changes to debug labels. 3. Have dwarf writer use debug label info to simplify scopes and source line coorespondence. 4. Revert the merging of compile units until I can get the bugs ironed out. --- Diffs of the changes: (+94 -48) DwarfWriter.cpp | 37 +++++++++--------- LLVMTargetMachine.cpp | 3 + MachineDebugInfo.cpp | 102 ++++++++++++++++++++++++++++++++++---------------- 3 files changed, 94 insertions(+), 48 deletions(-) Index: llvm/lib/CodeGen/MachineDebugInfo.cpp diff -u llvm/lib/CodeGen/MachineDebugInfo.cpp:1.54 llvm/lib/CodeGen/MachineDebugInfo.cpp:1.55 --- llvm/lib/CodeGen/MachineDebugInfo.cpp:1.54 Mon Nov 6 07:20:29 2006 +++ llvm/lib/CodeGen/MachineDebugInfo.cpp Tue Nov 7 13:33:46 2006 @@ -10,7 +10,11 @@ #include "llvm/CodeGen/MachineDebugInfo.h" #include "llvm/Constants.h" +#include "llvm/CodeGen/MachineFunctionPass.h" +#include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineLocation.h" +#include "llvm/Target/TargetInstrInfo.h" +#include "llvm/Target/TargetMachine.h" #include "llvm/DerivedTypes.h" #include "llvm/GlobalVariable.h" #include "llvm/Intrinsics.h" @@ -1448,10 +1452,9 @@ , Directories() , SourceFiles() , Lines() -, LabelID(0) +, LabelIDList() , ScopeMap() , RootScope(NULL) -, DeletedLabelIDs() , FrameMoves() {} MachineDebugInfo::~MachineDebugInfo() { @@ -1544,35 +1547,6 @@ return ID; } -static bool LabelUIDComparison(const SourceLineInfo &LI, unsigned UID) { - return LI.getLabelID() < UID; -} - -/// InvalidateLabel - Inhibit use of the specified label # from -/// MachineDebugInfo, for example because the code was deleted. -void MachineDebugInfo::InvalidateLabel(unsigned LabelID) { - // Check source line list first. SourceLineInfo is sorted by LabelID. - std::vector::iterator I = - std::lower_bound(Lines.begin(), Lines.end(), LabelID, LabelUIDComparison); - if (I != Lines.end() && I->getLabelID() == LabelID) { - Lines.erase(I); - return; - } - - // Otherwise add for use by isLabelValid. - std::vector::iterator J = - std::lower_bound(DeletedLabelIDs.begin(), DeletedLabelIDs.end(), LabelID); - DeletedLabelIDs.insert(J, LabelID); -} - -/// isLabelValid - Check to make sure the label is still valid before -/// attempting to use. -bool MachineDebugInfo::isLabelValid(unsigned LabelID) { - std::vector::iterator I = - std::lower_bound(DeletedLabelIDs.begin(), DeletedLabelIDs.end(), LabelID); - return I == DeletedLabelIDs.end() || *I != LabelID; -} - /// RecordSource - Register a source file with debug info. Returns an source /// ID. unsigned MachineDebugInfo::RecordSource(const std::string &Directory, @@ -1642,4 +1616,70 @@ return Slot; } +//===----------------------------------------------------------------------===// +/// DebugLabelFolding pass - This pass prunes out redundant debug labels. This +/// allows a debug emitter to determine if the range of two labels is empty, +/// by seeing if the labels map to the same reduced label. + +namespace llvm { + +struct DebugLabelFolder : public MachineFunctionPass { + virtual bool runOnMachineFunction(MachineFunction &MF); + virtual const char *getPassName() const { return "Debug Label Folder"; } +}; + +bool DebugLabelFolder::runOnMachineFunction(MachineFunction &MF) { + // Get machine debug info. + MachineDebugInfo *MDI = getAnalysisToUpdate(); + if (!MDI) return false; + // Get target instruction info. + const TargetInstrInfo *TII = MF.getTarget().getInstrInfo(); + if (!TII) return false; + // Get target version of the debug label opcode. + unsigned DWARF_LABELOpc = TII->getDWARF_LABELOpcode(); + if (!DWARF_LABELOpc) return false; + + // Track if change is made. + bool MadeChange = false; + // No prior label to begin. + unsigned PriorLabel = 0; + + // Iterate through basic blocks. + for (MachineFunction::iterator BB = MF.begin(), E = MF.end(); + BB != E; ++BB) { + // Iterate through instructions. + for (MachineBasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ) { + // Is it a debug label. + if ((unsigned)I->getOpcode() == DWARF_LABELOpc) { + // The label ID # is always operand #0, an immediate. + unsigned NextLabel = I->getOperand(0).getImm(); + + // If there was an immediate prior label. + if (PriorLabel) { + // Remap the current label to prior label. + MDI->RemapLabel(NextLabel, PriorLabel); + // Delete the current label. + I = BB->erase(I); + // Indicate a change has been made. + MadeChange = true; + continue; + } else { + // Start a new round. + PriorLabel = NextLabel; + } + } else { + // No consecutive labels. + PriorLabel = 0; + } + + ++I; + } + } + + return MadeChange; +} + +FunctionPass *createDebugLabelFoldingPass() { return new DebugLabelFolder(); } + +} Index: llvm/lib/CodeGen/LLVMTargetMachine.cpp diff -u llvm/lib/CodeGen/LLVMTargetMachine.cpp:1.4 llvm/lib/CodeGen/LLVMTargetMachine.cpp:1.5 --- llvm/lib/CodeGen/LLVMTargetMachine.cpp:1.4 Tue Oct 24 11:11:49 2006 +++ llvm/lib/CodeGen/LLVMTargetMachine.cpp Tue Nov 7 13:33:46 2006 @@ -66,6 +66,9 @@ // Branch folding must be run after regalloc and prolog/epilog insertion. if (!Fast) PM.add(createBranchFoldingPass()); + + // Fold redundant debug labels. + PM.add(createDebugLabelFoldingPass()); if (PrintMachineCode) // Print the register-allocated code PM.add(createMachineFunctionPrinterPass(&std::cerr)); Index: llvm/lib/CodeGen/DwarfWriter.cpp diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.98 llvm/lib/CodeGen/DwarfWriter.cpp:1.99 --- llvm/lib/CodeGen/DwarfWriter.cpp:1.98 Tue Nov 7 00:36:36 2006 +++ llvm/lib/CodeGen/DwarfWriter.cpp Tue Nov 7 13:33:46 2006 @@ -1695,15 +1695,18 @@ return Unit; } + /// GetBaseCompileUnit - Get the main compile unit. + /// + CompileUnit *GetBaseCompileUnit() const { + CompileUnit *Unit = CompileUnits[0]; + assert(Unit && "Missing compile unit."); + return Unit; + } + /// FindCompileUnit - Get the compile unit for the given descriptor. /// CompileUnit *FindCompileUnit(CompileUnitDesc *UnitDesc) { -#if 1 - // FIXME - Using only one compile unit. Needs to me fixed at the FE. - CompileUnit *Unit = CompileUnits[0]; -#else CompileUnit *Unit = DescToUnitMap[UnitDesc]; -#endif assert(Unit && "Missing compile unit."); return Unit; } @@ -1859,13 +1862,12 @@ // FIXME - Ignore inlined functions for the time being. if (!Scope->getParent()) continue; - unsigned StartID = Scope->getStartLabelID(); - unsigned EndID = Scope->getEndLabelID(); + unsigned StartID = DebugInfo->MappedLabel(Scope->getStartLabelID()); + unsigned EndID = DebugInfo->MappedLabel(Scope->getEndLabelID()); - // Widen scope if label is discarded. - // FIXME - really need to find a GOOD label if a block is dead. - if (StartID && !DebugInfo->isLabelValid(StartID)) StartID = 0; - if (EndID && !DebugInfo->isLabelValid(EndID)) EndID = 0; + // Ignore empty scopes. + if (StartID == EndID && StartID != 0) continue; + if (Scope->getScopes().empty() && Scope->getVariables().empty()) continue; DIE *ScopeDie = new DIE(DW_TAG_lexical_block); @@ -2084,10 +2086,10 @@ std::vector &Moves) { for (unsigned i = 0, N = Moves.size(); i < N; ++i) { MachineMove *Move = Moves[i]; - unsigned LabelID = Move->getLabelID(); + unsigned LabelID = DebugInfo->MappedLabel(Move->getLabelID()); // Throw out move if the label is invalid. - if (LabelID && !DebugInfo->isLabelValid(LabelID)) continue; + if (!LabelID) continue; const MachineLocation &Dst = Move->getDestination(); const MachineLocation &Src = Move->getSource(); @@ -2307,9 +2309,8 @@ // Construct rows of the address, source, line, column matrix. for (unsigned i = 0, N = LineInfos.size(); i < N; ++i) { const SourceLineInfo &LineInfo = LineInfos[i]; - unsigned LabelID = LineInfo.getLabelID(); - - // Source line labels are validated at the MachineDebugInfo level. + unsigned LabelID = DebugInfo->MappedLabel(LineInfo.getLabelID()); + if (!LabelID) continue; if (DwarfVerbose) { unsigned SourceID = LineInfo.getSourceID(); @@ -2420,6 +2421,7 @@ void EmitFunctionDebugFrame() { if (!TAI->getDwarfRequiresFrameSection()) return; + // Start the dwarf frame section. Asm->SwitchToDataSection(TAI->getDwarfFrameSection()); @@ -2588,7 +2590,8 @@ const UniqueVector CUW = DebugInfo->getCompileUnits(); for (unsigned i = 1, N = CUW.size(); i <= N; ++i) { - CompileUnit *Unit = NewCompileUnit(CUW[i], i); + unsigned ID = DebugInfo->RecordSource(CUW[i]); + CompileUnit *Unit = NewCompileUnit(CUW[i], ID); CompileUnits.push_back(Unit); } } From alenhar2 at cs.uiuc.edu Tue Nov 7 14:35:41 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Tue, 7 Nov 2006 14:35:41 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Message-ID: <200611072035.kA7KZfBH002428@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: TopDownClosure.cpp updated: 1.92 -> 1.93 --- Log message: debug type for DSA TD --- Diffs of the changes: (+1 -1) TopDownClosure.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp diff -u llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.92 llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.93 --- llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.92 Fri Oct 13 12:38:22 2006 +++ llvm/lib/Analysis/DataStructure/TopDownClosure.cpp Tue Nov 7 14:35:11 2006 @@ -13,7 +13,7 @@ // like pointer analysis. // //===----------------------------------------------------------------------===// - +#define DEBUG_TYPE "td_dsa" #include "llvm/Analysis/DataStructure/DataStructure.h" #include "llvm/Module.h" #include "llvm/DerivedTypes.h" From alenhar2 at cs.uiuc.edu Tue Nov 7 14:36:22 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Tue, 7 Nov 2006 14:36:22 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp Message-ID: <200611072036.kA7KaMrM002452@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: DataStructure.cpp updated: 1.248 -> 1.249 --- Log message: Allow loop detection during debug in forwarding nodes, and revert auxcall patch as it make 176.gcc untenable --- Diffs of the changes: (+20 -8) DataStructure.cpp | 28 ++++++++++++++++++++-------- 1 files changed, 20 insertions(+), 8 deletions(-) Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.248 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.249 --- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.248 Thu Nov 2 14:25:49 2006 +++ llvm/lib/Analysis/DataStructure/DataStructure.cpp Tue Nov 7 14:36:02 2006 @@ -62,7 +62,17 @@ DSNode *DSNodeHandle::HandleForwarding() const { assert(N->isForwarding() && "Can only be invoked if forwarding!"); - + DEBUG( + { //assert not looping + DSNode* NH = N; + std::set seen; + while(NH && NH->isForwarding()) { + assert(seen.find(NH) == seen.end() && "Loop detected"); + seen.insert(NH); + NH = NH->ForwardNH.N; + } + } + ); // Handle node forwarding here! DSNode *Next = N->ForwardNH.getNode(); // Cause recursive shrinkage Offset += N->ForwardNH.getOffset(); @@ -421,6 +431,8 @@ /// bool DSNode::mergeTypeInfo(const Type *NewTy, unsigned Offset, bool FoldIfIncompatible) { + DEBUG(std::cerr << "merging " << *NewTy << " at " << Offset + << " with " << *Ty << "\n"); const TargetData &TD = getTargetData(); // Check to make sure the Size member is up-to-date. Size can be one of the // following: @@ -1595,13 +1607,13 @@ for (afc_iterator I = Graph.afc_begin(), E = Graph.afc_end(); I!=E; ++I) if (SCCFinder.PathExistsToClonedNode(*I)) AuxCallToCopy.push_back(&*I); - else if (I->isIndirectCall()){ - //If the call node doesn't have any callees, clone it - std::vector< Function *> List; - I->getCalleeNode()->addFullFunctionList(List); - if (!List.size()) - AuxCallToCopy.push_back(&*I); - } +// else if (I->isIndirectCall()){ +// //If the call node doesn't have any callees, clone it +// std::vector< Function *> List; +// I->getCalleeNode()->addFullFunctionList(List); +// if (!List.size()) +// AuxCallToCopy.push_back(&*I); +// } const DSScalarMap &GSM = Graph.getScalarMap(); for (DSScalarMap::global_iterator GI = GSM.global_begin(), From alenhar2 at cs.uiuc.edu Tue Nov 7 14:39:32 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Tue, 7 Nov 2006 14:39:32 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Local.cpp Message-ID: <200611072039.kA7KdW6f002513@apoc.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/DataStructure: Local.cpp updated: 1.158 -> 1.159 --- Log message: Optionally allow comparison operations from affect DSGraphs --- Diffs of the changes: (+6 -1) Local.cpp | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletion(-) Index: llvm/lib/Analysis/DataStructure/Local.cpp diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.158 llvm/lib/Analysis/DataStructure/Local.cpp:1.159 --- llvm/lib/Analysis/DataStructure/Local.cpp:1.158 Fri Nov 3 11:43:19 2006 +++ llvm/lib/Analysis/DataStructure/Local.cpp Tue Nov 7 14:39:05 2006 @@ -40,6 +40,10 @@ TrackIntegersAsPointers("dsa-track-integers", cl::Hidden, cl::desc("If this is set, track integers as potential pointers")); +static cl::opt +IgnoreSetCC("dsa-ignore-setcc", cl::Hidden, + cl::desc("If this is set, do nothing at pointer comparisons")); + static cl::list AllocList("dsa-alloc-list", cl::value_desc("list"), @@ -336,7 +340,8 @@ void GraphBuilder::visitSetCondInst(SetCondInst &SCI) { if (!isPointerType(SCI.getOperand(0)->getType()) || isa(SCI.getOperand(1))) return; // Only pointers - ScalarMap[SCI.getOperand(0)].mergeWith(getValueDest(*SCI.getOperand(1))); + if(!IgnoreSetCC) + ScalarMap[SCI.getOperand(0)].mergeWith(getValueDest(*SCI.getOperand(1))); } From jlaskey at apple.com Tue Nov 7 14:53:20 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 7 Nov 2006 14:53:20 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/MachineDebugInfo.cpp Message-ID: <200611072053.kA7KrKhE017214@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: MachineDebugInfo.cpp updated: 1.55 -> 1.56 --- Log message: Missed a label map, reverting till covered. --- Diffs of the changes: (+3 -0) MachineDebugInfo.cpp | 3 +++ 1 files changed, 3 insertions(+) Index: llvm/lib/CodeGen/MachineDebugInfo.cpp diff -u llvm/lib/CodeGen/MachineDebugInfo.cpp:1.55 llvm/lib/CodeGen/MachineDebugInfo.cpp:1.56 --- llvm/lib/CodeGen/MachineDebugInfo.cpp:1.55 Tue Nov 7 13:33:46 2006 +++ llvm/lib/CodeGen/MachineDebugInfo.cpp Tue Nov 7 14:53:05 2006 @@ -1629,6 +1629,9 @@ }; bool DebugLabelFolder::runOnMachineFunction(MachineFunction &MF) { + // FIXME - Missing label mapping. + return false; + // Get machine debug info. MachineDebugInfo *MDI = getAnalysisToUpdate(); if (!MDI) return false; From dpatel at apple.com Tue Nov 7 15:32:15 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 7 Nov 2006 15:32:15 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200611072132.kA7LWFqm017881@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp added (r1.1) --- Log message: Add BasicBlockPassManager_New. --- Diffs of the changes: (+56 -0) PassManager.cpp | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 56 insertions(+) Index: llvm/lib/VMCore/PassManager.cpp diff -c /dev/null llvm/lib/VMCore/PassManager.cpp:1.1 *** /dev/null Tue Nov 7 15:32:07 2006 --- llvm/lib/VMCore/PassManager.cpp Tue Nov 7 15:31:57 2006 *************** *** 0 **** --- 1,56 ---- + //===- PassManager.cpp - LLVM Pass Infrastructure Implementation ----------===// + // + // The LLVM Compiler Infrastructure + // + // This file was developed by the LLVM research group and is distributed under + // the University of Illinois Open Source License. See LICENSE.TXT for details. + // + //===----------------------------------------------------------------------===// + // + // This file implements the LLVM Pass Manager infrastructure. + // + //===----------------------------------------------------------------------===// + + + #include "llvm/PassManager.h" + #include "llvm/Function.h" + #include "llvm/Module.h" + + using namespace llvm; + + /// BasicBlockPassManager implementation + + /// Add pass P into PassVector and return TRUE. If this pass is not + /// manageable by this manager then return FALSE. + bool + BasicBlockPassManager_New::addPass (Pass *P) { + + BasicBlockPass *BP = dynamic_cast(P); + if (!BP) + return false; + + // TODO: Check if it suitable to manage P using this BasicBlockPassManager + // or we need another instance of BasicBlockPassManager + + // Add pass + PassVector.push_back(BP); + return true; + } + + /// Execute all of the passes scheduled for execution by invoking + /// runOnBasicBlock method. Keep track of whether any of the passes modifies + /// the function, and if so, return true. + bool + BasicBlockPassManager_New::runOnFunction(Function &F) { + + bool Changed = false; + for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) + for (std::vector::iterator itr = PassVector.begin(), + e = PassVector.end(); itr != e; ++itr) { + Pass *P = *itr; + BasicBlockPass *BP = dynamic_cast(P); + Changed |= BP->runOnBasicBlock(*I); + } + return Changed; + } + From dpatel at apple.com Tue Nov 7 15:32:15 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 7 Nov 2006 15:32:15 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/PassManager.h Message-ID: <200611072132.kA7LWFqU017879@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: PassManager.h updated: 1.15 -> 1.16 --- Log message: Add BasicBlockPassManager_New. --- Diffs of the changes: (+23 -0) PassManager.h | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+) Index: llvm/include/llvm/PassManager.h diff -u llvm/include/llvm/PassManager.h:1.15 llvm/include/llvm/PassManager.h:1.16 --- llvm/include/llvm/PassManager.h:1.15 Sun Sep 3 23:07:39 2006 +++ llvm/include/llvm/PassManager.h Tue Nov 7 15:31:57 2006 @@ -17,6 +17,9 @@ #ifndef LLVM_PASSMANAGER_H #define LLVM_PASSMANAGER_H +#include "llvm/Pass.h" +#include + namespace llvm { class Pass; @@ -85,6 +88,26 @@ bool doFinalization(); }; +/// BasicBlockpassManager_New manages BasicBlockPass. It batches all the +/// pass together and sequence them to process one basic block before +/// processing next basic block. +class BasicBlockPassManager_New: public Pass { + +public: + BasicBlockPassManager_New() { } + + /// Add a pass into a passmanager queue. + bool addPass(Pass *p); + + /// Execute all of the passes scheduled for execution. Keep track of + /// whether any of the passes modifies the function, and if so, return true. + bool runOnFunction(Function &F); + +private: + // Collection of pass that are not yet scheduled + std::vector PassVector; +}; + } // End llvm namespace #endif From jlaskey at apple.com Tue Nov 7 15:37:45 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 7 Nov 2006 15:37:45 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/MachineDebugInfo.cpp Message-ID: <200611072137.kA7Lbj0d017974@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: MachineDebugInfo.cpp updated: 1.56 -> 1.57 --- Log message: Missed a label map, reverting till covered. --- Diffs of the changes: (+0 -3) MachineDebugInfo.cpp | 3 --- 1 files changed, 3 deletions(-) Index: llvm/lib/CodeGen/MachineDebugInfo.cpp diff -u llvm/lib/CodeGen/MachineDebugInfo.cpp:1.56 llvm/lib/CodeGen/MachineDebugInfo.cpp:1.57 --- llvm/lib/CodeGen/MachineDebugInfo.cpp:1.56 Tue Nov 7 14:53:05 2006 +++ llvm/lib/CodeGen/MachineDebugInfo.cpp Tue Nov 7 15:37:31 2006 @@ -1629,9 +1629,6 @@ }; bool DebugLabelFolder::runOnMachineFunction(MachineFunction &MF) { - // FIXME - Missing label mapping. - return false; - // Get machine debug info. MachineDebugInfo *MDI = getAnalysisToUpdate(); if (!MDI) return false; From dpatel at apple.com Tue Nov 7 15:50:06 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 7 Nov 2006 15:50:06 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200611072150.kA7Lo6dG018195@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.1 -> 1.2 --- Log message: Add FunctionPassManager_New. --- Diffs of the changes: (+56 -0) PassManager.cpp | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 56 insertions(+) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.1 llvm/lib/VMCore/PassManager.cpp:1.2 --- llvm/lib/VMCore/PassManager.cpp:1.1 Tue Nov 7 15:31:57 2006 +++ llvm/lib/VMCore/PassManager.cpp Tue Nov 7 15:49:50 2006 @@ -54,3 +54,59 @@ return Changed; } +// FunctionPassManager_New implementation + +/////////////////////////////////////////////////////////////////////////////// +// FunctionPassManager + +/// Add pass P into the pass manager queue. If P is a BasicBlockPass then +/// either use it into active basic block pass manager or create new basic +/// block pass manager to handle pass P. +bool +FunctionPassManager_New::addPass (Pass *P) { + + // If P is a BasicBlockPass then use BasicBlockPassManager_New. + if (BasicBlockPass *BP = dynamic_cast(P)) { + + if (!activeBBPassManager + || !activeBBPassManager->addPass(BP)) { + + activeBBPassManager = new BasicBlockPassManager_New(); + + PassVector.push_back(activeBBPassManager); + assert (!activeBBPassManager->addPass(BP) && + "Unable to add Pass"); + } + return true; + } + + FunctionPass *FP = dynamic_cast(P); + if (!FP) + return false; + + // TODO: Check if it suitable to manage P using this FunctionPassManager + // or we need another instance of BasicBlockPassManager + + PassVector.push_back(FP); + activeBBPassManager = NULL; + return true; +} + +/// Execute all of the passes scheduled for execution by invoking +/// runOnFunction method. Keep track of whether any of the passes modifies +/// the function, and if so, return true. +bool +FunctionPassManager_New::runOnModule(Module &M) { + + bool Changed = false; + for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) + for (std::vector::iterator itr = PassVector.begin(), + e = PassVector.end(); itr != e; ++itr) { + Pass *P = *itr; + FunctionPass *FP = dynamic_cast(P); + Changed |= FP->runOnFunction(*I); + } + return Changed; +} + + From dpatel at apple.com Tue Nov 7 15:50:05 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 7 Nov 2006 15:50:05 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/PassManager.h Message-ID: <200611072150.kA7Lo5Gs018190@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: PassManager.h updated: 1.16 -> 1.17 --- Log message: Add FunctionPassManager_New. --- Diffs of the changes: (+35 -0) PassManager.h | 35 +++++++++++++++++++++++++++++++++++ 1 files changed, 35 insertions(+) Index: llvm/include/llvm/PassManager.h diff -u llvm/include/llvm/PassManager.h:1.16 llvm/include/llvm/PassManager.h:1.17 --- llvm/include/llvm/PassManager.h:1.16 Tue Nov 7 15:31:57 2006 +++ llvm/include/llvm/PassManager.h Tue Nov 7 15:49:50 2006 @@ -108,6 +108,41 @@ std::vector PassVector; }; +/// FunctionPassManager_New manages FunctionPasses and BasicBlockPassManagers. +/// It batches all function passes and basic block pass managers together and +/// sequence them to process one function at a time before processing next +/// function. +class FunctionPassManager_New:public Pass { +public: + FunctionPassManager_New(ModuleProvider *P) { /* TODO */ } + FunctionPassManager_New() { + activeBBPassManager = NULL; + } + ~FunctionPassManager_New() { /* TODO */ }; + + /// add - Add a pass to the queue of passes to run. This passes + /// ownership of the Pass to the PassManager. When the + /// PassManager_X is destroyed, the pass will be destroyed as well, so + /// there is no need to delete the pass. (TODO delete passes.) + /// This implies that all passes MUST be allocated with 'new'. + void add(Pass *P) { /* TODO*/ } + + /// Add pass into the pass manager queue. + bool addPass(Pass *P); + + /// Execute all of the passes scheduled for execution. Keep + /// track of whether any of the passes modifies the function, and if + /// so, return true. + bool runOnModule(Module &M); + +private: + // Collection of pass that are not yet scheduled + std::vector PassVector; + + // Active Pass Managers + BasicBlockPassManager_New *activeBBPassManager; +}; + } // End llvm namespace #endif From jlaskey at apple.com Tue Nov 7 15:59:30 2006 From: jlaskey at apple.com (Jim Laskey) Date: Tue, 7 Nov 2006 15:59:30 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/MachineDebugInfo.cpp Message-ID: <200611072159.kA7LxUvA018335@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: MachineDebugInfo.cpp updated: 1.57 -> 1.58 --- Log message: Accidently reran commit. --- Diffs of the changes: (+3 -0) MachineDebugInfo.cpp | 3 +++ 1 files changed, 3 insertions(+) Index: llvm/lib/CodeGen/MachineDebugInfo.cpp diff -u llvm/lib/CodeGen/MachineDebugInfo.cpp:1.57 llvm/lib/CodeGen/MachineDebugInfo.cpp:1.58 --- llvm/lib/CodeGen/MachineDebugInfo.cpp:1.57 Tue Nov 7 15:37:31 2006 +++ llvm/lib/CodeGen/MachineDebugInfo.cpp Tue Nov 7 15:58:55 2006 @@ -1629,6 +1629,9 @@ }; bool DebugLabelFolder::runOnMachineFunction(MachineFunction &MF) { + // FIXME - Missing label mapping. + return false; + // Get machine debug info. MachineDebugInfo *MDI = getAnalysisToUpdate(); if (!MDI) return false; From dpatel at apple.com Tue Nov 7 16:03:30 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 7 Nov 2006 16:03:30 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/PassManager.h Message-ID: <200611072203.kA7M3UXt018420@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: PassManager.h updated: 1.17 -> 1.18 --- Log message: Add ModulePassManager_New. --- Diffs of the changes: (+23 -0) PassManager.h | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+) Index: llvm/include/llvm/PassManager.h diff -u llvm/include/llvm/PassManager.h:1.17 llvm/include/llvm/PassManager.h:1.18 --- llvm/include/llvm/PassManager.h:1.17 Tue Nov 7 15:49:50 2006 +++ llvm/include/llvm/PassManager.h Tue Nov 7 16:03:15 2006 @@ -143,6 +143,29 @@ BasicBlockPassManager_New *activeBBPassManager; }; +/// FunctionPassManager_New manages FunctionPasses. +/// It batches all Module passes passes and function pass managers together and +/// sequence them to process one module. +class ModulePassManager_New: public Pass { + +public: + ModulePassManager_New() { activeFunctionPassManager = NULL; } + + /// Add a pass into a passmanager queue. + bool addPass(Pass *p); + + /// run - Execute all of the passes scheduled for execution. Keep track of + /// whether any of the passes modifies the module, and if so, return true. + bool runOnModule(Module &M); + +private: + // Collection of pass that are not yet scheduled + std::vector PassVector; + + // Active Pass Manager + FunctionPassManager_New *activeFunctionPassManager; +}; + } // End llvm namespace #endif From dpatel at apple.com Tue Nov 7 16:03:31 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 7 Nov 2006 16:03:31 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200611072203.kA7M3Var018426@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.2 -> 1.3 --- Log message: Add ModulePassManager_New. --- Diffs of the changes: (+54 -1) PassManager.cpp | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 54 insertions(+), 1 deletion(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.2 llvm/lib/VMCore/PassManager.cpp:1.3 --- llvm/lib/VMCore/PassManager.cpp:1.2 Tue Nov 7 15:49:50 2006 +++ llvm/lib/VMCore/PassManager.cpp Tue Nov 7 16:03:15 2006 @@ -85,7 +85,7 @@ return false; // TODO: Check if it suitable to manage P using this FunctionPassManager - // or we need another instance of BasicBlockPassManager + // or we need another instance of FunctionPassManager PassVector.push_back(FP); activeBBPassManager = NULL; @@ -110,3 +110,56 @@ } +// ModulePassManager implementation + +/// Add P into pass vector if it is manageble. If P is a FunctionPass +/// then use FunctionPassManager_New to manage it. Return FALSE if P +/// is not manageable by this manager. +bool +ModulePassManager_New::addPass (Pass *P) { + + // If P is FunctionPass then use function pass maanager. + if (FunctionPass *FP = dynamic_cast(P)) { + + activeFunctionPassManager = NULL; + + if (!activeFunctionPassManager + || !activeFunctionPassManager->addPass(P)) { + + activeFunctionPassManager = new FunctionPassManager_New(); + + PassVector.push_back(activeFunctionPassManager); + assert (!activeFunctionPassManager->addPass(FP) && + "Unable to add Pass"); + } + return true; + } + + ModulePass *MP = dynamic_cast(P); + if (!MP) + return false; + + // TODO: Check if it suitable to manage P using this ModulePassManager + // or we need another instance of ModulePassManager + + PassVector.push_back(MP); + activeFunctionPassManager = NULL; + return true; +} + + +/// Execute all of the passes scheduled for execution by invoking +/// runOnModule method. Keep track of whether any of the passes modifies +/// the module, and if so, return true. +bool +ModulePassManager_New::runOnModule(Module &M) { + bool Changed = false; + for (std::vector::iterator itr = PassVector.begin(), + e = PassVector.end(); itr != e; ++itr) { + Pass *P = *itr; + ModulePass *MP = dynamic_cast(P); + Changed |= MP->runOnModule(M); + } + return Changed; +} + From evan.cheng at apple.com Tue Nov 7 16:14:44 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 7 Nov 2006 16:14:44 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp X86ISelLowering.h X86InstrSSE.td Message-ID: <200611072214.kA7MEic1018613@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.287 -> 1.288 X86ISelLowering.h updated: 1.78 -> 1.79 X86InstrSSE.td updated: 1.169 -> 1.170 --- Log message: Fixed a bug which causes x86 be to incorrectly match shuffle v, undef, <2, ?, 3, ?> to movhlps It should match to unpckhps instead. Added proper matching code for shuffle v, undef, <2, 3, 2, 3> --- Diffs of the changes: (+30 -5) X86ISelLowering.cpp | 18 +++++++++++++++++- X86ISelLowering.h | 5 +++++ X86InstrSSE.td | 12 ++++++++---- 3 files changed, 30 insertions(+), 5 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.287 llvm/lib/Target/X86/X86ISelLowering.cpp:1.288 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.287 Thu Nov 2 14:25:49 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Tue Nov 7 16:14:24 2006 @@ -2582,6 +2582,22 @@ isUndefOrEqual(N->getOperand(3), 3); } +/// isMOVHLPS_v_undef_Mask - Special case of isMOVHLPSMask for canonical form +/// of vector_shuffle v, v, <2, 3, 2, 3>, i.e. vector_shuffle v, undef, +/// <2, 3, 2, 3> +bool X86::isMOVHLPS_v_undef_Mask(SDNode *N) { + assert(N->getOpcode() == ISD::BUILD_VECTOR); + + if (N->getNumOperands() != 4) + return false; + + // Expect bit0 == 2, bit1 == 3, bit2 == 2, bit3 == 3 + return isUndefOrEqual(N->getOperand(0), 2) && + isUndefOrEqual(N->getOperand(1), 3) && + isUndefOrEqual(N->getOperand(2), 2) && + isUndefOrEqual(N->getOperand(3), 3); +} + /// isMOVLPMask - Return true if the specified VECTOR_SHUFFLE operand /// specifies a shuffle of elements that is suitable for input to MOVLP{S|D}. bool X86::isMOVLPMask(SDNode *N) { @@ -3724,7 +3740,7 @@ SDOperand Mask = DAG.getNode(ISD::BUILD_VECTOR, MaskVT, &IdxVec[0], IdxVec.size()); Vec = DAG.getNode(ISD::VECTOR_SHUFFLE, Vec.getValueType(), - Vec, Vec, Mask); + Vec, DAG.getNode(ISD::UNDEF, Vec.getValueType()), Mask); return DAG.getNode(ISD::EXTRACT_VECTOR_ELT, VT, Vec, DAG.getConstant(0, getPointerTy())); } else if (MVT::getSizeInBits(VT) == 64) { Index: llvm/lib/Target/X86/X86ISelLowering.h diff -u llvm/lib/Target/X86/X86ISelLowering.h:1.78 llvm/lib/Target/X86/X86ISelLowering.h:1.79 --- llvm/lib/Target/X86/X86ISelLowering.h:1.78 Tue Oct 31 14:13:11 2006 +++ llvm/lib/Target/X86/X86ISelLowering.h Tue Nov 7 16:14:24 2006 @@ -186,6 +186,11 @@ /// specifies a shuffle of elements that is suitable for input to MOVHLPS. bool isMOVHLPSMask(SDNode *N); + /// isMOVHLPS_v_undef_Mask - Special case of isMOVHLPSMask for canonical form + /// of vector_shuffle v, v, <2, 3, 2, 3>, i.e. vector_shuffle v, undef, + /// <2, 3, 2, 3> + bool isMOVHLPS_v_undef_Mask(SDNode *N); + /// isMOVLPMask - Return true if the specified VECTOR_SHUFFLE operand /// specifies a shuffle of elements that is suitable for input to MOVLP{S|D}. bool isMOVLPMask(SDNode *N); Index: llvm/lib/Target/X86/X86InstrSSE.td diff -u llvm/lib/Target/X86/X86InstrSSE.td:1.169 llvm/lib/Target/X86/X86InstrSSE.td:1.170 --- llvm/lib/Target/X86/X86InstrSSE.td:1.169 Fri Nov 3 17:48:56 2006 +++ llvm/lib/Target/X86/X86InstrSSE.td Tue Nov 7 16:14:24 2006 @@ -110,6 +110,10 @@ return X86::isMOVHLPSMask(N); }]>; +def MOVHLPS_v_undef_shuffle_mask : PatLeaf<(build_vector), [{ + return X86::isMOVHLPS_v_undef_Mask(N); +}]>; + def MOVHP_shuffle_mask : PatLeaf<(build_vector), [{ return X86::isMOVHPMask(N); }]>; @@ -1987,16 +1991,16 @@ MOVHLPS_shuffle_mask)), (MOVHLPSrr VR128:$src1, VR128:$src2)>; -// vector_shuffle v1, undef <2, 3, ?, ?> using MOVHLPS +// vector_shuffle v1, undef <2, ?, ?, ?> using MOVHLPS def : Pat<(v4f32 (vector_shuffle VR128:$src1, (undef), - UNPCKH_shuffle_mask)), + MOVHLPS_v_undef_shuffle_mask)), (MOVHLPSrr VR128:$src1, VR128:$src1)>; def : Pat<(v4i32 (vector_shuffle VR128:$src1, (undef), - UNPCKH_shuffle_mask)), + MOVHLPS_v_undef_shuffle_mask)), (MOVHLPSrr VR128:$src1, VR128:$src1)>; } - let AddedComplexity = 20 in { +let AddedComplexity = 20 in { // vector_shuffle v1, (load v2) <4, 5, 2, 3> using MOVLPS // vector_shuffle v1, (load v2) <0, 1, 4, 5> using MOVHPS def : Pat<(v4f32 (vector_shuffle VR128:$src1, (loadv4f32 addr:$src2), From dpatel at apple.com Tue Nov 7 16:23:57 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 7 Nov 2006 16:23:57 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200611072223.kA7MNvtH018870@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.3 -> 1.4 --- Log message: Add PassManager_New. --- Diffs of the changes: (+41 -0) PassManager.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ 1 files changed, 41 insertions(+) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.3 llvm/lib/VMCore/PassManager.cpp:1.4 --- llvm/lib/VMCore/PassManager.cpp:1.3 Tue Nov 7 16:03:15 2006 +++ llvm/lib/VMCore/PassManager.cpp Tue Nov 7 16:23:34 2006 @@ -163,3 +163,44 @@ return Changed; } +/// Schedule all passes from the queue by adding them in their +/// respective manager's queue. +void +PassManager_New::schedulePasses() { + /* TODO */ +} + +/// Add pass P to the queue of passes to run. +void +PassManager_New::add(Pass *P) { + /* TODO */ +} + +// PassManager_New implementation +/// Add P into active pass manager or use new module pass manager to +/// manage it. +bool +PassManager_New::addPass (Pass *P) { + + if (!activeManager) { + activeManager = new ModulePassManager_New(); + PassManagers.push_back(activeManager); + } + + return activeManager->addPass(P); +} + +/// run - Execute all of the passes scheduled for execution. Keep track of +/// whether any of the passes modifies the module, and if so, return true. +bool +PassManager_New::run(Module &M) { + + schedulePasses(); + bool Changed = false; + for (std::vector::iterator itr = PassManagers.begin(), + e = PassManagers.end(); itr != e; ++itr) { + ModulePassManager_New *pm = *itr; + Changed |= pm->runOnModule(M); + } + return Changed; +} From dpatel at apple.com Tue Nov 7 16:23:57 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 7 Nov 2006 16:23:57 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/PassManager.h Message-ID: <200611072223.kA7MNvuA018871@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: PassManager.h updated: 1.19 -> 1.20 --- Log message: Add PassManager_New. --- Diffs of the changes: (+34 -0) PassManager.h | 34 ++++++++++++++++++++++++++++++++++ 1 files changed, 34 insertions(+) Index: llvm/include/llvm/PassManager.h diff -u llvm/include/llvm/PassManager.h:1.19 llvm/include/llvm/PassManager.h:1.20 --- llvm/include/llvm/PassManager.h:1.19 Tue Nov 7 16:04:53 2006 +++ llvm/include/llvm/PassManager.h Tue Nov 7 16:23:34 2006 @@ -166,6 +166,40 @@ FunctionPassManager_New *activeFunctionPassManager; }; +/// PassManager_New manages ModulePassManagers +class PassManager_New: public Pass { + +public: + + /// add - Add a pass to the queue of passes to run. This passes ownership of + /// the Pass to the PassManager. When the PassManager is destroyed, the pass + /// will be destroyed as well, so there is no need to delete the pass. This + /// implies that all passes MUST be allocated with 'new'. + void add(Pass *P); + + /// run - Execute all of the passes scheduled for execution. Keep track of + /// whether any of the passes modifies the module, and if so, return true. + bool run(Module &M); + +private: + + /// Add a pass into a passmanager queue. This is used by schedulePasses + bool addPass(Pass *p); + + /// Schedule all passes collected in pass queue using add(). Add all the + /// schedule passes into various manager's queue using addPass(). + void schedulePasses(); + + // Collection of pass managers + std::vector PassManagers; + + // Collection of pass that are not yet scheduled + std::vector PassVector; + + // Active Pass Manager + ModulePassManager_New *activeManager; +}; + } // End llvm namespace #endif From dpatel at apple.com Tue Nov 7 16:35:45 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 7 Nov 2006 16:35:45 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/PassManager.h Message-ID: <200611072235.kA7MZjCi019148@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: PassManager.h updated: 1.20 -> 1.21 --- Log message: Introduce PassManagerAnalysisHelper. --- Diffs of the changes: (+30 -0) PassManager.h | 30 ++++++++++++++++++++++++++++++ 1 files changed, 30 insertions(+) Index: llvm/include/llvm/PassManager.h diff -u llvm/include/llvm/PassManager.h:1.20 llvm/include/llvm/PassManager.h:1.21 --- llvm/include/llvm/PassManager.h:1.20 Tue Nov 7 16:23:34 2006 +++ llvm/include/llvm/PassManager.h Tue Nov 7 16:35:17 2006 @@ -88,6 +88,36 @@ bool doFinalization(); }; +/// PassManagerAnalysisHelper helpes pass manager analysis required by +/// the managed passes. +class PassManagerAnalysisHelper { + +public: + + /// Return TRUE IFF pass P's required analysis set does not required new + /// manager. + bool manageablePass(Pass *P); + + /// Return TRUE iff AnalysisID AID is currently available. + bool analysisCurrentlyAvailable(AnalysisID AID); + + /// Augment RequiredSet by adding analysis required by pass P. + void noteDownRequiredAnalysis(Pass *P); + + /// Remove AnalysisID from the RequiredSet + void removeAnalysis(AnalysisID AID); + + /// Remove Analysis that is not preserved by the pass + void removeNotPreservedAnalysis(Pass *P); + + /// Remove dead passes + void removeDeadPasses() { /* TODO : Implement */ } + +private: + // Required set of analysis for the passes managed by this manager + std::vector RequiredSet; +}; + /// BasicBlockpassManager_New manages BasicBlockPass. It batches all the /// pass together and sequence them to process one basic block before /// processing next basic block. From dpatel at apple.com Tue Nov 7 16:35:45 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 7 Nov 2006 16:35:45 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200611072235.kA7MZjED019149@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.4 -> 1.5 --- Log message: Introduce PassManagerAnalysisHelper. --- Diffs of the changes: (+40 -0) PassManager.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 40 insertions(+) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.4 llvm/lib/VMCore/PassManager.cpp:1.5 --- llvm/lib/VMCore/PassManager.cpp:1.4 Tue Nov 7 16:23:34 2006 +++ llvm/lib/VMCore/PassManager.cpp Tue Nov 7 16:35:17 2006 @@ -18,6 +18,46 @@ using namespace llvm; +// PassManagerAnalysisHelper implementation + +/// Return TRUE IFF pass P's required analysis set does not required new +/// manager. +bool PassManagerAnalysisHelper::manageablePass(Pass *P) { + + AnalysisUsage AnUsage; + P->getAnalysisUsage(AnUsage); + + // If this pass is not preserving information that is required by the other passes + // managed by this manager then use new manager + // TODO + return true; +} + +/// Return TRUE iff AnalysisID AID is currently available. +bool PassManagerAnalysisHelper::analysisCurrentlyAvailable(AnalysisID AID) { + + // TODO + return false; +} + +/// Augment RequiredSet by adding analysis required by pass P. +void PassManagerAnalysisHelper::noteDownRequiredAnalysis(Pass *P) { + + // TODO +} + +/// Remove AnalysisID from the RequiredSet +void PassManagerAnalysisHelper::removeAnalysis(AnalysisID AID) { + + // TODO +} + +/// Remove Analyss not preserved by Pass P +void PassManagerAnalysisHelper::removeNotPreservedAnalysis(Pass *P) { + + // TODO +} + /// BasicBlockPassManager implementation /// Add pass P into PassVector and return TRUE. If this pass is not From sabre at nondot.org Tue Nov 7 16:43:02 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 7 Nov 2006 16:43:02 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Message-ID: <200611072243.kA7Mh2s5019363@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: ScalarReplAggregates.cpp updated: 1.47 -> 1.48 --- Log message: scalarrepl should not split the two elements of the vsiidx array: int func(vFloat v0, vFloat v1) { int ii; vSInt32 vsiidx[2]; vsiidx[0] = _mm_cvttps_epi32(v0); vsiidx[1] = _mm_cvttps_epi32(v1); ii = ((int *) vsiidx)[4]; return ii; } This fixes Transforms/ScalarRepl/2006-11-07-InvalidArrayPromote.ll --- Diffs of the changes: (+7 -3) ScalarReplAggregates.cpp | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.47 llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.48 --- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.47 Thu Nov 2 14:25:50 2006 +++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Tue Nov 7 16:42:47 2006 @@ -316,9 +316,13 @@ // // Scalar replacing *just* the outer index of the array is probably not // going to be a win anyway, so just give up. - for (++I; I != E && isa(*I); ++I) { - const ArrayType *SubArrayTy = cast(*I); - uint64_t NumElements = SubArrayTy->getNumElements(); + for (++I; I != E && (isa(*I) || isa(*I)); ++I) { + uint64_t NumElements; + if (const ArrayType *SubArrayTy = dyn_cast(*I)) + NumElements = SubArrayTy->getNumElements(); + else + NumElements = cast(*I)->getNumElements(); + if (!isa(I.getOperand())) return 0; if (cast(I.getOperand())->getZExtValue() >= NumElements) return 0; From dpatel at apple.com Tue Nov 7 16:45:10 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 7 Nov 2006 16:45:10 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/PassManager.h Message-ID: <200611072245.kA7MjADG019400@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: PassManager.h updated: 1.21 -> 1.22 --- Log message: Derive new pass managers from PassManagerAnalysisHelper. --- Diffs of the changes: (+8 -4) PassManager.h | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) Index: llvm/include/llvm/PassManager.h diff -u llvm/include/llvm/PassManager.h:1.21 llvm/include/llvm/PassManager.h:1.22 --- llvm/include/llvm/PassManager.h:1.21 Tue Nov 7 16:35:17 2006 +++ llvm/include/llvm/PassManager.h Tue Nov 7 16:44:55 2006 @@ -121,7 +121,8 @@ /// BasicBlockpassManager_New manages BasicBlockPass. It batches all the /// pass together and sequence them to process one basic block before /// processing next basic block. -class BasicBlockPassManager_New: public Pass { +class BasicBlockPassManager_New: public Pass, + public PassManagerAnalysisHelper { public: BasicBlockPassManager_New() { } @@ -142,7 +143,8 @@ /// It batches all function passes and basic block pass managers together and /// sequence them to process one function at a time before processing next /// function. -class FunctionPassManager_New:public Pass { +class FunctionPassManager_New: public Pass, + public PassManagerAnalysisHelper { public: FunctionPassManager_New(ModuleProvider *P) { /* TODO */ } FunctionPassManager_New() { @@ -176,7 +178,8 @@ /// ModulePassManager_New manages ModulePasses and function pass managers. /// It batches all Module passes passes and function pass managers together and /// sequence them to process one module. -class ModulePassManager_New: public Pass { +class ModulePassManager_New: public Pass, + public PassManagerAnalysisHelper { public: ModulePassManager_New() { activeFunctionPassManager = NULL; } @@ -197,7 +200,8 @@ }; /// PassManager_New manages ModulePassManagers -class PassManager_New: public Pass { +class PassManager_New: public Pass, + public PassManagerAnalysisHelper { public: From dpatel at apple.com Tue Nov 7 16:05:08 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 7 Nov 2006 16:05:08 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/PassManager.h Message-ID: <200611072205.kA7M58mg018464@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: PassManager.h updated: 1.18 -> 1.19 --- Log message: Fix comment. --- Diffs of the changes: (+1 -1) PassManager.h | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/PassManager.h diff -u llvm/include/llvm/PassManager.h:1.18 llvm/include/llvm/PassManager.h:1.19 --- llvm/include/llvm/PassManager.h:1.18 Tue Nov 7 16:03:15 2006 +++ llvm/include/llvm/PassManager.h Tue Nov 7 16:04:53 2006 @@ -143,7 +143,7 @@ BasicBlockPassManager_New *activeBBPassManager; }; -/// FunctionPassManager_New manages FunctionPasses. +/// ModulePassManager_New manages ModulePasses and function pass managers. /// It batches all Module passes passes and function pass managers together and /// sequence them to process one module. class ModulePassManager_New: public Pass { From dpatel at apple.com Tue Nov 7 16:57:19 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 7 Nov 2006 16:57:19 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200611072257.kA7MvJjp019600@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.5 -> 1.6 --- Log message: Update new pass managers to use PassManagerAnalysisHelper API. --- Diffs of the changes: (+21 -6) PassManager.cpp | 27 +++++++++++++++++++++------ 1 files changed, 21 insertions(+), 6 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.5 llvm/lib/VMCore/PassManager.cpp:1.6 --- llvm/lib/VMCore/PassManager.cpp:1.5 Tue Nov 7 16:35:17 2006 +++ llvm/lib/VMCore/PassManager.cpp Tue Nov 7 16:56:50 2006 @@ -69,8 +69,13 @@ if (!BP) return false; - // TODO: Check if it suitable to manage P using this BasicBlockPassManager - // or we need another instance of BasicBlockPassManager + // If this pass does not preserve anlysis that is used by other passes + // managed by this manager than it is not a suiable pass for this manager. + if (!manageablePass (P)) + return false; + + // Take a note of analysis required by this pass. + noteDownRequiredAnalysis(P); // Add pass PassVector.push_back(BP); @@ -124,8 +129,13 @@ if (!FP) return false; - // TODO: Check if it suitable to manage P using this FunctionPassManager - // or we need another instance of FunctionPassManager + // If this pass does not preserve anlysis that is used by other passes + // managed by this manager than it is not a suiable pass for this manager. + if (!manageablePass (P)) + return false; + + // Take a note of analysis required by this pass. + noteDownRequiredAnalysis(P); PassVector.push_back(FP); activeBBPassManager = NULL; @@ -179,8 +189,13 @@ if (!MP) return false; - // TODO: Check if it suitable to manage P using this ModulePassManager - // or we need another instance of ModulePassManager + // If this pass does not preserve anlysis that is used by other passes + // managed by this manager than it is not a suiable pass for this manager. + if (!manageablePass (P)) + return false; + + // Take a note of analysis required by this pass. + noteDownRequiredAnalysis(P); PassVector.push_back(MP); activeFunctionPassManager = NULL; From evan.cheng at apple.com Tue Nov 7 16:18:32 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 7 Nov 2006 16:18:32 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/vec_shuffle-10.ll unpcklps.ll Message-ID: <200611072218.kA7MIWU9018776@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/X86: vec_shuffle-10.ll added (r1.1) unpcklps.ll (r1.1) removed --- Log message: New test case. --- Diffs of the changes: (+25 -0) vec_shuffle-10.ll | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+) Index: llvm/test/Regression/CodeGen/X86/vec_shuffle-10.ll diff -c /dev/null llvm/test/Regression/CodeGen/X86/vec_shuffle-10.ll:1.1 *** /dev/null Tue Nov 7 16:18:24 2006 --- llvm/test/Regression/CodeGen/X86/vec_shuffle-10.ll Tue Nov 7 16:18:14 2006 *************** *** 0 **** --- 1,25 ---- + ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 && + ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep unpcklps | wc -l | grep 1 && + ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | grep unpckhps | wc -l | grep 1 && + ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2 | not grep 'sub.*esp' + + void %test(<4 x float>* %res, <4 x float>* %A, <4 x float>* %B) { + %tmp = load <4 x float>* %B ; <<4 x float>> [#uses=2] + %tmp3 = load <4 x float>* %A ; <<4 x float>> [#uses=2] + %tmp = extractelement <4 x float> %tmp3, uint 0 ; [#uses=1] + %tmp7 = extractelement <4 x float> %tmp, uint 0 ; [#uses=1] + %tmp8 = extractelement <4 x float> %tmp3, uint 1 ; [#uses=1] + %tmp9 = extractelement <4 x float> %tmp, uint 1 ; [#uses=1] + %tmp10 = insertelement <4 x float> undef, float %tmp, uint 0 ; <<4 x float>> [#uses=1] + %tmp11 = insertelement <4 x float> %tmp10, float %tmp7, uint 1 ; <<4 x float>> [#uses=1] + %tmp12 = insertelement <4 x float> %tmp11, float %tmp8, uint 2 ; <<4 x float>> [#uses=1] + %tmp13 = insertelement <4 x float> %tmp12, float %tmp9, uint 3 ; <<4 x float>> [#uses=1] + store <4 x float> %tmp13, <4 x float>* %res + ret void + } + + void %test2(<4 x float> %X, <4 x float>* %res) { + %tmp5 = shufflevector <4 x float> %X, <4 x float> undef, <4 x uint> < uint 2, uint 6, uint 3, uint 7 > + store <4 x float> %tmp5, <4 x float>* %res + ret void + } From alenhar2 at cs.uiuc.edu Tue Nov 7 17:17:51 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Tue, 7 Nov 2006 17:17:51 -0600 Subject: [llvm-commits] CVS: llvm-test/Makefile.rules Message-ID: <200611072317.kA7NHpYt019978@zion.cs.uiuc.edu> Changes in directory llvm-test: Makefile.rules updated: 1.17 -> 1.18 --- Log message: analyze went away --- Diffs of the changes: (+0 -1) Makefile.rules | 1 - 1 files changed, 1 deletion(-) Index: llvm-test/Makefile.rules diff -u llvm-test/Makefile.rules:1.17 llvm-test/Makefile.rules:1.18 --- llvm-test/Makefile.rules:1.17 Tue Sep 19 11:59:51 2006 +++ llvm-test/Makefile.rules Tue Nov 7 17:17:30 2006 @@ -279,7 +279,6 @@ LOPT = $(LLVMTOOLCURRENT)/opt$(EXEEXT) LLINK = $(LLVMTOOLCURRENT)/llvm-link$(EXEEXT) LPROF = $(LLVMTOOLCURRENT)/llvm-prof$(EXEEXT) -LANALYZE = $(LLVMTOOLCURRENT)/analyze$(EXEEXT) LBUGPOINT = $(LLVMTOOLCURRENT)/bugpoint$(EXEEXT) LLVMC = $(LLVMTOOLCURRENT)/llvmc$(EXEEXT) From alenhar2 at cs.uiuc.edu Tue Nov 7 17:23:44 2006 From: alenhar2 at cs.uiuc.edu (Andrew Lenharth) Date: Tue, 7 Nov 2006 17:23:44 -0600 Subject: [llvm-commits] CVS: llvm-test/TEST.dsgraph.Makefile TEST.dsgraph.report Message-ID: <200611072323.kA7NNipt020093@zion.cs.uiuc.edu> Changes in directory llvm-test: TEST.dsgraph.Makefile updated: 1.17 -> 1.18 TEST.dsgraph.report updated: 1.14 -> 1.15 --- Log message: analyze is gone --- Diffs of the changes: (+5 -5) TEST.dsgraph.Makefile | 8 ++++---- TEST.dsgraph.report | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) Index: llvm-test/TEST.dsgraph.Makefile diff -u llvm-test/TEST.dsgraph.Makefile:1.17 llvm-test/TEST.dsgraph.Makefile:1.18 --- llvm-test/TEST.dsgraph.Makefile:1.17 Fri Mar 25 20:04:44 2005 +++ llvm-test/TEST.dsgraph.Makefile Tue Nov 7 17:23:25 2006 @@ -18,10 +18,10 @@ MEM := -track-memory -time-passes $(PROGRAMS_TO_TEST:%=Output/%.$(TEST).report.txt): \ -Output/%.$(TEST).report.txt: Output/%.lib.bc Output/%.LOC.txt $(LANALYZE) $(LOPT) +Output/%.$(TEST).report.txt: Output/%.lib.bc Output/%.LOC.txt $(LOPT) @# Gather data - -($(LANALYZE) -$(PASS)datastructure $(ANALYZE_OPTS) $<)> $@.time.1 2>&1 - -($(LANALYZE) $(MEM) -$(PASS)datastructure -disable-verify $<)> $@.mem.1 2>&1 + -($(LOPT) -analyze -$(PASS)datastructure $(ANALYZE_OPTS) $<)> $@.time.1 2>&1 + -($(LOPT) -analyze $(MEM) -$(PASS)datastructure -disable-verify $<)> $@.mem.1 2>&1 -($(LOPT) -steens-aa -time-passes -disable-output $<) > $@.time.2 2>&1 -($(LOPT) -steens-aa $(MEM) -disable-output $<) > $@.mem.2 2>&1 @# Emit data. @@ -74,5 +74,5 @@ # Define REPORT_DEPENDENCIES so that the report is regenerated if analyze or # dummylib is updated. # -REPORT_DEPENDENCIES := $(DUMMYLIB) $(LANALYZE) $(LOPT) +REPORT_DEPENDENCIES := $(DUMMYLIB) $(LOPT) Index: llvm-test/TEST.dsgraph.report diff -u llvm-test/TEST.dsgraph.report:1.14 llvm-test/TEST.dsgraph.report:1.15 --- llvm-test/TEST.dsgraph.report:1.14 Fri Mar 25 20:04:44 2005 +++ llvm-test/TEST.dsgraph.report Tue Nov 7 17:23:25 2006 @@ -28,7 +28,7 @@ $TS = 0 if ($TS eq "*"); $NTS = 0 if ($NTS eq "*"); - if ($TS + NTS != 0) { + if ($TS + $NTS != 0) { return sprintf("%4.1f%%", 100*$TS/($TS+$NTS+0.0)); } else { return "n/a"; From sabre at nondot.org Tue Nov 7 16:42:50 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 7 Nov 2006 16:42:50 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/ScalarRepl/2006-11-07-InvalidArrayPromote.ll Message-ID: <200611072242.kA7MgopT019352@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/ScalarRepl: 2006-11-07-InvalidArrayPromote.ll added (r1.1) --- Log message: scalarrepl should not split the two elements of the vsiidx array: int func(vFloat v0, vFloat v1) { int ii; vSInt32 vsiidx[2]; vsiidx[0] = _mm_cvttps_epi32(v0); vsiidx[1] = _mm_cvttps_epi32(v1); ii = ((int *) vsiidx)[4]; return ii; } --- Diffs of the changes: (+19 -0) 2006-11-07-InvalidArrayPromote.ll | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+) Index: llvm/test/Regression/Transforms/ScalarRepl/2006-11-07-InvalidArrayPromote.ll diff -c /dev/null llvm/test/Regression/Transforms/ScalarRepl/2006-11-07-InvalidArrayPromote.ll:1.1 *** /dev/null Tue Nov 7 16:42:39 2006 --- llvm/test/Regression/Transforms/ScalarRepl/2006-11-07-InvalidArrayPromote.ll Tue Nov 7 16:42:29 2006 *************** *** 0 **** --- 1,19 ---- + ; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis && + ; RUN: llvm-as < %s | opt -scalarrepl | llvm-dis | grep -F 'alloca [2 x <4 x int>]' + + int %func(<4 x float> %v0, <4 x float> %v1) { + %vsiidx = alloca [2 x <4 x int>], align 16 ; <[2 x <4 x int>]*> [#uses=3] + %tmp = call <4 x int> %llvm.x86.sse2.cvttps2dq( <4 x float> %v0 ) ; <<4 x int>> [#uses=2] + %tmp = cast <4 x int> %tmp to <2 x long> ; <<2 x long>> [#uses=0] + %tmp = getelementptr [2 x <4 x int>]* %vsiidx, int 0, int 0 ; <<4 x int>*> [#uses=1] + store <4 x int> %tmp, <4 x int>* %tmp + %tmp10 = call <4 x int> %llvm.x86.sse2.cvttps2dq( <4 x float> %v1 ) ; <<4 x int>> [#uses=2] + %tmp10 = cast <4 x int> %tmp10 to <2 x long> ; <<2 x long>> [#uses=0] + %tmp14 = getelementptr [2 x <4 x int>]* %vsiidx, int 0, int 1 ; <<4 x int>*> [#uses=1] + store <4 x int> %tmp10, <4 x int>* %tmp14 + %tmp15 = getelementptr [2 x <4 x int>]* %vsiidx, int 0, int 0, int 4 ; [#uses=1] + %tmp = load int* %tmp15 ; [#uses=1] + ret int %tmp + } + + declare <4 x int> %llvm.x86.sse2.cvttps2dq(<4 x float>) From dpatel at apple.com Tue Nov 7 18:19:55 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 7 Nov 2006 18:19:55 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/PassManager.h Message-ID: <200611080019.kA80Jtho020938@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: PassManager.h updated: 1.22 -> 1.23 --- Log message: Beautify. Clarify comments. --- Diffs of the changes: (+17 -16) PassManager.h | 33 +++++++++++++++++---------------- 1 files changed, 17 insertions(+), 16 deletions(-) Index: llvm/include/llvm/PassManager.h diff -u llvm/include/llvm/PassManager.h:1.22 llvm/include/llvm/PassManager.h:1.23 --- llvm/include/llvm/PassManager.h:1.22 Tue Nov 7 16:44:55 2006 +++ llvm/include/llvm/PassManager.h Tue Nov 7 18:19:31 2006 @@ -88,17 +88,18 @@ bool doFinalization(); }; -/// PassManagerAnalysisHelper helpes pass manager analysis required by -/// the managed passes. +/// PassManagerAnalysisHelper helps pass manager analysis required by +/// the managed passes. It provides methods to add/remove analysis +/// available and query if certain analysis is available or not. class PassManagerAnalysisHelper { public: - /// Return TRUE IFF pass P's required analysis set does not required new + /// Return true IFF pass P's required analysis set does not required new /// manager. bool manageablePass(Pass *P); - /// Return TRUE iff AnalysisID AID is currently available. + /// Return true IFF AnalysisID AID is currently available. bool analysisCurrentlyAvailable(AnalysisID AID); /// Augment RequiredSet by adding analysis required by pass P. @@ -118,11 +119,11 @@ std::vector RequiredSet; }; -/// BasicBlockpassManager_New manages BasicBlockPass. It batches all the +/// BasicBlockPassManager_New manages BasicBlockPass. It batches all the /// pass together and sequence them to process one basic block before /// processing next basic block. -class BasicBlockPassManager_New: public Pass, - public PassManagerAnalysisHelper { +class BasicBlockPassManager_New : public Pass, + public PassManagerAnalysisHelper { public: BasicBlockPassManager_New() { } @@ -135,7 +136,7 @@ bool runOnFunction(Function &F); private: - // Collection of pass that are not yet scheduled + // Collection of pass that are managed by this manager std::vector PassVector; }; @@ -143,8 +144,8 @@ /// It batches all function passes and basic block pass managers together and /// sequence them to process one function at a time before processing next /// function. -class FunctionPassManager_New: public Pass, - public PassManagerAnalysisHelper { +class FunctionPassManager_New : public Pass, + public PassManagerAnalysisHelper { public: FunctionPassManager_New(ModuleProvider *P) { /* TODO */ } FunctionPassManager_New() { @@ -168,7 +169,7 @@ bool runOnModule(Module &M); private: - // Collection of pass that are not yet scheduled + // Collection of pass that are manged by this manager std::vector PassVector; // Active Pass Managers @@ -178,8 +179,8 @@ /// ModulePassManager_New manages ModulePasses and function pass managers. /// It batches all Module passes passes and function pass managers together and /// sequence them to process one module. -class ModulePassManager_New: public Pass, - public PassManagerAnalysisHelper { +class ModulePassManager_New : public Pass, + public PassManagerAnalysisHelper { public: ModulePassManager_New() { activeFunctionPassManager = NULL; } @@ -192,7 +193,7 @@ bool runOnModule(Module &M); private: - // Collection of pass that are not yet scheduled + // Collection of pass that are managed by this manager std::vector PassVector; // Active Pass Manager @@ -200,8 +201,8 @@ }; /// PassManager_New manages ModulePassManagers -class PassManager_New: public Pass, - public PassManagerAnalysisHelper { +class PassManager_New : public Pass, + public PassManagerAnalysisHelper { public: From rspencer at reidspencer.com Tue Nov 7 18:45:10 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Tue, 07 Nov 2006 16:45:10 -0800 Subject: [llvm-commits] CAST Patch (Review Only) Message-ID: <1162946710.30912.147.camel@bashful.x10sys.com> Attached is the patch to convert CAST into 10 distinct conversion instructions. This patch still exhibits two test failures so it is not ready to be committed. However, due to its size (its 4 times longer than the others in this series), I thought some early review access would be useful. This passes everything except: MultiSource/Benchmarks/McCat/18-imp MultiSource/Applications/hbd Unfortunately, bugpoint has not be helpful in reducing these tests to something useful. I will continue working to find these problems, but there's no reason a review couldn't be started. Indeed, a review might discover these problems. I have reviewed it twice and can't see what's wrong. The nature of the problem is a code gen issue (its not a misoptimization). NOTE: Please don't commit any of this (yet) ! Reid. -------------- next part -------------- A non-text attachment was scrubbed... Name: CAST.patch Type: text/x-patch Size: 627721 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061107/87ee33e1/attachment.bin From sabre at nondot.org Tue Nov 7 19:03:42 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 7 Nov 2006 19:03:42 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/BranchFolding.cpp Message-ID: <200611080103.kA813g4m019591@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: BranchFolding.cpp updated: 1.32 -> 1.33 --- Log message: optimize single MBB loops better. In particular, produce: LBB1_57: #bb207.i movl 72(%esp), %ecx movb (%ecx,%eax), %cl movl 80(%esp), %edx movb %cl, 1(%edx,%eax) incl %eax cmpl $143, %eax jne LBB1_57 #bb207.i jmp LBB1_64 #cond_next255.i intead of: LBB1_57: #bb207.i movl 72(%esp), %ecx movb (%ecx,%eax), %cl movl 80(%esp), %edx movb %cl, 1(%edx,%eax) incl %eax cmpl $143, %eax je LBB1_64 #cond_next255.i jmp LBB1_57 #bb207.i This eliminates a branch per iteration of the loop. This hurted PPC particularly, because the extra branch meant another dispatch group for each iteration of the loop. --- Diffs of the changes: (+17 -0) BranchFolding.cpp | 17 +++++++++++++++++ 1 files changed, 17 insertions(+) Index: llvm/lib/CodeGen/BranchFolding.cpp diff -u llvm/lib/CodeGen/BranchFolding.cpp:1.32 llvm/lib/CodeGen/BranchFolding.cpp:1.33 --- llvm/lib/CodeGen/BranchFolding.cpp:1.32 Sun Nov 5 13:31:28 2006 +++ llvm/lib/CodeGen/BranchFolding.cpp Tue Nov 7 19:03:21 2006 @@ -687,6 +687,23 @@ !CurCond.empty(), ++MachineFunction::iterator(MBB)); + // If this is a two-way branch, and the FBB branches to this block, reverse + // the condition so the single-basic-block loop is faster. Instead of: + // Loop: xxx; jcc Out; jmp Loop + // we want: + // Loop: xxx; jncc Loop; jmp Out + if (CurTBB && CurFBB && CurFBB == MBB && CurTBB != MBB) { + std::vector NewCond(CurCond); + if (!TII->ReverseBranchCondition(NewCond)) { + TII->RemoveBranch(*MBB); + TII->InsertBranch(*MBB, CurFBB, CurTBB, NewCond); + MadeChange = true; + ++NumBranchOpts; + return OptimizeBlock(MBB); + } + } + + // If this branch is the only thing in its block, see if we can forward // other blocks across it. if (CurTBB && CurCond.empty() && CurFBB == 0 && From reid at x10sys.com Tue Nov 7 19:11:46 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 7 Nov 2006 19:11:46 -0600 Subject: [llvm-commits] CVS: llvm/docs/LangRef.html Message-ID: <200611080111.kA81Bk4O019770@zion.cs.uiuc.edu> Changes in directory llvm/docs: LangRef.html updated: 1.160 -> 1.161 --- Log message: For PR950: http://llvm.org/PR950 : Early commit of the documentation for new conversion instructions for easier review. --- Diffs of the changes: (+405 -33) LangRef.html | 438 ++++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 405 insertions(+), 33 deletions(-) Index: llvm/docs/LangRef.html diff -u llvm/docs/LangRef.html:1.160 llvm/docs/LangRef.html:1.161 --- llvm/docs/LangRef.html:1.160 Wed Nov 1 19:53:58 2006 +++ llvm/docs/LangRef.html Tue Nov 7 19:11:31 2006 @@ -115,10 +115,22 @@
  • 'getelementptr' Instruction
  • +
  • Cast Operations +
      +
    1. 'trunc .. to' Instruction
    2. +
    3. 'zext .. to' Instruction
    4. +
    5. 'sext .. to' Instruction
    6. +
    7. 'fptrunc .. to' Instruction
    8. +
    9. 'fpext .. to' Instruction
    10. +
    11. 'fp2uint .. to' Instruction
    12. +
    13. 'fp2sint .. to' Instruction
    14. +
    15. 'uint2fp .. to' Instruction
    16. +
    17. 'sint2fp .. to' Instruction
    18. +
    19. 'bitconvert .. to' Instruction
    20. +
  • Other Operations
    1. 'phi' Instruction
    2. -
    3. 'cast .. to' Instruction
    4. 'select' Instruction
    5. 'call' Instruction
    6. 'va_arg' Instruction
    7. @@ -1170,9 +1182,54 @@ following is the syntax for constant expressions:

      -
      cast ( CST to TYPE )
      - -
      Cast a constant to another type.
      +
      trunc ( CST to TYPE )
      +
      Truncate a constant to another type. The bit size of CST must be larger + than the bit size of TYPE. Both types must be integral.
      + +
      zext ( CST to TYPE )
      +
      Zero extend a constant to another type. The bit size of CST must be + smaller or equal to the bit size of TYPE. Both types must be integral.
      + +
      sext ( CST to TYPE )
      +
      Sign extend a constant to another type. The bit size of CST must be + smaller or equal to the bit size of TYPE. Both types must be integral.
      + +
      fptrunc ( CST to TYPE )
      +
      Truncate a floating point constant to another floating point type. The + size of CST must be larger than the size of TYPE. Both types must be + floating point.
      + +
      fpext ( CST to TYPE )
      +
      Floating point extend a constant to another type. The size of CST must be + smaller or equal to the size of TYPE. Both types must be floating point.
      + +
      fp2uint ( CST to TYPE )
      +
      Convert a floating point constant to the corresponding unsigned integer + constant. TYPE must be an integer type. CST must be floating point. If the + value won't fit in the integer type, the results are undefined.
      + +
      fp2sint ( CST to TYPE )
      +
      Convert a floating point constant to the corresponding signed integer + constant. TYPE must be an integer type. CST must be floating point. If the + value won't fit in the integer type, the results are undefined.
      + +
      uint2fp ( CST to TYPE )
      +
      Convert an unsigned integer constant to the corresponding floating point + constant. TYPE must be floating point. CST must be of integer type. If the + value won't fit in the floating point type, the results are undefined.
      + +
      sint2fp ( CST to TYPE )
      +
      Convert a signed integer constant to the corresponding floating point + constant. TYPE must be floating point. CST must be of integer type. If the + value won't fit in the floating point type, the results are undefined.
      + +
      bitconvert ( CST to TYPE )
      +
      Convert a constant, CST, to another TYPE. The size of CST and TYPE must be + identical (same number of bits). The conversion is done as if the CST value + was stored to memory and read back as TYPE. In other words, no bits change + with this operator, just the type. This can be used for conversion of pointer + and packed types to any other type, as long as they have the same bit width. +
      getelementptr ( CSTPTR, IDX0, IDX1, ... )
      @@ -1403,7 +1460,7 @@
        ; Emulate a conditional br instruction
      - %Val = cast bool %value to int
      + %Val = zext bool %value to int
        switch int %Val, label %truedest [int 0, label %falsedest ]
       
        ; Emulate an unconditional br instruction
      @@ -2740,60 +2797,375 @@
       
       
       
      -
       
      Syntax:
      -
      -  <result> = cast <ty> <value> to <ty2>             ; yields ty2
      +  <result> = trunc <ty> <value> to <ty2>             ; yields ty2
       
      Overview:
      -

      -The 'cast' instruction is used as the primitive means to convert -integers to floating point, change data type sizes, and break type safety (by -casting pointers). +The 'trunc' instruction truncates its operand to the type ty2.

      -
      Arguments:
      +

      +The 'trunc' instruction takes a value to trunc, which must +be an integer type, and a type that specifies the size +and type of the result, which must be an integral +type.

      +
      Semantics:

      -The 'cast' instruction takes a value to cast, which must be a first -class value, and a type to cast it to, which must also be a first class type. -

      +The 'trunc' instruction truncates the high order bits in value +and converts the reamining bits to ty2. The bit size of value +must be larger than the bit size of ty2. Equal sized types are not +allowed. This implies that a trunc cannot be a no-op cast. It +will always truncate bits.

      + +

      When truncating to bool, the truncation is done as a comparison against +zero. If the value was zero, the bool result will be false. +If the value was non-zero, the bool result will be true.

      + +
      Example:
      +
      +  %X = trunc int 257 to ubyte              ; yields ubyte:1
      +  %Y = trunc int 123 to bool               ; yields bool:true
      +
      +
      + + + +
      + +
      Syntax:
      +
      +  <result> = zext <ty> <value> to <ty2>             ; yields ty2
      +
      + +
      Overview:
      +

      The 'zext' instruction zero extends its operand to type +ty2.

      + + +
      Arguments:
      +

      The 'zext' instruction takes a value to cast, which must be of +integral type, and a type to cast it to, which must +also be of integral type. The bit size of the +value must be smaller than or equal to the bit size of the +destination type, ty2.

      Semantics:
      +

      The zext fills the high order bits of the value with zero +bits until it reaches the size of the destination type, ty2. When the +the operand and the type are the same size, no bit filling is done and the +cast is considered a no-op cast because no bits change (only the type +changes).

      + +

      When zero extending to bool, the extension is done as a comparison against +zero. If the value was zero, the bool result will be false. +If the value was non-zero, the bool result will be true.

      +
      Example:
      +
      +  %X = zext int 257 to ulong              ; yields ulong:257
      +  %Y = zext bool true to int              ; yields int:1
      +
      +
      + + + +
      + +
      Syntax:
      +
      +  <result> = sext <ty> <value> to <ty2>             ; yields ty2
      +
      + +
      Overview:
      +

      The 'sext' sign extends value to the type ty2.

      + +
      Arguments:

      -This instruction follows the C rules for explicit casts when determining how the -data being cast must change to fit in its new container. -

      +The 'sext' instruction takes a value to cast, which must be of +integral type, and a type to cast it to, which must +also be of integral type.

      +
      Semantics:

      -When casting to bool, any value that would be considered true in the context of -a C 'if' condition is converted to the boolean 'true' values, -all else are 'false'. +The 'sext' instruction performs a sign extension by copying the sign +bit (highest order bit) of the value until it reaches the bit size of +the type ty2. When the the operand and the type are the same size, +no bit filling is done and the cast is considered a no-op cast because +no bits change (only the type changes).

      + +

      When sign extending to bool, the extension is done as a comparison against +zero. If the value was zero, the bool result will be false. +If the value was non-zero, the bool result will be true.

      + +
      Example:
      + +
      +  %X = sext sbyte -1 to ushort           ; yields ushort:65535
      +  %Y = sext bool true to int             ; yields int:-1
      +
      +
      + + + +
      + +
      Syntax:
      +
      +  <result> = fpext <ty> <value> to <ty2>             ; yields ty2
      +
      + +
      Overview:
      +

      The 'fpext' extends a floating point value to a larger +floating point value.

      + +
      Arguments:
      +

      The 'fpext' instruction takes a +floating point value to cast, +and a floating point type to cast it to.

      + +
      Semantics:
      +

      The 'fpext' instruction extends the value from one floating +point type to another. If the type of the value and ty2 are +the same, the instruction is considered a no-op cast because no bits +change.

      + +
      Example:
      +
      +  %X = fpext float 3.1415 to double        ; yields double:3.1415
      +  %Y = fpext float 1.0 to float            ; yields float:1.0 (no-op)
      +
      +
      + + + + +
      + +
      Syntax:
      + +
      +  <result> = fptrunc <ty> <value> to <ty2>             ; yields ty2
      +
      + +
      Overview:
      +

      The 'fptrunc' instruction truncates value to type +ty2.

      + + +
      Arguments:
      +

      The 'fptrunc' instruction takes a floating + point value to cast and a floating point type to +cast it to. The size of value must be larger than the size of +ty2. This implies that fptrunc cannot be used to make a +no-op cast.

      + +
      Semantics:
      +

      The 'fptrunc' instruction converts a +floating point value from a larger type to a smaller +type. If the value cannot fit within the destination type, ty2, then +the results are undefined.

      + +
      Example:
      +
      +  %X = fptrunc double 123.0 to float         ; yields float:123.0
      +  %Y = fptrunc double 1.0E+300 to float      ; yields undefined
      +
      +
      + + + +
      + +
      Syntax:
      +
      +  <result> = fp2uint <ty> <value> to <ty2>             ; yields ty2
      +
      + +
      Overview:
      +

      The 'fp2uint' converts a floating point value to its +unsigned integer equivalent of type ty2.

      -

      -When extending an integral value from a type of one signness to another (for -example 'sbyte' to 'ulong'), the value is sign-extended if the -source value is signed, and zero-extended if the source value is -unsigned. bool values are always zero extended into either zero or -one. +

      Arguments:
      +

      The 'fp2uint' instruction takes a value to cast, which must be a +floating point value, and a type to cast it to, which +must be an integral type.

      + +
      Semantics:
      +

      The 'fp2uint' instruction converts its +floating point operand into the nearest (rounding +towards zero) unsigned integer value. If the value cannot fit in ty2, +the results are undefined.

      + +

      When converting to bool, the conversion is done as a comparison against +zero. If the value was zero, the bool result will be false. +If the value was non-zero, the bool result will be true.

      + +
      Example:
      +
      +  %X = fp2uint double 123.0 to int         ; yields int:123
      +  %Y = fp2uint float 1.0E+300 to bool      ; yields bool:true
      +  %X = fp2uint float 1.04E+17 to ubyte     ; yields undefined:1
      +
      +
      + + + +
      + +
      Syntax:
      +
      +  <result> = fp2sint <ty> <value> to <ty2>             ; yields ty2
      +
      + +
      Overview:
      +

      The 'fp2sint' instruction converts +floating point value to type ty2.

      + +
      Arguments:
      +

      The 'fp2sint' instruction takes a value to cast, which must be a +floating point value, and a type to cast it to, which +must also be an integral type.

      + +
      Semantics:
      +

      The 'fp2sint' instruction converts its +floating point operand into the nearest (rounding +towards zero) signed integer value. If the value cannot fit in ty2, +the results are undefined.

      + +

      When converting to bool, the conversion is done as a comparison against +zero. If the value was zero, the bool result will be false. +If the value was non-zero, the bool result will be true.

      + +
      Example:
      +
      +  %X = fp2sint double -123.0 to int        ; yields int:-123
      +  %Y = fp2sint float 1.0E-247 to bool      ; yields bool:true
      +  %X = fp2sint float 1.04E+17 to sbyte     ; yields undefined:1
      +
      +
      + + + +
      + +
      Syntax:
      +
      +  <result> = uint2fp <ty> <value> to <ty2>             ; yields ty2
      +
      + +
      Overview:
      +

      The 'uint2fp' instruction regards value as an unsigned +integer and converts that value to the ty2 type.

      + + +
      Arguments:
      +

      The 'uint2fp' instruction takes a value to cast, which must be an +integral value, and a type to cast it to, which must +be a floating point type.

      + +
      Semantics:
      +

      The 'uint2fp' instruction interprets its operand as an unsigned +integer quantity and converts it to the corresponding floating point value. If +the value cannot fit in the floating point value, the results are undefined.

      + + +
      Example:
      +
      +  %X = uint2fp int 257 to float         ; yields float:257.0
      +  %Y = uint2fp sbyte -1 to double       ; yields double:255.0
      +
      +
      + + + +
      + +
      Syntax:
      +
      +  <result> = sint2fp <ty> <value> to <ty2>             ; yields ty2
      +
      + +
      Overview:
      +

      The 'sint2fp' instruction regards value as a signed +integer and converts that value to the ty2 type.

      + +
      Arguments:
      +

      The 'sint2fp' instruction takes a value to cast, which must be an +integral value, and a type to cast it to, which must be +a floating point type.

      + +
      Semantics:
      +

      The 'sint2fp' instruction interprets its operand as a signed +integer quantity and converts it to the corresponding floating point value. If +the value cannot fit in the floating point value, the results are undefined.

      +
      Example:
      +
      +  %X = sint2fp int 257 to float         ; yields float:257.0
      +  %Y = sint2fp sbyte -1 to double       ; yields double:-1.0
      +
      +
      + + +
      + +
      Syntax:
      +
      +  <result> = bitconvert <ty> <value> to <ty2>             ; yields ty2
      +
      + +
      Overview:
      +

      The 'bitconvert' instruction converts value to type +ty2 without changing any bits.

      + +
      Arguments:
      +

      The 'bitconvert' instruction takes a value to cast, which must be +a first class value, and a type to cast it to, which must also be a first class type. The bit sizes of value +and the destination type, ty2, must be identical.

      + +
      Semantics:
      +

      The 'bitconvert' instruction converts value to type +ty2 as if the value had been stored to memory and read back as type +ty2. That is, no bits are changed during the conversion. The +bitconvert instruction may be used to construct no-op casts that +the zext, sext, and fpext instructions do not permit.

      + +
      Example:
      -  %X = cast int 257 to ubyte              ; yields ubyte:1
      -  %Y = cast int 123 to bool               ; yields bool:true
      +  %X = bitconvert ubyte 255 to sbyte         ; yields sbyte:-1
      +  %Y = bitconvert uint* %x to uint           ; yields uint:%x
       
      @@ -4000,7 +4372,7 @@ Chris Lattner
      The LLVM Compiler Infrastructure
      - Last modified: $Date: 2006/11/02 01:53:58 $ + Last modified: $Date: 2006/11/08 01:11:31 $ From reid at x10sys.com Tue Nov 7 19:19:06 2006 From: reid at x10sys.com (Reid Spencer) Date: Tue, 7 Nov 2006 19:19:06 -0600 Subject: [llvm-commits] CVS: llvm/docs/LangRef.html Message-ID: <200611080119.kA81J6Eq019964@zion.cs.uiuc.edu> Changes in directory llvm/docs: LangRef.html updated: 1.161 -> 1.162 --- Log message: Fix the section headings. --- Diffs of the changes: (+39 -30) LangRef.html | 69 +++++++++++++++++++++++++++++++++-------------------------- 1 files changed, 39 insertions(+), 30 deletions(-) Index: llvm/docs/LangRef.html diff -u llvm/docs/LangRef.html:1.161 llvm/docs/LangRef.html:1.162 --- llvm/docs/LangRef.html:1.161 Tue Nov 7 19:11:31 2006 +++ llvm/docs/LangRef.html Tue Nov 7 19:18:52 2006 @@ -115,7 +115,7 @@
    8. 'getelementptr' Instruction
  • -
  • Cast Operations +
  • Conversion Operations
    1. 'trunc .. to' Instruction
    2. 'zext .. to' Instruction
    3. @@ -2763,36 +2763,12 @@ - -
      -

      The instructions in this category are the "miscellaneous" -instructions, which defy better classification.

      + - -
      -
      Syntax:
      -
        <result> = phi <ty> [ <val0>, <label0>], ...
      -
      Overview:
      -

      The 'phi' instruction is used to implement the φ node in -the SSA graph representing the function.

      -
      Arguments:
      -

      The type of the incoming values are specified with the first type -field. After this, the 'phi' instruction takes a list of pairs -as arguments, with one pair for each predecessor basic block of the -current block. Only values of first class -type may be used as the value arguments to the PHI node. Only labels -may be used as the label arguments.

      -

      There must be no non-phi instructions between the start of a basic -block and the PHI instructions: i.e. PHI instructions must be first in -a basic block.

      -
      Semantics:
      -

      At runtime, the 'phi' instruction logically takes on the -value specified by the parameter, depending on which basic block we -came from in the last terminator instruction.

      -
      Example:
      -
      Loop:       ; Infinite loop that counts from 0 on up...
      %indvar = phi uint [ 0, %LoopHeader ], [ %nextindvar, %Loop ]
      %nextindvar = add uint %indvar, 1
      br label %Loop
      +

      The instructions in this category are the conversion instructions (casting) +which all take a single operand and a type. They perform various bit conversions +on the operand.

      @@ -3169,6 +3145,39 @@
      + + +
      +

      The instructions in this category are the "miscellaneous" +instructions, which defy better classification.

      +
      + + +
      +
      Syntax:
      +
        <result> = phi <ty> [ <val0>, <label0>], ...
      +
      Overview:
      +

      The 'phi' instruction is used to implement the φ node in +the SSA graph representing the function.

      +
      Arguments:
      +

      The type of the incoming values are specified with the first type +field. After this, the 'phi' instruction takes a list of pairs +as arguments, with one pair for each predecessor basic block of the +current block. Only values of first class +type may be used as the value arguments to the PHI node. Only labels +may be used as the label arguments.

      +

      There must be no non-phi instructions between the start of a basic +block and the PHI instructions: i.e. PHI instructions must be first in +a basic block.

      +
      Semantics:
      +

      At runtime, the 'phi' instruction logically takes on the +value specified by the parameter, depending on which basic block we +came from in the last terminator instruction.

      +
      Example:
      +
      Loop:       ; Infinite loop that counts from 0 on up...
      %indvar = phi uint [ 0, %LoopHeader ], [ %nextindvar, %Loop ]
      %nextindvar = add uint %indvar, 1
      br label %Loop
      +
      +
      'select' Instruction @@ -4372,7 +4381,7 @@ Chris Lattner
      The LLVM Compiler Infrastructure
      - Last modified: $Date: 2006/11/08 01:11:31 $ + Last modified: $Date: 2006/11/08 01:18:52 $ From dpatel at apple.com Tue Nov 7 19:31:42 2006 From: dpatel at apple.com (Devang Patel) Date: Tue, 7 Nov 2006 19:31:42 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200611080131.kA81Vgtv020152@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.6 -> 1.7 --- Log message: Beautify. --- Diffs of the changes: (+17 -19) PassManager.cpp | 36 +++++++++++++++++------------------- 1 files changed, 17 insertions(+), 19 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.6 llvm/lib/VMCore/PassManager.cpp:1.7 --- llvm/lib/VMCore/PassManager.cpp:1.6 Tue Nov 7 16:56:50 2006 +++ llvm/lib/VMCore/PassManager.cpp Tue Nov 7 19:31:28 2006 @@ -2,7 +2,7 @@ // // The LLVM Compiler Infrastructure // -// This file was developed by the LLVM research group and is distributed under +// This file was developed by Devang Patel and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// @@ -13,14 +13,13 @@ #include "llvm/PassManager.h" -#include "llvm/Function.h" #include "llvm/Module.h" using namespace llvm; // PassManagerAnalysisHelper implementation -/// Return TRUE IFF pass P's required analysis set does not required new +/// Return true IFF pass P's required analysis set does not required new /// manager. bool PassManagerAnalysisHelper::manageablePass(Pass *P) { @@ -33,7 +32,7 @@ return true; } -/// Return TRUE iff AnalysisID AID is currently available. +/// Return true IFF AnalysisID AID is currently available. bool PassManagerAnalysisHelper::analysisCurrentlyAvailable(AnalysisID AID) { // TODO @@ -60,10 +59,10 @@ /// BasicBlockPassManager implementation -/// Add pass P into PassVector and return TRUE. If this pass is not -/// manageable by this manager then return FALSE. +/// Add pass P into PassVector and return true. If this pass is not +/// manageable by this manager then return false. bool -BasicBlockPassManager_New::addPass (Pass *P) { +BasicBlockPassManager_New::addPass(Pass *P) { BasicBlockPass *BP = dynamic_cast(P); if (!BP) @@ -71,7 +70,7 @@ // If this pass does not preserve anlysis that is used by other passes // managed by this manager than it is not a suiable pass for this manager. - if (!manageablePass (P)) + if (!manageablePass(P)) return false; // Take a note of analysis required by this pass. @@ -101,14 +100,13 @@ // FunctionPassManager_New implementation -/////////////////////////////////////////////////////////////////////////////// // FunctionPassManager /// Add pass P into the pass manager queue. If P is a BasicBlockPass then /// either use it into active basic block pass manager or create new basic /// block pass manager to handle pass P. bool -FunctionPassManager_New::addPass (Pass *P) { +FunctionPassManager_New::addPass(Pass *P) { // If P is a BasicBlockPass then use BasicBlockPassManager_New. if (BasicBlockPass *BP = dynamic_cast(P)) { @@ -119,8 +117,8 @@ activeBBPassManager = new BasicBlockPassManager_New(); PassVector.push_back(activeBBPassManager); - assert (!activeBBPassManager->addPass(BP) && - "Unable to add Pass"); + if (!activeBBPassManager->addPass(BP)) + assert(0 && "Unable to add Pass"); } return true; } @@ -131,7 +129,7 @@ // If this pass does not preserve anlysis that is used by other passes // managed by this manager than it is not a suiable pass for this manager. - if (!manageablePass (P)) + if (!manageablePass(P)) return false; // Take a note of analysis required by this pass. @@ -163,10 +161,10 @@ // ModulePassManager implementation /// Add P into pass vector if it is manageble. If P is a FunctionPass -/// then use FunctionPassManager_New to manage it. Return FALSE if P +/// then use FunctionPassManager_New to manage it. Return false if P /// is not manageable by this manager. bool -ModulePassManager_New::addPass (Pass *P) { +ModulePassManager_New::addPass(Pass *P) { // If P is FunctionPass then use function pass maanager. if (FunctionPass *FP = dynamic_cast(P)) { @@ -179,8 +177,8 @@ activeFunctionPassManager = new FunctionPassManager_New(); PassVector.push_back(activeFunctionPassManager); - assert (!activeFunctionPassManager->addPass(FP) && - "Unable to add Pass"); + if (!activeFunctionPassManager->addPass(FP)) + assert(0 && "Unable to add pass"); } return true; } @@ -191,7 +189,7 @@ // If this pass does not preserve anlysis that is used by other passes // managed by this manager than it is not a suiable pass for this manager. - if (!manageablePass (P)) + if (!manageablePass(P)) return false; // Take a note of analysis required by this pass. @@ -235,7 +233,7 @@ /// Add P into active pass manager or use new module pass manager to /// manage it. bool -PassManager_New::addPass (Pass *P) { +PassManager_New::addPass(Pass *P) { if (!activeManager) { activeManager = new ModulePassManager_New(); From rspencer at reidspencer.com Tue Nov 7 19:33:22 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Tue, 07 Nov 2006 17:33:22 -0800 Subject: [llvm-commits] SHR Patch (For Review) Message-ID: <1162949602.30912.162.camel@bashful.x10sys.com> Attached is the 3rd attempt to get the SHR patch right. This one passes all the tests and eliminates many more casts than previous versions. NOTE: Please don't commit this! Reid. -------------- next part -------------- A non-text attachment was scrubbed... Name: SHR.patch Type: text/x-patch Size: 102934 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061107/33fd4f8c/attachment.bin From sabre at nondot.org Tue Nov 7 19:44:49 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 7 Nov 2006 19:44:49 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/PowerPC/mem_update.ll Message-ID: <200611080144.kA81inln020387@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/PowerPC: mem_update.ll added (r1.1) --- Log message: preincrement case we miss. xfail until we catch it --- Diffs of the changes: (+11 -0) mem_update.ll | 11 +++++++++++ 1 files changed, 11 insertions(+) Index: llvm/test/Regression/CodeGen/PowerPC/mem_update.ll diff -c /dev/null llvm/test/Regression/CodeGen/PowerPC/mem_update.ll:1.1 *** /dev/null Tue Nov 7 19:44:45 2006 --- llvm/test/Regression/CodeGen/PowerPC/mem_update.ll Tue Nov 7 19:44:35 2006 *************** *** 0 **** --- 1,11 ---- + ; RUN: llvm-as < %s | llc -march=ppc32 && + ; RUN: llvm-as < %s | llc -march=ppc32 | not grep addi + + ; XFAIL: * + + int *%test(int *%X, int *%dest) { + %Y = getelementptr int* %X, int 4 + %A = load int* %Y + store int %A, int* %dest + ret int* %Y + } From rspencer at reidspencer.com Tue Nov 7 20:03:07 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Tue, 07 Nov 2006 18:03:07 -0800 Subject: [llvm-commits] CAST Patch (The Latest One This Time) Message-ID: <1162951388.30912.165.camel@bashful.x10sys.com> Oops, Sent the wrong patch last time. Here's today's patch. Reid. -------------- next part -------------- A non-text attachment was scrubbed... Name: CASTS.patch Type: text/x-patch Size: 397607 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061107/c2dd4585/attachment.bin From sabre at nondot.org Tue Nov 7 20:13:26 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 7 Nov 2006 20:13:26 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCInstrInfo.td Message-ID: <200611080213.kA82DQY4020870@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCInstrInfo.td updated: 1.253 -> 1.254 --- Log message: correct the (currently unused) pattern for lwzu. --- Diffs of the changes: (+8 -2) PPCInstrInfo.td | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) Index: llvm/lib/Target/PowerPC/PPCInstrInfo.td diff -u llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.253 llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.254 --- llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.253 Fri Nov 3 23:42:48 2006 +++ llvm/lib/Target/PowerPC/PPCInstrInfo.td Tue Nov 7 20:13:12 2006 @@ -197,6 +197,9 @@ bit RC = 1; } +class RegConstraint { + string Constraints = C; +} //===----------------------------------------------------------------------===// @@ -418,10 +421,13 @@ def LWZ : DForm_1<32, (ops GPRC:$rD, memri:$src), "lwz $rD, $src", LdStGeneral, [(set GPRC:$rD, (load iaddr:$src))]>; -def LWZU : DForm_1<35, (ops GPRC:$rD, s16imm:$disp, GPRC:$rA), + +def LWZU : DForm_1<33, (ops GPRC:$rD, GPRC:$rA_result, i32imm:$disp, GPRC:$rA), "lwzu $rD, $disp($rA)", LdStGeneral, - []>; + []>, RegConstraint<"$rA = $rA_result">; } + + let PPC970_Unit = 1 in { // FXU Operations. def ADDI : DForm_2<14, (ops GPRC:$rD, GPRC:$rA, s16imm:$imm), "addi $rD, $rA, $imm", IntGeneral, From sabre at nondot.org Tue Nov 7 20:15:56 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 7 Nov 2006 20:15:56 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp PPCISelLowering.cpp PPCISelLowering.h Message-ID: <200611080215.kA82FuMe020960@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCISelDAGToDAG.cpp updated: 1.213 -> 1.214 PPCISelLowering.cpp updated: 1.218 -> 1.219 PPCISelLowering.h updated: 1.54 -> 1.55 --- Log message: Refactor all the addressing mode selection stuff into the isel lowering class, where it can be used for preinc formation. --- Diffs of the changes: (+325 -229) PPCISelDAGToDAG.cpp | 241 ++------------------------------------------ PPCISelLowering.cpp | 279 ++++++++++++++++++++++++++++++++++++++++++++++++++++ PPCISelLowering.h | 34 ++++++ 3 files changed, 325 insertions(+), 229 deletions(-) Index: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp diff -u llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.213 llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.214 --- llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.213 Thu Nov 2 14:25:49 2006 +++ llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Tue Nov 7 20:15:41 2006 @@ -104,22 +104,30 @@ /// SelectAddrImm - Returns true if the address N can be represented by /// a base register plus a signed 16-bit displacement [r+imm]. - bool SelectAddrImm(SDOperand N, SDOperand &Disp, SDOperand &Base); + bool SelectAddrImm(SDOperand N, SDOperand &Disp, SDOperand &Base) { + return PPCLowering.SelectAddressRegImm(N, Disp, Base, *CurDAG); + } /// SelectAddrIdx - Given the specified addressed, check to see if it can be /// represented as an indexed [r+r] operation. Returns false if it can /// be represented by [r+imm], which are preferred. - bool SelectAddrIdx(SDOperand N, SDOperand &Base, SDOperand &Index); + bool SelectAddrIdx(SDOperand N, SDOperand &Base, SDOperand &Index) { + return PPCLowering.SelectAddressRegReg(N, Base, Index, *CurDAG); + } /// SelectAddrIdxOnly - Given the specified addressed, force it to be /// represented as an indexed [r+r] operation. - bool SelectAddrIdxOnly(SDOperand N, SDOperand &Base, SDOperand &Index); + bool SelectAddrIdxOnly(SDOperand N, SDOperand &Base, SDOperand &Index) { + return PPCLowering.SelectAddressRegRegOnly(N, Base, Index, *CurDAG); + } /// SelectAddrImmShift - Returns true if the address N can be represented by /// a base register plus a signed 14-bit displacement [r+imm*4]. Suitable /// for use by STD and friends. - bool SelectAddrImmShift(SDOperand N, SDOperand &Disp, SDOperand &Base); - + bool SelectAddrImmShift(SDOperand N, SDOperand &Disp, SDOperand &Base) { + return PPCLowering.SelectAddressRegImmShift(N, Disp, Base, *CurDAG); + } + /// SelectInlineAsmMemoryOperand - Implement addressing mode selection for /// inline asm expressions. virtual bool SelectInlineAsmMemoryOperand(const SDOperand &Op, @@ -472,229 +480,6 @@ return 0; } -/// SelectAddrImm - Returns true if the address N can be represented by -/// a base register plus a signed 16-bit displacement [r+imm]. -bool PPCDAGToDAGISel::SelectAddrImm(SDOperand N, SDOperand &Disp, - SDOperand &Base) { - // If this can be more profitably realized as r+r, fail. - if (SelectAddrIdx(N, Disp, Base)) - return false; - - if (N.getOpcode() == ISD::ADD) { - short imm = 0; - if (isIntS16Immediate(N.getOperand(1), imm)) { - Disp = getI32Imm((int)imm & 0xFFFF); - if (FrameIndexSDNode *FI = dyn_cast(N.getOperand(0))) { - Base = CurDAG->getTargetFrameIndex(FI->getIndex(), N.getValueType()); - } else { - Base = N.getOperand(0); - } - return true; // [r+i] - } else if (N.getOperand(1).getOpcode() == PPCISD::Lo) { - // Match LOAD (ADD (X, Lo(G))). - assert(!cast(N.getOperand(1).getOperand(1))->getValue() - && "Cannot handle constant offsets yet!"); - Disp = N.getOperand(1).getOperand(0); // The global address. - assert(Disp.getOpcode() == ISD::TargetGlobalAddress || - Disp.getOpcode() == ISD::TargetConstantPool || - Disp.getOpcode() == ISD::TargetJumpTable); - Base = N.getOperand(0); - return true; // [&g+r] - } - } else if (N.getOpcode() == ISD::OR) { - short imm = 0; - if (isIntS16Immediate(N.getOperand(1), imm)) { - // If this is an or of disjoint bitfields, we can codegen this as an add - // (for better address arithmetic) if the LHS and RHS of the OR are - // provably disjoint. - uint64_t LHSKnownZero, LHSKnownOne; - PPCLowering.ComputeMaskedBits(N.getOperand(0), ~0U, - LHSKnownZero, LHSKnownOne); - if ((LHSKnownZero|~(unsigned)imm) == ~0U) { - // If all of the bits are known zero on the LHS or RHS, the add won't - // carry. - Base = N.getOperand(0); - Disp = getI32Imm((int)imm & 0xFFFF); - return true; - } - } - } else if (ConstantSDNode *CN = dyn_cast(N)) { - // Loading from a constant address. - - // If this address fits entirely in a 16-bit sext immediate field, codegen - // this as "d, 0" - short Imm; - if (isIntS16Immediate(CN, Imm)) { - Disp = CurDAG->getTargetConstant(Imm, CN->getValueType(0)); - Base = CurDAG->getRegister(PPC::R0, CN->getValueType(0)); - return true; - } - - // FIXME: Handle small sext constant offsets in PPC64 mode also! - if (CN->getValueType(0) == MVT::i32) { - int Addr = (int)CN->getValue(); - - // Otherwise, break this down into an LIS + disp. - Disp = getI32Imm((short)Addr); - Base = CurDAG->getConstant(Addr - (signed short)Addr, MVT::i32); - return true; - } - } - - Disp = getSmallIPtrImm(0); - if (FrameIndexSDNode *FI = dyn_cast(N)) - Base = CurDAG->getTargetFrameIndex(FI->getIndex(), N.getValueType()); - else - Base = N; - return true; // [r+0] -} - -/// SelectAddrIdx - Given the specified addressed, check to see if it can be -/// represented as an indexed [r+r] operation. Returns false if it can -/// be represented by [r+imm], which are preferred. -bool PPCDAGToDAGISel::SelectAddrIdx(SDOperand N, SDOperand &Base, - SDOperand &Index) { - short imm = 0; - if (N.getOpcode() == ISD::ADD) { - if (isIntS16Immediate(N.getOperand(1), imm)) - return false; // r+i - if (N.getOperand(1).getOpcode() == PPCISD::Lo) - return false; // r+i - - Base = N.getOperand(0); - Index = N.getOperand(1); - return true; - } else if (N.getOpcode() == ISD::OR) { - if (isIntS16Immediate(N.getOperand(1), imm)) - return false; // r+i can fold it if we can. - - // If this is an or of disjoint bitfields, we can codegen this as an add - // (for better address arithmetic) if the LHS and RHS of the OR are provably - // disjoint. - uint64_t LHSKnownZero, LHSKnownOne; - uint64_t RHSKnownZero, RHSKnownOne; - PPCLowering.ComputeMaskedBits(N.getOperand(0), ~0U, - LHSKnownZero, LHSKnownOne); - - if (LHSKnownZero) { - PPCLowering.ComputeMaskedBits(N.getOperand(1), ~0U, - RHSKnownZero, RHSKnownOne); - // If all of the bits are known zero on the LHS or RHS, the add won't - // carry. - if ((LHSKnownZero | RHSKnownZero) == ~0U) { - Base = N.getOperand(0); - Index = N.getOperand(1); - return true; - } - } - } - - return false; -} - -/// SelectAddrIdxOnly - Given the specified addressed, force it to be -/// represented as an indexed [r+r] operation. -bool PPCDAGToDAGISel::SelectAddrIdxOnly(SDOperand N, SDOperand &Base, - SDOperand &Index) { - // Check to see if we can easily represent this as an [r+r] address. This - // will fail if it thinks that the address is more profitably represented as - // reg+imm, e.g. where imm = 0. - if (SelectAddrIdx(N, Base, Index)) - return true; - - // If the operand is an addition, always emit this as [r+r], since this is - // better (for code size, and execution, as the memop does the add for free) - // than emitting an explicit add. - if (N.getOpcode() == ISD::ADD) { - Base = N.getOperand(0); - Index = N.getOperand(1); - return true; - } - - // Otherwise, do it the hard way, using R0 as the base register. - Base = CurDAG->getRegister(PPC::R0, N.getValueType()); - Index = N; - return true; -} - -/// SelectAddrImmShift - Returns true if the address N can be represented by -/// a base register plus a signed 14-bit displacement [r+imm*4]. Suitable -/// for use by STD and friends. -bool PPCDAGToDAGISel::SelectAddrImmShift(SDOperand N, SDOperand &Disp, - SDOperand &Base) { - // If this can be more profitably realized as r+r, fail. - if (SelectAddrIdx(N, Disp, Base)) - return false; - - if (N.getOpcode() == ISD::ADD) { - short imm = 0; - if (isIntS16Immediate(N.getOperand(1), imm) && (imm & 3) == 0) { - Disp = getI32Imm(((int)imm & 0xFFFF) >> 2); - if (FrameIndexSDNode *FI = dyn_cast(N.getOperand(0))) { - Base = CurDAG->getTargetFrameIndex(FI->getIndex(), N.getValueType()); - } else { - Base = N.getOperand(0); - } - return true; // [r+i] - } else if (N.getOperand(1).getOpcode() == PPCISD::Lo) { - // Match LOAD (ADD (X, Lo(G))). - assert(!cast(N.getOperand(1).getOperand(1))->getValue() - && "Cannot handle constant offsets yet!"); - Disp = N.getOperand(1).getOperand(0); // The global address. - assert(Disp.getOpcode() == ISD::TargetGlobalAddress || - Disp.getOpcode() == ISD::TargetConstantPool || - Disp.getOpcode() == ISD::TargetJumpTable); - Base = N.getOperand(0); - return true; // [&g+r] - } - } else if (N.getOpcode() == ISD::OR) { - short imm = 0; - if (isIntS16Immediate(N.getOperand(1), imm) && (imm & 3) == 0) { - // If this is an or of disjoint bitfields, we can codegen this as an add - // (for better address arithmetic) if the LHS and RHS of the OR are - // provably disjoint. - uint64_t LHSKnownZero, LHSKnownOne; - PPCLowering.ComputeMaskedBits(N.getOperand(0), ~0U, - LHSKnownZero, LHSKnownOne); - if ((LHSKnownZero|~(unsigned)imm) == ~0U) { - // If all of the bits are known zero on the LHS or RHS, the add won't - // carry. - Base = N.getOperand(0); - Disp = getI32Imm(((int)imm & 0xFFFF) >> 2); - return true; - } - } - } else if (ConstantSDNode *CN = dyn_cast(N)) { - // Loading from a constant address. - - // If this address fits entirely in a 14-bit sext immediate field, codegen - // this as "d, 0" - short Imm; - if (isIntS16Immediate(CN, Imm)) { - Disp = getSmallIPtrImm((unsigned short)Imm >> 2); - Base = CurDAG->getRegister(PPC::R0, CN->getValueType(0)); - return true; - } - - // FIXME: Handle small sext constant offsets in PPC64 mode also! - if (CN->getValueType(0) == MVT::i32) { - int Addr = (int)CN->getValue(); - - // Otherwise, break this down into an LIS + disp. - Disp = getI32Imm((short)Addr >> 2); - Base = CurDAG->getConstant(Addr - (signed short)Addr, MVT::i32); - return true; - } - } - - Disp = getSmallIPtrImm(0); - if (FrameIndexSDNode *FI = dyn_cast(N)) - Base = CurDAG->getTargetFrameIndex(FI->getIndex(), N.getValueType()); - else - Base = N; - return true; // [r+0] -} - /// SelectCC - Select a comparison of the specified values with the specified /// condition code, returning the CR# of the expression. Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.218 llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.219 --- llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.218 Thu Nov 2 14:25:49 2006 +++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp Tue Nov 7 20:15:41 2006 @@ -602,6 +602,285 @@ } //===----------------------------------------------------------------------===// +// Addressing Mode Selection +//===----------------------------------------------------------------------===// + +/// isIntS16Immediate - This method tests to see if the node is either a 32-bit +/// or 64-bit immediate, and if the value can be accurately represented as a +/// sign extension from a 16-bit value. If so, this returns true and the +/// immediate. +static bool isIntS16Immediate(SDNode *N, short &Imm) { + if (N->getOpcode() != ISD::Constant) + return false; + + Imm = (short)cast(N)->getValue(); + if (N->getValueType(0) == MVT::i32) + return Imm == (int32_t)cast(N)->getValue(); + else + return Imm == (int64_t)cast(N)->getValue(); +} +static bool isIntS16Immediate(SDOperand Op, short &Imm) { + return isIntS16Immediate(Op.Val, Imm); +} + + +/// SelectAddressRegReg - Given the specified addressed, check to see if it +/// can be represented as an indexed [r+r] operation. Returns false if it +/// can be more efficiently represented with [r+imm]. +bool PPCTargetLowering::SelectAddressRegReg(SDOperand N, SDOperand &Base, + SDOperand &Index, + SelectionDAG &DAG) { + short imm = 0; + if (N.getOpcode() == ISD::ADD) { + if (isIntS16Immediate(N.getOperand(1), imm)) + return false; // r+i + if (N.getOperand(1).getOpcode() == PPCISD::Lo) + return false; // r+i + + Base = N.getOperand(0); + Index = N.getOperand(1); + return true; + } else if (N.getOpcode() == ISD::OR) { + if (isIntS16Immediate(N.getOperand(1), imm)) + return false; // r+i can fold it if we can. + + // If this is an or of disjoint bitfields, we can codegen this as an add + // (for better address arithmetic) if the LHS and RHS of the OR are provably + // disjoint. + uint64_t LHSKnownZero, LHSKnownOne; + uint64_t RHSKnownZero, RHSKnownOne; + ComputeMaskedBits(N.getOperand(0), ~0U, LHSKnownZero, LHSKnownOne); + + if (LHSKnownZero) { + ComputeMaskedBits(N.getOperand(1), ~0U, RHSKnownZero, RHSKnownOne); + // If all of the bits are known zero on the LHS or RHS, the add won't + // carry. + if ((LHSKnownZero | RHSKnownZero) == ~0U) { + Base = N.getOperand(0); + Index = N.getOperand(1); + return true; + } + } + } + + return false; +} + +/// Returns true if the address N can be represented by a base register plus +/// a signed 16-bit displacement [r+imm], and if it is not better +/// represented as reg+reg. +bool PPCTargetLowering::SelectAddressRegImm(SDOperand N, SDOperand &Disp, + SDOperand &Base, SelectionDAG &DAG){ + // If this can be more profitably realized as r+r, fail. + if (SelectAddressRegReg(N, Disp, Base, DAG)) + return false; + + if (N.getOpcode() == ISD::ADD) { + short imm = 0; + if (isIntS16Immediate(N.getOperand(1), imm)) { + Disp = DAG.getTargetConstant((int)imm & 0xFFFF, MVT::i32); + if (FrameIndexSDNode *FI = dyn_cast(N.getOperand(0))) { + Base = DAG.getTargetFrameIndex(FI->getIndex(), N.getValueType()); + } else { + Base = N.getOperand(0); + } + return true; // [r+i] + } else if (N.getOperand(1).getOpcode() == PPCISD::Lo) { + // Match LOAD (ADD (X, Lo(G))). + assert(!cast(N.getOperand(1).getOperand(1))->getValue() + && "Cannot handle constant offsets yet!"); + Disp = N.getOperand(1).getOperand(0); // The global address. + assert(Disp.getOpcode() == ISD::TargetGlobalAddress || + Disp.getOpcode() == ISD::TargetConstantPool || + Disp.getOpcode() == ISD::TargetJumpTable); + Base = N.getOperand(0); + return true; // [&g+r] + } + } else if (N.getOpcode() == ISD::OR) { + short imm = 0; + if (isIntS16Immediate(N.getOperand(1), imm)) { + // If this is an or of disjoint bitfields, we can codegen this as an add + // (for better address arithmetic) if the LHS and RHS of the OR are + // provably disjoint. + uint64_t LHSKnownZero, LHSKnownOne; + ComputeMaskedBits(N.getOperand(0), ~0U, LHSKnownZero, LHSKnownOne); + if ((LHSKnownZero|~(unsigned)imm) == ~0U) { + // If all of the bits are known zero on the LHS or RHS, the add won't + // carry. + Base = N.getOperand(0); + Disp = DAG.getTargetConstant((int)imm & 0xFFFF, MVT::i32); + return true; + } + } + } else if (ConstantSDNode *CN = dyn_cast(N)) { + // Loading from a constant address. + + // If this address fits entirely in a 16-bit sext immediate field, codegen + // this as "d, 0" + short Imm; + if (isIntS16Immediate(CN, Imm)) { + Disp = DAG.getTargetConstant(Imm, CN->getValueType(0)); + Base = DAG.getRegister(PPC::R0, CN->getValueType(0)); + return true; + } + + // FIXME: Handle small sext constant offsets in PPC64 mode also! + if (CN->getValueType(0) == MVT::i32) { + int Addr = (int)CN->getValue(); + + // Otherwise, break this down into an LIS + disp. + Disp = DAG.getTargetConstant((short)Addr, MVT::i32); + Base = DAG.getConstant(Addr - (signed short)Addr, MVT::i32); + return true; + } + } + + Disp = DAG.getTargetConstant(0, getPointerTy()); + if (FrameIndexSDNode *FI = dyn_cast(N)) + Base = DAG.getTargetFrameIndex(FI->getIndex(), N.getValueType()); + else + Base = N; + return true; // [r+0] +} + +/// SelectAddressRegRegOnly - Given the specified addressed, force it to be +/// represented as an indexed [r+r] operation. +bool PPCTargetLowering::SelectAddressRegRegOnly(SDOperand N, SDOperand &Base, + SDOperand &Index, + SelectionDAG &DAG) { + // Check to see if we can easily represent this as an [r+r] address. This + // will fail if it thinks that the address is more profitably represented as + // reg+imm, e.g. where imm = 0. + if (SelectAddressRegReg(N, Base, Index, DAG)) + return true; + + // If the operand is an addition, always emit this as [r+r], since this is + // better (for code size, and execution, as the memop does the add for free) + // than emitting an explicit add. + if (N.getOpcode() == ISD::ADD) { + Base = N.getOperand(0); + Index = N.getOperand(1); + return true; + } + + // Otherwise, do it the hard way, using R0 as the base register. + Base = DAG.getRegister(PPC::R0, N.getValueType()); + Index = N; + return true; +} + +/// SelectAddressRegImmShift - Returns true if the address N can be +/// represented by a base register plus a signed 14-bit displacement +/// [r+imm*4]. Suitable for use by STD and friends. +bool PPCTargetLowering::SelectAddressRegImmShift(SDOperand N, SDOperand &Disp, + SDOperand &Base, + SelectionDAG &DAG) { + // If this can be more profitably realized as r+r, fail. + if (SelectAddressRegReg(N, Disp, Base, DAG)) + return false; + + if (N.getOpcode() == ISD::ADD) { + short imm = 0; + if (isIntS16Immediate(N.getOperand(1), imm) && (imm & 3) == 0) { + Disp = DAG.getTargetConstant(((int)imm & 0xFFFF) >> 2, MVT::i32); + if (FrameIndexSDNode *FI = dyn_cast(N.getOperand(0))) { + Base = DAG.getTargetFrameIndex(FI->getIndex(), N.getValueType()); + } else { + Base = N.getOperand(0); + } + return true; // [r+i] + } else if (N.getOperand(1).getOpcode() == PPCISD::Lo) { + // Match LOAD (ADD (X, Lo(G))). + assert(!cast(N.getOperand(1).getOperand(1))->getValue() + && "Cannot handle constant offsets yet!"); + Disp = N.getOperand(1).getOperand(0); // The global address. + assert(Disp.getOpcode() == ISD::TargetGlobalAddress || + Disp.getOpcode() == ISD::TargetConstantPool || + Disp.getOpcode() == ISD::TargetJumpTable); + Base = N.getOperand(0); + return true; // [&g+r] + } + } else if (N.getOpcode() == ISD::OR) { + short imm = 0; + if (isIntS16Immediate(N.getOperand(1), imm) && (imm & 3) == 0) { + // If this is an or of disjoint bitfields, we can codegen this as an add + // (for better address arithmetic) if the LHS and RHS of the OR are + // provably disjoint. + uint64_t LHSKnownZero, LHSKnownOne; + ComputeMaskedBits(N.getOperand(0), ~0U, LHSKnownZero, LHSKnownOne); + if ((LHSKnownZero|~(unsigned)imm) == ~0U) { + // If all of the bits are known zero on the LHS or RHS, the add won't + // carry. + Base = N.getOperand(0); + Disp = DAG.getTargetConstant(((int)imm & 0xFFFF) >> 2, MVT::i32); + return true; + } + } + } else if (ConstantSDNode *CN = dyn_cast(N)) { + // Loading from a constant address. + + // If this address fits entirely in a 14-bit sext immediate field, codegen + // this as "d, 0" + short Imm; + if (isIntS16Immediate(CN, Imm)) { + Disp = DAG.getTargetConstant((unsigned short)Imm >> 2, getPointerTy()); + Base = DAG.getRegister(PPC::R0, CN->getValueType(0)); + return true; + } + + // FIXME: Handle small sext constant offsets in PPC64 mode also! + if (CN->getValueType(0) == MVT::i32) { + int Addr = (int)CN->getValue(); + + // Otherwise, break this down into an LIS + disp. + Disp = DAG.getTargetConstant((short)Addr >> 2, MVT::i32); + Base = DAG.getConstant(Addr - (signed short)Addr, MVT::i32); + return true; + } + } + + Disp = DAG.getTargetConstant(0, getPointerTy()); + if (FrameIndexSDNode *FI = dyn_cast(N)) + Base = DAG.getTargetFrameIndex(FI->getIndex(), N.getValueType()); + else + Base = N; + return true; // [r+0] +} + + +/// getPreIndexedAddressParts - returns true by value, base pointer and +/// offset pointer and addressing mode by reference if the node's address +/// can be legally represented as pre-indexed load / store address. +bool PPCTargetLowering::getPreIndexedAddressParts(SDNode *N, SDOperand &Base, + SDOperand &Offset, + ISD::MemOpAddrMode &AM, + SelectionDAG &DAG) { + return false; + +#if 0 + MVT::ValueType VT; + SDOperand Ptr; + if (LoadSDNode *LD = dyn_cast(N)) { + Ptr = LD->getBasePtr(); + VT = LD->getLoadedVT(); + + // TODO: handle other cases. + if (VT != MVT::i32) return false; + } else if (StoreSDNode *ST = dyn_cast(N)) { + Ptr = ST->getBasePtr(); + VT = ST->getStoredVT(); + // TODO: handle other cases. + return false; + } else + return false; + + + + return false; +#endif +} + +//===----------------------------------------------------------------------===// // LowerOperation implementation //===----------------------------------------------------------------------===// Index: llvm/lib/Target/PowerPC/PPCISelLowering.h diff -u llvm/lib/Target/PowerPC/PPCISelLowering.h:1.54 llvm/lib/Target/PowerPC/PPCISelLowering.h:1.55 --- llvm/lib/Target/PowerPC/PPCISelLowering.h:1.54 Wed Nov 1 19:44:04 2006 +++ llvm/lib/Target/PowerPC/PPCISelLowering.h Tue Nov 7 20:15:41 2006 @@ -176,13 +176,45 @@ /// getTargetNodeName() - This method returns the name of a target specific /// DAG node. virtual const char *getTargetNodeName(unsigned Opcode) const; + + /// getPreIndexedAddressParts - returns true by value, base pointer and + /// offset pointer and addressing mode by reference if the node's address + /// can be legally represented as pre-indexed load / store address. + virtual bool getPreIndexedAddressParts(SDNode *N, SDOperand &Base, + SDOperand &Offset, + ISD::MemOpAddrMode &AM, + SelectionDAG &DAG); + + /// SelectAddressRegReg - Given the specified addressed, check to see if it + /// can be represented as an indexed [r+r] operation. Returns false if it + /// can be more efficiently represented with [r+imm]. + bool SelectAddressRegReg(SDOperand N, SDOperand &Base, SDOperand &Index, + SelectionDAG &DAG); + + /// SelectAddressRegImm - Returns true if the address N can be represented + /// by a base register plus a signed 16-bit displacement [r+imm], and if it + /// is not better represented as reg+reg. + bool SelectAddressRegImm(SDOperand N, SDOperand &Disp, SDOperand &Base, + SelectionDAG &DAG); + + /// SelectAddressRegRegOnly - Given the specified addressed, force it to be + /// represented as an indexed [r+r] operation. + bool SelectAddressRegRegOnly(SDOperand N, SDOperand &Base, SDOperand &Index, + SelectionDAG &DAG); + + /// SelectAddressRegImmShift - Returns true if the address N can be + /// represented by a base register plus a signed 14-bit displacement + /// [r+imm*4]. Suitable for use by STD and friends. + bool SelectAddressRegImmShift(SDOperand N, SDOperand &Disp, SDOperand &Base, + SelectionDAG &DAG); + /// LowerOperation - Provide custom lowering hooks for some operations. /// virtual SDOperand LowerOperation(SDOperand Op, SelectionDAG &DAG); virtual SDOperand PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const; - + virtual void computeMaskedBitsForTargetNode(const SDOperand Op, uint64_t Mask, uint64_t &KnownZero, From evan.cheng at apple.com Tue Nov 7 20:39:09 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Tue, 7 Nov 2006 20:39:09 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200611080239.kA82d9BH021285@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.239 -> 1.240 --- Log message: Fix a obscure post-indexed load / store dag combine bug. --- 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.239 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.240 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.239 Tue Nov 7 03:03:05 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Tue Nov 7 20:38:55 2006 @@ -338,7 +338,7 @@ SDOperand Offset; ISD::MemOpAddrMode AM = ISD::UNINDEXED; if (TLI.getPostIndexedAddressParts(Op, VT, BasePtr, Offset, AM,DAG) && - BasePtr.Val == Ptr.Val) { + BasePtr == Ptr) { // Try turning it into a post-indexed load / store except when // 1) Op must be independent of N, i.e. Op is neither a predecessor // nor a successor of N. Otherwise, if Op is folded that would From clattner at apple.com Tue Nov 7 21:58:53 2006 From: clattner at apple.com (Chris Lattner) Date: Tue, 7 Nov 2006 19:58:53 -0800 Subject: [llvm-commits] SHR Patch (For Review) In-Reply-To: <1162949602.30912.162.camel@bashful.x10sys.com> References: <1162949602.30912.162.camel@bashful.x10sys.com> Message-ID: <0D3095D6-E185-43C0-9D2B-33E671C99B06@apple.com> On Nov 7, 2006, at 5:33 PM, Reid Spencer wrote: > Attached is the 3rd attempt to get the SHR patch right. This one > passes > all the tests and eliminates many more casts than previous versions. > > NOTE: Please don't commit this! > > Reid. Overall, the patch looks excellent. There is some minor typographical cruft like "return new ShiftInst" in various places. Please grep for that (turning two spaces before new into one). In this hunk: @@ -5250,12 +5230,16 @@ Instruction *InstCombiner::FoldShiftByCo Amt = Op0->getType()->getPrimitiveSizeInBits(); Value *Op = ShiftOp->getOperand(0); if (isShiftOfSignedShift != isSignedShift) Op = InsertNewInstBefore(new CastInst(Op, I.getType(), "tmp"), I); - return new ShiftInst(I.getOpcode(), Op, + ShiftInst* ShiftResult = new ShiftInst(I.getOpcode(), Op, ConstantInt::get(Type::UByteTy, Amt)); + if (I.getType() == ShiftResult->getType()) + return ShiftResult; + InsertNewInstBefore(ShiftResult, I); + return new CastInst(ShiftResult, I.getType()); } Why do you need the two casts? If you don't, please remove them. In this hunk: @@ -5790,33 +5768,28 @@ Instruction *InstCombiner::visitCastInst ... - // Insert the new shift, which is now unsigned. - N1 = InsertNewInstBefore(new ShiftInst(Instruction::Shr, N1, - Op1, Src->getName ()), CI); - return new CastInst(N1, CI.getType()); + // Insert the new logical shift right. + return new ShiftInst(Instruction::LShr, Op0, Op1, Src- >getName()); You shouldn't pass Src->getName() to the instruction ctor. RCS file: /var/cvs/llvm/llvm/lib/VMCore/Instructions.cpp,v retrieving revision 1.45 diff -t -d -u -p -5 -r1.45 Instructions.cpp --- lib/VMCore/Instructions.cpp 2 Nov 2006 01:53:58 -0000 1.45 +++ lib/VMCore/Instructions.cpp 8 Nov 2006 00:31:58 -0000 @@ -1228,11 +1228,11 @@ bool BinaryOperator::swapOperands() { // ===--------------------------------------------------------------------- -===// /// isLogicalShift - Return true if this is a logical shift left or a logical /// shift right. bool ShiftInst::isLogicalShift() const { - return getOpcode() == Instruction::Shl || getType()->isUnsigned(); + return getOpcode() == Instruction::Shl || getOpcode() == Instruction::LShr; } isLogicalShift can now be an inline method in the header for ShiftInst, now that it isn't touching getType(). Please move it to the header. After making the changes above and retesting, please commit this! After this goes in, please remember to do the next patch which turns ConstantExpr::getUShr -> ConstantExpr::getLShr etc. Thanks guys, -Chris From rspencer at reidspencer.com Tue Nov 7 23:20:21 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Tue, 07 Nov 2006 21:20:21 -0800 Subject: [llvm-commits] SHR Patch (For Review) In-Reply-To: <0D3095D6-E185-43C0-9D2B-33E671C99B06@apple.com> References: <1162949602.30912.162.camel@bashful.x10sys.com> <0D3095D6-E185-43C0-9D2B-33E671C99B06@apple.com> Message-ID: <1162963221.30912.242.camel@bashful.x10sys.com> On Tue, 2006-11-07 at 19:58 -0800, Chris Lattner wrote: > On Nov 7, 2006, at 5:33 PM, Reid Spencer wrote: > > > Attached is the 3rd attempt to get the SHR patch right. This one > > passes > > all the tests and eliminates many more casts than previous versions. > > > > NOTE: Please don't commit this! > > > > Reid. > > Overall, the patch looks excellent. There is some minor > typographical cruft like "return new ShiftInst" in various places. > Please grep for that (turning two spaces before new into one). > Found 3, only in InstCombine > > In this hunk: > > @@ -5250,12 +5230,16 @@ Instruction *InstCombiner::FoldShiftByCo > Amt = Op0->getType()->getPrimitiveSizeInBits(); > > Value *Op = ShiftOp->getOperand(0); > if (isShiftOfSignedShift != isSignedShift) > Op = InsertNewInstBefore(new CastInst(Op, I.getType(), > "tmp"), I); > - return new ShiftInst(I.getOpcode(), Op, > + ShiftInst* ShiftResult = new ShiftInst(I.getOpcode(), Op, > ConstantInt::get(Type::UByteTy, Amt)); > + if (I.getType() == ShiftResult->getType()) > + return ShiftResult; > + InsertNewInstBefore(ShiftResult, I); > + return new CastInst(ShiftResult, I.getType()); > } > > Why do you need the two casts? If you don't, please remove them. That's the one that causes InstCombiner's replaceAllUsesWith call to assert because its the wrong type. This is specifically the one I warned you about :) If you can see a way to eliminate it, please feel free after I commit it. We already tried and it breaks. > > In this hunk: > @@ -5790,33 +5768,28 @@ Instruction *InstCombiner::visitCastInst > ... > - // Insert the new shift, which is now unsigned. > - N1 = InsertNewInstBefore(new ShiftInst(Instruction::Shr, > N1, > - Op1, Src->getName > ()), CI); > - return new CastInst(N1, CI.getType()); > + // Insert the new logical shift right. > + return new ShiftInst(Instruction::LShr, Op0, Op1, Src- > >getName()); > > You shouldn't pass Src->getName() to the instruction ctor. Right. Done. > > > > RCS file: /var/cvs/llvm/llvm/lib/VMCore/Instructions.cpp,v > retrieving revision 1.45 > diff -t -d -u -p -5 -r1.45 Instructions.cpp > --- lib/VMCore/Instructions.cpp 2 Nov 2006 01:53:58 -0000 1.45 > +++ lib/VMCore/Instructions.cpp 8 Nov 2006 00:31:58 -0000 > @@ -1228,11 +1228,11 @@ bool BinaryOperator::swapOperands() { > // > ===--------------------------------------------------------------------- > -===// > > /// isLogicalShift - Return true if this is a logical shift left or > a logical > /// shift right. > bool ShiftInst::isLogicalShift() const { > - return getOpcode() == Instruction::Shl || getType()->isUnsigned(); > + return getOpcode() == Instruction::Shl || getOpcode() == > Instruction::LShr; > } > > isLogicalShift can now be an inline method in the header for > ShiftInst, now that it isn't touching getType(). Please move it to > the header. Done. > > > > After making the changes above and retesting, please commit this! > After this goes in, please remember to do the next patch which turns > ConstantExpr::getUShr -> ConstantExpr::getLShr etc. Thanks guys, Will do immediately after the commit. Thanks Chris! From clattner at apple.com Tue Nov 7 23:28:44 2006 From: clattner at apple.com (Chris Lattner) Date: Tue, 7 Nov 2006 21:28:44 -0800 Subject: [llvm-commits] SHR Patch (For Review) In-Reply-To: <1162963221.30912.242.camel@bashful.x10sys.com> References: <1162949602.30912.162.camel@bashful.x10sys.com> <0D3095D6-E185-43C0-9D2B-33E671C99B06@apple.com> <1162963221.30912.242.camel@bashful.x10sys.com> Message-ID: <6C411923-23B6-4975-AB72-9A48F8ED9829@apple.com> On Nov 7, 2006, at 9:20 PM, Reid Spencer wrote: >> Op = InsertNewInstBefore(new CastInst(Op, I.getType(), >> "tmp"), I); >> - return new ShiftInst(I.getOpcode(), Op, >> + ShiftInst* ShiftResult = new ShiftInst(I.getOpcode(), Op, >> ConstantInt::get(Type::UByteTy, Amt)); >> + if (I.getType() == ShiftResult->getType()) >> + return ShiftResult; >> + InsertNewInstBefore(ShiftResult, I); >> + return new CastInst(ShiftResult, I.getType()); >> } >> >> Why do you need the two casts? If you don't, please remove them. > > That's the one that causes InstCombiner's replaceAllUsesWith call to > assert because its the wrong type. This is specifically the one I > warned you about :) > > If you can see a way to eliminate it, please feel free after I commit > it. We already tried and it breaks. Fair enough. Thanks, -Chris From sabre at nondot.org Tue Nov 7 23:58:26 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 7 Nov 2006 23:58:26 -0600 Subject: [llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y Message-ID: <200611080558.kA85wQOW024264@zion.cs.uiuc.edu> Changes in directory llvm/lib/AsmParser: llvmAsmParser.y updated: 1.272 -> 1.273 --- Log message: Fix a bug noticed by Emil Mikulic. --- Diffs of the changes: (+2 -2) llvmAsmParser.y | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.272 llvm/lib/AsmParser/llvmAsmParser.y:1.273 --- llvm/lib/AsmParser/llvmAsmParser.y:1.272 Wed Nov 1 19:53:58 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y Tue Nov 7 23:58:11 2006 @@ -2102,8 +2102,8 @@ }; FnDeclareLinkage: /*default*/ | - DLLIMPORT { CurFun.Linkage = GlobalValue::DLLImportLinkage } | - EXTERN_WEAK { CurFun.Linkage = GlobalValue::DLLImportLinkage }; + DLLIMPORT { CurFun.Linkage = GlobalValue::DLLImportLinkage; } | + EXTERN_WEAK { CurFun.Linkage = GlobalValue::DLLImportLinkage; }; FunctionProto : DECLARE { CurFun.isDeclare = true; } FnDeclareLinkage FunctionHeaderH { $$ = CurFun.CurrentFunction; From sabre at nondot.org Tue Nov 7 23:59:01 2006 From: sabre at nondot.org (Chris Lattner) Date: Tue, 7 Nov 2006 23:59:01 -0600 Subject: [llvm-commits] CVS: llvm/lib/AsmParser/Lexer.cpp.cvs llvmAsmParser.cpp.cvs llvmAsmParser.h.cvs llvmAsmParser.y.cvs Message-ID: <200611080559.kA85x1pj024307@zion.cs.uiuc.edu> Changes in directory llvm/lib/AsmParser: Lexer.cpp.cvs updated: 1.13 -> 1.14 llvmAsmParser.cpp.cvs updated: 1.23 -> 1.24 llvmAsmParser.h.cvs updated: 1.18 -> 1.19 llvmAsmParser.y.cvs updated: 1.24 -> 1.25 --- Log message: regenerate --- Diffs of the changes: (+3030 -4033) Lexer.cpp.cvs | 283 +- llvmAsmParser.cpp.cvs | 6394 +++++++++++++++++++++----------------------------- llvmAsmParser.h.cvs | 382 -- llvmAsmParser.y.cvs | 4 4 files changed, 3030 insertions(+), 4033 deletions(-) Index: llvm/lib/AsmParser/Lexer.cpp.cvs diff -u llvm/lib/AsmParser/Lexer.cpp.cvs:1.13 llvm/lib/AsmParser/Lexer.cpp.cvs:1.14 --- llvm/lib/AsmParser/Lexer.cpp.cvs:1.13 Thu Nov 2 14:25:49 2006 +++ llvm/lib/AsmParser/Lexer.cpp.cvs Tue Nov 7 23:58:47 2006 @@ -17,10 +17,10 @@ #define yylineno llvmAsmlineno #line 20 "Lexer.cpp" -/* A lexical scanner generated by flex*/ +/* A lexical scanner generated by flex */ /* Scanner skeleton version: - * $Header: /home/vadve/shared/PublicCVS/llvm/lib/AsmParser/Lexer.cpp.cvs,v 1.13 2006/11/02 20:25:49 reid Exp $ + * $Header: /home/vadve/shared/PublicCVS/llvm/lib/AsmParser/Lexer.cpp.cvs,v 1.14 2006/11/08 05:58:47 lattner Exp $ */ #define FLEX_SCANNER @@ -28,7 +28,6 @@ #define YY_FLEX_MINOR_VERSION 5 #include -#include /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ @@ -42,6 +41,7 @@ #ifdef __cplusplus #include +#include /* Use prototypes in function declarations. */ #define YY_USE_PROTOS @@ -153,15 +153,6 @@ #define unput(c) yyunput( c, yytext_ptr ) -/* Some routines like yy_flex_realloc() are emitted as static but are - not called by all lexers. This generates warnings in some compilers, - notably GCC. Arrange to suppress these. */ -#ifdef __GNUC__ -#define YY_MAY_BE_UNUSED __attribute__((unused)) -#else -#define YY_MAY_BE_UNUSED -#endif - /* The following is because we cannot portably get our hands on size_t * (without autoconf's help, which isn't available because we want * flex-generated scanners to compile on their own). @@ -268,7 +259,7 @@ YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static inline void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )) YY_MAY_BE_UNUSED; +static inline void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); static void yy_flex_free YY_PROTO(( void * )); #define yy_new_buffer yy_create_buffer @@ -854,7 +845,7 @@ #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; -#line 1 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 1 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" #define INITIAL 0 /*===-- Lexer.l - Scanner for llvm assembly files --------------*- C++ -*--===// // @@ -869,7 +860,7 @@ // //===----------------------------------------------------------------------===*/ #define YY_NEVER_INTERACTIVE 1 -#line 28 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 28 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" #include "ParserInternals.h" #include "llvm/Module.h" #include @@ -1005,7 +996,7 @@ /* HexIntConstant - Hexadecimal constant generated by the CFE to avoid forcing * it to deal with 64 bit numbers. */ -#line 1009 "Lexer.cpp" +#line 1000 "Lexer.cpp" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -1153,13 +1144,13 @@ YY_DECL { register yy_state_type yy_current_state; - register char *yy_cp = NULL, *yy_bp = NULL; + register char *yy_cp, *yy_bp; register int yy_act; -#line 189 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 189 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" -#line 1163 "Lexer.cpp" +#line 1154 "Lexer.cpp" if ( yy_init ) { @@ -1252,537 +1243,537 @@ { /* beginning of action switch */ case 1: YY_RULE_SETUP -#line 191 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 191 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { /* Ignore comments for now */ } YY_BREAK case 2: YY_RULE_SETUP -#line 193 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 193 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return BEGINTOK; } YY_BREAK case 3: YY_RULE_SETUP -#line 194 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 194 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return ENDTOK; } YY_BREAK case 4: YY_RULE_SETUP -#line 195 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 195 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return TRUETOK; } YY_BREAK case 5: YY_RULE_SETUP -#line 196 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 196 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return FALSETOK; } YY_BREAK case 6: YY_RULE_SETUP -#line 197 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 197 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return DECLARE; } YY_BREAK case 7: YY_RULE_SETUP -#line 198 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 198 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return GLOBAL; } YY_BREAK case 8: YY_RULE_SETUP -#line 199 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 199 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return CONSTANT; } YY_BREAK case 9: YY_RULE_SETUP -#line 200 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 200 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return INTERNAL; } YY_BREAK case 10: YY_RULE_SETUP -#line 201 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 201 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return LINKONCE; } YY_BREAK case 11: YY_RULE_SETUP -#line 202 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 202 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return WEAK; } YY_BREAK case 12: YY_RULE_SETUP -#line 203 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 203 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return APPENDING; } YY_BREAK case 13: YY_RULE_SETUP -#line 204 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 204 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return DLLIMPORT; } YY_BREAK case 14: YY_RULE_SETUP -#line 205 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 205 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return DLLEXPORT; } YY_BREAK case 15: YY_RULE_SETUP -#line 206 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 206 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return EXTERN_WEAK; } YY_BREAK case 16: YY_RULE_SETUP -#line 207 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 207 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return EXTERNAL; } /* Deprecated, turn into external */ YY_BREAK case 17: YY_RULE_SETUP -#line 208 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 208 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return EXTERNAL; } YY_BREAK case 18: YY_RULE_SETUP -#line 209 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 209 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return IMPLEMENTATION; } YY_BREAK case 19: YY_RULE_SETUP -#line 210 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 210 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return ZEROINITIALIZER; } YY_BREAK case 20: YY_RULE_SETUP -#line 211 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 211 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return DOTDOTDOT; } YY_BREAK case 21: YY_RULE_SETUP -#line 212 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 212 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return UNDEF; } YY_BREAK case 22: YY_RULE_SETUP -#line 213 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 213 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return NULL_TOK; } YY_BREAK case 23: YY_RULE_SETUP -#line 214 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 214 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return TO; } YY_BREAK case 24: YY_RULE_SETUP -#line 215 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 215 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Unwind, UNWIND); } YY_BREAK case 25: YY_RULE_SETUP -#line 216 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 216 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return NOT; } /* Deprecated, turned into XOR */ YY_BREAK case 26: YY_RULE_SETUP -#line 217 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 217 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return TAIL; } YY_BREAK case 27: YY_RULE_SETUP -#line 218 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 218 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return TARGET; } YY_BREAK case 28: YY_RULE_SETUP -#line 219 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 219 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return TRIPLE; } YY_BREAK case 29: YY_RULE_SETUP -#line 220 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 220 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return DEPLIBS; } YY_BREAK case 30: YY_RULE_SETUP -#line 221 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 221 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return ENDIAN; } YY_BREAK case 31: YY_RULE_SETUP -#line 222 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 222 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return POINTERSIZE; } YY_BREAK case 32: YY_RULE_SETUP -#line 223 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 223 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return DATALAYOUT; } YY_BREAK case 33: YY_RULE_SETUP -#line 224 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 224 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return LITTLE; } YY_BREAK case 34: YY_RULE_SETUP -#line 225 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 225 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return BIG; } YY_BREAK case 35: YY_RULE_SETUP -#line 226 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 226 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return VOLATILE; } YY_BREAK case 36: YY_RULE_SETUP -#line 227 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 227 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return ALIGN; } YY_BREAK case 37: YY_RULE_SETUP -#line 228 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 228 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return SECTION; } YY_BREAK case 38: YY_RULE_SETUP -#line 229 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 229 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return MODULE; } YY_BREAK case 39: YY_RULE_SETUP -#line 230 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 230 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return ASM_TOK; } YY_BREAK case 40: YY_RULE_SETUP -#line 231 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 231 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return SIDEEFFECT; } YY_BREAK case 41: YY_RULE_SETUP -#line 233 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 233 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return CC_TOK; } YY_BREAK case 42: YY_RULE_SETUP -#line 234 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 234 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return CCC_TOK; } YY_BREAK case 43: YY_RULE_SETUP -#line 235 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 235 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return CSRETCC_TOK; } YY_BREAK case 44: YY_RULE_SETUP -#line 236 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 236 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return FASTCC_TOK; } YY_BREAK case 45: YY_RULE_SETUP -#line 237 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 237 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return COLDCC_TOK; } YY_BREAK case 46: YY_RULE_SETUP -#line 238 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 238 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return X86_STDCALLCC_TOK; } YY_BREAK case 47: YY_RULE_SETUP -#line 239 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 239 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return X86_FASTCALLCC_TOK; } YY_BREAK case 48: YY_RULE_SETUP -#line 241 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 241 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::VoidTy ; return VOID; } YY_BREAK case 49: YY_RULE_SETUP -#line 242 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 242 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::BoolTy ; return BOOL; } YY_BREAK case 50: YY_RULE_SETUP -#line 243 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 243 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::SByteTy ; return SBYTE; } YY_BREAK case 51: YY_RULE_SETUP -#line 244 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 244 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::UByteTy ; return UBYTE; } YY_BREAK case 52: YY_RULE_SETUP -#line 245 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 245 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::ShortTy ; return SHORT; } YY_BREAK case 53: YY_RULE_SETUP -#line 246 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 246 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::UShortTy; return USHORT; } YY_BREAK case 54: YY_RULE_SETUP -#line 247 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 247 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::IntTy ; return INT; } YY_BREAK case 55: YY_RULE_SETUP -#line 248 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 248 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::UIntTy ; return UINT; } YY_BREAK case 56: YY_RULE_SETUP -#line 249 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 249 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::LongTy ; return LONG; } YY_BREAK case 57: YY_RULE_SETUP -#line 250 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 250 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::ULongTy ; return ULONG; } YY_BREAK case 58: YY_RULE_SETUP -#line 251 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 251 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::FloatTy ; return FLOAT; } YY_BREAK case 59: YY_RULE_SETUP -#line 252 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 252 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::DoubleTy; return DOUBLE; } YY_BREAK case 60: YY_RULE_SETUP -#line 253 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 253 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::LabelTy ; return LABEL; } YY_BREAK case 61: YY_RULE_SETUP -#line 254 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 254 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return TYPE; } YY_BREAK case 62: YY_RULE_SETUP -#line 255 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 255 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return OPAQUE; } YY_BREAK case 63: YY_RULE_SETUP -#line 257 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 257 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Add, ADD); } YY_BREAK case 64: YY_RULE_SETUP -#line 258 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 258 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Sub, SUB); } YY_BREAK case 65: YY_RULE_SETUP -#line 259 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 259 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Mul, MUL); } YY_BREAK case 66: YY_RULE_SETUP -#line 260 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 260 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK_OBSOLETE(BinaryOpVal, UDiv, UDIV); } YY_BREAK case 67: YY_RULE_SETUP -#line 261 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 261 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, UDiv, UDIV); } YY_BREAK case 68: YY_RULE_SETUP -#line 262 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 262 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, SDiv, SDIV); } YY_BREAK case 69: YY_RULE_SETUP -#line 263 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 263 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, FDiv, FDIV); } YY_BREAK case 70: YY_RULE_SETUP -#line 264 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 264 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK_OBSOLETE(BinaryOpVal, URem, UREM); } YY_BREAK case 71: YY_RULE_SETUP -#line 265 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 265 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, URem, UREM); } YY_BREAK case 72: YY_RULE_SETUP -#line 266 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 266 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, SRem, SREM); } YY_BREAK case 73: YY_RULE_SETUP -#line 267 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 267 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, FRem, FREM); } YY_BREAK case 74: YY_RULE_SETUP -#line 268 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 268 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, And, AND); } YY_BREAK case 75: YY_RULE_SETUP -#line 269 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 269 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Or , OR ); } YY_BREAK case 76: YY_RULE_SETUP -#line 270 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 270 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Xor, XOR); } YY_BREAK case 77: YY_RULE_SETUP -#line 271 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 271 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, SetNE, SETNE); } YY_BREAK case 78: YY_RULE_SETUP -#line 272 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 272 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, SetEQ, SETEQ); } YY_BREAK case 79: YY_RULE_SETUP -#line 273 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 273 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, SetLT, SETLT); } YY_BREAK case 80: YY_RULE_SETUP -#line 274 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 274 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, SetGT, SETGT); } YY_BREAK case 81: YY_RULE_SETUP -#line 275 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 275 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, SetLE, SETLE); } YY_BREAK case 82: YY_RULE_SETUP -#line 276 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 276 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, SetGE, SETGE); } YY_BREAK case 83: YY_RULE_SETUP -#line 278 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 278 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, PHI, PHI_TOK); } YY_BREAK case 84: YY_RULE_SETUP -#line 279 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 279 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, Call, CALL); } YY_BREAK case 85: YY_RULE_SETUP -#line 280 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 280 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, Cast, CAST); } YY_BREAK case 86: YY_RULE_SETUP -#line 281 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 281 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, Select, SELECT); } YY_BREAK case 87: YY_RULE_SETUP -#line 282 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 282 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, Shl, SHL); } YY_BREAK case 88: YY_RULE_SETUP -#line 283 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 283 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, Shr, SHR); } YY_BREAK case 89: YY_RULE_SETUP -#line 284 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 284 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return VANEXT_old; } YY_BREAK case 90: YY_RULE_SETUP -#line 285 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 285 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return VAARG_old; } YY_BREAK case 91: YY_RULE_SETUP -#line 286 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 286 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, VAArg , VAARG); } YY_BREAK case 92: YY_RULE_SETUP -#line 287 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 287 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Ret, RET); } YY_BREAK case 93: YY_RULE_SETUP -#line 288 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 288 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Br, BR); } YY_BREAK case 94: YY_RULE_SETUP -#line 289 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 289 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Switch, SWITCH); } YY_BREAK case 95: YY_RULE_SETUP -#line 290 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 290 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Invoke, INVOKE); } YY_BREAK case 96: YY_RULE_SETUP -#line 291 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 291 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Unwind, UNWIND); } YY_BREAK case 97: YY_RULE_SETUP -#line 292 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 292 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Unreachable, UNREACHABLE); } YY_BREAK case 98: YY_RULE_SETUP -#line 294 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 294 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, Malloc, MALLOC); } YY_BREAK case 99: YY_RULE_SETUP -#line 295 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 295 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, Alloca, ALLOCA); } YY_BREAK case 100: YY_RULE_SETUP -#line 296 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 296 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, Free, FREE); } YY_BREAK case 101: YY_RULE_SETUP -#line 297 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 297 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, Load, LOAD); } YY_BREAK case 102: YY_RULE_SETUP -#line 298 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 298 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, Store, STORE); } YY_BREAK case 103: YY_RULE_SETUP -#line 299 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 299 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, GetElementPtr, GETELEMENTPTR); } YY_BREAK case 104: YY_RULE_SETUP -#line 301 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 301 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, ExtractElement, EXTRACTELEMENT); } YY_BREAK case 105: YY_RULE_SETUP -#line 302 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 302 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, InsertElement, INSERTELEMENT); } YY_BREAK case 106: YY_RULE_SETUP -#line 303 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 303 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, ShuffleVector, SHUFFLEVECTOR); } YY_BREAK case 107: YY_RULE_SETUP -#line 306 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 306 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { UnEscapeLexed(yytext+1); llvmAsmlval.StrVal = strdup(yytext+1); // Skip % @@ -1791,7 +1782,7 @@ YY_BREAK case 108: YY_RULE_SETUP -#line 311 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 311 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { yytext[strlen(yytext)-1] = 0; // nuke colon UnEscapeLexed(yytext); @@ -1801,7 +1792,7 @@ YY_BREAK case 109: YY_RULE_SETUP -#line 317 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 317 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { yytext[strlen(yytext)-2] = 0; // nuke colon, end quote UnEscapeLexed(yytext+1); @@ -1811,7 +1802,7 @@ YY_BREAK case 110: YY_RULE_SETUP -#line 324 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 324 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { // Note that we cannot unescape a string constant here! The // string constant might contain a \00 which would not be // understood by the string stuff. It is valid to make a @@ -1824,12 +1815,12 @@ YY_BREAK case 111: YY_RULE_SETUP -#line 335 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 335 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.UInt64Val = atoull(yytext); return EUINT64VAL; } YY_BREAK case 112: YY_RULE_SETUP -#line 336 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 336 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { uint64_t Val = atoull(yytext+1); // +1: we have bigger negative range @@ -1841,7 +1832,7 @@ YY_BREAK case 113: YY_RULE_SETUP -#line 344 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 344 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.UInt64Val = HexIntToVal(yytext+3); return yytext[0] == 's' ? ESINT64VAL : EUINT64VAL; @@ -1849,7 +1840,7 @@ YY_BREAK case 114: YY_RULE_SETUP -#line 349 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 349 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { uint64_t Val = atoull(yytext+1); if ((unsigned)Val != Val) @@ -1860,7 +1851,7 @@ YY_BREAK case 115: YY_RULE_SETUP -#line 356 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 356 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { uint64_t Val = atoull(yytext+2); // +1: we have bigger negative range @@ -1872,16 +1863,16 @@ YY_BREAK case 116: YY_RULE_SETUP -#line 365 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 365 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.FPVal = atof(yytext); return FPVAL; } YY_BREAK case 117: YY_RULE_SETUP -#line 366 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 366 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.FPVal = HexToFP(yytext); return FPVAL; } YY_BREAK case YY_STATE_EOF(INITIAL): -#line 368 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 368 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { /* Make sure to free the internal buffers for flex when we are * done reading our input! @@ -1892,20 +1883,20 @@ YY_BREAK case 118: YY_RULE_SETUP -#line 376 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 376 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { /* Ignore whitespace */ } YY_BREAK case 119: YY_RULE_SETUP -#line 377 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 377 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return yytext[0]; } YY_BREAK case 120: YY_RULE_SETUP -#line 379 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 379 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK -#line 1909 "Lexer.cpp" +#line 1900 "Lexer.cpp" case YY_END_OF_BUFFER: { @@ -2281,7 +2272,6 @@ #endif /* ifndef YY_NO_UNPUT */ -#ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput() #else @@ -2355,7 +2345,7 @@ return c; } -#endif /* YY_NO_INPUT */ + #ifdef YY_USE_PROTOS void yyrestart( FILE *input_file ) @@ -2466,6 +2456,11 @@ } +#ifndef YY_ALWAYS_INTERACTIVE +#ifndef YY_NEVER_INTERACTIVE +extern int isatty YY_PROTO(( int )); +#endif +#endif #ifdef YY_USE_PROTOS void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) @@ -2783,5 +2778,5 @@ return 0; } #endif -#line 379 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 379 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" Index: llvm/lib/AsmParser/llvmAsmParser.cpp.cvs diff -u llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.23 llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.24 --- llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.23 Thu Nov 2 14:25:49 2006 +++ llvm/lib/AsmParser/llvmAsmParser.cpp.cvs Tue Nov 7 23:58:47 2006 @@ -1,298 +1,128 @@ -/* 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 /Users/sabre/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 DATALAYOUT 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 UDIV 335 +#define SDIV 336 +#define FDIV 337 +#define UREM 338 +#define SREM 339 +#define FREM 340 +#define AND 341 +#define OR 342 +#define XOR 343 +#define SETLE 344 +#define SETGE 345 +#define SETLT 346 +#define SETGT 347 +#define SETEQ 348 +#define SETNE 349 +#define MALLOC 350 +#define ALLOCA 351 +#define FREE 352 +#define LOAD 353 +#define STORE 354 +#define GETELEMENTPTR 355 +#define PHI_TOK 356 +#define CAST 357 +#define SELECT 358 +#define SHL 359 +#define SHR 360 +#define VAARG 361 +#define EXTRACTELEMENT 362 +#define INSERTELEMENT 363 +#define SHUFFLEVECTOR 364 +#define VAARG_old 365 +#define VANEXT_old 366 - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - ESINT64VAL = 258, - EUINT64VAL = 259, - SINTVAL = 260, - UINTVAL = 261, - FPVAL = 262, - VOID = 263, - BOOL = 264, - SBYTE = 265, - UBYTE = 266, - SHORT = 267, - USHORT = 268, - INT = 269, - UINT = 270, - LONG = 271, - ULONG = 272, - FLOAT = 273, - DOUBLE = 274, - TYPE = 275, - LABEL = 276, - VAR_ID = 277, - LABELSTR = 278, - STRINGCONSTANT = 279, - IMPLEMENTATION = 280, - ZEROINITIALIZER = 281, - TRUETOK = 282, - FALSETOK = 283, - BEGINTOK = 284, - ENDTOK = 285, - DECLARE = 286, - GLOBAL = 287, - CONSTANT = 288, - SECTION = 289, - VOLATILE = 290, - TO = 291, - DOTDOTDOT = 292, - NULL_TOK = 293, - UNDEF = 294, - CONST = 295, - INTERNAL = 296, - LINKONCE = 297, - WEAK = 298, - APPENDING = 299, - DLLIMPORT = 300, - DLLEXPORT = 301, - EXTERN_WEAK = 302, - OPAQUE = 303, - NOT = 304, - EXTERNAL = 305, - TARGET = 306, - TRIPLE = 307, - ENDIAN = 308, - POINTERSIZE = 309, - LITTLE = 310, - BIG = 311, - ALIGN = 312, - DEPLIBS = 313, - CALL = 314, - TAIL = 315, - ASM_TOK = 316, - MODULE = 317, - SIDEEFFECT = 318, - CC_TOK = 319, - CCC_TOK = 320, - CSRETCC_TOK = 321, - FASTCC_TOK = 322, - COLDCC_TOK = 323, - X86_STDCALLCC_TOK = 324, - X86_FASTCALLCC_TOK = 325, - DATALAYOUT = 326, - RET = 327, - BR = 328, - SWITCH = 329, - INVOKE = 330, - UNWIND = 331, - UNREACHABLE = 332, - ADD = 333, - SUB = 334, - MUL = 335, - UDIV = 336, - SDIV = 337, - FDIV = 338, - UREM = 339, - SREM = 340, - FREM = 341, - AND = 342, - OR = 343, - XOR = 344, - SETLE = 345, - SETGE = 346, - SETLT = 347, - SETGT = 348, - SETEQ = 349, - SETNE = 350, - MALLOC = 351, - ALLOCA = 352, - FREE = 353, - LOAD = 354, - STORE = 355, - GETELEMENTPTR = 356, - PHI_TOK = 357, - CAST = 358, - SELECT = 359, - SHL = 360, - SHR = 361, - VAARG = 362, - EXTRACTELEMENT = 363, - INSERTELEMENT = 364, - SHUFFLEVECTOR = 365, - VAARG_old = 366, - VANEXT_old = 367 - }; -#endif -/* Tokens. */ -#define ESINT64VAL 258 -#define EUINT64VAL 259 -#define SINTVAL 260 -#define UINTVAL 261 -#define FPVAL 262 -#define VOID 263 -#define BOOL 264 -#define SBYTE 265 -#define UBYTE 266 -#define SHORT 267 -#define USHORT 268 -#define INT 269 -#define UINT 270 -#define LONG 271 -#define ULONG 272 -#define FLOAT 273 -#define DOUBLE 274 -#define TYPE 275 -#define LABEL 276 -#define VAR_ID 277 -#define LABELSTR 278 -#define STRINGCONSTANT 279 -#define IMPLEMENTATION 280 -#define ZEROINITIALIZER 281 -#define TRUETOK 282 -#define FALSETOK 283 -#define BEGINTOK 284 -#define ENDTOK 285 -#define DECLARE 286 -#define GLOBAL 287 -#define CONSTANT 288 -#define SECTION 289 -#define VOLATILE 290 -#define TO 291 -#define DOTDOTDOT 292 -#define NULL_TOK 293 -#define UNDEF 294 -#define CONST 295 -#define INTERNAL 296 -#define LINKONCE 297 -#define WEAK 298 -#define APPENDING 299 -#define DLLIMPORT 300 -#define DLLEXPORT 301 -#define EXTERN_WEAK 302 -#define OPAQUE 303 -#define NOT 304 -#define EXTERNAL 305 -#define TARGET 306 -#define TRIPLE 307 -#define ENDIAN 308 -#define POINTERSIZE 309 -#define LITTLE 310 -#define BIG 311 -#define ALIGN 312 -#define DEPLIBS 313 -#define CALL 314 -#define TAIL 315 -#define ASM_TOK 316 -#define MODULE 317 -#define SIDEEFFECT 318 -#define CC_TOK 319 -#define CCC_TOK 320 -#define CSRETCC_TOK 321 -#define FASTCC_TOK 322 -#define COLDCC_TOK 323 -#define X86_STDCALLCC_TOK 324 -#define X86_FASTCALLCC_TOK 325 -#define DATALAYOUT 326 -#define RET 327 -#define BR 328 -#define SWITCH 329 -#define INVOKE 330 -#define UNWIND 331 -#define UNREACHABLE 332 -#define ADD 333 -#define SUB 334 -#define MUL 335 -#define UDIV 336 -#define SDIV 337 -#define FDIV 338 -#define UREM 339 -#define SREM 340 -#define FREM 341 -#define AND 342 -#define OR 343 -#define XOR 344 -#define SETLE 345 -#define SETGE 346 -#define SETLT 347 -#define SETGT 348 -#define SETEQ 349 -#define SETNE 350 -#define MALLOC 351 -#define ALLOCA 352 -#define FREE 353 -#define LOAD 354 -#define STORE 355 -#define GETELEMENTPTR 356 -#define PHI_TOK 357 -#define CAST 358 -#define SELECT 359 -#define SHL 360 -#define SHR 361 -#define VAARG 362 -#define EXTRACTELEMENT 363 -#define INSERTELEMENT 364 -#define SHUFFLEVECTOR 365 -#define VAARG_old 366 -#define VANEXT_old 367 - - - - -/* Copy the first part of user declarations. */ -#line 14 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 14 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" #include "ParserInternals.h" #include "llvm/CallingConv.h" @@ -1294,28 +1124,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 1016 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" -typedef union YYSTYPE { +#line 1016 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +typedef union { llvm::Module *ModuleVal; llvm::Function *FunctionVal; std::pair *ArgVal; @@ -1354,1466 +1164,1011 @@ OtherOpInfo OtherOpVal; llvm::Module::Endianness Endianness; } YYSTYPE; -/* Line 196 of yacc.c. */ -#line 1359 "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 1371 "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 521 +#define YYFLAG -32768 +#define YYNTBASE 127 + +#define YYTRANSLATE(x) ((unsigned)(x) <= 366 ? yytranslate[x] : 201) + +static const short yytranslate[] = { 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 116, + 117, 125, 2, 114, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 121, + 113, 122, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 118, 115, 120, 2, 2, 2, 2, 2, 126, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 119, + 2, 2, 123, 2, 124, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112 +}; -/* 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, 66, 68, 70, 72, 75, 76, 78, + 80, 82, 84, 86, 88, 90, 91, 92, 94, 96, + 98, 100, 102, 104, 107, 108, 111, 112, 116, 119, + 120, 122, 123, 127, 129, 132, 134, 136, 138, 140, + 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, + 162, 164, 166, 168, 170, 172, 174, 177, 182, 188, + 194, 198, 201, 204, 206, 210, 212, 216, 218, 219, + 224, 228, 232, 237, 242, 246, 249, 252, 255, 258, + 261, 264, 267, 270, 273, 276, 283, 289, 298, 305, + 312, 319, 326, 333, 342, 351, 355, 357, 359, 361, + 363, 366, 369, 374, 377, 379, 384, 387, 392, 393, + 401, 402, 410, 411, 419, 420, 428, 432, 437, 438, + 440, 442, 444, 448, 452, 456, 460, 464, 468, 470, + 471, 473, 475, 477, 478, 481, 485, 487, 489, 493, + 495, 496, 505, 507, 509, 513, 515, 517, 520, 521, + 523, 525, 526, 531, 532, 534, 536, 538, 540, 542, + 544, 546, 548, 550, 554, 556, 562, 564, 566, 568, + 570, 573, 576, 579, 583, 586, 587, 589, 592, 595, + 599, 609, 619, 628, 642, 644, 646, 653, 659, 662, + 669, 677, 679, 683, 685, 686, 689, 691, 697, 703, + 709, 712, 717, 722, 729, 734, 739, 744, 749, 756, + 763, 766, 774, 776, 779, 780, 782, 783, 787, 794, + 798, 805, 808, 813, 820 +}; -#endif +static const short yyrhs[] = { 5, + 0, 6, 0, 3, 0, 4, 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, 91, 0, 92, 0, 93, 0, 94, + 0, 95, 0, 105, 0, 106, 0, 16, 0, 14, + 0, 12, 0, 10, 0, 17, 0, 15, 0, 13, + 0, 11, 0, 133, 0, 134, 0, 18, 0, 19, + 0, 169, 113, 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, 114, 57, 4, 0, 34, 24, 0, 0, 142, + 0, 0, 114, 145, 144, 0, 142, 0, 57, 4, + 0, 148, 0, 8, 0, 150, 0, 8, 0, 150, + 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, 149, + 0, 184, 0, 115, 4, 0, 147, 116, 152, 117, + 0, 118, 4, 119, 150, 120, 0, 121, 4, 119, + 150, 122, 0, 123, 151, 124, 0, 123, 124, 0, + 150, 125, 0, 150, 0, 151, 114, 150, 0, 151, + 0, 151, 114, 37, 0, 37, 0, 0, 148, 118, + 155, 120, 0, 148, 118, 120, 0, 148, 126, 24, + 0, 148, 121, 155, 122, 0, 148, 123, 155, 124, + 0, 148, 123, 124, 0, 148, 38, 0, 148, 39, + 0, 148, 184, 0, 148, 154, 0, 148, 26, 0, + 133, 128, 0, 134, 4, 0, 9, 27, 0, 9, + 28, 0, 136, 7, 0, 103, 116, 153, 36, 148, + 117, 0, 101, 116, 153, 198, 117, 0, 104, 116, + 153, 114, 153, 114, 153, 117, 0, 129, 116, 153, + 114, 153, 117, 0, 130, 116, 153, 114, 153, 117, + 0, 131, 116, 153, 114, 153, 117, 0, 132, 116, + 153, 114, 153, 117, 0, 108, 116, 153, 114, 153, + 117, 0, 109, 116, 153, 114, 153, 114, 153, 117, + 0, 110, 116, 153, 114, 153, 114, 153, 117, 0, + 155, 114, 153, 0, 153, 0, 32, 0, 33, 0, + 158, 0, 158, 178, 0, 158, 180, 0, 158, 62, + 61, 164, 0, 158, 25, 0, 159, 0, 159, 137, + 20, 146, 0, 159, 180, 0, 159, 62, 61, 164, + 0, 0, 159, 137, 138, 156, 153, 160, 144, 0, + 0, 159, 137, 50, 156, 148, 161, 144, 0, 0, + 159, 137, 45, 156, 148, 162, 144, 0, 0, 159, + 137, 47, 156, 148, 163, 144, 0, 159, 51, 166, + 0, 159, 58, 113, 167, 0, 0, 24, 0, 56, + 0, 55, 0, 53, 113, 165, 0, 54, 113, 4, + 0, 52, 113, 24, 0, 71, 113, 24, 0, 118, + 168, 120, 0, 168, 114, 24, 0, 24, 0, 0, + 22, 0, 24, 0, 169, 0, 0, 148, 170, 0, + 172, 114, 171, 0, 171, 0, 172, 0, 172, 114, + 37, 0, 37, 0, 0, 139, 146, 169, 116, 173, + 117, 143, 140, 0, 29, 0, 123, 0, 138, 174, + 175, 0, 30, 0, 124, 0, 187, 177, 0, 0, + 45, 0, 47, 0, 0, 31, 181, 179, 174, 0, + 0, 63, 0, 3, 0, 4, 0, 7, 0, 27, + 0, 28, 0, 38, 0, 39, 0, 26, 0, 121, + 155, 122, 0, 154, 0, 61, 182, 24, 114, 24, + 0, 127, 0, 169, 0, 184, 0, 183, 0, 148, + 185, 0, 187, 188, 0, 176, 188, 0, 189, 137, + 190, 0, 189, 192, 0, 0, 23, 0, 72, 186, + 0, 72, 8, 0, 73, 21, 185, 0, 73, 9, + 185, 114, 21, 185, 114, 21, 185, 0, 74, 135, + 185, 114, 21, 185, 118, 191, 120, 0, 74, 135, + 185, 114, 21, 185, 118, 120, 0, 75, 139, 146, + 185, 116, 195, 117, 36, 21, 185, 76, 21, 185, + 0, 76, 0, 77, 0, 191, 135, 183, 114, 21, + 185, 0, 135, 183, 114, 21, 185, 0, 137, 197, + 0, 148, 118, 185, 114, 185, 120, 0, 193, 114, + 118, 185, 114, 185, 120, 0, 186, 0, 194, 114, + 186, 0, 194, 0, 0, 60, 59, 0, 59, 0, + 129, 148, 185, 114, 185, 0, 130, 148, 185, 114, + 185, 0, 131, 148, 185, 114, 185, 0, 49, 186, + 0, 132, 186, 114, 186, 0, 103, 186, 36, 148, + 0, 104, 186, 114, 186, 114, 186, 0, 107, 186, + 114, 148, 0, 111, 186, 114, 148, 0, 112, 186, + 114, 148, 0, 108, 186, 114, 186, 0, 109, 186, + 114, 186, 114, 186, 0, 110, 186, 114, 186, 114, + 186, 0, 102, 193, 0, 196, 139, 146, 185, 116, + 195, 117, 0, 200, 0, 114, 194, 0, 0, 35, + 0, 0, 96, 148, 141, 0, 96, 148, 114, 15, + 185, 141, 0, 97, 148, 141, 0, 97, 148, 114, + 15, 185, 141, 0, 98, 186, 0, 199, 99, 148, + 185, 0, 199, 100, 186, 114, 148, 185, 0, 101, + 148, 185, 198, 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 1357 - -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 127 -/* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 75 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 256 -/* YYNRULES -- Number of states. */ -#define YYNSTATES 521 - -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ -#define YYUNDEFTOK 2 -#define YYMAXUTOK 367 - -#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, - 116, 117, 125, 2, 114, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 121, 113, 122, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 118, 115, 120, 2, 2, 2, 2, 2, 126, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 119, 2, 2, 123, 2, 124, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112 +#if YYDEBUG != 0 +static const short yyrline[] = { 0, + 1139, 1140, 1148, 1149, 1159, 1159, 1159, 1159, 1159, 1159, + 1159, 1159, 1159, 1160, 1160, 1160, 1161, 1161, 1161, 1161, + 1161, 1161, 1163, 1163, 1167, 1167, 1167, 1167, 1168, 1168, + 1168, 1168, 1169, 1169, 1170, 1170, 1173, 1177, 1182, 1182, + 1183, 1184, 1185, 1186, 1187, 1188, 1191, 1191, 1192, 1193, + 1194, 1195, 1196, 1197, 1207, 1207, 1214, 1214, 1223, 1231, + 1231, 1237, 1237, 1239, 1244, 1258, 1258, 1259, 1259, 1261, + 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1272, 1272, 1272, + 1272, 1272, 1272, 1273, 1277, 1281, 1289, 1297, 1310, 1315, + 1327, 1337, 1341, 1352, 1357, 1363, 1364, 1368, 1372, 1383, + 1409, 1423, 1453, 1479, 1500, 1513, 1523, 1528, 1589, 1596, + 1605, 1611, 1617, 1621, 1625, 1633, 1644, 1676, 1684, 1711, + 1722, 1728, 1736, 1742, 1748, 1757, 1761, 1769, 1769, 1779, + 1787, 1792, 1796, 1800, 1804, 1819, 1841, 1844, 1847, 1852, + 1855, 1859, 1863, 1867, 1871, 1876, 1880, 1883, 1886, 1890, + 1903, 1904, 1906, 1910, 1919, 1923, 1928, 1930, 1935, 1940, + 1949, 1949, 1950, 1950, 1952, 1959, 1965, 1972, 1976, 1982, + 1987, 1992, 2087, 2087, 2089, 2097, 2097, 2099, 2104, 2104, + 2105, 2108, 2108, 2118, 2122, 2127, 2131, 2135, 2139, 2143, + 2147, 2151, 2155, 2159, 2184, 2188, 2202, 2206, 2212, 2212, + 2218, 2223, 2227, 2236, 2247, 2252, 2264, 2277, 2281, 2285, + 2290, 2299, 2318, 2327, 2383, 2387, 2394, 2405, 2418, 2427, + 2436, 2446, 2450, 2457, 2457, 2459, 2463, 2468, 2490, 2505, + 2519, 2532, 2540, 2548, 2556, 2562, 2582, 2605, 2611, 2617, + 2623, 2638, 2697, 2704, 2707, 2712, 2716, 2723, 2728, 2734, + 2739, 2745, 2753, 2765, 2780 }; +#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, 69, 71, 73, 75, 78, - 79, 81, 83, 85, 87, 89, 91, 93, 94, 95, - 97, 99, 101, 103, 105, 107, 110, 111, 114, 115, - 119, 122, 123, 125, 126, 130, 132, 135, 137, 139, - 141, 143, 145, 147, 149, 151, 153, 155, 157, 159, - 161, 163, 165, 167, 169, 171, 173, 175, 177, 180, - 185, 191, 197, 201, 204, 207, 209, 213, 215, 219, - 221, 222, 227, 231, 235, 240, 245, 249, 252, 255, - 258, 261, 264, 267, 270, 273, 276, 279, 286, 292, - 301, 308, 315, 322, 329, 336, 345, 354, 358, 360, - 362, 364, 366, 369, 372, 377, 380, 382, 387, 390, - 395, 396, 404, 405, 413, 414, 422, 423, 431, 435, - 440, 441, 443, 445, 447, 451, 455, 459, 463, 467, - 471, 473, 474, 476, 478, 480, 481, 484, 488, 490, - 492, 496, 498, 499, 508, 510, 512, 516, 518, 520, - 523, 524, 526, 528, 529, 534, 535, 537, 539, 541, - 543, 545, 547, 549, 551, 553, 557, 559, 565, 567, - 569, 571, 573, 576, 579, 582, 586, 589, 590, 592, - 595, 598, 602, 612, 622, 631, 645, 647, 649, 656, - 662, 665, 672, 680, 682, 686, 688, 689, 692, 694, - 700, 706, 712, 715, 720, 725, 732, 737, 742, 747, - 752, 759, 766, 769, 777, 779, 782, 783, 785, 786, - 790, 797, 801, 808, 811, 816, 823 -}; -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const short int yyrhs[] = -{ - 158, 0, -1, 5, -1, 6, -1, 3, -1, 4, - -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, 91, -1, 92, - -1, 93, -1, 94, -1, 95, -1, 105, -1, 106, - -1, 16, -1, 14, -1, 12, -1, 10, -1, 17, - -1, 15, -1, 13, -1, 11, -1, 134, -1, 135, - -1, 18, -1, 19, -1, 170, 113, -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, 114, 57, 4, -1, 34, - 24, -1, -1, 143, -1, -1, 114, 146, 145, -1, - 143, -1, 57, 4, -1, 149, -1, 8, -1, 151, - -1, 8, -1, 151, -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, 150, -1, 185, -1, 115, 4, -1, - 148, 116, 153, 117, -1, 118, 4, 119, 151, 120, - -1, 121, 4, 119, 151, 122, -1, 123, 152, 124, - -1, 123, 124, -1, 151, 125, -1, 151, -1, 152, - 114, 151, -1, 152, -1, 152, 114, 37, -1, 37, - -1, -1, 149, 118, 156, 120, -1, 149, 118, 120, - -1, 149, 126, 24, -1, 149, 121, 156, 122, -1, - 149, 123, 156, 124, -1, 149, 123, 124, -1, 149, - 38, -1, 149, 39, -1, 149, 185, -1, 149, 155, - -1, 149, 26, -1, 134, 129, -1, 135, 4, -1, - 9, 27, -1, 9, 28, -1, 137, 7, -1, 103, - 116, 154, 36, 149, 117, -1, 101, 116, 154, 199, - 117, -1, 104, 116, 154, 114, 154, 114, 154, 117, - -1, 130, 116, 154, 114, 154, 117, -1, 131, 116, - 154, 114, 154, 117, -1, 132, 116, 154, 114, 154, - 117, -1, 133, 116, 154, 114, 154, 117, -1, 108, - 116, 154, 114, 154, 117, -1, 109, 116, 154, 114, - 154, 114, 154, 117, -1, 110, 116, 154, 114, 154, - 114, 154, 117, -1, 156, 114, 154, -1, 154, -1, - 32, -1, 33, -1, 159, -1, 159, 179, -1, 159, - 181, -1, 159, 62, 61, 165, -1, 159, 25, -1, - 160, -1, 160, 138, 20, 147, -1, 160, 181, -1, - 160, 62, 61, 165, -1, -1, 160, 138, 139, 157, - 154, 161, 145, -1, -1, 160, 138, 50, 157, 149, - 162, 145, -1, -1, 160, 138, 45, 157, 149, 163, - 145, -1, -1, 160, 138, 47, 157, 149, 164, 145, - -1, 160, 51, 167, -1, 160, 58, 113, 168, -1, - -1, 24, -1, 56, -1, 55, -1, 53, 113, 166, - -1, 54, 113, 4, -1, 52, 113, 24, -1, 71, - 113, 24, -1, 118, 169, 120, -1, 169, 114, 24, - -1, 24, -1, -1, 22, -1, 24, -1, 170, -1, - -1, 149, 171, -1, 173, 114, 172, -1, 172, -1, - 173, -1, 173, 114, 37, -1, 37, -1, -1, 140, - 147, 170, 116, 174, 117, 144, 141, -1, 29, -1, - 123, -1, 139, 175, 176, -1, 30, -1, 124, -1, - 188, 178, -1, -1, 45, -1, 47, -1, -1, 31, - 182, 180, 175, -1, -1, 63, -1, 3, -1, 4, - -1, 7, -1, 27, -1, 28, -1, 38, -1, 39, - -1, 26, -1, 121, 156, 122, -1, 155, -1, 61, - 183, 24, 114, 24, -1, 128, -1, 170, -1, 185, - -1, 184, -1, 149, 186, -1, 188, 189, -1, 177, - 189, -1, 190, 138, 191, -1, 190, 193, -1, -1, - 23, -1, 72, 187, -1, 72, 8, -1, 73, 21, - 186, -1, 73, 9, 186, 114, 21, 186, 114, 21, - 186, -1, 74, 136, 186, 114, 21, 186, 118, 192, - 120, -1, 74, 136, 186, 114, 21, 186, 118, 120, - -1, 75, 140, 147, 186, 116, 196, 117, 36, 21, - 186, 76, 21, 186, -1, 76, -1, 77, -1, 192, - 136, 184, 114, 21, 186, -1, 136, 184, 114, 21, - 186, -1, 138, 198, -1, 149, 118, 186, 114, 186, - 120, -1, 194, 114, 118, 186, 114, 186, 120, -1, - 187, -1, 195, 114, 187, -1, 195, -1, -1, 60, - 59, -1, 59, -1, 130, 149, 186, 114, 186, -1, - 131, 149, 186, 114, 186, -1, 132, 149, 186, 114, - 186, -1, 49, 187, -1, 133, 187, 114, 187, -1, - 103, 187, 36, 149, -1, 104, 187, 114, 187, 114, - 187, -1, 107, 187, 114, 149, -1, 111, 187, 114, - 149, -1, 112, 187, 114, 149, -1, 108, 187, 114, - 187, -1, 109, 187, 114, 187, 114, 187, -1, 110, - 187, 114, 187, 114, 187, -1, 102, 194, -1, 197, - 140, 147, 186, 116, 196, 117, -1, 201, -1, 114, - 195, -1, -1, 35, -1, -1, 96, 149, 142, -1, - 96, 149, 114, 15, 186, 142, -1, 97, 149, 142, - -1, 97, 149, 114, 15, 186, 142, -1, 98, 187, - -1, 200, 99, 149, 186, -1, 200, 100, 187, 114, - 149, 186, -1, 101, 149, 186, 199, -1 -}; +#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const unsigned short int yyrline[] = -{ - 0, 1139, 1139, 1140, 1148, 1149, 1159, 1159, 1159, 1159, - 1159, 1159, 1159, 1159, 1159, 1160, 1160, 1160, 1161, 1161, - 1161, 1161, 1161, 1161, 1163, 1163, 1167, 1167, 1167, 1167, - 1168, 1168, 1168, 1168, 1169, 1169, 1170, 1170, 1173, 1177, - 1182, 1183, 1184, 1185, 1186, 1187, 1188, 1189, 1191, 1192, - 1193, 1194, 1195, 1196, 1197, 1198, 1207, 1208, 1214, 1215, - 1223, 1231, 1232, 1237, 1238, 1239, 1244, 1258, 1258, 1259, - 1259, 1261, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1272, - 1272, 1272, 1272, 1272, 1272, 1273, 1277, 1281, 1289, 1297, - 1310, 1315, 1327, 1337, 1341, 1352, 1357, 1363, 1364, 1368, - 1372, 1383, 1409, 1423, 1453, 1479, 1500, 1513, 1523, 1528, - 1589, 1596, 1605, 1611, 1617, 1621, 1625, 1633, 1644, 1676, - 1684, 1711, 1722, 1728, 1736, 1742, 1748, 1757, 1761, 1769, - 1769, 1779, 1787, 1792, 1796, 1800, 1804, 1819, 1841, 1844, - 1847, 1847, 1855, 1855, 1863, 1863, 1871, 1871, 1880, 1883, - 1886, 1890, 1903, 1904, 1906, 1910, 1919, 1923, 1928, 1930, - 1935, 1940, 1949, 1949, 1950, 1950, 1952, 1959, 1965, 1972, - 1976, 1982, 1987, 1992, 2087, 2087, 2089, 2097, 2097, 2099, - 2104, 2105, 2106, 2108, 2108, 2118, 2122, 2127, 2131, 2135, - 2139, 2143, 2147, 2151, 2155, 2159, 2184, 2188, 2202, 2206, - 2212, 2212, 2218, 2223, 2227, 2236, 2247, 2252, 2264, 2277, - 2281, 2285, 2290, 2299, 2318, 2327, 2383, 2387, 2394, 2405, - 2418, 2427, 2436, 2446, 2450, 2457, 2457, 2459, 2463, 2468, - 2490, 2505, 2519, 2532, 2540, 2548, 2556, 2562, 2582, 2605, - 2611, 2617, 2623, 2638, 2697, 2704, 2707, 2712, 2716, 2723, - 2728, 2734, 2739, 2745, 2753, 2765, 2780 +static const char * const yytname[] = { "$","error","$undefined.","ESINT64VAL", +"EUINT64VAL","SINTVAL","UINTVAL","FPVAL","VOID","BOOL","SBYTE","UBYTE","SHORT", +"USHORT","INT","UINT","LONG","ULONG","FLOAT","DOUBLE","TYPE","LABEL","VAR_ID", +"LABELSTR","STRINGCONSTANT","IMPLEMENTATION","ZEROINITIALIZER","TRUETOK","FALSETOK", +"BEGINTOK","ENDTOK","DECLARE","GLOBAL","CONSTANT","SECTION","VOLATILE","TO", +"DOTDOTDOT","NULL_TOK","UNDEF","CONST","INTERNAL","LINKONCE","WEAK","APPENDING", +"DLLIMPORT","DLLEXPORT","EXTERN_WEAK","OPAQUE","NOT","EXTERNAL","TARGET","TRIPLE", +"ENDIAN","POINTERSIZE","LITTLE","BIG","ALIGN","DEPLIBS","CALL","TAIL","ASM_TOK", +"MODULE","SIDEEFFECT","CC_TOK","CCC_TOK","CSRETCC_TOK","FASTCC_TOK","COLDCC_TOK", +"X86_STDCALLCC_TOK","X86_FASTCALLCC_TOK","DATALAYOUT","RET","BR","SWITCH","INVOKE", +"UNWIND","UNREACHABLE","ADD","SUB","MUL","UDIV","SDIV","FDIV","UREM","SREM", +"FREM","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", "DATALAYOUT", - "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB", - "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "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, + 127, 127, 128, 128, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 130, 130, 130, 131, 131, 131, 131, + 131, 131, 132, 132, 133, 133, 133, 133, 134, 134, + 134, 134, 135, 135, 136, 136, 137, 137, 138, 138, + 138, 138, 138, 138, 138, 138, 139, 139, 139, 139, + 139, 139, 139, 139, 140, 140, 141, 141, 142, 143, + 143, 144, 144, 145, 145, 146, 146, 147, 147, 148, + 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, 152, 152, 153, + 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, + 153, 153, 153, 153, 153, 154, 154, 154, 154, 154, + 154, 154, 154, 154, 154, 155, 155, 156, 156, 157, + 158, 158, 158, 158, 158, 159, 159, 159, 160, 159, + 161, 159, 162, 159, 163, 159, 159, 159, 159, 164, + 165, 165, 166, 166, 166, 166, 167, 168, 168, 168, + 169, 169, 170, 170, 171, 172, 172, 173, 173, 173, + 173, 174, 175, 175, 176, 177, 177, 178, 179, 179, + 179, 181, 180, 182, 182, 183, 183, 183, 183, 183, + 183, 183, 183, 183, 183, 183, 184, 184, 185, 185, + 186, 187, 187, 188, 189, 189, 189, 190, 190, 190, + 190, 190, 190, 190, 190, 190, 191, 191, 192, 193, + 193, 194, 194, 195, 195, 196, 196, 197, 197, 197, + 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, + 197, 197, 197, 198, 198, 199, 199, 200, 200, 200, + 200, 200, 200, 200, 200 }; -#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, 363, 364, - 365, 366, 367, 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, 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, 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, 127, 128, 128, 129, 129, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 131, 131, 131, 132, 132, - 132, 132, 132, 132, 133, 133, 134, 134, 134, 134, - 135, 135, 135, 135, 136, 136, 137, 137, 138, 138, - 139, 139, 139, 139, 139, 139, 139, 139, 140, 140, - 140, 140, 140, 140, 140, 140, 141, 141, 142, 142, - 143, 144, 144, 145, 145, 146, 146, 147, 147, 148, - 148, 149, 150, 150, 150, 150, 150, 150, 150, 150, - 150, 150, 150, 150, 150, 151, 151, 151, 151, 151, - 151, 151, 151, 151, 151, 152, 152, 153, 153, 153, - 153, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 155, 155, 155, - 155, 155, 155, 155, 155, 155, 155, 156, 156, 157, - 157, 158, 159, 159, 159, 159, 159, 160, 160, 160, - 161, 160, 162, 160, 163, 160, 164, 160, 160, 160, - 160, 165, 166, 166, 167, 167, 167, 167, 168, 169, - 169, 169, 170, 170, 171, 171, 172, 173, 173, 174, - 174, 174, 174, 175, 176, 176, 177, 178, 178, 179, - 180, 180, 180, 182, 181, 183, 183, 184, 184, 184, - 184, 184, 184, 184, 184, 184, 184, 184, 185, 185, - 186, 186, 187, 188, 188, 189, 190, 190, 190, 191, - 191, 191, 191, 191, 191, 191, 191, 191, 192, 192, - 193, 194, 194, 195, 195, 196, 196, 197, 197, 198, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 198, 198, 198, 199, 199, 200, 200, 201, - 201, 201, 201, 201, 201, 201, 201 +static const short yydefact[] = { 149, + 46, 135, 134, 182, 39, 40, 41, 42, 43, 44, + 45, 0, 47, 206, 131, 132, 206, 161, 162, 0, + 0, 0, 46, 0, 137, 179, 0, 0, 48, 49, + 50, 51, 52, 53, 0, 0, 207, 203, 38, 176, + 177, 178, 202, 0, 0, 0, 0, 147, 0, 0, + 0, 0, 0, 0, 0, 37, 180, 181, 47, 150, + 133, 54, 1, 2, 67, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 0, + 0, 0, 0, 197, 0, 0, 66, 85, 70, 198, + 86, 173, 174, 175, 247, 205, 0, 0, 0, 0, + 160, 148, 138, 136, 128, 129, 0, 0, 0, 0, + 183, 87, 0, 0, 69, 92, 94, 0, 0, 99, + 93, 246, 0, 227, 0, 0, 0, 0, 47, 215, + 216, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, + 0, 0, 0, 0, 0, 0, 23, 24, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 204, 47, + 219, 0, 243, 155, 152, 151, 153, 154, 156, 159, + 0, 143, 145, 141, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 0, 0, 0, 0, 139, + 0, 0, 0, 91, 171, 98, 96, 0, 0, 231, + 226, 209, 208, 0, 0, 28, 32, 27, 31, 26, + 30, 25, 29, 33, 34, 0, 0, 57, 57, 252, + 0, 0, 241, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 157, + 62, 62, 62, 113, 114, 3, 4, 111, 112, 115, + 110, 106, 107, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 109, 108, 62, + 68, 68, 95, 170, 164, 167, 168, 0, 0, 88, + 186, 187, 188, 193, 189, 190, 191, 192, 184, 0, + 195, 200, 199, 201, 0, 210, 0, 0, 0, 248, + 0, 250, 245, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 158, 0, 144, 146, 142, 0, 0, 0, 0, 0, + 0, 101, 127, 0, 0, 105, 0, 102, 0, 0, + 0, 0, 140, 89, 90, 163, 165, 0, 60, 97, + 185, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 255, 0, 0, 233, 0, 235, 238, 0, 0, 236, + 237, 0, 0, 0, 232, 0, 253, 0, 0, 0, + 64, 62, 245, 0, 0, 0, 0, 0, 0, 100, + 103, 104, 0, 0, 0, 0, 169, 166, 61, 55, + 0, 194, 0, 0, 225, 57, 58, 57, 222, 244, + 0, 0, 0, 0, 0, 228, 229, 230, 225, 0, + 59, 65, 63, 0, 0, 0, 0, 0, 0, 126, + 0, 0, 0, 0, 0, 172, 0, 0, 0, 224, + 0, 0, 249, 251, 0, 0, 0, 234, 239, 240, + 0, 254, 117, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 56, 196, 0, 0, 0, 223, 220, 0, + 242, 116, 0, 123, 0, 0, 119, 120, 121, 122, + 0, 213, 0, 0, 0, 221, 0, 0, 0, 211, + 0, 212, 0, 0, 118, 124, 125, 0, 0, 0, + 0, 0, 0, 218, 0, 0, 217, 214, 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, 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, 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[] = { 84, + 258, 274, 275, 276, 277, 196, 197, 226, 198, 23, + 13, 35, 446, 310, 391, 410, 333, 392, 85, 86, + 199, 88, 89, 118, 208, 343, 301, 344, 107, 519, + 1, 2, 280, 253, 251, 252, 61, 177, 48, 102, + 181, 90, 357, 286, 287, 288, 36, 94, 14, 42, + 15, 59, 16, 26, 362, 302, 91, 304, 419, 17, + 38, 39, 169, 494, 96, 233, 450, 451, 170, 171, + 371, 172, 173 }; -/* 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 short int yydefact[] = -{ - 150, 0, 47, 136, 1, 135, 183, 40, 41, 42, - 43, 44, 45, 46, 0, 48, 207, 132, 133, 207, - 162, 163, 0, 0, 0, 47, 0, 138, 180, 0, - 0, 49, 50, 51, 52, 53, 54, 0, 0, 208, - 204, 39, 177, 178, 179, 203, 0, 0, 0, 0, - 148, 0, 0, 0, 0, 0, 0, 0, 38, 181, - 182, 48, 151, 134, 55, 2, 3, 68, 72, 73, - 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, - 84, 85, 0, 0, 0, 0, 198, 0, 0, 67, - 86, 71, 199, 87, 174, 175, 176, 248, 206, 0, - 0, 0, 0, 161, 149, 139, 137, 129, 130, 0, - 0, 0, 0, 184, 88, 0, 0, 70, 93, 95, - 0, 0, 100, 94, 247, 0, 228, 0, 0, 0, - 0, 48, 216, 217, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 0, 0, 0, 0, 0, 0, 0, 24, - 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 205, 48, 220, 0, 244, 156, 153, 152, 154, - 155, 157, 160, 0, 144, 146, 142, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 0, 0, - 0, 0, 140, 0, 0, 0, 92, 172, 99, 97, - 0, 0, 232, 227, 210, 209, 0, 0, 29, 33, - 28, 32, 27, 31, 26, 30, 34, 35, 0, 0, - 58, 58, 253, 0, 0, 242, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 158, 63, 63, 63, 114, 115, 4, 5, - 112, 113, 116, 111, 107, 108, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 110, 109, 63, 69, 69, 96, 171, 165, 168, 169, - 0, 0, 89, 187, 188, 189, 194, 190, 191, 192, - 193, 185, 0, 196, 201, 200, 202, 0, 211, 0, - 0, 0, 249, 0, 251, 246, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 159, 0, 145, 147, 143, 0, 0, - 0, 0, 0, 0, 102, 128, 0, 0, 106, 0, - 103, 0, 0, 0, 0, 141, 90, 91, 164, 166, - 0, 61, 98, 186, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 256, 0, 0, 234, 0, 236, 239, - 0, 0, 237, 238, 0, 0, 0, 233, 0, 254, - 0, 0, 0, 65, 63, 246, 0, 0, 0, 0, - 0, 0, 101, 104, 105, 0, 0, 0, 0, 170, - 167, 62, 56, 0, 195, 0, 0, 226, 58, 59, - 58, 223, 245, 0, 0, 0, 0, 0, 229, 230, - 231, 226, 0, 60, 66, 64, 0, 0, 0, 0, - 0, 0, 127, 0, 0, 0, 0, 0, 173, 0, - 0, 0, 225, 0, 0, 250, 252, 0, 0, 0, - 235, 240, 241, 0, 255, 118, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 57, 197, 0, 0, 0, - 224, 221, 0, 243, 117, 0, 124, 0, 0, 120, - 121, 122, 123, 0, 214, 0, 0, 0, 222, 0, - 0, 0, 212, 0, 213, 0, 0, 119, 125, 126, - 0, 0, 0, 0, 0, 0, 219, 0, 0, 218, - 215 +static const short yypact[] = {-32768, + 184, 610,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, +-32768, -46, 135, -1,-32768,-32768, -18,-32768,-32768, 15, + -72, -24, 51, -62,-32768, 19, 61, 98,-32768,-32768, +-32768,-32768,-32768,-32768, 1070, -20,-32768,-32768, 85,-32768, +-32768,-32768,-32768, 33, 56, 60, 62,-32768, 54, 61, + 1070, 90, 90, 90, 90,-32768,-32768,-32768, 135,-32768, +-32768,-32768,-32768,-32768, 58,-32768,-32768,-32768,-32768,-32768, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 173, + 174, 176, 576,-32768, 85, 66,-32768,-32768, -26,-32768, +-32768,-32768,-32768,-32768, 1245,-32768, 157, 83, 179, 162, + 166,-32768,-32768,-32768,-32768,-32768, 1111, 1111, 1111, 1152, +-32768,-32768, 75, 76,-32768,-32768, -26, -78, 80, 865, +-32768,-32768, 1111,-32768, 138, 1193, 24, 151, 135,-32768, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 1111, + 1111, 1111, 1111, 1111, 1111, 1111,-32768,-32768, 1111, 1111, + 1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111,-32768, 135, +-32768, 41,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + -10,-32768,-32768,-32768, 115, 145, 202, 147, 203, 149, + 204, 152, 206, 212, 213, 154, 217, 215, 419,-32768, + 1111, 1111, 1111,-32768, 906,-32768, 118, 116, 643,-32768, +-32768, 58,-32768, 643, 643,-32768,-32768,-32768,-32768,-32768, +-32768,-32768,-32768,-32768,-32768, 643, 1070, 120, 121,-32768, + 643, 124, 129, 208, 131, 133, 134, 140, 141, 142, + 143, 643, 643, 643, 144, 1070, 1111, 1111, 236,-32768, + 148, 148, 148,-32768,-32768,-32768,-32768,-32768,-32768,-32768, +-32768,-32768,-32768, 150, 153, 155, 156, 159, 160, 947, + 1152, 596, 237, 161, 164, 175, 177,-32768,-32768, 148, + -81, -38, -26,-32768, 85,-32768, 180, 146, 988,-32768, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 201, 1152, +-32768,-32768,-32768,-32768, 182,-32768, 183, 643, -2,-32768, + 6,-32768, 186, 643, 185, 1111, 1111, 1111, 1111, 1111, + 1111, 1111, 1111, 187, 188, 190, 1111, 643, 643, 191, +-32768, -23,-32768,-32768,-32768, 1152, 1152, 1152, 1152, 1152, + 1152,-32768,-32768, -9, -52,-32768, -76,-32768, 1152, 1152, + 1152, 1152,-32768,-32768,-32768,-32768,-32768, 1029, 231,-32768, +-32768, 243, -14, 247, 249, 193, 643, 294, 643, 1111, +-32768, 196, 643,-32768, 197,-32768,-32768, 199, 205,-32768, +-32768, 643, 643, 643,-32768, 200,-32768, 1111, 291, 313, +-32768, 148, 186, 288, 211, 216, 218, 219, 1152,-32768, +-32768,-32768, 220, 226, 232, 233,-32768,-32768,-32768, 269, + 234,-32768, 643, 643, 1111, 240,-32768, 240,-32768, 241, + 643, 242, 1111, 1111, 1111,-32768,-32768,-32768, 1111, 643, +-32768,-32768,-32768, 214, 1111, 1152, 1152, 1152, 1152,-32768, + 1152, 1152, 1152, 1152, 341,-32768, 327, 246, 239, 241, + 244, 305,-32768,-32768, 1111, 245, 643,-32768,-32768,-32768, + 252,-32768,-32768, 253, 250, 254, 259, 260, 262, 264, + 265, 267,-32768,-32768, 342, 14, 340,-32768,-32768, 257, +-32768,-32768, 1152,-32768, 1152, 1152,-32768,-32768,-32768,-32768, + 643,-32768, 751, 65, 366,-32768, 274, 278, 279,-32768, + 283,-32768, 751, 643,-32768,-32768,-32768, 377, 285, 325, + 643, 382, 383,-32768, 643, 643,-32768,-32768, 405, 406, +-32768 }; -/* YYDEFGOTO[NTERM-NUM]. */ -static const short int yydefgoto[] = -{ - -1, 86, 260, 276, 277, 278, 279, 198, 199, 228, - 200, 25, 15, 37, 448, 312, 393, 412, 335, 394, - 87, 88, 201, 90, 91, 120, 210, 345, 303, 346, - 109, 1, 2, 3, 282, 255, 253, 254, 63, 179, - 50, 104, 183, 92, 359, 288, 289, 290, 38, 96, - 16, 44, 17, 61, 18, 28, 364, 304, 93, 306, - 421, 19, 40, 41, 171, 496, 98, 235, 452, 453, - 172, 173, 373, 174, 175 +static const short yypgoto[] = {-32768, +-32768, 312, 314, 315, 316, -127, -126, -462,-32768, 369, + 389, -87,-32768, -225, 55,-32768, -245,-32768, -48,-32768, + -35,-32768, -66, 293,-32768, -100, 222, -253, 59,-32768, +-32768,-32768,-32768,-32768,-32768,-32768, 365,-32768,-32768,-32768, +-32768, 4,-32768, 68,-32768,-32768, 357,-32768,-32768,-32768, +-32768,-32768, 415,-32768,-32768, -453, -55, 64, -103,-32768, + 401,-32768,-32768,-32768,-32768,-32768, 49, -7,-32768,-32768, + 30,-32768,-32768 }; -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -447 -static const short int yypact[] = -{ - -447, 33, 122, 610, -447, -447, -447, -447, -447, -447, - -447, -447, -447, -447, -13, 161, 47, -447, -447, -15, - -447, -447, 15, 10, 91, -6, 48, -447, 19, 138, - 168, -447, -447, -447, -447, -447, -447, 1070, -20, -447, - -447, 70, -447, -447, -447, -447, 60, 61, 64, 67, - -447, 63, 138, 1070, 106, 106, 106, 106, -447, -447, - -447, 161, -447, -447, -447, -447, -447, 59, -447, -447, - -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, - -447, -447, 174, 178, 179, 576, -447, 70, 74, -447, - -447, -54, -447, -447, -447, -447, -447, 1245, -447, 162, - -44, 190, 171, 172, -447, -447, -447, -447, -447, 1111, - 1111, 1111, 1152, -447, -447, 78, 88, -447, -447, -54, - -29, 92, 865, -447, -447, 1111, -447, 150, 1193, 75, - 189, 161, -447, -447, -447, -447, -447, -447, -447, -447, - -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, - -447, -447, 1111, 1111, 1111, 1111, 1111, 1111, 1111, -447, - -447, 1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111, - 1111, -447, 161, -447, 8, -447, -447, -447, -447, -447, - -447, -447, -447, -10, -447, -447, -447, 113, 139, 206, - 145, 211, 147, 215, 152, 216, 214, 225, 154, 218, - 226, 419, -447, 1111, 1111, 1111, -447, 906, -447, 120, - 118, 643, -447, -447, 59, -447, 643, 643, -447, -447, - -447, -447, -447, -447, -447, -447, -447, -447, 643, 1070, - 128, 129, -447, 643, 126, 131, 210, 133, 134, 140, - 141, 142, 143, 144, 643, 643, 643, 146, 1070, 1111, - 1111, 237, -447, 148, 148, 148, -447, -447, -447, -447, - -447, -447, -447, -447, -447, -447, 149, 151, 153, 155, - 156, 159, 947, 1152, 596, 239, 160, 164, 175, 177, - -447, -447, 148, -74, -23, -54, -447, 70, -447, 163, - 180, 988, -447, -447, -447, -447, -447, -447, -447, -447, - -447, 201, 1152, -447, -447, -447, -447, 182, -447, 184, - 643, -2, -447, 6, -447, 186, 643, 176, 1111, 1111, - 1111, 1111, 1111, 1111, 1111, 1111, 187, 188, 191, 1111, - 643, 643, 195, -447, -12, -447, -447, -447, 1152, 1152, - 1152, 1152, 1152, 1152, -447, -447, -9, -21, -447, -27, - -447, 1152, 1152, 1152, 1152, -447, -447, -447, -447, -447, - 1029, 232, -447, -447, 244, -16, 249, 282, 194, 643, - 300, 643, 1111, -447, 197, 643, -447, 199, -447, -447, - 202, 203, -447, -447, 643, 643, 643, -447, 208, -447, - 1111, 291, 315, -447, 148, 186, 289, 212, 217, 219, - 220, 1152, -447, -447, -447, 231, 233, 234, 240, -447, - -447, -447, 273, 241, -447, 643, 643, 1111, 242, -447, - 242, -447, 243, 643, 246, 1111, 1111, 1111, -447, -447, - -447, 1111, 643, -447, -447, -447, 223, 1111, 1152, 1152, - 1152, 1152, -447, 1152, 1152, 1152, 1152, 328, -447, 322, - 247, 245, 243, 248, 294, -447, -447, 1111, 250, 643, - -447, -447, -447, 252, -447, -447, 254, 259, 257, 262, - 263, 264, 265, 267, 270, -447, -447, 341, 14, 343, - -447, -447, 271, -447, -447, 1152, -447, 1152, 1152, -447, - -447, -447, -447, 643, -447, 751, 65, 374, -447, 279, - 280, 281, -447, 285, -447, 751, 643, -447, -447, -447, - 380, 290, 288, 643, 382, 384, -447, 643, 643, -447, - -447 -}; -/* YYPGOTO[NTERM-NUM]. */ -static const short int yypgoto[] = -{ - -447, -447, -447, 309, 310, 311, 312, -129, -128, -446, - -447, 369, 386, -89, -447, -227, 51, -447, -248, -447, - -50, -447, -37, -447, -68, 292, -447, -102, 221, -255, - 57, -447, -447, -447, -447, -447, -447, -447, 361, -447, - -447, -447, -447, 2, -447, 55, -447, -447, 355, -447, - -447, -447, -447, -447, 414, -447, -447, -405, -57, 62, - -105, -447, 399, -447, -447, -447, -447, -447, 49, -8, - -447, -447, 24, -447, -447 -}; +#define YYLAST 1357 -/* 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 -132 -static const short int yytable[] = -{ - 89, 226, 227, 106, 314, 26, 336, 337, 39, 94, - 202, 177, 178, 369, 53, 42, 89, 119, 347, 349, - 212, 371, 391, 215, 218, 219, 220, 221, 222, 223, - 224, 225, 495, 4, 355, 7, 8, 9, 10, 54, - 12, 55, 229, 26, 56, 392, 356, 365, 29, 232, - 505, 123, 236, 237, 119, 370, 238, 239, 240, 241, - 242, 243, -69, 370, 59, 247, 60, 46, 47, 48, - 39, 123, 184, 185, 186, 218, 219, 220, 221, 222, - 223, 224, 225, 248, 216, 205, 49, 401, 211, 121, - 503, 211, 20, 401, 21, 206, 217, 404, 401, 357, - 511, 403, 123, 95, 251, 401, 414, 249, 250, 43, - 252, 402, 110, 111, 112, 230, 231, 211, 233, 234, - 211, 211, -131, 51, 211, 211, 211, 211, 211, 211, - 244, 245, 246, 211, 494, 283, 284, 285, 107, 108, - 256, 257, -29, -29, 281, 332, 435, 5, -28, -28, - -27, -27, 52, 6, 305, -26, -26, 258, 259, 305, - 305, 58, 62, 7, 8, 9, 10, 11, 12, 13, - 287, 305, 64, 99, 100, -70, 305, 101, 114, 310, - 102, 103, 115, 116, 14, 504, 176, 305, 305, 305, - 122, 455, 89, 456, 180, 181, 182, 203, 330, 218, - 219, 220, 221, 222, 223, 224, 225, 204, 207, 213, - -33, 89, 331, 211, 377, -32, 379, 380, 381, -31, - -30, -36, 261, 285, 387, 30, 31, 32, 33, 34, - 35, 36, -37, 262, 291, 292, 395, 396, 397, 398, - 399, 400, 311, 313, 316, 317, 318, 319, 320, 405, - 406, 407, 408, 305, 321, 322, 323, 324, 325, 305, - 329, 333, 334, 350, 363, 338, 391, 339, 413, 340, - 415, 341, 342, 305, 305, 343, 351, 360, 307, 308, - 352, 376, 211, 378, 211, 211, 211, 382, 383, 358, - 309, 353, 211, 354, 375, 315, 366, 361, 367, 442, - 372, 384, 385, 416, 419, 386, 326, 327, 328, 390, - 417, 423, 305, 425, 305, 433, 426, 427, 305, 434, - 460, 461, 462, 287, 431, 437, 438, 305, 305, 305, - 447, 439, 475, 440, 441, 211, 467, 468, 469, 470, - 465, 471, 472, 473, 474, 443, 476, 444, 445, 226, - 227, 370, 480, 432, 446, 449, 454, 457, 305, 305, - 459, 477, 493, 478, 515, 479, 305, 226, 227, 483, - 481, 484, 368, 485, 486, 305, 487, 488, 374, 497, - 211, 489, 490, 499, 491, 500, 501, 492, 211, 211, - 211, 498, 388, 389, 211, 506, 507, 508, 509, 510, - 466, 513, 305, 517, 514, 518, 167, 168, 169, 170, - 97, 57, 411, 105, 209, 410, 113, 27, 45, 436, - 211, 422, 280, 463, 65, 66, 0, 0, 0, 0, - 0, 418, 0, 420, 0, 0, 305, 424, 0, 0, - 0, 20, 0, 21, 0, 263, 428, 429, 430, 305, - 0, 0, 0, 0, 0, 0, 305, 264, 265, 0, - 305, 305, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 450, 451, 0, - 0, 0, 0, 0, 0, 458, 0, 0, 0, 0, - 0, 0, 0, 0, 464, 0, 0, 134, 135, 136, - 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, - 147, 148, 149, 150, 151, 0, 0, 0, 0, 0, - 266, 482, 267, 268, 159, 160, 0, 269, 270, 271, - 0, 0, 0, 0, 0, 0, 0, 272, 0, 0, - 273, 0, 274, 0, 0, 275, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 502, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 512, 0, - 0, 0, 0, 0, 0, 516, 0, 0, 0, 519, - 520, 65, 66, 0, 117, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 20, 0, - 21, 65, 66, 0, 117, 187, 188, 189, 190, 191, - 192, 193, 194, 195, 196, 197, 79, 80, 20, 0, - 21, 0, 0, 0, 81, 0, 0, 0, 0, 0, - -39, 0, 20, 0, 21, 0, 0, 0, 0, 0, - 0, 6, -39, -39, 81, 0, 293, 294, 65, 66, - 295, -39, -39, -39, -39, -39, -39, -39, 0, 0, - -39, 22, 0, 0, 0, 20, 0, 21, 23, 296, - 297, 298, 24, 0, 0, 0, 0, 0, 0, 0, - 0, 299, 300, 0, 0, 0, 0, 0, 0, 0, - 0, 82, 0, 0, 83, 0, 0, 84, 0, 85, - 118, 0, 0, 0, 301, 0, 0, 0, 0, 0, - 0, 82, 0, 0, 83, 0, 0, 84, 0, 85, - 348, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 0, - 0, 0, 0, 0, 266, 0, 267, 268, 159, 160, - 0, 269, 270, 271, 293, 294, 0, 0, 295, 0, - 0, 0, 0, 0, 302, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 296, 297, 298, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 299, - 300, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 301, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 0, 0, 0, - 0, 0, 266, 0, 267, 268, 159, 160, 0, 269, - 270, 271, 0, 0, 0, 0, 0, 0, 0, 0, - 65, 66, 302, 117, 68, 69, 70, 71, 72, 73, - 74, 75, 76, 77, 78, 79, 80, 20, 0, 21, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 208, 0, 0, 0, 0, 0, 0, 0, - 0, 65, 66, 81, 117, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 20, 0, - 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 286, 0, 0, 0, 0, 0, 0, - 0, 0, 65, 66, 81, 117, 187, 188, 189, 190, - 191, 192, 193, 194, 195, 196, 197, 79, 80, 20, - 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, - 82, 0, 0, 83, 0, 0, 84, 0, 85, 0, - 0, 0, 0, 65, 66, 81, 117, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - 20, 0, 21, 0, 0, 0, 0, 0, 0, 0, - 0, 82, 0, 0, 83, 362, 0, 84, 0, 85, - 0, 0, 0, 0, 65, 66, 81, 117, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 20, 0, 21, 0, 0, 0, 0, 0, 0, - 0, 0, 82, 0, 0, 83, 409, 344, 84, 0, - 85, 0, 0, 0, 0, 65, 66, 81, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - 79, 80, 20, 0, 21, 0, 0, 0, 0, 0, - 0, 0, 0, 82, 0, 0, 83, 0, 0, 84, - 0, 85, 0, 0, 0, 0, 65, 66, 81, 117, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 20, 0, 21, 0, 0, 0, 0, - 0, 0, 0, 0, 82, 0, 0, 83, 0, 0, - 84, 0, 85, 0, 0, 0, 0, 65, 66, 81, - 117, 187, 188, 189, 190, 191, 192, 193, 194, 195, - 196, 197, 79, 80, 20, 0, 21, 0, 0, 0, - 0, 0, 0, 0, 0, 82, 0, 0, 83, 0, - 0, 84, 0, 85, 0, 0, 0, 0, 65, 66, - 81, 214, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 80, 20, 0, 21, 0, 0, - 0, 0, 0, 0, 0, 0, 82, 0, 0, 83, - 0, 0, 84, 0, 85, 0, 0, 0, 0, 0, - 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 82, 0, 0, - 83, 0, 0, 84, 0, 85, 0, 0, 0, 0, - 124, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 125, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 126, 127, 0, 0, 82, 0, - 0, 83, 0, 0, 84, 0, 85, 128, 129, 130, - 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, - 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, - 151, 152, 153, 154, 0, 0, 155, 156, 157, 158, - 159, 160, 161, 162, 163, 164, 165, 166 -}; -static const short int yycheck[] = -{ - 37, 130, 130, 53, 231, 3, 254, 255, 23, 29, - 112, 55, 56, 15, 20, 30, 53, 85, 273, 274, - 125, 15, 34, 128, 10, 11, 12, 13, 14, 15, - 16, 17, 478, 0, 282, 41, 42, 43, 44, 45, - 46, 47, 131, 41, 50, 57, 120, 302, 61, 154, - 496, 125, 157, 158, 122, 57, 161, 162, 163, 164, - 165, 166, 116, 57, 45, 170, 47, 52, 53, 54, - 23, 125, 109, 110, 111, 10, 11, 12, 13, 14, - 15, 16, 17, 172, 9, 114, 71, 114, 125, 87, - 495, 128, 22, 114, 24, 124, 21, 124, 114, 122, - 505, 122, 125, 123, 114, 114, 122, 99, 100, 124, - 120, 120, 55, 56, 57, 152, 153, 154, 155, 156, - 157, 158, 0, 113, 161, 162, 163, 164, 165, 166, - 167, 168, 169, 170, 120, 203, 204, 205, 32, 33, - 27, 28, 3, 4, 201, 250, 394, 25, 3, 4, - 3, 4, 61, 31, 211, 3, 4, 3, 4, 216, - 217, 113, 24, 41, 42, 43, 44, 45, 46, 47, - 207, 228, 4, 113, 113, 116, 233, 113, 4, 229, - 113, 118, 4, 4, 62, 120, 24, 244, 245, 246, - 116, 418, 229, 420, 4, 24, 24, 119, 248, 10, - 11, 12, 13, 14, 15, 16, 17, 119, 116, 59, - 4, 248, 249, 250, 319, 4, 321, 322, 323, 4, - 4, 7, 4, 291, 329, 64, 65, 66, 67, 68, - 69, 70, 7, 7, 114, 117, 338, 339, 340, 341, - 342, 343, 114, 114, 118, 114, 36, 114, 114, 351, - 352, 353, 354, 310, 114, 114, 114, 114, 114, 316, - 114, 24, 114, 24, 63, 116, 34, 116, 24, 116, - 21, 116, 116, 330, 331, 116, 116, 114, 216, 217, - 116, 318, 319, 320, 321, 322, 323, 324, 325, 287, - 228, 116, 329, 116, 118, 233, 114, 117, 114, 401, - 114, 114, 114, 21, 4, 114, 244, 245, 246, 114, - 116, 114, 369, 114, 371, 24, 114, 114, 375, 4, - 425, 426, 427, 360, 116, 36, 114, 384, 385, 386, - 57, 114, 4, 114, 114, 372, 438, 439, 440, 441, - 117, 443, 444, 445, 446, 114, 24, 114, 114, 478, - 478, 57, 457, 390, 114, 114, 114, 114, 415, 416, - 114, 114, 21, 118, 76, 117, 423, 496, 496, 117, - 120, 117, 310, 114, 117, 432, 114, 114, 316, 36, - 417, 117, 117, 485, 117, 487, 488, 117, 425, 426, - 427, 120, 330, 331, 431, 21, 117, 117, 117, 114, - 437, 21, 459, 21, 114, 21, 97, 97, 97, 97, - 41, 25, 361, 52, 122, 360, 61, 3, 19, 395, - 457, 372, 201, 431, 5, 6, -1, -1, -1, -1, - -1, 369, -1, 371, -1, -1, 493, 375, -1, -1, - -1, 22, -1, 24, -1, 26, 384, 385, 386, 506, - -1, -1, -1, -1, -1, -1, 513, 38, 39, -1, - 517, 518, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 415, 416, -1, - -1, -1, -1, -1, -1, 423, -1, -1, -1, -1, - -1, -1, -1, -1, 432, -1, -1, 78, 79, 80, - 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, - 91, 92, 93, 94, 95, -1, -1, -1, -1, -1, - 101, 459, 103, 104, 105, 106, -1, 108, 109, 110, - -1, -1, -1, -1, -1, -1, -1, 118, -1, -1, - 121, -1, 123, -1, -1, 126, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 493, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 506, -1, - -1, -1, -1, -1, -1, 513, -1, -1, -1, 517, - 518, 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, -1, - 20, -1, 22, -1, 24, -1, -1, -1, -1, -1, - -1, 31, 32, 33, 48, -1, 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, -1, -1, -1, - -1, 115, -1, -1, 118, -1, -1, 121, -1, 123, - 124, -1, -1, -1, 61, -1, -1, -1, -1, -1, - -1, 115, -1, -1, 118, -1, -1, 121, -1, 123, - 124, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, 92, 93, 94, 95, -1, - -1, -1, -1, -1, 101, -1, 103, 104, 105, 106, - -1, 108, 109, 110, 3, 4, -1, -1, 7, -1, - -1, -1, -1, -1, 121, -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, -1, 78, - 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, - 89, 90, 91, 92, 93, 94, 95, -1, -1, -1, - -1, -1, 101, -1, 103, 104, 105, 106, -1, 108, - 109, 110, -1, -1, -1, -1, -1, -1, -1, -1, - 5, 6, 121, 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, -1, -1, -1, -1, -1, - 115, -1, -1, 118, -1, -1, 121, -1, 123, -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, 115, -1, -1, 118, 37, -1, 121, -1, 123, - -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, 115, -1, -1, 118, 37, 120, 121, -1, - 123, -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, 115, -1, -1, 118, -1, -1, 121, - -1, 123, -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, 115, -1, -1, 118, -1, -1, - 121, -1, 123, -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, 115, -1, -1, 118, -1, - -1, 121, -1, 123, -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, 115, -1, -1, 118, - -1, -1, 121, -1, 123, -1, -1, -1, -1, -1, - -1, 48, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 115, -1, -1, - 118, -1, -1, 121, -1, 123, -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, -1, 115, -1, - -1, 118, -1, -1, 121, -1, 123, 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, -1, -1, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112 +static const short yytable[] = { 87, + 224, 225, 104, 312, 37, 24, 334, 335, 92, 200, + 389, 40, 367, 493, 27, 87, 117, 345, 347, 210, + 369, 37, 213, 216, 217, 218, 219, 220, 221, 222, + 223, 503, 214, 390, 353, 203, 50, 399, 354, 501, + 49, 227, 24, 121, 215, 204, 363, 402, 230, 509, + 56, 234, 235, 117, 368, 236, 237, 238, 239, 240, + 241, 399, 368, 57, 245, 58, 44, 45, 46, 401, + 51, 182, 183, 184, 216, 217, 218, 219, 220, 221, + 222, 223, 246, 355, 60, 47, 121, 209, 119, -68, + 209, 5, 6, 7, 8, 52, 10, 53, 121, 399, + 54, 62, 93, 249, 399, 41, 18, 412, 19, 250, + 400, 108, 109, 110, 228, 229, 209, 231, 232, 209, + 209, 105, 106, 209, 209, 209, 209, 209, 209, 242, + 243, 244, 209, 492, 281, 282, 283, 175, 176, 247, + 248, 254, 255, 279, 330, 97, 433, -28, -28, -27, + -27, -26, -26, 303, -25, -25, 256, 257, 303, 303, + 216, 217, 218, 219, 220, 221, 222, 223, 98, 285, + 303, 101, 99, -69, 100, 303, 112, 113, 308, 114, + 174, 120, 178, -130, 502, 179, 303, 303, 303, 180, + 453, 87, 454, 201, 202, 205, 211, 328, 28, 29, + 30, 31, 32, 33, 34, -32, -31, -30, 3, -29, + 87, 329, 209, 375, 4, 377, 378, 379, -35, -36, + 259, 260, 283, 385, 5, 6, 7, 8, 9, 10, + 11, 289, 290, 309, 311, 393, 394, 395, 396, 397, + 398, 314, 315, 316, 317, 12, 318, 319, 403, 404, + 405, 406, 303, 320, 321, 322, 323, 327, 303, 331, + 348, 332, 359, 361, 389, 336, 411, 413, 337, 414, + 338, 339, 303, 303, 340, 341, 349, 305, 306, 350, + 374, 209, 376, 209, 209, 209, 380, 381, 356, 307, + 351, 209, 352, 358, 313, 364, 365, 417, 440, 370, + 382, 383, 373, 384, 388, 324, 325, 326, 415, 421, + 423, 303, 424, 303, 431, 429, 432, 303, 425, 458, + 459, 460, 285, 435, 436, 445, 303, 303, 303, 437, + 463, 438, 439, 441, 209, 465, 466, 467, 468, 442, + 469, 470, 471, 472, 473, 443, 444, 447, 224, 225, + 474, 478, 430, 452, 455, 457, 476, 303, 303, 475, + 477, 368, 491, 483, 479, 303, 224, 225, 481, 482, + 484, 366, 485, 486, 303, 495, 496, 372, 487, 209, + 488, 489, 497, 490, 498, 499, 504, 209, 209, 209, + 505, 386, 387, 209, 506, 507, 508, 511, 512, 464, + 513, 303, 515, 516, 520, 521, 165, 95, 166, 167, + 168, 55, 207, 409, 103, 111, 25, 43, 420, 209, + 278, 461, 434, 63, 64, 408, 0, 0, 0, 0, + 416, 0, 418, 0, 0, 303, 422, 0, 0, 0, + 18, 0, 19, 0, 261, 426, 427, 428, 303, 0, + 0, 0, 0, 0, 0, 303, 262, 263, 0, 303, + 303, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 448, 449, 0, 0, + 0, 0, 0, 0, 456, 0, 0, 0, 0, 0, + 0, 0, 0, 462, 0, 0, 132, 133, 134, 135, + 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, + 146, 147, 148, 149, 0, 0, 0, 0, 0, 264, + 480, 265, 266, 157, 158, 0, 267, 268, 269, 0, + 0, 0, 0, 0, 0, 0, 270, 0, 0, 271, + 0, 272, 0, 0, 273, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 500, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 510, 0, 0, + 0, 0, 0, 0, 514, 0, 0, 0, 517, 518, + 63, 64, 0, 115, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 18, 0, 19, + 63, 64, 0, 115, 185, 186, 187, 188, 189, 190, + 191, 192, 193, 194, 195, 77, 78, 18, 0, 19, + 0, 0, 0, 79, 0, 0, 0, 0, 0, -38, + 0, 18, 0, 19, 0, 0, 0, 0, 0, 0, + 4, -38, -38, 79, 0, 291, 292, 63, 64, 293, + -38, -38, -38, -38, -38, -38, -38, 0, 0, -38, + 20, 0, 0, 0, 18, 0, 19, 21, 294, 295, + 296, 22, 0, 0, 0, 0, 0, 0, 0, 0, + 297, 298, 0, 0, 0, 0, 0, 0, 0, 0, + 80, 0, 0, 81, 0, 0, 82, 0, 83, 116, + 0, 0, 0, 299, 0, 0, 0, 0, 0, 0, + 80, 0, 0, 81, 0, 0, 82, 0, 83, 346, + 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 146, 147, 148, 149, 0, 0, + 0, 0, 0, 264, 0, 265, 266, 157, 158, 0, + 267, 268, 269, 291, 292, 0, 0, 293, 0, 0, + 0, 0, 0, 300, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 294, 295, 296, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 297, 298, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 299, 0, 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, 146, 147, 148, 149, 0, 0, 0, 0, + 0, 264, 0, 265, 266, 157, 158, 0, 267, 268, + 269, 0, 0, 0, 0, 0, 0, 0, 0, 63, + 64, 300, 115, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 18, 0, 19, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 206, 0, 0, 0, 0, 0, 0, 0, 0, + 63, 64, 79, 115, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 18, 0, 19, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 284, 0, 0, 0, 0, 0, 0, 0, + 0, 63, 64, 79, 115, 185, 186, 187, 188, 189, + 190, 191, 192, 193, 194, 195, 77, 78, 18, 0, + 19, 0, 0, 0, 0, 0, 0, 0, 0, 80, + 0, 0, 81, 0, 0, 82, 0, 83, 0, 0, + 0, 0, 63, 64, 79, 115, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 18, + 0, 19, 0, 0, 0, 0, 0, 0, 0, 0, + 80, 0, 0, 81, 360, 0, 82, 0, 83, 0, + 0, 0, 0, 63, 64, 79, 115, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 18, 0, 19, 0, 0, 0, 0, 0, 0, 0, + 0, 80, 0, 0, 81, 407, 342, 82, 0, 83, + 0, 0, 0, 0, 63, 64, 79, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 18, 0, 19, 0, 0, 0, 0, 0, 0, + 0, 0, 80, 0, 0, 81, 0, 0, 82, 0, + 83, 0, 0, 0, 0, 63, 64, 79, 115, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 18, 0, 19, 0, 0, 0, 0, 0, + 0, 0, 0, 80, 0, 0, 81, 0, 0, 82, + 0, 83, 0, 0, 0, 0, 63, 64, 79, 115, + 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, + 195, 77, 78, 18, 0, 19, 0, 0, 0, 0, + 0, 0, 0, 0, 80, 0, 0, 81, 0, 0, + 82, 0, 83, 0, 0, 0, 0, 63, 64, 79, + 212, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 18, 0, 19, 0, 0, 0, + 0, 0, 0, 0, 0, 80, 0, 0, 81, 0, + 0, 82, 0, 83, 0, 0, 0, 0, 0, 0, + 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 80, 0, 0, 81, + 0, 0, 82, 0, 83, 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, 0, 80, 0, 0, + 81, 0, 0, 82, 0, 83, 126, 127, 128, 129, + 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, + 150, 151, 152, 0, 0, 153, 154, 155, 156, 157, + 158, 159, 160, 161, 162, 163, 164 }; -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const unsigned char yystos[] = -{ - 0, 158, 159, 160, 0, 25, 31, 41, 42, 43, - 44, 45, 46, 47, 62, 139, 177, 179, 181, 188, - 22, 24, 51, 58, 62, 138, 170, 181, 182, 61, - 64, 65, 66, 67, 68, 69, 70, 140, 175, 23, - 189, 190, 30, 124, 178, 189, 52, 53, 54, 71, - 167, 113, 61, 20, 45, 47, 50, 139, 113, 45, - 47, 180, 24, 165, 4, 5, 6, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 48, 115, 118, 121, 123, 128, 147, 148, 149, - 150, 151, 170, 185, 29, 123, 176, 138, 193, 113, - 113, 113, 113, 118, 168, 165, 147, 32, 33, 157, - 157, 157, 157, 175, 4, 4, 4, 8, 124, 151, - 152, 170, 116, 125, 35, 49, 59, 60, 72, 73, - 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, - 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - 94, 95, 96, 97, 98, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, 112, 130, 131, 132, - 133, 191, 197, 198, 200, 201, 24, 55, 56, 166, - 4, 24, 24, 169, 149, 149, 149, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 134, 135, - 137, 149, 154, 119, 119, 114, 124, 116, 37, 152, - 153, 149, 187, 59, 8, 187, 9, 21, 10, 11, - 12, 13, 14, 15, 16, 17, 134, 135, 136, 140, - 149, 149, 187, 149, 149, 194, 187, 187, 187, 187, - 187, 187, 187, 187, 149, 149, 149, 187, 140, 99, - 100, 114, 120, 163, 164, 162, 27, 28, 3, 4, - 129, 4, 7, 26, 38, 39, 101, 103, 104, 108, - 109, 110, 118, 121, 123, 126, 130, 131, 132, 133, - 155, 185, 161, 151, 151, 151, 37, 149, 172, 173, - 174, 114, 117, 3, 4, 7, 26, 27, 28, 38, - 39, 61, 121, 155, 184, 185, 186, 186, 186, 186, - 147, 114, 142, 114, 142, 186, 118, 114, 36, 114, - 114, 114, 114, 114, 114, 114, 186, 186, 186, 114, - 147, 149, 187, 24, 114, 145, 145, 145, 116, 116, - 116, 116, 116, 116, 120, 154, 156, 156, 124, 156, - 24, 116, 116, 116, 116, 145, 120, 122, 170, 171, - 114, 117, 37, 63, 183, 156, 114, 114, 186, 15, - 57, 15, 114, 199, 186, 118, 149, 187, 149, 187, - 187, 187, 149, 149, 114, 114, 114, 187, 186, 186, - 114, 34, 57, 143, 146, 154, 154, 154, 154, 154, - 154, 114, 120, 122, 124, 154, 154, 154, 154, 37, - 172, 143, 144, 24, 122, 21, 21, 116, 186, 4, - 186, 187, 195, 114, 186, 114, 114, 114, 186, 186, - 186, 116, 149, 24, 4, 145, 199, 36, 114, 114, - 114, 114, 154, 114, 114, 114, 114, 57, 141, 114, - 186, 186, 195, 196, 114, 142, 142, 114, 186, 114, - 187, 187, 187, 196, 186, 117, 149, 154, 154, 154, - 154, 154, 154, 154, 154, 4, 24, 114, 118, 117, - 187, 120, 186, 117, 117, 114, 117, 114, 114, 117, - 117, 117, 117, 21, 120, 136, 192, 36, 120, 154, - 154, 154, 186, 184, 120, 136, 21, 117, 117, 117, - 114, 184, 186, 21, 114, 76, 186, 21, 21, 186, - 186 +static const short yycheck[] = { 35, + 128, 128, 51, 229, 23, 2, 252, 253, 29, 110, + 34, 30, 15, 476, 61, 51, 83, 271, 272, 123, + 15, 23, 126, 10, 11, 12, 13, 14, 15, 16, + 17, 494, 9, 57, 280, 114, 61, 114, 120, 493, + 113, 129, 39, 125, 21, 124, 300, 124, 152, 503, + 113, 155, 156, 120, 57, 159, 160, 161, 162, 163, + 164, 114, 57, 45, 168, 47, 52, 53, 54, 122, + 20, 107, 108, 109, 10, 11, 12, 13, 14, 15, + 16, 17, 170, 122, 24, 71, 125, 123, 85, 116, + 126, 41, 42, 43, 44, 45, 46, 47, 125, 114, + 50, 4, 123, 114, 114, 124, 22, 122, 24, 120, + 120, 53, 54, 55, 150, 151, 152, 153, 154, 155, + 156, 32, 33, 159, 160, 161, 162, 163, 164, 165, + 166, 167, 168, 120, 201, 202, 203, 55, 56, 99, + 100, 27, 28, 199, 248, 113, 392, 3, 4, 3, + 4, 3, 4, 209, 3, 4, 3, 4, 214, 215, + 10, 11, 12, 13, 14, 15, 16, 17, 113, 205, + 226, 118, 113, 116, 113, 231, 4, 4, 227, 4, + 24, 116, 4, 0, 120, 24, 242, 243, 244, 24, + 416, 227, 418, 119, 119, 116, 59, 246, 64, 65, + 66, 67, 68, 69, 70, 4, 4, 4, 25, 4, + 246, 247, 248, 317, 31, 319, 320, 321, 7, 7, + 4, 7, 289, 327, 41, 42, 43, 44, 45, 46, + 47, 114, 117, 114, 114, 336, 337, 338, 339, 340, + 341, 118, 114, 36, 114, 62, 114, 114, 349, 350, + 351, 352, 308, 114, 114, 114, 114, 114, 314, 24, + 24, 114, 117, 63, 34, 116, 24, 21, 116, 21, + 116, 116, 328, 329, 116, 116, 116, 214, 215, 116, + 316, 317, 318, 319, 320, 321, 322, 323, 285, 226, + 116, 327, 116, 114, 231, 114, 114, 4, 399, 114, + 114, 114, 118, 114, 114, 242, 243, 244, 116, 114, + 114, 367, 114, 369, 24, 116, 4, 373, 114, 423, + 424, 425, 358, 36, 114, 57, 382, 383, 384, 114, + 117, 114, 114, 114, 370, 436, 437, 438, 439, 114, + 441, 442, 443, 444, 4, 114, 114, 114, 476, 476, + 24, 455, 388, 114, 114, 114, 118, 413, 414, 114, + 117, 57, 21, 114, 120, 421, 494, 494, 117, 117, + 117, 308, 114, 114, 430, 36, 120, 314, 117, 415, + 117, 117, 483, 117, 485, 486, 21, 423, 424, 425, + 117, 328, 329, 429, 117, 117, 114, 21, 114, 435, + 76, 457, 21, 21, 0, 0, 95, 39, 95, 95, + 95, 23, 120, 359, 50, 59, 2, 17, 370, 455, + 199, 429, 393, 5, 6, 358, -1, -1, -1, -1, + 367, -1, 369, -1, -1, 491, 373, -1, -1, -1, + 22, -1, 24, -1, 26, 382, 383, 384, 504, -1, + -1, -1, -1, -1, -1, 511, 38, 39, -1, 515, + 516, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 413, 414, -1, -1, + -1, -1, -1, -1, 421, -1, -1, -1, -1, -1, + -1, -1, -1, 430, -1, -1, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, -1, -1, -1, -1, -1, 101, + 457, 103, 104, 105, 106, -1, 108, 109, 110, -1, + -1, -1, -1, -1, -1, -1, 118, -1, -1, 121, + -1, 123, -1, -1, 126, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 491, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 504, -1, -1, + -1, -1, -1, -1, 511, -1, -1, -1, 515, 516, + 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, -1, 20, + -1, 22, -1, 24, -1, -1, -1, -1, -1, -1, + 31, 32, 33, 48, -1, 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, -1, -1, -1, -1, + 115, -1, -1, 118, -1, -1, 121, -1, 123, 124, + -1, -1, -1, 61, -1, -1, -1, -1, -1, -1, + 115, -1, -1, 118, -1, -1, 121, -1, 123, 124, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, -1, -1, + -1, -1, -1, 101, -1, 103, 104, 105, 106, -1, + 108, 109, 110, 3, 4, -1, -1, 7, -1, -1, + -1, -1, -1, 121, -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, -1, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, -1, -1, -1, -1, + -1, 101, -1, 103, 104, 105, 106, -1, 108, 109, + 110, -1, -1, -1, -1, -1, -1, -1, -1, 5, + 6, 121, 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, -1, -1, -1, -1, -1, 115, + -1, -1, 118, -1, -1, 121, -1, 123, -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, + 115, -1, -1, 118, 37, -1, 121, -1, 123, -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, 115, -1, -1, 118, 37, 120, 121, -1, 123, + -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, 115, -1, -1, 118, -1, -1, 121, -1, + 123, -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, 115, -1, -1, 118, -1, -1, 121, + -1, 123, -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, 115, -1, -1, 118, -1, -1, + 121, -1, 123, -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, 115, -1, -1, 118, -1, + -1, 121, -1, 123, -1, -1, -1, -1, -1, -1, + 48, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 115, -1, -1, 118, + -1, -1, 121, -1, 123, -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, -1, 115, -1, -1, + 118, -1, -1, 121, -1, 123, 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, -1, -1, 101, 102, 103, 104, 105, + 106, 107, 108, 109, 110, 111, 112 }; +/* -*-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; @@ -2825,749 +2180,742 @@ 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 1140 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[0].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range! + switch (yyn) { + +case 2: +#line 1140 "/Users/sabre/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 1149 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[0].UInt64Val) > (uint64_t)INT64_MAX) // Outside of my range! +; + break;} +case 4: +#line 1149 "/Users/sabre/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 38: -#line 1173 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.StrVal) = (yyvsp[-1].StrVal); +; + break;} +case 37: +#line 1173 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.StrVal = yyvsp[-1].StrVal; CHECK_FOR_ERROR - ;} - break; - - case 39: -#line 1177 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.StrVal) = 0; + ; + break;} +case 38: +#line 1177 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.StrVal = 0; CHECK_FOR_ERROR - ;} - break; - - case 40: -#line 1182 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} - break; - - case 41: -#line 1183 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} - break; - - case 42: -#line 1184 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} - break; - - case 43: -#line 1185 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} - break; - - case 44: -#line 1186 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} - break; - - case 45: -#line 1187 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} - break; - - case 46: -#line 1188 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} - break; - - case 47: -#line 1189 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} - break; - - case 48: -#line 1191 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.UIntVal) = CallingConv::C; ;} - break; - - case 49: -#line 1192 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.UIntVal) = CallingConv::C; ;} - break; - - case 50: -#line 1193 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.UIntVal) = CallingConv::CSRet; ;} - break; - - case 51: -#line 1194 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.UIntVal) = CallingConv::Fast; ;} - break; - - case 52: -#line 1195 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.UIntVal) = CallingConv::Cold; ;} - break; - - case 53: -#line 1196 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} - break; - - case 54: -#line 1197 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} - break; - - case 55: -#line 1198 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val)) + ; + break;} +case 39: +#line 1182 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.Linkage = GlobalValue::InternalLinkage; ; + break;} +case 40: +#line 1183 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.Linkage = GlobalValue::LinkOnceLinkage; ; + break;} +case 41: +#line 1184 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.Linkage = GlobalValue::WeakLinkage; ; + break;} +case 42: +#line 1185 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.Linkage = GlobalValue::AppendingLinkage; ; + break;} +case 43: +#line 1186 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.Linkage = GlobalValue::DLLImportLinkage; ; + break;} +case 44: +#line 1187 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.Linkage = GlobalValue::DLLExportLinkage; ; + break;} +case 45: +#line 1188 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.Linkage = GlobalValue::ExternalWeakLinkage; ; + break;} +case 46: +#line 1189 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.Linkage = GlobalValue::ExternalLinkage; ; + break;} +case 47: +#line 1191 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.UIntVal = CallingConv::C; ; + break;} +case 48: +#line 1192 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.UIntVal = CallingConv::C; ; + break;} +case 49: +#line 1193 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.UIntVal = CallingConv::CSRet; ; + break;} +case 50: +#line 1194 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.UIntVal = CallingConv::Fast; ; + break;} +case 51: +#line 1195 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.UIntVal = CallingConv::Cold; ; + break;} +case 52: +#line 1196 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.UIntVal = CallingConv::X86_StdCall; ; + break;} +case 53: +#line 1197 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.UIntVal = CallingConv::X86_FastCall; ; + break;} +case 54: +#line 1198 "/Users/sabre/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 56: -#line 1207 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.UIntVal) = 0; ;} - break; - - case 57: -#line 1208 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.UIntVal) = (yyvsp[0].UInt64Val); - if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) + ; + break;} +case 55: +#line 1207 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.UIntVal = 0; ; + break;} +case 56: +#line 1208 "/Users/sabre/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 58: -#line 1214 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.UIntVal) = 0; ;} - break; - - case 59: -#line 1215 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.UIntVal) = (yyvsp[0].UInt64Val); - if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) +; + break;} +case 57: +#line 1214 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.UIntVal = 0; ; + break;} +case 58: +#line 1215 "/Users/sabre/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 60: -#line 1223 "/proj/llvm/llvm-4/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 59: +#line 1223 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + for (unsigned i = 0, e = strlen(yyvsp[0].StrVal); i != e; ++i) + if (yyvsp[0].StrVal[i] == '"' || yyvsp[0].StrVal[i] == '\\') GEN_ERROR("Invalid character in section name!"); - (yyval.StrVal) = (yyvsp[0].StrVal); + yyval.StrVal = yyvsp[0].StrVal; CHECK_FOR_ERROR -;} - break; - - case 61: -#line 1231 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.StrVal) = 0; ;} - break; - - case 62: -#line 1232 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.StrVal) = (yyvsp[0].StrVal); ;} - break; - - case 63: -#line 1237 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - {;} - break; - - case 64: -#line 1238 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - {;} - break; - - case 65: -#line 1239 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - CurGV->setSection((yyvsp[0].StrVal)); - free((yyvsp[0].StrVal)); +; + break;} +case 60: +#line 1231 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.StrVal = 0; ; + break;} +case 61: +#line 1232 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.StrVal = yyvsp[0].StrVal; ; + break;} +case 62: +#line 1237 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{; + break;} +case 63: +#line 1238 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{; + break;} +case 64: +#line 1239 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + CurGV->setSection(yyvsp[0].StrVal); + free(yyvsp[0].StrVal); CHECK_FOR_ERROR - ;} - break; - - case 66: -#line 1244 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val))) + ; + break;} +case 65: +#line 1244 "/Users/sabre/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 68: -#line 1258 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;} - break; - - case 70: -#line 1259 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;} - break; - - case 71: -#line 1261 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 67: +#line 1258 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); ; + break;} +case 69: +#line 1259 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); ; + break;} +case 70: +#line 1261 "/Users/sabre/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 85: -#line 1273 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); + ; + break;} +case 84: +#line 1273 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.TypeVal = new PATypeHolder(OpaqueType::get()); CHECK_FOR_ERROR - ;} - break; - - case 86: -#line 1277 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); + ; + break;} +case 85: +#line 1277 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); CHECK_FOR_ERROR - ;} - break; - - case 87: -#line 1281 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Named types are also simple types... - const Type* tmp = getTypeVal((yyvsp[0].ValIDVal)); + ; + break;} +case 86: +#line 1281 "/Users/sabre/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 88: -#line 1289 "/proj/llvm/llvm-4/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 87: +#line 1289 "/Users/sabre/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 89: -#line 1297 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Function derived type? + ; + break;} +case 88: +#line 1297 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Function derived type? std::vector Params; - for (std::list::iterator I = (yyvsp[-1].TypeList)->begin(), - E = (yyvsp[-1].TypeList)->end(); I != E; ++I) + 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 90: -#line 1310 "/proj/llvm/llvm-4/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 91: -#line 1315 "/proj/llvm/llvm-4/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 89: +#line 1310 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Sized array type? + yyval.TypeVal = new PATypeHolder(HandleUpRefs(ArrayType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val))); + delete yyvsp[-1].TypeVal; + CHECK_FOR_ERROR + ; + break;} +case 90: +#line 1315 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Packed array type? + const llvm::Type* ElemTy = yyvsp[-1].TypeVal->get(); + if ((unsigned)yyvsp[-3].UInt64Val != yyvsp[-3].UInt64Val) 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 92: -#line 1327 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Structure type? + ; + break;} +case 91: +#line 1327 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Structure type? std::vector Elements; - for (std::list::iterator I = (yyvsp[-1].TypeList)->begin(), - E = (yyvsp[-1].TypeList)->end(); I != E; ++I) + 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); + yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); + delete yyvsp[-1].TypeList; CHECK_FOR_ERROR - ;} - break; - - case 93: -#line 1337 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Empty structure type? - (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector())); - CHECK_FOR_ERROR - ;} - break; - - case 94: -#line 1341 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Pointer type? - if (*(yyvsp[-1].TypeVal) == Type::LabelTy) + ; + break;} +case 92: +#line 1337 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Empty structure type? + yyval.TypeVal = new PATypeHolder(StructType::get(std::vector())); + CHECK_FOR_ERROR + ; + break;} +case 93: +#line 1341 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Pointer type? + if (*yyvsp[-1].TypeVal == Type::LabelTy) GEN_ERROR("Cannot form a pointer to a basic block"); - (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal)))); - delete (yyvsp[-1].TypeVal); + yyval.TypeVal = new PATypeHolder(HandleUpRefs(PointerType::get(*yyvsp[-1].TypeVal))); + delete yyvsp[-1].TypeVal; CHECK_FOR_ERROR - ;} - break; - - case 95: -#line 1352 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.TypeList) = new std::list(); - (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); + ; + break;} +case 94: +#line 1352 "/Users/sabre/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 96: -#line 1357 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); + ; + break;} +case 95: +#line 1357 "/Users/sabre/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 98: -#line 1364 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(Type::VoidTy); + ; + break;} +case 97: +#line 1364 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + (yyval.TypeList=yyvsp[-2].TypeList)->push_back(Type::VoidTy); CHECK_FOR_ERROR - ;} - break; - - case 99: -#line 1368 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - ((yyval.TypeList) = new std::list())->push_back(Type::VoidTy); + ; + break;} +case 98: +#line 1368 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + (yyval.TypeList = new std::list())->push_back(Type::VoidTy); CHECK_FOR_ERROR - ;} - break; - - case 100: -#line 1372 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.TypeList) = new std::list(); + ; + break;} +case 99: +#line 1372 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.TypeList = new std::list(); CHECK_FOR_ERROR - ;} - break; - - case 101: -#line 1383 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Nonempty unsized arr - const ArrayType *ATy = dyn_cast((yyvsp[-3].TypeVal)->get()); + ; + break;} +case 100: +#line 1383 "/Users/sabre/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 102: -#line 1409 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - const ArrayType *ATy = dyn_cast((yyvsp[-2].TypeVal)->get()); + ; + break;} +case 101: +#line 1409 "/Users/sabre/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 103: -#line 1423 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - const ArrayType *ATy = dyn_cast((yyvsp[-2].TypeVal)->get()); + ; + break;} +case 102: +#line 1423 "/Users/sabre/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(ConstantInt::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(ConstantInt::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 104: -#line 1453 "/proj/llvm/llvm-4/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 103: +#line 1453 "/Users/sabre/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 105: -#line 1479 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - const StructType *STy = dyn_cast((yyvsp[-3].TypeVal)->get()); + ; + break;} +case 104: +#line 1479 "/Users/sabre/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 106: -#line 1500 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - const StructType *STy = dyn_cast((yyvsp[-2].TypeVal)->get()); + ; + break;} +case 105: +#line 1500 "/Users/sabre/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 107: -#line 1513 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - const PointerType *PTy = dyn_cast((yyvsp[-1].TypeVal)->get()); + ; + break;} +case 106: +#line 1513 "/Users/sabre/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 108: -#line 1523 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get()); - delete (yyvsp[-1].TypeVal); + ; + break;} +case 107: +#line 1523 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ConstVal = UndefValue::get(yyvsp[-1].TypeVal->get()); + delete yyvsp[-1].TypeVal; CHECK_FOR_ERROR - ;} - break; - - case 109: -#line 1528 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - const PointerType *Ty = dyn_cast((yyvsp[-1].TypeVal)->get()); + ; + break;} +case 108: +#line 1528 "/Users/sabre/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!"); @@ -3581,7 +2929,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; @@ -3596,14 +2944,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; @@ -3618,165 +2966,154 @@ } // 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 110: -#line 1589 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType()) + ; + break;} +case 109: +#line 1589 "/Users/sabre/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 111: -#line 1596 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - const Type *Ty = (yyvsp[-1].TypeVal)->get(); + ; + break;} +case 110: +#line 1596 "/Users/sabre/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 112: -#line 1605 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // integral constants - if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val))) + ; + break;} +case 111: +#line 1605 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // integral constants + if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].SInt64Val)) GEN_ERROR("Constant value doesn't fit in type!"); - (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)); + yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].SInt64Val); CHECK_FOR_ERROR - ;} - break; - - case 113: -#line 1611 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // integral constants - if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val))) + ; + break;} +case 112: +#line 1611 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // integral constants + if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].UInt64Val)) GEN_ERROR("Constant value doesn't fit in type!"); - (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)); - CHECK_FOR_ERROR - ;} - break; - - case 114: -#line 1617 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Boolean constants - (yyval.ConstVal) = ConstantBool::getTrue(); - CHECK_FOR_ERROR - ;} - break; - - case 115: -#line 1621 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Boolean constants - (yyval.ConstVal) = ConstantBool::getFalse(); + yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].UInt64Val); CHECK_FOR_ERROR - ;} - break; - - case 116: -#line 1625 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Float & Double constants - if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal))) + ; + break;} +case 113: +#line 1617 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Boolean constants + yyval.ConstVal = ConstantBool::getTrue(); + CHECK_FOR_ERROR + ; + break;} +case 114: +#line 1621 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Boolean constants + yyval.ConstVal = ConstantBool::getFalse(); + CHECK_FOR_ERROR + ; + break;} +case 115: +#line 1625 "/Users/sabre/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 117: -#line 1633 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if (!(yyvsp[-3].ConstVal)->getType()->isFirstClassType()) + ; + break;} +case 116: +#line 1633 "/Users/sabre/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 118: -#line 1644 "/proj/llvm/llvm-4/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 117: +#line 1644 "/Users/sabre/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 (ConstantInt *CUI = dyn_cast((*(yyvsp[-1].ValueList))[i])) + if (ConstantInt *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 119: -#line 1676 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[-5].ConstVal)->getType() != Type::BoolTy) + ; + break;} +case 118: +#line 1676 "/Users/sabre/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 120: -#line 1684 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) + ; + break;} +case 119: +#line 1684 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) GEN_ERROR("Binary operator types must match!"); // First, make sure we're dealing with the right opcode by upgrading from // obsolete versions. - sanitizeOpCode((yyvsp[-5].BinaryOpVal),(yyvsp[-3].ConstVal)->getType()); + sanitizeOpCode(yyvsp[-5].BinaryOpVal,yyvsp[-3].ConstVal->getType()); CHECK_FOR_ERROR; // 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).opcode, (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); + if (!isa(yyvsp[-3].ConstVal->getType())) { + yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal.opcode, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); } else { const Type *IntPtrTy = 0; switch (CurModule.CurrentModule->getPointerSize()) { @@ -3784,154 +3121,138 @@ case Module::Pointer64: IntPtrTy = Type::LongTy; break; default: GEN_ERROR("invalid pointer binary constant expr!"); } - (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal).opcode, 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.opcode, 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 121: -#line 1711 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) + ; + break;} +case 120: +#line 1711 "/Users/sabre/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).opcode, (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); + yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal.opcode, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); CHECK_FOR_ERROR - ;} - break; - - case 122: -#line 1722 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) + ; + break;} +case 121: +#line 1722 "/Users/sabre/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).opcode, (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); + yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal.opcode, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); CHECK_FOR_ERROR - ;} - break; - - case 123: -#line 1728 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[-1].ConstVal)->getType() != Type::UByteTy) + ; + break;} +case 122: +#line 1728 "/Users/sabre/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).opcode, (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); + yyval.ConstVal = ConstantExpr::get(yyvsp[-5].OtherOpVal.opcode, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); CHECK_FOR_ERROR - ;} - break; - - case 124: -#line 1736 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) + ; + break;} +case 123: +#line 1736 "/Users/sabre/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 125: -#line 1742 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) + ; + break;} +case 124: +#line 1742 "/Users/sabre/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 126: -#line 1748 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) + ; + break;} +case 125: +#line 1748 "/Users/sabre/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 127: -#line 1757 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal)); + ; + break;} +case 126: +#line 1757 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(yyvsp[0].ConstVal); CHECK_FOR_ERROR - ;} - break; - - case 128: -#line 1761 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ConstVector) = new std::vector(); - (yyval.ConstVector)->push_back((yyvsp[0].ConstVal)); + ; + break;} +case 127: +#line 1761 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ConstVector = new std::vector(); + yyval.ConstVector->push_back(yyvsp[0].ConstVal); CHECK_FOR_ERROR - ;} - break; - - case 129: -#line 1769 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.BoolVal) = false; ;} - break; - - case 130: -#line 1769 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.BoolVal) = true; ;} - break; - - case 131: -#line 1779 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ModuleVal) = ParserResult = (yyvsp[0].ModuleVal); + ; + break;} +case 128: +#line 1769 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.BoolVal = false; ; + break;} +case 129: +#line 1769 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.BoolVal = true; ; + break;} +case 130: +#line 1779 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ModuleVal = ParserResult = yyvsp[0].ModuleVal; CurModule.ModuleDone(); CHECK_FOR_ERROR; -;} - break; - - case 132: -#line 1787 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); +; + break;} +case 131: +#line 1787 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ModuleVal = yyvsp[-1].ModuleVal; CurFun.FunctionDone(); CHECK_FOR_ERROR - ;} - break; - - case 133: -#line 1792 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); + ; + break;} +case 132: +#line 1792 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ModuleVal = yyvsp[-1].ModuleVal; CHECK_FOR_ERROR - ;} - break; - - case 134: -#line 1796 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ModuleVal) = (yyvsp[-3].ModuleVal); + ; + break;} +case 133: +#line 1796 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ModuleVal = yyvsp[-3].ModuleVal; CHECK_FOR_ERROR - ;} - break; - - case 135: -#line 1800 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); + ; + break;} +case 134: +#line 1800 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ModuleVal = yyvsp[-1].ModuleVal; CHECK_FOR_ERROR - ;} - break; - - case 136: -#line 1804 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ModuleVal) = CurModule.CurrentModule; + ; + break;} +case 135: +#line 1804 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ModuleVal = CurModule.CurrentModule; // Emit an error if there are any unresolved types left. if (!CurModule.LateResolveTypes.empty()) { const ValID &DID = CurModule.LateResolveTypes.begin()->first; @@ -3942,12 +3263,11 @@ } } CHECK_FOR_ERROR - ;} - break; - - case 137: -#line 1819 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 136: +#line 1819 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Eagerly resolve types. This is not an optimization, this is a // requirement that is due to the fact that we could have this: // @@ -3957,304 +3277,272 @@ // 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 138: -#line 1841 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Function prototypes can be in const pool + delete yyvsp[0].TypeVal; CHECK_FOR_ERROR - ;} - break; - - case 139: -#line 1844 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Asm blocks can be in the const pool - CHECK_FOR_ERROR - ;} - break; - - case 140: -#line 1847 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[0].ConstVal) == 0) + ; + break;} +case 137: +#line 1841 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Function prototypes can be in const pool + CHECK_FOR_ERROR + ; + break;} +case 138: +#line 1844 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Asm blocks can be in the const pool + CHECK_FOR_ERROR + ; + break;} +case 139: +#line 1847 "/Users/sabre/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 141: -#line 1852 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 140: +#line 1852 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ CurGV = 0; - ;} - break; - - case 142: -#line 1855 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); + ; + break;} +case 141: +#line 1855 "/Users/sabre/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 143: -#line 1859 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { + delete yyvsp[0].TypeVal; + ; + break;} +case 142: +#line 1859 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ CurGV = 0; CHECK_FOR_ERROR - ;} - break; - - case 144: -#line 1863 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::DLLImportLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); + ; + break;} +case 143: +#line 1863 "/Users/sabre/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 145: -#line 1867 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { + delete yyvsp[0].TypeVal; + ; + break;} +case 144: +#line 1867 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ CurGV = 0; CHECK_FOR_ERROR - ;} - break; - - case 146: -#line 1871 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 145: +#line 1871 "/Users/sabre/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 147: -#line 1876 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { + delete yyvsp[0].TypeVal; + ; + break;} +case 146: +#line 1876 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ CurGV = 0; CHECK_FOR_ERROR - ;} - break; - - case 148: -#line 1880 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - CHECK_FOR_ERROR - ;} - break; - - case 149: -#line 1883 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 147: +#line 1880 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + CHECK_FOR_ERROR + ; + break;} +case 148: +#line 1883 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ CHECK_FOR_ERROR - ;} - break; - - case 150: -#line 1886 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - ;} - break; - - case 151: -#line 1890 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 149: +#line 1886 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + ; + break;} +case 150: +#line 1890 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); - char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true); - std::string NewAsm((yyvsp[0].StrVal), EndStr); - free((yyvsp[0].StrVal)); + 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 152: -#line 1903 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.Endianness) = Module::BigEndian; ;} - break; - - case 153: -#line 1904 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.Endianness) = Module::LittleEndian; ;} - break; - - case 154: -#line 1906 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - CurModule.CurrentModule->setEndianness((yyvsp[0].Endianness)); +; + break;} +case 151: +#line 1903 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.Endianness = Module::BigEndian; ; + break;} +case 152: +#line 1904 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.Endianness = Module::LittleEndian; ; + break;} +case 153: +#line 1906 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + CurModule.CurrentModule->setEndianness(yyvsp[0].Endianness); CHECK_FOR_ERROR - ;} - break; - - case 155: -#line 1910 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[0].UInt64Val) == 32) + ; + break;} +case 154: +#line 1910 "/Users/sabre/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 156: -#line 1919 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal)); - free((yyvsp[0].StrVal)); - ;} - break; - - case 157: -#line 1923 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal)); - free((yyvsp[0].StrVal)); - ;} - break; - - case 159: -#line 1930 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); - free((yyvsp[0].StrVal)); + ; + break;} +case 155: +#line 1919 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + CurModule.CurrentModule->setTargetTriple(yyvsp[0].StrVal); + free(yyvsp[0].StrVal); + ; + break;} +case 156: +#line 1923 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + CurModule.CurrentModule->setDataLayout(yyvsp[0].StrVal); + free(yyvsp[0].StrVal); + ; + break;} +case 158: +#line 1930 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal); + free(yyvsp[0].StrVal); CHECK_FOR_ERROR - ;} - break; - - case 160: -#line 1935 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); - free((yyvsp[0].StrVal)); + ; + break;} +case 159: +#line 1935 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal); + free(yyvsp[0].StrVal); CHECK_FOR_ERROR - ;} - break; - - case 161: -#line 1940 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 160: +#line 1940 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ CHECK_FOR_ERROR - ;} - break; - - case 165: -#line 1950 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.StrVal) = 0; ;} - break; - - case 166: -#line 1952 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if (*(yyvsp[-1].TypeVal) == Type::VoidTy) + ; + break;} +case 164: +#line 1950 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.StrVal = 0; ; + break;} +case 165: +#line 1952 "/Users/sabre/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 167: -#line 1959 "/proj/llvm/llvm-4/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 168: -#line 1965 "/proj/llvm/llvm-4/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 169: -#line 1972 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ArgList) = (yyvsp[0].ArgList); +; + break;} +case 166: +#line 1959 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ArgList = yyvsp[-2].ArgList; + yyvsp[-2].ArgList->push_back(*yyvsp[0].ArgVal); + delete yyvsp[0].ArgVal; + CHECK_FOR_ERROR + ; + break;} +case 167: +#line 1965 "/Users/sabre/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 168: +#line 1972 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ArgList = yyvsp[0].ArgList; CHECK_FOR_ERROR - ;} - break; - - case 170: -#line 1976 "/proj/llvm/llvm-4/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 171: -#line 1982 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ArgList) = new std::vector >(); - (yyval.ArgList)->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0)); + ; + break;} +case 170: +#line 1982 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ArgList = new std::vector >(); + yyval.ArgList->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0)); CHECK_FOR_ERROR - ;} - break; - - case 172: -#line 1987 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ArgList) = 0; + ; + break;} +case 171: +#line 1987 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ArgList = 0; CHECK_FOR_ERROR - ;} - break; - - case 173: -#line 1993 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - UnEscapeLexed((yyvsp[-5].StrVal)); - std::string FunctionName((yyvsp[-5].StrVal)); - free((yyvsp[-5].StrVal)); // Free strdup'd memory! + ; + break;} +case 172: +#line 1993 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + UnEscapeLexed(yyvsp[-5].StrVal); + std::string FunctionName(yyvsp[-5].StrVal); + free(yyvsp[-5].StrVal); // Free strdup'd memory! - if (!(*(yyvsp[-6].TypeVal))->isFirstClassType() && *(yyvsp[-6].TypeVal) != Type::VoidTy) + 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()) { @@ -4298,24 +3586,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... @@ -4323,140 +3611,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 176: -#line 2089 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.FunctionVal) = CurFun.CurrentFunction; +; + break;} +case 175: +#line 2089 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.FunctionVal = CurFun.CurrentFunction; // Make sure that we keep track of the linkage type even if there was a // previous "declare". - (yyval.FunctionVal)->setLinkage((yyvsp[-2].Linkage)); -;} - break; - - case 179: -#line 2099 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); + yyval.FunctionVal->setLinkage(yyvsp[-2].Linkage); +; + break;} +case 178: +#line 2099 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.FunctionVal = yyvsp[-1].FunctionVal; CHECK_FOR_ERROR -;} - break; - - case 181: -#line 2105 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { CurFun.Linkage = GlobalValue::DLLImportLinkage ;} - break; - - case 182: -#line 2106 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { CurFun.Linkage = GlobalValue::DLLImportLinkage ;} - break; - - case 183: -#line 2108 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { CurFun.isDeclare = true; ;} - break; - - case 184: -#line 2108 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.FunctionVal) = CurFun.CurrentFunction; +; + break;} +case 180: +#line 2105 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ CurFun.Linkage = GlobalValue::DLLImportLinkage; ; + break;} +case 181: +#line 2106 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ CurFun.Linkage = GlobalValue::DLLImportLinkage; ; + break;} +case 182: +#line 2108 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ CurFun.isDeclare = true; ; + break;} +case 183: +#line 2108 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.FunctionVal = CurFun.CurrentFunction; CurFun.FunctionDone(); CHECK_FOR_ERROR - ;} - break; - - case 185: -#line 2118 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.BoolVal) = false; - CHECK_FOR_ERROR - ;} - break; - - case 186: -#line 2122 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.BoolVal) = true; - CHECK_FOR_ERROR - ;} - break; - - case 187: -#line 2127 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // A reference to a direct constant - (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val)); - CHECK_FOR_ERROR - ;} - break; - - case 188: -#line 2131 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val)); + ; + break;} +case 184: +#line 2118 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.BoolVal = false; CHECK_FOR_ERROR - ;} - break; - - case 189: -#line 2135 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Perhaps it's an FP constant? - (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal)); + ; + break;} +case 185: +#line 2122 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.BoolVal = true; CHECK_FOR_ERROR - ;} - break; - - case 190: -#line 2139 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ValIDVal) = ValID::create(ConstantBool::getTrue()); + ; + break;} +case 186: +#line 2127 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // A reference to a direct constant + yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val); + CHECK_FOR_ERROR + ; + break;} +case 187: +#line 2131 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val); CHECK_FOR_ERROR - ;} - break; - - case 191: -#line 2143 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ValIDVal) = ValID::create(ConstantBool::getFalse()); + ; + break;} +case 188: +#line 2135 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Perhaps it's an FP constant? + yyval.ValIDVal = ValID::create(yyvsp[0].FPVal); + CHECK_FOR_ERROR + ; + break;} +case 189: +#line 2139 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ValIDVal = ValID::create(ConstantBool::getTrue()); CHECK_FOR_ERROR - ;} - break; - - case 192: -#line 2147 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ValIDVal) = ValID::createNull(); + ; + break;} +case 190: +#line 2143 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ValIDVal = ValID::create(ConstantBool::getFalse()); CHECK_FOR_ERROR - ;} - break; - - case 193: -#line 2151 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ValIDVal) = ValID::createUndef(); + ; + break;} +case 191: +#line 2147 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ValIDVal = ValID::createNull(); CHECK_FOR_ERROR - ;} - break; - - case 194: -#line 2155 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // A vector zero constant. - (yyval.ValIDVal) = ValID::createZeroInit(); + ; + break;} +case 192: +#line 2151 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ValIDVal = ValID::createUndef(); CHECK_FOR_ERROR - ;} - break; - - case 195: -#line 2159 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Nonempty unsized packed vector - const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType(); - int NumElements = (yyvsp[-1].ConstVector)->size(); + ; + break;} +case 193: +#line 2155 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // A vector zero constant. + yyval.ValIDVal = ValID::createZeroInit(); + CHECK_FOR_ERROR + ; + break;} +case 194: +#line 2159 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Nonempty unsized packed vector + const Type *ETy = (*yyvsp[-1].ConstVector)[0]->getType(); + int NumElements = yyvsp[-1].ConstVector->size(); PackedType* pt = PackedType::get(ETy, NumElements); PATypeHolder* PTy = new PATypeHolder( @@ -4468,108 +3739,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 196: -#line 2184 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal)); - CHECK_FOR_ERROR - ;} - break; - - case 197: -#line 2188 "/proj/llvm/llvm-4/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 198: -#line 2202 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Is it an integer reference...? - (yyval.ValIDVal) = ValID::create((yyvsp[0].SIntVal)); - CHECK_FOR_ERROR - ;} - break; - - case 199: -#line 2206 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Is it a named reference...? - (yyval.ValIDVal) = ValID::create((yyvsp[0].StrVal)); - CHECK_FOR_ERROR - ;} - break; - - case 202: -#line 2218 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); delete (yyvsp[-1].TypeVal); - CHECK_FOR_ERROR - ;} - break; - - case 203: -#line 2223 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); - CHECK_FOR_ERROR - ;} - break; - - case 204: -#line 2227 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Do not allow functions with 0 basic blocks - (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); + ; + break;} +case 195: +#line 2184 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ValIDVal = ValID::create(yyvsp[0].ConstVal); CHECK_FOR_ERROR - ;} - break; - - case 205: -#line 2236 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal)); + ; + break;} +case 196: +#line 2188 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + char *End = UnEscapeLexed(yyvsp[-2].StrVal, true); + std::string AsmStr = std::string(yyvsp[-2].StrVal, End); + End = UnEscapeLexed(yyvsp[0].StrVal, true); + std::string Constraints = std::string(yyvsp[0].StrVal, End); + yyval.ValIDVal = ValID::createInlineAsm(AsmStr, Constraints, yyvsp[-3].BoolVal); + free(yyvsp[-2].StrVal); + free(yyvsp[0].StrVal); + CHECK_FOR_ERROR + ; + break;} +case 197: +#line 2202 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Is it an integer reference...? + yyval.ValIDVal = ValID::create(yyvsp[0].SIntVal); + CHECK_FOR_ERROR + ; + break;} +case 198: +#line 2206 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Is it a named reference...? + yyval.ValIDVal = ValID::create(yyvsp[0].StrVal); + CHECK_FOR_ERROR + ; + break;} +case 201: +#line 2218 "/Users/sabre/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 202: +#line 2223 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.FunctionVal = yyvsp[-1].FunctionVal; CHECK_FOR_ERROR - ;} - break; - - case 206: -#line 2247 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal)); - (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal); + ; + break;} +case 203: +#line 2227 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Do not allow functions with 0 basic blocks + yyval.FunctionVal = yyvsp[-1].FunctionVal; + CHECK_FOR_ERROR + ; + break;} +case 204: +#line 2236 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + setValueName(yyvsp[0].TermInstVal, yyvsp[-1].StrVal); CHECK_FOR_ERROR - ;} - break; + InsertValue(yyvsp[0].TermInstVal); - case 207: -#line 2252 "/proj/llvm/llvm-4/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 205: +#line 2247 "/Users/sabre/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 206: +#line 2252 "/Users/sabre/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 @@ -4577,15 +3838,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 208: -#line 2264 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((yyvsp[0].StrVal)), true); + ; + break;} +case 207: +#line 2264 "/Users/sabre/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 @@ -4593,97 +3853,90 @@ // referenced. Function::BasicBlockListType &BBL = CurFun.CurrentFunction->getBasicBlockList(); - BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal)); - CHECK_FOR_ERROR - ;} - break; - - case 209: -#line 2277 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Return with a result... - (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal)); - CHECK_FOR_ERROR - ;} - break; - - case 210: -#line 2281 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Return with no result... - (yyval.TermInstVal) = new ReturnInst(); - CHECK_FOR_ERROR - ;} - break; - - case 211: -#line 2285 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Unconditional Branch... - BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); - CHECK_FOR_ERROR - (yyval.TermInstVal) = new BranchInst(tmpBB); - ;} - break; - - case 212: -#line 2290 "/proj/llvm/llvm-4/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 213: -#line 2299 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal)); + ; + break;} +case 208: +#line 2277 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Return with a result... + yyval.TermInstVal = new ReturnInst(yyvsp[0].ValueVal); + CHECK_FOR_ERROR + ; + break;} +case 209: +#line 2281 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Return with no result... + yyval.TermInstVal = new ReturnInst(); + CHECK_FOR_ERROR + ; + break;} +case 210: +#line 2285 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Unconditional Branch... + BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal); + CHECK_FOR_ERROR + yyval.TermInstVal = new BranchInst(tmpBB); + ; + break;} +case 211: +#line 2290 "/Users/sabre/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 212: +#line 2299 "/Users/sabre/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 214: -#line 2318 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal)); + ; + break;} +case 213: +#line 2318 "/Users/sabre/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 215: -#line 2328 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 214: +#line 2328 "/Users/sabre/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()); } @@ -4691,27 +3944,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) @@ -4721,269 +3974,248 @@ 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 216: -#line 2383 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.TermInstVal) = new UnwindInst(); + ; + break;} +case 215: +#line 2383 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.TermInstVal = new UnwindInst(); CHECK_FOR_ERROR - ;} - break; - - case 217: -#line 2387 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.TermInstVal) = new UnreachableInst(); + ; + break;} +case 216: +#line 2387 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.TermInstVal = new UnreachableInst(); CHECK_FOR_ERROR - ;} - break; - - case 218: -#line 2394 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.JumpTable) = (yyvsp[-5].JumpTable); - Constant *V = cast(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); + ; + break;} +case 217: +#line 2394 "/Users/sabre/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 219: -#line 2405 "/proj/llvm/llvm-4/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 218: +#line 2405 "/Users/sabre/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 220: -#line 2418 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { + yyval.JumpTable->push_back(std::make_pair(V, tmpBB)); + ; + break;} +case 219: +#line 2418 "/Users/sabre/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 221: -#line 2427 "/proj/llvm/llvm-4/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 222: -#line 2436 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.PHIList) = (yyvsp[-6].PHIList); - Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal)); +; + break;} +case 220: +#line 2427 "/Users/sabre/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 221: +#line 2436 "/Users/sabre/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 223: -#line 2446 "/proj/llvm/llvm-4/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 224: -#line 2450 "/proj/llvm/llvm-4/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 222: +#line 2446 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Used for call statements, and memory insts... + yyval.ValueList = new std::vector(); + yyval.ValueList->push_back(yyvsp[0].ValueVal); + ; + break;} +case 223: +#line 2450 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ValueList = yyvsp[-2].ValueList; + yyvsp[-2].ValueList->push_back(yyvsp[0].ValueVal); CHECK_FOR_ERROR - ;} - break; - - case 226: -#line 2457 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.ValueList) = 0; ;} - break; - - case 227: -#line 2459 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.BoolVal) = true; + ; + break;} +case 225: +#line 2457 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.ValueList = 0; ; + break;} +case 226: +#line 2459 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.BoolVal = true; CHECK_FOR_ERROR - ;} - break; - - case 228: -#line 2463 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.BoolVal) = false; + ; + break;} +case 227: +#line 2463 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.BoolVal = false; CHECK_FOR_ERROR - ;} - break; - - case 229: -#line 2468 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() && - !isa((*(yyvsp[-3].TypeVal)).get())) + ; + break;} +case 228: +#line 2468 "/Users/sabre/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).opcode == Instruction::URem || - (yyvsp[-4].BinaryOpVal).opcode == Instruction::SRem || - (yyvsp[-4].BinaryOpVal).opcode == Instruction::FRem)) + if (isa((*yyvsp[-3].TypeVal).get()) && + (yyvsp[-4].BinaryOpVal.opcode == Instruction::URem || + yyvsp[-4].BinaryOpVal.opcode == Instruction::SRem || + yyvsp[-4].BinaryOpVal.opcode == Instruction::FRem)) GEN_ERROR("U/S/FRem not supported on packed types!"); // Upgrade the opcode from obsolete versions before we do anything with it. - sanitizeOpCode((yyvsp[-4].BinaryOpVal),*(yyvsp[-3].TypeVal)); + sanitizeOpCode(yyvsp[-4].BinaryOpVal,*yyvsp[-3].TypeVal); CHECK_FOR_ERROR; - 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).opcode, val1, val2); - if ((yyval.InstVal) == 0) + yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal.opcode, val1, val2); + if (yyval.InstVal == 0) GEN_ERROR("binary operator returned null!"); - delete (yyvsp[-3].TypeVal); - ;} - break; - - case 230: -#line 2490 "/proj/llvm/llvm-4/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 229: +#line 2490 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + if (!(*yyvsp[-3].TypeVal)->isIntegral()) { + if (!isa(yyvsp[-3].TypeVal->get()) || + !cast(yyvsp[-3].TypeVal->get())->getElementType()->isIntegral()) 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).opcode, tmpVal1, tmpVal2); - if ((yyval.InstVal) == 0) + yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal.opcode, tmpVal1, tmpVal2); + if (yyval.InstVal == 0) GEN_ERROR("binary operator returned null!"); - delete (yyvsp[-3].TypeVal); - ;} - break; - - case 231: -#line 2505 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if(isa((*(yyvsp[-3].TypeVal)).get())) { + delete yyvsp[-3].TypeVal; + ; + break;} +case 230: +#line 2505 "/Users/sabre/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).opcode, tmpVal1, tmpVal2); - if ((yyval.InstVal) == 0) + yyval.InstVal = new SetCondInst(yyvsp[-4].BinaryOpVal.opcode, tmpVal1, tmpVal2); + if (yyval.InstVal == 0) GEN_ERROR("binary operator returned null!"); - delete (yyvsp[-3].TypeVal); - ;} - break; - - case 232: -#line 2519 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { + delete yyvsp[-3].TypeVal; + ; + break;} +case 231: +#line 2519 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ std::cerr << "WARNING: Use of eliminated 'not' instruction:" << " Replacing with 'xor'.\n"; - Value *Ones = ConstantIntegral::getAllOnesValue((yyvsp[0].ValueVal)->getType()); + 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 233: -#line 2532 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[0].ValueVal)->getType() != Type::UByteTy) + ; + break;} +case 232: +#line 2532 "/Users/sabre/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).opcode, (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); + yyval.InstVal = new ShiftInst(yyvsp[-3].OtherOpVal.opcode, yyvsp[-2].ValueVal, yyvsp[0].ValueVal); CHECK_FOR_ERROR - ;} - break; - - case 234: -#line 2540 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if (!(yyvsp[0].TypeVal)->get()->isFirstClassType()) + ; + break;} +case 233: +#line 2540 "/Users/sabre/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 235: -#line 2548 "/proj/llvm/llvm-4/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 234: +#line 2548 "/Users/sabre/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 236: -#line 2556 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 235: +#line 2556 "/Users/sabre/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 237: -#line 2562 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 236: +#line 2562 "/Users/sabre/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); @@ -4994,20 +4226,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 238: -#line 2582 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 237: +#line 2582 "/Users/sabre/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); @@ -5019,78 +4250,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 239: -#line 2605 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) + ; + break;} +case 238: +#line 2605 "/Users/sabre/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 240: -#line 2611 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) + ; + break;} +case 239: +#line 2611 "/Users/sabre/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 241: -#line 2617 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) + ; + break;} +case 240: +#line 2617 "/Users/sabre/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 242: -#line 2623 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - const Type *Ty = (yyvsp[0].PHIList)->front().first->getType(); + ; + break;} +case 241: +#line 2623 "/Users/sabre/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 243: -#line 2638 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 242: +#line 2638 "/Users/sabre/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()); } @@ -5098,31 +4324,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) @@ -5132,442 +4358,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 244: -#line 2697 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.InstVal) = (yyvsp[0].InstVal); - CHECK_FOR_ERROR - ;} - break; - - case 245: -#line 2704 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ValueList) = (yyvsp[0].ValueList); - CHECK_FOR_ERROR - ;} - break; - - case 246: -#line 2707 "/proj/llvm/llvm-4/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 243: +#line 2697 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.InstVal = yyvsp[0].InstVal; CHECK_FOR_ERROR - ;} - break; - - case 247: -#line 2712 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.BoolVal) = true; + ; + break;} +case 244: +#line 2704 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ValueList = yyvsp[0].ValueList; + CHECK_FOR_ERROR + ; + break;} +case 245: +#line 2707 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ValueList = new std::vector(); + CHECK_FOR_ERROR + ; + break;} +case 246: +#line 2712 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.BoolVal = true; CHECK_FOR_ERROR - ;} - break; - - case 248: -#line 2716 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.BoolVal) = false; + ; + break;} +case 247: +#line 2716 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.BoolVal = false; CHECK_FOR_ERROR - ;} - break; - - case 249: -#line 2723 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); - delete (yyvsp[-1].TypeVal); + ; + break;} +case 248: +#line 2723 "/Users/sabre/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 250: -#line 2728 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); + ; + break;} +case 249: +#line 2728 "/Users/sabre/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 251: -#line 2734 "/proj/llvm/llvm-4/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 250: +#line 2734 "/Users/sabre/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 252: -#line 2739 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); + ; + break;} +case 251: +#line 2739 "/Users/sabre/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 253: -#line 2745 "/proj/llvm/llvm-4/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 252: +#line 2745 "/Users/sabre/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 254: -#line 2753 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if (!isa((yyvsp[-1].TypeVal)->get())) + ; + break;} +case 253: +#line 2753 "/Users/sabre/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 255: -#line 2765 "/proj/llvm/llvm-4/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 254: +#line 2765 "/Users/sabre/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 256: -#line 2780 "/proj/llvm/llvm-4/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 255: +#line 2780 "/Users/sabre/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 (ConstantInt *CUI = dyn_cast((*(yyvsp[0].ValueList))[i])) + if (ConstantInt *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 5303 "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 2806 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2806 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" void llvm::GenerateError(const std::string &message, int LineNo) { @@ -5590,4 +4751,3 @@ GenerateError(errMsg); return 0; } - Index: llvm/lib/AsmParser/llvmAsmParser.h.cvs diff -u llvm/lib/AsmParser/llvmAsmParser.h.cvs:1.18 llvm/lib/AsmParser/llvmAsmParser.h.cvs:1.19 --- llvm/lib/AsmParser/llvmAsmParser.h.cvs:1.18 Thu Nov 2 14:25:49 2006 +++ llvm/lib/AsmParser/llvmAsmParser.h.cvs Tue Nov 7 23:58:47 2006 @@ -1,264 +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, - DATALAYOUT = 326, - RET = 327, - BR = 328, - SWITCH = 329, - INVOKE = 330, - UNWIND = 331, - UNREACHABLE = 332, - ADD = 333, - SUB = 334, - MUL = 335, - UDIV = 336, - SDIV = 337, - FDIV = 338, - UREM = 339, - SREM = 340, - FREM = 341, - AND = 342, - OR = 343, - XOR = 344, - SETLE = 345, - SETGE = 346, - SETLT = 347, - SETGT = 348, - SETEQ = 349, - SETNE = 350, - MALLOC = 351, - ALLOCA = 352, - FREE = 353, - LOAD = 354, - STORE = 355, - GETELEMENTPTR = 356, - PHI_TOK = 357, - CAST = 358, - SELECT = 359, - SHL = 360, - SHR = 361, - VAARG = 362, - EXTRACTELEMENT = 363, - INSERTELEMENT = 364, - SHUFFLEVECTOR = 365, - VAARG_old = 366, - VANEXT_old = 367 - }; -#endif -/* Tokens. */ -#define ESINT64VAL 258 -#define EUINT64VAL 259 -#define SINTVAL 260 -#define UINTVAL 261 -#define FPVAL 262 -#define VOID 263 -#define BOOL 264 -#define SBYTE 265 -#define UBYTE 266 -#define SHORT 267 -#define USHORT 268 -#define INT 269 -#define UINT 270 -#define LONG 271 -#define ULONG 272 -#define FLOAT 273 -#define DOUBLE 274 -#define TYPE 275 -#define LABEL 276 -#define VAR_ID 277 -#define LABELSTR 278 -#define STRINGCONSTANT 279 -#define IMPLEMENTATION 280 -#define ZEROINITIALIZER 281 -#define TRUETOK 282 -#define FALSETOK 283 -#define BEGINTOK 284 -#define ENDTOK 285 -#define DECLARE 286 -#define GLOBAL 287 -#define CONSTANT 288 -#define SECTION 289 -#define VOLATILE 290 -#define TO 291 -#define DOTDOTDOT 292 -#define NULL_TOK 293 -#define UNDEF 294 -#define CONST 295 -#define INTERNAL 296 -#define LINKONCE 297 -#define WEAK 298 -#define APPENDING 299 -#define DLLIMPORT 300 -#define DLLEXPORT 301 -#define EXTERN_WEAK 302 -#define OPAQUE 303 -#define NOT 304 -#define EXTERNAL 305 -#define TARGET 306 -#define TRIPLE 307 -#define ENDIAN 308 -#define POINTERSIZE 309 -#define LITTLE 310 -#define BIG 311 -#define ALIGN 312 -#define DEPLIBS 313 -#define CALL 314 -#define TAIL 315 -#define ASM_TOK 316 -#define MODULE 317 -#define SIDEEFFECT 318 -#define CC_TOK 319 -#define CCC_TOK 320 -#define CSRETCC_TOK 321 -#define FASTCC_TOK 322 -#define COLDCC_TOK 323 -#define X86_STDCALLCC_TOK 324 -#define X86_FASTCALLCC_TOK 325 -#define DATALAYOUT 326 -#define RET 327 -#define BR 328 -#define SWITCH 329 -#define INVOKE 330 -#define UNWIND 331 -#define UNREACHABLE 332 -#define ADD 333 -#define SUB 334 -#define MUL 335 -#define UDIV 336 -#define SDIV 337 -#define FDIV 338 -#define UREM 339 -#define SREM 340 -#define FREM 341 -#define AND 342 -#define OR 343 -#define XOR 344 -#define SETLE 345 -#define SETGE 346 -#define SETLT 347 -#define SETGT 348 -#define SETEQ 349 -#define SETNE 350 -#define MALLOC 351 -#define ALLOCA 352 -#define FREE 353 -#define LOAD 354 -#define STORE 355 -#define GETELEMENTPTR 356 -#define PHI_TOK 357 -#define CAST 358 -#define SELECT 359 -#define SHL 360 -#define SHR 361 -#define VAARG 362 -#define EXTRACTELEMENT 363 -#define INSERTELEMENT 364 -#define SHUFFLEVECTOR 365 -#define VAARG_old 366 -#define VANEXT_old 367 - - - - -#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 1016 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" -typedef union YYSTYPE { +typedef union { llvm::Module *ModuleVal; llvm::Function *FunctionVal; std::pair *ArgVal; @@ -297,14 +37,116 @@ OtherOpInfo OtherOpVal; llvm::Module::Endianness Endianness; } YYSTYPE; -/* Line 1447 of yacc.c. */ -#line 302 "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 DATALAYOUT 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 UDIV 335 +#define SDIV 336 +#define FDIV 337 +#define UREM 338 +#define SREM 339 +#define FREM 340 +#define AND 341 +#define OR 342 +#define XOR 343 +#define SETLE 344 +#define SETGE 345 +#define SETLT 346 +#define SETGT 347 +#define SETEQ 348 +#define SETNE 349 +#define MALLOC 350 +#define ALLOCA 351 +#define FREE 352 +#define LOAD 353 +#define STORE 354 +#define GETELEMENTPTR 355 +#define PHI_TOK 356 +#define CAST 357 +#define SELECT 358 +#define SHL 359 +#define SHR 360 +#define VAARG 361 +#define EXTRACTELEMENT 362 +#define INSERTELEMENT 363 +#define SHUFFLEVECTOR 364 +#define VAARG_old 365 +#define VANEXT_old 366 +extern YYSTYPE llvmAsmlval; Index: llvm/lib/AsmParser/llvmAsmParser.y.cvs diff -u llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.24 llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.25 --- llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.24 Thu Nov 2 14:25:49 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y.cvs Tue Nov 7 23:58:47 2006 @@ -2102,8 +2102,8 @@ }; FnDeclareLinkage: /*default*/ | - DLLIMPORT { CurFun.Linkage = GlobalValue::DLLImportLinkage } | - EXTERN_WEAK { CurFun.Linkage = GlobalValue::DLLImportLinkage }; + DLLIMPORT { CurFun.Linkage = GlobalValue::DLLImportLinkage; } | + EXTERN_WEAK { CurFun.Linkage = GlobalValue::DLLImportLinkage; }; FunctionProto : DECLARE { CurFun.isDeclare = true; } FnDeclareLinkage FunctionHeaderH { $$ = CurFun.CurrentFunction; From sabre at nondot.org Wed Nov 8 00:42:56 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 8 Nov 2006 00:42:56 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/PowerPC/branch-opt.ll Message-ID: <200611080642.kA86guK4025017@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/PowerPC: branch-opt.ll updated: 1.1 -> 1.2 --- Log message: now that we handle single mbb loops better, one branch is allowed --- Diffs of the changes: (+1 -1) branch-opt.ll | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/Regression/CodeGen/PowerPC/branch-opt.ll diff -u llvm/test/Regression/CodeGen/PowerPC/branch-opt.ll:1.1 llvm/test/Regression/CodeGen/PowerPC/branch-opt.ll:1.2 --- llvm/test/Regression/CodeGen/PowerPC/branch-opt.ll:1.1 Tue Oct 17 13:14:39 2006 +++ llvm/test/Regression/CodeGen/PowerPC/branch-opt.ll Wed Nov 8 00:42:42 2006 @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | llc -march=ppc32 && -; RUN: llvm-as < %s | llc -march=ppc32 | not grep 'b LBB.*cond_next48.loopexit' +; RUN: llvm-as < %s | llc -march=ppc32 | grep 'b LBB.*cond_next48.loopexit' | wc -l | grep 1 target endian = big target pointersize = 32 From reid at x10sys.com Wed Nov 8 00:43:30 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 8 Nov 2006 00:43:30 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp Message-ID: <200611080643.kA86hUJe025037@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/DebugInfo: 2006-11-06-StackTrace.cpp updated: 1.2 -> 1.3 --- Log message: XFAIL this on Linux until Jim gets Darwin ship shape. --- Diffs of the changes: (+1 -0) 2006-11-06-StackTrace.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp diff -u llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp:1.2 llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp:1.3 --- llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp:1.2 Tue Nov 7 01:58:02 2006 +++ llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp Wed Nov 8 00:43:16 2006 @@ -5,6 +5,7 @@ // RUN: ( echo "break DeepStack::deepest"; echo "run 17" ; echo "where" ) > Output/StackTrace.gdbin // RUN: gdb -q -batch -n -x Output/StackTrace.gdbin Output/StackTrace.exe | tee Output/StackTrace.out | grep '#0 DeepStack::deepest (this=.*,x=33)' // RUN: gdb -q -batch -n -x Output/StackTrace.gdbin Output/StackTrace.exe | grep '#7 0x.* in main(argc=1, argv=.*)' +// XFAIL: linux #include From reid at x10sys.com Wed Nov 8 00:48:16 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 8 Nov 2006 00:48:16 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp Message-ID: <200611080648.kA86mG3C025300@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: Reader.cpp updated: 1.202 -> 1.203 --- Log message: For PR950: http://llvm.org/PR950 : This patch converts the old SHR instruction into two instructions, AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not dependent on the sign of their operands. --- Diffs of the changes: (+15 -3) Reader.cpp | 18 +++++++++++++++--- 1 files changed, 15 insertions(+), 3 deletions(-) Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.202 llvm/lib/Bytecode/Reader/Reader.cpp:1.203 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.202 Thu Nov 2 14:25:49 2006 +++ llvm/lib/Bytecode/Reader/Reader.cpp Wed Nov 8 00:47:33 2006 @@ -719,7 +719,15 @@ Opcode = Instruction::Shl; break; case 31: // Shr - Opcode = Instruction::Shr; + // The type of the instruction is based on the operands. We need to + // select ashr or lshr based on that type. The iType values are hardcoded + // to the values used in bytecode version 5 (and prior) because it is + // likely these codes will change in future versions of LLVM. This if + // statement says "if (integer type and signed)" + if (iType >= 2 && iType <= 9 && iType % 2 != 0) + Opcode = Instruction::AShr; + else + Opcode = Instruction::LShr; break; case 32: { //VANext_old ( <= llvm 1.5 ) const Type* ArgTy = getValue(iType, Oprnds[0])->getType(); @@ -987,7 +995,8 @@ } case Instruction::Shl: - case Instruction::Shr: + case Instruction::LShr: + case Instruction::AShr: Result = new ShiftInst(Instruction::OtherOps(Opcode), getValue(iType, Oprnds[0]), getValue(Type::UByteTyID, Oprnds[1])); @@ -1707,7 +1716,10 @@ Opcode = Instruction::Shl; break; case 31: // Shr - Opcode = Instruction::Shr; + if (ArgVec[0]->getType()->isSigned()) + Opcode = Instruction::AShr; + else + Opcode = Instruction::LShr; break; case 34: // Select Opcode = Instruction::Select; From reid at x10sys.com Wed Nov 8 00:48:13 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 8 Nov 2006 00:48:13 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp ScalarReplAggregates.cpp Message-ID: <200611080648.kA86mDCv025280@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.536 -> 1.537 ScalarReplAggregates.cpp updated: 1.48 -> 1.49 --- Log message: For PR950: http://llvm.org/PR950 : This patch converts the old SHR instruction into two instructions, AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not dependent on the sign of their operands. --- Diffs of the changes: (+179 -207) InstructionCombining.cpp | 379 +++++++++++++++++++++-------------------------- ScalarReplAggregates.cpp | 7 2 files changed, 179 insertions(+), 207 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.536 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.537 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.536 Fri Nov 3 16:45:50 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Wed Nov 8 00:47:33 2006 @@ -731,7 +731,7 @@ return; } break; - case Instruction::Shr: + case Instruction::LShr: // (ushr X, C1) & C2 == 0 iff (-1 >> C1) & C2 == 0 if (ConstantInt *SA = dyn_cast(I->getOperand(1))) { // Compute the new bits that are at the top now. @@ -739,29 +739,39 @@ uint64_t HighBits = (1ULL << ShiftAmt)-1; HighBits <<= I->getType()->getPrimitiveSizeInBits()-ShiftAmt; - if (I->getType()->isUnsigned()) { // Unsigned shift right. - Mask <<= ShiftAmt; - ComputeMaskedBits(I->getOperand(0), Mask, KnownZero,KnownOne,Depth+1); - assert((KnownZero & KnownOne) == 0&&"Bits known to be one AND zero?"); - KnownZero >>= ShiftAmt; - KnownOne >>= ShiftAmt; - KnownZero |= HighBits; // high bits known zero. - } else { - Mask <<= ShiftAmt; - ComputeMaskedBits(I->getOperand(0), Mask, KnownZero,KnownOne,Depth+1); - assert((KnownZero & KnownOne) == 0&&"Bits known to be one AND zero?"); - KnownZero >>= ShiftAmt; - KnownOne >>= ShiftAmt; + // Unsigned shift right. + Mask <<= ShiftAmt; + ComputeMaskedBits(I->getOperand(0), Mask, KnownZero,KnownOne,Depth+1); + assert((KnownZero & KnownOne) == 0&&"Bits known to be one AND zero?"); + KnownZero >>= ShiftAmt; + KnownOne >>= ShiftAmt; + KnownZero |= HighBits; // high bits known zero. + return; + } + break; + case Instruction::AShr: + // (ushr X, C1) & C2 == 0 iff (-1 >> C1) & C2 == 0 + if (ConstantInt *SA = dyn_cast(I->getOperand(1))) { + // Compute the new bits that are at the top now. + uint64_t ShiftAmt = SA->getZExtValue(); + uint64_t HighBits = (1ULL << ShiftAmt)-1; + HighBits <<= I->getType()->getPrimitiveSizeInBits()-ShiftAmt; + + // Signed shift right. + Mask <<= ShiftAmt; + ComputeMaskedBits(I->getOperand(0), Mask, KnownZero,KnownOne,Depth+1); + assert((KnownZero & KnownOne) == 0&&"Bits known to be one AND zero?"); + KnownZero >>= ShiftAmt; + KnownOne >>= ShiftAmt; - // Handle the sign bits. - uint64_t SignBit = 1ULL << (I->getType()->getPrimitiveSizeInBits()-1); - SignBit >>= ShiftAmt; // Adjust to where it is now in the mask. + // Handle the sign bits. + uint64_t SignBit = 1ULL << (I->getType()->getPrimitiveSizeInBits()-1); + SignBit >>= ShiftAmt; // Adjust to where it is now in the mask. - if (KnownZero & SignBit) { // New bits are known zero. - KnownZero |= HighBits; - } else if (KnownOne & SignBit) { // New bits are known one. - KnownOne |= HighBits; - } + if (KnownZero & SignBit) { // New bits are known zero. + KnownZero |= HighBits; + } else if (KnownOne & SignBit) { // New bits are known one. + KnownOne |= HighBits; } return; } @@ -1119,21 +1129,37 @@ KnownZero |= (1ULL << ShiftAmt) - 1; // low bits known zero. } break; - case Instruction::Shr: + case Instruction::LShr: + // For a logical shift right + if (ConstantInt *SA = dyn_cast(I->getOperand(1))) { + unsigned ShiftAmt = SA->getZExtValue(); + + // Compute the new bits that are at the top now. + uint64_t HighBits = (1ULL << ShiftAmt)-1; + HighBits <<= I->getType()->getPrimitiveSizeInBits() - ShiftAmt; + uint64_t TypeMask = I->getType()->getIntegralTypeMask(); + // Unsigned shift right. + if (SimplifyDemandedBits(I->getOperand(0), + (DemandedMask << ShiftAmt) & TypeMask, + KnownZero, KnownOne, Depth+1)) + return true; + assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); + KnownZero &= TypeMask; + KnownOne &= TypeMask; + KnownZero >>= ShiftAmt; + KnownOne >>= ShiftAmt; + KnownZero |= HighBits; // high bits known zero. + } + break; + case Instruction::AShr: // If this is an arithmetic shift right and only the low-bit is set, we can // always convert this into a logical shr, even if the shift amount is // variable. The low bit of the shift cannot be an input sign bit unless // the shift amount is >= the size of the datatype, which is undefined. - if (DemandedMask == 1 && I->getType()->isSigned()) { - // Convert the input to unsigned. - Value *NewVal = InsertCastBefore(I->getOperand(0), - I->getType()->getUnsignedVersion(), *I); - // Perform the unsigned shift right. - NewVal = new ShiftInst(Instruction::Shr, NewVal, I->getOperand(1), - I->getName()); - InsertNewInstBefore(cast(NewVal), *I); - // Then cast that to the destination type. - NewVal = new CastInst(NewVal, I->getType(), I->getName()); + if (DemandedMask == 1) { + // Perform the logical shift right. + Value *NewVal = new ShiftInst(Instruction::LShr, I->getOperand(0), + I->getOperand(1), I->getName()); InsertNewInstBefore(cast(NewVal), *I); return UpdateValueUsesWith(I, NewVal); } @@ -1145,48 +1171,31 @@ uint64_t HighBits = (1ULL << ShiftAmt)-1; HighBits <<= I->getType()->getPrimitiveSizeInBits() - ShiftAmt; uint64_t TypeMask = I->getType()->getIntegralTypeMask(); - if (I->getType()->isUnsigned()) { // Unsigned shift right. - if (SimplifyDemandedBits(I->getOperand(0), - (DemandedMask << ShiftAmt) & TypeMask, - KnownZero, KnownOne, Depth+1)) - return true; - assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); - KnownZero &= TypeMask; - KnownOne &= TypeMask; - KnownZero >>= ShiftAmt; - KnownOne >>= ShiftAmt; - KnownZero |= HighBits; // high bits known zero. - } else { // Signed shift right. - if (SimplifyDemandedBits(I->getOperand(0), - (DemandedMask << ShiftAmt) & TypeMask, - KnownZero, KnownOne, Depth+1)) - return true; - assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); - KnownZero &= TypeMask; - KnownOne &= TypeMask; - KnownZero >>= ShiftAmt; - KnownOne >>= ShiftAmt; + // Signed shift right. + if (SimplifyDemandedBits(I->getOperand(0), + (DemandedMask << ShiftAmt) & TypeMask, + KnownZero, KnownOne, Depth+1)) + return true; + assert((KnownZero & KnownOne) == 0 && "Bits known to be one AND zero?"); + KnownZero &= TypeMask; + KnownOne &= TypeMask; + KnownZero >>= ShiftAmt; + KnownOne >>= ShiftAmt; - // Handle the sign bits. - uint64_t SignBit = 1ULL << (I->getType()->getPrimitiveSizeInBits()-1); - SignBit >>= ShiftAmt; // Adjust to where it is now in the mask. + // Handle the sign bits. + uint64_t SignBit = 1ULL << (I->getType()->getPrimitiveSizeInBits()-1); + SignBit >>= ShiftAmt; // Adjust to where it is now in the mask. - // If the input sign bit is known to be zero, or if none of the top bits - // are demanded, turn this into an unsigned shift right. - if ((KnownZero & SignBit) || (HighBits & ~DemandedMask) == HighBits) { - // Convert the input to unsigned. - Value *NewVal = InsertCastBefore(I->getOperand(0), - I->getType()->getUnsignedVersion(), *I); - // Perform the unsigned shift right. - NewVal = new ShiftInst(Instruction::Shr, NewVal, SA, I->getName()); - InsertNewInstBefore(cast(NewVal), *I); - // Then cast that to the destination type. - NewVal = new CastInst(NewVal, I->getType(), I->getName()); - InsertNewInstBefore(cast(NewVal), *I); - return UpdateValueUsesWith(I, NewVal); - } else if (KnownOne & SignBit) { // New bits are known one. - KnownOne |= HighBits; - } + // If the input sign bit is known to be zero, or if none of the top bits + // are demanded, turn this into an unsigned shift right. + if ((KnownZero & SignBit) || (HighBits & ~DemandedMask) == HighBits) { + // Perform the logical shift right. + Value *NewVal = new ShiftInst(Instruction::LShr, I->getOperand(0), + SA, I->getName()); + InsertNewInstBefore(cast(NewVal), *I); + return UpdateValueUsesWith(I, NewVal); + } else if (KnownOne & SignBit) { // New bits are known one. + KnownOne |= HighBits; } } break; @@ -1899,29 +1908,28 @@ if (C->isNullValue()) { Value *NoopCastedRHS = RemoveNoopCast(Op1); if (ShiftInst *SI = dyn_cast(NoopCastedRHS)) - if (SI->getOpcode() == Instruction::Shr) + if (SI->getOpcode() == Instruction::LShr) { if (ConstantInt *CU = dyn_cast(SI->getOperand(1))) { - const Type *NewTy; - if (SI->getType()->isSigned()) - NewTy = SI->getType()->getUnsignedVersion(); - else - NewTy = SI->getType()->getSignedVersion(); // Check to see if we are shifting out everything but the sign bit. if (CU->getZExtValue() == SI->getType()->getPrimitiveSizeInBits()-1) { - // Ok, the transformation is safe. Insert a cast of the incoming - // value, then the new shift, then the new cast. - Value *InV = InsertCastBefore(SI->getOperand(0), NewTy, I); - Instruction *NewShift = new ShiftInst(Instruction::Shr, InV, - CU, SI->getName()); - if (NewShift->getType() == I.getType()) - return NewShift; - else { - InsertNewInstBefore(NewShift, I); - return new CastInst(NewShift, I.getType()); - } + // Ok, the transformation is safe. Insert AShr. + return new ShiftInst(Instruction::AShr, SI->getOperand(0), + CU, SI->getName()); + } + } + } + else if (SI->getOpcode() == Instruction::AShr) { + if (ConstantInt *CU = dyn_cast(SI->getOperand(1))) { + // Check to see if we are shifting out everything but the sign bit. + if (CU->getZExtValue() == + SI->getType()->getPrimitiveSizeInBits()-1) { + // Ok, the transformation is safe. Insert LShr. + return new ShiftInst(Instruction::LShr, SI->getOperand(0), + CU, SI->getName()); } } + } } // Try to fold constant sub into select arguments. @@ -2138,7 +2146,7 @@ } Value *V = - InsertNewInstBefore(new ShiftInst(Instruction::Shr, SCIOp0, Amt, + InsertNewInstBefore(new ShiftInst(Instruction::AShr, SCIOp0, Amt, BoolCast->getOperand(0)->getName()+ ".mask"), I); @@ -2262,18 +2270,8 @@ if (uint64_t Val = C->getZExtValue()) // Don't break X / 0 if (isPowerOf2_64(Val)) { uint64_t ShiftAmt = Log2_64(Val); - Value* X = Op0; - const Type* XTy = X->getType(); - bool isSigned = XTy->isSigned(); - if (isSigned) - X = InsertCastBefore(X, XTy->getUnsignedVersion(), I); - Instruction* Result = - new ShiftInst(Instruction::Shr, X, - ConstantInt::get(Type::UByteTy, ShiftAmt)); - if (!isSigned) - return Result; - InsertNewInstBefore(Result, I); - return new CastInst(Result, XTy->getSignedVersion(), I.getName()); + return new ShiftInst(Instruction::LShr, Op0, + ConstantInt::get(Type::UByteTy, ShiftAmt)); } } @@ -2285,20 +2283,11 @@ if (isPowerOf2_64(C1)) { Value *N = RHSI->getOperand(1); const Type* NTy = N->getType(); - bool isSigned = NTy->isSigned(); if (uint64_t C2 = Log2_64(C1)) { - if (isSigned) { - NTy = NTy->getUnsignedVersion(); - N = InsertCastBefore(N, NTy, I); - } Constant *C2V = ConstantInt::get(NTy, C2); N = InsertNewInstBefore(BinaryOperator::createAdd(N, C2V, "tmp"), I); } - Instruction* Result = new ShiftInst(Instruction::Shr, Op0, N); - if (!isSigned) - return Result; - InsertNewInstBefore(Result, I); - return new CastInst(Result, NTy->getSignedVersion(), I.getName()); + return new ShiftInst(Instruction::LShr, Op0, N); } } } @@ -2313,31 +2302,20 @@ if (isPowerOf2_64(TVA) && isPowerOf2_64(FVA)) { // Compute the shift amounts unsigned TSA = Log2_64(TVA), FSA = Log2_64(FVA); - // Make sure we get the unsigned version of X - Value* X = Op0; - const Type* origXTy = X->getType(); - bool isSigned = origXTy->isSigned(); - if (isSigned) - X = InsertCastBefore(X, X->getType()->getUnsignedVersion(), I); // Construct the "on true" case of the select Constant *TC = ConstantInt::get(Type::UByteTy, TSA); Instruction *TSI = - new ShiftInst(Instruction::Shr, X, TC, SI->getName()+".t"); + new ShiftInst(Instruction::LShr, Op0, TC, SI->getName()+".t"); TSI = InsertNewInstBefore(TSI, I); // Construct the "on false" case of the select Constant *FC = ConstantInt::get(Type::UByteTy, FSA); Instruction *FSI = - new ShiftInst(Instruction::Shr, X, FC, SI->getName()+".f"); + new ShiftInst(Instruction::LShr, Op0, FC, SI->getName()+".f"); FSI = InsertNewInstBefore(FSI, I); // construct the select instruction and return it. - SelectInst* NewSI = - new SelectInst(SI->getOperand(0), TSI, FSI, SI->getName()); - if (!isSigned) - return NewSI; - InsertNewInstBefore(NewSI, I); - return new CastInst(NewSI, origXTy, NewSI->getName()); + return new SelectInst(SI->getOperand(0), TSI, FSI, SI->getName()); } } } @@ -2807,44 +2785,40 @@ } break; } - case Instruction::Shr: + case Instruction::LShr: + { // We know that the AND will not produce any of the bits shifted in, so if // the anded constant includes them, clear them now! This only applies to // unsigned shifts, because a signed shr may bring in set bits! // - if (AndRHS->getType()->isUnsigned()) { + Constant *AllOne = ConstantIntegral::getAllOnesValue(AndRHS->getType()); + Constant *ShrMask = ConstantExpr::getLShr(AllOne, OpRHS); + Constant *CI = ConstantExpr::getAnd(AndRHS, ShrMask); + + if (CI == ShrMask) { // Masking out bits that the shift already masks. + return ReplaceInstUsesWith(TheAnd, Op); + } else if (CI != AndRHS) { + TheAnd.setOperand(1, CI); // Reduce bits set in and cst. + return &TheAnd; + } + break; + } + case Instruction::AShr: + // Signed shr. + // See if this is shifting in some sign extension, then masking it out + // with an and. + if (Op->hasOneUse()) { Constant *AllOne = ConstantIntegral::getAllOnesValue(AndRHS->getType()); - Constant *ShrMask = ConstantExpr::getShr(AllOne, OpRHS); + Constant *ShrMask = ConstantExpr::getLShr(AllOne, OpRHS); Constant *CI = ConstantExpr::getAnd(AndRHS, ShrMask); - - if (CI == ShrMask) { // Masking out bits that the shift already masks. - return ReplaceInstUsesWith(TheAnd, Op); - } else if (CI != AndRHS) { - TheAnd.setOperand(1, CI); // Reduce bits set in and cst. - return &TheAnd; - } - } else { // Signed shr. - // See if this is shifting in some sign extension, then masking it out - // with an and. - if (Op->hasOneUse()) { - Constant *AllOne = ConstantIntegral::getAllOnesValue(AndRHS->getType()); - Constant *ShrMask = ConstantExpr::getUShr(AllOne, OpRHS); - Constant *CI = ConstantExpr::getAnd(AndRHS, ShrMask); - if (CI == AndRHS) { // Masking out bits shifted in. - // Make the argument unsigned. - Value *ShVal = Op->getOperand(0); - ShVal = InsertCastBefore(ShVal, - ShVal->getType()->getUnsignedVersion(), - TheAnd); - ShVal = InsertNewInstBefore(new ShiftInst(Instruction::Shr, ShVal, - OpRHS, Op->getName()), - TheAnd); - Value *AndRHS2 = ConstantExpr::getCast(AndRHS, ShVal->getType()); - ShVal = InsertNewInstBefore(BinaryOperator::createAnd(ShVal, AndRHS2, - TheAnd.getName()), - TheAnd); - return new CastInst(ShVal, Op->getType()); - } + if (CI == AndRHS) { // Masking out bits shifted in. + // Make the argument unsigned. + Value *ShVal = Op->getOperand(0); + ShVal = InsertNewInstBefore(new ShiftInst(Instruction::LShr, ShVal, + OpRHS, Op->getName()), + TheAnd); + Value *AndRHS2 = ConstantExpr::getCast(AndRHS, ShVal->getType()); + return BinaryOperator::createAnd(ShVal, AndRHS2, TheAnd.getName()); } } break; @@ -4294,7 +4268,7 @@ if (CanFold) { Constant *NewCst; if (Shift->getOpcode() == Instruction::Shl) - NewCst = ConstantExpr::getUShr(CI, ShAmt); + NewCst = ConstantExpr::getLShr(CI, ShAmt); else NewCst = ConstantExpr::getShl(CI, ShAmt); @@ -4312,7 +4286,7 @@ I.setOperand(1, NewCst); Constant *NewAndCST; if (Shift->getOpcode() == Instruction::Shl) - NewAndCST = ConstantExpr::getUShr(AndCST, ShAmt); + NewAndCST = ConstantExpr::getLShr(AndCST, ShAmt); else NewAndCST = ConstantExpr::getShl(AndCST, ShAmt); LHSI->setOperand(1, NewAndCST); @@ -4338,7 +4312,7 @@ isa(Shift->getOperand(0))) { // Compute C << Y. Value *NS; - if (Shift->getOpcode() == Instruction::Shr) { + if (Shift->getOpcode() == Instruction::LShr) { NS = new ShiftInst(Instruction::Shl, AndCST, Shift->getOperand(1), "tmp"); } else { @@ -4347,7 +4321,7 @@ if (AndCST->getType()->isSigned()) NewAndCST = ConstantExpr::getCast(AndCST, AndCST->getType()->getUnsignedVersion()); - NS = new ShiftInst(Instruction::Shr, NewAndCST, + NS = new ShiftInst(Instruction::LShr, NewAndCST, Shift->getOperand(1), "tmp"); } InsertNewInstBefore(cast(NS), I); @@ -4385,7 +4359,7 @@ // If we are comparing against bits always shifted out, the // comparison cannot succeed. Constant *Comp = - ConstantExpr::getShl(ConstantExpr::getShr(CI, ShAmt), ShAmt); + ConstantExpr::getShl(ConstantExpr::getLShr(CI, ShAmt), ShAmt); if (Comp != CI) {// Comparing against a bit that we know is zero. bool IsSetNE = I.getOpcode() == Instruction::SetNE; Constant *Cst = ConstantBool::get(IsSetNE); @@ -4411,13 +4385,14 @@ Mask, LHSI->getName()+".mask"); Value *And = InsertNewInstBefore(AndI, I); return new SetCondInst(I.getOpcode(), And, - ConstantExpr::getUShr(CI, ShAmt)); + ConstantExpr::getLShr(CI, ShAmt)); } } } break; - case Instruction::Shr: // (setcc (shr X, ShAmt), CI) + case Instruction::LShr: // (setcc (shr X, ShAmt), CI) + case Instruction::AShr: if (ConstantInt *ShAmt = dyn_cast(LHSI->getOperand(1))) { if (I.isEquality()) { // Check that the shift amount is in range. If not, don't perform @@ -4429,8 +4404,13 @@ // If we are comparing against bits always shifted out, the // comparison cannot succeed. - Constant *Comp = - ConstantExpr::getShr(ConstantExpr::getShl(CI, ShAmt), ShAmt); + Constant *Comp; + if (CI->getType()->isUnsigned()) + Comp = ConstantExpr::getLShr(ConstantExpr::getShl(CI, ShAmt), + ShAmt); + else + Comp = ConstantExpr::getAShr(ConstantExpr::getShl(CI, ShAmt), + ShAmt); if (Comp != CI) {// Comparing against a bit that we know is zero. bool IsSetNE = I.getOpcode() == Instruction::SetNE; @@ -5019,10 +4999,7 @@ if (I.isArithmeticShift()) { if (MaskedValueIsZero(Op0, 1ULL << (I.getType()->getPrimitiveSizeInBits()-1))) { - Value *V = InsertCastBefore(Op0, I.getType()->getUnsignedVersion(), I); - V = InsertNewInstBefore(new ShiftInst(Instruction::Shr, V, Op1, - I.getName()), I); - return new CastInst(V, I.getType()); + return new ShiftInst(Instruction::LShr, Op0, Op1, I.getName()); } } @@ -5036,7 +5013,8 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantInt *Op1, ShiftInst &I) { bool isLeftShift = I.getOpcode() == Instruction::Shl; - bool isSignedShift = Op0->getType()->isSigned(); + bool isSignedShift = isLeftShift ? Op0->getType()->isSigned() : + I.getOpcode() == Instruction::AShr; bool isUnsignedShift = !isSignedShift; // See if we can simplify any instructions used by the instruction whose sole @@ -5229,7 +5207,9 @@ // signedness of the input shift may differ from the current shift if there // is a noop cast between the two. bool isShiftOfLeftShift = ShiftOp->getOpcode() == Instruction::Shl; - bool isShiftOfSignedShift = ShiftOp->getType()->isSigned(); + bool isShiftOfSignedShift = isShiftOfLeftShift ? + ShiftOp->getType()->isSigned() : + ShiftOp->getOpcode() == Instruction::AShr; bool isShiftOfUnsignedShift = !isShiftOfSignedShift; ConstantInt *ShiftAmt1C = cast(ShiftOp->getOperand(1)); @@ -5252,8 +5232,12 @@ Value *Op = ShiftOp->getOperand(0); if (isShiftOfSignedShift != isSignedShift) Op = InsertNewInstBefore(new CastInst(Op, I.getType(), "tmp"), I); - return new ShiftInst(I.getOpcode(), Op, + ShiftInst* ShiftResult = new ShiftInst(I.getOpcode(), Op, ConstantInt::get(Type::UByteTy, Amt)); + if (I.getType() == ShiftResult->getType()) + return ShiftResult; + InsertNewInstBefore(ShiftResult, I); + return new CastInst(ShiftResult, I.getType()); } // Check for (A << c1) >> c2 or (A >> c1) << c2. If we are dealing with @@ -5265,10 +5249,10 @@ if (isLeftShift) C = ConstantExpr::getShl(C, ShiftAmt1C); else - C = ConstantExpr::getUShr(C, ShiftAmt1C); + C = ConstantExpr::getLShr(C, ShiftAmt1C); Value *Op = ShiftOp->getOperand(0); - if (isShiftOfSignedShift != isSignedShift) + if (Op->getType() != C->getType()) Op = InsertCastBefore(Op, I.getType(), I); Instruction *Mask = @@ -5283,14 +5267,8 @@ ConstantInt::get(Type::UByteTy, ShiftAmt2-ShiftAmt1)); } else if (isShiftOfUnsignedShift || isShiftOfLeftShift) { if (isShiftOfUnsignedShift && !isShiftOfLeftShift && isSignedShift) { - // Make sure to emit an unsigned shift right, not a signed one. - Mask = InsertNewInstBefore(new CastInst(Mask, - Mask->getType()->getUnsignedVersion(), - Op->getName()), I); - Mask = new ShiftInst(Instruction::Shr, Mask, - ConstantInt::get(Type::UByteTy, ShiftAmt1-ShiftAmt2)); - InsertNewInstBefore(Mask, I); - return new CastInst(Mask, I.getType()); + return new ShiftInst(Instruction::LShr, Mask, + ConstantInt::get(Type::UByteTy, ShiftAmt1-ShiftAmt2)); } else { return new ShiftInst(ShiftOp->getOpcode(), Mask, ConstantInt::get(Type::UByteTy, ShiftAmt1-ShiftAmt2)); @@ -5792,7 +5770,7 @@ case Instruction::Shl: // Allow changing the sign of the source operand. Do not allow changing // the size of the shift, UNLESS the shift amount is a constant. We - // mush not change variable sized shifts to a smaller size, because it + // must not change variable sized shifts to a smaller size, because it // is undefined to shift more bits out than exist in the value. if (DestBitSize == SrcBitSize || (DestBitSize < SrcBitSize && isa(Op1))) { @@ -5800,21 +5778,16 @@ return new ShiftInst(Instruction::Shl, Op0c, Op1); } break; - case Instruction::Shr: + case Instruction::AShr: // If this is a signed shr, and if all bits shifted in are about to be // truncated off, turn it into an unsigned shr to allow greater // simplifications. - if (DestBitSize < SrcBitSize && Src->getType()->isSigned() && + if (DestBitSize < SrcBitSize && isa(Op1)) { unsigned ShiftAmt = cast(Op1)->getZExtValue(); if (SrcBitSize > ShiftAmt && SrcBitSize-ShiftAmt >= DestBitSize) { - // Convert to unsigned. - Value *N1 = InsertOperandCastBefore(Op0, - Op0->getType()->getUnsignedVersion(), &CI); - // Insert the new shift, which is now unsigned. - N1 = InsertNewInstBefore(new ShiftInst(Instruction::Shr, N1, - Op1, Src->getName()), CI); - return new CastInst(N1, CI.getType()); + // Insert the new logical shift right. + return new ShiftInst(Instruction::LShr, Op0, Op1); } } break; @@ -5853,13 +5826,9 @@ unsigned ShiftAmt = Log2_64(KnownZero^TypeMask); Value *In = Op0; if (ShiftAmt) { - // Perform an unsigned shr by shiftamt. Convert input to - // unsigned if it is signed. - if (In->getType()->isSigned()) - In = InsertCastBefore( - In, In->getType()->getUnsignedVersion(), CI); + // Perform a logical shr by shiftamt. // Insert the shift to put the result in the low bit. - In = InsertNewInstBefore(new ShiftInst(Instruction::Shr, In, + In = InsertNewInstBefore(new ShiftInst(Instruction::LShr, In, ConstantInt::get(Type::UByteTy, ShiftAmt), In->getName()+".lobit"), CI); } @@ -5934,7 +5903,8 @@ return 3; // Can fold through either operand. case Instruction::Sub: // Can only fold on the amount subtracted. case Instruction::Shl: // Can only fold on the shift amount. - case Instruction::Shr: + case Instruction::LShr: + case Instruction::AShr: return 1; default: return 0; // Cannot fold @@ -5952,7 +5922,8 @@ case Instruction::Xor: return Constant::getNullValue(I->getType()); case Instruction::Shl: - case Instruction::Shr: + case Instruction::LShr: + case Instruction::AShr: return Constant::getNullValue(Type::UByteTy); case Instruction::And: return ConstantInt::getAllOnesValue(I->getType()); @@ -6125,7 +6096,7 @@ // this by inserting a new SRA. unsigned Bits = X->getType()->getPrimitiveSizeInBits(); Constant *ShAmt = ConstantInt::get(Type::UByteTy, Bits-1); - Instruction *SRA = new ShiftInst(Instruction::Shr, X, + Instruction *SRA = new ShiftInst(Instruction::AShr, X, ShAmt, "ones"); InsertNewInstBefore(SRA, SI); Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.48 llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.49 --- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.48 Tue Nov 7 16:42:47 2006 +++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Wed Nov 8 00:47:33 2006 @@ -617,10 +617,11 @@ } else { if (Offset) { assert(NV->getType()->isInteger() && "Unknown promotion!"); - if (Offset < TD.getTypeSize(NV->getType())*8) - NV = new ShiftInst(Instruction::Shr, NV, - ConstantInt::get(Type::UByteTy, Offset), + if (Offset < TD.getTypeSize(NV->getType())*8) { + NV = new ShiftInst(Instruction::LShr, NV, + ConstantInt::get(Type::UByteTy, Offset), LI->getName(), LI); + } } else { assert((NV->getType()->isInteger() || isa(NV->getType())) && "Unknown promotion!"); From reid at x10sys.com Wed Nov 8 00:48:13 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 8 Nov 2006 00:48:13 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200611080648.kA86mDFU025270@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.315 -> 1.316 --- Log message: For PR950: http://llvm.org/PR950 : This patch converts the old SHR instruction into two instructions, AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not dependent on the sign of their operands. --- Diffs of the changes: (+2 -4) SelectionDAGISel.cpp | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.315 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.316 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.315 Thu Nov 2 14:25:49 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Nov 8 00:47:33 2006 @@ -538,10 +538,8 @@ void visitOr (User &I) { visitIntBinary(I, ISD::OR, ISD::VOR); } void visitXor(User &I) { visitIntBinary(I, ISD::XOR, ISD::VXOR); } void visitShl(User &I) { visitShift(I, ISD::SHL); } - void visitShr(User &I) { - visitShift(I, I.getType()->isUnsigned() ? ISD::SRL : ISD::SRA); - } - + void visitLShr(User &I) { visitShift(I, ISD::SRL); } + void visitAShr(User &I) { visitShift(I, ISD::SRA); } void visitSetCC(User &I, ISD::CondCode SignedOpc, ISD::CondCode UnsignedOpc, ISD::CondCode FPOpc); void visitSetEQ(User &I) { visitSetCC(I, ISD::SETEQ, ISD::SETEQ, From reid at x10sys.com Wed Nov 8 00:48:17 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 8 Nov 2006 00:48:17 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/ExprTypeConvert.cpp Message-ID: <200611080648.kA86mHtu025319@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms: ExprTypeConvert.cpp updated: 1.111 -> 1.112 --- Log message: For PR950: http://llvm.org/PR950 : This patch converts the old SHR instruction into two instructions, AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not dependent on the sign of their operands. --- Diffs of the changes: (+11 -6) ExprTypeConvert.cpp | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-) Index: llvm/lib/Transforms/ExprTypeConvert.cpp diff -u llvm/lib/Transforms/ExprTypeConvert.cpp:1.111 llvm/lib/Transforms/ExprTypeConvert.cpp:1.112 --- llvm/lib/Transforms/ExprTypeConvert.cpp:1.111 Thu Nov 2 14:25:50 2006 +++ llvm/lib/Transforms/ExprTypeConvert.cpp Wed Nov 8 00:47:33 2006 @@ -76,10 +76,12 @@ !ExpressionConvertibleToType(I->getOperand(1), Ty, CTMap, TD)) return false; break; - case Instruction::Shr: + case Instruction::LShr: + case Instruction::AShr: if (!Ty->isInteger()) return false; - if (Ty->isSigned() != V->getType()->isSigned()) return false; - // FALL THROUGH + if (!ExpressionConvertibleToType(I->getOperand(0), Ty, CTMap, TD)) + return false; + break; case Instruction::Shl: if (!Ty->isInteger()) return false; if (!ExpressionConvertibleToType(I->getOperand(0), Ty, CTMap, TD)) @@ -243,7 +245,8 @@ break; case Instruction::Shl: - case Instruction::Shr: + case Instruction::LShr: + case Instruction::AShr: Res = new ShiftInst(cast(I)->getOpcode(), Dummy, I->getOperand(1), Name); VMC.ExprMap[I] = Res; @@ -476,7 +479,8 @@ Value *OtherOp = I->getOperand((V == I->getOperand(0)) ? 1 : 0); return ExpressionConvertibleToType(OtherOp, Ty, CTMap, TD); } - case Instruction::Shr: + case Instruction::LShr: + case Instruction::AShr: if (Ty->isSigned() != V->getType()->isSigned()) return false; // FALL THROUGH case Instruction::Shl: @@ -746,7 +750,8 @@ break; } case Instruction::Shl: - case Instruction::Shr: + case Instruction::LShr: + case Instruction::AShr: assert(I->getOperand(0) == OldVal); Res = new ShiftInst(cast(I)->getOpcode(), NewVal, I->getOperand(1), Name); From reid at x10sys.com Wed Nov 8 00:48:13 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 8 Nov 2006 00:48:13 -0600 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Interpreter.h Message-ID: <200611080648.kA86mDXL025276@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/Interpreter: Execution.cpp updated: 1.145 -> 1.146 Interpreter.h updated: 1.75 -> 1.76 --- Log message: For PR950: http://llvm.org/PR950 : This patch converts the old SHR instruction into two instructions, AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not dependent on the sign of their operands. --- Diffs of the changes: (+52 -20) Execution.cpp | 69 ++++++++++++++++++++++++++++++++++++++++++---------------- Interpreter.h | 3 +- 2 files changed, 52 insertions(+), 20 deletions(-) Index: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp diff -u llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.145 llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.146 --- llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.145 Thu Nov 2 02:12:02 2006 +++ llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Wed Nov 8 00:47:33 2006 @@ -72,8 +72,10 @@ const Type *Ty); static GenericValue executeShlInst(GenericValue Src1, GenericValue Src2, const Type *Ty); -static GenericValue executeShrInst(GenericValue Src1, GenericValue Src2, - const Type *Ty); +static GenericValue executeLShrInst(GenericValue Src1, GenericValue Src2, + const Type *Ty); +static GenericValue executeAShrInst(GenericValue Src1, GenericValue Src2, + const Type *Ty); static GenericValue executeSelectInst(GenericValue Src1, GenericValue Src2, GenericValue Src3); @@ -161,10 +163,14 @@ return executeShlInst(getOperandValue(CE->getOperand(0), SF), getOperandValue(CE->getOperand(1), SF), CE->getOperand(0)->getType()); - case Instruction::Shr: - return executeShrInst(getOperandValue(CE->getOperand(0), SF), - getOperandValue(CE->getOperand(1), SF), - CE->getOperand(0)->getType()); + case Instruction::LShr: + return executeLShrInst(getOperandValue(CE->getOperand(0), SF), + getOperandValue(CE->getOperand(1), SF), + CE->getOperand(0)->getType()); + case Instruction::AShr: + return executeAShrInst(getOperandValue(CE->getOperand(0), SF), + getOperandValue(CE->getOperand(1), SF), + CE->getOperand(0)->getType()); case Instruction::Select: return executeSelectInst(getOperandValue(CE->getOperand(0), SF), getOperandValue(CE->getOperand(1), SF), @@ -943,6 +949,10 @@ #define IMPLEMENT_SHIFT(OP, TY) \ case Type::TY##TyID: Dest.TY##Val = Src1.TY##Val OP Src2.UByteVal; break +#define IMPLEMENT_SIGNLESS_SHIFT(OP, TY1, TY2) \ + case Type::TY2##TyID: \ + IMPLEMENT_SHIFT(OP, TY1) + static GenericValue executeShlInst(GenericValue Src1, GenericValue Src2, const Type *Ty) { GenericValue Dest; @@ -961,20 +971,31 @@ return Dest; } -static GenericValue executeShrInst(GenericValue Src1, GenericValue Src2, - const Type *Ty) { +static GenericValue executeLShrInst(GenericValue Src1, GenericValue Src2, + const Type *Ty) { + GenericValue Dest; + switch (Ty->getTypeID()) { + IMPLEMENT_SIGNLESS_SHIFT(>>, UByte, SByte); + IMPLEMENT_SIGNLESS_SHIFT(>>, UShort, Short); + IMPLEMENT_SIGNLESS_SHIFT(>>, UInt, Int); + IMPLEMENT_SIGNLESS_SHIFT(>>, ULong, Long); + default: + std::cout << "Unhandled type for LShr instruction: " << *Ty << "\n"; + abort(); + } + return Dest; +} + +static GenericValue executeAShrInst(GenericValue Src1, GenericValue Src2, + const Type *Ty) { GenericValue Dest; switch (Ty->getTypeID()) { - IMPLEMENT_SHIFT(>>, UByte); - IMPLEMENT_SHIFT(>>, SByte); - IMPLEMENT_SHIFT(>>, UShort); - IMPLEMENT_SHIFT(>>, Short); - IMPLEMENT_SHIFT(>>, UInt); - IMPLEMENT_SHIFT(>>, Int); - IMPLEMENT_SHIFT(>>, ULong); - IMPLEMENT_SHIFT(>>, Long); + IMPLEMENT_SIGNLESS_SHIFT(>>, SByte, UByte); + IMPLEMENT_SIGNLESS_SHIFT(>>, Short, UShort); + IMPLEMENT_SIGNLESS_SHIFT(>>, Int, UInt); + IMPLEMENT_SIGNLESS_SHIFT(>>, Long, ULong); default: - std::cout << "Unhandled type for Shr instruction: " << *Ty << "\n"; + std::cout << "Unhandled type for AShr instruction: " << *Ty << "\n"; abort(); } return Dest; @@ -990,13 +1011,23 @@ SetValue(&I, Dest, SF); } -void Interpreter::visitShr(ShiftInst &I) { +void Interpreter::visitLShr(ShiftInst &I) { + ExecutionContext &SF = ECStack.back(); + const Type *Ty = I.getOperand(0)->getType(); + GenericValue Src1 = getOperandValue(I.getOperand(0), SF); + GenericValue Src2 = getOperandValue(I.getOperand(1), SF); + GenericValue Dest; + Dest = executeLShrInst (Src1, Src2, Ty); + SetValue(&I, Dest, SF); +} + +void Interpreter::visitAShr(ShiftInst &I) { ExecutionContext &SF = ECStack.back(); const Type *Ty = I.getOperand(0)->getType(); GenericValue Src1 = getOperandValue(I.getOperand(0), SF); GenericValue Src2 = getOperandValue(I.getOperand(1), SF); GenericValue Dest; - Dest = executeShrInst (Src1, Src2, Ty); + Dest = executeAShrInst (Src1, Src2, Ty); SetValue(&I, Dest, SF); } Index: llvm/lib/ExecutionEngine/Interpreter/Interpreter.h diff -u llvm/lib/ExecutionEngine/Interpreter/Interpreter.h:1.75 llvm/lib/ExecutionEngine/Interpreter/Interpreter.h:1.76 --- llvm/lib/ExecutionEngine/Interpreter/Interpreter.h:1.75 Fri Jun 16 13:08:38 2006 +++ llvm/lib/ExecutionEngine/Interpreter/Interpreter.h Wed Nov 8 00:47:33 2006 @@ -154,7 +154,8 @@ void visitUnreachableInst(UnreachableInst &I); void visitShl(ShiftInst &I); - void visitShr(ShiftInst &I); + void visitLShr(ShiftInst &I); + void visitAShr(ShiftInst &I); void visitVAArgInst(VAArgInst &I); void visitInstruction(Instruction &I) { std::cerr << I; From reid at x10sys.com Wed Nov 8 00:48:13 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 8 Nov 2006 00:48:13 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/Local.cpp SimplifyCFG.cpp Message-ID: <200611080648.kA86mDue025272@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: Local.cpp updated: 1.59 -> 1.60 SimplifyCFG.cpp updated: 1.103 -> 1.104 --- Log message: For PR950: http://llvm.org/PR950 : This patch converts the old SHR instruction into two instructions, AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not dependent on the sign of their operands. --- Diffs of the changes: (+4 -2) Local.cpp | 3 ++- SimplifyCFG.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) Index: llvm/lib/Transforms/Utils/Local.cpp diff -u llvm/lib/Transforms/Utils/Local.cpp:1.59 llvm/lib/Transforms/Utils/Local.cpp:1.60 --- llvm/lib/Transforms/Utils/Local.cpp:1.59 Fri Oct 20 02:07:24 2006 +++ llvm/lib/Transforms/Utils/Local.cpp Wed Nov 8 00:47:33 2006 @@ -120,7 +120,8 @@ } return 0; case Instruction::Shl: - case Instruction::Shr: + case Instruction::LShr: + case Instruction::AShr: return ConstantExpr::get(Opc, Ops[0], Ops[1]); case Instruction::Cast: return ConstantExpr::getCast(Ops[0], DestTy); Index: llvm/lib/Transforms/Utils/SimplifyCFG.cpp diff -u llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.103 llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.104 --- llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.103 Thu Nov 2 14:25:50 2006 +++ llvm/lib/Transforms/Utils/SimplifyCFG.cpp Wed Nov 8 00:47:33 2006 @@ -368,7 +368,8 @@ case Instruction::Or: case Instruction::Xor: case Instruction::Shl: - case Instruction::Shr: + case Instruction::LShr: + case Instruction::AShr: case Instruction::SetEQ: case Instruction::SetNE: case Instruction::SetLT: From reid at x10sys.com Wed Nov 8 00:48:17 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 8 Nov 2006 00:48:17 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp Constants.cpp Instruction.cpp Instructions.cpp Message-ID: <200611080648.kA86mHIS025356@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: ConstantFolding.cpp updated: 1.97 -> 1.98 Constants.cpp updated: 1.169 -> 1.170 Instruction.cpp updated: 1.56 -> 1.57 Instructions.cpp updated: 1.45 -> 1.46 --- Log message: For PR950: http://llvm.org/PR950 : This patch converts the old SHR instruction into two instructions, AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not dependent on the sign of their operands. --- Diffs of the changes: (+52 -61) ConstantFolding.cpp | 62 +++++++++++++++++++++++++++------------------------- Constants.cpp | 37 ++++++++++++++----------------- Instruction.cpp | 3 +- Instructions.cpp | 11 --------- 4 files changed, 52 insertions(+), 61 deletions(-) Index: llvm/lib/VMCore/ConstantFolding.cpp diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.97 llvm/lib/VMCore/ConstantFolding.cpp:1.98 --- llvm/lib/VMCore/ConstantFolding.cpp:1.97 Thu Nov 2 02:18:15 2006 +++ llvm/lib/VMCore/ConstantFolding.cpp Wed Nov 8 00:47:33 2006 @@ -50,7 +50,8 @@ virtual Constant *op_or (const Constant *V1, const Constant *V2) const = 0; virtual Constant *op_xor(const Constant *V1, const Constant *V2) const = 0; virtual Constant *shl(const Constant *V1, const Constant *V2) const = 0; - virtual Constant *shr(const Constant *V1, const Constant *V2) const = 0; + virtual Constant *lshr(const Constant *V1, const Constant *V2) const = 0; + virtual Constant *ashr(const Constant *V1, const Constant *V2) const = 0; virtual Constant *lessthan(const Constant *V1, const Constant *V2) const =0; virtual Constant *equalto(const Constant *V1, const Constant *V2) const = 0; @@ -140,8 +141,11 @@ virtual Constant *shl(const Constant *V1, const Constant *V2) const { return SubClassName::Shl((const ArgType *)V1, (const ArgType *)V2); } - virtual Constant *shr(const Constant *V1, const Constant *V2) const { - return SubClassName::Shr((const ArgType *)V1, (const ArgType *)V2); + virtual Constant *lshr(const Constant *V1, const Constant *V2) const { + return SubClassName::LShr((const ArgType *)V1, (const ArgType *)V2); + } + virtual Constant *ashr(const Constant *V1, const Constant *V2) const { + return SubClassName::AShr((const ArgType *)V1, (const ArgType *)V2); } virtual Constant *lessthan(const Constant *V1, const Constant *V2) const { @@ -207,7 +211,8 @@ static Constant *Or (const ArgType *V1, const ArgType *V2) { return 0; } static Constant *Xor (const ArgType *V1, const ArgType *V2) { return 0; } static Constant *Shl (const ArgType *V1, const ArgType *V2) { return 0; } - static Constant *Shr (const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *LShr(const ArgType *V1, const ArgType *V2) { return 0; } + static Constant *AShr(const ArgType *V1, const ArgType *V2) { return 0; } static Constant *LessThan(const ArgType *V1, const ArgType *V2) { return 0; } @@ -420,12 +425,6 @@ static Constant *Xor(const ConstantPacked *V1, const ConstantPacked *V2) { return EvalVectorOp(V1, V2, ConstantExpr::getXor); } - static Constant *Shl(const ConstantPacked *V1, const ConstantPacked *V2) { - return EvalVectorOp(V1, V2, ConstantExpr::getShl); - } - static Constant *Shr(const ConstantPacked *V1, const ConstantPacked *V2) { - return EvalVectorOp(V1, V2, ConstantExpr::getShr); - } static Constant *LessThan(const ConstantPacked *V1, const ConstantPacked *V2){ return 0; } @@ -581,9 +580,13 @@ return ConstantInt::get(*Ty, R); } - static Constant *Shr(const ConstantInt *V1, const ConstantInt *V2) { - BuiltinType R = - (BuiltinType)V1->getZExtValue() >> (BuiltinType)V2->getZExtValue(); + static Constant *LShr(const ConstantInt *V1, const ConstantInt *V2) { + BuiltinType R = BuiltinType(V1->getZExtValue() >> V2->getZExtValue()); + return ConstantInt::get(*Ty, R); + } + + static Constant *AShr(const ConstantInt *V1, const ConstantInt *V2) { + BuiltinType R = BuiltinType(V1->getSExtValue() >> V2->getZExtValue()); return ConstantInt::get(*Ty, R); } }; @@ -1278,7 +1281,8 @@ case Instruction::Or: C = ConstRules::get(V1, V2).op_or (V1, V2); break; case Instruction::Xor: C = ConstRules::get(V1, V2).op_xor(V1, V2); break; case Instruction::Shl: C = ConstRules::get(V1, V2).shl(V1, V2); break; - case Instruction::Shr: C = ConstRules::get(V1, V2).shr(V1, V2); break; + case Instruction::LShr: C = ConstRules::get(V1, V2).lshr(V1, V2); break; + case Instruction::AShr: C = ConstRules::get(V1, V2).ashr(V1, V2); break; case Instruction::SetEQ: C = ConstRules::get(V1, V2).equalto(V1, V2); break; case Instruction::SetLT: C = ConstRules::get(V1, V2).lessthan(V1, V2);break; case Instruction::SetGT: C = ConstRules::get(V1, V2).lessthan(V2, V1);break; @@ -1366,21 +1370,20 @@ return const_cast(V2); // X / undef -> undef case Instruction::Or: // X | undef -> -1 return ConstantInt::getAllOnesValue(V1->getType()); - case Instruction::Shr: - if (!isa(V2)) { - if (V1->getType()->isSigned()) - return const_cast(V1); // undef >>s X -> undef - // undef >>u X -> 0 - } else if (isa(V1)) { - return const_cast(V1); // undef >> undef -> undef - } else { - if (V1->getType()->isSigned()) - return const_cast(V1); // X >>s undef -> X - } - return Constant::getNullValue(V1->getType());// X >>u undef -> 0 - + case Instruction::LShr: + if (isa(V2) && isa(V1)) + return const_cast(V1); // undef lshr undef -> undef + return Constant::getNullValue(V1->getType()); // X lshr undef -> 0 + // undef lshr X -> 0 + case Instruction::AShr: + if (!isa(V2)) + return const_cast(V1); // undef ashr X --> undef + else if (isa(V1)) + return const_cast(V1); // undef ashr undef -> undef + else + return const_cast(V1); // X ashr undef --> X case Instruction::Shl: - // undef << X -> 0 X << undef -> 0 + // undef << X -> 0 or X << undef -> 0 return Constant::getNullValue(V1->getType()); } } @@ -1466,7 +1469,8 @@ return ConstantFoldBinaryInstruction(Opcode, V2, V1); case Instruction::Shl: - case Instruction::Shr: + case Instruction::LShr: + case Instruction::AShr: case Instruction::Sub: case Instruction::SDiv: case Instruction::UDiv: Index: llvm/lib/VMCore/Constants.cpp diff -u llvm/lib/VMCore/Constants.cpp:1.169 llvm/lib/VMCore/Constants.cpp:1.170 --- llvm/lib/VMCore/Constants.cpp:1.169 Wed Nov 1 19:53:58 2006 +++ llvm/lib/VMCore/Constants.cpp Wed Nov 8 00:47:33 2006 @@ -498,20 +498,11 @@ Constant *ConstantExpr::getShl(Constant *C1, Constant *C2) { return get(Instruction::Shl, C1, C2); } -Constant *ConstantExpr::getShr(Constant *C1, Constant *C2) { - return get(Instruction::Shr, C1, C2); +Constant *ConstantExpr::getLShr(Constant *C1, Constant *C2) { + return get(Instruction::LShr, C1, C2); } - -Constant *ConstantExpr::getUShr(Constant *C1, Constant *C2) { - if (C1->getType()->isUnsigned()) return getShr(C1, C2); - return getCast(getShr(getCast(C1, - C1->getType()->getUnsignedVersion()), C2), C1->getType()); -} - -Constant *ConstantExpr::getSShr(Constant *C1, Constant *C2) { - if (C1->getType()->isSigned()) return getShr(C1, C2); - return getCast(getShr(getCast(C1, - C1->getType()->getSignedVersion()), C2), C1->getType()); +Constant *ConstantExpr::getAShr(Constant *C1, Constant *C2) { + return get(Instruction::AShr, C1, C2); } /// getWithOperandReplaced - Return a constant expression identical to this @@ -1330,7 +1321,9 @@ return new UnaryConstantExpr(Instruction::Cast, V.second[0], Ty); if ((V.first >= Instruction::BinaryOpsBegin && V.first < Instruction::BinaryOpsEnd) || - V.first == Instruction::Shl || V.first == Instruction::Shr) + V.first == Instruction::Shl || + V.first == Instruction::LShr || + V.first == Instruction::AShr) return new BinaryConstantExpr(V.first, V.second[0], V.second[1]); if (V.first == Instruction::Select) return new SelectConstantExpr(V.second[0], V.second[1], V.second[2]); @@ -1364,7 +1357,8 @@ OldC->getOperand(2)); break; case Instruction::Shl: - case Instruction::Shr: + case Instruction::LShr: + case Instruction::AShr: New = ConstantExpr::getShiftTy(NewTy, OldC->getOpcode(), OldC->getOperand(0), OldC->getOperand(1)); break; @@ -1453,7 +1447,8 @@ Constant *ConstantExpr::getTy(const Type *ReqTy, unsigned Opcode, Constant *C1, Constant *C2) { - if (Opcode == Instruction::Shl || Opcode == Instruction::Shr) + if (Opcode == Instruction::Shl || Opcode == Instruction::LShr || + Opcode == Instruction::AShr) return getShiftTy(ReqTy, Opcode, C1, C2); // Check the operands for consistency first assert(Opcode >= Instruction::BinaryOpsBegin && @@ -1521,9 +1516,10 @@ assert(C1->getType() == C2->getType() && "Op types should be identical!"); break; case Instruction::Shl: - case Instruction::Shr: + case Instruction::LShr: + case Instruction::AShr: assert(C2->getType() == Type::UByteTy && "Shift should be by ubyte!"); - assert((C1->getType()->isInteger() || isa(C1->getType())) && + assert(C1->getType()->isInteger() && "Tried to create a shift operation on a non-integer type!"); break; default: @@ -1558,8 +1554,9 @@ Constant *ConstantExpr::getShiftTy(const Type *ReqTy, unsigned Opcode, Constant *C1, Constant *C2) { // Check the operands for consistency first - assert((Opcode == Instruction::Shl || - Opcode == Instruction::Shr) && + assert((Opcode == Instruction::Shl || + Opcode == Instruction::LShr || + Opcode == Instruction::AShr) && "Invalid opcode in binary constant expression"); assert(C1->getType()->isIntegral() && C2->getType() == Type::UByteTy && "Invalid operand types for Shift constant expr!"); Index: llvm/lib/VMCore/Instruction.cpp diff -u llvm/lib/VMCore/Instruction.cpp:1.56 llvm/lib/VMCore/Instruction.cpp:1.57 --- llvm/lib/VMCore/Instruction.cpp:1.56 Wed Nov 1 19:53:58 2006 +++ llvm/lib/VMCore/Instruction.cpp Wed Nov 8 00:47:33 2006 @@ -128,7 +128,8 @@ case Select: return "select"; case Call: return "call"; case Shl: return "shl"; - case Shr: return "shr"; + case LShr: return "lshr"; + case AShr: return "ashr"; case VAArg: return "va_arg"; case ExtractElement: return "extractelement"; case InsertElement: return "insertelement"; Index: llvm/lib/VMCore/Instructions.cpp diff -u llvm/lib/VMCore/Instructions.cpp:1.45 llvm/lib/VMCore/Instructions.cpp:1.46 --- llvm/lib/VMCore/Instructions.cpp:1.45 Wed Nov 1 19:53:58 2006 +++ llvm/lib/VMCore/Instructions.cpp Wed Nov 8 00:47:33 2006 @@ -1222,17 +1222,6 @@ return false; } - -//===----------------------------------------------------------------------===// -// ShiftInst Class -//===----------------------------------------------------------------------===// - -/// isLogicalShift - Return true if this is a logical shift left or a logical -/// shift right. -bool ShiftInst::isLogicalShift() const { - return getOpcode() == Instruction::Shl || getType()->isUnsigned(); -} - //===----------------------------------------------------------------------===// // CastInst Class //===----------------------------------------------------------------------===// From reid at x10sys.com Wed Nov 8 00:48:17 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 8 Nov 2006 00:48:17 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/IPA/Andersens.cpp Message-ID: <200611080648.kA86mHwX025331@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis/IPA: Andersens.cpp updated: 1.34 -> 1.35 --- Log message: For PR950: http://llvm.org/PR950 : This patch converts the old SHR instruction into two instructions, AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not dependent on the sign of their operands. --- Diffs of the changes: (+2 -1) Andersens.cpp | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/Analysis/IPA/Andersens.cpp diff -u llvm/lib/Analysis/IPA/Andersens.cpp:1.34 llvm/lib/Analysis/IPA/Andersens.cpp:1.35 --- llvm/lib/Analysis/IPA/Andersens.cpp:1.34 Thu Nov 2 14:25:49 2006 +++ llvm/lib/Analysis/IPA/Andersens.cpp Wed Nov 8 00:47:33 2006 @@ -784,7 +784,8 @@ case Instruction::Unreachable: case Instruction::Free: case Instruction::Shl: - case Instruction::Shr: + case Instruction::LShr: + case Instruction::AShr: return; default: // Is this something we aren't handling yet? From reid at x10sys.com Wed Nov 8 00:48:17 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 8 Nov 2006 00:48:17 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/CBackend/Writer.cpp Message-ID: <200611080648.kA86mHfF025327@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/CBackend: Writer.cpp updated: 1.280 -> 1.281 --- Log message: For PR950: http://llvm.org/PR950 : This patch converts the old SHR instruction into two instructions, AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not dependent on the sign of their operands. --- Diffs of the changes: (+24 -17) Writer.cpp | 41 ++++++++++++++++++++++++----------------- 1 files changed, 24 insertions(+), 17 deletions(-) Index: llvm/lib/Target/CBackend/Writer.cpp diff -u llvm/lib/Target/CBackend/Writer.cpp:1.280 llvm/lib/Target/CBackend/Writer.cpp:1.281 --- llvm/lib/Target/CBackend/Writer.cpp:1.280 Sun Nov 5 13:26:37 2006 +++ llvm/lib/Target/CBackend/Writer.cpp Wed Nov 8 00:47:33 2006 @@ -606,7 +606,8 @@ case Instruction::SetGT: case Instruction::SetGE: case Instruction::Shl: - case Instruction::Shr: + case Instruction::LShr: + case Instruction::AShr: { Out << '('; bool NeedsClosingParens = printConstExprCast(CE); @@ -631,7 +632,8 @@ case Instruction::SetGT: Out << " > "; break; case Instruction::SetGE: Out << " >= "; break; case Instruction::Shl: Out << " << "; break; - case Instruction::Shr: Out << " >> "; break; + case Instruction::LShr: + case Instruction::AShr: Out << " >> "; break; default: assert(0 && "Illegal opcode here!"); } printConstantWithCast(CE->getOperand(1), CE->getOpcode()); @@ -826,23 +828,23 @@ // because their operands were casted to the expected type. This function takes // care of detecting that case and printing the cast for the ConstantExpr. bool CWriter::printConstExprCast(const ConstantExpr* CE) { - bool Result = false; + bool NeedsExplicitCast = false; const Type* Ty = CE->getOperand(0)->getType(); switch (CE->getOpcode()) { - case Instruction::UDiv: + case Instruction::LShr: case Instruction::URem: - Result = Ty->isSigned(); break; - case Instruction::SDiv: + case Instruction::UDiv: NeedsExplicitCast = Ty->isSigned(); break; + case Instruction::AShr: case Instruction::SRem: - Result = Ty->isUnsigned(); break; + case Instruction::SDiv: NeedsExplicitCast = Ty->isUnsigned(); break; default: break; } - if (Result) { + if (NeedsExplicitCast) { Out << "(("; printType(Out, Ty); Out << ")("; } - return Result; + return NeedsExplicitCast; } // Print a constant assuming that it is the operand for a given Opcode. The @@ -863,6 +865,7 @@ default: // for most instructions, it doesn't matter break; + case Instruction::LShr: case Instruction::UDiv: case Instruction::URem: // For UDiv/URem get correct type @@ -871,6 +874,7 @@ shouldCast = true; } break; + case Instruction::AShr: case Instruction::SDiv: case Instruction::SRem: // For SDiv/SRem get correct type @@ -927,23 +931,23 @@ // This function takes care of detecting that case and printing the cast // for the Instruction. bool CWriter::writeInstructionCast(const Instruction &I) { - bool Result = false; + bool NeedsExplicitCast = false; const Type* Ty = I.getOperand(0)->getType(); switch (I.getOpcode()) { - case Instruction::UDiv: + case Instruction::LShr: case Instruction::URem: - Result = Ty->isSigned(); break; - case Instruction::SDiv: + case Instruction::UDiv: NeedsExplicitCast = Ty->isSigned(); break; + case Instruction::AShr: case Instruction::SRem: - Result = Ty->isUnsigned(); break; + case Instruction::SDiv: NeedsExplicitCast = Ty->isUnsigned(); break; default: break; } - if (Result) { + if (NeedsExplicitCast) { Out << "(("; printType(Out, Ty); Out << ")("; } - return Result; + return NeedsExplicitCast; } // Write the operand with a cast to another type based on the Opcode being used. @@ -964,6 +968,7 @@ default: // for most instructions, it doesn't matter break; + case Instruction::LShr: case Instruction::UDiv: case Instruction::URem: // For UDiv to have unsigned operands @@ -972,6 +977,7 @@ shouldCast = true; } break; + case Instruction::AShr: case Instruction::SDiv: case Instruction::SRem: if (OpTy->isUnsigned()) { @@ -1832,7 +1838,8 @@ case Instruction::SetLT: Out << " < "; break; case Instruction::SetGT: Out << " > "; break; case Instruction::Shl : Out << " << "; break; - case Instruction::Shr : Out << " >> "; break; + case Instruction::LShr: + case Instruction::AShr: Out << " >> "; break; default: std::cerr << "Invalid operator type!" << I; abort(); } From reid at x10sys.com Wed Nov 8 00:48:17 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 8 Nov 2006 00:48:17 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/shift-sra.ll Message-ID: <200611080648.kA86mHJV025316@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/InstCombine: shift-sra.ll updated: 1.1 -> 1.2 --- Log message: For PR950: http://llvm.org/PR950 : This patch converts the old SHR instruction into two instructions, AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not dependent on the sign of their operands. --- Diffs of the changes: (+1 -1) shift-sra.ll | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/Regression/Transforms/InstCombine/shift-sra.ll diff -u llvm/test/Regression/Transforms/InstCombine/shift-sra.ll:1.1 llvm/test/Regression/Transforms/InstCombine/shift-sra.ll:1.2 --- llvm/test/Regression/Transforms/InstCombine/shift-sra.ll:1.1 Sun Sep 17 23:31:18 2006 +++ llvm/test/Regression/Transforms/InstCombine/shift-sra.ll Wed Nov 8 00:47:33 2006 @@ -1,5 +1,5 @@ ; RUN: llvm-as < %s | opt -instcombine -disable-output && -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep 'shr int' +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep 'lshr int' int %test0(int %X, ubyte %A) { %Y = shr int %X, ubyte %A ; can be logical shift. From reid at x10sys.com Wed Nov 8 00:48:17 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 8 Nov 2006 00:48:17 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/PatternMatch.h Message-ID: <200611080648.kA86mHgn025341@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Support: PatternMatch.h updated: 1.12 -> 1.13 --- Log message: For PR950: http://llvm.org/PR950 : This patch converts the old SHR instruction into two instructions, AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not dependent on the sign of their operands. --- Diffs of the changes: (+43 -3) PatternMatch.h | 46 +++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 43 insertions(+), 3 deletions(-) Index: llvm/include/llvm/Support/PatternMatch.h diff -u llvm/include/llvm/Support/PatternMatch.h:1.12 llvm/include/llvm/Support/PatternMatch.h:1.13 --- llvm/include/llvm/Support/PatternMatch.h:1.12 Mon Nov 6 12:47:14 2006 +++ llvm/include/llvm/Support/PatternMatch.h Wed Nov 8 00:47:32 2006 @@ -172,9 +172,49 @@ } template -inline BinaryOp_match m_Shr(const LHS &L, const RHS &R) { - return BinaryOp_match(L, R); +inline BinaryOp_match m_LShr(const LHS &L, const RHS &R) { + return BinaryOp_match(L, R); +} + +template +inline BinaryOp_match m_AShr(const LHS &L, const RHS &R) { + return BinaryOp_match(L, R); +} + +//===----------------------------------------------------------------------===// +// Matchers for either AShr or LShr .. for convenience +// +template +struct Shr_match { + LHS_t L; + RHS_t R; + + Shr_match(const LHS_t &LHS, const RHS_t &RHS) : L(LHS), R(RHS) {} + + template + bool match(OpTy *V) { + if (V->getValueType() == Value::InstructionVal + Instruction::LShr || + V->getValueType() == Value::InstructionVal + Instruction::AShr) { + ConcreteTy *I = cast(V); + return (I->getOpcode() == Instruction::AShr || + I->getOpcode() == Instruction::LShr) && + L.match(I->getOperand(0)) && + R.match(I->getOperand(1)); + } + if (ConstantExpr *CE = dyn_cast(V)) + return (CE->getOpcode() == Instruction::LShr || + CE->getOpcode() == Instruction::AShr) && + L.match(CE->getOperand(0)) && + R.match(CE->getOperand(1)); + return false; + } +}; + +template +inline Shr_match m_Shr(const LHS &L, const RHS &R) { + return Shr_match(L, R); } //===----------------------------------------------------------------------===// From reid at x10sys.com Wed Nov 8 00:48:17 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 8 Nov 2006 00:48:17 -0600 Subject: [llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l llvmAsmParser.cpp.cvs llvmAsmParser.h.cvs llvmAsmParser.y llvmAsmParser.y.cvs Message-ID: <200611080648.kA86mHs6025358@zion.cs.uiuc.edu> Changes in directory llvm/lib/AsmParser: Lexer.l updated: 1.81 -> 1.82 llvmAsmParser.cpp.cvs updated: 1.24 -> 1.25 llvmAsmParser.h.cvs updated: 1.19 -> 1.20 llvmAsmParser.y updated: 1.273 -> 1.274 llvmAsmParser.y.cvs updated: 1.25 -> 1.26 --- Log message: For PR950: http://llvm.org/PR950 : This patch converts the old SHR instruction into two instructions, AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not dependent on the sign of their operands. --- Diffs of the changes: (+3985 -2899) Lexer.l | 4 llvmAsmParser.cpp.cvs | 6391 ++++++++++++++++++++++++++++---------------------- llvmAsmParser.h.cvs | 384 ++- llvmAsmParser.y | 38 llvmAsmParser.y.cvs | 38 5 files changed, 3985 insertions(+), 2870 deletions(-) Index: llvm/lib/AsmParser/Lexer.l diff -u llvm/lib/AsmParser/Lexer.l:1.81 llvm/lib/AsmParser/Lexer.l:1.82 --- llvm/lib/AsmParser/Lexer.l:1.81 Wed Nov 1 19:53:58 2006 +++ llvm/lib/AsmParser/Lexer.l Wed Nov 8 00:47:33 2006 @@ -280,7 +280,9 @@ cast { RET_TOK(OtherOpVal, Cast, CAST); } select { RET_TOK(OtherOpVal, Select, SELECT); } shl { RET_TOK(OtherOpVal, Shl, SHL); } -shr { RET_TOK(OtherOpVal, Shr, SHR); } +shr { RET_TOK_OBSOLETE(OtherOpVal, LShr, LSHR); } +lshr { RET_TOK(OtherOpVal, LShr, LSHR); } +ashr { RET_TOK(OtherOpVal, AShr, ASHR); } vanext { return VANEXT_old; } vaarg { return VAARG_old; } va_arg { RET_TOK(OtherOpVal, VAArg , VAARG); } Index: llvm/lib/AsmParser/llvmAsmParser.cpp.cvs diff -u llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.24 llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.25 --- llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.24 Tue Nov 7 23:58:47 2006 +++ llvm/lib/AsmParser/llvmAsmParser.cpp.cvs Wed Nov 8 00:47:33 2006 @@ -1,128 +1,300 @@ +/* A Bison parser, made by GNU Bison 2.1. */ -/* A Bison parser, made from /Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y - by GNU Bison version 1.28 */ +/* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. -#define YYBISON 1 /* Identify Bison output. */ + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. */ + +/* As a special exception, 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 +/* 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 DATALAYOUT 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 UDIV 335 -#define SDIV 336 -#define FDIV 337 -#define UREM 338 -#define SREM 339 -#define FREM 340 -#define AND 341 -#define OR 342 -#define XOR 343 -#define SETLE 344 -#define SETGE 345 -#define SETLT 346 -#define SETGT 347 -#define SETEQ 348 -#define SETNE 349 -#define MALLOC 350 -#define ALLOCA 351 -#define FREE 352 -#define LOAD 353 -#define STORE 354 -#define GETELEMENTPTR 355 -#define PHI_TOK 356 -#define CAST 357 -#define SELECT 358 -#define SHL 359 -#define SHR 360 -#define VAARG 361 -#define EXTRACTELEMENT 362 -#define INSERTELEMENT 363 -#define SHUFFLEVECTOR 364 -#define VAARG_old 365 -#define VANEXT_old 366 -#line 14 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + ESINT64VAL = 258, + EUINT64VAL = 259, + SINTVAL = 260, + UINTVAL = 261, + FPVAL = 262, + VOID = 263, + BOOL = 264, + SBYTE = 265, + UBYTE = 266, + SHORT = 267, + USHORT = 268, + INT = 269, + UINT = 270, + LONG = 271, + ULONG = 272, + FLOAT = 273, + DOUBLE = 274, + TYPE = 275, + LABEL = 276, + VAR_ID = 277, + LABELSTR = 278, + STRINGCONSTANT = 279, + IMPLEMENTATION = 280, + ZEROINITIALIZER = 281, + TRUETOK = 282, + FALSETOK = 283, + BEGINTOK = 284, + ENDTOK = 285, + DECLARE = 286, + GLOBAL = 287, + CONSTANT = 288, + SECTION = 289, + VOLATILE = 290, + TO = 291, + DOTDOTDOT = 292, + NULL_TOK = 293, + UNDEF = 294, + CONST = 295, + INTERNAL = 296, + LINKONCE = 297, + WEAK = 298, + APPENDING = 299, + DLLIMPORT = 300, + DLLEXPORT = 301, + EXTERN_WEAK = 302, + OPAQUE = 303, + NOT = 304, + EXTERNAL = 305, + TARGET = 306, + TRIPLE = 307, + ENDIAN = 308, + POINTERSIZE = 309, + LITTLE = 310, + BIG = 311, + ALIGN = 312, + DEPLIBS = 313, + CALL = 314, + TAIL = 315, + ASM_TOK = 316, + MODULE = 317, + SIDEEFFECT = 318, + CC_TOK = 319, + CCC_TOK = 320, + CSRETCC_TOK = 321, + FASTCC_TOK = 322, + COLDCC_TOK = 323, + X86_STDCALLCC_TOK = 324, + X86_FASTCALLCC_TOK = 325, + DATALAYOUT = 326, + RET = 327, + BR = 328, + SWITCH = 329, + INVOKE = 330, + UNWIND = 331, + UNREACHABLE = 332, + ADD = 333, + SUB = 334, + MUL = 335, + UDIV = 336, + SDIV = 337, + FDIV = 338, + UREM = 339, + SREM = 340, + FREM = 341, + AND = 342, + OR = 343, + XOR = 344, + SETLE = 345, + SETGE = 346, + SETLT = 347, + SETGT = 348, + SETEQ = 349, + SETNE = 350, + MALLOC = 351, + ALLOCA = 352, + FREE = 353, + LOAD = 354, + STORE = 355, + GETELEMENTPTR = 356, + PHI_TOK = 357, + CAST = 358, + SELECT = 359, + SHL = 360, + LSHR = 361, + ASHR = 362, + VAARG = 363, + EXTRACTELEMENT = 364, + INSERTELEMENT = 365, + SHUFFLEVECTOR = 366, + VAARG_old = 367, + VANEXT_old = 368 + }; +#endif +/* Tokens. */ +#define ESINT64VAL 258 +#define EUINT64VAL 259 +#define SINTVAL 260 +#define UINTVAL 261 +#define FPVAL 262 +#define VOID 263 +#define BOOL 264 +#define SBYTE 265 +#define UBYTE 266 +#define SHORT 267 +#define USHORT 268 +#define INT 269 +#define UINT 270 +#define LONG 271 +#define ULONG 272 +#define FLOAT 273 +#define DOUBLE 274 +#define TYPE 275 +#define LABEL 276 +#define VAR_ID 277 +#define LABELSTR 278 +#define STRINGCONSTANT 279 +#define IMPLEMENTATION 280 +#define ZEROINITIALIZER 281 +#define TRUETOK 282 +#define FALSETOK 283 +#define BEGINTOK 284 +#define ENDTOK 285 +#define DECLARE 286 +#define GLOBAL 287 +#define CONSTANT 288 +#define SECTION 289 +#define VOLATILE 290 +#define TO 291 +#define DOTDOTDOT 292 +#define NULL_TOK 293 +#define UNDEF 294 +#define CONST 295 +#define INTERNAL 296 +#define LINKONCE 297 +#define WEAK 298 +#define APPENDING 299 +#define DLLIMPORT 300 +#define DLLEXPORT 301 +#define EXTERN_WEAK 302 +#define OPAQUE 303 +#define NOT 304 +#define EXTERNAL 305 +#define TARGET 306 +#define TRIPLE 307 +#define ENDIAN 308 +#define POINTERSIZE 309 +#define LITTLE 310 +#define BIG 311 +#define ALIGN 312 +#define DEPLIBS 313 +#define CALL 314 +#define TAIL 315 +#define ASM_TOK 316 +#define MODULE 317 +#define SIDEEFFECT 318 +#define CC_TOK 319 +#define CCC_TOK 320 +#define CSRETCC_TOK 321 +#define FASTCC_TOK 322 +#define COLDCC_TOK 323 +#define X86_STDCALLCC_TOK 324 +#define X86_FASTCALLCC_TOK 325 +#define DATALAYOUT 326 +#define RET 327 +#define BR 328 +#define SWITCH 329 +#define INVOKE 330 +#define UNWIND 331 +#define UNREACHABLE 332 +#define ADD 333 +#define SUB 334 +#define MUL 335 +#define UDIV 336 +#define SDIV 337 +#define FDIV 338 +#define UREM 339 +#define SREM 340 +#define FREM 341 +#define AND 342 +#define OR 343 +#define XOR 344 +#define SETLE 345 +#define SETGE 346 +#define SETLT 347 +#define SETGT 348 +#define SETEQ 349 +#define SETNE 350 +#define MALLOC 351 +#define ALLOCA 352 +#define FREE 353 +#define LOAD 354 +#define STORE 355 +#define GETELEMENTPTR 356 +#define PHI_TOK 357 +#define CAST 358 +#define SELECT 359 +#define SHL 360 +#define LSHR 361 +#define ASHR 362 +#define VAARG 363 +#define EXTRACTELEMENT 364 +#define INSERTELEMENT 365 +#define SHUFFLEVECTOR 366 +#define VAARG_old 367 +#define VANEXT_old 368 + + + + +/* Copy the first part of user declarations. */ +#line 14 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" #include "ParserInternals.h" #include "llvm/CallingConv.h" @@ -932,7 +1104,7 @@ /// an obsolete opcode. For example, "div" was replaced by [usf]div but we need /// to maintain backwards compatibility for asm files that still have the "div" /// instruction. This function handles converting div -> [usf]div appropriately. -/// @brief Convert obsolete opcodes to new values +/// @brief Convert obsolete BinaryOps opcodes to new values static void sanitizeOpCode(OpcodeInfo &OI, const PATypeHolder& PATy) { @@ -967,7 +1139,31 @@ // Its not obsolete any more, we fixed it. OI.obsolete = false; } - + +/// This function is similar to the previous overload of sanitizeOpCode but +/// operates on Instruction::OtherOps instead of Instruction::BinaryOps. +/// @brief Convert obsolete OtherOps opcodes to new values +static void +sanitizeOpCode(OpcodeInfo &OI, const PATypeHolder& PATy) +{ + // If its not obsolete, don't do anything + if (!OI.obsolete) + return; + + const Type* Ty = PATy; // type conversion + switch (OI.opcode) { + default: + GenerateError("Invalid obsolete opcode (check Lexer.l)"); + break; + case Instruction::LShr: + if (Ty->isSigned()) + OI.opcode = Instruction::AShr; + break; + } + // Its not obsolete any more, we fixed it. + OI.obsolete = false; +} + // common code from the two 'RunVMAsmParser' functions static Module* RunParser(Module * M) { @@ -1124,8 +1320,28 @@ } -#line 1016 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -typedef union { + +/* 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 1040 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" +typedef union YYSTYPE { llvm::Module *ModuleVal; llvm::Function *FunctionVal; std::pair *ArgVal; @@ -1164,1011 +1380,1458 @@ OtherOpInfo OtherOpVal; llvm::Module::Endianness Endianness; } YYSTYPE; -#include +/* Line 196 of yacc.c. */ +#line 1385 "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 1397 "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 */ -#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; + }; -#define YYFINAL 521 -#define YYFLAG -32768 -#define YYNTBASE 127 - -#define YYTRANSLATE(x) ((unsigned)(x) <= 366 ? yytranslate[x] : 201) - -static const short yytranslate[] = { 0, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 116, - 117, 125, 2, 114, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 121, - 113, 122, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 118, 115, 120, 2, 2, 2, 2, 2, 126, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 119, - 2, 2, 123, 2, 124, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, - 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 108, 109, 110, 111, 112 -}; +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) -#if YYDEBUG != 0 -static const short yyprhs[] = { 0, - 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, - 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, - 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, - 60, 62, 64, 66, 68, 70, 72, 75, 76, 78, - 80, 82, 84, 86, 88, 90, 91, 92, 94, 96, - 98, 100, 102, 104, 107, 108, 111, 112, 116, 119, - 120, 122, 123, 127, 129, 132, 134, 136, 138, 140, - 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, - 162, 164, 166, 168, 170, 172, 174, 177, 182, 188, - 194, 198, 201, 204, 206, 210, 212, 216, 218, 219, - 224, 228, 232, 237, 242, 246, 249, 252, 255, 258, - 261, 264, 267, 270, 273, 276, 283, 289, 298, 305, - 312, 319, 326, 333, 342, 351, 355, 357, 359, 361, - 363, 366, 369, 374, 377, 379, 384, 387, 392, 393, - 401, 402, 410, 411, 419, 420, 428, 432, 437, 438, - 440, 442, 444, 448, 452, 456, 460, 464, 468, 470, - 471, 473, 475, 477, 478, 481, 485, 487, 489, 493, - 495, 496, 505, 507, 509, 513, 515, 517, 520, 521, - 523, 525, 526, 531, 532, 534, 536, 538, 540, 542, - 544, 546, 548, 550, 554, 556, 562, 564, 566, 568, - 570, 573, 576, 579, 583, 586, 587, 589, 592, 595, - 599, 609, 619, 628, 642, 644, 646, 653, 659, 662, - 669, 677, 679, 683, 685, 686, 689, 691, 697, 703, - 709, 712, 717, 722, 729, 734, 739, 744, 749, 756, - 763, 766, 774, 776, 779, 780, 782, 783, 787, 794, - 798, 805, 808, 813, 820 -}; +/* 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) -static const short yyrhs[] = { 5, - 0, 6, 0, 3, 0, 4, 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, 91, 0, 92, 0, 93, 0, 94, - 0, 95, 0, 105, 0, 106, 0, 16, 0, 14, - 0, 12, 0, 10, 0, 17, 0, 15, 0, 13, - 0, 11, 0, 133, 0, 134, 0, 18, 0, 19, - 0, 169, 113, 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, 114, 57, 4, 0, 34, 24, 0, 0, 142, - 0, 0, 114, 145, 144, 0, 142, 0, 57, 4, - 0, 148, 0, 8, 0, 150, 0, 8, 0, 150, - 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, 149, - 0, 184, 0, 115, 4, 0, 147, 116, 152, 117, - 0, 118, 4, 119, 150, 120, 0, 121, 4, 119, - 150, 122, 0, 123, 151, 124, 0, 123, 124, 0, - 150, 125, 0, 150, 0, 151, 114, 150, 0, 151, - 0, 151, 114, 37, 0, 37, 0, 0, 148, 118, - 155, 120, 0, 148, 118, 120, 0, 148, 126, 24, - 0, 148, 121, 155, 122, 0, 148, 123, 155, 124, - 0, 148, 123, 124, 0, 148, 38, 0, 148, 39, - 0, 148, 184, 0, 148, 154, 0, 148, 26, 0, - 133, 128, 0, 134, 4, 0, 9, 27, 0, 9, - 28, 0, 136, 7, 0, 103, 116, 153, 36, 148, - 117, 0, 101, 116, 153, 198, 117, 0, 104, 116, - 153, 114, 153, 114, 153, 117, 0, 129, 116, 153, - 114, 153, 117, 0, 130, 116, 153, 114, 153, 117, - 0, 131, 116, 153, 114, 153, 117, 0, 132, 116, - 153, 114, 153, 117, 0, 108, 116, 153, 114, 153, - 117, 0, 109, 116, 153, 114, 153, 114, 153, 117, - 0, 110, 116, 153, 114, 153, 114, 153, 117, 0, - 155, 114, 153, 0, 153, 0, 32, 0, 33, 0, - 158, 0, 158, 178, 0, 158, 180, 0, 158, 62, - 61, 164, 0, 158, 25, 0, 159, 0, 159, 137, - 20, 146, 0, 159, 180, 0, 159, 62, 61, 164, - 0, 0, 159, 137, 138, 156, 153, 160, 144, 0, - 0, 159, 137, 50, 156, 148, 161, 144, 0, 0, - 159, 137, 45, 156, 148, 162, 144, 0, 0, 159, - 137, 47, 156, 148, 163, 144, 0, 159, 51, 166, - 0, 159, 58, 113, 167, 0, 0, 24, 0, 56, - 0, 55, 0, 53, 113, 165, 0, 54, 113, 4, - 0, 52, 113, 24, 0, 71, 113, 24, 0, 118, - 168, 120, 0, 168, 114, 24, 0, 24, 0, 0, - 22, 0, 24, 0, 169, 0, 0, 148, 170, 0, - 172, 114, 171, 0, 171, 0, 172, 0, 172, 114, - 37, 0, 37, 0, 0, 139, 146, 169, 116, 173, - 117, 143, 140, 0, 29, 0, 123, 0, 138, 174, - 175, 0, 30, 0, 124, 0, 187, 177, 0, 0, - 45, 0, 47, 0, 0, 31, 181, 179, 174, 0, - 0, 63, 0, 3, 0, 4, 0, 7, 0, 27, - 0, 28, 0, 38, 0, 39, 0, 26, 0, 121, - 155, 122, 0, 154, 0, 61, 182, 24, 114, 24, - 0, 127, 0, 169, 0, 184, 0, 183, 0, 148, - 185, 0, 187, 188, 0, 176, 188, 0, 189, 137, - 190, 0, 189, 192, 0, 0, 23, 0, 72, 186, - 0, 72, 8, 0, 73, 21, 185, 0, 73, 9, - 185, 114, 21, 185, 114, 21, 185, 0, 74, 135, - 185, 114, 21, 185, 118, 191, 120, 0, 74, 135, - 185, 114, 21, 185, 118, 120, 0, 75, 139, 146, - 185, 116, 195, 117, 36, 21, 185, 76, 21, 185, - 0, 76, 0, 77, 0, 191, 135, 183, 114, 21, - 185, 0, 135, 183, 114, 21, 185, 0, 137, 197, - 0, 148, 118, 185, 114, 185, 120, 0, 193, 114, - 118, 185, 114, 185, 120, 0, 186, 0, 194, 114, - 186, 0, 194, 0, 0, 60, 59, 0, 59, 0, - 129, 148, 185, 114, 185, 0, 130, 148, 185, 114, - 185, 0, 131, 148, 185, 114, 185, 0, 49, 186, - 0, 132, 186, 114, 186, 0, 103, 186, 36, 148, - 0, 104, 186, 114, 186, 114, 186, 0, 107, 186, - 114, 148, 0, 111, 186, 114, 148, 0, 112, 186, - 114, 148, 0, 108, 186, 114, 186, 0, 109, 186, - 114, 186, 114, 186, 0, 110, 186, 114, 186, 114, - 186, 0, 102, 193, 0, 196, 139, 146, 185, 116, - 195, 117, 0, 200, 0, 114, 194, 0, 0, 35, - 0, 0, 96, 148, 141, 0, 96, 148, 114, 15, - 185, 141, 0, 97, 148, 141, 0, 97, 148, 114, - 15, 185, 141, 0, 98, 186, 0, 199, 99, 148, - 185, 0, 199, 100, 186, 114, 148, 185, 0, 101, - 148, 185, 198, 0 -}; +#endif +#if defined (__STDC__) || defined (__cplusplus) + typedef signed char yysigned_char; +#else + typedef short int yysigned_char; #endif -#if YYDEBUG != 0 -static const short yyrline[] = { 0, - 1139, 1140, 1148, 1149, 1159, 1159, 1159, 1159, 1159, 1159, - 1159, 1159, 1159, 1160, 1160, 1160, 1161, 1161, 1161, 1161, - 1161, 1161, 1163, 1163, 1167, 1167, 1167, 1167, 1168, 1168, - 1168, 1168, 1169, 1169, 1170, 1170, 1173, 1177, 1182, 1182, - 1183, 1184, 1185, 1186, 1187, 1188, 1191, 1191, 1192, 1193, - 1194, 1195, 1196, 1197, 1207, 1207, 1214, 1214, 1223, 1231, - 1231, 1237, 1237, 1239, 1244, 1258, 1258, 1259, 1259, 1261, - 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1272, 1272, 1272, - 1272, 1272, 1272, 1273, 1277, 1281, 1289, 1297, 1310, 1315, - 1327, 1337, 1341, 1352, 1357, 1363, 1364, 1368, 1372, 1383, - 1409, 1423, 1453, 1479, 1500, 1513, 1523, 1528, 1589, 1596, - 1605, 1611, 1617, 1621, 1625, 1633, 1644, 1676, 1684, 1711, - 1722, 1728, 1736, 1742, 1748, 1757, 1761, 1769, 1769, 1779, - 1787, 1792, 1796, 1800, 1804, 1819, 1841, 1844, 1847, 1852, - 1855, 1859, 1863, 1867, 1871, 1876, 1880, 1883, 1886, 1890, - 1903, 1904, 1906, 1910, 1919, 1923, 1928, 1930, 1935, 1940, - 1949, 1949, 1950, 1950, 1952, 1959, 1965, 1972, 1976, 1982, - 1987, 1992, 2087, 2087, 2089, 2097, 2097, 2099, 2104, 2104, - 2105, 2108, 2108, 2118, 2122, 2127, 2131, 2135, 2139, 2143, - 2147, 2151, 2155, 2159, 2184, 2188, 2202, 2206, 2212, 2212, - 2218, 2223, 2227, 2236, 2247, 2252, 2264, 2277, 2281, 2285, - 2290, 2299, 2318, 2327, 2383, 2387, 2394, 2405, 2418, 2427, - 2436, 2446, 2450, 2457, 2457, 2459, 2463, 2468, 2490, 2505, - 2519, 2532, 2540, 2548, 2556, 2562, 2582, 2605, 2611, 2617, - 2623, 2638, 2697, 2704, 2707, 2712, 2716, 2723, 2728, 2734, - 2739, 2745, 2753, 2765, 2780 +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 4 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 1310 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 128 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 75 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 257 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 522 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 368 + +#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, + 117, 118, 126, 2, 115, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 122, 114, 123, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 119, 116, 121, 2, 2, 2, 2, 2, 127, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 120, 2, 2, 124, 2, 125, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 112, 113 }; -#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, 69, 71, 73, 75, 77, + 80, 81, 83, 85, 87, 89, 91, 93, 95, 96, + 97, 99, 101, 103, 105, 107, 109, 112, 113, 116, + 117, 121, 124, 125, 127, 128, 132, 134, 137, 139, + 141, 143, 145, 147, 149, 151, 153, 155, 157, 159, + 161, 163, 165, 167, 169, 171, 173, 175, 177, 179, + 182, 187, 193, 199, 203, 206, 209, 211, 215, 217, + 221, 223, 224, 229, 233, 237, 242, 247, 251, 254, + 257, 260, 263, 266, 269, 272, 275, 278, 281, 288, + 294, 303, 310, 317, 324, 331, 338, 347, 356, 360, + 362, 364, 366, 368, 371, 374, 379, 382, 384, 389, + 392, 397, 398, 406, 407, 415, 416, 424, 425, 433, + 437, 442, 443, 445, 447, 449, 453, 457, 461, 465, + 469, 473, 475, 476, 478, 480, 482, 483, 486, 490, + 492, 494, 498, 500, 501, 510, 512, 514, 518, 520, + 522, 525, 526, 528, 530, 531, 536, 537, 539, 541, + 543, 545, 547, 549, 551, 553, 555, 559, 561, 567, + 569, 571, 573, 575, 578, 581, 584, 588, 591, 592, + 594, 597, 600, 604, 614, 624, 633, 647, 649, 651, + 658, 664, 667, 674, 682, 684, 688, 690, 691, 694, + 696, 702, 708, 714, 717, 722, 727, 734, 739, 744, + 749, 754, 761, 768, 771, 779, 781, 784, 785, 787, + 788, 792, 799, 803, 810, 813, 818, 825 +}; -#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const short int yyrhs[] = +{ + 159, 0, -1, 5, -1, 6, -1, 3, -1, 4, + -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, 91, -1, 92, + -1, 93, -1, 94, -1, 95, -1, 105, -1, 106, + -1, 107, -1, 16, -1, 14, -1, 12, -1, 10, + -1, 17, -1, 15, -1, 13, -1, 11, -1, 135, + -1, 136, -1, 18, -1, 19, -1, 171, 114, -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, 115, 57, 4, + -1, 34, 24, -1, -1, 144, -1, -1, 115, 147, + 146, -1, 144, -1, 57, 4, -1, 150, -1, 8, + -1, 152, -1, 8, -1, 152, -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, 151, -1, 186, -1, 116, + 4, -1, 149, 117, 154, 118, -1, 119, 4, 120, + 152, 121, -1, 122, 4, 120, 152, 123, -1, 124, + 153, 125, -1, 124, 125, -1, 152, 126, -1, 152, + -1, 153, 115, 152, -1, 153, -1, 153, 115, 37, + -1, 37, -1, -1, 150, 119, 157, 121, -1, 150, + 119, 121, -1, 150, 127, 24, -1, 150, 122, 157, + 123, -1, 150, 124, 157, 125, -1, 150, 124, 125, + -1, 150, 38, -1, 150, 39, -1, 150, 186, -1, + 150, 156, -1, 150, 26, -1, 135, 130, -1, 136, + 4, -1, 9, 27, -1, 9, 28, -1, 138, 7, + -1, 103, 117, 155, 36, 150, 118, -1, 101, 117, + 155, 200, 118, -1, 104, 117, 155, 115, 155, 115, + 155, 118, -1, 131, 117, 155, 115, 155, 118, -1, + 132, 117, 155, 115, 155, 118, -1, 133, 117, 155, + 115, 155, 118, -1, 134, 117, 155, 115, 155, 118, + -1, 109, 117, 155, 115, 155, 118, -1, 110, 117, + 155, 115, 155, 115, 155, 118, -1, 111, 117, 155, + 115, 155, 115, 155, 118, -1, 157, 115, 155, -1, + 155, -1, 32, -1, 33, -1, 160, -1, 160, 180, + -1, 160, 182, -1, 160, 62, 61, 166, -1, 160, + 25, -1, 161, -1, 161, 139, 20, 148, -1, 161, + 182, -1, 161, 62, 61, 166, -1, -1, 161, 139, + 140, 158, 155, 162, 146, -1, -1, 161, 139, 50, + 158, 150, 163, 146, -1, -1, 161, 139, 45, 158, + 150, 164, 146, -1, -1, 161, 139, 47, 158, 150, + 165, 146, -1, 161, 51, 168, -1, 161, 58, 114, + 169, -1, -1, 24, -1, 56, -1, 55, -1, 53, + 114, 167, -1, 54, 114, 4, -1, 52, 114, 24, + -1, 71, 114, 24, -1, 119, 170, 121, -1, 170, + 115, 24, -1, 24, -1, -1, 22, -1, 24, -1, + 171, -1, -1, 150, 172, -1, 174, 115, 173, -1, + 173, -1, 174, -1, 174, 115, 37, -1, 37, -1, + -1, 141, 148, 171, 117, 175, 118, 145, 142, -1, + 29, -1, 124, -1, 140, 176, 177, -1, 30, -1, + 125, -1, 189, 179, -1, -1, 45, -1, 47, -1, + -1, 31, 183, 181, 176, -1, -1, 63, -1, 3, + -1, 4, -1, 7, -1, 27, -1, 28, -1, 38, + -1, 39, -1, 26, -1, 122, 157, 123, -1, 156, + -1, 61, 184, 24, 115, 24, -1, 129, -1, 171, + -1, 186, -1, 185, -1, 150, 187, -1, 189, 190, + -1, 178, 190, -1, 191, 139, 192, -1, 191, 194, + -1, -1, 23, -1, 72, 188, -1, 72, 8, -1, + 73, 21, 187, -1, 73, 9, 187, 115, 21, 187, + 115, 21, 187, -1, 74, 137, 187, 115, 21, 187, + 119, 193, 121, -1, 74, 137, 187, 115, 21, 187, + 119, 121, -1, 75, 141, 148, 187, 117, 197, 118, + 36, 21, 187, 76, 21, 187, -1, 76, -1, 77, + -1, 193, 137, 185, 115, 21, 187, -1, 137, 185, + 115, 21, 187, -1, 139, 199, -1, 150, 119, 187, + 115, 187, 121, -1, 195, 115, 119, 187, 115, 187, + 121, -1, 188, -1, 196, 115, 188, -1, 196, -1, + -1, 60, 59, -1, 59, -1, 131, 150, 187, 115, + 187, -1, 132, 150, 187, 115, 187, -1, 133, 150, + 187, 115, 187, -1, 49, 188, -1, 134, 188, 115, + 188, -1, 103, 188, 36, 150, -1, 104, 188, 115, + 188, 115, 188, -1, 108, 188, 115, 150, -1, 112, + 188, 115, 150, -1, 113, 188, 115, 150, -1, 109, + 188, 115, 188, -1, 110, 188, 115, 188, 115, 188, + -1, 111, 188, 115, 188, 115, 188, -1, 102, 195, + -1, 198, 141, 148, 187, 117, 197, 118, -1, 202, + -1, 115, 196, -1, -1, 35, -1, -1, 96, 150, + 143, -1, 96, 150, 115, 15, 187, 143, -1, 97, + 150, 143, -1, 97, 150, 115, 15, 187, 143, -1, + 98, 188, -1, 201, 99, 150, 187, -1, 201, 100, + 188, 115, 150, 187, -1, 101, 150, 187, 200, -1 +}; -static const char * const yytname[] = { "$","error","$undefined.","ESINT64VAL", -"EUINT64VAL","SINTVAL","UINTVAL","FPVAL","VOID","BOOL","SBYTE","UBYTE","SHORT", -"USHORT","INT","UINT","LONG","ULONG","FLOAT","DOUBLE","TYPE","LABEL","VAR_ID", -"LABELSTR","STRINGCONSTANT","IMPLEMENTATION","ZEROINITIALIZER","TRUETOK","FALSETOK", -"BEGINTOK","ENDTOK","DECLARE","GLOBAL","CONSTANT","SECTION","VOLATILE","TO", -"DOTDOTDOT","NULL_TOK","UNDEF","CONST","INTERNAL","LINKONCE","WEAK","APPENDING", -"DLLIMPORT","DLLEXPORT","EXTERN_WEAK","OPAQUE","NOT","EXTERNAL","TARGET","TRIPLE", -"ENDIAN","POINTERSIZE","LITTLE","BIG","ALIGN","DEPLIBS","CALL","TAIL","ASM_TOK", -"MODULE","SIDEEFFECT","CC_TOK","CCC_TOK","CSRETCC_TOK","FASTCC_TOK","COLDCC_TOK", -"X86_STDCALLCC_TOK","X86_FASTCALLCC_TOK","DATALAYOUT","RET","BR","SWITCH","INVOKE", -"UNWIND","UNREACHABLE","ADD","SUB","MUL","UDIV","SDIV","FDIV","UREM","SREM", -"FREM","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 +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const unsigned short int yyrline[] = +{ + 0, 1163, 1163, 1164, 1172, 1173, 1183, 1183, 1183, 1183, + 1183, 1183, 1183, 1183, 1183, 1184, 1184, 1184, 1185, 1185, + 1185, 1185, 1185, 1185, 1187, 1187, 1187, 1191, 1191, 1191, + 1191, 1192, 1192, 1192, 1192, 1193, 1193, 1194, 1194, 1197, + 1201, 1206, 1207, 1208, 1209, 1210, 1211, 1212, 1213, 1215, + 1216, 1217, 1218, 1219, 1220, 1221, 1222, 1231, 1232, 1238, + 1239, 1247, 1255, 1256, 1261, 1262, 1263, 1268, 1282, 1282, + 1283, 1283, 1285, 1295, 1295, 1295, 1295, 1295, 1295, 1295, + 1296, 1296, 1296, 1296, 1296, 1296, 1297, 1301, 1305, 1313, + 1321, 1334, 1339, 1351, 1361, 1365, 1376, 1381, 1387, 1388, + 1392, 1396, 1407, 1433, 1447, 1477, 1503, 1524, 1537, 1547, + 1552, 1613, 1620, 1629, 1635, 1641, 1645, 1649, 1657, 1668, + 1700, 1708, 1735, 1746, 1752, 1763, 1769, 1775, 1784, 1788, + 1796, 1796, 1806, 1814, 1819, 1823, 1827, 1831, 1846, 1868, + 1871, 1874, 1874, 1882, 1882, 1890, 1890, 1898, 1898, 1907, + 1910, 1913, 1917, 1930, 1931, 1933, 1937, 1946, 1950, 1955, + 1957, 1962, 1967, 1976, 1976, 1977, 1977, 1979, 1986, 1992, + 1999, 2003, 2009, 2014, 2019, 2114, 2114, 2116, 2124, 2124, + 2126, 2131, 2132, 2133, 2135, 2135, 2145, 2149, 2154, 2158, + 2162, 2166, 2170, 2174, 2178, 2182, 2186, 2211, 2215, 2229, + 2233, 2239, 2239, 2245, 2250, 2254, 2263, 2274, 2279, 2291, + 2304, 2308, 2312, 2317, 2326, 2345, 2354, 2410, 2414, 2421, + 2432, 2445, 2454, 2463, 2473, 2477, 2484, 2484, 2486, 2490, + 2495, 2517, 2532, 2546, 2559, 2570, 2578, 2586, 2592, 2612, + 2635, 2641, 2647, 2653, 2668, 2727, 2734, 2737, 2742, 2746, + 2753, 2758, 2764, 2769, 2775, 2783, 2795, 2810 }; #endif -static const short yyr1[] = { 0, - 127, 127, 128, 128, 129, 129, 129, 129, 129, 129, - 129, 129, 129, 130, 130, 130, 131, 131, 131, 131, - 131, 131, 132, 132, 133, 133, 133, 133, 134, 134, - 134, 134, 135, 135, 136, 136, 137, 137, 138, 138, - 138, 138, 138, 138, 138, 138, 139, 139, 139, 139, - 139, 139, 139, 139, 140, 140, 141, 141, 142, 143, - 143, 144, 144, 145, 145, 146, 146, 147, 147, 148, - 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, 152, 152, 153, - 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, - 153, 153, 153, 153, 153, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 155, 155, 156, 156, 157, - 158, 158, 158, 158, 158, 159, 159, 159, 160, 159, - 161, 159, 162, 159, 163, 159, 159, 159, 159, 164, - 165, 165, 166, 166, 166, 166, 167, 168, 168, 168, - 169, 169, 170, 170, 171, 172, 172, 173, 173, 173, - 173, 174, 175, 175, 176, 177, 177, 178, 179, 179, - 179, 181, 180, 182, 182, 183, 183, 183, 183, 183, - 183, 183, 183, 183, 183, 183, 184, 184, 185, 185, - 186, 187, 187, 188, 189, 189, 189, 190, 190, 190, - 190, 190, 190, 190, 190, 190, 191, 191, 192, 193, - 193, 194, 194, 195, 195, 196, 196, 197, 197, 197, - 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, - 197, 197, 197, 198, 198, 199, 199, 200, 200, 200, - 200, 200, 200, 200, 200 +#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "SINTVAL", + "UINTVAL", "FPVAL", "VOID", "BOOL", "SBYTE", "UBYTE", "SHORT", "USHORT", + "INT", "UINT", "LONG", "ULONG", "FLOAT", "DOUBLE", "TYPE", "LABEL", + "VAR_ID", "LABELSTR", "STRINGCONSTANT", "IMPLEMENTATION", + "ZEROINITIALIZER", "TRUETOK", "FALSETOK", "BEGINTOK", "ENDTOK", + "DECLARE", "GLOBAL", "CONSTANT", "SECTION", "VOLATILE", "TO", + "DOTDOTDOT", "NULL_TOK", "UNDEF", "CONST", "INTERNAL", "LINKONCE", + "WEAK", "APPENDING", "DLLIMPORT", "DLLEXPORT", "EXTERN_WEAK", "OPAQUE", + "NOT", "EXTERNAL", "TARGET", "TRIPLE", "ENDIAN", "POINTERSIZE", "LITTLE", + "BIG", "ALIGN", "DEPLIBS", "CALL", "TAIL", "ASM_TOK", "MODULE", + "SIDEEFFECT", "CC_TOK", "CCC_TOK", "CSRETCC_TOK", "FASTCC_TOK", + "COLDCC_TOK", "X86_STDCALLCC_TOK", "X86_FASTCALLCC_TOK", "DATALAYOUT", + "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB", + "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "AND", "OR", + "XOR", "SETLE", "SETGE", "SETLT", "SETGT", "SETEQ", "SETNE", "MALLOC", + "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR", "PHI_TOK", "CAST", + "SELECT", "SHL", "LSHR", "ASHR", "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 }; +#endif -static const short yyr2[] = { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 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, 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 +# 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, 363, 364, + 365, 366, 367, 368, 61, 44, 92, 40, 41, 91, + 120, 93, 60, 62, 123, 125, 42, 99 }; +# endif -static const short yydefact[] = { 149, - 46, 135, 134, 182, 39, 40, 41, 42, 43, 44, - 45, 0, 47, 206, 131, 132, 206, 161, 162, 0, - 0, 0, 46, 0, 137, 179, 0, 0, 48, 49, - 50, 51, 52, 53, 0, 0, 207, 203, 38, 176, - 177, 178, 202, 0, 0, 0, 0, 147, 0, 0, - 0, 0, 0, 0, 0, 37, 180, 181, 47, 150, - 133, 54, 1, 2, 67, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 0, - 0, 0, 0, 197, 0, 0, 66, 85, 70, 198, - 86, 173, 174, 175, 247, 205, 0, 0, 0, 0, - 160, 148, 138, 136, 128, 129, 0, 0, 0, 0, - 183, 87, 0, 0, 69, 92, 94, 0, 0, 99, - 93, 246, 0, 227, 0, 0, 0, 0, 47, 215, - 216, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, - 0, 0, 0, 0, 0, 0, 23, 24, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 204, 47, - 219, 0, 243, 155, 152, 151, 153, 154, 156, 159, - 0, 143, 145, 141, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 80, 81, 0, 0, 0, 0, 139, - 0, 0, 0, 91, 171, 98, 96, 0, 0, 231, - 226, 209, 208, 0, 0, 28, 32, 27, 31, 26, - 30, 25, 29, 33, 34, 0, 0, 57, 57, 252, - 0, 0, 241, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 157, - 62, 62, 62, 113, 114, 3, 4, 111, 112, 115, - 110, 106, 107, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 109, 108, 62, - 68, 68, 95, 170, 164, 167, 168, 0, 0, 88, - 186, 187, 188, 193, 189, 190, 191, 192, 184, 0, - 195, 200, 199, 201, 0, 210, 0, 0, 0, 248, - 0, 250, 245, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 158, 0, 144, 146, 142, 0, 0, 0, 0, 0, - 0, 101, 127, 0, 0, 105, 0, 102, 0, 0, - 0, 0, 140, 89, 90, 163, 165, 0, 60, 97, - 185, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 255, 0, 0, 233, 0, 235, 238, 0, 0, 236, - 237, 0, 0, 0, 232, 0, 253, 0, 0, 0, - 64, 62, 245, 0, 0, 0, 0, 0, 0, 100, - 103, 104, 0, 0, 0, 0, 169, 166, 61, 55, - 0, 194, 0, 0, 225, 57, 58, 57, 222, 244, - 0, 0, 0, 0, 0, 228, 229, 230, 225, 0, - 59, 65, 63, 0, 0, 0, 0, 0, 0, 126, - 0, 0, 0, 0, 0, 172, 0, 0, 0, 224, - 0, 0, 249, 251, 0, 0, 0, 234, 239, 240, - 0, 254, 117, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 56, 196, 0, 0, 0, 223, 220, 0, - 242, 116, 0, 123, 0, 0, 119, 120, 121, 122, - 0, 213, 0, 0, 0, 221, 0, 0, 0, 211, - 0, 212, 0, 0, 118, 124, 125, 0, 0, 0, - 0, 0, 0, 218, 0, 0, 217, 214, 0, 0, - 0 +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const unsigned char yyr1[] = +{ + 0, 128, 129, 129, 130, 130, 131, 131, 131, 131, + 131, 131, 131, 131, 131, 132, 132, 132, 133, 133, + 133, 133, 133, 133, 134, 134, 134, 135, 135, 135, + 135, 136, 136, 136, 136, 137, 137, 138, 138, 139, + 139, 140, 140, 140, 140, 140, 140, 140, 140, 141, + 141, 141, 141, 141, 141, 141, 141, 142, 142, 143, + 143, 144, 145, 145, 146, 146, 147, 147, 148, 148, + 149, 149, 150, 151, 151, 151, 151, 151, 151, 151, + 151, 151, 151, 151, 151, 151, 152, 152, 152, 152, + 152, 152, 152, 152, 152, 152, 153, 153, 154, 154, + 154, 154, 155, 155, 155, 155, 155, 155, 155, 155, + 155, 155, 155, 155, 155, 155, 155, 155, 156, 156, + 156, 156, 156, 156, 156, 156, 156, 156, 157, 157, + 158, 158, 159, 160, 160, 160, 160, 160, 161, 161, + 161, 162, 161, 163, 161, 164, 161, 165, 161, 161, + 161, 161, 166, 167, 167, 168, 168, 168, 168, 169, + 170, 170, 170, 171, 171, 172, 172, 173, 174, 174, + 175, 175, 175, 175, 176, 177, 177, 178, 179, 179, + 180, 181, 181, 181, 183, 182, 184, 184, 185, 185, + 185, 185, 185, 185, 185, 185, 185, 185, 185, 186, + 186, 187, 187, 188, 189, 189, 190, 191, 191, 191, + 192, 192, 192, 192, 192, 192, 192, 192, 192, 193, + 193, 194, 195, 195, 196, 196, 197, 197, 198, 198, + 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, + 199, 199, 199, 199, 199, 199, 200, 200, 201, 201, + 202, 202, 202, 202, 202, 202, 202, 202 }; -static const short yydefgoto[] = { 84, - 258, 274, 275, 276, 277, 196, 197, 226, 198, 23, - 13, 35, 446, 310, 391, 410, 333, 392, 85, 86, - 199, 88, 89, 118, 208, 343, 301, 344, 107, 519, - 1, 2, 280, 253, 251, 252, 61, 177, 48, 102, - 181, 90, 357, 286, 287, 288, 36, 94, 14, 42, - 15, 59, 16, 26, 362, 302, 91, 304, 419, 17, - 38, 39, 169, 494, 96, 233, 450, 451, 170, 171, - 371, 172, 173 +/* 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, 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, + 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 yypact[] = {-32768, - 184, 610,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768, -46, 135, -1,-32768,-32768, -18,-32768,-32768, 15, - -72, -24, 51, -62,-32768, 19, 61, 98,-32768,-32768, --32768,-32768,-32768,-32768, 1070, -20,-32768,-32768, 85,-32768, --32768,-32768,-32768, 33, 56, 60, 62,-32768, 54, 61, - 1070, 90, 90, 90, 90,-32768,-32768,-32768, 135,-32768, --32768,-32768,-32768,-32768, 58,-32768,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 173, - 174, 176, 576,-32768, 85, 66,-32768,-32768, -26,-32768, --32768,-32768,-32768,-32768, 1245,-32768, 157, 83, 179, 162, - 166,-32768,-32768,-32768,-32768,-32768, 1111, 1111, 1111, 1152, --32768,-32768, 75, 76,-32768,-32768, -26, -78, 80, 865, --32768,-32768, 1111,-32768, 138, 1193, 24, 151, 135,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 1111, - 1111, 1111, 1111, 1111, 1111, 1111,-32768,-32768, 1111, 1111, - 1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111,-32768, 135, --32768, 41,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -10,-32768,-32768,-32768, 115, 145, 202, 147, 203, 149, - 204, 152, 206, 212, 213, 154, 217, 215, 419,-32768, - 1111, 1111, 1111,-32768, 906,-32768, 118, 116, 643,-32768, --32768, 58,-32768, 643, 643,-32768,-32768,-32768,-32768,-32768, --32768,-32768,-32768,-32768,-32768, 643, 1070, 120, 121,-32768, - 643, 124, 129, 208, 131, 133, 134, 140, 141, 142, - 143, 643, 643, 643, 144, 1070, 1111, 1111, 236,-32768, - 148, 148, 148,-32768,-32768,-32768,-32768,-32768,-32768,-32768, --32768,-32768,-32768, 150, 153, 155, 156, 159, 160, 947, - 1152, 596, 237, 161, 164, 175, 177,-32768,-32768, 148, - -81, -38, -26,-32768, 85,-32768, 180, 146, 988,-32768, --32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 201, 1152, --32768,-32768,-32768,-32768, 182,-32768, 183, 643, -2,-32768, - 6,-32768, 186, 643, 185, 1111, 1111, 1111, 1111, 1111, - 1111, 1111, 1111, 187, 188, 190, 1111, 643, 643, 191, --32768, -23,-32768,-32768,-32768, 1152, 1152, 1152, 1152, 1152, - 1152,-32768,-32768, -9, -52,-32768, -76,-32768, 1152, 1152, - 1152, 1152,-32768,-32768,-32768,-32768,-32768, 1029, 231,-32768, --32768, 243, -14, 247, 249, 193, 643, 294, 643, 1111, --32768, 196, 643,-32768, 197,-32768,-32768, 199, 205,-32768, --32768, 643, 643, 643,-32768, 200,-32768, 1111, 291, 313, --32768, 148, 186, 288, 211, 216, 218, 219, 1152,-32768, --32768,-32768, 220, 226, 232, 233,-32768,-32768,-32768, 269, - 234,-32768, 643, 643, 1111, 240,-32768, 240,-32768, 241, - 643, 242, 1111, 1111, 1111,-32768,-32768,-32768, 1111, 643, --32768,-32768,-32768, 214, 1111, 1152, 1152, 1152, 1152,-32768, - 1152, 1152, 1152, 1152, 341,-32768, 327, 246, 239, 241, - 244, 305,-32768,-32768, 1111, 245, 643,-32768,-32768,-32768, - 252,-32768,-32768, 253, 250, 254, 259, 260, 262, 264, - 265, 267,-32768,-32768, 342, 14, 340,-32768,-32768, 257, --32768,-32768, 1152,-32768, 1152, 1152,-32768,-32768,-32768,-32768, - 643,-32768, 751, 65, 366,-32768, 274, 278, 279,-32768, - 283,-32768, 751, 643,-32768,-32768,-32768, 377, 285, 325, - 643, 382, 383,-32768, 643, 643,-32768,-32768, 405, 406, --32768 +/* 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 short int yydefact[] = +{ + 151, 0, 48, 137, 1, 136, 184, 41, 42, 43, + 44, 45, 46, 47, 0, 49, 208, 133, 134, 208, + 163, 164, 0, 0, 0, 48, 0, 139, 181, 0, + 0, 50, 51, 52, 53, 54, 55, 0, 0, 209, + 205, 40, 178, 179, 180, 204, 0, 0, 0, 0, + 149, 0, 0, 0, 0, 0, 0, 0, 39, 182, + 183, 49, 152, 135, 56, 2, 3, 69, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 0, 0, 0, 0, 199, 0, 0, 68, + 87, 72, 200, 88, 175, 176, 177, 249, 207, 0, + 0, 0, 0, 162, 150, 140, 138, 130, 131, 0, + 0, 0, 0, 185, 89, 0, 0, 71, 94, 96, + 0, 0, 101, 95, 248, 0, 229, 0, 0, 0, + 0, 49, 217, 218, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 0, 0, 0, 0, 0, 0, 0, 24, + 25, 26, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 206, 49, 221, 0, 245, 157, 154, 153, + 155, 156, 158, 161, 0, 145, 147, 143, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 0, + 0, 0, 0, 141, 0, 0, 0, 93, 173, 100, + 98, 0, 0, 233, 228, 211, 210, 0, 0, 30, + 34, 29, 33, 28, 32, 27, 31, 35, 36, 0, + 0, 59, 59, 254, 0, 0, 243, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 159, 64, 64, 64, 115, 116, 4, + 5, 113, 114, 117, 112, 108, 109, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 111, 110, 64, 70, 70, 97, 172, 166, 169, + 170, 0, 0, 90, 188, 189, 190, 195, 191, 192, + 193, 194, 186, 0, 197, 202, 201, 203, 0, 212, + 0, 0, 0, 250, 0, 252, 247, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 160, 0, 146, 148, 144, 0, + 0, 0, 0, 0, 0, 103, 129, 0, 0, 107, + 0, 104, 0, 0, 0, 0, 142, 91, 92, 165, + 167, 0, 62, 99, 187, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 257, 0, 0, 235, 0, 237, + 240, 0, 0, 238, 239, 0, 0, 0, 234, 0, + 255, 0, 0, 0, 66, 64, 247, 0, 0, 0, + 0, 0, 0, 102, 105, 106, 0, 0, 0, 0, + 171, 168, 63, 57, 0, 196, 0, 0, 227, 59, + 60, 59, 224, 246, 0, 0, 0, 0, 0, 230, + 231, 232, 227, 0, 61, 67, 65, 0, 0, 0, + 0, 0, 0, 128, 0, 0, 0, 0, 0, 174, + 0, 0, 0, 226, 0, 0, 251, 253, 0, 0, + 0, 236, 241, 242, 0, 256, 119, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 58, 198, 0, 0, + 0, 225, 222, 0, 244, 118, 0, 125, 0, 0, + 121, 122, 123, 124, 0, 215, 0, 0, 0, 223, + 0, 0, 0, 213, 0, 214, 0, 0, 120, 126, + 127, 0, 0, 0, 0, 0, 0, 220, 0, 0, + 219, 216 }; -static const short yypgoto[] = {-32768, --32768, 312, 314, 315, 316, -127, -126, -462,-32768, 369, - 389, -87,-32768, -225, 55,-32768, -245,-32768, -48,-32768, - -35,-32768, -66, 293,-32768, -100, 222, -253, 59,-32768, --32768,-32768,-32768,-32768,-32768,-32768, 365,-32768,-32768,-32768, --32768, 4,-32768, 68,-32768,-32768, 357,-32768,-32768,-32768, --32768,-32768, 415,-32768,-32768, -453, -55, 64, -103,-32768, - 401,-32768,-32768,-32768,-32768,-32768, 49, -7,-32768,-32768, - 30,-32768,-32768 +/* YYDEFGOTO[NTERM-NUM]. */ +static const short int yydefgoto[] = +{ + -1, 86, 261, 277, 278, 279, 280, 199, 200, 229, + 201, 25, 15, 37, 449, 313, 394, 413, 336, 395, + 87, 88, 202, 90, 91, 120, 211, 346, 304, 347, + 109, 1, 2, 3, 283, 256, 254, 255, 63, 180, + 50, 104, 184, 92, 360, 289, 290, 291, 38, 96, + 16, 44, 17, 61, 18, 28, 365, 305, 93, 307, + 422, 19, 40, 41, 172, 497, 98, 236, 453, 454, + 173, 174, 374, 175, 176 }; - -#define YYLAST 1357 - - -static const short yytable[] = { 87, - 224, 225, 104, 312, 37, 24, 334, 335, 92, 200, - 389, 40, 367, 493, 27, 87, 117, 345, 347, 210, - 369, 37, 213, 216, 217, 218, 219, 220, 221, 222, - 223, 503, 214, 390, 353, 203, 50, 399, 354, 501, - 49, 227, 24, 121, 215, 204, 363, 402, 230, 509, - 56, 234, 235, 117, 368, 236, 237, 238, 239, 240, - 241, 399, 368, 57, 245, 58, 44, 45, 46, 401, - 51, 182, 183, 184, 216, 217, 218, 219, 220, 221, - 222, 223, 246, 355, 60, 47, 121, 209, 119, -68, - 209, 5, 6, 7, 8, 52, 10, 53, 121, 399, - 54, 62, 93, 249, 399, 41, 18, 412, 19, 250, - 400, 108, 109, 110, 228, 229, 209, 231, 232, 209, - 209, 105, 106, 209, 209, 209, 209, 209, 209, 242, - 243, 244, 209, 492, 281, 282, 283, 175, 176, 247, - 248, 254, 255, 279, 330, 97, 433, -28, -28, -27, - -27, -26, -26, 303, -25, -25, 256, 257, 303, 303, - 216, 217, 218, 219, 220, 221, 222, 223, 98, 285, - 303, 101, 99, -69, 100, 303, 112, 113, 308, 114, - 174, 120, 178, -130, 502, 179, 303, 303, 303, 180, - 453, 87, 454, 201, 202, 205, 211, 328, 28, 29, - 30, 31, 32, 33, 34, -32, -31, -30, 3, -29, - 87, 329, 209, 375, 4, 377, 378, 379, -35, -36, - 259, 260, 283, 385, 5, 6, 7, 8, 9, 10, - 11, 289, 290, 309, 311, 393, 394, 395, 396, 397, - 398, 314, 315, 316, 317, 12, 318, 319, 403, 404, - 405, 406, 303, 320, 321, 322, 323, 327, 303, 331, - 348, 332, 359, 361, 389, 336, 411, 413, 337, 414, - 338, 339, 303, 303, 340, 341, 349, 305, 306, 350, - 374, 209, 376, 209, 209, 209, 380, 381, 356, 307, - 351, 209, 352, 358, 313, 364, 365, 417, 440, 370, - 382, 383, 373, 384, 388, 324, 325, 326, 415, 421, - 423, 303, 424, 303, 431, 429, 432, 303, 425, 458, - 459, 460, 285, 435, 436, 445, 303, 303, 303, 437, - 463, 438, 439, 441, 209, 465, 466, 467, 468, 442, - 469, 470, 471, 472, 473, 443, 444, 447, 224, 225, - 474, 478, 430, 452, 455, 457, 476, 303, 303, 475, - 477, 368, 491, 483, 479, 303, 224, 225, 481, 482, - 484, 366, 485, 486, 303, 495, 496, 372, 487, 209, - 488, 489, 497, 490, 498, 499, 504, 209, 209, 209, - 505, 386, 387, 209, 506, 507, 508, 511, 512, 464, - 513, 303, 515, 516, 520, 521, 165, 95, 166, 167, - 168, 55, 207, 409, 103, 111, 25, 43, 420, 209, - 278, 461, 434, 63, 64, 408, 0, 0, 0, 0, - 416, 0, 418, 0, 0, 303, 422, 0, 0, 0, - 18, 0, 19, 0, 261, 426, 427, 428, 303, 0, - 0, 0, 0, 0, 0, 303, 262, 263, 0, 303, - 303, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 448, 449, 0, 0, - 0, 0, 0, 0, 456, 0, 0, 0, 0, 0, - 0, 0, 0, 462, 0, 0, 132, 133, 134, 135, - 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, - 146, 147, 148, 149, 0, 0, 0, 0, 0, 264, - 480, 265, 266, 157, 158, 0, 267, 268, 269, 0, - 0, 0, 0, 0, 0, 0, 270, 0, 0, 271, - 0, 272, 0, 0, 273, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 500, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 510, 0, 0, - 0, 0, 0, 0, 514, 0, 0, 0, 517, 518, - 63, 64, 0, 115, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 18, 0, 19, - 63, 64, 0, 115, 185, 186, 187, 188, 189, 190, - 191, 192, 193, 194, 195, 77, 78, 18, 0, 19, - 0, 0, 0, 79, 0, 0, 0, 0, 0, -38, - 0, 18, 0, 19, 0, 0, 0, 0, 0, 0, - 4, -38, -38, 79, 0, 291, 292, 63, 64, 293, - -38, -38, -38, -38, -38, -38, -38, 0, 0, -38, - 20, 0, 0, 0, 18, 0, 19, 21, 294, 295, - 296, 22, 0, 0, 0, 0, 0, 0, 0, 0, - 297, 298, 0, 0, 0, 0, 0, 0, 0, 0, - 80, 0, 0, 81, 0, 0, 82, 0, 83, 116, - 0, 0, 0, 299, 0, 0, 0, 0, 0, 0, - 80, 0, 0, 81, 0, 0, 82, 0, 83, 346, - 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, - 142, 143, 144, 145, 146, 147, 148, 149, 0, 0, - 0, 0, 0, 264, 0, 265, 266, 157, 158, 0, - 267, 268, 269, 291, 292, 0, 0, 293, 0, 0, - 0, 0, 0, 300, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 294, 295, 296, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 297, 298, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 299, 0, 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, 146, 147, 148, 149, 0, 0, 0, 0, - 0, 264, 0, 265, 266, 157, 158, 0, 267, 268, - 269, 0, 0, 0, 0, 0, 0, 0, 0, 63, - 64, 300, 115, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 18, 0, 19, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 206, 0, 0, 0, 0, 0, 0, 0, 0, - 63, 64, 79, 115, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 18, 0, 19, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 284, 0, 0, 0, 0, 0, 0, 0, - 0, 63, 64, 79, 115, 185, 186, 187, 188, 189, - 190, 191, 192, 193, 194, 195, 77, 78, 18, 0, - 19, 0, 0, 0, 0, 0, 0, 0, 0, 80, - 0, 0, 81, 0, 0, 82, 0, 83, 0, 0, - 0, 0, 63, 64, 79, 115, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 18, - 0, 19, 0, 0, 0, 0, 0, 0, 0, 0, - 80, 0, 0, 81, 360, 0, 82, 0, 83, 0, - 0, 0, 0, 63, 64, 79, 115, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - 18, 0, 19, 0, 0, 0, 0, 0, 0, 0, - 0, 80, 0, 0, 81, 407, 342, 82, 0, 83, - 0, 0, 0, 0, 63, 64, 79, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 18, 0, 19, 0, 0, 0, 0, 0, 0, - 0, 0, 80, 0, 0, 81, 0, 0, 82, 0, - 83, 0, 0, 0, 0, 63, 64, 79, 115, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 18, 0, 19, 0, 0, 0, 0, 0, - 0, 0, 0, 80, 0, 0, 81, 0, 0, 82, - 0, 83, 0, 0, 0, 0, 63, 64, 79, 115, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, - 195, 77, 78, 18, 0, 19, 0, 0, 0, 0, - 0, 0, 0, 0, 80, 0, 0, 81, 0, 0, - 82, 0, 83, 0, 0, 0, 0, 63, 64, 79, - 212, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 18, 0, 19, 0, 0, 0, - 0, 0, 0, 0, 0, 80, 0, 0, 81, 0, - 0, 82, 0, 83, 0, 0, 0, 0, 0, 0, - 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 80, 0, 0, 81, - 0, 0, 82, 0, 83, 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, 0, 80, 0, 0, - 81, 0, 0, 82, 0, 83, 126, 127, 128, 129, - 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, - 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, - 150, 151, 152, 0, 0, 153, 154, 155, 156, 157, - 158, 159, 160, 161, 162, 163, 164 +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -463 +static const short int yypact[] = +{ + -463, 19, 202, 739, -463, -463, -463, -463, -463, -463, + -463, -463, -463, -463, -23, 340, 60, -463, -463, -12, + -463, -463, -8, 40, 115, 123, 66, -463, 67, 158, + 179, -463, -463, -463, -463, -463, -463, 1021, -14, -463, + -463, 120, -463, -463, -463, -463, 70, 71, 73, 77, + -463, 76, 158, 1021, 36, 36, 36, 36, -463, -463, + -463, 340, -463, -463, -463, -463, -463, 75, -463, -463, + -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, + -463, -463, 193, 194, 195, 577, -463, 120, 84, -463, + -463, -84, -463, -463, -463, -463, -463, 1197, -463, 180, + 31, 201, 183, 192, -463, -463, -463, -463, -463, 1062, + 1062, 1062, 1103, -463, -463, 100, 101, -463, -463, -84, + -91, 105, 853, -463, -463, 1062, -463, 164, 1144, 30, + 255, 340, -463, -463, -463, -463, -463, -463, -463, -463, + -463, -463, -463, -463, -463, -463, -463, -463, -463, -463, + -463, -463, 1062, 1062, 1062, 1062, 1062, 1062, 1062, -463, + -463, -463, 1062, 1062, 1062, 1062, 1062, 1062, 1062, 1062, + 1062, 1062, -463, 340, -463, 51, -463, -463, -463, -463, + -463, -463, -463, -463, -74, -463, -463, -463, 125, 153, + 220, 155, 222, 159, 224, 171, 225, 223, 227, 175, + 228, 229, 420, -463, 1062, 1062, 1062, -463, 894, -463, + 116, 117, 645, -463, -463, 75, -463, 645, 645, -463, + -463, -463, -463, -463, -463, -463, -463, -463, -463, 645, + 1021, 140, 141, -463, 645, 138, 143, 226, 144, 146, + 148, 161, 162, 163, 166, 645, 645, 645, 177, 1021, + 1062, 1062, 249, -463, 182, 182, 182, -463, -463, -463, + -463, -463, -463, -463, -463, -463, -463, 178, 181, 184, + 185, 186, 187, 87, 1103, 597, 270, 188, 189, 197, + 199, -463, -463, 182, -36, -56, -84, -463, 120, -463, + 196, 200, 939, -463, -463, -463, -463, -463, -463, -463, + -463, -463, 236, 1103, -463, -463, -463, -463, 205, -463, + 210, 645, -9, -463, -3, -463, 211, 645, 191, 1062, + 1062, 1062, 1062, 1062, 1062, 1062, 1062, 212, 216, 217, + 1062, 645, 645, 218, -463, -20, -463, -463, -463, 1103, + 1103, 1103, 1103, 1103, 1103, -463, -463, -50, -59, -463, + -31, -463, 1103, 1103, 1103, 1103, -463, -463, -463, -463, + -463, 980, 278, -463, -463, 293, 26, 313, 314, 230, + 645, 337, 645, 1062, -463, 231, 645, -463, 233, -463, + -463, 234, 237, -463, -463, 645, 645, 645, -463, 238, + -463, 1062, 332, 353, -463, 182, 211, 322, 246, 247, + 248, 250, 1103, -463, -463, -463, 251, 256, 257, 259, + -463, -463, -463, 307, 260, -463, 645, 645, 1062, 262, + -463, 262, -463, 263, 645, 265, 1062, 1062, 1062, -463, + -463, -463, 1062, 645, -463, -463, -463, 252, 1062, 1103, + 1103, 1103, 1103, -463, 1103, 1103, 1103, 1103, 378, -463, + 359, 273, 266, 263, 274, 339, -463, -463, 1062, 276, + 645, -463, -463, -463, 280, -463, -463, 281, 285, 284, + 296, 297, 295, 298, 299, 300, -463, -463, 393, 15, + 379, -463, -463, 301, -463, -463, 1103, -463, 1103, 1103, + -463, -463, -463, -463, 645, -463, 738, 65, 398, -463, + 302, 305, 306, -463, 312, -463, 738, 645, -463, -463, + -463, 407, 315, 355, 645, 408, 412, -463, 645, 645, + -463, -463 }; -static const short yycheck[] = { 35, - 128, 128, 51, 229, 23, 2, 252, 253, 29, 110, - 34, 30, 15, 476, 61, 51, 83, 271, 272, 123, - 15, 23, 126, 10, 11, 12, 13, 14, 15, 16, - 17, 494, 9, 57, 280, 114, 61, 114, 120, 493, - 113, 129, 39, 125, 21, 124, 300, 124, 152, 503, - 113, 155, 156, 120, 57, 159, 160, 161, 162, 163, - 164, 114, 57, 45, 168, 47, 52, 53, 54, 122, - 20, 107, 108, 109, 10, 11, 12, 13, 14, 15, - 16, 17, 170, 122, 24, 71, 125, 123, 85, 116, - 126, 41, 42, 43, 44, 45, 46, 47, 125, 114, - 50, 4, 123, 114, 114, 124, 22, 122, 24, 120, - 120, 53, 54, 55, 150, 151, 152, 153, 154, 155, - 156, 32, 33, 159, 160, 161, 162, 163, 164, 165, - 166, 167, 168, 120, 201, 202, 203, 55, 56, 99, - 100, 27, 28, 199, 248, 113, 392, 3, 4, 3, - 4, 3, 4, 209, 3, 4, 3, 4, 214, 215, - 10, 11, 12, 13, 14, 15, 16, 17, 113, 205, - 226, 118, 113, 116, 113, 231, 4, 4, 227, 4, - 24, 116, 4, 0, 120, 24, 242, 243, 244, 24, - 416, 227, 418, 119, 119, 116, 59, 246, 64, 65, - 66, 67, 68, 69, 70, 4, 4, 4, 25, 4, - 246, 247, 248, 317, 31, 319, 320, 321, 7, 7, - 4, 7, 289, 327, 41, 42, 43, 44, 45, 46, - 47, 114, 117, 114, 114, 336, 337, 338, 339, 340, - 341, 118, 114, 36, 114, 62, 114, 114, 349, 350, - 351, 352, 308, 114, 114, 114, 114, 114, 314, 24, - 24, 114, 117, 63, 34, 116, 24, 21, 116, 21, - 116, 116, 328, 329, 116, 116, 116, 214, 215, 116, - 316, 317, 318, 319, 320, 321, 322, 323, 285, 226, - 116, 327, 116, 114, 231, 114, 114, 4, 399, 114, - 114, 114, 118, 114, 114, 242, 243, 244, 116, 114, - 114, 367, 114, 369, 24, 116, 4, 373, 114, 423, - 424, 425, 358, 36, 114, 57, 382, 383, 384, 114, - 117, 114, 114, 114, 370, 436, 437, 438, 439, 114, - 441, 442, 443, 444, 4, 114, 114, 114, 476, 476, - 24, 455, 388, 114, 114, 114, 118, 413, 414, 114, - 117, 57, 21, 114, 120, 421, 494, 494, 117, 117, - 117, 308, 114, 114, 430, 36, 120, 314, 117, 415, - 117, 117, 483, 117, 485, 486, 21, 423, 424, 425, - 117, 328, 329, 429, 117, 117, 114, 21, 114, 435, - 76, 457, 21, 21, 0, 0, 95, 39, 95, 95, - 95, 23, 120, 359, 50, 59, 2, 17, 370, 455, - 199, 429, 393, 5, 6, 358, -1, -1, -1, -1, - 367, -1, 369, -1, -1, 491, 373, -1, -1, -1, - 22, -1, 24, -1, 26, 382, 383, 384, 504, -1, - -1, -1, -1, -1, -1, 511, 38, 39, -1, 515, - 516, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 413, 414, -1, -1, - -1, -1, -1, -1, 421, -1, -1, -1, -1, -1, - -1, -1, -1, 430, -1, -1, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, -1, -1, -1, -1, -1, 101, - 457, 103, 104, 105, 106, -1, 108, 109, 110, -1, - -1, -1, -1, -1, -1, -1, 118, -1, -1, 121, - -1, 123, -1, -1, 126, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 491, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 504, -1, -1, - -1, -1, -1, -1, 511, -1, -1, -1, 515, 516, - 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, -1, 20, - -1, 22, -1, 24, -1, -1, -1, -1, -1, -1, - 31, 32, 33, 48, -1, 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, -1, -1, -1, -1, - 115, -1, -1, 118, -1, -1, 121, -1, 123, 124, - -1, -1, -1, 61, -1, -1, -1, -1, -1, -1, - 115, -1, -1, 118, -1, -1, 121, -1, 123, 124, - 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, -1, -1, - -1, -1, -1, 101, -1, 103, 104, 105, 106, -1, - 108, 109, 110, 3, 4, -1, -1, 7, -1, -1, - -1, -1, -1, 121, -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, -1, 78, 79, - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, -1, -1, -1, -1, - -1, 101, -1, 103, 104, 105, 106, -1, 108, 109, - 110, -1, -1, -1, -1, -1, -1, -1, -1, 5, - 6, 121, 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, -1, -1, -1, -1, -1, 115, - -1, -1, 118, -1, -1, 121, -1, 123, -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, - 115, -1, -1, 118, 37, -1, 121, -1, 123, -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, 115, -1, -1, 118, 37, 120, 121, -1, 123, - -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, 115, -1, -1, 118, -1, -1, 121, -1, - 123, -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, 115, -1, -1, 118, -1, -1, 121, - -1, 123, -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, 115, -1, -1, 118, -1, -1, - 121, -1, 123, -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, 115, -1, -1, 118, -1, - -1, 121, -1, 123, -1, -1, -1, -1, -1, -1, - 48, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 115, -1, -1, 118, - -1, -1, 121, -1, 123, -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, -1, 115, -1, -1, - 118, -1, -1, 121, -1, 123, 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, -1, -1, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, 112 +/* YYPGOTO[NTERM-NUM]. */ +static const short int yypgoto[] = +{ + -463, -463, -463, 338, 342, 343, 344, -129, -128, -462, + -463, 395, 418, -118, -463, -225, 89, -463, -247, -463, + -49, -463, -37, -463, -82, 323, -463, -102, 253, -253, + 83, -463, -463, -463, -463, -463, -463, -463, 400, -463, + -463, -463, -463, 2, -463, 92, -463, -463, 399, -463, + -463, -463, -463, -463, 451, -463, -463, -359, -57, 62, + -105, -463, 437, -463, -463, -463, -463, -463, 90, 32, + -463, -463, 69, -463, -463 }; -/* -*-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 */ +/* 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 -133 +static const short int yytable[] = +{ + 89, 227, 228, 119, 106, 26, 370, 315, 337, 338, + 203, 39, 372, 230, 392, 94, 89, 496, 42, 4, + 213, 348, 350, 216, 206, 219, 220, 221, 222, 223, + 224, 225, 226, -70, 207, 506, 356, 393, 29, 217, + 119, 252, 123, 26, 46, 47, 48, 253, 371, 233, + 366, 218, 237, 238, 371, 249, 402, 239, 240, 241, + 242, 243, 244, 49, 404, 402, 248, 358, 107, 108, + 123, 403, 185, 186, 187, 219, 220, 221, 222, 223, + 224, 225, 226, 39, 402, 357, 178, 179, 212, 121, + 123, 212, 65, 66, 405, 117, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 79, 80, 20, + 95, 21, 59, 43, 60, 231, 232, 212, 234, 235, + 212, 212, 284, 285, 286, 212, 212, 212, 212, 212, + 212, 245, 246, 247, 212, 81, 495, 504, 110, 111, + 112, 402, 20, 53, 21, 282, 333, 512, 436, 415, + 250, 251, 257, 258, 51, 306, -30, -30, -29, -29, + 306, 306, -28, -28, 7, 8, 9, 10, 54, 12, + 55, 288, 306, 56, -27, -27, 52, 306, 259, 260, + 58, 311, 62, 64, 99, 100, 505, 101, 306, 306, + 306, 102, -71, 89, 456, 103, 457, 114, 115, 116, + 331, 122, -132, 82, 177, 181, 83, 182, 345, 84, + 286, 85, 89, 332, 212, 378, 183, 380, 381, 382, + 204, 205, 208, 214, -34, 388, -33, 5, -32, -31, + -37, 292, 262, 6, -38, 293, 263, 396, 397, 398, + 399, 400, 401, 7, 8, 9, 10, 11, 12, 13, + 406, 407, 408, 409, 306, 312, 314, 317, 318, 320, + 306, 321, 319, 322, 14, 219, 220, 221, 222, 223, + 224, 225, 226, 334, 306, 306, 323, 324, 325, 308, + 309, 326, 377, 212, 379, 212, 212, 212, 383, 384, + 359, 310, 330, 212, 351, 339, 316, 335, 340, 364, + 443, 341, 342, 343, 344, 352, 353, 327, 328, 329, + 376, 361, 392, 306, 354, 306, 355, 414, 362, 306, + 367, 461, 462, 463, 288, 368, 373, 385, 306, 306, + 306, 386, 387, 391, 416, 417, 212, 468, 469, 470, + 471, 420, 472, 473, 474, 475, 424, 418, 426, 427, + 227, 228, 428, 481, 433, 432, 434, 435, 438, 306, + 306, 439, 440, 441, 448, 442, 444, 306, 227, 228, + 466, 445, 446, 369, 447, 450, 306, 455, 458, 375, + 460, 212, 476, 477, 500, 479, 501, 502, 478, 212, + 212, 212, 480, 389, 390, 212, 371, 482, 484, 485, + 486, 467, 487, 306, 30, 31, 32, 33, 34, 35, + 36, 488, 489, 490, 494, 498, 491, 492, 493, 507, + 508, 212, 499, 509, 510, 65, 66, 511, 514, 518, + 515, 516, 419, 519, 421, 168, 97, 306, 425, 169, + 170, 171, 20, 57, 21, 210, 264, 429, 430, 431, + 306, 412, 105, 411, 27, 281, 45, 306, 265, 266, + 113, 306, 306, 423, 464, 437, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 451, 452, + 0, 0, 0, 0, 0, 0, 459, 0, 0, 0, + 0, 0, 0, 0, 0, 465, 0, 0, 134, 135, + 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, + 146, 147, 148, 149, 150, 151, 0, 0, 0, 0, + 0, 267, 483, 268, 269, 159, 160, 161, 0, 270, + 271, 272, 0, 0, 0, 0, 0, 0, 0, 273, + 0, 0, 274, 0, 275, 0, 0, 276, 0, 0, + 0, 0, 0, 0, 0, 0, 503, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 513, + 0, 0, 0, 0, 0, 0, 517, 0, 0, 0, + 520, 521, 65, 66, 0, 117, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 79, 80, 20, + 0, 21, 65, 66, 0, 117, 188, 189, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 79, 80, 20, + 0, 21, 0, 0, 0, 81, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 81, 0, 0, 294, 295, + 65, 66, 296, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 20, 0, 21, + 0, 297, 298, 299, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 300, 301, 0, 0, 0, 0, 0, + 0, 0, 0, 82, 0, 0, 83, 0, 0, 84, + 0, 85, 118, 0, 0, 0, 302, 0, 0, 0, + 0, 0, 0, 82, 0, 0, 83, 0, 0, 84, + 0, 85, 349, 134, 135, 136, 137, 138, 139, 140, + 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, + 151, 294, 295, 0, 0, 296, 267, 0, 268, 269, + 159, 160, 161, 0, 270, 271, 272, 0, 0, -40, + 0, 20, 0, 21, 297, 298, 299, 303, 0, 0, + 6, -40, -40, 0, 0, 0, 300, 301, 0, 0, + -40, -40, -40, -40, -40, -40, -40, 0, 0, -40, + 22, 0, 0, 0, 0, 0, 0, 23, 0, 302, + 0, 24, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 134, 135, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, + 148, 149, 150, 151, 0, 0, 0, 0, 0, 267, + 0, 268, 269, 159, 160, 161, 0, 270, 271, 272, + 0, 0, 0, 0, 0, 0, 0, 0, 65, 66, + 303, 117, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 20, 0, 21, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 209, 0, 0, 0, 0, 0, 0, 0, 0, 65, + 66, 81, 117, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 20, 0, 21, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 287, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 81, 0, 65, 66, 0, 117, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 80, 20, 0, 21, 0, 0, 0, 0, 0, 82, + 0, 0, 83, 0, 0, 84, 363, 85, 0, 0, + 0, 0, 0, 0, 0, 65, 66, 81, 117, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 79, 80, 20, 0, 21, 0, 0, 0, 0, 0, + 82, 0, 0, 83, 0, 0, 84, 410, 85, 0, + 0, 0, 0, 0, 0, 0, 65, 66, 81, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 79, 80, 20, 0, 21, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 82, 0, 0, 83, 0, + 0, 84, 0, 85, 0, 0, 0, 65, 66, 81, + 117, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 20, 0, 21, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 82, 0, 0, 83, + 0, 0, 84, 0, 85, 0, 0, 0, 65, 66, + 81, 117, 188, 189, 190, 191, 192, 193, 194, 195, + 196, 197, 198, 79, 80, 20, 0, 21, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 82, 0, 0, + 83, 0, 0, 84, 0, 85, 0, 0, 0, 65, + 66, 81, 215, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 20, 0, 21, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 82, 0, + 0, 83, 0, 0, 84, 0, 85, 0, 0, 0, + 0, 0, 81, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 82, + 0, 0, 83, 0, 0, 84, 0, 85, 0, 0, + 0, 0, 124, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 125, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 126, 127, 0, 0, + 82, 0, 0, 83, 0, 0, 84, 0, 85, 128, + 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, + 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, + 149, 150, 151, 152, 153, 154, 0, 0, 155, 156, + 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 167 +}; -#ifdef YYSTACK_USE_ALLOCA -#define YYSTACK_ALLOC alloca -#else -#define YYSTACK_ALLOC malloc -#endif +static const short int yycheck[] = +{ + 37, 130, 130, 85, 53, 3, 15, 232, 255, 256, + 112, 23, 15, 131, 34, 29, 53, 479, 30, 0, + 125, 274, 275, 128, 115, 10, 11, 12, 13, 14, + 15, 16, 17, 117, 125, 497, 283, 57, 61, 9, + 122, 115, 126, 41, 52, 53, 54, 121, 57, 154, + 303, 21, 157, 158, 57, 173, 115, 162, 163, 164, + 165, 166, 167, 71, 123, 115, 171, 123, 32, 33, + 126, 121, 109, 110, 111, 10, 11, 12, 13, 14, + 15, 16, 17, 23, 115, 121, 55, 56, 125, 87, + 126, 128, 5, 6, 125, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 124, 24, 45, 125, 47, 152, 153, 154, 155, 156, + 157, 158, 204, 205, 206, 162, 163, 164, 165, 166, + 167, 168, 169, 170, 171, 48, 121, 496, 55, 56, + 57, 115, 22, 20, 24, 202, 251, 506, 395, 123, + 99, 100, 27, 28, 114, 212, 3, 4, 3, 4, + 217, 218, 3, 4, 41, 42, 43, 44, 45, 46, + 47, 208, 229, 50, 3, 4, 61, 234, 3, 4, + 114, 230, 24, 4, 114, 114, 121, 114, 245, 246, + 247, 114, 117, 230, 419, 119, 421, 4, 4, 4, + 249, 117, 0, 116, 24, 4, 119, 24, 121, 122, + 292, 124, 249, 250, 251, 320, 24, 322, 323, 324, + 120, 120, 117, 59, 4, 330, 4, 25, 4, 4, + 7, 115, 4, 31, 7, 118, 7, 339, 340, 341, + 342, 343, 344, 41, 42, 43, 44, 45, 46, 47, + 352, 353, 354, 355, 311, 115, 115, 119, 115, 115, + 317, 115, 36, 115, 62, 10, 11, 12, 13, 14, + 15, 16, 17, 24, 331, 332, 115, 115, 115, 217, + 218, 115, 319, 320, 321, 322, 323, 324, 325, 326, + 288, 229, 115, 330, 24, 117, 234, 115, 117, 63, + 402, 117, 117, 117, 117, 117, 117, 245, 246, 247, + 119, 115, 34, 370, 117, 372, 117, 24, 118, 376, + 115, 426, 427, 428, 361, 115, 115, 115, 385, 386, + 387, 115, 115, 115, 21, 21, 373, 439, 440, 441, + 442, 4, 444, 445, 446, 447, 115, 117, 115, 115, + 479, 479, 115, 458, 391, 117, 24, 4, 36, 416, + 417, 115, 115, 115, 57, 115, 115, 424, 497, 497, + 118, 115, 115, 311, 115, 115, 433, 115, 115, 317, + 115, 418, 4, 24, 486, 119, 488, 489, 115, 426, + 427, 428, 118, 331, 332, 432, 57, 121, 118, 118, + 115, 438, 118, 460, 64, 65, 66, 67, 68, 69, + 70, 115, 115, 118, 21, 36, 118, 118, 118, 21, + 118, 458, 121, 118, 118, 5, 6, 115, 21, 21, + 115, 76, 370, 21, 372, 97, 41, 494, 376, 97, + 97, 97, 22, 25, 24, 122, 26, 385, 386, 387, + 507, 362, 52, 361, 3, 202, 19, 514, 38, 39, + 61, 518, 519, 373, 432, 396, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 416, 417, + -1, -1, -1, -1, -1, -1, 424, -1, -1, -1, + -1, -1, -1, -1, -1, 433, -1, -1, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, -1, -1, -1, -1, + -1, 101, 460, 103, 104, 105, 106, 107, -1, 109, + 110, 111, -1, -1, -1, -1, -1, -1, -1, 119, + -1, -1, 122, -1, 124, -1, -1, 127, -1, -1, + -1, -1, -1, -1, -1, -1, 494, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 507, + -1, -1, -1, -1, -1, -1, 514, -1, -1, -1, + 518, 519, 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, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 48, -1, -1, 3, 4, + 5, 6, 7, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 22, -1, 24, + -1, 26, 27, 28, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 38, 39, -1, -1, -1, -1, -1, + -1, -1, -1, 116, -1, -1, 119, -1, -1, 122, + -1, 124, 125, -1, -1, -1, 61, -1, -1, -1, + -1, -1, -1, 116, -1, -1, 119, -1, -1, 122, + -1, 124, 125, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 3, 4, -1, -1, 7, 101, -1, 103, 104, + 105, 106, 107, -1, 109, 110, 111, -1, -1, 20, + -1, 22, -1, 24, 26, 27, 28, 122, -1, -1, + 31, 32, 33, -1, -1, -1, 38, 39, -1, -1, + 41, 42, 43, 44, 45, 46, 47, -1, -1, 50, + 51, -1, -1, -1, -1, -1, -1, 58, -1, 61, + -1, 62, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, -1, -1, -1, -1, -1, 101, + -1, 103, 104, 105, 106, 107, -1, 109, 110, 111, + -1, -1, -1, -1, -1, -1, -1, -1, 5, 6, + 122, 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, + -1, -1, 48, -1, 5, 6, -1, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, -1, 24, -1, -1, -1, -1, -1, 116, + -1, -1, 119, -1, -1, 122, 37, 124, -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, + 116, -1, -1, 119, -1, -1, 122, 37, 124, -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, 116, -1, -1, 119, -1, + -1, 122, -1, 124, -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, 116, -1, -1, 119, + -1, -1, 122, -1, 124, -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, 116, -1, -1, + 119, -1, -1, 122, -1, 124, -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, 116, -1, + -1, 119, -1, -1, 122, -1, 124, -1, -1, -1, + -1, -1, 48, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 116, + -1, -1, 119, -1, -1, 122, -1, 124, -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, -1, + 116, -1, -1, 119, -1, -1, 122, -1, 124, 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, -1, -1, 101, 102, + 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, + 113 +}; -/* 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. */ +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const unsigned char yystos[] = +{ + 0, 159, 160, 161, 0, 25, 31, 41, 42, 43, + 44, 45, 46, 47, 62, 140, 178, 180, 182, 189, + 22, 24, 51, 58, 62, 139, 171, 182, 183, 61, + 64, 65, 66, 67, 68, 69, 70, 141, 176, 23, + 190, 191, 30, 125, 179, 190, 52, 53, 54, 71, + 168, 114, 61, 20, 45, 47, 50, 140, 114, 45, + 47, 181, 24, 166, 4, 5, 6, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 48, 116, 119, 122, 124, 129, 148, 149, 150, + 151, 152, 171, 186, 29, 124, 177, 139, 194, 114, + 114, 114, 114, 119, 169, 166, 148, 32, 33, 158, + 158, 158, 158, 176, 4, 4, 4, 8, 125, 152, + 153, 171, 117, 126, 35, 49, 59, 60, 72, 73, + 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, + 94, 95, 96, 97, 98, 101, 102, 103, 104, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 131, 132, + 133, 134, 192, 198, 199, 201, 202, 24, 55, 56, + 167, 4, 24, 24, 170, 150, 150, 150, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 135, + 136, 138, 150, 155, 120, 120, 115, 125, 117, 37, + 153, 154, 150, 188, 59, 8, 188, 9, 21, 10, + 11, 12, 13, 14, 15, 16, 17, 135, 136, 137, + 141, 150, 150, 188, 150, 150, 195, 188, 188, 188, + 188, 188, 188, 188, 188, 150, 150, 150, 188, 141, + 99, 100, 115, 121, 164, 165, 163, 27, 28, 3, + 4, 130, 4, 7, 26, 38, 39, 101, 103, 104, + 109, 110, 111, 119, 122, 124, 127, 131, 132, 133, + 134, 156, 186, 162, 152, 152, 152, 37, 150, 173, + 174, 175, 115, 118, 3, 4, 7, 26, 27, 28, + 38, 39, 61, 122, 156, 185, 186, 187, 187, 187, + 187, 148, 115, 143, 115, 143, 187, 119, 115, 36, + 115, 115, 115, 115, 115, 115, 115, 187, 187, 187, + 115, 148, 150, 188, 24, 115, 146, 146, 146, 117, + 117, 117, 117, 117, 117, 121, 155, 157, 157, 125, + 157, 24, 117, 117, 117, 117, 146, 121, 123, 171, + 172, 115, 118, 37, 63, 184, 157, 115, 115, 187, + 15, 57, 15, 115, 200, 187, 119, 150, 188, 150, + 188, 188, 188, 150, 150, 115, 115, 115, 188, 187, + 187, 115, 34, 57, 144, 147, 155, 155, 155, 155, + 155, 155, 115, 121, 123, 125, 155, 155, 155, 155, + 37, 173, 144, 145, 24, 123, 21, 21, 117, 187, + 4, 187, 188, 196, 115, 187, 115, 115, 115, 187, + 187, 187, 117, 150, 24, 4, 146, 200, 36, 115, + 115, 115, 115, 155, 115, 115, 115, 115, 57, 142, + 115, 187, 187, 196, 197, 115, 143, 143, 115, 187, + 115, 188, 188, 188, 197, 187, 118, 150, 155, 155, + 155, 155, 155, 155, 155, 155, 4, 24, 115, 119, + 118, 188, 121, 187, 118, 118, 115, 118, 115, 115, + 118, 118, 118, 118, 21, 121, 137, 193, 36, 121, + 155, 155, 155, 187, 185, 121, 137, 21, 118, 118, + 118, 115, 185, 187, 21, 115, 76, 187, 21, 21, + 187, 187 +}; #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 yyerrlab1 -/* 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 yyerrorlab + + +/* Like YYERROR except do call yyerror. This remains here temporarily + to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ + #define YYFAIL goto yyerrlab + #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(token, value) \ + +#define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ - { yychar = (token), yylval = (value); \ - yychar1 = YYTRANSLATE (yychar); \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK; \ goto yybackup; \ } \ else \ - { yyerror ("syntax error: cannot back up"); YYERROR; } \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ while (0) + #define YYTERROR 1 #define YYERRCODE 256 -#ifndef YYPURE -#define YYLEX yylex() + +/* 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) #endif -#ifdef YYPURE -#ifdef YYLSP_NEEDED -#ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) -#else -#define YYLEX yylex(&yylval, &yylloc) + +/* 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 #endif -#else /* not YYLSP_NEEDED */ + + +/* YYLEX -- calling `yylex' with the right arguments. */ + #ifdef YYLEX_PARAM -#define YYLEX yylex(&yylval, YYLEX_PARAM) +# define YYLEX yylex (YYLEX_PARAM) #else -#define YYLEX yylex(&yylval) -#endif -#endif /* not YYLSP_NEEDED */ +# define YYLEX yylex () #endif -/* If nonreentrant, generate the variables here */ +/* Enable debugging if requested. */ +#if YYDEBUG -#ifndef YYPURE +# 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) -int yychar; /* the lookahead symbol */ -YYSTYPE yylval; /* the semantic value of the */ - /* lookahead symbol */ +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ -#ifdef YYLSP_NEEDED -YYLTYPE yylloc; /* location data for 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; #endif +{ + YYFPRINTF (stderr, "Stack now"); + for (/* Nothing. */; bottom <= top; ++bottom) + YYFPRINTF (stderr, " %d", *bottom); + YYFPRINTF (stderr, "\n"); +} -int yynerrs; /* number of parse errors so far */ -#endif /* not YYPURE */ +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) -#if YYDEBUG != 0 -int yydebug; /* nonzero means print parse trace */ -/* Since this is uninitialized, it does not stop multiple parsers - from coexisting. */ + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yy_reduce_print (int yyrule) +#else +static void +yy_reduce_print (yyrule) + int yyrule; #endif +{ + int yyi; + unsigned 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 is the maximum size the stacks can grow to - (effective only if the built-in stack extension method is used). */ +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). -#if YYMAXDEPTH == 0 -#undef YYMAXDEPTH -#endif + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ #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 -/* 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 YYERROR_VERBOSE + +# ifndef yystrlen +# if defined (__GLIBC__) && defined (_STRING_H) +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +static YYSIZE_T +# if defined (__STDC__) || defined (__cplusplus) +yystrlen (const char *yystr) +# else +yystrlen (yystr) + const char *yystr; +# endif { - register char *f = from; - register char *t = to; - register int i = count; + const char *yys = yystr; - while (i-- > 0) - *t++ = *f++; + 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; -#else /* __cplusplus */ + while ((*yyd++ = *yys++) != '\0') + continue; -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ -static void -__yy_memcpy (char *to, char *from, unsigned int count) + 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) { - register char *t = to; - register char *f = from; - register int i = 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: ; + } + + if (! yyres) + return yystrlen (yystr); - while (i-- > 0) - *t++ = *f++; + return yystpcpy (yyres, yystr) - yyres; } +# endif + +#endif /* YYERROR_VERBOSE */ + + +#if YYDEBUG +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) +#else +static void +yysymprint (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE *yyvaluep; #endif +{ + /* Pacify ``unused variable'' warnings. */ + (void) yyvaluep; + + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif + switch (yytype) + { + default: + break; + } + YYFPRINTF (yyoutput, ")"); +} + +#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; + } +} -#line 217 "/usr/share/bison.simple" -/* The user can define YYPARSE_PARAM as the name of an argument to be passed - into yyparse. The argument should have type void *. - It should actually point to an object. - Grammar actions can access the variable by casting it - to the proper pointer type. */ +/* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM -#ifdef __cplusplus -#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM -#define YYPARSE_PARAM_DECL -#else /* not __cplusplus */ -#define YYPARSE_PARAM_ARG YYPARSE_PARAM -#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; -#endif /* not __cplusplus */ -#else /* not YYPARSE_PARAM */ -#define YYPARSE_PARAM_ARG -#define YYPARSE_PARAM_DECL -#endif /* not YYPARSE_PARAM */ +# 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. | +`----------*/ -/* Prevent warning if -Wstrict-prototypes. */ -#ifdef __GNUC__ #ifdef YYPARSE_PARAM -int yyparse (void *); +# if defined (__STDC__) || defined (__cplusplus) +int yyparse (void *YYPARSE_PARAM) +# else +int yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +# endif +#else /* ! YYPARSE_PARAM */ +#if defined (__STDC__) || defined (__cplusplus) +int +yyparse (void) #else -int yyparse (void); +int +yyparse () + #endif #endif - -int -yyparse(YYPARSE_PARAM_ARG) - YYPARSE_PARAM_DECL { - register int yystate; - register int yyn; - register short *yyssp; - register YYSTYPE *yyvsp; - int yyerrstatus; /* number of tokens to shift before error messages enabled */ - int yychar1 = 0; /* lookahead token as an internal (translated) token number */ - - short yyssa[YYINITDEPTH]; /* the state stack */ - YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ - - short *yyss = yyssa; /* refer to the stacks thru separate pointers */ - YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ - -#ifdef YYLSP_NEEDED - YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; + + 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; + + -#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) -#else #define YYPOPSTACK (yyvsp--, yyssp--) -#endif - int yystacksize = YYINITDEPTH; - int yyfree_stacks = 0; + YYSIZE_T yystacksize = YYINITDEPTH; -#ifdef YYPURE - int yychar; - YYSTYPE yylval; - int yynerrs; -#ifdef YYLSP_NEEDED - YYLTYPE yylloc; -#endif -#endif + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; - 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; -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Starting parse\n"); -#endif + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; @@ -2180,742 +2843,749 @@ so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss - 1; + yyssp = yyss; yyvsp = yyvs; -#ifdef YYLSP_NEEDED - yylsp = yyls; -#endif -/* Push a new state, which is found in yystate . */ -/* In all cases, when you get here, the value and location stacks - have just been pushed. so pushing a state here evens the stacks. */ -yynewstate: - - *++yyssp = yystate; - - if (yyssp >= yyss + yystacksize - 1) - { - /* Give user a chance to reallocate the stack */ - /* Use copies of these so that the &'s don't force the real ones into memory. */ - YYSTYPE *yyvs1 = yyvs; - short *yyss1 = yyss; -#ifdef YYLSP_NEEDED - YYLTYPE *yyls1 = yyls; -#endif + goto yysetstate; + +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. so pushing a state here evens the stacks. + */ + yyssp++; + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) + { /* Get the current used size of the three stacks, in elements. */ - int size = yyssp - yyss + 1; + YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow - /* Each stack pointer address is followed by the size of - the data in use in that stack, in bytes. */ -#ifdef YYLSP_NEEDED - /* This used to be a conditional around just the two extra args, - but that might be undefined if yyoverflow is a macro. */ - yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yyls1, size * sizeof (*yylsp), - &yystacksize); -#else - yyoverflow("parser stack overflow", - &yyss1, size * sizeof (*yyssp), - &yyvs1, size * sizeof (*yyvsp), - &yystacksize); -#endif + { + /* 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), - yyss = yyss1; yyvs = yyvs1; -#ifdef YYLSP_NEEDED - yyls = yyls1; -#endif + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } #else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyexhaustedlab; +# else /* Extend the stack our own way. */ - if (yystacksize >= YYMAXDEPTH) - { - yyerror("parser stack overflow"); - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); -#endif - } - return 2; - } + if (YYMAXDEPTH <= yystacksize) + goto yyexhaustedlab; yystacksize *= 2; - if (yystacksize > YYMAXDEPTH) + if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; -#ifndef YYSTACK_USE_ALLOCA - yyfree_stacks = 1; -#endif - yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); - __yy_memcpy ((char *)yyss, (char *)yyss1, - size * (unsigned int) sizeof (*yyssp)); - yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); - __yy_memcpy ((char *)yyvs, (char *)yyvs1, - size * (unsigned int) sizeof (*yyvsp)); -#ifdef YYLSP_NEEDED - yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); - __yy_memcpy ((char *)yyls, (char *)yyls1, - size * (unsigned int) sizeof (*yylsp)); -#endif + + { + 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 #endif /* no yyoverflow */ - yyssp = yyss + size - 1; - yyvsp = yyvs + size - 1; -#ifdef YYLSP_NEEDED - yylsp = yyls + size - 1; -#endif + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Stack size increased to %d\n", yystacksize); -#endif - if (yyssp >= yyss + yystacksize - 1) + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) YYABORT; } -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Entering state %d\n", yystate); -#endif + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); goto yybackup; - yybackup: + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: /* Do appropriate processing given the current state. */ -/* Read a lookahead token if we need one and don't already have one. */ +/* 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 lookahead token. */ + /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; - if (yyn == YYFLAG) + if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a lookahead token if don't already have one. */ - - /* yychar is either YYEMPTY or YYEOF - or a valid token in external form. */ + /* Not known => get a look-ahead token if don't already have one. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Reading a token: "); -#endif + YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } - /* Convert token to internal form (in yychar1) for indexing tables with */ - - if (yychar <= 0) /* This means end of input. */ + if (yychar <= YYEOF) { - yychar1 = 0; - yychar = YYEOF; /* Don't call YYLEX any more */ - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Now at end of input.\n"); -#endif + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); } else { - yychar1 = YYTRANSLATE(yychar); - -#if YYDEBUG != 0 - if (yydebug) - { - fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); - /* Give the individual parser a way to print the precise meaning - of a token, for further debugging info. */ -#ifdef YYPRINT - YYPRINT (stderr, yychar, yylval); -#endif - fprintf (stderr, ")\n"); - } -#endif + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } - yyn += yychar1; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; - yyn = yytable[yyn]; - - /* 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) { - if (yyn == YYFLAG) + if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } - else if (yyn == 0) - goto yyerrlab; if (yyn == YYFINAL) YYACCEPT; - /* Shift the lookahead token. */ - -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); -#endif + /* Shift the look-ahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* 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; -/* Do the default action for the current state. */ -yydefault: +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; + goto yyreduce; + -/* Do a reduction. yyn is the number of a rule to reduce with. */ +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ 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; - - fprintf (stderr, "Reducing via rule %d (line %d), ", - yyn, yyrline[yyn]); - - /* Print the symbols being reduced, and their result. */ - for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) - fprintf (stderr, "%s ", yytname[yyrhs[i]]); - fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); - } -#endif + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; - switch (yyn) { -case 2: -#line 1140 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (yyvsp[0].UIntVal > (uint32_t)INT32_MAX) // Outside of my range! + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 3: +#line 1164 "/proj/llvm/llvm-3/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 4: -#line 1149 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (yyvsp[0].UInt64Val > (uint64_t)INT64_MAX) // Outside of my range! +;} + break; + + case 5: +#line 1173 "/proj/llvm/llvm-3/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 37: -#line 1173 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.StrVal = yyvsp[-1].StrVal; +;} + break; + + case 39: +#line 1197 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.StrVal) = (yyvsp[-1].StrVal); CHECK_FOR_ERROR - ; - break;} -case 38: -#line 1177 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.StrVal = 0; + ;} + break; + + case 40: +#line 1201 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.StrVal) = 0; CHECK_FOR_ERROR - ; - break;} -case 39: -#line 1182 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Linkage = GlobalValue::InternalLinkage; ; - break;} -case 40: -#line 1183 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Linkage = GlobalValue::LinkOnceLinkage; ; - break;} -case 41: -#line 1184 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Linkage = GlobalValue::WeakLinkage; ; - break;} -case 42: -#line 1185 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Linkage = GlobalValue::AppendingLinkage; ; - break;} -case 43: -#line 1186 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Linkage = GlobalValue::DLLImportLinkage; ; - break;} -case 44: -#line 1187 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Linkage = GlobalValue::DLLExportLinkage; ; - break;} -case 45: -#line 1188 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Linkage = GlobalValue::ExternalWeakLinkage; ; - break;} -case 46: -#line 1189 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Linkage = GlobalValue::ExternalLinkage; ; - break;} -case 47: -#line 1191 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.UIntVal = CallingConv::C; ; - break;} -case 48: -#line 1192 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.UIntVal = CallingConv::C; ; - break;} -case 49: -#line 1193 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.UIntVal = CallingConv::CSRet; ; - break;} -case 50: -#line 1194 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.UIntVal = CallingConv::Fast; ; - break;} -case 51: -#line 1195 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.UIntVal = CallingConv::Cold; ; - break;} -case 52: -#line 1196 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.UIntVal = CallingConv::X86_StdCall; ; - break;} -case 53: -#line 1197 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.UIntVal = CallingConv::X86_FastCall; ; - break;} -case 54: -#line 1198 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if ((unsigned)yyvsp[0].UInt64Val != yyvsp[0].UInt64Val) + ;} + break; + + case 41: +#line 1206 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} + break; + + case 42: +#line 1207 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} + break; + + case 43: +#line 1208 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} + break; + + case 44: +#line 1209 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} + break; + + case 45: +#line 1210 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} + break; + + case 46: +#line 1211 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} + break; + + case 47: +#line 1212 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} + break; + + case 48: +#line 1213 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} + break; + + case 49: +#line 1215 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = CallingConv::C; ;} + break; + + case 50: +#line 1216 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = CallingConv::C; ;} + break; + + case 51: +#line 1217 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = CallingConv::CSRet; ;} + break; + + case 52: +#line 1218 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = CallingConv::Fast; ;} + break; + + case 53: +#line 1219 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = CallingConv::Cold; ;} + break; + + case 54: +#line 1220 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} + break; + + case 55: +#line 1221 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} + break; + + case 56: +#line 1222 "/proj/llvm/llvm-3/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 55: -#line 1207 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.UIntVal = 0; ; - break;} -case 56: -#line 1208 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.UIntVal = yyvsp[0].UInt64Val; - if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal)) + ;} + break; + + case 57: +#line 1231 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = 0; ;} + break; + + case 58: +#line 1232 "/proj/llvm/llvm-3/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 57: -#line 1214 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.UIntVal = 0; ; - break;} -case 58: -#line 1215 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.UIntVal = yyvsp[0].UInt64Val; - if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal)) +;} + break; + + case 59: +#line 1238 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.UIntVal) = 0; ;} + break; + + case 60: +#line 1239 "/proj/llvm/llvm-3/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 59: -#line 1223 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - for (unsigned i = 0, e = strlen(yyvsp[0].StrVal); i != e; ++i) - if (yyvsp[0].StrVal[i] == '"' || yyvsp[0].StrVal[i] == '\\') +;} + break; + + case 61: +#line 1247 "/proj/llvm/llvm-3/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 60: -#line 1231 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.StrVal = 0; ; - break;} -case 61: -#line 1232 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.StrVal = yyvsp[0].StrVal; ; - break;} -case 62: -#line 1237 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{; - break;} -case 63: -#line 1238 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{; - break;} -case 64: -#line 1239 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - CurGV->setSection(yyvsp[0].StrVal); - free(yyvsp[0].StrVal); +;} + break; + + case 62: +#line 1255 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.StrVal) = 0; ;} + break; + + case 63: +#line 1256 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.StrVal) = (yyvsp[0].StrVal); ;} + break; + + case 64: +#line 1261 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + {;} + break; + + case 65: +#line 1262 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + {;} + break; + + case 66: +#line 1263 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + CurGV->setSection((yyvsp[0].StrVal)); + free((yyvsp[0].StrVal)); CHECK_FOR_ERROR - ; - break;} -case 65: -#line 1244 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (yyvsp[0].UInt64Val != 0 && !isPowerOf2_32(yyvsp[0].UInt64Val)) + ;} + break; + + case 67: +#line 1268 "/proj/llvm/llvm-3/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 67: -#line 1258 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); ; - break;} -case 69: -#line 1259 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); ; - break;} -case 70: -#line 1261 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 69: +#line 1282 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;} + break; + + case 71: +#line 1283 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;} + break; + + case 72: +#line 1285 "/proj/llvm/llvm-3/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 84: -#line 1273 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.TypeVal = new PATypeHolder(OpaqueType::get()); + ;} + break; + + case 86: +#line 1297 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); CHECK_FOR_ERROR - ; - break;} -case 85: -#line 1277 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); + ;} + break; + + case 87: +#line 1301 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); CHECK_FOR_ERROR - ; - break;} -case 86: -#line 1281 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Named types are also simple types... - const Type* tmp = getTypeVal(yyvsp[0].ValIDVal); + ;} + break; + + case 88: +#line 1305 "/proj/llvm/llvm-3/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 87: -#line 1289 "/Users/sabre/cvs/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 89: +#line 1313 "/proj/llvm/llvm-3/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 88: -#line 1297 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Function derived type? + ;} + break; + + case 90: +#line 1321 "/proj/llvm/llvm-3/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 89: -#line 1310 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Sized array type? - yyval.TypeVal = new PATypeHolder(HandleUpRefs(ArrayType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val))); - delete yyvsp[-1].TypeVal; - CHECK_FOR_ERROR - ; - break;} -case 90: -#line 1315 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Packed array type? - const llvm::Type* ElemTy = yyvsp[-1].TypeVal->get(); - if ((unsigned)yyvsp[-3].UInt64Val != yyvsp[-3].UInt64Val) + (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 91: +#line 1334 "/proj/llvm/llvm-3/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 92: +#line 1339 "/proj/llvm/llvm-3/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 91: -#line 1327 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Structure type? + ;} + break; + + case 93: +#line 1351 "/proj/llvm/llvm-3/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; + (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); + delete (yyvsp[-1].TypeList); + CHECK_FOR_ERROR + ;} + break; + + case 94: +#line 1361 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { // Empty structure type? + (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector())); CHECK_FOR_ERROR - ; - break;} -case 92: -#line 1337 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Empty structure type? - yyval.TypeVal = new PATypeHolder(StructType::get(std::vector())); - CHECK_FOR_ERROR - ; - break;} -case 93: -#line 1341 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Pointer type? - if (*yyvsp[-1].TypeVal == Type::LabelTy) + ;} + break; + + case 95: +#line 1365 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { // Pointer type? + if (*(yyvsp[-1].TypeVal) == Type::LabelTy) GEN_ERROR("Cannot form a pointer to a basic block"); - yyval.TypeVal = new PATypeHolder(HandleUpRefs(PointerType::get(*yyvsp[-1].TypeVal))); - delete yyvsp[-1].TypeVal; + (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal)))); + delete (yyvsp[-1].TypeVal); CHECK_FOR_ERROR - ; - break;} -case 94: -#line 1352 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.TypeList = new std::list(); - yyval.TypeList->push_back(*yyvsp[0].TypeVal); delete yyvsp[0].TypeVal; + ;} + break; + + case 96: +#line 1376 "/proj/llvm/llvm-3/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 95: -#line 1357 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - (yyval.TypeList=yyvsp[-2].TypeList)->push_back(*yyvsp[0].TypeVal); delete yyvsp[0].TypeVal; + ;} + break; + + case 97: +#line 1381 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); CHECK_FOR_ERROR - ; - break;} -case 97: -#line 1364 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - (yyval.TypeList=yyvsp[-2].TypeList)->push_back(Type::VoidTy); + ;} + break; + + case 99: +#line 1388 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(Type::VoidTy); CHECK_FOR_ERROR - ; - break;} -case 98: -#line 1368 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - (yyval.TypeList = new std::list())->push_back(Type::VoidTy); + ;} + break; + + case 100: +#line 1392 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + ((yyval.TypeList) = new std::list())->push_back(Type::VoidTy); CHECK_FOR_ERROR - ; - break;} -case 99: -#line 1372 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.TypeList = new std::list(); + ;} + break; + + case 101: +#line 1396 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.TypeList) = new std::list(); CHECK_FOR_ERROR - ; - break;} -case 100: -#line 1383 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Nonempty unsized arr - const ArrayType *ATy = dyn_cast(yyvsp[-3].TypeVal->get()); + ;} + break; + + case 102: +#line 1407 "/proj/llvm/llvm-3/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 101: -#line 1409 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - const ArrayType *ATy = dyn_cast(yyvsp[-2].TypeVal->get()); + ;} + break; + + case 103: +#line 1433 "/proj/llvm/llvm-3/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 102: -#line 1423 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - const ArrayType *ATy = dyn_cast(yyvsp[-2].TypeVal->get()); + ;} + break; + + case 104: +#line 1447 "/proj/llvm/llvm-3/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(ConstantInt::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(ConstantInt::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 103: -#line 1453 "/Users/sabre/cvs/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 105: +#line 1477 "/proj/llvm/llvm-3/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 104: -#line 1479 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - const StructType *STy = dyn_cast(yyvsp[-3].TypeVal->get()); + ;} + break; + + case 106: +#line 1503 "/proj/llvm/llvm-3/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 105: -#line 1500 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - const StructType *STy = dyn_cast(yyvsp[-2].TypeVal->get()); + ;} + break; + + case 107: +#line 1524 "/proj/llvm/llvm-3/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 106: -#line 1513 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - const PointerType *PTy = dyn_cast(yyvsp[-1].TypeVal->get()); + ;} + break; + + case 108: +#line 1537 "/proj/llvm/llvm-3/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 107: -#line 1523 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ConstVal = UndefValue::get(yyvsp[-1].TypeVal->get()); - delete yyvsp[-1].TypeVal; + ;} + break; + + case 109: +#line 1547 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get()); + delete (yyvsp[-1].TypeVal); CHECK_FOR_ERROR - ; - break;} -case 108: -#line 1528 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - const PointerType *Ty = dyn_cast(yyvsp[-1].TypeVal->get()); + ;} + break; + + case 110: +#line 1552 "/proj/llvm/llvm-3/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!"); @@ -2929,7 +3599,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; @@ -2944,14 +3614,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; @@ -2966,154 +3636,165 @@ } // 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 109: -#line 1589 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (yyvsp[-1].TypeVal->get() != yyvsp[0].ConstVal->getType()) + ;} + break; + + case 111: +#line 1613 "/proj/llvm/llvm-3/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 110: -#line 1596 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - const Type *Ty = yyvsp[-1].TypeVal->get(); + ;} + break; + + case 112: +#line 1620 "/proj/llvm/llvm-3/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 111: -#line 1605 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ // integral constants - if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].SInt64Val)) + ;} + break; + + case 113: +#line 1629 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { // integral constants + if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val))) GEN_ERROR("Constant value doesn't fit in type!"); - yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].SInt64Val); + (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)); CHECK_FOR_ERROR - ; - break;} -case 112: -#line 1611 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ // integral constants - if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].UInt64Val)) + ;} + break; + + case 114: +#line 1635 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { // integral constants + if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val))) GEN_ERROR("Constant value doesn't fit in type!"); - yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].UInt64Val); + (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)); + CHECK_FOR_ERROR + ;} + break; + + case 115: +#line 1641 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { // Boolean constants + (yyval.ConstVal) = ConstantBool::getTrue(); + CHECK_FOR_ERROR + ;} + break; + + case 116: +#line 1645 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { // Boolean constants + (yyval.ConstVal) = ConstantBool::getFalse(); CHECK_FOR_ERROR - ; - break;} -case 113: -#line 1617 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Boolean constants - yyval.ConstVal = ConstantBool::getTrue(); - CHECK_FOR_ERROR - ; - break;} -case 114: -#line 1621 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Boolean constants - yyval.ConstVal = ConstantBool::getFalse(); - CHECK_FOR_ERROR - ; - break;} -case 115: -#line 1625 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Float & Double constants - if (!ConstantFP::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].FPVal)) + ;} + break; + + case 117: +#line 1649 "/proj/llvm/llvm-3/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 116: -#line 1633 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (!yyvsp[-3].ConstVal->getType()->isFirstClassType()) + ;} + break; + + case 118: +#line 1657 "/proj/llvm/llvm-3/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 117: -#line 1644 "/Users/sabre/cvs/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 119: +#line 1668 "/proj/llvm/llvm-3/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 (ConstantInt *CUI = dyn_cast((*yyvsp[-1].ValueList)[i])) + if (ConstantInt *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 118: -#line 1676 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (yyvsp[-5].ConstVal->getType() != Type::BoolTy) + ;} + break; + + case 120: +#line 1700 "/proj/llvm/llvm-3/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 119: -#line 1684 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) + ;} + break; + + case 121: +#line 1708 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) GEN_ERROR("Binary operator types must match!"); // First, make sure we're dealing with the right opcode by upgrading from // obsolete versions. - sanitizeOpCode(yyvsp[-5].BinaryOpVal,yyvsp[-3].ConstVal->getType()); + sanitizeOpCode((yyvsp[-5].BinaryOpVal),(yyvsp[-3].ConstVal)->getType()); CHECK_FOR_ERROR; // 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.opcode, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); + if (!isa((yyvsp[-3].ConstVal)->getType())) { + (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal).opcode, (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); } else { const Type *IntPtrTy = 0; switch (CurModule.CurrentModule->getPointerSize()) { @@ -3121,138 +3802,157 @@ case Module::Pointer64: IntPtrTy = Type::LongTy; break; default: GEN_ERROR("invalid pointer binary constant expr!"); } - yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal.opcode, 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).opcode, 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 120: -#line 1711 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) + ;} + break; + + case 122: +#line 1735 "/proj/llvm/llvm-3/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.opcode, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); + (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal).opcode, (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); CHECK_FOR_ERROR - ; - break;} -case 121: -#line 1722 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) + ;} + break; + + case 123: +#line 1746 "/proj/llvm/llvm-3/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.opcode, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); + (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal).opcode, (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); CHECK_FOR_ERROR - ; - break;} -case 122: -#line 1728 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (yyvsp[-1].ConstVal->getType() != Type::UByteTy) + ;} + break; + + case 124: +#line 1752 "/proj/llvm/llvm-3/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.opcode, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); + // Handle opcode upgrade situations + sanitizeOpCode((yyvsp[-5].OtherOpVal), (yyvsp[-3].ConstVal)->getType()); + CHECK_FOR_ERROR; + (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].OtherOpVal).opcode, (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); CHECK_FOR_ERROR - ; - break;} -case 123: -#line 1736 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (!ExtractElementInst::isValidOperands(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal)) + ;} + break; + + case 125: +#line 1763 "/proj/llvm/llvm-3/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 124: -#line 1742 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (!InsertElementInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal)) + ;} + break; + + case 126: +#line 1769 "/proj/llvm/llvm-3/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 125: -#line 1748 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (!ShuffleVectorInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal)) + ;} + break; + + case 127: +#line 1775 "/proj/llvm/llvm-3/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 126: -#line 1757 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(yyvsp[0].ConstVal); + ;} + break; + + case 128: +#line 1784 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal)); CHECK_FOR_ERROR - ; - break;} -case 127: -#line 1761 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ConstVector = new std::vector(); - yyval.ConstVector->push_back(yyvsp[0].ConstVal); + ;} + break; + + case 129: +#line 1788 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ConstVector) = new std::vector(); + (yyval.ConstVector)->push_back((yyvsp[0].ConstVal)); CHECK_FOR_ERROR - ; - break;} -case 128: -#line 1769 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.BoolVal = false; ; - break;} -case 129: -#line 1769 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.BoolVal = true; ; - break;} -case 130: -#line 1779 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ModuleVal = ParserResult = yyvsp[0].ModuleVal; + ;} + break; + + case 130: +#line 1796 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.BoolVal) = false; ;} + break; + + case 131: +#line 1796 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.BoolVal) = true; ;} + break; + + case 132: +#line 1806 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ModuleVal) = ParserResult = (yyvsp[0].ModuleVal); CurModule.ModuleDone(); CHECK_FOR_ERROR; -; - break;} -case 131: -#line 1787 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ModuleVal = yyvsp[-1].ModuleVal; +;} + break; + + case 133: +#line 1814 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); CurFun.FunctionDone(); CHECK_FOR_ERROR - ; - break;} -case 132: -#line 1792 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ModuleVal = yyvsp[-1].ModuleVal; + ;} + break; + + case 134: +#line 1819 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); CHECK_FOR_ERROR - ; - break;} -case 133: -#line 1796 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ModuleVal = yyvsp[-3].ModuleVal; + ;} + break; + + case 135: +#line 1823 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ModuleVal) = (yyvsp[-3].ModuleVal); CHECK_FOR_ERROR - ; - break;} -case 134: -#line 1800 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ModuleVal = yyvsp[-1].ModuleVal; + ;} + break; + + case 136: +#line 1827 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); CHECK_FOR_ERROR - ; - break;} -case 135: -#line 1804 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ModuleVal = CurModule.CurrentModule; + ;} + break; + + case 137: +#line 1831 "/proj/llvm/llvm-3/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; @@ -3263,11 +3963,12 @@ } } CHECK_FOR_ERROR - ; - break;} -case 136: -#line 1819 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 138: +#line 1846 "/proj/llvm/llvm-3/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: // @@ -3277,272 +3978,304 @@ // 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; + delete (yyvsp[0].TypeVal); CHECK_FOR_ERROR - ; - break;} -case 137: -#line 1841 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Function prototypes can be in const pool - CHECK_FOR_ERROR - ; - break;} -case 138: -#line 1844 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Asm blocks can be in the const pool - CHECK_FOR_ERROR - ; - break;} -case 139: -#line 1847 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (yyvsp[0].ConstVal == 0) + ;} + break; + + case 139: +#line 1868 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { // Function prototypes can be in const pool + CHECK_FOR_ERROR + ;} + break; + + case 140: +#line 1871 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { // Asm blocks can be in the const pool + CHECK_FOR_ERROR + ;} + break; + + case 141: +#line 1874 "/proj/llvm/llvm-3/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 140: -#line 1852 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 142: +#line 1879 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { CurGV = 0; - ; - break;} -case 141: -#line 1855 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - CurGV = ParseGlobalVariable(yyvsp[-3].StrVal, GlobalValue::ExternalLinkage, yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0); + ;} + break; + + case 143: +#line 1882 "/proj/llvm/llvm-3/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 142: -#line 1859 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ + delete (yyvsp[0].TypeVal); + ;} + break; + + case 144: +#line 1886 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { CurGV = 0; CHECK_FOR_ERROR - ; - break;} -case 143: -#line 1863 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - CurGV = ParseGlobalVariable(yyvsp[-3].StrVal, GlobalValue::DLLImportLinkage, yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0); + ;} + break; + + case 145: +#line 1890 "/proj/llvm/llvm-3/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 144: -#line 1867 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ + delete (yyvsp[0].TypeVal); + ;} + break; + + case 146: +#line 1894 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { CurGV = 0; CHECK_FOR_ERROR - ; - break;} -case 145: -#line 1871 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 147: +#line 1898 "/proj/llvm/llvm-3/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 146: -#line 1876 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ + delete (yyvsp[0].TypeVal); + ;} + break; + + case 148: +#line 1903 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { CurGV = 0; CHECK_FOR_ERROR - ; - break;} -case 147: -#line 1880 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - CHECK_FOR_ERROR - ; - break;} -case 148: -#line 1883 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 149: +#line 1907 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { CHECK_FOR_ERROR - ; - break;} -case 149: -#line 1886 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - ; - break;} -case 150: -#line 1890 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 150: +#line 1910 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + CHECK_FOR_ERROR + ;} + break; + + case 151: +#line 1913 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + ;} + break; + + case 152: +#line 1917 "/proj/llvm/llvm-3/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 151: -#line 1903 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Endianness = Module::BigEndian; ; - break;} -case 152: -#line 1904 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.Endianness = Module::LittleEndian; ; - break;} -case 153: -#line 1906 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - CurModule.CurrentModule->setEndianness(yyvsp[0].Endianness); +;} + break; + + case 153: +#line 1930 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.Endianness) = Module::BigEndian; ;} + break; + + case 154: +#line 1931 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.Endianness) = Module::LittleEndian; ;} + break; + + case 155: +#line 1933 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + CurModule.CurrentModule->setEndianness((yyvsp[0].Endianness)); CHECK_FOR_ERROR - ; - break;} -case 154: -#line 1910 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (yyvsp[0].UInt64Val == 32) + ;} + break; + + case 156: +#line 1937 "/proj/llvm/llvm-3/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 155: -#line 1919 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - CurModule.CurrentModule->setTargetTriple(yyvsp[0].StrVal); - free(yyvsp[0].StrVal); - ; - break;} -case 156: -#line 1923 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - CurModule.CurrentModule->setDataLayout(yyvsp[0].StrVal); - free(yyvsp[0].StrVal); - ; - break;} -case 158: -#line 1930 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal); - free(yyvsp[0].StrVal); + ;} + break; + + case 157: +#line 1946 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal)); + free((yyvsp[0].StrVal)); + ;} + break; + + case 158: +#line 1950 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal)); + free((yyvsp[0].StrVal)); + ;} + break; + + case 160: +#line 1957 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); + free((yyvsp[0].StrVal)); CHECK_FOR_ERROR - ; - break;} -case 159: -#line 1935 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal); - free(yyvsp[0].StrVal); + ;} + break; + + case 161: +#line 1962 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); + free((yyvsp[0].StrVal)); CHECK_FOR_ERROR - ; - break;} -case 160: -#line 1940 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 162: +#line 1967 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { CHECK_FOR_ERROR - ; - break;} -case 164: -#line 1950 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.StrVal = 0; ; - break;} -case 165: -#line 1952 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (*yyvsp[-1].TypeVal == Type::VoidTy) + ;} + break; + + case 166: +#line 1977 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.StrVal) = 0; ;} + break; + + case 167: +#line 1979 "/proj/llvm/llvm-3/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 166: -#line 1959 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ArgList = yyvsp[-2].ArgList; - yyvsp[-2].ArgList->push_back(*yyvsp[0].ArgVal); - delete yyvsp[0].ArgVal; - CHECK_FOR_ERROR - ; - break;} -case 167: -#line 1965 "/Users/sabre/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 168: -#line 1972 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ArgList = yyvsp[0].ArgList; +;} + break; + + case 168: +#line 1986 "/proj/llvm/llvm-3/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 169: -#line 1976 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ArgList = yyvsp[-2].ArgList; - yyval.ArgList->push_back(std::pair >(); + (yyval.ArgList)->push_back(*(yyvsp[0].ArgVal)); + delete (yyvsp[0].ArgVal); + CHECK_FOR_ERROR + ;} + break; + + case 170: +#line 1999 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ArgList) = (yyvsp[0].ArgList); + CHECK_FOR_ERROR + ;} + break; + + case 171: +#line 2003 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ArgList) = (yyvsp[-2].ArgList); + (yyval.ArgList)->push_back(std::pair(new PATypeHolder(Type::VoidTy), 0)); CHECK_FOR_ERROR - ; - break;} -case 170: -#line 1982 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ArgList = new std::vector >(); - yyval.ArgList->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0)); + ;} + break; + + case 172: +#line 2009 "/proj/llvm/llvm-3/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 171: -#line 1987 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ArgList = 0; + ;} + break; + + case 173: +#line 2014 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ArgList) = 0; CHECK_FOR_ERROR - ; - break;} -case 172: -#line 1993 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - UnEscapeLexed(yyvsp[-5].StrVal); - std::string FunctionName(yyvsp[-5].StrVal); - free(yyvsp[-5].StrVal); // Free strdup'd memory! + ;} + break; + + case 174: +#line 2020 "/proj/llvm/llvm-3/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()) { @@ -3586,24 +4319,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... @@ -3611,123 +4344,140 @@ 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 175: -#line 2089 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.FunctionVal = CurFun.CurrentFunction; +;} + break; + + case 177: +#line 2116 "/proj/llvm/llvm-3/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 178: -#line 2099 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.FunctionVal = yyvsp[-1].FunctionVal; + (yyval.FunctionVal)->setLinkage((yyvsp[-2].Linkage)); +;} + break; + + case 180: +#line 2126 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); CHECK_FOR_ERROR -; - break;} -case 180: -#line 2105 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ CurFun.Linkage = GlobalValue::DLLImportLinkage; ; - break;} -case 181: -#line 2106 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ CurFun.Linkage = GlobalValue::DLLImportLinkage; ; - break;} -case 182: -#line 2108 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ CurFun.isDeclare = true; ; - break;} -case 183: -#line 2108 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.FunctionVal = CurFun.CurrentFunction; +;} + break; + + case 182: +#line 2132 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { CurFun.Linkage = GlobalValue::DLLImportLinkage; ;} + break; + + case 183: +#line 2133 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { CurFun.Linkage = GlobalValue::DLLImportLinkage; ;} + break; + + case 184: +#line 2135 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { CurFun.isDeclare = true; ;} + break; + + case 185: +#line 2135 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.FunctionVal) = CurFun.CurrentFunction; CurFun.FunctionDone(); CHECK_FOR_ERROR - ; - break;} -case 184: -#line 2118 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.BoolVal = false; + ;} + break; + + case 186: +#line 2145 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.BoolVal) = false; CHECK_FOR_ERROR - ; - break;} -case 185: -#line 2122 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.BoolVal = true; + ;} + break; + + case 187: +#line 2149 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.BoolVal) = true; CHECK_FOR_ERROR - ; - break;} -case 186: -#line 2127 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ // A reference to a direct constant - yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val); - CHECK_FOR_ERROR - ; - break;} -case 187: -#line 2131 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val); + ;} + break; + + case 188: +#line 2154 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { // A reference to a direct constant + (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val)); CHECK_FOR_ERROR - ; - break;} -case 188: -#line 2135 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Perhaps it's an FP constant? - yyval.ValIDVal = ValID::create(yyvsp[0].FPVal); - CHECK_FOR_ERROR - ; - break;} -case 189: -#line 2139 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ValIDVal = ValID::create(ConstantBool::getTrue()); + ;} + break; + + case 189: +#line 2158 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val)); CHECK_FOR_ERROR - ; - break;} -case 190: -#line 2143 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ValIDVal = ValID::create(ConstantBool::getFalse()); + ;} + break; + + case 190: +#line 2162 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { // Perhaps it's an FP constant? + (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal)); CHECK_FOR_ERROR - ; - break;} -case 191: -#line 2147 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ValIDVal = ValID::createNull(); + ;} + break; + + case 191: +#line 2166 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ValIDVal) = ValID::create(ConstantBool::getTrue()); CHECK_FOR_ERROR - ; - break;} -case 192: -#line 2151 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ValIDVal = ValID::createUndef(); + ;} + break; + + case 192: +#line 2170 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ValIDVal) = ValID::create(ConstantBool::getFalse()); + CHECK_FOR_ERROR + ;} + break; + + case 193: +#line 2174 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ValIDVal) = ValID::createNull(); CHECK_FOR_ERROR - ; - break;} -case 193: -#line 2155 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ // A vector zero constant. - yyval.ValIDVal = ValID::createZeroInit(); - CHECK_FOR_ERROR - ; - break;} -case 194: -#line 2159 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Nonempty unsized packed vector - const Type *ETy = (*yyvsp[-1].ConstVector)[0]->getType(); - int NumElements = yyvsp[-1].ConstVector->size(); + ;} + break; + + case 194: +#line 2178 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ValIDVal) = ValID::createUndef(); + CHECK_FOR_ERROR + ;} + break; + + case 195: +#line 2182 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { // A vector zero constant. + (yyval.ValIDVal) = ValID::createZeroInit(); + CHECK_FOR_ERROR + ;} + break; + + case 196: +#line 2186 "/proj/llvm/llvm-3/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( @@ -3739,98 +4489,108 @@ ); // 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; + (yyval.ValIDVal) = ValID::create(ConstantPacked::get(pt, *(yyvsp[-1].ConstVector))); + delete PTy; delete (yyvsp[-1].ConstVector); CHECK_FOR_ERROR - ; - break;} -case 195: -#line 2184 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ValIDVal = ValID::create(yyvsp[0].ConstVal); + ;} + break; + + case 197: +#line 2211 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal)); CHECK_FOR_ERROR - ; - break;} -case 196: -#line 2188 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - char *End = UnEscapeLexed(yyvsp[-2].StrVal, true); - std::string AsmStr = std::string(yyvsp[-2].StrVal, End); - End = UnEscapeLexed(yyvsp[0].StrVal, true); - std::string Constraints = std::string(yyvsp[0].StrVal, End); - yyval.ValIDVal = ValID::createInlineAsm(AsmStr, Constraints, yyvsp[-3].BoolVal); - free(yyvsp[-2].StrVal); - free(yyvsp[0].StrVal); - CHECK_FOR_ERROR - ; - break;} -case 197: -#line 2202 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Is it an integer reference...? - yyval.ValIDVal = ValID::create(yyvsp[0].SIntVal); - CHECK_FOR_ERROR - ; - break;} -case 198: -#line 2206 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Is it a named reference...? - yyval.ValIDVal = ValID::create(yyvsp[0].StrVal); - CHECK_FOR_ERROR - ; - break;} -case 201: -#line 2218 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ValueVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal); delete yyvsp[-1].TypeVal; + ;} + break; + + case 198: +#line 2215 "/proj/llvm/llvm-3/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 202: -#line 2223 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.FunctionVal = yyvsp[-1].FunctionVal; + ;} + break; + + case 199: +#line 2229 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { // Is it an integer reference...? + (yyval.ValIDVal) = ValID::create((yyvsp[0].SIntVal)); CHECK_FOR_ERROR - ; - break;} -case 203: -#line 2227 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Do not allow functions with 0 basic blocks - yyval.FunctionVal = yyvsp[-1].FunctionVal; - CHECK_FOR_ERROR - ; - break;} -case 204: -#line 2236 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - setValueName(yyvsp[0].TermInstVal, yyvsp[-1].StrVal); + ;} + break; + + case 200: +#line 2233 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { // Is it a named reference...? + (yyval.ValIDVal) = ValID::create((yyvsp[0].StrVal)); CHECK_FOR_ERROR - InsertValue(yyvsp[0].TermInstVal); + ;} + break; - yyvsp[-2].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal); - InsertValue(yyvsp[-2].BasicBlockVal); - yyval.BasicBlockVal = yyvsp[-2].BasicBlockVal; - CHECK_FOR_ERROR - ; - break;} -case 205: -#line 2247 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal); - yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal; + case 203: +#line 2245 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); delete (yyvsp[-1].TypeVal); + CHECK_FOR_ERROR + ;} + break; + + case 204: +#line 2250 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); + CHECK_FOR_ERROR + ;} + break; + + case 205: +#line 2254 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { // Do not allow functions with 0 basic blocks + (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); + CHECK_FOR_ERROR + ;} + break; + + case 206: +#line 2263 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal)); + 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); + CHECK_FOR_ERROR + ;} + break; + + case 207: +#line 2274 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal)); + (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal); CHECK_FOR_ERROR - ; - break;} -case 206: -#line 2252 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.BasicBlockVal = CurBB = getBBVal(ValID::create((int)CurFun.NextBBNum++), true); + ;} + break; + + case 208: +#line 2279 "/proj/llvm/llvm-3/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 @@ -3838,14 +4598,15 @@ // 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 207: -#line 2264 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.BasicBlockVal = CurBB = getBBVal(ValID::create(yyvsp[0].StrVal), true); + ;} + break; + + case 209: +#line 2291 "/proj/llvm/llvm-3/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 @@ -3853,90 +4614,97 @@ // 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 208: -#line 2277 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Return with a result... - yyval.TermInstVal = new ReturnInst(yyvsp[0].ValueVal); - CHECK_FOR_ERROR - ; - break;} -case 209: -#line 2281 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Return with no result... - yyval.TermInstVal = new ReturnInst(); - CHECK_FOR_ERROR - ; - break;} -case 210: -#line 2285 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Unconditional Branch... - BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal); - CHECK_FOR_ERROR - yyval.TermInstVal = new BranchInst(tmpBB); - ; - break;} -case 211: -#line 2290 "/Users/sabre/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 212: -#line 2299 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - Value* tmpVal = getVal(yyvsp[-7].PrimType, yyvsp[-6].ValIDVal); + ;} + break; + + case 210: +#line 2304 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { // Return with a result... + (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal)); + CHECK_FOR_ERROR + ;} + break; + + case 211: +#line 2308 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { // Return with no result... + (yyval.TermInstVal) = new ReturnInst(); + CHECK_FOR_ERROR + ;} + break; + + case 212: +#line 2312 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { // Unconditional Branch... + BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); + CHECK_FOR_ERROR + (yyval.TermInstVal) = new BranchInst(tmpBB); + ;} + break; + + case 213: +#line 2317 "/proj/llvm/llvm-3/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 214: +#line 2326 "/proj/llvm/llvm-3/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 213: -#line 2318 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - Value* tmpVal = getVal(yyvsp[-6].PrimType, yyvsp[-5].ValIDVal); + ;} + break; + + case 215: +#line 2345 "/proj/llvm/llvm-3/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 214: -#line 2328 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 216: +#line 2355 "/proj/llvm/llvm-3/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()); } @@ -3944,27 +4712,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) @@ -3974,248 +4742,272 @@ 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 215: -#line 2383 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.TermInstVal = new UnwindInst(); + ;} + break; + + case 217: +#line 2410 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.TermInstVal) = new UnwindInst(); CHECK_FOR_ERROR - ; - break;} -case 216: -#line 2387 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.TermInstVal = new UnreachableInst(); + ;} + break; + + case 218: +#line 2414 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.TermInstVal) = new UnreachableInst(); CHECK_FOR_ERROR - ; - break;} -case 217: -#line 2394 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.JumpTable = yyvsp[-5].JumpTable; - Constant *V = cast(getValNonImprovising(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal)); + ;} + break; + + case 219: +#line 2421 "/proj/llvm/llvm-3/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 218: -#line 2405 "/Users/sabre/cvs/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 220: +#line 2432 "/proj/llvm/llvm-3/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 219: -#line 2418 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ + (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB)); + ;} + break; + + case 221: +#line 2445 "/proj/llvm/llvm-3/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 220: -#line 2427 "/Users/sabre/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 221: -#line 2436 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.PHIList = yyvsp[-6].PHIList; - Value* tmpVal = getVal(yyvsp[-6].PHIList->front().first->getType(), yyvsp[-3].ValIDVal); +;} + break; + + case 222: +#line 2454 "/proj/llvm/llvm-3/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 223: +#line 2463 "/proj/llvm/llvm-3/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 222: -#line 2446 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ // Used for call statements, and memory insts... - yyval.ValueList = new std::vector(); - yyval.ValueList->push_back(yyvsp[0].ValueVal); - ; - break;} -case 223: -#line 2450 "/Users/sabre/cvs/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 224: +#line 2473 "/proj/llvm/llvm-3/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 225: +#line 2477 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ValueList) = (yyvsp[-2].ValueList); + (yyvsp[-2].ValueList)->push_back((yyvsp[0].ValueVal)); CHECK_FOR_ERROR - ; - break;} -case 225: -#line 2457 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ yyval.ValueList = 0; ; - break;} -case 226: -#line 2459 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.BoolVal = true; + ;} + break; + + case 227: +#line 2484 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { (yyval.ValueList) = 0; ;} + break; + + case 228: +#line 2486 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.BoolVal) = true; CHECK_FOR_ERROR - ; - break;} -case 227: -#line 2463 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.BoolVal = false; + ;} + break; + + case 229: +#line 2490 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.BoolVal) = false; CHECK_FOR_ERROR - ; - break;} -case 228: -#line 2468 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (!(*yyvsp[-3].TypeVal)->isInteger() && !(*yyvsp[-3].TypeVal)->isFloatingPoint() && - !isa((*yyvsp[-3].TypeVal).get())) + ;} + break; + + case 230: +#line 2495 "/proj/llvm/llvm-3/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.opcode == Instruction::URem || - yyvsp[-4].BinaryOpVal.opcode == Instruction::SRem || - yyvsp[-4].BinaryOpVal.opcode == Instruction::FRem)) + if (isa((*(yyvsp[-3].TypeVal)).get()) && + ((yyvsp[-4].BinaryOpVal).opcode == Instruction::URem || + (yyvsp[-4].BinaryOpVal).opcode == Instruction::SRem || + (yyvsp[-4].BinaryOpVal).opcode == Instruction::FRem)) GEN_ERROR("U/S/FRem not supported on packed types!"); // Upgrade the opcode from obsolete versions before we do anything with it. - sanitizeOpCode(yyvsp[-4].BinaryOpVal,*yyvsp[-3].TypeVal); + sanitizeOpCode((yyvsp[-4].BinaryOpVal),*(yyvsp[-3].TypeVal)); CHECK_FOR_ERROR; - 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.opcode, val1, val2); - if (yyval.InstVal == 0) + (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal).opcode, val1, val2); + if ((yyval.InstVal) == 0) GEN_ERROR("binary operator returned null!"); - delete yyvsp[-3].TypeVal; - ; - break;} -case 229: -#line 2490 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (!(*yyvsp[-3].TypeVal)->isIntegral()) { - if (!isa(yyvsp[-3].TypeVal->get()) || - !cast(yyvsp[-3].TypeVal->get())->getElementType()->isIntegral()) + delete (yyvsp[-3].TypeVal); + ;} + break; + + case 231: +#line 2517 "/proj/llvm/llvm-3/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.opcode, tmpVal1, tmpVal2); - if (yyval.InstVal == 0) + (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal).opcode, tmpVal1, tmpVal2); + if ((yyval.InstVal) == 0) GEN_ERROR("binary operator returned null!"); - delete yyvsp[-3].TypeVal; - ; - break;} -case 230: -#line 2505 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if(isa((*yyvsp[-3].TypeVal).get())) { + delete (yyvsp[-3].TypeVal); + ;} + break; + + case 232: +#line 2532 "/proj/llvm/llvm-3/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.opcode, tmpVal1, tmpVal2); - if (yyval.InstVal == 0) + (yyval.InstVal) = new SetCondInst((yyvsp[-4].BinaryOpVal).opcode, tmpVal1, tmpVal2); + if ((yyval.InstVal) == 0) GEN_ERROR("binary operator returned null!"); - delete yyvsp[-3].TypeVal; - ; - break;} -case 231: -#line 2519 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ + delete (yyvsp[-3].TypeVal); + ;} + break; + + case 233: +#line 2546 "/proj/llvm/llvm-3/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 232: -#line 2532 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (yyvsp[0].ValueVal->getType() != Type::UByteTy) + ;} + break; + + case 234: +#line 2559 "/proj/llvm/llvm-3/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.opcode, yyvsp[-2].ValueVal, yyvsp[0].ValueVal); + // Handle opcode upgrade situations + sanitizeOpCode((yyvsp[-3].OtherOpVal), (yyvsp[-2].ValueVal)->getType()); + CHECK_FOR_ERROR; + (yyval.InstVal) = new ShiftInst((yyvsp[-3].OtherOpVal).opcode, (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); CHECK_FOR_ERROR - ; - break;} -case 233: -#line 2540 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (!yyvsp[0].TypeVal->get()->isFirstClassType()) + ;} + break; + + case 235: +#line 2570 "/proj/llvm/llvm-3/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 234: -#line 2548 "/Users/sabre/cvs/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 236: +#line 2578 "/proj/llvm/llvm-3/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 235: -#line 2556 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 237: +#line 2586 "/proj/llvm/llvm-3/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 236: -#line 2562 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 238: +#line 2592 "/proj/llvm/llvm-3/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); @@ -4226,19 +5018,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].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 237: -#line 2582 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 239: +#line 2612 "/proj/llvm/llvm-3/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); @@ -4250,73 +5043,78 @@ //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 238: -#line 2605 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (!ExtractElementInst::isValidOperands(yyvsp[-2].ValueVal, yyvsp[0].ValueVal)) + ;} + break; + + case 240: +#line 2635 "/proj/llvm/llvm-3/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 239: -#line 2611 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (!InsertElementInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal)) + ;} + break; + + case 241: +#line 2641 "/proj/llvm/llvm-3/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 240: -#line 2617 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (!ShuffleVectorInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal)) + ;} + break; + + case 242: +#line 2647 "/proj/llvm/llvm-3/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 241: -#line 2623 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - const Type *Ty = yyvsp[0].PHIList->front().first->getType(); + ;} + break; + + case 243: +#line 2653 "/proj/llvm/llvm-3/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 242: -#line 2638 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ + ;} + break; + + case 244: +#line 2668 "/proj/llvm/llvm-3/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()); } @@ -4324,31 +5122,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) @@ -4358,377 +5156,442 @@ 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 243: -#line 2697 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.InstVal = yyvsp[0].InstVal; + 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 244: -#line 2704 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ValueList = yyvsp[0].ValueList; - CHECK_FOR_ERROR - ; - break;} -case 245: -#line 2707 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.ValueList = new std::vector(); - CHECK_FOR_ERROR - ; - break;} -case 246: -#line 2712 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.BoolVal = true; + ;} + break; + + case 245: +#line 2727 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.InstVal) = (yyvsp[0].InstVal); CHECK_FOR_ERROR - ; - break;} -case 247: -#line 2716 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.BoolVal = false; + ;} + break; + + case 246: +#line 2734 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ValueList) = (yyvsp[0].ValueList); CHECK_FOR_ERROR - ; - break;} -case 248: -#line 2723 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.InstVal = new MallocInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal); - delete yyvsp[-1].TypeVal; + ;} + break; + + case 247: +#line 2737 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.ValueList) = new std::vector(); CHECK_FOR_ERROR - ; - break;} -case 249: -#line 2728 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal); + ;} + break; + + case 248: +#line 2742 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.BoolVal) = true; CHECK_FOR_ERROR - yyval.InstVal = new MallocInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal); - delete yyvsp[-4].TypeVal; - ; - break;} -case 250: -#line 2734 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - yyval.InstVal = new AllocaInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal); - delete yyvsp[-1].TypeVal; + ;} + break; + + case 249: +#line 2746 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.BoolVal) = false; CHECK_FOR_ERROR - ; - break;} -case 251: -#line 2739 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal); + ;} + break; + + case 250: +#line 2753 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); + delete (yyvsp[-1].TypeVal); CHECK_FOR_ERROR - yyval.InstVal = new AllocaInst(*yyvsp[-4].TypeVal, tmpVal, yyvsp[0].UIntVal); - delete yyvsp[-4].TypeVal; - ; - break;} -case 252: -#line 2745 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (!isa(yyvsp[0].ValueVal->getType())) + ;} + break; + + case 251: +#line 2758 "/proj/llvm/llvm-3/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 252: +#line 2764 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" + { + (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); + delete (yyvsp[-1].TypeVal); + CHECK_FOR_ERROR + ;} + break; + + case 253: +#line 2769 "/proj/llvm/llvm-3/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 254: +#line 2775 "/proj/llvm/llvm-3/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 253: -#line 2753 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" -{ - if (!isa(yyvsp[-1].TypeVal->get())) + ;} + break; + + case 255: +#line 2783 "/proj/llvm/llvm-3/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 254: -#line 2765 "/Users/sabre/cvs/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 256: +#line 2795 "/proj/llvm/llvm-3/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 255: -#line 2780 "/Users/sabre/cvs/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 257: +#line 2810 "/proj/llvm/llvm-3/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 (ConstantInt *CUI = dyn_cast((*yyvsp[0].ValueList)[i])) + if (ConstantInt *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;} -} - /* the action file gets copied in in place of this dollarsign */ -#line 543 "/usr/share/bison.simple" + (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 5327 "llvmAsmParser.tab.c" yyvsp -= yylen; yyssp -= yylen; -#ifdef YYLSP_NEEDED - yylsp -= yylen; -#endif -#if YYDEBUG != 0 - if (yydebug) - { - short *ssp1 = yyss - 1; - fprintf (stderr, "state stack now"); - while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); - } -#endif + + YY_STACK_PRINT (yyss, yyssp); *++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 - YYNTBASE] + *yyssp; - if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) + yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else - yystate = yydefgoto[yyn - YYNTBASE]; + yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; -yyerrlab: /* here on detecting error */ - if (! yyerrstatus) - /* If not already recovering from an error, report this error. */ +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) { ++yynerrs; - -#ifdef YYERROR_VERBOSE +#if YYERROR_VERBOSE yyn = yypact[yystate]; - if (yyn > YYFLAG && yyn < YYLAST) + if (YYPACT_NINF < yyn && yyn < YYLAST) { - int size = 0; - char *msg; - int x, count; - - count = 0; - /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ - for (x = (yyn < 0 ? -yyn : 0); - x < (sizeof(yytname) / sizeof(char *)); x++) - if (yycheck[x + yyn] == x) - size += strlen(yytname[x]) + 15, count++; - msg = (char *) malloc(size + 15); - if (msg != 0) - { - strcpy(msg, "parse error"); + 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 (count < 5) +#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) + { + /* 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)) { - 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++; - } + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } } - yyerror(msg); - free(msg); + yyerror (yymsg); + YYSTACK_FREE (yymsg); } else - yyerror ("parse error; also virtual memory exceeded"); + { + yyerror (YY_("syntax error")); + goto yyexhaustedlab; + } } else #endif /* YYERROR_VERBOSE */ - yyerror("parse error"); + yyerror (YY_("syntax error")); } - goto yyerrlab1; -yyerrlab1: /* here on error raised explicitly by an action */ + if (yyerrstatus == 3) { - /* if just tried and failed to reuse lookahead token after an error, discard it. */ - - /* return failure if at end of input */ - if (yychar == YYEOF) - YYABORT; + /* If just tried and failed to reuse look-ahead token after an + error, discard it. */ -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); -#endif - - yychar = YYEMPTY; + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", yytoken, &yylval); + yychar = YYEMPTY; + } } - /* Else will try to reuse lookahead token - after shifting the error token. */ - - yyerrstatus = 3; /* Each real token shifted decrements this */ + /* Else will try to reuse look-ahead token after shifting the error + token. */ + goto yyerrlab1; - goto yyerrhandle; -yyerrdefault: /* current state does not do anything special for the error token. */ +/*---------------------------------------------------. +| 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; -#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 +yyvsp -= yylen; + yyssp -= yylen; + yystate = *yyssp; + goto yyerrlab1; -yyerrpop: /* pop the current state because it cannot handle the error token */ - if (yyssp == yyss) YYABORT; - yyvsp--; - yystate = *--yyssp; -#ifdef YYLSP_NEEDED - yylsp--; -#endif +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ -#if YYDEBUG != 0 - if (yydebug) + for (;;) { - short *ssp1 = yyss - 1; - fprintf (stderr, "Error: state stack now"); - while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); - } -#endif - -yyerrhandle: + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } - yyn = yypact[yystate]; - if (yyn == YYFLAG) - goto yyerrdefault; + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; - yyn += YYTERROR; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) - goto yyerrdefault; - yyn = yytable[yyn]; - if (yyn < 0) - { - if (yyn == YYFLAG) - goto yyerrpop; - yyn = -yyn; - goto yyreduce; + yydestruct ("Error: popping", yystos[yystate], yyvsp); + YYPOPSTACK; + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); } - else if (yyn == 0) - goto yyerrpop; if (yyn == YYFINAL) YYACCEPT; -#if YYDEBUG != 0 - if (yydebug) - fprintf(stderr, "Shifting error token, "); -#endif - *++yyvsp = yylval; -#ifdef YYLSP_NEEDED - *++yylsp = yylloc; -#endif + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; - yyacceptlab: - /* YYACCEPT comes here. */ - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); -#endif - } - return 0; - yyabortlab: - /* YYABORT comes here. */ - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); +/*-------------------------------------. +| 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); #endif - } - return 1; + return yyresult; } -#line 2806 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" + + +#line 2836 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" void llvm::GenerateError(const std::string &message, int LineNo) { @@ -4751,3 +5614,4 @@ GenerateError(errMsg); return 0; } + Index: llvm/lib/AsmParser/llvmAsmParser.h.cvs diff -u llvm/lib/AsmParser/llvmAsmParser.h.cvs:1.19 llvm/lib/AsmParser/llvmAsmParser.h.cvs:1.20 --- llvm/lib/AsmParser/llvmAsmParser.h.cvs:1.19 Tue Nov 7 23:58:47 2006 +++ llvm/lib/AsmParser/llvmAsmParser.h.cvs Wed Nov 8 00:47:33 2006 @@ -1,4 +1,266 @@ -typedef union { +/* 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, + DATALAYOUT = 326, + RET = 327, + BR = 328, + SWITCH = 329, + INVOKE = 330, + UNWIND = 331, + UNREACHABLE = 332, + ADD = 333, + SUB = 334, + MUL = 335, + UDIV = 336, + SDIV = 337, + FDIV = 338, + UREM = 339, + SREM = 340, + FREM = 341, + AND = 342, + OR = 343, + XOR = 344, + SETLE = 345, + SETGE = 346, + SETLT = 347, + SETGT = 348, + SETEQ = 349, + SETNE = 350, + MALLOC = 351, + ALLOCA = 352, + FREE = 353, + LOAD = 354, + STORE = 355, + GETELEMENTPTR = 356, + PHI_TOK = 357, + CAST = 358, + SELECT = 359, + SHL = 360, + LSHR = 361, + ASHR = 362, + VAARG = 363, + EXTRACTELEMENT = 364, + INSERTELEMENT = 365, + SHUFFLEVECTOR = 366, + VAARG_old = 367, + VANEXT_old = 368 + }; +#endif +/* Tokens. */ +#define ESINT64VAL 258 +#define EUINT64VAL 259 +#define SINTVAL 260 +#define UINTVAL 261 +#define FPVAL 262 +#define VOID 263 +#define BOOL 264 +#define SBYTE 265 +#define UBYTE 266 +#define SHORT 267 +#define USHORT 268 +#define INT 269 +#define UINT 270 +#define LONG 271 +#define ULONG 272 +#define FLOAT 273 +#define DOUBLE 274 +#define TYPE 275 +#define LABEL 276 +#define VAR_ID 277 +#define LABELSTR 278 +#define STRINGCONSTANT 279 +#define IMPLEMENTATION 280 +#define ZEROINITIALIZER 281 +#define TRUETOK 282 +#define FALSETOK 283 +#define BEGINTOK 284 +#define ENDTOK 285 +#define DECLARE 286 +#define GLOBAL 287 +#define CONSTANT 288 +#define SECTION 289 +#define VOLATILE 290 +#define TO 291 +#define DOTDOTDOT 292 +#define NULL_TOK 293 +#define UNDEF 294 +#define CONST 295 +#define INTERNAL 296 +#define LINKONCE 297 +#define WEAK 298 +#define APPENDING 299 +#define DLLIMPORT 300 +#define DLLEXPORT 301 +#define EXTERN_WEAK 302 +#define OPAQUE 303 +#define NOT 304 +#define EXTERNAL 305 +#define TARGET 306 +#define TRIPLE 307 +#define ENDIAN 308 +#define POINTERSIZE 309 +#define LITTLE 310 +#define BIG 311 +#define ALIGN 312 +#define DEPLIBS 313 +#define CALL 314 +#define TAIL 315 +#define ASM_TOK 316 +#define MODULE 317 +#define SIDEEFFECT 318 +#define CC_TOK 319 +#define CCC_TOK 320 +#define CSRETCC_TOK 321 +#define FASTCC_TOK 322 +#define COLDCC_TOK 323 +#define X86_STDCALLCC_TOK 324 +#define X86_FASTCALLCC_TOK 325 +#define DATALAYOUT 326 +#define RET 327 +#define BR 328 +#define SWITCH 329 +#define INVOKE 330 +#define UNWIND 331 +#define UNREACHABLE 332 +#define ADD 333 +#define SUB 334 +#define MUL 335 +#define UDIV 336 +#define SDIV 337 +#define FDIV 338 +#define UREM 339 +#define SREM 340 +#define FREM 341 +#define AND 342 +#define OR 343 +#define XOR 344 +#define SETLE 345 +#define SETGE 346 +#define SETLT 347 +#define SETGT 348 +#define SETEQ 349 +#define SETNE 350 +#define MALLOC 351 +#define ALLOCA 352 +#define FREE 353 +#define LOAD 354 +#define STORE 355 +#define GETELEMENTPTR 356 +#define PHI_TOK 357 +#define CAST 358 +#define SELECT 359 +#define SHL 360 +#define LSHR 361 +#define ASHR 362 +#define VAARG 363 +#define EXTRACTELEMENT 364 +#define INSERTELEMENT 365 +#define SHUFFLEVECTOR 366 +#define VAARG_old 367 +#define VANEXT_old 368 + + + + +#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +#line 1040 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y" +typedef union YYSTYPE { llvm::Module *ModuleVal; llvm::Function *FunctionVal; std::pair *ArgVal; @@ -37,116 +299,14 @@ OtherOpInfo OtherOpVal; llvm::Module::Endianness Endianness; } YYSTYPE; -#define ESINT64VAL 257 -#define EUINT64VAL 258 -#define SINTVAL 259 -#define UINTVAL 260 -#define FPVAL 261 -#define VOID 262 -#define BOOL 263 -#define SBYTE 264 -#define UBYTE 265 -#define SHORT 266 -#define USHORT 267 -#define INT 268 -#define UINT 269 -#define LONG 270 -#define ULONG 271 -#define FLOAT 272 -#define DOUBLE 273 -#define TYPE 274 -#define LABEL 275 -#define VAR_ID 276 -#define LABELSTR 277 -#define STRINGCONSTANT 278 -#define IMPLEMENTATION 279 -#define ZEROINITIALIZER 280 -#define TRUETOK 281 -#define FALSETOK 282 -#define BEGINTOK 283 -#define ENDTOK 284 -#define DECLARE 285 -#define GLOBAL 286 -#define CONSTANT 287 -#define SECTION 288 -#define VOLATILE 289 -#define TO 290 -#define DOTDOTDOT 291 -#define NULL_TOK 292 -#define UNDEF 293 -#define CONST 294 -#define INTERNAL 295 -#define LINKONCE 296 -#define WEAK 297 -#define APPENDING 298 -#define DLLIMPORT 299 -#define DLLEXPORT 300 -#define EXTERN_WEAK 301 -#define OPAQUE 302 -#define NOT 303 -#define EXTERNAL 304 -#define TARGET 305 -#define TRIPLE 306 -#define ENDIAN 307 -#define POINTERSIZE 308 -#define LITTLE 309 -#define BIG 310 -#define ALIGN 311 -#define DEPLIBS 312 -#define CALL 313 -#define TAIL 314 -#define ASM_TOK 315 -#define MODULE 316 -#define SIDEEFFECT 317 -#define CC_TOK 318 -#define CCC_TOK 319 -#define CSRETCC_TOK 320 -#define FASTCC_TOK 321 -#define COLDCC_TOK 322 -#define X86_STDCALLCC_TOK 323 -#define X86_FASTCALLCC_TOK 324 -#define DATALAYOUT 325 -#define RET 326 -#define BR 327 -#define SWITCH 328 -#define INVOKE 329 -#define UNWIND 330 -#define UNREACHABLE 331 -#define ADD 332 -#define SUB 333 -#define MUL 334 -#define UDIV 335 -#define SDIV 336 -#define FDIV 337 -#define UREM 338 -#define SREM 339 -#define FREM 340 -#define AND 341 -#define OR 342 -#define XOR 343 -#define SETLE 344 -#define SETGE 345 -#define SETLT 346 -#define SETGT 347 -#define SETEQ 348 -#define SETNE 349 -#define MALLOC 350 -#define ALLOCA 351 -#define FREE 352 -#define LOAD 353 -#define STORE 354 -#define GETELEMENTPTR 355 -#define PHI_TOK 356 -#define CAST 357 -#define SELECT 358 -#define SHL 359 -#define SHR 360 -#define VAARG 361 -#define EXTRACTELEMENT 362 -#define INSERTELEMENT 363 -#define SHUFFLEVECTOR 364 -#define VAARG_old 365 -#define VANEXT_old 366 - +/* Line 1447 of yacc.c. */ +#line 304 "llvmAsmParser.tab.h" +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif extern YYSTYPE llvmAsmlval; + + + Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.273 llvm/lib/AsmParser/llvmAsmParser.y:1.274 --- llvm/lib/AsmParser/llvmAsmParser.y:1.273 Tue Nov 7 23:58:11 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y Wed Nov 8 00:47:33 2006 @@ -820,7 +820,7 @@ /// an obsolete opcode. For example, "div" was replaced by [usf]div but we need /// to maintain backwards compatibility for asm files that still have the "div" /// instruction. This function handles converting div -> [usf]div appropriately. -/// @brief Convert obsolete opcodes to new values +/// @brief Convert obsolete BinaryOps opcodes to new values static void sanitizeOpCode(OpcodeInfo &OI, const PATypeHolder& PATy) { @@ -855,7 +855,31 @@ // Its not obsolete any more, we fixed it. OI.obsolete = false; } - + +/// This function is similar to the previous overload of sanitizeOpCode but +/// operates on Instruction::OtherOps instead of Instruction::BinaryOps. +/// @brief Convert obsolete OtherOps opcodes to new values +static void +sanitizeOpCode(OpcodeInfo &OI, const PATypeHolder& PATy) +{ + // If its not obsolete, don't do anything + if (!OI.obsolete) + return; + + const Type* Ty = PATy; // type conversion + switch (OI.opcode) { + default: + GenerateError("Invalid obsolete opcode (check Lexer.l)"); + break; + case Instruction::LShr: + if (Ty->isSigned()) + OI.opcode = Instruction::AShr; + break; + } + // Its not obsolete any more, we fixed it. + OI.obsolete = false; +} + // common code from the two 'RunVMAsmParser' functions static Module* RunParser(Module * M) { @@ -1126,7 +1150,7 @@ // Other Operators %type ShiftOps -%token PHI_TOK CAST SELECT SHL SHR VAARG +%token PHI_TOK CAST SELECT SHL LSHR ASHR VAARG %token EXTRACTELEMENT INSERTELEMENT SHUFFLEVECTOR %token VAARG_old VANEXT_old //OBSOLETE @@ -1160,7 +1184,7 @@ LogicalOps : AND | OR | XOR; SetCondOps : SETLE | SETGE | SETLT | SETGT | SETEQ | SETNE; -ShiftOps : SHL | SHR; +ShiftOps : SHL | LSHR | ASHR; // These are some types that allow classification if we only want a particular // thing... for example, only a signed, unsigned, or integral type. @@ -1730,6 +1754,9 @@ GEN_ERROR("Shift count for shift constant must be unsigned byte!"); if (!$3->getType()->isInteger()) GEN_ERROR("Shift constant expression requires integer operand!"); + // Handle opcode upgrade situations + sanitizeOpCode($1, $3->getType()); + CHECK_FOR_ERROR; $$ = ConstantExpr::get($1.opcode, $3, $5); CHECK_FOR_ERROR } @@ -2534,6 +2561,9 @@ GEN_ERROR("Shift amount must be ubyte!"); if (!$2->getType()->isInteger()) GEN_ERROR("Shift constant expression requires integer operand!"); + // Handle opcode upgrade situations + sanitizeOpCode($1, $2->getType()); + CHECK_FOR_ERROR; $$ = new ShiftInst($1.opcode, $2, $4); CHECK_FOR_ERROR } Index: llvm/lib/AsmParser/llvmAsmParser.y.cvs diff -u llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.25 llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.26 --- llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.25 Tue Nov 7 23:58:47 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y.cvs Wed Nov 8 00:47:33 2006 @@ -820,7 +820,7 @@ /// an obsolete opcode. For example, "div" was replaced by [usf]div but we need /// to maintain backwards compatibility for asm files that still have the "div" /// instruction. This function handles converting div -> [usf]div appropriately. -/// @brief Convert obsolete opcodes to new values +/// @brief Convert obsolete BinaryOps opcodes to new values static void sanitizeOpCode(OpcodeInfo &OI, const PATypeHolder& PATy) { @@ -855,7 +855,31 @@ // Its not obsolete any more, we fixed it. OI.obsolete = false; } - + +/// This function is similar to the previous overload of sanitizeOpCode but +/// operates on Instruction::OtherOps instead of Instruction::BinaryOps. +/// @brief Convert obsolete OtherOps opcodes to new values +static void +sanitizeOpCode(OpcodeInfo &OI, const PATypeHolder& PATy) +{ + // If its not obsolete, don't do anything + if (!OI.obsolete) + return; + + const Type* Ty = PATy; // type conversion + switch (OI.opcode) { + default: + GenerateError("Invalid obsolete opcode (check Lexer.l)"); + break; + case Instruction::LShr: + if (Ty->isSigned()) + OI.opcode = Instruction::AShr; + break; + } + // Its not obsolete any more, we fixed it. + OI.obsolete = false; +} + // common code from the two 'RunVMAsmParser' functions static Module* RunParser(Module * M) { @@ -1126,7 +1150,7 @@ // Other Operators %type ShiftOps -%token PHI_TOK CAST SELECT SHL SHR VAARG +%token PHI_TOK CAST SELECT SHL LSHR ASHR VAARG %token EXTRACTELEMENT INSERTELEMENT SHUFFLEVECTOR %token VAARG_old VANEXT_old //OBSOLETE @@ -1160,7 +1184,7 @@ LogicalOps : AND | OR | XOR; SetCondOps : SETLE | SETGE | SETLT | SETGT | SETEQ | SETNE; -ShiftOps : SHL | SHR; +ShiftOps : SHL | LSHR | ASHR; // These are some types that allow classification if we only want a particular // thing... for example, only a signed, unsigned, or integral type. @@ -1730,6 +1754,9 @@ GEN_ERROR("Shift count for shift constant must be unsigned byte!"); if (!$3->getType()->isInteger()) GEN_ERROR("Shift constant expression requires integer operand!"); + // Handle opcode upgrade situations + sanitizeOpCode($1, $3->getType()); + CHECK_FOR_ERROR; $$ = ConstantExpr::get($1.opcode, $3, $5); CHECK_FOR_ERROR } @@ -2534,6 +2561,9 @@ GEN_ERROR("Shift amount must be ubyte!"); if (!$2->getType()->isInteger()) GEN_ERROR("Shift constant expression requires integer operand!"); + // Handle opcode upgrade situations + sanitizeOpCode($1, $2->getType()); + CHECK_FOR_ERROR; $$ = new ShiftInst($1.opcode, $2, $4); CHECK_FOR_ERROR } From reid at x10sys.com Wed Nov 8 00:48:12 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 8 Nov 2006 00:48:12 -0600 Subject: [llvm-commits] CVS: llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp Message-ID: <200611080648.kA86mCK5025258@zion.cs.uiuc.edu> Changes in directory llvm/projects/Stacker/lib/compiler: StackerCompiler.cpp updated: 1.22 -> 1.23 --- Log message: For PR950: http://llvm.org/PR950 : This patch converts the old SHR instruction into two instructions, AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not dependent on the sign of their operands. --- Diffs of the changes: (+1 -1) StackerCompiler.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp diff -u llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.22 llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.23 --- llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp:1.22 Thu Nov 2 14:25:50 2006 +++ llvm/projects/Stacker/lib/compiler/StackerCompiler.cpp Wed Nov 8 00:47:33 2006 @@ -1257,7 +1257,7 @@ LoadInst* op2 = cast(pop_integer(bb)); CastInst* castop = new CastInst( op1, Type::UByteTy ); bb->getInstList().push_back( castop ); - ShiftInst* shrop = new ShiftInst( Instruction::Shr, op2, castop ); + ShiftInst* shrop = new ShiftInst( Instruction::AShr, op2, castop ); bb->getInstList().push_back( shrop ); push_value( bb, shrop ); break; From reid at x10sys.com Wed Nov 8 00:48:13 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 8 Nov 2006 00:48:13 -0600 Subject: [llvm-commits] CVS: llvm/tools/llvm2cpp/CppWriter.cpp Message-ID: <200611080648.kA86mDs5025263@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm2cpp: CppWriter.cpp updated: 1.20 -> 1.21 --- Log message: For PR950: http://llvm.org/PR950 : This patch converts the old SHR instruction into two instructions, AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not dependent on the sign of their operands. --- Diffs of the changes: (+6 -3) CppWriter.cpp | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) Index: llvm/tools/llvm2cpp/CppWriter.cpp diff -u llvm/tools/llvm2cpp/CppWriter.cpp:1.20 llvm/tools/llvm2cpp/CppWriter.cpp:1.21 --- llvm/tools/llvm2cpp/CppWriter.cpp:1.20 Thu Nov 2 14:25:50 2006 +++ llvm/tools/llvm2cpp/CppWriter.cpp Wed Nov 8 00:47:33 2006 @@ -788,7 +788,8 @@ case Instruction::SetLT: Out << "getSetLT"; break; case Instruction::SetGT: Out << "getSetGT"; break; case Instruction::Shl: Out << "getShl"; break; - case Instruction::Shr: Out << "getShr"; break; + case Instruction::LShr: Out << "getLShr"; break; + case Instruction::AShr: Out << "getAShr"; break; case Instruction::Select: Out << "getSelect"; break; case Instruction::ExtractElement: Out << "getExtractElement"; break; case Instruction::InsertElement: Out << "getInsertElement"; break; @@ -1034,7 +1035,8 @@ case Instruction::Or: case Instruction::Xor: case Instruction::Shl: - case Instruction::Shr:{ + case Instruction::LShr: + case Instruction::AShr:{ Out << "BinaryOperator* " << iName << " = BinaryOperator::create("; switch (I->getOpcode()) { case Instruction::Add: Out << "Instruction::Add"; break; @@ -1050,7 +1052,8 @@ case Instruction::Or: Out << "Instruction::Or"; break; case Instruction::Xor: Out << "Instruction::Xor"; break; case Instruction::Shl: Out << "Instruction::Shl"; break; - case Instruction::Shr: Out << "Instruction::Shr"; break; + case Instruction::LShr:Out << "Instruction::LShr"; break; + case Instruction::AShr:Out << "Instruction::AShr"; break; default: Out << "Instruction::BadOpCode"; break; } Out << ", " << opNames[0] << ", " << opNames[1] << ", \""; From reid at x10sys.com Wed Nov 8 00:48:14 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 8 Nov 2006 00:48:14 -0600 Subject: [llvm-commits] CVS: llvm/docs/LangRef.html Message-ID: <200611080648.kA86mEaQ025294@zion.cs.uiuc.edu> Changes in directory llvm/docs: LangRef.html updated: 1.162 -> 1.163 --- Log message: For PR950: http://llvm.org/PR950 : This patch converts the old SHR instruction into two instructions, AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not dependent on the sign of their operands. --- Diffs of the changes: (+54 -19) LangRef.html | 73 +++++++++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 54 insertions(+), 19 deletions(-) Index: llvm/docs/LangRef.html diff -u llvm/docs/LangRef.html:1.162 llvm/docs/LangRef.html:1.163 --- llvm/docs/LangRef.html:1.162 Tue Nov 7 19:18:52 2006 +++ llvm/docs/LangRef.html Wed Nov 8 00:47:32 2006 @@ -92,7 +92,8 @@
    4. 'or' Instruction
    5. 'xor' Instruction
    6. 'shl' Instruction
    7. -
    8. 'shr' Instruction
    9. +
    10. 'lshr' Instruction
    11. +
    12. 'ashr' Instruction
  • Vector Operations @@ -2070,30 +2071,64 @@ -
    'shr' +
    Syntax:
    -
      <result> = shr <ty> <var1>, ubyte <var2>   ; yields {ty}:result
    +
      <result> = lshr <ty> <var1>, ubyte <var2>   ; yields {ty}:result
     
    +
    Overview:
    -

    The 'shr' instruction returns the first operand shifted to -the right a specified number of bits.

    +

    The 'lshr' instruction (logical shift right) returns the first +operand shifted to the right a specified number of bits.

    +
    Arguments:
    -

    The first argument to the 'shr' instruction must be an integer type. The second argument must be an 'ubyte' -type.

    +

    The first argument to the 'lshr' instruction must be an integer type. The second argument must be an 'ubyte' type.

    + +
    Semantics:
    +

    This instruction always performs a logical shift right operation, regardless +of whether the arguments are unsigned or not. The var2 most significant +bits will be filled with zero bits after the shift.

    + +
    Example:
    +
    +  <result> = lshr uint 4, ubyte 1   ; yields {uint}:result = 2
    +  <result> = lshr int 4, ubyte 2    ; yields {uint}:result = 1
    +  <result> = lshr sbyte 4, ubyte 3  ; yields {sbyte}:result = 0
    +  <result> = lshr sbyte -2, ubyte 1 ; yields {sbyte}:result = 0x7FFFFFFF 
    +
    +
    + + + +
    + +
    Syntax:
    +
      <result> = ashr <ty> <var1>, ubyte <var2>   ; yields {ty}:result
    +
    + +
    Overview:
    +

    The 'ashr' instruction (arithmetic shift right) returns the first +operand shifted to the right a specified number of bits.

    + +
    Arguments:
    +

    The first argument to the 'ashr' instruction must be an +integer type. The second argument must be an +'ubyte' type.

    +
    Semantics:
    -

    If the first argument is a signed type, the -most significant bit is duplicated in the newly free'd bit positions. -If the first argument is unsigned, zero bits shall fill the empty -positions.

    -
    Example:
    -
      <result> = shr int 4, ubyte %var   ; yields {int}:result = 4 >> %var
    -  <result> = shr uint 4, ubyte 1     ; yields {uint}:result = 2
    -  <result> = shr int 4, ubyte 2      ; yields {int}:result = 1
    -  <result> = shr sbyte 4, ubyte 3    ; yields {sbyte}:result = 0
    -  <result> = shr sbyte -2, ubyte 1   ; yields {sbyte}:result = -1
    +

    This instruction always performs an arithmetic shift right operation, +regardless of whether the arguments are signed or not. The var2 most +significant bits will be filled with the sign bit of var1.

    + +
    Example:
    +
    +  <result> = ashr uint 4, ubyte 1    ; yields {uint}:result = 2
    +  <result> = ashr int 4, ubyte 2      ; yields {int}:result = 1
    +  <result> = ashr ubyte 4, ubyte 3    ; yields {ubyte}:result = 0
    +  <result> = ashr sbyte -2, ubyte 1   ; yields {sbyte}:result = -1
     
    @@ -4381,7 +4416,7 @@ Chris Lattner
    The LLVM Compiler Infrastructure
    - Last modified: $Date: 2006/11/08 01:18:52 $ + Last modified: $Date: 2006/11/08 06:47:32 $ From reid at x10sys.com Wed Nov 8 00:48:17 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 8 Nov 2006 00:48:17 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Constants.h Instruction.def Instructions.h Message-ID: <200611080648.kA86mHwL025314@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Constants.h updated: 1.93 -> 1.94 Instruction.def updated: 1.21 -> 1.22 Instructions.h updated: 1.44 -> 1.45 --- Log message: For PR950: http://llvm.org/PR950 : This patch converts the old SHR instruction into two instructions, AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not dependent on the sign of their operands. --- Diffs of the changes: (+24 -19) Constants.h | 6 ++---- Instruction.def | 25 +++++++++++++------------ Instructions.h | 12 +++++++++--- 3 files changed, 24 insertions(+), 19 deletions(-) Index: llvm/include/llvm/Constants.h diff -u llvm/include/llvm/Constants.h:1.93 llvm/include/llvm/Constants.h:1.94 --- llvm/include/llvm/Constants.h:1.93 Wed Nov 1 19:53:58 2006 +++ llvm/include/llvm/Constants.h Wed Nov 8 00:47:32 2006 @@ -564,10 +564,8 @@ static Constant *getSetLE(Constant *C1, Constant *C2); static Constant *getSetGE(Constant *C1, Constant *C2); static Constant *getShl(Constant *C1, Constant *C2); - static Constant *getShr(Constant *C1, Constant *C2); - - static Constant *getUShr(Constant *C1, Constant *C2); // unsigned shr - static Constant *getSShr(Constant *C1, Constant *C2); // signed shr + static Constant *getLShr(Constant *C1, Constant *C2); + static Constant *getAShr(Constant *C1, Constant *C2); /// Getelementptr form. std::vector is only accepted for convenience: /// all elements must be Constant's. Index: llvm/include/llvm/Instruction.def diff -u llvm/include/llvm/Instruction.def:1.21 llvm/include/llvm/Instruction.def:1.22 --- llvm/include/llvm/Instruction.def:1.21 Wed Nov 1 19:53:58 2006 +++ llvm/include/llvm/Instruction.def Wed Nov 8 00:47:32 2006 @@ -15,8 +15,8 @@ // NOTE: NO INCLUDE GUARD DESIRED! -// Provide definitions of macros so that users of this file do not have to define -// everything to use it... +// Provide definitions of macros so that users of this file do not have to +// define everything to use it... // #ifndef FIRST_TERM_INST #define FIRST_TERM_INST(num) @@ -129,16 +129,17 @@ HANDLE_OTHER_INST(31, PHI , PHINode ) // PHI node instruction HANDLE_OTHER_INST(32, Cast , CastInst ) // Type cast HANDLE_OTHER_INST(33, Call , CallInst ) // Call a function -HANDLE_OTHER_INST(34, Shl , ShiftInst ) // Shift operations -HANDLE_OTHER_INST(35, Shr , ShiftInst ) -HANDLE_OTHER_INST(36, Select , SelectInst ) // select instruction -HANDLE_OTHER_INST(37, UserOp1, Instruction) // May be used internally in a pass -HANDLE_OTHER_INST(38, UserOp2, Instruction) -HANDLE_OTHER_INST(39, VAArg , VAArgInst ) // vaarg instruction -HANDLE_OTHER_INST(40, ExtractElement, ExtractElementInst)// extract from vector. -HANDLE_OTHER_INST(41, InsertElement, InsertElementInst) // insert into vector -HANDLE_OTHER_INST(42, ShuffleVector, ShuffleVectorInst) // shuffle two vectors. - LAST_OTHER_INST(42) +HANDLE_OTHER_INST(34, Shl , ShiftInst ) // Shift Left operations (logical) +HANDLE_OTHER_INST(35, LShr , ShiftInst ) // Logical Shift right (unsigned) +HANDLE_OTHER_INST(36, AShr , ShiftInst ) // Arithmetic shift right (signed) +HANDLE_OTHER_INST(37, Select , SelectInst ) // select instruction +HANDLE_OTHER_INST(38, UserOp1, Instruction) // May be used internally in a pass +HANDLE_OTHER_INST(39, UserOp2, Instruction) // Internal to passes only +HANDLE_OTHER_INST(40, VAArg , VAArgInst ) // vaarg instruction +HANDLE_OTHER_INST(41, ExtractElement, ExtractElementInst)// extract from vector. +HANDLE_OTHER_INST(42, InsertElement, InsertElementInst) // insert into vector +HANDLE_OTHER_INST(43, ShuffleVector, ShuffleVectorInst) // shuffle two vectors. + LAST_OTHER_INST(43) #undef FIRST_TERM_INST #undef HANDLE_TERM_INST Index: llvm/include/llvm/Instructions.h diff -u llvm/include/llvm/Instructions.h:1.44 llvm/include/llvm/Instructions.h:1.45 --- llvm/include/llvm/Instructions.h:1.44 Thu Oct 5 01:24:58 2006 +++ llvm/include/llvm/Instructions.h Wed Nov 8 00:47:32 2006 @@ -604,7 +604,8 @@ Ops[1].init(SI.Ops[1], this); } void init(OtherOps Opcode, Value *S, Value *SA) { - assert((Opcode == Shl || Opcode == Shr) && "ShiftInst Opcode invalid!"); + assert((Opcode == Shl || Opcode == LShr || Opcode == AShr) && + "ShiftInst Opcode invalid!"); Ops[0].init(S, this); Ops[1].init(SA, this); } @@ -638,7 +639,11 @@ /// isLogicalShift - Return true if this is a logical shift left or a logical /// shift right. - bool isLogicalShift() const; + bool isLogicalShift() const { + unsigned opcode = getOpcode(); + return opcode == Instruction::Shl || opcode == Instruction::LShr; + } + /// isArithmeticShift - Return true if this is a sign-extending shift right /// operation. @@ -652,7 +657,8 @@ // Methods for support type inquiry through isa, cast, and dyn_cast: static inline bool classof(const ShiftInst *) { return true; } static inline bool classof(const Instruction *I) { - return (I->getOpcode() == Instruction::Shr) | + return (I->getOpcode() == Instruction::LShr) | + (I->getOpcode() == Instruction::AShr) | (I->getOpcode() == Instruction::Shl); } static inline bool classof(const Value *V) { From reid at x10sys.com Wed Nov 8 00:48:17 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 8 Nov 2006 00:48:17 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/IntrinsicLowering.cpp Message-ID: <200611080648.kA86mHwA025305@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: IntrinsicLowering.cpp updated: 1.44 -> 1.45 --- Log message: For PR950: http://llvm.org/PR950 : This patch converts the old SHR instruction into two instructions, AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not dependent on the sign of their operands. --- Diffs of the changes: (+14 -38) IntrinsicLowering.cpp | 52 +++++++++++++------------------------------------- 1 files changed, 14 insertions(+), 38 deletions(-) Index: llvm/lib/CodeGen/IntrinsicLowering.cpp diff -u llvm/lib/CodeGen/IntrinsicLowering.cpp:1.44 llvm/lib/CodeGen/IntrinsicLowering.cpp:1.45 --- llvm/lib/CodeGen/IntrinsicLowering.cpp:1.44 Fri Oct 20 02:07:24 2006 +++ llvm/lib/CodeGen/IntrinsicLowering.cpp Wed Nov 8 00:47:33 2006 @@ -138,12 +138,6 @@ static Value *LowerBSWAP(Value *V, Instruction *IP) { assert(V->getType()->isInteger() && "Can't bswap a non-integer type!"); - const Type *DestTy = V->getType(); - - // Force to unsigned so that the shift rights are logical. - if (DestTy->isSigned()) - V = new CastInst(V, DestTy->getUnsignedVersion(), V->getName(), IP); - unsigned BitSize = V->getType()->getPrimitiveSizeInBits(); switch(BitSize) { @@ -151,7 +145,7 @@ case 16: { Value *Tmp1 = new ShiftInst(Instruction::Shl, V, ConstantInt::get(Type::UByteTy,8),"bswap.2",IP); - Value *Tmp2 = new ShiftInst(Instruction::Shr, V, + Value *Tmp2 = new ShiftInst(Instruction::LShr, V, ConstantInt::get(Type::UByteTy,8),"bswap.1",IP); V = BinaryOperator::createOr(Tmp1, Tmp2, "bswap.i16", IP); break; @@ -160,10 +154,10 @@ Value *Tmp4 = new ShiftInst(Instruction::Shl, V, ConstantInt::get(Type::UByteTy,24),"bswap.4", IP); Value *Tmp3 = new ShiftInst(Instruction::Shl, V, - ConstantInt::get(Type::UByteTy,8),"bswap.3",IP); - Value *Tmp2 = new ShiftInst(Instruction::Shr, V, - ConstantInt::get(Type::UByteTy,8),"bswap.2",IP); - Value *Tmp1 = new ShiftInst(Instruction::Shr, V, + ConstantInt::get(Type::UByteTy,8),"bswap.3",IP); + Value *Tmp2 = new ShiftInst(Instruction::LShr, V, + ConstantInt::get(Type::UByteTy,8),"bswap.2",IP); + Value *Tmp1 = new ShiftInst(Instruction::LShr, V, ConstantInt::get(Type::UByteTy,24),"bswap.1", IP); Tmp3 = BinaryOperator::createAnd(Tmp3, ConstantInt::get(Type::UIntTy, 0xFF0000), @@ -184,14 +178,14 @@ Value *Tmp6 = new ShiftInst(Instruction::Shl, V, ConstantInt::get(Type::UByteTy,24),"bswap.6", IP); Value *Tmp5 = new ShiftInst(Instruction::Shl, V, - ConstantInt::get(Type::UByteTy,8),"bswap.5",IP); - Value *Tmp4 = new ShiftInst(Instruction::Shr, V, - ConstantInt::get(Type::UByteTy,8),"bswap.4",IP); - Value *Tmp3 = new ShiftInst(Instruction::Shr, V, + ConstantInt::get(Type::UByteTy,8),"bswap.5", IP); + Value* Tmp4 = new ShiftInst(Instruction::LShr, V, + ConstantInt::get(Type::UByteTy,8),"bswap.4", IP); + Value* Tmp3 = new ShiftInst(Instruction::LShr, V, ConstantInt::get(Type::UByteTy,24),"bswap.3", IP); - Value *Tmp2 = new ShiftInst(Instruction::Shr, V, + Value* Tmp2 = new ShiftInst(Instruction::LShr, V, ConstantInt::get(Type::UByteTy,40),"bswap.2", IP); - Value *Tmp1 = new ShiftInst(Instruction::Shr, V, + Value* Tmp1 = new ShiftInst(Instruction::LShr, V, ConstantInt::get(Type::UByteTy,56),"bswap.1", IP); Tmp7 = BinaryOperator::createAnd(Tmp7, ConstantInt::get(Type::ULongTy, @@ -222,9 +216,6 @@ break; } } - - if (V->getType() != DestTy) - V = new CastInst(V, DestTy, V->getName(), IP); return V; } @@ -239,48 +230,33 @@ 0x0000FFFF0000FFFFULL, 0x00000000FFFFFFFFULL }; - const Type *DestTy = V->getType(); - - // Force to unsigned so that the shift rights are logical. - if (DestTy->isSigned()) - V = new CastInst(V, DestTy->getUnsignedVersion(), V->getName(), IP); - unsigned BitSize = V->getType()->getPrimitiveSizeInBits(); + for (unsigned i = 1, ct = 0; i != BitSize; i <<= 1, ++ct) { Value *MaskCst = ConstantExpr::getCast(ConstantInt::get(Type::ULongTy, MaskValues[ct]), V->getType()); Value *LHS = BinaryOperator::createAnd(V, MaskCst, "cppop.and1", IP); - Value *VShift = new ShiftInst(Instruction::Shr, V, + Value *VShift = new ShiftInst(Instruction::LShr, V, ConstantInt::get(Type::UByteTy, i), "ctpop.sh", IP); Value *RHS = BinaryOperator::createAnd(VShift, MaskCst, "cppop.and2", IP); V = BinaryOperator::createAdd(LHS, RHS, "ctpop.step", IP); } - if (V->getType() != DestTy) - V = new CastInst(V, DestTy, V->getName(), IP); return V; } /// LowerCTLZ - Emit the code to lower ctlz of V before the specified /// instruction IP. static Value *LowerCTLZ(Value *V, Instruction *IP) { - const Type *DestTy = V->getType(); - - // Force to unsigned so that the shift rights are logical. - if (DestTy->isSigned()) - V = new CastInst(V, DestTy->getUnsignedVersion(), V->getName(), IP); unsigned BitSize = V->getType()->getPrimitiveSizeInBits(); for (unsigned i = 1; i != BitSize; i <<= 1) { Value *ShVal = ConstantInt::get(Type::UByteTy, i); - ShVal = new ShiftInst(Instruction::Shr, V, ShVal, "ctlz.sh", IP); + ShVal = new ShiftInst(Instruction::LShr, V, ShVal, "ctlz.sh", IP); V = BinaryOperator::createOr(V, ShVal, "ctlz.step", IP); } - if (V->getType() != DestTy) - V = new CastInst(V, DestTy, V->getName(), IP); - V = BinaryOperator::createNot(V, "", IP); return LowerCTPOP(V, IP); } From evan.cheng at apple.com Wed Nov 8 00:56:19 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 8 Nov 2006 00:56:19 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200611080656.kA86uJal025561@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.240 -> 1.241 --- Log message: Fixed a minor bug preventing some pre-indexed load / store transformation. --- Diffs of the changes: (+3 -3) DAGCombiner.cpp | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.240 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.241 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.240 Tue Nov 7 20:38:55 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed Nov 8 00:56:05 2006 @@ -239,8 +239,8 @@ } // Now check for #1 and #2. - unsigned NumRealUses = 0; if (OffIsAMImm) { + unsigned NumRealUses = 0; for (SDNode::use_iterator I = Ptr.Val->use_begin(), E = Ptr.Val->use_end(); I != E; ++I) { SDNode *Use = *I; @@ -260,9 +260,9 @@ } else NumRealUses++; } + if (NumRealUses == 0) + return false; } - if (NumRealUses == 0) - return false; SDOperand Result = isLoad ? DAG.getIndexedLoad(SDOperand(N,0), BasePtr, Offset, AM) From rspencer at reidspencer.com Wed Nov 8 01:20:49 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Tue, 07 Nov 2006 23:20:49 -0800 Subject: [llvm-commits] [llvm-gcc4] SHR Patch (Please Apply!) Message-ID: <1162970449.30912.271.camel@bashful.x10sys.com> This patch for llvm-gcc4 is needed to make llvm-gcc4 work correctly with the just committed SHR patch. Please commit at earliest convenience. If you're building llvm-gcc4 and you have updated your LLVM tree to include the SHR patch, please apply this to your llvm-gcc4 tree so that it will compile correctly. Thanks, Reid. -------------- next part -------------- A non-text attachment was scrubbed... Name: SHR.llvmgcc.patch Type: text/x-patch Size: 1867 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061107/58c913d4/attachment.bin From clattner at apple.com Wed Nov 8 01:24:19 2006 From: clattner at apple.com (Chris Lattner) Date: Tue, 7 Nov 2006 23:24:19 -0800 Subject: [llvm-commits] [llvm-gcc4] SHR Patch (Please Apply!) In-Reply-To: <1162970449.30912.271.camel@bashful.x10sys.com> References: <1162970449.30912.271.camel@bashful.x10sys.com> Message-ID: <723565FA-C546-4F95-9288-0B3A910E7C90@apple.com> applied, thanks -Chris On Nov 7, 2006, at 11:20 PM, Reid Spencer wrote: > This patch for llvm-gcc4 is needed to make llvm-gcc4 work correctly > with > the just committed SHR patch. Please commit at earliest > convenience. If > you're building llvm-gcc4 and you have updated your LLVM tree to > include > the SHR patch, please apply this to your llvm-gcc4 tree so that it > will > compile correctly. > > Thanks, > > Reid. > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From evan.cheng at apple.com Wed Nov 8 02:30:42 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 8 Nov 2006 02:30:42 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200611080830.kA88UgiJ003190@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.241 -> 1.242 --- Log message: - When performing pre-/post- indexed load/store transformation, do not worry about whether the new base ptr would be live below the load/store. Let two address pass split it back to non-indexed ops. - Minor tweaks / fixes. --- Diffs of the changes: (+30 -91) DAGCombiner.cpp | 121 +++++++++++++------------------------------------------- 1 files changed, 30 insertions(+), 91 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.241 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.242 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.241 Wed Nov 8 00:56:05 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed Nov 8 02:30:28 2006 @@ -208,61 +208,26 @@ // Try turning it into a pre-indexed load / store except when // 1) Another use of base ptr is a predecessor of N. If ptr is folded // that would create a cycle. - // 2) All uses are load / store ops that use it as base ptr and offset - // is just an addressing mode immediate. - // 3) If the would-be new base may not to be dead at N. - - bool OffIsAMImm = Offset.getOpcode() == ISD::Constant && TLI. - isLegalAddressImmediate(cast(Offset)->getValue()); - - // Check for #3. - for (SDNode::use_iterator I = BasePtr.Val->use_begin(), - E = BasePtr.Val->use_end(); I != E; ++I) { + // 2) All uses are load / store ops that use it as base ptr. + + // Now check for #1 and #2. + bool RealUse = false; + for (SDNode::use_iterator I = Ptr.Val->use_begin(), + E = Ptr.Val->use_end(); I != E; ++I) { SDNode *Use = *I; - if (Use == Ptr.Val) + if (Use == N) continue; - if (Use->getOpcode() == ISD::CopyToReg) + if (Use->isPredecessor(N)) return false; - if (OffIsAMImm && (Use->getOpcode() == ISD::ADD || - Use->getOpcode() == ISD::SUB)) { - for (SDNode::use_iterator II = Use->use_begin(), - EE = Use->use_end(); II != EE; ++II) { - SDNode *UseUse = *II; - if (UseUse->getOpcode() == ISD::LOAD && - cast(UseUse)->getBasePtr().Val == Use) - return false; - else if (UseUse->getOpcode() == ISD::STORE && - cast(UseUse)->getBasePtr().Val == Use) - return false; - } - } - } - // Now check for #1 and #2. - if (OffIsAMImm) { - unsigned NumRealUses = 0; - for (SDNode::use_iterator I = Ptr.Val->use_begin(), - E = Ptr.Val->use_end(); I != E; ++I) { - SDNode *Use = *I; - if (Use == N) - continue; - if (Use->isPredecessor(N)) - return false; - - if (!OffIsAMImm) { - NumRealUses++; - } else if (Use->getOpcode() == ISD::LOAD) { - if (cast(Use)->getBasePtr().Val != Ptr.Val) - NumRealUses++; - } else if (Use->getOpcode() == ISD::STORE) { - if (cast(Use)->getBasePtr().Val != Ptr.Val) - NumRealUses++; - } else - NumRealUses++; - } - if (NumRealUses == 0) - return false; + if (!((Use->getOpcode() == ISD::LOAD && + cast(Use)->getBasePtr() == Ptr) || + (Use->getOpcode() == ISD::STORE) && + cast(Use)->getBasePtr() == Ptr)) + RealUse = true; } + if (!RealUse) + return false; SDOperand Result = isLoad ? DAG.getIndexedLoad(SDOperand(N,0), BasePtr, Offset, AM) @@ -343,12 +308,7 @@ // 1) Op must be independent of N, i.e. Op is neither a predecessor // nor a successor of N. Otherwise, if Op is folded that would // create a cycle. - // 2) All uses are load / store ops that use it as base ptr and offset - // is just an addressing mode immediate. - // 3) If the would-be new base may not to be dead at N. - - bool OffIsAMImm = Offset.getOpcode() == ISD::Constant && TLI. - isLegalAddressImmediate(cast(Offset)->getValue()); + // 2) All uses are load / store ops that use it as base ptr. // Check for #3. bool TryNext = false; @@ -357,51 +317,30 @@ SDNode *Use = *II; if (Use == Ptr.Val) continue; - if (Use->getOpcode() == ISD::CopyToReg) { - TryNext = true; - break; - } - if (OffIsAMImm && (Use->getOpcode() == ISD::ADD || - Use->getOpcode() == ISD::SUB)) { + // If all the uses are load / store addresses, then don't do the + // transformation. + if (Use->getOpcode() == ISD::ADD || Use->getOpcode() == ISD::SUB){ + bool RealUse = false; for (SDNode::use_iterator III = Use->use_begin(), EEE = Use->use_end(); III != EEE; ++III) { SDNode *UseUse = *III; - if (UseUse->getOpcode() == ISD::LOAD && - cast(UseUse)->getBasePtr().Val == Use) { - TryNext = true; - break; - } else if (UseUse->getOpcode() == ISD::STORE && - cast(UseUse)->getBasePtr().Val == Use) { - - TryNext = true; - break; - } + if (!((UseUse->getOpcode() == ISD::LOAD && + cast(UseUse)->getBasePtr().Val == Use) || + (UseUse->getOpcode() == ISD::STORE) && + cast(UseUse)->getBasePtr().Val == Use)) + RealUse = true; + } + + if (!RealUse) { + TryNext = true; + break; } } } if (TryNext) continue; - if (OffIsAMImm) { - // Check for #2. - unsigned NumRealUses = 0; - for (SDNode::use_iterator II = Op->use_begin(), EE = Op->use_end(); - II != EE; ++II) { - SDNode *Use = *II; - if (Use->getOpcode() == ISD::LOAD) { - if (cast(Use)->getBasePtr().Val != Op) - NumRealUses++; - } else if (Use->getOpcode() == ISD::STORE) { - if (cast(Use)->getBasePtr().Val != Op) - NumRealUses++; - } else - NumRealUses++; - } - if (NumRealUses == 0) - continue; - } - // Check for #1 if (!Op->isPredecessor(N) && !N->isPredecessor(Op)) { SDOperand Result = isLoad From dpatel at apple.com Wed Nov 8 04:05:55 2006 From: dpatel at apple.com (Devang Patel) Date: Wed, 8 Nov 2006 04:05:55 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200611081005.kA8A5t4i005145@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.7 -> 1.8 --- Log message: Move BasicBlockPassManager_New, FunctionPassManager_New and ModulePassManager_New class declarations from PassManager.h to PassManager.cpp --- Diffs of the changes: (+86 -1) PassManager.cpp | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 86 insertions(+), 1 deletion(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.7 llvm/lib/VMCore/PassManager.cpp:1.8 --- llvm/lib/VMCore/PassManager.cpp:1.7 Tue Nov 7 19:31:28 2006 +++ llvm/lib/VMCore/PassManager.cpp Wed Nov 8 04:05:38 2006 @@ -2,7 +2,7 @@ // // The LLVM Compiler Infrastructure // -// This file was developed by Devang Patel and is distributed under +// This file was developed by Devang Patel and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// @@ -17,6 +17,91 @@ using namespace llvm; +namespace llvm { + +/// BasicBlockPassManager_New manages BasicBlockPass. It batches all the +/// pass together and sequence them to process one basic block before +/// processing next basic block. +class BasicBlockPassManager_New : public Pass, + public PassManagerAnalysisHelper { + +public: + BasicBlockPassManager_New() { } + + /// Add a pass into a passmanager queue. + bool addPass(Pass *p); + + /// Execute all of the passes scheduled for execution. Keep track of + /// whether any of the passes modifies the function, and if so, return true. + bool runOnFunction(Function &F); + +private: + // Collection of pass that are managed by this manager + std::vector PassVector; +}; + +/// FunctionPassManager_New manages FunctionPasses and BasicBlockPassManagers. +/// It batches all function passes and basic block pass managers together and +/// sequence them to process one function at a time before processing next +/// function. +class FunctionPassManager_New : public Pass, + public PassManagerAnalysisHelper { +public: + FunctionPassManager_New(ModuleProvider *P) { /* TODO */ } + FunctionPassManager_New() { + activeBBPassManager = NULL; + } + ~FunctionPassManager_New() { /* TODO */ }; + + /// add - Add a pass to the queue of passes to run. This passes + /// ownership of the Pass to the PassManager. When the + /// PassManager_X is destroyed, the pass will be destroyed as well, so + /// there is no need to delete the pass. (TODO delete passes.) + /// This implies that all passes MUST be allocated with 'new'. + void add(Pass *P) { /* TODO*/ } + + /// Add pass into the pass manager queue. + bool addPass(Pass *P); + + /// Execute all of the passes scheduled for execution. Keep + /// track of whether any of the passes modifies the function, and if + /// so, return true. + bool runOnModule(Module &M); + +private: + // Collection of pass that are manged by this manager + std::vector PassVector; + + // Active Pass Managers + BasicBlockPassManager_New *activeBBPassManager; +}; + +/// ModulePassManager_New manages ModulePasses and function pass managers. +/// It batches all Module passes passes and function pass managers together and +/// sequence them to process one module. +class ModulePassManager_New : public Pass, + public PassManagerAnalysisHelper { + +public: + ModulePassManager_New() { activeFunctionPassManager = NULL; } + + /// Add a pass into a passmanager queue. + bool addPass(Pass *p); + + /// run - Execute all of the passes scheduled for execution. Keep track of + /// whether any of the passes modifies the module, and if so, return true. + bool runOnModule(Module &M); + +private: + // Collection of pass that are managed by this manager + std::vector PassVector; + + // Active Pass Manager + FunctionPassManager_New *activeFunctionPassManager; +}; + +} // End of llvm namespace + // PassManagerAnalysisHelper implementation /// Return true IFF pass P's required analysis set does not required new From dpatel at apple.com Wed Nov 8 04:05:55 2006 From: dpatel at apple.com (Devang Patel) Date: Wed, 8 Nov 2006 04:05:55 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/PassManager.h Message-ID: <200611081005.kA8A5tW5005148@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: PassManager.h updated: 1.23 -> 1.24 --- Log message: Move BasicBlockPassManager_New, FunctionPassManager_New and ModulePassManager_New class declarations from PassManager.h to PassManager.cpp --- Diffs of the changes: (+2 -81) PassManager.h | 83 +--------------------------------------------------------- 1 files changed, 2 insertions(+), 81 deletions(-) Index: llvm/include/llvm/PassManager.h diff -u llvm/include/llvm/PassManager.h:1.23 llvm/include/llvm/PassManager.h:1.24 --- llvm/include/llvm/PassManager.h:1.23 Tue Nov 7 18:19:31 2006 +++ llvm/include/llvm/PassManager.h Wed Nov 8 04:05:38 2006 @@ -88,6 +88,8 @@ bool doFinalization(); }; +class ModulePassManager_New; + /// PassManagerAnalysisHelper helps pass manager analysis required by /// the managed passes. It provides methods to add/remove analysis /// available and query if certain analysis is available or not. @@ -119,87 +121,6 @@ std::vector RequiredSet; }; -/// BasicBlockPassManager_New manages BasicBlockPass. It batches all the -/// pass together and sequence them to process one basic block before -/// processing next basic block. -class BasicBlockPassManager_New : public Pass, - public PassManagerAnalysisHelper { - -public: - BasicBlockPassManager_New() { } - - /// Add a pass into a passmanager queue. - bool addPass(Pass *p); - - /// Execute all of the passes scheduled for execution. Keep track of - /// whether any of the passes modifies the function, and if so, return true. - bool runOnFunction(Function &F); - -private: - // Collection of pass that are managed by this manager - std::vector PassVector; -}; - -/// FunctionPassManager_New manages FunctionPasses and BasicBlockPassManagers. -/// It batches all function passes and basic block pass managers together and -/// sequence them to process one function at a time before processing next -/// function. -class FunctionPassManager_New : public Pass, - public PassManagerAnalysisHelper { -public: - FunctionPassManager_New(ModuleProvider *P) { /* TODO */ } - FunctionPassManager_New() { - activeBBPassManager = NULL; - } - ~FunctionPassManager_New() { /* TODO */ }; - - /// add - Add a pass to the queue of passes to run. This passes - /// ownership of the Pass to the PassManager. When the - /// PassManager_X is destroyed, the pass will be destroyed as well, so - /// there is no need to delete the pass. (TODO delete passes.) - /// This implies that all passes MUST be allocated with 'new'. - void add(Pass *P) { /* TODO*/ } - - /// Add pass into the pass manager queue. - bool addPass(Pass *P); - - /// Execute all of the passes scheduled for execution. Keep - /// track of whether any of the passes modifies the function, and if - /// so, return true. - bool runOnModule(Module &M); - -private: - // Collection of pass that are manged by this manager - std::vector PassVector; - - // Active Pass Managers - BasicBlockPassManager_New *activeBBPassManager; -}; - -/// ModulePassManager_New manages ModulePasses and function pass managers. -/// It batches all Module passes passes and function pass managers together and -/// sequence them to process one module. -class ModulePassManager_New : public Pass, - public PassManagerAnalysisHelper { - -public: - ModulePassManager_New() { activeFunctionPassManager = NULL; } - - /// Add a pass into a passmanager queue. - bool addPass(Pass *p); - - /// run - Execute all of the passes scheduled for execution. Keep track of - /// whether any of the passes modifies the module, and if so, return true. - bool runOnModule(Module &M); - -private: - // Collection of pass that are managed by this manager - std::vector PassVector; - - // Active Pass Manager - FunctionPassManager_New *activeFunctionPassManager; -}; - /// PassManager_New manages ModulePassManagers class PassManager_New : public Pass, public PassManagerAnalysisHelper { From dpatel at apple.com Wed Nov 8 04:30:15 2006 From: dpatel at apple.com (Devang Patel) Date: Wed, 8 Nov 2006 04:30:15 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/PassManager.h Message-ID: <200611081030.kA8AUFrk005515@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: PassManager.h updated: 1.24 -> 1.25 --- Log message: Split PassManager_New into PassManager_New and PassManagerImpl_New. PassManagerImpl_New implements the pass manager. PassManager_New is the public interface. --- Diffs of the changes: (+6 -14) PassManager.h | 20 ++++++-------------- 1 files changed, 6 insertions(+), 14 deletions(-) Index: llvm/include/llvm/PassManager.h diff -u llvm/include/llvm/PassManager.h:1.24 llvm/include/llvm/PassManager.h:1.25 --- llvm/include/llvm/PassManager.h:1.24 Wed Nov 8 04:05:38 2006 +++ llvm/include/llvm/PassManager.h Wed Nov 8 04:29:57 2006 @@ -89,6 +89,7 @@ }; class ModulePassManager_New; +class PassManagerImpl_New; /// PassManagerAnalysisHelper helps pass manager analysis required by /// the managed passes. It provides methods to add/remove analysis @@ -127,6 +128,8 @@ public: + PassManager_New(); + /// add - Add a pass to the queue of passes to run. This passes ownership of /// the Pass to the PassManager. When the PassManager is destroyed, the pass /// will be destroyed as well, so there is no need to delete the pass. This @@ -138,22 +141,11 @@ bool run(Module &M); private: - - /// Add a pass into a passmanager queue. This is used by schedulePasses - bool addPass(Pass *p); - /// Schedule all passes collected in pass queue using add(). Add all the - /// schedule passes into various manager's queue using addPass(). - void schedulePasses(); + /// PassManagerImpl_New is the actual class. PassManager_New is just the + /// wraper to publish simple pass manager interface + PassManagerImpl_New *PM; - // Collection of pass managers - std::vector PassManagers; - - // Collection of pass that are not yet scheduled - std::vector PassVector; - - // Active Pass Manager - ModulePassManager_New *activeManager; }; } // End llvm namespace From dpatel at apple.com Wed Nov 8 04:30:15 2006 From: dpatel at apple.com (Devang Patel) Date: Wed, 8 Nov 2006 04:30:15 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200611081030.kA8AUFxa005517@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.8 -> 1.9 --- Log message: Split PassManager_New into PassManager_New and PassManagerImpl_New. PassManagerImpl_New implements the pass manager. PassManager_New is the public interface. --- Diffs of the changes: (+61 -4) PassManager.cpp | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 61 insertions(+), 4 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.8 llvm/lib/VMCore/PassManager.cpp:1.9 --- llvm/lib/VMCore/PassManager.cpp:1.8 Wed Nov 8 04:05:38 2006 +++ llvm/lib/VMCore/PassManager.cpp Wed Nov 8 04:29:57 2006 @@ -100,6 +100,41 @@ FunctionPassManager_New *activeFunctionPassManager; }; +/// PassManager_New manages ModulePassManagers +class PassManagerImpl_New : public Pass, + public PassManagerAnalysisHelper { + +public: + + /// add - Add a pass to the queue of passes to run. This passes ownership of + /// the Pass to the PassManager. When the PassManager is destroyed, the pass + /// will be destroyed as well, so there is no need to delete the pass. This + /// implies that all passes MUST be allocated with 'new'. + void add(Pass *P); + + /// run - Execute all of the passes scheduled for execution. Keep track of + /// whether any of the passes modifies the module, and if so, return true. + bool run(Module &M); + +private: + + /// Add a pass into a passmanager queue. This is used by schedulePasses + bool addPass(Pass *p); + + /// Schedule all passes collected in pass queue using add(). Add all the + /// schedule passes into various manager's queue using addPass(). + void schedulePasses(); + + // Collection of pass managers + std::vector PassManagers; + + // Collection of pass that are not yet scheduled + std::vector PassVector; + + // Active Pass Manager + ModulePassManager_New *activeManager; +}; + } // End of llvm namespace // PassManagerAnalysisHelper implementation @@ -304,13 +339,13 @@ /// Schedule all passes from the queue by adding them in their /// respective manager's queue. void -PassManager_New::schedulePasses() { +PassManagerImpl_New::schedulePasses() { /* TODO */ } /// Add pass P to the queue of passes to run. void -PassManager_New::add(Pass *P) { +PassManagerImpl_New::add(Pass *P) { /* TODO */ } @@ -318,7 +353,7 @@ /// Add P into active pass manager or use new module pass manager to /// manage it. bool -PassManager_New::addPass(Pass *P) { +PassManagerImpl_New::addPass(Pass *P) { if (!activeManager) { activeManager = new ModulePassManager_New(); @@ -331,7 +366,7 @@ /// run - Execute all of the passes scheduled for execution. Keep track of /// whether any of the passes modifies the module, and if so, return true. bool -PassManager_New::run(Module &M) { +PassManagerImpl_New::run(Module &M) { schedulePasses(); bool Changed = false; @@ -342,3 +377,25 @@ } return Changed; } + +/// Create new pass manager +PassManager_New::PassManager_New() { + PM = new PassManagerImpl_New(); +} + +/// add - Add a pass to the queue of passes to run. This passes ownership of +/// the Pass to the PassManager. When the PassManager is destroyed, the pass +/// will be destroyed as well, so there is no need to delete the pass. This +/// implies that all passes MUST be allocated with 'new'. +void +PassManager_New::add(Pass *P) { + PM->add(P); +} + +/// run - Execute all of the passes scheduled for execution. Keep track of +/// whether any of the passes modifies the module, and if so, return true. +bool +PassManager_New::run(Module &M) { + return PM->run(M); +} + From dpatel at apple.com Wed Nov 8 04:44:58 2006 From: dpatel at apple.com (Devang Patel) Date: Wed, 8 Nov 2006 04:44:58 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/PassManager.h Message-ID: <200611081044.kA8AiwoW005770@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: PassManager.h updated: 1.25 -> 1.26 --- Log message: Split FunctionPassManager_New into FunctionPassManager_New and FunctionPassManagerImpl_New. FunctionPassManagerImpl_New implements the pass manager. FunctionPassManager_New is the public interface. --- Diffs of the changes: (+28 -0) PassManager.h | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+) Index: llvm/include/llvm/PassManager.h diff -u llvm/include/llvm/PassManager.h:1.25 llvm/include/llvm/PassManager.h:1.26 --- llvm/include/llvm/PassManager.h:1.25 Wed Nov 8 04:29:57 2006 +++ llvm/include/llvm/PassManager.h Wed Nov 8 04:44:40 2006 @@ -90,6 +90,7 @@ class ModulePassManager_New; class PassManagerImpl_New; +class FunctionPassManagerImpl_New; /// PassManagerAnalysisHelper helps pass manager analysis required by /// the managed passes. It provides methods to add/remove analysis @@ -148,6 +149,33 @@ }; +/// FunctionPassManager_New manages FunctionPasses and BasicBlockPassManagers. +class FunctionPassManager_New : public Pass, + public PassManagerAnalysisHelper { +public: + FunctionPassManager_New(ModuleProvider *P) { /* TODO */ } + FunctionPassManager_New(); + ~FunctionPassManager_New() { /* TODO */ }; + + /// add - Add a pass to the queue of passes to run. This passes + /// ownership of the Pass to the PassManager. When the + /// PassManager_X is destroyed, the pass will be destroyed as well, so + /// there is no need to delete the pass. (TODO delete passes.) + /// This implies that all passes MUST be allocated with 'new'. + void add(Pass *P); + + /// Execute all of the passes scheduled for execution. Keep + /// track of whether any of the passes modifies the function, and if + /// so, return true. + bool runOnModule(Module &M); + +private: + + FunctionPassManagerImpl_New *FPM; + +}; + + } // End llvm namespace #endif From dpatel at apple.com Wed Nov 8 04:44:58 2006 From: dpatel at apple.com (Devang Patel) Date: Wed, 8 Nov 2006 04:44:58 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200611081044.kA8AiwoY005768@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.9 -> 1.10 --- Log message: Split FunctionPassManager_New into FunctionPassManager_New and FunctionPassManagerImpl_New. FunctionPassManagerImpl_New implements the pass manager. FunctionPassManager_New is the public interface. --- Diffs of the changes: (+34 -10) PassManager.cpp | 44 ++++++++++++++++++++++++++++++++++---------- 1 files changed, 34 insertions(+), 10 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.9 llvm/lib/VMCore/PassManager.cpp:1.10 --- llvm/lib/VMCore/PassManager.cpp:1.9 Wed Nov 8 04:29:57 2006 +++ llvm/lib/VMCore/PassManager.cpp Wed Nov 8 04:44:40 2006 @@ -40,18 +40,18 @@ std::vector PassVector; }; -/// FunctionPassManager_New manages FunctionPasses and BasicBlockPassManagers. +/// FunctionPassManagerImpl_New manages FunctionPasses and BasicBlockPassManagers. /// It batches all function passes and basic block pass managers together and /// sequence them to process one function at a time before processing next /// function. -class FunctionPassManager_New : public Pass, +class FunctionPassManagerImpl_New : public Pass, public PassManagerAnalysisHelper { public: - FunctionPassManager_New(ModuleProvider *P) { /* TODO */ } - FunctionPassManager_New() { + FunctionPassManagerImpl_New(ModuleProvider *P) { /* TODO */ } + FunctionPassManagerImpl_New() { activeBBPassManager = NULL; } - ~FunctionPassManager_New() { /* TODO */ }; + ~FunctionPassManagerImpl_New() { /* TODO */ }; /// add - Add a pass to the queue of passes to run. This passes /// ownership of the Pass to the PassManager. When the @@ -97,7 +97,7 @@ std::vector PassVector; // Active Pass Manager - FunctionPassManager_New *activeFunctionPassManager; + FunctionPassManagerImpl_New *activeFunctionPassManager; }; /// PassManager_New manages ModulePassManagers @@ -219,6 +219,30 @@ } // FunctionPassManager_New implementation +/// Create new Function pass manager +FunctionPassManager_New::FunctionPassManager_New() { + FPM = new FunctionPassManagerImpl_New(); +} + +/// add - Add a pass to the queue of passes to run. This passes +/// ownership of the Pass to the PassManager. When the +/// PassManager_X is destroyed, the pass will be destroyed as well, so +/// there is no need to delete the pass. (TODO delete passes.) +/// This implies that all passes MUST be allocated with 'new'. +void +FunctionPassManager_New::add(Pass *P) { + FPM->add(P); +} + +/// Execute all of the passes scheduled for execution. Keep +/// track of whether any of the passes modifies the function, and if +/// so, return true. +bool +FunctionPassManager_New::runOnModule(Module &M) { + return FPM->runOnModule(M); +} + +// FunctionPassManagerImpl_New implementation // FunctionPassManager @@ -226,7 +250,7 @@ /// either use it into active basic block pass manager or create new basic /// block pass manager to handle pass P. bool -FunctionPassManager_New::addPass(Pass *P) { +FunctionPassManagerImpl_New::addPass(Pass *P) { // If P is a BasicBlockPass then use BasicBlockPassManager_New. if (BasicBlockPass *BP = dynamic_cast(P)) { @@ -264,7 +288,7 @@ /// runOnFunction method. Keep track of whether any of the passes modifies /// the function, and if so, return true. bool -FunctionPassManager_New::runOnModule(Module &M) { +FunctionPassManagerImpl_New::runOnModule(Module &M) { bool Changed = false; for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) @@ -281,7 +305,7 @@ // ModulePassManager implementation /// Add P into pass vector if it is manageble. If P is a FunctionPass -/// then use FunctionPassManager_New to manage it. Return false if P +/// then use FunctionPassManagerImpl_New to manage it. Return false if P /// is not manageable by this manager. bool ModulePassManager_New::addPass(Pass *P) { @@ -294,7 +318,7 @@ if (!activeFunctionPassManager || !activeFunctionPassManager->addPass(P)) { - activeFunctionPassManager = new FunctionPassManager_New(); + activeFunctionPassManager = new FunctionPassManagerImpl_New(); PassVector.push_back(activeFunctionPassManager); if (!activeFunctionPassManager->addPass(FP)) From jlaskey at apple.com Wed Nov 8 05:03:43 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 8 Nov 2006 07:03:43 -0400 Subject: [llvm-commits] [llvm-gcc4] SHR Patch (Please Apply!) In-Reply-To: <723565FA-C546-4F95-9288-0B3A910E7C90@apple.com> References: <1162970449.30912.271.camel@bashful.x10sys.com> <723565FA-C546-4F95-9288-0B3A910E7C90@apple.com> Message-ID: Will be in today's mirror. On Nov 8, 2006, at 3:24 AM, Chris Lattner wrote: > applied, thanks > > -Chris > > On Nov 7, 2006, at 11:20 PM, Reid Spencer wrote: > >> This patch for llvm-gcc4 is needed to make llvm-gcc4 work correctly >> with >> the just committed SHR patch. Please commit at earliest >> convenience. If >> you're building llvm-gcc4 and you have updated your LLVM tree to >> include >> the SHR patch, please apply this to your llvm-gcc4 tree so that it >> will >> compile correctly. >> >> Thanks, >> >> Reid. >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2417 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061108/17b67d39/attachment.bin From jlaskey at apple.com Wed Nov 8 08:16:53 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 8 Nov 2006 08:16:53 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineDebugInfo.h Message-ID: <200611081416.kA8EGra3009786@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineDebugInfo.h updated: 1.45 -> 1.46 --- Log message: Wasn't handling case of when machine move labels were undefined. --- Diffs of the changes: (+6 -1) MachineDebugInfo.h | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletion(-) Index: llvm/include/llvm/CodeGen/MachineDebugInfo.h diff -u llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.45 llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.46 --- llvm/include/llvm/CodeGen/MachineDebugInfo.h:1.45 Tue Nov 7 13:33:46 2006 +++ llvm/include/llvm/CodeGen/MachineDebugInfo.h Wed Nov 8 08:16:39 2006 @@ -1046,13 +1046,18 @@ /// RemapLabel - Indicate that a label has been merged into another. /// void RemapLabel(unsigned OldLabelID, unsigned NewLabelID) { + assert(0 < OldLabelID && OldLabelID <= LabelIDList.size() && + "Old debug label ID out of range."); + assert(NewLabelID <= LabelIDList.size() && + "New debug label ID out of range."); LabelIDList[OldLabelID - 1] = NewLabelID; } /// MappedLabel - Find out the label's final ID. Zero indicates deletion. /// ID != Mapped ID indicates that the label was folded into another label. unsigned MappedLabel(unsigned LabelID) const { - return LabelIDList[LabelID - 1]; + assert(LabelID <= LabelIDList.size() && "Debug label ID out of range."); + return LabelID ? LabelIDList[LabelID - 1] : 0; } /// RecordSource - Register a source file with debug info. Returns an source From jlaskey at apple.com Wed Nov 8 08:17:59 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 8 Nov 2006 08:17:59 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/MachineDebugInfo.cpp Message-ID: <200611081417.kA8EHxMg009815@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: MachineDebugInfo.cpp updated: 1.58 -> 1.59 --- Log message: Now can re-enable debug label folding. --- Diffs of the changes: (+0 -3) MachineDebugInfo.cpp | 3 --- 1 files changed, 3 deletions(-) Index: llvm/lib/CodeGen/MachineDebugInfo.cpp diff -u llvm/lib/CodeGen/MachineDebugInfo.cpp:1.58 llvm/lib/CodeGen/MachineDebugInfo.cpp:1.59 --- llvm/lib/CodeGen/MachineDebugInfo.cpp:1.58 Tue Nov 7 15:58:55 2006 +++ llvm/lib/CodeGen/MachineDebugInfo.cpp Wed Nov 8 08:17:45 2006 @@ -1629,9 +1629,6 @@ }; bool DebugLabelFolder::runOnMachineFunction(MachineFunction &MF) { - // FIXME - Missing label mapping. - return false; - // Get machine debug info. MachineDebugInfo *MDI = getAnalysisToUpdate(); if (!MDI) return false; From criswell at cs.uiuc.edu Wed Nov 8 09:05:03 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 8 Nov 2006 09:05:03 -0600 Subject: [llvm-commits] CVS: llvm/lib/Support/Allocator.cpp Message-ID: <200611081505.JAA23643@choi.cs.uiuc.edu> Changes in directory llvm/lib/Support: Allocator.cpp updated: 1.1 -> 1.2 --- Log message: Include llvm/Support/DataTypes.h to define intptr_t. This fixes the build on OpenBSD and potentially other systems. --- Diffs of the changes: (+1 -0) Allocator.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Support/Allocator.cpp diff -u llvm/lib/Support/Allocator.cpp:1.1 llvm/lib/Support/Allocator.cpp:1.2 --- llvm/lib/Support/Allocator.cpp:1.1 Sun Oct 29 16:08:03 2006 +++ llvm/lib/Support/Allocator.cpp Wed Nov 8 09:04:35 2006 @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Support/Allocator.h" +#include "llvm/Support/DataTypes.h" #include using namespace llvm; From criswell at cs.uiuc.edu Wed Nov 8 10:03:56 2006 From: criswell at cs.uiuc.edu (John Criswell) Date: Wed, 08 Nov 2006 10:03:56 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp RegAllocLinearScan.cpp In-Reply-To: <200611071226.kA7CQ5v8011213@zion.cs.uiuc.edu> References: <200611071226.kA7CQ5v8011213@zion.cs.uiuc.edu> Message-ID: <4551FFEC.6070506@cs.uiuc.edu> Dear Mr. Laskey, This change broke the LLVM build on OpenBSD. Would it be possible to use FLT_MAX instead of HUGE_VALF? FLT_MAX from float.h looks more portable. -- John T. Jim Laskey wrote: > Changes in directory llvm/lib/CodeGen: > > LiveIntervalAnalysis.cpp updated: 1.190 -> 1.191 > RegAllocLinearScan.cpp updated: 1.129 -> 1.130 > --- > Log message: > > Use correct value for float HUGH_VAL. > > --- > Diffs of the changes: (+6 -6) > > LiveIntervalAnalysis.cpp | 8 ++++---- > RegAllocLinearScan.cpp | 4 ++-- > 2 files changed, 6 insertions(+), 6 deletions(-) > > > Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp > diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.190 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.191 > --- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.190 Tue Nov 7 01:18:40 2006 > +++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Tue Nov 7 06:25:45 2006 > @@ -219,7 +219,7 @@ > // range the use follows def immediately, it doesn't make sense to spill > // it and hope it will be easier to allocate for this li. > if (isZeroLengthInterval(&LI)) > - LI.weight = float(HUGE_VAL); > + LI.weight = HUGE_VALF; > > if (EnableReweight) { > // Divide the weight of the interval by its size. This encourages > @@ -265,7 +265,7 @@ > > std::vector added; > > - assert(li.weight != HUGE_VAL && > + assert(li.weight != HUGE_VALF && > "attempt to spill already spilled interval!"); > > DEBUG(std::cerr << "\t\t\t\tadding intervals for spills for interval: "; > @@ -340,7 +340,7 @@ > > // the spill weight is now infinity as it > // cannot be spilled again > - nI.weight = float(HUGE_VAL); > + nI.weight = HUGE_VALF; > > if (HasUse) { > LiveRange LR(getLoadIndex(index), getUseIndex(index), > @@ -1362,6 +1362,6 @@ > > LiveInterval LiveIntervals::createInterval(unsigned reg) { > float Weight = MRegisterInfo::isPhysicalRegister(reg) ? > - (float)HUGE_VAL : 0.0F; > + HUGE_VALF : 0.0F; > return LiveInterval(reg, Weight); > } > > > Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp > diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.129 llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.130 > --- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.129 Tue Oct 24 09:35:25 2006 > +++ llvm/lib/CodeGen/RegAllocLinearScan.cpp Tue Nov 7 06:25:45 2006 > @@ -545,7 +545,7 @@ > DEBUG(std::cerr << "\tassigning stack slot at interval "<< *cur << ":\n"); > > // Find a register to spill. > - float minWeight = float(HUGE_VAL); > + float minWeight = HUGE_VALF; > unsigned minReg = 0; > for (TargetRegisterClass::iterator i = RC->allocation_order_begin(*mf_), > e = RC->allocation_order_end(*mf_); i != e; ++i) { > @@ -582,7 +582,7 @@ > // if the current has the minimum weight, we need to spill it and > // add any added intervals back to unhandled, and restart > // linearscan. > - if (cur->weight != float(HUGE_VAL) && cur->weight <= minWeight) { > + if (cur->weight != HUGE_VALF && cur->weight <= minWeight) { > DEBUG(std::cerr << "\t\t\tspilling(c): " << *cur << '\n';); > int slot = vrm_->assignVirt2StackSlot(cur->reg); > std::vector added = > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits > From jlaskey at apple.com Wed Nov 8 10:30:32 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 8 Nov 2006 12:30:32 -0400 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp RegAllocLinearScan.cpp In-Reply-To: <4551FFEC.6070506@cs.uiuc.edu> References: <200611071226.kA7CQ5v8011213@zion.cs.uiuc.edu> <4551FFEC.6070506@cs.uiuc.edu> Message-ID: John, Both are defined on Darwin, FLT_MAX in float.h and HUGE_VALF in math.h. However, neither header seems to be based on a BSD header. I choose HUGE_VALF because it was also defined in the LINUX and FREEBSD math.h headers (seemed like confirmation to me.) I'll wait for Chris to make the call. (might uses a #ifndef HUGE_VALF thingame.) Cheers, -- Jim On Nov 8, 2006, at 12:03 PM, John Criswell wrote: > Dear Mr. Laskey, > > This change broke the LLVM build on OpenBSD. Would it be possible to > use FLT_MAX instead of HUGE_VALF? FLT_MAX from float.h looks more > portable. > > -- John T. > > Jim Laskey wrote: >> Changes in directory llvm/lib/CodeGen: >> >> LiveIntervalAnalysis.cpp updated: 1.190 -> 1.191 >> RegAllocLinearScan.cpp updated: 1.129 -> 1.130 >> --- >> Log message: >> >> Use correct value for float HUGH_VAL. >> >> --- >> Diffs of the changes: (+6 -6) >> >> LiveIntervalAnalysis.cpp | 8 ++++---- >> RegAllocLinearScan.cpp | 4 ++-- >> 2 files changed, 6 insertions(+), 6 deletions(-) >> >> >> Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp >> diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.190 llvm/lib/ >> CodeGen/LiveIntervalAnalysis.cpp:1.191 >> --- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.190 Tue Nov 7 >> 01:18:40 2006 >> +++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Tue Nov 7 06:25:45 >> 2006 >> @@ -219,7 +219,7 @@ >> // range the use follows def immediately, it doesn't make >> sense to spill >> // it and hope it will be easier to allocate for this li. >> if (isZeroLengthInterval(&LI)) >> - LI.weight = float(HUGE_VAL); >> + LI.weight = HUGE_VALF; >> >> if (EnableReweight) { >> // Divide the weight of the interval by its size. This >> encourages >> @@ -265,7 +265,7 @@ >> >> std::vector added; >> >> - assert(li.weight != HUGE_VAL && >> + assert(li.weight != HUGE_VALF && >> "attempt to spill already spilled interval!"); >> >> DEBUG(std::cerr << "\t\t\t\tadding intervals for spills for >> interval: "; >> @@ -340,7 +340,7 @@ >> >> // the spill weight is now infinity as it >> // cannot be spilled again >> - nI.weight = float(HUGE_VAL); >> + nI.weight = HUGE_VALF; >> >> if (HasUse) { >> LiveRange LR(getLoadIndex(index), getUseIndex(index), >> @@ -1362,6 +1362,6 @@ >> >> LiveInterval LiveIntervals::createInterval(unsigned reg) { >> float Weight = MRegisterInfo::isPhysicalRegister(reg) ? >> - (float)HUGE_VAL : 0.0F; >> + HUGE_VALF : 0.0F; >> return LiveInterval(reg, Weight); >> } >> >> >> Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp >> diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.129 llvm/lib/ >> CodeGen/RegAllocLinearScan.cpp:1.130 >> --- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.129 Tue Oct 24 >> 09:35:25 2006 >> +++ llvm/lib/CodeGen/RegAllocLinearScan.cpp Tue Nov 7 06:25:45 2006 >> @@ -545,7 +545,7 @@ >> DEBUG(std::cerr << "\tassigning stack slot at interval "<< *cur >> << ":\n"); >> >> // Find a register to spill. >> - float minWeight = float(HUGE_VAL); >> + float minWeight = HUGE_VALF; >> unsigned minReg = 0; >> for (TargetRegisterClass::iterator i = RC- >> >allocation_order_begin(*mf_), >> e = RC->allocation_order_end(*mf_); i != e; ++i) { >> @@ -582,7 +582,7 @@ >> // if the current has the minimum weight, we need to spill it and >> // add any added intervals back to unhandled, and restart >> // linearscan. >> - if (cur->weight != float(HUGE_VAL) && cur->weight <= minWeight) { >> + if (cur->weight != HUGE_VALF && cur->weight <= minWeight) { >> DEBUG(std::cerr << "\t\t\tspilling(c): " << *cur << '\n';); >> int slot = vrm_->assignVirt2StackSlot(cur->reg); >> std::vector added = >> >> >> >> _______________________________________________ >> llvm-commits mailing list >> llvm-commits at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061108/218a11fc/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2417 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061108/218a11fc/attachment.bin From jlaskey at apple.com Wed Nov 8 10:38:59 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 8 Nov 2006 10:38:59 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp Message-ID: <200611081638.kA8GcxgJ012205@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/DebugInfo: 2006-11-06-StackTrace.cpp updated: 1.3 -> 1.4 --- Log message: Make it work on Darwin. --- Diffs of the changes: (+4 -3) 2006-11-06-StackTrace.cpp | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) Index: llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp diff -u llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp:1.3 llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp:1.4 --- llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp:1.3 Wed Nov 8 00:43:16 2006 +++ llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp Wed Nov 8 10:38:45 2006 @@ -1,10 +1,11 @@ // This is a regression test on debug info to make sure that we can get a // meaningful stack trace from a C++ program. // RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | llc -o Output/StackTrace.s -f -// RUN: gcc -g Output/StackTrace.s -o Output/StackTrace.exe -lstdc++ +// RUN: as Output/StackTrace.s -o Output/StackTrace.o +// RUN: g++ Output/StackTrace.o -o Output/StackTrace.exe // RUN: ( echo "break DeepStack::deepest"; echo "run 17" ; echo "where" ) > Output/StackTrace.gdbin -// RUN: gdb -q -batch -n -x Output/StackTrace.gdbin Output/StackTrace.exe | tee Output/StackTrace.out | grep '#0 DeepStack::deepest (this=.*,x=33)' -// RUN: gdb -q -batch -n -x Output/StackTrace.gdbin Output/StackTrace.exe | grep '#7 0x.* in main(argc=1, argv=.*)' +// RUN: gdb -q -batch -n -x Output/StackTrace.gdbin Output/StackTrace.exe | tee Output/StackTrace.out | grep '#0 DeepStack::deepest.*(this=.*,.*x=33)' +// RUN: gdb -q -batch -n -x Output/StackTrace.gdbin Output/StackTrace.exe | grep '#7 0x.* in main.*(argc=[12],.*argv=.*)' // XFAIL: linux From rafael.espindola at gmail.com Wed Nov 8 11:07:46 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Wed, 8 Nov 2006 11:07:46 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMAsmPrinter.cpp ARMISelDAGToDAG.cpp ARMInstrInfo.td ARMRegisterInfo.cpp Message-ID: <200611081707.kA8H7kqU012735@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMAsmPrinter.cpp updated: 1.27 -> 1.28 ARMISelDAGToDAG.cpp updated: 1.82 -> 1.83 ARMInstrInfo.td updated: 1.73 -> 1.74 ARMRegisterInfo.cpp updated: 1.24 -> 1.25 --- Log message: initial implementation of addressing mode 2 TODO: fix lea_addri --- Diffs of the changes: (+72 -15) ARMAsmPrinter.cpp | 19 +++++++++++++++++++ ARMISelDAGToDAG.cpp | 32 +++++++++++++++++++++++++++++++- ARMInstrInfo.td | 18 +++++++++++++----- ARMRegisterInfo.cpp | 18 +++++++++--------- 4 files changed, 72 insertions(+), 15 deletions(-) Index: llvm/lib/Target/ARM/ARMAsmPrinter.cpp diff -u llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.27 llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.28 --- llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.27 Thu Nov 2 09:00:02 2006 +++ llvm/lib/Target/ARM/ARMAsmPrinter.cpp Wed Nov 8 11:07:31 2006 @@ -76,6 +76,7 @@ } void printAddrMode1(const MachineInstr *MI, int opNum); + void printAddrMode2(const MachineInstr *MI, int opNum); void printAddrMode5(const MachineInstr *MI, int opNum); void printMemRegImm(const MachineInstr *MI, int opNum, @@ -215,6 +216,24 @@ } } +void ARMAsmPrinter::printAddrMode2(const MachineInstr *MI, int opNum) { + const MachineOperand &Arg = MI->getOperand(opNum); + const MachineOperand &Offset = MI->getOperand(opNum + 1); + assert(Offset.isImmediate()); + + if (Arg.isConstantPoolIndex()) { + assert(Offset.getImmedValue() == 0); + printOperand(MI, opNum); + } else { + assert(Arg.isRegister()); + O << '['; + printOperand(MI, opNum); + O << ", "; + printOperand(MI, opNum + 1); + O << ']'; + } +} + void ARMAsmPrinter::printAddrMode5(const MachineInstr *MI, int opNum) { const MachineOperand &Arg = MI->getOperand(opNum); const MachineOperand &Offset = MI->getOperand(opNum + 1); Index: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp diff -u llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.82 llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.83 --- llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.82 Thu Nov 2 09:00:02 2006 +++ llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Wed Nov 8 11:07:32 2006 @@ -754,6 +754,7 @@ bool SelectAddrRegImm(SDOperand N, SDOperand &Offset, SDOperand &Base); bool SelectAddrMode1(SDOperand N, SDOperand &Arg, SDOperand &Shift, SDOperand &ShiftType); + bool SelectAddrMode2(SDOperand N, SDOperand &Arg, SDOperand &Offset); bool SelectAddrMode5(SDOperand N, SDOperand &Arg, SDOperand &Offset); // Include the pieces autogenerated from the target description. @@ -820,7 +821,7 @@ int alignment = 2; SDOperand Addr = CurDAG->getTargetConstantPool(C, MVT::i32, alignment); SDOperand Z = CurDAG->getTargetConstant(0, MVT::i32); - SDNode *n = CurDAG->getTargetNode(ARM::ldr, MVT::i32, Z, Addr); + SDNode *n = CurDAG->getTargetNode(ARM::LDR, MVT::i32, Addr, Z); Arg = SDOperand(n, 0); } else Arg = CurDAG->getTargetConstant(val, MVT::i32); @@ -852,6 +853,35 @@ return true; } +bool ARMDAGToDAGISel::SelectAddrMode2(SDOperand N, SDOperand &Arg, + SDOperand &Offset) { + //TODO: complete and cleanup! + SDOperand Zero = CurDAG->getTargetConstant(0, MVT::i32); + if (FrameIndexSDNode *FIN = dyn_cast(N)) { + Arg = CurDAG->getTargetFrameIndex(FIN->getIndex(), MVT::i32); + Offset = Zero; + return true; + } + if (N.getOpcode() == ISD::ADD) { + short imm = 0; + if (isInt12Immediate(N.getOperand(1), imm)) { + Offset = CurDAG->getTargetConstant(imm, MVT::i32); + if (FrameIndexSDNode *FI = dyn_cast(N.getOperand(0))) { + Arg = CurDAG->getTargetFrameIndex(FI->getIndex(), N.getValueType()); + } else { + Arg = N.getOperand(0); + } + return true; // [r+i] + } + } + Offset = Zero; + if (FrameIndexSDNode *FI = dyn_cast(N)) + Arg = CurDAG->getTargetFrameIndex(FI->getIndex(), N.getValueType()); + else + Arg = N; + return true; +} + bool ARMDAGToDAGISel::SelectAddrMode5(SDOperand N, SDOperand &Arg, SDOperand &Offset) { //TODO: detect offset Index: llvm/lib/Target/ARM/ARMInstrInfo.td diff -u llvm/lib/Target/ARM/ARMInstrInfo.td:1.73 llvm/lib/Target/ARM/ARMInstrInfo.td:1.74 --- llvm/lib/Target/ARM/ARMInstrInfo.td:1.73 Fri Nov 3 17:47:46 2006 +++ llvm/lib/Target/ARM/ARMInstrInfo.td Wed Nov 8 11:07:32 2006 @@ -18,6 +18,11 @@ let MIOperandInfo = (ops ptr_rc, ptr_rc, i32imm); } +def op_addr_mode2 : Operand { + let PrintMethod = "printAddrMode2"; + let MIOperandInfo = (ops ptr_rc, i32imm); +} + def op_addr_mode5 : Operand { let PrintMethod = "printAddrMode5"; let MIOperandInfo = (ops ptr_rc, i32imm); @@ -33,6 +38,9 @@ def addr_mode1 : ComplexPattern; +//Addressing Mode 2: Load and Store Word or Unsigned Byte +def addr_mode2 : ComplexPattern; + //Addressing Mode 5: VFP load/store def addr_mode5 : ComplexPattern; @@ -157,9 +165,9 @@ def blx : InstARM<(ops IntRegs:$func, variable_ops), "blx $func", [(ARMcall IntRegs:$func)]>; } -def ldr : InstARM<(ops IntRegs:$dst, memri:$addr), +def LDR : InstARM<(ops IntRegs:$dst, op_addr_mode2:$addr), "ldr $dst, $addr", - [(set IntRegs:$dst, (load iaddr:$addr))]>; + [(set IntRegs:$dst, (load addr_mode2:$addr))]>; def LDRB : InstARM<(ops IntRegs:$dst, IntRegs:$addr), "ldrb $dst, [$addr]", @@ -177,9 +185,9 @@ "ldrsh $dst, [$addr]", [(set IntRegs:$dst, (sextloadi16 IntRegs:$addr))]>; -def str : InstARM<(ops IntRegs:$src, memri:$addr), - "str $src, $addr", - [(store IntRegs:$src, iaddr:$addr)]>; +def STR : InstARM<(ops IntRegs:$src, op_addr_mode2:$addr), + "str $src, $addr", + [(store IntRegs:$src, addr_mode2:$addr)]>; def STRB : InstARM<(ops IntRegs:$src, IntRegs:$addr), "strb $src, [$addr]", Index: llvm/lib/Target/ARM/ARMRegisterInfo.cpp diff -u llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.24 llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.25 --- llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.24 Tue Oct 31 07:03:26 2006 +++ llvm/lib/Target/ARM/ARMRegisterInfo.cpp Wed Nov 8 11:07:32 2006 @@ -44,7 +44,7 @@ unsigned SrcReg, int FI, const TargetRegisterClass *RC) const { assert (RC == ARM::IntRegsRegisterClass); - BuildMI(MBB, I, ARM::str, 3).addReg(SrcReg).addImm(0).addFrameIndex(FI); + BuildMI(MBB, I, ARM::STR, 3).addReg(SrcReg).addFrameIndex(FI).addImm(0); } void ARMRegisterInfo:: @@ -52,7 +52,7 @@ unsigned DestReg, int FI, const TargetRegisterClass *RC) const { assert (RC == ARM::IntRegsRegisterClass); - BuildMI(MBB, I, ARM::ldr, 2, DestReg).addImm(0).addFrameIndex(FI); + BuildMI(MBB, I, ARM::LDR, 2, DestReg).addFrameIndex(FI).addImm(0); } void ARMRegisterInfo::copyRegToReg(MachineBasicBlock &MBB, @@ -128,12 +128,12 @@ MachineBasicBlock &MBB = *MI.getParent(); MachineFunction &MF = *MBB.getParent(); - assert (MI.getOpcode() == ARM::ldr || - MI.getOpcode() == ARM::str || + assert (MI.getOpcode() == ARM::LDR || + MI.getOpcode() == ARM::STR || MI.getOpcode() == ARM::lea_addri); - unsigned FrameIdx = 2; - unsigned OffIdx = 1; + unsigned FrameIdx = MI.getOpcode() == ARM::lea_addri ? 2 : 1; + unsigned OffIdx = MI.getOpcode() == ARM::lea_addri ? 1 : 2; int FrameIndex = MI.getOperand(FrameIdx).getFrameIndex(); @@ -195,8 +195,8 @@ .addImm(0).addImm(ARMShift::LSL); if (HasFP) { - BuildMI(MBB, MBBI, ARM::str, 3) - .addReg(ARM::R11).addImm(0).addReg(ARM::R13); + BuildMI(MBB, MBBI, ARM::STR, 3) + .addReg(ARM::R11).addReg(ARM::R13).addImm(0); BuildMI(MBB, MBBI, ARM::MOV, 3, ARM::R11).addReg(ARM::R13).addImm(0). addImm(ARMShift::LSL); } @@ -214,7 +214,7 @@ if (hasFP(MF)) { BuildMI(MBB, MBBI, ARM::MOV, 3, ARM::R13).addReg(ARM::R11).addImm(0). addImm(ARMShift::LSL); - BuildMI(MBB, MBBI, ARM::ldr, 2, ARM::R11).addImm(0).addReg(ARM::R13); + BuildMI(MBB, MBBI, ARM::LDR, 2, ARM::R11).addReg(ARM::R13).addImm(0); } //add sp, sp, #NumBytes From jlaskey at apple.com Wed Nov 8 11:19:43 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 8 Nov 2006 11:19:43 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/DataTypes.h.in Message-ID: <200611081719.kA8HJhPl012938@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Support: DataTypes.h.in updated: 1.23 -> 1.24 --- Log message: Add backup support for HUGH_VALF. --- Diffs of the changes: (+4 -0) DataTypes.h.in | 4 ++++ 1 files changed, 4 insertions(+) Index: llvm/include/llvm/Support/DataTypes.h.in diff -u llvm/include/llvm/Support/DataTypes.h.in:1.23 llvm/include/llvm/Support/DataTypes.h.in:1.24 --- llvm/include/llvm/Support/DataTypes.h.in:1.23 Wed Apr 19 19:18:39 2006 +++ llvm/include/llvm/Support/DataTypes.h.in Wed Nov 8 11:19:29 2006 @@ -117,4 +117,8 @@ #define END_WITH_NULL #endif +#ifndef HUGE_VALF +#define HUGE_VALF (float)HUGE_VAL +#endif + #endif /* SUPPORT_DATATYPES_H */ From jlaskey at apple.com Wed Nov 8 11:19:47 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 8 Nov 2006 13:19:47 -0400 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp RegAllocLinearScan.cpp In-Reply-To: References: <200611071226.kA7CQ5v8011213@zion.cs.uiuc.edu> <4551FFEC.6070506@cs.uiuc.edu> Message-ID: <78E2D7B2-20D3-4B04-B102-BD3E63168257@apple.com> John, Adding declaration to DataTypes.h(.in). Cheers, -- Jim On Nov 8, 2006, at 12:30 PM, Jim Laskey wrote: > John, > > Both are defined on Darwin, FLT_MAX in float.h and HUGE_VALF in > math.h. However, neither header seems to be based on a BSD > header. I choose HUGE_VALF because it was also defined in the > LINUX and FREEBSD math.h headers (seemed like confirmation to me.) > I'll wait for Chris to make the call. (might uses a #ifndef > HUGE_VALF thingame.) > > Cheers, > > -- Jim > > > > > > On Nov 8, 2006, at 12:03 PM, John Criswell wrote: > >> Dear Mr. Laskey, >> >> This change broke the LLVM build on OpenBSD. Would it be possible to >> use FLT_MAX instead of HUGE_VALF? FLT_MAX from float.h looks more >> portable. >> >> -- John T. >> >> Jim Laskey wrote: >>> Changes in directory llvm/lib/CodeGen: >>> >>> LiveIntervalAnalysis.cpp updated: 1.190 -> 1.191 >>> RegAllocLinearScan.cpp updated: 1.129 -> 1.130 >>> --- >>> Log message: >>> >>> Use correct value for float HUGH_VAL. >>> >>> --- >>> Diffs of the changes: (+6 -6) >>> >>> LiveIntervalAnalysis.cpp | 8 ++++---- >>> RegAllocLinearScan.cpp | 4 ++-- >>> 2 files changed, 6 insertions(+), 6 deletions(-) >>> >>> >>> Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp >>> diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.190 llvm/lib/ >>> CodeGen/LiveIntervalAnalysis.cpp:1.191 >>> --- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.190 Tue Nov 7 >>> 01:18:40 2006 >>> +++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Tue Nov 7 06:25:45 >>> 2006 >>> @@ -219,7 +219,7 @@ >>> // range the use follows def immediately, it doesn't make >>> sense to spill >>> // it and hope it will be easier to allocate for this li. >>> if (isZeroLengthInterval(&LI)) >>> - LI.weight = float(HUGE_VAL); >>> + LI.weight = HUGE_VALF; >>> >>> if (EnableReweight) { >>> // Divide the weight of the interval by its size. This >>> encourages >>> @@ -265,7 +265,7 @@ >>> >>> std::vector added; >>> >>> - assert(li.weight != HUGE_VAL && >>> + assert(li.weight != HUGE_VALF && >>> "attempt to spill already spilled interval!"); >>> >>> DEBUG(std::cerr << "\t\t\t\tadding intervals for spills for >>> interval: "; >>> @@ -340,7 +340,7 @@ >>> >>> // the spill weight is now infinity as it >>> // cannot be spilled again >>> - nI.weight = float(HUGE_VAL); >>> + nI.weight = HUGE_VALF; >>> >>> if (HasUse) { >>> LiveRange LR(getLoadIndex(index), getUseIndex(index), >>> @@ -1362,6 +1362,6 @@ >>> >>> LiveInterval LiveIntervals::createInterval(unsigned reg) { >>> float Weight = MRegisterInfo::isPhysicalRegister(reg) ? >>> - (float)HUGE_VAL : 0.0F; >>> + HUGE_VALF : 0.0F; >>> return LiveInterval(reg, Weight); >>> } >>> >>> >>> Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp >>> diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.129 llvm/lib/ >>> CodeGen/RegAllocLinearScan.cpp:1.130 >>> --- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.129 Tue Oct 24 >>> 09:35:25 2006 >>> +++ llvm/lib/CodeGen/RegAllocLinearScan.cpp Tue Nov 7 06:25:45 2006 >>> @@ -545,7 +545,7 @@ >>> DEBUG(std::cerr << "\tassigning stack slot at interval "<< >>> *cur << ":\n"); >>> >>> // Find a register to spill. >>> - float minWeight = float(HUGE_VAL); >>> + float minWeight = HUGE_VALF; >>> unsigned minReg = 0; >>> for (TargetRegisterClass::iterator i = RC- >>> >allocation_order_begin(*mf_), >>> e = RC->allocation_order_end(*mf_); i != e; ++i) { >>> @@ -582,7 +582,7 @@ >>> // if the current has the minimum weight, we need to spill it and >>> // add any added intervals back to unhandled, and restart >>> // linearscan. >>> - if (cur->weight != float(HUGE_VAL) && cur->weight <= minWeight) { >>> + if (cur->weight != HUGE_VALF && cur->weight <= minWeight) { >>> DEBUG(std::cerr << "\t\t\tspilling(c): " << *cur << '\n';); >>> int slot = vrm_->assignVirt2StackSlot(cur->reg); >>> std::vector added = >>> >>> >>> >>> _______________________________________________ >>> llvm-commits mailing list >>> llvm-commits at cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits >>> >> > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061108/9dc16081/attachment.html -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2417 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061108/9dc16081/attachment.bin From tonic at nondot.org Wed Nov 8 11:39:06 2006 From: tonic at nondot.org (Tanya Lattner) Date: Wed, 8 Nov 2006 11:39:06 -0600 Subject: [llvm-commits] [release_19] CVS: llvm/lib/CodeGen/DwarfWriter.cpp Message-ID: <200611081739.kA8Hd6Zt013328@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: DwarfWriter.cpp updated: 1.97 -> 1.97.2.1 --- Log message: Merging from mainline --- Diffs of the changes: (+2 -0) DwarfWriter.cpp | 2 ++ 1 files changed, 2 insertions(+) Index: llvm/lib/CodeGen/DwarfWriter.cpp diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.97 llvm/lib/CodeGen/DwarfWriter.cpp:1.97.2.1 --- llvm/lib/CodeGen/DwarfWriter.cpp:1.97 Mon Nov 6 10:23:59 2006 +++ llvm/lib/CodeGen/DwarfWriter.cpp Wed Nov 8 11:38:54 2006 @@ -2418,6 +2418,8 @@ /// EmitFunctionDebugFrame - Emit per function frame info into a debug frame /// section. void EmitFunctionDebugFrame() { + if (!TAI->getDwarfRequiresFrameSection()) + return; // Start the dwarf frame section. Asm->SwitchToDataSection(TAI->getDwarfFrameSection()); From rspencer at reidspencer.com Wed Nov 8 11:39:02 2006 From: rspencer at reidspencer.com (Reid Spencer) Date: Wed, 08 Nov 2006 09:39:02 -0800 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/DataTypes.h.in In-Reply-To: <200611081719.kA8HJhPl012938@zion.cs.uiuc.edu> References: <200611081719.kA8HJhPl012938@zion.cs.uiuc.edu> Message-ID: <1163007542.30912.301.camel@bashful.x10sys.com> Jim, Perhaps this ... On Wed, 2006-11-08 at 11:19 -0600, Jim Laskey wrote: > > Changes in directory llvm/include/llvm/Support: > > DataTypes.h.in updated: 1.23 -> 1.24 > --- > Log message: > > Add backup support for HUGH_VALF. > > --- > Diffs of the changes: (+4 -0) > > DataTypes.h.in | 4 ++++ > 1 files changed, 4 insertions(+) > > > Index: llvm/include/llvm/Support/DataTypes.h.in > diff -u llvm/include/llvm/Support/DataTypes.h.in:1.23 llvm/include/llvm/Support/DataTypes.h.in:1.24 > --- llvm/include/llvm/Support/DataTypes.h.in:1.23 Wed Apr 19 19:18:39 2006 > +++ llvm/include/llvm/Support/DataTypes.h.in Wed Nov 8 11:19:29 2006 > @@ -117,4 +117,8 @@ > #define END_WITH_NULL > #endif > > +#ifndef HUGE_VALF > +#define HUGE_VALF (float)HUGE_VAL > +#endif How about: #ifndef HUGE_VALF #ifndef HUGE_VAL #ifndef MAX_FLT #warning don't know how to define HUGE_VALF #else #define HUGE_VALF MAX_FLT #endif #else #define HUGE_VALF (float)HUGE_VAL #endif #endif ? > + > #endif /* SUPPORT_DATATYPES_H */ > > > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From tonic at nondot.org Wed Nov 8 11:41:46 2006 From: tonic at nondot.org (Tanya Lattner) Date: Wed, 8 Nov 2006 11:41:46 -0600 Subject: [llvm-commits] [release_19] CVS: llvm/lib/AsmParser/llvmAsmParser.y Message-ID: <200611081741.kA8HfkQH018803@zion.cs.uiuc.edu> Changes in directory llvm/lib/AsmParser: llvmAsmParser.y updated: 1.272 -> 1.272.2.1 --- Log message: Merging from mainline. --- Diffs of the changes: (+2 -2) llvmAsmParser.y | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.272 llvm/lib/AsmParser/llvmAsmParser.y:1.272.2.1 --- llvm/lib/AsmParser/llvmAsmParser.y:1.272 Wed Nov 1 19:53:58 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y Wed Nov 8 11:41:32 2006 @@ -2102,8 +2102,8 @@ }; FnDeclareLinkage: /*default*/ | - DLLIMPORT { CurFun.Linkage = GlobalValue::DLLImportLinkage } | - EXTERN_WEAK { CurFun.Linkage = GlobalValue::DLLImportLinkage }; + DLLIMPORT { CurFun.Linkage = GlobalValue::DLLImportLinkage; } | + EXTERN_WEAK { CurFun.Linkage = GlobalValue::DLLImportLinkage; }; FunctionProto : DECLARE { CurFun.isDeclare = true; } FnDeclareLinkage FunctionHeaderH { $$ = CurFun.CurrentFunction; From clattner at apple.com Wed Nov 8 11:41:25 2006 From: clattner at apple.com (Chris Lattner) Date: Wed, 8 Nov 2006 09:41:25 -0800 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/DataTypes.h.in In-Reply-To: <1163007542.30912.301.camel@bashful.x10sys.com> References: <200611081719.kA8HJhPl012938@zion.cs.uiuc.edu> <1163007542.30912.301.camel@bashful.x10sys.com> Message-ID: > > #ifndef HUGE_VALF > #ifndef HUGE_VAL > #ifndef MAX_FLT > #warning don't know how to define HUGE_VALF > #else > #define HUGE_VALF MAX_FLT > #endif > #else > #define HUGE_VALF (float)HUGE_VAL > #endif > #endif More significantly, neither of these will work unless you #include and/or float.h. -Chris From tonic at nondot.org Wed Nov 8 11:44:28 2006 From: tonic at nondot.org (Tanya Lattner) Date: Wed, 8 Nov 2006 11:44:28 -0600 Subject: [llvm-commits] [release_19] CVS: llvm/lib/AsmParser/llvmAsmParser.y Message-ID: <200611081744.kA8HiSba019903@zion.cs.uiuc.edu> Changes in directory llvm/lib/AsmParser: llvmAsmParser.y updated: 1.272.2.1 -> 1.272.2.2 --- Log message: Merging from mainline cvs --- Diffs of the changes: (+800 -2289) llvmAsmParser.y | 3089 ++++++++++++++------------------------------------------ 1 files changed, 800 insertions(+), 2289 deletions(-) Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.272.2.1 llvm/lib/AsmParser/llvmAsmParser.y:1.272.2.2 --- llvm/lib/AsmParser/llvmAsmParser.y:1.272.2.1 Wed Nov 8 11:41:32 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y Wed Nov 8 11:44:16 2006 @@ -1,233 +1,164 @@ -//===-- llvmAsmParser.y - Parser for llvm assembly files --------*- C++ -*-===// +//===-- llvmAsmParser.y - Parser for llvm assembly files ---------*- C++ -*--=// // -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. +// This file implements the bison parser for LLVM assembly languages files. // -//===----------------------------------------------------------------------===// +//===------------------------------------------------------------------------=// + // -// This file implements the bison parser for LLVM assembly languages files. +// TODO: Parse comments and add them to an internal node... so that they may +// be saved in the bytecode format as well as everything else. Very important +// for a general IR format. // -//===----------------------------------------------------------------------===// %{ #include "ParserInternals.h" -#include "llvm/CallingConv.h" -#include "llvm/InlineAsm.h" -#include "llvm/Instructions.h" -#include "llvm/Module.h" +#include "llvm/Assembly/Parser.h" #include "llvm/SymbolTable.h" -#include "llvm/Assembly/AutoUpgrade.h" -#include "llvm/Support/GetElementPtrTypeIterator.h" -#include "llvm/ADT/STLExtras.h" -#include "llvm/Support/MathExtras.h" -#include -#include +#include "llvm/Module.h" +#include "llvm/GlobalVariable.h" +#include "llvm/Method.h" +#include "llvm/BasicBlock.h" +#include "llvm/DerivedTypes.h" +#include "llvm/iTerminators.h" +#include "llvm/iMemory.h" +#include "llvm/Support/STLExtras.h" +#include "llvm/Support/DepthFirstIterator.h" #include -#include - -// The following is a gross hack. In order to rid the libAsmParser library of -// exceptions, we have to have a way of getting the yyparse function to go into -// an error situation. So, whenever we want an error to occur, the GenerateError -// function (see bottom of file) sets TriggerError. Then, at the end of each -// production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR -// (a goto) to put YACC in error state. Furthermore, several calls to -// GenerateError are made from inside productions and they must simulate the -// previous exception behavior by exiting the production immediately. We have -// replaced these with the GEN_ERROR macro which calls GeneratError and then -// immediately invokes YYERROR. This would be so much cleaner if it was a -// recursive descent parser. -static bool TriggerError = false; -#define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } } -#define GEN_ERROR(msg) { GenerateError(msg); YYERROR; } +#include // Get definition of pair class +#include +#include // This embarasment is due to our flex lexer... -int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit +int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit int yylex(); // declaration" of xxx warnings. int yyparse(); -namespace llvm { - std::string CurFilename; -} -using namespace llvm; - static Module *ParserResult; +string CurFilename; // DEBUG_UPREFS - Define this symbol if you want to enable debugging output // relating to upreferences in the input stream. // //#define DEBUG_UPREFS 1 #ifdef DEBUG_UPREFS -#define UR_OUT(X) std::cerr << X +#define UR_OUT(X) cerr << X #else #define UR_OUT(X) #endif -#define YYERROR_VERBOSE 1 - -static bool ObsoleteVarArgs; -static bool NewVarArgs; -static BasicBlock *CurBB; -static GlobalVariable *CurGV; - - -// This contains info used when building the body of a function. It is -// destroyed when the function is completed. +// This contains info used when building the body of a method. It is destroyed +// when the method is completed. // -typedef std::vector ValueList; // Numbered defs -static void -ResolveDefinitions(std::map &LateResolvers, - std::map *FutureLateResolvers = 0); +typedef vector ValueList; // Numbered defs +static void ResolveDefinitions(vector &LateResolvers); +static void ResolveTypes (vector > &LateResolveTypes); static struct PerModuleInfo { Module *CurrentModule; - std::map Values; // Module level numbered definitions - std::map LateResolveValues; - std::vector Types; - std::map LateResolveTypes; - - /// PlaceHolderInfo - When temporary placeholder objects are created, remember - /// how they were referenced and on which line of the input they came from so - /// that we can resolve them later and print error messages as appropriate. - std::map > PlaceHolderInfo; - - // GlobalRefs - This maintains a mapping between 's and forward - // references to global values. Global values may be referenced before they - // are defined, and if so, the temporary object that they represent is held - // here. This is used for forward references of GlobalValues. - // - typedef std::map, GlobalValue*> GlobalRefsType; - GlobalRefsType GlobalRefs; + vector Values; // Module level numbered definitions + vector LateResolveValues; + vector > Types, LateResolveTypes; void ModuleDone() { - // If we could not resolve some functions at function compilation time - // (calls to functions before they are defined), resolve them now... Types - // are resolved when the constant pool has been completely parsed. + // If we could not resolve some methods at method compilation time (calls to + // methods before they are defined), resolve them now... Types 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! - // - if (!GlobalRefs.empty()) { - std::string UndefinedReferences = "Unresolved global references exist:\n"; - - for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end(); - I != E; ++I) { - UndefinedReferences += " " + I->first.first->getDescription() + " " + - I->first.second.getName() + "\n"; - } - GenerateError(UndefinedReferences); - return; - } - // Look for intrinsic functions and CallInst that need to be upgraded - for (Module::iterator FI = CurrentModule->begin(), - FE = CurrentModule->end(); FI != FE; ) - UpgradeCallsToIntrinsic(FI++); - - Values.clear(); // Clear out function local definitions + Values.clear(); // Clear out method local definitions Types.clear(); CurrentModule = 0; } - - // GetForwardRefForGlobal - Check to see if there is a forward reference - // for this global. If so, remove it from the GlobalRefs map and return it. - // If not, just return null. - GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) { - // Check to see if there is a forward reference to this global variable... - // if there is, eliminate it and patch the reference to use the new def'n. - GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID)); - GlobalValue *Ret = 0; - if (I != GlobalRefs.end()) { - Ret = I->second; - GlobalRefs.erase(I); - } - return Ret; - } } CurModule; -static struct PerFunctionInfo { - Function *CurrentFunction; // Pointer to current function being created +static struct PerMethodInfo { + Method *CurrentMethod; // Pointer to current method being created - std::map Values; // Keep track of #'d definitions - std::map LateResolveValues; - bool isDeclare; // Is this function a forward declararation? - GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration. - - /// BBForwardRefs - When we see forward references to basic blocks, keep - /// track of them here. - std::map > BBForwardRefs; - std::vector NumberedBlocks; - unsigned NextBBNum; + vector Values; // Keep track of numbered definitions + vector LateResolveValues; + vector > Types, LateResolveTypes; + bool isDeclare; // Is this method a forward declararation? - inline PerFunctionInfo() { - CurrentFunction = 0; + inline PerMethodInfo() { + CurrentMethod = 0; isDeclare = false; - Linkage = GlobalValue::ExternalLinkage; } - inline void FunctionStart(Function *M) { - CurrentFunction = M; - NextBBNum = 0; - } - - void FunctionDone() { - NumberedBlocks.clear(); + inline ~PerMethodInfo() {} - // Any forward referenced blocks left? - if (!BBForwardRefs.empty()) { - GenerateError("Undefined reference to label " + - BBForwardRefs.begin()->first->getName()); - return; - } + inline void MethodStart(Method *M) { + CurrentMethod = M; + } - // Resolve all forward references now. - ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues); + void MethodDone() { + // If we could not resolve some blocks at parsing time (forward branches) + // resolve the branches now... + ResolveDefinitions(LateResolveValues); - Values.clear(); // Clear out function local definitions - CurrentFunction = 0; + Values.clear(); // Clear out method local definitions + Types.clear(); + CurrentMethod = 0; isDeclare = false; - Linkage = GlobalValue::ExternalLinkage; } -} CurFun; // Info for the current function... - -static bool inFunctionScope() { return CurFun.CurrentFunction != 0; } +} CurMeth; // Info for the current method... //===----------------------------------------------------------------------===// // Code to handle definitions of all the types //===----------------------------------------------------------------------===// -static int InsertValue(Value *V, - std::map &ValueTab = CurFun.Values) { - if (V->hasName()) return -1; // Is this a numbered definition? - - // Yes, insert the value into the value table... - ValueList &List = ValueTab[V->getType()]; - List.push_back(V); - return List.size()-1; +static void InsertValue(Value *D, vector &ValueTab = CurMeth.Values){ + if (!D->hasName()) { // Is this a numbered definition? + unsigned type = D->getType()->getUniqueID(); + if (ValueTab.size() <= type) + ValueTab.resize(type+1, ValueList()); + //printf("Values[%d][%d] = %d\n", type, ValueTab[type].size(), D); + ValueTab[type].push_back(D); + } +} + +// TODO: FIXME when Type are not const +static void InsertType(const Type *Ty, vector > &Types) { + Types.push_back(Ty); } static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) { switch (D.Type) { - case ValID::NumberVal: // Is it a numbered definition? + case 0: { // Is it a numbered definition? + unsigned Num = (unsigned)D.Num; + // Module constants occupy the lowest numbered slots... - if ((unsigned)D.Num < CurModule.Types.size()) - return CurModule.Types[(unsigned)D.Num]; - break; - case ValID::NameVal: // Is it a named definition? - if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) { - D.destroy(); // Free old strdup'd memory... - return N; + if (Num < CurModule.Types.size()) + return CurModule.Types[Num]; + + Num -= CurModule.Types.size(); + + // Check that the number is within bounds... + if (Num <= CurMeth.Types.size()) + return CurMeth.Types[Num]; + } + case 1: { // Is it a named definition? + string Name(D.Name); + SymbolTable *SymTab = 0; + if (CurMeth.CurrentMethod) + SymTab = CurMeth.CurrentMethod->getSymbolTable(); + Value *N = SymTab ? SymTab->lookup(Type::TypeTy, Name) : 0; + + if (N == 0) { + // Symbol table doesn't automatically chain yet... because the method + // hasn't been added to the module... + // + SymTab = CurModule.CurrentModule->getSymbolTable(); + if (SymTab) + N = SymTab->lookup(Type::TypeTy, Name); + if (N == 0) break; } - break; + + D.destroy(); // Free old strdup'd memory... + return N->castTypeAsserting(); + } default: - GenerateError("Internal parser error: Invalid symbol type reference!"); - return 0; + ThrowException("Invalid symbol type reference!"); } // If we reached here, we referenced either a symbol that we don't know about @@ -236,251 +167,132 @@ // if (DoNotImprovise) return 0; // Do we just want a null to be returned? + vector > *LateResolver = CurMeth.CurrentMethod ? + &CurMeth.LateResolveTypes : &CurModule.LateResolveTypes; - if (inFunctionScope()) { - if (D.Type == ValID::NameVal) { - GenerateError("Reference to an undefined type: '" + D.getName() + "'"); - return 0; - } else { - GenerateError("Reference to an undefined type: #" + itostr(D.Num)); - return 0; - } - } - - std::map::iterator I =CurModule.LateResolveTypes.find(D); - if (I != CurModule.LateResolveTypes.end()) - return I->second; - - Type *Typ = OpaqueType::get(); - CurModule.LateResolveTypes.insert(std::make_pair(D, Typ)); + Type *Typ = new TypePlaceHolder(Type::TypeTy, D); + InsertType(Typ, *LateResolver); return Typ; - } +} -static Value *lookupInSymbolTable(const Type *Ty, const std::string &Name) { - SymbolTable &SymTab = - inFunctionScope() ? CurFun.CurrentFunction->getSymbolTable() : - CurModule.CurrentModule->getSymbolTable(); - return SymTab.lookup(Ty, Name); -} - -// getValNonImprovising - Look up the value specified by the provided type and -// the provided ValID. If the value exists and has already been defined, return -// it. Otherwise return null. -// -static Value *getValNonImprovising(const Type *Ty, const ValID &D) { - if (isa(Ty)) { - GenerateError("Functions are not values and " - "must be referenced as pointers"); - return 0; - } +static Value *getVal(const Type *Ty, const ValID &D, + bool DoNotImprovise = false) { + assert(Ty != Type::TypeTy && "Should use getTypeVal for types!"); switch (D.Type) { - case ValID::NumberVal: { // Is it a numbered definition? + case 0: { // Is it a numbered definition? + unsigned type = Ty->getUniqueID(); unsigned Num = (unsigned)D.Num; // Module constants occupy the lowest numbered slots... - std::map::iterator VI = CurModule.Values.find(Ty); - if (VI != CurModule.Values.end()) { - if (Num < VI->second.size()) - return VI->second[Num]; - Num -= VI->second.size(); + if (type < CurModule.Values.size()) { + if (Num < CurModule.Values[type].size()) + return CurModule.Values[type][Num]; + + Num -= CurModule.Values[type].size(); } // Make sure that our type is within bounds - VI = CurFun.Values.find(Ty); - if (VI == CurFun.Values.end()) return 0; + if (CurMeth.Values.size() <= type) + break; // Check that the number is within bounds... - if (VI->second.size() <= Num) return 0; - - return VI->second[Num]; + if (CurMeth.Values[type].size() <= Num) + break; + + return CurMeth.Values[type][Num]; } - - case ValID::NameVal: { // Is it a named definition? - Value *N = lookupInSymbolTable(Ty, std::string(D.Name)); - if (N == 0) return 0; + case 1: { // Is it a named definition? + string Name(D.Name); + SymbolTable *SymTab = 0; + if (CurMeth.CurrentMethod) + SymTab = CurMeth.CurrentMethod->getSymbolTable(); + Value *N = SymTab ? SymTab->lookup(Ty, Name) : 0; + + if (N == 0) { + // Symbol table doesn't automatically chain yet... because the method + // hasn't been added to the module... + // + SymTab = CurModule.CurrentModule->getSymbolTable(); + if (SymTab) + N = SymTab->lookup(Ty, Name); + if (N == 0) break; + } D.destroy(); // Free old strdup'd memory... return N; } - // Check to make sure that "Ty" is an integral type, and that our - // value will fit into the specified type... - case ValID::ConstSIntVal: // Is it a constant pool reference?? - if (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { - GenerateError("Signed integral constant '" + - itostr(D.ConstPool64) + "' is invalid for type '" + - Ty->getDescription() + "'!"); - return 0; - } - return ConstantInt::get(Ty, D.ConstPool64); - - case ValID::ConstUIntVal: // Is it an unsigned const pool reference? - if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) { - if (!ConstantInt::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 ConstantInt::get(Ty, D.ConstPool64); + case 2: // Is it a constant pool reference?? + case 3: // Is it an unsigned const pool reference? + case 4: // Is it a string const pool reference? + case 5:{ // Is it a floating point const pool reference? + ConstPoolVal *CPV = 0; + + // Check to make sure that "Ty" is an integral type, and that our + // value will fit into the specified type... + switch (D.Type) { + case 2: + if (Ty == Type::BoolTy) { // Special handling for boolean data + CPV = ConstPoolBool::get(D.ConstPool64 != 0); + } else { + if (!ConstPoolSInt::isValueValidForType(Ty, D.ConstPool64)) + ThrowException("Symbolic constant pool value '" + + itostr(D.ConstPool64) + "' is invalid for type '" + + Ty->getName() + "'!"); + CPV = ConstPoolSInt::get(Ty, D.ConstPool64); } - } else { - return ConstantInt::get(Ty, D.UConstPool64); - } - - case ValID::ConstFPVal: // Is it a floating point const pool reference? - 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)) { - GenerateError("Cannot create a a non pointer null!"); - return 0; - } - return ConstantPointerNull::get(cast(Ty)); - - case ValID::ConstUndefVal: // Is it an undef value? - return UndefValue::get(Ty); - - case ValID::ConstZeroVal: // Is it a zero value? - return Constant::getNullValue(Ty); - - case ValID::ConstantVal: // Fully resolved constant? - if (D.ConstantValue->getType() != Ty) { - 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)) { - GenerateError("Invalid type for asm constraint string!"); - return 0; + break; + case 3: + if (!ConstPoolUInt::isValueValidForType(Ty, D.UConstPool64)) { + if (!ConstPoolSInt::isValueValidForType(Ty, D.ConstPool64)) { + ThrowException("Integral constant pool reference is invalid!"); + } else { // This is really a signed reference. Transmogrify. + CPV = ConstPoolSInt::get(Ty, D.ConstPool64); + } + } else { + CPV = ConstPoolUInt::get(Ty, D.UConstPool64); + } + break; + case 4: + cerr << "FIXME: TODO: String constants [sbyte] not implemented yet!\n"; + abort(); + break; + case 5: + if (!ConstPoolFP::isValueValidForType(Ty, D.ConstPoolFP)) + ThrowException("FP constant invalid for type!!"); + else + CPV = ConstPoolFP::get(Ty, D.ConstPoolFP); + break; } - InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints, - D.IAD->HasSideEffects); - D.destroy(); // Free InlineAsmDescriptor. - return IA; - } + assert(CPV && "How did we escape creating a constant??"); + return CPV; + } // End of case 2,3,4 default: assert(0 && "Unhandled case!"); - return 0; } // End of switch - assert(0 && "Unhandled case!"); - return 0; -} - -// getVal - This function is identical to getValNonImprovising, except that if a -// value is not already defined, it "improvises" by creating a placeholder var -// that looks and acts just like the requested variable. When the value is -// defined later, all uses of the placeholder variable are replaced with the -// real thing. -// -static Value *getVal(const Type *Ty, const ValID &ID) { - if (Ty == Type::LabelTy) { - 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)) { - 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 // forward, so just create an entry to be resolved later and get to it... // - V = new Argument(Ty); - - // Remember where this forward reference came from. FIXME, shouldn't we try - // to recycle these things?? - CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID, - llvmAsmlineno))); - - if (inFunctionScope()) - InsertValue(V, CurFun.LateResolveValues); - else - InsertValue(V, CurModule.LateResolveValues); - return V; -} - -/// getBBVal - This is used for two purposes: -/// * If isDefinition is true, a new basic block with the specified ID is being -/// defined. -/// * If isDefinition is true, this is a reference to a basic block, which may -/// or may not be a forward reference. -/// -static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) { - assert(inFunctionScope() && "Can't get basic block at global scope!"); - - std::string Name; - BasicBlock *BB = 0; - switch (ID.Type) { - default: - 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); - BB = CurFun.NumberedBlocks[ID.Num]; - break; - case ValID::NameVal: // Is it a named definition? - Name = ID.Name; - if (Value *N = CurFun.CurrentFunction-> - getSymbolTable().lookup(Type::LabelTy, Name)) - BB = cast(N); - break; - } - - // See if the block has already been defined. - if (BB) { - // If this is the definition of the block, make sure the existing value was - // just a forward reference. If it was a forward reference, there will be - // an entry for it in the PlaceHolderInfo map. - if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) { - // The existing value was a definition, not a forward reference. - GenerateError("Redefinition of label " + ID.getName()); - return 0; - } + if (DoNotImprovise) return 0; // Do we just want a null to be returned? - ID.destroy(); // Free strdup'd memory. - return BB; + Value *d = 0; + vector *LateResolver = (CurMeth.CurrentMethod) ? + &CurMeth.LateResolveValues : &CurModule.LateResolveValues; + + switch (Ty->getPrimitiveID()) { + case Type::LabelTyID: d = new BBPlaceHolder(Ty, D); break; + case Type::MethodTyID: d = new MethPlaceHolder(Ty, D); + LateResolver = &CurModule.LateResolveValues; break; + default: d = new ValuePlaceHolder(Ty, D); break; } - // Otherwise this block has not been seen before. - BB = new BasicBlock("", CurFun.CurrentFunction); - if (ID.Type == ValID::NameVal) { - BB->setName(ID.Name); - } else { - CurFun.NumberedBlocks[ID.Num] = BB; - } - - // If this is not a definition, keep track of it so we can use it as a forward - // reference. - if (!isDefinition) { - // Remember where this forward reference came from. - CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno); - } else { - // The forward declaration could have been inserted anywhere in the - // function: insert it into the correct place now. - CurFun.CurrentFunction->getBasicBlockList().remove(BB); - CurFun.CurrentFunction->getBasicBlockList().push_back(BB); - } - ID.destroy(); - return BB; + assert(d != 0 && "How did we not make something?"); + InsertValue(d, *LateResolver); + return d; } @@ -492,550 +304,219 @@ // values not defined yet... for example, a forward branch, or the PHI node for // a loop body. // -// This keeps a table (CurFun.LateResolveValues) of all such forward references +// This keeps a table (CurMeth.LateResolveValues) of all such forward references // and back patchs after we are done. // -// ResolveDefinitions - If we could not resolve some defs at parsing -// time (forward branches, phi functions for loops, etc...) resolve the +// ResolveDefinitions - If we could not resolve some defs at parsing +// time (forward branches, phi functions for loops, etc...) resolve the // defs now... // -static void -ResolveDefinitions(std::map &LateResolvers, - std::map *FutureLateResolvers) { +static void ResolveDefinitions(vector &LateResolvers) { // Loop over LateResolveDefs fixing up stuff that couldn't be resolved - for (std::map::iterator LRI = LateResolvers.begin(), - E = LateResolvers.end(); LRI != E; ++LRI) { - ValueList &List = LRI->second; - while (!List.empty()) { - Value *V = List.back(); - List.pop_back(); - - std::map >::iterator PHI = - CurModule.PlaceHolderInfo.find(V); - assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!"); - - ValID &DID = PHI->second.first; - - Value *TheRealValue = getValNonImprovising(LRI->first, DID); - if (TriggerError) - return; - if (TheRealValue) { - V->replaceAllUsesWith(TheRealValue); - delete V; - CurModule.PlaceHolderInfo.erase(PHI); - } else if (FutureLateResolvers) { - // Functions have their unresolved items forwarded to the module late - // resolver table - InsertValue(V, *FutureLateResolvers); - } else { - if (DID.Type == ValID::NameVal) { - GenerateError("Reference to an invalid definition: '" +DID.getName()+ - "' of type '" + V->getType()->getDescription() + "'", - PHI->second.second); - return; - } else { - GenerateError("Reference to an invalid definition: #" + - itostr(DID.Num) + " of type '" + - V->getType()->getDescription() + "'", - PHI->second.second); - return; - } + for (unsigned ty = 0; ty < LateResolvers.size(); ty++) { + while (!LateResolvers[ty].empty()) { + Value *V = LateResolvers[ty].back(); + LateResolvers[ty].pop_back(); + ValID &DID = getValIDFromPlaceHolder(V); + + Value *TheRealValue = getVal(Type::getUniqueIDType(ty), DID, true); + + if (TheRealValue == 0) { + if (DID.Type == 1) + ThrowException("Reference to an invalid definition: '" +DID.getName()+ + "' of type '" + V->getType()->getDescription() + "'", + getLineNumFromPlaceHolder(V)); + else + ThrowException("Reference to an invalid definition: #" + + itostr(DID.Num) + " of type '" + + V->getType()->getDescription() + "'", + getLineNumFromPlaceHolder(V)); } + + assert(!V->isType() && "Types should be in LateResolveTypes!"); + + V->replaceAllUsesWith(TheRealValue); + delete V; } } LateResolvers.clear(); } -// ResolveTypeTo - A brand new type was just declared. This means that (if -// name is not null) things referencing Name can be resolved. Otherwise, things -// refering to the number can be resolved. Do this now. -// -static void ResolveTypeTo(char *Name, const Type *ToTy) { - ValID D; - if (Name) D = ValID::create(Name); - else D = ValID::create((int)CurModule.Types.size()); - - std::map::iterator I = - CurModule.LateResolveTypes.find(D); - if (I != CurModule.LateResolveTypes.end()) { - ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy); - CurModule.LateResolveTypes.erase(I); - } -} - -// setValueName - Set the specified value to the name given. The name may be -// null potentially, in which case this is a noop. The string passed in is -// assumed to be a malloc'd string buffer, and is free'd by this function. -// -static void setValueName(Value *V, char *NameStr) { - if (NameStr) { - std::string Name(NameStr); // Copy string - free(NameStr); // Free old string - - if (V->getType() == Type::VoidTy) { - 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)) { - GenerateError("Redefinition of value named '" + Name + "' in the '" + - V->getType()->getDescription() + "' type plane!"); - return; +// ResolveTypes - This goes through the forward referenced type table and makes +// sure that all type references are complete. This code is executed after the +// constant pool of a method or module is completely parsed. +// +static void ResolveTypes(vector > &LateResolveTypes) { + while (!LateResolveTypes.empty()) { + const Type *Ty = LateResolveTypes.back(); + ValID &DID = getValIDFromPlaceHolder(Ty); + + const Type *TheRealType = getTypeVal(DID, true); + if (TheRealType == 0) { + if (DID.Type == 1) + ThrowException("Reference to an invalid type: '" +DID.getName(), + getLineNumFromPlaceHolder(Ty)); + else + ThrowException("Reference to an invalid type: #" + itostr(DID.Num), + getLineNumFromPlaceHolder(Ty)); } - // Set the name. - V->setName(Name); - } -} - -/// ParseGlobalVariable - Handle parsing of a global. If Initializer is null, -/// this is a declaration, otherwise it is a definition. -static GlobalVariable * -ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage, - bool isConstantGlobal, const Type *Ty, - Constant *Initializer) { - if (isa(Ty)) { - GenerateError("Cannot declare global vars of function type!"); - return 0; - } - - const PointerType *PTy = PointerType::get(Ty); - - std::string Name; - if (NameStr) { - Name = NameStr; // Copy string - free(NameStr); // Free old string - } - - // See if this global value was forward referenced. If so, recycle the - // object. - ValID ID; - if (!Name.empty()) { - ID = ValID::create((char*)Name.c_str()); - } else { - ID = ValID::create((int)CurModule.Values[PTy].size()); - } - - if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) { - // Move the global to the end of the list, from whereever it was - // previously inserted. - GlobalVariable *GV = cast(FWGV); - CurModule.CurrentModule->getGlobalList().remove(GV); - CurModule.CurrentModule->getGlobalList().push_back(GV); - GV->setInitializer(Initializer); - GV->setLinkage(Linkage); - GV->setConstant(isConstantGlobal); - InsertValue(GV, CurModule.Values); - return GV; - } - - // If this global has a name, check to see if there is already a definition - // of this global in the module. If so, merge as appropriate. Note that - // this is really just a hack around problems in the CFE. :( - if (!Name.empty()) { - // We are a simple redefinition of a value, check to see if it is defined - // the same as the old one. - if (GlobalVariable *EGV = - CurModule.CurrentModule->getGlobalVariable(Name, Ty)) { - // We are allowed to redefine a global variable in two circumstances: - // 1. If at least one of the globals is uninitialized or - // 2. If both initializers have the same value. - // - if (!EGV->hasInitializer() || !Initializer || - EGV->getInitializer() == Initializer) { - - // Make sure the existing global version gets the initializer! Make - // sure that it also gets marked const if the new version is. - if (Initializer && !EGV->hasInitializer()) - EGV->setInitializer(Initializer); - if (isConstantGlobal) - EGV->setConstant(true); - EGV->setLinkage(Linkage); - return EGV; - } + // FIXME: When types are not const + DerivedType *DTy = const_cast(Ty->castDerivedTypeAsserting()); + + // Refine the opaque type we had to the new type we are getting. + DTy->refineAbstractTypeTo(TheRealType); - GenerateError("Redefinition of global variable named '" + Name + - "' in the '" + Ty->getDescription() + "' type plane!"); - return 0; - } + // No need to delete type, refine does that for us. + LateResolveTypes.pop_back(); } - - // Otherwise there is no existing GV to use, create one now. - GlobalVariable *GV = - new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name, - CurModule.CurrentModule); - InsertValue(GV, CurModule.Values); - return GV; } -// setTypeName - Set the specified type to the name given. The name may be +// setValueName - Set the specified value to the name given. The name may be // null potentially, in which case this is a noop. The string passed in is // assumed to be a malloc'd string buffer, and is freed by this function. // -// This function returns true if the type has already been defined, but is -// allowed to be redefined in the specified context. If the name is a new name -// for the type plane, it is inserted and false is returned. -static bool setTypeName(const Type *T, char *NameStr) { - assert(!inFunctionScope() && "Can't give types function-local names!"); - if (NameStr == 0) return false; - - std::string Name(NameStr); // Copy string +static void setValueName(Value *V, char *NameStr) { + if (NameStr == 0) return; + string Name(NameStr); // Copy string free(NameStr); // Free old string - // We don't allow assigning names to void type - 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); - - if (AlreadyExists) { // Inserting a name that is already defined??? - const Type *Existing = CurModule.CurrentModule->getTypeByName(Name); - assert(Existing && "Conflict but no matching type?"); + SymbolTable *ST = CurMeth.CurrentMethod ? + CurMeth.CurrentMethod->getSymbolTableSure() : + CurModule.CurrentModule->getSymbolTableSure(); + Value *Existing = ST->lookup(V->getType(), Name); + if (Existing) { // Inserting a name that is already defined??? // There is only one case where this is allowed: when we are refining an // opaque type. In this case, Existing will be an opaque type. - if (const OpaqueType *OpTy = dyn_cast(Existing)) { - // We ARE replacing an opaque type! - const_cast(OpTy)->refineAbstractTypeTo(T); - return true; - } + if (const Type *Ty = Existing->castType()) + if (Ty->isOpaqueType()) { + // We ARE replacing an opaque type! + + // TODO: FIXME when types are not const! + const_cast(Ty->castDerivedTypeAsserting())->refineAbstractTypeTo(V->castTypeAsserting()); + return; + } - // Otherwise, this is an attempt to redefine a type. That's okay if - // the redefinition is identical to the original. This will be so if - // Existing and T point to the same Type object. In this one case we - // allow the equivalent redefinition. - if (Existing == T) return true; // Yes, it's equal. - - // Any other kind of (non-equivalent) redefinition is an error. - GenerateError("Redefinition of type named '" + Name + "' in the '" + - T->getDescription() + "' type plane!"); + // Otherwise, we are a simple redefinition of a value, baaad + ThrowException("Redefinition of value name '" + Name + "' in the '" + + V->getType()->getDescription() + "' type plane!"); } - return false; + V->setName(Name, ST); } + //===----------------------------------------------------------------------===// // Code for handling upreferences in type names... // -// TypeContains - Returns true if Ty directly contains E in it. +// TypeContains - Returns true if Ty contains E in it. // static bool TypeContains(const Type *Ty, const Type *E) { - return std::find(Ty->subtype_begin(), Ty->subtype_end(), - E) != Ty->subtype_end(); + return find(df_begin(Ty), df_end(Ty), E) != df_end(Ty); } -namespace { - struct UpRefRecord { - // NestingLevel - The number of nesting levels that need to be popped before - // this type is resolved. - unsigned NestingLevel; - - // LastContainedTy - This is the type at the current binding level for the - // type. Every time we reduce the nesting level, this gets updated. - const Type *LastContainedTy; - - // UpRefTy - This is the actual opaque type that the upreference is - // represented with. - OpaqueType *UpRefTy; - - UpRefRecord(unsigned NL, OpaqueType *URTy) - : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {} - }; -} - -// UpRefs - A list of the outstanding upreferences that need to be resolved. -static std::vector UpRefs; - -/// HandleUpRefs - Every time we finish a new layer of types, this function is -/// called. It loops through the UpRefs vector, which is a list of the -/// currently active types. For each type, if the up reference is contained in -/// the newly completed type, we decrement the level count. When the level -/// count reaches zero, the upreferenced type is the type that is passed in: -/// thus we can complete the cycle. -/// -static PATypeHolder HandleUpRefs(const Type *ty) { - // If Ty isn't abstract, or if there are no up-references in it, then there is - // nothing to resolve here. - if (!ty->isAbstract() || UpRefs.empty()) return ty; - - PATypeHolder Ty(ty); - UR_OUT("Type '" << Ty->getDescription() << - "' newly formed. Resolving upreferences.\n" << - UpRefs.size() << " upreferences active!\n"); - - // If we find any resolvable upreferences (i.e., those whose NestingLevel goes - // to zero), we resolve them all together before we resolve them to Ty. At - // the end of the loop, if there is anything to resolve to Ty, it will be in - // this variable. - OpaqueType *TypeToResolve = 0; - - for (unsigned i = 0; i != UpRefs.size(); ++i) { - UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", " - << UpRefs[i].second->getDescription() << ") = " - << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n"); - if (TypeContains(Ty, UpRefs[i].LastContainedTy)) { - // Decrement level of upreference - unsigned Level = --UpRefs[i].NestingLevel; - UpRefs[i].LastContainedTy = Ty; - UR_OUT(" Uplevel Ref Level = " << Level << "\n"); - if (Level == 0) { // Upreference should be resolved! - if (!TypeToResolve) { - TypeToResolve = UpRefs[i].UpRefTy; - } else { - UR_OUT(" * Resolving upreference for " - << UpRefs[i].second->getDescription() << "\n"; - std::string OldName = UpRefs[i].UpRefTy->getDescription()); - UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve); - UR_OUT(" * Type '" << OldName << "' refined upreference to: " - << (const void*)Ty << ", " << Ty->getDescription() << "\n"); - } - UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list... - --i; // Do not skip the next element... + +static vector > UpRefs; + +static PATypeHolder HandleUpRefs(const Type *ty) { + PATypeHolder Ty(ty); + UR_OUT(UpRefs.size() << " upreferences active!\n"); + for (unsigned i = 0; i < UpRefs.size(); ) { + UR_OUT("TypeContains(" << Ty->getDescription() << ", " + << UpRefs[i].second->getDescription() << ") = " + << TypeContains(Ty, UpRefs[i].second) << endl); + if (TypeContains(Ty, UpRefs[i].second)) { + unsigned Level = --UpRefs[i].first; // Decrement level of upreference + UR_OUT("Uplevel Ref Level = " << Level << endl); + if (Level == 0) { // Upreference should be resolved! + UR_OUT("About to resolve upreference!\n"; + string OldName = UpRefs[i].second->getDescription()); + UpRefs[i].second->refineAbstractTypeTo(Ty); + UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list... + UR_OUT("Type '" << OldName << "' refined upreference to: " + << (const void*)Ty << ", " << Ty->getDescription() << endl); + continue; } } - } - if (TypeToResolve) { - UR_OUT(" * Resolving upreference for " - << UpRefs[i].second->getDescription() << "\n"; - std::string OldName = TypeToResolve->getDescription()); - TypeToResolve->refineAbstractTypeTo(Ty); + ++i; // Otherwise, no resolve, move on... } - + // FIXME: TODO: this should return the updated type return Ty; } -/// This function is used to obtain the correct opcode for an instruction when -/// an obsolete opcode is encountered. The OI parameter (OpcodeInfo) has both -/// an opcode and an "obsolete" flag. These are generated by the lexer and -/// the "obsolete" member will be true when the lexer encounters the token for -/// an obsolete opcode. For example, "div" was replaced by [usf]div but we need -/// to maintain backwards compatibility for asm files that still have the "div" -/// instruction. This function handles converting div -> [usf]div appropriately. -/// @brief Convert obsolete opcodes to new values -static void -sanitizeOpCode(OpcodeInfo &OI, const PATypeHolder& PATy) -{ - // If its not obsolete, don't do anything - if (!OI.obsolete) - return; - - // If its a packed type we want to use the element type - const Type* Ty = PATy; - if (const PackedType* PTy = dyn_cast(Ty)) - Ty = PTy->getElementType(); - - // Depending on the opcode .. - switch (OI.opcode) { - default: - GenerateError("Invalid obsolete opCode (check Lexer.l)"); - break; - case Instruction::UDiv: - // Handle cases where the opcode needs to change - if (Ty->isFloatingPoint()) - OI.opcode = Instruction::FDiv; - else if (Ty->isSigned()) - OI.opcode = Instruction::SDiv; - break; - case Instruction::URem: - if (Ty->isFloatingPoint()) - OI.opcode = Instruction::FRem; - else if (Ty->isSigned()) - OI.opcode = Instruction::SRem; - break; - } - // Its not obsolete any more, we fixed it. - OI.obsolete = false; +template +inline static void TypeDone(PATypeHolder *Ty) { + if (UpRefs.size()) + ThrowException("Invalid upreference in type: " + (*Ty)->getDescription()); } - -// common code from the two 'RunVMAsmParser' functions -static Module* RunParser(Module * M) { - llvmAsmlineno = 1; // Reset the current line number... - ObsoleteVarArgs = false; - NewVarArgs = false; - CurModule.CurrentModule = M; - - // Check to make sure the parser succeeded - if (yyparse()) { - if (ParserResult) - delete ParserResult; - return 0; - } - - // Check to make sure that parsing produced a result - if (!ParserResult) - return 0; - - // Reset ParserResult variable while saving its value for the result. - Module *Result = ParserResult; - ParserResult = 0; - - //Not all functions use vaarg, so make a second check for ObsoleteVarArgs - { - Function* F; - if ((F = Result->getNamedFunction("llvm.va_start")) - && F->getFunctionType()->getNumParams() == 0) - ObsoleteVarArgs = true; - if((F = Result->getNamedFunction("llvm.va_copy")) - && F->getFunctionType()->getNumParams() == 1) - ObsoleteVarArgs = true; - } - - if (ObsoleteVarArgs && NewVarArgs) { - 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) { - GenerateError("Obsolete va_start takes 0 argument!"); - return 0; - } - - //foo = va_start() - // -> - //bar = alloca typeof(foo) - //va_start(bar) - //foo = load bar - - const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID); - const Type* ArgTy = F->getFunctionType()->getReturnType(); - const Type* ArgTyPtr = PointerType::get(ArgTy); - Function* NF = Result->getOrInsertFunction("llvm.va_start", - RetTy, ArgTyPtr, (Type *)0); - - while (!F->use_empty()) { - CallInst* CI = cast(F->use_back()); - AllocaInst* bar = new AllocaInst(ArgTy, 0, "vastart.fix.1", CI); - new CallInst(NF, bar, "", CI); - Value* foo = new LoadInst(bar, "vastart.fix.2", CI); - CI->replaceAllUsesWith(foo); - CI->getParent()->getInstList().erase(CI); - } - Result->getFunctionList().erase(F); - } - - if(Function* F = Result->getNamedFunction("llvm.va_end")) { - if(F->arg_size() != 1) { - GenerateError("Obsolete va_end takes 1 argument!"); - return 0; - } - - //vaend foo - // -> - //bar = alloca 1 of typeof(foo) - //vaend bar - const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID); - const Type* ArgTy = F->getFunctionType()->getParamType(0); - const Type* ArgTyPtr = PointerType::get(ArgTy); - Function* NF = Result->getOrInsertFunction("llvm.va_end", - RetTy, ArgTyPtr, (Type *)0); - - while (!F->use_empty()) { - CallInst* CI = cast(F->use_back()); - AllocaInst* bar = new AllocaInst(ArgTy, 0, "vaend.fix.1", CI); - new StoreInst(CI->getOperand(1), bar, CI); - new CallInst(NF, bar, "", CI); - CI->getParent()->getInstList().erase(CI); - } - Result->getFunctionList().erase(F); - } +// newTH - Allocate a new type holder for the specified type +template +inline static PATypeHolder *newTH(const TypeTy *Ty) { + return new PATypeHolder(Ty); +} +template +inline static PATypeHolder *newTH(const PATypeHolder &TH) { + return new PATypeHolder(TH); +} - if(Function* F = Result->getNamedFunction("llvm.va_copy")) { - if(F->arg_size() != 1) { - GenerateError("Obsolete va_copy takes 1 argument!"); - return 0; - } - //foo = vacopy(bar) - // -> - //a = alloca 1 of typeof(foo) - //b = alloca 1 of typeof(foo) - //store bar -> b - //vacopy(a, b) - //foo = load a - - const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID); - const Type* ArgTy = F->getFunctionType()->getReturnType(); - const Type* ArgTyPtr = PointerType::get(ArgTy); - Function* NF = Result->getOrInsertFunction("llvm.va_copy", - RetTy, ArgTyPtr, ArgTyPtr, - (Type *)0); - - while (!F->use_empty()) { - CallInst* CI = cast(F->use_back()); - AllocaInst* a = new AllocaInst(ArgTy, 0, "vacopy.fix.1", CI); - AllocaInst* b = new AllocaInst(ArgTy, 0, "vacopy.fix.2", CI); - new StoreInst(CI->getOperand(1), b, CI); - new CallInst(NF, a, b, "", CI); - Value* foo = new LoadInst(a, "vacopy.fix.3", CI); - CI->replaceAllUsesWith(foo); - CI->getParent()->getInstList().erase(CI); - } - Result->getFunctionList().erase(F); - } - } - return Result; +// newTHC - Allocate a new type holder for the specified type that can be +// casted to a new Type type. +template +inline static PATypeHolder *newTHC(const PATypeHolder &Old) { + return new PATypeHolder((const TypeTy*)Old.get()); } + //===----------------------------------------------------------------------===// // RunVMAsmParser - Define an interface to this parser //===----------------------------------------------------------------------===// // -Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) { - set_scan_file(F); - +Module *RunVMAsmParser(const string &Filename, FILE *F) { + llvmAsmin = F; CurFilename = Filename; - return RunParser(new Module(CurFilename)); -} + llvmAsmlineno = 1; // Reset the current line number... -Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) { - set_scan_string(AsmString); + CurModule.CurrentModule = new Module(); // Allocate a new module to read + yyparse(); // Parse the file. + Module *Result = ParserResult; + llvmAsmin = stdin; // F is about to go away, don't use it anymore... + ParserResult = 0; - CurFilename = "from_memory"; - if (M == NULL) { - return RunParser(new Module (CurFilename)); - } else { - return RunParser(M); - } + return Result; } %} %union { - llvm::Module *ModuleVal; - llvm::Function *FunctionVal; - std::pair *ArgVal; - llvm::BasicBlock *BasicBlockVal; - llvm::TerminatorInst *TermInstVal; - llvm::Instruction *InstVal; - llvm::Constant *ConstVal; - - const llvm::Type *PrimType; - llvm::PATypeHolder *TypeVal; - llvm::Value *ValueVal; - - std::vector > *ArgList; - std::vector *ValueList; - std::list *TypeList; - // Represent the RHS of PHI node - std::list > *PHIList; - std::vector > *JumpTable; - std::vector *ConstVector; + Module *ModuleVal; + Method *MethodVal; + MethodArgument *MethArgVal; + BasicBlock *BasicBlockVal; + TerminatorInst *TermInstVal; + Instruction *InstVal; + ConstPoolVal *ConstVal; + + const Type *PrimType; + PATypeHolder *TypeVal; + PATypeHolder *ArrayTypeTy; + PATypeHolder *StructTypeTy; + Value *ValueVal; + + list *MethodArgList; + list *ValueList; + list > *TypeList; + list > *PHIList; // Represent the RHS of PHI node + list > *JumpTable; + vector *ConstVector; - llvm::GlobalValue::LinkageTypes Linkage; int64_t SInt64Val; uint64_t UInt64Val; int SIntVal; @@ -1044,38 +525,31 @@ bool BoolVal; char *StrVal; // This memory is strdup'd! - llvm::ValID ValIDVal; // strdup'd memory maybe! + ValID ValIDVal; // strdup'd memory maybe! - BinaryOpInfo BinaryOpVal; - TermOpInfo TermOpVal; - MemOpInfo MemOpVal; - OtherOpInfo OtherOpVal; - llvm::Module::Endianness Endianness; + Instruction::UnaryOps UnaryOpVal; + Instruction::BinaryOps BinaryOpVal; + Instruction::TermOps TermOpVal; + Instruction::MemoryOps MemOpVal; + Instruction::OtherOps OtherOpVal; } -%type Module FunctionList -%type Function FunctionProto FunctionHeader BasicBlockList +%type Module MethodList +%type Method MethodProto MethodHeader BasicBlockList %type BasicBlock InstructionList %type BBTerminatorInst %type Inst InstVal MemoryInst -%type ConstVal ConstExpr -%type ConstVector -%type ArgList ArgListH -%type ArgVal +%type ConstVal ExtendedConstVal +%type ConstVector UByteList +%type ArgList ArgListH +%type ArgVal %type PHIList %type ValueRefList ValueRefListE // For call param lists -%type IndexList // For GEP derived indices %type TypeListI ArgTypeListI %type JumpTable %type GlobalType // GLOBAL or CONSTANT? -%type OptVolatile // 'volatile' or not -%type OptTailCall // TAIL CALL or plain CALL. -%type OptSideEffect // 'sideeffect' or not. -%type OptLinkage -%type BigOrLittle -// ValueRef - Unresolved reference to a definition or BB -%type ValueRef ConstValueRef SymbolicValueRef +%type ValueRef ConstValueRef // Reference to a definition or BB %type ResolvedVal // pair // Tokens and types for handling constant integer values // @@ -1094,679 +568,346 @@ // Built in types... %type Types TypesV UpRTypes UpRTypesV %type SIntType UIntType IntType FPType PrimType // Classifications +%token OPAQUE %token VOID BOOL SBYTE UBYTE SHORT USHORT INT UINT LONG ULONG %token FLOAT DOUBLE TYPE LABEL +%type ArrayType ArrayTypeI +%type StructType StructTypeI + +%token VAR_ID LABELSTR STRINGCONSTANT +%type OptVAR_ID OptAssign -%token VAR_ID LABELSTR STRINGCONSTANT -%type Name OptName OptAssign -%type OptAlign OptCAlign -%type OptSection SectionString - -%token IMPLEMENTATION ZEROINITIALIZER TRUETOK FALSETOK BEGINTOK ENDTOK -%token DECLARE GLOBAL CONSTANT SECTION VOLATILE -%token TO DOTDOTDOT NULL_TOK UNDEF CONST INTERNAL LINKONCE WEAK APPENDING -%token DLLIMPORT DLLEXPORT EXTERN_WEAK -%token OPAQUE NOT EXTERNAL TARGET TRIPLE ENDIAN POINTERSIZE LITTLE BIG ALIGN -%token DEPLIBS CALL TAIL ASM_TOK MODULE SIDEEFFECT -%token CC_TOK CCC_TOK CSRETCC_TOK FASTCC_TOK COLDCC_TOK -%token X86_STDCALLCC_TOK X86_FASTCALLCC_TOK -%token DATALAYOUT -%type OptCallingConv - -// Basic Block Terminating Operators -%token RET BR SWITCH INVOKE UNWIND UNREACHABLE - -// Binary Operators -%type ArithmeticOps LogicalOps SetCondOps // Binops Subcatagories -%token ADD SUB MUL UDIV SDIV FDIV UREM SREM FREM AND OR XOR -%token SETLE SETGE SETLT SETGT SETEQ SETNE // Binary Comparators + +%token IMPLEMENTATION TRUE FALSE BEGINTOK END DECLARE GLOBAL CONSTANT UNINIT +%token TO DOTDOTDOT STRING + +// Basic Block Terminating Operators +%token RET BR SWITCH + +// Unary Operators +%type UnaryOps // all the unary operators +%token NOT + +// Binary Operators +%type BinaryOps // all the binary operators +%token ADD SUB MUL DIV REM +%token SETLE SETGE SETLT SETGT SETEQ SETNE // Binary Comarators // Memory Instructions -%token MALLOC ALLOCA FREE LOAD STORE GETELEMENTPTR +%token MALLOC ALLOCA FREE LOAD STORE GETELEMENTPTR // Other Operators %type ShiftOps -%token PHI_TOK CAST SELECT SHL SHR VAARG -%token EXTRACTELEMENT INSERTELEMENT SHUFFLEVECTOR -%token VAARG_old VANEXT_old //OBSOLETE - +%token PHI CALL CAST SHL SHR %start Module %% // Handle constant integer size restriction and conversion... // -INTVAL : SINTVAL; + +INTVAL : SINTVAL INTVAL : UINTVAL { if ($1 > (uint32_t)INT32_MAX) // Outside of my range! - GEN_ERROR("Value too large for type!"); + ThrowException("Value too large for type!"); $$ = (int32_t)$1; - CHECK_FOR_ERROR -}; +} -EINT64VAL : ESINT64VAL; // These have same type and can't cause problems... +EINT64VAL : ESINT64VAL // These have same type and can't cause problems... EINT64VAL : EUINT64VAL { if ($1 > (uint64_t)INT64_MAX) // Outside of my range! - GEN_ERROR("Value too large for type!"); + ThrowException("Value too large for type!"); $$ = (int64_t)$1; - CHECK_FOR_ERROR -}; +} -// Operations that are notably excluded from this list include: +// Operations that are notably excluded from this list include: // RET, BR, & SWITCH because they end basic blocks and are treated specially. // -ArithmeticOps: ADD | SUB | MUL | UDIV | SDIV | FDIV | UREM | SREM | FREM; -LogicalOps : AND | OR | XOR; -SetCondOps : SETLE | SETGE | SETLT | SETGT | SETEQ | SETNE; - -ShiftOps : SHL | SHR; +UnaryOps : NOT +BinaryOps : ADD | SUB | MUL | DIV | REM +BinaryOps : SETLE | SETGE | SETLT | SETGT | SETEQ | SETNE +ShiftOps : SHL | SHR // These are some types that allow classification if we only want a particular // thing... for example, only a signed, unsigned, or integral type. -SIntType : LONG | INT | SHORT | SBYTE; -UIntType : ULONG | UINT | USHORT | UBYTE; -IntType : SIntType | UIntType; -FPType : FLOAT | DOUBLE; +SIntType : LONG | INT | SHORT | SBYTE +UIntType : ULONG | UINT | USHORT | UBYTE +IntType : SIntType | UIntType +FPType : FLOAT | DOUBLE // OptAssign - Value producing statements have an optional assignment component -OptAssign : Name '=' { +OptAssign : VAR_ID '=' { $$ = $1; - CHECK_FOR_ERROR } - | /*empty*/ { - $$ = 0; - CHECK_FOR_ERROR - }; - -OptLinkage : INTERNAL { $$ = GlobalValue::InternalLinkage; } | - LINKONCE { $$ = GlobalValue::LinkOnceLinkage; } | - WEAK { $$ = GlobalValue::WeakLinkage; } | - APPENDING { $$ = GlobalValue::AppendingLinkage; } | - DLLIMPORT { $$ = GlobalValue::DLLImportLinkage; } | - DLLEXPORT { $$ = GlobalValue::DLLExportLinkage; } | - EXTERN_WEAK { $$ = GlobalValue::ExternalWeakLinkage; } | - /*empty*/ { $$ = GlobalValue::ExternalLinkage; }; - -OptCallingConv : /*empty*/ { $$ = CallingConv::C; } | - CCC_TOK { $$ = CallingConv::C; } | - CSRETCC_TOK { $$ = CallingConv::CSRet; } | - FASTCC_TOK { $$ = CallingConv::Fast; } | - COLDCC_TOK { $$ = CallingConv::Cold; } | - X86_STDCALLCC_TOK { $$ = CallingConv::X86_StdCall; } | - X86_FASTCALLCC_TOK { $$ = CallingConv::X86_FastCall; } | - CC_TOK EUINT64VAL { - if ((unsigned)$2 != $2) - GEN_ERROR("Calling conv too large!"); - $$ = $2; - CHECK_FOR_ERROR - }; - -// OptAlign/OptCAlign - An optional alignment, and an optional alignment with -// a comma before it. -OptAlign : /*empty*/ { $$ = 0; } | - ALIGN EUINT64VAL { - $$ = $2; - if ($$ != 0 && !isPowerOf2_32($$)) - GEN_ERROR("Alignment must be a power of two!"); - CHECK_FOR_ERROR -}; -OptCAlign : /*empty*/ { $$ = 0; } | - ',' ALIGN EUINT64VAL { - $$ = $3; - if ($$ != 0 && !isPowerOf2_32($$)) - GEN_ERROR("Alignment must be a power of two!"); - CHECK_FOR_ERROR -}; - - -SectionString : SECTION STRINGCONSTANT { - for (unsigned i = 0, e = strlen($2); i != e; ++i) - if ($2[i] == '"' || $2[i] == '\\') - GEN_ERROR("Invalid character in section name!"); - $$ = $2; - CHECK_FOR_ERROR -}; - -OptSection : /*empty*/ { $$ = 0; } | - SectionString { $$ = $1; }; + | /*empty*/ { + $$ = 0; + } -// GlobalVarAttributes - Used to pass the attributes string on a global. CurGV -// is set to be the global we are processing. -// -GlobalVarAttributes : /* empty */ {} | - ',' GlobalVarAttribute GlobalVarAttributes {}; -GlobalVarAttribute : SectionString { - CurGV->setSection($1); - free($1); - CHECK_FOR_ERROR - } - | ALIGN EUINT64VAL { - if ($2 != 0 && !isPowerOf2_32($2)) - GEN_ERROR("Alignment must be a power of two!"); - CurGV->setAlignment($2); - CHECK_FOR_ERROR - }; //===----------------------------------------------------------------------===// // Types includes all predefined types... except void, because it can only be -// used in specific contexts (function returning void for example). To have +// used in specific contexts (method returning void for example). To have // access to it, a user must explicitly use TypesV. // // TypesV includes all of 'Types', but it also includes the void type. -TypesV : Types | VOID { $$ = new PATypeHolder($1); }; -UpRTypesV : UpRTypes | VOID { $$ = new PATypeHolder($1); }; +TypesV : Types | VOID { $$ = newTH($1); } +UpRTypesV : UpRTypes | VOID { $$ = newTH($1); } Types : UpRTypes { - if (!UpRefs.empty()) - GEN_ERROR("Invalid upreference in type: " + (*$1)->getDescription()); - $$ = $1; - CHECK_FOR_ERROR - }; + TypeDone($$ = $1); + } // Derived types are added later... // -PrimType : BOOL | SBYTE | UBYTE | SHORT | USHORT | INT | UINT ; -PrimType : LONG | ULONG | FLOAT | DOUBLE | TYPE | LABEL; -UpRTypes : OPAQUE { - $$ = new PATypeHolder(OpaqueType::get()); - CHECK_FOR_ERROR - } - | PrimType { - $$ = new PATypeHolder($1); - CHECK_FOR_ERROR - }; -UpRTypes : SymbolicValueRef { // Named types are also simple types... - const Type* tmp = getTypeVal($1); - CHECK_FOR_ERROR - $$ = new PATypeHolder(tmp); -}; +PrimType : BOOL | SBYTE | UBYTE | SHORT | USHORT | INT | UINT +PrimType : LONG | ULONG | FLOAT | DOUBLE | TYPE | LABEL +UpRTypes : OPAQUE | PrimType { $$ = newTH($1); } +UpRTypes : ValueRef { // Named types are also simple types... + $$ = newTH(getTypeVal($1)); +} -// Include derived types in the Types production. +// ArrayTypeI - Internal version of ArrayType that can have incomplete uprefs // -UpRTypes : '\\' EUINT64VAL { // Type UpReference - if ($2 > (uint64_t)~0U) GEN_ERROR("Value out of range!"); - OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder - UpRefs.push_back(UpRefRecord((unsigned)$2, OT)); // Add to vector... - $$ = new PATypeHolder(OT); - UR_OUT("New Upreference!\n"); - CHECK_FOR_ERROR - } - | UpRTypesV '(' ArgTypeListI ')' { // Function derived type? - std::vector Params; - for (std::list::iterator I = $3->begin(), - E = $3->end(); I != E; ++I) - Params.push_back(*I); - bool isVarArg = Params.size() && Params.back() == Type::VoidTy; - if (isVarArg) Params.pop_back(); - - $$ = new PATypeHolder(HandleUpRefs(FunctionType::get(*$1,Params,isVarArg))); - delete $3; // Delete the argument list - delete $1; // Delete the return type handle - CHECK_FOR_ERROR +ArrayTypeI : '[' UpRTypesV ']' { // Unsized array type? + $$ = newTHC(HandleUpRefs(ArrayType::get(*$2))); + delete $2; } | '[' EUINT64VAL 'x' UpRTypes ']' { // Sized array type? - $$ = new PATypeHolder(HandleUpRefs(ArrayType::get(*$4, (unsigned)$2))); + $$ = newTHC(HandleUpRefs(ArrayType::get(*$4, (int)$2))); delete $4; - CHECK_FOR_ERROR } - | '<' EUINT64VAL 'x' UpRTypes '>' { // Packed array type? - const llvm::Type* ElemTy = $4->get(); - if ((unsigned)$2 != $2) - 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($2)) - GEN_ERROR("Vector length should be a power of 2!"); - $$ = new PATypeHolder(HandleUpRefs(PackedType::get(*$4, (unsigned)$2))); - delete $4; - CHECK_FOR_ERROR - } - | '{' TypeListI '}' { // Structure type? - std::vector Elements; - for (std::list::iterator I = $2->begin(), - E = $2->end(); I != E; ++I) - Elements.push_back(*I); - $$ = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); +StructTypeI : '{' TypeListI '}' { // Structure type? + vector Elements; + mapto($2->begin(), $2->end(), back_inserter(Elements), + mem_fun_ref(&PATypeHandle::get)); + + $$ = newTHC(HandleUpRefs(StructType::get(Elements))); delete $2; - CHECK_FOR_ERROR } | '{' '}' { // Empty structure type? - $$ = new PATypeHolder(StructType::get(std::vector())); - CHECK_FOR_ERROR + $$ = newTH(StructType::get(vector())); + } + + +// Include derived types in the Types production. +// +UpRTypes : '\\' EUINT64VAL { // Type UpReference + if ($2 > (uint64_t)INT64_MAX) ThrowException("Value out of range!"); + OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder + UpRefs.push_back(make_pair((unsigned)$2, OT)); // Add to vector... + $$ = newTH(OT); + UR_OUT("New Upreference!\n"); + } + | UpRTypesV '(' ArgTypeListI ')' { // Method derived type? + vector Params; + mapto($3->begin(), $3->end(), back_inserter(Params), + mem_fun_ref(&PATypeHandle::get)); + $$ = newTH(HandleUpRefs(MethodType::get(*$1, Params))); + delete $3; // Delete the argument list + delete $1; // Delete the old type handle + } + | ArrayTypeI { // [Un]sized array type? + $$ = newTHC(*$1); delete $1; + } + | StructTypeI { // Structure type? + $$ = newTHC(*$1); delete $1; } | UpRTypes '*' { // Pointer type? - if (*$1 == Type::LabelTy) - GEN_ERROR("Cannot form a pointer to a basic block"); - $$ = new PATypeHolder(HandleUpRefs(PointerType::get(*$1))); - delete $1; - CHECK_FOR_ERROR - }; + $$ = newTH(HandleUpRefs(PointerType::get(*$1))); + delete $1; // Delete the type handle + } + +// Define some helpful top level types that do not allow UpReferences to escape +// +ArrayType : ArrayTypeI { TypeDone($$ = $1); } +StructType : StructTypeI { TypeDone($$ = $1); } + -// TypeList - Used for struct declarations and as a basis for function type + +// TypeList - Used for struct declarations and as a basis for method type // declaration type lists // TypeListI : UpRTypes { - $$ = new std::list(); + $$ = new list >(); $$->push_back(*$1); delete $1; - CHECK_FOR_ERROR } | TypeListI ',' UpRTypes { ($$=$1)->push_back(*$3); delete $3; - CHECK_FOR_ERROR - }; + } -// ArgTypeList - List of types for a function type declaration... +// ArgTypeList - List of types for a method type declaration... ArgTypeListI : TypeListI | TypeListI ',' DOTDOTDOT { ($$=$1)->push_back(Type::VoidTy); - CHECK_FOR_ERROR } | DOTDOTDOT { - ($$ = new std::list())->push_back(Type::VoidTy); - CHECK_FOR_ERROR + ($$ = new list >())->push_back(Type::VoidTy); } | /*empty*/ { - $$ = new std::list(); - CHECK_FOR_ERROR - }; + $$ = new list >(); + } + // ConstVal - The various declarations that go into the constant pool. This -// production is used ONLY to represent constants that show up AFTER a 'const', -// 'constant' or 'global' token at global scope. Constants that can be inlined -// into other expressions (such as integers and constexprs) are handled by the -// ResolvedVal, ValueRef and ConstValueRef productions. -// -ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr - const ArrayType *ATy = dyn_cast($1->get()); - if (ATy == 0) - GEN_ERROR("Cannot make array constant with type: '" + - (*$1)->getDescription() + "'!"); +// includes all forward declarations of types, constants, and functions. +// +// This is broken into two sections: ExtendedConstVal and ConstVal +// +ExtendedConstVal: ArrayType '[' ConstVector ']' { // Nonempty unsized arr + const ArrayType *ATy = *$1; const Type *ETy = ATy->getElementType(); int NumElements = ATy->getNumElements(); // Verify that we have the correct size... if (NumElements != -1 && NumElements != (int)$3->size()) - GEN_ERROR("Type mismatch: constant sized array initialized with " + - utostr($3->size()) + " arguments, but has size of " + - itostr(NumElements) + "!"); + ThrowException("Type mismatch: constant sized array initialized with " + + utostr($3->size()) + " arguments, but has size of " + + itostr(NumElements) + "!"); // Verify all elements are correct type! for (unsigned i = 0; i < $3->size(); i++) { if (ETy != (*$3)[i]->getType()) - GEN_ERROR("Element #" + utostr(i) + " is not of type '" + - ETy->getDescription() +"' as required!\nIt is of type '"+ - (*$3)[i]->getType()->getDescription() + "'."); + ThrowException("Element #" + utostr(i) + " is not of type '" + + ETy->getName() + "' as required!\nIt is of type '" + + (*$3)[i]->getType()->getName() + "'."); } - $$ = ConstantArray::get(ATy, *$3); + $$ = ConstPoolArray::get(ATy, *$3); delete $1; delete $3; - CHECK_FOR_ERROR } - | Types '[' ']' { - const ArrayType *ATy = dyn_cast($1->get()); - if (ATy == 0) - GEN_ERROR("Cannot make array constant with type: '" + - (*$1)->getDescription() + "'!"); - - int NumElements = ATy->getNumElements(); + | ArrayType '[' ']' { + int NumElements = (*$1)->getNumElements(); if (NumElements != -1 && NumElements != 0) - GEN_ERROR("Type mismatch: constant sized array initialized with 0" - " arguments, but has size of " + itostr(NumElements) +"!"); - $$ = ConstantArray::get(ATy, std::vector()); + ThrowException("Type mismatch: constant sized array initialized with 0" + " arguments, but has size of " + itostr(NumElements) +"!"); + $$ = ConstPoolArray::get((*$1), vector()); delete $1; - CHECK_FOR_ERROR } - | Types 'c' STRINGCONSTANT { - const ArrayType *ATy = dyn_cast($1->get()); - if (ATy == 0) - GEN_ERROR("Cannot make array constant with type: '" + - (*$1)->getDescription() + "'!"); - + | ArrayType 'c' STRINGCONSTANT { + const ArrayType *ATy = *$1; int NumElements = ATy->getNumElements(); const Type *ETy = ATy->getElementType(); char *EndStr = UnEscapeLexed($3, true); if (NumElements != -1 && NumElements != (EndStr-$3)) - GEN_ERROR("Can't build string constant of size " + - itostr((int)(EndStr-$3)) + - " when array has size " + itostr(NumElements) + "!"); - std::vector Vals; + ThrowException("Can't build string constant of size " + + itostr((int)(EndStr-$3)) + + " when array has size " + itostr(NumElements) + "!"); + vector Vals; if (ETy == Type::SByteTy) { - for (signed char *C = (signed char *)$3; C != (signed char *)EndStr; ++C) - Vals.push_back(ConstantInt::get(ETy, *C)); + for (char *C = $3; C != EndStr; ++C) + Vals.push_back(ConstPoolSInt::get(ETy, *C)); } else if (ETy == Type::UByteTy) { - for (unsigned char *C = (unsigned char *)$3; - C != (unsigned char*)EndStr; ++C) - Vals.push_back(ConstantInt::get(ETy, *C)); + for (char *C = $3; C != EndStr; ++C) + Vals.push_back(ConstPoolUInt::get(ETy, *C)); } else { free($3); - GEN_ERROR("Cannot build string arrays of non byte sized elements!"); + ThrowException("Cannot build string arrays of non byte sized elements!"); } free($3); - $$ = ConstantArray::get(ATy, Vals); + $$ = ConstPoolArray::get(ATy, Vals); delete $1; - CHECK_FOR_ERROR } - | Types '<' ConstVector '>' { // Nonempty unsized arr - const PackedType *PTy = dyn_cast($1->get()); - if (PTy == 0) - GEN_ERROR("Cannot make packed constant with type: '" + - (*$1)->getDescription() + "'!"); - const Type *ETy = PTy->getElementType(); - int NumElements = PTy->getNumElements(); - - // Verify that we have the correct size... - if (NumElements != -1 && NumElements != (int)$3->size()) - GEN_ERROR("Type mismatch: constant sized packed initialized with " + - utostr($3->size()) + " arguments, but has size of " + - itostr(NumElements) + "!"); - - // Verify all elements are correct type! - for (unsigned i = 0; i < $3->size(); i++) { - if (ETy != (*$3)[i]->getType()) - GEN_ERROR("Element #" + utostr(i) + " is not of type '" + - ETy->getDescription() +"' as required!\nIt is of type '"+ - (*$3)[i]->getType()->getDescription() + "'."); - } - - $$ = ConstantPacked::get(PTy, *$3); + | StructType '{' ConstVector '}' { + // FIXME: TODO: Check to see that the constants are compatible with the type + // initializer! + $$ = ConstPoolStruct::get(*$1, *$3); delete $1; delete $3; - CHECK_FOR_ERROR } - | Types '{' ConstVector '}' { - const StructType *STy = dyn_cast($1->get()); - if (STy == 0) - GEN_ERROR("Cannot make struct constant with type: '" + - (*$1)->getDescription() + "'!"); - - if ($3->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 = $3->size(); i != e; ++i) - if ((*$3)[i]->getType() != STy->getElementType(i)) - GEN_ERROR("Expected type '" + - STy->getElementType(i)->getDescription() + - "' for element #" + utostr(i) + - " of structure initializer!"); - - $$ = ConstantStruct::get(STy, *$3); - delete $1; delete $3; - CHECK_FOR_ERROR +/* + | Types '*' ConstVal { + assert(0); + $$ = 0; } - | Types '{' '}' { - const StructType *STy = dyn_cast($1->get()); - if (STy == 0) - GEN_ERROR("Cannot make struct constant with type: '" + - (*$1)->getDescription() + "'!"); - - if (STy->getNumContainedTypes() != 0) - GEN_ERROR("Illegal number of initializers for structure type!"); +*/ - $$ = ConstantStruct::get(STy, std::vector()); - delete $1; - CHECK_FOR_ERROR +ConstVal : ExtendedConstVal { + $$ = $1; } - | Types NULL_TOK { - const PointerType *PTy = dyn_cast($1->get()); - if (PTy == 0) - GEN_ERROR("Cannot make null pointer constant with type: '" + - (*$1)->getDescription() + "'!"); - - $$ = ConstantPointerNull::get(PTy); - delete $1; - CHECK_FOR_ERROR + | SIntType EINT64VAL { // integral constants + if (!ConstPoolSInt::isValueValidForType($1, $2)) + ThrowException("Constant value doesn't fit in type!"); + $$ = ConstPoolSInt::get($1, $2); + } + | UIntType EUINT64VAL { // integral constants + if (!ConstPoolUInt::isValueValidForType($1, $2)) + ThrowException("Constant value doesn't fit in type!"); + $$ = ConstPoolUInt::get($1, $2); + } + | BOOL TRUE { // Boolean constants + $$ = ConstPoolBool::True; } - | Types UNDEF { - $$ = UndefValue::get($1->get()); - delete $1; - CHECK_FOR_ERROR + | BOOL FALSE { // Boolean constants + $$ = ConstPoolBool::False; } - | Types SymbolicValueRef { - const PointerType *Ty = dyn_cast($1->get()); - if (Ty == 0) - GEN_ERROR("Global const reference must be a pointer type!"); - - // ConstExprs can exist in the body of a function, thus creating - // GlobalValues whenever they refer to a variable. Because we are in - // the context of a function, getValNonImprovising will search the functions - // symbol table instead of the module symbol table for the global symbol, - // which throws things all off. To get around this, we just tell - // getValNonImprovising that we are at global scope here. - // - Function *SavedCurFn = CurFun.CurrentFunction; - CurFun.CurrentFunction = 0; - - Value *V = getValNonImprovising(Ty, $2); - CHECK_FOR_ERROR - - CurFun.CurrentFunction = SavedCurFn; - - // If this is an initializer for a constant pointer, which is referencing a - // (currently) undefined variable, create a stub now that shall be replaced - // in the future with the right type of variable. - // - if (V == 0) { - assert(isa(Ty) && "Globals may only be used as pointers!"); - const PointerType *PT = cast(Ty); - - // First check to see if the forward references value is already created! - PerModuleInfo::GlobalRefsType::iterator I = - CurModule.GlobalRefs.find(std::make_pair(PT, $2)); - - if (I != CurModule.GlobalRefs.end()) { - V = I->second; // Placeholder already exists, use it... - $2.destroy(); - } else { - std::string Name; - if ($2.Type == ValID::NameVal) Name = $2.Name; - - // Create the forward referenced global. - GlobalValue *GV; - if (const FunctionType *FTy = - dyn_cast(PT->getElementType())) { - GV = new Function(FTy, GlobalValue::ExternalLinkage, Name, - CurModule.CurrentModule); - } else { - GV = new GlobalVariable(PT->getElementType(), false, - GlobalValue::ExternalLinkage, 0, - Name, CurModule.CurrentModule); - } - - // Keep track of the fact that we have a forward ref to recycle it - CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, $2), GV)); - V = GV; - } - } - - $$ = cast(V); - delete $1; // Free the type handle - CHECK_FOR_ERROR - } - | Types ConstExpr { - if ($1->get() != $2->getType()) - GEN_ERROR("Mismatched types for constant expression!"); - $$ = $2; - delete $1; - CHECK_FOR_ERROR + | FPType FPVAL { // Float & Double constants + $$ = ConstPoolFP::get($1, $2); } - | Types ZEROINITIALIZER { - const Type *Ty = $1->get(); - if (isa(Ty) || Ty == Type::LabelTy || isa(Ty)) - GEN_ERROR("Cannot create a null initialized value of this type!"); - $$ = Constant::getNullValue(Ty); - delete $1; - CHECK_FOR_ERROR - }; -ConstVal : SIntType EINT64VAL { // integral constants - if (!ConstantInt::isValueValidForType($1, $2)) - GEN_ERROR("Constant value doesn't fit in type!"); - $$ = ConstantInt::get($1, $2); - CHECK_FOR_ERROR - } - | UIntType EUINT64VAL { // integral constants - if (!ConstantInt::isValueValidForType($1, $2)) - GEN_ERROR("Constant value doesn't fit in type!"); - $$ = ConstantInt::get($1, $2); - CHECK_FOR_ERROR - } - | BOOL TRUETOK { // Boolean constants - $$ = ConstantBool::getTrue(); - CHECK_FOR_ERROR - } - | BOOL FALSETOK { // Boolean constants - $$ = ConstantBool::getFalse(); - CHECK_FOR_ERROR +// ConstVector - A list of comma seperated constants. +ConstVector : ConstVector ',' ConstVal { + ($$ = $1)->push_back($3); + } + | ConstVal { + $$ = new vector(); + $$->push_back($1); } - | FPType FPVAL { // Float & Double constants - if (!ConstantFP::isValueValidForType($1, $2)) - GEN_ERROR("Floating point constant invalid for type!!"); - $$ = ConstantFP::get($1, $2); - CHECK_FOR_ERROR - }; -ConstExpr: CAST '(' ConstVal TO Types ')' { - if (!$3->getType()->isFirstClassType()) - GEN_ERROR("cast constant expression from a non-primitive type: '" + - $3->getType()->getDescription() + "'!"); - if (!$5->get()->isFirstClassType()) - GEN_ERROR("cast constant expression to a non-primitive type: '" + - $5->get()->getDescription() + "'!"); - $$ = ConstantExpr::getCast($3, $5->get()); - delete $5; - CHECK_FOR_ERROR - } - | GETELEMENTPTR '(' ConstVal IndexList ')' { - if (!isa($3->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($3->getType(), $4->begin(), $4->end()), - GTE = gep_type_end($3->getType(), $4->begin(), $4->end()); - for (unsigned i = 0, e = $4->size(); i != e && GTI != GTE; ++i, ++GTI) - if (isa(*GTI)) // Only change struct indices - if (ConstantInt *CUI = dyn_cast((*$4)[i])) - if (CUI->getType() == Type::UByteTy) - (*$4)[i] = ConstantExpr::getCast(CUI, Type::UIntTy); - - const Type *IdxTy = - GetElementPtrInst::getIndexedType($3->getType(), *$4, true); - if (!IdxTy) - GEN_ERROR("Index list invalid for constant getelementptr!"); - - std::vector IdxVec; - for (unsigned i = 0, e = $4->size(); i != e; ++i) - if (Constant *C = dyn_cast((*$4)[i])) - IdxVec.push_back(C); - else - GEN_ERROR("Indices to constant getelementptr must be constants!"); +// GlobalType - Match either GLOBAL or CONSTANT for global declarations... +GlobalType : GLOBAL { $$ = false; } | CONSTANT { $$ = true; } - delete $4; - $$ = ConstantExpr::getGetElementPtr($3, IdxVec); - CHECK_FOR_ERROR +// ConstPool - Constants with optional names assigned to them. +ConstPool : ConstPool OptAssign ConstVal { + setValueName($3, $2); + InsertValue($3); } - | SELECT '(' ConstVal ',' ConstVal ',' ConstVal ')' { - if ($3->getType() != Type::BoolTy) - GEN_ERROR("Select condition must be of boolean type!"); - if ($5->getType() != $7->getType()) - GEN_ERROR("Select operand types must match!"); - $$ = ConstantExpr::getSelect($3, $5, $7); - CHECK_FOR_ERROR - } - | ArithmeticOps '(' ConstVal ',' ConstVal ')' { - if ($3->getType() != $5->getType()) - GEN_ERROR("Binary operator types must match!"); - // First, make sure we're dealing with the right opcode by upgrading from - // obsolete versions. - sanitizeOpCode($1,$3->getType()); - CHECK_FOR_ERROR; - - // HACK: llvm 1.3 and earlier used to emit invalid pointer constant exprs. - // To retain backward compatibility with these early compilers, we emit a - // cast to the appropriate integer type automatically if we are in the - // broken case. See PR424 for more information. - if (!isa($3->getType())) { - $$ = ConstantExpr::get($1.opcode, $3, $5); - } else { - const Type *IntPtrTy = 0; - switch (CurModule.CurrentModule->getPointerSize()) { - case Module::Pointer32: IntPtrTy = Type::IntTy; break; - case Module::Pointer64: IntPtrTy = Type::LongTy; break; - default: GEN_ERROR("invalid pointer binary constant expr!"); - } - $$ = ConstantExpr::get($1.opcode, ConstantExpr::getCast($3, IntPtrTy), - ConstantExpr::getCast($5, IntPtrTy)); - $$ = ConstantExpr::getCast($$, $3->getType()); + | ConstPool OptAssign TYPE TypesV { // Types can be defined in the const pool + // TODO: FIXME when Type are not const + setValueName(const_cast($4->get()), $2); + + if (!$2) { + InsertType($4->get(), + CurMeth.CurrentMethod ? CurMeth.Types : CurModule.Types); } - CHECK_FOR_ERROR + delete $4; } - | LogicalOps '(' ConstVal ',' ConstVal ')' { - if ($3->getType() != $5->getType()) - GEN_ERROR("Logical operator types must match!"); - if (!$3->getType()->isIntegral()) { - if (!isa($3->getType()) || - !cast($3->getType())->getElementType()->isIntegral()) - GEN_ERROR("Logical operator requires integral operands!"); - } - $$ = ConstantExpr::get($1.opcode, $3, $5); - CHECK_FOR_ERROR + | ConstPool MethodProto { // Method prototypes can be in const pool } - | SetCondOps '(' ConstVal ',' ConstVal ')' { - if ($3->getType() != $5->getType()) - GEN_ERROR("setcc operand types must match!"); - $$ = ConstantExpr::get($1.opcode, $3, $5); - CHECK_FOR_ERROR - } - | ShiftOps '(' ConstVal ',' ConstVal ')' { - if ($5->getType() != Type::UByteTy) - GEN_ERROR("Shift count for shift constant must be unsigned byte!"); - if (!$3->getType()->isInteger()) - GEN_ERROR("Shift constant expression requires integer operand!"); - $$ = ConstantExpr::get($1.opcode, $3, $5); - CHECK_FOR_ERROR - } - | EXTRACTELEMENT '(' ConstVal ',' ConstVal ')' { - if (!ExtractElementInst::isValidOperands($3, $5)) - GEN_ERROR("Invalid extractelement operands!"); - $$ = ConstantExpr::getExtractElement($3, $5); - CHECK_FOR_ERROR - } - | INSERTELEMENT '(' ConstVal ',' ConstVal ',' ConstVal ')' { - if (!InsertElementInst::isValidOperands($3, $5, $7)) - GEN_ERROR("Invalid insertelement operands!"); - $$ = ConstantExpr::getInsertElement($3, $5, $7); - CHECK_FOR_ERROR - } - | SHUFFLEVECTOR '(' ConstVal ',' ConstVal ',' ConstVal ')' { - if (!ShuffleVectorInst::isValidOperands($3, $5, $7)) - GEN_ERROR("Invalid shufflevector operands!"); - $$ = ConstantExpr::getShuffleVector($3, $5, $7); - CHECK_FOR_ERROR - }; - + | ConstPool OptAssign GlobalType ResolvedVal { + const Type *Ty = $4->getType(); + // Global declarations appear in Constant Pool + ConstPoolVal *Initializer = $4->castConstant(); + if (Initializer == 0) + ThrowException("Global value initializer is not a constant!"); + + GlobalVariable *GV = new GlobalVariable(PointerType::get(Ty), $3, + Initializer); + setValueName(GV, $2); -// ConstVector - A list of comma separated constants. -ConstVector : ConstVector ',' ConstVal { - ($$ = $1)->push_back($3); - CHECK_FOR_ERROR + CurModule.CurrentModule->getGlobalList().push_back(GV); + InsertValue(GV, CurModule.Values); } - | ConstVal { - $$ = new std::vector(); - $$->push_back($1); - CHECK_FOR_ERROR - }; + | ConstPool OptAssign UNINIT GlobalType Types { + const Type *Ty = *$5; + // Global declarations appear in Constant Pool + if (Ty->isArrayType() && Ty->castArrayType()->isUnsized()) { + ThrowException("Type '" + Ty->getDescription() + + "' is not a sized type!"); + } + GlobalVariable *GV = new GlobalVariable(PointerType::get(Ty), $4); + setValueName(GV, $2); -// GlobalType - Match either GLOBAL or CONSTANT for global declarations... -GlobalType : GLOBAL { $$ = false; } | CONSTANT { $$ = true; }; + CurModule.CurrentModule->getGlobalList().push_back(GV); + InsertValue(GV, CurModule.Values); + } + | /* empty: end of list */ { + } //===----------------------------------------------------------------------===// @@ -1776,1052 +917,422 @@ // Module rule: Capture the result of parsing the whole file into a result // variable... // -Module : FunctionList { +Module : MethodList { $$ = ParserResult = $1; CurModule.ModuleDone(); - CHECK_FOR_ERROR; -}; +} -// FunctionList - A list of functions, preceeded by a constant pool. +// MethodList - A list of methods, preceeded by a constant pool. // -FunctionList : FunctionList Function { +MethodList : MethodList Method { $$ = $1; - CurFun.FunctionDone(); - CHECK_FOR_ERROR + if (!$2->getParent()) + $1->getMethodList().push_back($2); + CurMeth.MethodDone(); } - | FunctionList FunctionProto { + | MethodList MethodProto { $$ = $1; - CHECK_FOR_ERROR } - | FunctionList MODULE ASM_TOK AsmBlock { - $$ = $1; - CHECK_FOR_ERROR - } - | FunctionList IMPLEMENTATION { - $$ = $1; - CHECK_FOR_ERROR - } - | ConstPool { + | ConstPool IMPLEMENTATION { $$ = CurModule.CurrentModule; - // Emit an error if there are any unresolved types left. - if (!CurModule.LateResolveTypes.empty()) { - const ValID &DID = CurModule.LateResolveTypes.begin()->first; - if (DID.Type == ValID::NameVal) { - GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'"); - } else { - GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num)); - } - } - CHECK_FOR_ERROR - }; - -// ConstPool - Constants with optional names assigned to them. -ConstPool : ConstPool OptAssign TYPE TypesV { - // Eagerly resolve types. This is not an optimization, this is a - // requirement that is due to the fact that we could have this: - // - // %list = type { %list * } - // %list = type { %list * } ; repeated type decl - // - // If types are not resolved eagerly, then the two types will not be - // determined to be the same type! - // - ResolveTypeTo($2, *$4); - - if (!setTypeName(*$4, $2) && !$2) { - 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); - } - - delete $4; - CHECK_FOR_ERROR + // Resolve circular types before we parse the body of the module + ResolveTypes(CurModule.LateResolveTypes); } - | ConstPool FunctionProto { // Function prototypes can be in const pool - CHECK_FOR_ERROR - } - | ConstPool MODULE ASM_TOK AsmBlock { // Asm blocks can be in the const pool - CHECK_FOR_ERROR - } - | ConstPool OptAssign OptLinkage GlobalType ConstVal { - if ($5 == 0) - GEN_ERROR("Global value initializer is not a constant!"); - CurGV = ParseGlobalVariable($2, $3, $4, $5->getType(), $5); - CHECK_FOR_ERROR - } GlobalVarAttributes { - CurGV = 0; - } - | ConstPool OptAssign EXTERNAL GlobalType Types { - CurGV = ParseGlobalVariable($2, GlobalValue::ExternalLinkage, $4, *$5, 0); - CHECK_FOR_ERROR - delete $5; - } GlobalVarAttributes { - CurGV = 0; - CHECK_FOR_ERROR - } - | ConstPool OptAssign DLLIMPORT GlobalType Types { - CurGV = ParseGlobalVariable($2, GlobalValue::DLLImportLinkage, $4, *$5, 0); - CHECK_FOR_ERROR - delete $5; - } GlobalVarAttributes { - CurGV = 0; - CHECK_FOR_ERROR - } - | ConstPool OptAssign EXTERN_WEAK GlobalType Types { - CurGV = - ParseGlobalVariable($2, GlobalValue::ExternalWeakLinkage, $4, *$5, 0); - CHECK_FOR_ERROR - delete $5; - } GlobalVarAttributes { - CurGV = 0; - CHECK_FOR_ERROR - } - | ConstPool TARGET TargetDefinition { - CHECK_FOR_ERROR - } - | ConstPool DEPLIBS '=' LibrariesDefinition { - CHECK_FOR_ERROR - } - | /* empty: end of list */ { - }; - -AsmBlock : STRINGCONSTANT { - const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); - char *EndStr = UnEscapeLexed($1, true); - std::string NewAsm($1, EndStr); - free($1); - - if (AsmSoFar.empty()) - CurModule.CurrentModule->setModuleInlineAsm(NewAsm); - else - CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm); - CHECK_FOR_ERROR -}; - -BigOrLittle : BIG { $$ = Module::BigEndian; }; -BigOrLittle : LITTLE { $$ = Module::LittleEndian; }; - -TargetDefinition : ENDIAN '=' BigOrLittle { - CurModule.CurrentModule->setEndianness($3); - CHECK_FOR_ERROR - } - | POINTERSIZE '=' EUINT64VAL { - if ($3 == 32) - CurModule.CurrentModule->setPointerSize(Module::Pointer32); - else if ($3 == 64) - CurModule.CurrentModule->setPointerSize(Module::Pointer64); - else - GEN_ERROR("Invalid pointer size: '" + utostr($3) + "'!"); - CHECK_FOR_ERROR - } - | TRIPLE '=' STRINGCONSTANT { - CurModule.CurrentModule->setTargetTriple($3); - free($3); - } - | DATALAYOUT '=' STRINGCONSTANT { - CurModule.CurrentModule->setDataLayout($3); - free($3); - }; - -LibrariesDefinition : '[' LibList ']'; - -LibList : LibList ',' STRINGCONSTANT { - CurModule.CurrentModule->addLibrary($3); - free($3); - CHECK_FOR_ERROR - } - | STRINGCONSTANT { - CurModule.CurrentModule->addLibrary($1); - free($1); - CHECK_FOR_ERROR - } - | /* empty: end of list */ { - CHECK_FOR_ERROR - } - ; //===----------------------------------------------------------------------===// -// Rules to match Function Headers +// Rules to match Method Headers //===----------------------------------------------------------------------===// -Name : VAR_ID | STRINGCONSTANT; -OptName : Name | /*empty*/ { $$ = 0; }; +OptVAR_ID : VAR_ID | /*empty*/ { $$ = 0; } -ArgVal : Types OptName { - if (*$1 == Type::VoidTy) - GEN_ERROR("void typed arguments are invalid!"); - $$ = new std::pair($1, $2); - CHECK_FOR_ERROR -}; +ArgVal : Types OptVAR_ID { + $$ = new MethodArgument(*$1); delete $1; + setValueName($$, $2); +} -ArgListH : ArgListH ',' ArgVal { - $$ = $1; - $1->push_back(*$3); - delete $3; - CHECK_FOR_ERROR +ArgListH : ArgVal ',' ArgListH { + $$ = $3; + $3->push_front($1); } | ArgVal { - $$ = new std::vector >(); - $$->push_back(*$1); - delete $1; - CHECK_FOR_ERROR - }; + $$ = new list(); + $$->push_front($1); + } + | DOTDOTDOT { + $$ = new list(); + $$->push_back(new MethodArgument(Type::VoidTy)); + } ArgList : ArgListH { $$ = $1; - CHECK_FOR_ERROR - } - | ArgListH ',' DOTDOTDOT { - $$ = $1; - $$->push_back(std::pair(new PATypeHolder(Type::VoidTy), 0)); - CHECK_FOR_ERROR - } - | DOTDOTDOT { - $$ = new std::vector >(); - $$->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0)); - CHECK_FOR_ERROR } | /* empty */ { $$ = 0; - CHECK_FOR_ERROR - }; + } -FunctionHeaderH : OptCallingConv TypesV Name '(' ArgList ')' - OptSection OptAlign { - UnEscapeLexed($3); - std::string FunctionName($3); - free($3); // Free strdup'd memory! - - if (!(*$2)->isFirstClassType() && *$2 != Type::VoidTy) - GEN_ERROR("LLVM functions cannot return aggregate types!"); +MethodHeaderH : TypesV STRINGCONSTANT '(' ArgList ')' { + UnEscapeLexed($2); + vector ParamTypeList; + if ($4) + for (list::iterator I = $4->begin(); I != $4->end(); ++I) + ParamTypeList.push_back((*I)->getType()); - std::vector ParamTypeList; - if ($5) { // If there are arguments... - for (std::vector >::iterator I = $5->begin(); - I != $5->end(); ++I) - ParamTypeList.push_back(I->first->get()); - } - - bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; - if (isVarArg) ParamTypeList.pop_back(); - - const FunctionType *FT = FunctionType::get(*$2, ParamTypeList, isVarArg); - const PointerType *PFT = PointerType::get(FT); - delete $2; - - ValID ID; - if (!FunctionName.empty()) { - ID = ValID::create((char*)FunctionName.c_str()); - } else { - ID = ValID::create((int)CurModule.Values[PFT].size()); - } - - Function *Fn = 0; - // See if this function was forward referenced. If so, recycle the object. - if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) { - // Move the function to the end of the list, from whereever it was - // previously inserted. - Fn = cast(FWRef); - CurModule.CurrentModule->getFunctionList().remove(Fn); - CurModule.CurrentModule->getFunctionList().push_back(Fn); - } else if (!FunctionName.empty() && // Merge with an earlier prototype? - (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) { - // If this is the case, either we need to be a forward decl, or it needs - // to be. - if (!CurFun.isDeclare && !Fn->isExternal()) - GEN_ERROR("Redefinition of function '" + FunctionName + "'!"); - - // Make sure to strip off any argument names so we can't get conflicts. - if (Fn->isExternal()) - for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); - AI != AE; ++AI) - AI->setName(""); - } else { // Not already defined? - Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName, - CurModule.CurrentModule); - - InsertValue(Fn, CurModule.Values); - } - - CurFun.FunctionStart(Fn); - - if (CurFun.isDeclare) { - // If we have declaration, always overwrite linkage. This will allow us to - // correctly handle cases, when pointer to function is passed as argument to - // another function. - Fn->setLinkage(CurFun.Linkage); - } - Fn->setCallingConv($1); - Fn->setAlignment($8); - if ($7) { - Fn->setSection($7); - free($7); - } - - // Add all of the arguments we parsed to the function... - if ($5) { // Is null if empty... - if (isVarArg) { // Nuke the last entry - assert($5->back().first->get() == Type::VoidTy && $5->back().second == 0&& - "Not a varargs marker!"); - delete $5->back().first; - $5->pop_back(); // Delete the last entry - } - Function::arg_iterator ArgIt = Fn->arg_begin(); - for (std::vector >::iterator I = $5->begin(); - I != $5->end(); ++I, ++ArgIt) { - delete I->first; // Delete the typeholder... - - setValueName(ArgIt, I->second); // Insert arg into symtab... - CHECK_FOR_ERROR - InsertValue(ArgIt); + const MethodType *MT = MethodType::get(*$1, ParamTypeList); + delete $1; + + Method *M = 0; + if (SymbolTable *ST = CurModule.CurrentModule->getSymbolTable()) { + if (Value *V = ST->lookup(MT, $2)) { // Method already in symtab? + M = V->castMethodAsserting(); + + // Yes it is. If this is the case, either we need to be a forward decl, + // or it needs to be. + if (!CurMeth.isDeclare && !M->isExternal()) + ThrowException("Redefinition of method '" + string($2) + "'!"); } + } - delete $5; // We're now done with the argument list + if (M == 0) { // Not already defined? + M = new Method(MT, $2); + InsertValue(M, CurModule.Values); } - CHECK_FOR_ERROR -}; -BEGIN : BEGINTOK | '{'; // Allow BEGIN or '{' to start a function + free($2); // Free strdup'd memory! -FunctionHeader : OptLinkage FunctionHeaderH BEGIN { - $$ = CurFun.CurrentFunction; + CurMeth.MethodStart(M); - // Make sure that we keep track of the linkage type even if there was a - // previous "declare". - $$->setLinkage($1); -}; + // Add all of the arguments we parsed to the method... + if ($4 && !CurMeth.isDeclare) { // Is null if empty... + Method::ArgumentListType &ArgList = M->getArgumentList(); -END : ENDTOK | '}'; // Allow end of '}' to end a function + for (list::iterator I = $4->begin(); I != $4->end(); ++I) { + InsertValue(*I); + ArgList.push_back(*I); + } + delete $4; // We're now done with the argument list + } +} -Function : BasicBlockList END { +MethodHeader : MethodHeaderH ConstPool BEGINTOK { + $$ = CurMeth.CurrentMethod; + + // Resolve circular types before we parse the body of the method. + ResolveTypes(CurMeth.LateResolveTypes); +} + +Method : BasicBlockList END { $$ = $1; - CHECK_FOR_ERROR -}; +} -FnDeclareLinkage: /*default*/ | - DLLIMPORT { CurFun.Linkage = GlobalValue::DLLImportLinkage; } | - EXTERN_WEAK { CurFun.Linkage = GlobalValue::DLLImportLinkage; }; - -FunctionProto : DECLARE { CurFun.isDeclare = true; } FnDeclareLinkage FunctionHeaderH { - $$ = CurFun.CurrentFunction; - CurFun.FunctionDone(); - CHECK_FOR_ERROR - }; +MethodProto : DECLARE { CurMeth.isDeclare = true; } MethodHeaderH { + $$ = CurMeth.CurrentMethod; + if (!$$->getParent()) + CurModule.CurrentModule->getMethodList().push_back($$); + CurMeth.MethodDone(); +} //===----------------------------------------------------------------------===// // Rules to match Basic Blocks //===----------------------------------------------------------------------===// -OptSideEffect : /* empty */ { - $$ = false; - CHECK_FOR_ERROR - } - | SIDEEFFECT { - $$ = true; - CHECK_FOR_ERROR - }; - ConstValueRef : ESINT64VAL { // A reference to a direct constant $$ = ValID::create($1); - CHECK_FOR_ERROR } | EUINT64VAL { $$ = ValID::create($1); - CHECK_FOR_ERROR } | FPVAL { // Perhaps it's an FP constant? $$ = ValID::create($1); - CHECK_FOR_ERROR } - | TRUETOK { - $$ = ValID::create(ConstantBool::getTrue()); - CHECK_FOR_ERROR + | TRUE { + $$ = ValID::create((int64_t)1); } - | FALSETOK { - $$ = ValID::create(ConstantBool::getFalse()); - CHECK_FOR_ERROR - } - | NULL_TOK { - $$ = ValID::createNull(); - CHECK_FOR_ERROR - } - | UNDEF { - $$ = ValID::createUndef(); - CHECK_FOR_ERROR - } - | ZEROINITIALIZER { // A vector zero constant. - $$ = ValID::createZeroInit(); - CHECK_FOR_ERROR - } - | '<' ConstVector '>' { // Nonempty unsized packed vector - const Type *ETy = (*$2)[0]->getType(); - int NumElements = $2->size(); - - PackedType* pt = PackedType::get(ETy, NumElements); - PATypeHolder* PTy = new PATypeHolder( - HandleUpRefs( - PackedType::get( - ETy, - NumElements) - ) - ); - - // Verify all elements are correct type! - for (unsigned i = 0; i < $2->size(); i++) { - if (ETy != (*$2)[i]->getType()) - GEN_ERROR("Element #" + utostr(i) + " is not of type '" + - ETy->getDescription() +"' as required!\nIt is of type '" + - (*$2)[i]->getType()->getDescription() + "'."); - } - - $$ = ValID::create(ConstantPacked::get(pt, *$2)); - delete PTy; delete $2; - CHECK_FOR_ERROR + | FALSE { + $$ = ValID::create((int64_t)0); } - | ConstExpr { - $$ = ValID::create($1); - CHECK_FOR_ERROR +/* + | STRINGCONSTANT { // Quoted strings work too... especially for methods + $$ = ValID::create_conststr($1); } - | ASM_TOK OptSideEffect STRINGCONSTANT ',' STRINGCONSTANT { - char *End = UnEscapeLexed($3, true); - std::string AsmStr = std::string($3, End); - End = UnEscapeLexed($5, true); - std::string Constraints = std::string($5, End); - $$ = ValID::createInlineAsm(AsmStr, Constraints, $2); - free($3); - free($5); - CHECK_FOR_ERROR - }; +*/ -// SymbolicValueRef - Reference to one of two ways of symbolically refering to -// another value. -// -SymbolicValueRef : INTVAL { // Is it an integer reference...? +// ValueRef - A reference to a definition... +ValueRef : INTVAL { // Is it an integer reference...? $$ = ValID::create($1); - CHECK_FOR_ERROR } - | Name { // Is it a named reference...? + | VAR_ID { // Is it a named reference...? $$ = ValID::create($1); - CHECK_FOR_ERROR - }; - -// ValueRef - A reference to a definition... either constant or symbolic -ValueRef : SymbolicValueRef | ConstValueRef; - + } + | ConstValueRef { + $$ = $1; + } // ResolvedVal - a pair. This is used only in cases where the // type immediately preceeds the value reference, and allows complex constant // pool references (for things like: 'ret [2 x int] [ int 12, int 42]') -ResolvedVal : Types ValueRef { +ResolvedVal : ExtendedConstVal { + $$ = $1; + } + | Types ValueRef { $$ = getVal(*$1, $2); delete $1; - CHECK_FOR_ERROR - }; + } + BasicBlockList : BasicBlockList BasicBlock { + $1->getBasicBlocks().push_back($2); $$ = $1; - CHECK_FOR_ERROR } - | FunctionHeader BasicBlock { // Do not allow functions with 0 basic blocks - $$ = $1; - CHECK_FOR_ERROR - }; + | MethodHeader BasicBlock { // Do not allow methods with 0 basic blocks + $$ = $1; // in them... + $1->getBasicBlocks().push_back($2); + } // Basic blocks are terminated by branching instructions: // br, br/cc, switch, ret // -BasicBlock : InstructionList OptAssign BBTerminatorInst { - setValueName($3, $2); - CHECK_FOR_ERROR - InsertValue($3); - - $1->getInstList().push_back($3); +BasicBlock : InstructionList BBTerminatorInst { + $1->getInstList().push_back($2); InsertValue($1); $$ = $1; - CHECK_FOR_ERROR - }; + } + | LABELSTR InstructionList BBTerminatorInst { + $2->getInstList().push_back($3); + setValueName($2, $1); + + InsertValue($2); + $$ = $2; + } InstructionList : InstructionList Inst { $1->getInstList().push_back($2); $$ = $1; - CHECK_FOR_ERROR } | /* 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 - // referenced. - Function::BasicBlockListType &BBL = - CurFun.CurrentFunction->getBasicBlockList(); - BBL.splice(BBL.end(), BBL, $$); - CHECK_FOR_ERROR - } - | 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 - // referenced. - Function::BasicBlockListType &BBL = - CurFun.CurrentFunction->getBasicBlockList(); - BBL.splice(BBL.end(), BBL, $$); - CHECK_FOR_ERROR - }; + $$ = new BasicBlock(); + } BBTerminatorInst : RET ResolvedVal { // Return with a result... $$ = new ReturnInst($2); - CHECK_FOR_ERROR } | RET VOID { // Return with no result... $$ = new ReturnInst(); - CHECK_FOR_ERROR } | BR LABEL ValueRef { // Unconditional Branch... - BasicBlock* tmpBB = getBBVal($3); - CHECK_FOR_ERROR - $$ = new BranchInst(tmpBB); + $$ = new BranchInst(getVal(Type::LabelTy, $3)->castBasicBlockAsserting()); } // Conditional Branch... | BR BOOL ValueRef ',' LABEL ValueRef ',' LABEL ValueRef { - 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); + $$ = new BranchInst(getVal(Type::LabelTy, $6)->castBasicBlockAsserting(), + getVal(Type::LabelTy, $9)->castBasicBlockAsserting(), + getVal(Type::BoolTy, $3)); } | SWITCH IntType ValueRef ',' LABEL ValueRef '[' JumpTable ']' { - Value* tmpVal = getVal($2, $3); - CHECK_FOR_ERROR - BasicBlock* tmpBB = getBBVal($6); - CHECK_FOR_ERROR - SwitchInst *S = new SwitchInst(tmpVal, tmpBB, $8->size()); + SwitchInst *S = new SwitchInst(getVal($2, $3), + getVal(Type::LabelTy, $6)->castBasicBlockAsserting()); $$ = S; - std::vector >::iterator I = $8->begin(), - E = $8->end(); - for (; I != E; ++I) { - if (ConstantInt *CI = dyn_cast(I->first)) - S->addCase(CI, I->second); - else - GEN_ERROR("Switch case is constant, but not a simple integer!"); - } - delete $8; - CHECK_FOR_ERROR + list >::iterator I = $8->begin(), + end = $8->end(); + for (; I != end; ++I) + S->dest_push_back(I->first, I->second); } - | SWITCH IntType ValueRef ',' LABEL ValueRef '[' ']' { - 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 - } - | INVOKE OptCallingConv TypesV ValueRef '(' ValueRefListE ')' - TO LABEL ValueRef UNWIND LABEL ValueRef { - const PointerType *PFTy; - const FunctionType *Ty; - - if (!(PFTy = dyn_cast($3->get())) || - !(Ty = dyn_cast(PFTy->getElementType()))) { - // Pull out the types of all of the arguments... - std::vector ParamTypes; - if ($6) { - for (std::vector::iterator I = $6->begin(), E = $6->end(); - I != E; ++I) - ParamTypes.push_back((*I)->getType()); - } - - bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy; - if (isVarArg) ParamTypes.pop_back(); - - Ty = FunctionType::get($3->get(), ParamTypes, isVarArg); - PFTy = PointerType::get(Ty); - } - - Value *V = getVal(PFTy, $4); // Get the function we're calling... - 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? - $$ = new InvokeInst(V, Normal, Except, std::vector()); - } else { // Has arguments? - // Loop through FunctionType's arguments and ensure they are specified - // correctly! - // - FunctionType::param_iterator I = Ty->param_begin(); - FunctionType::param_iterator E = Ty->param_end(); - std::vector::iterator ArgI = $6->begin(), ArgE = $6->end(); - - for (; ArgI != ArgE && I != E; ++ArgI, ++I) - if ((*ArgI)->getType() != *I) - GEN_ERROR("Parameter " +(*ArgI)->getName()+ " is not of type '" + - (*I)->getDescription() + "'!"); - - if (I != E || (ArgI != ArgE && !Ty->isVarArg())) - GEN_ERROR("Invalid number of parameters detected!"); - - $$ = new InvokeInst(V, Normal, Except, *$6); - } - cast($$)->setCallingConv($2); - - delete $3; - delete $6; - CHECK_FOR_ERROR - } - | UNWIND { - $$ = new UnwindInst(); - CHECK_FOR_ERROR - } - | UNREACHABLE { - $$ = new UnreachableInst(); - CHECK_FOR_ERROR - }; - - JumpTable : JumpTable IntType ConstValueRef ',' LABEL ValueRef { $$ = $1; - Constant *V = cast(getValNonImprovising($2, $3)); - CHECK_FOR_ERROR + ConstPoolVal *V = getVal($2, $3, true)->castConstantAsserting(); if (V == 0) - GEN_ERROR("May only switch on a constant pool value!"); + ThrowException("May only switch on a constant pool value!"); - BasicBlock* tmpBB = getBBVal($6); - CHECK_FOR_ERROR - $$->push_back(std::make_pair(V, tmpBB)); + $$->push_back(make_pair(V, getVal($5, $6)->castBasicBlockAsserting())); } | IntType ConstValueRef ',' LABEL ValueRef { - $$ = new std::vector >(); - Constant *V = cast(getValNonImprovising($1, $2)); - CHECK_FOR_ERROR + $$ = new list >(); + ConstPoolVal *V = getVal($1, $2, true)->castConstantAsserting(); if (V == 0) - GEN_ERROR("May only switch on a constant pool value!"); + ThrowException("May only switch on a constant pool value!"); - BasicBlock* tmpBB = getBBVal($5); - CHECK_FOR_ERROR - $$->push_back(std::make_pair(V, tmpBB)); - }; + $$->push_back(make_pair(V, getVal($4, $5)->castBasicBlockAsserting())); + } Inst : OptAssign InstVal { - // Is this definition named?? if so, assign the name... - setValueName($2, $1); - CHECK_FOR_ERROR + setValueName($2, $1); // Is this definition named?? if so, assign the name... + InsertValue($2); $$ = $2; - CHECK_FOR_ERROR -}; +} PHIList : Types '[' ValueRef ',' ValueRef ']' { // Used for PHI nodes - $$ = new std::list >(); - Value* tmpVal = getVal(*$1, $3); - CHECK_FOR_ERROR - BasicBlock* tmpBB = getBBVal($5); - CHECK_FOR_ERROR - $$->push_back(std::make_pair(tmpVal, tmpBB)); + $$ = new list >(); + $$->push_back(make_pair(getVal(*$1, $3), + getVal(Type::LabelTy, $5)->castBasicBlockAsserting())); delete $1; } | PHIList ',' '[' ValueRef ',' ValueRef ']' { $$ = $1; - 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)); - }; + $1->push_back(make_pair(getVal($1->front().first->getType(), $4), + getVal(Type::LabelTy, $6)->castBasicBlockAsserting())); + } ValueRefList : ResolvedVal { // Used for call statements, and memory insts... - $$ = new std::vector(); + $$ = new list(); $$->push_back($1); } | ValueRefList ',' ResolvedVal { $$ = $1; $1->push_back($3); - CHECK_FOR_ERROR - }; + } // ValueRefListE - Just like ValueRefList, except that it may also be empty! -ValueRefListE : ValueRefList | /*empty*/ { $$ = 0; }; +ValueRefListE : ValueRefList | /*empty*/ { $$ = 0; } -OptTailCall : TAIL CALL { - $$ = true; - CHECK_FOR_ERROR - } - | CALL { - $$ = false; - CHECK_FOR_ERROR - }; - -InstVal : ArithmeticOps Types ValueRef ',' ValueRef { - if (!(*$2)->isInteger() && !(*$2)->isFloatingPoint() && - !isa((*$2).get())) - GEN_ERROR( - "Arithmetic operator requires integer, FP, or packed operands!"); - if (isa((*$2).get()) && - ($1.opcode == Instruction::URem || - $1.opcode == Instruction::SRem || - $1.opcode == Instruction::FRem)) - GEN_ERROR("U/S/FRem not supported on packed types!"); - // Upgrade the opcode from obsolete versions before we do anything with it. - sanitizeOpCode($1,*$2); - CHECK_FOR_ERROR; - Value* val1 = getVal(*$2, $3); - CHECK_FOR_ERROR - Value* val2 = getVal(*$2, $5); - CHECK_FOR_ERROR - $$ = BinaryOperator::create($1.opcode, val1, val2); - if ($$ == 0) - GEN_ERROR("binary operator returned null!"); - delete $2; - } - | LogicalOps Types ValueRef ',' ValueRef { - if (!(*$2)->isIntegral()) { - if (!isa($2->get()) || - !cast($2->get())->getElementType()->isIntegral()) - GEN_ERROR("Logical operator requires integral operands!"); - } - Value* tmpVal1 = getVal(*$2, $3); - CHECK_FOR_ERROR - Value* tmpVal2 = getVal(*$2, $5); - CHECK_FOR_ERROR - $$ = BinaryOperator::create($1.opcode, tmpVal1, tmpVal2); - if ($$ == 0) - GEN_ERROR("binary operator returned null!"); - delete $2; - } - | SetCondOps Types ValueRef ',' ValueRef { - if(isa((*$2).get())) { - GEN_ERROR( - "PackedTypes currently not supported in setcc instructions!"); - } - Value* tmpVal1 = getVal(*$2, $3); - CHECK_FOR_ERROR - Value* tmpVal2 = getVal(*$2, $5); - CHECK_FOR_ERROR - $$ = new SetCondInst($1.opcode, tmpVal1, tmpVal2); +InstVal : BinaryOps Types ValueRef ',' ValueRef { + $$ = BinaryOperator::create($1, getVal(*$2, $3), getVal(*$2, $5)); if ($$ == 0) - GEN_ERROR("binary operator returned null!"); + ThrowException("binary operator returned null!"); delete $2; } - | NOT ResolvedVal { - std::cerr << "WARNING: Use of eliminated 'not' instruction:" - << " Replacing with 'xor'.\n"; - - Value *Ones = ConstantIntegral::getAllOnesValue($2->getType()); - if (Ones == 0) - GEN_ERROR("Expected integral type for not instruction!"); - - $$ = BinaryOperator::create(Instruction::Xor, $2, Ones); + | UnaryOps ResolvedVal { + $$ = UnaryOperator::create($1, $2); if ($$ == 0) - GEN_ERROR("Could not create a xor instruction!"); - CHECK_FOR_ERROR + ThrowException("unary operator returned null!"); } | ShiftOps ResolvedVal ',' ResolvedVal { if ($4->getType() != Type::UByteTy) - GEN_ERROR("Shift amount must be ubyte!"); - if (!$2->getType()->isInteger()) - GEN_ERROR("Shift constant expression requires integer operand!"); - $$ = new ShiftInst($1.opcode, $2, $4); - CHECK_FOR_ERROR + ThrowException("Shift amount must be ubyte!"); + $$ = new ShiftInst($1, $2, $4); } | CAST ResolvedVal TO Types { - if (!$4->get()->isFirstClassType()) - GEN_ERROR("cast instruction to a non-primitive type: '" + - $4->get()->getDescription() + "'!"); $$ = new CastInst($2, *$4); delete $4; - CHECK_FOR_ERROR } - | SELECT ResolvedVal ',' ResolvedVal ',' ResolvedVal { - if ($2->getType() != Type::BoolTy) - GEN_ERROR("select condition must be boolean!"); - if ($4->getType() != $6->getType()) - GEN_ERROR("select value types should match!"); - $$ = new SelectInst($2, $4, $6); - CHECK_FOR_ERROR - } - | VAARG ResolvedVal ',' Types { - NewVarArgs = true; - $$ = new VAArgInst($2, *$4); - delete $4; - CHECK_FOR_ERROR - } - | VAARG_old ResolvedVal ',' Types { - ObsoleteVarArgs = true; - const Type* ArgTy = $2->getType(); - Function* NF = CurModule.CurrentModule-> - getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0); - - //b = vaarg a, t -> - //foo = alloca 1 of t - //bar = vacopy a - //store bar -> foo - //b = vaarg foo, t - AllocaInst* foo = new AllocaInst(ArgTy, 0, "vaarg.fix"); - CurBB->getInstList().push_back(foo); - CallInst* bar = new CallInst(NF, $2); - CurBB->getInstList().push_back(bar); - CurBB->getInstList().push_back(new StoreInst(bar, foo)); - $$ = new VAArgInst(foo, *$4); - delete $4; - CHECK_FOR_ERROR - } - | VANEXT_old ResolvedVal ',' Types { - ObsoleteVarArgs = true; - const Type* ArgTy = $2->getType(); - Function* NF = CurModule.CurrentModule-> - getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0); - - //b = vanext a, t -> - //foo = alloca 1 of t - //bar = vacopy a - //store bar -> foo - //tmp = vaarg foo, t - //b = load foo - AllocaInst* foo = new AllocaInst(ArgTy, 0, "vanext.fix"); - CurBB->getInstList().push_back(foo); - CallInst* bar = new CallInst(NF, $2); - CurBB->getInstList().push_back(bar); - CurBB->getInstList().push_back(new StoreInst(bar, foo)); - Instruction* tmp = new VAArgInst(foo, *$4); - CurBB->getInstList().push_back(tmp); - $$ = new LoadInst(foo); - delete $4; - CHECK_FOR_ERROR - } - | EXTRACTELEMENT ResolvedVal ',' ResolvedVal { - if (!ExtractElementInst::isValidOperands($2, $4)) - GEN_ERROR("Invalid extractelement operands!"); - $$ = new ExtractElementInst($2, $4); - CHECK_FOR_ERROR - } - | INSERTELEMENT ResolvedVal ',' ResolvedVal ',' ResolvedVal { - if (!InsertElementInst::isValidOperands($2, $4, $6)) - GEN_ERROR("Invalid insertelement operands!"); - $$ = new InsertElementInst($2, $4, $6); - CHECK_FOR_ERROR - } - | SHUFFLEVECTOR ResolvedVal ',' ResolvedVal ',' ResolvedVal { - if (!ShuffleVectorInst::isValidOperands($2, $4, $6)) - GEN_ERROR("Invalid shufflevector operands!"); - $$ = new ShuffleVectorInst($2, $4, $6); - CHECK_FOR_ERROR - } - | PHI_TOK PHIList { + | PHI PHIList { const Type *Ty = $2->front().first->getType(); - if (!Ty->isFirstClassType()) - GEN_ERROR("PHI node operands must be of first class type!"); $$ = new PHINode(Ty); - ((PHINode*)$$)->reserveOperandSpace($2->size()); while ($2->begin() != $2->end()) { if ($2->front().first->getType() != Ty) - GEN_ERROR("All elements of a PHI node must be of the same type!"); - cast($$)->addIncoming($2->front().first, $2->front().second); + ThrowException("All elements of a PHI node must be of the same type!"); + ((PHINode*)$$)->addIncoming($2->front().first, $2->front().second); $2->pop_front(); } delete $2; // Free the list... - CHECK_FOR_ERROR - } - | OptTailCall OptCallingConv TypesV ValueRef '(' ValueRefListE ')' { - const PointerType *PFTy; - const FunctionType *Ty; + } + | CALL TypesV ValueRef '(' ValueRefListE ')' { + const MethodType *Ty; - if (!(PFTy = dyn_cast($3->get())) || - !(Ty = dyn_cast(PFTy->getElementType()))) { + if (!(Ty = (*$2)->dyncastMethodType())) { // Pull out the types of all of the arguments... - std::vector ParamTypes; - if ($6) { - for (std::vector::iterator I = $6->begin(), E = $6->end(); - I != E; ++I) - ParamTypes.push_back((*I)->getType()); - } - - bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy; - if (isVarArg) ParamTypes.pop_back(); - - if (!(*$3)->isFirstClassType() && *$3 != Type::VoidTy) - GEN_ERROR("LLVM functions cannot return aggregate types!"); - - Ty = FunctionType::get($3->get(), ParamTypes, isVarArg); - PFTy = PointerType::get(Ty); + vector ParamTypes; + for (list::iterator I = $5->begin(), E = $5->end(); I != E; ++I) + ParamTypes.push_back((*I)->getType()); + Ty = MethodType::get(*$2, ParamTypes); } + delete $2; - Value *V = getVal(PFTy, $4); // Get the function we're calling... - CHECK_FOR_ERROR + Value *V = getVal(Ty, $3); // Get the method we're calling... // Create the call node... - if (!$6) { // 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!"); - - $$ = new CallInst(V, std::vector()); + if (!$5) { // Has no arguments? + $$ = new CallInst(V->castMethodAsserting(), vector()); } else { // Has arguments? - // Loop through FunctionType's arguments and ensure they are specified + // Loop through MethodType's arguments and ensure they are specified // correctly! // - FunctionType::param_iterator I = Ty->param_begin(); - FunctionType::param_iterator E = Ty->param_end(); - std::vector::iterator ArgI = $6->begin(), ArgE = $6->end(); + MethodType::ParamTypes::const_iterator I = Ty->getParamTypes().begin(); + MethodType::ParamTypes::const_iterator E = Ty->getParamTypes().end(); + list::iterator ArgI = $5->begin(), ArgE = $5->end(); for (; ArgI != ArgE && I != E; ++ArgI, ++I) - if ((*ArgI)->getType() != *I) - GEN_ERROR("Parameter " +(*ArgI)->getName()+ " is not of type '" + - (*I)->getDescription() + "'!"); + if ((*ArgI)->getType() != *I) + ThrowException("Parameter " +(*ArgI)->getName()+ " is not of type '" + + (*I)->getName() + "'!"); if (I != E || (ArgI != ArgE && !Ty->isVarArg())) - GEN_ERROR("Invalid number of parameters detected!"); + ThrowException("Invalid number of parameters detected!"); - $$ = new CallInst(V, *$6); + $$ = new CallInst(V->castMethodAsserting(), + vector($5->begin(), $5->end())); } - cast($$)->setTailCall($1); - cast($$)->setCallingConv($2); - delete $3; - delete $6; - CHECK_FOR_ERROR + delete $5; } | MemoryInst { $$ = $1; - CHECK_FOR_ERROR - }; - - -// IndexList - List of indices for GEP based instructions... -IndexList : ',' ValueRefList { - $$ = $2; - CHECK_FOR_ERROR - } | /* empty */ { - $$ = new std::vector(); - CHECK_FOR_ERROR - }; - -OptVolatile : VOLATILE { - $$ = true; - CHECK_FOR_ERROR } - | /* empty */ { - $$ = false; - CHECK_FOR_ERROR - }; - +// UByteList - List of ubyte values for load and store instructions +UByteList : ',' ConstVector { + $$ = $2; +} | /* empty */ { + $$ = new vector(); +} -MemoryInst : MALLOC Types OptCAlign { - $$ = new MallocInst(*$2, 0, $3); +MemoryInst : MALLOC Types { + $$ = new MallocInst(PointerType::get(*$2)); delete $2; - CHECK_FOR_ERROR } - | MALLOC Types ',' UINT ValueRef OptCAlign { - Value* tmpVal = getVal($4, $5); - CHECK_FOR_ERROR - $$ = new MallocInst(*$2, tmpVal, $6); + | MALLOC Types ',' UINT ValueRef { + if (!(*$2)->isArrayType() || ((const ArrayType*)$2->get())->isSized()) + ThrowException("Trying to allocate " + (*$2)->getName() + + " as unsized array!"); + const Type *Ty = PointerType::get(*$2); + $$ = new MallocInst(Ty, getVal($4, $5)); delete $2; } - | ALLOCA Types OptCAlign { - $$ = new AllocaInst(*$2, 0, $3); + | ALLOCA Types { + $$ = new AllocaInst(PointerType::get(*$2)); delete $2; - CHECK_FOR_ERROR } - | ALLOCA Types ',' UINT ValueRef OptCAlign { - Value* tmpVal = getVal($4, $5); - CHECK_FOR_ERROR - $$ = new AllocaInst(*$2, tmpVal, $6); + | ALLOCA Types ',' UINT ValueRef { + if (!(*$2)->isArrayType() || ((const ArrayType*)$2->get())->isSized()) + ThrowException("Trying to allocate " + (*$2)->getName() + + " as unsized array!"); + const Type *Ty = PointerType::get(*$2); + Value *ArrSize = getVal($4, $5); + $$ = new AllocaInst(Ty, ArrSize); delete $2; } | FREE ResolvedVal { - if (!isa($2->getType())) - GEN_ERROR("Trying to free nonpointer type " + - $2->getType()->getDescription() + "!"); + if (!$2->getType()->isPointerType()) + ThrowException("Trying to free nonpointer type " + + $2->getType()->getName() + "!"); $$ = new FreeInst($2); - CHECK_FOR_ERROR } - | OptVolatile LOAD Types ValueRef { - if (!isa($3->get())) - GEN_ERROR("Can't load from nonpointer type: " + - (*$3)->getDescription()); - if (!cast($3->get())->getElementType()->isFirstClassType()) - GEN_ERROR("Can't load from pointer of non-first-class type: " + - (*$3)->getDescription()); - 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()); - if (!PT) - GEN_ERROR("Can't store to a nonpointer type: " + - (*$5)->getDescription()); - const Type *ElTy = PT->getElementType(); - if (ElTy != $3->getType()) - GEN_ERROR("Can't store '" + $3->getType()->getDescription() + - "' into space of type '" + ElTy->getDescription() + "'!"); - - Value* tmpVal = getVal(*$5, $6); - CHECK_FOR_ERROR - $$ = new StoreInst($3, tmpVal, $1); - delete $5; - } - | GETELEMENTPTR Types ValueRef IndexList { - if (!isa($2->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($2->get(), $4->begin(), $4->end()), - GTE = gep_type_end($2->get(), $4->begin(), $4->end()); - for (unsigned i = 0, e = $4->size(); i != e && GTI != GTE; ++i, ++GTI) - if (isa(*GTI)) // Only change struct indices - if (ConstantInt *CUI = dyn_cast((*$4)[i])) - if (CUI->getType() == Type::UByteTy) - (*$4)[i] = ConstantExpr::getCast(CUI, Type::UIntTy); + | LOAD Types ValueRef UByteList { + if (!(*$2)->isPointerType()) + ThrowException("Can't load from nonpointer type: " + (*$2)->getName()); + if (LoadInst::getIndexedType(*$2, *$4) == 0) + ThrowException("Invalid indices for load instruction!"); + $$ = new LoadInst(getVal(*$2, $3), *$4); + delete $4; // Free the vector... + delete $2; + } + | STORE ResolvedVal ',' Types ValueRef UByteList { + if (!(*$4)->isPointerType()) + ThrowException("Can't store to a nonpointer type: " + (*$4)->getName()); + const Type *ElTy = StoreInst::getIndexedType(*$4, *$6); + if (ElTy == 0) + ThrowException("Can't store into that field list!"); + if (ElTy != $2->getType()) + ThrowException("Can't store '" + $2->getType()->getName() + + "' into space of type '" + ElTy->getName() + "'!"); + $$ = new StoreInst($2, getVal(*$4, $5), *$6); + delete $4; delete $6; + } + | GETELEMENTPTR Types ValueRef UByteList { + if (!(*$2)->isPointerType()) + ThrowException("getelementptr insn requires pointer operand!"); if (!GetElementPtrInst::getIndexedType(*$2, *$4, true)) - GEN_ERROR("Invalid getelementptr indices for type '" + - (*$2)->getDescription()+ "'!"); - Value* tmpVal = getVal(*$2, $3); - CHECK_FOR_ERROR - $$ = new GetElementPtrInst(tmpVal, *$4); - delete $2; - delete $4; - }; - + ThrowException("Can't get element ptr '" + (*$2)->getName() + "'!"); + $$ = new GetElementPtrInst(getVal(*$2, $3), *$4); + delete $2; delete $4; + } %% - -void llvm::GenerateError(const std::string &message, int LineNo) { - if (LineNo == -1) LineNo = llvmAsmlineno; - // TODO: column number in exception - if (TheParseError) - TheParseError->setError(CurFilename, message, LineNo); - TriggerError = 1; -} - int yyerror(const char *ErrorMsg) { - std::string where - = std::string((CurFilename == "-") ? std::string("") : CurFilename) - + ":" + utostr((unsigned) llvmAsmlineno) + ": "; - std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading "; - if (yychar == YYEMPTY || yychar == 0) - errMsg += "end-of-file."; - else - errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'"; - GenerateError(errMsg); + ThrowException(string("Parse error: ") + ErrorMsg); return 0; } From jlaskey at apple.com Wed Nov 8 11:50:22 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 8 Nov 2006 13:50:22 -0400 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/DataTypes.h.in In-Reply-To: References: <200611081719.kA8HJhPl012938@zion.cs.uiuc.edu> <1163007542.30912.301.camel@bashful.x10sys.com> Message-ID: We know (float)HUGE_VAL works because that's where we started. -- Jim On Nov 8, 2006, at 1:41 PM, Chris Lattner wrote: >> >> #ifndef HUGE_VALF >> #ifndef HUGE_VAL >> #ifndef MAX_FLT >> #warning don't know how to define HUGE_VALF >> #else >> #define HUGE_VALF MAX_FLT >> #endif >> #else >> #define HUGE_VALF (float)HUGE_VAL >> #endif >> #endif > > More significantly, neither of these will work unless you #include > and/or float.h. > > -Chris -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 2417 bytes Desc: not available Url : http://lists.cs.uiuc.edu/pipermail/llvm-commits/attachments/20061108/b9d77cf0/attachment.bin From clattner at apple.com Wed Nov 8 11:52:39 2006 From: clattner at apple.com (Chris Lattner) Date: Wed, 8 Nov 2006 09:52:39 -0800 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/DataTypes.h.in In-Reply-To: References: <200611081719.kA8HJhPl012938@zion.cs.uiuc.edu> <1163007542.30912.301.camel@bashful.x10sys.com> Message-ID: <76FA567A-E5EE-47D2-934F-1526FF5ADC86@apple.com> On Nov 8, 2006, at 9:50 AM, Jim Laskey wrote: > We know (float)HUGE_VAL works because that's where we started. Right, but if DataTypes.in.h doesn't #include before checking for HUGE_VALF, HUGE_VALF will never be defined. -Chris > -- Jim > > > On Nov 8, 2006, at 1:41 PM, Chris Lattner wrote: > >>> >>> #ifndef HUGE_VALF >>> #ifndef HUGE_VAL >>> #ifndef MAX_FLT >>> #warning don't know how to define HUGE_VALF >>> #else >>> #define HUGE_VALF MAX_FLT >>> #endif >>> #else >>> #define HUGE_VALF (float)HUGE_VAL >>> #endif >>> #endif >> >> More significantly, neither of these will work unless you #include >> and/or float.h. >> >> -Chris > > _______________________________________________ > llvm-commits mailing list > llvm-commits at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits From tonic at nondot.org Wed Nov 8 12:00:27 2006 From: tonic at nondot.org (Tanya Lattner) Date: Wed, 8 Nov 2006 12:00:27 -0600 Subject: [llvm-commits] [release_19] CVS: llvm/lib/Support/Allocator.cpp Message-ID: <200611081800.kA8I0R2Y006839@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: Allocator.cpp updated: 1.1 -> 1.1.2.1 --- Log message: Merging from mainline. --- Diffs of the changes: (+1 -0) Allocator.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Support/Allocator.cpp diff -u llvm/lib/Support/Allocator.cpp:1.1 llvm/lib/Support/Allocator.cpp:1.1.2.1 --- llvm/lib/Support/Allocator.cpp:1.1 Sun Oct 29 16:08:03 2006 +++ llvm/lib/Support/Allocator.cpp Wed Nov 8 12:00:14 2006 @@ -12,6 +12,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Support/Allocator.h" +#include "llvm/Support/DataTypes.h" #include using namespace llvm; From jlaskey at apple.com Wed Nov 8 12:48:32 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 8 Nov 2006 12:48:32 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/DataTypes.h.in Message-ID: <200611081848.kA8ImWYq030043@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Support: DataTypes.h.in updated: 1.24 -> 1.25 --- Log message: Make sure comes first --- Diffs of the changes: (+2 -0) DataTypes.h.in | 2 ++ 1 files changed, 2 insertions(+) Index: llvm/include/llvm/Support/DataTypes.h.in diff -u llvm/include/llvm/Support/DataTypes.h.in:1.24 llvm/include/llvm/Support/DataTypes.h.in:1.25 --- llvm/include/llvm/Support/DataTypes.h.in:1.24 Wed Nov 8 11:19:29 2006 +++ llvm/include/llvm/Support/DataTypes.h.in Wed Nov 8 12:48:14 2006 @@ -50,6 +50,8 @@ #include #endif +#include + #ifdef _AIX #include "llvm/Support/AIXDataTypesFix.h" #endif From sabre at nondot.org Wed Nov 8 12:49:48 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 8 Nov 2006 12:49:48 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200611081849.kA8Inmb2030174@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.537 -> 1.538 --- Log message: disable this factoring optzn for GEPs for now, this severely pessimizes some loops. --- Diffs of the changes: (+1 -1) InstructionCombining.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.537 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.538 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.537 Wed Nov 8 00:47:33 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Wed Nov 8 12:49:31 2006 @@ -6878,7 +6878,7 @@ !isSafeToSinkLoad(LI)) return 0; } else if (isa(FirstInst)) { - if (FirstInst->getNumOperands() == 2) + if (0 && FirstInst->getNumOperands() == 2) return FoldPHIArgBinOpIntoPHI(PN); // Can't handle general GEPs yet. return 0; From jlaskey at apple.com Wed Nov 8 13:17:07 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 8 Nov 2006 13:17:07 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp Message-ID: <200611081917.kA8JH7AV010730@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: ConstantFolding.cpp updated: 1.98 -> 1.99 --- Log message: Remove redundant . --- Diffs of the changes: (+0 -1) ConstantFolding.cpp | 1 - 1 files changed, 1 deletion(-) Index: llvm/lib/VMCore/ConstantFolding.cpp diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.98 llvm/lib/VMCore/ConstantFolding.cpp:1.99 --- llvm/lib/VMCore/ConstantFolding.cpp:1.98 Wed Nov 8 00:47:33 2006 +++ llvm/lib/VMCore/ConstantFolding.cpp Wed Nov 8 13:16:44 2006 @@ -28,7 +28,6 @@ #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/MathExtras.h" #include -#include using namespace llvm; namespace { From jlaskey at apple.com Wed Nov 8 13:17:08 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 8 Nov 2006 13:17:08 -0600 Subject: [llvm-commits] CVS: llvm/lib/Support/FileUtilities.cpp Message-ID: <200611081917.kA8JH8C2010743@zion.cs.uiuc.edu> Changes in directory llvm/lib/Support: FileUtilities.cpp updated: 1.51 -> 1.52 --- Log message: Remove redundant . --- Diffs of the changes: (+0 -1) FileUtilities.cpp | 1 - 1 files changed, 1 deletion(-) Index: llvm/lib/Support/FileUtilities.cpp diff -u llvm/lib/Support/FileUtilities.cpp:1.51 llvm/lib/Support/FileUtilities.cpp:1.52 --- llvm/lib/Support/FileUtilities.cpp:1.51 Wed Oct 18 15:23:52 2006 +++ llvm/lib/Support/FileUtilities.cpp Wed Nov 8 13:16:44 2006 @@ -16,7 +16,6 @@ #include "llvm/System/Path.h" #include "llvm/System/MappedFile.h" #include "llvm/ADT/StringExtras.h" -#include #include #include using namespace llvm; From jlaskey at apple.com Wed Nov 8 13:17:09 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 8 Nov 2006 13:17:09 -0600 Subject: [llvm-commits] CVS: llvm/lib/Analysis/ConstantFolding.cpp ScalarEvolution.cpp Message-ID: <200611081917.kA8JH9PY010766@zion.cs.uiuc.edu> Changes in directory llvm/lib/Analysis: ConstantFolding.cpp updated: 1.5 -> 1.6 ScalarEvolution.cpp updated: 1.57 -> 1.58 --- Log message: Remove redundant . --- Diffs of the changes: (+0 -2) ConstantFolding.cpp | 1 - ScalarEvolution.cpp | 1 - 2 files changed, 2 deletions(-) Index: llvm/lib/Analysis/ConstantFolding.cpp diff -u llvm/lib/Analysis/ConstantFolding.cpp:1.5 llvm/lib/Analysis/ConstantFolding.cpp:1.6 --- llvm/lib/Analysis/ConstantFolding.cpp:1.5 Fri Oct 20 02:07:24 2006 +++ llvm/lib/Analysis/ConstantFolding.cpp Wed Nov 8 13:16:43 2006 @@ -20,7 +20,6 @@ #include "llvm/Support/GetElementPtrTypeIterator.h" #include "llvm/Support/MathExtras.h" #include -#include using namespace llvm; //===----------------------------------------------------------------------===// Index: llvm/lib/Analysis/ScalarEvolution.cpp diff -u llvm/lib/Analysis/ScalarEvolution.cpp:1.57 llvm/lib/Analysis/ScalarEvolution.cpp:1.58 --- llvm/lib/Analysis/ScalarEvolution.cpp:1.57 Wed Nov 1 19:53:58 2006 +++ llvm/lib/Analysis/ScalarEvolution.cpp Wed Nov 8 13:16:43 2006 @@ -75,7 +75,6 @@ #include "llvm/Support/InstIterator.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/ADT/Statistic.h" -#include #include #include using namespace llvm; From jlaskey at apple.com Wed Nov 8 13:17:09 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 8 Nov 2006 13:17:09 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp SelectionDAG.cpp Message-ID: <200611081917.kA8JH9Zv010767@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.242 -> 1.243 SelectionDAG.cpp updated: 1.370 -> 1.371 --- Log message: Remove redundant . --- Diffs of the changes: (+0 -2) DAGCombiner.cpp | 1 - SelectionDAG.cpp | 1 - 2 files changed, 2 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.242 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.243 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.242 Wed Nov 8 02:30:28 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed Nov 8 13:16:43 2006 @@ -38,7 +38,6 @@ #include "llvm/Support/Compiler.h" #include "llvm/Support/CommandLine.h" #include -#include #include #include using namespace llvm; Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.370 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.371 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.370 Sun Nov 5 13:31:28 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Wed Nov 8 13:16:43 2006 @@ -28,7 +28,6 @@ #include "llvm/ADT/StringExtras.h" #include #include -#include #include using namespace llvm; From sabre at nondot.org Wed Nov 8 13:29:38 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 8 Nov 2006 13:29:38 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200611081929.kA8JTc24018793@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.538 -> 1.539 --- Log message: make this code more efficient by not creating a phi node we are just going to delete in the first place. This also makes it simpler. --- Diffs of the changes: (+33 -36) InstructionCombining.cpp | 69 ++++++++++++++++++++++------------------------- 1 files changed, 33 insertions(+), 36 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.538 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.539 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.538 Wed Nov 8 12:49:31 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Wed Nov 8 13:29:23 2006 @@ -6766,8 +6766,11 @@ assert(isa(FirstInst) || isa(FirstInst) || isa(FirstInst)); unsigned Opc = FirstInst->getOpcode(); - const Type *LHSType = FirstInst->getOperand(0)->getType(); - const Type *RHSType = FirstInst->getOperand(1)->getType(); + Value *LHSVal = FirstInst->getOperand(0); + Value *RHSVal = FirstInst->getOperand(1); + + const Type *LHSType = LHSVal->getType(); + const Type *RHSType = RHSVal->getType(); // Scan to see if all operands are the same opcode, all have one use, and all // kill their operands (i.e. the operands have one use). @@ -6779,52 +6782,46 @@ I->getOperand(0)->getType() != LHSType || I->getOperand(1)->getType() != RHSType) return 0; + + // Keep track of which operand needs a phi node. + if (I->getOperand(0) != LHSVal) LHSVal = 0; + if (I->getOperand(1) != RHSVal) RHSVal = 0; } - // Otherwise, this is safe and profitable to transform. Create two phi nodes. - PHINode *NewLHS = new PHINode(FirstInst->getOperand(0)->getType(), - FirstInst->getOperand(0)->getName()+".pn"); - NewLHS->reserveOperandSpace(PN.getNumOperands()/2); - PHINode *NewRHS = new PHINode(FirstInst->getOperand(1)->getType(), - FirstInst->getOperand(1)->getName()+".pn"); - NewRHS->reserveOperandSpace(PN.getNumOperands()/2); - + // Otherwise, this is safe and profitable to transform. Create up to two phi + // nodes. + PHINode *NewLHS = 0, *NewRHS = 0; Value *InLHS = FirstInst->getOperand(0); - NewLHS->addIncoming(InLHS, PN.getIncomingBlock(0)); Value *InRHS = FirstInst->getOperand(1); - NewRHS->addIncoming(InRHS, PN.getIncomingBlock(0)); - // Add all operands to the new PHsI. - for (unsigned i = 1, e = PN.getNumIncomingValues(); i != e; ++i) { - Value *NewInLHS = cast(PN.getIncomingValue(i))->getOperand(0); - Value *NewInRHS = cast(PN.getIncomingValue(i))->getOperand(1); - if (NewInLHS != InLHS) InLHS = 0; - if (NewInRHS != InRHS) InRHS = 0; - NewLHS->addIncoming(NewInLHS, PN.getIncomingBlock(i)); - NewRHS->addIncoming(NewInRHS, PN.getIncomingBlock(i)); - } - - Value *LHSVal; - if (InLHS) { - // The new PHI unions all of the same values together. This is really - // common, so we handle it intelligently here for compile-time speed. - LHSVal = InLHS; - delete NewLHS; - } else { + if (LHSVal == 0) { + NewLHS = new PHINode(LHSType, FirstInst->getOperand(0)->getName()+".pn"); + NewLHS->reserveOperandSpace(PN.getNumOperands()/2); + NewLHS->addIncoming(InLHS, PN.getIncomingBlock(0)); InsertNewInstBefore(NewLHS, PN); LHSVal = NewLHS; } - Value *RHSVal; - if (InRHS) { - // The new PHI unions all of the same values together. This is really - // common, so we handle it intelligently here for compile-time speed. - RHSVal = InRHS; - delete NewRHS; - } else { + + if (RHSVal == 0) { + NewRHS = new PHINode(RHSType, FirstInst->getOperand(1)->getName()+".pn"); + NewRHS->reserveOperandSpace(PN.getNumOperands()/2); + NewRHS->addIncoming(InRHS, PN.getIncomingBlock(0)); InsertNewInstBefore(NewRHS, PN); RHSVal = NewRHS; } + // Add all operands to the new PHIs. + for (unsigned i = 1, e = PN.getNumIncomingValues(); i != e; ++i) { + if (NewLHS) { + Value *NewInLHS =cast(PN.getIncomingValue(i))->getOperand(0); + NewLHS->addIncoming(NewInLHS, PN.getIncomingBlock(i)); + } + if (NewRHS) { + Value *NewInRHS =cast(PN.getIncomingValue(i))->getOperand(1); + NewRHS->addIncoming(NewInRHS, PN.getIncomingBlock(i)); + } + } + if (BinaryOperator *BinOp = dyn_cast(FirstInst)) return BinaryOperator::create(BinOp->getOpcode(), LHSVal, RHSVal); else if (ShiftInst *SI = dyn_cast(FirstInst)) From sabre at nondot.org Wed Nov 8 13:42:42 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 8 Nov 2006 13:42:42 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200611081942.kA8JggfX013202@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.539 -> 1.540 --- Log message: reenable factoring of GEP expressions, being more precise about the case that it bad to do. --- Diffs of the changes: (+10 -5) InstructionCombining.cpp | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.539 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.540 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.539 Wed Nov 8 13:29:23 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Wed Nov 8 13:42:28 2006 @@ -6788,12 +6788,17 @@ if (I->getOperand(1) != RHSVal) RHSVal = 0; } - // Otherwise, this is safe and profitable to transform. Create up to two phi - // nodes. - PHINode *NewLHS = 0, *NewRHS = 0; + // Otherwise, this is safe to transform, determine if it is profitable. + + // If this is a GEP, and if the index (not the pointer) needs a PHI, bail out. + // Indexes are often folded into load/store instructions, so we don't want to + // hide them behind a phi. + if (isa(FirstInst) && RHSVal == 0) + return 0; + Value *InLHS = FirstInst->getOperand(0); Value *InRHS = FirstInst->getOperand(1); - + PHINode *NewLHS = 0, *NewRHS = 0; if (LHSVal == 0) { NewLHS = new PHINode(LHSType, FirstInst->getOperand(0)->getName()+".pn"); NewLHS->reserveOperandSpace(PN.getNumOperands()/2); @@ -6875,7 +6880,7 @@ !isSafeToSinkLoad(LI)) return 0; } else if (isa(FirstInst)) { - if (0 && FirstInst->getNumOperands() == 2) + if (FirstInst->getNumOperands() == 2) return FoldPHIArgBinOpIntoPHI(PN); // Can't handle general GEPs yet. return 0; From jlaskey at apple.com Wed Nov 8 13:17:08 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 8 Nov 2006 13:17:08 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Utils/Local.cpp Message-ID: <200611081917.kA8JH8Om010746@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Utils: Local.cpp updated: 1.60 -> 1.61 --- Log message: Remove redundant . --- Diffs of the changes: (+0 -1) Local.cpp | 1 - 1 files changed, 1 deletion(-) Index: llvm/lib/Transforms/Utils/Local.cpp diff -u llvm/lib/Transforms/Utils/Local.cpp:1.60 llvm/lib/Transforms/Utils/Local.cpp:1.61 --- llvm/lib/Transforms/Utils/Local.cpp:1.60 Wed Nov 8 00:47:33 2006 +++ llvm/lib/Transforms/Utils/Local.cpp Wed Nov 8 13:16:44 2006 @@ -21,7 +21,6 @@ #include "llvm/Support/GetElementPtrTypeIterator.h" #include "llvm/Support/MathExtras.h" #include -#include using namespace llvm; //===----------------------------------------------------------------------===// From jlaskey at apple.com Wed Nov 8 13:17:07 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 8 Nov 2006 13:17:07 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp RegAllocLinearScan.cpp Message-ID: <200611081917.kA8JH7Dx010738@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveIntervalAnalysis.cpp updated: 1.192 -> 1.193 RegAllocLinearScan.cpp updated: 1.130 -> 1.131 --- Log message: Remove redundant . --- Diffs of the changes: (+0 -2) LiveIntervalAnalysis.cpp | 1 - RegAllocLinearScan.cpp | 1 - 2 files changed, 2 deletions(-) Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.192 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.193 --- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.192 Tue Nov 7 12:04:58 2006 +++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Wed Nov 8 13:16:43 2006 @@ -33,7 +33,6 @@ #include "llvm/ADT/Statistic.h" #include "llvm/ADT/STLExtras.h" #include -#include #include using namespace llvm; Index: llvm/lib/CodeGen/RegAllocLinearScan.cpp diff -u llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.130 llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.131 --- llvm/lib/CodeGen/RegAllocLinearScan.cpp:1.130 Tue Nov 7 06:25:45 2006 +++ llvm/lib/CodeGen/RegAllocLinearScan.cpp Wed Nov 8 13:16:43 2006 @@ -29,7 +29,6 @@ #include "llvm/Support/Debug.h" #include "llvm/Support/Compiler.h" #include -#include #include #include #include From jlaskey at apple.com Wed Nov 8 13:17:08 2006 From: jlaskey at apple.com (Jim Laskey) Date: Wed, 8 Nov 2006 13:17:08 -0600 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp ExternalFunctions.cpp Message-ID: <200611081917.kA8JH8v1010756@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/Interpreter: Execution.cpp updated: 1.146 -> 1.147 ExternalFunctions.cpp updated: 1.88 -> 1.89 --- Log message: Remove redundant . --- Diffs of the changes: (+0 -2) Execution.cpp | 1 - ExternalFunctions.cpp | 1 - 2 files changed, 2 deletions(-) Index: llvm/lib/ExecutionEngine/Interpreter/Execution.cpp diff -u llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.146 llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.147 --- llvm/lib/ExecutionEngine/Interpreter/Execution.cpp:1.146 Wed Nov 8 00:47:33 2006 +++ llvm/lib/ExecutionEngine/Interpreter/Execution.cpp Wed Nov 8 13:16:44 2006 @@ -20,7 +20,6 @@ #include "llvm/Support/GetElementPtrTypeIterator.h" #include "llvm/ADT/Statistic.h" #include "llvm/Support/Debug.h" -#include // For fmod using namespace llvm; namespace { Index: llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp diff -u llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:1.88 llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:1.89 --- llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:1.88 Tue Aug 15 20:24:12 2006 +++ llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp Wed Nov 8 13:16:44 2006 @@ -24,7 +24,6 @@ #include "llvm/Module.h" #include "llvm/System/DynamicLibrary.h" #include "llvm/Target/TargetData.h" -#include #include #include using std::vector; From isanbard at gmail.com Wed Nov 8 11:24:29 2006 From: isanbard at gmail.com (Bill Wendling) Date: Wed, 8 Nov 2006 09:24:29 -0800 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp RegAllocLinearScan.cpp In-Reply-To: References: <200611071226.kA7CQ5v8011213@zion.cs.uiuc.edu> <4551FFEC.6070506@cs.uiuc.edu> Message-ID: <16e5fdf90611080924k5bbebaecncb8d339d7134c8a7@mail.gmail.com> On 11/8/06, Jim Laskey wrote: > > John, > > Both are defined on Darwin, FLT_MAX in float.h and HUGE_VALF in math.h. > However, neither header seems to be based on a BSD header. I choose > HUGE_VALF because it was also defined in the LINUX and FREEBSD math.h > headers (seemed like confirmation to me.) I'll wait for Chris to make the > call. (might uses a #ifndef HUGE_VALF thingame.) > Would it be possible to use std::numeric_limits::infinity in instead? -bw From tonic at nondot.org Wed Nov 8 14:05:49 2006 From: tonic at nondot.org (Tanya Lattner) Date: Wed, 8 Nov 2006 14:05:49 -0600 Subject: [llvm-commits] [release_19] CVS: llvm/test/Regression/C++Frontend/2006-09-27-Debug-Protection.cpp Message-ID: <200611082005.kA8K5nov030558@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/C++Frontend: 2006-09-27-Debug-Protection.cpp updated: 1.1 -> 1.1.4.1 --- Log message: This test should be marked to xfail on llvmgcc-3.4 --- Diffs of the changes: (+1 -0) 2006-09-27-Debug-Protection.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/test/Regression/C++Frontend/2006-09-27-Debug-Protection.cpp diff -u llvm/test/Regression/C++Frontend/2006-09-27-Debug-Protection.cpp:1.1 llvm/test/Regression/C++Frontend/2006-09-27-Debug-Protection.cpp:1.1.4.1 --- llvm/test/Regression/C++Frontend/2006-09-27-Debug-Protection.cpp:1.1 Wed Sep 27 11:55:19 2006 +++ llvm/test/Regression/C++Frontend/2006-09-27-Debug-Protection.cpp Wed Nov 8 14:05:36 2006 @@ -1,3 +1,4 @@ +// XFAIL: llvmgcc3 // RUN: %llvmgxx -O0 -emit-llvm -S -g -o - %s | grep 'uint 1,' && // RUN: %llvmgxx -O0 -emit-llvm -S -g -o - %s | grep 'uint 2,' From reid at x10sys.com Wed Nov 8 14:06:51 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 8 Nov 2006 14:06:51 -0600 Subject: [llvm-commits] CVS: llvm/docs/BytecodeFormat.html Message-ID: <200611082006.kA8K6ppx030639@zion.cs.uiuc.edu> Changes in directory llvm/docs: BytecodeFormat.html updated: 1.54 -> 1.55 --- Log message: Update the instruction opcodes for release 1.9 --- Diffs of the changes: (+36 -34) BytecodeFormat.html | 70 ++++++++++++++++++++++++++-------------------------- 1 files changed, 36 insertions(+), 34 deletions(-) Index: llvm/docs/BytecodeFormat.html diff -u llvm/docs/BytecodeFormat.html:1.54 llvm/docs/BytecodeFormat.html:1.55 --- llvm/docs/BytecodeFormat.html:1.54 Sat Oct 14 19:11:05 2006 +++ llvm/docs/BytecodeFormat.html Wed Nov 8 14:06:36 2006 @@ -1587,45 +1587,47 @@ Add711.0 Sub811.0 Mul911.0 - Div1011.0 - Rem1111.0 + UDiv1011.9 + SDiv1111.9 + FDiv1211.9 + URem1311.9 + SRem1411.9 + FRem1511.9 Logical Operators - And1211.0 - Or1311.0 - Xor1411.0 + And1611.0 + Or1711.0 + Xor1811.0 Binary Comparison Operators - SetEQ1511.0 - SetNE1611.0 - SetLE1711.0 - SetGE1811.0 - SetLT1911.0 - SetGT2011.0 + SetEQ1911.0 + SetNE2011.0 + SetLE2111.0 + SetGE2211.0 + SetLT2311.0 + SetGT2411.0 Memory Operators - Malloc2111.0 - Free2211.0 - Alloca2311.0 - Load2411.0 - Store2511.0 - GetElementPtr2611.0 + Malloc2511.0 + Free2611.0 + Alloca2711.0 + Load2811.0 + Store2911.0 + GetElementPtr3011.0 Other Operators - PHI2711.0 - Cast2811.0 - Call2911.0 - Shl3011.0 - Shr3111.0 - VANext3211.0,unused since 1.5 - VAArg3311.0,unused sine 1.5 - Select3421.2 - UserOp13511.0 - UserOp23611.0 - VAArg3751.5 - ExtractElement3851.5 - InsertElement3951.5 - ShuffleElement4051.5 + PHI3111.0 + Cast3211.0 + Call3311.0 + Shl3411.0 + Shr3511.0 + Select3621.2 + UserOp13711.0 + UserOp23811.0 + VAArg3951.5 + ExtractElement4051.5 + InsertElement4151.5 + ShuffleElement4251.5 Pseudo Instructions* @@ -2167,7 +2169,7 @@ Reid Spencer and Chris Lattner
    The LLVM Compiler Infrastructure
    -Last modified: $Date: 2006/10/15 00:11:05 $ +Last modified: $Date: 2006/11/08 20:06:36 $ From reid at x10sys.com Wed Nov 8 14:07:54 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 8 Nov 2006 14:07:54 -0600 Subject: [llvm-commits] CVS: llvm/docs/BytecodeFormat.html Message-ID: <200611082007.kA8K7sjt030751@zion.cs.uiuc.edu> Changes in directory llvm/docs: BytecodeFormat.html updated: 1.55 -> 1.56 --- Log message: Document correct opcodes for post 1.9 release. --- Diffs of the changes: (+8 -11) BytecodeFormat.html | 19 ++++++++----------- 1 files changed, 8 insertions(+), 11 deletions(-) Index: llvm/docs/BytecodeFormat.html diff -u llvm/docs/BytecodeFormat.html:1.55 llvm/docs/BytecodeFormat.html:1.56 --- llvm/docs/BytecodeFormat.html:1.55 Wed Nov 8 14:06:36 2006 +++ llvm/docs/BytecodeFormat.html Wed Nov 8 14:07:40 2006 @@ -1616,18 +1616,15 @@ Cast3211.0 Call3311.0 Shl3411.0 - Shr3511.0 - - Select3621.2 - UserOp13711.0 - UserOp23811.0 - VAArg3951.5 - ExtractElement4051.5 - InsertElement4151.5 - ShuffleElement4251.5 + Select3721.2 + UserOp13811.0 + UserOp23911.0 + VAArg4051.5 + ExtractElement4151.5 + InsertElement4251.5 + ShuffleElement4351.5 Pseudo Instructions* @@ -2169,7 +2166,7 @@ Reid Spencer and Chris Lattner
    The LLVM Compiler Infrastructure
    -Last modified: $Date: 2006/11/08 20:06:36 $ +Last modified: $Date: 2006/11/08 20:07:40 $ From reid at x10sys.com Wed Nov 8 14:11:47 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 8 Nov 2006 14:11:47 -0600 Subject: [llvm-commits] [release_19] CVS: llvm/docs/BytecodeFormat.html Message-ID: <200611082011.kA8KBloG007050@zion.cs.uiuc.edu> Changes in directory llvm/docs: BytecodeFormat.html updated: 1.54 -> 1.54.4.1 --- Log message: Merge from head. Bytecode doc update for 1.9 release. --- Diffs of the changes: (+36 -34) BytecodeFormat.html | 70 ++++++++++++++++++++++++++-------------------------- 1 files changed, 36 insertions(+), 34 deletions(-) Index: llvm/docs/BytecodeFormat.html diff -u llvm/docs/BytecodeFormat.html:1.54 llvm/docs/BytecodeFormat.html:1.54.4.1 --- llvm/docs/BytecodeFormat.html:1.54 Sat Oct 14 19:11:05 2006 +++ llvm/docs/BytecodeFormat.html Wed Nov 8 14:11:33 2006 @@ -1587,45 +1587,47 @@ Add711.0 Sub811.0 Mul911.0 - Div1011.0 - Rem1111.0 + UDiv1011.9 + SDiv1111.9 + FDiv1211.9 + URem1311.9 + SRem1411.9 + FRem1511.9 Logical Operators - And1211.0 - Or1311.0 - Xor1411.0 + And1611.0 + Or1711.0 + Xor1811.0 Binary Comparison Operators - SetEQ1511.0 - SetNE1611.0 - SetLE1711.0 - SetGE1811.0 - SetLT1911.0 - SetGT2011.0 + SetEQ1911.0 + SetNE2011.0 + SetLE2111.0 + SetGE2211.0 + SetLT2311.0 + SetGT2411.0 Memory Operators - Malloc2111.0 - Free2211.0 - Alloca2311.0 - Load2411.0 - Store2511.0 - GetElementPtr2611.0 + Malloc2511.0 + Free2611.0 + Alloca2711.0 + Load2811.0 + Store2911.0 + GetElementPtr3011.0 Other Operators - PHI2711.0 - Cast2811.0 - Call2911.0 - Shl3011.0 - Shr3111.0 - VANext3211.0,unused since 1.5 - VAArg3311.0,unused sine 1.5 - Select3421.2 - UserOp13511.0 - UserOp23611.0 - VAArg3751.5 - ExtractElement3851.5 - InsertElement3951.5 - ShuffleElement4051.5 + PHI3111.0 + Cast3211.0 + Call3311.0 + Shl3411.0 + Shr3511.0 + Select3621.2 + UserOp13711.0 + UserOp23811.0 + VAArg3951.5 + ExtractElement4051.5 + InsertElement4151.5 + ShuffleElement4251.5 Pseudo Instructions* @@ -2167,7 +2169,7 @@ Reid Spencer and Chris Lattner
    The LLVM Compiler Infrastructure
    -Last modified: $Date: 2006/10/15 00:11:05 $ +Last modified: $Date: 2006/11/08 20:11:33 $ From tonic at nondot.org Wed Nov 8 14:16:18 2006 From: tonic at nondot.org (Tanya Lattner) Date: Wed, 8 Nov 2006 14:16:18 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/C++Frontend/2006-09-27-Debug-Protection.cpp Message-ID: <200611082016.kA8KGIPi007145@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/C++Frontend: 2006-09-27-Debug-Protection.cpp updated: 1.1 -> 1.2 --- Log message: Should be xfailed for llvm-gcc3.4 --- Diffs of the changes: (+1 -0) 2006-09-27-Debug-Protection.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/test/Regression/C++Frontend/2006-09-27-Debug-Protection.cpp diff -u llvm/test/Regression/C++Frontend/2006-09-27-Debug-Protection.cpp:1.1 llvm/test/Regression/C++Frontend/2006-09-27-Debug-Protection.cpp:1.2 --- llvm/test/Regression/C++Frontend/2006-09-27-Debug-Protection.cpp:1.1 Wed Sep 27 11:55:19 2006 +++ llvm/test/Regression/C++Frontend/2006-09-27-Debug-Protection.cpp Wed Nov 8 14:16:05 2006 @@ -1,3 +1,4 @@ +// XFAIL: llvmgcc3 // RUN: %llvmgxx -O0 -emit-llvm -S -g -o - %s | grep 'uint 1,' && // RUN: %llvmgxx -O0 -emit-llvm -S -g -o - %s | grep 'uint 2,' From evan.cheng at apple.com Wed Nov 8 14:27:41 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 8 Nov 2006 14:27:41 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200611082027.kA8KRfoU007421@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.243 -> 1.244 --- Log message: Match more post-indexed ops. --- Diffs of the changes: (+6 -2) DAGCombiner.cpp | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.243 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.244 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.243 Wed Nov 8 13:16:43 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed Nov 8 14:27:27 2006 @@ -301,8 +301,12 @@ SDOperand BasePtr; SDOperand Offset; ISD::MemOpAddrMode AM = ISD::UNINDEXED; - if (TLI.getPostIndexedAddressParts(Op, VT, BasePtr, Offset, AM,DAG) && - BasePtr == Ptr) { + if (TLI.getPostIndexedAddressParts(Op, VT, BasePtr, Offset, AM,DAG)) { + if (Ptr == Offset) + std::swap(BasePtr, Offset); + if (Ptr != BasePtr) + continue; + // Try turning it into a post-indexed load / store except when // 1) Op must be independent of N, i.e. Op is neither a predecessor // nor a successor of N. Otherwise, if Op is folded that would From evan.cheng at apple.com Wed Nov 8 14:31:24 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 8 Nov 2006 14:31:24 -0600 Subject: [llvm-commits] CVS: llvm/utils/TableGen/DAGISelEmitter.cpp Message-ID: <200611082031.kA8KVOnq007504@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: DAGISelEmitter.cpp updated: 1.279 -> 1.280 --- Log message: Always pass the root node to ComplexPattern isel matching function. --- Diffs of the changes: (+3 -4) DAGISelEmitter.cpp | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-) Index: llvm/utils/TableGen/DAGISelEmitter.cpp diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.279 llvm/utils/TableGen/DAGISelEmitter.cpp:1.280 --- llvm/utils/TableGen/DAGISelEmitter.cpp:1.279 Fri Nov 3 23:12:02 2006 +++ llvm/utils/TableGen/DAGISelEmitter.cpp Wed Nov 8 14:31:10 2006 @@ -2464,7 +2464,7 @@ emitCode("SDOperand Chain" + ChainSuffix + ";"); } - std::string Code = Fn + "(" + RootName; + std::string Code = Fn + "(" + RootName + ", " + RootName; for (unsigned i = 0; i < NumOps; i++) Code += ", CPTmp" + utostr(i); if (CP->hasProperty(SDNPHasChain)) { @@ -2531,10 +2531,10 @@ emitCode("SDOperand " + ChainName + ";"); } - std::string Code = Fn + "("; + std::string Code = Fn + "(N, "; if (CP->hasProperty(SDNPHasChain)) { std::string ParentName(RootName.begin(), RootName.end()-1); - Code += "N, " + ParentName + ", "; + Code += ParentName + ", "; } Code += RootName; for (unsigned i = 0; i < NumOps; i++) @@ -2662,7 +2662,6 @@ // value if used multiple times by this pattern result. Val = "Tmp"+utostr(ResNo); } else if (N->isLeaf() && (CP = NodeGetComplexPattern(N, ISE))) { - std::string Fn = CP->getSelectFunc(); for (unsigned i = 0; i < CP->getNumOperands(); ++i) { emitCode("AddToISelQueue(CPTmp" + utostr(i) + ");"); NodeOps.push_back("CPTmp" + utostr(i)); From evan.cheng at apple.com Wed Nov 8 14:32:19 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 8 Nov 2006 14:32:19 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Message-ID: <200611082032.kA8KWJ5n007539@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMISelDAGToDAG.cpp updated: 1.83 -> 1.84 --- Log message: Match tblegen changes. --- Diffs of the changes: (+16 -10) ARMISelDAGToDAG.cpp | 26 ++++++++++++++++---------- 1 files changed, 16 insertions(+), 10 deletions(-) Index: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp diff -u llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.83 llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.84 --- llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.83 Wed Nov 8 11:07:32 2006 +++ llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Wed Nov 8 14:32:04 2006 @@ -751,11 +751,14 @@ SDNode *Select(SDOperand Op); virtual void InstructionSelectBasicBlock(SelectionDAG &DAG); - bool SelectAddrRegImm(SDOperand N, SDOperand &Offset, SDOperand &Base); - bool SelectAddrMode1(SDOperand N, SDOperand &Arg, SDOperand &Shift, - SDOperand &ShiftType); - bool SelectAddrMode2(SDOperand N, SDOperand &Arg, SDOperand &Offset); - bool SelectAddrMode5(SDOperand N, SDOperand &Arg, SDOperand &Offset); + bool SelectAddrRegImm(SDOperand Op, SDOperand N, SDOperand &Offset, + SDOperand &Base); + bool SelectAddrMode1(SDOperand Op, SDOperand N, SDOperand &Arg, + SDOperand &Shift, SDOperand &ShiftType); + bool SelectAddrMode2(SDOperand Op, SDOperand N, SDOperand &Arg, + SDOperand &Offset); + bool SelectAddrMode5(SDOperand Op, SDOperand N, SDOperand &Arg, + SDOperand &Offset); // Include the pieces autogenerated from the target description. #include "ARMGenDAGISel.inc" @@ -809,7 +812,8 @@ return false; } -bool ARMDAGToDAGISel::SelectAddrMode1(SDOperand N, +bool ARMDAGToDAGISel::SelectAddrMode1(SDOperand Op, + SDOperand N, SDOperand &Arg, SDOperand &Shift, SDOperand &ShiftType) { @@ -853,8 +857,8 @@ return true; } -bool ARMDAGToDAGISel::SelectAddrMode2(SDOperand N, SDOperand &Arg, - SDOperand &Offset) { +bool ARMDAGToDAGISel::SelectAddrMode2(SDOperand Op, SDOperand N, + SDOperand &Arg, SDOperand &Offset) { //TODO: complete and cleanup! SDOperand Zero = CurDAG->getTargetConstant(0, MVT::i32); if (FrameIndexSDNode *FIN = dyn_cast(N)) { @@ -882,7 +886,8 @@ return true; } -bool ARMDAGToDAGISel::SelectAddrMode5(SDOperand N, SDOperand &Arg, +bool ARMDAGToDAGISel::SelectAddrMode5(SDOperand Op, + SDOperand N, SDOperand &Arg, SDOperand &Offset) { //TODO: detect offset Offset = CurDAG->getTargetConstant(0, MVT::i32); @@ -891,7 +896,8 @@ } //register plus/minus 12 bit offset -bool ARMDAGToDAGISel::SelectAddrRegImm(SDOperand N, SDOperand &Offset, +bool ARMDAGToDAGISel::SelectAddrRegImm(SDOperand Op, + SDOperand N, SDOperand &Offset, SDOperand &Base) { if (FrameIndexSDNode *FIN = dyn_cast(N)) { Base = CurDAG->getTargetFrameIndex(FIN->getIndex(), MVT::i32); From evan.cheng at apple.com Wed Nov 8 14:33:23 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 8 Nov 2006 14:33:23 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Message-ID: <200611082033.kA8KXNlM007570@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCISelDAGToDAG.cpp updated: 1.214 -> 1.215 --- Log message: Match tblegen changes. --- Diffs of the changes: (+12 -9) PPCISelDAGToDAG.cpp | 21 ++++++++++++--------- 1 files changed, 12 insertions(+), 9 deletions(-) Index: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp diff -u llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.214 llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.215 --- llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.214 Tue Nov 7 20:15:41 2006 +++ llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Wed Nov 8 14:33:09 2006 @@ -104,27 +104,31 @@ /// SelectAddrImm - Returns true if the address N can be represented by /// a base register plus a signed 16-bit displacement [r+imm]. - bool SelectAddrImm(SDOperand N, SDOperand &Disp, SDOperand &Base) { + bool SelectAddrImm(SDOperand Op, SDOperand N, SDOperand &Disp, + SDOperand &Base) { return PPCLowering.SelectAddressRegImm(N, Disp, Base, *CurDAG); } /// SelectAddrIdx - Given the specified addressed, check to see if it can be /// represented as an indexed [r+r] operation. Returns false if it can /// be represented by [r+imm], which are preferred. - bool SelectAddrIdx(SDOperand N, SDOperand &Base, SDOperand &Index) { + bool SelectAddrIdx(SDOperand Op, SDOperand N, SDOperand &Base, + SDOperand &Index) { return PPCLowering.SelectAddressRegReg(N, Base, Index, *CurDAG); } /// SelectAddrIdxOnly - Given the specified addressed, force it to be /// represented as an indexed [r+r] operation. - bool SelectAddrIdxOnly(SDOperand N, SDOperand &Base, SDOperand &Index) { + bool SelectAddrIdxOnly(SDOperand Op, SDOperand N, SDOperand &Base, + SDOperand &Index) { return PPCLowering.SelectAddressRegRegOnly(N, Base, Index, *CurDAG); } /// SelectAddrImmShift - Returns true if the address N can be represented by /// a base register plus a signed 14-bit displacement [r+imm*4]. Suitable /// for use by STD and friends. - bool SelectAddrImmShift(SDOperand N, SDOperand &Disp, SDOperand &Base) { + bool SelectAddrImmShift(SDOperand Op, SDOperand N, SDOperand &Disp, + SDOperand &Base) { return PPCLowering.SelectAddressRegImmShift(N, Disp, Base, *CurDAG); } @@ -138,18 +142,18 @@ switch (ConstraintCode) { default: return true; case 'm': // memory - if (!SelectAddrIdx(Op, Op0, Op1)) - SelectAddrImm(Op, Op0, Op1); + if (!SelectAddrIdx(Op, Op, Op0, Op1)) + SelectAddrImm(Op, Op, Op0, Op1); break; case 'o': // offsetable - if (!SelectAddrImm(Op, Op0, Op1)) { + if (!SelectAddrImm(Op, Op, Op0, Op1)) { Op0 = Op; AddToISelQueue(Op0); // r+0. Op1 = getSmallIPtrImm(0); } break; case 'v': // not offsetable - SelectAddrIdxOnly(Op, Op0, Op1); + SelectAddrIdxOnly(Op, Op, Op0, Op1); break; } @@ -480,7 +484,6 @@ return 0; } - /// SelectCC - Select a comparison of the specified values with the specified /// condition code, returning the CR# of the expression. SDOperand PPCDAGToDAGISel::SelectCC(SDOperand LHS, SDOperand RHS, From evan.cheng at apple.com Wed Nov 8 14:34:43 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 8 Nov 2006 14:34:43 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Message-ID: <200611082034.kA8KYhsb007633@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelDAGToDAG.cpp updated: 1.122 -> 1.123 --- Log message: Match tblegen changes. --- Diffs of the changes: (+16 -15) X86ISelDAGToDAG.cpp | 31 ++++++++++++++++--------------- 1 files changed, 16 insertions(+), 15 deletions(-) Index: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp diff -u llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.122 llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.123 --- llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.122 Sun Nov 5 13:31:28 2006 +++ llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Nov 8 14:34:28 2006 @@ -143,11 +143,11 @@ SDNode *Select(SDOperand N); bool MatchAddress(SDOperand N, X86ISelAddressMode &AM, bool isRoot = true); - bool SelectAddr(SDOperand N, SDOperand &Base, SDOperand &Scale, - SDOperand &Index, SDOperand &Disp); - bool SelectLEAAddr(SDOperand N, SDOperand &Base, SDOperand &Scale, - SDOperand &Index, SDOperand &Disp); - bool SelectScalarSSELoad(SDOperand Root, SDOperand Pred, + bool SelectAddr(SDOperand Op, SDOperand N, SDOperand &Base, + SDOperand &Scale, SDOperand &Index, SDOperand &Disp); + bool SelectLEAAddr(SDOperand Op, SDOperand N, SDOperand &Base, + SDOperand &Scale, SDOperand &Index, SDOperand &Disp); + bool SelectScalarSSELoad(SDOperand Op, SDOperand Pred, SDOperand N, SDOperand &Base, SDOperand &Scale, SDOperand &Index, SDOperand &Disp, SDOperand &InChain, SDOperand &OutChain); @@ -773,8 +773,9 @@ /// SelectAddr - returns true if it is able pattern match an addressing mode. /// It returns the operands which make up the maximal addressing mode it can /// match by reference. -bool X86DAGToDAGISel::SelectAddr(SDOperand N, SDOperand &Base, SDOperand &Scale, - SDOperand &Index, SDOperand &Disp) { +bool X86DAGToDAGISel::SelectAddr(SDOperand Op, SDOperand N, SDOperand &Base, + SDOperand &Scale, SDOperand &Index, + SDOperand &Disp) { X86ISelAddressMode AM; if (MatchAddress(N, AM)) return false; @@ -805,7 +806,7 @@ /// SelectScalarSSELoad - Match a scalar SSE load. In particular, we want to /// match a load whose top elements are either undef or zeros. The load flavor /// is derived from the type of N, which is either v4f32 or v2f64. -bool X86DAGToDAGISel::SelectScalarSSELoad(SDOperand Root, SDOperand Pred, +bool X86DAGToDAGISel::SelectScalarSSELoad(SDOperand Op, SDOperand Pred, SDOperand N, SDOperand &Base, SDOperand &Scale, SDOperand &Index, SDOperand &Disp, SDOperand &InChain, @@ -814,9 +815,9 @@ InChain = N.getOperand(0).getValue(1); if (ISD::isNON_EXTLoad(InChain.Val) && InChain.getValue(0).hasOneUse() && - CanBeFoldedBy(N.Val, Pred.Val, Root.Val)) { + CanBeFoldedBy(N.Val, Pred.Val, Op.Val)) { LoadSDNode *LD = cast(InChain); - if (!SelectAddr(LD->getBasePtr(), Base, Scale, Index, Disp)) + if (!SelectAddr(Op, LD->getBasePtr(), Base, Scale, Index, Disp)) return false; OutChain = LD->getChain(); return true; @@ -856,7 +857,7 @@ // Okay, this is a zero extending load. Fold it. LoadSDNode *LD = cast(N.getOperand(1).getOperand(0)); - if (!SelectAddr(LD->getBasePtr(), Base, Scale, Index, Disp)) + if (!SelectAddr(Op, LD->getBasePtr(), Base, Scale, Index, Disp)) return false; OutChain = LD->getChain(); InChain = SDOperand(LD, 1); @@ -869,8 +870,8 @@ /// SelectLEAAddr - it calls SelectAddr and determines if the maximal addressing /// mode it matches can be cost effectively emitted as an LEA instruction. -bool X86DAGToDAGISel::SelectLEAAddr(SDOperand N, SDOperand &Base, - SDOperand &Scale, +bool X86DAGToDAGISel::SelectLEAAddr(SDOperand Op, SDOperand N, + SDOperand &Base, SDOperand &Scale, SDOperand &Index, SDOperand &Disp) { X86ISelAddressMode AM; if (MatchAddress(N, AM)) @@ -927,7 +928,7 @@ if (ISD::isNON_EXTLoad(N.Val) && N.hasOneUse() && CanBeFoldedBy(N.Val, P.Val, P.Val)) - return SelectAddr(N.getOperand(1), Base, Scale, Index, Disp); + return SelectAddr(P, N.getOperand(1), Base, Scale, Index, Disp); return false; } @@ -1288,7 +1289,7 @@ case 'v': // not offsetable ?? default: return true; case 'm': // memory - if (!SelectAddr(Op, Op0, Op1, Op2, Op3)) + if (!SelectAddr(Op, Op, Op0, Op1, Op2, Op3)) return true; break; } From evan.cheng at apple.com Wed Nov 8 14:35:52 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 8 Nov 2006 14:35:52 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86Subtarget.cpp Message-ID: <200611082035.kA8KZqlv007664@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86Subtarget.cpp updated: 1.38 -> 1.39 --- Log message: Use movl+xchgl instead of pushl+popl. --- Diffs of the changes: (+2 -3) X86Subtarget.cpp | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-) Index: llvm/lib/Target/X86/X86Subtarget.cpp diff -u llvm/lib/Target/X86/X86Subtarget.cpp:1.38 llvm/lib/Target/X86/X86Subtarget.cpp:1.39 --- llvm/lib/Target/X86/X86Subtarget.cpp:1.38 Mon Oct 16 19:24:49 2006 +++ llvm/lib/Target/X86/X86Subtarget.cpp Wed Nov 8 14:35:37 2006 @@ -44,10 +44,9 @@ return false; #elif defined(i386) || defined(__i386__) || defined(__x86__) || defined(_M_IX86) #if defined(__GNUC__) - asm ("pushl\t%%ebx\n\t" + asm ("movl\t%%ebx, %%esi\n\t" "cpuid\n\t" - "movl\t%%ebx, %%esi\n\t" - "popl\t%%ebx" + "xchgl\t%%ebx, %%esi\n\t" : "=a" (*rEAX), "=S" (*rEBX), "=c" (*rECX), From tonic at nondot.org Wed Nov 8 11:52:08 2006 From: tonic at nondot.org (Tanya Lattner) Date: Wed, 8 Nov 2006 11:52:08 -0600 Subject: [llvm-commits] [release_19] CVS: llvm/lib/AsmParser/Lexer.cpp.cvs llvmAsmParser.cpp.cvs llvmAsmParser.y llvmAsmParser.y.cvs Message-ID: <200611081752.kA8Hq8g4026215@zion.cs.uiuc.edu> Changes in directory llvm/lib/AsmParser: Lexer.cpp.cvs updated: 1.13 -> 1.13.2.1 llvmAsmParser.cpp.cvs updated: 1.23 -> 1.23.2.1 llvmAsmParser.y updated: 1.272.2.2 -> 1.272.2.3 llvmAsmParser.y.cvs updated: 1.24 -> 1.24.2.1 --- Log message: Merging from mainline and fixing wrong merge of llvmAsmParser.y --- Diffs of the changes: (+5207 -4563) Lexer.cpp.cvs | 283 +- llvmAsmParser.cpp.cvs | 6394 +++++++++++++++++++++----------------------------- llvmAsmParser.y | 3089 +++++++++++++++++------- llvmAsmParser.y.cvs | 4 4 files changed, 5207 insertions(+), 4563 deletions(-) Index: llvm/lib/AsmParser/Lexer.cpp.cvs diff -u llvm/lib/AsmParser/Lexer.cpp.cvs:1.13 llvm/lib/AsmParser/Lexer.cpp.cvs:1.13.2.1 --- llvm/lib/AsmParser/Lexer.cpp.cvs:1.13 Thu Nov 2 14:25:49 2006 +++ llvm/lib/AsmParser/Lexer.cpp.cvs Wed Nov 8 11:51:53 2006 @@ -17,10 +17,10 @@ #define yylineno llvmAsmlineno #line 20 "Lexer.cpp" -/* A lexical scanner generated by flex*/ +/* A lexical scanner generated by flex */ /* Scanner skeleton version: - * $Header: /home/vadve/shared/PublicCVS/llvm/lib/AsmParser/Lexer.cpp.cvs,v 1.13 2006/11/02 20:25:49 reid Exp $ + * $Header: /home/vadve/shared/PublicCVS/llvm/lib/AsmParser/Lexer.cpp.cvs,v 1.13.2.1 2006/11/08 17:51:53 tbrethou Exp $ */ #define FLEX_SCANNER @@ -28,7 +28,6 @@ #define YY_FLEX_MINOR_VERSION 5 #include -#include /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ @@ -42,6 +41,7 @@ #ifdef __cplusplus #include +#include /* Use prototypes in function declarations. */ #define YY_USE_PROTOS @@ -153,15 +153,6 @@ #define unput(c) yyunput( c, yytext_ptr ) -/* Some routines like yy_flex_realloc() are emitted as static but are - not called by all lexers. This generates warnings in some compilers, - notably GCC. Arrange to suppress these. */ -#ifdef __GNUC__ -#define YY_MAY_BE_UNUSED __attribute__((unused)) -#else -#define YY_MAY_BE_UNUSED -#endif - /* The following is because we cannot portably get our hands on size_t * (without autoconf's help, which isn't available because we want * flex-generated scanners to compile on their own). @@ -268,7 +259,7 @@ YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static inline void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )) YY_MAY_BE_UNUSED; +static inline void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); static void yy_flex_free YY_PROTO(( void * )); #define yy_new_buffer yy_create_buffer @@ -854,7 +845,7 @@ #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; -#line 1 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 1 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" #define INITIAL 0 /*===-- Lexer.l - Scanner for llvm assembly files --------------*- C++ -*--===// // @@ -869,7 +860,7 @@ // //===----------------------------------------------------------------------===*/ #define YY_NEVER_INTERACTIVE 1 -#line 28 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 28 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" #include "ParserInternals.h" #include "llvm/Module.h" #include @@ -1005,7 +996,7 @@ /* HexIntConstant - Hexadecimal constant generated by the CFE to avoid forcing * it to deal with 64 bit numbers. */ -#line 1009 "Lexer.cpp" +#line 1000 "Lexer.cpp" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -1153,13 +1144,13 @@ YY_DECL { register yy_state_type yy_current_state; - register char *yy_cp = NULL, *yy_bp = NULL; + register char *yy_cp, *yy_bp; register int yy_act; -#line 189 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 189 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" -#line 1163 "Lexer.cpp" +#line 1154 "Lexer.cpp" if ( yy_init ) { @@ -1252,537 +1243,537 @@ { /* beginning of action switch */ case 1: YY_RULE_SETUP -#line 191 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 191 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { /* Ignore comments for now */ } YY_BREAK case 2: YY_RULE_SETUP -#line 193 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 193 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return BEGINTOK; } YY_BREAK case 3: YY_RULE_SETUP -#line 194 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 194 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return ENDTOK; } YY_BREAK case 4: YY_RULE_SETUP -#line 195 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 195 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return TRUETOK; } YY_BREAK case 5: YY_RULE_SETUP -#line 196 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 196 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return FALSETOK; } YY_BREAK case 6: YY_RULE_SETUP -#line 197 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 197 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return DECLARE; } YY_BREAK case 7: YY_RULE_SETUP -#line 198 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 198 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return GLOBAL; } YY_BREAK case 8: YY_RULE_SETUP -#line 199 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 199 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return CONSTANT; } YY_BREAK case 9: YY_RULE_SETUP -#line 200 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 200 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return INTERNAL; } YY_BREAK case 10: YY_RULE_SETUP -#line 201 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 201 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return LINKONCE; } YY_BREAK case 11: YY_RULE_SETUP -#line 202 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 202 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return WEAK; } YY_BREAK case 12: YY_RULE_SETUP -#line 203 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 203 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return APPENDING; } YY_BREAK case 13: YY_RULE_SETUP -#line 204 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 204 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return DLLIMPORT; } YY_BREAK case 14: YY_RULE_SETUP -#line 205 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 205 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return DLLEXPORT; } YY_BREAK case 15: YY_RULE_SETUP -#line 206 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 206 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return EXTERN_WEAK; } YY_BREAK case 16: YY_RULE_SETUP -#line 207 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 207 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return EXTERNAL; } /* Deprecated, turn into external */ YY_BREAK case 17: YY_RULE_SETUP -#line 208 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 208 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return EXTERNAL; } YY_BREAK case 18: YY_RULE_SETUP -#line 209 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 209 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return IMPLEMENTATION; } YY_BREAK case 19: YY_RULE_SETUP -#line 210 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 210 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return ZEROINITIALIZER; } YY_BREAK case 20: YY_RULE_SETUP -#line 211 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 211 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return DOTDOTDOT; } YY_BREAK case 21: YY_RULE_SETUP -#line 212 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 212 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return UNDEF; } YY_BREAK case 22: YY_RULE_SETUP -#line 213 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 213 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return NULL_TOK; } YY_BREAK case 23: YY_RULE_SETUP -#line 214 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 214 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return TO; } YY_BREAK case 24: YY_RULE_SETUP -#line 215 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 215 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Unwind, UNWIND); } YY_BREAK case 25: YY_RULE_SETUP -#line 216 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 216 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return NOT; } /* Deprecated, turned into XOR */ YY_BREAK case 26: YY_RULE_SETUP -#line 217 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 217 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return TAIL; } YY_BREAK case 27: YY_RULE_SETUP -#line 218 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 218 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return TARGET; } YY_BREAK case 28: YY_RULE_SETUP -#line 219 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 219 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return TRIPLE; } YY_BREAK case 29: YY_RULE_SETUP -#line 220 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 220 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return DEPLIBS; } YY_BREAK case 30: YY_RULE_SETUP -#line 221 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 221 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return ENDIAN; } YY_BREAK case 31: YY_RULE_SETUP -#line 222 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 222 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return POINTERSIZE; } YY_BREAK case 32: YY_RULE_SETUP -#line 223 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 223 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return DATALAYOUT; } YY_BREAK case 33: YY_RULE_SETUP -#line 224 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 224 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return LITTLE; } YY_BREAK case 34: YY_RULE_SETUP -#line 225 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 225 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return BIG; } YY_BREAK case 35: YY_RULE_SETUP -#line 226 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 226 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return VOLATILE; } YY_BREAK case 36: YY_RULE_SETUP -#line 227 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 227 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return ALIGN; } YY_BREAK case 37: YY_RULE_SETUP -#line 228 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 228 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return SECTION; } YY_BREAK case 38: YY_RULE_SETUP -#line 229 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 229 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return MODULE; } YY_BREAK case 39: YY_RULE_SETUP -#line 230 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 230 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return ASM_TOK; } YY_BREAK case 40: YY_RULE_SETUP -#line 231 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 231 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return SIDEEFFECT; } YY_BREAK case 41: YY_RULE_SETUP -#line 233 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 233 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return CC_TOK; } YY_BREAK case 42: YY_RULE_SETUP -#line 234 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 234 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return CCC_TOK; } YY_BREAK case 43: YY_RULE_SETUP -#line 235 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 235 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return CSRETCC_TOK; } YY_BREAK case 44: YY_RULE_SETUP -#line 236 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 236 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return FASTCC_TOK; } YY_BREAK case 45: YY_RULE_SETUP -#line 237 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 237 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return COLDCC_TOK; } YY_BREAK case 46: YY_RULE_SETUP -#line 238 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 238 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return X86_STDCALLCC_TOK; } YY_BREAK case 47: YY_RULE_SETUP -#line 239 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 239 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return X86_FASTCALLCC_TOK; } YY_BREAK case 48: YY_RULE_SETUP -#line 241 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 241 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::VoidTy ; return VOID; } YY_BREAK case 49: YY_RULE_SETUP -#line 242 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 242 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::BoolTy ; return BOOL; } YY_BREAK case 50: YY_RULE_SETUP -#line 243 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 243 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::SByteTy ; return SBYTE; } YY_BREAK case 51: YY_RULE_SETUP -#line 244 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 244 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::UByteTy ; return UBYTE; } YY_BREAK case 52: YY_RULE_SETUP -#line 245 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 245 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::ShortTy ; return SHORT; } YY_BREAK case 53: YY_RULE_SETUP -#line 246 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 246 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::UShortTy; return USHORT; } YY_BREAK case 54: YY_RULE_SETUP -#line 247 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 247 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::IntTy ; return INT; } YY_BREAK case 55: YY_RULE_SETUP -#line 248 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 248 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::UIntTy ; return UINT; } YY_BREAK case 56: YY_RULE_SETUP -#line 249 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 249 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::LongTy ; return LONG; } YY_BREAK case 57: YY_RULE_SETUP -#line 250 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 250 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::ULongTy ; return ULONG; } YY_BREAK case 58: YY_RULE_SETUP -#line 251 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 251 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::FloatTy ; return FLOAT; } YY_BREAK case 59: YY_RULE_SETUP -#line 252 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 252 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::DoubleTy; return DOUBLE; } YY_BREAK case 60: YY_RULE_SETUP -#line 253 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 253 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.PrimType = Type::LabelTy ; return LABEL; } YY_BREAK case 61: YY_RULE_SETUP -#line 254 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 254 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return TYPE; } YY_BREAK case 62: YY_RULE_SETUP -#line 255 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 255 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return OPAQUE; } YY_BREAK case 63: YY_RULE_SETUP -#line 257 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 257 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Add, ADD); } YY_BREAK case 64: YY_RULE_SETUP -#line 258 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 258 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Sub, SUB); } YY_BREAK case 65: YY_RULE_SETUP -#line 259 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 259 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Mul, MUL); } YY_BREAK case 66: YY_RULE_SETUP -#line 260 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 260 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK_OBSOLETE(BinaryOpVal, UDiv, UDIV); } YY_BREAK case 67: YY_RULE_SETUP -#line 261 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 261 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, UDiv, UDIV); } YY_BREAK case 68: YY_RULE_SETUP -#line 262 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 262 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, SDiv, SDIV); } YY_BREAK case 69: YY_RULE_SETUP -#line 263 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 263 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, FDiv, FDIV); } YY_BREAK case 70: YY_RULE_SETUP -#line 264 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 264 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK_OBSOLETE(BinaryOpVal, URem, UREM); } YY_BREAK case 71: YY_RULE_SETUP -#line 265 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 265 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, URem, UREM); } YY_BREAK case 72: YY_RULE_SETUP -#line 266 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 266 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, SRem, SREM); } YY_BREAK case 73: YY_RULE_SETUP -#line 267 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 267 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, FRem, FREM); } YY_BREAK case 74: YY_RULE_SETUP -#line 268 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 268 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, And, AND); } YY_BREAK case 75: YY_RULE_SETUP -#line 269 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 269 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Or , OR ); } YY_BREAK case 76: YY_RULE_SETUP -#line 270 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 270 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, Xor, XOR); } YY_BREAK case 77: YY_RULE_SETUP -#line 271 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 271 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, SetNE, SETNE); } YY_BREAK case 78: YY_RULE_SETUP -#line 272 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 272 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, SetEQ, SETEQ); } YY_BREAK case 79: YY_RULE_SETUP -#line 273 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 273 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, SetLT, SETLT); } YY_BREAK case 80: YY_RULE_SETUP -#line 274 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 274 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, SetGT, SETGT); } YY_BREAK case 81: YY_RULE_SETUP -#line 275 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 275 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, SetLE, SETLE); } YY_BREAK case 82: YY_RULE_SETUP -#line 276 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 276 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(BinaryOpVal, SetGE, SETGE); } YY_BREAK case 83: YY_RULE_SETUP -#line 278 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 278 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, PHI, PHI_TOK); } YY_BREAK case 84: YY_RULE_SETUP -#line 279 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 279 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, Call, CALL); } YY_BREAK case 85: YY_RULE_SETUP -#line 280 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 280 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, Cast, CAST); } YY_BREAK case 86: YY_RULE_SETUP -#line 281 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 281 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, Select, SELECT); } YY_BREAK case 87: YY_RULE_SETUP -#line 282 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 282 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, Shl, SHL); } YY_BREAK case 88: YY_RULE_SETUP -#line 283 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 283 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, Shr, SHR); } YY_BREAK case 89: YY_RULE_SETUP -#line 284 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 284 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return VANEXT_old; } YY_BREAK case 90: YY_RULE_SETUP -#line 285 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 285 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return VAARG_old; } YY_BREAK case 91: YY_RULE_SETUP -#line 286 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 286 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, VAArg , VAARG); } YY_BREAK case 92: YY_RULE_SETUP -#line 287 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 287 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Ret, RET); } YY_BREAK case 93: YY_RULE_SETUP -#line 288 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 288 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Br, BR); } YY_BREAK case 94: YY_RULE_SETUP -#line 289 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 289 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Switch, SWITCH); } YY_BREAK case 95: YY_RULE_SETUP -#line 290 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 290 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Invoke, INVOKE); } YY_BREAK case 96: YY_RULE_SETUP -#line 291 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 291 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Unwind, UNWIND); } YY_BREAK case 97: YY_RULE_SETUP -#line 292 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 292 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(TermOpVal, Unreachable, UNREACHABLE); } YY_BREAK case 98: YY_RULE_SETUP -#line 294 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 294 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, Malloc, MALLOC); } YY_BREAK case 99: YY_RULE_SETUP -#line 295 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 295 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, Alloca, ALLOCA); } YY_BREAK case 100: YY_RULE_SETUP -#line 296 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 296 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, Free, FREE); } YY_BREAK case 101: YY_RULE_SETUP -#line 297 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 297 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, Load, LOAD); } YY_BREAK case 102: YY_RULE_SETUP -#line 298 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 298 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, Store, STORE); } YY_BREAK case 103: YY_RULE_SETUP -#line 299 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 299 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(MemOpVal, GetElementPtr, GETELEMENTPTR); } YY_BREAK case 104: YY_RULE_SETUP -#line 301 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 301 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, ExtractElement, EXTRACTELEMENT); } YY_BREAK case 105: YY_RULE_SETUP -#line 302 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 302 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, InsertElement, INSERTELEMENT); } YY_BREAK case 106: YY_RULE_SETUP -#line 303 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 303 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { RET_TOK(OtherOpVal, ShuffleVector, SHUFFLEVECTOR); } YY_BREAK case 107: YY_RULE_SETUP -#line 306 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 306 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { UnEscapeLexed(yytext+1); llvmAsmlval.StrVal = strdup(yytext+1); // Skip % @@ -1791,7 +1782,7 @@ YY_BREAK case 108: YY_RULE_SETUP -#line 311 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 311 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { yytext[strlen(yytext)-1] = 0; // nuke colon UnEscapeLexed(yytext); @@ -1801,7 +1792,7 @@ YY_BREAK case 109: YY_RULE_SETUP -#line 317 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 317 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { yytext[strlen(yytext)-2] = 0; // nuke colon, end quote UnEscapeLexed(yytext+1); @@ -1811,7 +1802,7 @@ YY_BREAK case 110: YY_RULE_SETUP -#line 324 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 324 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { // Note that we cannot unescape a string constant here! The // string constant might contain a \00 which would not be // understood by the string stuff. It is valid to make a @@ -1824,12 +1815,12 @@ YY_BREAK case 111: YY_RULE_SETUP -#line 335 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 335 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.UInt64Val = atoull(yytext); return EUINT64VAL; } YY_BREAK case 112: YY_RULE_SETUP -#line 336 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 336 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { uint64_t Val = atoull(yytext+1); // +1: we have bigger negative range @@ -1841,7 +1832,7 @@ YY_BREAK case 113: YY_RULE_SETUP -#line 344 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 344 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.UInt64Val = HexIntToVal(yytext+3); return yytext[0] == 's' ? ESINT64VAL : EUINT64VAL; @@ -1849,7 +1840,7 @@ YY_BREAK case 114: YY_RULE_SETUP -#line 349 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 349 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { uint64_t Val = atoull(yytext+1); if ((unsigned)Val != Val) @@ -1860,7 +1851,7 @@ YY_BREAK case 115: YY_RULE_SETUP -#line 356 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 356 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { uint64_t Val = atoull(yytext+2); // +1: we have bigger negative range @@ -1872,16 +1863,16 @@ YY_BREAK case 116: YY_RULE_SETUP -#line 365 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 365 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.FPVal = atof(yytext); return FPVAL; } YY_BREAK case 117: YY_RULE_SETUP -#line 366 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 366 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { llvmAsmlval.FPVal = HexToFP(yytext); return FPVAL; } YY_BREAK case YY_STATE_EOF(INITIAL): -#line 368 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 368 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { /* Make sure to free the internal buffers for flex when we are * done reading our input! @@ -1892,20 +1883,20 @@ YY_BREAK case 118: YY_RULE_SETUP -#line 376 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 376 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { /* Ignore whitespace */ } YY_BREAK case 119: YY_RULE_SETUP -#line 377 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 377 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" { return yytext[0]; } YY_BREAK case 120: YY_RULE_SETUP -#line 379 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 379 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK -#line 1909 "Lexer.cpp" +#line 1900 "Lexer.cpp" case YY_END_OF_BUFFER: { @@ -2281,7 +2272,6 @@ #endif /* ifndef YY_NO_UNPUT */ -#ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput() #else @@ -2355,7 +2345,7 @@ return c; } -#endif /* YY_NO_INPUT */ + #ifdef YY_USE_PROTOS void yyrestart( FILE *input_file ) @@ -2466,6 +2456,11 @@ } +#ifndef YY_ALWAYS_INTERACTIVE +#ifndef YY_NEVER_INTERACTIVE +extern int isatty YY_PROTO(( int )); +#endif +#endif #ifdef YY_USE_PROTOS void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) @@ -2783,5 +2778,5 @@ return 0; } #endif -#line 379 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l" +#line 379 "/Users/sabre/cvs/llvm/lib/AsmParser/Lexer.l" Index: llvm/lib/AsmParser/llvmAsmParser.cpp.cvs diff -u llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.23 llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.23.2.1 --- llvm/lib/AsmParser/llvmAsmParser.cpp.cvs:1.23 Thu Nov 2 14:25:49 2006 +++ llvm/lib/AsmParser/llvmAsmParser.cpp.cvs Wed Nov 8 11:51:54 2006 @@ -1,298 +1,128 @@ -/* 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 /Users/sabre/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 DATALAYOUT 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 UDIV 335 +#define SDIV 336 +#define FDIV 337 +#define UREM 338 +#define SREM 339 +#define FREM 340 +#define AND 341 +#define OR 342 +#define XOR 343 +#define SETLE 344 +#define SETGE 345 +#define SETLT 346 +#define SETGT 347 +#define SETEQ 348 +#define SETNE 349 +#define MALLOC 350 +#define ALLOCA 351 +#define FREE 352 +#define LOAD 353 +#define STORE 354 +#define GETELEMENTPTR 355 +#define PHI_TOK 356 +#define CAST 357 +#define SELECT 358 +#define SHL 359 +#define SHR 360 +#define VAARG 361 +#define EXTRACTELEMENT 362 +#define INSERTELEMENT 363 +#define SHUFFLEVECTOR 364 +#define VAARG_old 365 +#define VANEXT_old 366 - -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - ESINT64VAL = 258, - EUINT64VAL = 259, - SINTVAL = 260, - UINTVAL = 261, - FPVAL = 262, - VOID = 263, - BOOL = 264, - SBYTE = 265, - UBYTE = 266, - SHORT = 267, - USHORT = 268, - INT = 269, - UINT = 270, - LONG = 271, - ULONG = 272, - FLOAT = 273, - DOUBLE = 274, - TYPE = 275, - LABEL = 276, - VAR_ID = 277, - LABELSTR = 278, - STRINGCONSTANT = 279, - IMPLEMENTATION = 280, - ZEROINITIALIZER = 281, - TRUETOK = 282, - FALSETOK = 283, - BEGINTOK = 284, - ENDTOK = 285, - DECLARE = 286, - GLOBAL = 287, - CONSTANT = 288, - SECTION = 289, - VOLATILE = 290, - TO = 291, - DOTDOTDOT = 292, - NULL_TOK = 293, - UNDEF = 294, - CONST = 295, - INTERNAL = 296, - LINKONCE = 297, - WEAK = 298, - APPENDING = 299, - DLLIMPORT = 300, - DLLEXPORT = 301, - EXTERN_WEAK = 302, - OPAQUE = 303, - NOT = 304, - EXTERNAL = 305, - TARGET = 306, - TRIPLE = 307, - ENDIAN = 308, - POINTERSIZE = 309, - LITTLE = 310, - BIG = 311, - ALIGN = 312, - DEPLIBS = 313, - CALL = 314, - TAIL = 315, - ASM_TOK = 316, - MODULE = 317, - SIDEEFFECT = 318, - CC_TOK = 319, - CCC_TOK = 320, - CSRETCC_TOK = 321, - FASTCC_TOK = 322, - COLDCC_TOK = 323, - X86_STDCALLCC_TOK = 324, - X86_FASTCALLCC_TOK = 325, - DATALAYOUT = 326, - RET = 327, - BR = 328, - SWITCH = 329, - INVOKE = 330, - UNWIND = 331, - UNREACHABLE = 332, - ADD = 333, - SUB = 334, - MUL = 335, - UDIV = 336, - SDIV = 337, - FDIV = 338, - UREM = 339, - SREM = 340, - FREM = 341, - AND = 342, - OR = 343, - XOR = 344, - SETLE = 345, - SETGE = 346, - SETLT = 347, - SETGT = 348, - SETEQ = 349, - SETNE = 350, - MALLOC = 351, - ALLOCA = 352, - FREE = 353, - LOAD = 354, - STORE = 355, - GETELEMENTPTR = 356, - PHI_TOK = 357, - CAST = 358, - SELECT = 359, - SHL = 360, - SHR = 361, - VAARG = 362, - EXTRACTELEMENT = 363, - INSERTELEMENT = 364, - SHUFFLEVECTOR = 365, - VAARG_old = 366, - VANEXT_old = 367 - }; -#endif -/* Tokens. */ -#define ESINT64VAL 258 -#define EUINT64VAL 259 -#define SINTVAL 260 -#define UINTVAL 261 -#define FPVAL 262 -#define VOID 263 -#define BOOL 264 -#define SBYTE 265 -#define UBYTE 266 -#define SHORT 267 -#define USHORT 268 -#define INT 269 -#define UINT 270 -#define LONG 271 -#define ULONG 272 -#define FLOAT 273 -#define DOUBLE 274 -#define TYPE 275 -#define LABEL 276 -#define VAR_ID 277 -#define LABELSTR 278 -#define STRINGCONSTANT 279 -#define IMPLEMENTATION 280 -#define ZEROINITIALIZER 281 -#define TRUETOK 282 -#define FALSETOK 283 -#define BEGINTOK 284 -#define ENDTOK 285 -#define DECLARE 286 -#define GLOBAL 287 -#define CONSTANT 288 -#define SECTION 289 -#define VOLATILE 290 -#define TO 291 -#define DOTDOTDOT 292 -#define NULL_TOK 293 -#define UNDEF 294 -#define CONST 295 -#define INTERNAL 296 -#define LINKONCE 297 -#define WEAK 298 -#define APPENDING 299 -#define DLLIMPORT 300 -#define DLLEXPORT 301 -#define EXTERN_WEAK 302 -#define OPAQUE 303 -#define NOT 304 -#define EXTERNAL 305 -#define TARGET 306 -#define TRIPLE 307 -#define ENDIAN 308 -#define POINTERSIZE 309 -#define LITTLE 310 -#define BIG 311 -#define ALIGN 312 -#define DEPLIBS 313 -#define CALL 314 -#define TAIL 315 -#define ASM_TOK 316 -#define MODULE 317 -#define SIDEEFFECT 318 -#define CC_TOK 319 -#define CCC_TOK 320 -#define CSRETCC_TOK 321 -#define FASTCC_TOK 322 -#define COLDCC_TOK 323 -#define X86_STDCALLCC_TOK 324 -#define X86_FASTCALLCC_TOK 325 -#define DATALAYOUT 326 -#define RET 327 -#define BR 328 -#define SWITCH 329 -#define INVOKE 330 -#define UNWIND 331 -#define UNREACHABLE 332 -#define ADD 333 -#define SUB 334 -#define MUL 335 -#define UDIV 336 -#define SDIV 337 -#define FDIV 338 -#define UREM 339 -#define SREM 340 -#define FREM 341 -#define AND 342 -#define OR 343 -#define XOR 344 -#define SETLE 345 -#define SETGE 346 -#define SETLT 347 -#define SETGT 348 -#define SETEQ 349 -#define SETNE 350 -#define MALLOC 351 -#define ALLOCA 352 -#define FREE 353 -#define LOAD 354 -#define STORE 355 -#define GETELEMENTPTR 356 -#define PHI_TOK 357 -#define CAST 358 -#define SELECT 359 -#define SHL 360 -#define SHR 361 -#define VAARG 362 -#define EXTRACTELEMENT 363 -#define INSERTELEMENT 364 -#define SHUFFLEVECTOR 365 -#define VAARG_old 366 -#define VANEXT_old 367 - - - - -/* Copy the first part of user declarations. */ -#line 14 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 14 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" #include "ParserInternals.h" #include "llvm/CallingConv.h" @@ -1294,28 +1124,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 1016 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" -typedef union YYSTYPE { +#line 1016 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +typedef union { llvm::Module *ModuleVal; llvm::Function *FunctionVal; std::pair *ArgVal; @@ -1354,1466 +1164,1011 @@ OtherOpInfo OtherOpVal; llvm::Module::Endianness Endianness; } YYSTYPE; -/* Line 196 of yacc.c. */ -#line 1359 "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 1371 "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 521 +#define YYFLAG -32768 +#define YYNTBASE 127 + +#define YYTRANSLATE(x) ((unsigned)(x) <= 366 ? yytranslate[x] : 201) + +static const short yytranslate[] = { 0, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 116, + 117, 125, 2, 114, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 121, + 113, 122, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 118, 115, 120, 2, 2, 2, 2, 2, 126, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 119, + 2, 2, 123, 2, 124, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112 +}; -/* 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, 66, 68, 70, 72, 75, 76, 78, + 80, 82, 84, 86, 88, 90, 91, 92, 94, 96, + 98, 100, 102, 104, 107, 108, 111, 112, 116, 119, + 120, 122, 123, 127, 129, 132, 134, 136, 138, 140, + 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, + 162, 164, 166, 168, 170, 172, 174, 177, 182, 188, + 194, 198, 201, 204, 206, 210, 212, 216, 218, 219, + 224, 228, 232, 237, 242, 246, 249, 252, 255, 258, + 261, 264, 267, 270, 273, 276, 283, 289, 298, 305, + 312, 319, 326, 333, 342, 351, 355, 357, 359, 361, + 363, 366, 369, 374, 377, 379, 384, 387, 392, 393, + 401, 402, 410, 411, 419, 420, 428, 432, 437, 438, + 440, 442, 444, 448, 452, 456, 460, 464, 468, 470, + 471, 473, 475, 477, 478, 481, 485, 487, 489, 493, + 495, 496, 505, 507, 509, 513, 515, 517, 520, 521, + 523, 525, 526, 531, 532, 534, 536, 538, 540, 542, + 544, 546, 548, 550, 554, 556, 562, 564, 566, 568, + 570, 573, 576, 579, 583, 586, 587, 589, 592, 595, + 599, 609, 619, 628, 642, 644, 646, 653, 659, 662, + 669, 677, 679, 683, 685, 686, 689, 691, 697, 703, + 709, 712, 717, 722, 729, 734, 739, 744, 749, 756, + 763, 766, 774, 776, 779, 780, 782, 783, 787, 794, + 798, 805, 808, 813, 820 +}; -#endif +static const short yyrhs[] = { 5, + 0, 6, 0, 3, 0, 4, 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, 91, 0, 92, 0, 93, 0, 94, + 0, 95, 0, 105, 0, 106, 0, 16, 0, 14, + 0, 12, 0, 10, 0, 17, 0, 15, 0, 13, + 0, 11, 0, 133, 0, 134, 0, 18, 0, 19, + 0, 169, 113, 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, 114, 57, 4, 0, 34, 24, 0, 0, 142, + 0, 0, 114, 145, 144, 0, 142, 0, 57, 4, + 0, 148, 0, 8, 0, 150, 0, 8, 0, 150, + 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, 149, + 0, 184, 0, 115, 4, 0, 147, 116, 152, 117, + 0, 118, 4, 119, 150, 120, 0, 121, 4, 119, + 150, 122, 0, 123, 151, 124, 0, 123, 124, 0, + 150, 125, 0, 150, 0, 151, 114, 150, 0, 151, + 0, 151, 114, 37, 0, 37, 0, 0, 148, 118, + 155, 120, 0, 148, 118, 120, 0, 148, 126, 24, + 0, 148, 121, 155, 122, 0, 148, 123, 155, 124, + 0, 148, 123, 124, 0, 148, 38, 0, 148, 39, + 0, 148, 184, 0, 148, 154, 0, 148, 26, 0, + 133, 128, 0, 134, 4, 0, 9, 27, 0, 9, + 28, 0, 136, 7, 0, 103, 116, 153, 36, 148, + 117, 0, 101, 116, 153, 198, 117, 0, 104, 116, + 153, 114, 153, 114, 153, 117, 0, 129, 116, 153, + 114, 153, 117, 0, 130, 116, 153, 114, 153, 117, + 0, 131, 116, 153, 114, 153, 117, 0, 132, 116, + 153, 114, 153, 117, 0, 108, 116, 153, 114, 153, + 117, 0, 109, 116, 153, 114, 153, 114, 153, 117, + 0, 110, 116, 153, 114, 153, 114, 153, 117, 0, + 155, 114, 153, 0, 153, 0, 32, 0, 33, 0, + 158, 0, 158, 178, 0, 158, 180, 0, 158, 62, + 61, 164, 0, 158, 25, 0, 159, 0, 159, 137, + 20, 146, 0, 159, 180, 0, 159, 62, 61, 164, + 0, 0, 159, 137, 138, 156, 153, 160, 144, 0, + 0, 159, 137, 50, 156, 148, 161, 144, 0, 0, + 159, 137, 45, 156, 148, 162, 144, 0, 0, 159, + 137, 47, 156, 148, 163, 144, 0, 159, 51, 166, + 0, 159, 58, 113, 167, 0, 0, 24, 0, 56, + 0, 55, 0, 53, 113, 165, 0, 54, 113, 4, + 0, 52, 113, 24, 0, 71, 113, 24, 0, 118, + 168, 120, 0, 168, 114, 24, 0, 24, 0, 0, + 22, 0, 24, 0, 169, 0, 0, 148, 170, 0, + 172, 114, 171, 0, 171, 0, 172, 0, 172, 114, + 37, 0, 37, 0, 0, 139, 146, 169, 116, 173, + 117, 143, 140, 0, 29, 0, 123, 0, 138, 174, + 175, 0, 30, 0, 124, 0, 187, 177, 0, 0, + 45, 0, 47, 0, 0, 31, 181, 179, 174, 0, + 0, 63, 0, 3, 0, 4, 0, 7, 0, 27, + 0, 28, 0, 38, 0, 39, 0, 26, 0, 121, + 155, 122, 0, 154, 0, 61, 182, 24, 114, 24, + 0, 127, 0, 169, 0, 184, 0, 183, 0, 148, + 185, 0, 187, 188, 0, 176, 188, 0, 189, 137, + 190, 0, 189, 192, 0, 0, 23, 0, 72, 186, + 0, 72, 8, 0, 73, 21, 185, 0, 73, 9, + 185, 114, 21, 185, 114, 21, 185, 0, 74, 135, + 185, 114, 21, 185, 118, 191, 120, 0, 74, 135, + 185, 114, 21, 185, 118, 120, 0, 75, 139, 146, + 185, 116, 195, 117, 36, 21, 185, 76, 21, 185, + 0, 76, 0, 77, 0, 191, 135, 183, 114, 21, + 185, 0, 135, 183, 114, 21, 185, 0, 137, 197, + 0, 148, 118, 185, 114, 185, 120, 0, 193, 114, + 118, 185, 114, 185, 120, 0, 186, 0, 194, 114, + 186, 0, 194, 0, 0, 60, 59, 0, 59, 0, + 129, 148, 185, 114, 185, 0, 130, 148, 185, 114, + 185, 0, 131, 148, 185, 114, 185, 0, 49, 186, + 0, 132, 186, 114, 186, 0, 103, 186, 36, 148, + 0, 104, 186, 114, 186, 114, 186, 0, 107, 186, + 114, 148, 0, 111, 186, 114, 148, 0, 112, 186, + 114, 148, 0, 108, 186, 114, 186, 0, 109, 186, + 114, 186, 114, 186, 0, 110, 186, 114, 186, 114, + 186, 0, 102, 193, 0, 196, 139, 146, 185, 116, + 195, 117, 0, 200, 0, 114, 194, 0, 0, 35, + 0, 0, 96, 148, 141, 0, 96, 148, 114, 15, + 185, 141, 0, 97, 148, 141, 0, 97, 148, 114, + 15, 185, 141, 0, 98, 186, 0, 199, 99, 148, + 185, 0, 199, 100, 186, 114, 148, 185, 0, 101, + 148, 185, 198, 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 1357 - -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 127 -/* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 75 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 256 -/* YYNRULES -- Number of states. */ -#define YYNSTATES 521 - -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ -#define YYUNDEFTOK 2 -#define YYMAXUTOK 367 - -#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, - 116, 117, 125, 2, 114, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 121, 113, 122, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 118, 115, 120, 2, 2, 2, 2, 2, 126, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 119, 2, 2, 123, 2, 124, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112 +#if YYDEBUG != 0 +static const short yyrline[] = { 0, + 1139, 1140, 1148, 1149, 1159, 1159, 1159, 1159, 1159, 1159, + 1159, 1159, 1159, 1160, 1160, 1160, 1161, 1161, 1161, 1161, + 1161, 1161, 1163, 1163, 1167, 1167, 1167, 1167, 1168, 1168, + 1168, 1168, 1169, 1169, 1170, 1170, 1173, 1177, 1182, 1182, + 1183, 1184, 1185, 1186, 1187, 1188, 1191, 1191, 1192, 1193, + 1194, 1195, 1196, 1197, 1207, 1207, 1214, 1214, 1223, 1231, + 1231, 1237, 1237, 1239, 1244, 1258, 1258, 1259, 1259, 1261, + 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1272, 1272, 1272, + 1272, 1272, 1272, 1273, 1277, 1281, 1289, 1297, 1310, 1315, + 1327, 1337, 1341, 1352, 1357, 1363, 1364, 1368, 1372, 1383, + 1409, 1423, 1453, 1479, 1500, 1513, 1523, 1528, 1589, 1596, + 1605, 1611, 1617, 1621, 1625, 1633, 1644, 1676, 1684, 1711, + 1722, 1728, 1736, 1742, 1748, 1757, 1761, 1769, 1769, 1779, + 1787, 1792, 1796, 1800, 1804, 1819, 1841, 1844, 1847, 1852, + 1855, 1859, 1863, 1867, 1871, 1876, 1880, 1883, 1886, 1890, + 1903, 1904, 1906, 1910, 1919, 1923, 1928, 1930, 1935, 1940, + 1949, 1949, 1950, 1950, 1952, 1959, 1965, 1972, 1976, 1982, + 1987, 1992, 2087, 2087, 2089, 2097, 2097, 2099, 2104, 2104, + 2105, 2108, 2108, 2118, 2122, 2127, 2131, 2135, 2139, 2143, + 2147, 2151, 2155, 2159, 2184, 2188, 2202, 2206, 2212, 2212, + 2218, 2223, 2227, 2236, 2247, 2252, 2264, 2277, 2281, 2285, + 2290, 2299, 2318, 2327, 2383, 2387, 2394, 2405, 2418, 2427, + 2436, 2446, 2450, 2457, 2457, 2459, 2463, 2468, 2490, 2505, + 2519, 2532, 2540, 2548, 2556, 2562, 2582, 2605, 2611, 2617, + 2623, 2638, 2697, 2704, 2707, 2712, 2716, 2723, 2728, 2734, + 2739, 2745, 2753, 2765, 2780 }; +#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, 69, 71, 73, 75, 78, - 79, 81, 83, 85, 87, 89, 91, 93, 94, 95, - 97, 99, 101, 103, 105, 107, 110, 111, 114, 115, - 119, 122, 123, 125, 126, 130, 132, 135, 137, 139, - 141, 143, 145, 147, 149, 151, 153, 155, 157, 159, - 161, 163, 165, 167, 169, 171, 173, 175, 177, 180, - 185, 191, 197, 201, 204, 207, 209, 213, 215, 219, - 221, 222, 227, 231, 235, 240, 245, 249, 252, 255, - 258, 261, 264, 267, 270, 273, 276, 279, 286, 292, - 301, 308, 315, 322, 329, 336, 345, 354, 358, 360, - 362, 364, 366, 369, 372, 377, 380, 382, 387, 390, - 395, 396, 404, 405, 413, 414, 422, 423, 431, 435, - 440, 441, 443, 445, 447, 451, 455, 459, 463, 467, - 471, 473, 474, 476, 478, 480, 481, 484, 488, 490, - 492, 496, 498, 499, 508, 510, 512, 516, 518, 520, - 523, 524, 526, 528, 529, 534, 535, 537, 539, 541, - 543, 545, 547, 549, 551, 553, 557, 559, 565, 567, - 569, 571, 573, 576, 579, 582, 586, 589, 590, 592, - 595, 598, 602, 612, 622, 631, 645, 647, 649, 656, - 662, 665, 672, 680, 682, 686, 688, 689, 692, 694, - 700, 706, 712, 715, 720, 725, 732, 737, 742, 747, - 752, 759, 766, 769, 777, 779, 782, 783, 785, 786, - 790, 797, 801, 808, 811, 816, 823 -}; -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const short int yyrhs[] = -{ - 158, 0, -1, 5, -1, 6, -1, 3, -1, 4, - -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, 91, -1, 92, - -1, 93, -1, 94, -1, 95, -1, 105, -1, 106, - -1, 16, -1, 14, -1, 12, -1, 10, -1, 17, - -1, 15, -1, 13, -1, 11, -1, 134, -1, 135, - -1, 18, -1, 19, -1, 170, 113, -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, 114, 57, 4, -1, 34, - 24, -1, -1, 143, -1, -1, 114, 146, 145, -1, - 143, -1, 57, 4, -1, 149, -1, 8, -1, 151, - -1, 8, -1, 151, -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, 150, -1, 185, -1, 115, 4, -1, - 148, 116, 153, 117, -1, 118, 4, 119, 151, 120, - -1, 121, 4, 119, 151, 122, -1, 123, 152, 124, - -1, 123, 124, -1, 151, 125, -1, 151, -1, 152, - 114, 151, -1, 152, -1, 152, 114, 37, -1, 37, - -1, -1, 149, 118, 156, 120, -1, 149, 118, 120, - -1, 149, 126, 24, -1, 149, 121, 156, 122, -1, - 149, 123, 156, 124, -1, 149, 123, 124, -1, 149, - 38, -1, 149, 39, -1, 149, 185, -1, 149, 155, - -1, 149, 26, -1, 134, 129, -1, 135, 4, -1, - 9, 27, -1, 9, 28, -1, 137, 7, -1, 103, - 116, 154, 36, 149, 117, -1, 101, 116, 154, 199, - 117, -1, 104, 116, 154, 114, 154, 114, 154, 117, - -1, 130, 116, 154, 114, 154, 117, -1, 131, 116, - 154, 114, 154, 117, -1, 132, 116, 154, 114, 154, - 117, -1, 133, 116, 154, 114, 154, 117, -1, 108, - 116, 154, 114, 154, 117, -1, 109, 116, 154, 114, - 154, 114, 154, 117, -1, 110, 116, 154, 114, 154, - 114, 154, 117, -1, 156, 114, 154, -1, 154, -1, - 32, -1, 33, -1, 159, -1, 159, 179, -1, 159, - 181, -1, 159, 62, 61, 165, -1, 159, 25, -1, - 160, -1, 160, 138, 20, 147, -1, 160, 181, -1, - 160, 62, 61, 165, -1, -1, 160, 138, 139, 157, - 154, 161, 145, -1, -1, 160, 138, 50, 157, 149, - 162, 145, -1, -1, 160, 138, 45, 157, 149, 163, - 145, -1, -1, 160, 138, 47, 157, 149, 164, 145, - -1, 160, 51, 167, -1, 160, 58, 113, 168, -1, - -1, 24, -1, 56, -1, 55, -1, 53, 113, 166, - -1, 54, 113, 4, -1, 52, 113, 24, -1, 71, - 113, 24, -1, 118, 169, 120, -1, 169, 114, 24, - -1, 24, -1, -1, 22, -1, 24, -1, 170, -1, - -1, 149, 171, -1, 173, 114, 172, -1, 172, -1, - 173, -1, 173, 114, 37, -1, 37, -1, -1, 140, - 147, 170, 116, 174, 117, 144, 141, -1, 29, -1, - 123, -1, 139, 175, 176, -1, 30, -1, 124, -1, - 188, 178, -1, -1, 45, -1, 47, -1, -1, 31, - 182, 180, 175, -1, -1, 63, -1, 3, -1, 4, - -1, 7, -1, 27, -1, 28, -1, 38, -1, 39, - -1, 26, -1, 121, 156, 122, -1, 155, -1, 61, - 183, 24, 114, 24, -1, 128, -1, 170, -1, 185, - -1, 184, -1, 149, 186, -1, 188, 189, -1, 177, - 189, -1, 190, 138, 191, -1, 190, 193, -1, -1, - 23, -1, 72, 187, -1, 72, 8, -1, 73, 21, - 186, -1, 73, 9, 186, 114, 21, 186, 114, 21, - 186, -1, 74, 136, 186, 114, 21, 186, 118, 192, - 120, -1, 74, 136, 186, 114, 21, 186, 118, 120, - -1, 75, 140, 147, 186, 116, 196, 117, 36, 21, - 186, 76, 21, 186, -1, 76, -1, 77, -1, 192, - 136, 184, 114, 21, 186, -1, 136, 184, 114, 21, - 186, -1, 138, 198, -1, 149, 118, 186, 114, 186, - 120, -1, 194, 114, 118, 186, 114, 186, 120, -1, - 187, -1, 195, 114, 187, -1, 195, -1, -1, 60, - 59, -1, 59, -1, 130, 149, 186, 114, 186, -1, - 131, 149, 186, 114, 186, -1, 132, 149, 186, 114, - 186, -1, 49, 187, -1, 133, 187, 114, 187, -1, - 103, 187, 36, 149, -1, 104, 187, 114, 187, 114, - 187, -1, 107, 187, 114, 149, -1, 111, 187, 114, - 149, -1, 112, 187, 114, 149, -1, 108, 187, 114, - 187, -1, 109, 187, 114, 187, 114, 187, -1, 110, - 187, 114, 187, 114, 187, -1, 102, 194, -1, 197, - 140, 147, 186, 116, 196, 117, -1, 201, -1, 114, - 195, -1, -1, 35, -1, -1, 96, 149, 142, -1, - 96, 149, 114, 15, 186, 142, -1, 97, 149, 142, - -1, 97, 149, 114, 15, 186, 142, -1, 98, 187, - -1, 200, 99, 149, 186, -1, 200, 100, 187, 114, - 149, 186, -1, 101, 149, 186, 199, -1 -}; +#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const unsigned short int yyrline[] = -{ - 0, 1139, 1139, 1140, 1148, 1149, 1159, 1159, 1159, 1159, - 1159, 1159, 1159, 1159, 1159, 1160, 1160, 1160, 1161, 1161, - 1161, 1161, 1161, 1161, 1163, 1163, 1167, 1167, 1167, 1167, - 1168, 1168, 1168, 1168, 1169, 1169, 1170, 1170, 1173, 1177, - 1182, 1183, 1184, 1185, 1186, 1187, 1188, 1189, 1191, 1192, - 1193, 1194, 1195, 1196, 1197, 1198, 1207, 1208, 1214, 1215, - 1223, 1231, 1232, 1237, 1238, 1239, 1244, 1258, 1258, 1259, - 1259, 1261, 1271, 1271, 1271, 1271, 1271, 1271, 1271, 1272, - 1272, 1272, 1272, 1272, 1272, 1273, 1277, 1281, 1289, 1297, - 1310, 1315, 1327, 1337, 1341, 1352, 1357, 1363, 1364, 1368, - 1372, 1383, 1409, 1423, 1453, 1479, 1500, 1513, 1523, 1528, - 1589, 1596, 1605, 1611, 1617, 1621, 1625, 1633, 1644, 1676, - 1684, 1711, 1722, 1728, 1736, 1742, 1748, 1757, 1761, 1769, - 1769, 1779, 1787, 1792, 1796, 1800, 1804, 1819, 1841, 1844, - 1847, 1847, 1855, 1855, 1863, 1863, 1871, 1871, 1880, 1883, - 1886, 1890, 1903, 1904, 1906, 1910, 1919, 1923, 1928, 1930, - 1935, 1940, 1949, 1949, 1950, 1950, 1952, 1959, 1965, 1972, - 1976, 1982, 1987, 1992, 2087, 2087, 2089, 2097, 2097, 2099, - 2104, 2105, 2106, 2108, 2108, 2118, 2122, 2127, 2131, 2135, - 2139, 2143, 2147, 2151, 2155, 2159, 2184, 2188, 2202, 2206, - 2212, 2212, 2218, 2223, 2227, 2236, 2247, 2252, 2264, 2277, - 2281, 2285, 2290, 2299, 2318, 2327, 2383, 2387, 2394, 2405, - 2418, 2427, 2436, 2446, 2450, 2457, 2457, 2459, 2463, 2468, - 2490, 2505, 2519, 2532, 2540, 2548, 2556, 2562, 2582, 2605, - 2611, 2617, 2623, 2638, 2697, 2704, 2707, 2712, 2716, 2723, - 2728, 2734, 2739, 2745, 2753, 2765, 2780 +static const char * const yytname[] = { "$","error","$undefined.","ESINT64VAL", +"EUINT64VAL","SINTVAL","UINTVAL","FPVAL","VOID","BOOL","SBYTE","UBYTE","SHORT", +"USHORT","INT","UINT","LONG","ULONG","FLOAT","DOUBLE","TYPE","LABEL","VAR_ID", +"LABELSTR","STRINGCONSTANT","IMPLEMENTATION","ZEROINITIALIZER","TRUETOK","FALSETOK", +"BEGINTOK","ENDTOK","DECLARE","GLOBAL","CONSTANT","SECTION","VOLATILE","TO", +"DOTDOTDOT","NULL_TOK","UNDEF","CONST","INTERNAL","LINKONCE","WEAK","APPENDING", +"DLLIMPORT","DLLEXPORT","EXTERN_WEAK","OPAQUE","NOT","EXTERNAL","TARGET","TRIPLE", +"ENDIAN","POINTERSIZE","LITTLE","BIG","ALIGN","DEPLIBS","CALL","TAIL","ASM_TOK", +"MODULE","SIDEEFFECT","CC_TOK","CCC_TOK","CSRETCC_TOK","FASTCC_TOK","COLDCC_TOK", +"X86_STDCALLCC_TOK","X86_FASTCALLCC_TOK","DATALAYOUT","RET","BR","SWITCH","INVOKE", +"UNWIND","UNREACHABLE","ADD","SUB","MUL","UDIV","SDIV","FDIV","UREM","SREM", +"FREM","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", "DATALAYOUT", - "RET", "BR", "SWITCH", "INVOKE", "UNWIND", "UNREACHABLE", "ADD", "SUB", - "MUL", "UDIV", "SDIV", "FDIV", "UREM", "SREM", "FREM", "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, + 127, 127, 128, 128, 129, 129, 129, 129, 129, 129, + 129, 129, 129, 130, 130, 130, 131, 131, 131, 131, + 131, 131, 132, 132, 133, 133, 133, 133, 134, 134, + 134, 134, 135, 135, 136, 136, 137, 137, 138, 138, + 138, 138, 138, 138, 138, 138, 139, 139, 139, 139, + 139, 139, 139, 139, 140, 140, 141, 141, 142, 143, + 143, 144, 144, 145, 145, 146, 146, 147, 147, 148, + 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, 152, 152, 153, + 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, + 153, 153, 153, 153, 153, 154, 154, 154, 154, 154, + 154, 154, 154, 154, 154, 155, 155, 156, 156, 157, + 158, 158, 158, 158, 158, 159, 159, 159, 160, 159, + 161, 159, 162, 159, 163, 159, 159, 159, 159, 164, + 165, 165, 166, 166, 166, 166, 167, 168, 168, 168, + 169, 169, 170, 170, 171, 172, 172, 173, 173, 173, + 173, 174, 175, 175, 176, 177, 177, 178, 179, 179, + 179, 181, 180, 182, 182, 183, 183, 183, 183, 183, + 183, 183, 183, 183, 183, 183, 184, 184, 185, 185, + 186, 187, 187, 188, 189, 189, 189, 190, 190, 190, + 190, 190, 190, 190, 190, 190, 191, 191, 192, 193, + 193, 194, 194, 195, 195, 196, 196, 197, 197, 197, + 197, 197, 197, 197, 197, 197, 197, 197, 197, 197, + 197, 197, 197, 198, 198, 199, 199, 200, 200, 200, + 200, 200, 200, 200, 200 }; -#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, 363, 364, - 365, 366, 367, 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, 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, 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, 127, 128, 128, 129, 129, 130, 130, 130, 130, - 130, 130, 130, 130, 130, 131, 131, 131, 132, 132, - 132, 132, 132, 132, 133, 133, 134, 134, 134, 134, - 135, 135, 135, 135, 136, 136, 137, 137, 138, 138, - 139, 139, 139, 139, 139, 139, 139, 139, 140, 140, - 140, 140, 140, 140, 140, 140, 141, 141, 142, 142, - 143, 144, 144, 145, 145, 146, 146, 147, 147, 148, - 148, 149, 150, 150, 150, 150, 150, 150, 150, 150, - 150, 150, 150, 150, 150, 151, 151, 151, 151, 151, - 151, 151, 151, 151, 151, 152, 152, 153, 153, 153, - 153, 154, 154, 154, 154, 154, 154, 154, 154, 154, - 154, 154, 154, 154, 154, 154, 154, 155, 155, 155, - 155, 155, 155, 155, 155, 155, 155, 156, 156, 157, - 157, 158, 159, 159, 159, 159, 159, 160, 160, 160, - 161, 160, 162, 160, 163, 160, 164, 160, 160, 160, - 160, 165, 166, 166, 167, 167, 167, 167, 168, 169, - 169, 169, 170, 170, 171, 171, 172, 173, 173, 174, - 174, 174, 174, 175, 176, 176, 177, 178, 178, 179, - 180, 180, 180, 182, 181, 183, 183, 184, 184, 184, - 184, 184, 184, 184, 184, 184, 184, 184, 185, 185, - 186, 186, 187, 188, 188, 189, 190, 190, 190, 191, - 191, 191, 191, 191, 191, 191, 191, 191, 192, 192, - 193, 194, 194, 195, 195, 196, 196, 197, 197, 198, - 198, 198, 198, 198, 198, 198, 198, 198, 198, 198, - 198, 198, 198, 198, 198, 199, 199, 200, 200, 201, - 201, 201, 201, 201, 201, 201, 201 +static const short yydefact[] = { 149, + 46, 135, 134, 182, 39, 40, 41, 42, 43, 44, + 45, 0, 47, 206, 131, 132, 206, 161, 162, 0, + 0, 0, 46, 0, 137, 179, 0, 0, 48, 49, + 50, 51, 52, 53, 0, 0, 207, 203, 38, 176, + 177, 178, 202, 0, 0, 0, 0, 147, 0, 0, + 0, 0, 0, 0, 0, 37, 180, 181, 47, 150, + 133, 54, 1, 2, 67, 71, 72, 73, 74, 75, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 0, + 0, 0, 0, 197, 0, 0, 66, 85, 70, 198, + 86, 173, 174, 175, 247, 205, 0, 0, 0, 0, + 160, 148, 138, 136, 128, 129, 0, 0, 0, 0, + 183, 87, 0, 0, 69, 92, 94, 0, 0, 99, + 93, 246, 0, 227, 0, 0, 0, 0, 47, 215, + 216, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 0, + 0, 0, 0, 0, 0, 0, 23, 24, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 204, 47, + 219, 0, 243, 155, 152, 151, 153, 154, 156, 159, + 0, 143, 145, 141, 71, 72, 73, 74, 75, 76, + 77, 78, 79, 80, 81, 0, 0, 0, 0, 139, + 0, 0, 0, 91, 171, 98, 96, 0, 0, 231, + 226, 209, 208, 0, 0, 28, 32, 27, 31, 26, + 30, 25, 29, 33, 34, 0, 0, 57, 57, 252, + 0, 0, 241, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 157, + 62, 62, 62, 113, 114, 3, 4, 111, 112, 115, + 110, 106, 107, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 109, 108, 62, + 68, 68, 95, 170, 164, 167, 168, 0, 0, 88, + 186, 187, 188, 193, 189, 190, 191, 192, 184, 0, + 195, 200, 199, 201, 0, 210, 0, 0, 0, 248, + 0, 250, 245, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 158, 0, 144, 146, 142, 0, 0, 0, 0, 0, + 0, 101, 127, 0, 0, 105, 0, 102, 0, 0, + 0, 0, 140, 89, 90, 163, 165, 0, 60, 97, + 185, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 255, 0, 0, 233, 0, 235, 238, 0, 0, 236, + 237, 0, 0, 0, 232, 0, 253, 0, 0, 0, + 64, 62, 245, 0, 0, 0, 0, 0, 0, 100, + 103, 104, 0, 0, 0, 0, 169, 166, 61, 55, + 0, 194, 0, 0, 225, 57, 58, 57, 222, 244, + 0, 0, 0, 0, 0, 228, 229, 230, 225, 0, + 59, 65, 63, 0, 0, 0, 0, 0, 0, 126, + 0, 0, 0, 0, 0, 172, 0, 0, 0, 224, + 0, 0, 249, 251, 0, 0, 0, 234, 239, 240, + 0, 254, 117, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 56, 196, 0, 0, 0, 223, 220, 0, + 242, 116, 0, 123, 0, 0, 119, 120, 121, 122, + 0, 213, 0, 0, 0, 221, 0, 0, 0, 211, + 0, 212, 0, 0, 118, 124, 125, 0, 0, 0, + 0, 0, 0, 218, 0, 0, 217, 214, 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, 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, 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[] = { 84, + 258, 274, 275, 276, 277, 196, 197, 226, 198, 23, + 13, 35, 446, 310, 391, 410, 333, 392, 85, 86, + 199, 88, 89, 118, 208, 343, 301, 344, 107, 519, + 1, 2, 280, 253, 251, 252, 61, 177, 48, 102, + 181, 90, 357, 286, 287, 288, 36, 94, 14, 42, + 15, 59, 16, 26, 362, 302, 91, 304, 419, 17, + 38, 39, 169, 494, 96, 233, 450, 451, 170, 171, + 371, 172, 173 }; -/* 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 short int yydefact[] = -{ - 150, 0, 47, 136, 1, 135, 183, 40, 41, 42, - 43, 44, 45, 46, 0, 48, 207, 132, 133, 207, - 162, 163, 0, 0, 0, 47, 0, 138, 180, 0, - 0, 49, 50, 51, 52, 53, 54, 0, 0, 208, - 204, 39, 177, 178, 179, 203, 0, 0, 0, 0, - 148, 0, 0, 0, 0, 0, 0, 0, 38, 181, - 182, 48, 151, 134, 55, 2, 3, 68, 72, 73, - 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, - 84, 85, 0, 0, 0, 0, 198, 0, 0, 67, - 86, 71, 199, 87, 174, 175, 176, 248, 206, 0, - 0, 0, 0, 161, 149, 139, 137, 129, 130, 0, - 0, 0, 0, 184, 88, 0, 0, 70, 93, 95, - 0, 0, 100, 94, 247, 0, 228, 0, 0, 0, - 0, 48, 216, 217, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 0, 0, 0, 0, 0, 0, 0, 24, - 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 205, 48, 220, 0, 244, 156, 153, 152, 154, - 155, 157, 160, 0, 144, 146, 142, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 0, 0, - 0, 0, 140, 0, 0, 0, 92, 172, 99, 97, - 0, 0, 232, 227, 210, 209, 0, 0, 29, 33, - 28, 32, 27, 31, 26, 30, 34, 35, 0, 0, - 58, 58, 253, 0, 0, 242, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 158, 63, 63, 63, 114, 115, 4, 5, - 112, 113, 116, 111, 107, 108, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 110, 109, 63, 69, 69, 96, 171, 165, 168, 169, - 0, 0, 89, 187, 188, 189, 194, 190, 191, 192, - 193, 185, 0, 196, 201, 200, 202, 0, 211, 0, - 0, 0, 249, 0, 251, 246, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 159, 0, 145, 147, 143, 0, 0, - 0, 0, 0, 0, 102, 128, 0, 0, 106, 0, - 103, 0, 0, 0, 0, 141, 90, 91, 164, 166, - 0, 61, 98, 186, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 256, 0, 0, 234, 0, 236, 239, - 0, 0, 237, 238, 0, 0, 0, 233, 0, 254, - 0, 0, 0, 65, 63, 246, 0, 0, 0, 0, - 0, 0, 101, 104, 105, 0, 0, 0, 0, 170, - 167, 62, 56, 0, 195, 0, 0, 226, 58, 59, - 58, 223, 245, 0, 0, 0, 0, 0, 229, 230, - 231, 226, 0, 60, 66, 64, 0, 0, 0, 0, - 0, 0, 127, 0, 0, 0, 0, 0, 173, 0, - 0, 0, 225, 0, 0, 250, 252, 0, 0, 0, - 235, 240, 241, 0, 255, 118, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 57, 197, 0, 0, 0, - 224, 221, 0, 243, 117, 0, 124, 0, 0, 120, - 121, 122, 123, 0, 214, 0, 0, 0, 222, 0, - 0, 0, 212, 0, 213, 0, 0, 119, 125, 126, - 0, 0, 0, 0, 0, 0, 219, 0, 0, 218, - 215 +static const short yypact[] = {-32768, + 184, 610,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, +-32768, -46, 135, -1,-32768,-32768, -18,-32768,-32768, 15, + -72, -24, 51, -62,-32768, 19, 61, 98,-32768,-32768, +-32768,-32768,-32768,-32768, 1070, -20,-32768,-32768, 85,-32768, +-32768,-32768,-32768, 33, 56, 60, 62,-32768, 54, 61, + 1070, 90, 90, 90, 90,-32768,-32768,-32768, 135,-32768, +-32768,-32768,-32768,-32768, 58,-32768,-32768,-32768,-32768,-32768, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 173, + 174, 176, 576,-32768, 85, 66,-32768,-32768, -26,-32768, +-32768,-32768,-32768,-32768, 1245,-32768, 157, 83, 179, 162, + 166,-32768,-32768,-32768,-32768,-32768, 1111, 1111, 1111, 1152, +-32768,-32768, 75, 76,-32768,-32768, -26, -78, 80, 865, +-32768,-32768, 1111,-32768, 138, 1193, 24, 151, 135,-32768, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 1111, + 1111, 1111, 1111, 1111, 1111, 1111,-32768,-32768, 1111, 1111, + 1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111,-32768, 135, +-32768, 41,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + -10,-32768,-32768,-32768, 115, 145, 202, 147, 203, 149, + 204, 152, 206, 212, 213, 154, 217, 215, 419,-32768, + 1111, 1111, 1111,-32768, 906,-32768, 118, 116, 643,-32768, +-32768, 58,-32768, 643, 643,-32768,-32768,-32768,-32768,-32768, +-32768,-32768,-32768,-32768,-32768, 643, 1070, 120, 121,-32768, + 643, 124, 129, 208, 131, 133, 134, 140, 141, 142, + 143, 643, 643, 643, 144, 1070, 1111, 1111, 236,-32768, + 148, 148, 148,-32768,-32768,-32768,-32768,-32768,-32768,-32768, +-32768,-32768,-32768, 150, 153, 155, 156, 159, 160, 947, + 1152, 596, 237, 161, 164, 175, 177,-32768,-32768, 148, + -81, -38, -26,-32768, 85,-32768, 180, 146, 988,-32768, +-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 201, 1152, +-32768,-32768,-32768,-32768, 182,-32768, 183, 643, -2,-32768, + 6,-32768, 186, 643, 185, 1111, 1111, 1111, 1111, 1111, + 1111, 1111, 1111, 187, 188, 190, 1111, 643, 643, 191, +-32768, -23,-32768,-32768,-32768, 1152, 1152, 1152, 1152, 1152, + 1152,-32768,-32768, -9, -52,-32768, -76,-32768, 1152, 1152, + 1152, 1152,-32768,-32768,-32768,-32768,-32768, 1029, 231,-32768, +-32768, 243, -14, 247, 249, 193, 643, 294, 643, 1111, +-32768, 196, 643,-32768, 197,-32768,-32768, 199, 205,-32768, +-32768, 643, 643, 643,-32768, 200,-32768, 1111, 291, 313, +-32768, 148, 186, 288, 211, 216, 218, 219, 1152,-32768, +-32768,-32768, 220, 226, 232, 233,-32768,-32768,-32768, 269, + 234,-32768, 643, 643, 1111, 240,-32768, 240,-32768, 241, + 643, 242, 1111, 1111, 1111,-32768,-32768,-32768, 1111, 643, +-32768,-32768,-32768, 214, 1111, 1152, 1152, 1152, 1152,-32768, + 1152, 1152, 1152, 1152, 341,-32768, 327, 246, 239, 241, + 244, 305,-32768,-32768, 1111, 245, 643,-32768,-32768,-32768, + 252,-32768,-32768, 253, 250, 254, 259, 260, 262, 264, + 265, 267,-32768,-32768, 342, 14, 340,-32768,-32768, 257, +-32768,-32768, 1152,-32768, 1152, 1152,-32768,-32768,-32768,-32768, + 643,-32768, 751, 65, 366,-32768, 274, 278, 279,-32768, + 283,-32768, 751, 643,-32768,-32768,-32768, 377, 285, 325, + 643, 382, 383,-32768, 643, 643,-32768,-32768, 405, 406, +-32768 }; -/* YYDEFGOTO[NTERM-NUM]. */ -static const short int yydefgoto[] = -{ - -1, 86, 260, 276, 277, 278, 279, 198, 199, 228, - 200, 25, 15, 37, 448, 312, 393, 412, 335, 394, - 87, 88, 201, 90, 91, 120, 210, 345, 303, 346, - 109, 1, 2, 3, 282, 255, 253, 254, 63, 179, - 50, 104, 183, 92, 359, 288, 289, 290, 38, 96, - 16, 44, 17, 61, 18, 28, 364, 304, 93, 306, - 421, 19, 40, 41, 171, 496, 98, 235, 452, 453, - 172, 173, 373, 174, 175 +static const short yypgoto[] = {-32768, +-32768, 312, 314, 315, 316, -127, -126, -462,-32768, 369, + 389, -87,-32768, -225, 55,-32768, -245,-32768, -48,-32768, + -35,-32768, -66, 293,-32768, -100, 222, -253, 59,-32768, +-32768,-32768,-32768,-32768,-32768,-32768, 365,-32768,-32768,-32768, +-32768, 4,-32768, 68,-32768,-32768, 357,-32768,-32768,-32768, +-32768,-32768, 415,-32768,-32768, -453, -55, 64, -103,-32768, + 401,-32768,-32768,-32768,-32768,-32768, 49, -7,-32768,-32768, + 30,-32768,-32768 }; -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -447 -static const short int yypact[] = -{ - -447, 33, 122, 610, -447, -447, -447, -447, -447, -447, - -447, -447, -447, -447, -13, 161, 47, -447, -447, -15, - -447, -447, 15, 10, 91, -6, 48, -447, 19, 138, - 168, -447, -447, -447, -447, -447, -447, 1070, -20, -447, - -447, 70, -447, -447, -447, -447, 60, 61, 64, 67, - -447, 63, 138, 1070, 106, 106, 106, 106, -447, -447, - -447, 161, -447, -447, -447, -447, -447, 59, -447, -447, - -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, - -447, -447, 174, 178, 179, 576, -447, 70, 74, -447, - -447, -54, -447, -447, -447, -447, -447, 1245, -447, 162, - -44, 190, 171, 172, -447, -447, -447, -447, -447, 1111, - 1111, 1111, 1152, -447, -447, 78, 88, -447, -447, -54, - -29, 92, 865, -447, -447, 1111, -447, 150, 1193, 75, - 189, 161, -447, -447, -447, -447, -447, -447, -447, -447, - -447, -447, -447, -447, -447, -447, -447, -447, -447, -447, - -447, -447, 1111, 1111, 1111, 1111, 1111, 1111, 1111, -447, - -447, 1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111, 1111, - 1111, -447, 161, -447, 8, -447, -447, -447, -447, -447, - -447, -447, -447, -10, -447, -447, -447, 113, 139, 206, - 145, 211, 147, 215, 152, 216, 214, 225, 154, 218, - 226, 419, -447, 1111, 1111, 1111, -447, 906, -447, 120, - 118, 643, -447, -447, 59, -447, 643, 643, -447, -447, - -447, -447, -447, -447, -447, -447, -447, -447, 643, 1070, - 128, 129, -447, 643, 126, 131, 210, 133, 134, 140, - 141, 142, 143, 144, 643, 643, 643, 146, 1070, 1111, - 1111, 237, -447, 148, 148, 148, -447, -447, -447, -447, - -447, -447, -447, -447, -447, -447, 149, 151, 153, 155, - 156, 159, 947, 1152, 596, 239, 160, 164, 175, 177, - -447, -447, 148, -74, -23, -54, -447, 70, -447, 163, - 180, 988, -447, -447, -447, -447, -447, -447, -447, -447, - -447, 201, 1152, -447, -447, -447, -447, 182, -447, 184, - 643, -2, -447, 6, -447, 186, 643, 176, 1111, 1111, - 1111, 1111, 1111, 1111, 1111, 1111, 187, 188, 191, 1111, - 643, 643, 195, -447, -12, -447, -447, -447, 1152, 1152, - 1152, 1152, 1152, 1152, -447, -447, -9, -21, -447, -27, - -447, 1152, 1152, 1152, 1152, -447, -447, -447, -447, -447, - 1029, 232, -447, -447, 244, -16, 249, 282, 194, 643, - 300, 643, 1111, -447, 197, 643, -447, 199, -447, -447, - 202, 203, -447, -447, 643, 643, 643, -447, 208, -447, - 1111, 291, 315, -447, 148, 186, 289, 212, 217, 219, - 220, 1152, -447, -447, -447, 231, 233, 234, 240, -447, - -447, -447, 273, 241, -447, 643, 643, 1111, 242, -447, - 242, -447, 243, 643, 246, 1111, 1111, 1111, -447, -447, - -447, 1111, 643, -447, -447, -447, 223, 1111, 1152, 1152, - 1152, 1152, -447, 1152, 1152, 1152, 1152, 328, -447, 322, - 247, 245, 243, 248, 294, -447, -447, 1111, 250, 643, - -447, -447, -447, 252, -447, -447, 254, 259, 257, 262, - 263, 264, 265, 267, 270, -447, -447, 341, 14, 343, - -447, -447, 271, -447, -447, 1152, -447, 1152, 1152, -447, - -447, -447, -447, 643, -447, 751, 65, 374, -447, 279, - 280, 281, -447, 285, -447, 751, 643, -447, -447, -447, - 380, 290, 288, 643, 382, 384, -447, 643, 643, -447, - -447 -}; -/* YYPGOTO[NTERM-NUM]. */ -static const short int yypgoto[] = -{ - -447, -447, -447, 309, 310, 311, 312, -129, -128, -446, - -447, 369, 386, -89, -447, -227, 51, -447, -248, -447, - -50, -447, -37, -447, -68, 292, -447, -102, 221, -255, - 57, -447, -447, -447, -447, -447, -447, -447, 361, -447, - -447, -447, -447, 2, -447, 55, -447, -447, 355, -447, - -447, -447, -447, -447, 414, -447, -447, -405, -57, 62, - -105, -447, 399, -447, -447, -447, -447, -447, 49, -8, - -447, -447, 24, -447, -447 -}; +#define YYLAST 1357 -/* 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 -132 -static const short int yytable[] = -{ - 89, 226, 227, 106, 314, 26, 336, 337, 39, 94, - 202, 177, 178, 369, 53, 42, 89, 119, 347, 349, - 212, 371, 391, 215, 218, 219, 220, 221, 222, 223, - 224, 225, 495, 4, 355, 7, 8, 9, 10, 54, - 12, 55, 229, 26, 56, 392, 356, 365, 29, 232, - 505, 123, 236, 237, 119, 370, 238, 239, 240, 241, - 242, 243, -69, 370, 59, 247, 60, 46, 47, 48, - 39, 123, 184, 185, 186, 218, 219, 220, 221, 222, - 223, 224, 225, 248, 216, 205, 49, 401, 211, 121, - 503, 211, 20, 401, 21, 206, 217, 404, 401, 357, - 511, 403, 123, 95, 251, 401, 414, 249, 250, 43, - 252, 402, 110, 111, 112, 230, 231, 211, 233, 234, - 211, 211, -131, 51, 211, 211, 211, 211, 211, 211, - 244, 245, 246, 211, 494, 283, 284, 285, 107, 108, - 256, 257, -29, -29, 281, 332, 435, 5, -28, -28, - -27, -27, 52, 6, 305, -26, -26, 258, 259, 305, - 305, 58, 62, 7, 8, 9, 10, 11, 12, 13, - 287, 305, 64, 99, 100, -70, 305, 101, 114, 310, - 102, 103, 115, 116, 14, 504, 176, 305, 305, 305, - 122, 455, 89, 456, 180, 181, 182, 203, 330, 218, - 219, 220, 221, 222, 223, 224, 225, 204, 207, 213, - -33, 89, 331, 211, 377, -32, 379, 380, 381, -31, - -30, -36, 261, 285, 387, 30, 31, 32, 33, 34, - 35, 36, -37, 262, 291, 292, 395, 396, 397, 398, - 399, 400, 311, 313, 316, 317, 318, 319, 320, 405, - 406, 407, 408, 305, 321, 322, 323, 324, 325, 305, - 329, 333, 334, 350, 363, 338, 391, 339, 413, 340, - 415, 341, 342, 305, 305, 343, 351, 360, 307, 308, - 352, 376, 211, 378, 211, 211, 211, 382, 383, 358, - 309, 353, 211, 354, 375, 315, 366, 361, 367, 442, - 372, 384, 385, 416, 419, 386, 326, 327, 328, 390, - 417, 423, 305, 425, 305, 433, 426, 427, 305, 434, - 460, 461, 462, 287, 431, 437, 438, 305, 305, 305, - 447, 439, 475, 440, 441, 211, 467, 468, 469, 470, - 465, 471, 472, 473, 474, 443, 476, 444, 445, 226, - 227, 370, 480, 432, 446, 449, 454, 457, 305, 305, - 459, 477, 493, 478, 515, 479, 305, 226, 227, 483, - 481, 484, 368, 485, 486, 305, 487, 488, 374, 497, - 211, 489, 490, 499, 491, 500, 501, 492, 211, 211, - 211, 498, 388, 389, 211, 506, 507, 508, 509, 510, - 466, 513, 305, 517, 514, 518, 167, 168, 169, 170, - 97, 57, 411, 105, 209, 410, 113, 27, 45, 436, - 211, 422, 280, 463, 65, 66, 0, 0, 0, 0, - 0, 418, 0, 420, 0, 0, 305, 424, 0, 0, - 0, 20, 0, 21, 0, 263, 428, 429, 430, 305, - 0, 0, 0, 0, 0, 0, 305, 264, 265, 0, - 305, 305, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 450, 451, 0, - 0, 0, 0, 0, 0, 458, 0, 0, 0, 0, - 0, 0, 0, 0, 464, 0, 0, 134, 135, 136, - 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, - 147, 148, 149, 150, 151, 0, 0, 0, 0, 0, - 266, 482, 267, 268, 159, 160, 0, 269, 270, 271, - 0, 0, 0, 0, 0, 0, 0, 272, 0, 0, - 273, 0, 274, 0, 0, 275, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 502, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 512, 0, - 0, 0, 0, 0, 0, 516, 0, 0, 0, 519, - 520, 65, 66, 0, 117, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 20, 0, - 21, 65, 66, 0, 117, 187, 188, 189, 190, 191, - 192, 193, 194, 195, 196, 197, 79, 80, 20, 0, - 21, 0, 0, 0, 81, 0, 0, 0, 0, 0, - -39, 0, 20, 0, 21, 0, 0, 0, 0, 0, - 0, 6, -39, -39, 81, 0, 293, 294, 65, 66, - 295, -39, -39, -39, -39, -39, -39, -39, 0, 0, - -39, 22, 0, 0, 0, 20, 0, 21, 23, 296, - 297, 298, 24, 0, 0, 0, 0, 0, 0, 0, - 0, 299, 300, 0, 0, 0, 0, 0, 0, 0, - 0, 82, 0, 0, 83, 0, 0, 84, 0, 85, - 118, 0, 0, 0, 301, 0, 0, 0, 0, 0, - 0, 82, 0, 0, 83, 0, 0, 84, 0, 85, - 348, 134, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 150, 151, 0, - 0, 0, 0, 0, 266, 0, 267, 268, 159, 160, - 0, 269, 270, 271, 293, 294, 0, 0, 295, 0, - 0, 0, 0, 0, 302, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 296, 297, 298, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 299, - 300, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 301, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 0, 0, 0, - 0, 0, 266, 0, 267, 268, 159, 160, 0, 269, - 270, 271, 0, 0, 0, 0, 0, 0, 0, 0, - 65, 66, 302, 117, 68, 69, 70, 71, 72, 73, - 74, 75, 76, 77, 78, 79, 80, 20, 0, 21, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 208, 0, 0, 0, 0, 0, 0, 0, - 0, 65, 66, 81, 117, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 79, 80, 20, 0, - 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 286, 0, 0, 0, 0, 0, 0, - 0, 0, 65, 66, 81, 117, 187, 188, 189, 190, - 191, 192, 193, 194, 195, 196, 197, 79, 80, 20, - 0, 21, 0, 0, 0, 0, 0, 0, 0, 0, - 82, 0, 0, 83, 0, 0, 84, 0, 85, 0, - 0, 0, 0, 65, 66, 81, 117, 68, 69, 70, - 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - 20, 0, 21, 0, 0, 0, 0, 0, 0, 0, - 0, 82, 0, 0, 83, 362, 0, 84, 0, 85, - 0, 0, 0, 0, 65, 66, 81, 117, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, - 80, 20, 0, 21, 0, 0, 0, 0, 0, 0, - 0, 0, 82, 0, 0, 83, 409, 344, 84, 0, - 85, 0, 0, 0, 0, 65, 66, 81, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, - 79, 80, 20, 0, 21, 0, 0, 0, 0, 0, - 0, 0, 0, 82, 0, 0, 83, 0, 0, 84, - 0, 85, 0, 0, 0, 0, 65, 66, 81, 117, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, - 78, 79, 80, 20, 0, 21, 0, 0, 0, 0, - 0, 0, 0, 0, 82, 0, 0, 83, 0, 0, - 84, 0, 85, 0, 0, 0, 0, 65, 66, 81, - 117, 187, 188, 189, 190, 191, 192, 193, 194, 195, - 196, 197, 79, 80, 20, 0, 21, 0, 0, 0, - 0, 0, 0, 0, 0, 82, 0, 0, 83, 0, - 0, 84, 0, 85, 0, 0, 0, 0, 65, 66, - 81, 214, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 80, 20, 0, 21, 0, 0, - 0, 0, 0, 0, 0, 0, 82, 0, 0, 83, - 0, 0, 84, 0, 85, 0, 0, 0, 0, 0, - 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 82, 0, 0, - 83, 0, 0, 84, 0, 85, 0, 0, 0, 0, - 124, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 125, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 126, 127, 0, 0, 82, 0, - 0, 83, 0, 0, 84, 0, 85, 128, 129, 130, - 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, - 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, - 151, 152, 153, 154, 0, 0, 155, 156, 157, 158, - 159, 160, 161, 162, 163, 164, 165, 166 -}; -static const short int yycheck[] = -{ - 37, 130, 130, 53, 231, 3, 254, 255, 23, 29, - 112, 55, 56, 15, 20, 30, 53, 85, 273, 274, - 125, 15, 34, 128, 10, 11, 12, 13, 14, 15, - 16, 17, 478, 0, 282, 41, 42, 43, 44, 45, - 46, 47, 131, 41, 50, 57, 120, 302, 61, 154, - 496, 125, 157, 158, 122, 57, 161, 162, 163, 164, - 165, 166, 116, 57, 45, 170, 47, 52, 53, 54, - 23, 125, 109, 110, 111, 10, 11, 12, 13, 14, - 15, 16, 17, 172, 9, 114, 71, 114, 125, 87, - 495, 128, 22, 114, 24, 124, 21, 124, 114, 122, - 505, 122, 125, 123, 114, 114, 122, 99, 100, 124, - 120, 120, 55, 56, 57, 152, 153, 154, 155, 156, - 157, 158, 0, 113, 161, 162, 163, 164, 165, 166, - 167, 168, 169, 170, 120, 203, 204, 205, 32, 33, - 27, 28, 3, 4, 201, 250, 394, 25, 3, 4, - 3, 4, 61, 31, 211, 3, 4, 3, 4, 216, - 217, 113, 24, 41, 42, 43, 44, 45, 46, 47, - 207, 228, 4, 113, 113, 116, 233, 113, 4, 229, - 113, 118, 4, 4, 62, 120, 24, 244, 245, 246, - 116, 418, 229, 420, 4, 24, 24, 119, 248, 10, - 11, 12, 13, 14, 15, 16, 17, 119, 116, 59, - 4, 248, 249, 250, 319, 4, 321, 322, 323, 4, - 4, 7, 4, 291, 329, 64, 65, 66, 67, 68, - 69, 70, 7, 7, 114, 117, 338, 339, 340, 341, - 342, 343, 114, 114, 118, 114, 36, 114, 114, 351, - 352, 353, 354, 310, 114, 114, 114, 114, 114, 316, - 114, 24, 114, 24, 63, 116, 34, 116, 24, 116, - 21, 116, 116, 330, 331, 116, 116, 114, 216, 217, - 116, 318, 319, 320, 321, 322, 323, 324, 325, 287, - 228, 116, 329, 116, 118, 233, 114, 117, 114, 401, - 114, 114, 114, 21, 4, 114, 244, 245, 246, 114, - 116, 114, 369, 114, 371, 24, 114, 114, 375, 4, - 425, 426, 427, 360, 116, 36, 114, 384, 385, 386, - 57, 114, 4, 114, 114, 372, 438, 439, 440, 441, - 117, 443, 444, 445, 446, 114, 24, 114, 114, 478, - 478, 57, 457, 390, 114, 114, 114, 114, 415, 416, - 114, 114, 21, 118, 76, 117, 423, 496, 496, 117, - 120, 117, 310, 114, 117, 432, 114, 114, 316, 36, - 417, 117, 117, 485, 117, 487, 488, 117, 425, 426, - 427, 120, 330, 331, 431, 21, 117, 117, 117, 114, - 437, 21, 459, 21, 114, 21, 97, 97, 97, 97, - 41, 25, 361, 52, 122, 360, 61, 3, 19, 395, - 457, 372, 201, 431, 5, 6, -1, -1, -1, -1, - -1, 369, -1, 371, -1, -1, 493, 375, -1, -1, - -1, 22, -1, 24, -1, 26, 384, 385, 386, 506, - -1, -1, -1, -1, -1, -1, 513, 38, 39, -1, - 517, 518, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 415, 416, -1, - -1, -1, -1, -1, -1, 423, -1, -1, -1, -1, - -1, -1, -1, -1, 432, -1, -1, 78, 79, 80, - 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, - 91, 92, 93, 94, 95, -1, -1, -1, -1, -1, - 101, 459, 103, 104, 105, 106, -1, 108, 109, 110, - -1, -1, -1, -1, -1, -1, -1, 118, -1, -1, - 121, -1, 123, -1, -1, 126, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 493, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 506, -1, - -1, -1, -1, -1, -1, 513, -1, -1, -1, 517, - 518, 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, -1, - 20, -1, 22, -1, 24, -1, -1, -1, -1, -1, - -1, 31, 32, 33, 48, -1, 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, -1, -1, -1, - -1, 115, -1, -1, 118, -1, -1, 121, -1, 123, - 124, -1, -1, -1, 61, -1, -1, -1, -1, -1, - -1, 115, -1, -1, 118, -1, -1, 121, -1, 123, - 124, 78, 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, 92, 93, 94, 95, -1, - -1, -1, -1, -1, 101, -1, 103, 104, 105, 106, - -1, 108, 109, 110, 3, 4, -1, -1, 7, -1, - -1, -1, -1, -1, 121, -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, -1, 78, - 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, - 89, 90, 91, 92, 93, 94, 95, -1, -1, -1, - -1, -1, 101, -1, 103, 104, 105, 106, -1, 108, - 109, 110, -1, -1, -1, -1, -1, -1, -1, -1, - 5, 6, 121, 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, -1, -1, -1, -1, -1, - 115, -1, -1, 118, -1, -1, 121, -1, 123, -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, 115, -1, -1, 118, 37, -1, 121, -1, 123, - -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, 115, -1, -1, 118, 37, 120, 121, -1, - 123, -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, 115, -1, -1, 118, -1, -1, 121, - -1, 123, -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, 115, -1, -1, 118, -1, -1, - 121, -1, 123, -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, 115, -1, -1, 118, -1, - -1, 121, -1, 123, -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, 115, -1, -1, 118, - -1, -1, 121, -1, 123, -1, -1, -1, -1, -1, - -1, 48, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 115, -1, -1, - 118, -1, -1, 121, -1, 123, -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, -1, 115, -1, - -1, 118, -1, -1, 121, -1, 123, 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, -1, -1, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112 +static const short yytable[] = { 87, + 224, 225, 104, 312, 37, 24, 334, 335, 92, 200, + 389, 40, 367, 493, 27, 87, 117, 345, 347, 210, + 369, 37, 213, 216, 217, 218, 219, 220, 221, 222, + 223, 503, 214, 390, 353, 203, 50, 399, 354, 501, + 49, 227, 24, 121, 215, 204, 363, 402, 230, 509, + 56, 234, 235, 117, 368, 236, 237, 238, 239, 240, + 241, 399, 368, 57, 245, 58, 44, 45, 46, 401, + 51, 182, 183, 184, 216, 217, 218, 219, 220, 221, + 222, 223, 246, 355, 60, 47, 121, 209, 119, -68, + 209, 5, 6, 7, 8, 52, 10, 53, 121, 399, + 54, 62, 93, 249, 399, 41, 18, 412, 19, 250, + 400, 108, 109, 110, 228, 229, 209, 231, 232, 209, + 209, 105, 106, 209, 209, 209, 209, 209, 209, 242, + 243, 244, 209, 492, 281, 282, 283, 175, 176, 247, + 248, 254, 255, 279, 330, 97, 433, -28, -28, -27, + -27, -26, -26, 303, -25, -25, 256, 257, 303, 303, + 216, 217, 218, 219, 220, 221, 222, 223, 98, 285, + 303, 101, 99, -69, 100, 303, 112, 113, 308, 114, + 174, 120, 178, -130, 502, 179, 303, 303, 303, 180, + 453, 87, 454, 201, 202, 205, 211, 328, 28, 29, + 30, 31, 32, 33, 34, -32, -31, -30, 3, -29, + 87, 329, 209, 375, 4, 377, 378, 379, -35, -36, + 259, 260, 283, 385, 5, 6, 7, 8, 9, 10, + 11, 289, 290, 309, 311, 393, 394, 395, 396, 397, + 398, 314, 315, 316, 317, 12, 318, 319, 403, 404, + 405, 406, 303, 320, 321, 322, 323, 327, 303, 331, + 348, 332, 359, 361, 389, 336, 411, 413, 337, 414, + 338, 339, 303, 303, 340, 341, 349, 305, 306, 350, + 374, 209, 376, 209, 209, 209, 380, 381, 356, 307, + 351, 209, 352, 358, 313, 364, 365, 417, 440, 370, + 382, 383, 373, 384, 388, 324, 325, 326, 415, 421, + 423, 303, 424, 303, 431, 429, 432, 303, 425, 458, + 459, 460, 285, 435, 436, 445, 303, 303, 303, 437, + 463, 438, 439, 441, 209, 465, 466, 467, 468, 442, + 469, 470, 471, 472, 473, 443, 444, 447, 224, 225, + 474, 478, 430, 452, 455, 457, 476, 303, 303, 475, + 477, 368, 491, 483, 479, 303, 224, 225, 481, 482, + 484, 366, 485, 486, 303, 495, 496, 372, 487, 209, + 488, 489, 497, 490, 498, 499, 504, 209, 209, 209, + 505, 386, 387, 209, 506, 507, 508, 511, 512, 464, + 513, 303, 515, 516, 520, 521, 165, 95, 166, 167, + 168, 55, 207, 409, 103, 111, 25, 43, 420, 209, + 278, 461, 434, 63, 64, 408, 0, 0, 0, 0, + 416, 0, 418, 0, 0, 303, 422, 0, 0, 0, + 18, 0, 19, 0, 261, 426, 427, 428, 303, 0, + 0, 0, 0, 0, 0, 303, 262, 263, 0, 303, + 303, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 448, 449, 0, 0, + 0, 0, 0, 0, 456, 0, 0, 0, 0, 0, + 0, 0, 0, 462, 0, 0, 132, 133, 134, 135, + 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, + 146, 147, 148, 149, 0, 0, 0, 0, 0, 264, + 480, 265, 266, 157, 158, 0, 267, 268, 269, 0, + 0, 0, 0, 0, 0, 0, 270, 0, 0, 271, + 0, 272, 0, 0, 273, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 500, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 510, 0, 0, + 0, 0, 0, 0, 514, 0, 0, 0, 517, 518, + 63, 64, 0, 115, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 18, 0, 19, + 63, 64, 0, 115, 185, 186, 187, 188, 189, 190, + 191, 192, 193, 194, 195, 77, 78, 18, 0, 19, + 0, 0, 0, 79, 0, 0, 0, 0, 0, -38, + 0, 18, 0, 19, 0, 0, 0, 0, 0, 0, + 4, -38, -38, 79, 0, 291, 292, 63, 64, 293, + -38, -38, -38, -38, -38, -38, -38, 0, 0, -38, + 20, 0, 0, 0, 18, 0, 19, 21, 294, 295, + 296, 22, 0, 0, 0, 0, 0, 0, 0, 0, + 297, 298, 0, 0, 0, 0, 0, 0, 0, 0, + 80, 0, 0, 81, 0, 0, 82, 0, 83, 116, + 0, 0, 0, 299, 0, 0, 0, 0, 0, 0, + 80, 0, 0, 81, 0, 0, 82, 0, 83, 346, + 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 146, 147, 148, 149, 0, 0, + 0, 0, 0, 264, 0, 265, 266, 157, 158, 0, + 267, 268, 269, 291, 292, 0, 0, 293, 0, 0, + 0, 0, 0, 300, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 294, 295, 296, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 297, 298, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 299, 0, 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, 146, 147, 148, 149, 0, 0, 0, 0, + 0, 264, 0, 265, 266, 157, 158, 0, 267, 268, + 269, 0, 0, 0, 0, 0, 0, 0, 0, 63, + 64, 300, 115, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 18, 0, 19, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 206, 0, 0, 0, 0, 0, 0, 0, 0, + 63, 64, 79, 115, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 77, 78, 18, 0, 19, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 284, 0, 0, 0, 0, 0, 0, 0, + 0, 63, 64, 79, 115, 185, 186, 187, 188, 189, + 190, 191, 192, 193, 194, 195, 77, 78, 18, 0, + 19, 0, 0, 0, 0, 0, 0, 0, 0, 80, + 0, 0, 81, 0, 0, 82, 0, 83, 0, 0, + 0, 0, 63, 64, 79, 115, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 18, + 0, 19, 0, 0, 0, 0, 0, 0, 0, 0, + 80, 0, 0, 81, 360, 0, 82, 0, 83, 0, + 0, 0, 0, 63, 64, 79, 115, 66, 67, 68, + 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, + 18, 0, 19, 0, 0, 0, 0, 0, 0, 0, + 0, 80, 0, 0, 81, 407, 342, 82, 0, 83, + 0, 0, 0, 0, 63, 64, 79, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, + 78, 18, 0, 19, 0, 0, 0, 0, 0, 0, + 0, 0, 80, 0, 0, 81, 0, 0, 82, 0, + 83, 0, 0, 0, 0, 63, 64, 79, 115, 66, + 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, + 77, 78, 18, 0, 19, 0, 0, 0, 0, 0, + 0, 0, 0, 80, 0, 0, 81, 0, 0, 82, + 0, 83, 0, 0, 0, 0, 63, 64, 79, 115, + 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, + 195, 77, 78, 18, 0, 19, 0, 0, 0, 0, + 0, 0, 0, 0, 80, 0, 0, 81, 0, 0, + 82, 0, 83, 0, 0, 0, 0, 63, 64, 79, + 212, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 18, 0, 19, 0, 0, 0, + 0, 0, 0, 0, 0, 80, 0, 0, 81, 0, + 0, 82, 0, 83, 0, 0, 0, 0, 0, 0, + 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 80, 0, 0, 81, + 0, 0, 82, 0, 83, 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, 0, 80, 0, 0, + 81, 0, 0, 82, 0, 83, 126, 127, 128, 129, + 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, + 150, 151, 152, 0, 0, 153, 154, 155, 156, 157, + 158, 159, 160, 161, 162, 163, 164 }; -/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const unsigned char yystos[] = -{ - 0, 158, 159, 160, 0, 25, 31, 41, 42, 43, - 44, 45, 46, 47, 62, 139, 177, 179, 181, 188, - 22, 24, 51, 58, 62, 138, 170, 181, 182, 61, - 64, 65, 66, 67, 68, 69, 70, 140, 175, 23, - 189, 190, 30, 124, 178, 189, 52, 53, 54, 71, - 167, 113, 61, 20, 45, 47, 50, 139, 113, 45, - 47, 180, 24, 165, 4, 5, 6, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 48, 115, 118, 121, 123, 128, 147, 148, 149, - 150, 151, 170, 185, 29, 123, 176, 138, 193, 113, - 113, 113, 113, 118, 168, 165, 147, 32, 33, 157, - 157, 157, 157, 175, 4, 4, 4, 8, 124, 151, - 152, 170, 116, 125, 35, 49, 59, 60, 72, 73, - 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, - 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - 94, 95, 96, 97, 98, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, 112, 130, 131, 132, - 133, 191, 197, 198, 200, 201, 24, 55, 56, 166, - 4, 24, 24, 169, 149, 149, 149, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 134, 135, - 137, 149, 154, 119, 119, 114, 124, 116, 37, 152, - 153, 149, 187, 59, 8, 187, 9, 21, 10, 11, - 12, 13, 14, 15, 16, 17, 134, 135, 136, 140, - 149, 149, 187, 149, 149, 194, 187, 187, 187, 187, - 187, 187, 187, 187, 149, 149, 149, 187, 140, 99, - 100, 114, 120, 163, 164, 162, 27, 28, 3, 4, - 129, 4, 7, 26, 38, 39, 101, 103, 104, 108, - 109, 110, 118, 121, 123, 126, 130, 131, 132, 133, - 155, 185, 161, 151, 151, 151, 37, 149, 172, 173, - 174, 114, 117, 3, 4, 7, 26, 27, 28, 38, - 39, 61, 121, 155, 184, 185, 186, 186, 186, 186, - 147, 114, 142, 114, 142, 186, 118, 114, 36, 114, - 114, 114, 114, 114, 114, 114, 186, 186, 186, 114, - 147, 149, 187, 24, 114, 145, 145, 145, 116, 116, - 116, 116, 116, 116, 120, 154, 156, 156, 124, 156, - 24, 116, 116, 116, 116, 145, 120, 122, 170, 171, - 114, 117, 37, 63, 183, 156, 114, 114, 186, 15, - 57, 15, 114, 199, 186, 118, 149, 187, 149, 187, - 187, 187, 149, 149, 114, 114, 114, 187, 186, 186, - 114, 34, 57, 143, 146, 154, 154, 154, 154, 154, - 154, 114, 120, 122, 124, 154, 154, 154, 154, 37, - 172, 143, 144, 24, 122, 21, 21, 116, 186, 4, - 186, 187, 195, 114, 186, 114, 114, 114, 186, 186, - 186, 116, 149, 24, 4, 145, 199, 36, 114, 114, - 114, 114, 154, 114, 114, 114, 114, 57, 141, 114, - 186, 186, 195, 196, 114, 142, 142, 114, 186, 114, - 187, 187, 187, 196, 186, 117, 149, 154, 154, 154, - 154, 154, 154, 154, 154, 4, 24, 114, 118, 117, - 187, 120, 186, 117, 117, 114, 117, 114, 114, 117, - 117, 117, 117, 21, 120, 136, 192, 36, 120, 154, - 154, 154, 186, 184, 120, 136, 21, 117, 117, 117, - 114, 184, 186, 21, 114, 76, 186, 21, 21, 186, - 186 +static const short yycheck[] = { 35, + 128, 128, 51, 229, 23, 2, 252, 253, 29, 110, + 34, 30, 15, 476, 61, 51, 83, 271, 272, 123, + 15, 23, 126, 10, 11, 12, 13, 14, 15, 16, + 17, 494, 9, 57, 280, 114, 61, 114, 120, 493, + 113, 129, 39, 125, 21, 124, 300, 124, 152, 503, + 113, 155, 156, 120, 57, 159, 160, 161, 162, 163, + 164, 114, 57, 45, 168, 47, 52, 53, 54, 122, + 20, 107, 108, 109, 10, 11, 12, 13, 14, 15, + 16, 17, 170, 122, 24, 71, 125, 123, 85, 116, + 126, 41, 42, 43, 44, 45, 46, 47, 125, 114, + 50, 4, 123, 114, 114, 124, 22, 122, 24, 120, + 120, 53, 54, 55, 150, 151, 152, 153, 154, 155, + 156, 32, 33, 159, 160, 161, 162, 163, 164, 165, + 166, 167, 168, 120, 201, 202, 203, 55, 56, 99, + 100, 27, 28, 199, 248, 113, 392, 3, 4, 3, + 4, 3, 4, 209, 3, 4, 3, 4, 214, 215, + 10, 11, 12, 13, 14, 15, 16, 17, 113, 205, + 226, 118, 113, 116, 113, 231, 4, 4, 227, 4, + 24, 116, 4, 0, 120, 24, 242, 243, 244, 24, + 416, 227, 418, 119, 119, 116, 59, 246, 64, 65, + 66, 67, 68, 69, 70, 4, 4, 4, 25, 4, + 246, 247, 248, 317, 31, 319, 320, 321, 7, 7, + 4, 7, 289, 327, 41, 42, 43, 44, 45, 46, + 47, 114, 117, 114, 114, 336, 337, 338, 339, 340, + 341, 118, 114, 36, 114, 62, 114, 114, 349, 350, + 351, 352, 308, 114, 114, 114, 114, 114, 314, 24, + 24, 114, 117, 63, 34, 116, 24, 21, 116, 21, + 116, 116, 328, 329, 116, 116, 116, 214, 215, 116, + 316, 317, 318, 319, 320, 321, 322, 323, 285, 226, + 116, 327, 116, 114, 231, 114, 114, 4, 399, 114, + 114, 114, 118, 114, 114, 242, 243, 244, 116, 114, + 114, 367, 114, 369, 24, 116, 4, 373, 114, 423, + 424, 425, 358, 36, 114, 57, 382, 383, 384, 114, + 117, 114, 114, 114, 370, 436, 437, 438, 439, 114, + 441, 442, 443, 444, 4, 114, 114, 114, 476, 476, + 24, 455, 388, 114, 114, 114, 118, 413, 414, 114, + 117, 57, 21, 114, 120, 421, 494, 494, 117, 117, + 117, 308, 114, 114, 430, 36, 120, 314, 117, 415, + 117, 117, 483, 117, 485, 486, 21, 423, 424, 425, + 117, 328, 329, 429, 117, 117, 114, 21, 114, 435, + 76, 457, 21, 21, 0, 0, 95, 39, 95, 95, + 95, 23, 120, 359, 50, 59, 2, 17, 370, 455, + 199, 429, 393, 5, 6, 358, -1, -1, -1, -1, + 367, -1, 369, -1, -1, 491, 373, -1, -1, -1, + 22, -1, 24, -1, 26, 382, 383, 384, 504, -1, + -1, -1, -1, -1, -1, 511, 38, 39, -1, 515, + 516, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 413, 414, -1, -1, + -1, -1, -1, -1, 421, -1, -1, -1, -1, -1, + -1, -1, -1, 430, -1, -1, 78, 79, 80, 81, + 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, -1, -1, -1, -1, -1, 101, + 457, 103, 104, 105, 106, -1, 108, 109, 110, -1, + -1, -1, -1, -1, -1, -1, 118, -1, -1, 121, + -1, 123, -1, -1, 126, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 491, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 504, -1, -1, + -1, -1, -1, -1, 511, -1, -1, -1, 515, 516, + 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, -1, 20, + -1, 22, -1, 24, -1, -1, -1, -1, -1, -1, + 31, 32, 33, 48, -1, 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, -1, -1, -1, -1, + 115, -1, -1, 118, -1, -1, 121, -1, 123, 124, + -1, -1, -1, 61, -1, -1, -1, -1, -1, -1, + 115, -1, -1, 118, -1, -1, 121, -1, 123, 124, + 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, -1, -1, + -1, -1, -1, 101, -1, 103, 104, 105, 106, -1, + 108, 109, 110, 3, 4, -1, -1, 7, -1, -1, + -1, -1, -1, 121, -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, -1, 78, 79, + 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, -1, -1, -1, -1, + -1, 101, -1, 103, 104, 105, 106, -1, 108, 109, + 110, -1, -1, -1, -1, -1, -1, -1, -1, 5, + 6, 121, 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, -1, -1, -1, -1, -1, 115, + -1, -1, 118, -1, -1, 121, -1, 123, -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, + 115, -1, -1, 118, 37, -1, 121, -1, 123, -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, 115, -1, -1, 118, 37, 120, 121, -1, 123, + -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, 115, -1, -1, 118, -1, -1, 121, -1, + 123, -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, 115, -1, -1, 118, -1, -1, 121, + -1, 123, -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, 115, -1, -1, 118, -1, -1, + 121, -1, 123, -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, 115, -1, -1, 118, -1, + -1, 121, -1, 123, -1, -1, -1, -1, -1, -1, + 48, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 115, -1, -1, 118, + -1, -1, 121, -1, 123, -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, -1, 115, -1, -1, + 118, -1, -1, 121, -1, 123, 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, -1, -1, 101, 102, 103, 104, 105, + 106, 107, 108, 109, 110, 111, 112 }; +/* -*-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; @@ -2825,749 +2180,742 @@ 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 1140 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[0].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range! + switch (yyn) { + +case 2: +#line 1140 "/Users/sabre/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 1149 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[0].UInt64Val) > (uint64_t)INT64_MAX) // Outside of my range! +; + break;} +case 4: +#line 1149 "/Users/sabre/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 38: -#line 1173 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.StrVal) = (yyvsp[-1].StrVal); +; + break;} +case 37: +#line 1173 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.StrVal = yyvsp[-1].StrVal; CHECK_FOR_ERROR - ;} - break; - - case 39: -#line 1177 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.StrVal) = 0; + ; + break;} +case 38: +#line 1177 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.StrVal = 0; CHECK_FOR_ERROR - ;} - break; - - case 40: -#line 1182 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.Linkage) = GlobalValue::InternalLinkage; ;} - break; - - case 41: -#line 1183 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;} - break; - - case 42: -#line 1184 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.Linkage) = GlobalValue::WeakLinkage; ;} - break; - - case 43: -#line 1185 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;} - break; - - case 44: -#line 1186 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;} - break; - - case 45: -#line 1187 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;} - break; - - case 46: -#line 1188 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;} - break; - - case 47: -#line 1189 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;} - break; - - case 48: -#line 1191 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.UIntVal) = CallingConv::C; ;} - break; - - case 49: -#line 1192 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.UIntVal) = CallingConv::C; ;} - break; - - case 50: -#line 1193 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.UIntVal) = CallingConv::CSRet; ;} - break; - - case 51: -#line 1194 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.UIntVal) = CallingConv::Fast; ;} - break; - - case 52: -#line 1195 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.UIntVal) = CallingConv::Cold; ;} - break; - - case 53: -#line 1196 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.UIntVal) = CallingConv::X86_StdCall; ;} - break; - - case 54: -#line 1197 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.UIntVal) = CallingConv::X86_FastCall; ;} - break; - - case 55: -#line 1198 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if ((unsigned)(yyvsp[0].UInt64Val) != (yyvsp[0].UInt64Val)) + ; + break;} +case 39: +#line 1182 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.Linkage = GlobalValue::InternalLinkage; ; + break;} +case 40: +#line 1183 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.Linkage = GlobalValue::LinkOnceLinkage; ; + break;} +case 41: +#line 1184 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.Linkage = GlobalValue::WeakLinkage; ; + break;} +case 42: +#line 1185 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.Linkage = GlobalValue::AppendingLinkage; ; + break;} +case 43: +#line 1186 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.Linkage = GlobalValue::DLLImportLinkage; ; + break;} +case 44: +#line 1187 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.Linkage = GlobalValue::DLLExportLinkage; ; + break;} +case 45: +#line 1188 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.Linkage = GlobalValue::ExternalWeakLinkage; ; + break;} +case 46: +#line 1189 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.Linkage = GlobalValue::ExternalLinkage; ; + break;} +case 47: +#line 1191 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.UIntVal = CallingConv::C; ; + break;} +case 48: +#line 1192 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.UIntVal = CallingConv::C; ; + break;} +case 49: +#line 1193 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.UIntVal = CallingConv::CSRet; ; + break;} +case 50: +#line 1194 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.UIntVal = CallingConv::Fast; ; + break;} +case 51: +#line 1195 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.UIntVal = CallingConv::Cold; ; + break;} +case 52: +#line 1196 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.UIntVal = CallingConv::X86_StdCall; ; + break;} +case 53: +#line 1197 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.UIntVal = CallingConv::X86_FastCall; ; + break;} +case 54: +#line 1198 "/Users/sabre/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 56: -#line 1207 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.UIntVal) = 0; ;} - break; - - case 57: -#line 1208 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.UIntVal) = (yyvsp[0].UInt64Val); - if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) + ; + break;} +case 55: +#line 1207 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.UIntVal = 0; ; + break;} +case 56: +#line 1208 "/Users/sabre/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 58: -#line 1214 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.UIntVal) = 0; ;} - break; - - case 59: -#line 1215 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.UIntVal) = (yyvsp[0].UInt64Val); - if ((yyval.UIntVal) != 0 && !isPowerOf2_32((yyval.UIntVal))) +; + break;} +case 57: +#line 1214 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.UIntVal = 0; ; + break;} +case 58: +#line 1215 "/Users/sabre/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 60: -#line 1223 "/proj/llvm/llvm-4/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 59: +#line 1223 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + for (unsigned i = 0, e = strlen(yyvsp[0].StrVal); i != e; ++i) + if (yyvsp[0].StrVal[i] == '"' || yyvsp[0].StrVal[i] == '\\') GEN_ERROR("Invalid character in section name!"); - (yyval.StrVal) = (yyvsp[0].StrVal); + yyval.StrVal = yyvsp[0].StrVal; CHECK_FOR_ERROR -;} - break; - - case 61: -#line 1231 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.StrVal) = 0; ;} - break; - - case 62: -#line 1232 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.StrVal) = (yyvsp[0].StrVal); ;} - break; - - case 63: -#line 1237 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - {;} - break; - - case 64: -#line 1238 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - {;} - break; - - case 65: -#line 1239 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - CurGV->setSection((yyvsp[0].StrVal)); - free((yyvsp[0].StrVal)); +; + break;} +case 60: +#line 1231 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.StrVal = 0; ; + break;} +case 61: +#line 1232 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.StrVal = yyvsp[0].StrVal; ; + break;} +case 62: +#line 1237 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{; + break;} +case 63: +#line 1238 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{; + break;} +case 64: +#line 1239 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + CurGV->setSection(yyvsp[0].StrVal); + free(yyvsp[0].StrVal); CHECK_FOR_ERROR - ;} - break; - - case 66: -#line 1244 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[0].UInt64Val) != 0 && !isPowerOf2_32((yyvsp[0].UInt64Val))) + ; + break;} +case 65: +#line 1244 "/Users/sabre/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 68: -#line 1258 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;} - break; - - case 70: -#line 1259 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;} - break; - - case 71: -#line 1261 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 67: +#line 1258 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); ; + break;} +case 69: +#line 1259 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); ; + break;} +case 70: +#line 1261 "/Users/sabre/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 85: -#line 1273 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.TypeVal) = new PATypeHolder(OpaqueType::get()); + ; + break;} +case 84: +#line 1273 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.TypeVal = new PATypeHolder(OpaqueType::get()); CHECK_FOR_ERROR - ;} - break; - - case 86: -#line 1277 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); + ; + break;} +case 85: +#line 1277 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); CHECK_FOR_ERROR - ;} - break; - - case 87: -#line 1281 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Named types are also simple types... - const Type* tmp = getTypeVal((yyvsp[0].ValIDVal)); + ; + break;} +case 86: +#line 1281 "/Users/sabre/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 88: -#line 1289 "/proj/llvm/llvm-4/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 87: +#line 1289 "/Users/sabre/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 89: -#line 1297 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Function derived type? + ; + break;} +case 88: +#line 1297 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Function derived type? std::vector Params; - for (std::list::iterator I = (yyvsp[-1].TypeList)->begin(), - E = (yyvsp[-1].TypeList)->end(); I != E; ++I) + 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 90: -#line 1310 "/proj/llvm/llvm-4/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 91: -#line 1315 "/proj/llvm/llvm-4/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 89: +#line 1310 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Sized array type? + yyval.TypeVal = new PATypeHolder(HandleUpRefs(ArrayType::get(*yyvsp[-1].TypeVal, (unsigned)yyvsp[-3].UInt64Val))); + delete yyvsp[-1].TypeVal; + CHECK_FOR_ERROR + ; + break;} +case 90: +#line 1315 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Packed array type? + const llvm::Type* ElemTy = yyvsp[-1].TypeVal->get(); + if ((unsigned)yyvsp[-3].UInt64Val != yyvsp[-3].UInt64Val) 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 92: -#line 1327 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Structure type? + ; + break;} +case 91: +#line 1327 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Structure type? std::vector Elements; - for (std::list::iterator I = (yyvsp[-1].TypeList)->begin(), - E = (yyvsp[-1].TypeList)->end(); I != E; ++I) + 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); + yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); + delete yyvsp[-1].TypeList; CHECK_FOR_ERROR - ;} - break; - - case 93: -#line 1337 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Empty structure type? - (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector())); - CHECK_FOR_ERROR - ;} - break; - - case 94: -#line 1341 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Pointer type? - if (*(yyvsp[-1].TypeVal) == Type::LabelTy) + ; + break;} +case 92: +#line 1337 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Empty structure type? + yyval.TypeVal = new PATypeHolder(StructType::get(std::vector())); + CHECK_FOR_ERROR + ; + break;} +case 93: +#line 1341 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Pointer type? + if (*yyvsp[-1].TypeVal == Type::LabelTy) GEN_ERROR("Cannot form a pointer to a basic block"); - (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(PointerType::get(*(yyvsp[-1].TypeVal)))); - delete (yyvsp[-1].TypeVal); + yyval.TypeVal = new PATypeHolder(HandleUpRefs(PointerType::get(*yyvsp[-1].TypeVal))); + delete yyvsp[-1].TypeVal; CHECK_FOR_ERROR - ;} - break; - - case 95: -#line 1352 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.TypeList) = new std::list(); - (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); + ; + break;} +case 94: +#line 1352 "/Users/sabre/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 96: -#line 1357 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal); + ; + break;} +case 95: +#line 1357 "/Users/sabre/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 98: -#line 1364 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(Type::VoidTy); + ; + break;} +case 97: +#line 1364 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + (yyval.TypeList=yyvsp[-2].TypeList)->push_back(Type::VoidTy); CHECK_FOR_ERROR - ;} - break; - - case 99: -#line 1368 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - ((yyval.TypeList) = new std::list())->push_back(Type::VoidTy); + ; + break;} +case 98: +#line 1368 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + (yyval.TypeList = new std::list())->push_back(Type::VoidTy); CHECK_FOR_ERROR - ;} - break; - - case 100: -#line 1372 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.TypeList) = new std::list(); + ; + break;} +case 99: +#line 1372 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.TypeList = new std::list(); CHECK_FOR_ERROR - ;} - break; - - case 101: -#line 1383 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Nonempty unsized arr - const ArrayType *ATy = dyn_cast((yyvsp[-3].TypeVal)->get()); + ; + break;} +case 100: +#line 1383 "/Users/sabre/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 102: -#line 1409 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - const ArrayType *ATy = dyn_cast((yyvsp[-2].TypeVal)->get()); + ; + break;} +case 101: +#line 1409 "/Users/sabre/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 103: -#line 1423 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - const ArrayType *ATy = dyn_cast((yyvsp[-2].TypeVal)->get()); + ; + break;} +case 102: +#line 1423 "/Users/sabre/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(ConstantInt::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(ConstantInt::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 104: -#line 1453 "/proj/llvm/llvm-4/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 103: +#line 1453 "/Users/sabre/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 105: -#line 1479 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - const StructType *STy = dyn_cast((yyvsp[-3].TypeVal)->get()); + ; + break;} +case 104: +#line 1479 "/Users/sabre/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 106: -#line 1500 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - const StructType *STy = dyn_cast((yyvsp[-2].TypeVal)->get()); + ; + break;} +case 105: +#line 1500 "/Users/sabre/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 107: -#line 1513 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - const PointerType *PTy = dyn_cast((yyvsp[-1].TypeVal)->get()); + ; + break;} +case 106: +#line 1513 "/Users/sabre/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 108: -#line 1523 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get()); - delete (yyvsp[-1].TypeVal); + ; + break;} +case 107: +#line 1523 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ConstVal = UndefValue::get(yyvsp[-1].TypeVal->get()); + delete yyvsp[-1].TypeVal; CHECK_FOR_ERROR - ;} - break; - - case 109: -#line 1528 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - const PointerType *Ty = dyn_cast((yyvsp[-1].TypeVal)->get()); + ; + break;} +case 108: +#line 1528 "/Users/sabre/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!"); @@ -3581,7 +2929,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; @@ -3596,14 +2944,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; @@ -3618,165 +2966,154 @@ } // 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 110: -#line 1589 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[-1].TypeVal)->get() != (yyvsp[0].ConstVal)->getType()) + ; + break;} +case 109: +#line 1589 "/Users/sabre/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 111: -#line 1596 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - const Type *Ty = (yyvsp[-1].TypeVal)->get(); + ; + break;} +case 110: +#line 1596 "/Users/sabre/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 112: -#line 1605 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // integral constants - if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val))) + ; + break;} +case 111: +#line 1605 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // integral constants + if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].SInt64Val)) GEN_ERROR("Constant value doesn't fit in type!"); - (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].SInt64Val)); + yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].SInt64Val); CHECK_FOR_ERROR - ;} - break; - - case 113: -#line 1611 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // integral constants - if (!ConstantInt::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val))) + ; + break;} +case 112: +#line 1611 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // integral constants + if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].UInt64Val)) GEN_ERROR("Constant value doesn't fit in type!"); - (yyval.ConstVal) = ConstantInt::get((yyvsp[-1].PrimType), (yyvsp[0].UInt64Val)); - CHECK_FOR_ERROR - ;} - break; - - case 114: -#line 1617 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Boolean constants - (yyval.ConstVal) = ConstantBool::getTrue(); - CHECK_FOR_ERROR - ;} - break; - - case 115: -#line 1621 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Boolean constants - (yyval.ConstVal) = ConstantBool::getFalse(); + yyval.ConstVal = ConstantInt::get(yyvsp[-1].PrimType, yyvsp[0].UInt64Val); CHECK_FOR_ERROR - ;} - break; - - case 116: -#line 1625 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Float & Double constants - if (!ConstantFP::isValueValidForType((yyvsp[-1].PrimType), (yyvsp[0].FPVal))) + ; + break;} +case 113: +#line 1617 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Boolean constants + yyval.ConstVal = ConstantBool::getTrue(); + CHECK_FOR_ERROR + ; + break;} +case 114: +#line 1621 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Boolean constants + yyval.ConstVal = ConstantBool::getFalse(); + CHECK_FOR_ERROR + ; + break;} +case 115: +#line 1625 "/Users/sabre/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 117: -#line 1633 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if (!(yyvsp[-3].ConstVal)->getType()->isFirstClassType()) + ; + break;} +case 116: +#line 1633 "/Users/sabre/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 118: -#line 1644 "/proj/llvm/llvm-4/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 117: +#line 1644 "/Users/sabre/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 (ConstantInt *CUI = dyn_cast((*(yyvsp[-1].ValueList))[i])) + if (ConstantInt *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 119: -#line 1676 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[-5].ConstVal)->getType() != Type::BoolTy) + ; + break;} +case 118: +#line 1676 "/Users/sabre/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 120: -#line 1684 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) + ; + break;} +case 119: +#line 1684 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType()) GEN_ERROR("Binary operator types must match!"); // First, make sure we're dealing with the right opcode by upgrading from // obsolete versions. - sanitizeOpCode((yyvsp[-5].BinaryOpVal),(yyvsp[-3].ConstVal)->getType()); + sanitizeOpCode(yyvsp[-5].BinaryOpVal,yyvsp[-3].ConstVal->getType()); CHECK_FOR_ERROR; // 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).opcode, (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); + if (!isa(yyvsp[-3].ConstVal->getType())) { + yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal.opcode, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); } else { const Type *IntPtrTy = 0; switch (CurModule.CurrentModule->getPointerSize()) { @@ -3784,154 +3121,138 @@ case Module::Pointer64: IntPtrTy = Type::LongTy; break; default: GEN_ERROR("invalid pointer binary constant expr!"); } - (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal).opcode, 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.opcode, 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 121: -#line 1711 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) + ; + break;} +case 120: +#line 1711 "/Users/sabre/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).opcode, (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); + yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal.opcode, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); CHECK_FOR_ERROR - ;} - break; - - case 122: -#line 1722 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType()) + ; + break;} +case 121: +#line 1722 "/Users/sabre/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).opcode, (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); + yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal.opcode, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); CHECK_FOR_ERROR - ;} - break; - - case 123: -#line 1728 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[-1].ConstVal)->getType() != Type::UByteTy) + ; + break;} +case 122: +#line 1728 "/Users/sabre/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).opcode, (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal)); + yyval.ConstVal = ConstantExpr::get(yyvsp[-5].OtherOpVal.opcode, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal); CHECK_FOR_ERROR - ;} - break; - - case 124: -#line 1736 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if (!ExtractElementInst::isValidOperands((yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) + ; + break;} +case 123: +#line 1736 "/Users/sabre/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 125: -#line 1742 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if (!InsertElementInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) + ; + break;} +case 124: +#line 1742 "/Users/sabre/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 126: -#line 1748 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if (!ShuffleVectorInst::isValidOperands((yyvsp[-5].ConstVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal))) + ; + break;} +case 125: +#line 1748 "/Users/sabre/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 127: -#line 1757 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal)); + ; + break;} +case 126: +#line 1757 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(yyvsp[0].ConstVal); CHECK_FOR_ERROR - ;} - break; - - case 128: -#line 1761 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ConstVector) = new std::vector(); - (yyval.ConstVector)->push_back((yyvsp[0].ConstVal)); + ; + break;} +case 127: +#line 1761 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ConstVector = new std::vector(); + yyval.ConstVector->push_back(yyvsp[0].ConstVal); CHECK_FOR_ERROR - ;} - break; - - case 129: -#line 1769 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.BoolVal) = false; ;} - break; - - case 130: -#line 1769 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.BoolVal) = true; ;} - break; - - case 131: -#line 1779 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ModuleVal) = ParserResult = (yyvsp[0].ModuleVal); + ; + break;} +case 128: +#line 1769 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.BoolVal = false; ; + break;} +case 129: +#line 1769 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.BoolVal = true; ; + break;} +case 130: +#line 1779 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ModuleVal = ParserResult = yyvsp[0].ModuleVal; CurModule.ModuleDone(); CHECK_FOR_ERROR; -;} - break; - - case 132: -#line 1787 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); +; + break;} +case 131: +#line 1787 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ModuleVal = yyvsp[-1].ModuleVal; CurFun.FunctionDone(); CHECK_FOR_ERROR - ;} - break; - - case 133: -#line 1792 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); + ; + break;} +case 132: +#line 1792 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ModuleVal = yyvsp[-1].ModuleVal; CHECK_FOR_ERROR - ;} - break; - - case 134: -#line 1796 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ModuleVal) = (yyvsp[-3].ModuleVal); + ; + break;} +case 133: +#line 1796 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ModuleVal = yyvsp[-3].ModuleVal; CHECK_FOR_ERROR - ;} - break; - - case 135: -#line 1800 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ModuleVal) = (yyvsp[-1].ModuleVal); + ; + break;} +case 134: +#line 1800 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ModuleVal = yyvsp[-1].ModuleVal; CHECK_FOR_ERROR - ;} - break; - - case 136: -#line 1804 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ModuleVal) = CurModule.CurrentModule; + ; + break;} +case 135: +#line 1804 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ModuleVal = CurModule.CurrentModule; // Emit an error if there are any unresolved types left. if (!CurModule.LateResolveTypes.empty()) { const ValID &DID = CurModule.LateResolveTypes.begin()->first; @@ -3942,12 +3263,11 @@ } } CHECK_FOR_ERROR - ;} - break; - - case 137: -#line 1819 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 136: +#line 1819 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Eagerly resolve types. This is not an optimization, this is a // requirement that is due to the fact that we could have this: // @@ -3957,304 +3277,272 @@ // 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 138: -#line 1841 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Function prototypes can be in const pool + delete yyvsp[0].TypeVal; CHECK_FOR_ERROR - ;} - break; - - case 139: -#line 1844 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Asm blocks can be in the const pool - CHECK_FOR_ERROR - ;} - break; - - case 140: -#line 1847 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[0].ConstVal) == 0) + ; + break;} +case 137: +#line 1841 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Function prototypes can be in const pool + CHECK_FOR_ERROR + ; + break;} +case 138: +#line 1844 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Asm blocks can be in the const pool + CHECK_FOR_ERROR + ; + break;} +case 139: +#line 1847 "/Users/sabre/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 141: -#line 1852 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 140: +#line 1852 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ CurGV = 0; - ;} - break; - - case 142: -#line 1855 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); + ; + break;} +case 141: +#line 1855 "/Users/sabre/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 143: -#line 1859 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { + delete yyvsp[0].TypeVal; + ; + break;} +case 142: +#line 1859 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ CurGV = 0; CHECK_FOR_ERROR - ;} - break; - - case 144: -#line 1863 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::DLLImportLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0); + ; + break;} +case 143: +#line 1863 "/Users/sabre/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 145: -#line 1867 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { + delete yyvsp[0].TypeVal; + ; + break;} +case 144: +#line 1867 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ CurGV = 0; CHECK_FOR_ERROR - ;} - break; - - case 146: -#line 1871 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 145: +#line 1871 "/Users/sabre/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 147: -#line 1876 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { + delete yyvsp[0].TypeVal; + ; + break;} +case 146: +#line 1876 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ CurGV = 0; CHECK_FOR_ERROR - ;} - break; - - case 148: -#line 1880 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - CHECK_FOR_ERROR - ;} - break; - - case 149: -#line 1883 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 147: +#line 1880 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + CHECK_FOR_ERROR + ; + break;} +case 148: +#line 1883 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ CHECK_FOR_ERROR - ;} - break; - - case 150: -#line 1886 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - ;} - break; - - case 151: -#line 1890 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 149: +#line 1886 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + ; + break;} +case 150: +#line 1890 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); - char *EndStr = UnEscapeLexed((yyvsp[0].StrVal), true); - std::string NewAsm((yyvsp[0].StrVal), EndStr); - free((yyvsp[0].StrVal)); + 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 152: -#line 1903 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.Endianness) = Module::BigEndian; ;} - break; - - case 153: -#line 1904 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.Endianness) = Module::LittleEndian; ;} - break; - - case 154: -#line 1906 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - CurModule.CurrentModule->setEndianness((yyvsp[0].Endianness)); +; + break;} +case 151: +#line 1903 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.Endianness = Module::BigEndian; ; + break;} +case 152: +#line 1904 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.Endianness = Module::LittleEndian; ; + break;} +case 153: +#line 1906 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + CurModule.CurrentModule->setEndianness(yyvsp[0].Endianness); CHECK_FOR_ERROR - ;} - break; - - case 155: -#line 1910 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[0].UInt64Val) == 32) + ; + break;} +case 154: +#line 1910 "/Users/sabre/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 156: -#line 1919 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal)); - free((yyvsp[0].StrVal)); - ;} - break; - - case 157: -#line 1923 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal)); - free((yyvsp[0].StrVal)); - ;} - break; - - case 159: -#line 1930 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); - free((yyvsp[0].StrVal)); + ; + break;} +case 155: +#line 1919 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + CurModule.CurrentModule->setTargetTriple(yyvsp[0].StrVal); + free(yyvsp[0].StrVal); + ; + break;} +case 156: +#line 1923 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + CurModule.CurrentModule->setDataLayout(yyvsp[0].StrVal); + free(yyvsp[0].StrVal); + ; + break;} +case 158: +#line 1930 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal); + free(yyvsp[0].StrVal); CHECK_FOR_ERROR - ;} - break; - - case 160: -#line 1935 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal)); - free((yyvsp[0].StrVal)); + ; + break;} +case 159: +#line 1935 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal); + free(yyvsp[0].StrVal); CHECK_FOR_ERROR - ;} - break; - - case 161: -#line 1940 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 160: +#line 1940 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ CHECK_FOR_ERROR - ;} - break; - - case 165: -#line 1950 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.StrVal) = 0; ;} - break; - - case 166: -#line 1952 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if (*(yyvsp[-1].TypeVal) == Type::VoidTy) + ; + break;} +case 164: +#line 1950 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.StrVal = 0; ; + break;} +case 165: +#line 1952 "/Users/sabre/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 167: -#line 1959 "/proj/llvm/llvm-4/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 168: -#line 1965 "/proj/llvm/llvm-4/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 169: -#line 1972 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ArgList) = (yyvsp[0].ArgList); +; + break;} +case 166: +#line 1959 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ArgList = yyvsp[-2].ArgList; + yyvsp[-2].ArgList->push_back(*yyvsp[0].ArgVal); + delete yyvsp[0].ArgVal; + CHECK_FOR_ERROR + ; + break;} +case 167: +#line 1965 "/Users/sabre/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 168: +#line 1972 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ArgList = yyvsp[0].ArgList; CHECK_FOR_ERROR - ;} - break; - - case 170: -#line 1976 "/proj/llvm/llvm-4/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 171: -#line 1982 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ArgList) = new std::vector >(); - (yyval.ArgList)->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0)); + ; + break;} +case 170: +#line 1982 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ArgList = new std::vector >(); + yyval.ArgList->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0)); CHECK_FOR_ERROR - ;} - break; - - case 172: -#line 1987 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ArgList) = 0; + ; + break;} +case 171: +#line 1987 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ArgList = 0; CHECK_FOR_ERROR - ;} - break; - - case 173: -#line 1993 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - UnEscapeLexed((yyvsp[-5].StrVal)); - std::string FunctionName((yyvsp[-5].StrVal)); - free((yyvsp[-5].StrVal)); // Free strdup'd memory! + ; + break;} +case 172: +#line 1993 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + UnEscapeLexed(yyvsp[-5].StrVal); + std::string FunctionName(yyvsp[-5].StrVal); + free(yyvsp[-5].StrVal); // Free strdup'd memory! - if (!(*(yyvsp[-6].TypeVal))->isFirstClassType() && *(yyvsp[-6].TypeVal) != Type::VoidTy) + 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()) { @@ -4298,24 +3586,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... @@ -4323,140 +3611,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 176: -#line 2089 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.FunctionVal) = CurFun.CurrentFunction; +; + break;} +case 175: +#line 2089 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.FunctionVal = CurFun.CurrentFunction; // Make sure that we keep track of the linkage type even if there was a // previous "declare". - (yyval.FunctionVal)->setLinkage((yyvsp[-2].Linkage)); -;} - break; - - case 179: -#line 2099 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); + yyval.FunctionVal->setLinkage(yyvsp[-2].Linkage); +; + break;} +case 178: +#line 2099 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.FunctionVal = yyvsp[-1].FunctionVal; CHECK_FOR_ERROR -;} - break; - - case 181: -#line 2105 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { CurFun.Linkage = GlobalValue::DLLImportLinkage ;} - break; - - case 182: -#line 2106 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { CurFun.Linkage = GlobalValue::DLLImportLinkage ;} - break; - - case 183: -#line 2108 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { CurFun.isDeclare = true; ;} - break; - - case 184: -#line 2108 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.FunctionVal) = CurFun.CurrentFunction; +; + break;} +case 180: +#line 2105 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ CurFun.Linkage = GlobalValue::DLLImportLinkage; ; + break;} +case 181: +#line 2106 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ CurFun.Linkage = GlobalValue::DLLImportLinkage; ; + break;} +case 182: +#line 2108 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ CurFun.isDeclare = true; ; + break;} +case 183: +#line 2108 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.FunctionVal = CurFun.CurrentFunction; CurFun.FunctionDone(); CHECK_FOR_ERROR - ;} - break; - - case 185: -#line 2118 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.BoolVal) = false; - CHECK_FOR_ERROR - ;} - break; - - case 186: -#line 2122 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.BoolVal) = true; - CHECK_FOR_ERROR - ;} - break; - - case 187: -#line 2127 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // A reference to a direct constant - (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val)); - CHECK_FOR_ERROR - ;} - break; - - case 188: -#line 2131 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val)); + ; + break;} +case 184: +#line 2118 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.BoolVal = false; CHECK_FOR_ERROR - ;} - break; - - case 189: -#line 2135 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Perhaps it's an FP constant? - (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal)); + ; + break;} +case 185: +#line 2122 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.BoolVal = true; CHECK_FOR_ERROR - ;} - break; - - case 190: -#line 2139 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ValIDVal) = ValID::create(ConstantBool::getTrue()); + ; + break;} +case 186: +#line 2127 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // A reference to a direct constant + yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val); + CHECK_FOR_ERROR + ; + break;} +case 187: +#line 2131 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val); CHECK_FOR_ERROR - ;} - break; - - case 191: -#line 2143 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ValIDVal) = ValID::create(ConstantBool::getFalse()); + ; + break;} +case 188: +#line 2135 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Perhaps it's an FP constant? + yyval.ValIDVal = ValID::create(yyvsp[0].FPVal); + CHECK_FOR_ERROR + ; + break;} +case 189: +#line 2139 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ValIDVal = ValID::create(ConstantBool::getTrue()); CHECK_FOR_ERROR - ;} - break; - - case 192: -#line 2147 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ValIDVal) = ValID::createNull(); + ; + break;} +case 190: +#line 2143 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ValIDVal = ValID::create(ConstantBool::getFalse()); CHECK_FOR_ERROR - ;} - break; - - case 193: -#line 2151 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ValIDVal) = ValID::createUndef(); + ; + break;} +case 191: +#line 2147 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ValIDVal = ValID::createNull(); CHECK_FOR_ERROR - ;} - break; - - case 194: -#line 2155 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // A vector zero constant. - (yyval.ValIDVal) = ValID::createZeroInit(); + ; + break;} +case 192: +#line 2151 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ValIDVal = ValID::createUndef(); CHECK_FOR_ERROR - ;} - break; - - case 195: -#line 2159 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Nonempty unsized packed vector - const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType(); - int NumElements = (yyvsp[-1].ConstVector)->size(); + ; + break;} +case 193: +#line 2155 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // A vector zero constant. + yyval.ValIDVal = ValID::createZeroInit(); + CHECK_FOR_ERROR + ; + break;} +case 194: +#line 2159 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Nonempty unsized packed vector + const Type *ETy = (*yyvsp[-1].ConstVector)[0]->getType(); + int NumElements = yyvsp[-1].ConstVector->size(); PackedType* pt = PackedType::get(ETy, NumElements); PATypeHolder* PTy = new PATypeHolder( @@ -4468,108 +3739,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 196: -#line 2184 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal)); - CHECK_FOR_ERROR - ;} - break; - - case 197: -#line 2188 "/proj/llvm/llvm-4/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 198: -#line 2202 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Is it an integer reference...? - (yyval.ValIDVal) = ValID::create((yyvsp[0].SIntVal)); - CHECK_FOR_ERROR - ;} - break; - - case 199: -#line 2206 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Is it a named reference...? - (yyval.ValIDVal) = ValID::create((yyvsp[0].StrVal)); - CHECK_FOR_ERROR - ;} - break; - - case 202: -#line 2218 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); delete (yyvsp[-1].TypeVal); - CHECK_FOR_ERROR - ;} - break; - - case 203: -#line 2223 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); - CHECK_FOR_ERROR - ;} - break; - - case 204: -#line 2227 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Do not allow functions with 0 basic blocks - (yyval.FunctionVal) = (yyvsp[-1].FunctionVal); + ; + break;} +case 195: +#line 2184 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ValIDVal = ValID::create(yyvsp[0].ConstVal); CHECK_FOR_ERROR - ;} - break; - - case 205: -#line 2236 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal)); + ; + break;} +case 196: +#line 2188 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + char *End = UnEscapeLexed(yyvsp[-2].StrVal, true); + std::string AsmStr = std::string(yyvsp[-2].StrVal, End); + End = UnEscapeLexed(yyvsp[0].StrVal, true); + std::string Constraints = std::string(yyvsp[0].StrVal, End); + yyval.ValIDVal = ValID::createInlineAsm(AsmStr, Constraints, yyvsp[-3].BoolVal); + free(yyvsp[-2].StrVal); + free(yyvsp[0].StrVal); + CHECK_FOR_ERROR + ; + break;} +case 197: +#line 2202 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Is it an integer reference...? + yyval.ValIDVal = ValID::create(yyvsp[0].SIntVal); + CHECK_FOR_ERROR + ; + break;} +case 198: +#line 2206 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Is it a named reference...? + yyval.ValIDVal = ValID::create(yyvsp[0].StrVal); + CHECK_FOR_ERROR + ; + break;} +case 201: +#line 2218 "/Users/sabre/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 202: +#line 2223 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.FunctionVal = yyvsp[-1].FunctionVal; CHECK_FOR_ERROR - ;} - break; - - case 206: -#line 2247 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal)); - (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal); + ; + break;} +case 203: +#line 2227 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Do not allow functions with 0 basic blocks + yyval.FunctionVal = yyvsp[-1].FunctionVal; + CHECK_FOR_ERROR + ; + break;} +case 204: +#line 2236 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + setValueName(yyvsp[0].TermInstVal, yyvsp[-1].StrVal); CHECK_FOR_ERROR - ;} - break; + InsertValue(yyvsp[0].TermInstVal); - case 207: -#line 2252 "/proj/llvm/llvm-4/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 205: +#line 2247 "/Users/sabre/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 206: +#line 2252 "/Users/sabre/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 @@ -4577,15 +3838,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 208: -#line 2264 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.BasicBlockVal) = CurBB = getBBVal(ValID::create((yyvsp[0].StrVal)), true); + ; + break;} +case 207: +#line 2264 "/Users/sabre/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 @@ -4593,97 +3853,90 @@ // referenced. Function::BasicBlockListType &BBL = CurFun.CurrentFunction->getBasicBlockList(); - BBL.splice(BBL.end(), BBL, (yyval.BasicBlockVal)); - CHECK_FOR_ERROR - ;} - break; - - case 209: -#line 2277 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Return with a result... - (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal)); - CHECK_FOR_ERROR - ;} - break; - - case 210: -#line 2281 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Return with no result... - (yyval.TermInstVal) = new ReturnInst(); - CHECK_FOR_ERROR - ;} - break; - - case 211: -#line 2285 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { // Unconditional Branch... - BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal)); - CHECK_FOR_ERROR - (yyval.TermInstVal) = new BranchInst(tmpBB); - ;} - break; - - case 212: -#line 2290 "/proj/llvm/llvm-4/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 213: -#line 2299 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - Value* tmpVal = getVal((yyvsp[-7].PrimType), (yyvsp[-6].ValIDVal)); + ; + break;} +case 208: +#line 2277 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Return with a result... + yyval.TermInstVal = new ReturnInst(yyvsp[0].ValueVal); + CHECK_FOR_ERROR + ; + break;} +case 209: +#line 2281 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Return with no result... + yyval.TermInstVal = new ReturnInst(); + CHECK_FOR_ERROR + ; + break;} +case 210: +#line 2285 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Unconditional Branch... + BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal); + CHECK_FOR_ERROR + yyval.TermInstVal = new BranchInst(tmpBB); + ; + break;} +case 211: +#line 2290 "/Users/sabre/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 212: +#line 2299 "/Users/sabre/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 214: -#line 2318 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - Value* tmpVal = getVal((yyvsp[-6].PrimType), (yyvsp[-5].ValIDVal)); + ; + break;} +case 213: +#line 2318 "/Users/sabre/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 215: -#line 2328 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 214: +#line 2328 "/Users/sabre/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()); } @@ -4691,27 +3944,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) @@ -4721,269 +3974,248 @@ 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 216: -#line 2383 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.TermInstVal) = new UnwindInst(); + ; + break;} +case 215: +#line 2383 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.TermInstVal = new UnwindInst(); CHECK_FOR_ERROR - ;} - break; - - case 217: -#line 2387 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.TermInstVal) = new UnreachableInst(); + ; + break;} +case 216: +#line 2387 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.TermInstVal = new UnreachableInst(); CHECK_FOR_ERROR - ;} - break; - - case 218: -#line 2394 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.JumpTable) = (yyvsp[-5].JumpTable); - Constant *V = cast(getValNonImprovising((yyvsp[-4].PrimType), (yyvsp[-3].ValIDVal))); + ; + break;} +case 217: +#line 2394 "/Users/sabre/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 219: -#line 2405 "/proj/llvm/llvm-4/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 218: +#line 2405 "/Users/sabre/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 220: -#line 2418 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { + yyval.JumpTable->push_back(std::make_pair(V, tmpBB)); + ; + break;} +case 219: +#line 2418 "/Users/sabre/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 221: -#line 2427 "/proj/llvm/llvm-4/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 222: -#line 2436 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.PHIList) = (yyvsp[-6].PHIList); - Value* tmpVal = getVal((yyvsp[-6].PHIList)->front().first->getType(), (yyvsp[-3].ValIDVal)); +; + break;} +case 220: +#line 2427 "/Users/sabre/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 221: +#line 2436 "/Users/sabre/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 223: -#line 2446 "/proj/llvm/llvm-4/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 224: -#line 2450 "/proj/llvm/llvm-4/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 222: +#line 2446 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ // Used for call statements, and memory insts... + yyval.ValueList = new std::vector(); + yyval.ValueList->push_back(yyvsp[0].ValueVal); + ; + break;} +case 223: +#line 2450 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ValueList = yyvsp[-2].ValueList; + yyvsp[-2].ValueList->push_back(yyvsp[0].ValueVal); CHECK_FOR_ERROR - ;} - break; - - case 226: -#line 2457 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { (yyval.ValueList) = 0; ;} - break; - - case 227: -#line 2459 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.BoolVal) = true; + ; + break;} +case 225: +#line 2457 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ yyval.ValueList = 0; ; + break;} +case 226: +#line 2459 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.BoolVal = true; CHECK_FOR_ERROR - ;} - break; - - case 228: -#line 2463 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.BoolVal) = false; + ; + break;} +case 227: +#line 2463 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.BoolVal = false; CHECK_FOR_ERROR - ;} - break; - - case 229: -#line 2468 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() && - !isa((*(yyvsp[-3].TypeVal)).get())) + ; + break;} +case 228: +#line 2468 "/Users/sabre/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).opcode == Instruction::URem || - (yyvsp[-4].BinaryOpVal).opcode == Instruction::SRem || - (yyvsp[-4].BinaryOpVal).opcode == Instruction::FRem)) + if (isa((*yyvsp[-3].TypeVal).get()) && + (yyvsp[-4].BinaryOpVal.opcode == Instruction::URem || + yyvsp[-4].BinaryOpVal.opcode == Instruction::SRem || + yyvsp[-4].BinaryOpVal.opcode == Instruction::FRem)) GEN_ERROR("U/S/FRem not supported on packed types!"); // Upgrade the opcode from obsolete versions before we do anything with it. - sanitizeOpCode((yyvsp[-4].BinaryOpVal),*(yyvsp[-3].TypeVal)); + sanitizeOpCode(yyvsp[-4].BinaryOpVal,*yyvsp[-3].TypeVal); CHECK_FOR_ERROR; - 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).opcode, val1, val2); - if ((yyval.InstVal) == 0) + yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal.opcode, val1, val2); + if (yyval.InstVal == 0) GEN_ERROR("binary operator returned null!"); - delete (yyvsp[-3].TypeVal); - ;} - break; - - case 230: -#line 2490 "/proj/llvm/llvm-4/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 229: +#line 2490 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + if (!(*yyvsp[-3].TypeVal)->isIntegral()) { + if (!isa(yyvsp[-3].TypeVal->get()) || + !cast(yyvsp[-3].TypeVal->get())->getElementType()->isIntegral()) 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).opcode, tmpVal1, tmpVal2); - if ((yyval.InstVal) == 0) + yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal.opcode, tmpVal1, tmpVal2); + if (yyval.InstVal == 0) GEN_ERROR("binary operator returned null!"); - delete (yyvsp[-3].TypeVal); - ;} - break; - - case 231: -#line 2505 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if(isa((*(yyvsp[-3].TypeVal)).get())) { + delete yyvsp[-3].TypeVal; + ; + break;} +case 230: +#line 2505 "/Users/sabre/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).opcode, tmpVal1, tmpVal2); - if ((yyval.InstVal) == 0) + yyval.InstVal = new SetCondInst(yyvsp[-4].BinaryOpVal.opcode, tmpVal1, tmpVal2); + if (yyval.InstVal == 0) GEN_ERROR("binary operator returned null!"); - delete (yyvsp[-3].TypeVal); - ;} - break; - - case 232: -#line 2519 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { + delete yyvsp[-3].TypeVal; + ; + break;} +case 231: +#line 2519 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ std::cerr << "WARNING: Use of eliminated 'not' instruction:" << " Replacing with 'xor'.\n"; - Value *Ones = ConstantIntegral::getAllOnesValue((yyvsp[0].ValueVal)->getType()); + 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 233: -#line 2532 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if ((yyvsp[0].ValueVal)->getType() != Type::UByteTy) + ; + break;} +case 232: +#line 2532 "/Users/sabre/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).opcode, (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal)); + yyval.InstVal = new ShiftInst(yyvsp[-3].OtherOpVal.opcode, yyvsp[-2].ValueVal, yyvsp[0].ValueVal); CHECK_FOR_ERROR - ;} - break; - - case 234: -#line 2540 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if (!(yyvsp[0].TypeVal)->get()->isFirstClassType()) + ; + break;} +case 233: +#line 2540 "/Users/sabre/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 235: -#line 2548 "/proj/llvm/llvm-4/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 234: +#line 2548 "/Users/sabre/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 236: -#line 2556 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 235: +#line 2556 "/Users/sabre/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 237: -#line 2562 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 236: +#line 2562 "/Users/sabre/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); @@ -4994,20 +4226,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 238: -#line 2582 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 237: +#line 2582 "/Users/sabre/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); @@ -5019,78 +4250,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 239: -#line 2605 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if (!ExtractElementInst::isValidOperands((yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) + ; + break;} +case 238: +#line 2605 "/Users/sabre/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 240: -#line 2611 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if (!InsertElementInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) + ; + break;} +case 239: +#line 2611 "/Users/sabre/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 241: -#line 2617 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if (!ShuffleVectorInst::isValidOperands((yyvsp[-4].ValueVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal))) + ; + break;} +case 240: +#line 2617 "/Users/sabre/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 242: -#line 2623 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - const Type *Ty = (yyvsp[0].PHIList)->front().first->getType(); + ; + break;} +case 241: +#line 2623 "/Users/sabre/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 243: -#line 2638 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { + ; + break;} +case 242: +#line 2638 "/Users/sabre/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()); } @@ -5098,31 +4324,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) @@ -5132,442 +4358,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 244: -#line 2697 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.InstVal) = (yyvsp[0].InstVal); - CHECK_FOR_ERROR - ;} - break; - - case 245: -#line 2704 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.ValueList) = (yyvsp[0].ValueList); - CHECK_FOR_ERROR - ;} - break; - - case 246: -#line 2707 "/proj/llvm/llvm-4/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 243: +#line 2697 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.InstVal = yyvsp[0].InstVal; CHECK_FOR_ERROR - ;} - break; - - case 247: -#line 2712 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.BoolVal) = true; + ; + break;} +case 244: +#line 2704 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ValueList = yyvsp[0].ValueList; + CHECK_FOR_ERROR + ; + break;} +case 245: +#line 2707 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.ValueList = new std::vector(); + CHECK_FOR_ERROR + ; + break;} +case 246: +#line 2712 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.BoolVal = true; CHECK_FOR_ERROR - ;} - break; - - case 248: -#line 2716 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.BoolVal) = false; + ; + break;} +case 247: +#line 2716 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" +{ + yyval.BoolVal = false; CHECK_FOR_ERROR - ;} - break; - - case 249: -#line 2723 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal)); - delete (yyvsp[-1].TypeVal); + ; + break;} +case 248: +#line 2723 "/Users/sabre/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 250: -#line 2728 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); + ; + break;} +case 249: +#line 2728 "/Users/sabre/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 251: -#line 2734 "/proj/llvm/llvm-4/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 250: +#line 2734 "/Users/sabre/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 252: -#line 2739 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - Value* tmpVal = getVal((yyvsp[-2].PrimType), (yyvsp[-1].ValIDVal)); + ; + break;} +case 251: +#line 2739 "/Users/sabre/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 253: -#line 2745 "/proj/llvm/llvm-4/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 252: +#line 2745 "/Users/sabre/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 254: -#line 2753 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" - { - if (!isa((yyvsp[-1].TypeVal)->get())) + ; + break;} +case 253: +#line 2753 "/Users/sabre/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 255: -#line 2765 "/proj/llvm/llvm-4/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 254: +#line 2765 "/Users/sabre/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 256: -#line 2780 "/proj/llvm/llvm-4/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 255: +#line 2780 "/Users/sabre/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 (ConstantInt *CUI = dyn_cast((*(yyvsp[0].ValueList))[i])) + if (ConstantInt *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 5303 "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 2806 "/proj/llvm/llvm-4/lib/AsmParser/llvmAsmParser.y" +#line 2806 "/Users/sabre/cvs/llvm/lib/AsmParser/llvmAsmParser.y" void llvm::GenerateError(const std::string &message, int LineNo) { @@ -5590,4 +4751,3 @@ GenerateError(errMsg); return 0; } - Index: llvm/lib/AsmParser/llvmAsmParser.y diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.272.2.2 llvm/lib/AsmParser/llvmAsmParser.y:1.272.2.3 --- llvm/lib/AsmParser/llvmAsmParser.y:1.272.2.2 Wed Nov 8 11:44:16 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y Wed Nov 8 11:51:54 2006 @@ -1,164 +1,233 @@ -//===-- llvmAsmParser.y - Parser for llvm assembly files ---------*- C++ -*--=// +//===-- llvmAsmParser.y - Parser for llvm assembly files --------*- C++ -*-===// // -// This file implements the bison parser for LLVM assembly languages files. +// The LLVM Compiler Infrastructure // -//===------------------------------------------------------------------------=// - +// This file was developed by the LLVM research group and is distributed under +// the University of Illinois Open Source License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// // -// TODO: Parse comments and add them to an internal node... so that they may -// be saved in the bytecode format as well as everything else. Very important -// for a general IR format. +// This file implements the bison parser for LLVM assembly languages files. // +//===----------------------------------------------------------------------===// %{ #include "ParserInternals.h" -#include "llvm/Assembly/Parser.h" -#include "llvm/SymbolTable.h" +#include "llvm/CallingConv.h" +#include "llvm/InlineAsm.h" +#include "llvm/Instructions.h" #include "llvm/Module.h" -#include "llvm/GlobalVariable.h" -#include "llvm/Method.h" -#include "llvm/BasicBlock.h" -#include "llvm/DerivedTypes.h" -#include "llvm/iTerminators.h" -#include "llvm/iMemory.h" -#include "llvm/Support/STLExtras.h" -#include "llvm/Support/DepthFirstIterator.h" -#include -#include // Get definition of pair class +#include "llvm/SymbolTable.h" +#include "llvm/Assembly/AutoUpgrade.h" +#include "llvm/Support/GetElementPtrTypeIterator.h" +#include "llvm/ADT/STLExtras.h" +#include "llvm/Support/MathExtras.h" #include -#include // This embarasment is due to our flex lexer... +#include +#include +#include -int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit +// The following is a gross hack. In order to rid the libAsmParser library of +// exceptions, we have to have a way of getting the yyparse function to go into +// an error situation. So, whenever we want an error to occur, the GenerateError +// function (see bottom of file) sets TriggerError. Then, at the end of each +// production in the grammer we use CHECK_FOR_ERROR which will invoke YYERROR +// (a goto) to put YACC in error state. Furthermore, several calls to +// GenerateError are made from inside productions and they must simulate the +// previous exception behavior by exiting the production immediately. We have +// replaced these with the GEN_ERROR macro which calls GeneratError and then +// immediately invokes YYERROR. This would be so much cleaner if it was a +// recursive descent parser. +static bool TriggerError = false; +#define CHECK_FOR_ERROR { if (TriggerError) { TriggerError = false; YYABORT; } } +#define GEN_ERROR(msg) { GenerateError(msg); YYERROR; } + +int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit int yylex(); // declaration" of xxx warnings. int yyparse(); +namespace llvm { + std::string CurFilename; +} +using namespace llvm; + static Module *ParserResult; -string CurFilename; // DEBUG_UPREFS - Define this symbol if you want to enable debugging output // relating to upreferences in the input stream. // //#define DEBUG_UPREFS 1 #ifdef DEBUG_UPREFS -#define UR_OUT(X) cerr << X +#define UR_OUT(X) std::cerr << X #else #define UR_OUT(X) #endif -// This contains info used when building the body of a method. It is destroyed -// when the method is completed. +#define YYERROR_VERBOSE 1 + +static bool ObsoleteVarArgs; +static bool NewVarArgs; +static BasicBlock *CurBB; +static GlobalVariable *CurGV; + + +// This contains info used when building the body of a function. It is +// destroyed when the function is completed. // -typedef vector ValueList; // Numbered defs -static void ResolveDefinitions(vector &LateResolvers); -static void ResolveTypes (vector > &LateResolveTypes); +typedef std::vector ValueList; // Numbered defs +static void +ResolveDefinitions(std::map &LateResolvers, + std::map *FutureLateResolvers = 0); static struct PerModuleInfo { Module *CurrentModule; - vector Values; // Module level numbered definitions - vector LateResolveValues; - vector > Types, LateResolveTypes; + std::map Values; // Module level numbered definitions + std::map LateResolveValues; + std::vector Types; + std::map LateResolveTypes; + + /// PlaceHolderInfo - When temporary placeholder objects are created, remember + /// how they were referenced and on which line of the input they came from so + /// that we can resolve them later and print error messages as appropriate. + std::map > PlaceHolderInfo; + + // GlobalRefs - This maintains a mapping between 's and forward + // references to global values. Global values may be referenced before they + // are defined, and if so, the temporary object that they represent is held + // here. This is used for forward references of GlobalValues. + // + typedef std::map, GlobalValue*> GlobalRefsType; + GlobalRefsType GlobalRefs; void ModuleDone() { - // If we could not resolve some methods at method compilation time (calls to - // methods before they are defined), resolve them now... Types are resolved - // when the constant pool has been completely parsed. + // If we could not resolve some functions at function compilation time + // (calls to functions before they are defined), resolve them now... Types + // are resolved when the constant pool has been completely parsed. // ResolveDefinitions(LateResolveValues); + if (TriggerError) + return; + + // Check to make sure that all global value forward references have been + // resolved! + // + if (!GlobalRefs.empty()) { + std::string UndefinedReferences = "Unresolved global references exist:\n"; + + for (GlobalRefsType::iterator I = GlobalRefs.begin(), E =GlobalRefs.end(); + I != E; ++I) { + UndefinedReferences += " " + I->first.first->getDescription() + " " + + I->first.second.getName() + "\n"; + } + GenerateError(UndefinedReferences); + return; + } - Values.clear(); // Clear out method local definitions + // Look for intrinsic functions and CallInst that need to be upgraded + for (Module::iterator FI = CurrentModule->begin(), + FE = CurrentModule->end(); FI != FE; ) + UpgradeCallsToIntrinsic(FI++); + + Values.clear(); // Clear out function local definitions Types.clear(); CurrentModule = 0; } + + // GetForwardRefForGlobal - Check to see if there is a forward reference + // for this global. If so, remove it from the GlobalRefs map and return it. + // If not, just return null. + GlobalValue *GetForwardRefForGlobal(const PointerType *PTy, ValID ID) { + // Check to see if there is a forward reference to this global variable... + // if there is, eliminate it and patch the reference to use the new def'n. + GlobalRefsType::iterator I = GlobalRefs.find(std::make_pair(PTy, ID)); + GlobalValue *Ret = 0; + if (I != GlobalRefs.end()) { + Ret = I->second; + GlobalRefs.erase(I); + } + return Ret; + } } CurModule; -static struct PerMethodInfo { - Method *CurrentMethod; // Pointer to current method being created +static struct PerFunctionInfo { + Function *CurrentFunction; // Pointer to current function being created - vector Values; // Keep track of numbered definitions - vector LateResolveValues; - vector > Types, LateResolveTypes; - bool isDeclare; // Is this method a forward declararation? + std::map Values; // Keep track of #'d definitions + std::map LateResolveValues; + bool isDeclare; // Is this function a forward declararation? + GlobalValue::LinkageTypes Linkage; // Linkage for forward declaration. + + /// BBForwardRefs - When we see forward references to basic blocks, keep + /// track of them here. + std::map > BBForwardRefs; + std::vector NumberedBlocks; + unsigned NextBBNum; - inline PerMethodInfo() { - CurrentMethod = 0; + inline PerFunctionInfo() { + CurrentFunction = 0; isDeclare = false; + Linkage = GlobalValue::ExternalLinkage; } - inline ~PerMethodInfo() {} - - inline void MethodStart(Method *M) { - CurrentMethod = M; + inline void FunctionStart(Function *M) { + CurrentFunction = M; + NextBBNum = 0; } - void MethodDone() { - // If we could not resolve some blocks at parsing time (forward branches) - // resolve the branches now... - ResolveDefinitions(LateResolveValues); + void FunctionDone() { + NumberedBlocks.clear(); - Values.clear(); // Clear out method local definitions - Types.clear(); - CurrentMethod = 0; + // Any forward referenced blocks left? + if (!BBForwardRefs.empty()) { + GenerateError("Undefined reference to label " + + BBForwardRefs.begin()->first->getName()); + return; + } + + // Resolve all forward references now. + ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues); + + Values.clear(); // Clear out function local definitions + CurrentFunction = 0; isDeclare = false; + Linkage = GlobalValue::ExternalLinkage; } -} CurMeth; // Info for the current method... +} CurFun; // Info for the current function... + +static bool inFunctionScope() { return CurFun.CurrentFunction != 0; } //===----------------------------------------------------------------------===// // Code to handle definitions of all the types //===----------------------------------------------------------------------===// -static void InsertValue(Value *D, vector &ValueTab = CurMeth.Values){ - if (!D->hasName()) { // Is this a numbered definition? - unsigned type = D->getType()->getUniqueID(); - if (ValueTab.size() <= type) - ValueTab.resize(type+1, ValueList()); - //printf("Values[%d][%d] = %d\n", type, ValueTab[type].size(), D); - ValueTab[type].push_back(D); - } -} - -// TODO: FIXME when Type are not const -static void InsertType(const Type *Ty, vector > &Types) { - Types.push_back(Ty); +static int InsertValue(Value *V, + std::map &ValueTab = CurFun.Values) { + if (V->hasName()) return -1; // Is this a numbered definition? + + // Yes, insert the value into the value table... + ValueList &List = ValueTab[V->getType()]; + List.push_back(V); + return List.size()-1; } static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) { switch (D.Type) { - case 0: { // Is it a numbered definition? - unsigned Num = (unsigned)D.Num; - + case ValID::NumberVal: // Is it a numbered definition? // Module constants occupy the lowest numbered slots... - if (Num < CurModule.Types.size()) - return CurModule.Types[Num]; - - Num -= CurModule.Types.size(); - - // Check that the number is within bounds... - if (Num <= CurMeth.Types.size()) - return CurMeth.Types[Num]; - } - case 1: { // Is it a named definition? - string Name(D.Name); - SymbolTable *SymTab = 0; - if (CurMeth.CurrentMethod) - SymTab = CurMeth.CurrentMethod->getSymbolTable(); - Value *N = SymTab ? SymTab->lookup(Type::TypeTy, Name) : 0; - - if (N == 0) { - // Symbol table doesn't automatically chain yet... because the method - // hasn't been added to the module... - // - SymTab = CurModule.CurrentModule->getSymbolTable(); - if (SymTab) - N = SymTab->lookup(Type::TypeTy, Name); - if (N == 0) break; + if ((unsigned)D.Num < CurModule.Types.size()) + return CurModule.Types[(unsigned)D.Num]; + break; + case ValID::NameVal: // Is it a named definition? + if (const Type *N = CurModule.CurrentModule->getTypeByName(D.Name)) { + D.destroy(); // Free old strdup'd memory... + return N; } - - D.destroy(); // Free old strdup'd memory... - return N->castTypeAsserting(); - } + break; default: - ThrowException("Invalid symbol type reference!"); + 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 @@ -167,132 +236,251 @@ // if (DoNotImprovise) return 0; // Do we just want a null to be returned? - vector > *LateResolver = CurMeth.CurrentMethod ? - &CurMeth.LateResolveTypes : &CurModule.LateResolveTypes; - Type *Typ = new TypePlaceHolder(Type::TypeTy, D); - InsertType(Typ, *LateResolver); + if (inFunctionScope()) { + if (D.Type == ValID::NameVal) { + GenerateError("Reference to an undefined type: '" + D.getName() + "'"); + return 0; + } else { + GenerateError("Reference to an undefined type: #" + itostr(D.Num)); + return 0; + } + } + + std::map::iterator I =CurModule.LateResolveTypes.find(D); + if (I != CurModule.LateResolveTypes.end()) + return I->second; + + Type *Typ = OpaqueType::get(); + CurModule.LateResolveTypes.insert(std::make_pair(D, Typ)); return Typ; -} + } -static Value *getVal(const Type *Ty, const ValID &D, - bool DoNotImprovise = false) { - assert(Ty != Type::TypeTy && "Should use getTypeVal for types!"); +static Value *lookupInSymbolTable(const Type *Ty, const std::string &Name) { + SymbolTable &SymTab = + inFunctionScope() ? CurFun.CurrentFunction->getSymbolTable() : + CurModule.CurrentModule->getSymbolTable(); + return SymTab.lookup(Ty, Name); +} + +// getValNonImprovising - Look up the value specified by the provided type and +// the provided ValID. If the value exists and has already been defined, return +// it. Otherwise return null. +// +static Value *getValNonImprovising(const Type *Ty, const ValID &D) { + if (isa(Ty)) { + GenerateError("Functions are not values and " + "must be referenced as pointers"); + return 0; + } switch (D.Type) { - case 0: { // Is it a numbered definition? - unsigned type = Ty->getUniqueID(); + case ValID::NumberVal: { // Is it a numbered definition? unsigned Num = (unsigned)D.Num; // Module constants occupy the lowest numbered slots... - if (type < CurModule.Values.size()) { - if (Num < CurModule.Values[type].size()) - return CurModule.Values[type][Num]; - - Num -= CurModule.Values[type].size(); + std::map::iterator VI = CurModule.Values.find(Ty); + if (VI != CurModule.Values.end()) { + if (Num < VI->second.size()) + return VI->second[Num]; + Num -= VI->second.size(); } // Make sure that our type is within bounds - if (CurMeth.Values.size() <= type) - break; + VI = CurFun.Values.find(Ty); + if (VI == CurFun.Values.end()) return 0; // Check that the number is within bounds... - if (CurMeth.Values[type].size() <= Num) - break; - - return CurMeth.Values[type][Num]; + if (VI->second.size() <= Num) return 0; + + return VI->second[Num]; } - case 1: { // Is it a named definition? - string Name(D.Name); - SymbolTable *SymTab = 0; - if (CurMeth.CurrentMethod) - SymTab = CurMeth.CurrentMethod->getSymbolTable(); - Value *N = SymTab ? SymTab->lookup(Ty, Name) : 0; - - if (N == 0) { - // Symbol table doesn't automatically chain yet... because the method - // hasn't been added to the module... - // - SymTab = CurModule.CurrentModule->getSymbolTable(); - if (SymTab) - N = SymTab->lookup(Ty, Name); - if (N == 0) break; - } + + case ValID::NameVal: { // Is it a named definition? + Value *N = lookupInSymbolTable(Ty, std::string(D.Name)); + if (N == 0) return 0; D.destroy(); // Free old strdup'd memory... return N; } - case 2: // Is it a constant pool reference?? - case 3: // Is it an unsigned const pool reference? - case 4: // Is it a string const pool reference? - case 5:{ // Is it a floating point const pool reference? - ConstPoolVal *CPV = 0; - - // Check to make sure that "Ty" is an integral type, and that our - // value will fit into the specified type... - switch (D.Type) { - case 2: - if (Ty == Type::BoolTy) { // Special handling for boolean data - CPV = ConstPoolBool::get(D.ConstPool64 != 0); - } else { - if (!ConstPoolSInt::isValueValidForType(Ty, D.ConstPool64)) - ThrowException("Symbolic constant pool value '" + - itostr(D.ConstPool64) + "' is invalid for type '" + - Ty->getName() + "'!"); - CPV = ConstPoolSInt::get(Ty, D.ConstPool64); - } - break; - case 3: - if (!ConstPoolUInt::isValueValidForType(Ty, D.UConstPool64)) { - if (!ConstPoolSInt::isValueValidForType(Ty, D.ConstPool64)) { - ThrowException("Integral constant pool reference is invalid!"); - } else { // This is really a signed reference. Transmogrify. - CPV = ConstPoolSInt::get(Ty, D.ConstPool64); - } - } else { - CPV = ConstPoolUInt::get(Ty, D.UConstPool64); + // 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 (!ConstantInt::isValueValidForType(Ty, D.ConstPool64)) { + GenerateError("Signed integral constant '" + + itostr(D.ConstPool64) + "' is invalid for type '" + + Ty->getDescription() + "'!"); + return 0; + } + return ConstantInt::get(Ty, D.ConstPool64); + + case ValID::ConstUIntVal: // Is it an unsigned const pool reference? + if (!ConstantInt::isValueValidForType(Ty, D.UConstPool64)) { + if (!ConstantInt::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 ConstantInt::get(Ty, D.ConstPool64); } - break; - case 4: - cerr << "FIXME: TODO: String constants [sbyte] not implemented yet!\n"; - abort(); - break; - case 5: - if (!ConstPoolFP::isValueValidForType(Ty, D.ConstPoolFP)) - ThrowException("FP constant invalid for type!!"); - else - CPV = ConstPoolFP::get(Ty, D.ConstPoolFP); - break; + } else { + return ConstantInt::get(Ty, D.UConstPool64); } - assert(CPV && "How did we escape creating a constant??"); - return CPV; - } // End of case 2,3,4 + + case ValID::ConstFPVal: // Is it a floating point const pool reference? + 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)) { + GenerateError("Cannot create a a non pointer null!"); + return 0; + } + return ConstantPointerNull::get(cast(Ty)); + + case ValID::ConstUndefVal: // Is it an undef value? + return UndefValue::get(Ty); + + case ValID::ConstZeroVal: // Is it a zero value? + return Constant::getNullValue(Ty); + + case ValID::ConstantVal: // Fully resolved constant? + if (D.ConstantValue->getType() != Ty) { + 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)) { + 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. + return IA; + } default: assert(0 && "Unhandled case!"); + return 0; } // End of switch + assert(0 && "Unhandled case!"); + return 0; +} + +// getVal - This function is identical to getValNonImprovising, except that if a +// value is not already defined, it "improvises" by creating a placeholder var +// that looks and acts just like the requested variable. When the value is +// defined later, all uses of the placeholder variable are replaced with the +// real thing. +// +static Value *getVal(const Type *Ty, const ValID &ID) { + if (Ty == Type::LabelTy) { + 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)) { + 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 // forward, so just create an entry to be resolved later and get to it... // - if (DoNotImprovise) return 0; // Do we just want a null to be returned? + V = new Argument(Ty); + + // Remember where this forward reference came from. FIXME, shouldn't we try + // to recycle these things?? + CurModule.PlaceHolderInfo.insert(std::make_pair(V, std::make_pair(ID, + llvmAsmlineno))); + + if (inFunctionScope()) + InsertValue(V, CurFun.LateResolveValues); + else + InsertValue(V, CurModule.LateResolveValues); + return V; +} + +/// getBBVal - This is used for two purposes: +/// * If isDefinition is true, a new basic block with the specified ID is being +/// defined. +/// * If isDefinition is true, this is a reference to a basic block, which may +/// or may not be a forward reference. +/// +static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) { + assert(inFunctionScope() && "Can't get basic block at global scope!"); + + std::string Name; + BasicBlock *BB = 0; + switch (ID.Type) { + default: + 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); + BB = CurFun.NumberedBlocks[ID.Num]; + break; + case ValID::NameVal: // Is it a named definition? + Name = ID.Name; + if (Value *N = CurFun.CurrentFunction-> + getSymbolTable().lookup(Type::LabelTy, Name)) + BB = cast(N); + break; + } + + // See if the block has already been defined. + if (BB) { + // If this is the definition of the block, make sure the existing value was + // just a forward reference. If it was a forward reference, there will be + // an entry for it in the PlaceHolderInfo map. + if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) { + // The existing value was a definition, not a forward reference. + GenerateError("Redefinition of label " + ID.getName()); + return 0; + } - Value *d = 0; - vector *LateResolver = (CurMeth.CurrentMethod) ? - &CurMeth.LateResolveValues : &CurModule.LateResolveValues; - - switch (Ty->getPrimitiveID()) { - case Type::LabelTyID: d = new BBPlaceHolder(Ty, D); break; - case Type::MethodTyID: d = new MethPlaceHolder(Ty, D); - LateResolver = &CurModule.LateResolveValues; break; - default: d = new ValuePlaceHolder(Ty, D); break; + ID.destroy(); // Free strdup'd memory. + return BB; } - assert(d != 0 && "How did we not make something?"); - InsertValue(d, *LateResolver); - return d; + // Otherwise this block has not been seen before. + BB = new BasicBlock("", CurFun.CurrentFunction); + if (ID.Type == ValID::NameVal) { + BB->setName(ID.Name); + } else { + CurFun.NumberedBlocks[ID.Num] = BB; + } + + // If this is not a definition, keep track of it so we can use it as a forward + // reference. + if (!isDefinition) { + // Remember where this forward reference came from. + CurFun.BBForwardRefs[BB] = std::make_pair(ID, llvmAsmlineno); + } else { + // The forward declaration could have been inserted anywhere in the + // function: insert it into the correct place now. + CurFun.CurrentFunction->getBasicBlockList().remove(BB); + CurFun.CurrentFunction->getBasicBlockList().push_back(BB); + } + ID.destroy(); + return BB; } @@ -304,219 +492,550 @@ // values not defined yet... for example, a forward branch, or the PHI node for // a loop body. // -// This keeps a table (CurMeth.LateResolveValues) of all such forward references +// This keeps a table (CurFun.LateResolveValues) of all such forward references // and back patchs after we are done. // -// ResolveDefinitions - If we could not resolve some defs at parsing -// time (forward branches, phi functions for loops, etc...) resolve the +// ResolveDefinitions - If we could not resolve some defs at parsing +// time (forward branches, phi functions for loops, etc...) resolve the // defs now... // -static void ResolveDefinitions(vector &LateResolvers) { +static void +ResolveDefinitions(std::map &LateResolvers, + std::map *FutureLateResolvers) { // Loop over LateResolveDefs fixing up stuff that couldn't be resolved - for (unsigned ty = 0; ty < LateResolvers.size(); ty++) { - while (!LateResolvers[ty].empty()) { - Value *V = LateResolvers[ty].back(); - LateResolvers[ty].pop_back(); - ValID &DID = getValIDFromPlaceHolder(V); - - Value *TheRealValue = getVal(Type::getUniqueIDType(ty), DID, true); - - if (TheRealValue == 0) { - if (DID.Type == 1) - ThrowException("Reference to an invalid definition: '" +DID.getName()+ - "' of type '" + V->getType()->getDescription() + "'", - getLineNumFromPlaceHolder(V)); - else - ThrowException("Reference to an invalid definition: #" + - itostr(DID.Num) + " of type '" + - V->getType()->getDescription() + "'", - getLineNumFromPlaceHolder(V)); + for (std::map::iterator LRI = LateResolvers.begin(), + E = LateResolvers.end(); LRI != E; ++LRI) { + ValueList &List = LRI->second; + while (!List.empty()) { + Value *V = List.back(); + List.pop_back(); + + std::map >::iterator PHI = + CurModule.PlaceHolderInfo.find(V); + assert(PHI != CurModule.PlaceHolderInfo.end() && "Placeholder error!"); + + ValID &DID = PHI->second.first; + + Value *TheRealValue = getValNonImprovising(LRI->first, DID); + if (TriggerError) + return; + if (TheRealValue) { + V->replaceAllUsesWith(TheRealValue); + delete V; + CurModule.PlaceHolderInfo.erase(PHI); + } else if (FutureLateResolvers) { + // Functions have their unresolved items forwarded to the module late + // resolver table + InsertValue(V, *FutureLateResolvers); + } else { + if (DID.Type == ValID::NameVal) { + GenerateError("Reference to an invalid definition: '" +DID.getName()+ + "' of type '" + V->getType()->getDescription() + "'", + PHI->second.second); + return; + } else { + GenerateError("Reference to an invalid definition: #" + + itostr(DID.Num) + " of type '" + + V->getType()->getDescription() + "'", + PHI->second.second); + return; + } } - - assert(!V->isType() && "Types should be in LateResolveTypes!"); - - V->replaceAllUsesWith(TheRealValue); - delete V; } } LateResolvers.clear(); } +// ResolveTypeTo - A brand new type was just declared. This means that (if +// name is not null) things referencing Name can be resolved. Otherwise, things +// refering to the number can be resolved. Do this now. +// +static void ResolveTypeTo(char *Name, const Type *ToTy) { + ValID D; + if (Name) D = ValID::create(Name); + else D = ValID::create((int)CurModule.Types.size()); + + std::map::iterator I = + CurModule.LateResolveTypes.find(D); + if (I != CurModule.LateResolveTypes.end()) { + ((DerivedType*)I->second.get())->refineAbstractTypeTo(ToTy); + CurModule.LateResolveTypes.erase(I); + } +} -// ResolveTypes - This goes through the forward referenced type table and makes -// sure that all type references are complete. This code is executed after the -// constant pool of a method or module is completely parsed. -// -static void ResolveTypes(vector > &LateResolveTypes) { - while (!LateResolveTypes.empty()) { - const Type *Ty = LateResolveTypes.back(); - ValID &DID = getValIDFromPlaceHolder(Ty); - - const Type *TheRealType = getTypeVal(DID, true); - if (TheRealType == 0) { - if (DID.Type == 1) - ThrowException("Reference to an invalid type: '" +DID.getName(), - getLineNumFromPlaceHolder(Ty)); - else - ThrowException("Reference to an invalid type: #" + itostr(DID.Num), - getLineNumFromPlaceHolder(Ty)); +// setValueName - Set the specified value to the name given. The name may be +// null potentially, in which case this is a noop. The string passed in is +// assumed to be a malloc'd string buffer, and is free'd by this function. +// +static void setValueName(Value *V, char *NameStr) { + if (NameStr) { + std::string Name(NameStr); // Copy string + free(NameStr); // Free old string + + if (V->getType() == Type::VoidTy) { + GenerateError("Can't assign name '" + Name+"' to value with void type!"); + return; } - // FIXME: When types are not const - DerivedType *DTy = const_cast(Ty->castDerivedTypeAsserting()); - - // Refine the opaque type we had to the new type we are getting. - DTy->refineAbstractTypeTo(TheRealType); + assert(inFunctionScope() && "Must be in function scope!"); + SymbolTable &ST = CurFun.CurrentFunction->getSymbolTable(); + if (ST.lookup(V->getType(), Name)) { + GenerateError("Redefinition of value named '" + Name + "' in the '" + + V->getType()->getDescription() + "' type plane!"); + return; + } - // No need to delete type, refine does that for us. - LateResolveTypes.pop_back(); + // Set the name. + V->setName(Name); } } -// setValueName - Set the specified value to the name given. The name may be +/// ParseGlobalVariable - Handle parsing of a global. If Initializer is null, +/// this is a declaration, otherwise it is a definition. +static GlobalVariable * +ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage, + bool isConstantGlobal, const Type *Ty, + Constant *Initializer) { + if (isa(Ty)) { + GenerateError("Cannot declare global vars of function type!"); + return 0; + } + + const PointerType *PTy = PointerType::get(Ty); + + std::string Name; + if (NameStr) { + Name = NameStr; // Copy string + free(NameStr); // Free old string + } + + // See if this global value was forward referenced. If so, recycle the + // object. + ValID ID; + if (!Name.empty()) { + ID = ValID::create((char*)Name.c_str()); + } else { + ID = ValID::create((int)CurModule.Values[PTy].size()); + } + + if (GlobalValue *FWGV = CurModule.GetForwardRefForGlobal(PTy, ID)) { + // Move the global to the end of the list, from whereever it was + // previously inserted. + GlobalVariable *GV = cast(FWGV); + CurModule.CurrentModule->getGlobalList().remove(GV); + CurModule.CurrentModule->getGlobalList().push_back(GV); + GV->setInitializer(Initializer); + GV->setLinkage(Linkage); + GV->setConstant(isConstantGlobal); + InsertValue(GV, CurModule.Values); + return GV; + } + + // If this global has a name, check to see if there is already a definition + // of this global in the module. If so, merge as appropriate. Note that + // this is really just a hack around problems in the CFE. :( + if (!Name.empty()) { + // We are a simple redefinition of a value, check to see if it is defined + // the same as the old one. + if (GlobalVariable *EGV = + CurModule.CurrentModule->getGlobalVariable(Name, Ty)) { + // We are allowed to redefine a global variable in two circumstances: + // 1. If at least one of the globals is uninitialized or + // 2. If both initializers have the same value. + // + if (!EGV->hasInitializer() || !Initializer || + EGV->getInitializer() == Initializer) { + + // Make sure the existing global version gets the initializer! Make + // sure that it also gets marked const if the new version is. + if (Initializer && !EGV->hasInitializer()) + EGV->setInitializer(Initializer); + if (isConstantGlobal) + EGV->setConstant(true); + EGV->setLinkage(Linkage); + return EGV; + } + + GenerateError("Redefinition of global variable named '" + Name + + "' in the '" + Ty->getDescription() + "' type plane!"); + return 0; + } + } + + // Otherwise there is no existing GV to use, create one now. + GlobalVariable *GV = + new GlobalVariable(Ty, isConstantGlobal, Linkage, Initializer, Name, + CurModule.CurrentModule); + InsertValue(GV, CurModule.Values); + return GV; +} + +// setTypeName - Set the specified type to the name given. The name may be // null potentially, in which case this is a noop. The string passed in is // assumed to be a malloc'd string buffer, and is freed by this function. // -static void setValueName(Value *V, char *NameStr) { - if (NameStr == 0) return; - string Name(NameStr); // Copy string +// This function returns true if the type has already been defined, but is +// allowed to be redefined in the specified context. If the name is a new name +// for the type plane, it is inserted and false is returned. +static bool setTypeName(const Type *T, char *NameStr) { + assert(!inFunctionScope() && "Can't give types function-local names!"); + if (NameStr == 0) return false; + + std::string Name(NameStr); // Copy string free(NameStr); // Free old string - SymbolTable *ST = CurMeth.CurrentMethod ? - CurMeth.CurrentMethod->getSymbolTableSure() : - CurModule.CurrentModule->getSymbolTableSure(); + // We don't allow assigning names to void type + 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); + + if (AlreadyExists) { // Inserting a name that is already defined??? + const Type *Existing = CurModule.CurrentModule->getTypeByName(Name); + assert(Existing && "Conflict but no matching type?"); - Value *Existing = ST->lookup(V->getType(), Name); - if (Existing) { // Inserting a name that is already defined??? // There is only one case where this is allowed: when we are refining an // opaque type. In this case, Existing will be an opaque type. - if (const Type *Ty = Existing->castType()) - if (Ty->isOpaqueType()) { - // We ARE replacing an opaque type! - - // TODO: FIXME when types are not const! - const_cast(Ty->castDerivedTypeAsserting())->refineAbstractTypeTo(V->castTypeAsserting()); - return; - } + if (const OpaqueType *OpTy = dyn_cast(Existing)) { + // We ARE replacing an opaque type! + const_cast(OpTy)->refineAbstractTypeTo(T); + return true; + } - // Otherwise, we are a simple redefinition of a value, baaad - ThrowException("Redefinition of value name '" + Name + "' in the '" + - V->getType()->getDescription() + "' type plane!"); + // Otherwise, this is an attempt to redefine a type. That's okay if + // the redefinition is identical to the original. This will be so if + // Existing and T point to the same Type object. In this one case we + // allow the equivalent redefinition. + if (Existing == T) return true; // Yes, it's equal. + + // Any other kind of (non-equivalent) redefinition is an error. + GenerateError("Redefinition of type named '" + Name + "' in the '" + + T->getDescription() + "' type plane!"); } - V->setName(Name, ST); + return false; } - //===----------------------------------------------------------------------===// // Code for handling upreferences in type names... // -// TypeContains - Returns true if Ty contains E in it. +// TypeContains - Returns true if Ty directly contains E in it. // static bool TypeContains(const Type *Ty, const Type *E) { - return find(df_begin(Ty), df_end(Ty), E) != df_end(Ty); + return std::find(Ty->subtype_begin(), Ty->subtype_end(), + E) != Ty->subtype_end(); } - -static vector > UpRefs; - -static PATypeHolder HandleUpRefs(const Type *ty) { - PATypeHolder Ty(ty); - UR_OUT(UpRefs.size() << " upreferences active!\n"); - for (unsigned i = 0; i < UpRefs.size(); ) { - UR_OUT("TypeContains(" << Ty->getDescription() << ", " - << UpRefs[i].second->getDescription() << ") = " - << TypeContains(Ty, UpRefs[i].second) << endl); - if (TypeContains(Ty, UpRefs[i].second)) { - unsigned Level = --UpRefs[i].first; // Decrement level of upreference - UR_OUT("Uplevel Ref Level = " << Level << endl); - if (Level == 0) { // Upreference should be resolved! - UR_OUT("About to resolve upreference!\n"; - string OldName = UpRefs[i].second->getDescription()); - UpRefs[i].second->refineAbstractTypeTo(Ty); - UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list... - UR_OUT("Type '" << OldName << "' refined upreference to: " - << (const void*)Ty << ", " << Ty->getDescription() << endl); - continue; +namespace { + struct UpRefRecord { + // NestingLevel - The number of nesting levels that need to be popped before + // this type is resolved. + unsigned NestingLevel; + + // LastContainedTy - This is the type at the current binding level for the + // type. Every time we reduce the nesting level, this gets updated. + const Type *LastContainedTy; + + // UpRefTy - This is the actual opaque type that the upreference is + // represented with. + OpaqueType *UpRefTy; + + UpRefRecord(unsigned NL, OpaqueType *URTy) + : NestingLevel(NL), LastContainedTy(URTy), UpRefTy(URTy) {} + }; +} + +// UpRefs - A list of the outstanding upreferences that need to be resolved. +static std::vector UpRefs; + +/// HandleUpRefs - Every time we finish a new layer of types, this function is +/// called. It loops through the UpRefs vector, which is a list of the +/// currently active types. For each type, if the up reference is contained in +/// the newly completed type, we decrement the level count. When the level +/// count reaches zero, the upreferenced type is the type that is passed in: +/// thus we can complete the cycle. +/// +static PATypeHolder HandleUpRefs(const Type *ty) { + // If Ty isn't abstract, or if there are no up-references in it, then there is + // nothing to resolve here. + if (!ty->isAbstract() || UpRefs.empty()) return ty; + + PATypeHolder Ty(ty); + UR_OUT("Type '" << Ty->getDescription() << + "' newly formed. Resolving upreferences.\n" << + UpRefs.size() << " upreferences active!\n"); + + // If we find any resolvable upreferences (i.e., those whose NestingLevel goes + // to zero), we resolve them all together before we resolve them to Ty. At + // the end of the loop, if there is anything to resolve to Ty, it will be in + // this variable. + OpaqueType *TypeToResolve = 0; + + for (unsigned i = 0; i != UpRefs.size(); ++i) { + UR_OUT(" UR#" << i << " - TypeContains(" << Ty->getDescription() << ", " + << UpRefs[i].second->getDescription() << ") = " + << (TypeContains(Ty, UpRefs[i].second) ? "true" : "false") << "\n"); + if (TypeContains(Ty, UpRefs[i].LastContainedTy)) { + // Decrement level of upreference + unsigned Level = --UpRefs[i].NestingLevel; + UpRefs[i].LastContainedTy = Ty; + UR_OUT(" Uplevel Ref Level = " << Level << "\n"); + if (Level == 0) { // Upreference should be resolved! + if (!TypeToResolve) { + TypeToResolve = UpRefs[i].UpRefTy; + } else { + UR_OUT(" * Resolving upreference for " + << UpRefs[i].second->getDescription() << "\n"; + std::string OldName = UpRefs[i].UpRefTy->getDescription()); + UpRefs[i].UpRefTy->refineAbstractTypeTo(TypeToResolve); + UR_OUT(" * Type '" << OldName << "' refined upreference to: " + << (const void*)Ty << ", " << Ty->getDescription() << "\n"); + } + UpRefs.erase(UpRefs.begin()+i); // Remove from upreference list... + --i; // Do not skip the next element... } } + } - ++i; // Otherwise, no resolve, move on... + if (TypeToResolve) { + UR_OUT(" * Resolving upreference for " + << UpRefs[i].second->getDescription() << "\n"; + std::string OldName = TypeToResolve->getDescription()); + TypeToResolve->refineAbstractTypeTo(Ty); } - // FIXME: TODO: this should return the updated type + return Ty; } -template -inline static void TypeDone(PATypeHolder *Ty) { - if (UpRefs.size()) - ThrowException("Invalid upreference in type: " + (*Ty)->getDescription()); +/// This function is used to obtain the correct opcode for an instruction when +/// an obsolete opcode is encountered. The OI parameter (OpcodeInfo) has both +/// an opcode and an "obsolete" flag. These are generated by the lexer and +/// the "obsolete" member will be true when the lexer encounters the token for +/// an obsolete opcode. For example, "div" was replaced by [usf]div but we need +/// to maintain backwards compatibility for asm files that still have the "div" +/// instruction. This function handles converting div -> [usf]div appropriately. +/// @brief Convert obsolete opcodes to new values +static void +sanitizeOpCode(OpcodeInfo &OI, const PATypeHolder& PATy) +{ + // If its not obsolete, don't do anything + if (!OI.obsolete) + return; + + // If its a packed type we want to use the element type + const Type* Ty = PATy; + if (const PackedType* PTy = dyn_cast(Ty)) + Ty = PTy->getElementType(); + + // Depending on the opcode .. + switch (OI.opcode) { + default: + GenerateError("Invalid obsolete opCode (check Lexer.l)"); + break; + case Instruction::UDiv: + // Handle cases where the opcode needs to change + if (Ty->isFloatingPoint()) + OI.opcode = Instruction::FDiv; + else if (Ty->isSigned()) + OI.opcode = Instruction::SDiv; + break; + case Instruction::URem: + if (Ty->isFloatingPoint()) + OI.opcode = Instruction::FRem; + else if (Ty->isSigned()) + OI.opcode = Instruction::SRem; + break; + } + // Its not obsolete any more, we fixed it. + OI.obsolete = false; } + +// common code from the two 'RunVMAsmParser' functions +static Module* RunParser(Module * M) { -// newTH - Allocate a new type holder for the specified type -template -inline static PATypeHolder *newTH(const TypeTy *Ty) { - return new PATypeHolder(Ty); -} -template -inline static PATypeHolder *newTH(const PATypeHolder &TH) { - return new PATypeHolder(TH); -} + llvmAsmlineno = 1; // Reset the current line number... + ObsoleteVarArgs = false; + NewVarArgs = false; + CurModule.CurrentModule = M; + + // Check to make sure the parser succeeded + if (yyparse()) { + if (ParserResult) + delete ParserResult; + return 0; + } + + // Check to make sure that parsing produced a result + if (!ParserResult) + return 0; + // Reset ParserResult variable while saving its value for the result. + Module *Result = ParserResult; + ParserResult = 0; -// newTHC - Allocate a new type holder for the specified type that can be -// casted to a new Type type. -template -inline static PATypeHolder *newTHC(const PATypeHolder &Old) { - return new PATypeHolder((const TypeTy*)Old.get()); -} + //Not all functions use vaarg, so make a second check for ObsoleteVarArgs + { + Function* F; + if ((F = Result->getNamedFunction("llvm.va_start")) + && F->getFunctionType()->getNumParams() == 0) + ObsoleteVarArgs = true; + if((F = Result->getNamedFunction("llvm.va_copy")) + && F->getFunctionType()->getNumParams() == 1) + ObsoleteVarArgs = true; + } + + if (ObsoleteVarArgs && NewVarArgs) { + 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) { + GenerateError("Obsolete va_start takes 0 argument!"); + return 0; + } + + //foo = va_start() + // -> + //bar = alloca typeof(foo) + //va_start(bar) + //foo = load bar + + const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID); + const Type* ArgTy = F->getFunctionType()->getReturnType(); + const Type* ArgTyPtr = PointerType::get(ArgTy); + Function* NF = Result->getOrInsertFunction("llvm.va_start", + RetTy, ArgTyPtr, (Type *)0); + + while (!F->use_empty()) { + CallInst* CI = cast(F->use_back()); + AllocaInst* bar = new AllocaInst(ArgTy, 0, "vastart.fix.1", CI); + new CallInst(NF, bar, "", CI); + Value* foo = new LoadInst(bar, "vastart.fix.2", CI); + CI->replaceAllUsesWith(foo); + CI->getParent()->getInstList().erase(CI); + } + Result->getFunctionList().erase(F); + } + + if(Function* F = Result->getNamedFunction("llvm.va_end")) { + if(F->arg_size() != 1) { + GenerateError("Obsolete va_end takes 1 argument!"); + return 0; + } + + //vaend foo + // -> + //bar = alloca 1 of typeof(foo) + //vaend bar + const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID); + const Type* ArgTy = F->getFunctionType()->getParamType(0); + const Type* ArgTyPtr = PointerType::get(ArgTy); + Function* NF = Result->getOrInsertFunction("llvm.va_end", + RetTy, ArgTyPtr, (Type *)0); + + while (!F->use_empty()) { + CallInst* CI = cast(F->use_back()); + AllocaInst* bar = new AllocaInst(ArgTy, 0, "vaend.fix.1", CI); + new StoreInst(CI->getOperand(1), bar, CI); + new CallInst(NF, bar, "", CI); + CI->getParent()->getInstList().erase(CI); + } + Result->getFunctionList().erase(F); + } + + if(Function* F = Result->getNamedFunction("llvm.va_copy")) { + if(F->arg_size() != 1) { + GenerateError("Obsolete va_copy takes 1 argument!"); + return 0; + } + //foo = vacopy(bar) + // -> + //a = alloca 1 of typeof(foo) + //b = alloca 1 of typeof(foo) + //store bar -> b + //vacopy(a, b) + //foo = load a + + const Type* RetTy = Type::getPrimitiveType(Type::VoidTyID); + const Type* ArgTy = F->getFunctionType()->getReturnType(); + const Type* ArgTyPtr = PointerType::get(ArgTy); + Function* NF = Result->getOrInsertFunction("llvm.va_copy", + RetTy, ArgTyPtr, ArgTyPtr, + (Type *)0); + + while (!F->use_empty()) { + CallInst* CI = cast(F->use_back()); + AllocaInst* a = new AllocaInst(ArgTy, 0, "vacopy.fix.1", CI); + AllocaInst* b = new AllocaInst(ArgTy, 0, "vacopy.fix.2", CI); + new StoreInst(CI->getOperand(1), b, CI); + new CallInst(NF, a, b, "", CI); + Value* foo = new LoadInst(a, "vacopy.fix.3", CI); + CI->replaceAllUsesWith(foo); + CI->getParent()->getInstList().erase(CI); + } + Result->getFunctionList().erase(F); + } + } + return Result; +} //===----------------------------------------------------------------------===// // RunVMAsmParser - Define an interface to this parser //===----------------------------------------------------------------------===// // -Module *RunVMAsmParser(const string &Filename, FILE *F) { - llvmAsmin = F; +Module *llvm::RunVMAsmParser(const std::string &Filename, FILE *F) { + set_scan_file(F); + CurFilename = Filename; - llvmAsmlineno = 1; // Reset the current line number... + return RunParser(new Module(CurFilename)); +} - CurModule.CurrentModule = new Module(); // Allocate a new module to read - yyparse(); // Parse the file. - Module *Result = ParserResult; - llvmAsmin = stdin; // F is about to go away, don't use it anymore... - ParserResult = 0; +Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) { + set_scan_string(AsmString); - return Result; + CurFilename = "from_memory"; + if (M == NULL) { + return RunParser(new Module (CurFilename)); + } else { + return RunParser(M); + } } %} %union { - Module *ModuleVal; - Method *MethodVal; - MethodArgument *MethArgVal; - BasicBlock *BasicBlockVal; - TerminatorInst *TermInstVal; - Instruction *InstVal; - ConstPoolVal *ConstVal; - - const Type *PrimType; - PATypeHolder *TypeVal; - PATypeHolder *ArrayTypeTy; - PATypeHolder *StructTypeTy; - Value *ValueVal; - - list *MethodArgList; - list *ValueList; - list > *TypeList; - list > *PHIList; // Represent the RHS of PHI node - list > *JumpTable; - vector *ConstVector; + llvm::Module *ModuleVal; + llvm::Function *FunctionVal; + std::pair *ArgVal; + llvm::BasicBlock *BasicBlockVal; + llvm::TerminatorInst *TermInstVal; + llvm::Instruction *InstVal; + llvm::Constant *ConstVal; + + const llvm::Type *PrimType; + llvm::PATypeHolder *TypeVal; + llvm::Value *ValueVal; + + std::vector > *ArgList; + std::vector *ValueList; + std::list *TypeList; + // Represent the RHS of PHI node + std::list > *PHIList; + std::vector > *JumpTable; + std::vector *ConstVector; + llvm::GlobalValue::LinkageTypes Linkage; int64_t SInt64Val; uint64_t UInt64Val; int SIntVal; @@ -525,31 +1044,38 @@ bool BoolVal; char *StrVal; // This memory is strdup'd! - ValID ValIDVal; // strdup'd memory maybe! + llvm::ValID ValIDVal; // strdup'd memory maybe! - Instruction::UnaryOps UnaryOpVal; - Instruction::BinaryOps BinaryOpVal; - Instruction::TermOps TermOpVal; - Instruction::MemoryOps MemOpVal; - Instruction::OtherOps OtherOpVal; + BinaryOpInfo BinaryOpVal; + TermOpInfo TermOpVal; + MemOpInfo MemOpVal; + OtherOpInfo OtherOpVal; + llvm::Module::Endianness Endianness; } -%type Module MethodList -%type Method MethodProto MethodHeader BasicBlockList +%type Module FunctionList +%type Function FunctionProto FunctionHeader BasicBlockList %type BasicBlock InstructionList %type BBTerminatorInst %type Inst InstVal MemoryInst -%type ConstVal ExtendedConstVal -%type ConstVector UByteList -%type ArgList ArgListH -%type ArgVal +%type ConstVal ConstExpr +%type ConstVector +%type ArgList ArgListH +%type ArgVal %type PHIList %type ValueRefList ValueRefListE // For call param lists +%type IndexList // For GEP derived indices %type TypeListI ArgTypeListI %type JumpTable %type GlobalType // GLOBAL or CONSTANT? +%type OptVolatile // 'volatile' or not +%type OptTailCall // TAIL CALL or plain CALL. +%type OptSideEffect // 'sideeffect' or not. +%type OptLinkage +%type BigOrLittle -%type ValueRef ConstValueRef // Reference to a definition or BB +// ValueRef - Unresolved reference to a definition or BB +%type ValueRef ConstValueRef SymbolicValueRef %type ResolvedVal // pair // Tokens and types for handling constant integer values // @@ -568,346 +1094,679 @@ // Built in types... %type Types TypesV UpRTypes UpRTypesV %type SIntType UIntType IntType FPType PrimType // Classifications -%token OPAQUE %token VOID BOOL SBYTE UBYTE SHORT USHORT INT UINT LONG ULONG %token FLOAT DOUBLE TYPE LABEL -%type ArrayType ArrayTypeI -%type StructType StructTypeI - -%token VAR_ID LABELSTR STRINGCONSTANT -%type OptVAR_ID OptAssign - -%token IMPLEMENTATION TRUE FALSE BEGINTOK END DECLARE GLOBAL CONSTANT UNINIT -%token TO DOTDOTDOT STRING - -// Basic Block Terminating Operators -%token RET BR SWITCH - -// Unary Operators -%type UnaryOps // all the unary operators -%token NOT - -// Binary Operators -%type BinaryOps // all the binary operators -%token ADD SUB MUL DIV REM -%token SETLE SETGE SETLT SETGT SETEQ SETNE // Binary Comarators +%token VAR_ID LABELSTR STRINGCONSTANT +%type Name OptName OptAssign +%type OptAlign OptCAlign +%type OptSection SectionString + +%token IMPLEMENTATION ZEROINITIALIZER TRUETOK FALSETOK BEGINTOK ENDTOK +%token DECLARE GLOBAL CONSTANT SECTION VOLATILE +%token TO DOTDOTDOT NULL_TOK UNDEF CONST INTERNAL LINKONCE WEAK APPENDING +%token DLLIMPORT DLLEXPORT EXTERN_WEAK +%token OPAQUE NOT EXTERNAL TARGET TRIPLE ENDIAN POINTERSIZE LITTLE BIG ALIGN +%token DEPLIBS CALL TAIL ASM_TOK MODULE SIDEEFFECT +%token CC_TOK CCC_TOK CSRETCC_TOK FASTCC_TOK COLDCC_TOK +%token X86_STDCALLCC_TOK X86_FASTCALLCC_TOK +%token DATALAYOUT +%type OptCallingConv + +// Basic Block Terminating Operators +%token RET BR SWITCH INVOKE UNWIND UNREACHABLE + +// Binary Operators +%type ArithmeticOps LogicalOps SetCondOps // Binops Subcatagories +%token ADD SUB MUL UDIV SDIV FDIV UREM SREM FREM AND OR XOR +%token SETLE SETGE SETLT SETGT SETEQ SETNE // Binary Comparators // Memory Instructions -%token MALLOC ALLOCA FREE LOAD STORE GETELEMENTPTR +%token MALLOC ALLOCA FREE LOAD STORE GETELEMENTPTR // Other Operators %type ShiftOps -%token PHI CALL CAST SHL SHR +%token PHI_TOK CAST SELECT SHL SHR VAARG +%token EXTRACTELEMENT INSERTELEMENT SHUFFLEVECTOR +%token VAARG_old VANEXT_old //OBSOLETE + %start Module %% // Handle constant integer size restriction and conversion... // - -INTVAL : SINTVAL +INTVAL : SINTVAL; INTVAL : UINTVAL { if ($1 > (uint32_t)INT32_MAX) // Outside of my range! - ThrowException("Value too large for type!"); + GEN_ERROR("Value too large for type!"); $$ = (int32_t)$1; -} + CHECK_FOR_ERROR +}; -EINT64VAL : ESINT64VAL // These have same type and can't cause problems... +EINT64VAL : ESINT64VAL; // These have same type and can't cause problems... EINT64VAL : EUINT64VAL { if ($1 > (uint64_t)INT64_MAX) // Outside of my range! - ThrowException("Value too large for type!"); + GEN_ERROR("Value too large for type!"); $$ = (int64_t)$1; -} + CHECK_FOR_ERROR +}; -// Operations that are notably excluded from this list include: +// Operations that are notably excluded from this list include: // RET, BR, & SWITCH because they end basic blocks and are treated specially. // -UnaryOps : NOT -BinaryOps : ADD | SUB | MUL | DIV | REM -BinaryOps : SETLE | SETGE | SETLT | SETGT | SETEQ | SETNE -ShiftOps : SHL | SHR +ArithmeticOps: ADD | SUB | MUL | UDIV | SDIV | FDIV | UREM | SREM | FREM; +LogicalOps : AND | OR | XOR; +SetCondOps : SETLE | SETGE | SETLT | SETGT | SETEQ | SETNE; + +ShiftOps : SHL | SHR; // These are some types that allow classification if we only want a particular // thing... for example, only a signed, unsigned, or integral type. -SIntType : LONG | INT | SHORT | SBYTE -UIntType : ULONG | UINT | USHORT | UBYTE -IntType : SIntType | UIntType -FPType : FLOAT | DOUBLE +SIntType : LONG | INT | SHORT | SBYTE; +UIntType : ULONG | UINT | USHORT | UBYTE; +IntType : SIntType | UIntType; +FPType : FLOAT | DOUBLE; // OptAssign - Value producing statements have an optional assignment component -OptAssign : VAR_ID '=' { +OptAssign : Name '=' { $$ = $1; + CHECK_FOR_ERROR } - | /*empty*/ { - $$ = 0; - } + | /*empty*/ { + $$ = 0; + CHECK_FOR_ERROR + }; + +OptLinkage : INTERNAL { $$ = GlobalValue::InternalLinkage; } | + LINKONCE { $$ = GlobalValue::LinkOnceLinkage; } | + WEAK { $$ = GlobalValue::WeakLinkage; } | + APPENDING { $$ = GlobalValue::AppendingLinkage; } | + DLLIMPORT { $$ = GlobalValue::DLLImportLinkage; } | + DLLEXPORT { $$ = GlobalValue::DLLExportLinkage; } | + EXTERN_WEAK { $$ = GlobalValue::ExternalWeakLinkage; } | + /*empty*/ { $$ = GlobalValue::ExternalLinkage; }; + +OptCallingConv : /*empty*/ { $$ = CallingConv::C; } | + CCC_TOK { $$ = CallingConv::C; } | + CSRETCC_TOK { $$ = CallingConv::CSRet; } | + FASTCC_TOK { $$ = CallingConv::Fast; } | + COLDCC_TOK { $$ = CallingConv::Cold; } | + X86_STDCALLCC_TOK { $$ = CallingConv::X86_StdCall; } | + X86_FASTCALLCC_TOK { $$ = CallingConv::X86_FastCall; } | + CC_TOK EUINT64VAL { + if ((unsigned)$2 != $2) + GEN_ERROR("Calling conv too large!"); + $$ = $2; + CHECK_FOR_ERROR + }; + +// OptAlign/OptCAlign - An optional alignment, and an optional alignment with +// a comma before it. +OptAlign : /*empty*/ { $$ = 0; } | + ALIGN EUINT64VAL { + $$ = $2; + if ($$ != 0 && !isPowerOf2_32($$)) + GEN_ERROR("Alignment must be a power of two!"); + CHECK_FOR_ERROR +}; +OptCAlign : /*empty*/ { $$ = 0; } | + ',' ALIGN EUINT64VAL { + $$ = $3; + if ($$ != 0 && !isPowerOf2_32($$)) + GEN_ERROR("Alignment must be a power of two!"); + CHECK_FOR_ERROR +}; + + +SectionString : SECTION STRINGCONSTANT { + for (unsigned i = 0, e = strlen($2); i != e; ++i) + if ($2[i] == '"' || $2[i] == '\\') + GEN_ERROR("Invalid character in section name!"); + $$ = $2; + CHECK_FOR_ERROR +}; +OptSection : /*empty*/ { $$ = 0; } | + SectionString { $$ = $1; }; + +// GlobalVarAttributes - Used to pass the attributes string on a global. CurGV +// is set to be the global we are processing. +// +GlobalVarAttributes : /* empty */ {} | + ',' GlobalVarAttribute GlobalVarAttributes {}; +GlobalVarAttribute : SectionString { + CurGV->setSection($1); + free($1); + CHECK_FOR_ERROR + } + | ALIGN EUINT64VAL { + if ($2 != 0 && !isPowerOf2_32($2)) + GEN_ERROR("Alignment must be a power of two!"); + CurGV->setAlignment($2); + CHECK_FOR_ERROR + }; //===----------------------------------------------------------------------===// // Types includes all predefined types... except void, because it can only be -// used in specific contexts (method returning void for example). To have +// used in specific contexts (function returning void for example). To have // access to it, a user must explicitly use TypesV. // // TypesV includes all of 'Types', but it also includes the void type. -TypesV : Types | VOID { $$ = newTH($1); } -UpRTypesV : UpRTypes | VOID { $$ = newTH($1); } +TypesV : Types | VOID { $$ = new PATypeHolder($1); }; +UpRTypesV : UpRTypes | VOID { $$ = new PATypeHolder($1); }; Types : UpRTypes { - TypeDone($$ = $1); - } + if (!UpRefs.empty()) + GEN_ERROR("Invalid upreference in type: " + (*$1)->getDescription()); + $$ = $1; + CHECK_FOR_ERROR + }; // Derived types are added later... // -PrimType : BOOL | SBYTE | UBYTE | SHORT | USHORT | INT | UINT -PrimType : LONG | ULONG | FLOAT | DOUBLE | TYPE | LABEL -UpRTypes : OPAQUE | PrimType { $$ = newTH($1); } -UpRTypes : ValueRef { // Named types are also simple types... - $$ = newTH(getTypeVal($1)); -} - -// ArrayTypeI - Internal version of ArrayType that can have incomplete uprefs -// -ArrayTypeI : '[' UpRTypesV ']' { // Unsized array type? - $$ = newTHC(HandleUpRefs(ArrayType::get(*$2))); - delete $2; - } - | '[' EUINT64VAL 'x' UpRTypes ']' { // Sized array type? - $$ = newTHC(HandleUpRefs(ArrayType::get(*$4, (int)$2))); - delete $4; - } - -StructTypeI : '{' TypeListI '}' { // Structure type? - vector Elements; - mapto($2->begin(), $2->end(), back_inserter(Elements), - mem_fun_ref(&PATypeHandle::get)); - - $$ = newTHC(HandleUpRefs(StructType::get(Elements))); - delete $2; - } - | '{' '}' { // Empty structure type? - $$ = newTH(StructType::get(vector())); - } - +PrimType : BOOL | SBYTE | UBYTE | SHORT | USHORT | INT | UINT ; +PrimType : LONG | ULONG | FLOAT | DOUBLE | TYPE | LABEL; +UpRTypes : OPAQUE { + $$ = new PATypeHolder(OpaqueType::get()); + CHECK_FOR_ERROR + } + | PrimType { + $$ = new PATypeHolder($1); + CHECK_FOR_ERROR + }; +UpRTypes : SymbolicValueRef { // Named types are also simple types... + const Type* tmp = getTypeVal($1); + CHECK_FOR_ERROR + $$ = new PATypeHolder(tmp); +}; // Include derived types in the Types production. // UpRTypes : '\\' EUINT64VAL { // Type UpReference - if ($2 > (uint64_t)INT64_MAX) ThrowException("Value out of range!"); + if ($2 > (uint64_t)~0U) GEN_ERROR("Value out of range!"); OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder - UpRefs.push_back(make_pair((unsigned)$2, OT)); // Add to vector... - $$ = newTH(OT); + UpRefs.push_back(UpRefRecord((unsigned)$2, OT)); // Add to vector... + $$ = new PATypeHolder(OT); UR_OUT("New Upreference!\n"); + CHECK_FOR_ERROR } - | UpRTypesV '(' ArgTypeListI ')' { // Method derived type? - vector Params; - mapto($3->begin(), $3->end(), back_inserter(Params), - mem_fun_ref(&PATypeHandle::get)); - $$ = newTH(HandleUpRefs(MethodType::get(*$1, Params))); + | UpRTypesV '(' ArgTypeListI ')' { // Function derived type? + std::vector Params; + for (std::list::iterator I = $3->begin(), + E = $3->end(); I != E; ++I) + Params.push_back(*I); + bool isVarArg = Params.size() && Params.back() == Type::VoidTy; + if (isVarArg) Params.pop_back(); + + $$ = new PATypeHolder(HandleUpRefs(FunctionType::get(*$1,Params,isVarArg))); delete $3; // Delete the argument list - delete $1; // Delete the old type handle + delete $1; // Delete the return type handle + CHECK_FOR_ERROR } - | ArrayTypeI { // [Un]sized array type? - $$ = newTHC(*$1); delete $1; + | '[' EUINT64VAL 'x' UpRTypes ']' { // Sized array type? + $$ = new PATypeHolder(HandleUpRefs(ArrayType::get(*$4, (unsigned)$2))); + delete $4; + CHECK_FOR_ERROR } - | StructTypeI { // Structure type? - $$ = newTHC(*$1); delete $1; + | '<' EUINT64VAL 'x' UpRTypes '>' { // Packed array type? + const llvm::Type* ElemTy = $4->get(); + if ((unsigned)$2 != $2) + 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($2)) + GEN_ERROR("Vector length should be a power of 2!"); + $$ = new PATypeHolder(HandleUpRefs(PackedType::get(*$4, (unsigned)$2))); + delete $4; + CHECK_FOR_ERROR + } + | '{' TypeListI '}' { // Structure type? + std::vector Elements; + for (std::list::iterator I = $2->begin(), + E = $2->end(); I != E; ++I) + Elements.push_back(*I); + + $$ = new PATypeHolder(HandleUpRefs(StructType::get(Elements))); + delete $2; + CHECK_FOR_ERROR } - | UpRTypes '*' { // Pointer type? - $$ = newTH(HandleUpRefs(PointerType::get(*$1))); - delete $1; // Delete the type handle + | '{' '}' { // Empty structure type? + $$ = new PATypeHolder(StructType::get(std::vector())); + CHECK_FOR_ERROR } + | UpRTypes '*' { // Pointer type? + if (*$1 == Type::LabelTy) + GEN_ERROR("Cannot form a pointer to a basic block"); + $$ = new PATypeHolder(HandleUpRefs(PointerType::get(*$1))); + delete $1; + CHECK_FOR_ERROR + }; -// Define some helpful top level types that do not allow UpReferences to escape -// -ArrayType : ArrayTypeI { TypeDone($$ = $1); } -StructType : StructTypeI { TypeDone($$ = $1); } - - - -// TypeList - Used for struct declarations and as a basis for method type +// TypeList - Used for struct declarations and as a basis for function type // declaration type lists // TypeListI : UpRTypes { - $$ = new list >(); + $$ = new std::list(); $$->push_back(*$1); delete $1; + CHECK_FOR_ERROR } | TypeListI ',' UpRTypes { ($$=$1)->push_back(*$3); delete $3; - } + CHECK_FOR_ERROR + }; -// ArgTypeList - List of types for a method type declaration... +// ArgTypeList - List of types for a function type declaration... ArgTypeListI : TypeListI | TypeListI ',' DOTDOTDOT { ($$=$1)->push_back(Type::VoidTy); + CHECK_FOR_ERROR } | DOTDOTDOT { - ($$ = new list >())->push_back(Type::VoidTy); + ($$ = new std::list())->push_back(Type::VoidTy); + CHECK_FOR_ERROR } | /*empty*/ { - $$ = new list >(); - } - + $$ = new std::list(); + CHECK_FOR_ERROR + }; // ConstVal - The various declarations that go into the constant pool. This -// includes all forward declarations of types, constants, and functions. -// -// This is broken into two sections: ExtendedConstVal and ConstVal -// -ExtendedConstVal: ArrayType '[' ConstVector ']' { // Nonempty unsized arr - const ArrayType *ATy = *$1; +// production is used ONLY to represent constants that show up AFTER a 'const', +// 'constant' or 'global' token at global scope. Constants that can be inlined +// into other expressions (such as integers and constexprs) are handled by the +// ResolvedVal, ValueRef and ConstValueRef productions. +// +ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr + const ArrayType *ATy = dyn_cast($1->get()); + if (ATy == 0) + GEN_ERROR("Cannot make array constant with type: '" + + (*$1)->getDescription() + "'!"); const Type *ETy = ATy->getElementType(); int NumElements = ATy->getNumElements(); // Verify that we have the correct size... if (NumElements != -1 && NumElements != (int)$3->size()) - ThrowException("Type mismatch: constant sized array initialized with " + - utostr($3->size()) + " arguments, but has size of " + - itostr(NumElements) + "!"); + GEN_ERROR("Type mismatch: constant sized array initialized with " + + utostr($3->size()) + " arguments, but has size of " + + itostr(NumElements) + "!"); // Verify all elements are correct type! for (unsigned i = 0; i < $3->size(); i++) { if (ETy != (*$3)[i]->getType()) - ThrowException("Element #" + utostr(i) + " is not of type '" + - ETy->getName() + "' as required!\nIt is of type '" + - (*$3)[i]->getType()->getName() + "'."); + GEN_ERROR("Element #" + utostr(i) + " is not of type '" + + ETy->getDescription() +"' as required!\nIt is of type '"+ + (*$3)[i]->getType()->getDescription() + "'."); } - $$ = ConstPoolArray::get(ATy, *$3); + $$ = ConstantArray::get(ATy, *$3); delete $1; delete $3; + CHECK_FOR_ERROR } - | ArrayType '[' ']' { - int NumElements = (*$1)->getNumElements(); + | Types '[' ']' { + const ArrayType *ATy = dyn_cast($1->get()); + if (ATy == 0) + GEN_ERROR("Cannot make array constant with type: '" + + (*$1)->getDescription() + "'!"); + + int NumElements = ATy->getNumElements(); if (NumElements != -1 && NumElements != 0) - ThrowException("Type mismatch: constant sized array initialized with 0" - " arguments, but has size of " + itostr(NumElements) +"!"); - $$ = ConstPoolArray::get((*$1), vector()); + GEN_ERROR("Type mismatch: constant sized array initialized with 0" + " arguments, but has size of " + itostr(NumElements) +"!"); + $$ = ConstantArray::get(ATy, std::vector()); delete $1; + CHECK_FOR_ERROR } - | ArrayType 'c' STRINGCONSTANT { - const ArrayType *ATy = *$1; + | Types 'c' STRINGCONSTANT { + const ArrayType *ATy = dyn_cast($1->get()); + if (ATy == 0) + GEN_ERROR("Cannot make array constant with type: '" + + (*$1)->getDescription() + "'!"); + int NumElements = ATy->getNumElements(); const Type *ETy = ATy->getElementType(); char *EndStr = UnEscapeLexed($3, true); if (NumElements != -1 && NumElements != (EndStr-$3)) - ThrowException("Can't build string constant of size " + - itostr((int)(EndStr-$3)) + - " when array has size " + itostr(NumElements) + "!"); - vector Vals; + GEN_ERROR("Can't build string constant of size " + + itostr((int)(EndStr-$3)) + + " when array has size " + itostr(NumElements) + "!"); + std::vector Vals; if (ETy == Type::SByteTy) { - for (char *C = $3; C != EndStr; ++C) - Vals.push_back(ConstPoolSInt::get(ETy, *C)); + for (signed char *C = (signed char *)$3; C != (signed char *)EndStr; ++C) + Vals.push_back(ConstantInt::get(ETy, *C)); } else if (ETy == Type::UByteTy) { - for (char *C = $3; C != EndStr; ++C) - Vals.push_back(ConstPoolUInt::get(ETy, *C)); + for (unsigned char *C = (unsigned char *)$3; + C != (unsigned char*)EndStr; ++C) + Vals.push_back(ConstantInt::get(ETy, *C)); } else { free($3); - ThrowException("Cannot build string arrays of non byte sized elements!"); + GEN_ERROR("Cannot build string arrays of non byte sized elements!"); } free($3); - $$ = ConstPoolArray::get(ATy, Vals); + $$ = ConstantArray::get(ATy, Vals); delete $1; + CHECK_FOR_ERROR } - | StructType '{' ConstVector '}' { - // FIXME: TODO: Check to see that the constants are compatible with the type - // initializer! - $$ = ConstPoolStruct::get(*$1, *$3); + | Types '<' ConstVector '>' { // Nonempty unsized arr + const PackedType *PTy = dyn_cast($1->get()); + if (PTy == 0) + GEN_ERROR("Cannot make packed constant with type: '" + + (*$1)->getDescription() + "'!"); + const Type *ETy = PTy->getElementType(); + int NumElements = PTy->getNumElements(); + + // Verify that we have the correct size... + if (NumElements != -1 && NumElements != (int)$3->size()) + GEN_ERROR("Type mismatch: constant sized packed initialized with " + + utostr($3->size()) + " arguments, but has size of " + + itostr(NumElements) + "!"); + + // Verify all elements are correct type! + for (unsigned i = 0; i < $3->size(); i++) { + if (ETy != (*$3)[i]->getType()) + GEN_ERROR("Element #" + utostr(i) + " is not of type '" + + ETy->getDescription() +"' as required!\nIt is of type '"+ + (*$3)[i]->getType()->getDescription() + "'."); + } + + $$ = ConstantPacked::get(PTy, *$3); delete $1; delete $3; + CHECK_FOR_ERROR } -/* - | Types '*' ConstVal { - assert(0); - $$ = 0; - } -*/ + | Types '{' ConstVector '}' { + const StructType *STy = dyn_cast($1->get()); + if (STy == 0) + GEN_ERROR("Cannot make struct constant with type: '" + + (*$1)->getDescription() + "'!"); + + if ($3->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 = $3->size(); i != e; ++i) + if ((*$3)[i]->getType() != STy->getElementType(i)) + GEN_ERROR("Expected type '" + + STy->getElementType(i)->getDescription() + + "' for element #" + utostr(i) + + " of structure initializer!"); -ConstVal : ExtendedConstVal { - $$ = $1; + $$ = ConstantStruct::get(STy, *$3); + delete $1; delete $3; + CHECK_FOR_ERROR } - | SIntType EINT64VAL { // integral constants - if (!ConstPoolSInt::isValueValidForType($1, $2)) - ThrowException("Constant value doesn't fit in type!"); - $$ = ConstPoolSInt::get($1, $2); - } - | UIntType EUINT64VAL { // integral constants - if (!ConstPoolUInt::isValueValidForType($1, $2)) - ThrowException("Constant value doesn't fit in type!"); - $$ = ConstPoolUInt::get($1, $2); - } - | BOOL TRUE { // Boolean constants - $$ = ConstPoolBool::True; + | Types '{' '}' { + const StructType *STy = dyn_cast($1->get()); + if (STy == 0) + GEN_ERROR("Cannot make struct constant with type: '" + + (*$1)->getDescription() + "'!"); + + if (STy->getNumContainedTypes() != 0) + GEN_ERROR("Illegal number of initializers for structure type!"); + + $$ = ConstantStruct::get(STy, std::vector()); + delete $1; + CHECK_FOR_ERROR } - | BOOL FALSE { // Boolean constants - $$ = ConstPoolBool::False; + | Types NULL_TOK { + const PointerType *PTy = dyn_cast($1->get()); + if (PTy == 0) + GEN_ERROR("Cannot make null pointer constant with type: '" + + (*$1)->getDescription() + "'!"); + + $$ = ConstantPointerNull::get(PTy); + delete $1; + CHECK_FOR_ERROR } - | FPType FPVAL { // Float & Double constants - $$ = ConstPoolFP::get($1, $2); + | Types UNDEF { + $$ = UndefValue::get($1->get()); + delete $1; + CHECK_FOR_ERROR } + | Types SymbolicValueRef { + const PointerType *Ty = dyn_cast($1->get()); + if (Ty == 0) + GEN_ERROR("Global const reference must be a pointer type!"); + + // ConstExprs can exist in the body of a function, thus creating + // GlobalValues whenever they refer to a variable. Because we are in + // the context of a function, getValNonImprovising will search the functions + // symbol table instead of the module symbol table for the global symbol, + // which throws things all off. To get around this, we just tell + // getValNonImprovising that we are at global scope here. + // + Function *SavedCurFn = CurFun.CurrentFunction; + CurFun.CurrentFunction = 0; -// ConstVector - A list of comma seperated constants. -ConstVector : ConstVector ',' ConstVal { - ($$ = $1)->push_back($3); + Value *V = getValNonImprovising(Ty, $2); + CHECK_FOR_ERROR + + CurFun.CurrentFunction = SavedCurFn; + + // If this is an initializer for a constant pointer, which is referencing a + // (currently) undefined variable, create a stub now that shall be replaced + // in the future with the right type of variable. + // + if (V == 0) { + assert(isa(Ty) && "Globals may only be used as pointers!"); + const PointerType *PT = cast(Ty); + + // First check to see if the forward references value is already created! + PerModuleInfo::GlobalRefsType::iterator I = + CurModule.GlobalRefs.find(std::make_pair(PT, $2)); + + if (I != CurModule.GlobalRefs.end()) { + V = I->second; // Placeholder already exists, use it... + $2.destroy(); + } else { + std::string Name; + if ($2.Type == ValID::NameVal) Name = $2.Name; + + // Create the forward referenced global. + GlobalValue *GV; + if (const FunctionType *FTy = + dyn_cast(PT->getElementType())) { + GV = new Function(FTy, GlobalValue::ExternalLinkage, Name, + CurModule.CurrentModule); + } else { + GV = new GlobalVariable(PT->getElementType(), false, + GlobalValue::ExternalLinkage, 0, + Name, CurModule.CurrentModule); + } + + // Keep track of the fact that we have a forward ref to recycle it + CurModule.GlobalRefs.insert(std::make_pair(std::make_pair(PT, $2), GV)); + V = GV; + } + } + + $$ = cast(V); + delete $1; // Free the type handle + CHECK_FOR_ERROR + } + | Types ConstExpr { + if ($1->get() != $2->getType()) + GEN_ERROR("Mismatched types for constant expression!"); + $$ = $2; + delete $1; + CHECK_FOR_ERROR } - | ConstVal { - $$ = new vector(); - $$->push_back($1); + | Types ZEROINITIALIZER { + const Type *Ty = $1->get(); + if (isa(Ty) || Ty == Type::LabelTy || isa(Ty)) + GEN_ERROR("Cannot create a null initialized value of this type!"); + $$ = Constant::getNullValue(Ty); + delete $1; + CHECK_FOR_ERROR + }; + +ConstVal : SIntType EINT64VAL { // integral constants + if (!ConstantInt::isValueValidForType($1, $2)) + GEN_ERROR("Constant value doesn't fit in type!"); + $$ = ConstantInt::get($1, $2); + CHECK_FOR_ERROR + } + | UIntType EUINT64VAL { // integral constants + if (!ConstantInt::isValueValidForType($1, $2)) + GEN_ERROR("Constant value doesn't fit in type!"); + $$ = ConstantInt::get($1, $2); + CHECK_FOR_ERROR + } + | BOOL TRUETOK { // Boolean constants + $$ = ConstantBool::getTrue(); + CHECK_FOR_ERROR + } + | BOOL FALSETOK { // Boolean constants + $$ = ConstantBool::getFalse(); + CHECK_FOR_ERROR } + | FPType FPVAL { // Float & Double constants + if (!ConstantFP::isValueValidForType($1, $2)) + GEN_ERROR("Floating point constant invalid for type!!"); + $$ = ConstantFP::get($1, $2); + CHECK_FOR_ERROR + }; -// GlobalType - Match either GLOBAL or CONSTANT for global declarations... -GlobalType : GLOBAL { $$ = false; } | CONSTANT { $$ = true; } +ConstExpr: CAST '(' ConstVal TO Types ')' { + if (!$3->getType()->isFirstClassType()) + GEN_ERROR("cast constant expression from a non-primitive type: '" + + $3->getType()->getDescription() + "'!"); + if (!$5->get()->isFirstClassType()) + GEN_ERROR("cast constant expression to a non-primitive type: '" + + $5->get()->getDescription() + "'!"); + $$ = ConstantExpr::getCast($3, $5->get()); + delete $5; + CHECK_FOR_ERROR + } + | GETELEMENTPTR '(' ConstVal IndexList ')' { + if (!isa($3->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($3->getType(), $4->begin(), $4->end()), + GTE = gep_type_end($3->getType(), $4->begin(), $4->end()); + for (unsigned i = 0, e = $4->size(); i != e && GTI != GTE; ++i, ++GTI) + if (isa(*GTI)) // Only change struct indices + if (ConstantInt *CUI = dyn_cast((*$4)[i])) + if (CUI->getType() == Type::UByteTy) + (*$4)[i] = ConstantExpr::getCast(CUI, Type::UIntTy); + + const Type *IdxTy = + GetElementPtrInst::getIndexedType($3->getType(), *$4, true); + if (!IdxTy) + GEN_ERROR("Index list invalid for constant getelementptr!"); + + std::vector IdxVec; + for (unsigned i = 0, e = $4->size(); i != e; ++i) + if (Constant *C = dyn_cast((*$4)[i])) + IdxVec.push_back(C); + else + GEN_ERROR("Indices to constant getelementptr must be constants!"); + delete $4; -// ConstPool - Constants with optional names assigned to them. -ConstPool : ConstPool OptAssign ConstVal { - setValueName($3, $2); - InsertValue($3); + $$ = ConstantExpr::getGetElementPtr($3, IdxVec); + CHECK_FOR_ERROR } - | ConstPool OptAssign TYPE TypesV { // Types can be defined in the const pool - // TODO: FIXME when Type are not const - setValueName(const_cast($4->get()), $2); - - if (!$2) { - InsertType($4->get(), - CurMeth.CurrentMethod ? CurMeth.Types : CurModule.Types); + | SELECT '(' ConstVal ',' ConstVal ',' ConstVal ')' { + if ($3->getType() != Type::BoolTy) + GEN_ERROR("Select condition must be of boolean type!"); + if ($5->getType() != $7->getType()) + GEN_ERROR("Select operand types must match!"); + $$ = ConstantExpr::getSelect($3, $5, $7); + CHECK_FOR_ERROR + } + | ArithmeticOps '(' ConstVal ',' ConstVal ')' { + if ($3->getType() != $5->getType()) + GEN_ERROR("Binary operator types must match!"); + // First, make sure we're dealing with the right opcode by upgrading from + // obsolete versions. + sanitizeOpCode($1,$3->getType()); + CHECK_FOR_ERROR; + + // HACK: llvm 1.3 and earlier used to emit invalid pointer constant exprs. + // To retain backward compatibility with these early compilers, we emit a + // cast to the appropriate integer type automatically if we are in the + // broken case. See PR424 for more information. + if (!isa($3->getType())) { + $$ = ConstantExpr::get($1.opcode, $3, $5); + } else { + const Type *IntPtrTy = 0; + switch (CurModule.CurrentModule->getPointerSize()) { + case Module::Pointer32: IntPtrTy = Type::IntTy; break; + case Module::Pointer64: IntPtrTy = Type::LongTy; break; + default: GEN_ERROR("invalid pointer binary constant expr!"); + } + $$ = ConstantExpr::get($1.opcode, ConstantExpr::getCast($3, IntPtrTy), + ConstantExpr::getCast($5, IntPtrTy)); + $$ = ConstantExpr::getCast($$, $3->getType()); } - delete $4; + CHECK_FOR_ERROR } - | ConstPool MethodProto { // Method prototypes can be in const pool + | LogicalOps '(' ConstVal ',' ConstVal ')' { + if ($3->getType() != $5->getType()) + GEN_ERROR("Logical operator types must match!"); + if (!$3->getType()->isIntegral()) { + if (!isa($3->getType()) || + !cast($3->getType())->getElementType()->isIntegral()) + GEN_ERROR("Logical operator requires integral operands!"); + } + $$ = ConstantExpr::get($1.opcode, $3, $5); + CHECK_FOR_ERROR } - | ConstPool OptAssign GlobalType ResolvedVal { - const Type *Ty = $4->getType(); - // Global declarations appear in Constant Pool - ConstPoolVal *Initializer = $4->castConstant(); - if (Initializer == 0) - ThrowException("Global value initializer is not a constant!"); - - GlobalVariable *GV = new GlobalVariable(PointerType::get(Ty), $3, - Initializer); - setValueName(GV, $2); + | SetCondOps '(' ConstVal ',' ConstVal ')' { + if ($3->getType() != $5->getType()) + GEN_ERROR("setcc operand types must match!"); + $$ = ConstantExpr::get($1.opcode, $3, $5); + CHECK_FOR_ERROR + } + | ShiftOps '(' ConstVal ',' ConstVal ')' { + if ($5->getType() != Type::UByteTy) + GEN_ERROR("Shift count for shift constant must be unsigned byte!"); + if (!$3->getType()->isInteger()) + GEN_ERROR("Shift constant expression requires integer operand!"); + $$ = ConstantExpr::get($1.opcode, $3, $5); + CHECK_FOR_ERROR + } + | EXTRACTELEMENT '(' ConstVal ',' ConstVal ')' { + if (!ExtractElementInst::isValidOperands($3, $5)) + GEN_ERROR("Invalid extractelement operands!"); + $$ = ConstantExpr::getExtractElement($3, $5); + CHECK_FOR_ERROR + } + | INSERTELEMENT '(' ConstVal ',' ConstVal ',' ConstVal ')' { + if (!InsertElementInst::isValidOperands($3, $5, $7)) + GEN_ERROR("Invalid insertelement operands!"); + $$ = ConstantExpr::getInsertElement($3, $5, $7); + CHECK_FOR_ERROR + } + | SHUFFLEVECTOR '(' ConstVal ',' ConstVal ',' ConstVal ')' { + if (!ShuffleVectorInst::isValidOperands($3, $5, $7)) + GEN_ERROR("Invalid shufflevector operands!"); + $$ = ConstantExpr::getShuffleVector($3, $5, $7); + CHECK_FOR_ERROR + }; - CurModule.CurrentModule->getGlobalList().push_back(GV); - InsertValue(GV, CurModule.Values); + +// ConstVector - A list of comma separated constants. +ConstVector : ConstVector ',' ConstVal { + ($$ = $1)->push_back($3); + CHECK_FOR_ERROR } - | ConstPool OptAssign UNINIT GlobalType Types { - const Type *Ty = *$5; - // Global declarations appear in Constant Pool - if (Ty->isArrayType() && Ty->castArrayType()->isUnsized()) { - ThrowException("Type '" + Ty->getDescription() + - "' is not a sized type!"); - } + | ConstVal { + $$ = new std::vector(); + $$->push_back($1); + CHECK_FOR_ERROR + }; - GlobalVariable *GV = new GlobalVariable(PointerType::get(Ty), $4); - setValueName(GV, $2); - CurModule.CurrentModule->getGlobalList().push_back(GV); - InsertValue(GV, CurModule.Values); - } - | /* empty: end of list */ { - } +// GlobalType - Match either GLOBAL or CONSTANT for global declarations... +GlobalType : GLOBAL { $$ = false; } | CONSTANT { $$ = true; }; //===----------------------------------------------------------------------===// @@ -917,422 +1776,1052 @@ // Module rule: Capture the result of parsing the whole file into a result // variable... // -Module : MethodList { +Module : FunctionList { $$ = ParserResult = $1; CurModule.ModuleDone(); -} + CHECK_FOR_ERROR; +}; -// MethodList - A list of methods, preceeded by a constant pool. +// FunctionList - A list of functions, preceeded by a constant pool. // -MethodList : MethodList Method { +FunctionList : FunctionList Function { $$ = $1; - if (!$2->getParent()) - $1->getMethodList().push_back($2); - CurMeth.MethodDone(); + CurFun.FunctionDone(); + CHECK_FOR_ERROR } - | MethodList MethodProto { + | FunctionList FunctionProto { $$ = $1; + CHECK_FOR_ERROR } - | ConstPool IMPLEMENTATION { + | FunctionList MODULE ASM_TOK AsmBlock { + $$ = $1; + CHECK_FOR_ERROR + } + | FunctionList IMPLEMENTATION { + $$ = $1; + CHECK_FOR_ERROR + } + | ConstPool { $$ = CurModule.CurrentModule; - // Resolve circular types before we parse the body of the module - ResolveTypes(CurModule.LateResolveTypes); + // Emit an error if there are any unresolved types left. + if (!CurModule.LateResolveTypes.empty()) { + const ValID &DID = CurModule.LateResolveTypes.begin()->first; + if (DID.Type == ValID::NameVal) { + GEN_ERROR("Reference to an undefined type: '"+DID.getName() + "'"); + } else { + GEN_ERROR("Reference to an undefined type: #" + itostr(DID.Num)); + } + } + CHECK_FOR_ERROR + }; + +// ConstPool - Constants with optional names assigned to them. +ConstPool : ConstPool OptAssign TYPE TypesV { + // Eagerly resolve types. This is not an optimization, this is a + // requirement that is due to the fact that we could have this: + // + // %list = type { %list * } + // %list = type { %list * } ; repeated type decl + // + // If types are not resolved eagerly, then the two types will not be + // determined to be the same type! + // + ResolveTypeTo($2, *$4); + + if (!setTypeName(*$4, $2) && !$2) { + 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); + } + + delete $4; + CHECK_FOR_ERROR } + | ConstPool FunctionProto { // Function prototypes can be in const pool + CHECK_FOR_ERROR + } + | ConstPool MODULE ASM_TOK AsmBlock { // Asm blocks can be in the const pool + CHECK_FOR_ERROR + } + | ConstPool OptAssign OptLinkage GlobalType ConstVal { + if ($5 == 0) + GEN_ERROR("Global value initializer is not a constant!"); + CurGV = ParseGlobalVariable($2, $3, $4, $5->getType(), $5); + CHECK_FOR_ERROR + } GlobalVarAttributes { + CurGV = 0; + } + | ConstPool OptAssign EXTERNAL GlobalType Types { + CurGV = ParseGlobalVariable($2, GlobalValue::ExternalLinkage, $4, *$5, 0); + CHECK_FOR_ERROR + delete $5; + } GlobalVarAttributes { + CurGV = 0; + CHECK_FOR_ERROR + } + | ConstPool OptAssign DLLIMPORT GlobalType Types { + CurGV = ParseGlobalVariable($2, GlobalValue::DLLImportLinkage, $4, *$5, 0); + CHECK_FOR_ERROR + delete $5; + } GlobalVarAttributes { + CurGV = 0; + CHECK_FOR_ERROR + } + | ConstPool OptAssign EXTERN_WEAK GlobalType Types { + CurGV = + ParseGlobalVariable($2, GlobalValue::ExternalWeakLinkage, $4, *$5, 0); + CHECK_FOR_ERROR + delete $5; + } GlobalVarAttributes { + CurGV = 0; + CHECK_FOR_ERROR + } + | ConstPool TARGET TargetDefinition { + CHECK_FOR_ERROR + } + | ConstPool DEPLIBS '=' LibrariesDefinition { + CHECK_FOR_ERROR + } + | /* empty: end of list */ { + }; + +AsmBlock : STRINGCONSTANT { + const std::string &AsmSoFar = CurModule.CurrentModule->getModuleInlineAsm(); + char *EndStr = UnEscapeLexed($1, true); + std::string NewAsm($1, EndStr); + free($1); + + if (AsmSoFar.empty()) + CurModule.CurrentModule->setModuleInlineAsm(NewAsm); + else + CurModule.CurrentModule->setModuleInlineAsm(AsmSoFar+"\n"+NewAsm); + CHECK_FOR_ERROR +}; + +BigOrLittle : BIG { $$ = Module::BigEndian; }; +BigOrLittle : LITTLE { $$ = Module::LittleEndian; }; + +TargetDefinition : ENDIAN '=' BigOrLittle { + CurModule.CurrentModule->setEndianness($3); + CHECK_FOR_ERROR + } + | POINTERSIZE '=' EUINT64VAL { + if ($3 == 32) + CurModule.CurrentModule->setPointerSize(Module::Pointer32); + else if ($3 == 64) + CurModule.CurrentModule->setPointerSize(Module::Pointer64); + else + GEN_ERROR("Invalid pointer size: '" + utostr($3) + "'!"); + CHECK_FOR_ERROR + } + | TRIPLE '=' STRINGCONSTANT { + CurModule.CurrentModule->setTargetTriple($3); + free($3); + } + | DATALAYOUT '=' STRINGCONSTANT { + CurModule.CurrentModule->setDataLayout($3); + free($3); + }; + +LibrariesDefinition : '[' LibList ']'; + +LibList : LibList ',' STRINGCONSTANT { + CurModule.CurrentModule->addLibrary($3); + free($3); + CHECK_FOR_ERROR + } + | STRINGCONSTANT { + CurModule.CurrentModule->addLibrary($1); + free($1); + CHECK_FOR_ERROR + } + | /* empty: end of list */ { + CHECK_FOR_ERROR + } + ; //===----------------------------------------------------------------------===// -// Rules to match Method Headers +// Rules to match Function Headers //===----------------------------------------------------------------------===// -OptVAR_ID : VAR_ID | /*empty*/ { $$ = 0; } +Name : VAR_ID | STRINGCONSTANT; +OptName : Name | /*empty*/ { $$ = 0; }; -ArgVal : Types OptVAR_ID { - $$ = new MethodArgument(*$1); delete $1; - setValueName($$, $2); -} +ArgVal : Types OptName { + if (*$1 == Type::VoidTy) + GEN_ERROR("void typed arguments are invalid!"); + $$ = new std::pair($1, $2); + CHECK_FOR_ERROR +}; -ArgListH : ArgVal ',' ArgListH { - $$ = $3; - $3->push_front($1); +ArgListH : ArgListH ',' ArgVal { + $$ = $1; + $1->push_back(*$3); + delete $3; + CHECK_FOR_ERROR } | ArgVal { - $$ = new list(); - $$->push_front($1); - } - | DOTDOTDOT { - $$ = new list(); - $$->push_back(new MethodArgument(Type::VoidTy)); - } + $$ = new std::vector >(); + $$->push_back(*$1); + delete $1; + CHECK_FOR_ERROR + }; ArgList : ArgListH { $$ = $1; + CHECK_FOR_ERROR + } + | ArgListH ',' DOTDOTDOT { + $$ = $1; + $$->push_back(std::pair(new PATypeHolder(Type::VoidTy), 0)); + CHECK_FOR_ERROR + } + | DOTDOTDOT { + $$ = new std::vector >(); + $$->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0)); + CHECK_FOR_ERROR } | /* empty */ { $$ = 0; - } - -MethodHeaderH : TypesV STRINGCONSTANT '(' ArgList ')' { - UnEscapeLexed($2); - vector ParamTypeList; - if ($4) - for (list::iterator I = $4->begin(); I != $4->end(); ++I) - ParamTypeList.push_back((*I)->getType()); + CHECK_FOR_ERROR + }; - const MethodType *MT = MethodType::get(*$1, ParamTypeList); - delete $1; - - Method *M = 0; - if (SymbolTable *ST = CurModule.CurrentModule->getSymbolTable()) { - if (Value *V = ST->lookup(MT, $2)) { // Method already in symtab? - M = V->castMethodAsserting(); +FunctionHeaderH : OptCallingConv TypesV Name '(' ArgList ')' + OptSection OptAlign { + UnEscapeLexed($3); + std::string FunctionName($3); + free($3); // Free strdup'd memory! + + if (!(*$2)->isFirstClassType() && *$2 != Type::VoidTy) + GEN_ERROR("LLVM functions cannot return aggregate types!"); - // Yes it is. If this is the case, either we need to be a forward decl, - // or it needs to be. - if (!CurMeth.isDeclare && !M->isExternal()) - ThrowException("Redefinition of method '" + string($2) + "'!"); + std::vector ParamTypeList; + if ($5) { // If there are arguments... + for (std::vector >::iterator I = $5->begin(); + I != $5->end(); ++I) + ParamTypeList.push_back(I->first->get()); + } + + bool isVarArg = ParamTypeList.size() && ParamTypeList.back() == Type::VoidTy; + if (isVarArg) ParamTypeList.pop_back(); + + const FunctionType *FT = FunctionType::get(*$2, ParamTypeList, isVarArg); + const PointerType *PFT = PointerType::get(FT); + delete $2; + + ValID ID; + if (!FunctionName.empty()) { + ID = ValID::create((char*)FunctionName.c_str()); + } else { + ID = ValID::create((int)CurModule.Values[PFT].size()); + } + + Function *Fn = 0; + // See if this function was forward referenced. If so, recycle the object. + if (GlobalValue *FWRef = CurModule.GetForwardRefForGlobal(PFT, ID)) { + // Move the function to the end of the list, from whereever it was + // previously inserted. + Fn = cast(FWRef); + CurModule.CurrentModule->getFunctionList().remove(Fn); + CurModule.CurrentModule->getFunctionList().push_back(Fn); + } else if (!FunctionName.empty() && // Merge with an earlier prototype? + (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) { + // If this is the case, either we need to be a forward decl, or it needs + // to be. + if (!CurFun.isDeclare && !Fn->isExternal()) + GEN_ERROR("Redefinition of function '" + FunctionName + "'!"); + + // Make sure to strip off any argument names so we can't get conflicts. + if (Fn->isExternal()) + for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); + AI != AE; ++AI) + AI->setName(""); + } else { // Not already defined? + Fn = new Function(FT, GlobalValue::ExternalLinkage, FunctionName, + CurModule.CurrentModule); + + InsertValue(Fn, CurModule.Values); + } + + CurFun.FunctionStart(Fn); + + if (CurFun.isDeclare) { + // If we have declaration, always overwrite linkage. This will allow us to + // correctly handle cases, when pointer to function is passed as argument to + // another function. + Fn->setLinkage(CurFun.Linkage); + } + Fn->setCallingConv($1); + Fn->setAlignment($8); + if ($7) { + Fn->setSection($7); + free($7); + } + + // Add all of the arguments we parsed to the function... + if ($5) { // Is null if empty... + if (isVarArg) { // Nuke the last entry + assert($5->back().first->get() == Type::VoidTy && $5->back().second == 0&& + "Not a varargs marker!"); + delete $5->back().first; + $5->pop_back(); // Delete the last entry + } + Function::arg_iterator ArgIt = Fn->arg_begin(); + for (std::vector >::iterator I = $5->begin(); + I != $5->end(); ++I, ++ArgIt) { + delete I->first; // Delete the typeholder... + + setValueName(ArgIt, I->second); // Insert arg into symtab... + CHECK_FOR_ERROR + InsertValue(ArgIt); } - } - if (M == 0) { // Not already defined? - M = new Method(MT, $2); - InsertValue(M, CurModule.Values); + delete $5; // We're now done with the argument list } + CHECK_FOR_ERROR +}; - free($2); // Free strdup'd memory! +BEGIN : BEGINTOK | '{'; // Allow BEGIN or '{' to start a function - CurMeth.MethodStart(M); +FunctionHeader : OptLinkage FunctionHeaderH BEGIN { + $$ = CurFun.CurrentFunction; - // Add all of the arguments we parsed to the method... - if ($4 && !CurMeth.isDeclare) { // Is null if empty... - Method::ArgumentListType &ArgList = M->getArgumentList(); + // Make sure that we keep track of the linkage type even if there was a + // previous "declare". + $$->setLinkage($1); +}; - for (list::iterator I = $4->begin(); I != $4->end(); ++I) { - InsertValue(*I); - ArgList.push_back(*I); - } - delete $4; // We're now done with the argument list - } -} +END : ENDTOK | '}'; // Allow end of '}' to end a function -MethodHeader : MethodHeaderH ConstPool BEGINTOK { - $$ = CurMeth.CurrentMethod; - - // Resolve circular types before we parse the body of the method. - ResolveTypes(CurMeth.LateResolveTypes); -} - -Method : BasicBlockList END { +Function : BasicBlockList END { $$ = $1; -} + CHECK_FOR_ERROR +}; -MethodProto : DECLARE { CurMeth.isDeclare = true; } MethodHeaderH { - $$ = CurMeth.CurrentMethod; - if (!$$->getParent()) - CurModule.CurrentModule->getMethodList().push_back($$); - CurMeth.MethodDone(); -} +FnDeclareLinkage: /*default*/ | + DLLIMPORT { CurFun.Linkage = GlobalValue::DLLImportLinkage; } | + EXTERN_WEAK { CurFun.Linkage = GlobalValue::DLLImportLinkage; }; + +FunctionProto : DECLARE { CurFun.isDeclare = true; } FnDeclareLinkage FunctionHeaderH { + $$ = CurFun.CurrentFunction; + CurFun.FunctionDone(); + CHECK_FOR_ERROR + }; //===----------------------------------------------------------------------===// // Rules to match Basic Blocks //===----------------------------------------------------------------------===// +OptSideEffect : /* empty */ { + $$ = false; + CHECK_FOR_ERROR + } + | SIDEEFFECT { + $$ = true; + CHECK_FOR_ERROR + }; + ConstValueRef : ESINT64VAL { // A reference to a direct constant $$ = ValID::create($1); + CHECK_FOR_ERROR } | EUINT64VAL { $$ = ValID::create($1); + CHECK_FOR_ERROR } | FPVAL { // Perhaps it's an FP constant? $$ = ValID::create($1); + CHECK_FOR_ERROR } - | TRUE { - $$ = ValID::create((int64_t)1); + | TRUETOK { + $$ = ValID::create(ConstantBool::getTrue()); + CHECK_FOR_ERROR } - | FALSE { - $$ = ValID::create((int64_t)0); + | FALSETOK { + $$ = ValID::create(ConstantBool::getFalse()); + CHECK_FOR_ERROR + } + | NULL_TOK { + $$ = ValID::createNull(); + CHECK_FOR_ERROR + } + | UNDEF { + $$ = ValID::createUndef(); + CHECK_FOR_ERROR + } + | ZEROINITIALIZER { // A vector zero constant. + $$ = ValID::createZeroInit(); + CHECK_FOR_ERROR + } + | '<' ConstVector '>' { // Nonempty unsized packed vector + const Type *ETy = (*$2)[0]->getType(); + int NumElements = $2->size(); + + PackedType* pt = PackedType::get(ETy, NumElements); + PATypeHolder* PTy = new PATypeHolder( + HandleUpRefs( + PackedType::get( + ETy, + NumElements) + ) + ); + + // Verify all elements are correct type! + for (unsigned i = 0; i < $2->size(); i++) { + if (ETy != (*$2)[i]->getType()) + GEN_ERROR("Element #" + utostr(i) + " is not of type '" + + ETy->getDescription() +"' as required!\nIt is of type '" + + (*$2)[i]->getType()->getDescription() + "'."); + } + + $$ = ValID::create(ConstantPacked::get(pt, *$2)); + delete PTy; delete $2; + CHECK_FOR_ERROR } -/* - | STRINGCONSTANT { // Quoted strings work too... especially for methods - $$ = ValID::create_conststr($1); + | ConstExpr { + $$ = ValID::create($1); + CHECK_FOR_ERROR } -*/ + | ASM_TOK OptSideEffect STRINGCONSTANT ',' STRINGCONSTANT { + char *End = UnEscapeLexed($3, true); + std::string AsmStr = std::string($3, End); + End = UnEscapeLexed($5, true); + std::string Constraints = std::string($5, End); + $$ = ValID::createInlineAsm(AsmStr, Constraints, $2); + free($3); + free($5); + CHECK_FOR_ERROR + }; -// ValueRef - A reference to a definition... -ValueRef : INTVAL { // Is it an integer reference...? +// SymbolicValueRef - Reference to one of two ways of symbolically refering to +// another value. +// +SymbolicValueRef : INTVAL { // Is it an integer reference...? $$ = ValID::create($1); + CHECK_FOR_ERROR } - | VAR_ID { // Is it a named reference...? + | Name { // Is it a named reference...? $$ = ValID::create($1); - } - | ConstValueRef { - $$ = $1; - } + CHECK_FOR_ERROR + }; + +// ValueRef - A reference to a definition... either constant or symbolic +ValueRef : SymbolicValueRef | ConstValueRef; + // ResolvedVal - a pair. This is used only in cases where the // type immediately preceeds the value reference, and allows complex constant // pool references (for things like: 'ret [2 x int] [ int 12, int 42]') -ResolvedVal : ExtendedConstVal { - $$ = $1; - } - | Types ValueRef { +ResolvedVal : Types ValueRef { $$ = getVal(*$1, $2); delete $1; - } - + CHECK_FOR_ERROR + }; BasicBlockList : BasicBlockList BasicBlock { - $1->getBasicBlocks().push_back($2); $$ = $1; + CHECK_FOR_ERROR } - | MethodHeader BasicBlock { // Do not allow methods with 0 basic blocks - $$ = $1; // in them... - $1->getBasicBlocks().push_back($2); - } + | FunctionHeader BasicBlock { // Do not allow functions with 0 basic blocks + $$ = $1; + CHECK_FOR_ERROR + }; // Basic blocks are terminated by branching instructions: // br, br/cc, switch, ret // -BasicBlock : InstructionList BBTerminatorInst { - $1->getInstList().push_back($2); +BasicBlock : InstructionList OptAssign BBTerminatorInst { + setValueName($3, $2); + CHECK_FOR_ERROR + InsertValue($3); + + $1->getInstList().push_back($3); InsertValue($1); $$ = $1; - } - | LABELSTR InstructionList BBTerminatorInst { - $2->getInstList().push_back($3); - setValueName($2, $1); - - InsertValue($2); - $$ = $2; - } + CHECK_FOR_ERROR + }; InstructionList : InstructionList Inst { $1->getInstList().push_back($2); $$ = $1; + CHECK_FOR_ERROR } | /* empty */ { - $$ = new BasicBlock(); - } + $$ = 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 + // referenced. + Function::BasicBlockListType &BBL = + CurFun.CurrentFunction->getBasicBlockList(); + BBL.splice(BBL.end(), BBL, $$); + CHECK_FOR_ERROR + } + | 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 + // referenced. + Function::BasicBlockListType &BBL = + CurFun.CurrentFunction->getBasicBlockList(); + BBL.splice(BBL.end(), BBL, $$); + CHECK_FOR_ERROR + }; BBTerminatorInst : RET ResolvedVal { // Return with a result... $$ = new ReturnInst($2); + CHECK_FOR_ERROR } | RET VOID { // Return with no result... $$ = new ReturnInst(); + CHECK_FOR_ERROR } | BR LABEL ValueRef { // Unconditional Branch... - $$ = new BranchInst(getVal(Type::LabelTy, $3)->castBasicBlockAsserting()); + BasicBlock* tmpBB = getBBVal($3); + CHECK_FOR_ERROR + $$ = new BranchInst(tmpBB); } // Conditional Branch... | BR BOOL ValueRef ',' LABEL ValueRef ',' LABEL ValueRef { - $$ = new BranchInst(getVal(Type::LabelTy, $6)->castBasicBlockAsserting(), - getVal(Type::LabelTy, $9)->castBasicBlockAsserting(), - 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), - getVal(Type::LabelTy, $6)->castBasicBlockAsserting()); + Value* tmpVal = getVal($2, $3); + CHECK_FOR_ERROR + BasicBlock* tmpBB = getBBVal($6); + CHECK_FOR_ERROR + SwitchInst *S = new SwitchInst(tmpVal, tmpBB, $8->size()); $$ = S; - list >::iterator I = $8->begin(), - end = $8->end(); - for (; I != end; ++I) - S->dest_push_back(I->first, I->second); + std::vector >::iterator I = $8->begin(), + E = $8->end(); + for (; I != E; ++I) { + if (ConstantInt *CI = dyn_cast(I->first)) + S->addCase(CI, I->second); + else + GEN_ERROR("Switch case is constant, but not a simple integer!"); + } + delete $8; + CHECK_FOR_ERROR } + | SWITCH IntType ValueRef ',' LABEL ValueRef '[' ']' { + 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 + } + | INVOKE OptCallingConv TypesV ValueRef '(' ValueRefListE ')' + TO LABEL ValueRef UNWIND LABEL ValueRef { + const PointerType *PFTy; + const FunctionType *Ty; + + if (!(PFTy = dyn_cast($3->get())) || + !(Ty = dyn_cast(PFTy->getElementType()))) { + // Pull out the types of all of the arguments... + std::vector ParamTypes; + if ($6) { + for (std::vector::iterator I = $6->begin(), E = $6->end(); + I != E; ++I) + ParamTypes.push_back((*I)->getType()); + } + + bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy; + if (isVarArg) ParamTypes.pop_back(); + + Ty = FunctionType::get($3->get(), ParamTypes, isVarArg); + PFTy = PointerType::get(Ty); + } + + Value *V = getVal(PFTy, $4); // Get the function we're calling... + 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? + $$ = new InvokeInst(V, Normal, Except, std::vector()); + } else { // Has arguments? + // Loop through FunctionType's arguments and ensure they are specified + // correctly! + // + FunctionType::param_iterator I = Ty->param_begin(); + FunctionType::param_iterator E = Ty->param_end(); + std::vector::iterator ArgI = $6->begin(), ArgE = $6->end(); + + for (; ArgI != ArgE && I != E; ++ArgI, ++I) + if ((*ArgI)->getType() != *I) + GEN_ERROR("Parameter " +(*ArgI)->getName()+ " is not of type '" + + (*I)->getDescription() + "'!"); + + if (I != E || (ArgI != ArgE && !Ty->isVarArg())) + GEN_ERROR("Invalid number of parameters detected!"); + + $$ = new InvokeInst(V, Normal, Except, *$6); + } + cast($$)->setCallingConv($2); + + delete $3; + delete $6; + CHECK_FOR_ERROR + } + | UNWIND { + $$ = new UnwindInst(); + CHECK_FOR_ERROR + } + | UNREACHABLE { + $$ = new UnreachableInst(); + CHECK_FOR_ERROR + }; + + JumpTable : JumpTable IntType ConstValueRef ',' LABEL ValueRef { $$ = $1; - ConstPoolVal *V = getVal($2, $3, true)->castConstantAsserting(); + Constant *V = cast(getValNonImprovising($2, $3)); + CHECK_FOR_ERROR if (V == 0) - ThrowException("May only switch on a constant pool value!"); + GEN_ERROR("May only switch on a constant pool value!"); - $$->push_back(make_pair(V, getVal($5, $6)->castBasicBlockAsserting())); + BasicBlock* tmpBB = getBBVal($6); + CHECK_FOR_ERROR + $$->push_back(std::make_pair(V, tmpBB)); } | IntType ConstValueRef ',' LABEL ValueRef { - $$ = new list >(); - ConstPoolVal *V = getVal($1, $2, true)->castConstantAsserting(); + $$ = new std::vector >(); + Constant *V = cast(getValNonImprovising($1, $2)); + CHECK_FOR_ERROR if (V == 0) - ThrowException("May only switch on a constant pool value!"); + GEN_ERROR("May only switch on a constant pool value!"); - $$->push_back(make_pair(V, getVal($4, $5)->castBasicBlockAsserting())); - } + BasicBlock* tmpBB = getBBVal($5); + CHECK_FOR_ERROR + $$->push_back(std::make_pair(V, tmpBB)); + }; Inst : OptAssign InstVal { - setValueName($2, $1); // Is this definition named?? if so, assign the name... - + // Is this definition named?? if so, assign the name... + setValueName($2, $1); + CHECK_FOR_ERROR InsertValue($2); $$ = $2; -} + CHECK_FOR_ERROR +}; PHIList : Types '[' ValueRef ',' ValueRef ']' { // Used for PHI nodes - $$ = new list >(); - $$->push_back(make_pair(getVal(*$1, $3), - getVal(Type::LabelTy, $5)->castBasicBlockAsserting())); + $$ = new std::list >(); + 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(make_pair(getVal($1->front().first->getType(), $4), - getVal(Type::LabelTy, $6)->castBasicBlockAsserting())); - } + 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 list(); + $$ = new std::vector(); $$->push_back($1); } | ValueRefList ',' ResolvedVal { $$ = $1; $1->push_back($3); - } + CHECK_FOR_ERROR + }; // ValueRefListE - Just like ValueRefList, except that it may also be empty! -ValueRefListE : ValueRefList | /*empty*/ { $$ = 0; } +ValueRefListE : ValueRefList | /*empty*/ { $$ = 0; }; -InstVal : BinaryOps Types ValueRef ',' ValueRef { - $$ = BinaryOperator::create($1, getVal(*$2, $3), getVal(*$2, $5)); +OptTailCall : TAIL CALL { + $$ = true; + CHECK_FOR_ERROR + } + | CALL { + $$ = false; + CHECK_FOR_ERROR + }; + +InstVal : ArithmeticOps Types ValueRef ',' ValueRef { + if (!(*$2)->isInteger() && !(*$2)->isFloatingPoint() && + !isa((*$2).get())) + GEN_ERROR( + "Arithmetic operator requires integer, FP, or packed operands!"); + if (isa((*$2).get()) && + ($1.opcode == Instruction::URem || + $1.opcode == Instruction::SRem || + $1.opcode == Instruction::FRem)) + GEN_ERROR("U/S/FRem not supported on packed types!"); + // Upgrade the opcode from obsolete versions before we do anything with it. + sanitizeOpCode($1,*$2); + CHECK_FOR_ERROR; + Value* val1 = getVal(*$2, $3); + CHECK_FOR_ERROR + Value* val2 = getVal(*$2, $5); + CHECK_FOR_ERROR + $$ = BinaryOperator::create($1.opcode, val1, val2); + if ($$ == 0) + GEN_ERROR("binary operator returned null!"); + delete $2; + } + | LogicalOps Types ValueRef ',' ValueRef { + if (!(*$2)->isIntegral()) { + if (!isa($2->get()) || + !cast($2->get())->getElementType()->isIntegral()) + GEN_ERROR("Logical operator requires integral operands!"); + } + Value* tmpVal1 = getVal(*$2, $3); + CHECK_FOR_ERROR + Value* tmpVal2 = getVal(*$2, $5); + CHECK_FOR_ERROR + $$ = BinaryOperator::create($1.opcode, tmpVal1, tmpVal2); + if ($$ == 0) + GEN_ERROR("binary operator returned null!"); + delete $2; + } + | SetCondOps Types ValueRef ',' ValueRef { + if(isa((*$2).get())) { + GEN_ERROR( + "PackedTypes currently not supported in setcc instructions!"); + } + Value* tmpVal1 = getVal(*$2, $3); + CHECK_FOR_ERROR + Value* tmpVal2 = getVal(*$2, $5); + CHECK_FOR_ERROR + $$ = new SetCondInst($1.opcode, tmpVal1, tmpVal2); if ($$ == 0) - ThrowException("binary operator returned null!"); + GEN_ERROR("binary operator returned null!"); delete $2; } - | UnaryOps ResolvedVal { - $$ = UnaryOperator::create($1, $2); + | NOT ResolvedVal { + std::cerr << "WARNING: Use of eliminated 'not' instruction:" + << " Replacing with 'xor'.\n"; + + Value *Ones = ConstantIntegral::getAllOnesValue($2->getType()); + if (Ones == 0) + GEN_ERROR("Expected integral type for not instruction!"); + + $$ = BinaryOperator::create(Instruction::Xor, $2, Ones); if ($$ == 0) - ThrowException("unary operator returned null!"); + GEN_ERROR("Could not create a xor instruction!"); + CHECK_FOR_ERROR } | ShiftOps ResolvedVal ',' ResolvedVal { if ($4->getType() != Type::UByteTy) - ThrowException("Shift amount must be ubyte!"); - $$ = new ShiftInst($1, $2, $4); + GEN_ERROR("Shift amount must be ubyte!"); + if (!$2->getType()->isInteger()) + GEN_ERROR("Shift constant expression requires integer operand!"); + $$ = new ShiftInst($1.opcode, $2, $4); + CHECK_FOR_ERROR } | CAST ResolvedVal TO Types { + if (!$4->get()->isFirstClassType()) + GEN_ERROR("cast instruction to a non-primitive type: '" + + $4->get()->getDescription() + "'!"); $$ = new CastInst($2, *$4); delete $4; + CHECK_FOR_ERROR } - | PHI PHIList { + | SELECT ResolvedVal ',' ResolvedVal ',' ResolvedVal { + if ($2->getType() != Type::BoolTy) + GEN_ERROR("select condition must be boolean!"); + if ($4->getType() != $6->getType()) + GEN_ERROR("select value types should match!"); + $$ = new SelectInst($2, $4, $6); + CHECK_FOR_ERROR + } + | VAARG ResolvedVal ',' Types { + NewVarArgs = true; + $$ = new VAArgInst($2, *$4); + delete $4; + CHECK_FOR_ERROR + } + | VAARG_old ResolvedVal ',' Types { + ObsoleteVarArgs = true; + const Type* ArgTy = $2->getType(); + Function* NF = CurModule.CurrentModule-> + getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0); + + //b = vaarg a, t -> + //foo = alloca 1 of t + //bar = vacopy a + //store bar -> foo + //b = vaarg foo, t + AllocaInst* foo = new AllocaInst(ArgTy, 0, "vaarg.fix"); + CurBB->getInstList().push_back(foo); + CallInst* bar = new CallInst(NF, $2); + CurBB->getInstList().push_back(bar); + CurBB->getInstList().push_back(new StoreInst(bar, foo)); + $$ = new VAArgInst(foo, *$4); + delete $4; + CHECK_FOR_ERROR + } + | VANEXT_old ResolvedVal ',' Types { + ObsoleteVarArgs = true; + const Type* ArgTy = $2->getType(); + Function* NF = CurModule.CurrentModule-> + getOrInsertFunction("llvm.va_copy", ArgTy, ArgTy, (Type *)0); + + //b = vanext a, t -> + //foo = alloca 1 of t + //bar = vacopy a + //store bar -> foo + //tmp = vaarg foo, t + //b = load foo + AllocaInst* foo = new AllocaInst(ArgTy, 0, "vanext.fix"); + CurBB->getInstList().push_back(foo); + CallInst* bar = new CallInst(NF, $2); + CurBB->getInstList().push_back(bar); + CurBB->getInstList().push_back(new StoreInst(bar, foo)); + Instruction* tmp = new VAArgInst(foo, *$4); + CurBB->getInstList().push_back(tmp); + $$ = new LoadInst(foo); + delete $4; + CHECK_FOR_ERROR + } + | EXTRACTELEMENT ResolvedVal ',' ResolvedVal { + if (!ExtractElementInst::isValidOperands($2, $4)) + GEN_ERROR("Invalid extractelement operands!"); + $$ = new ExtractElementInst($2, $4); + CHECK_FOR_ERROR + } + | INSERTELEMENT ResolvedVal ',' ResolvedVal ',' ResolvedVal { + if (!InsertElementInst::isValidOperands($2, $4, $6)) + GEN_ERROR("Invalid insertelement operands!"); + $$ = new InsertElementInst($2, $4, $6); + CHECK_FOR_ERROR + } + | SHUFFLEVECTOR ResolvedVal ',' ResolvedVal ',' ResolvedVal { + if (!ShuffleVectorInst::isValidOperands($2, $4, $6)) + GEN_ERROR("Invalid shufflevector operands!"); + $$ = new ShuffleVectorInst($2, $4, $6); + CHECK_FOR_ERROR + } + | PHI_TOK PHIList { const Type *Ty = $2->front().first->getType(); + if (!Ty->isFirstClassType()) + GEN_ERROR("PHI node operands must be of first class type!"); $$ = new PHINode(Ty); + ((PHINode*)$$)->reserveOperandSpace($2->size()); while ($2->begin() != $2->end()) { if ($2->front().first->getType() != Ty) - ThrowException("All elements of a PHI node must be of the same type!"); - ((PHINode*)$$)->addIncoming($2->front().first, $2->front().second); + GEN_ERROR("All elements of a PHI node must be of the same type!"); + cast($$)->addIncoming($2->front().first, $2->front().second); $2->pop_front(); } delete $2; // Free the list... - } - | CALL TypesV ValueRef '(' ValueRefListE ')' { - const MethodType *Ty; + CHECK_FOR_ERROR + } + | OptTailCall OptCallingConv TypesV ValueRef '(' ValueRefListE ')' { + const PointerType *PFTy; + const FunctionType *Ty; - if (!(Ty = (*$2)->dyncastMethodType())) { + if (!(PFTy = dyn_cast($3->get())) || + !(Ty = dyn_cast(PFTy->getElementType()))) { // Pull out the types of all of the arguments... - vector ParamTypes; - for (list::iterator I = $5->begin(), E = $5->end(); I != E; ++I) - ParamTypes.push_back((*I)->getType()); - Ty = MethodType::get(*$2, ParamTypes); + std::vector ParamTypes; + if ($6) { + for (std::vector::iterator I = $6->begin(), E = $6->end(); + I != E; ++I) + ParamTypes.push_back((*I)->getType()); + } + + bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy; + if (isVarArg) ParamTypes.pop_back(); + + if (!(*$3)->isFirstClassType() && *$3 != Type::VoidTy) + GEN_ERROR("LLVM functions cannot return aggregate types!"); + + Ty = FunctionType::get($3->get(), ParamTypes, isVarArg); + PFTy = PointerType::get(Ty); } - delete $2; - Value *V = getVal(Ty, $3); // Get the method we're calling... + Value *V = getVal(PFTy, $4); // Get the function we're calling... + CHECK_FOR_ERROR // Create the call node... - if (!$5) { // Has no arguments? - $$ = new CallInst(V->castMethodAsserting(), vector()); + if (!$6) { // 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!"); + + $$ = new CallInst(V, std::vector()); } else { // Has arguments? - // Loop through MethodType's arguments and ensure they are specified + // Loop through FunctionType's arguments and ensure they are specified // correctly! // - MethodType::ParamTypes::const_iterator I = Ty->getParamTypes().begin(); - MethodType::ParamTypes::const_iterator E = Ty->getParamTypes().end(); - list::iterator ArgI = $5->begin(), ArgE = $5->end(); + FunctionType::param_iterator I = Ty->param_begin(); + FunctionType::param_iterator E = Ty->param_end(); + std::vector::iterator ArgI = $6->begin(), ArgE = $6->end(); for (; ArgI != ArgE && I != E; ++ArgI, ++I) - if ((*ArgI)->getType() != *I) - ThrowException("Parameter " +(*ArgI)->getName()+ " is not of type '" + - (*I)->getName() + "'!"); + if ((*ArgI)->getType() != *I) + GEN_ERROR("Parameter " +(*ArgI)->getName()+ " is not of type '" + + (*I)->getDescription() + "'!"); if (I != E || (ArgI != ArgE && !Ty->isVarArg())) - ThrowException("Invalid number of parameters detected!"); + GEN_ERROR("Invalid number of parameters detected!"); - $$ = new CallInst(V->castMethodAsserting(), - vector($5->begin(), $5->end())); + $$ = new CallInst(V, *$6); } - delete $5; + cast($$)->setTailCall($1); + cast($$)->setCallingConv($2); + delete $3; + delete $6; + CHECK_FOR_ERROR } | MemoryInst { $$ = $1; + CHECK_FOR_ERROR + }; + + +// IndexList - List of indices for GEP based instructions... +IndexList : ',' ValueRefList { + $$ = $2; + CHECK_FOR_ERROR + } | /* empty */ { + $$ = new std::vector(); + CHECK_FOR_ERROR + }; + +OptVolatile : VOLATILE { + $$ = true; + CHECK_FOR_ERROR } + | /* empty */ { + $$ = false; + CHECK_FOR_ERROR + }; + -// UByteList - List of ubyte values for load and store instructions -UByteList : ',' ConstVector { - $$ = $2; -} | /* empty */ { - $$ = new vector(); -} -MemoryInst : MALLOC Types { - $$ = new MallocInst(PointerType::get(*$2)); +MemoryInst : MALLOC Types OptCAlign { + $$ = new MallocInst(*$2, 0, $3); delete $2; + CHECK_FOR_ERROR } - | MALLOC Types ',' UINT ValueRef { - if (!(*$2)->isArrayType() || ((const ArrayType*)$2->get())->isSized()) - ThrowException("Trying to allocate " + (*$2)->getName() + - " as unsized array!"); - const Type *Ty = PointerType::get(*$2); - $$ = new MallocInst(Ty, getVal($4, $5)); + | MALLOC Types ',' UINT ValueRef OptCAlign { + Value* tmpVal = getVal($4, $5); + CHECK_FOR_ERROR + $$ = new MallocInst(*$2, tmpVal, $6); delete $2; } - | ALLOCA Types { - $$ = new AllocaInst(PointerType::get(*$2)); + | ALLOCA Types OptCAlign { + $$ = new AllocaInst(*$2, 0, $3); delete $2; + CHECK_FOR_ERROR } - | ALLOCA Types ',' UINT ValueRef { - if (!(*$2)->isArrayType() || ((const ArrayType*)$2->get())->isSized()) - ThrowException("Trying to allocate " + (*$2)->getName() + - " as unsized array!"); - const Type *Ty = PointerType::get(*$2); - Value *ArrSize = getVal($4, $5); - $$ = new AllocaInst(Ty, ArrSize); + | ALLOCA Types ',' UINT ValueRef OptCAlign { + Value* tmpVal = getVal($4, $5); + CHECK_FOR_ERROR + $$ = new AllocaInst(*$2, tmpVal, $6); delete $2; } | FREE ResolvedVal { - if (!$2->getType()->isPointerType()) - ThrowException("Trying to free nonpointer type " + - $2->getType()->getName() + "!"); + if (!isa($2->getType())) + GEN_ERROR("Trying to free nonpointer type " + + $2->getType()->getDescription() + "!"); $$ = new FreeInst($2); + CHECK_FOR_ERROR } - | LOAD Types ValueRef UByteList { - if (!(*$2)->isPointerType()) - ThrowException("Can't load from nonpointer type: " + (*$2)->getName()); - if (LoadInst::getIndexedType(*$2, *$4) == 0) - ThrowException("Invalid indices for load instruction!"); - - $$ = new LoadInst(getVal(*$2, $3), *$4); - delete $4; // Free the vector... - delete $2; + | OptVolatile LOAD Types ValueRef { + if (!isa($3->get())) + GEN_ERROR("Can't load from nonpointer type: " + + (*$3)->getDescription()); + if (!cast($3->get())->getElementType()->isFirstClassType()) + GEN_ERROR("Can't load from pointer of non-first-class type: " + + (*$3)->getDescription()); + 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()); + if (!PT) + GEN_ERROR("Can't store to a nonpointer type: " + + (*$5)->getDescription()); + const Type *ElTy = PT->getElementType(); + if (ElTy != $3->getType()) + GEN_ERROR("Can't store '" + $3->getType()->getDescription() + + "' into space of type '" + ElTy->getDescription() + "'!"); + + Value* tmpVal = getVal(*$5, $6); + CHECK_FOR_ERROR + $$ = new StoreInst($3, tmpVal, $1); + delete $5; } - | STORE ResolvedVal ',' Types ValueRef UByteList { - if (!(*$4)->isPointerType()) - ThrowException("Can't store to a nonpointer type: " + (*$4)->getName()); - const Type *ElTy = StoreInst::getIndexedType(*$4, *$6); - if (ElTy == 0) - ThrowException("Can't store into that field list!"); - if (ElTy != $2->getType()) - ThrowException("Can't store '" + $2->getType()->getName() + - "' into space of type '" + ElTy->getName() + "'!"); - $$ = new StoreInst($2, getVal(*$4, $5), *$6); - delete $4; delete $6; - } - | GETELEMENTPTR Types ValueRef UByteList { - if (!(*$2)->isPointerType()) - ThrowException("getelementptr insn requires pointer operand!"); + | GETELEMENTPTR Types ValueRef IndexList { + if (!isa($2->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($2->get(), $4->begin(), $4->end()), + GTE = gep_type_end($2->get(), $4->begin(), $4->end()); + for (unsigned i = 0, e = $4->size(); i != e && GTI != GTE; ++i, ++GTI) + if (isa(*GTI)) // Only change struct indices + if (ConstantInt *CUI = dyn_cast((*$4)[i])) + if (CUI->getType() == Type::UByteTy) + (*$4)[i] = ConstantExpr::getCast(CUI, Type::UIntTy); + if (!GetElementPtrInst::getIndexedType(*$2, *$4, true)) - ThrowException("Can't get element ptr '" + (*$2)->getName() + "'!"); - $$ = new GetElementPtrInst(getVal(*$2, $3), *$4); - delete $2; delete $4; - } + GEN_ERROR("Invalid getelementptr indices for type '" + + (*$2)->getDescription()+ "'!"); + Value* tmpVal = getVal(*$2, $3); + CHECK_FOR_ERROR + $$ = new GetElementPtrInst(tmpVal, *$4); + delete $2; + delete $4; + }; + %% + +void llvm::GenerateError(const std::string &message, int LineNo) { + if (LineNo == -1) LineNo = llvmAsmlineno; + // TODO: column number in exception + if (TheParseError) + TheParseError->setError(CurFilename, message, LineNo); + TriggerError = 1; +} + int yyerror(const char *ErrorMsg) { - ThrowException(string("Parse error: ") + ErrorMsg); + std::string where + = std::string((CurFilename == "-") ? std::string("") : CurFilename) + + ":" + utostr((unsigned) llvmAsmlineno) + ": "; + std::string errMsg = std::string(ErrorMsg) + "\n" + where + " while reading "; + if (yychar == YYEMPTY || yychar == 0) + errMsg += "end-of-file."; + else + errMsg += "token: '" + std::string(llvmAsmtext, llvmAsmleng) + "'"; + GenerateError(errMsg); return 0; } Index: llvm/lib/AsmParser/llvmAsmParser.y.cvs diff -u llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.24 llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.24.2.1 --- llvm/lib/AsmParser/llvmAsmParser.y.cvs:1.24 Thu Nov 2 14:25:49 2006 +++ llvm/lib/AsmParser/llvmAsmParser.y.cvs Wed Nov 8 11:51:54 2006 @@ -2102,8 +2102,8 @@ }; FnDeclareLinkage: /*default*/ | - DLLIMPORT { CurFun.Linkage = GlobalValue::DLLImportLinkage } | - EXTERN_WEAK { CurFun.Linkage = GlobalValue::DLLImportLinkage }; + DLLIMPORT { CurFun.Linkage = GlobalValue::DLLImportLinkage; } | + EXTERN_WEAK { CurFun.Linkage = GlobalValue::DLLImportLinkage; }; FunctionProto : DECLARE { CurFun.isDeclare = true; } FnDeclareLinkage FunctionHeaderH { $$ = CurFun.CurrentFunction; From evan.cheng at apple.com Wed Nov 8 14:33:54 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 8 Nov 2006 14:33:54 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp Message-ID: <200611082033.kA8KXsmx007592@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/Sparc: SparcISelDAGToDAG.cpp updated: 1.113 -> 1.114 --- Log message: Match tblegen changes. --- Diffs of the changes: (+7 -6) SparcISelDAGToDAG.cpp | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) Index: llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp diff -u llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp:1.113 llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp:1.114 --- llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp:1.113 Mon Oct 30 02:02:39 2006 +++ llvm/lib/Target/Sparc/SparcISelDAGToDAG.cpp Wed Nov 8 14:33:40 2006 @@ -968,8 +968,9 @@ SDNode *Select(SDOperand Op); // Complex Pattern Selectors. - bool SelectADDRrr(SDOperand N, SDOperand &R1, SDOperand &R2); - bool SelectADDRri(SDOperand N, SDOperand &Base, SDOperand &Offset); + bool SelectADDRrr(SDOperand Op, SDOperand N, SDOperand &R1, SDOperand &R2); + bool SelectADDRri(SDOperand Op, SDOperand N, SDOperand &Base, + SDOperand &Offset); /// InstructionSelectBasicBlock - This callback is invoked by /// SelectionDAGISel when it has created a SelectionDAG for us to codegen. @@ -997,8 +998,8 @@ ScheduleAndEmitDAG(DAG); } -bool SparcDAGToDAGISel::SelectADDRri(SDOperand Addr, SDOperand &Base, - SDOperand &Offset) { +bool SparcDAGToDAGISel::SelectADDRri(SDOperand Op, SDOperand Addr, + SDOperand &Base, SDOperand &Offset) { if (FrameIndexSDNode *FIN = dyn_cast(Addr)) { Base = CurDAG->getTargetFrameIndex(FIN->getIndex(), MVT::i32); Offset = CurDAG->getTargetConstant(0, MVT::i32); @@ -1038,8 +1039,8 @@ return true; } -bool SparcDAGToDAGISel::SelectADDRrr(SDOperand Addr, SDOperand &R1, - SDOperand &R2) { +bool SparcDAGToDAGISel::SelectADDRrr(SDOperand Op, SDOperand Addr, + SDOperand &R1, SDOperand &R2) { if (Addr.getOpcode() == ISD::FrameIndex) return false; if (Addr.getOpcode() == ISD::TargetExternalSymbol || Addr.getOpcode() == ISD::TargetGlobalAddress) From clattner at apple.com Wed Nov 8 15:24:45 2006 From: clattner at apple.com (Chris Lattner) Date: Wed, 8 Nov 2006 13:24:45 -0800 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp RegAllocLinearScan.cpp In-Reply-To: <16e5fdf90611080924k5bbebaecncb8d339d7134c8a7@mail.gmail.com> References: <200611071226.kA7CQ5v8011213@zion.cs.uiuc.edu> <4551FFEC.6070506@cs.uiuc.edu> <16e5fdf90611080924k5bbebaecncb8d339d7134c8a7@mail.gmail.com> Message-ID: On Nov 8, 2006, at 9:24 AM, Bill Wendling wrote: > On 11/8/06, Jim Laskey wrote: >> >> John, >> >> Both are defined on Darwin, FLT_MAX in float.h and HUGE_VALF in >> math.h. >> However, neither header seems to be based on a BSD header. I choose >> HUGE_VALF because it was also defined in the LINUX and FREEBSD math.h >> headers (seemed like confirmation to me.) I'll wait for Chris to >> make the >> call. (might uses a #ifndef HUGE_VALF thingame.) >> > Would it be possible to use std::numeric_limits::infinity in > instead? I think that had some other problems, it is broken in some version of GCC, IIRC. -Chris From reid at x10sys.com Wed Nov 8 15:28:08 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 8 Nov 2006 15:28:08 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Reader/Reader.cpp Reader.h Message-ID: <200611082128.kA8LS8B2008807@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Reader: Reader.cpp updated: 1.203 -> 1.204 Reader.h updated: 1.35 -> 1.36 --- Log message: Bump the bytecode version number to 7. Implement upgrade of version 6 and version 6 bytecode. --- Diffs of the changes: (+106 -28) Reader.cpp | 110 +++++++++++++++++++++++++++++++++++++++++++++++++------------ Reader.h | 24 +++++++++---- 2 files changed, 106 insertions(+), 28 deletions(-) Index: llvm/lib/Bytecode/Reader/Reader.cpp diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.203 llvm/lib/Bytecode/Reader/Reader.cpp:1.204 --- llvm/lib/Bytecode/Reader/Reader.cpp:1.203 Wed Nov 8 00:47:33 2006 +++ llvm/lib/Bytecode/Reader/Reader.cpp Wed Nov 8 15:27:54 2006 @@ -574,7 +574,7 @@ // instruction generation should be used, but with the new Opcode value. // Instruction* -BytecodeReader::handleObsoleteOpcodes( +BytecodeReader::upgradeInstrOpcodes( unsigned &Opcode, ///< The old opcode, possibly updated by this function std::vector &Oprnds, ///< The operands to the instruction unsigned &iType, ///< The type code from the bytecode file @@ -583,24 +583,53 @@ ) { // First, short circuit this if no conversion is required. When signless - // instructions were implemented the entire opcode sequence was revised so - // we key on this first which means that the opcode value read is the one - // we should use. - if (!hasSignlessInstructions) + // instructions were implemented the entire opcode sequence was revised in + // two stages: first Div/Rem became signed, then Shr/Cast/Setcc became + // signed. If all of these instructions are signed then we don't have to + // upgrade the opcode. + if (!hasSignlessDivRem && !hasSignlessShrCastSetcc) return 0; // The opcode is fine the way it is. + // If this is a bytecode format that did not include the unreachable + // instruction, bump up the opcode number to adjust it. + if (hasNoUnreachableInst) + if (Opcode >= 6 && Opcode < 62) + ++Opcode; + + // If this is bytecode version 6, that only had signed Rem and Div + // instructions, then we must compensate for those two instructions only. + // So that the switch statement below works, we're trying to turn this into + // a version 5 opcode. To do that we must adjust the opcode to 10 (Div) if its + // any of the UDiv, SDiv or FDiv instructions; or, adjust the opcode to + // 11 (Rem) if its any of the URem, SRem, or FRem instructions; or, simply + // decrement the instruction code if its beyond FRem. + if (!hasSignlessDivRem) { + // If its one of the signed Div/Rem opcodes, its fine the way it is + if (Opcode >= 10 && Opcode <= 12) // UDiv through FDiv + Opcode = 10; // Div + else if (Opcode >=13 && Opcode <= 15) // URem through FRem + Opcode = 11; // Rem + else if (Opcode >= 16 && Opcode <= 35) // And through Shr + // Adjust for new instruction codes + Opcode -= 4; + else if (Opcode >= 36 && Opcode <= 42) // Everything after Select + // In vers 6 bytecode we eliminated the placeholders for the obsolete + // VAARG and VANEXT instructions. Consequently those two slots were + // filled starting with Select (36) which was 34. So now we only need + // to subtract two. This circumvents hitting opcodes 32 and 33 + Opcode -= 2; + else { // Opcode < 10 or > 42 + // No upgrade necessary. + return 0; + } + } + // Declare the resulting instruction we might build. In general we just // change the Opcode argument but in a few cases we need to generate the // Instruction here because the upgrade case is significantly different from // the normal case. Instruction *Result = 0; - // If this is a bytecode format that did not include the unreachable - // instruction, bump up the opcode number to adjust it. - if (hasNoUnreachableInst) - if (Opcode >= Instruction::Unreachable && Opcode < 62) - ++Opcode; - // We're dealing with an upgrade situation. For each of the opcode values, // perform the necessary conversion. switch (Opcode) { @@ -899,7 +928,7 @@ // Make the necessary adjustments for dealing with backwards compatibility // of opcodes. Instruction* Result = - handleObsoleteOpcodes(Opcode, Oprnds, iType, InstTy, BB); + upgradeInstrOpcodes(Opcode, Oprnds, iType, InstTy, BB); // We have enough info to inform the handler now. if (Handler) @@ -1636,13 +1665,43 @@ // values used after ver 6. bytecode format. The operands are provided to the // function so that decisions based on the operand type can be made when // auto-upgrading obsolete opcodes to the new ones. -// NOTE: This code needs to be kept synchronized with handleObsoleteOpcodes. +// NOTE: This code needs to be kept synchronized with upgradeInstrOpcodes. // We can't use that function because of that functions argument requirements. // This function only deals with the subset of opcodes that are applicable to -// constant expressions and is therefore simpler than handleObsoleteOpcodes. -inline unsigned fixCEOpcodes( +// constant expressions and is therefore simpler than upgradeInstrOpcodes. +inline unsigned BytecodeReader::upgradeCEOpcodes( unsigned Opcode, const std::vector &ArgVec ) { + // Determine if no upgrade necessary + if (!hasSignlessDivRem && !hasSignlessShrCastSetcc) + return Opcode; + +#if 0 + // If this is a bytecode format that did not include the unreachable + // instruction, bump up the opcode number to adjust it. + if (hasNoUnreachableInst) + if (Opcode >= 6 && Opcode < 62) + ++Opcode; +#endif + + // If this is bytecode version 6, that only had signed Rem and Div + // instructions, then we must compensate for those two instructions only. + // So that the switch statement below works, we're trying to turn this into + // a version 5 opcode. To do that we must adjust the opcode to 10 (Div) if its + // any of the UDiv, SDiv or FDiv instructions; or, adjust the opcode to + // 11 (Rem) if its any of the URem, SRem, or FRem instructions; or, simply + // decrement the instruction code if its beyond FRem. + if (!hasSignlessDivRem) { + // If its one of the signed Div/Rem opcodes, its fine the way it is + if (Opcode >= 10 && Opcode <= 12) // UDiv through FDiv + Opcode = 10; // Div + else if (Opcode >=13 && Opcode <= 15) // URem through FRem + Opcode = 11; // Rem + else if (Opcode > 15) // Everything above FRem + // Adjust for new instruction codes + Opcode -= 4; + } + switch (Opcode) { default: // Pass Through // If we don't match any of the cases here then the opcode is fine the @@ -1792,8 +1851,7 @@ } // Handle backwards compatibility for the opcode numbers - if (hasSignlessInstructions) - Opcode = fixCEOpcodes(Opcode, ArgVec); + Opcode = upgradeCEOpcodes(Opcode, ArgVec); // Construct a ConstantExpr of the appropriate kind if (isExprNumArgs == 1) { // All one-operand expressions @@ -2567,7 +2625,8 @@ hasNoUndefValue = false; hasNoFlagsForFunctions = false; hasNoUnreachableInst = false; - hasSignlessInstructions = false; + hasSignlessDivRem = false; + hasSignlessShrCastSetcc = false; // Determine which backwards compatibility flags to set based on the // bytecode file's version number @@ -2645,17 +2704,26 @@ // FALL THROUGH case 5: // 1.4 (Released) + // In version 6, the Div and Rem instructions were converted to their + // signed and floating point counterparts: UDiv, SDiv, FDiv, URem, SRem, + // and FRem. Versions prior to 6 need to indicate that they have the + // signless Div and Rem instructions. + hasSignlessDivRem = true; + + // FALL THROUGH + + case 6: // Signless Rem & Div Implementation (1.9 release) // In version 5 and prior, instructions were signless while integer types // were signed. In version 6, instructions became signed and types became // signless. For example in version 5 we have the DIV instruction but in // version 6 we have FDIV, SDIV and UDIV to replace it. This caused a // renumbering of the instruction codes in version 6 that must be dealt with // when reading old bytecode files. - hasSignlessInstructions = true; + hasSignlessShrCastSetcc = true; // FALL THROUGH - - case 6: // SignlessTypes Implementation (1.9 release) + + case 7: break; default: Index: llvm/lib/Bytecode/Reader/Reader.h diff -u llvm/lib/Bytecode/Reader/Reader.h:1.35 llvm/lib/Bytecode/Reader/Reader.h:1.36 --- llvm/lib/Bytecode/Reader/Reader.h:1.35 Thu Oct 26 01:15:43 2006 +++ llvm/lib/Bytecode/Reader/Reader.h Wed Nov 8 15:27:54 2006 @@ -230,7 +230,7 @@ /// the instruction. This function handles all *abnormal* cases for /// instruction generation based on obsolete opcode values. The normal cases /// are handled by the ParseInstruction function. - Instruction* handleObsoleteOpcodes( + Instruction* upgradeInstrOpcodes( unsigned &opcode, ///< The old opcode, possibly updated by this function std::vector &Oprnds, ///< The operands to the instruction unsigned &iType, ///< The type code from the bytecode file @@ -238,6 +238,13 @@ BasicBlock* BB ///< The basic block to insert into, if we need to ); + /// @brief Convert previous opcode values for ConstantExpr into the current + /// value. + unsigned upgradeCEOpcodes( + unsigned Opcode, ///< Opcode read from bytecode + const std::vector &ArgVec ///< Arguments of instruction + ); + /// @brief Parse a single instruction. void ParseInstruction( std::vector& Args, ///< The arguments to be filled in @@ -348,12 +355,15 @@ // unreachable instruction. bool hasNoUnreachableInst; - // In version 5 and prior, instructions were signless. In version 6, - // instructions became signed. For example in version 5 we have the DIV - // instruction but in version 6 we have FDIV, SDIV and UDIV to replace it. - // This causes a renumbering of the instruction codes in version 6 that must - // be dealt with when reading old bytecode files. - bool hasSignlessInstructions; + // In version 6, the Div and Rem instructions were converted to be the + // signed instructions UDiv, SDiv, URem and SRem. This flag will be true if + // the Div and Rem instructions are signless (ver 5 and prior). + bool hasSignlessDivRem; + + // In version 7, the Shr, Cast and Setcc instructions changed to their + // signed counterparts. This flag will be true if these instructions are + // signless (version 6 and prior). + bool hasSignlessShrCastSetcc; /// In release 1.7 we changed intrinsic functions to not be overloaded. There /// is no bytecode change for this, but to optimize the auto-upgrade of calls From reid at x10sys.com Wed Nov 8 15:28:44 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 8 Nov 2006 15:28:44 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Bytecode/ver6.ll ver6.ll.bc Message-ID: <200611082128.kA8LSi4n008835@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Bytecode: ver6.ll added (r1.1) ver6.ll.bc added (r1.1) --- Log message: Ensure we don't regress on reading version 6 bytecode. --- Diffs of the changes: (+2 -0) ver6.ll | 2 ++ ver6.ll.bc | 0 2 files changed, 2 insertions(+) Index: llvm/test/Regression/Bytecode/ver6.ll diff -c /dev/null llvm/test/Regression/Bytecode/ver6.ll:1.1 *** /dev/null Wed Nov 8 15:28:40 2006 --- llvm/test/Regression/Bytecode/ver6.ll Wed Nov 8 15:28:30 2006 *************** *** 0 **** --- 1,2 ---- + ; Just see if we can disassemble the ver6.ll.bc bc file for upgrade purposes. + ; RUN: llvm-dis < %s.bc | llvm-as | llc -o /dev/null -f -march=c Index: llvm/test/Regression/Bytecode/ver6.ll.bc From evan.cheng at apple.com Wed Nov 8 17:01:24 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 8 Nov 2006 17:01:24 -0600 Subject: [llvm-commits] CVS: llvm/utils/TableGen/DAGISelEmitter.cpp Message-ID: <200611082301.kA8N1O5C010265@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: DAGISelEmitter.cpp updated: 1.280 -> 1.281 --- Log message: Divide select methods into groups by SelectionDAG node opcodes (ISD::ADD, X86ISD::CMP, etc.) instead of SDNode names (add, x86cmp, etc). We now allow multiple SDNodes to map to the same SelectionDAG node (e.g. store, indexed store). --- Diffs of the changes: (+35 -46) DAGISelEmitter.cpp | 81 ++++++++++++++++++++++------------------------------- 1 files changed, 35 insertions(+), 46 deletions(-) Index: llvm/utils/TableGen/DAGISelEmitter.cpp diff -u llvm/utils/TableGen/DAGISelEmitter.cpp:1.280 llvm/utils/TableGen/DAGISelEmitter.cpp:1.281 --- llvm/utils/TableGen/DAGISelEmitter.cpp:1.280 Wed Nov 8 14:31:10 2006 +++ llvm/utils/TableGen/DAGISelEmitter.cpp Wed Nov 8 17:01:03 2006 @@ -3374,19 +3374,16 @@ OS << std::string(Indent-2, ' ') << "}\n"; } +static std::string getOpcodeName(Record *Op, DAGISelEmitter &ISE) { + const SDNodeInfo &OpcodeInfo = ISE.getSDNodeInfo(Op); + return OpcodeInfo.getEnumName(); +} - -namespace { - /// CompareByRecordName - An ordering predicate that implements less-than by - /// comparing the names records. - struct CompareByRecordName { - bool operator()(const Record *LHS, const Record *RHS) const { - // Sort by name first. - if (LHS->getName() < RHS->getName()) return true; - // If both names are equal, sort by pointer. - return LHS->getName() == RHS->getName() && LHS < RHS; - } - }; +static std::string getLegalCName(std::string OpName) { + std::string::size_type pos = OpName.find("::"); + if (pos != std::string::npos) + OpName.replace(pos, 2, "_"); + return OpName; } void DAGISelEmitter::EmitInstructionSelector(std::ostream &OS) { @@ -3394,23 +3391,25 @@ if (!InstNS.empty()) InstNS += "::"; // Group the patterns by their top-level opcodes. - std::map, - CompareByRecordName> PatternsByOpcode; + std::map > PatternsByOpcode; // All unique target node emission functions. std::map EmitFunctions; for (unsigned i = 0, e = PatternsToMatch.size(); i != e; ++i) { TreePatternNode *Node = PatternsToMatch[i].getSrcPattern(); if (!Node->isLeaf()) { - PatternsByOpcode[Node->getOperator()].push_back(&PatternsToMatch[i]); + PatternsByOpcode[getOpcodeName(Node->getOperator(), *this)]. + push_back(&PatternsToMatch[i]); } else { const ComplexPattern *CP; if (dynamic_cast(Node->getLeafValue())) { - PatternsByOpcode[getSDNodeNamed("imm")].push_back(&PatternsToMatch[i]); + PatternsByOpcode[getOpcodeName(getSDNodeNamed("imm"), *this)]. + push_back(&PatternsToMatch[i]); } else if ((CP = NodeGetComplexPattern(Node, *this))) { std::vector OpNodes = CP->getRootNodes(); for (unsigned j = 0, e = OpNodes.size(); j != e; j++) { - PatternsByOpcode[OpNodes[j]] - .insert(PatternsByOpcode[OpNodes[j]].begin(), &PatternsToMatch[i]); + PatternsByOpcode[getOpcodeName(OpNodes[j], *this)] + .insert(PatternsByOpcode[getOpcodeName(OpNodes[j], *this)].begin(), + &PatternsToMatch[i]); } } else { std::cerr << "Unrecognized opcode '"; @@ -3432,11 +3431,10 @@ // Emit one Select_* method for each top-level opcode. We do this instead of // emitting one giant switch statement to support compilers where this will // result in the recursive functions taking less stack space. - for (std::map, - CompareByRecordName>::iterator PBOI = PatternsByOpcode.begin(), - E = PatternsByOpcode.end(); PBOI != E; ++PBOI) { - const std::string &OpName = PBOI->first->getName(); - const SDNodeInfo &OpcodeInfo = getSDNodeInfo(PBOI->first); + for (std::map >::iterator + PBOI = PatternsByOpcode.begin(), E = PatternsByOpcode.end(); + PBOI != E; ++PBOI) { + const std::string &OpName = PBOI->first; std::vector &PatternsOfOp = PBOI->second; assert(!PatternsOfOp.empty() && "No patterns but map has entry?"); @@ -3451,8 +3449,6 @@ for (unsigned i = 0, e = PatternsOfOp.size(); i != e; ++i) { PatternToMatch *Pat = PatternsOfOp[i]; TreePatternNode *SrcPat = Pat->getSrcPattern(); - if (OpcodeInfo.getNumResults() == 0 && SrcPat->getNumChildren() > 0) - SrcPat = SrcPat->getChild(0); MVT::ValueType VT = SrcPat->getTypeNum(0); std::map >::iterator TI = PatternsByType.find(VT); @@ -3595,7 +3591,8 @@ } else OpVTI->second.push_back(OpVTStr); - OS << "SDNode *Select_" << OpName << (OpVTStr != "" ? "_" : "") + OS << "SDNode *Select_" << getLegalCName(OpName) + << (OpVTStr != "" ? "_" : "") << OpVTStr << "(const SDOperand &N) {\n"; // Loop through and reverse all of the CodeList vectors, as we will be @@ -3616,9 +3613,9 @@ // catch the case where nothing handles a pattern. if (mightNotMatch) { OS << " std::cerr << \"Cannot yet select: \";\n"; - if (OpcodeInfo.getEnumName() != "ISD::INTRINSIC_W_CHAIN" && - OpcodeInfo.getEnumName() != "ISD::INTRINSIC_WO_CHAIN" && - OpcodeInfo.getEnumName() != "ISD::INTRINSIC_VOID") { + if (OpName != "ISD::INTRINSIC_W_CHAIN" && + OpName != "ISD::INTRINSIC_WO_CHAIN" && + OpName != "ISD::INTRINSIC_VOID") { OS << " N.Val->dump(CurDAG);\n"; } else { OS << " unsigned iid = cast(N.getOperand(" @@ -3657,6 +3654,7 @@ << "INSTRUCTION_LIST_END)) {\n" << " return NULL; // Already selected.\n" << " }\n\n" + << " MVT::ValueType NVT = N.Val->getValueType(0);\n" << " switch (N.getOpcode()) {\n" << " default: break;\n" << " case ISD::EntryToken: // These leaves remain the same.\n" @@ -3688,31 +3686,22 @@ // Loop over all of the case statements, emiting a call to each method we // emitted above. - for (std::map, - CompareByRecordName>::iterator PBOI = PatternsByOpcode.begin(), - E = PatternsByOpcode.end(); PBOI != E; ++PBOI) { - const SDNodeInfo &OpcodeInfo = getSDNodeInfo(PBOI->first); - const std::string &OpName = PBOI->first->getName(); + for (std::map >::iterator + PBOI = PatternsByOpcode.begin(), E = PatternsByOpcode.end(); + PBOI != E; ++PBOI) { + const std::string &OpName = PBOI->first; // Potentially multiple versions of select for this opcode. One for each // ValueType of the node (or its first true operand if it doesn't produce a // result. std::map >::iterator OpVTI = OpcodeVTMap.find(OpName); std::vector &OpVTs = OpVTI->second; - OS << " case " << OpcodeInfo.getEnumName() << ": {\n"; + OS << " case " << OpName << ": {\n"; if (OpVTs.size() == 1) { std::string &VTStr = OpVTs[0]; - OS << " return Select_" << OpName + OS << " return Select_" << getLegalCName(OpName) << (VTStr != "" ? "_" : "") << VTStr << "(N);\n"; } else { - if (OpcodeInfo.getNumResults()) - OS << " MVT::ValueType NVT = N.Val->getValueType(0);\n"; - else if (OpcodeInfo.hasProperty(SDNPHasChain)) - OS << " MVT::ValueType NVT = (N.getNumOperands() > 1) ?" - << " N.getOperand(1).Val->getValueType(0) : MVT::isVoid;\n"; - else - OS << " MVT::ValueType NVT = (N.getNumOperands() > 0) ?" - << " N.getOperand(0).Val->getValueType(0) : MVT::isVoid;\n"; int Default = -1; OS << " switch (NVT) {\n"; for (unsigned i = 0, e = OpVTs.size(); i < e; ++i) { @@ -3722,12 +3711,12 @@ continue; } OS << " case MVT::" << VTStr << ":\n" - << " return Select_" << OpName + << " return Select_" << getLegalCName(OpName) << "_" << VTStr << "(N);\n"; } OS << " default:\n"; if (Default != -1) - OS << " return Select_" << OpName << "(N);\n"; + OS << " return Select_" << getLegalCName(OpName) << "(N);\n"; else OS << " break;\n"; OS << " }\n"; From reid at x10sys.com Wed Nov 8 15:28:09 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 8 Nov 2006 15:28:09 -0600 Subject: [llvm-commits] CVS: llvm/lib/Bytecode/Writer/Writer.cpp Message-ID: <200611082128.kA8LS9B0008812@zion.cs.uiuc.edu> Changes in directory llvm/lib/Bytecode/Writer: Writer.cpp updated: 1.127 -> 1.128 --- Log message: Bump the bytecode version number to 7. Implement upgrade of version 6 and version 6 bytecode. --- Diffs of the changes: (+1 -1) Writer.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Bytecode/Writer/Writer.cpp diff -u llvm/lib/Bytecode/Writer/Writer.cpp:1.127 llvm/lib/Bytecode/Writer/Writer.cpp:1.128 --- llvm/lib/Bytecode/Writer/Writer.cpp:1.127 Thu Nov 2 14:25:49 2006 +++ llvm/lib/Bytecode/Writer/Writer.cpp Wed Nov 8 15:27:54 2006 @@ -40,7 +40,7 @@ /// so that the reader can distinguish which format of the bytecode file has /// been written. /// @brief The bytecode version number -const unsigned BCVersionNum = 6; +const unsigned BCVersionNum = 7; static RegisterPass X("emitbytecode", "Bytecode Writer"); From tonic at nondot.org Wed Nov 8 17:26:28 2006 From: tonic at nondot.org (Tanya Lattner) Date: Wed, 8 Nov 2006 17:26:28 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CFrontend/2006-09-28-SimpleAsm.c Message-ID: <200611082326.kA8NQSJL027749@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CFrontend: 2006-09-28-SimpleAsm.c updated: 1.1 -> 1.2 --- Log message: Should be xfailed for llvmgcc3 --- Diffs of the changes: (+1 -0) 2006-09-28-SimpleAsm.c | 1 + 1 files changed, 1 insertion(+) Index: llvm/test/Regression/CFrontend/2006-09-28-SimpleAsm.c diff -u llvm/test/Regression/CFrontend/2006-09-28-SimpleAsm.c:1.1 llvm/test/Regression/CFrontend/2006-09-28-SimpleAsm.c:1.2 --- llvm/test/Regression/CFrontend/2006-09-28-SimpleAsm.c:1.1 Thu Sep 28 13:58:02 2006 +++ llvm/test/Regression/CFrontend/2006-09-28-SimpleAsm.c Wed Nov 8 17:26:16 2006 @@ -1,6 +1,7 @@ // 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' +// XFAIL: llvmgcc3 // PR924 void bar() { From tonic at nondot.org Wed Nov 8 17:26:11 2006 From: tonic at nondot.org (Tanya Lattner) Date: Wed, 8 Nov 2006 17:26:11 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/C++Frontend/2003-11-02-WeakLinkage.cpp.tr Message-ID: <200611082326.kA8NQBR9027735@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/C++Frontend: 2003-11-02-WeakLinkage.cpp.tr updated: 1.2 -> 1.3 --- Log message: Should be xfailed for llvmgcc4 and NOT *. * means all platforms regardless of what llvmgcc you use. --- Diffs of the changes: (+1 -1) 2003-11-02-WeakLinkage.cpp.tr | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/Regression/C++Frontend/2003-11-02-WeakLinkage.cpp.tr diff -u llvm/test/Regression/C++Frontend/2003-11-02-WeakLinkage.cpp.tr:1.2 llvm/test/Regression/C++Frontend/2003-11-02-WeakLinkage.cpp.tr:1.3 --- llvm/test/Regression/C++Frontend/2003-11-02-WeakLinkage.cpp.tr:1.2 Sun Nov 5 17:27:36 2006 +++ llvm/test/Regression/C++Frontend/2003-11-02-WeakLinkage.cpp.tr Wed Nov 8 17:25:58 2006 @@ -1,5 +1,5 @@ // RUN: %llvmgcc -xc++ -S -o - %s | not grep weak -// XFAIL: * +// XFAIL: llvmgcc4 template void thefunc(); From tonic at nondot.org Wed Nov 8 17:27:52 2006 From: tonic at nondot.org (Tanya Lattner) Date: Wed, 8 Nov 2006 17:27:52 -0600 Subject: [llvm-commits] [release_19] CVS: llvm/test/Regression/C++Frontend/2003-11-02-WeakLinkage.cpp.tr Message-ID: <200611082327.kA8NRqIU027785@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/C++Frontend: 2003-11-02-WeakLinkage.cpp.tr updated: 1.2 -> 1.2.2.1 --- Log message: Merging from mainline --- Diffs of the changes: (+1 -1) 2003-11-02-WeakLinkage.cpp.tr | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/Regression/C++Frontend/2003-11-02-WeakLinkage.cpp.tr diff -u llvm/test/Regression/C++Frontend/2003-11-02-WeakLinkage.cpp.tr:1.2 llvm/test/Regression/C++Frontend/2003-11-02-WeakLinkage.cpp.tr:1.2.2.1 --- llvm/test/Regression/C++Frontend/2003-11-02-WeakLinkage.cpp.tr:1.2 Sun Nov 5 17:27:36 2006 +++ llvm/test/Regression/C++Frontend/2003-11-02-WeakLinkage.cpp.tr Wed Nov 8 17:27:39 2006 @@ -1,5 +1,5 @@ // RUN: %llvmgcc -xc++ -S -o - %s | not grep weak -// XFAIL: * +// XFAIL: llvmgcc4 template void thefunc(); From tonic at nondot.org Wed Nov 8 17:28:07 2006 From: tonic at nondot.org (Tanya Lattner) Date: Wed, 8 Nov 2006 17:28:07 -0600 Subject: [llvm-commits] [release_19] CVS: llvm/test/Regression/CFrontend/2006-09-28-SimpleAsm.c Message-ID: <200611082328.kA8NS7VN027799@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CFrontend: 2006-09-28-SimpleAsm.c updated: 1.1 -> 1.1.4.1 --- Log message: Merging from mainline --- Diffs of the changes: (+1 -0) 2006-09-28-SimpleAsm.c | 1 + 1 files changed, 1 insertion(+) Index: llvm/test/Regression/CFrontend/2006-09-28-SimpleAsm.c diff -u llvm/test/Regression/CFrontend/2006-09-28-SimpleAsm.c:1.1 llvm/test/Regression/CFrontend/2006-09-28-SimpleAsm.c:1.1.4.1 --- llvm/test/Regression/CFrontend/2006-09-28-SimpleAsm.c:1.1 Thu Sep 28 13:58:02 2006 +++ llvm/test/Regression/CFrontend/2006-09-28-SimpleAsm.c Wed Nov 8 17:27:54 2006 @@ -1,6 +1,7 @@ // 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' +// XFAIL: llvmgcc3 // PR924 void bar() { From reid at x10sys.com Wed Nov 8 18:26:32 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 8 Nov 2006 18:26:32 -0600 Subject: [llvm-commits] CVS: llvm/utils/findmisopt Message-ID: <200611090026.kA90QWMN028738@zion.cs.uiuc.edu> Changes in directory llvm/utils: findmisopt added (r1.1) --- Log message: Add a utility script to find a mis-optimization problem. This sometimes helps when bugpoint can't find the problem directly because it needs the set of optimizations that cause the program to fail. --- Diffs of the changes: (+125 -0) findmisopt | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 125 insertions(+) Index: llvm/utils/findmisopt diff -c /dev/null llvm/utils/findmisopt:1.1 *** /dev/null Wed Nov 8 18:26:27 2006 --- llvm/utils/findmisopt Wed Nov 8 18:26:17 2006 *************** *** 0 **** --- 1,125 ---- + #!/bin/bash + # + # findmisopt + # + # This is a quick and dirty hack to potentially find a misoptimization + # problem. Mostly its to work around problems in bugpoint that prevent + # it from finding a problem unless the set of failing optimizations are + # known and given to it on the command line. + # + # Given a bytecode file that produces correct output (or return code), + # this script will run through all the optimizations passes that gccas + # uses (in the same order) and will narrow down which optimizations + # cause the program either generate different output or return a + # different result code. When the passes have been narrowed down, + # bugpoint is invoked to further refine the problem to its origin. + # + # Usage: + # findmisopt bcfile outdir progargs [match] + # + # Where: + # bcfile + # is the bytecode file input (the unoptimized working case) + # outdir + # is a directory into which intermediate results are placed + # progargs + # is a single argument containing all the arguments the program needs + # match + # if specified to any value causes the result code of the program to + # be used to determine success/fail. If not specified success/fail is + # determined by diffing the program's output with the non-optimized + # output. + # + bcfile="$1" + outdir="$2" + args="$3" + match="$4" + name=`basename $bcfile .bc` + ll="$outdir/${name}.ll" + s="$outdir/${name}.s" + prog="$outdir/${name}" + out="$outdir/${name}.out" + optbc="$outdir/${name}.opt.bc" + optll="$outdir/${name}.opt.ll" + opts="$outdir/${name}.opt.s" + optprog="$outdir/${name}.opt" + optout="$outdir/${name}.opt.out" + + echo "Test Name: $name" + echo "Unoptimized program: $prog" + echo " Optimized program: $optprog" + + + # Generate the disassembly + llvm-dis "$bcfile" -o "$ll" -f || exit 1 + + # Generate the non-optimized program + llc "$bcfile" -o "$s" -f || exit 1 + gcc "$s" -o "$prog" || exit 1 + + # Define the list of optimizations to run + all_switches="-verify -lowersetjmp -funcresolve -raiseallocs -simplifycfg -mem2reg -globalopt -globaldce -ipconstprop -deadargelim -instcombine -simplifycfg -prune-eh -inline -simplify-libcalls -argpromotion -raise -tailduplicate -simplifycfg -scalarrepl -instcombine -predsimplify -condprop -tailcallelim -simplifycfg -reassociate -licm -loop-unswitch -instcombine -indvars -loop-unroll -instcombine -load-vn -gcse -sccp -instcombine -condprop -dse -dce -simplifycfg -deadtypeelim -constmerge" + + # Current set of switches is empty + function tryit { + switches_to_use="$1" + opt $switches_to_use "$bcfile" -o "$optbc" -f || exit + llvm-dis "$optbc" -o "$optll" -f || exit + llc "$optbc" -o "$opts" -f || exit + gcc "$opts" -o "$optprog" || exit + "$prog" $args > "$out" + ex1=$? + "$optprog" $args > "$optout" + ex2=$? + + if [ -n "$match" ] ; then + if [ "$ex1" -ne "$ex2" ] ; then + echo "Return code not the same with these switches:" + echo $switches + echo "Unoptimized returned: $ex1" + echo "Optimized returned: $ex2" + return 0 + fi + else + diff "$out" "$optout" > /dev/null + if [ $? -ne 0 ] ; then + echo "Diff fails with these switches:" + echo $switches + echo "Differences:" + diff "$out" "$optout" + return 0; + fi + fi + return 1 + } + + for sw in $all_switches ; do + switches="$switches $sw" + if tryit "$switches" ; then + break; + fi + done + + final="" + while [ ! -z "$switches" ] ; do + trimmed=`echo "$switches" | sed -e 's/^ *\(-[^ ]*\).*/\1/'` + switches=`echo "$switches" | sed -e 's/^ *-[^ ]* *//'` + echo "Trimmed $trimmed from left" + tryit "$final $switches" + if [ "$?" -eq "0" ] ; then + echo "Still Failing .. continuing ..." + continue + else + echo "Found required early pass: $trimmed" + final="$final $trimmed" + continue + fi + echo "Next Loop" + done + + echo "Smallest Optimization list= $final" + bpcmd="bugpoint -run-llc --output "$out" --input /dev/null $bcfile $final --args $args" + + echo "Running: $bpcmd" + $bpcmd + echo "Finished." From reid at x10sys.com Wed Nov 8 18:50:48 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 8 Nov 2006 18:50:48 -0600 Subject: [llvm-commits] CVS: llvm/utils/findmisopt Message-ID: <200611090050.kA90omV6015550@zion.cs.uiuc.edu> Changes in directory llvm/utils: findmisopt updated: 1.1 -> 1.2 --- Log message: Print a usage message if too few arguments to program. --- Diffs of the changes: (+5 -0) findmisopt | 5 +++++ 1 files changed, 5 insertions(+) Index: llvm/utils/findmisopt diff -u llvm/utils/findmisopt:1.1 llvm/utils/findmisopt:1.2 --- llvm/utils/findmisopt:1.1 Wed Nov 8 18:26:17 2006 +++ llvm/utils/findmisopt Wed Nov 8 18:50:32 2006 @@ -30,6 +30,11 @@ # determined by diffing the program's output with the non-optimized # output. # +if [ "$#" -lt 3 ] ; then + echo "usage: findmisopt bcfile outdir progargs [match]" + exit 1 +fi + bcfile="$1" outdir="$2" args="$3" From evan.cheng at apple.com Wed Nov 8 17:02:25 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 8 Nov 2006 17:02:25 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/TargetSelectionDAG.td Message-ID: <200611082302.kA8N2P42010293@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: TargetSelectionDAG.td updated: 1.74 -> 1.75 --- Log message: Added indexed store node and patfrag's. --- Diffs of the changes: (+131 -11) TargetSelectionDAG.td | 142 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 131 insertions(+), 11 deletions(-) Index: llvm/lib/Target/TargetSelectionDAG.td diff -u llvm/lib/Target/TargetSelectionDAG.td:1.74 llvm/lib/Target/TargetSelectionDAG.td:1.75 --- llvm/lib/Target/TargetSelectionDAG.td:1.74 Thu Oct 26 16:55:50 2006 +++ llvm/lib/Target/TargetSelectionDAG.td Wed Nov 8 17:02:11 2006 @@ -164,6 +164,10 @@ SDTCisPtrTy<1> ]>; +def SDTIStore : SDTypeProfile<1, 3, [ // indexed store + SDTCisSameAs<0, 2>, SDTCisPtrTy<0>, SDTCisPtrTy<3> +]>; + def SDTVecShuffle : SDTypeProfile<1, 3, [ SDTCisSameAs<0, 1>, SDTCisSameAs<1, 2>, SDTCisIntVectorOfSameSize<3, 0> ]>; @@ -299,6 +303,7 @@ // and truncst (see below). def ld : SDNode<"ISD::LOAD" , SDTLoad, [SDNPHasChain]>; def st : SDNode<"ISD::STORE" , SDTStore, [SDNPHasChain]>; +def ist : SDNode<"ISD::STORE" , SDTIStore, [SDNPHasChain]>; def vector_shuffle : SDNode<"ISD::VECTOR_SHUFFLE", SDTVecShuffle, []>; def build_vector : SDNode<"ISD::BUILD_VECTOR", SDTypeProfile<1, 0, []>, []>; @@ -505,38 +510,153 @@ // store fragments. def store : PatFrag<(ops node:$val, node:$ptr), (st node:$val, node:$ptr), [{ - return ISD::isNON_TRUNCStore(N); + if (StoreSDNode *ST = dyn_cast(N)) + return !ST->isTruncatingStore(); + return false; }]>; // truncstore fragments. def truncstorei1 : PatFrag<(ops node:$val, node:$ptr), (st node:$val, node:$ptr), [{ - if (ISD::isTRUNCStore(N)) - return cast(N)->getStoredVT() == MVT::i1; + if (StoreSDNode *ST = dyn_cast(N)) + return ST->isTruncatingStore() && ST->getStoredVT() == MVT::i1; return false; }]>; def truncstorei8 : PatFrag<(ops node:$val, node:$ptr), (st node:$val, node:$ptr), [{ - if (ISD::isTRUNCStore(N)) - return cast(N)->getStoredVT() == MVT::i8; + if (StoreSDNode *ST = dyn_cast(N)) + return ST->isTruncatingStore() && ST->getStoredVT() == MVT::i8; return false; }]>; def truncstorei16 : PatFrag<(ops node:$val, node:$ptr), (st node:$val, node:$ptr), [{ - if (ISD::isTRUNCStore(N)) - return cast(N)->getStoredVT() == MVT::i16; + if (StoreSDNode *ST = dyn_cast(N)) + return ST->isTruncatingStore() && ST->getStoredVT() == MVT::i16; return false; }]>; def truncstorei32 : PatFrag<(ops node:$val, node:$ptr), (st node:$val, node:$ptr), [{ - if (ISD::isTRUNCStore(N)) - return cast(N)->getStoredVT() == MVT::i32; + if (StoreSDNode *ST = dyn_cast(N)) + return ST->isTruncatingStore() && ST->getStoredVT() == MVT::i32; return false; }]>; def truncstoref32 : PatFrag<(ops node:$val, node:$ptr), (st node:$val, node:$ptr), [{ - if (ISD::isTRUNCStore(N)) - return cast(N)->getStoredVT() == MVT::f32; + if (StoreSDNode *ST = dyn_cast(N)) + return ST->isTruncatingStore() && ST->getStoredVT() == MVT::f32; + return false; +}]>; + +// indexed store fragments. +def pre_store : PatFrag<(ops node:$val, node:$base, node:$offset), + (ist node:$val, node:$base, node:$offset), [{ + if (StoreSDNode *ST = dyn_cast(N)) { + ISD::MemOpAddrMode AM = ST->getAddressingMode(); + return (AM == ISD::PRE_INC || AM == ISD::PRE_DEC) && + !ST->isTruncatingStore(); + } + return false; +}]>; + +def pre_truncsti1 : PatFrag<(ops node:$val, node:$base, node:$offset), + (ist node:$val, node:$base, node:$offset), [{ + if (StoreSDNode *ST = dyn_cast(N)) { + ISD::MemOpAddrMode AM = ST->getAddressingMode(); + return (AM == ISD::PRE_INC || AM == ISD::PRE_DEC) && + ST->isTruncatingStore() && ST->getStoredVT() == MVT::i1; + } + return false; +}]>; +def pre_truncsti8 : PatFrag<(ops node:$val, node:$base, node:$offset), + (ist node:$val, node:$base, node:$offset), [{ + if (StoreSDNode *ST = dyn_cast(N)) { + ISD::MemOpAddrMode AM = ST->getAddressingMode(); + return (AM == ISD::PRE_INC || AM == ISD::PRE_DEC) && + ST->isTruncatingStore() && ST->getStoredVT() == MVT::i8; + } + return false; +}]>; +def pre_truncsti16 : PatFrag<(ops node:$val, node:$base, node:$offset), + (ist node:$val, node:$base, node:$offset), [{ + if (StoreSDNode *ST = dyn_cast(N)) { + ISD::MemOpAddrMode AM = ST->getAddressingMode(); + return (AM == ISD::PRE_INC || AM == ISD::PRE_DEC) && + ST->isTruncatingStore() && ST->getStoredVT() == MVT::i16; + } + return false; +}]>; +def pre_truncsti32 : PatFrag<(ops node:$val, node:$base, node:$offset), + (ist node:$val, node:$base, node:$offset), [{ + if (StoreSDNode *ST = dyn_cast(N)) { + ISD::MemOpAddrMode AM = ST->getAddressingMode(); + return (AM == ISD::PRE_INC || AM == ISD::PRE_DEC) && + ST->isTruncatingStore() && ST->getStoredVT() == MVT::i32; + } + return false; +}]>; +def pre_truncstf32 : PatFrag<(ops node:$val, node:$base, node:$offset), + (ist node:$val, node:$base, node:$offset), [{ + if (StoreSDNode *ST = dyn_cast(N)) { + ISD::MemOpAddrMode AM = ST->getAddressingMode(); + return (AM == ISD::PRE_INC || AM == ISD::PRE_DEC) && + ST->isTruncatingStore() && ST->getStoredVT() == MVT::f32; + } + return false; +}]>; + +def post_store : PatFrag<(ops node:$val, node:$ptr, node:$offset), + (ist node:$val, node:$ptr, node:$offset), [{ + if (StoreSDNode *ST = dyn_cast(N)) { + ISD::MemOpAddrMode AM = ST->getAddressingMode(); + return !ST->isTruncatingStore() && + (AM == ISD::POST_INC || AM == ISD::POST_DEC); + } + return false; +}]>; + +def post_truncsti1 : PatFrag<(ops node:$val, node:$base, node:$offset), + (ist node:$val, node:$base, node:$offset), [{ + if (StoreSDNode *ST = dyn_cast(N)) { + ISD::MemOpAddrMode AM = ST->getAddressingMode(); + return (AM == ISD::POST_INC || AM == ISD::POST_DEC) && + ST->isTruncatingStore() && ST->getStoredVT() == MVT::i1; + } + return false; +}]>; +def post_truncsti8 : PatFrag<(ops node:$val, node:$base, node:$offset), + (ist node:$val, node:$base, node:$offset), [{ + if (StoreSDNode *ST = dyn_cast(N)) { + ISD::MemOpAddrMode AM = ST->getAddressingMode(); + return (AM == ISD::POST_INC || AM == ISD::POST_DEC) && + ST->isTruncatingStore() && ST->getStoredVT() == MVT::i8; + } + return false; +}]>; +def post_truncsti16 : PatFrag<(ops node:$val, node:$base, node:$offset), + (ist node:$val, node:$base, node:$offset), [{ + if (StoreSDNode *ST = dyn_cast(N)) { + ISD::MemOpAddrMode AM = ST->getAddressingMode(); + return (AM == ISD::POST_INC || AM == ISD::POST_DEC) && + ST->isTruncatingStore() && ST->getStoredVT() == MVT::i16; + } + return false; +}]>; +def post_truncsti32 : PatFrag<(ops node:$val, node:$base, node:$offset), + (ist node:$val, node:$base, node:$offset), [{ + if (StoreSDNode *ST = dyn_cast(N)) { + ISD::MemOpAddrMode AM = ST->getAddressingMode(); + return (AM == ISD::POST_INC || AM == ISD::POST_DEC) && + ST->isTruncatingStore() && ST->getStoredVT() == MVT::i32; + } + return false; +}]>; +def post_truncstf32 : PatFrag<(ops node:$val, node:$base, node:$offset), + (ist node:$val, node:$base, node:$offset), [{ + if (StoreSDNode *ST = dyn_cast(N)) { + ISD::MemOpAddrMode AM = ST->getAddressingMode(); + return (AM == ISD::POST_INC || AM == ISD::POST_DEC) && + ST->isTruncatingStore() && ST->getStoredVT() == MVT::f32; + } return false; }]>; From reid at x10sys.com Wed Nov 8 19:47:18 2006 From: reid at x10sys.com (Reid Spencer) Date: Wed, 8 Nov 2006 19:47:18 -0600 Subject: [llvm-commits] CVS: llvm/utils/findmisopt Message-ID: <200611090147.kA91lIJ5005055@zion.cs.uiuc.edu> Changes in directory llvm/utils: findmisopt updated: 1.2 -> 1.3 --- Log message: Don't run bugpoint if we can't find a misoptimization. --- Diffs of the changes: (+6 -2) findmisopt | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) Index: llvm/utils/findmisopt diff -u llvm/utils/findmisopt:1.2 llvm/utils/findmisopt:1.3 --- llvm/utils/findmisopt:1.2 Wed Nov 8 18:50:32 2006 +++ llvm/utils/findmisopt Wed Nov 8 19:47:04 2006 @@ -122,9 +122,13 @@ echo "Next Loop" done -echo "Smallest Optimization list= $final" +if [ "$final" == " $all_switches" ] ; then + echo "findmisopt: Can't find a set of optimizations that make it fail" + exit 0 +fi +echo "Smallest Optimization list=$final" bpcmd="bugpoint -run-llc --output "$out" --input /dev/null $bcfile $final --args $args" echo "Running: $bpcmd" $bpcmd -echo "Finished." +echo "findmisopt finished." From evan.cheng at apple.com Wed Nov 8 20:21:12 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 8 Nov 2006 20:21:12 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetInstrInfo.h Message-ID: <200611090221.kA92LClY009401@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetInstrInfo.h updated: 1.104 -> 1.105 --- Log message: Remove M_2_ADDR_FLAG. --- Diffs of the changes: (+7 -13) TargetInstrInfo.h | 20 +++++++------------- 1 files changed, 7 insertions(+), 13 deletions(-) Index: llvm/include/llvm/Target/TargetInstrInfo.h diff -u llvm/include/llvm/Target/TargetInstrInfo.h:1.104 llvm/include/llvm/Target/TargetInstrInfo.h:1.105 --- llvm/include/llvm/Target/TargetInstrInfo.h:1.104 Mon Nov 6 17:53:08 2006 +++ llvm/include/llvm/Target/TargetInstrInfo.h Wed Nov 8 20:20:58 2006 @@ -52,37 +52,34 @@ const unsigned M_LOAD_FLAG = 1 << 5; const unsigned M_STORE_FLAG = 1 << 6; -// M_2_ADDR_FLAG - 3-addr instructions which really work like 2-addr ones. -const unsigned M_2_ADDR_FLAG = 1 << 7; - -// M_CONVERTIBLE_TO_3_ADDR - This is a M_2_ADDR_FLAG instruction which can be +// M_CONVERTIBLE_TO_3_ADDR - This is a 2-address instruction which can be // changed into a 3-address instruction if the first two operands cannot be // assigned to the same register. The target must implement the // TargetInstrInfo::convertToThreeAddress method for this instruction. -const unsigned M_CONVERTIBLE_TO_3_ADDR = 1 << 8; +const unsigned M_CONVERTIBLE_TO_3_ADDR = 1 << 7; // This M_COMMUTABLE - is a 2- or 3-address instruction (of the form X = op Y, // Z), which produces the same result if Y and Z are exchanged. -const unsigned M_COMMUTABLE = 1 << 9; +const unsigned M_COMMUTABLE = 1 << 8; // M_TERMINATOR_FLAG - Is this instruction part of the terminator for a basic // block? Typically this is things like return and branch instructions. // Various passes use this to insert code into the bottom of a basic block, but // before control flow occurs. -const unsigned M_TERMINATOR_FLAG = 1 << 10; +const unsigned M_TERMINATOR_FLAG = 1 << 9; // M_USES_CUSTOM_DAG_SCHED_INSERTION - Set if this instruction requires custom // insertion support when the DAG scheduler is inserting it into a machine basic // block. -const unsigned M_USES_CUSTOM_DAG_SCHED_INSERTION = 1 << 11; +const unsigned M_USES_CUSTOM_DAG_SCHED_INSERTION = 1 << 10; // M_VARIABLE_OPS - Set if this instruction can have a variable number of extra // operands in addition to the minimum number operands specified. -const unsigned M_VARIABLE_OPS = 1 << 12; +const unsigned M_VARIABLE_OPS = 1 << 11; // M_PREDICATED - Set if this instruction has a predicate that controls its // execution. -const unsigned M_PREDICATED = 1 << 13; +const unsigned M_PREDICATED = 1 << 12; // Machine operand flags @@ -184,9 +181,6 @@ return get(Opcode).Flags & M_RET_FLAG; } - bool isTwoAddrInstr(MachineOpCode Opcode) const { - return get(Opcode).Flags & M_2_ADDR_FLAG; - } bool isPredicated(MachineOpCode Opcode) const { return get(Opcode).Flags & M_PREDICATED; } From evan.cheng at apple.com Wed Nov 8 20:21:45 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 8 Nov 2006 20:21:45 -0600 Subject: [llvm-commits] CVS: llvm/utils/TableGen/InstrInfoEmitter.cpp Message-ID: <200611090221.kA92Ljgl009424@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: InstrInfoEmitter.cpp updated: 1.50 -> 1.51 --- Log message: Remove M_2_ADDR_FLAG. --- Diffs of the changes: (+0 -1) InstrInfoEmitter.cpp | 1 - 1 files changed, 1 deletion(-) Index: llvm/utils/TableGen/InstrInfoEmitter.cpp diff -u llvm/utils/TableGen/InstrInfoEmitter.cpp:1.50 llvm/utils/TableGen/InstrInfoEmitter.cpp:1.51 --- llvm/utils/TableGen/InstrInfoEmitter.cpp:1.50 Mon Nov 6 17:53:31 2006 +++ llvm/utils/TableGen/InstrInfoEmitter.cpp Wed Nov 8 20:21:31 2006 @@ -232,7 +232,6 @@ if (Inst.isCall) OS << "|M_CALL_FLAG"; if (Inst.isLoad) OS << "|M_LOAD_FLAG"; if (Inst.isStore || isStore) OS << "|M_STORE_FLAG"; - if (Inst.isTwoAddress) OS << "|M_2_ADDR_FLAG"; if (Inst.isPredicated) OS << "|M_PREDICATED"; if (Inst.isConvertibleToThreeAddress) OS << "|M_CONVERTIBLE_TO_3_ADDR"; if (Inst.isCommutable) OS << "|M_COMMUTABLE"; From evan.cheng at apple.com Wed Nov 8 20:22:30 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 8 Nov 2006 20:22:30 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/TwoAddressInstructionPass.cpp Message-ID: <200611090222.kA92MUju009467@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: TwoAddressInstructionPass.cpp updated: 1.39 -> 1.40 --- Log message: Remove M_2_ADDR_FLAG. --- Diffs of the changes: (+0 -2) TwoAddressInstructionPass.cpp | 2 -- 1 files changed, 2 deletions(-) Index: llvm/lib/CodeGen/TwoAddressInstructionPass.cpp diff -u llvm/lib/CodeGen/TwoAddressInstructionPass.cpp:1.39 llvm/lib/CodeGen/TwoAddressInstructionPass.cpp:1.40 --- llvm/lib/CodeGen/TwoAddressInstructionPass.cpp:1.39 Wed Nov 1 17:06:55 2006 +++ llvm/lib/CodeGen/TwoAddressInstructionPass.cpp Wed Nov 8 20:22:15 2006 @@ -191,8 +191,6 @@ mbbi->erase(mi); // Nuke the old inst. mi = New; ++NumConvertedTo3Addr; - assert(!TII.isTwoAddrInstr(New->getOpcode()) && - "convertToThreeAddress returned a 2-addr instruction??"); // Done with this instruction. break; } From evan.cheng at apple.com Wed Nov 8 20:23:09 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 8 Nov 2006 20:23:09 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86CodeEmitter.cpp X86RegisterInfo.cpp Message-ID: <200611090223.kA92N9L7009499@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86CodeEmitter.cpp updated: 1.120 -> 1.121 X86RegisterInfo.cpp updated: 1.172 -> 1.173 --- Log message: Remove M_2_ADDR_FLAG. --- Diffs of the changes: (+9 -5) X86CodeEmitter.cpp | 7 +++++-- X86RegisterInfo.cpp | 7 ++++--- 2 files changed, 9 insertions(+), 5 deletions(-) Index: llvm/lib/Target/X86/X86CodeEmitter.cpp diff -u llvm/lib/Target/X86/X86CodeEmitter.cpp:1.120 llvm/lib/Target/X86/X86CodeEmitter.cpp:1.121 --- llvm/lib/Target/X86/X86CodeEmitter.cpp:1.120 Wed Sep 13 14:07:28 2006 +++ llvm/lib/Target/X86/X86CodeEmitter.cpp Wed Nov 8 20:22:54 2006 @@ -470,7 +470,8 @@ REX |= 1 << 3; if (MI.getNumOperands()) { - bool isTwoAddr = (Desc.Flags & M_2_ADDR_FLAG) != 0; + bool isTwoAddr = II->getNumOperands(Opcode) > 1 && + II->getOperandConstraint(Opcode, 1, TargetInstrInfo::TIED_TO) != -1; // If it accesses SPL, BPL, SIL, or DIL, then it requires a 0x40 REX prefix. bool isTrunc8 = isX86_64TruncToByte(Opcode); @@ -607,7 +608,9 @@ // If this is a two-address instruction, skip one of the register operands. unsigned CurOp = 0; - CurOp += (Desc.Flags & M_2_ADDR_FLAG) != 0; + if (II->getNumOperands(Opcode) > 1 && + II->getOperandConstraint(Opcode, 1, TargetInstrInfo::TIED_TO) != -1) + CurOp++; unsigned char BaseOpcode = II->getBaseOpcodeFor(Opcode); switch (Desc.TSFlags & X86II::FormMask) { Index: llvm/lib/Target/X86/X86RegisterInfo.cpp diff -u llvm/lib/Target/X86/X86RegisterInfo.cpp:1.172 llvm/lib/Target/X86/X86RegisterInfo.cpp:1.173 --- llvm/lib/Target/X86/X86RegisterInfo.cpp:1.172 Thu Nov 2 20:08:41 2006 +++ llvm/lib/Target/X86/X86RegisterInfo.cpp Wed Nov 8 20:22:54 2006 @@ -284,14 +284,15 @@ const TableEntry *OpcodeTablePtr = NULL; unsigned OpcodeTableSize = 0; bool isTwoAddrFold = false; + bool isTwoAddr = TII.getNumOperands(MI->getOpcode()) > 1 && + TII.getOperandConstraint(MI->getOpcode(), 1,TargetInstrInfo::TIED_TO) != -1; // Folding a memory location into the two-address part of a two-address // instruction is different than folding it other places. It requires // replacing the *two* registers with the memory location. - if (MI->getNumOperands() >= 2 && MI->getOperand(0).isReg() && + if (isTwoAddr && MI->getNumOperands() >= 2 && MI->getOperand(0).isReg() && MI->getOperand(1).isReg() && i < 2 && - MI->getOperand(0).getReg() == MI->getOperand(1).getReg() && - TII.isTwoAddrInstr(MI->getOpcode())) { + MI->getOperand(0).getReg() == MI->getOperand(1).getReg()) { static const TableEntry OpcodeTable[] = { { X86::ADC32ri, X86::ADC32mi }, { X86::ADC32ri8, X86::ADC32mi8 }, From evan.cheng at apple.com Wed Nov 8 22:29:23 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 8 Nov 2006 22:29:23 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetLowering.h Message-ID: <200611090429.kA94TNqn011428@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetLowering.h updated: 1.87 -> 1.88 --- Log message: getPostIndexedAddressParts change: passes in load/store instead of its loaded / stored VT. --- Diffs of the changes: (+1 -1) TargetLowering.h | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/Target/TargetLowering.h diff -u llvm/include/llvm/Target/TargetLowering.h:1.87 llvm/include/llvm/Target/TargetLowering.h:1.88 --- llvm/include/llvm/Target/TargetLowering.h:1.87 Tue Nov 7 03:04:16 2006 +++ llvm/include/llvm/Target/TargetLowering.h Wed Nov 8 22:29:09 2006 @@ -385,7 +385,7 @@ /// getPostIndexedAddressParts - returns true by value, base pointer and /// offset pointer and addressing mode by reference if this node can be /// combined with a load / store to form a post-indexed load / store. - virtual bool getPostIndexedAddressParts(SDNode *N, MVT::ValueType VT, + virtual bool getPostIndexedAddressParts(SDNode *N, SDNode *Op, SDOperand &Base, SDOperand &Offset, ISD::MemOpAddrMode &AM, SelectionDAG &DAG) { From evan.cheng at apple.com Wed Nov 8 22:30:01 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Wed, 8 Nov 2006 22:30:01 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200611090430.kA94U1Z9011452@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.244 -> 1.245 --- Log message: getPostIndexedAddressParts change: passes in load/store instead of its loaded / stored VT. --- Diffs of the changes: (+1 -3) DAGCombiner.cpp | 4 +--- 1 files changed, 1 insertion(+), 3 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.244 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.245 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.244 Wed Nov 8 14:27:27 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed Nov 8 22:29:46 2006 @@ -282,10 +282,8 @@ MVT::ValueType VT; if (LoadSDNode *LD = dyn_cast(N)) { Ptr = LD->getBasePtr(); - VT = LD->getLoadedVT(); } else if (StoreSDNode *ST = dyn_cast(N)) { Ptr = ST->getBasePtr(); - VT = ST->getStoredVT(); isLoad = false; } else return false; @@ -301,7 +299,7 @@ SDOperand BasePtr; SDOperand Offset; ISD::MemOpAddrMode AM = ISD::UNINDEXED; - if (TLI.getPostIndexedAddressParts(Op, VT, BasePtr, Offset, AM,DAG)) { + if (TLI.getPostIndexedAddressParts(N, Op, BasePtr, Offset, AM,DAG)) { if (Ptr == Offset) std::swap(BasePtr, Offset); if (Ptr != BasePtr) From sabre at nondot.org Wed Nov 8 23:11:37 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 8 Nov 2006 23:11:37 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/add.ll shift-sra.ll Message-ID: <200611090511.kA95BbF5012146@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/InstCombine: add.ll updated: 1.30 -> 1.31 shift-sra.ll updated: 1.2 -> 1.3 --- Log message: new testcases --- Diffs of the changes: (+24 -2) add.ll | 13 +++++++++++++ shift-sra.ll | 13 +++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) Index: llvm/test/Regression/Transforms/InstCombine/add.ll diff -u llvm/test/Regression/Transforms/InstCombine/add.ll:1.30 llvm/test/Regression/Transforms/InstCombine/add.ll:1.31 --- llvm/test/Regression/Transforms/InstCombine/add.ll:1.30 Sun Mar 5 17:53:04 2006 +++ llvm/test/Regression/Transforms/InstCombine/add.ll Wed Nov 8 23:11:23 2006 @@ -227,3 +227,16 @@ %D = sub int %C, 16 ret int %D } + +ubyte %test33(ubyte %A) { ;; OR A, 1 + %B = and ubyte %A, 254 + %C = add ubyte %B, 1 + ret ubyte %C +} + +ubyte %test34(ubyte %A) { + %B = add ubyte %A, 64 ;; dead + %C = and ubyte %B, 12 + ret ubyte %C +} + Index: llvm/test/Regression/Transforms/InstCombine/shift-sra.ll diff -u llvm/test/Regression/Transforms/InstCombine/shift-sra.ll:1.2 llvm/test/Regression/Transforms/InstCombine/shift-sra.ll:1.3 --- llvm/test/Regression/Transforms/InstCombine/shift-sra.ll:1.2 Wed Nov 8 00:47:33 2006 +++ llvm/test/Regression/Transforms/InstCombine/shift-sra.ll Wed Nov 8 23:11:23 2006 @@ -1,8 +1,17 @@ ; RUN: llvm-as < %s | opt -instcombine -disable-output && -; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep 'lshr int' +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep 'lshr int' | wc -l | grep 2 && +; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep ashr -int %test0(int %X, ubyte %A) { +int %test1(int %X, ubyte %A) { %Y = shr int %X, ubyte %A ; can be logical shift. %Z = and int %Y, 1 ret int %Z } + +int %test2(ubyte %tmp) { + %tmp3 = cast ubyte %tmp to int + %tmp4 = add int %tmp3, 7 + %tmp5 = ashr int %tmp4, ubyte 3 ; lshr + ret int %tmp5 +} + From sabre at nondot.org Wed Nov 8 23:12:41 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 8 Nov 2006 23:12:41 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200611090512.kA95Cf8X015621@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.540 -> 1.541 --- Log message: Teach ShrinkDemandedConstant how to handle X+C. This implements: add.ll:test33, add.ll:test34, shift-sra.ll:test2 --- Diffs of the changes: (+100 -1) InstructionCombining.cpp | 101 ++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 100 insertions(+), 1 deletion(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.540 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.541 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.540 Wed Nov 8 13:42:28 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Wed Nov 8 23:12:27 2006 @@ -1117,6 +1117,97 @@ } break; } + case Instruction::Add: + // If there is a constant on the RHS, there are a variety of xformations + // we can do. + if (ConstantInt *RHS = dyn_cast(I->getOperand(1))) { + // If null, this should be simplified elsewhere. Some of the xforms here + // won't work if the RHS is zero. + if (RHS->isNullValue()) + break; + + // Figure out what the input bits are. If the top bits of the and result + // are not demanded, then the add doesn't demand them from its input + // either. + + // Shift the demanded mask up so that it's at the top of the uint64_t. + unsigned BitWidth = I->getType()->getPrimitiveSizeInBits(); + unsigned NLZ = CountLeadingZeros_64(DemandedMask << (64-BitWidth)); + + // If the top bit of the output is demanded, demand everything from the + // input. Otherwise, we demand all the input bits except NLZ top bits. + uint64_t InDemandedBits = ~0ULL >> 64-BitWidth+NLZ; + + // Find information about known zero/one bits in the input. + if (SimplifyDemandedBits(I->getOperand(0), InDemandedBits, + KnownZero2, KnownOne2, Depth+1)) + return true; + + // If the RHS of the add has bits set that can't affect the input, reduce + // the constant. + if (ShrinkDemandedConstant(I, 1, InDemandedBits)) + return UpdateValueUsesWith(I, I); + + // Avoid excess work. + if (KnownZero2 == 0 && KnownOne2 == 0) + break; + + // Turn it into OR if input bits are zero. + if ((KnownZero2 & RHS->getZExtValue()) == RHS->getZExtValue()) { + Instruction *Or = + BinaryOperator::createOr(I->getOperand(0), I->getOperand(1), + I->getName()); + InsertNewInstBefore(Or, *I); + return UpdateValueUsesWith(I, Or); + } + + // We can say something about the output known-zero and known-one bits, + // depending on potential carries from the input constant and the + // unknowns. For example if the LHS is known to have at most the 0x0F0F0 + // bits set and the RHS constant is 0x01001, then we know we have a known + // one mask of 0x00001 and a known zero mask of 0xE0F0E. + + // To compute this, we first compute the potential carry bits. These are + // the bits which may be modified. I'm not aware of a better way to do + // this scan. + uint64_t RHSVal = RHS->getZExtValue(); + + bool CarryIn = false; + uint64_t CarryBits = 0; + uint64_t CurBit = 1; + for (unsigned i = 0; i != BitWidth; ++i, CurBit <<= 1) { + // Record the current carry in. + if (CarryIn) CarryBits |= CurBit; + + bool CarryOut; + + // This bit has a carry out unless it is "zero + zero" or + // "zero + anything" with no carry in. + if ((KnownZero2 & CurBit) && ((RHSVal & CurBit) == 0)) { + CarryOut = false; // 0 + 0 has no carry out, even with carry in. + } else if (!CarryIn && + ((KnownZero2 & CurBit) || ((RHSVal & CurBit) == 0))) { + CarryOut = false; // 0 + anything has no carry out if no carry in. + } else { + // Otherwise, we have to assume we have a carry out. + CarryOut = true; + } + + // This stage's carry out becomes the next stage's carry-in. + CarryIn = CarryOut; + } + + // Now that we know which bits have carries, compute the known-1/0 sets. + + // Bits are known one if they are known zero in one operand and one in the + // other, and there is no input carry. + KnownOne = ((KnownZero2 & RHSVal) | (KnownOne2 & ~RHSVal)) & ~CarryBits; + + // Bits are known zero if they are known zero in both operands and there + // is no input carry. + KnownZero = KnownZero2 & ~RHSVal & ~CarryBits; + } + break; case Instruction::Shl: if (ConstantInt *SA = dyn_cast(I->getOperand(1))) { uint64_t ShiftAmt = SA->getZExtValue(); @@ -1685,11 +1776,19 @@ return ReplaceInstUsesWith(I, LHS); } - // X + (signbit) --> X ^ signbit if (ConstantInt *CI = dyn_cast(RHSC)) { + // X + (signbit) --> X ^ signbit uint64_t Val = CI->getZExtValue(); if (Val == (1ULL << (CI->getType()->getPrimitiveSizeInBits()-1))) return BinaryOperator::createXor(LHS, RHS); + + // See if SimplifyDemandedBits can simplify this. This handles stuff like + // (X & 254)+1 -> (X&254)|1 + uint64_t KnownZero, KnownOne; + if (!isa(I.getType()) && + SimplifyDemandedBits(&I, I.getType()->getIntegralTypeMask(), + KnownZero, KnownOne)) + return &I; } if (isa(LHS)) From sabre at nondot.org Wed Nov 8 23:18:27 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 8 Nov 2006 23:18:27 -0600 Subject: [llvm-commits] CVS: llvm/lib/Linker/LinkModules.cpp Message-ID: <200611090518.kA95IRoR015777@zion.cs.uiuc.edu> Changes in directory llvm/lib/Linker: LinkModules.cpp updated: 1.117 -> 1.118 --- Log message: silence warnings --- Diffs of the changes: (+2 -2) LinkModules.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Linker/LinkModules.cpp diff -u llvm/lib/Linker/LinkModules.cpp:1.117 llvm/lib/Linker/LinkModules.cpp:1.118 --- llvm/lib/Linker/LinkModules.cpp:1.117 Thu Sep 14 13:23:26 2006 +++ llvm/lib/Linker/LinkModules.cpp Wed Nov 8 23:18:12 2006 @@ -441,8 +441,8 @@ SGV->hasExternalLinkage() || SGV->hasDLLImportLinkage() && "Global must either be external or have an initializer!"); - GlobalValue::LinkageTypes NewLinkage; - bool LinkFromSrc; + GlobalValue::LinkageTypes NewLinkage = GlobalValue::InternalLinkage; + bool LinkFromSrc = false; if (GetLinkageResult(DGV, SGV, NewLinkage, LinkFromSrc, Err)) return true; From sabre at nondot.org Wed Nov 8 23:58:07 2006 From: sabre at nondot.org (Chris Lattner) Date: Wed, 8 Nov 2006 23:58:07 -0600 Subject: [llvm-commits] CVS: llvm/tools/bugpoint/ExecutionDriver.cpp Message-ID: <200611090558.kA95w79p017276@zion.cs.uiuc.edu> Changes in directory llvm/tools/bugpoint: ExecutionDriver.cpp updated: 1.66 -> 1.67 --- Log message: add a new bugpoint mode -llc-safe. This uses LLC for both halves of a miscompilation. This is useful for working around GCC+CBE bugs or for handling programs that CBE doesn't support (e.g. inline asm) when searching for optimizer bugs. --- Diffs of the changes: (+9 -3) ExecutionDriver.cpp | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) Index: llvm/tools/bugpoint/ExecutionDriver.cpp diff -u llvm/tools/bugpoint/ExecutionDriver.cpp:1.66 llvm/tools/bugpoint/ExecutionDriver.cpp:1.67 --- llvm/tools/bugpoint/ExecutionDriver.cpp:1.66 Sun Nov 5 13:31:28 2006 +++ llvm/tools/bugpoint/ExecutionDriver.cpp Wed Nov 8 23:57:53 2006 @@ -28,7 +28,7 @@ // for miscompilation. // enum OutputType { - AutoPick, RunLLI, RunJIT, RunLLC, RunCBE, CBE_bug + AutoPick, RunLLI, RunJIT, RunLLC, RunCBE, CBE_bug, LLC_Safe }; cl::opt @@ -47,6 +47,7 @@ clEnumValN(RunLLC, "run-llc", "Compile with LLC"), clEnumValN(RunCBE, "run-cbe", "Compile with CBE"), clEnumValN(CBE_bug,"cbe-bug", "Find CBE bugs"), + clEnumValN(LLC_Safe, "llc-safe", "Use LLC for all"), clEnumValEnd), cl::init(AutoPick)); @@ -133,6 +134,10 @@ Interpreter = AbstractInterpreter::createJIT(getToolName(), Message, &ToolArgv); break; + case LLC_Safe: + Interpreter = AbstractInterpreter::createLLC(getToolName(), Message, + &ToolArgv); + break; case RunCBE: case CBE_bug: Interpreter = AbstractInterpreter::createCBE(getToolName(), Message, @@ -148,8 +153,9 @@ if (InterpreterSel == RunCBE) { // We already created a CBE, reuse it. cbe = Interpreter; - } else if (InterpreterSel == CBE_bug) { - // We want to debug the CBE itself. Use LLC as the 'known-good' compiler. + } else if (InterpreterSel == CBE_bug || InterpreterSel == LLC_Safe) { + // We want to debug the CBE itself or LLC is known-good. Use LLC as the + // 'known-good' compiler. std::vector ToolArgs; ToolArgs.push_back("--relocation-model=pic"); cbe = AbstractInterpreter::createLLC(getToolName(), Message, &ToolArgs); From sabre at nondot.org Thu Nov 9 00:25:10 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 9 Nov 2006 00:25:10 -0600 Subject: [llvm-commits] CVS: llvm/tools/bugpoint/ExtractFunction.cpp Message-ID: <200611090625.kA96PAnE032448@zion.cs.uiuc.edu> Changes in directory llvm/tools/bugpoint: ExtractFunction.cpp updated: 1.53 -> 1.54 --- Log message: completely revert patrick's enhancement to bugpoint. Though it makes bugpoint speed up, it sometimes makes it crash on complex bc files, which isn't very nice. With this, bugpoint can reduce the 176.gcc failure. --- Diffs of the changes: (+16 -124) ExtractFunction.cpp | 140 +++++----------------------------------------------- 1 files changed, 16 insertions(+), 124 deletions(-) Index: llvm/tools/bugpoint/ExtractFunction.cpp diff -u llvm/tools/bugpoint/ExtractFunction.cpp:1.53 llvm/tools/bugpoint/ExtractFunction.cpp:1.54 --- llvm/tools/bugpoint/ExtractFunction.cpp:1.53 Fri Oct 20 02:07:24 2006 +++ llvm/tools/bugpoint/ExtractFunction.cpp Thu Nov 9 00:24:56 2006 @@ -18,7 +18,6 @@ #include "llvm/Module.h" #include "llvm/PassManager.h" #include "llvm/Pass.h" -#include "llvm/SymbolTable.h" #include "llvm/Analysis/Verifier.h" #include "llvm/Transforms/IPO.h" #include "llvm/Transforms/Scalar.h" @@ -248,63 +247,6 @@ } } -/// RewriteUsesInNewModule - Given a constant 'OrigVal' and a module 'OrigMod', -/// find all uses of the constant. If they are not in the specified module, -/// replace them with uses of another constant 'NewVal'. -static void RewriteUsesInNewModule(Constant *OrigVal, Constant *NewVal, - Module *OrigMod) { - assert(OrigVal->getType() == NewVal->getType() && - "Can't replace something with a different type"); - for (Value::use_iterator UI = OrigVal->use_begin(), E = OrigVal->use_end(); - UI != E; ) { - Value::use_iterator TmpUI = UI++; - User *U = *TmpUI; - if (Instruction *Inst = dyn_cast(U)) { - if (Inst->getParent()->getParent()->getParent() != OrigMod) - TmpUI.getUse() = NewVal; - } else if (GlobalVariable *GV = dyn_cast(U)) { - if (GV->getParent() != OrigMod) - TmpUI.getUse() = NewVal; - } else if (ConstantExpr *CE = dyn_cast(U)) { - // If nothing uses this, don't bother making a copy. - if (CE->use_empty()) continue; - Constant *NewCE = CE->getWithOperandReplaced(TmpUI.getOperandNo(), - NewVal); - RewriteUsesInNewModule(CE, NewCE, OrigMod); - } else if (ConstantStruct *CS = dyn_cast(U)) { - // If nothing uses this, don't bother making a copy. - if (CS->use_empty()) continue; - unsigned OpNo = TmpUI.getOperandNo(); - std::vector Ops; - for (unsigned i = 0, e = CS->getNumOperands(); i != e; ++i) - Ops.push_back(i == OpNo ? NewVal : CS->getOperand(i)); - Constant *NewStruct = ConstantStruct::get(Ops); - RewriteUsesInNewModule(CS, NewStruct, OrigMod); - } else if (ConstantPacked *CP = dyn_cast(U)) { - // If nothing uses this, don't bother making a copy. - if (CP->use_empty()) continue; - unsigned OpNo = TmpUI.getOperandNo(); - std::vector Ops; - for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i) - Ops.push_back(i == OpNo ? NewVal : CP->getOperand(i)); - Constant *NewPacked = ConstantPacked::get(Ops); - RewriteUsesInNewModule(CP, NewPacked, OrigMod); - } else if (ConstantArray *CA = dyn_cast(U)) { - // If nothing uses this, don't bother making a copy. - if (CA->use_empty()) continue; - unsigned OpNo = TmpUI.getOperandNo(); - std::vector Ops; - for (unsigned i = 0, e = CA->getNumOperands(); i != e; ++i) { - Ops.push_back(i == OpNo ? NewVal : CA->getOperand(i)); - } - Constant *NewArray = ConstantArray::get(CA->getType(), Ops); - RewriteUsesInNewModule(CA, NewArray, OrigMod); - } else { - assert(0 && "Unexpected user"); - } - } -} - /// SplitFunctionsOutOfModule - Given a module and a list of functions in the /// module, split the functions OUT of the specified module, and place them in @@ -319,79 +261,29 @@ I != E; ++I) I->setLinkage(GlobalValue::ExternalLinkage); - // First off, we need to create the new module... - Module *New = new Module(M->getModuleIdentifier()); - New->setEndianness(M->getEndianness()); - New->setPointerSize(M->getPointerSize()); - New->setTargetTriple(M->getTargetTriple()); - New->setModuleInlineAsm(M->getModuleInlineAsm()); - - // Copy all of the dependent libraries over. - for (Module::lib_iterator I = M->lib_begin(), E = M->lib_end(); I != E; ++I) - New->addLibrary(*I); + Module *New = CloneModule(M); + + // Make sure global initializers exist only in the safe module (CBE->.so) + for (Module::global_iterator I = New->global_begin(), E = New->global_end(); + I != E; ++I) + I->setInitializer(0); // Delete the initializer to make it external - // build a set of the functions to search later... + // Remove the Test functions from the Safe module std::set > TestFunctions; for (unsigned i = 0, e = F.size(); i != e; ++i) { TestFunctions.insert(std::make_pair(F[i]->getName(), F[i]->getType())); + Function *TNOF = M->getFunction(F[i]->getName(), F[i]->getFunctionType()); + DEBUG(std::cerr << "Removing function " << F[i]->getName() << "\n"); + assert(TNOF && "Function doesn't exist in module!"); + DeleteFunctionBody(TNOF); // Function is now external in this module! } - std::map GlobalToPrototypeMap; - std::vector OrigGlobals; - - // Adding specified functions to new module... - for (Module::iterator I = M->begin(), E = M->end(); I != E;) { - OrigGlobals.push_back(I); - if (TestFunctions.count(std::make_pair(I->getName(), I->getType()))) { - Module::iterator tempI = I; - I++; - Function *Func = new Function(tempI->getFunctionType(), - GlobalValue::ExternalLinkage); - M->getFunctionList().insert(tempI, Func); - New->getFunctionList().splice(New->end(), - M->getFunctionList(), - tempI); - Func->setName(tempI->getName()); - Func->setCallingConv(tempI->getCallingConv()); - GlobalToPrototypeMap[tempI] = Func; - } else { - Function *Func = new Function(I->getFunctionType(), - GlobalValue::ExternalLinkage, - I->getName(), - New); - Func->setCallingConv(I->getCallingConv()); - GlobalToPrototypeMap[I] = Func; - I++; - } - } - - // Copy over global variable list. - for (Module::global_iterator I = M->global_begin(), E = M->global_end(); - I != E; ++I) { - OrigGlobals.push_back(I); - GlobalVariable *G = new GlobalVariable(I->getType()->getElementType(), - I->isConstant(), - GlobalValue::ExternalLinkage, - 0, I->getName(), New); - GlobalToPrototypeMap[I] = G; - } - // Copy all of the type symbol table entries over. - const SymbolTable &SymTab = M->getSymbolTable(); - SymbolTable::type_const_iterator TypeI = SymTab.type_begin(); - SymbolTable::type_const_iterator TypeE = SymTab.type_end(); - for (; TypeI != TypeE; ++TypeI) - New->addTypeName(TypeI->first, TypeI->second); - - // Loop over globals, rewriting uses in the module the prototype is in to use - // the prototype. - for (unsigned i = 0, e = OrigGlobals.size(); i != e; ++i) { - assert(OrigGlobals[i]->getName() == - GlobalToPrototypeMap[OrigGlobals[i]]->getName() && - "Something got renamed?"); - RewriteUsesInNewModule(OrigGlobals[i], GlobalToPrototypeMap[OrigGlobals[i]], - OrigGlobals[i]->getParent()); - } + // Remove the Safe functions from the Test module + for (Module::iterator I = New->begin(), E = New->end(); I != E; ++I) + if (!TestFunctions.count(std::make_pair(I->getName(), I->getType()))) + DeleteFunctionBody(I); + // Make sure that there is a global ctor/dtor array in both halves of the // module if they both have static ctor/dtor functions. From jlaskey at apple.com Thu Nov 9 02:06:04 2006 From: jlaskey at apple.com (Jim Laskey) Date: Thu, 9 Nov 2006 02:06:04 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/DataTypes.h.in Message-ID: <200611090806.kA9864DK025280@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Support: DataTypes.h.in updated: 1.25 -> 1.26 --- Log message: math.h for C's sake. --- Diffs of the changes: (+1 -1) DataTypes.h.in | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/Support/DataTypes.h.in diff -u llvm/include/llvm/Support/DataTypes.h.in:1.25 llvm/include/llvm/Support/DataTypes.h.in:1.26 --- llvm/include/llvm/Support/DataTypes.h.in:1.25 Wed Nov 8 12:48:14 2006 +++ llvm/include/llvm/Support/DataTypes.h.in Thu Nov 9 02:05:39 2006 @@ -50,7 +50,7 @@ #include #endif -#include +#include #ifdef _AIX #include "llvm/Support/AIXDataTypesFix.h" From jlaskey at apple.com Thu Nov 9 02:26:37 2006 From: jlaskey at apple.com (Jim Laskey) Date: Thu, 9 Nov 2006 02:26:37 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Support/DataTypes.h.in Message-ID: <200611090826.kA98Qb9J002180@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Support: DataTypes.h.in updated: 1.26 -> 1.27 --- Log message: math.h creates ambiguity --- Diffs of the changes: (+4 -0) DataTypes.h.in | 4 ++++ 1 files changed, 4 insertions(+) Index: llvm/include/llvm/Support/DataTypes.h.in diff -u llvm/include/llvm/Support/DataTypes.h.in:1.26 llvm/include/llvm/Support/DataTypes.h.in:1.27 --- llvm/include/llvm/Support/DataTypes.h.in:1.26 Thu Nov 9 02:05:39 2006 +++ llvm/include/llvm/Support/DataTypes.h.in Thu Nov 9 02:26:22 2006 @@ -50,7 +50,11 @@ #include #endif +#ifdef __cplusplus +#include +#else #include +#endif #ifdef _AIX #include "llvm/Support/AIXDataTypesFix.h" From rafael.espindola at gmail.com Thu Nov 9 07:59:09 2006 From: rafael.espindola at gmail.com (Rafael Espindola) Date: Thu, 9 Nov 2006 07:59:09 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/ARM/ARMAsmPrinter.cpp ARMISelDAGToDAG.cpp ARMInstrInfo.td ARMRegisterInfo.cpp Message-ID: <200611091359.kA9Dx9m5008357@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/ARM: ARMAsmPrinter.cpp updated: 1.28 -> 1.29 ARMISelDAGToDAG.cpp updated: 1.84 -> 1.85 ARMInstrInfo.td updated: 1.74 -> 1.75 ARMRegisterInfo.cpp updated: 1.25 -> 1.26 --- Log message: implement load effective address similar to the alpha backend remove lea_addri and the now unused memri addressing mode --- Diffs of the changes: (+15 -82) ARMAsmPrinter.cpp | 27 --------------------------- ARMISelDAGToDAG.cpp | 45 +++++++++++---------------------------------- ARMInstrInfo.td | 17 ----------------- ARMRegisterInfo.cpp | 8 ++++---- 4 files changed, 15 insertions(+), 82 deletions(-) Index: llvm/lib/Target/ARM/ARMAsmPrinter.cpp diff -u llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.28 llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.29 --- llvm/lib/Target/ARM/ARMAsmPrinter.cpp:1.28 Wed Nov 8 11:07:31 2006 +++ llvm/lib/Target/ARM/ARMAsmPrinter.cpp Thu Nov 9 07:58:55 2006 @@ -78,33 +78,6 @@ void printAddrMode1(const MachineInstr *MI, int opNum); void printAddrMode2(const MachineInstr *MI, int opNum); void printAddrMode5(const MachineInstr *MI, int opNum); - - void printMemRegImm(const MachineInstr *MI, int opNum, - const char *Modifier = NULL) { - const MachineOperand &MO1 = MI->getOperand(opNum); - const MachineOperand &MO2 = MI->getOperand(opNum + 1); - assert(MO1.isImmediate()); - bool arith = false; - if (Modifier != NULL) { - assert(strcmp(Modifier, "arith") == 0); - arith = true; - } - - if (MO2.isConstantPoolIndex()) { - printOperand(MI, opNum + 1); - } else if (MO2.isRegister()) { - if(!arith) - O << '['; - printOperand(MI, opNum + 1); - O << ", "; - printOperand(MI, opNum); - if(!arith) - O << ']'; - } else { - assert(0 && "Invalid Operand Type"); - } - } - void printOperand(const MachineInstr *MI, int opNum); void printMemOperand(const MachineInstr *MI, int opNum, const char *Modifier = 0); Index: llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp diff -u llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.84 llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.85 --- llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:1.84 Wed Nov 8 14:32:04 2006 +++ llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp Thu Nov 9 07:58:55 2006 @@ -751,8 +751,6 @@ SDNode *Select(SDOperand Op); virtual void InstructionSelectBasicBlock(SelectionDAG &DAG); - bool SelectAddrRegImm(SDOperand Op, SDOperand N, SDOperand &Offset, - SDOperand &Base); bool SelectAddrMode1(SDOperand Op, SDOperand N, SDOperand &Arg, SDOperand &Shift, SDOperand &ShiftType); bool SelectAddrMode2(SDOperand Op, SDOperand N, SDOperand &Arg, @@ -895,37 +893,6 @@ return true; } -//register plus/minus 12 bit offset -bool ARMDAGToDAGISel::SelectAddrRegImm(SDOperand Op, - SDOperand N, SDOperand &Offset, - SDOperand &Base) { - if (FrameIndexSDNode *FIN = dyn_cast(N)) { - Base = CurDAG->getTargetFrameIndex(FIN->getIndex(), MVT::i32); - Offset = CurDAG->getTargetConstant(0, MVT::i32); - return true; - } - if (N.getOpcode() == ISD::ADD) { - short imm = 0; - if (isInt12Immediate(N.getOperand(1), imm)) { - Offset = CurDAG->getTargetConstant(imm, MVT::i32); - if (FrameIndexSDNode *FI = dyn_cast(N.getOperand(0))) { - Base = CurDAG->getTargetFrameIndex(FI->getIndex(), N.getValueType()); - } else { - Base = N.getOperand(0); - } - return true; // [r+i] - } - } - - Offset = CurDAG->getTargetConstant(0, MVT::i32); - if (FrameIndexSDNode *FI = dyn_cast(N)) { - Base = CurDAG->getTargetFrameIndex(FI->getIndex(), N.getValueType()); - } - else - Base = N; - return true; //any address fits in a register -} - SDNode *ARMDAGToDAGISel::Select(SDOperand Op) { SDNode *N = Op.Val; @@ -933,8 +900,18 @@ default: return SelectCode(Op); break; + case ISD::FrameIndex: { + int FI = cast(N)->getIndex(); + SDOperand Ops[] = {CurDAG->getTargetFrameIndex(FI, MVT::i32), + CurDAG->getTargetConstant(0, MVT::i32), + CurDAG->getTargetConstant(0, MVT::i32), + CurDAG->getTargetConstant(ARMShift::LSL, MVT::i32)}; + + return CurDAG->SelectNodeTo(N, ARM::ADD, MVT::i32, Ops, + sizeof(Ops)/sizeof(SDOperand)); + break; + } } - return NULL; } } // end anonymous namespace Index: llvm/lib/Target/ARM/ARMInstrInfo.td diff -u llvm/lib/Target/ARM/ARMInstrInfo.td:1.74 llvm/lib/Target/ARM/ARMInstrInfo.td:1.75 --- llvm/lib/Target/ARM/ARMInstrInfo.td:1.74 Wed Nov 8 11:07:32 2006 +++ llvm/lib/Target/ARM/ARMInstrInfo.td Thu Nov 9 07:58:55 2006 @@ -28,11 +28,6 @@ let MIOperandInfo = (ops ptr_rc, i32imm); } -def memri : Operand { - let PrintMethod = "printMemRegImm"; - let MIOperandInfo = (ops i32imm, ptr_rc); -} - // Define ARM specific addressing mode. //Addressing Mode 1: data processing operands def addr_mode1 : ComplexPattern; -//register plus/minus 12 bit offset -def iaddr : ComplexPattern; -//register plus scaled register -//def raddr : ComplexPattern; - //===----------------------------------------------------------------------===// // Instruction Class Templates //===----------------------------------------------------------------------===// @@ -203,13 +193,6 @@ def ADD : Addr1BinOp<"add", add>; def ADCS : Addr1BinOp<"adcs", adde>; def ADDS : Addr1BinOp<"adds", addc>; - -// "LEA" forms of add -def lea_addri : InstARM<(ops IntRegs:$dst, memri:$addr), - "add $dst, ${addr:arith}", - [(set IntRegs:$dst, iaddr:$addr)]>; - - def SUB : Addr1BinOp<"sub", sub>; def SBCS : Addr1BinOp<"sbcs", sube>; def SUBS : Addr1BinOp<"subs", subc>; Index: llvm/lib/Target/ARM/ARMRegisterInfo.cpp diff -u llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.25 llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.26 --- llvm/lib/Target/ARM/ARMRegisterInfo.cpp:1.25 Wed Nov 8 11:07:32 2006 +++ llvm/lib/Target/ARM/ARMRegisterInfo.cpp Thu Nov 9 07:58:55 2006 @@ -129,11 +129,11 @@ MachineFunction &MF = *MBB.getParent(); assert (MI.getOpcode() == ARM::LDR || - MI.getOpcode() == ARM::STR || - MI.getOpcode() == ARM::lea_addri); + MI.getOpcode() == ARM::STR || + MI.getOpcode() == ARM::ADD); - unsigned FrameIdx = MI.getOpcode() == ARM::lea_addri ? 2 : 1; - unsigned OffIdx = MI.getOpcode() == ARM::lea_addri ? 1 : 2; + unsigned FrameIdx = 1; + unsigned OffIdx = 2; int FrameIndex = MI.getOperand(FrameIdx).getFrameIndex(); From jlaskey at apple.com Thu Nov 9 08:52:28 2006 From: jlaskey at apple.com (Jim Laskey) Date: Thu, 9 Nov 2006 08:52:28 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/DwarfWriter.cpp Message-ID: <200611091452.kA9EqS1m009331@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: DwarfWriter.cpp updated: 1.99 -> 1.100 --- Log message: Merging dwarf info to a single compile unit. --- Diffs of the changes: (+105 -118) DwarfWriter.cpp | 223 ++++++++++++++++++++++++++------------------------------ 1 files changed, 105 insertions(+), 118 deletions(-) Index: llvm/lib/CodeGen/DwarfWriter.cpp diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.99 llvm/lib/CodeGen/DwarfWriter.cpp:1.100 --- llvm/lib/CodeGen/DwarfWriter.cpp:1.99 Tue Nov 7 13:33:46 2006 +++ llvm/lib/CodeGen/DwarfWriter.cpp Thu Nov 9 08:52:14 2006 @@ -438,10 +438,11 @@ /// Profile - Used to gather unique data for the value folding set. /// - virtual void Profile(FoldingSetNodeID &ID) { + static void Profile(FoldingSetNodeID &ID, unsigned Integer) { ID.AddInteger(isInteger); ID.AddInteger(Integer); } + virtual void Profile(FoldingSetNodeID &ID) { Profile(ID, Integer); } #ifndef NDEBUG virtual void print(std::ostream &O) { @@ -476,10 +477,11 @@ /// Profile - Used to gather unique data for the value folding set. /// - virtual void Profile(FoldingSetNodeID &ID) { + static void Profile(FoldingSetNodeID &ID, const std::string &String) { ID.AddInteger(isString); ID.AddString(String); } + virtual void Profile(FoldingSetNodeID &ID) { Profile(ID, String); } #ifndef NDEBUG virtual void print(std::ostream &O) { @@ -512,10 +514,11 @@ /// Profile - Used to gather unique data for the value folding set. /// - virtual void Profile(FoldingSetNodeID &ID) { + static void Profile(FoldingSetNodeID &ID, const DWLabel &Label) { ID.AddInteger(isLabel); Label.Profile(ID); } + virtual void Profile(FoldingSetNodeID &ID) { Profile(ID, Label); } #ifndef NDEBUG virtual void print(std::ostream &O) { @@ -549,10 +552,11 @@ /// Profile - Used to gather unique data for the value folding set. /// - virtual void Profile(FoldingSetNodeID &ID) { + static void Profile(FoldingSetNodeID &ID, const std::string &Label) { ID.AddInteger(isAsIsLabel); ID.AddString(Label); } + virtual void Profile(FoldingSetNodeID &ID) { Profile(ID, Label); } #ifndef NDEBUG virtual void print(std::ostream &O) { @@ -586,11 +590,13 @@ /// Profile - Used to gather unique data for the value folding set. /// - virtual void Profile(FoldingSetNodeID &ID){ + static void Profile(FoldingSetNodeID &ID, const DWLabel &LabelHi, + const DWLabel &LabelLo) { ID.AddInteger(isDelta); LabelHi.Profile(ID); LabelLo.Profile(ID); } + virtual void Profile(FoldingSetNodeID &ID) { Profile(ID, LabelHi, LabelLo); } #ifndef NDEBUG virtual void print(std::ostream &O) { @@ -628,6 +634,10 @@ /// Profile - Used to gather unique data for the value folding set. /// + static void Profile(FoldingSetNodeID &ID, DIE *Entry) { + ID.AddInteger(isEntry); + ID.AddPointer(Entry); + } virtual void Profile(FoldingSetNodeID &ID) { ID.AddInteger(isEntry); @@ -1145,7 +1155,7 @@ if (Entry) { FoldingSetNodeID ID; - ID.AddPointer(Entry); + DIEntry::Profile(ID, Entry); void *Where; Value = static_cast(ValuesSet.FindNodeOrInsertPos(ID, Where)); @@ -1176,7 +1186,7 @@ if (!Form) Form = DIEInteger::BestForm(false, Integer); FoldingSetNodeID ID; - ID.AddInteger(Integer); + DIEInteger::Profile(ID, Integer); void *Where; DIEValue *Value = ValuesSet.FindNodeOrInsertPos(ID, Where); if (!Value) { @@ -1194,7 +1204,7 @@ if (!Form) Form = DIEInteger::BestForm(true, Integer); FoldingSetNodeID ID; - ID.AddInteger((uint64_t)Integer); + DIEInteger::Profile(ID, (uint64_t)Integer); void *Where; DIEValue *Value = ValuesSet.FindNodeOrInsertPos(ID, Where); if (!Value) { @@ -1211,7 +1221,7 @@ void AddString(DIE *Die, unsigned Attribute, unsigned Form, const std::string &String) { FoldingSetNodeID ID; - ID.AddString(String); + DIEString::Profile(ID, String); void *Where; DIEValue *Value = ValuesSet.FindNodeOrInsertPos(ID, Where); if (!Value) { @@ -1228,7 +1238,7 @@ void AddLabel(DIE *Die, unsigned Attribute, unsigned Form, const DWLabel &Label) { FoldingSetNodeID ID; - Label.Profile(ID); + DIEDwarfLabel::Profile(ID, Label); void *Where; DIEValue *Value = ValuesSet.FindNodeOrInsertPos(ID, Where); if (!Value) { @@ -1245,7 +1255,7 @@ void AddObjectLabel(DIE *Die, unsigned Attribute, unsigned Form, const std::string &Label) { FoldingSetNodeID ID; - ID.AddString(Label); + DIEObjectLabel::Profile(ID, Label); void *Where; DIEValue *Value = ValuesSet.FindNodeOrInsertPos(ID, Where); if (!Value) { @@ -1262,8 +1272,7 @@ void AddDelta(DIE *Die, unsigned Attribute, unsigned Form, const DWLabel &Hi, const DWLabel &Lo) { FoldingSetNodeID ID; - Hi.Profile(ID); - Lo.Profile(ID); + DIEDelta::Profile(ID, Hi, Lo); void *Where; DIEValue *Value = ValuesSet.FindNodeOrInsertPos(ID, Where); if (!Value) { @@ -1717,7 +1726,7 @@ // Get the compile unit context. CompileUnitDesc *UnitDesc = static_cast(GVD->getContext()); - CompileUnit *Unit = FindCompileUnit(UnitDesc); + CompileUnit *Unit = GetBaseCompileUnit(); // Check for pre-existence. DIE *&Slot = Unit->getDieMapSlotFor(GVD); @@ -1771,7 +1780,7 @@ // Get the compile unit context. CompileUnitDesc *UnitDesc = static_cast(SPD->getContext()); - CompileUnit *Unit = FindCompileUnit(UnitDesc); + CompileUnit *Unit = GetBaseCompileUnit(); // Check for pre-existence. DIE *&Slot = Unit->getDieMapSlotFor(SPD); @@ -1839,7 +1848,7 @@ MachineLocation Location; RI->getLocation(*MF, DV->getFrameIndex(), Location); AddAddress(VariableDie, DW_AT_location, Location); - + return VariableDie; } @@ -1864,7 +1873,7 @@ unsigned StartID = DebugInfo->MappedLabel(Scope->getStartLabelID()); unsigned EndID = DebugInfo->MappedLabel(Scope->getEndLabelID()); - + // Ignore empty scopes. if (StartID == EndID && StartID != 0) continue; if (Scope->getScopes().empty() && Scope->getVariables().empty()) continue; @@ -1903,9 +1912,7 @@ SubprogramDesc *SPD = cast(RootScope->getDesc()); // Get the compile unit context. - CompileUnitDesc *UnitDesc = - static_cast(SPD->getContext()); - CompileUnit *Unit = FindCompileUnit(UnitDesc); + CompileUnit *Unit = GetBaseCompileUnit(); // Get the subprogram die. DIE *SPDie = Unit->getDieMapSlotFor(SPD); @@ -1918,7 +1925,7 @@ DWLabel("func_end", SubprogramCount)); MachineLocation Location(RI->getFrameRegister(*MF)); AddAddress(SPDie, DW_AT_frame_base, Location); - + ConstructScope(RootScope, SPDie, Unit); } @@ -2066,18 +2073,14 @@ /// SizeAndOffsets - Compute the size and offset of all the DIEs. /// void SizeAndOffsets() { - // Process each compile unit. - for (unsigned i = 0, N = CompileUnits.size(); i < N; ++i) { - CompileUnit *Unit = CompileUnits[i]; - if (Unit->hasContent()) { - // Compute size of compile unit header - unsigned Offset = sizeof(int32_t) + // Length of Compilation Unit Info - sizeof(int16_t) + // DWARF version number - sizeof(int32_t) + // Offset Into Abbrev. Section - sizeof(int8_t); // Pointer Size (in bytes) - SizeAndOffsetDie(Unit->getDie(), Offset, (i + 1) == N); - } - } + // Process base compile unit. + CompileUnit *Unit = GetBaseCompileUnit(); + // Compute size of compile unit header + unsigned Offset = sizeof(int32_t) + // Length of Compilation Unit Info + sizeof(int16_t) + // DWARF version number + sizeof(int32_t) + // Offset Into Abbrev. Section + sizeof(int8_t); // Pointer Size (in bytes) + SizeAndOffsetDie(Unit->getDie(), Offset, true); } /// EmitFrameMoves - Emit frame instructions to describe the layout of the @@ -2164,32 +2167,26 @@ // Start debug info section. Asm->SwitchToDataSection(TAI->getDwarfInfoSection()); - // Process each compile unit. - for (unsigned i = 0, N = CompileUnits.size(); i < N; ++i) { - CompileUnit *Unit = CompileUnits[i]; - - if (Unit->hasContent()) { - DIE *Die = Unit->getDie(); - // Emit the compile units header. - EmitLabel("info_begin", Unit->getID()); - // Emit size of content not including length itself - unsigned ContentSize = Die->getSize() + - sizeof(int16_t) + // DWARF version number - sizeof(int32_t) + // Offset Into Abbrev. Section - sizeof(int8_t); // Pointer Size (in bytes) - - EmitInt32(ContentSize); EOL("Length of Compilation Unit Info"); - EmitInt16(DWARF_VERSION); EOL("DWARF version number"); - EmitDifference("abbrev_begin", 0, "section_abbrev", 0); - EOL("Offset Into Abbrev. Section"); - EmitInt8(TAI->getAddressSize()); EOL("Address Size (in bytes)"); - - EmitDIE(Die); - EmitLabel("info_end", Unit->getID()); - } - - O << "\n"; - } + CompileUnit *Unit = GetBaseCompileUnit(); + DIE *Die = Unit->getDie(); + // Emit the compile units header. + EmitLabel("info_begin", Unit->getID()); + // Emit size of content not including length itself + unsigned ContentSize = Die->getSize() + + sizeof(int16_t) + // DWARF version number + sizeof(int32_t) + // Offset Into Abbrev. Section + sizeof(int8_t); // Pointer Size (in bytes) + + EmitInt32(ContentSize); EOL("Length of Compilation Unit Info"); + EmitInt16(DWARF_VERSION); EOL("DWARF version number"); + EmitDifference("abbrev_begin", 0, "section_abbrev", 0); + EOL("Offset Into Abbrev. Section"); + EmitInt8(TAI->getAddressSize()); EOL("Address Size (in bytes)"); + + EmitDIE(Die); + EmitLabel("info_end", Unit->getID()); + + O << "\n"; } /// EmitAbbreviations - Emit the abbreviation section. @@ -2455,43 +2452,38 @@ // Start the dwarf pubnames section. Asm->SwitchToDataSection(TAI->getDwarfPubNamesSection()); - // Process each compile unit. - for (unsigned i = 0, N = CompileUnits.size(); i < N; ++i) { - CompileUnit *Unit = CompileUnits[i]; - - if (Unit->hasContent()) { - EmitDifference("pubnames_end", Unit->getID(), - "pubnames_begin", Unit->getID()); - EOL("Length of Public Names Info"); - - EmitLabel("pubnames_begin", Unit->getID()); - - EmitInt16(DWARF_VERSION); EOL("DWARF Version"); - - EmitDifference("info_begin", Unit->getID(), "section_info", 0); - EOL("Offset of Compilation Unit Info"); + CompileUnit *Unit = GetBaseCompileUnit(); + + EmitDifference("pubnames_end", Unit->getID(), + "pubnames_begin", Unit->getID()); + EOL("Length of Public Names Info"); + + EmitLabel("pubnames_begin", Unit->getID()); + + EmitInt16(DWARF_VERSION); EOL("DWARF Version"); + + EmitDifference("info_begin", Unit->getID(), "section_info", 0); + EOL("Offset of Compilation Unit Info"); - EmitDifference("info_end", Unit->getID(), "info_begin", Unit->getID()); - EOL("Compilation Unit Length"); - - std::map &Globals = Unit->getGlobals(); - - for (std::map::iterator GI = Globals.begin(), - GE = Globals.end(); - GI != GE; ++GI) { - const std::string &Name = GI->first; - DIE * Entity = GI->second; - - EmitInt32(Entity->getOffset()); EOL("DIE offset"); - EmitString(Name); EOL("External Name"); - } - - EmitInt32(0); EOL("End Mark"); - EmitLabel("pubnames_end", Unit->getID()); + EmitDifference("info_end", Unit->getID(), "info_begin", Unit->getID()); + EOL("Compilation Unit Length"); + + std::map &Globals = Unit->getGlobals(); + + for (std::map::iterator GI = Globals.begin(), + GE = Globals.end(); + GI != GE; ++GI) { + const std::string &Name = GI->first; + DIE * Entity = GI->second; - O << "\n"; - } + EmitInt32(Entity->getOffset()); EOL("DIE offset"); + EmitString(Name); EOL("External Name"); } + + EmitInt32(0); EOL("End Mark"); + EmitLabel("pubnames_end", Unit->getID()); + + O << "\n"; } /// EmitDebugStr - Emit visible names into a debug str section. @@ -2533,36 +2525,31 @@ // FIXME - Mock up #if 0 - // Process each compile unit. - for (unsigned i = 0, N = CompileUnits.size(); i < N; ++i) { - CompileUnit *Unit = CompileUnits[i]; - - if (Unit->hasContent()) { - // Don't include size of length - EmitInt32(0x1c); EOL("Length of Address Ranges Info"); - - EmitInt16(DWARF_VERSION); EOL("Dwarf Version"); - - EmitReference("info_begin", Unit->getID()); - EOL("Offset of Compilation Unit Info"); + CompileUnit *Unit = GetBaseCompileUnit(); + + // Don't include size of length + EmitInt32(0x1c); EOL("Length of Address Ranges Info"); + + EmitInt16(DWARF_VERSION); EOL("Dwarf Version"); + + EmitReference("info_begin", Unit->getID()); + EOL("Offset of Compilation Unit Info"); - EmitInt8(TAI->getAddressSize()); EOL("Size of Address"); + EmitInt8(TAI->getAddressSize()); EOL("Size of Address"); - EmitInt8(0); EOL("Size of Segment Descriptor"); + EmitInt8(0); EOL("Size of Segment Descriptor"); - EmitInt16(0); EOL("Pad (1)"); - EmitInt16(0); EOL("Pad (2)"); + EmitInt16(0); EOL("Pad (1)"); + EmitInt16(0); EOL("Pad (2)"); - // Range 1 - EmitReference("text_begin", 0); EOL("Address"); - EmitDifference("text_end", 0, "text_begin", 0); EOL("Length"); + // Range 1 + EmitReference("text_begin", 0); EOL("Address"); + EmitDifference("text_end", 0, "text_begin", 0); EOL("Length"); - EmitInt32(0); EOL("EOM (1)"); - EmitInt32(0); EOL("EOM (2)"); - - O << "\n"; - } - } + EmitInt32(0); EOL("EOM (1)"); + EmitInt32(0); EOL("EOM (2)"); + + O << "\n"; #endif } From jlaskey at apple.com Thu Nov 9 10:32:41 2006 From: jlaskey at apple.com (Jim Laskey) Date: Thu, 9 Nov 2006 10:32:41 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/DwarfWriter.cpp Message-ID: <200611091632.kA9GWfer011152@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: DwarfWriter.cpp updated: 1.100 -> 1.101 --- Log message: Allows debugging llc self hosted. --- Diffs of the changes: (+7 -2) DwarfWriter.cpp | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/DwarfWriter.cpp diff -u llvm/lib/CodeGen/DwarfWriter.cpp:1.100 llvm/lib/CodeGen/DwarfWriter.cpp:1.101 --- llvm/lib/CodeGen/DwarfWriter.cpp:1.100 Thu Nov 9 08:52:14 2006 +++ llvm/lib/CodeGen/DwarfWriter.cpp Thu Nov 9 10:32:26 2006 @@ -289,6 +289,7 @@ unsigned getAbbrevNumber() const { return Abbrev.getNumber(); } + unsigned getTag() const { return Abbrev.getTag(); } unsigned getOffset() const { return Offset; } unsigned getSize() const { return Size; } const std::vector &getChildren() const { return Children; } @@ -1438,8 +1439,12 @@ Buffer.setTag(DW_TAG_base_type); AddUInt(&Buffer, DW_AT_encoding, DW_FORM_data1, BasicTy->getEncoding()); } else if (DerivedTypeDesc *DerivedTy = dyn_cast(TyDesc)) { - // Pointers, tyepdefs et al. - Buffer.setTag(DerivedTy->getTag()); + // Fetch tag. + unsigned Tag = DerivedTy->getTag(); + // FIXME - Workaround for templates. + if (Tag == DW_TAG_inheritance) Tag = DW_TAG_reference_type; + // Pointers, typedefs et al. + Buffer.setTag(Tag); // Map to main type, void will not have a type. if (TypeDesc *FromTy = DerivedTy->getFromType()) AddType(&Buffer, FromTy, Unit); From evan.cheng at apple.com Thu Nov 9 11:53:15 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 9 Nov 2006 11:53:15 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/SelectionDAG.h SelectionDAGNodes.h Message-ID: <200611091753.kA9HrFf8013105@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: SelectionDAG.h updated: 1.144 -> 1.145 SelectionDAGNodes.h updated: 1.161 -> 1.162 --- Log message: Rename ISD::MemOpAddrMode to ISD::MemIndexedMode --- Diffs of the changes: (+14 -13) SelectionDAG.h | 4 ++-- SelectionDAGNodes.h | 23 ++++++++++++----------- 2 files changed, 14 insertions(+), 13 deletions(-) Index: llvm/include/llvm/CodeGen/SelectionDAG.h diff -u llvm/include/llvm/CodeGen/SelectionDAG.h:1.144 llvm/include/llvm/CodeGen/SelectionDAG.h:1.145 --- llvm/include/llvm/CodeGen/SelectionDAG.h:1.144 Sun Nov 5 13:31:28 2006 +++ llvm/include/llvm/CodeGen/SelectionDAG.h Thu Nov 9 11:53:01 2006 @@ -316,7 +316,7 @@ SDOperand Chain, SDOperand Ptr, const Value *SV, int SVOffset, MVT::ValueType EVT, bool isVolatile=false); SDOperand getIndexedLoad(SDOperand OrigLoad, SDOperand Base, - SDOperand Offset, ISD::MemOpAddrMode AM); + SDOperand Offset, ISD::MemIndexedMode AM); SDOperand getVecLoad(unsigned Count, MVT::ValueType VT, SDOperand Chain, SDOperand Ptr, SDOperand SV); @@ -328,7 +328,7 @@ const Value *SV, int SVOffset, MVT::ValueType TVT, bool isVolatile=false); SDOperand getIndexedStore(SDOperand OrigStoe, SDOperand Base, - SDOperand Offset, ISD::MemOpAddrMode AM); + SDOperand Offset, ISD::MemIndexedMode AM); // getSrcValue - construct a node to track a Value* through the backend SDOperand getSrcValue(const Value* I, int offset = 0); Index: llvm/include/llvm/CodeGen/SelectionDAGNodes.h diff -u llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.161 llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.162 --- llvm/include/llvm/CodeGen/SelectionDAGNodes.h:1.161 Fri Nov 3 01:29:55 2006 +++ llvm/include/llvm/CodeGen/SelectionDAGNodes.h Thu Nov 9 11:53:01 2006 @@ -524,8 +524,8 @@ bool isBuildVectorAllZeros(const SDNode *N); //===--------------------------------------------------------------------===// - /// MemOpAddrMode enum - This enum defines the three load / store addressing - /// modes. + /// MemIndexedMode enum - This enum defines the load / store indexed + /// addressing modes. /// /// UNINDEXED "Normal" load / store. The effective address is already /// computed and is available in the base pointer. The offset @@ -552,12 +552,13 @@ /// computation); a post-indexed store produces one value (the /// the result of the base +/- offset computation). /// - enum MemOpAddrMode { + enum MemIndexedMode { UNINDEXED = 0, PRE_INC, PRE_DEC, POST_INC, - POST_DEC + POST_DEC, + LAST_INDEXED_MODE }; //===--------------------------------------------------------------------===// @@ -865,7 +866,7 @@ /// getOperationName - Return the opcode of this operation for printing. /// const char* getOperationName(const SelectionDAG *G = 0) const; - static const char* getAddressingModeName(ISD::MemOpAddrMode AM); + static const char* getIndexedModeName(ISD::MemIndexedMode AM); void dump() const; void dump(const SelectionDAG *G) const; @@ -1383,7 +1384,7 @@ /// class LoadSDNode : public SDNode { // AddrMode - unindexed, pre-indexed, post-indexed. - ISD::MemOpAddrMode AddrMode; + ISD::MemIndexedMode AddrMode; // ExtType - non-ext, anyext, sext, zext. ISD::LoadExtType ExtType; @@ -1405,7 +1406,7 @@ protected: friend class SelectionDAG; LoadSDNode(SDOperand Chain, SDOperand Ptr, SDOperand Off, - ISD::MemOpAddrMode AM, ISD::LoadExtType ETy, MVT::ValueType LVT, + ISD::MemIndexedMode AM, ISD::LoadExtType ETy, MVT::ValueType LVT, const Value *SV, int O=0, unsigned Align=1, bool Vol=false) : SDNode(ISD::LOAD, Chain, Ptr, Off), AddrMode(AM), ExtType(ETy), LoadedVT(LVT), SrcValue(SV), SVOffset(O), @@ -1418,7 +1419,7 @@ const SDOperand getChain() const { return getOperand(0); } const SDOperand getBasePtr() const { return getOperand(1); } const SDOperand getOffset() const { return getOperand(2); } - ISD::MemOpAddrMode getAddressingMode() const { return AddrMode; } + ISD::MemIndexedMode getAddressingMode() const { return AddrMode; } ISD::LoadExtType getExtensionType() const { return ExtType; } MVT::ValueType getLoadedVT() const { return LoadedVT; } const Value *getSrcValue() const { return SrcValue; } @@ -1436,7 +1437,7 @@ /// class StoreSDNode : public SDNode { // AddrMode - unindexed, pre-indexed, post-indexed. - ISD::MemOpAddrMode AddrMode; + ISD::MemIndexedMode AddrMode; // IsTruncStore - True is the op does a truncation before store. bool IsTruncStore; @@ -1458,7 +1459,7 @@ protected: friend class SelectionDAG; StoreSDNode(SDOperand Chain, SDOperand Value, SDOperand Ptr, SDOperand Off, - ISD::MemOpAddrMode AM, bool isTrunc, MVT::ValueType SVT, + ISD::MemIndexedMode AM, bool isTrunc, MVT::ValueType SVT, const Value *SV, int O=0, unsigned Align=0, bool Vol=false) : SDNode(ISD::STORE, Chain, Value, Ptr, Off), AddrMode(AM), IsTruncStore(isTrunc), StoredVT(SVT), SrcValue(SV), @@ -1472,7 +1473,7 @@ const SDOperand getValue() const { return getOperand(1); } const SDOperand getBasePtr() const { return getOperand(2); } const SDOperand getOffset() const { return getOperand(3); } - ISD::MemOpAddrMode getAddressingMode() const { return AddrMode; } + ISD::MemIndexedMode getAddressingMode() const { return AddrMode; } bool isTruncatingStore() const { return IsTruncStore; } MVT::ValueType getStoredVT() const { return StoredVT; } const Value *getSrcValue() const { return SrcValue; } From evan.cheng at apple.com Thu Nov 9 11:53:17 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 9 Nov 2006 11:53:17 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetLowering.h Message-ID: <200611091753.kA9HrHH2013108@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetLowering.h updated: 1.88 -> 1.89 --- Log message: Rename ISD::MemOpAddrMode to ISD::MemIndexedMode --- Diffs of the changes: (+3 -3) TargetLowering.h | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/include/llvm/Target/TargetLowering.h diff -u llvm/include/llvm/Target/TargetLowering.h:1.88 llvm/include/llvm/Target/TargetLowering.h:1.89 --- llvm/include/llvm/Target/TargetLowering.h:1.88 Wed Nov 8 22:29:09 2006 +++ llvm/include/llvm/Target/TargetLowering.h Thu Nov 9 11:53:01 2006 @@ -377,7 +377,7 @@ /// can be legally represented as pre-indexed load / store address. virtual bool getPreIndexedAddressParts(SDNode *N, SDOperand &Base, SDOperand &Offset, - ISD::MemOpAddrMode &AM, + ISD::MemIndexedMode &AM, SelectionDAG &DAG) { return false; } @@ -387,7 +387,7 @@ /// combined with a load / store to form a post-indexed load / store. virtual bool getPostIndexedAddressParts(SDNode *N, SDNode *Op, SDOperand &Base, SDOperand &Offset, - ISD::MemOpAddrMode &AM, + ISD::MemIndexedMode &AM, SelectionDAG &DAG) { return false; } @@ -869,7 +869,7 @@ /// LegalizeAction that indicates how instruction selection should deal with /// the store. uint64_t StoreXActions; - + ValueTypeActionImpl ValueTypeActions; std::vector LegalFPImmediates; From evan.cheng at apple.com Thu Nov 9 11:54:34 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 9 Nov 2006 11:54:34 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp SelectionDAG.cpp Message-ID: <200611091754.kA9HsYxv013185@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.245 -> 1.246 SelectionDAG.cpp updated: 1.371 -> 1.372 --- Log message: Rename ISD::MemOpAddrMode to ISD::MemIndexedMode --- Diffs of the changes: (+11 -9) DAGCombiner.cpp | 4 ++-- SelectionDAG.cpp | 16 +++++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.245 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.246 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.245 Wed Nov 8 22:29:46 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu Nov 9 11:54:19 2006 @@ -202,7 +202,7 @@ Ptr.Val->use_size() > 1) { SDOperand BasePtr; SDOperand Offset; - ISD::MemOpAddrMode AM = ISD::UNINDEXED; + ISD::MemIndexedMode AM = ISD::UNINDEXED; if (TLI.getPreIndexedAddressParts(N, BasePtr, Offset, AM, DAG)) { // Try turning it into a pre-indexed load / store except when // 1) Another use of base ptr is a predecessor of N. If ptr is folded @@ -298,7 +298,7 @@ SDOperand BasePtr; SDOperand Offset; - ISD::MemOpAddrMode AM = ISD::UNINDEXED; + ISD::MemIndexedMode AM = ISD::UNINDEXED; if (TLI.getPostIndexedAddressParts(N, Op, BasePtr, Offset, AM,DAG)) { if (Ptr == Offset) std::swap(BasePtr, Offset); Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.371 llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.372 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1.371 Wed Nov 8 13:16:43 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Thu Nov 9 11:54:19 2006 @@ -1619,8 +1619,9 @@ return SDOperand(N, 0); } -SDOperand SelectionDAG::getIndexedLoad(SDOperand OrigLoad, SDOperand Base, - SDOperand Offset, ISD::MemOpAddrMode AM){ +SDOperand +SelectionDAG::getIndexedLoad(SDOperand OrigLoad, SDOperand Base, + SDOperand Offset, ISD::MemIndexedMode AM) { LoadSDNode *LD = cast(OrigLoad); assert(LD->getOffset().getOpcode() == ISD::UNDEF && "Load is already a indexed load!"); @@ -1722,8 +1723,9 @@ return SDOperand(N, 0); } -SDOperand SelectionDAG::getIndexedStore(SDOperand OrigStore, SDOperand Base, - SDOperand Offset, ISD::MemOpAddrMode AM){ +SDOperand +SelectionDAG::getIndexedStore(SDOperand OrigStore, SDOperand Base, + SDOperand Offset, ISD::MemIndexedMode AM) { StoreSDNode *ST = cast(OrigStore); assert(ST->getOffset().getOpcode() == ISD::UNDEF && "Store is already a indexed store!"); @@ -2841,7 +2843,7 @@ } } -const char *SDNode::getAddressingModeName(ISD::MemOpAddrMode AM) { +const char *SDNode::getIndexedModeName(ISD::MemIndexedMode AM) { switch (AM) { default: return ""; @@ -2943,7 +2945,7 @@ if (doExt) std::cerr << MVT::getValueTypeString(LD->getLoadedVT()) << ">"; - const char *AM = getAddressingModeName(LD->getAddressingMode()); + const char *AM = getIndexedModeName(LD->getAddressingMode()); if (AM != "") std::cerr << " " << AM; } else if (const StoreSDNode *ST = dyn_cast(this)) { @@ -2951,7 +2953,7 @@ std::cerr << " getStoredVT()) << ">"; - const char *AM = getAddressingModeName(ST->getAddressingMode()); + const char *AM = getIndexedModeName(ST->getAddressingMode()); if (AM != "") std::cerr << " " << AM; } From evan.cheng at apple.com Thu Nov 9 11:55:19 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 9 Nov 2006 11:55:19 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelLowering.cpp PPCISelLowering.h Message-ID: <200611091755.kA9HtJVd013266@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCISelLowering.cpp updated: 1.219 -> 1.220 PPCISelLowering.h updated: 1.55 -> 1.56 --- Log message: Rename ISD::MemOpAddrMode to ISD::MemIndexedMode --- Diffs of the changes: (+2 -2) PPCISelLowering.cpp | 2 +- PPCISelLowering.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.219 llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.220 --- llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.219 Tue Nov 7 20:15:41 2006 +++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp Thu Nov 9 11:55:04 2006 @@ -853,7 +853,7 @@ /// can be legally represented as pre-indexed load / store address. bool PPCTargetLowering::getPreIndexedAddressParts(SDNode *N, SDOperand &Base, SDOperand &Offset, - ISD::MemOpAddrMode &AM, + ISD::MemIndexedMode &AM, SelectionDAG &DAG) { return false; Index: llvm/lib/Target/PowerPC/PPCISelLowering.h diff -u llvm/lib/Target/PowerPC/PPCISelLowering.h:1.55 llvm/lib/Target/PowerPC/PPCISelLowering.h:1.56 --- llvm/lib/Target/PowerPC/PPCISelLowering.h:1.55 Tue Nov 7 20:15:41 2006 +++ llvm/lib/Target/PowerPC/PPCISelLowering.h Thu Nov 9 11:55:04 2006 @@ -182,7 +182,7 @@ /// can be legally represented as pre-indexed load / store address. virtual bool getPreIndexedAddressParts(SDNode *N, SDOperand &Base, SDOperand &Offset, - ISD::MemOpAddrMode &AM, + ISD::MemIndexedMode &AM, SelectionDAG &DAG); /// SelectAddressRegReg - Given the specified addressed, check to see if it From evan.cheng at apple.com Thu Nov 9 12:43:41 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 9 Nov 2006 12:43:41 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Message-ID: <200611091843.kA9IhfWs026578@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGPrinter.cpp updated: 1.42 -> 1.43 --- Log message: Rename ISD::MemOpAddrMode to ISD::MemIndexedMode --- Diffs of the changes: (+2 -2) SelectionDAGPrinter.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.42 llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.43 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp:1.42 Tue Oct 31 22:48:30 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp Thu Nov 9 12:43:20 2006 @@ -165,11 +165,11 @@ if (doExt) Op = Op + MVT::getValueTypeString(LD->getLoadedVT()) + ">"; - Op += LD->getAddressingModeName(LD->getAddressingMode()); + Op += LD->getIndexedModeName(LD->getAddressingMode()); } else if (const StoreSDNode *ST = dyn_cast(Node)) { if (ST->isTruncatingStore()) Op = Op + "getStoredVT()) + ">"; - Op += ST->getAddressingModeName(ST->getAddressingMode()); + Op += ST->getIndexedModeName(ST->getAddressingMode()); } return Op; From evan.cheng at apple.com Thu Nov 9 12:44:35 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 9 Nov 2006 12:44:35 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/TargetSelectionDAG.td Message-ID: <200611091844.kA9IiZTD026612@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: TargetSelectionDAG.td updated: 1.75 -> 1.76 --- Log message: Rename ISD::MemOpAddrMode to ISD::MemIndexedMode --- Diffs of the changes: (+12 -12) TargetSelectionDAG.td | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-) Index: llvm/lib/Target/TargetSelectionDAG.td diff -u llvm/lib/Target/TargetSelectionDAG.td:1.75 llvm/lib/Target/TargetSelectionDAG.td:1.76 --- llvm/lib/Target/TargetSelectionDAG.td:1.75 Wed Nov 8 17:02:11 2006 +++ llvm/lib/Target/TargetSelectionDAG.td Thu Nov 9 12:44:21 2006 @@ -551,7 +551,7 @@ def pre_store : PatFrag<(ops node:$val, node:$base, node:$offset), (ist node:$val, node:$base, node:$offset), [{ if (StoreSDNode *ST = dyn_cast(N)) { - ISD::MemOpAddrMode AM = ST->getAddressingMode(); + ISD::MemIndexedMode AM = ST->getAddressingMode(); return (AM == ISD::PRE_INC || AM == ISD::PRE_DEC) && !ST->isTruncatingStore(); } @@ -561,7 +561,7 @@ def pre_truncsti1 : PatFrag<(ops node:$val, node:$base, node:$offset), (ist node:$val, node:$base, node:$offset), [{ if (StoreSDNode *ST = dyn_cast(N)) { - ISD::MemOpAddrMode AM = ST->getAddressingMode(); + ISD::MemIndexedMode AM = ST->getAddressingMode(); return (AM == ISD::PRE_INC || AM == ISD::PRE_DEC) && ST->isTruncatingStore() && ST->getStoredVT() == MVT::i1; } @@ -570,7 +570,7 @@ def pre_truncsti8 : PatFrag<(ops node:$val, node:$base, node:$offset), (ist node:$val, node:$base, node:$offset), [{ if (StoreSDNode *ST = dyn_cast(N)) { - ISD::MemOpAddrMode AM = ST->getAddressingMode(); + ISD::MemIndexedMode AM = ST->getAddressingMode(); return (AM == ISD::PRE_INC || AM == ISD::PRE_DEC) && ST->isTruncatingStore() && ST->getStoredVT() == MVT::i8; } @@ -579,7 +579,7 @@ def pre_truncsti16 : PatFrag<(ops node:$val, node:$base, node:$offset), (ist node:$val, node:$base, node:$offset), [{ if (StoreSDNode *ST = dyn_cast(N)) { - ISD::MemOpAddrMode AM = ST->getAddressingMode(); + ISD::MemIndexedMode AM = ST->getAddressingMode(); return (AM == ISD::PRE_INC || AM == ISD::PRE_DEC) && ST->isTruncatingStore() && ST->getStoredVT() == MVT::i16; } @@ -588,7 +588,7 @@ def pre_truncsti32 : PatFrag<(ops node:$val, node:$base, node:$offset), (ist node:$val, node:$base, node:$offset), [{ if (StoreSDNode *ST = dyn_cast(N)) { - ISD::MemOpAddrMode AM = ST->getAddressingMode(); + ISD::MemIndexedMode AM = ST->getAddressingMode(); return (AM == ISD::PRE_INC || AM == ISD::PRE_DEC) && ST->isTruncatingStore() && ST->getStoredVT() == MVT::i32; } @@ -597,7 +597,7 @@ def pre_truncstf32 : PatFrag<(ops node:$val, node:$base, node:$offset), (ist node:$val, node:$base, node:$offset), [{ if (StoreSDNode *ST = dyn_cast(N)) { - ISD::MemOpAddrMode AM = ST->getAddressingMode(); + ISD::MemIndexedMode AM = ST->getAddressingMode(); return (AM == ISD::PRE_INC || AM == ISD::PRE_DEC) && ST->isTruncatingStore() && ST->getStoredVT() == MVT::f32; } @@ -607,7 +607,7 @@ def post_store : PatFrag<(ops node:$val, node:$ptr, node:$offset), (ist node:$val, node:$ptr, node:$offset), [{ if (StoreSDNode *ST = dyn_cast(N)) { - ISD::MemOpAddrMode AM = ST->getAddressingMode(); + ISD::MemIndexedMode AM = ST->getAddressingMode(); return !ST->isTruncatingStore() && (AM == ISD::POST_INC || AM == ISD::POST_DEC); } @@ -617,7 +617,7 @@ def post_truncsti1 : PatFrag<(ops node:$val, node:$base, node:$offset), (ist node:$val, node:$base, node:$offset), [{ if (StoreSDNode *ST = dyn_cast(N)) { - ISD::MemOpAddrMode AM = ST->getAddressingMode(); + ISD::MemIndexedMode AM = ST->getAddressingMode(); return (AM == ISD::POST_INC || AM == ISD::POST_DEC) && ST->isTruncatingStore() && ST->getStoredVT() == MVT::i1; } @@ -626,7 +626,7 @@ def post_truncsti8 : PatFrag<(ops node:$val, node:$base, node:$offset), (ist node:$val, node:$base, node:$offset), [{ if (StoreSDNode *ST = dyn_cast(N)) { - ISD::MemOpAddrMode AM = ST->getAddressingMode(); + ISD::MemIndexedMode AM = ST->getAddressingMode(); return (AM == ISD::POST_INC || AM == ISD::POST_DEC) && ST->isTruncatingStore() && ST->getStoredVT() == MVT::i8; } @@ -635,7 +635,7 @@ def post_truncsti16 : PatFrag<(ops node:$val, node:$base, node:$offset), (ist node:$val, node:$base, node:$offset), [{ if (StoreSDNode *ST = dyn_cast(N)) { - ISD::MemOpAddrMode AM = ST->getAddressingMode(); + ISD::MemIndexedMode AM = ST->getAddressingMode(); return (AM == ISD::POST_INC || AM == ISD::POST_DEC) && ST->isTruncatingStore() && ST->getStoredVT() == MVT::i16; } @@ -644,7 +644,7 @@ def post_truncsti32 : PatFrag<(ops node:$val, node:$base, node:$offset), (ist node:$val, node:$base, node:$offset), [{ if (StoreSDNode *ST = dyn_cast(N)) { - ISD::MemOpAddrMode AM = ST->getAddressingMode(); + ISD::MemIndexedMode AM = ST->getAddressingMode(); return (AM == ISD::POST_INC || AM == ISD::POST_DEC) && ST->isTruncatingStore() && ST->getStoredVT() == MVT::i32; } @@ -653,7 +653,7 @@ def post_truncstf32 : PatFrag<(ops node:$val, node:$base, node:$offset), (ist node:$val, node:$base, node:$offset), [{ if (StoreSDNode *ST = dyn_cast(N)) { - ISD::MemOpAddrMode AM = ST->getAddressingMode(); + ISD::MemIndexedMode AM = ST->getAddressingMode(); return (AM == ISD::POST_INC || AM == ISD::POST_DEC) && ST->isTruncatingStore() && ST->getStoredVT() == MVT::f32; } From evan.cheng at apple.com Thu Nov 9 12:53:28 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 9 Nov 2006 12:53:28 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Target/TargetLowering.h Message-ID: <200611091853.kA9IrS54026898@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/Target: TargetLowering.h updated: 1.89 -> 1.90 --- Log message: Add a mechanism to specify whether a target supports a particular indexed load / store. --- Diffs of the changes: (+63 -0) TargetLowering.h | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 63 insertions(+) Index: llvm/include/llvm/Target/TargetLowering.h diff -u llvm/include/llvm/Target/TargetLowering.h:1.89 llvm/include/llvm/Target/TargetLowering.h:1.90 --- llvm/include/llvm/Target/TargetLowering.h:1.89 Thu Nov 9 11:53:01 2006 +++ llvm/include/llvm/Target/TargetLowering.h Thu Nov 9 12:53:13 2006 @@ -258,6 +258,38 @@ return getStoreXAction(VT) == Legal || getStoreXAction(VT) == Custom; } + /// getIndexedLoadAction - Return how the indexed load should be treated: + /// either it is legal, needs to be promoted to a larger size, needs to be + /// expanded to some other code sequence, or the target has a custom expander + /// for it. + LegalizeAction + getIndexedLoadAction(unsigned IdxMode, MVT::ValueType VT) const { + return (LegalizeAction)((IndexedModeActions[0][IdxMode] >> (2*VT)) & 3); + } + + /// isIndexedLoadLegal - Return true if the specified indexed load is legal + /// on this target. + bool isIndexedLoadLegal(unsigned IdxMode, MVT::ValueType VT) const { + return getIndexedLoadAction(IdxMode, VT) == Legal || + getIndexedLoadAction(IdxMode, VT) == Custom; + } + + /// getIndexedStoreAction - Return how the indexed store should be treated: + /// either it is legal, needs to be promoted to a larger size, needs to be + /// expanded to some other code sequence, or the target has a custom expander + /// for it. + LegalizeAction + getIndexedStoreAction(unsigned IdxMode, MVT::ValueType VT) const { + return (LegalizeAction)((IndexedModeActions[1][IdxMode] >> (2*VT)) & 3); + } + + /// isIndexedStoreLegal - Return true if the specified indexed load is legal + /// on this target. + bool isIndexedStoreLegal(unsigned IdxMode, MVT::ValueType VT) const { + return getIndexedStoreAction(IdxMode, VT) == Legal || + getIndexedStoreAction(IdxMode, VT) == Custom; + } + /// getTypeToPromoteTo - If the action for this operation is to promote, this /// method returns the ValueType to promote to. MVT::ValueType getTypeToPromoteTo(unsigned Op, MVT::ValueType VT) const { @@ -601,6 +633,32 @@ StoreXActions |= (uint64_t)Action << VT*2; } + /// setIndexedLoadAction - Indicate that the specified indexed load does or + /// does not work with the with specified type and indicate what to do abort + /// it. NOTE: All indexed mode loads are initialized to Expand in + /// TargetLowering.cpp + void setIndexedLoadAction(unsigned IdxMode, MVT::ValueType VT, + LegalizeAction Action) { + assert(VT < 32 && IdxMode < + sizeof(IndexedModeActions[0]) / sizeof(IndexedModeActions[0][0]) && + "Table isn't big enough!"); + IndexedModeActions[0][IdxMode] &= ~(uint64_t(3UL) << VT*2); + IndexedModeActions[0][IdxMode] |= (uint64_t)Action << VT*2; + } + + /// setIndexedStoreAction - Indicate that the specified indexed store does or + /// does not work with the with specified type and indicate what to do about + /// it. NOTE: All indexed mode stores are initialized to Expand in + /// TargetLowering.cpp + void setIndexedStoreAction(unsigned IdxMode, MVT::ValueType VT, + LegalizeAction Action) { + assert(VT < 32 && IdxMode < + sizeof(IndexedModeActions[1]) / sizeof(IndexedModeActions[1][0]) && + "Table isn't big enough!"); + IndexedModeActions[1][IdxMode] &= ~(uint64_t(3UL) << VT*2); + IndexedModeActions[1][IdxMode] |= (uint64_t)Action << VT*2; + } + /// AddPromotedToType - If Opc/OrigVT is specified as being promoted, the /// promotion code defaults to trying a larger integer/fp until it can find /// one that works. If that default is insufficient, this method can be used @@ -870,6 +928,11 @@ /// the store. uint64_t StoreXActions; + /// IndexedModeActions - For each indexed mode and each value type, keep a + /// pair of LegalizeAction that indicates how instruction selection should + /// deal with the load / store. + uint64_t IndexedModeActions[2][ISD::LAST_INDEXED_MODE]; + ValueTypeActionImpl ValueTypeActions; std::vector LegalFPImmediates; From evan.cheng at apple.com Thu Nov 9 12:56:58 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 9 Nov 2006 12:56:58 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp Message-ID: <200611091856.kA9Iuwlf026985@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: TargetLowering.cpp updated: 1.79 -> 1.80 --- Log message: Add a mechanism to specify whether a target supports a particular indexed load / store. --- Diffs of the changes: (+8 -0) TargetLowering.cpp | 8 ++++++++ 1 files changed, 8 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp diff -u llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.79 llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.80 --- llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:1.79 Thu Nov 2 14:25:49 2006 +++ llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp Thu Nov 9 12:56:43 2006 @@ -29,6 +29,14 @@ memset(OpActions, 0, sizeof(OpActions)); memset(LoadXActions, 0, sizeof(LoadXActions)); memset(&StoreXActions, 0, sizeof(StoreXActions)); + // Initialize all indexed load / store to expand. + for (unsigned VT = 0; VT != (unsigned)MVT::LAST_VALUETYPE; ++VT) { + for (unsigned IM = (unsigned)ISD::PRE_INC; + IM != (unsigned)ISD::LAST_INDEXED_MODE; ++IM) { + setIndexedLoadAction(IM, (MVT::ValueType)VT, Expand); + setIndexedStoreAction(IM, (MVT::ValueType)VT, Expand); + } + } IsLittleEndian = TD->isLittleEndian(); UsesGlobalOffsetTable = false; From evan.cheng at apple.com Thu Nov 9 13:11:00 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 9 Nov 2006 13:11:00 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200611091911.kA9JB0aD027228@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.246 -> 1.247 --- Log message: Don't attempt expensive pre-/post- indexed dag combine if target does not support them. --- Diffs of the changes: (+18 -1) DAGCombiner.cpp | 19 ++++++++++++++++++- 1 files changed, 18 insertions(+), 1 deletion(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.246 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.247 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.246 Thu Nov 9 11:54:19 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu Nov 9 13:10:46 2006 @@ -190,9 +190,18 @@ bool isLoad = true; SDOperand Ptr; + MVT::ValueType VT; if (LoadSDNode *LD = dyn_cast(N)) { + VT = LD->getLoadedVT(); + if (!TLI.isIndexedLoadLegal(ISD::PRE_INC, VT) && + !TLI.isIndexedLoadLegal(ISD::PRE_DEC, VT)) + return false; Ptr = LD->getBasePtr(); } else if (StoreSDNode *ST = dyn_cast(N)) { + VT = ST->getStoredVT(); + if (!TLI.isIndexedStoreLegal(ISD::PRE_INC, VT) && + !TLI.isIndexedStoreLegal(ISD::PRE_DEC, VT)) + return false; Ptr = ST->getBasePtr(); isLoad = false; } else @@ -281,8 +290,16 @@ SDOperand Ptr; MVT::ValueType VT; if (LoadSDNode *LD = dyn_cast(N)) { + VT = LD->getLoadedVT(); + if (!TLI.isIndexedLoadLegal(ISD::POST_INC, VT) && + !TLI.isIndexedLoadLegal(ISD::POST_DEC, VT)) + return false; Ptr = LD->getBasePtr(); } else if (StoreSDNode *ST = dyn_cast(N)) { + VT = ST->getStoredVT(); + if (!TLI.isIndexedStoreLegal(ISD::POST_INC, VT) && + !TLI.isIndexedStoreLegal(ISD::POST_DEC, VT)) + return false; Ptr = ST->getBasePtr(); isLoad = false; } else @@ -299,7 +316,7 @@ SDOperand BasePtr; SDOperand Offset; ISD::MemIndexedMode AM = ISD::UNINDEXED; - if (TLI.getPostIndexedAddressParts(N, Op, BasePtr, Offset, AM,DAG)) { + if (TLI.getPostIndexedAddressParts(N, Op, BasePtr, Offset, AM, DAG)) { if (Ptr == Offset) std::swap(BasePtr, Offset); if (Ptr != BasePtr) From evan.cheng at apple.com Thu Nov 9 13:12:06 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 9 Nov 2006 13:12:06 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelLowering.cpp Message-ID: <200611091912.kA9JC6Zu027270@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCISelLowering.cpp updated: 1.220 -> 1.221 --- Log message: PPC supports i32 / i64 pre-inc load / store. --- Diffs of the changes: (+6 -0) PPCISelLowering.cpp | 6 ++++++ 1 files changed, 6 insertions(+) Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.220 llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.221 --- llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.220 Thu Nov 9 11:55:04 2006 +++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp Thu Nov 9 13:11:50 2006 @@ -50,6 +50,12 @@ // PowerPC does not have truncstore for i1. setStoreXAction(MVT::i1, Promote); + // PowerPC has i32 and i64 pre-inc load and store's. + setIndexedLoadAction(ISD::PRE_INC, MVT::i32, Legal); + setIndexedLoadAction(ISD::PRE_INC, MVT::i64, Legal); + setIndexedStoreAction(ISD::PRE_INC, MVT::i32, Legal); + setIndexedStoreAction(ISD::PRE_INC, MVT::i64, Legal); + setOperationAction(ISD::ConstantFP, MVT::f64, Expand); setOperationAction(ISD::ConstantFP, MVT::f32, Expand); From sabre at nondot.org Thu Nov 9 13:31:02 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 9 Nov 2006 13:31:02 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/ExecutionEngine/ExecutionEngine.h Message-ID: <200611091931.kA9JV2aw027633@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/ExecutionEngine: ExecutionEngine.h updated: 1.40 -> 1.41 --- Log message: allow clients to indicate that they never want lazy compilation. --- Diffs of the changes: (+10 -0) ExecutionEngine.h | 10 ++++++++++ 1 files changed, 10 insertions(+) Index: llvm/include/llvm/ExecutionEngine/ExecutionEngine.h diff -u llvm/include/llvm/ExecutionEngine/ExecutionEngine.h:1.40 llvm/include/llvm/ExecutionEngine/ExecutionEngine.h:1.41 --- llvm/include/llvm/ExecutionEngine/ExecutionEngine.h:1.40 Tue Aug 15 21:53:27 2006 +++ llvm/include/llvm/ExecutionEngine/ExecutionEngine.h Thu Nov 9 13:30:47 2006 @@ -63,6 +63,7 @@ class ExecutionEngine { const TargetData *TD; ExecutionEngineState state; + bool LazyCompilationDisabled; protected: /// Modules - This is a list of ModuleProvider's that we are JIT'ing from. We /// use a smallvector to optimize for the case where there is only one module. @@ -197,6 +198,15 @@ virtual void *getOrEmitGlobalVariable(const GlobalVariable *GV) { return getPointerToGlobal((GlobalValue*)GV); } + + /// DisableLazyCompilation - If called, the JIT will abort if lazy compilation + // is ever attempted. + void DisableLazyCompilation() { + LazyCompilationDisabled = true; + } + bool isLazyCompilationDisabled() const { + return LazyCompilationDisabled; + } protected: void emitGlobals(); From sabre at nondot.org Thu Nov 9 13:31:29 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 9 Nov 2006 13:31:29 -0600 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp Message-ID: <200611091931.kA9JVTTS027669@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine: ExecutionEngine.cpp updated: 1.86 -> 1.87 --- Log message: init ivar --- Diffs of the changes: (+2 -0) ExecutionEngine.cpp | 2 ++ 1 files changed, 2 insertions(+) Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.86 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.87 --- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.86 Fri Oct 20 02:07:24 2006 +++ llvm/lib/ExecutionEngine/ExecutionEngine.cpp Thu Nov 9 13:31:15 2006 @@ -36,11 +36,13 @@ ExecutionEngine::EECtorFn ExecutionEngine::InterpCtor = 0; ExecutionEngine::ExecutionEngine(ModuleProvider *P) { + LazyCompilationDisabled = false; Modules.push_back(P); assert(P && "ModuleProvider is null?"); } ExecutionEngine::ExecutionEngine(Module *M) { + LazyCompilationDisabled = false; assert(M && "Module is null?"); Modules.push_back(new ExistingModuleProvider(M)); } From sabre at nondot.org Thu Nov 9 13:32:28 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 9 Nov 2006 13:32:28 -0600 Subject: [llvm-commits] CVS: llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp Message-ID: <200611091932.kA9JWSlP027731@zion.cs.uiuc.edu> Changes in directory llvm/lib/ExecutionEngine/JIT: JITEmitter.cpp updated: 1.117 -> 1.118 --- Log message: if lazy compilation is disabled, print an error message and abort if lazy compilation is ever attempted --- Diffs of the changes: (+7 -0) JITEmitter.cpp | 7 +++++++ 1 files changed, 7 insertions(+) Index: llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp diff -u llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.117 llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.118 --- llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp:1.117 Thu Nov 2 14:25:49 2006 +++ llvm/lib/ExecutionEngine/JIT/JITEmitter.cpp Thu Nov 9 13:32:13 2006 @@ -613,6 +613,13 @@ "This is not a known stub!"); Function *F = (--I)->second; + // If disabled, emit a useful error message and abort. + if (TheJIT->isLazyCompilationDisabled()) { + std::cerr << "LLVM JIT requested to do lazy compilation of function '" + << F->getName() << "' when lazy compiles are disabled!\n"; + abort(); + } + // We might like to remove the stub from the StubToFunction map. // We can't do that! Multiple threads could be stuck, waiting to acquire the // lock above. As soon as the 1st function finishes compiling the function, From reid at x10sys.com Thu Nov 9 15:16:10 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 9 Nov 2006 15:16:10 -0600 Subject: [llvm-commits] CVS: llvm/docs/LangRef.html Message-ID: <200611092116.kA9LGAMZ023859@zion.cs.uiuc.edu> Changes in directory llvm/docs: LangRef.html updated: 1.163 -> 1.164 --- Log message: Fix indentation problem starting at GEP. --- Diffs of the changes: (+4 -2) LangRef.html | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) Index: llvm/docs/LangRef.html diff -u llvm/docs/LangRef.html:1.163 llvm/docs/LangRef.html:1.164 --- llvm/docs/LangRef.html:1.163 Wed Nov 8 00:47:32 2006 +++ llvm/docs/LangRef.html Thu Nov 9 15:15:49 2006 @@ -2683,6 +2683,8 @@ href="#i_store">store int 3, int* %ptr ; yields {void} %val = load int* %ptr ; yields {int}:val = int 3 +
    +
    'getelementptr' Instruction @@ -2795,8 +2797,8 @@ ; yields [12 x ubyte]*:aptr %aptr = getelementptr {int, [12 x ubyte]}* %sptr, long 0, uint 1 -
    + @@ -4416,7 +4418,7 @@ Chris Lattner
    The LLVM Compiler Infrastructure
    - Last modified: $Date: 2006/11/08 06:47:32 $ + Last modified: $Date: 2006/11/09 21:15:49 $ From reid at x10sys.com Thu Nov 9 15:18:15 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 9 Nov 2006 15:18:15 -0600 Subject: [llvm-commits] CVS: llvm/docs/LangRef.html Message-ID: <200611092118.kA9LIFbh023954@zion.cs.uiuc.edu> Changes in directory llvm/docs: LangRef.html updated: 1.164 -> 1.165 --- Log message: One more time for indentation. --- Diffs of the changes: (+2 -1) LangRef.html | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/docs/LangRef.html diff -u llvm/docs/LangRef.html:1.164 llvm/docs/LangRef.html:1.165 --- llvm/docs/LangRef.html:1.164 Thu Nov 9 15:15:49 2006 +++ llvm/docs/LangRef.html Thu Nov 9 15:18:01 2006 @@ -2660,6 +2660,7 @@ +
    Syntax:
      store <ty> <value>, <ty>* <pointer>                   ; yields {void}
       volatile store <ty> <value>, <ty>* <pointer>                   ; yields {void}
    @@ -4418,7 +4419,7 @@
     
       Chris Lattner
    The LLVM Compiler Infrastructure
    - Last modified: $Date: 2006/11/09 21:15:49 $ + Last modified: $Date: 2006/11/09 21:18:01 $ From reid at x10sys.com Thu Nov 9 15:42:28 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 9 Nov 2006 15:42:28 -0600 Subject: [llvm-commits] CVS: llvm/docs/LangRef.html Message-ID: <200611092142.kA9LgSOG024664@zion.cs.uiuc.edu> Changes in directory llvm/docs: LangRef.html updated: 1.165 -> 1.166 --- Log message: Remove futurisms that won't be in our future. --- Diffs of the changes: (+1 -191) LangRef.html | 192 ----------------------------------------------------------- 1 files changed, 1 insertion(+), 191 deletions(-) Index: llvm/docs/LangRef.html diff -u llvm/docs/LangRef.html:1.165 llvm/docs/LangRef.html:1.166 --- llvm/docs/LangRef.html:1.165 Thu Nov 9 15:18:01 2006 +++ llvm/docs/LangRef.html Thu Nov 9 15:42:14 2006 @@ -101,9 +101,6 @@
  • 'extractelement' Instruction
  • 'insertelement' Instruction
  • 'shufflevector' Instruction
  • -
  • 'vsetint' Instruction
  • -
  • 'vsetfp' Instruction
  • -
  • 'vselect' Instruction
  • Memory Access and Addressing Operations @@ -2295,193 +2292,6 @@ - - -
    -
    Syntax:
    -
    <result> = vsetint <op>, <n x <ty>> <var1>, <var2>   ; yields <n x bool>
    -
    - -
    Overview:
    - -

    The 'vsetint' instruction takes two integer vectors and -returns a vector of boolean values representing, at each position, the -result of the comparison between the values at that position in the -two operands.

    - -
    Arguments:
    - -

    The arguments to a 'vsetint' instruction are a comparison -operation and two value arguments. The value arguments must be of integral packed type, -and they must have identical types. The operation argument must be -one of eq, ne, slt, sgt, -sle, sge, ult, ugt, ule, -uge, true, and false. The result is a -packed bool value with the same length as each operand.

    - -
    Semantics:
    - -

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

    - - - - - - - - - - - - - - - - - -
    OperationResult is true iffComparison is
    eqvar1 == var2--
    nevar1 != var2--
    sltvar1 < var2signed
    sgtvar1 > var2signed
    slevar1 <= var2signed
    sgevar1 >= var2signed
    ultvar1 < var2unsigned
    ugtvar1 > var2unsigned
    ulevar1 <= var2unsigned
    ugevar1 >= var2unsigned
    truealways--
    falsenever--
    - -
    Example:
    -
      <result> = vsetint eq <2 x int> <int 0, int 1>, <int 1, int 0>      ; yields {<2 x bool>}:result = false, false
    -  <result> = vsetint ne <2 x int> <int 0, int 1>, <int 1, int 0>      ; yields {<2 x bool>}:result = true, true
    -  <result> = vsetint slt <2 x int> <int 0, int 1>, <int 1, int 0>      ; yields {<2 x bool>}:result = true, false
    -  <result> = vsetint sgt <2 x int> <int 0, int 1>, <int 1, int 0>      ; yields {<2 x bool>}:result = false, true
    -  <result> = vsetint sle <2 x int> <int 0, int 1>, <int 1, int 0>      ; yields {<2 x bool>}:result = true, false
    -  <result> = vsetint sge <2 x int> <int 0, int 1>, <int 1, int 0>      ; yields {<2 x bool>}:result = false, true
    -
    -
    - - - -
    -
    Syntax:
    -
    <result> = vsetfp <op>, <n x <ty>> <var1>, <var2>   ; yields <n x bool>
    -
    - -
    Overview:
    - -

    The 'vsetfp' instruction takes two floating point vector -arguments and returns a vector of boolean values representing, at each -position, the result of the comparison between the values at that -position in the two operands.

    - -
    Arguments:
    - -

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

    - -
    Semantics:
    - -

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

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

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

    - - -
    Arguments:
    - -

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

    - -
    Semantics:
    - -

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

    - -
    Example:
    - -
    -  %X = vselect bool <2 x bool> <bool true, bool false>, <2 x ubyte> <ubyte 17, ubyte 17>, 
    -    <2 x ubyte> <ubyte 42, ubyte 42>      ; yields <2 x ubyte>:17, 42
    -
    -
    - - -
    Memory Access and Addressing Operations @@ -4419,7 +4229,7 @@ Chris Lattner
    The LLVM Compiler Infrastructure
    - Last modified: $Date: 2006/11/09 21:18:01 $ + Last modified: $Date: 2006/11/09 21:42:14 $ From reid at x10sys.com Thu Nov 9 15:48:24 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 9 Nov 2006 15:48:24 -0600 Subject: [llvm-commits] CVS: llvm/docs/LangRef.html Message-ID: <200611092148.kA9LmOlw024810@zion.cs.uiuc.edu> Changes in directory llvm/docs: LangRef.html updated: 1.166 -> 1.167 --- Log message: Fix runaway element and section ordering. --- Diffs of the changes: (+32 -32) LangRef.html | 64 +++++++++++++++++++++++++++++------------------------------ 1 files changed, 32 insertions(+), 32 deletions(-) Index: llvm/docs/LangRef.html diff -u llvm/docs/LangRef.html:1.166 llvm/docs/LangRef.html:1.167 --- llvm/docs/LangRef.html:1.166 Thu Nov 9 15:42:14 2006 +++ llvm/docs/LangRef.html Thu Nov 9 15:48:10 2006 @@ -2744,72 +2744,72 @@ +
    Syntax:
    +
    -  <result> = fpext <ty> <value> to <ty2>             ; yields ty2
    +  <result> = fptrunc <ty> <value> to <ty2>             ; yields ty2
     
    Overview:
    -

    The 'fpext' extends a floating point value to a larger -floating point value.

    +

    The 'fptrunc' instruction truncates value to type +ty2.

    +
    Arguments:
    -

    The 'fpext' instruction takes a -floating point value to cast, -and a floating point type to cast it to.

    +

    The 'fptrunc' instruction takes a floating + point value to cast and a floating point type to +cast it to. The size of value must be larger than the size of +ty2. This implies that fptrunc cannot be used to make a +no-op cast.

    Semantics:
    -

    The 'fpext' instruction extends the value from one floating -point type to another. If the type of the value and ty2 are -the same, the instruction is considered a no-op cast because no bits -change.

    +

    The 'fptrunc' instruction converts a +floating point value from a larger type to a smaller +type. If the value cannot fit within the destination type, ty2, then +the results are undefined.

    Example:
    -  %X = fpext float 3.1415 to double        ; yields double:3.1415
    -  %Y = fpext float 1.0 to float            ; yields float:1.0 (no-op)
    +  %X = fptrunc double 123.0 to float         ; yields float:123.0
    +  %Y = fptrunc double 1.0E+300 to float      ; yields undefined
     
    -
    Syntax:
    -
    -  <result> = fptrunc <ty> <value> to <ty2>             ; yields ty2
    +  <result> = fpext <ty> <value> to <ty2>             ; yields ty2
     
    Overview:
    -

    The 'fptrunc' instruction truncates value to type -ty2.

    - +

    The 'fpext' extends a floating point value to a larger +floating point value.

    Arguments:
    -

    The 'fptrunc' instruction takes a floating - point value to cast and a floating point type to -cast it to. The size of value must be larger than the size of -ty2. This implies that fptrunc cannot be used to make a -no-op cast.

    +

    The 'fpext' instruction takes a +floating point value to cast, +and a floating point type to cast it to.

    Semantics:
    -

    The 'fptrunc' instruction converts a -floating point value from a larger type to a smaller -type. If the value cannot fit within the destination type, ty2, then -the results are undefined.

    +

    The 'fpext' instruction extends the value from one floating +point type to another. If the type of the value and ty2 are +the same, the instruction is considered a no-op cast because no bits +change.

    Example:
    -  %X = fptrunc double 123.0 to float         ; yields float:123.0
    -  %Y = fptrunc double 1.0E+300 to float      ; yields undefined
    +  %X = fpext float 3.1415 to double        ; yields double:3.1415
    +  %Y = fpext float 1.0 to float            ; yields float:1.0 (no-op)
     
    @@ -4229,7 +4229,7 @@ Chris Lattner
    The LLVM Compiler Infrastructure
    - Last modified: $Date: 2006/11/09 21:42:14 $ + Last modified: $Date: 2006/11/09 21:48:10 $ From reid at x10sys.com Thu Nov 9 17:03:43 2006 From: reid at x10sys.com (Reid Spencer) Date: Thu, 9 Nov 2006 17:03:43 -0600 Subject: [llvm-commits] CVS: llvm/docs/LangRef.html Message-ID: <200611092303.kA9N3hYw017494@zion.cs.uiuc.edu> Changes in directory llvm/docs: LangRef.html updated: 1.167 -> 1.168 --- Log message: Post-review changes on conversion instructions. --- Diffs of the changes: (+56 -61) LangRef.html | 117 ++++++++++++++++++++++++++++------------------------------- 1 files changed, 56 insertions(+), 61 deletions(-) Index: llvm/docs/LangRef.html diff -u llvm/docs/LangRef.html:1.167 llvm/docs/LangRef.html:1.168 --- llvm/docs/LangRef.html:1.167 Thu Nov 9 15:48:10 2006 +++ llvm/docs/LangRef.html Thu Nov 9 17:03:26 2006 @@ -120,10 +120,10 @@
  • 'sext .. to' Instruction
  • 'fptrunc .. to' Instruction
  • 'fpext .. to' Instruction
  • -
  • 'fp2uint .. to' Instruction
  • -
  • 'fp2sint .. to' Instruction
  • -
  • 'uint2fp .. to' Instruction
  • -
  • 'sint2fp .. to' Instruction
  • +
  • 'fptoui .. to' Instruction
  • +
  • 'fptosi .. to' Instruction
  • +
  • 'uitofp .. to' Instruction
  • +
  • 'sitofp .. to' Instruction
  • 'bitconvert .. to' Instruction
  • Other Operations @@ -1206,17 +1206,17 @@ constant. TYPE must be an integer type. CST must be floating point. If the value won't fit in the integer type, the results are undefined. -
    fp2sint ( CST to TYPE )
    +
    fptosi ( CST to TYPE )
    Convert a floating point constant to the corresponding signed integer constant. TYPE must be an integer type. CST must be floating point. If the value won't fit in the integer type, the results are undefined.
    -
    uint2fp ( CST to TYPE )
    +
    uitofp ( CST to TYPE )
    Convert an unsigned integer constant to the corresponding floating point constant. TYPE must be floating point. CST must be of integer type. If the value won't fit in the floating point type, the results are undefined.
    -
    sint2fp ( CST to TYPE )
    +
    sitofp ( CST to TYPE )
    Convert a signed integer constant to the corresponding floating point constant. TYPE must be floating point. CST must be of integer type. If the value won't fit in the floating point type, the results are undefined.
    @@ -2640,19 +2640,15 @@ The 'trunc' instruction takes a value to trunc, which must be an integer type, and a type that specifies the size and type of the result, which must be an integral -type.

    +type. The bit size of value must be larger than the bit size of +ty2. Equal sized types are not allowed.

    Semantics:

    The 'trunc' instruction truncates the high order bits in value -and converts the reamining bits to ty2. The bit size of value -must be larger than the bit size of ty2. Equal sized types are not -allowed. This implies that a trunc cannot be a no-op cast. It -will always truncate bits.

    - -

    When truncating to bool, the truncation is done as a comparison against -zero. If the value was zero, the bool result will be false. -If the value was non-zero, the bool result will be true.

    +and converts the remaining bits to ty2. Since the source size must be +larger than the destination size, trunc cannot be a no-op cast. +It will always truncate bits.

    Example:
    @@ -2681,8 +2677,8 @@
     

    The 'zext' instruction takes a value to cast, which must be of integral type, and a type to cast it to, which must also be of integral type. The bit size of the -value must be smaller than or equal to the bit size of the -destination type, ty2.

    +value must be smaller than the bit size of the destination type, +ty2.

    Semantics:

    The zext fills the high order bits of the value with zero @@ -2691,9 +2687,7 @@ cast is considered a no-op cast because no bits change (only the type changes).

    -

    When zero extending to bool, the extension is done as a comparison against -zero. If the value was zero, the bool result will be false. -If the value was non-zero, the bool result will be true.

    +

    When zero extending from bool, the result will alwasy be either 0 or 1.

    Example:
    @@ -2720,7 +2714,9 @@
     

    The 'sext' instruction takes a value to cast, which must be of integral type, and a type to cast it to, which must -also be of integral type.

    +also be of integral type. The bit size of the +value must be smaller than the bit size of the destination type, +ty2.

    Semantics:

    @@ -2730,12 +2726,9 @@ no bit filling is done and the cast is considered a no-op cast because no bits change (only the type changes).

    -

    When sign extending to bool, the extension is done as a comparison against -zero. If the value was zero, the bool result will be false. -If the value was non-zero, the bool result will be true.

    +

    When sign extending from bool, the extension always results in -1 or 0.

    Example:
    -
       %X = sext sbyte -1 to ushort           ; yields ushort:65535
       %Y = sext bool true to int             ; yields int:-1
    @@ -2768,10 +2761,10 @@
     no-op cast.

    Semantics:
    -

    The 'fptrunc' instruction converts a -floating point value from a larger type to a smaller -type. If the value cannot fit within the destination type, ty2, then -the results are undefined.

    +

    The 'fptrunc' instruction truncates a value from a larger +floating point type to a smaller +floating point type. If the value cannot fit within +the destination type, ty2, then the results are undefined.

    Example:
    @@ -2798,13 +2791,15 @@
     
    Arguments:

    The 'fpext' instruction takes a floating point value to cast, -and a floating point type to cast it to.

    +and a floating point type to cast it to. The source +type must be smaller than the destination type.

    Semantics:
    -

    The 'fpext' instruction extends the value from one floating -point type to another. If the type of the value and ty2 are -the same, the instruction is considered a no-op cast because no bits -change.

    +

    The 'fpext' instruction extends the value from a smaller +floating point type to a larger +floating point type. The fpext cannot be +used to make a no-op cast because it always changes bits. Use +bitconvert to make a no-op cast for a floating point cast.

    Example:
    @@ -2815,7 +2810,7 @@
     
     
     
     
    @@ -2854,28 +2849,28 @@
    Syntax:
    -  <result> = fp2sint <ty> <value> to <ty2>             ; yields ty2
    +  <result> = fptosi <ty> <value> to <ty2>             ; yields ty2
     
    Overview:
    -

    The 'fp2sint' instruction converts +

    The 'fptosi' instruction converts floating point value to type ty2.

    Arguments:
    -

    The 'fp2sint' instruction takes a value to cast, which must be a +

    The 'fptosi' instruction takes a value to cast, which must be a floating point value, and a type to cast it to, which must also be an integral type.

    Semantics:
    -

    The 'fp2sint' instruction converts its +

    The 'fptosi' instruction converts its floating point operand into the nearest (rounding towards zero) signed integer value. If the value cannot fit in ty2, the results are undefined.

    @@ -2886,75 +2881,75 @@
    Example:
    -  %X = fp2sint double -123.0 to int        ; yields int:-123
    -  %Y = fp2sint float 1.0E-247 to bool      ; yields bool:true
    -  %X = fp2sint float 1.04E+17 to sbyte     ; yields undefined:1
    +  %X = fptosi double -123.0 to int        ; yields int:-123
    +  %Y = fptosi float 1.0E-247 to bool      ; yields bool:true
    +  %X = fptosi float 1.04E+17 to sbyte     ; yields undefined:1
     
    Syntax:
    -  <result> = uint2fp <ty> <value> to <ty2>             ; yields ty2
    +  <result> = uitofp <ty> <value> to <ty2>             ; yields ty2
     
    Overview:
    -

    The 'uint2fp' instruction regards value as an unsigned +

    The 'uitofp' instruction regards value as an unsigned integer and converts that value to the ty2 type.

    Arguments:
    -

    The 'uint2fp' instruction takes a value to cast, which must be an +

    The 'uitofp' instruction takes a value to cast, which must be an integral value, and a type to cast it to, which must be a floating point type.

    Semantics:
    -

    The 'uint2fp' instruction interprets its operand as an unsigned +

    The 'uitofp' instruction interprets its operand as an unsigned integer quantity and converts it to the corresponding floating point value. If the value cannot fit in the floating point value, the results are undefined.

    Example:
    -  %X = uint2fp int 257 to float         ; yields float:257.0
    -  %Y = uint2fp sbyte -1 to double       ; yields double:255.0
    +  %X = uitofp int 257 to float         ; yields float:257.0
    +  %Y = uitofp sbyte -1 to double       ; yields double:255.0
     
    Syntax:
    -  <result> = sint2fp <ty> <value> to <ty2>             ; yields ty2
    +  <result> = sitofp <ty> <value> to <ty2>             ; yields ty2
     
    Overview:
    -

    The 'sint2fp' instruction regards value as a signed +

    The 'sitofp' instruction regards value as a signed integer and converts that value to the ty2 type.

    Arguments:
    -

    The 'sint2fp' instruction takes a value to cast, which must be an +

    The 'sitofp' instruction takes a value to cast, which must be an integral value, and a type to cast it to, which must be a floating point type.

    Semantics:
    -

    The 'sint2fp' instruction interprets its operand as a signed +

    The 'sitofp' instruction interprets its operand as a signed integer quantity and converts it to the corresponding floating point value. If the value cannot fit in the floating point value, the results are undefined.

    Example:
    -  %X = sint2fp int 257 to float         ; yields float:257.0
    -  %Y = sint2fp sbyte -1 to double       ; yields double:-1.0
    +  %X = sitofp int 257 to float         ; yields float:257.0
    +  %Y = sitofp sbyte -1 to double       ; yields double:-1.0
     
    @@ -2983,8 +2978,8 @@

    The 'bitconvert' instruction converts value to type ty2 as if the value had been stored to memory and read back as type ty2. That is, no bits are changed during the conversion. The -bitconvert instruction may be used to construct no-op casts that -the zext, sext, and fpext instructions do not permit.

    +bitconvert instruction is the only conversion instruction that permits +no-op casts to be constructed.

    Example:
    @@ -4229,7 +4224,7 @@
     
       Chris Lattner
    The LLVM Compiler Infrastructure
    - Last modified: $Date: 2006/11/09 21:48:10 $ + Last modified: $Date: 2006/11/09 23:03:26 $ From tbrethou at cs.uiuc.edu Thu Nov 9 17:04:15 2006 From: tbrethou at cs.uiuc.edu (Tanya Lattner) Date: Thu, 9 Nov 2006 17:04:15 -0600 Subject: [llvm-commits] [release_19] CVS: llvm-gcc/gcc/version.c Message-ID: <200611092304.kA9N4FYl021108@zion.cs.uiuc.edu> Changes in directory llvm-gcc/gcc: version.c updated: 1.4 -> 1.4.6.1 --- Log message: Bumping version number. --- Diffs of the changes: (+0 -0) 0 files changed From tbrethou at cs.uiuc.edu Thu Nov 9 17:09:56 2006 From: tbrethou at cs.uiuc.edu (Tanya Lattner) Date: Thu, 9 Nov 2006 17:09:56 -0600 Subject: [llvm-commits] CVS: llvm-gcc/gcc/version.c Message-ID: <200611092309.kA9N9uiW025496@zion.cs.uiuc.edu> Changes in directory llvm-gcc/gcc: version.c updated: 1.4 -> 1.5 --- Log message: Bumping version number. --- Diffs of the changes: (+0 -0) 0 files changed From sabre at nondot.org Thu Nov 9 17:18:02 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 9 Nov 2006 17:18:02 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/Inliner.cpp Message-ID: <200611092318.kA9NI2c2003333@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: Inliner.cpp updated: 1.30 -> 1.31 --- Log message: Minimal patch to fix PR992: http://llvm.org/PR992 /PR993: http://llvm.org/PR993 --- Diffs of the changes: (+1 -2) Inliner.cpp | 3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/lib/Transforms/IPO/Inliner.cpp diff -u llvm/lib/Transforms/IPO/Inliner.cpp:1.30 llvm/lib/Transforms/IPO/Inliner.cpp:1.31 --- llvm/lib/Transforms/IPO/Inliner.cpp:1.30 Thu Nov 2 14:25:50 2006 +++ llvm/lib/Transforms/IPO/Inliner.cpp Thu Nov 9 17:17:45 2006 @@ -132,8 +132,7 @@ // Attempt to inline the function... if (InlineCallIfPossible(CS, CG, SCCFunctions)) { // Remove this call site from the list. - std::swap(CallSites[CSi], CallSites.back()); - CallSites.pop_back(); + CallSites.erase(CallSites.begin()+CSi); --CSi; ++NumInlined; From sabre at nondot.org Thu Nov 9 17:35:16 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 9 Nov 2006 17:35:16 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/Inline/2006-11-09-InlineCGUpdate-2.ll 2006-11-09-InlineCGUpdate.ll Message-ID: <200611092335.kA9NZGsP032742@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/Inline: 2006-11-09-InlineCGUpdate-2.ll added (r1.1) 2006-11-09-InlineCGUpdate.ll added (r1.1) --- Log message: new testcases for PR992: http://llvm.org/PR992 /993 --- Diffs of the changes: (+590 -0) 2006-11-09-InlineCGUpdate-2.ll | 248 +++++++++++++++++++++++++++++ 2006-11-09-InlineCGUpdate.ll | 342 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 590 insertions(+) Index: llvm/test/Regression/Transforms/Inline/2006-11-09-InlineCGUpdate-2.ll diff -c /dev/null llvm/test/Regression/Transforms/Inline/2006-11-09-InlineCGUpdate-2.ll:1.1 *** /dev/null Thu Nov 9 17:35:12 2006 --- llvm/test/Regression/Transforms/Inline/2006-11-09-InlineCGUpdate-2.ll Thu Nov 9 17:35:01 2006 *************** *** 0 **** --- 1,248 ---- + ; RUN: llvm-as < %s | opt -inline -prune-eh -disable-output + ; PR993 + target endian = little + target pointersize = 32 + target triple = "i386-unknown-openbsd3.9" + deplibs = [ "stdc++", "c", "crtend" ] + "struct.__gnu_cxx::__normal_iterator, std::allocator > >" = type { sbyte* } + "struct.__gnu_cxx::char_producer" = type { int (...)** } + %struct.__sFILE = type { ubyte*, int, int, short, short, %struct.__sbuf, int, sbyte*, int (sbyte*)*, int (sbyte*, sbyte*, int)*, long (sbyte*, long, int)*, int (sbyte*, sbyte*, int)*, %struct.__sbuf, ubyte*, int, [3 x ubyte], [1 x ubyte], %struct.__sbuf, int, long } + %struct.__sbuf = type { ubyte*, int } + "struct.std::__basic_file" = type { %struct.__sFILE*, bool } + "struct.std::__codecvt_abstract_base" = type { "struct.std::locale::facet" } + "struct.std::bad_alloc" = type { "struct.__gnu_cxx::char_producer" } + "struct.std::basic_filebuf >" = type { "struct.std::basic_streambuf >", int, "struct.std::__basic_file", uint, %union.__mbstate_t, %union.__mbstate_t, sbyte*, uint, bool, bool, bool, bool, sbyte, sbyte*, sbyte*, bool, "struct.std::codecvt"*, sbyte*, int, sbyte*, sbyte* } + "struct.std::basic_ios >" = type { "struct.std::ios_base", "struct.std::basic_ostream >"*, sbyte, bool, "struct.std::basic_streambuf >"*, "struct.std::ctype"*, "struct.std::__codecvt_abstract_base"*, "struct.std::__codecvt_abstract_base"* } + "struct.std::basic_iostream >" = type { "struct.std::locale::facet", "struct.__gnu_cxx::char_producer", "struct.std::basic_ios >" } + "struct.std::basic_ofstream >" = type { "struct.__gnu_cxx::char_producer", "struct.std::basic_filebuf >", "struct.std::basic_ios >" } + "struct.std::basic_ostream >" = type { int (...)**, "struct.std::basic_ios >" } + "struct.std::basic_streambuf >" = type { int (...)**, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, "struct.std::locale" } + "struct.std::basic_string,std::allocator >" = type { "struct.__gnu_cxx::__normal_iterator, std::allocator > >" } + "struct.std::basic_string,std::allocator >::_Rep" = type { "struct.std::basic_string,std::allocator >::_Rep_base" } + "struct.std::basic_string,std::allocator >::_Rep_base" = type { uint, uint, int } + "struct.std::codecvt" = type { "struct.std::__codecvt_abstract_base", int* } + "struct.std::ctype" = type { "struct.std::__codecvt_abstract_base", int*, bool, int*, int*, uint* } + "struct.std::domain_error" = type { "struct.std::logic_error" } + "struct.std::ios_base" = type { int (...)**, int, int, uint, uint, uint, "struct.std::ios_base::_Callback_list"*, "struct.std::ios_base::_Words", [8 x "struct.std::ios_base::_Words"], int, "struct.std::ios_base::_Words"*, "struct.std::locale" } + "struct.std::ios_base::_Callback_list" = type { "struct.std::ios_base::_Callback_list"*, void (uint, "struct.std::ios_base"*, int)*, int, int } + "struct.std::ios_base::_Words" = type { sbyte*, int } + "struct.std::locale" = type { "struct.std::locale::_Impl"* } + "struct.std::locale::_Impl" = type { int, "struct.std::locale::facet"**, uint, "struct.std::locale::facet"**, sbyte** } + "struct.std::locale::facet" = type { int (...)**, int } + "struct.std::logic_error" = type { "struct.__gnu_cxx::char_producer", "struct.std::basic_string,std::allocator >" } + %union.__mbstate_t = type { long, [120 x ubyte] } + %.str_1 = external global [17 x sbyte] ; <[17 x sbyte]*> [#uses=0] + %.str_9 = external global [24 x sbyte] ; <[24 x sbyte]*> [#uses=0] + + implementation ; Functions: + + void %main() { + entry: + call fastcc void %_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode( ) + ret void + } + + fastcc void %_ZNSt14basic_ofstreamIcSt11char_traitsIcEE4openEPKcSt13_Ios_Openmode() { + entry: + %tmp.6 = seteq "struct.std::basic_filebuf >"* null, null ; [#uses=1] + br bool %tmp.6, label %then, label %UnifiedReturnBlock + + then: ; preds = %entry + tail call fastcc void %_ZNSt9basic_iosIcSt11char_traitsIcEE8setstateESt12_Ios_Iostate( ) + ret void + + UnifiedReturnBlock: ; preds = %entry + ret void + } + + fastcc void %_ZN10__cxxabiv111__terminateEPFvvE() { + entry: + unreachable + } + + void %_ZNSdD0Ev() { + entry: + unreachable + } + + void %_ZThn8_NSdD1Ev() { + entry: + ret void + } + + void %_ZNSt13basic_filebufIcSt11char_traitsIcEED0Ev() { + entry: + ret void + } + + void %_ZNSt13basic_filebufIcSt11char_traitsIcEE9pbackfailEi() { + entry: + unreachable + } + + fastcc void %_ZNSoD2Ev() { + entry: + unreachable + } + + fastcc void %_ZNSt9basic_iosIcSt11char_traitsIcEED2Ev() { + entry: + unreachable + } + + fastcc void %_ZNSt9basic_iosIcSt11char_traitsIcEE8setstateESt12_Ios_Iostate() { + entry: + tail call fastcc void %_ZSt19__throw_ios_failurePKc( ) + ret void + } + + declare fastcc void %_ZNSaIcED1Ev() + + fastcc void %_ZNSsC1EPKcRKSaIcE() { + entry: + tail call fastcc void %_ZNSs16_S_construct_auxIPKcEEPcT_S3_RKSaIcE12__false_type( ) + unreachable + } + + fastcc void %_ZSt14__convert_to_vIyEvPKcRT_RSt12_Ios_IostateRKPii() { + entry: + ret void + } + + fastcc void %_ZNSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEEC1Ej() { + entry: + ret void + } + + fastcc void %_ZSt19__throw_ios_failurePKc() { + entry: + call fastcc void %_ZNSsC1EPKcRKSaIcE( ) + unwind + } + + void %_GLOBAL__D__ZSt23lexicographical_compareIPKaS1_EbT_S2_T0_S3_() { + entry: + ret void + } + + void %_ZNSt9bad_allocD1Ev() { + entry: + unreachable + } + + fastcc void %_ZSt19__throw_logic_errorPKc() { + entry: + invoke fastcc void %_ZNSt11logic_errorC1ERKSs( ) + to label %try_exit.0 unwind label %try_catch.0 + + try_catch.0: ; preds = %entry + unreachable + + try_exit.0: ; preds = %entry + unwind + } + + fastcc void %_ZNSt11logic_errorC1ERKSs() { + entry: + call fastcc void %_ZNSsC1ERKSs( ) + ret void + } + + void %_ZNSt12domain_errorD1Ev() { + entry: + unreachable + } + + fastcc void %_ZSt20__throw_length_errorPKc() { + entry: + call fastcc void %_ZNSt12length_errorC1ERKSs( ) + unwind + } + + fastcc void %_ZNSt12length_errorC1ERKSs() { + entry: + invoke fastcc void %_ZNSsC1ERKSs( ) + to label %_ZNSt11logic_errorC2ERKSs.exit unwind label %invoke_catch.i + + invoke_catch.i: ; preds = %entry + unwind + + _ZNSt11logic_errorC2ERKSs.exit: ; preds = %entry + ret void + } + + fastcc void %_ZNSs4_Rep9_S_createEjRKSaIcE() { + entry: + call fastcc void %_ZSt20__throw_length_errorPKc( ) + unreachable + } + + fastcc void %_ZNSs12_S_constructIN9__gnu_cxx17__normal_iteratorIPcSsEEEES2_T_S4_RKSaIcESt20forward_iterator_tag() { + entry: + unreachable + } + + fastcc void %_ZNSs16_S_construct_auxIPKcEEPcT_S3_RKSaIcE12__false_type() { + entry: + br bool false, label %then.1.i, label %endif.1.i + + then.1.i: ; preds = %entry + call fastcc void %_ZSt19__throw_logic_errorPKc( ) + br label %endif.1.i + + endif.1.i: ; preds = %then.1.i, %entry + call fastcc void %_ZNSs4_Rep9_S_createEjRKSaIcE( ) + unreachable + } + + fastcc void %_ZNSsC1ERKSs() { + entry: + call fastcc void %_ZNSs4_Rep7_M_grabERKSaIcES2_( ) + invoke fastcc void %_ZNSaIcEC1ERKS_( ) + to label %invoke_cont.1 unwind label %invoke_catch.1 + + invoke_catch.1: ; preds = %entry + call fastcc void %_ZNSaIcED1Ev( ) + unwind + + invoke_cont.1: ; preds = %entry + call fastcc void %_ZNSaIcEC2ERKS_( ) + ret void + } + + fastcc void %_ZNSaIcEC1ERKS_() { + entry: + ret void + } + + fastcc void %_ZNSs7replaceEN9__gnu_cxx17__normal_iteratorIPcSsEES2_jc() { + entry: + ret void + } + + fastcc void %_ZNSs4_Rep7_M_grabERKSaIcES2_() { + entry: + br bool false, label %else.i, label %cond_true + + cond_true: ; preds = %entry + ret void + + else.i: ; preds = %entry + tail call fastcc void %_ZNSs4_Rep9_S_createEjRKSaIcE( ) + unreachable + } + + fastcc void %_ZNSaIcEC2ERKS_() { + entry: + ret void + } + + fastcc void %_ZN9__gnu_cxx12__pool_allocILb1ELi0EE8allocateEj() { + entry: + ret void + } + + fastcc void %_ZN9__gnu_cxx12__pool_allocILb1ELi0EE9_S_refillEj() { + entry: + unreachable + } Index: llvm/test/Regression/Transforms/Inline/2006-11-09-InlineCGUpdate.ll diff -c /dev/null llvm/test/Regression/Transforms/Inline/2006-11-09-InlineCGUpdate.ll:1.1 *** /dev/null Thu Nov 9 17:35:16 2006 --- llvm/test/Regression/Transforms/Inline/2006-11-09-InlineCGUpdate.ll Thu Nov 9 17:35:01 2006 *************** *** 0 **** --- 1,342 ---- + ; RUN: llvm-as < %s | opt -inline -prune-eh -disable-output + ; PR992 + target datalayout = "e-p:32:32" + target endian = little + target pointersize = 32 + target triple = "i686-pc-linux-gnu" + deplibs = [ "stdc++", "c", "crtend" ] + %struct._IO_FILE = type { int, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, %struct._IO_marker*, %struct._IO_FILE*, int, int, int, ushort, sbyte, [1 x sbyte], sbyte*, long, sbyte*, sbyte*, int, [52 x sbyte] } + %struct._IO_marker = type { %struct._IO_marker*, %struct._IO_FILE*, int } + "struct.__cxxabiv1::__array_type_info" = type { "struct.std::type_info" } + "struct.__cxxabiv1::__si_class_type_info" = type { "struct.__cxxabiv1::__array_type_info", "struct.__cxxabiv1::__array_type_info"* } + "struct.__gnu_cxx::_Rope_rep_alloc_base, true>" = type { uint } + "struct.__gnu_cxx::__normal_iterator, std::allocator > >" = type { sbyte* } + "struct.__gnu_cxx::__normal_iterator, std::allocator > >" = type { int* } + "struct.__gnu_cxx::char_producer" = type { int (...)** } + "struct.__gnu_cxx::stdio_sync_filebuf >" = type { "struct.std::basic_streambuf >", %struct._IO_FILE*, int } + "struct.__gnu_cxx::stdio_sync_filebuf >" = type { "struct.std::basic_streambuf >", %struct._IO_FILE*, uint } + %struct.__locale_struct = type { [13 x %struct.locale_data*], ushort*, int*, int*, [13 x sbyte*] } + %struct.__mbstate_t = type { int, "struct.__gnu_cxx::_Rope_rep_alloc_base, true>" } + %struct.locale_data = type opaque + "struct.std::__basic_file" = type { %struct._IO_FILE*, bool } + "struct.std::__codecvt_abstract_base" = type { "struct.std::locale::facet" } + "struct.std::basic_filebuf >" = type { "struct.std::basic_streambuf >", int, "struct.std::__basic_file", uint, %struct.__mbstate_t, %struct.__mbstate_t, sbyte*, uint, bool, bool, bool, bool, sbyte, sbyte*, sbyte*, bool, "struct.std::codecvt"*, sbyte*, int, sbyte*, sbyte* } + "struct.std::basic_filebuf >" = type { "struct.std::basic_streambuf >", int, "struct.std::__basic_file", uint, %struct.__mbstate_t, %struct.__mbstate_t, int*, uint, bool, bool, bool, bool, int, int*, int*, bool, "struct.std::codecvt"*, sbyte*, int, sbyte*, sbyte* } + "struct.std::basic_fstream >" = type { { "struct.std::locale::facet", "struct.__gnu_cxx::char_producer" }, "struct.std::basic_filebuf >", "struct.std::basic_ios >" } + "struct.std::basic_fstream >" = type { { "struct.std::locale::facet", "struct.__gnu_cxx::char_producer" }, "struct.std::basic_filebuf >", "struct.std::basic_ios >" } + "struct.std::basic_ios >" = type { "struct.std::ios_base", "struct.std::basic_ostream >"*, sbyte, bool, "struct.std::basic_streambuf >"*, "struct.std::ctype"*, "struct.std::__codecvt_abstract_base"*, "struct.std::__codecvt_abstract_base"* } + "struct.std::basic_ios >" = type { "struct.std::ios_base", "struct.std::basic_ostream >"*, int, bool, "struct.std::basic_streambuf >"*, "struct.std::codecvt"*, "struct.std::__codecvt_abstract_base"*, "struct.std::__codecvt_abstract_base"* } + "struct.std::basic_iostream >" = type { "struct.std::locale::facet", "struct.__gnu_cxx::char_producer", "struct.std::basic_ios >" } + "struct.std::basic_ostream >" = type { int (...)**, "struct.std::basic_ios >" } + "struct.std::basic_ostream >" = type { int (...)**, "struct.std::basic_ios >" } + "struct.std::basic_streambuf >" = type { int (...)**, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, "struct.std::locale" } + "struct.std::basic_streambuf >" = type { int (...)**, int*, int*, int*, int*, int*, int*, "struct.std::locale" } + "struct.std::basic_string,std::allocator >" = type { "struct.__gnu_cxx::__normal_iterator, std::allocator > >" } + "struct.std::basic_string,std::allocator >::_Rep" = type { "struct.std::basic_string,std::allocator >::_Rep_base" } + "struct.std::basic_string,std::allocator >::_Rep_base" = type { uint, uint, int } + "struct.std::basic_string,std::allocator >" = type { "struct.__gnu_cxx::__normal_iterator, std::allocator > >" } + "struct.std::codecvt" = type { "struct.std::__codecvt_abstract_base", %struct.__locale_struct* } + "struct.std::collate" = type { "struct.std::locale::facet", %struct.__locale_struct* } + "struct.std::collate_byname" = type { "struct.std::collate" } + "struct.std::ctype" = type { "struct.std::__codecvt_abstract_base", %struct.__locale_struct*, bool, int*, int*, ushort* } + "struct.std::ctype_byname" = type { "struct.std::ctype" } + "struct.std::domain_error" = type { "struct.std::logic_error" } + "struct.std::ios_base" = type { int (...)**, int, int, uint, uint, uint, "struct.std::ios_base::_Callback_list"*, "struct.std::ios_base::_Words", [8 x "struct.std::ios_base::_Words"], int, "struct.std::ios_base::_Words"*, "struct.std::locale" } + "struct.std::ios_base::_Callback_list" = type { "struct.std::ios_base::_Callback_list"*, void (uint, "struct.std::ios_base"*, int)*, int, int } + "struct.std::ios_base::_Words" = type { sbyte*, int } + "struct.std::istreambuf_iterator >" = type { "struct.std::basic_streambuf >"*, int } + "struct.std::istreambuf_iterator >" = type { "struct.std::basic_streambuf >"*, uint } + "struct.std::locale" = type { "struct.std::locale::_Impl"* } + "struct.std::locale::_Impl" = type { int, "struct.std::locale::facet"**, uint, "struct.std::locale::facet"**, sbyte** } + "struct.std::locale::facet" = type { int (...)**, int } + "struct.std::logic_error" = type { "struct.__gnu_cxx::char_producer", "struct.std::basic_string,std::allocator >" } + "struct.std::type_info" = type { int (...)**, sbyte* } + %.str_11 = external global [42 x sbyte] ; <[42 x sbyte]*> [#uses=0] + %.str_9 = external global [24 x sbyte] ; <[24 x sbyte]*> [#uses=0] + %.str_1 = external global [17 x sbyte] ; <[17 x sbyte]*> [#uses=0] + + implementation ; Functions: + + void %main() { + entry: + tail call fastcc void %_ZNSolsEi( ) + ret void + } + + fastcc void %_ZNSolsEi() { + entry: + %tmp.22 = seteq uint 0, 0 ; [#uses=1] + br bool %tmp.22, label %else, label %then + + then: ; preds = %entry + ret void + + else: ; preds = %entry + tail call fastcc void %_ZNSolsEl( ) + ret void + } + + void %_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_() { + entry: + ret void + } + + fastcc void %_ZNSt9basic_iosIcSt11char_traitsIcEE8setstateESt12_Ios_Iostate() { + entry: + tail call fastcc void %_ZSt19__throw_ios_failurePKc( ) + ret void + } + + fastcc void %_ZNSo3putEc() { + entry: + ret void + } + + fastcc void %_ZNSolsEl() { + entry: + %tmp.21.i = seteq "struct.std::basic_ostream >"* null, null ; [#uses=1] + br bool %tmp.21.i, label %endif.0.i, label %shortcirc_next.i + + shortcirc_next.i: ; preds = %entry + ret void + + endif.0.i: ; preds = %entry + call fastcc void %_ZNSt9basic_iosIcSt11char_traitsIcEE8setstateESt12_Ios_Iostate( ) + ret void + } + + fastcc void %_ZSt19__throw_ios_failurePKc() { + entry: + call fastcc void %_ZNSsC1EPKcRKSaIcE( ) + ret void + } + + fastcc void %_ZNSt8ios_baseD2Ev() { + entry: + unreachable + } + + void %_ZN9__gnu_cxx18stdio_sync_filebufIwSt11char_traitsIwEE5uflowEv() { + entry: + unreachable + } + + void %_ZN9__gnu_cxx18stdio_sync_filebufIcSt11char_traitsIcEED1Ev() { + entry: + unreachable + } + + void %_ZNSt15basic_streambufIcSt11char_traitsIcEE6setbufEPci() { + entry: + ret void + } + + fastcc void %_ZSt9use_facetISt5ctypeIcEERKT_RKSt6locale() { + entry: + ret void + } + + declare fastcc void %_ZNSaIcED1Ev() + + fastcc void %_ZSt19__throw_logic_errorPKc() { + entry: + call fastcc void %_ZNSt11logic_errorC1ERKSs( ) + ret void + } + + fastcc void %_ZNSs4_Rep9_S_createEjRKSaIcE() { + entry: + br bool false, label %then.0, label %endif.0 + + then.0: ; preds = %entry + call fastcc void %_ZSt20__throw_length_errorPKc( ) + ret void + + endif.0: ; preds = %entry + ret void + } + + fastcc void %_ZSt20__throw_length_errorPKc() { + entry: + call fastcc void %_ZNSt12length_errorC1ERKSs( ) + unwind + } + + fastcc void %_ZNSs16_S_construct_auxIPKcEEPcT_S3_RKSaIcE12__false_type() { + entry: + br bool false, label %then.1.i, label %endif.1.i + + then.1.i: ; preds = %entry + call fastcc void %_ZSt19__throw_logic_errorPKc( ) + ret void + + endif.1.i: ; preds = %entry + call fastcc void %_ZNSs4_Rep9_S_createEjRKSaIcE( ) + unreachable + } + + fastcc void %_ZNSsC1ERKSs() { + entry: + call fastcc void %_ZNSs4_Rep7_M_grabERKSaIcES2_( ) + invoke fastcc void %_ZNSaIcEC1ERKS_( ) + to label %invoke_cont.1 unwind label %invoke_catch.1 + + invoke_catch.1: ; preds = %entry + call fastcc void %_ZNSaIcED1Ev( ) + unwind + + invoke_cont.1: ; preds = %entry + call fastcc void %_ZNSaIcEC2ERKS_( ) + ret void + } + + fastcc void %_ZNSs7reserveEj() { + entry: + ret void + } + + fastcc void %_ZNSaIcEC1ERKS_() { + entry: + ret void + } + + fastcc void %_ZNSs4_Rep7_M_grabERKSaIcES2_() { + entry: + br bool false, label %else.i, label %cond_true + + cond_true: ; preds = %entry + ret void + + else.i: ; preds = %entry + tail call fastcc void %_ZNSs4_Rep9_S_createEjRKSaIcE( ) + ret void + } + + fastcc void %_ZNSsC1EPKcRKSaIcE() { + entry: + tail call fastcc void %_ZNSs16_S_construct_auxIPKcEEPcT_S3_RKSaIcE12__false_type( ) + unreachable + } + + fastcc void %_ZNSaIcEC2ERKS_() { + entry: + ret void + } + + void %_ZNSt7num_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEED1Ev() { + entry: + unreachable + } + + void %_ZNSt14collate_bynameIcED1Ev() { + entry: + unreachable + } + + void %_ZNKSt7num_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE6do_getES3_S3_RSt8ios_baseRSt12_Ios_IostateRy() { + entry: + ret void + } + + void %_ZNSt23__codecvt_abstract_baseIcc11__mbstate_tED1Ev() { + entry: + unreachable + } + + void %_ZNSt12ctype_bynameIcED0Ev() { + entry: + unreachable + } + + fastcc void %_ZNSt8messagesIwEC1Ej() { + entry: + ret void + } + + fastcc void %_ZSt14__convert_to_vIlEvPKcRT_RSt12_Ios_IostateRKP15__locale_structi() { + entry: + ret void + } + + fastcc void %_ZNSt8time_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEEC1Ej() { + entry: + ret void + } + + fastcc void %_ZNSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEEC1Ej() { + entry: + ret void + } + + fastcc void %_ZNKSt7num_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE16_M_extract_floatES3_S3_RSt8ios_baseRSt12_Ios_IostateRSs() { + entry: + unreachable + } + + fastcc void %_ZNSbIwSt11char_traitsIwESaIwEE4swapERS2_() { + entry: + ret void + } + + void %_ZNSt14basic_iostreamIwSt11char_traitsIwEED0Ev() { + entry: + unreachable + } + + void %_ZNSt15basic_streambufIcSt11char_traitsIcEE9showmanycEv() { + entry: + ret void + } + + void %_ZNSt9exceptionD0Ev() { + entry: + unreachable + } + + fastcc void %_ZNSt11logic_errorC1ERKSs() { + entry: + call fastcc void %_ZNSsC1ERKSs( ) + ret void + } + + fastcc void %_ZNSt11logic_errorD2Ev() { + entry: + unreachable + } + + fastcc void %_ZNSt12length_errorC1ERKSs() { + entry: + invoke fastcc void %_ZNSsC1ERKSs( ) + to label %_ZNSt11logic_errorC2ERKSs.exit unwind label %invoke_catch.i + + invoke_catch.i: ; preds = %entry + unwind + + _ZNSt11logic_errorC2ERKSs.exit: ; preds = %entry + ret void + } + + void %_ZNK10__cxxabiv120__si_class_type_info20__do_find_public_srcEiPKvPKNS_17__class_type_infoES2_() { + entry: + ret void + } + + fastcc void %_ZNSbIwSt11char_traitsIwESaIwEE16_S_construct_auxIPKwEEPwT_S7_RKS1_12__false_type() { + entry: + ret void + } + + void %_ZTv0_n12_NSt13basic_fstreamIwSt11char_traitsIwEED1Ev() { + entry: + ret void + } + + void %_ZNSt13basic_fstreamIcSt11char_traitsIcEED1Ev() { + entry: + unreachable + } + + fastcc void %_ZNSt5ctypeIcEC1EPKtbj() { + entry: + ret void + } From sabre at nondot.org Thu Nov 9 17:36:23 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 9 Nov 2006 17:36:23 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/IPO/Inliner.cpp Message-ID: <200611092336.kA9NaNtb002230@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: Inliner.cpp updated: 1.31 -> 1.32 --- Log message: second patch to fix PR992: http://llvm.org/PR992 /993. --- Diffs of the changes: (+17 -4) Inliner.cpp | 21 +++++++++++++++++---- 1 files changed, 17 insertions(+), 4 deletions(-) Index: llvm/lib/Transforms/IPO/Inliner.cpp diff -u llvm/lib/Transforms/IPO/Inliner.cpp:1.31 llvm/lib/Transforms/IPO/Inliner.cpp:1.32 --- llvm/lib/Transforms/IPO/Inliner.cpp:1.31 Thu Nov 9 17:17:45 2006 +++ llvm/lib/Transforms/IPO/Inliner.cpp Thu Nov 9 17:36:08 2006 @@ -112,8 +112,13 @@ // Calls to external functions are never inlinable. if (Callee->isExternal() || CallSites[CSi].getInstruction()->getParent()->getParent() ==Callee){ - std::swap(CallSites[CSi], CallSites.back()); - CallSites.pop_back(); + if (SCC.size() == 1) { + std::swap(CallSites[CSi], CallSites.back()); + CallSites.pop_back(); + } else { + // Keep the 'in SCC / not in SCC' boundary correct. + CallSites.erase(CallSites.begin()+CSi); + } --CSi; continue; } @@ -131,8 +136,16 @@ // Attempt to inline the function... if (InlineCallIfPossible(CS, CG, SCCFunctions)) { - // Remove this call site from the list. - CallSites.erase(CallSites.begin()+CSi); + // Remove this call site from the list. If possible, use + // swap/pop_back for efficiency, but do not use it if doing so would + // move a call site to a function in this SCC before the + // 'FirstCallInSCC' barrier. + if (SCC.size() == 1) { + std::swap(CallSites[CSi], CallSites.back()); + CallSites.pop_back(); + } else { + CallSites.erase(CallSites.begin()+CSi); + } --CSi; ++NumInlined; From tonic at nondot.org Thu Nov 9 18:06:36 2006 From: tonic at nondot.org (Tanya Lattner) Date: Thu, 9 Nov 2006 18:06:36 -0600 Subject: [llvm-commits] [release_19] CVS: llvm/lib/Transforms/IPO/Inliner.cpp Message-ID: <200611100006.kAA06a84012011@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/IPO: Inliner.cpp updated: 1.30 -> 1.30.2.1 --- Log message: Merging from mainline. --- Diffs of the changes: (+17 -5) Inliner.cpp | 22 +++++++++++++++++----- 1 files changed, 17 insertions(+), 5 deletions(-) Index: llvm/lib/Transforms/IPO/Inliner.cpp diff -u llvm/lib/Transforms/IPO/Inliner.cpp:1.30 llvm/lib/Transforms/IPO/Inliner.cpp:1.30.2.1 --- llvm/lib/Transforms/IPO/Inliner.cpp:1.30 Thu Nov 2 14:25:50 2006 +++ llvm/lib/Transforms/IPO/Inliner.cpp Thu Nov 9 18:06:24 2006 @@ -112,8 +112,13 @@ // Calls to external functions are never inlinable. if (Callee->isExternal() || CallSites[CSi].getInstruction()->getParent()->getParent() ==Callee){ - std::swap(CallSites[CSi], CallSites.back()); - CallSites.pop_back(); + if (SCC.size() == 1) { + std::swap(CallSites[CSi], CallSites.back()); + CallSites.pop_back(); + } else { + // Keep the 'in SCC / not in SCC' boundary correct. + CallSites.erase(CallSites.begin()+CSi); + } --CSi; continue; } @@ -131,9 +136,16 @@ // Attempt to inline the function... if (InlineCallIfPossible(CS, CG, SCCFunctions)) { - // Remove this call site from the list. - std::swap(CallSites[CSi], CallSites.back()); - CallSites.pop_back(); + // Remove this call site from the list. If possible, use + // swap/pop_back for efficiency, but do not use it if doing so would + // move a call site to a function in this SCC before the + // 'FirstCallInSCC' barrier. + if (SCC.size() == 1) { + std::swap(CallSites[CSi], CallSites.back()); + CallSites.pop_back(); + } else { + CallSites.erase(CallSites.begin()+CSi); + } --CSi; ++NumInlined; From sabre at nondot.org Thu Nov 9 18:23:41 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 9 Nov 2006 18:23:41 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/README.txt Message-ID: <200611100023.kAA0Nfpv009707@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target: README.txt updated: 1.46 -> 1.47 --- Log message: add a note about viterbi --- Diffs of the changes: (+6 -0) README.txt | 6 ++++++ 1 files changed, 6 insertions(+) Index: llvm/lib/Target/README.txt diff -u llvm/lib/Target/README.txt:1.46 llvm/lib/Target/README.txt:1.47 --- llvm/lib/Target/README.txt:1.46 Mon Nov 6 15:26:49 2006 +++ llvm/lib/Target/README.txt Thu Nov 9 18:23:26 2006 @@ -354,3 +354,9 @@ http://gcc.gnu.org/ml/gcc-patches/2006-10/msg01519.html //===---------------------------------------------------------------------===// + +viterbi speeds up *significantly* if the various "history" related copy loops +are turned into memcpy calls at the source level. We need a "loops to memcpy" +pass. + +//===---------------------------------------------------------------------===// From asl at math.spbu.ru Thu Nov 9 18:48:28 2006 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Thu, 9 Nov 2006 18:48:28 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200611100048.kAA0mSed020062@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.288 -> 1.289 --- Log message: Fixing PR990: http://llvm.org/PR990 : http://llvm.org/PR990: http://llvm.org/PR990 . This should unbreak csretcc on Linux & mingw targets. Several tests from llvm-test should be also restored (fftbench, bigfib). --- Diffs of the changes: (+6 -6) X86ISelLowering.cpp | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.288 llvm/lib/Target/X86/X86ISelLowering.cpp:1.289 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.288 Tue Nov 7 16:14:24 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Thu Nov 9 18:48:12 2006 @@ -516,10 +516,9 @@ BytesToPopOnReturn = 0; // Callee pops nothing. BytesCallerReserves = ArgOffset; - // If this is a struct return on Darwin/X86, the callee pops the hidden struct - // pointer. - if (MF.getFunction()->getCallingConv() == CallingConv::CSRet && - Subtarget->isTargetDarwin()) + // If this is a struct return on, the callee pops the hidden struct + // pointer. This is common for Darwin/X86, Linux & Mingw32 targets. + if (MF.getFunction()->getCallingConv() == CallingConv::CSRet) BytesToPopOnReturn = 4; // Return the new list of results. @@ -680,9 +679,10 @@ // Create the CALLSEQ_END node. unsigned NumBytesForCalleeToPush = 0; - // If this is is a call to a struct-return function on Darwin/X86, the callee + // If this is is a call to a struct-return function, the callee // pops the hidden struct pointer, so we have to push it back. - if (CallingConv == CallingConv::CSRet && Subtarget->isTargetDarwin()) + // This is common for Darwin/X86, Linux & Mingw32 targets. + if (CallingConv == CallingConv::CSRet) NumBytesForCalleeToPush = 4; NodeTys.clear(); From asl at math.spbu.ru Thu Nov 9 18:48:29 2006 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Thu, 9 Nov 2006 18:48:29 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/2006-11-12-CSRetCC.ll Message-ID: <200611100048.kAA0mTSe020067@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/X86: 2006-11-12-CSRetCC.ll added (r1.1) --- Log message: Fixing PR990: http://llvm.org/PR990 : http://llvm.org/PR990: http://llvm.org/PR990 . This should unbreak csretcc on Linux & mingw targets. Several tests from llvm-test should be also restored (fftbench, bigfib). --- Diffs of the changes: (+60 -0) 2006-11-12-CSRetCC.ll | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 60 insertions(+) Index: llvm/test/Regression/CodeGen/X86/2006-11-12-CSRetCC.ll diff -c /dev/null llvm/test/Regression/CodeGen/X86/2006-11-12-CSRetCC.ll:1.1 *** /dev/null Thu Nov 9 18:48:22 2006 --- llvm/test/Regression/CodeGen/X86/2006-11-12-CSRetCC.ll Thu Nov 9 18:48:12 2006 *************** *** 0 **** --- 1,60 ---- + ; RUN: llvm-as < %s | llc -march=x86 | grep 'subl $4, %esp' + + %str = internal constant [9 x sbyte] c"%f+%f*i\0A\00" ; <[9 x sbyte]*> [#uses=1] + + implementation ; Functions: + + int %main() { + entry: + %retval = alloca int, align 4 ; [#uses=1] + %tmp = alloca { double, double }, align 16 ; <{ double, double }*> [#uses=4] + %tmp1 = alloca { double, double }, align 16 ; <{ double, double }*> [#uses=4] + %tmp2 = alloca { double, double }, align 16 ; <{ double, double }*> [#uses=3] + %pi = alloca double, align 8 ; [#uses=2] + %z = alloca { double, double }, align 16 ; <{ double, double }*> [#uses=4] + "alloca point" = cast int 0 to int ; [#uses=0] + store double 0x400921FB54442D18, double* %pi + %tmp = load double* %pi ; [#uses=1] + %real = getelementptr { double, double }* %tmp1, uint 0, uint 0 ; [#uses=1] + store double 0.000000e+00, double* %real + %real3 = getelementptr { double, double }* %tmp1, uint 0, uint 1 ; [#uses=1] + store double %tmp, double* %real3 + %tmp = getelementptr { double, double }* %tmp, uint 0, uint 0 ; [#uses=1] + %tmp4 = getelementptr { double, double }* %tmp1, uint 0, uint 0 ; [#uses=1] + %tmp5 = load double* %tmp4 ; [#uses=1] + store double %tmp5, double* %tmp + %tmp6 = getelementptr { double, double }* %tmp, uint 0, uint 1 ; [#uses=1] + %tmp7 = getelementptr { double, double }* %tmp1, uint 0, uint 1 ; [#uses=1] + %tmp8 = load double* %tmp7 ; [#uses=1] + store double %tmp8, double* %tmp6 + %tmp = cast { double, double }* %tmp to { long, long }* ; <{ long, long }*> [#uses=1] + %tmp = getelementptr { long, long }* %tmp, uint 0, uint 0 ; [#uses=1] + %tmp = load long* %tmp ; [#uses=1] + %tmp9 = cast { double, double }* %tmp to { long, long }* ; <{ long, long }*> [#uses=1] + %tmp10 = getelementptr { long, long }* %tmp9, uint 0, uint 1 ; [#uses=1] + %tmp11 = load long* %tmp10 ; [#uses=1] + call csretcc void %cexp( { double, double }* %tmp2, long %tmp, long %tmp11 ) + %tmp12 = getelementptr { double, double }* %z, uint 0, uint 0 ; [#uses=1] + %tmp13 = getelementptr { double, double }* %tmp2, uint 0, uint 0 ; [#uses=1] + %tmp14 = load double* %tmp13 ; [#uses=1] + store double %tmp14, double* %tmp12 + %tmp15 = getelementptr { double, double }* %z, uint 0, uint 1 ; [#uses=1] + %tmp16 = getelementptr { double, double }* %tmp2, uint 0, uint 1 ; [#uses=1] + %tmp17 = load double* %tmp16 ; [#uses=1] + store double %tmp17, double* %tmp15 + %tmp18 = getelementptr { double, double }* %z, uint 0, uint 1 ; [#uses=1] + %tmp19 = load double* %tmp18 ; [#uses=1] + %tmp20 = getelementptr { double, double }* %z, uint 0, uint 0 ; [#uses=1] + %tmp21 = load double* %tmp20 ; [#uses=1] + %tmp = getelementptr [9 x sbyte]* %str, int 0, uint 0 ; [#uses=1] + %tmp = call int (sbyte*, ...)* %printf( sbyte* %tmp, double %tmp21, double %tmp19 ) ; [#uses=0] + br label %return + + return: ; preds = %entry + %retval = load int* %retval ; [#uses=1] + ret int %retval + } + + declare csretcc void %cexp({ double, double }*, long, long) + + declare int %printf(sbyte*, ...) From evan.cheng at apple.com Thu Nov 9 19:29:03 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Thu, 9 Nov 2006 19:29:03 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86CodeEmitter.cpp X86FloatingPoint.cpp X86RegisterInfo.cpp Message-ID: <200611100129.kAA1T300007280@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86CodeEmitter.cpp updated: 1.121 -> 1.122 X86FloatingPoint.cpp updated: 1.55 -> 1.56 X86RegisterInfo.cpp updated: 1.173 -> 1.174 --- Log message: Use TargetInstrInfo::getNumOperands() instead of MachineInstr::getNumOperands(). In preparation for implicit reg def/use changes. --- Diffs of the changes: (+50 -34) X86CodeEmitter.cpp | 42 ++++++++++++++++++++++-------------------- X86FloatingPoint.cpp | 22 ++++++++++++++++------ X86RegisterInfo.cpp | 20 ++++++++++++-------- 3 files changed, 50 insertions(+), 34 deletions(-) Index: llvm/lib/Target/X86/X86CodeEmitter.cpp diff -u llvm/lib/Target/X86/X86CodeEmitter.cpp:1.121 llvm/lib/Target/X86/X86CodeEmitter.cpp:1.122 --- llvm/lib/Target/X86/X86CodeEmitter.cpp:1.121 Wed Nov 8 20:22:54 2006 +++ llvm/lib/Target/X86/X86CodeEmitter.cpp Thu Nov 9 19:28:43 2006 @@ -469,14 +469,15 @@ if (Desc.TSFlags & X86II::REX_W) REX |= 1 << 3; - if (MI.getNumOperands()) { - bool isTwoAddr = II->getNumOperands(Opcode) > 1 && + unsigned NumOps = II->getNumOperands(Opcode); + if (NumOps) { + bool isTwoAddr = NumOps > 1 && II->getOperandConstraint(Opcode, 1, TargetInstrInfo::TIED_TO) != -1; // If it accesses SPL, BPL, SIL, or DIL, then it requires a 0x40 REX prefix. bool isTrunc8 = isX86_64TruncToByte(Opcode); unsigned i = isTwoAddr ? 1 : 0; - for (unsigned e = MI.getNumOperands(); i != e; ++i) { + for (unsigned e = NumOps; i != e; ++i) { const MachineOperand& MO = MI.getOperand(i); if (MO.isRegister()) { unsigned Reg = MO.getReg(); @@ -498,7 +499,7 @@ if (isX86_64ExtendedReg(MI.getOperand(0))) REX |= 1 << 2; i = isTwoAddr ? 2 : 1; - for (unsigned e = MI.getNumOperands(); i != e; ++i) { + for (unsigned e = NumOps; i != e; ++i) { const MachineOperand& MO = MI.getOperand(i); if (isX86_64ExtendedReg(MO)) REX |= 1 << 0; @@ -510,7 +511,7 @@ REX |= 1 << 2; unsigned Bit = 0; i = isTwoAddr ? 2 : 1; - for (; i != MI.getNumOperands(); ++i) { + for (; i != NumOps; ++i) { const MachineOperand& MO = MI.getOperand(i); if (MO.isRegister()) { if (isX86_64ExtendedReg(MO)) @@ -527,7 +528,7 @@ case X86II::MRMDestMem: { unsigned e = isTwoAddr ? 5 : 4; i = isTwoAddr ? 1 : 0; - if (MI.getNumOperands() > e && isX86_64ExtendedReg(MI.getOperand(e))) + if (NumOps > e && isX86_64ExtendedReg(MI.getOperand(e))) REX |= 1 << 2; unsigned Bit = 0; for (; i != e; ++i) { @@ -544,7 +545,7 @@ if (isX86_64ExtendedReg(MI.getOperand(0))) REX |= 1 << 0; i = isTwoAddr ? 2 : 1; - for (unsigned e = MI.getNumOperands(); i != e; ++i) { + for (unsigned e = NumOps; i != e; ++i) { const MachineOperand& MO = MI.getOperand(i); if (isX86_64ExtendedReg(MO)) REX |= 1 << 2; @@ -607,8 +608,9 @@ MCE.emitByte(0x0F); // If this is a two-address instruction, skip one of the register operands. + unsigned NumOps = II->getNumOperands(Opcode); unsigned CurOp = 0; - if (II->getNumOperands(Opcode) > 1 && + if (NumOps > 1 && II->getOperandConstraint(Opcode, 1, TargetInstrInfo::TIED_TO) != -1) CurOp++; @@ -637,12 +639,12 @@ break; } #endif - CurOp = MI.getNumOperands(); + CurOp = NumOps; break; case X86II::RawFrm: MCE.emitByte(BaseOpcode); - if (CurOp != MI.getNumOperands()) { + if (CurOp != NumOps) { const MachineOperand &MO = MI.getOperand(CurOp++); if (MO.isMachineBasicBlock()) { emitPCRelativeBlockAddress(MO.getMachineBasicBlock()); @@ -663,7 +665,7 @@ case X86II::AddRegFrm: MCE.emitByte(BaseOpcode + getX86RegNum(MI.getOperand(CurOp++).getReg())); - if (CurOp != MI.getNumOperands()) { + if (CurOp != NumOps) { const MachineOperand &MO1 = MI.getOperand(CurOp++); if (MO1.isGlobalAddress()) { assert(sizeOfImm(Desc) == TD->getPointerSize() && @@ -688,7 +690,7 @@ emitRegModRMByte(MI.getOperand(CurOp).getReg(), getX86RegNum(MI.getOperand(CurOp+1).getReg())); CurOp += 2; - if (CurOp != MI.getNumOperands()) + if (CurOp != NumOps) emitConstant(MI.getOperand(CurOp++).getImm(), sizeOfImm(Desc)); break; } @@ -696,7 +698,7 @@ MCE.emitByte(BaseOpcode); emitMemModRMByte(MI, CurOp, getX86RegNum(MI.getOperand(CurOp+4).getReg())); CurOp += 5; - if (CurOp != MI.getNumOperands()) + if (CurOp != NumOps) emitConstant(MI.getOperand(CurOp++).getImm(), sizeOfImm(Desc)); break; } @@ -706,18 +708,18 @@ emitRegModRMByte(MI.getOperand(CurOp+1).getReg(), getX86RegNum(MI.getOperand(CurOp).getReg())); CurOp += 2; - if (CurOp != MI.getNumOperands()) + if (CurOp != NumOps) emitConstant(MI.getOperand(CurOp++).getImm(), sizeOfImm(Desc)); break; case X86II::MRMSrcMem: { - unsigned PCAdj = (CurOp+5 != MI.getNumOperands()) ? sizeOfImm(Desc) : 0; + unsigned PCAdj = (CurOp+5 != NumOps) ? sizeOfImm(Desc) : 0; MCE.emitByte(BaseOpcode); emitMemModRMByte(MI, CurOp+1, getX86RegNum(MI.getOperand(CurOp).getReg()), PCAdj); CurOp += 5; - if (CurOp != MI.getNumOperands()) + if (CurOp != NumOps) emitConstant(MI.getOperand(CurOp++).getImm(), sizeOfImm(Desc)); break; } @@ -730,7 +732,7 @@ emitRegModRMByte(MI.getOperand(CurOp++).getReg(), (Desc.TSFlags & X86II::FormMask)-X86II::MRM0r); - if (CurOp != MI.getNumOperands() && MI.getOperand(CurOp).isImmediate()) + if (CurOp != NumOps && MI.getOperand(CurOp).isImmediate()) emitConstant(MI.getOperand(CurOp++).getImm(), sizeOfImm(Desc)); break; @@ -738,7 +740,7 @@ case X86II::MRM2m: case X86II::MRM3m: case X86II::MRM4m: case X86II::MRM5m: case X86II::MRM6m: case X86II::MRM7m: { - unsigned PCAdj = (CurOp+4 != MI.getNumOperands()) ? + unsigned PCAdj = (CurOp+4 != NumOps) ? (MI.getOperand(CurOp+4).isImmediate() ? sizeOfImm(Desc) : 4) : 0; MCE.emitByte(BaseOpcode); @@ -746,7 +748,7 @@ PCAdj); CurOp += 4; - if (CurOp != MI.getNumOperands()) { + if (CurOp != NumOps) { const MachineOperand &MO = MI.getOperand(CurOp++); if (MO.isImmediate()) emitConstant(MO.getImm(), sizeOfImm(Desc)); @@ -770,5 +772,5 @@ } assert((Desc.Flags & M_VARIABLE_OPS) != 0 || - CurOp == MI.getNumOperands() && "Unknown encoding!"); + CurOp == NumOps && "Unknown encoding!"); } Index: llvm/lib/Target/X86/X86FloatingPoint.cpp diff -u llvm/lib/Target/X86/X86FloatingPoint.cpp:1.55 llvm/lib/Target/X86/X86FloatingPoint.cpp:1.56 --- llvm/lib/Target/X86/X86FloatingPoint.cpp:1.55 Thu Nov 2 14:25:49 2006 +++ llvm/lib/Target/X86/X86FloatingPoint.cpp Thu Nov 9 19:28:43 2006 @@ -500,11 +500,14 @@ /// void FPS::handleOneArgFP(MachineBasicBlock::iterator &I) { MachineInstr *MI = I; - assert((MI->getNumOperands() == 5 || MI->getNumOperands() == 1) && + MachineFunction *MF = MI->getParent()->getParent(); + const TargetInstrInfo &TII = *MF->getTarget().getInstrInfo(); + unsigned NumOps = TII.getNumOperands(MI->getOpcode()); + assert((NumOps == 5 || NumOps == 1) && "Can only handle fst* & ftst instructions!"); // Is this the last use of the source register? - unsigned Reg = getFPReg(MI->getOperand(MI->getNumOperands()-1)); + unsigned Reg = getFPReg(MI->getOperand(NumOps-1)); bool KillsSrc = LV->KillsRegister(MI, X86::FP0+Reg); // FISTP64m is strange because there isn't a non-popping versions. @@ -524,7 +527,7 @@ } // Convert from the pseudo instruction to the concrete instruction. - MI->RemoveOperand(MI->getNumOperands()-1); // Remove explicit ST(0) operand + MI->RemoveOperand(NumOps-1); // Remove explicit ST(0) operand MI->setOpcode(getConcreteOpcode(MI->getOpcode())); if (MI->getOpcode() == X86::FISTP64m || @@ -549,7 +552,10 @@ /// void FPS::handleOneArgFPRW(MachineBasicBlock::iterator &I) { MachineInstr *MI = I; - assert(MI->getNumOperands() >= 2 && "FPRW instructions must have 2 ops!!"); + MachineFunction *MF = MI->getParent()->getParent(); + const TargetInstrInfo &TII = *MF->getTarget().getInstrInfo(); + unsigned NumOps = TII.getNumOperands(MI->getOpcode()); + assert(NumOps >= 2 && "FPRW instructions must have 2 ops!!"); // Is this the last use of the source register? unsigned Reg = getFPReg(MI->getOperand(1)); @@ -625,7 +631,9 @@ ASSERT_SORTED(ForwardSTiTable); ASSERT_SORTED(ReverseSTiTable); MachineInstr *MI = I; - unsigned NumOperands = MI->getNumOperands(); + MachineFunction *MF = MI->getParent()->getParent(); + const TargetInstrInfo &TII = *MF->getTarget().getInstrInfo(); + unsigned NumOperands = TII.getNumOperands(MI->getOpcode()); assert(NumOperands == 3 && "Illegal TwoArgFP instruction!"); unsigned Dest = getFPReg(MI->getOperand(0)); unsigned Op0 = getFPReg(MI->getOperand(NumOperands-2)); @@ -722,7 +730,9 @@ ASSERT_SORTED(ForwardSTiTable); ASSERT_SORTED(ReverseSTiTable); MachineInstr *MI = I; - unsigned NumOperands = MI->getNumOperands(); + MachineFunction *MF = MI->getParent()->getParent(); + const TargetInstrInfo &TII = *MF->getTarget().getInstrInfo(); + unsigned NumOperands = TII.getNumOperands(MI->getOpcode()); assert(NumOperands == 2 && "Illegal FUCOM* instruction!"); unsigned Op0 = getFPReg(MI->getOperand(NumOperands-2)); unsigned Op1 = getFPReg(MI->getOperand(NumOperands-1)); Index: llvm/lib/Target/X86/X86RegisterInfo.cpp diff -u llvm/lib/Target/X86/X86RegisterInfo.cpp:1.173 llvm/lib/Target/X86/X86RegisterInfo.cpp:1.174 --- llvm/lib/Target/X86/X86RegisterInfo.cpp:1.173 Wed Nov 8 20:22:54 2006 +++ llvm/lib/Target/X86/X86RegisterInfo.cpp Thu Nov 9 19:28:43 2006 @@ -161,8 +161,9 @@ } static MachineInstr *FuseTwoAddrInst(unsigned Opcode, unsigned FrameIndex, - MachineInstr *MI) { - unsigned NumOps = MI->getNumOperands()-2; + MachineInstr *MI, + const TargetInstrInfo &TII) { + unsigned NumOps = TII.getNumOperands(MI->getOpcode())-2; // Create the base instruction with the memory operand as the first part. MachineInstrBuilder MIB = addFrameReference(BuildMI(Opcode, 4+NumOps), FrameIndex); @@ -185,7 +186,8 @@ } static MachineInstr *FuseInst(unsigned Opcode, unsigned OpNo, - unsigned FrameIndex, MachineInstr *MI) { + unsigned FrameIndex, MachineInstr *MI, + const TargetInstrInfo &TII) { MachineInstrBuilder MIB = BuildMI(Opcode, MI->getNumOperands()+3); for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { @@ -284,14 +286,16 @@ const TableEntry *OpcodeTablePtr = NULL; unsigned OpcodeTableSize = 0; bool isTwoAddrFold = false; - bool isTwoAddr = TII.getNumOperands(MI->getOpcode()) > 1 && + unsigned NumOps = TII.getNumOperands(MI->getOpcode()); + bool isTwoAddr = NumOps > 1 && TII.getOperandConstraint(MI->getOpcode(), 1,TargetInstrInfo::TIED_TO) != -1; // Folding a memory location into the two-address part of a two-address // instruction is different than folding it other places. It requires // replacing the *two* registers with the memory location. - if (isTwoAddr && MI->getNumOperands() >= 2 && MI->getOperand(0).isReg() && - MI->getOperand(1).isReg() && i < 2 && + if (isTwoAddr && NumOps >= 2 && i < 2 && + MI->getOperand(0).isReg() && + MI->getOperand(1).isReg() && MI->getOperand(0).getReg() == MI->getOperand(1).getReg()) { static const TableEntry OpcodeTable[] = { { X86::ADC32ri, X86::ADC32mi }, @@ -823,9 +827,9 @@ if (const TableEntry *Entry = TableLookup(OpcodeTablePtr, OpcodeTableSize, fromOpcode)) { if (isTwoAddrFold) - return FuseTwoAddrInst(Entry->to, FrameIndex, MI); + return FuseTwoAddrInst(Entry->to, FrameIndex, MI, TII); - return FuseInst(Entry->to, i, FrameIndex, MI); + return FuseInst(Entry->to, i, FrameIndex, MI, TII); } } From sabre at nondot.org Thu Nov 9 19:34:07 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 9 Nov 2006 19:34:07 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/README.txt Message-ID: <200611100134.kAA1Y7n5007402@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: README.txt updated: 1.104 -> 1.105 --- Log message: add note about ugly codegen with preinc --- Diffs of the changes: (+29 -0) README.txt | 29 +++++++++++++++++++++++++++++ 1 files changed, 29 insertions(+) Index: llvm/lib/Target/PowerPC/README.txt diff -u llvm/lib/Target/PowerPC/README.txt:1.104 llvm/lib/Target/PowerPC/README.txt:1.105 --- llvm/lib/Target/PowerPC/README.txt:1.104 Tue Nov 7 12:30:21 2006 +++ llvm/lib/Target/PowerPC/README.txt Thu Nov 9 19:33:53 2006 @@ -9,6 +9,35 @@ Support 'update' load/store instructions. These are cracked on the G5, but are still a codesize win. +With preinc enabled, this: + +long *%test4(long *%X, long *%dest) { + %Y = getelementptr long* %X, int 4 + %A = load long* %Y + store long %A, long* %dest + ret long* %Y +} + +compiles to: + +_test4: + mr r2, r3 + lwzu r5, 32(r2) + lwz r3, 36(r3) + stw r5, 0(r4) + stw r3, 4(r4) + mr r3, r2 + blr + +with -sched=list-burr, I get: + +_test4: + lwz r2, 36(r3) + lwzu r5, 32(r3) + stw r2, 4(r4) + stw r5, 0(r4) + blr + ===-------------------------------------------------------------------------=== We compile the hottest inner loop of viterbi to: From sabre at nondot.org Thu Nov 9 20:01:55 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 9 Nov 2006 20:01:55 -0600 Subject: [llvm-commits] CVS: llvm/utils/TableGen/CodeGenTarget.cpp InstrInfoEmitter.cpp Message-ID: <200611100201.kAA21t01006121@zion.cs.uiuc.edu> Changes in directory llvm/utils/TableGen: CodeGenTarget.cpp updated: 1.76 -> 1.77 InstrInfoEmitter.cpp updated: 1.51 -> 1.52 --- Log message: allow ptr_rc to explicitly appear in an instructions operand list, it doesn't have to be a subpart of a complex operand. --- Diffs of the changes: (+42 -38) CodeGenTarget.cpp | 3 + InstrInfoEmitter.cpp | 77 ++++++++++++++++++++++++++------------------------- 2 files changed, 42 insertions(+), 38 deletions(-) Index: llvm/utils/TableGen/CodeGenTarget.cpp diff -u llvm/utils/TableGen/CodeGenTarget.cpp:1.76 llvm/utils/TableGen/CodeGenTarget.cpp:1.77 --- llvm/utils/TableGen/CodeGenTarget.cpp:1.76 Mon Nov 6 19:27:55 2006 +++ llvm/utils/TableGen/CodeGenTarget.cpp Thu Nov 9 20:01:40 2006 @@ -386,7 +386,8 @@ } else if (Rec->getName() == "variable_ops") { hasVariableNumberOfOperands = true; continue; - } else if (!Rec->isSubClassOf("RegisterClass")) + } else if (!Rec->isSubClassOf("RegisterClass") && + Rec->getName() != "ptr_rc") throw "Unknown operand class '" + Rec->getName() + "' in instruction '" + R->getName() + "' instruction!"; Index: llvm/utils/TableGen/InstrInfoEmitter.cpp diff -u llvm/utils/TableGen/InstrInfoEmitter.cpp:1.51 llvm/utils/TableGen/InstrInfoEmitter.cpp:1.52 --- llvm/utils/TableGen/InstrInfoEmitter.cpp:1.51 Wed Nov 8 20:21:31 2006 +++ llvm/utils/TableGen/InstrInfoEmitter.cpp Thu Nov 9 20:01:40 2006 @@ -66,50 +66,53 @@ std::vector InstrInfoEmitter::GetOperandInfo(const CodeGenInstruction &Inst) { std::vector Result; + for (unsigned i = 0, e = Inst.OperandList.size(); i != e; ++i) { - if (Inst.OperandList[i].Rec->isSubClassOf("RegisterClass")) { - std::string OpStr = getQualifiedName(Inst.OperandList[i].Rec); - OpStr += "RegClassID, 0, "; - OpStr += Inst.OperandList[i].Constraint; - - Result.push_back(OpStr); + // Handle aggregate operands and normal operands the same way by expanding + // either case into a list of operands for this op. + std::vector OperandList; + + // This might be a multiple operand thing. Targets like X86 have + // registers in their multi-operand operands. It may also be an anonymous + // operand, which has a single operand, but no declared class for the + // operand. + DagInit *MIOI = Inst.OperandList[i].MIOperandInfo; + + if (!MIOI || MIOI->getNumArgs() == 0) { + // Single, anonymous, operand. + OperandList.push_back(Inst.OperandList[i]); } else { - // This might be a multiple operand thing. Targets like X86 have - // registers in their multi-operand operands. It may also be an anonymous - // operand, which has a single operand, but no declared class for the - // operand. - DagInit *MIOI = Inst.OperandList[i].MIOperandInfo; - for (unsigned j = 0, e = Inst.OperandList[i].MINumOperands; j != e; ++j) { - Record *OpR = 0; - if (MIOI && j < MIOI->getNumArgs()) - if (DefInit *Def = dynamic_cast(MIOI->getArg(j))) - OpR = Def->getDef(); + OperandList.push_back(Inst.OperandList[i]); - - std::string Res; - - if (OpR && OpR->isSubClassOf("RegisterClass")) - Res += getQualifiedName(OpR) + "RegClassID, "; - else - Res += "0, "; + Record *OpR = dynamic_cast(MIOI->getArg(j))->getDef(); + OperandList.back().Rec = OpR; + } + } - // Fill in applicable flags. - Res += "0"; - - // Ptr value whose register class is resolved via callback. - if (OpR && OpR->getName() == "ptr_rc") - Res += "|M_LOOK_UP_PTR_REG_CLASS"; - - // Predicate operands. - if (j == 0 && Inst.OperandList[i].Rec->isSubClassOf("PredicateOperand")) - Res += "|M_PREDICATE_OPERAND"; + for (unsigned j = 0, e = OperandList.size(); j != e; ++j) { + Record *OpR = OperandList[j].Rec; + std::string Res; + + if (OpR->isSubClassOf("RegisterClass")) + Res += getQualifiedName(OpR) + "RegClassID, "; + else + Res += "0, "; + // Fill in applicable flags. + Res += "0"; - // fill in constraint info. - Res += ", " + Inst.OperandList[i].Constraint; + // Ptr value whose register class is resolved via callback. + if (OpR->getName() == "ptr_rc") + Res += "|M_LOOK_UP_PTR_REG_CLASS"; + + // Predicate operands. Check to see if the original unexpanded operand + // was of type PredicateOperand. + if (j == 0 && Inst.OperandList[i].Rec->isSubClassOf("PredicateOperand")) + Res += "|M_PREDICATE_OPERAND"; - Result.push_back(Res); - } + // Fill in constraint info. + Res += ", " + Inst.OperandList[i].Constraint; + Result.push_back(Res); } } From sabre at nondot.org Thu Nov 9 20:05:06 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 9 Nov 2006 20:05:06 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/PowerPC/mem_update.ll Message-ID: <200611100205.kAA256DN006208@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/PowerPC: mem_update.ll updated: 1.1 -> 1.2 --- Log message: make this test more interesting --- Diffs of the changes: (+32 -1) mem_update.ll | 33 ++++++++++++++++++++++++++++++++- 1 files changed, 32 insertions(+), 1 deletion(-) Index: llvm/test/Regression/CodeGen/PowerPC/mem_update.ll diff -u llvm/test/Regression/CodeGen/PowerPC/mem_update.ll:1.1 llvm/test/Regression/CodeGen/PowerPC/mem_update.ll:1.2 --- llvm/test/Regression/CodeGen/PowerPC/mem_update.ll:1.1 Tue Nov 7 19:44:35 2006 +++ llvm/test/Regression/CodeGen/PowerPC/mem_update.ll Thu Nov 9 20:04:52 2006 @@ -3,9 +3,40 @@ ; XFAIL: * -int *%test(int *%X, int *%dest) { +int *%test0(int *%X, int *%dest) { %Y = getelementptr int* %X, int 4 %A = load int* %Y store int %A, int* %dest ret int* %Y } + +int *%test1(int *%X, int *%dest) { + %Y = getelementptr int* %X, int 4 + %A = load int* %Y + store int %A, int* %dest + ret int* %Y +} + +short *%test2(short *%X, int *%dest) { + %Y = getelementptr short* %X, int 4 + %A = load short* %Y + %B = cast short %A to int + store int %B, int* %dest + ret short* %Y +} + +ushort *%test3(ushort *%X, int *%dest) { + %Y = getelementptr ushort* %X, int 4 + %A = load ushort* %Y + %B = cast ushort %A to int + store int %B, int* %dest + ret ushort* %Y +} + + +long *%test4(long *%X, long *%dest) { + %Y = getelementptr long* %X, int 4 + %A = load long* %Y + store long %A, long* %dest + ret long* %Y +} From sabre at nondot.org Thu Nov 9 20:08:40 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 9 Nov 2006 20:08:40 -0600 Subject: [llvm-commits] CVS: llvm-test/Makefile.programs Message-ID: <200611100208.kAA28eBM006340@zion.cs.uiuc.edu> Changes in directory llvm-test: Makefile.programs updated: 1.237 -> 1.238 --- Log message: enable preinc for llc-beta. --- Diffs of the changes: (+2 -1) Makefile.programs | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm-test/Makefile.programs diff -u llvm-test/Makefile.programs:1.237 llvm-test/Makefile.programs:1.238 --- llvm-test/Makefile.programs:1.237 Tue Nov 7 11:57:53 2006 +++ llvm-test/Makefile.programs Thu Nov 9 20:08:26 2006 @@ -193,7 +193,8 @@ endif#DISABLE_DIFFS ifeq ($(ARCH),PowerPC) -LLCBETAOPTION := --enable-tail-merge +LLCBETAOPTION := --enable-ppc-preinc +#--enable-tail-merge #-regalloc=local -fast endif ifeq ($(ARCH),Alpha) From sabre at nondot.org Thu Nov 9 20:09:02 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 9 Nov 2006 20:09:02 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp PPCISelLowering.cpp PPCInstrInfo.td Message-ID: <200611100209.kAA2926N006379@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCISelDAGToDAG.cpp updated: 1.215 -> 1.216 PPCISelLowering.cpp updated: 1.221 -> 1.222 PPCInstrInfo.td updated: 1.254 -> 1.255 --- Log message: add an initial cut at preinc loads for ppc32. This is broken for ppc64 (because the 64-bit reg target versions aren't implemented yet), doesn't support r+r addr modes, and doesn't handle stores, but it works otherwise. :) This is disabled unless -enable-ppc-preinc is passed to llc for now. --- Diffs of the changes: (+88 -22) PPCISelDAGToDAG.cpp | 38 ++++++++++++++++++++++++++++++++++++++ PPCISelLowering.cpp | 27 ++++++++++++++------------- PPCInstrInfo.td | 45 ++++++++++++++++++++++++++++++++++++--------- 3 files changed, 88 insertions(+), 22 deletions(-) Index: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp diff -u llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.215 llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.216 --- llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.215 Wed Nov 8 14:33:09 2006 +++ llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Thu Nov 9 20:08:47 2006 @@ -818,6 +818,44 @@ // Other cases are autogenerated. break; } + + case ISD::LOAD: { + // Handle preincrement loads. + LoadSDNode *LD = cast(Op); + MVT::ValueType LoadedVT = LD->getLoadedVT(); + + // Normal loads are handled by code generated from the .td file. + if (LD->getAddressingMode() != ISD::PRE_INC) + break; + + unsigned Opcode; + bool isSExt = LD->getExtensionType() == ISD::SEXTLOAD; + assert(!isSExt || LoadedVT == MVT::i16 && "Invalid sext update load"); + switch (LoadedVT) { + default: assert(0 && "Invalid PPC load type!"); + case MVT::f64: Opcode = PPC::LFDU; break; + case MVT::f32: Opcode = PPC::LFSU; break; + case MVT::i32: Opcode = PPC::LWZU; break; + case MVT::i16: Opcode = isSExt ? PPC::LHAU : PPC::LHZU; break; + case MVT::i8: Opcode = PPC::LBZU; break; + } + + SDOperand Offset = LD->getOffset(); + if (isa(Offset)) { + SDOperand Chain = LD->getChain(); + SDOperand Base = LD->getBasePtr(); + AddToISelQueue(Chain); + AddToISelQueue(Base); + AddToISelQueue(Offset); + SDOperand Ops[] = { Offset, Base, Chain }; + // FIXME: PPC64 + return CurDAG->getTargetNode(Opcode, MVT::i32, MVT::i32, + MVT::Other, Ops, 3); + } else { + assert(0 && "R+R preindex loads not supported yet!"); + } + } + case ISD::AND: { unsigned Imm, Imm2, SH, MB, ME; Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.221 llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.222 --- llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.221 Thu Nov 9 13:11:50 2006 +++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp Thu Nov 9 20:08:47 2006 @@ -26,8 +26,11 @@ #include "llvm/Intrinsics.h" #include "llvm/Support/MathExtras.h" #include "llvm/Target/TargetOptions.h" +#include "llvm/Support/CommandLine.h" using namespace llvm; +static cl::opt EnablePPCPreinc("enable-ppc-preinc"); + PPCTargetLowering::PPCTargetLowering(PPCTargetMachine &TM) : TargetLowering(TM), PPCSubTarget(*TM.getSubtargetImpl()) { @@ -861,29 +864,27 @@ SDOperand &Offset, ISD::MemIndexedMode &AM, SelectionDAG &DAG) { - return false; + // Disabled by default for now. + if (!EnablePPCPreinc) return false; -#if 0 - MVT::ValueType VT; SDOperand Ptr; if (LoadSDNode *LD = dyn_cast(N)) { Ptr = LD->getBasePtr(); - VT = LD->getLoadedVT(); - - // TODO: handle other cases. - if (VT != MVT::i32) return false; } else if (StoreSDNode *ST = dyn_cast(N)) { - Ptr = ST->getBasePtr(); - VT = ST->getStoredVT(); - // TODO: handle other cases. + ST = ST; + //Ptr = ST->getBasePtr(); + //VT = ST->getStoredVT(); + // TODO: handle stores. return false; } else return false; + // TODO: Handle reg+reg. + if (!SelectAddressRegImm(Ptr, Offset, Base, DAG)) + return false; - - return false; -#endif + AM = ISD::PRE_INC; + return true; } //===----------------------------------------------------------------------===// Index: llvm/lib/Target/PowerPC/PPCInstrInfo.td diff -u llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.254 llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.255 --- llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.254 Tue Nov 7 20:13:12 2006 +++ llvm/lib/Target/PowerPC/PPCInstrInfo.td Thu Nov 9 20:08:47 2006 @@ -422,9 +422,44 @@ "lwz $rD, $src", LdStGeneral, [(set GPRC:$rD, (load iaddr:$src))]>; -def LWZU : DForm_1<33, (ops GPRC:$rD, GPRC:$rA_result, i32imm:$disp, GPRC:$rA), +def LFS : DForm_8<48, (ops F4RC:$rD, memri:$src), + "lfs $rD, $src", LdStLFDU, + [(set F4RC:$rD, (load iaddr:$src))]>; +def LFD : DForm_8<50, (ops F8RC:$rD, memri:$src), + "lfd $rD, $src", LdStLFD, + [(set F8RC:$rD, (load iaddr:$src))]>; + +// FIXME: PTRRC for Pointer regs for ppc64. + +// 'Update' load forms. +def LBZU : DForm_1<35, (ops GPRC:$rD, ptr_rc:$rA_result, i32imm:$disp, + ptr_rc:$rA), + "lbzu $rD, $disp($rA)", LdStGeneral, + []>, RegConstraint<"$rA = $rA_result">; + +def LHAU : DForm_1<43, (ops GPRC:$rD, ptr_rc:$rA_result, i32imm:$disp, + ptr_rc:$rA), + "lhau $rD, $disp($rA)", LdStGeneral, + []>, RegConstraint<"$rA = $rA_result">; + +def LHZU : DForm_1<41, (ops GPRC:$rD, ptr_rc:$rA_result, i32imm:$disp, + ptr_rc:$rA), + "lhzu $rD, $disp($rA)", LdStGeneral, + []>, RegConstraint<"$rA = $rA_result">; + +def LWZU : DForm_1<33, (ops GPRC:$rD, ptr_rc:$rA_result, i32imm:$disp, + ptr_rc:$rA), "lwzu $rD, $disp($rA)", LdStGeneral, []>, RegConstraint<"$rA = $rA_result">; + +def LFSU : DForm_8<49, (ops F4RC:$rD, ptr_rc:$rA_result, i32imm:$disp, + ptr_rc:$rA), + "lfs $rD, $disp($rA)", LdStLFDU, + []>, RegConstraint<"$rA = $rA_result">; +def LFDU : DForm_8<51, (ops F8RC:$rD, ptr_rc:$rA_result, i32imm:$disp, + ptr_rc:$rA), + "lfd $rD, $disp($rA)", LdStLFD, + []>, RegConstraint<"$rA = $rA_result">; } @@ -501,14 +536,6 @@ def CMPLWI : DForm_6_ext<10, (ops CRRC:$dst, GPRC:$src1, u16imm:$src2), "cmplwi $dst, $src1, $src2", IntCompare>; } -let isLoad = 1, PPC970_Unit = 2 in { -def LFS : DForm_8<48, (ops F4RC:$rD, memri:$src), - "lfs $rD, $src", LdStLFDU, - [(set F4RC:$rD, (load iaddr:$src))]>; -def LFD : DForm_8<50, (ops F8RC:$rD, memri:$src), - "lfd $rD, $src", LdStLFD, - [(set F8RC:$rD, (load iaddr:$src))]>; -} let isStore = 1, noResults = 1, PPC970_Unit = 2 in { def STFS : DForm_9<52, (ops F4RC:$rS, memri:$dst), "stfs $rS, $dst", LdStUX, From zhousheng00 at gmail.com Thu Nov 9 20:20:41 2006 From: zhousheng00 at gmail.com (Zhou Sheng) Date: Thu, 9 Nov 2006 20:20:41 -0600 Subject: [llvm-commits] CVS: llvm-test/SingleSource/UnitTests/SignlessTypes/shr.c Message-ID: <200611100220.kAA2Kffo006565@zion.cs.uiuc.edu> Changes in directory llvm-test/SingleSource/UnitTests/SignlessTypes: shr.c added (r1.1) --- Log message: Add a test for logical shift right and arithmetic shift right testing. --- Diffs of the changes: (+113 -0) shr.c | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 113 insertions(+) Index: llvm-test/SingleSource/UnitTests/SignlessTypes/shr.c diff -c /dev/null llvm-test/SingleSource/UnitTests/SignlessTypes/shr.c:1.1 *** /dev/null Thu Nov 9 20:20:36 2006 --- llvm-test/SingleSource/UnitTests/SignlessTypes/shr.c Thu Nov 9 20:20:26 2006 *************** *** 0 **** --- 1,113 ---- + /* + * This file is used to test shift right operations in conjunction with + * the Signless Types features. The SHR instruction was replaced with + * LSHR, ASHR instructions. The tests here are aimed at triggering + * InstructionCombining transforms to exercise them and ensure they are + * not altering the computed values. + */ + + #include + + unsigned ShrTest1(unsigned X, unsigned C1, unsigned C2) { + // (ushr X, C1) & C2 == 0 iff (-1 >> C1) & C2 == 0 + return (X >> C1) & C2; + } + + int ShrTest2(int X, unsigned C1, int C2) { + // (ashr X, C1) & C2 -> (lshr X, C1) & C2 if C2 only has low-bit set + return (X >> C1) & C2; + } + + int ShrTest3(int X) { + // -((uint)X >> 31) -> ((int)X >> 31) + return -((unsigned)X >> 31); + } + + unsigned ShrTest4(int X) { + // -((int)X >> 31) -> ((uint)X >> 31) + return -(X >> 31); + } + + unsigned ShrTest5(unsigned X, unsigned C) { + // (X >> C) & AndRHS) -> X >> C if AndRHS == AllOne >> C + unsigned AndRHS = (unsigned)0xFFFFFFFF >> C; + return (X >> C) & AndRHS; + } + + unsigned ShrTest6(int X, unsigned C) { + // (X >>s C) & AndRHS) -> X >> C if AndRHS == AllOne >> C + int AndRHS = (unsigned)0xFFFFFFFF >> C; + return (X >> C) & AndRHS; + } + + int ShrTest7(int X) { + // shr X, 0 == X + return X >> 0; + } + + int ShrTest8(unsigned C) { + // ashr -1, C == -1 + return -1 >> C; + } + + int ShrTest9(int Y, int X, unsigned C) { + // (Y + (X >> C)) << C -> (X + (Y << C) & (~0 << C) + return (Y + (X >> C)) << C; + } + + int ShrTest10(int Y, int X, unsigned C) { + // (Y & (X >> C)) << C -> (X & (Y << C) & (~0 << C) + return (Y & (X >> C)) << C; + } + + int ShrTest11(int Y, int X, unsigned C) { + // (Y | (X >> C)) << C -> (X | (Y << C) & (~0 << C) + return (Y | (X >> C)) << C; + } + + int ShrTest12(int Y, int X, unsigned C, int CC) { + // (Y + ((X >> C) & CC)) << C -> ((X & (CC << C)) + (Y << C)) + return (Y + ((X >> C) & CC)) << C; + } + + int ShrTest13(int Y, int X, unsigned C, int CC) { + // (Y & ((X >> C) & CC)) << C -> ((X & (CC << C)) & (Y << C)) + return (Y & ((X >> C) & CC)) << C; + } + + int ShrTest14(int Y, int X, unsigned C, int CC) { + // (Y | ((X >> C) & CC)) << C -> ((X & (CC << C)) | (Y << C)) + return (Y | ((X >> C) & CC)) << C; + } + + unsigned ShrTest15(unsigned A, unsigned C1, unsigned C2) { + // (A << C1) >> C2 -> (A & (0xFFFFFFFF >>u C2)) << |C1-C2| + return (A << C1) >> C2; + } + + int ShrTest16(int X, unsigned C1, unsigned C2) { + // (X >>s C1) << C2 where C1 > C2 -> (X >>s (C1-C2)) & mask + // mask = X & (0xFFFFFFFF << C2) + return (X >> C1) << C2; + } + + int main(int argc, char **argv) { + printf("ShrTest1(-1, 11, 0xFF000000) = %d\n", + ShrTest1(0xFFFFFFFF, 11, 0xFF000000)); + printf("ShrTest2(-73, 11, 1) = %d\n", ShrTest2(-73, 11, 1)); + printf("ShrTest3(-73) = %d\n", ShrTest3(-73)); + printf("ShrTest4(-73) = %d\n", ShrTest4(-73)); + printf("ShrTest5(7773, 11) = %d\n", ShrTest5(7773, 11)); + printf("ShrTest6(-73, 11) = %d\n", ShrTest6(-73, 11)); + printf("ShrTest7(-737) = %d\n", ShrTest7(-737)); + printf("ShrTest8(73) = %d\n", ShrTest8(73)); + printf("ShrTest9(13, 7773, 11) = %d\n", ShrTest9(13, 7773, 11)); + printf("ShrTest10(13, 7773, 11) = %d\n", ShrTest10(13, 7773, 11)); + printf("ShrTest11(13, 7773, 11) = %d\n", ShrTest11(13, 7773, 11)); + printf("ShrTest12(7773, -73, 11, 3773) = %d\n", ShrTest12(7773, -73, 11, 3773)); + printf("ShrTest13(7773, -73, 11, 3773) = %d\n", ShrTest13(7773, -73, 11, 3773)); + printf("ShrTest14(7773, -73, 11, 3773) = %d\n", ShrTest14(7773, -73, 11, 3773)); + printf("ShrTest15(7773, 13, 11) = %d\n", ShrTest15(7773, 13, 11)); + printf("ShrTest16(-73, 11, 13) = %d\n", ShrTest16(-73, 11, 13)); + return 0; + } From tonic at nondot.org Thu Nov 9 22:05:26 2006 From: tonic at nondot.org (Tanya Lattner) Date: Thu, 9 Nov 2006 22:05:26 -0600 Subject: [llvm-commits] [release_19] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200611100405.kAA45QeY008235@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.287 -> 1.287.2.1 --- Log message: Merging from mainline --- Diffs of the changes: (+23 -7) X86ISelLowering.cpp | 30 +++++++++++++++++++++++------- 1 files changed, 23 insertions(+), 7 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.287 llvm/lib/Target/X86/X86ISelLowering.cpp:1.287.2.1 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.287 Thu Nov 2 14:25:49 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Thu Nov 9 22:05:13 2006 @@ -516,10 +516,9 @@ BytesToPopOnReturn = 0; // Callee pops nothing. BytesCallerReserves = ArgOffset; - // If this is a struct return on Darwin/X86, the callee pops the hidden struct - // pointer. - if (MF.getFunction()->getCallingConv() == CallingConv::CSRet && - Subtarget->isTargetDarwin()) + // If this is a struct return on, the callee pops the hidden struct + // pointer. This is common for Darwin/X86, Linux & Mingw32 targets. + if (MF.getFunction()->getCallingConv() == CallingConv::CSRet) BytesToPopOnReturn = 4; // Return the new list of results. @@ -680,9 +679,10 @@ // Create the CALLSEQ_END node. unsigned NumBytesForCalleeToPush = 0; - // If this is is a call to a struct-return function on Darwin/X86, the callee + // If this is is a call to a struct-return function, the callee // pops the hidden struct pointer, so we have to push it back. - if (CallingConv == CallingConv::CSRet && Subtarget->isTargetDarwin()) + // This is common for Darwin/X86, Linux & Mingw32 targets. + if (CallingConv == CallingConv::CSRet) NumBytesForCalleeToPush = 4; NodeTys.clear(); @@ -2582,6 +2582,22 @@ isUndefOrEqual(N->getOperand(3), 3); } +/// isMOVHLPS_v_undef_Mask - Special case of isMOVHLPSMask for canonical form +/// of vector_shuffle v, v, <2, 3, 2, 3>, i.e. vector_shuffle v, undef, +/// <2, 3, 2, 3> +bool X86::isMOVHLPS_v_undef_Mask(SDNode *N) { + assert(N->getOpcode() == ISD::BUILD_VECTOR); + + if (N->getNumOperands() != 4) + return false; + + // Expect bit0 == 2, bit1 == 3, bit2 == 2, bit3 == 3 + return isUndefOrEqual(N->getOperand(0), 2) && + isUndefOrEqual(N->getOperand(1), 3) && + isUndefOrEqual(N->getOperand(2), 2) && + isUndefOrEqual(N->getOperand(3), 3); +} + /// isMOVLPMask - Return true if the specified VECTOR_SHUFFLE operand /// specifies a shuffle of elements that is suitable for input to MOVLP{S|D}. bool X86::isMOVLPMask(SDNode *N) { @@ -3724,7 +3740,7 @@ SDOperand Mask = DAG.getNode(ISD::BUILD_VECTOR, MaskVT, &IdxVec[0], IdxVec.size()); Vec = DAG.getNode(ISD::VECTOR_SHUFFLE, Vec.getValueType(), - Vec, Vec, Mask); + Vec, DAG.getNode(ISD::UNDEF, Vec.getValueType()), Mask); return DAG.getNode(ISD::EXTRACT_VECTOR_ELT, VT, Vec, DAG.getConstant(0, getPointerTy())); } else if (MVT::getSizeInBits(VT) == 64) { From tonic at nondot.org Thu Nov 9 22:07:12 2006 From: tonic at nondot.org (Tanya Lattner) Date: Thu, 9 Nov 2006 22:07:12 -0600 Subject: [llvm-commits] [release_19] CVS: llvm/test/Regression/CodeGen/X86/2006-11-12-CSRetCC.ll Message-ID: <200611100407.kAA47CxV008275@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/X86: 2006-11-12-CSRetCC.ll added (r1.1.2.2) --- Log message: Merging from mainline --- Diffs of the changes: (+60 -0) 2006-11-12-CSRetCC.ll | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 60 insertions(+) Index: llvm/test/Regression/CodeGen/X86/2006-11-12-CSRetCC.ll diff -c /dev/null llvm/test/Regression/CodeGen/X86/2006-11-12-CSRetCC.ll:1.1.2.2 *** /dev/null Thu Nov 9 22:07:09 2006 --- llvm/test/Regression/CodeGen/X86/2006-11-12-CSRetCC.ll Thu Nov 9 22:06:59 2006 *************** *** 0 **** --- 1,60 ---- + ; RUN: llvm-as < %s | llc -march=x86 | grep 'subl $4, %esp' + + %str = internal constant [9 x sbyte] c"%f+%f*i\0A\00" ; <[9 x sbyte]*> [#uses=1] + + implementation ; Functions: + + int %main() { + entry: + %retval = alloca int, align 4 ; [#uses=1] + %tmp = alloca { double, double }, align 16 ; <{ double, double }*> [#uses=4] + %tmp1 = alloca { double, double }, align 16 ; <{ double, double }*> [#uses=4] + %tmp2 = alloca { double, double }, align 16 ; <{ double, double }*> [#uses=3] + %pi = alloca double, align 8 ; [#uses=2] + %z = alloca { double, double }, align 16 ; <{ double, double }*> [#uses=4] + "alloca point" = cast int 0 to int ; [#uses=0] + store double 0x400921FB54442D18, double* %pi + %tmp = load double* %pi ; [#uses=1] + %real = getelementptr { double, double }* %tmp1, uint 0, uint 0 ; [#uses=1] + store double 0.000000e+00, double* %real + %real3 = getelementptr { double, double }* %tmp1, uint 0, uint 1 ; [#uses=1] + store double %tmp, double* %real3 + %tmp = getelementptr { double, double }* %tmp, uint 0, uint 0 ; [#uses=1] + %tmp4 = getelementptr { double, double }* %tmp1, uint 0, uint 0 ; [#uses=1] + %tmp5 = load double* %tmp4 ; [#uses=1] + store double %tmp5, double* %tmp + %tmp6 = getelementptr { double, double }* %tmp, uint 0, uint 1 ; [#uses=1] + %tmp7 = getelementptr { double, double }* %tmp1, uint 0, uint 1 ; [#uses=1] + %tmp8 = load double* %tmp7 ; [#uses=1] + store double %tmp8, double* %tmp6 + %tmp = cast { double, double }* %tmp to { long, long }* ; <{ long, long }*> [#uses=1] + %tmp = getelementptr { long, long }* %tmp, uint 0, uint 0 ; [#uses=1] + %tmp = load long* %tmp ; [#uses=1] + %tmp9 = cast { double, double }* %tmp to { long, long }* ; <{ long, long }*> [#uses=1] + %tmp10 = getelementptr { long, long }* %tmp9, uint 0, uint 1 ; [#uses=1] + %tmp11 = load long* %tmp10 ; [#uses=1] + call csretcc void %cexp( { double, double }* %tmp2, long %tmp, long %tmp11 ) + %tmp12 = getelementptr { double, double }* %z, uint 0, uint 0 ; [#uses=1] + %tmp13 = getelementptr { double, double }* %tmp2, uint 0, uint 0 ; [#uses=1] + %tmp14 = load double* %tmp13 ; [#uses=1] + store double %tmp14, double* %tmp12 + %tmp15 = getelementptr { double, double }* %z, uint 0, uint 1 ; [#uses=1] + %tmp16 = getelementptr { double, double }* %tmp2, uint 0, uint 1 ; [#uses=1] + %tmp17 = load double* %tmp16 ; [#uses=1] + store double %tmp17, double* %tmp15 + %tmp18 = getelementptr { double, double }* %z, uint 0, uint 1 ; [#uses=1] + %tmp19 = load double* %tmp18 ; [#uses=1] + %tmp20 = getelementptr { double, double }* %z, uint 0, uint 0 ; [#uses=1] + %tmp21 = load double* %tmp20 ; [#uses=1] + %tmp = getelementptr [9 x sbyte]* %str, int 0, uint 0 ; [#uses=1] + %tmp = call int (sbyte*, ...)* %printf( sbyte* %tmp, double %tmp21, double %tmp19 ) ; [#uses=0] + br label %return + + return: ; preds = %entry + %retval = load int* %retval ; [#uses=1] + ret int %retval + } + + declare csretcc void %cexp({ double, double }*, long, long) + + declare int %printf(sbyte*, ...) From tbrethou at cs.uiuc.edu Thu Nov 9 22:17:47 2006 From: tbrethou at cs.uiuc.edu (Tanya Lattner) Date: Thu, 9 Nov 2006 22:17:47 -0600 Subject: [llvm-commits] [release_19] CVS: llvm/test/Regression/CodeGen/X86/2006-11-12-CSRetCC.ll Message-ID: <200611100417.kAA4Hlrk009826@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/X86: 2006-11-12-CSRetCC.ll (r1.1.2.2) removed --- Log message: Removing from release --- Diffs of the changes: (+0 -0) 0 files changed From tonic at nondot.org Thu Nov 9 22:27:33 2006 From: tonic at nondot.org (Tanya Lattner) Date: Thu, 9 Nov 2006 22:27:33 -0600 Subject: [llvm-commits] [release_19] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200611100427.kAA4RXdN010743@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.287.2.1 -> 1.287.2.2 --- Log message: Reverting patch --- Diffs of the changes: (+7 -23) X86ISelLowering.cpp | 30 +++++++----------------------- 1 files changed, 7 insertions(+), 23 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.287.2.1 llvm/lib/Target/X86/X86ISelLowering.cpp:1.287.2.2 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.287.2.1 Thu Nov 9 22:05:13 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Thu Nov 9 22:27:20 2006 @@ -516,9 +516,10 @@ BytesToPopOnReturn = 0; // Callee pops nothing. BytesCallerReserves = ArgOffset; - // If this is a struct return on, the callee pops the hidden struct - // pointer. This is common for Darwin/X86, Linux & Mingw32 targets. - if (MF.getFunction()->getCallingConv() == CallingConv::CSRet) + // If this is a struct return on Darwin/X86, the callee pops the hidden struct + // pointer. + if (MF.getFunction()->getCallingConv() == CallingConv::CSRet && + Subtarget->isTargetDarwin()) BytesToPopOnReturn = 4; // Return the new list of results. @@ -679,10 +680,9 @@ // Create the CALLSEQ_END node. unsigned NumBytesForCalleeToPush = 0; - // If this is is a call to a struct-return function, the callee + // If this is is a call to a struct-return function on Darwin/X86, the callee // pops the hidden struct pointer, so we have to push it back. - // This is common for Darwin/X86, Linux & Mingw32 targets. - if (CallingConv == CallingConv::CSRet) + if (CallingConv == CallingConv::CSRet && Subtarget->isTargetDarwin()) NumBytesForCalleeToPush = 4; NodeTys.clear(); @@ -2582,22 +2582,6 @@ isUndefOrEqual(N->getOperand(3), 3); } -/// isMOVHLPS_v_undef_Mask - Special case of isMOVHLPSMask for canonical form -/// of vector_shuffle v, v, <2, 3, 2, 3>, i.e. vector_shuffle v, undef, -/// <2, 3, 2, 3> -bool X86::isMOVHLPS_v_undef_Mask(SDNode *N) { - assert(N->getOpcode() == ISD::BUILD_VECTOR); - - if (N->getNumOperands() != 4) - return false; - - // Expect bit0 == 2, bit1 == 3, bit2 == 2, bit3 == 3 - return isUndefOrEqual(N->getOperand(0), 2) && - isUndefOrEqual(N->getOperand(1), 3) && - isUndefOrEqual(N->getOperand(2), 2) && - isUndefOrEqual(N->getOperand(3), 3); -} - /// isMOVLPMask - Return true if the specified VECTOR_SHUFFLE operand /// specifies a shuffle of elements that is suitable for input to MOVLP{S|D}. bool X86::isMOVLPMask(SDNode *N) { @@ -3740,7 +3724,7 @@ SDOperand Mask = DAG.getNode(ISD::BUILD_VECTOR, MaskVT, &IdxVec[0], IdxVec.size()); Vec = DAG.getNode(ISD::VECTOR_SHUFFLE, Vec.getValueType(), - Vec, DAG.getNode(ISD::UNDEF, Vec.getValueType()), Mask); + Vec, Vec, Mask); return DAG.getNode(ISD::EXTRACT_VECTOR_ELT, VT, Vec, DAG.getConstant(0, getPointerTy())); } else if (MVT::getSizeInBits(VT) == 64) { From tonic at nondot.org Thu Nov 9 22:28:48 2006 From: tonic at nondot.org (Tanya Lattner) Date: Thu, 9 Nov 2006 22:28:48 -0600 Subject: [llvm-commits] [release_19] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp Message-ID: <200611100428.kAA4SmYW010777@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.287.2.2 -> 1.287.2.3 --- Log message: Merging from mainline --- Diffs of the changes: (+6 -6) X86ISelLowering.cpp | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.287.2.2 llvm/lib/Target/X86/X86ISelLowering.cpp:1.287.2.3 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.287.2.2 Thu Nov 9 22:27:20 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Thu Nov 9 22:28:35 2006 @@ -516,10 +516,9 @@ BytesToPopOnReturn = 0; // Callee pops nothing. BytesCallerReserves = ArgOffset; - // If this is a struct return on Darwin/X86, the callee pops the hidden struct - // pointer. - if (MF.getFunction()->getCallingConv() == CallingConv::CSRet && - Subtarget->isTargetDarwin()) + // If this is a struct return on, the callee pops the hidden struct + // pointer. This is common for Darwin/X86, Linux & Mingw32 targets. + if (MF.getFunction()->getCallingConv() == CallingConv::CSRet) BytesToPopOnReturn = 4; // Return the new list of results. @@ -680,9 +679,10 @@ // Create the CALLSEQ_END node. unsigned NumBytesForCalleeToPush = 0; - // If this is is a call to a struct-return function on Darwin/X86, the callee + // If this is is a call to a struct-return function, the callee // pops the hidden struct pointer, so we have to push it back. - if (CallingConv == CallingConv::CSRet && Subtarget->isTargetDarwin()) + // This is common for Darwin/X86, Linux & Mingw32 targets. + if (CallingConv == CallingConv::CSRet) NumBytesForCalleeToPush = 4; NodeTys.clear(); From sabre at nondot.org Thu Nov 9 22:41:51 2006 From: sabre at nondot.org (Chris Lattner) Date: Thu, 9 Nov 2006 22:41:51 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Message-ID: <200611100441.kAA4fpZg019449@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: SelectionDAGISel.cpp updated: 1.316 -> 1.317 --- Log message: commentate --- Diffs of the changes: (+2 -0) SelectionDAGISel.cpp | 2 ++ 1 files changed, 2 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.316 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.317 --- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.316 Wed Nov 8 00:47:33 2006 +++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Thu Nov 9 22:41:34 2006 @@ -458,6 +458,8 @@ void visit(Instruction &I) { visit(I.getOpcode(), I); } void visit(unsigned Opcode, User &I) { + // Note: this doesn't use InstVisitor, because it has to work with + // ConstantExpr's in addition to instructions. switch (Opcode) { default: assert(0 && "Unknown instruction type encountered!"); abort(); From tonic at nondot.org Thu Nov 9 22:52:51 2006 From: tonic at nondot.org (Tanya Lattner) Date: Thu, 9 Nov 2006 22:52:51 -0600 Subject: [llvm-commits] [release_19] CVS: llvm/test/Regression/CFrontend/2006-07-31-PR854.c Message-ID: <200611100452.kAA4qpvr025716@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CFrontend: 2006-07-31-PR854.c updated: 1.3 -> 1.3.4.1 --- Log message: xfail for llvm-gcc3 --- Diffs of the changes: (+1 -0) 2006-07-31-PR854.c | 1 + 1 files changed, 1 insertion(+) Index: llvm/test/Regression/CFrontend/2006-07-31-PR854.c diff -u llvm/test/Regression/CFrontend/2006-07-31-PR854.c:1.3 llvm/test/Regression/CFrontend/2006-07-31-PR854.c:1.3.4.1 --- llvm/test/Regression/CFrontend/2006-07-31-PR854.c:1.3 Fri Aug 4 13:09:27 2006 +++ llvm/test/Regression/CFrontend/2006-07-31-PR854.c Thu Nov 9 22:52:37 2006 @@ -1,5 +1,6 @@ // RUN: %llvmgcc %s -S -o - // PR854 +// XFAIL: llvmgcc3 struct kernel_symbol { unsigned long value; }; From tonic at nondot.org Thu Nov 9 22:54:03 2006 From: tonic at nondot.org (Tanya Lattner) Date: Thu, 9 Nov 2006 22:54:03 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CFrontend/2006-07-31-PR854.c Message-ID: <200611100454.kAA4s3ka026802@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CFrontend: 2006-07-31-PR854.c updated: 1.3 -> 1.4 --- Log message: xfail for llvmgcc3 --- Diffs of the changes: (+1 -0) 2006-07-31-PR854.c | 1 + 1 files changed, 1 insertion(+) Index: llvm/test/Regression/CFrontend/2006-07-31-PR854.c diff -u llvm/test/Regression/CFrontend/2006-07-31-PR854.c:1.3 llvm/test/Regression/CFrontend/2006-07-31-PR854.c:1.4 --- llvm/test/Regression/CFrontend/2006-07-31-PR854.c:1.3 Fri Aug 4 13:09:27 2006 +++ llvm/test/Regression/CFrontend/2006-07-31-PR854.c Thu Nov 9 22:53:50 2006 @@ -1,5 +1,6 @@ // RUN: %llvmgcc %s -S -o - // PR854 +// XFAIL: llvmgcc3 struct kernel_symbol { unsigned long value; }; From asl at math.spbu.ru Fri Nov 10 01:00:15 2006 From: asl at math.spbu.ru (Anton Korobeynikov) Date: Fri, 10 Nov 2006 01:00:15 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/X86/2006-11-12-CSRetCC.ll Message-ID: <200611100700.kAA70FlJ023392@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/X86: 2006-11-12-CSRetCC.ll updated: 1.1 -> 1.2 --- Log message: Adding target triple to test --- Diffs of the changes: (+2 -0) 2006-11-12-CSRetCC.ll | 2 ++ 1 files changed, 2 insertions(+) Index: llvm/test/Regression/CodeGen/X86/2006-11-12-CSRetCC.ll diff -u llvm/test/Regression/CodeGen/X86/2006-11-12-CSRetCC.ll:1.1 llvm/test/Regression/CodeGen/X86/2006-11-12-CSRetCC.ll:1.2 --- llvm/test/Regression/CodeGen/X86/2006-11-12-CSRetCC.ll:1.1 Thu Nov 9 18:48:12 2006 +++ llvm/test/Regression/CodeGen/X86/2006-11-12-CSRetCC.ll Fri Nov 10 00:59:53 2006 @@ -1,5 +1,7 @@ ; RUN: llvm-as < %s | llc -march=x86 | grep 'subl $4, %esp' +target triple = "i686-pc-linux-gnu" + %str = internal constant [9 x sbyte] c"%f+%f*i\0A\00" ; <[9 x sbyte]*> [#uses=1] implementation ; Functions: From evan.cheng at apple.com Fri Nov 10 02:28:44 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 10 Nov 2006 02:28:44 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200611100828.kAA8SiKi008586@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.247 -> 1.248 --- Log message: When forming a pre-indexed store, make sure ptr isn't the same or is a pred of value being stored. It would cause a cycle. --- Diffs of the changes: (+16 -7) DAGCombiner.cpp | 23 ++++++++++++++++------- 1 files changed, 16 insertions(+), 7 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.247 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.248 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.247 Thu Nov 9 13:10:46 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Fri Nov 10 02:28:11 2006 @@ -214,11 +214,20 @@ ISD::MemIndexedMode AM = ISD::UNINDEXED; if (TLI.getPreIndexedAddressParts(N, BasePtr, Offset, AM, DAG)) { // Try turning it into a pre-indexed load / store except when - // 1) Another use of base ptr is a predecessor of N. If ptr is folded + // 1) If N is a store and the ptr is either the same as or is a + // predecessor of the value being stored. + // 2) Another use of base ptr is a predecessor of N. If ptr is folded // that would create a cycle. - // 2) All uses are load / store ops that use it as base ptr. + // 3) All uses are load / store ops that use it as base ptr. - // Now check for #1 and #2. + // Checking #1. + if (!isLoad) { + SDOperand Val = cast(N)->getValue(); + if (Val == Ptr || Ptr.Val->isPredecessor(Val.Val)) + return false; + } + + // Now check for #2 and #3. bool RealUse = false; for (SDNode::use_iterator I = Ptr.Val->use_begin(), E = Ptr.Val->use_end(); I != E; ++I) { @@ -323,12 +332,12 @@ continue; // Try turning it into a post-indexed load / store except when - // 1) Op must be independent of N, i.e. Op is neither a predecessor + // 1) All uses are load / store ops that use it as base ptr. + // 2) Op must be independent of N, i.e. Op is neither a predecessor // nor a successor of N. Otherwise, if Op is folded that would // create a cycle. - // 2) All uses are load / store ops that use it as base ptr. - // Check for #3. + // Check for #1. bool TryNext = false; for (SDNode::use_iterator II = BasePtr.Val->use_begin(), EE = BasePtr.Val->use_end(); II != EE; ++II) { @@ -359,7 +368,7 @@ if (TryNext) continue; - // Check for #1 + // Check for #2 if (!Op->isPredecessor(N) && !N->isPredecessor(Op)) { SDOperand Result = isLoad ? DAG.getIndexedLoad(SDOperand(N,0), BasePtr, Offset, AM) From evan.cheng at apple.com Fri Nov 10 02:32:59 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 10 Nov 2006 02:32:59 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineInstr.h MachineInstrBuilder.h Message-ID: <200611100832.kAA8WxAa008805@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineInstr.h updated: 1.192 -> 1.193 MachineInstrBuilder.h updated: 1.37 -> 1.38 --- Log message: Add implicit def / use operands to MachineInstr. --- Diffs of the changes: (+20 -6) MachineInstr.h | 21 +++++++++++++++++---- MachineInstrBuilder.h | 5 +++-- 2 files changed, 20 insertions(+), 6 deletions(-) Index: llvm/include/llvm/CodeGen/MachineInstr.h diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.192 llvm/include/llvm/CodeGen/MachineInstr.h:1.193 --- llvm/include/llvm/CodeGen/MachineInstr.h:1.192 Sat Oct 28 13:18:36 2006 +++ llvm/include/llvm/CodeGen/MachineInstr.h Fri Nov 10 02:32:14 2006 @@ -60,6 +60,7 @@ MachineOperandType opType:8; // Discriminate the union. bool IsDef : 1; // True if this is a def, false if this is a use. + bool IsImp : 1; // True if this is an implicit def or use. /// offset - Offset to address of global or external, only valid for /// MO_GlobalAddress, MO_ExternalSym and MO_ConstantPoolIndex @@ -78,6 +79,7 @@ Op.opType = MachineOperand::MO_Immediate; Op.contents.immedVal = Val; Op.IsDef = false; + Op.IsImp = false; Op.offset = 0; return Op; } @@ -85,6 +87,7 @@ const MachineOperand &operator=(const MachineOperand &MO) { contents = MO.contents; IsDef = MO.IsDef; + IsImp = MO.IsImp; opType = MO.opType; offset = MO.offset; return *this; @@ -173,6 +176,15 @@ IsDef = true; } + bool isImplicit() const { + assert(isRegister() && "Wrong MachineOperand accessor"); + return IsImp; + } + bool setImplicit() { + assert(isRegister() && "Wrong MachineOperand accessor"); + IsImp = true; + } + /// getReg - Returns the register number. /// unsigned getReg() const { @@ -330,10 +342,11 @@ /// addRegOperand - Add a register operand. /// - void addRegOperand(unsigned Reg, bool IsDef) { - MachineOperand &Op = AddNewOperand(); + void addRegOperand(unsigned Reg, bool IsDef, bool IsImp = false) { + MachineOperand &Op = AddNewOperand(IsImp); Op.opType = MachineOperand::MO_Register; Op.IsDef = IsDef; + Op.IsImp = IsImp; Op.contents.RegNo = Reg; Op.offset = 0; } @@ -415,8 +428,8 @@ Operands.erase(Operands.begin()+i); } private: - MachineOperand &AddNewOperand() { - assert(!OperandsComplete() && + MachineOperand &AddNewOperand(bool IsImp = false) { + assert((IsImp || !OperandsComplete()) && "Trying to add an operand to a machine instr that is already done!"); Operands.push_back(MachineOperand()); return Operands.back(); Index: llvm/include/llvm/CodeGen/MachineInstrBuilder.h diff -u llvm/include/llvm/CodeGen/MachineInstrBuilder.h:1.37 llvm/include/llvm/CodeGen/MachineInstrBuilder.h:1.38 --- llvm/include/llvm/CodeGen/MachineInstrBuilder.h:1.37 Mon Sep 4 21:31:13 2006 +++ llvm/include/llvm/CodeGen/MachineInstrBuilder.h Fri Nov 10 02:32:14 2006 @@ -33,8 +33,9 @@ /// addReg - Add a new virtual register operand... /// - const MachineInstrBuilder &addReg(int RegNo, bool isDef = false) const { - MI->addRegOperand(RegNo, isDef); + const MachineInstrBuilder &addReg(int RegNo, bool isDef = false, + bool isImp = false) const { + MI->addRegOperand(RegNo, isDef, isImp); return *this; } From evan.cheng at apple.com Fri Nov 10 02:38:36 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 10 Nov 2006 02:38:36 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp Message-ID: <200611100838.kAA8calf009012@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: ScheduleDAG.cpp updated: 1.106 -> 1.107 --- Log message: Add implicit def / use operands to MachineInstr. --- Diffs of the changes: (+12 -0) ScheduleDAG.cpp | 12 ++++++++++++ 1 files changed, 12 insertions(+) Index: llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.106 llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.107 --- llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.106 Sat Nov 4 03:44:31 2006 +++ llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp Fri Nov 10 02:38:20 2006 @@ -441,6 +441,18 @@ } } + // Emit implicit def / use operands. + if (II.ImplicitDefs) { + for (const unsigned *ImplicitDefs = II.ImplicitDefs; + *ImplicitDefs; ++ImplicitDefs) + MI->addRegOperand(*ImplicitDefs, true, true); + } + if (II.ImplicitUses) { + for (const unsigned *ImplicitUses = II.ImplicitUses; + *ImplicitUses; ++ImplicitUses) + MI->addRegOperand(*ImplicitUses, false, true); + } + // Now that we have emitted all operands, emit this instruction itself. if ((II.Flags & M_USES_CUSTOM_DAG_SCHED_INSERTION) == 0) { BB->insert(BB->end(), MI); From evan.cheng at apple.com Fri Nov 10 02:38:36 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 10 Nov 2006 02:38:36 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp LiveVariables.cpp MachineInstr.cpp RegAllocLocal.cpp Message-ID: <200611100838.kAA8caEG009015@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: LiveIntervalAnalysis.cpp updated: 1.193 -> 1.194 LiveVariables.cpp updated: 1.61 -> 1.62 MachineInstr.cpp updated: 1.127 -> 1.128 RegAllocLocal.cpp updated: 1.93 -> 1.94 --- Log message: Add implicit def / use operands to MachineInstr. --- Diffs of the changes: (+11 -29) LiveIntervalAnalysis.cpp | 9 +-------- LiveVariables.cpp | 19 ++----------------- MachineInstr.cpp | 8 ++++++-- RegAllocLocal.cpp | 4 ++-- 4 files changed, 11 insertions(+), 29 deletions(-) Index: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp diff -u llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.193 llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.194 --- llvm/lib/CodeGen/LiveIntervalAnalysis.cpp:1.193 Wed Nov 8 13:16:43 2006 +++ llvm/lib/CodeGen/LiveIntervalAnalysis.cpp Fri Nov 10 02:38:19 2006 @@ -658,16 +658,9 @@ } for (; MI != miEnd; ++MI) { - const TargetInstrDescriptor &TID = tii_->get(MI->getOpcode()); DEBUG(std::cerr << MIIndex << "\t" << *MI); - - // Handle implicit defs. - if (TID.ImplicitDefs) { - for (const unsigned *ImpDef = TID.ImplicitDefs; *ImpDef; ++ImpDef) - handleRegisterDef(MBB, MI, MIIndex, *ImpDef); - } - // Handle explicit defs. + // Handle defs. for (int i = MI->getNumOperands() - 1; i >= 0; --i) { MachineOperand &MO = MI->getOperand(i); // handle register defs - build intervals Index: llvm/lib/CodeGen/LiveVariables.cpp diff -u llvm/lib/CodeGen/LiveVariables.cpp:1.61 llvm/lib/CodeGen/LiveVariables.cpp:1.62 --- llvm/lib/CodeGen/LiveVariables.cpp:1.61 Thu Nov 2 14:25:49 2006 +++ llvm/lib/CodeGen/LiveVariables.cpp Fri Nov 10 02:38:19 2006 @@ -228,7 +228,6 @@ for (MachineBasicBlock::iterator I = MBB->begin(), E = MBB->end(); I != E; ++I) { MachineInstr *MI = I; - const TargetInstrDescriptor &MID = TII.get(MI->getOpcode()); // Process all of the operands of the instruction... unsigned NumOperandsToProcess = MI->getNumOperands(); @@ -238,14 +237,7 @@ if (MI->getOpcode() == TargetInstrInfo::PHI) NumOperandsToProcess = 1; - // Loop over implicit uses, using them. - if (MID.ImplicitUses) { - for (const unsigned *ImplicitUses = MID.ImplicitUses; - *ImplicitUses; ++ImplicitUses) - HandlePhysRegUse(*ImplicitUses, MI); - } - - // Process all explicit uses... + // Process all uses... for (unsigned i = 0; i != NumOperandsToProcess; ++i) { MachineOperand &MO = MI->getOperand(i); if (MO.isRegister() && MO.isUse() && MO.getReg()) { @@ -258,14 +250,7 @@ } } - // Loop over implicit defs, defining them. - if (MID.ImplicitDefs) { - for (const unsigned *ImplicitDefs = MID.ImplicitDefs; - *ImplicitDefs; ++ImplicitDefs) - HandlePhysRegDef(*ImplicitDefs, MI); - } - - // Process all explicit defs... + // Process all defs... for (unsigned i = 0; i != NumOperandsToProcess; ++i) { MachineOperand &MO = MI->getOperand(i); if (MO.isRegister() && MO.isDef() && MO.getReg()) { Index: llvm/lib/CodeGen/MachineInstr.cpp diff -u llvm/lib/CodeGen/MachineInstr.cpp:1.127 llvm/lib/CodeGen/MachineInstr.cpp:1.128 --- llvm/lib/CodeGen/MachineInstr.cpp:1.127 Wed Oct 25 13:08:14 2006 +++ llvm/lib/CodeGen/MachineInstr.cpp Fri Nov 10 02:38:19 2006 @@ -205,8 +205,12 @@ OS << " "; ::print(mop, OS, TM); - if (mop.isReg() && mop.isDef()) - OS << ""; + if (mop.isReg()) { + if (mop.isImplicit()) + OS << (mop.isDef() ? "" : ""); + else if (mop.isDef()) + OS << ""; + } } OS << "\n"; Index: llvm/lib/CodeGen/RegAllocLocal.cpp diff -u llvm/lib/CodeGen/RegAllocLocal.cpp:1.93 llvm/lib/CodeGen/RegAllocLocal.cpp:1.94 --- llvm/lib/CodeGen/RegAllocLocal.cpp:1.93 Tue Sep 19 13:02:01 2006 +++ llvm/lib/CodeGen/RegAllocLocal.cpp Fri Nov 10 02:38:19 2006 @@ -561,7 +561,7 @@ for (unsigned i = 0; i != MI->getNumOperands(); ++i) { MachineOperand& MO = MI->getOperand(i); // here we are looking for only used operands (never def&use) - if (MO.isRegister() && !MO.isDef() && MO.getReg() && + if (MO.isRegister() && !MO.isDef() && !MO.isImplicit() && MO.getReg() && MRegisterInfo::isVirtualRegister(MO.getReg())) MI = reloadVirtReg(MBB, MI, i); } @@ -596,7 +596,7 @@ // are defined, and marking explicit destinations in the PhysRegsUsed map. for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) { MachineOperand& MO = MI->getOperand(i); - if (MO.isRegister() && MO.isDef() && MO.getReg() && + if (MO.isRegister() && MO.isDef() && !MO.isImplicit() && MO.getReg() && MRegisterInfo::isPhysicalRegister(MO.getReg())) { unsigned Reg = MO.getReg(); if (PhysRegsUsed[Reg] == -2) continue; // Something like ESP. From evan.cheng at apple.com Fri Nov 10 02:43:31 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 10 Nov 2006 02:43:31 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86RegisterInfo.cpp Message-ID: <200611100843.kAA8hVGj009203@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86RegisterInfo.cpp updated: 1.174 -> 1.175 --- Log message: Add implicit def / use operands to MachineInstr. --- Diffs of the changes: (+1 -1) X86RegisterInfo.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/X86/X86RegisterInfo.cpp diff -u llvm/lib/Target/X86/X86RegisterInfo.cpp:1.174 llvm/lib/Target/X86/X86RegisterInfo.cpp:1.175 --- llvm/lib/Target/X86/X86RegisterInfo.cpp:1.174 Thu Nov 9 19:28:43 2006 +++ llvm/lib/Target/X86/X86RegisterInfo.cpp Fri Nov 10 02:43:01 2006 @@ -196,7 +196,7 @@ assert(MO.isReg() && "Expected to fold into reg operand!"); MIB = addFrameReference(MIB, FrameIndex); } else if (MO.isReg()) - MIB = MIB.addReg(MO.getReg(), MO.isDef()); + MIB = MIB.addReg(MO.getReg(), MO.isDef(), MO.isImplicit()); else if (MO.isImm()) MIB = MIB.addImm(MO.getImm()); else if (MO.isGlobalAddress()) From evan.cheng at apple.com Fri Nov 10 03:13:51 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 10 Nov 2006 03:13:51 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86RegisterInfo.cpp Message-ID: <200611100913.kAA9Dpg5010018@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86RegisterInfo.cpp updated: 1.175 -> 1.176 --- Log message: Fix a potential bug. --- Diffs of the changes: (+1 -1) X86RegisterInfo.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/Target/X86/X86RegisterInfo.cpp diff -u llvm/lib/Target/X86/X86RegisterInfo.cpp:1.175 llvm/lib/Target/X86/X86RegisterInfo.cpp:1.176 --- llvm/lib/Target/X86/X86RegisterInfo.cpp:1.175 Fri Nov 10 02:43:01 2006 +++ llvm/lib/Target/X86/X86RegisterInfo.cpp Fri Nov 10 03:13:37 2006 @@ -172,7 +172,7 @@ for (unsigned i = 0; i != NumOps; ++i) { MachineOperand &MO = MI->getOperand(i+2); if (MO.isReg()) - MIB = MIB.addReg(MO.getReg()); + MIB = MIB.addReg(MO.getReg(), false, MO.isImplicit()); else if (MO.isImm()) MIB = MIB.addImm(MO.getImm()); else if (MO.isGlobalAddress()) From jlaskey at apple.com Fri Nov 10 08:44:27 2006 From: jlaskey at apple.com (Jim Laskey) Date: Fri, 10 Nov 2006 08:44:27 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineInstr.h Message-ID: <200611101444.kAAEiRA4015823@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineInstr.h updated: 1.193 -> 1.194 --- Log message: Shut up the warning. --- Diffs of the changes: (+1 -1) MachineInstr.h | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/include/llvm/CodeGen/MachineInstr.h diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.193 llvm/include/llvm/CodeGen/MachineInstr.h:1.194 --- llvm/include/llvm/CodeGen/MachineInstr.h:1.193 Fri Nov 10 02:32:14 2006 +++ llvm/include/llvm/CodeGen/MachineInstr.h Fri Nov 10 08:44:12 2006 @@ -180,7 +180,7 @@ assert(isRegister() && "Wrong MachineOperand accessor"); return IsImp; } - bool setImplicit() { + void setImplicit() { assert(isRegister() && "Wrong MachineOperand accessor"); IsImp = true; } From reid at x10sys.com Fri Nov 10 11:47:42 2006 From: reid at x10sys.com (Reid Spencer) Date: Fri, 10 Nov 2006 11:47:42 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp Message-ID: <200611101747.kAAHlgCv019818@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/DebugInfo: 2006-11-06-StackTrace.cpp updated: 1.4 -> 1.5 --- Log message: This is XFAILed on i[0-9]86 systems not Linux --- Diffs of the changes: (+1 -1) 2006-11-06-StackTrace.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp diff -u llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp:1.4 llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp:1.5 --- llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp:1.4 Wed Nov 8 10:38:45 2006 +++ llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp Fri Nov 10 11:47:28 2006 @@ -6,7 +6,7 @@ // RUN: ( echo "break DeepStack::deepest"; echo "run 17" ; echo "where" ) > Output/StackTrace.gdbin // RUN: gdb -q -batch -n -x Output/StackTrace.gdbin Output/StackTrace.exe | tee Output/StackTrace.out | grep '#0 DeepStack::deepest.*(this=.*,.*x=33)' // RUN: gdb -q -batch -n -x Output/StackTrace.gdbin Output/StackTrace.exe | grep '#7 0x.* in main.*(argc=[12],.*argv=.*)' -// XFAIL: linux +// XFAIL: i[0-9]86 #include From sabre at nondot.org Fri Nov 10 11:51:16 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 10 Nov 2006 11:51:16 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCInstrFormats.td PPCInstrInfo.td Message-ID: <200611101751.kAAHpGBV019925@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCInstrFormats.td updated: 1.81 -> 1.82 PPCInstrInfo.td updated: 1.255 -> 1.256 --- Log message: dform 8/9 are identical to dform 1 --- Diffs of the changes: (+6 -15) PPCInstrFormats.td | 9 --------- PPCInstrInfo.td | 12 ++++++------ 2 files changed, 6 insertions(+), 15 deletions(-) Index: llvm/lib/Target/PowerPC/PPCInstrFormats.td diff -u llvm/lib/Target/PowerPC/PPCInstrFormats.td:1.81 llvm/lib/Target/PowerPC/PPCInstrFormats.td:1.82 --- llvm/lib/Target/PowerPC/PPCInstrFormats.td:1.81 Mon Nov 6 19:51:50 2006 +++ llvm/lib/Target/PowerPC/PPCInstrFormats.td Fri Nov 10 11:51:02 2006 @@ -174,15 +174,6 @@ let L = PPC64; } -class DForm_8 opcode, dag OL, string asmstr, InstrItinClass itin, - list pattern> - : DForm_1 { -} - -class DForm_9 opcode, dag OL, string asmstr, InstrItinClass itin, - list pattern> - : DForm_1 { -} // 1.7.5 DS-Form class DSForm_1 opcode, bits<2> xo, dag OL, string asmstr, Index: llvm/lib/Target/PowerPC/PPCInstrInfo.td diff -u llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.255 llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.256 --- llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.255 Thu Nov 9 20:08:47 2006 +++ llvm/lib/Target/PowerPC/PPCInstrInfo.td Fri Nov 10 11:51:02 2006 @@ -422,10 +422,10 @@ "lwz $rD, $src", LdStGeneral, [(set GPRC:$rD, (load iaddr:$src))]>; -def LFS : DForm_8<48, (ops F4RC:$rD, memri:$src), +def LFS : DForm_1<48, (ops F4RC:$rD, memri:$src), "lfs $rD, $src", LdStLFDU, [(set F4RC:$rD, (load iaddr:$src))]>; -def LFD : DForm_8<50, (ops F8RC:$rD, memri:$src), +def LFD : DForm_1<50, (ops F8RC:$rD, memri:$src), "lfd $rD, $src", LdStLFD, [(set F8RC:$rD, (load iaddr:$src))]>; @@ -452,11 +452,11 @@ "lwzu $rD, $disp($rA)", LdStGeneral, []>, RegConstraint<"$rA = $rA_result">; -def LFSU : DForm_8<49, (ops F4RC:$rD, ptr_rc:$rA_result, i32imm:$disp, +def LFSU : DForm_1<49, (ops F4RC:$rD, ptr_rc:$rA_result, i32imm:$disp, ptr_rc:$rA), "lfs $rD, $disp($rA)", LdStLFDU, []>, RegConstraint<"$rA = $rA_result">; -def LFDU : DForm_8<51, (ops F8RC:$rD, ptr_rc:$rA_result, i32imm:$disp, +def LFDU : DForm_1<51, (ops F8RC:$rD, ptr_rc:$rA_result, i32imm:$disp, ptr_rc:$rA), "lfd $rD, $disp($rA)", LdStLFD, []>, RegConstraint<"$rA = $rA_result">; @@ -537,10 +537,10 @@ "cmplwi $dst, $src1, $src2", IntCompare>; } let isStore = 1, noResults = 1, PPC970_Unit = 2 in { -def STFS : DForm_9<52, (ops F4RC:$rS, memri:$dst), +def STFS : DForm_1<52, (ops F4RC:$rS, memri:$dst), "stfs $rS, $dst", LdStUX, [(store F4RC:$rS, iaddr:$dst)]>; -def STFD : DForm_9<54, (ops F8RC:$rS, memri:$dst), +def STFD : DForm_1<54, (ops F8RC:$rS, memri:$dst), "stfd $rS, $dst", LdStUX, [(store F8RC:$rS, iaddr:$dst)]>; } From jlaskey at apple.com Fri Nov 10 11:51:40 2006 From: jlaskey at apple.com (Jim Laskey) Date: Fri, 10 Nov 2006 11:51:40 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp Message-ID: <200611101751.kAAHpe8B019944@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/DebugInfo: 2006-11-06-StackTrace.cpp updated: 1.5 -> 1.6 --- Log message: Must have a frame pointer. --- Diffs of the changes: (+1 -2) 2006-11-06-StackTrace.cpp | 3 +-- 1 files changed, 1 insertion(+), 2 deletions(-) Index: llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp diff -u llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp:1.5 llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp:1.6 --- llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp:1.5 Fri Nov 10 11:47:28 2006 +++ llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp Fri Nov 10 11:51:25 2006 @@ -1,6 +1,6 @@ // This is a regression test on debug info to make sure that we can get a // meaningful stack trace from a C++ program. -// RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | llc -o Output/StackTrace.s -f +// RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | --disable-fp-elim llc -o Output/StackTrace.s -f // RUN: as Output/StackTrace.s -o Output/StackTrace.o // RUN: g++ Output/StackTrace.o -o Output/StackTrace.exe // RUN: ( echo "break DeepStack::deepest"; echo "run 17" ; echo "where" ) > Output/StackTrace.gdbin @@ -8,7 +8,6 @@ // RUN: gdb -q -batch -n -x Output/StackTrace.gdbin Output/StackTrace.exe | grep '#7 0x.* in main.*(argc=[12],.*argv=.*)' // XFAIL: i[0-9]86 - #include class DeepStack { From jlaskey at apple.com Fri Nov 10 11:56:44 2006 From: jlaskey at apple.com (Jim Laskey) Date: Fri, 10 Nov 2006 11:56:44 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp Message-ID: <200611101756.kAAHuirK020098@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/DebugInfo: 2006-11-06-StackTrace.cpp updated: 1.6 -> 1.7 --- Log message: Must have a frame pointer argument fixed. Now fails on PowerPC. --- Diffs of the changes: (+2 -2) 2006-11-06-StackTrace.cpp | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp diff -u llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp:1.6 llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp:1.7 --- llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp:1.6 Fri Nov 10 11:51:25 2006 +++ llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp Fri Nov 10 11:56:29 2006 @@ -1,12 +1,12 @@ // This is a regression test on debug info to make sure that we can get a // meaningful stack trace from a C++ program. -// RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | --disable-fp-elim llc -o Output/StackTrace.s -f +// RUN: %llvmgcc -S -O0 -g %s -o - | llvm-as | llc --disable-fp-elim -o Output/StackTrace.s -f // RUN: as Output/StackTrace.s -o Output/StackTrace.o // RUN: g++ Output/StackTrace.o -o Output/StackTrace.exe // RUN: ( echo "break DeepStack::deepest"; echo "run 17" ; echo "where" ) > Output/StackTrace.gdbin // RUN: gdb -q -batch -n -x Output/StackTrace.gdbin Output/StackTrace.exe | tee Output/StackTrace.out | grep '#0 DeepStack::deepest.*(this=.*,.*x=33)' // RUN: gdb -q -batch -n -x Output/StackTrace.gdbin Output/StackTrace.exe | grep '#7 0x.* in main.*(argc=[12],.*argv=.*)' -// XFAIL: i[0-9]86 +// XFAIL: * #include From sabre at nondot.org Fri Nov 10 13:40:48 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 10 Nov 2006 13:40:48 -0600 Subject: [llvm-commits] CVS: llvm-test/SingleSource/CustomChecked/Makefile Message-ID: <200611101940.kAAJem3M023846@zion.cs.uiuc.edu> Changes in directory llvm-test/SingleSource/CustomChecked: Makefile updated: 1.12 -> 1.13 --- Log message: Let these link --- Diffs of the changes: (+1 -1) Makefile | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-test/SingleSource/CustomChecked/Makefile diff -u llvm-test/SingleSource/CustomChecked/Makefile:1.12 llvm-test/SingleSource/CustomChecked/Makefile:1.13 --- llvm-test/SingleSource/CustomChecked/Makefile:1.12 Wed Sep 1 09:33:26 2004 +++ llvm-test/SingleSource/CustomChecked/Makefile Fri Nov 10 13:40:33 2006 @@ -7,7 +7,7 @@ include $(LEVEL)/SingleSource/Makefile.singlesrc LIBS += -lstdc++ -LDFLAGS += -lm +LDFLAGS += -lstdc++ -lm LLI_RUN := $(addsuffix .run-lli, $(PREFIXED_PROGRAMS_TO_TEST)) JIT_RUN := $(addsuffix .run-jit, $(PREFIXED_PROGRAMS_TO_TEST)) From evan.cheng at apple.com Fri Nov 10 15:23:18 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 10 Nov 2006 15:23:18 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Message-ID: <200611102123.kAALNIKP032233@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelDAGToDAG.cpp updated: 1.123 -> 1.124 --- Log message: Fix a bug in SelectScalarSSELoad. Since the load is wrapped in a SCALAR_TO_VECTOR, even if the hasOneUse() check pass we may end up folding the load into two instructions. Make sure we check the SCALAR_TO_VECTOR has only one use as well. --- Diffs of the changes: (+1 -0) X86ISelDAGToDAG.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp diff -u llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.123 llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.124 --- llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.123 Wed Nov 8 14:34:28 2006 +++ llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Fri Nov 10 15:23:04 2006 @@ -815,6 +815,7 @@ InChain = N.getOperand(0).getValue(1); if (ISD::isNON_EXTLoad(InChain.Val) && InChain.getValue(0).hasOneUse() && + N.hasOneUse() && CanBeFoldedBy(N.Val, Pred.Val, Op.Val)) { LoadSDNode *LD = cast(InChain); if (!SelectAddr(Op, LD->getBasePtr(), Base, Scale, Index, Disp)) From dpatel at apple.com Fri Nov 10 15:33:31 2006 From: dpatel at apple.com (Devang Patel) Date: Fri, 10 Nov 2006 15:33:31 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200611102133.kAALXVIQ032445@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.10 -> 1.11 --- Log message: s/PassManagerAnalysisHelper/CommonPassManagerImpl Inherit CommonPassManagerImpl from Pass. --- Diffs of the changes: (+10 -14) PassManager.cpp | 24 ++++++++++-------------- 1 files changed, 10 insertions(+), 14 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.10 llvm/lib/VMCore/PassManager.cpp:1.11 --- llvm/lib/VMCore/PassManager.cpp:1.10 Wed Nov 8 04:44:40 2006 +++ llvm/lib/VMCore/PassManager.cpp Fri Nov 10 15:33:13 2006 @@ -22,8 +22,7 @@ /// BasicBlockPassManager_New manages BasicBlockPass. It batches all the /// pass together and sequence them to process one basic block before /// processing next basic block. -class BasicBlockPassManager_New : public Pass, - public PassManagerAnalysisHelper { +class BasicBlockPassManager_New : public CommonPassManagerImpl { public: BasicBlockPassManager_New() { } @@ -44,8 +43,7 @@ /// It batches all function passes and basic block pass managers together and /// sequence them to process one function at a time before processing next /// function. -class FunctionPassManagerImpl_New : public Pass, - public PassManagerAnalysisHelper { +class FunctionPassManagerImpl_New : public CommonPassManagerImpl { public: FunctionPassManagerImpl_New(ModuleProvider *P) { /* TODO */ } FunctionPassManagerImpl_New() { @@ -79,8 +77,7 @@ /// ModulePassManager_New manages ModulePasses and function pass managers. /// It batches all Module passes passes and function pass managers together and /// sequence them to process one module. -class ModulePassManager_New : public Pass, - public PassManagerAnalysisHelper { +class ModulePassManager_New : public CommonPassManagerImpl { public: ModulePassManager_New() { activeFunctionPassManager = NULL; } @@ -101,8 +98,7 @@ }; /// PassManager_New manages ModulePassManagers -class PassManagerImpl_New : public Pass, - public PassManagerAnalysisHelper { +class PassManagerImpl_New : public CommonPassManagerImpl { public: @@ -137,11 +133,11 @@ } // End of llvm namespace -// PassManagerAnalysisHelper implementation +// CommonPassManagerImpl implementation /// Return true IFF pass P's required analysis set does not required new /// manager. -bool PassManagerAnalysisHelper::manageablePass(Pass *P) { +bool CommonPassManagerImpl::manageablePass(Pass *P) { AnalysisUsage AnUsage; P->getAnalysisUsage(AnUsage); @@ -153,26 +149,26 @@ } /// Return true IFF AnalysisID AID is currently available. -bool PassManagerAnalysisHelper::analysisCurrentlyAvailable(AnalysisID AID) { +bool CommonPassManagerImpl::analysisCurrentlyAvailable(AnalysisID AID) { // TODO return false; } /// Augment RequiredSet by adding analysis required by pass P. -void PassManagerAnalysisHelper::noteDownRequiredAnalysis(Pass *P) { +void CommonPassManagerImpl::noteDownRequiredAnalysis(Pass *P) { // TODO } /// Remove AnalysisID from the RequiredSet -void PassManagerAnalysisHelper::removeAnalysis(AnalysisID AID) { +void CommonPassManagerImpl::removeAnalysis(AnalysisID AID) { // TODO } /// Remove Analyss not preserved by Pass P -void PassManagerAnalysisHelper::removeNotPreservedAnalysis(Pass *P) { +void CommonPassManagerImpl::removeNotPreservedAnalysis(Pass *P) { // TODO } From dpatel at apple.com Fri Nov 10 15:33:31 2006 From: dpatel at apple.com (Devang Patel) Date: Fri, 10 Nov 2006 15:33:31 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/PassManager.h Message-ID: <200611102133.kAALXVXu032442@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: PassManager.h updated: 1.26 -> 1.27 --- Log message: s/PassManagerAnalysisHelper/CommonPassManagerImpl Inherit CommonPassManagerImpl from Pass. --- Diffs of the changes: (+4 -6) PassManager.h | 10 ++++------ 1 files changed, 4 insertions(+), 6 deletions(-) Index: llvm/include/llvm/PassManager.h diff -u llvm/include/llvm/PassManager.h:1.26 llvm/include/llvm/PassManager.h:1.27 --- llvm/include/llvm/PassManager.h:1.26 Wed Nov 8 04:44:40 2006 +++ llvm/include/llvm/PassManager.h Fri Nov 10 15:33:13 2006 @@ -92,10 +92,10 @@ class PassManagerImpl_New; class FunctionPassManagerImpl_New; -/// PassManagerAnalysisHelper helps pass manager analysis required by +/// CommonPassManagerImpl helps pass manager analysis required by /// the managed passes. It provides methods to add/remove analysis /// available and query if certain analysis is available or not. -class PassManagerAnalysisHelper { +class CommonPassManagerImpl : public Pass{ public: @@ -124,8 +124,7 @@ }; /// PassManager_New manages ModulePassManagers -class PassManager_New : public Pass, - public PassManagerAnalysisHelper { +class PassManager_New : public CommonPassManagerImpl { public: @@ -150,8 +149,7 @@ }; /// FunctionPassManager_New manages FunctionPasses and BasicBlockPassManagers. -class FunctionPassManager_New : public Pass, - public PassManagerAnalysisHelper { +class FunctionPassManager_New : public CommonPassManagerImpl { public: FunctionPassManager_New(ModuleProvider *P) { /* TODO */ } FunctionPassManager_New(); From sabre at nondot.org Fri Nov 10 15:36:21 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 10 Nov 2006 15:36:21 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/Generic/2006-11-10-DAGCombineMiscompile.ll Message-ID: <200611102136.kAALaLmU032558@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/Generic: 2006-11-10-DAGCombineMiscompile.ll added (r1.1) --- Log message: new testcase --- Diffs of the changes: (+14 -0) 2006-11-10-DAGCombineMiscompile.ll | 14 ++++++++++++++ 1 files changed, 14 insertions(+) Index: llvm/test/Regression/CodeGen/Generic/2006-11-10-DAGCombineMiscompile.ll diff -c /dev/null llvm/test/Regression/CodeGen/Generic/2006-11-10-DAGCombineMiscompile.ll:1.1 *** /dev/null Fri Nov 10 15:36:17 2006 --- llvm/test/Regression/CodeGen/Generic/2006-11-10-DAGCombineMiscompile.ll Fri Nov 10 15:36:07 2006 *************** *** 0 **** --- 1,14 ---- + ; RUN: llvm-as < %s | llc -march=ppc32 | grep rlwimi + + void %test(short %div.0.i.i.i.i, int %L_num.0.i.i.i.i, int %tmp1.i.i206.i.i, short* %P) { + %X = shl short %div.0.i.i.i.i, ubyte 1 ; [#uses=1] + %tmp28.i.i.i.i = shl int %L_num.0.i.i.i.i, ubyte 1 ; [#uses=2] + %tmp31.i.i.i.i = setlt int %tmp28.i.i.i.i, %tmp1.i.i206.i.i ; [#uses=2] + + %tmp31.i.i.i.i = cast bool %tmp31.i.i.i.i to short ; [#uses=1] + %tmp371.i.i.i.i1 = or short %tmp31.i.i.i.i, %X ; [#uses=1] + %div.0.be.i.i.i.i = xor short %tmp371.i.i.i.i1, 1 ; [#uses=1] + store short %div.0.be.i.i.i.i, short* %P + ret void + } + From sabre at nondot.org Fri Nov 10 15:37:29 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 10 Nov 2006 15:37:29 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200611102137.kAALbT73032639@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.248 -> 1.249 --- Log message: Fix a dag combiner bug exposed by my recent instcombine patch. This fixes CodeGen/Generic/2006-11-10-DAGCombineMiscompile.ll and PPC gsm/toast --- 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.248 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.249 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.248 Fri Nov 10 02:28:11 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Fri Nov 10 15:37:15 2006 @@ -1723,7 +1723,7 @@ abort(); } // fold !(x or y) -> (!x and !y) iff x or y are setcc - if (N1C && N1C->getValue() == 1 && + if (N1C && N1C->getValue() == 1 && VT == MVT::i1 && (N0.getOpcode() == ISD::OR || N0.getOpcode() == ISD::AND)) { SDOperand LHS = N0.getOperand(0), RHS = N0.getOperand(1); if (isOneUseSetCC(RHS) || isOneUseSetCC(LHS)) { From evan.cheng at apple.com Fri Nov 10 15:43:51 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 10 Nov 2006 15:43:51 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp X86ISelLowering.h X86InstrSSE.td Message-ID: <200611102143.kAALhpjb000483@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.289 -> 1.290 X86ISelLowering.h updated: 1.79 -> 1.80 X86InstrSSE.td updated: 1.170 -> 1.171 --- Log message: Don't dag combine floating point select to max and min intrinsics. Those take v4f32 / v2f64 operands and may end up causing larger spills / restores. Added X86 specific nodes X86ISD::FMAX, X86ISD::FMIN instead. This fixes PR996: http://llvm.org/PR996 . --- Diffs of the changes: (+21 -59) X86ISelLowering.cpp | 36 +++++++++--------------------------- X86ISelLowering.h | 6 +++++- X86InstrSSE.td | 38 +++++++------------------------------- 3 files changed, 21 insertions(+), 59 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.289 llvm/lib/Target/X86/X86ISelLowering.cpp:1.290 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.289 Thu Nov 9 18:48:12 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Fri Nov 10 15:43:37 2006 @@ -4983,6 +4983,8 @@ case X86ISD::S2VEC: return "X86ISD::S2VEC"; case X86ISD::PEXTRW: return "X86ISD::PEXTRW"; case X86ISD::PINSRW: return "X86ISD::PINSRW"; + case X86ISD::FMAX: return "X86ISD::FMAX"; + case X86ISD::FMIN: return "X86ISD::FMIN"; } } @@ -5363,7 +5365,7 @@ SDOperand RHS = N->getOperand(2); ISD::CondCode CC = cast(Cond.getOperand(2))->get(); - unsigned IntNo = 0; + unsigned Opcode = 0; if (LHS == Cond.getOperand(0) && RHS == Cond.getOperand(1)) { switch (CC) { default: break; @@ -5374,8 +5376,7 @@ // FALL THROUGH. case ISD::SETOLT: // (X olt/lt Y) ? X : Y -> min case ISD::SETLT: - IntNo = LHS.getValueType() == MVT::f32 ? Intrinsic::x86_sse_min_ss : - Intrinsic::x86_sse2_min_sd; + Opcode = X86ISD::FMIN; break; case ISD::SETOGT: // (X > Y) ? X : Y -> max @@ -5385,8 +5386,7 @@ // FALL THROUGH. case ISD::SETUGE: // (X uge/ge Y) ? X : Y -> max case ISD::SETGE: - IntNo = LHS.getValueType() == MVT::f32 ? Intrinsic::x86_sse_max_ss : - Intrinsic::x86_sse2_max_sd; + Opcode = X86ISD::FMAX; break; } } else if (LHS == Cond.getOperand(1) && RHS == Cond.getOperand(0)) { @@ -5399,8 +5399,7 @@ // FALL THROUGH. case ISD::SETUGE: // (X uge/ge Y) ? Y : X -> min case ISD::SETGE: - IntNo = LHS.getValueType() == MVT::f32 ? Intrinsic::x86_sse_min_ss : - Intrinsic::x86_sse2_min_sd; + Opcode = X86ISD::FMIN; break; case ISD::SETOLE: // (X <= Y) ? Y : X -> max @@ -5410,30 +5409,13 @@ // FALL THROUGH. case ISD::SETOLT: // (X olt/lt Y) ? Y : X -> max case ISD::SETLT: - IntNo = LHS.getValueType() == MVT::f32 ? Intrinsic::x86_sse_max_ss : - Intrinsic::x86_sse2_max_sd; + Opcode = X86ISD::FMAX; break; } } - // minss/maxss take a v4f32 operand. - if (IntNo) { - if (LHS.getValueType() == MVT::f32) { - LHS = DAG.getNode(ISD::SCALAR_TO_VECTOR, MVT::v4f32, LHS); - RHS = DAG.getNode(ISD::SCALAR_TO_VECTOR, MVT::v4f32, RHS); - } else { - LHS = DAG.getNode(ISD::SCALAR_TO_VECTOR, MVT::v2f64, LHS); - RHS = DAG.getNode(ISD::SCALAR_TO_VECTOR, MVT::v2f64, RHS); - } - - MVT::ValueType PtrTy = Subtarget->is64Bit() ? MVT::i64 : MVT::i32; - SDOperand IntNoN = DAG.getConstant(IntNo, PtrTy); - - SDOperand Val = DAG.getNode(ISD::INTRINSIC_WO_CHAIN, LHS.getValueType(), - IntNoN, LHS, RHS); - return DAG.getNode(ISD::EXTRACT_VECTOR_ELT, N->getValueType(0), Val, - DAG.getConstant(0, PtrTy)); - } + if (Opcode) + return DAG.getNode(Opcode, N->getValueType(0), LHS, RHS); } } Index: llvm/lib/Target/X86/X86ISelLowering.h diff -u llvm/lib/Target/X86/X86ISelLowering.h:1.79 llvm/lib/Target/X86/X86ISelLowering.h:1.80 --- llvm/lib/Target/X86/X86ISelLowering.h:1.79 Tue Nov 7 16:14:24 2006 +++ llvm/lib/Target/X86/X86ISelLowering.h Fri Nov 10 15:43:37 2006 @@ -160,7 +160,11 @@ /// PINSRW - Insert the lower 16-bits of a 32-bit value to a vector, /// corresponds to X86::PINSRW. - PINSRW + PINSRW, + + /// FMAX, FMIN - Floating point max and min. + /// + FMAX, FMIN }; } Index: llvm/lib/Target/X86/X86InstrSSE.td diff -u llvm/lib/Target/X86/X86InstrSSE.td:1.170 llvm/lib/Target/X86/X86InstrSSE.td:1.171 --- llvm/lib/Target/X86/X86InstrSSE.td:1.170 Tue Nov 7 16:14:24 2006 +++ llvm/lib/Target/X86/X86InstrSSE.td Fri Nov 10 15:43:37 2006 @@ -20,6 +20,8 @@ def X86loadp : SDNode<"X86ISD::LOAD_PACK", SDTLoad, [SDNPHasChain]>; def X86loadu : SDNode<"X86ISD::LOAD_UA", SDTLoad, [SDNPHasChain]>; +def X86fmin : SDNode<"X86ISD::FMIN", SDTFPBinOp>; +def X86fmax : SDNode<"X86ISD::FMAX", SDTFPBinOp>; def X86fand : SDNode<"X86ISD::FAND", SDTFPBinOp, [SDNPCommutative, SDNPAssociative]>; def X86fxor : SDNode<"X86ISD::FXOR", SDTFPBinOp, @@ -380,6 +382,11 @@ defm DIV : scalar_sse12_fp_binop_rm<0x5E, "div", fdiv, int_x86_sse_div_ss, int_x86_sse2_div_sd>; +defm MAX : scalar_sse12_fp_binop_rm<0x5F, "max", X86fmax, + int_x86_sse_max_ss, int_x86_sse2_max_sd>; +defm MIN : scalar_sse12_fp_binop_rm<0x5D, "min", X86fmin, + int_x86_sse_min_ss, int_x86_sse2_min_sd>; + def SQRTSSr : SSI<0x51, MRMSrcReg, (ops FR32:$dst, FR32:$src), "sqrtss {$src, $dst|$dst, $src}", @@ -394,24 +401,6 @@ "sqrtsd {$src, $dst|$dst, $src}", [(set FR64:$dst, (fsqrt (loadf64 addr:$src)))]>; -class SS_Intrr o, string OpcodeStr, Intrinsic IntId> - : SSI; -class SS_Intrm o, string OpcodeStr, Intrinsic IntId> - : SSI; -class SD_Intrr o, string OpcodeStr, Intrinsic IntId> - : SDI; -class SD_Intrm o, string OpcodeStr, Intrinsic IntId> - : SDI; - - // Aliases to match intrinsics which expect XMM operand(s). defm SQRTSS_Int : SS_IntUnary<0x51, "sqrtss" , int_x86_sse_sqrt_ss>; @@ -419,19 +408,6 @@ defm RSQRTSS_Int : SS_IntUnary<0x52, "rsqrtss", int_x86_sse_rsqrt_ss>; defm RCPSS_Int : SS_IntUnary<0x53, "rcpss" , int_x86_sse_rcp_ss>; -let isTwoAddress = 1 in { -let isCommutable = 1 in { -def Int_MAXSSrr : SS_Intrr<0x5F, "maxss", int_x86_sse_max_ss>; -def Int_MAXSDrr : SD_Intrr<0x5F, "maxsd", int_x86_sse2_max_sd>; -def Int_MINSSrr : SS_Intrr<0x5D, "minss", int_x86_sse_min_ss>; -def Int_MINSDrr : SD_Intrr<0x5D, "minsd", int_x86_sse2_min_sd>; -} -def Int_MAXSSrm : SS_Intrm<0x5F, "maxss", int_x86_sse_max_ss>; -def Int_MAXSDrm : SD_Intrm<0x5F, "maxsd", int_x86_sse2_max_sd>; -def Int_MINSSrm : SS_Intrm<0x5D, "minss", int_x86_sse_min_ss>; -def Int_MINSDrm : SD_Intrm<0x5D, "minsd", int_x86_sse2_min_sd>; -} - // Conversion instructions def CVTTSS2SIrr: SSI<0x2C, MRMSrcReg, (ops GR32:$dst, FR32:$src), "cvttss2si {$src, $dst|$dst, $src}", From tonic at nondot.org Fri Nov 10 15:48:19 2006 From: tonic at nondot.org (Tanya Lattner) Date: Fri, 10 Nov 2006 15:48:19 -0600 Subject: [llvm-commits] [release_19] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200611102148.kAALmJdP000600@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.238 -> 1.238.2.1 --- Log message: Merging from mainline Fix a dag combiner bug exposed by my recent instcombine patch. This fixes CodeGen/Generic/2006-11-10-DAGCombineMiscompile.ll and PPC gsm/toast. --- 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.238 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.238.2.1 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.238 Mon Nov 6 02:14:30 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Fri Nov 10 15:48:06 2006 @@ -1608,7 +1608,7 @@ abort(); } // fold !(x or y) -> (!x and !y) iff x or y are setcc - if (N1C && N1C->getValue() == 1 && + if (N1C && N1C->getValue() == 1 && VT == MVT::i1 && (N0.getOpcode() == ISD::OR || N0.getOpcode() == ISD::AND)) { SDOperand LHS = N0.getOperand(0), RHS = N0.getOperand(1); if (isOneUseSetCC(RHS) || isOneUseSetCC(LHS)) { From tonic at nondot.org Fri Nov 10 15:51:13 2006 From: tonic at nondot.org (Tanya Lattner) Date: Fri, 10 Nov 2006 15:51:13 -0600 Subject: [llvm-commits] [release_19] CVS: llvm-test/SingleSource/CustomChecked/Makefile Message-ID: <200611102151.kAALpDvo000721@zion.cs.uiuc.edu> Changes in directory llvm-test/SingleSource/CustomChecked: Makefile updated: 1.12 -> 1.12.14.1 --- Log message: Merge from mainline to fix linking problem. --- Diffs of the changes: (+1 -1) Makefile | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm-test/SingleSource/CustomChecked/Makefile diff -u llvm-test/SingleSource/CustomChecked/Makefile:1.12 llvm-test/SingleSource/CustomChecked/Makefile:1.12.14.1 --- llvm-test/SingleSource/CustomChecked/Makefile:1.12 Wed Sep 1 09:33:26 2004 +++ llvm-test/SingleSource/CustomChecked/Makefile Fri Nov 10 15:51:00 2006 @@ -7,7 +7,7 @@ include $(LEVEL)/SingleSource/Makefile.singlesrc LIBS += -lstdc++ -LDFLAGS += -lm +LDFLAGS += -lstdc++ -lm LLI_RUN := $(addsuffix .run-lli, $(PREFIXED_PROGRAMS_TO_TEST)) JIT_RUN := $(addsuffix .run-jit, $(PREFIXED_PROGRAMS_TO_TEST)) From tonic at nondot.org Fri Nov 10 15:56:09 2006 From: tonic at nondot.org (Tanya Lattner) Date: Fri, 10 Nov 2006 15:56:09 -0600 Subject: [llvm-commits] [release_19] CVS: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Message-ID: <200611102156.kAALu9Qe000975@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelDAGToDAG.cpp updated: 1.122 -> 1.122.2.1 --- Log message: Merge from mainline. Fix a bug in SelectScalarSSELoad. Since the load is wrapped in a SCALAR_TO_VECTOR, even if the hasOneUse() check pass we may end up folding the load into two instructions. Make sure we check the SCALAR_TO_VECTOR has only one use as well. --- Diffs of the changes: (+1 -0) X86ISelDAGToDAG.cpp | 1 + 1 files changed, 1 insertion(+) Index: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp diff -u llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.122 llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.122.2.1 --- llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.122 Sun Nov 5 13:31:28 2006 +++ llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Fri Nov 10 15:55:57 2006 @@ -814,6 +814,7 @@ InChain = N.getOperand(0).getValue(1); if (ISD::isNON_EXTLoad(InChain.Val) && InChain.getValue(0).hasOneUse() && + N.hasOneUse() && CanBeFoldedBy(N.Val, Pred.Val, Root.Val)) { LoadSDNode *LD = cast(InChain); if (!SelectAddr(LD->getBasePtr(), Base, Scale, Index, Disp)) From evan.cheng at apple.com Fri Nov 10 16:03:49 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 10 Nov 2006 16:03:49 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/README-SSE.txt README.txt Message-ID: <200611102203.kAAM3nOx001166@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: README-SSE.txt updated: 1.7 -> 1.8 README.txt updated: 1.143 -> 1.144 --- Log message: These are done. --- Diffs of the changes: (+0 -69) README-SSE.txt | 58 --------------------------------------------------------- README.txt | 11 ---------- 2 files changed, 69 deletions(-) Index: llvm/lib/Target/X86/README-SSE.txt diff -u llvm/lib/Target/X86/README-SSE.txt:1.7 llvm/lib/Target/X86/README-SSE.txt:1.8 --- llvm/lib/Target/X86/README-SSE.txt:1.7 Wed Oct 18 12:04:09 2006 +++ llvm/lib/Target/X86/README-SSE.txt Fri Nov 10 16:03:35 2006 @@ -4,30 +4,6 @@ //===---------------------------------------------------------------------===// -There are serious issues folding loads into "scalar sse" intrinsics. For -example, this: - -float minss4( float x, float *y ) { - return _mm_cvtss_f32(_mm_min_ss(_mm_set_ss(x),_mm_set_ss(*y))); -} - -compiles to: - -_minss4: - subl $4, %esp - movl 12(%esp), %eax -*** movss 8(%esp), %xmm0 -*** movss (%eax), %xmm1 -*** minss %xmm1, %xmm0 - movss %xmm0, (%esp) - flds (%esp) - addl $4, %esp - ret - -Each operand of the minss is a load. At least one should be folded! - -//===---------------------------------------------------------------------===// - Expand libm rounding functions inline: Significant speedups possible. http://gcc.gnu.org/ml/gcc-patches/2006-10/msg00909.html @@ -165,17 +141,6 @@ //===---------------------------------------------------------------------===// -Should generate min/max for stuff like: - -void minf(float a, float b, float *X) { - *X = a <= b ? a : b; -} - -Make use of floating point min / max instructions. Perhaps introduce ISD::FMIN -and ISD::FMAX node types? - -//===---------------------------------------------------------------------===// - Lower memcpy / memset to a series of SSE 128 bit move instructions when it's feasible. @@ -225,29 +190,6 @@ //===---------------------------------------------------------------------===// -Better codegen for: - -void f(float a, float b, vector float * out) { *out = (vector float){ a, 0.0, 0.0, b}; } -void f(float a, float b, vector float * out) { *out = (vector float){ a, b, 0.0, 0}; } - -For the later we generate: - -_f: - pxor %xmm0, %xmm0 - movss 8(%esp), %xmm1 - movaps %xmm0, %xmm2 - unpcklps %xmm1, %xmm2 - movss 4(%esp), %xmm1 - unpcklps %xmm0, %xmm1 - unpcklps %xmm2, %xmm1 - movl 12(%esp), %eax - movaps %xmm1, (%eax) - ret - -This seems like it should use shufps, one for each of a & b. - -//===---------------------------------------------------------------------===// - How to decide when to use the "floating point version" of logical ops? Here are some code fragments: Index: llvm/lib/Target/X86/README.txt diff -u llvm/lib/Target/X86/README.txt:1.143 llvm/lib/Target/X86/README.txt:1.144 --- llvm/lib/Target/X86/README.txt:1.143 Sun Oct 22 16:40:12 2006 +++ llvm/lib/Target/X86/README.txt Fri Nov 10 16:03:35 2006 @@ -232,17 +232,6 @@ //===---------------------------------------------------------------------===// -Should generate min/max for stuff like: - -void minf(float a, float b, float *X) { - *X = a <= b ? a : b; -} - -Make use of floating point min / max instructions. Perhaps introduce ISD::FMIN -and ISD::FMAX node types? - -//===---------------------------------------------------------------------===// - The first BB of this code: declare bool %foo() From evan.cheng at apple.com Fri Nov 10 16:09:31 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Fri, 10 Nov 2006 16:09:31 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/README-SSE.txt Message-ID: <200611102209.kAAM9VuZ001274@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: README-SSE.txt updated: 1.8 -> 1.9 --- Log message: Add a note. --- Diffs of the changes: (+6 -0) README-SSE.txt | 6 ++++++ 1 files changed, 6 insertions(+) Index: llvm/lib/Target/X86/README-SSE.txt diff -u llvm/lib/Target/X86/README-SSE.txt:1.8 llvm/lib/Target/X86/README-SSE.txt:1.9 --- llvm/lib/Target/X86/README-SSE.txt:1.8 Fri Nov 10 16:03:35 2006 +++ llvm/lib/Target/X86/README-SSE.txt Fri Nov 10 16:09:17 2006 @@ -551,3 +551,9 @@ Apply the same transformation that merged four float into a single 128-bit load to loads from constant pool. + +//===---------------------------------------------------------------------===// + +Floating point max / min are commutable when -enable-unsafe-fp-path is +specified. We should turn int_x86_sse_max_ss and X86ISD::FMIN etc. into other +nodes which are selected to max / min instructions that are marked commutable. From tonic at nondot.org Fri Nov 10 16:11:34 2006 From: tonic at nondot.org (Tanya Lattner) Date: Fri, 10 Nov 2006 16:11:34 -0600 Subject: [llvm-commits] [release_19] CVS: llvm/lib/Target/X86/X86ISelLowering.cpp X86ISelLowering.h X86InstrSSE.td Message-ID: <200611102211.kAAMBYvW001327@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelLowering.cpp updated: 1.287.2.3 -> 1.287.2.4 X86ISelLowering.h updated: 1.78 -> 1.78.2.1 X86InstrSSE.td updated: 1.169 -> 1.169.2.1 --- Log message: Merge from mainline Don't dag combine floating point select to max and min intrinsics. Those take v4f32 / v2f64 operands and may end up causing larger spills / restores. Added X86 specific nodes X86ISD::FMAX, X86ISD::FMIN instead. --- Diffs of the changes: (+24 -64) X86ISelLowering.cpp | 45 +++++++++++++-------------------------------- X86ISelLowering.h | 6 +++++- X86InstrSSE.td | 37 ++++++------------------------------- 3 files changed, 24 insertions(+), 64 deletions(-) Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.287.2.3 llvm/lib/Target/X86/X86ISelLowering.cpp:1.287.2.4 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.287.2.3 Thu Nov 9 22:28:35 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Fri Nov 10 16:11:22 2006 @@ -4967,6 +4967,8 @@ case X86ISD::S2VEC: return "X86ISD::S2VEC"; case X86ISD::PEXTRW: return "X86ISD::PEXTRW"; case X86ISD::PINSRW: return "X86ISD::PINSRW"; + case X86ISD::FMAX: return "X86ISD::FMAX"; + case X86ISD::FMIN: return "X86ISD::FMIN"; } } @@ -5347,7 +5349,7 @@ SDOperand RHS = N->getOperand(2); ISD::CondCode CC = cast(Cond.getOperand(2))->get(); - unsigned IntNo = 0; + unsigned Opcode = 0; if (LHS == Cond.getOperand(0) && RHS == Cond.getOperand(1)) { switch (CC) { default: break; @@ -5358,9 +5360,8 @@ // FALL THROUGH. case ISD::SETOLT: // (X olt/lt Y) ? X : Y -> min case ISD::SETLT: - IntNo = LHS.getValueType() == MVT::f32 ? Intrinsic::x86_sse_min_ss : - Intrinsic::x86_sse2_min_sd; - break; + Opcode = X86ISD::FMIN; + break; case ISD::SETOGT: // (X > Y) ? X : Y -> max case ISD::SETUGT: @@ -5369,9 +5370,8 @@ // FALL THROUGH. case ISD::SETUGE: // (X uge/ge Y) ? X : Y -> max case ISD::SETGE: - IntNo = LHS.getValueType() == MVT::f32 ? Intrinsic::x86_sse_max_ss : - Intrinsic::x86_sse2_max_sd; - break; + Opcode = X86ISD::FMAX; + break; } } else if (LHS == Cond.getOperand(1) && RHS == Cond.getOperand(0)) { switch (CC) { @@ -5383,9 +5383,8 @@ // FALL THROUGH. case ISD::SETUGE: // (X uge/ge Y) ? Y : X -> min case ISD::SETGE: - IntNo = LHS.getValueType() == MVT::f32 ? Intrinsic::x86_sse_min_ss : - Intrinsic::x86_sse2_min_sd; - break; + Opcode = X86ISD::FMIN; + break; case ISD::SETOLE: // (X <= Y) ? Y : X -> max case ISD::SETULE: @@ -5394,30 +5393,12 @@ // FALL THROUGH. case ISD::SETOLT: // (X olt/lt Y) ? Y : X -> max case ISD::SETLT: - IntNo = LHS.getValueType() == MVT::f32 ? Intrinsic::x86_sse_max_ss : - Intrinsic::x86_sse2_max_sd; - break; + Opcode = X86ISD::FMAX; + break; } } - - // minss/maxss take a v4f32 operand. - if (IntNo) { - if (LHS.getValueType() == MVT::f32) { - LHS = DAG.getNode(ISD::SCALAR_TO_VECTOR, MVT::v4f32, LHS); - RHS = DAG.getNode(ISD::SCALAR_TO_VECTOR, MVT::v4f32, RHS); - } else { - LHS = DAG.getNode(ISD::SCALAR_TO_VECTOR, MVT::v2f64, LHS); - RHS = DAG.getNode(ISD::SCALAR_TO_VECTOR, MVT::v2f64, RHS); - } - - MVT::ValueType PtrTy = Subtarget->is64Bit() ? MVT::i64 : MVT::i32; - SDOperand IntNoN = DAG.getConstant(IntNo, PtrTy); - - SDOperand Val = DAG.getNode(ISD::INTRINSIC_WO_CHAIN, LHS.getValueType(), - IntNoN, LHS, RHS); - return DAG.getNode(ISD::EXTRACT_VECTOR_ELT, N->getValueType(0), Val, - DAG.getConstant(0, PtrTy)); - } + if (Opcode) + return DAG.getNode(Opcode, N->getValueType(0), LHS, RHS); } } Index: llvm/lib/Target/X86/X86ISelLowering.h diff -u llvm/lib/Target/X86/X86ISelLowering.h:1.78 llvm/lib/Target/X86/X86ISelLowering.h:1.78.2.1 --- llvm/lib/Target/X86/X86ISelLowering.h:1.78 Tue Oct 31 14:13:11 2006 +++ llvm/lib/Target/X86/X86ISelLowering.h Fri Nov 10 16:11:22 2006 @@ -160,7 +160,11 @@ /// PINSRW - Insert the lower 16-bits of a 32-bit value to a vector, /// corresponds to X86::PINSRW. - PINSRW + PINSRW, + + /// FMAX, FMIN - Floating point max and min. + /// + FMAX, FMIN }; } Index: llvm/lib/Target/X86/X86InstrSSE.td diff -u llvm/lib/Target/X86/X86InstrSSE.td:1.169 llvm/lib/Target/X86/X86InstrSSE.td:1.169.2.1 --- llvm/lib/Target/X86/X86InstrSSE.td:1.169 Fri Nov 3 17:48:56 2006 +++ llvm/lib/Target/X86/X86InstrSSE.td Fri Nov 10 16:11:22 2006 @@ -20,6 +20,8 @@ def X86loadp : SDNode<"X86ISD::LOAD_PACK", SDTLoad, [SDNPHasChain]>; def X86loadu : SDNode<"X86ISD::LOAD_UA", SDTLoad, [SDNPHasChain]>; +def X86fmin : SDNode<"X86ISD::FMIN", SDTFPBinOp>; +def X86fmax : SDNode<"X86ISD::FMAX", SDTFPBinOp>; def X86fand : SDNode<"X86ISD::FAND", SDTFPBinOp, [SDNPCommutative, SDNPAssociative]>; def X86fxor : SDNode<"X86ISD::FXOR", SDTFPBinOp, @@ -375,6 +377,10 @@ int_x86_sse_sub_ss, int_x86_sse2_sub_sd>; defm DIV : scalar_sse12_fp_binop_rm<0x5E, "div", fdiv, int_x86_sse_div_ss, int_x86_sse2_div_sd>; +defm MAX : scalar_sse12_fp_binop_rm<0x5F, "max", X86fmax, + int_x86_sse_max_ss, int_x86_sse2_max_sd>; +defm MIN : scalar_sse12_fp_binop_rm<0x5D, "min", X86fmin, + int_x86_sse_min_ss, int_x86_sse2_min_sd>; def SQRTSSr : SSI<0x51, MRMSrcReg, (ops FR32:$dst, FR32:$src), @@ -390,24 +396,6 @@ "sqrtsd {$src, $dst|$dst, $src}", [(set FR64:$dst, (fsqrt (loadf64 addr:$src)))]>; -class SS_Intrr o, string OpcodeStr, Intrinsic IntId> - : SSI; -class SS_Intrm o, string OpcodeStr, Intrinsic IntId> - : SSI; -class SD_Intrr o, string OpcodeStr, Intrinsic IntId> - : SDI; -class SD_Intrm o, string OpcodeStr, Intrinsic IntId> - : SDI; - - // Aliases to match intrinsics which expect XMM operand(s). defm SQRTSS_Int : SS_IntUnary<0x51, "sqrtss" , int_x86_sse_sqrt_ss>; @@ -415,19 +403,6 @@ defm RSQRTSS_Int : SS_IntUnary<0x52, "rsqrtss", int_x86_sse_rsqrt_ss>; defm RCPSS_Int : SS_IntUnary<0x53, "rcpss" , int_x86_sse_rcp_ss>; -let isTwoAddress = 1 in { -let isCommutable = 1 in { -def Int_MAXSSrr : SS_Intrr<0x5F, "maxss", int_x86_sse_max_ss>; -def Int_MAXSDrr : SD_Intrr<0x5F, "maxsd", int_x86_sse2_max_sd>; -def Int_MINSSrr : SS_Intrr<0x5D, "minss", int_x86_sse_min_ss>; -def Int_MINSDrr : SD_Intrr<0x5D, "minsd", int_x86_sse2_min_sd>; -} -def Int_MAXSSrm : SS_Intrm<0x5F, "maxss", int_x86_sse_max_ss>; -def Int_MAXSDrm : SD_Intrm<0x5F, "maxsd", int_x86_sse2_max_sd>; -def Int_MINSSrm : SS_Intrm<0x5D, "minss", int_x86_sse_min_ss>; -def Int_MINSDrm : SD_Intrm<0x5D, "minsd", int_x86_sse2_min_sd>; -} - // Conversion instructions def CVTTSS2SIrr: SSI<0x2C, MRMSrcReg, (ops GR32:$dst, FR32:$src), "cvttss2si {$src, $dst|$dst, $src}", From sabre at nondot.org Fri Nov 10 17:38:15 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 10 Nov 2006 17:38:15 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/Transforms/InstCombine/2006-11-10-ashr-miscompile.ll Message-ID: <200611102338.kAANcFxN014699@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/Transforms/InstCombine: 2006-11-10-ashr-miscompile.ll added (r1.1) --- Log message: This testcase is miscompiled by instcombine, reduced from 176.gcc --- Diffs of the changes: (+7 -0) 2006-11-10-ashr-miscompile.ll | 7 +++++++ 1 files changed, 7 insertions(+) Index: llvm/test/Regression/Transforms/InstCombine/2006-11-10-ashr-miscompile.ll diff -c /dev/null llvm/test/Regression/Transforms/InstCombine/2006-11-10-ashr-miscompile.ll:1.1 *** /dev/null Fri Nov 10 17:38:04 2006 --- llvm/test/Regression/Transforms/InstCombine/2006-11-10-ashr-miscompile.ll Fri Nov 10 17:37:54 2006 *************** *** 0 **** --- 1,7 ---- + ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep lshr + ; Verify this is not turned into -1. + + int %test(ubyte %amt) { + %B = lshr int -1, ubyte %amt + ret int %B + } From sabre at nondot.org Fri Nov 10 17:39:08 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 10 Nov 2006 17:39:08 -0600 Subject: [llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp Message-ID: <200611102339.kAANd8WT015064@zion.cs.uiuc.edu> Changes in directory llvm/lib/Transforms/Scalar: InstructionCombining.cpp updated: 1.541 -> 1.542 --- Log message: Fix InstCombine/2006-11-10-ashr-miscompile.ll a miscompilation introduced by the shr -> [al]shr patch. This was reduced from 176.gcc. --- Diffs of the changes: (+3 -3) InstructionCombining.cpp | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.541 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.542 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.541 Wed Nov 8 23:12:27 2006 +++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Fri Nov 10 17:38:52 2006 @@ -5082,10 +5082,10 @@ return ReplaceInstUsesWith(I, Op0); // X >>s undef -> X } - // shr int -1, X = -1 (for any arithmetic shift rights of ~0) - if (!isLeftShift) + // ashr int -1, X = -1 (for any arithmetic shift rights of ~0) + if (I.getOpcode() == Instruction::AShr) if (ConstantInt *CSI = dyn_cast(Op0)) - if (CSI->isAllOnesValue() && Op0->getType()->isSigned()) + if (CSI->isAllOnesValue()) return ReplaceInstUsesWith(I, CSI); // Try to fold constant and into select arguments. From sabre at nondot.org Fri Nov 10 17:59:00 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 10 Nov 2006 17:59:00 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp PPCISelLowering.cpp PPCInstr64Bit.td PPCInstrFormats.td Message-ID: <200611102359.kAANx0av022712@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCISelDAGToDAG.cpp updated: 1.216 -> 1.217 PPCISelLowering.cpp updated: 1.222 -> 1.223 PPCInstr64Bit.td updated: 1.22 -> 1.23 PPCInstrFormats.td updated: 1.82 -> 1.83 --- Log message: implement preinc support for r+i loads on ppc64 --- Diffs of the changes: (+71 -17) PPCISelDAGToDAG.cpp | 31 +++++++++++++++++++++++-------- PPCISelLowering.cpp | 11 ++++++++++- PPCInstr64Bit.td | 42 ++++++++++++++++++++++++++++++++++++++---- PPCInstrFormats.td | 4 ---- 4 files changed, 71 insertions(+), 17 deletions(-) Index: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp diff -u llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.216 llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.217 --- llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.216 Thu Nov 9 20:08:47 2006 +++ llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Fri Nov 10 17:58:44 2006 @@ -830,14 +830,29 @@ unsigned Opcode; bool isSExt = LD->getExtensionType() == ISD::SEXTLOAD; - assert(!isSExt || LoadedVT == MVT::i16 && "Invalid sext update load"); - switch (LoadedVT) { - default: assert(0 && "Invalid PPC load type!"); - case MVT::f64: Opcode = PPC::LFDU; break; - case MVT::f32: Opcode = PPC::LFSU; break; - case MVT::i32: Opcode = PPC::LWZU; break; - case MVT::i16: Opcode = isSExt ? PPC::LHAU : PPC::LHZU; break; - case MVT::i8: Opcode = PPC::LBZU; break; + if (LD->getValueType(0) != MVT::i64) { + // Handle PPC32 integer and normal FP loads. + assert(!isSExt || LoadedVT == MVT::i16 && "Invalid sext update load"); + switch (LoadedVT) { + default: assert(0 && "Invalid PPC load type!"); + case MVT::f64: Opcode = PPC::LFDU; break; + case MVT::f32: Opcode = PPC::LFSU; break; + case MVT::i32: Opcode = PPC::LWZU; break; + case MVT::i16: Opcode = isSExt ? PPC::LHAU : PPC::LHZU; break; + case MVT::i1: + case MVT::i8: Opcode = PPC::LBZU; break; + } + } else { + assert(LD->getValueType(0) == MVT::i64 && "Unknown load result type!"); + assert(!isSExt || LoadedVT == MVT::i16 && "Invalid sext update load"); + switch (LoadedVT) { + default: assert(0 && "Invalid PPC load type!"); + case MVT::i64: Opcode = PPC::LDU; break; + case MVT::i32: Opcode = PPC::LWZU8; break; + case MVT::i16: Opcode = isSExt ? PPC::LHAU8 : PPC::LHZU8; break; + case MVT::i1: + case MVT::i8: Opcode = PPC::LBZU8; break; + } } SDOperand Offset = LD->getOffset(); Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.222 llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.223 --- llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.222 Thu Nov 9 20:08:47 2006 +++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp Fri Nov 10 17:58:44 2006 @@ -53,9 +53,15 @@ // PowerPC does not have truncstore for i1. setStoreXAction(MVT::i1, Promote); - // PowerPC has i32 and i64 pre-inc load and store's. + // PowerPC has pre-inc load and store's. + setIndexedLoadAction(ISD::PRE_INC, MVT::i1, Legal); + setIndexedLoadAction(ISD::PRE_INC, MVT::i8, Legal); + setIndexedLoadAction(ISD::PRE_INC, MVT::i16, Legal); setIndexedLoadAction(ISD::PRE_INC, MVT::i32, Legal); setIndexedLoadAction(ISD::PRE_INC, MVT::i64, Legal); + setIndexedStoreAction(ISD::PRE_INC, MVT::i1, Legal); + setIndexedStoreAction(ISD::PRE_INC, MVT::i8, Legal); + setIndexedStoreAction(ISD::PRE_INC, MVT::i16, Legal); setIndexedStoreAction(ISD::PRE_INC, MVT::i32, Legal); setIndexedStoreAction(ISD::PRE_INC, MVT::i64, Legal); @@ -870,6 +876,9 @@ SDOperand Ptr; if (LoadSDNode *LD = dyn_cast(N)) { Ptr = LD->getBasePtr(); + + // FIXME: PPC has no LWAU! + } else if (StoreSDNode *ST = dyn_cast(N)) { ST = ST; //Ptr = ST->getBasePtr(); Index: llvm/lib/Target/PowerPC/PPCInstr64Bit.td diff -u llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.22 llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.23 --- llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.22 Fri Oct 13 16:14:26 2006 +++ llvm/lib/Target/PowerPC/PPCInstr64Bit.td Fri Nov 10 17:58:45 2006 @@ -229,8 +229,8 @@ // -let isLoad = 1, PPC970_Unit = 2 in { // Sign extending loads. +let isLoad = 1, PPC970_Unit = 2 in { def LHA8: DForm_1<42, (ops G8RC:$rD, memri:$src), "lha $rD, $src", LdStLHA, [(set G8RC:$rD, (sextloadi16 iaddr:$src))]>, @@ -248,7 +248,17 @@ [(set G8RC:$rD, (sextloadi32 xaddr:$src))]>, isPPC64, PPC970_DGroup_Cracked; +// Update forms. +def LHAU8 : DForm_1<43, (ops G8RC:$rD, ptr_rc:$rA_result, i32imm:$disp, + ptr_rc:$rA), + "lhau $rD, $disp($rA)", LdStGeneral, + []>, RegConstraint<"$rA = $rA_result">; +// NO LWAU! + +} + // Zero extending loads. +let isLoad = 1, PPC970_Unit = 2 in { def LBZ8 : DForm_1<34, (ops G8RC:$rD, memri:$src), "lbz $rD, $src", LdStGeneral, [(set G8RC:$rD, (zextloadi8 iaddr:$src))]>; @@ -268,20 +278,44 @@ def LWZX8 : XForm_1<31, 23, (ops G8RC:$rD, memrr:$src), "lwzx $rD, $src", LdStGeneral, [(set G8RC:$rD, (zextloadi32 xaddr:$src))]>; + + +// Update forms. +def LBZU8 : DForm_1<35, (ops G8RC:$rD, ptr_rc:$rA_result, i32imm:$disp, + ptr_rc:$rA), + "lbzu $rD, $disp($rA)", LdStGeneral, + []>, RegConstraint<"$rA = $rA_result">; +def LHZU8 : DForm_1<41, (ops G8RC:$rD, ptr_rc:$rA_result, i32imm:$disp, + ptr_rc:$rA), + "lhzu $rD, $disp($rA)", LdStGeneral, + []>, RegConstraint<"$rA = $rA_result">; +def LWZU8 : DForm_1<33, (ops G8RC:$rD, ptr_rc:$rA_result, i32imm:$disp, + ptr_rc:$rA), + "lwzu $rD, $disp($rA)", LdStGeneral, + []>, RegConstraint<"$rA = $rA_result">; + +} // Full 8-byte loads. -def LD : DSForm_2<58, 0, (ops G8RC:$rD, memrix:$src), +let isLoad = 1, PPC970_Unit = 2 in { +def LD : DSForm_1<58, 0, (ops G8RC:$rD, memrix:$src), "ld $rD, $src", LdStLD, [(set G8RC:$rD, (load ixaddr:$src))]>, isPPC64; def LDX : XForm_1<31, 21, (ops G8RC:$rD, memrr:$src), "ldx $rD, $src", LdStLD, [(set G8RC:$rD, (load xaddr:$src))]>, isPPC64; + +def LDU : DSForm_1<58, 1, (ops G8RC:$rD, ptr_rc:$rA_result, i32imm:$disp, + ptr_rc:$rA), + "ldu $rD, $disp($rA)", LdStLD, + []>, RegConstraint<"$rA = $rA_result">, isPPC64; + } let isStore = 1, noResults = 1, PPC970_Unit = 2 in { // Normal stores. -def STD : DSForm_2<62, 0, (ops G8RC:$rS, memrix:$dst), +def STD : DSForm_1<62, 0, (ops G8RC:$rS, memrix:$dst), "std $rS, $dst", LdStSTD, [(store G8RC:$rS, ixaddr:$dst)]>, isPPC64; def STDX : XForm_8<31, 149, (ops G8RC:$rS, memrr:$dst), @@ -293,7 +327,7 @@ []>, isPPC64; // STD_32/STDX_32 - Just like STD/STDX, but uses a '32-bit' input register. -def STD_32 : DSForm_2<62, 0, (ops GPRC:$rT, memrix:$dst), +def STD_32 : DSForm_1<62, 0, (ops GPRC:$rT, memrix:$dst), "std $rT, $dst", LdStSTD, [(PPCstd_32 GPRC:$rT, ixaddr:$dst)]>, isPPC64; def STDX_32 : XForm_8<31, 149, (ops GPRC:$rT, memrr:$dst), Index: llvm/lib/Target/PowerPC/PPCInstrFormats.td diff -u llvm/lib/Target/PowerPC/PPCInstrFormats.td:1.82 llvm/lib/Target/PowerPC/PPCInstrFormats.td:1.83 --- llvm/lib/Target/PowerPC/PPCInstrFormats.td:1.82 Fri Nov 10 11:51:02 2006 +++ llvm/lib/Target/PowerPC/PPCInstrFormats.td Fri Nov 10 17:58:45 2006 @@ -191,10 +191,6 @@ let Inst{30-31} = xo; } -class DSForm_2 opcode, bits<2> xo, dag OL, string asmstr, - InstrItinClass itin, list pattern> - : DSForm_1; - // 1.7.6 X-Form class XForm_base_r3xo opcode, bits<10> xo, dag OL, string asmstr, InstrItinClass itin, list pattern> From reid at x10sys.com Fri Nov 10 18:00:48 2006 From: reid at x10sys.com (Reid Spencer) Date: Fri, 10 Nov 2006 18:00:48 -0600 Subject: [llvm-commits] CVS: llvm/Makefile.rules Message-ID: <200611110000.kAB00mqZ023320@zion.cs.uiuc.edu> Changes in directory llvm: Makefile.rules updated: 1.408 -> 1.409 --- Log message: Allow ENABLE_OPTIMIZED=0 to turn off optimization (turn on debug). --- Diffs of the changes: (+1 -1) Makefile.rules | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/Makefile.rules diff -u llvm/Makefile.rules:1.408 llvm/Makefile.rules:1.409 --- llvm/Makefile.rules:1.408 Thu Nov 2 14:25:49 2006 +++ llvm/Makefile.rules Fri Nov 10 18:00:31 2006 @@ -213,7 +213,7 @@ C.Flags := $(OPTIMIZE_OPTION) -pg -g LD.Flags := $(OPTIMIZE_OPTION) -pg -g else - ifdef ENABLE_OPTIMIZED + ifeq ($(ENABLE_OPTIMIZED),1) BuildMode := Release # Don't use -fomit-frame-pointer on Darwin or FreeBSD. ifneq ($(OS),FreeBSD) From sabre at nondot.org Fri Nov 10 18:08:59 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 10 Nov 2006 18:08:59 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelLowering.cpp Message-ID: <200611110008.kAB08xXH025011@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCISelLowering.cpp updated: 1.223 -> 1.224 --- Log message: ppc64 doesn't have lwau, don't attempt to form it. --- Diffs of the changes: (+9 -3) PPCISelLowering.cpp | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) Index: llvm/lib/Target/PowerPC/PPCISelLowering.cpp diff -u llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.223 llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.224 --- llvm/lib/Target/PowerPC/PPCISelLowering.cpp:1.223 Fri Nov 10 17:58:44 2006 +++ llvm/lib/Target/PowerPC/PPCISelLowering.cpp Fri Nov 10 18:08:42 2006 @@ -876,9 +876,6 @@ SDOperand Ptr; if (LoadSDNode *LD = dyn_cast(N)) { Ptr = LD->getBasePtr(); - - // FIXME: PPC has no LWAU! - } else if (StoreSDNode *ST = dyn_cast(N)) { ST = ST; //Ptr = ST->getBasePtr(); @@ -891,6 +888,15 @@ // TODO: Handle reg+reg. if (!SelectAddressRegImm(Ptr, Offset, Base, DAG)) return false; + + // PPC64 doesn't have lwau, but it does have lwaux. Reject preinc load of + // sext i32 to i64 when addr mode is r+i. + if (LoadSDNode *LD = dyn_cast(N)) { + if (LD->getValueType(0) == MVT::i64 && LD->getLoadedVT() == MVT::i32 && + LD->getExtensionType() == ISD::SEXTLOAD && + isa(Offset)) + return false; + } AM = ISD::PRE_INC; return true; From sabre at nondot.org Fri Nov 10 18:13:23 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 10 Nov 2006 18:13:23 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/CodeGen/PowerPC/mem_update.ll Message-ID: <200611110013.kAB0DN63025927@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/CodeGen/PowerPC: mem_update.ll updated: 1.2 -> 1.3 --- Log message: enable this test, check ppc64 as well. --- Diffs of the changes: (+4 -4) mem_update.ll | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) Index: llvm/test/Regression/CodeGen/PowerPC/mem_update.ll diff -u llvm/test/Regression/CodeGen/PowerPC/mem_update.ll:1.2 llvm/test/Regression/CodeGen/PowerPC/mem_update.ll:1.3 --- llvm/test/Regression/CodeGen/PowerPC/mem_update.ll:1.2 Thu Nov 9 20:04:52 2006 +++ llvm/test/Regression/CodeGen/PowerPC/mem_update.ll Fri Nov 10 18:13:07 2006 @@ -1,7 +1,7 @@ -; RUN: llvm-as < %s | llc -march=ppc32 && -; RUN: llvm-as < %s | llc -march=ppc32 | not grep addi - -; XFAIL: * +; RUN: llvm-as < %s | llc -march=ppc32 -enable-ppc-preinc && +; RUN: llvm-as < %s | llc -march=ppc32 -enable-ppc-preinc | not grep addi && +; RUN: llvm-as < %s | llc -march=ppc64 -enable-ppc-preinc && +; RUN: llvm-as < %s | llc -march=ppc64 -enable-ppc-preinc | not grep addi int *%test0(int *%X, int *%dest) { %Y = getelementptr int* %X, int 4 From sabre at nondot.org Fri Nov 10 18:39:57 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 10 Nov 2006 18:39:57 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200611110039.kAB0dvHe007480@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.249 -> 1.250 --- Log message: move big chunks of code out-of-line, no functionality change. --- Diffs of the changes: (+241 -235) DAGCombiner.cpp | 476 ++++++++++++++++++++++++++++---------------------------- 1 files changed, 241 insertions(+), 235 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.249 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.250 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.249 Fri Nov 10 15:37:15 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Fri Nov 10 18:39:41 2006 @@ -178,241 +178,10 @@ return true; } - /// CombineToPreIndexedLoadStore - Try turning a load / store and a - /// pre-indexed load / store when the base pointer is a add or subtract - /// and it has other uses besides the load / store. After the - /// transformation, the new indexed load / store has effectively folded - /// the add / subtract in and all of its other uses are redirected to the - /// new load / store. - bool CombineToPreIndexedLoadStore(SDNode *N) { - if (!AfterLegalize) - return false; - - bool isLoad = true; - SDOperand Ptr; - MVT::ValueType VT; - if (LoadSDNode *LD = dyn_cast(N)) { - VT = LD->getLoadedVT(); - if (!TLI.isIndexedLoadLegal(ISD::PRE_INC, VT) && - !TLI.isIndexedLoadLegal(ISD::PRE_DEC, VT)) - return false; - Ptr = LD->getBasePtr(); - } else if (StoreSDNode *ST = dyn_cast(N)) { - VT = ST->getStoredVT(); - if (!TLI.isIndexedStoreLegal(ISD::PRE_INC, VT) && - !TLI.isIndexedStoreLegal(ISD::PRE_DEC, VT)) - return false; - Ptr = ST->getBasePtr(); - isLoad = false; - } else - return false; - - if ((Ptr.getOpcode() == ISD::ADD || Ptr.getOpcode() == ISD::SUB) && - Ptr.Val->use_size() > 1) { - SDOperand BasePtr; - SDOperand Offset; - ISD::MemIndexedMode AM = ISD::UNINDEXED; - if (TLI.getPreIndexedAddressParts(N, BasePtr, Offset, AM, DAG)) { - // Try turning it into a pre-indexed load / store except when - // 1) If N is a store and the ptr is either the same as or is a - // predecessor of the value being stored. - // 2) Another use of base ptr is a predecessor of N. If ptr is folded - // that would create a cycle. - // 3) All uses are load / store ops that use it as base ptr. - - // Checking #1. - if (!isLoad) { - SDOperand Val = cast(N)->getValue(); - if (Val == Ptr || Ptr.Val->isPredecessor(Val.Val)) - return false; - } - - // Now check for #2 and #3. - bool RealUse = false; - for (SDNode::use_iterator I = Ptr.Val->use_begin(), - E = Ptr.Val->use_end(); I != E; ++I) { - SDNode *Use = *I; - if (Use == N) - continue; - if (Use->isPredecessor(N)) - return false; - - if (!((Use->getOpcode() == ISD::LOAD && - cast(Use)->getBasePtr() == Ptr) || - (Use->getOpcode() == ISD::STORE) && - cast(Use)->getBasePtr() == Ptr)) - RealUse = true; - } - if (!RealUse) - return false; - - SDOperand Result = isLoad - ? DAG.getIndexedLoad(SDOperand(N,0), BasePtr, Offset, AM) - : DAG.getIndexedStore(SDOperand(N,0), BasePtr, Offset, AM); - ++PreIndexedNodes; - ++NodesCombined; - DEBUG(std::cerr << "\nReplacing.4 "; N->dump(); - std::cerr << "\nWith: "; Result.Val->dump(&DAG); - std::cerr << '\n'); - std::vector NowDead; - if (isLoad) { - DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 0), Result.getValue(0), - NowDead); - DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 1), Result.getValue(2), - NowDead); - } else { - DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 0), Result.getValue(1), - NowDead); - } - - // Nodes can end up on the worklist more than once. Make sure we do - // not process a node that has been replaced. - for (unsigned i = 0, e = NowDead.size(); i != e; ++i) - removeFromWorkList(NowDead[i]); - // Finally, since the node is now dead, remove it from the graph. - DAG.DeleteNode(N); - - // Replace the uses of Ptr with uses of the updated base value. - DAG.ReplaceAllUsesOfValueWith(Ptr, Result.getValue(isLoad ? 1 : 0), - NowDead); - removeFromWorkList(Ptr.Val); - for (unsigned i = 0, e = NowDead.size(); i != e; ++i) - removeFromWorkList(NowDead[i]); - DAG.DeleteNode(Ptr.Val); - - return true; - } - } - return false; - } - - /// CombineToPostIndexedLoadStore - Try combine a load / store with a - /// add / sub of the base pointer node into a post-indexed load / store. - /// The transformation folded the add / subtract into the new indexed - /// load / store effectively and all of its uses are redirected to the - /// new load / store. - bool CombineToPostIndexedLoadStore(SDNode *N) { - if (!AfterLegalize) - return false; - - bool isLoad = true; - SDOperand Ptr; - MVT::ValueType VT; - if (LoadSDNode *LD = dyn_cast(N)) { - VT = LD->getLoadedVT(); - if (!TLI.isIndexedLoadLegal(ISD::POST_INC, VT) && - !TLI.isIndexedLoadLegal(ISD::POST_DEC, VT)) - return false; - Ptr = LD->getBasePtr(); - } else if (StoreSDNode *ST = dyn_cast(N)) { - VT = ST->getStoredVT(); - if (!TLI.isIndexedStoreLegal(ISD::POST_INC, VT) && - !TLI.isIndexedStoreLegal(ISD::POST_DEC, VT)) - return false; - Ptr = ST->getBasePtr(); - isLoad = false; - } else - return false; - - if (Ptr.Val->use_size() > 1) { - for (SDNode::use_iterator I = Ptr.Val->use_begin(), - E = Ptr.Val->use_end(); I != E; ++I) { - SDNode *Op = *I; - if (Op == N || - (Op->getOpcode() != ISD::ADD && Op->getOpcode() != ISD::SUB)) - continue; - - SDOperand BasePtr; - SDOperand Offset; - ISD::MemIndexedMode AM = ISD::UNINDEXED; - if (TLI.getPostIndexedAddressParts(N, Op, BasePtr, Offset, AM, DAG)) { - if (Ptr == Offset) - std::swap(BasePtr, Offset); - if (Ptr != BasePtr) - continue; - - // Try turning it into a post-indexed load / store except when - // 1) All uses are load / store ops that use it as base ptr. - // 2) Op must be independent of N, i.e. Op is neither a predecessor - // nor a successor of N. Otherwise, if Op is folded that would - // create a cycle. - - // Check for #1. - bool TryNext = false; - for (SDNode::use_iterator II = BasePtr.Val->use_begin(), - EE = BasePtr.Val->use_end(); II != EE; ++II) { - SDNode *Use = *II; - if (Use == Ptr.Val) - continue; - - // If all the uses are load / store addresses, then don't do the - // transformation. - if (Use->getOpcode() == ISD::ADD || Use->getOpcode() == ISD::SUB){ - bool RealUse = false; - for (SDNode::use_iterator III = Use->use_begin(), - EEE = Use->use_end(); III != EEE; ++III) { - SDNode *UseUse = *III; - if (!((UseUse->getOpcode() == ISD::LOAD && - cast(UseUse)->getBasePtr().Val == Use) || - (UseUse->getOpcode() == ISD::STORE) && - cast(UseUse)->getBasePtr().Val == Use)) - RealUse = true; - } - - if (!RealUse) { - TryNext = true; - break; - } - } - } - if (TryNext) - continue; - - // Check for #2 - if (!Op->isPredecessor(N) && !N->isPredecessor(Op)) { - SDOperand Result = isLoad - ? DAG.getIndexedLoad(SDOperand(N,0), BasePtr, Offset, AM) - : DAG.getIndexedStore(SDOperand(N,0), BasePtr, Offset, AM); - ++PostIndexedNodes; - ++NodesCombined; - DEBUG(std::cerr << "\nReplacing.5 "; N->dump(); - std::cerr << "\nWith: "; Result.Val->dump(&DAG); - std::cerr << '\n'); - std::vector NowDead; - if (isLoad) { - DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 0), Result.getValue(0), - NowDead); - DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 1), Result.getValue(2), - NowDead); - } else { - DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 0), Result.getValue(1), - NowDead); - } - - // Nodes can end up on the worklist more than once. Make sure we do - // not process a node that has been replaced. - for (unsigned i = 0, e = NowDead.size(); i != e; ++i) - removeFromWorkList(NowDead[i]); - // Finally, since the node is now dead, remove it from the graph. - DAG.DeleteNode(N); - - // Replace the uses of Use with uses of the updated base value. - DAG.ReplaceAllUsesOfValueWith(SDOperand(Op, 0), - Result.getValue(isLoad ? 1 : 0), - NowDead); - removeFromWorkList(Op); - for (unsigned i = 0, e = NowDead.size(); i != e; ++i) - removeFromWorkList(NowDead[i]); - DAG.DeleteNode(Op); - - return true; - } - } - } - } - return false; - } - + bool CombineToPreIndexedLoadStore(SDNode *N); + bool CombineToPostIndexedLoadStore(SDNode *N); + + /// visit - call the node-specific routine that knows how to fold each /// particular type of node. SDOperand visit(SDNode *N); @@ -2938,6 +2707,243 @@ return SDOperand(); } + +/// CombineToPreIndexedLoadStore - Try turning a load / store and a +/// pre-indexed load / store when the base pointer is a add or subtract +/// and it has other uses besides the load / store. After the +/// transformation, the new indexed load / store has effectively folded +/// the add / subtract in and all of its other uses are redirected to the +/// new load / store. +bool DAGCombiner::CombineToPreIndexedLoadStore(SDNode *N) { + if (!AfterLegalize) + return false; + + bool isLoad = true; + SDOperand Ptr; + MVT::ValueType VT; + if (LoadSDNode *LD = dyn_cast(N)) { + VT = LD->getLoadedVT(); + if (!TLI.isIndexedLoadLegal(ISD::PRE_INC, VT) && + !TLI.isIndexedLoadLegal(ISD::PRE_DEC, VT)) + return false; + Ptr = LD->getBasePtr(); + } else if (StoreSDNode *ST = dyn_cast(N)) { + VT = ST->getStoredVT(); + if (!TLI.isIndexedStoreLegal(ISD::PRE_INC, VT) && + !TLI.isIndexedStoreLegal(ISD::PRE_DEC, VT)) + return false; + Ptr = ST->getBasePtr(); + isLoad = false; + } else + return false; + + if ((Ptr.getOpcode() == ISD::ADD || Ptr.getOpcode() == ISD::SUB) && + Ptr.Val->use_size() > 1) { + SDOperand BasePtr; + SDOperand Offset; + ISD::MemIndexedMode AM = ISD::UNINDEXED; + if (TLI.getPreIndexedAddressParts(N, BasePtr, Offset, AM, DAG)) { + // Try turning it into a pre-indexed load / store except when + // 1) If N is a store and the ptr is either the same as or is a + // predecessor of the value being stored. + // 2) Another use of base ptr is a predecessor of N. If ptr is folded + // that would create a cycle. + // 3) All uses are load / store ops that use it as base ptr. + + // Checking #1. + if (!isLoad) { + SDOperand Val = cast(N)->getValue(); + if (Val == Ptr || Ptr.Val->isPredecessor(Val.Val)) + return false; + } + + // Now check for #2 and #3. + bool RealUse = false; + for (SDNode::use_iterator I = Ptr.Val->use_begin(), + E = Ptr.Val->use_end(); I != E; ++I) { + SDNode *Use = *I; + if (Use == N) + continue; + if (Use->isPredecessor(N)) + return false; + + if (!((Use->getOpcode() == ISD::LOAD && + cast(Use)->getBasePtr() == Ptr) || + (Use->getOpcode() == ISD::STORE) && + cast(Use)->getBasePtr() == Ptr)) + RealUse = true; + } + if (!RealUse) + return false; + + SDOperand Result = isLoad + ? DAG.getIndexedLoad(SDOperand(N,0), BasePtr, Offset, AM) + : DAG.getIndexedStore(SDOperand(N,0), BasePtr, Offset, AM); + ++PreIndexedNodes; + ++NodesCombined; + DEBUG(std::cerr << "\nReplacing.4 "; N->dump(); + std::cerr << "\nWith: "; Result.Val->dump(&DAG); + std::cerr << '\n'); + std::vector NowDead; + if (isLoad) { + DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 0), Result.getValue(0), + NowDead); + DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 1), Result.getValue(2), + NowDead); + } else { + DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 0), Result.getValue(1), + NowDead); + } + + // Nodes can end up on the worklist more than once. Make sure we do + // not process a node that has been replaced. + for (unsigned i = 0, e = NowDead.size(); i != e; ++i) + removeFromWorkList(NowDead[i]); + // Finally, since the node is now dead, remove it from the graph. + DAG.DeleteNode(N); + + // Replace the uses of Ptr with uses of the updated base value. + DAG.ReplaceAllUsesOfValueWith(Ptr, Result.getValue(isLoad ? 1 : 0), + NowDead); + removeFromWorkList(Ptr.Val); + for (unsigned i = 0, e = NowDead.size(); i != e; ++i) + removeFromWorkList(NowDead[i]); + DAG.DeleteNode(Ptr.Val); + + return true; + } + } + return false; +} + +/// CombineToPostIndexedLoadStore - Try combine a load / store with a +/// add / sub of the base pointer node into a post-indexed load / store. +/// The transformation folded the add / subtract into the new indexed +/// load / store effectively and all of its uses are redirected to the +/// new load / store. +bool DAGCombiner::CombineToPostIndexedLoadStore(SDNode *N) { + if (!AfterLegalize) + return false; + + bool isLoad = true; + SDOperand Ptr; + MVT::ValueType VT; + if (LoadSDNode *LD = dyn_cast(N)) { + VT = LD->getLoadedVT(); + if (!TLI.isIndexedLoadLegal(ISD::POST_INC, VT) && + !TLI.isIndexedLoadLegal(ISD::POST_DEC, VT)) + return false; + Ptr = LD->getBasePtr(); + } else if (StoreSDNode *ST = dyn_cast(N)) { + VT = ST->getStoredVT(); + if (!TLI.isIndexedStoreLegal(ISD::POST_INC, VT) && + !TLI.isIndexedStoreLegal(ISD::POST_DEC, VT)) + return false; + Ptr = ST->getBasePtr(); + isLoad = false; + } else + return false; + + if (Ptr.Val->use_size() > 1) { + for (SDNode::use_iterator I = Ptr.Val->use_begin(), + E = Ptr.Val->use_end(); I != E; ++I) { + SDNode *Op = *I; + if (Op == N || + (Op->getOpcode() != ISD::ADD && Op->getOpcode() != ISD::SUB)) + continue; + + SDOperand BasePtr; + SDOperand Offset; + ISD::MemIndexedMode AM = ISD::UNINDEXED; + if (TLI.getPostIndexedAddressParts(N, Op, BasePtr, Offset, AM, DAG)) { + if (Ptr == Offset) + std::swap(BasePtr, Offset); + if (Ptr != BasePtr) + continue; + + // Try turning it into a post-indexed load / store except when + // 1) All uses are load / store ops that use it as base ptr. + // 2) Op must be independent of N, i.e. Op is neither a predecessor + // nor a successor of N. Otherwise, if Op is folded that would + // create a cycle. + + // Check for #1. + bool TryNext = false; + for (SDNode::use_iterator II = BasePtr.Val->use_begin(), + EE = BasePtr.Val->use_end(); II != EE; ++II) { + SDNode *Use = *II; + if (Use == Ptr.Val) + continue; + + // If all the uses are load / store addresses, then don't do the + // transformation. + if (Use->getOpcode() == ISD::ADD || Use->getOpcode() == ISD::SUB){ + bool RealUse = false; + for (SDNode::use_iterator III = Use->use_begin(), + EEE = Use->use_end(); III != EEE; ++III) { + SDNode *UseUse = *III; + if (!((UseUse->getOpcode() == ISD::LOAD && + cast(UseUse)->getBasePtr().Val == Use) || + (UseUse->getOpcode() == ISD::STORE) && + cast(UseUse)->getBasePtr().Val == Use)) + RealUse = true; + } + + if (!RealUse) { + TryNext = true; + break; + } + } + } + if (TryNext) + continue; + + // Check for #2 + if (!Op->isPredecessor(N) && !N->isPredecessor(Op)) { + SDOperand Result = isLoad + ? DAG.getIndexedLoad(SDOperand(N,0), BasePtr, Offset, AM) + : DAG.getIndexedStore(SDOperand(N,0), BasePtr, Offset, AM); + ++PostIndexedNodes; + ++NodesCombined; + DEBUG(std::cerr << "\nReplacing.5 "; N->dump(); + std::cerr << "\nWith: "; Result.Val->dump(&DAG); + std::cerr << '\n'); + std::vector NowDead; + if (isLoad) { + DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 0), Result.getValue(0), + NowDead); + DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 1), Result.getValue(2), + NowDead); + } else { + DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 0), Result.getValue(1), + NowDead); + } + + // Nodes can end up on the worklist more than once. Make sure we do + // not process a node that has been replaced. + for (unsigned i = 0, e = NowDead.size(); i != e; ++i) + removeFromWorkList(NowDead[i]); + // Finally, since the node is now dead, remove it from the graph. + DAG.DeleteNode(N); + + // Replace the uses of Use with uses of the updated base value. + DAG.ReplaceAllUsesOfValueWith(SDOperand(Op, 0), + Result.getValue(isLoad ? 1 : 0), + NowDead); + removeFromWorkList(Op); + for (unsigned i = 0, e = NowDead.size(); i != e; ++i) + removeFromWorkList(NowDead[i]); + DAG.DeleteNode(Op); + + return true; + } + } + } + } + return false; +} + + SDOperand DAGCombiner::visitLOAD(SDNode *N) { LoadSDNode *LD = cast(N); SDOperand Chain = LD->getChain(); From dpatel at apple.com Fri Nov 10 18:42:33 2006 From: dpatel at apple.com (Devang Patel) Date: Fri, 10 Nov 2006 18:42:33 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/PassManager.h Message-ID: <200611110042.kAB0gXQd009442@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: PassManager.h updated: 1.27 -> 1.28 --- Log message: Keep track of analysis required by the passes. Force use of new pass manager if a pass does not preserve analysis that is used by other passes. --- Diffs of the changes: (+2 -2) PassManager.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/include/llvm/PassManager.h diff -u llvm/include/llvm/PassManager.h:1.27 llvm/include/llvm/PassManager.h:1.28 --- llvm/include/llvm/PassManager.h:1.27 Fri Nov 10 15:33:13 2006 +++ llvm/include/llvm/PassManager.h Fri Nov 10 18:42:16 2006 @@ -119,8 +119,8 @@ void removeDeadPasses() { /* TODO : Implement */ } private: - // Required set of analysis for the passes managed by this manager - std::vector RequiredSet; + // Analysis required by the passes managed by this manager + std::vector RequiredAnalysis; }; /// PassManager_New manages ModulePassManagers From dpatel at apple.com Fri Nov 10 18:42:33 2006 From: dpatel at apple.com (Devang Patel) Date: Fri, 10 Nov 2006 18:42:33 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200611110042.kAB0gXBl009447@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.11 -> 1.12 --- Log message: Keep track of analysis required by the passes. Force use of new pass manager if a pass does not preserve analysis that is used by other passes. --- Diffs of the changes: (+18 -5) PassManager.cpp | 23 ++++++++++++++++++----- 1 files changed, 18 insertions(+), 5 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.11 llvm/lib/VMCore/PassManager.cpp:1.12 --- llvm/lib/VMCore/PassManager.cpp:1.11 Fri Nov 10 15:33:13 2006 +++ llvm/lib/VMCore/PassManager.cpp Fri Nov 10 18:42:16 2006 @@ -142,9 +142,18 @@ AnalysisUsage AnUsage; P->getAnalysisUsage(AnUsage); - // If this pass is not preserving information that is required by the other passes - // managed by this manager then use new manager - // TODO + // If this pass is not preserving information that is required by the other + // passes managed by this manager then use new manager + if (!AnUsage.getPreservesAll()) { + const std::vector &PreservedSet = AnUsage.getPreservedSet(); + for (std::vector::iterator I = RequiredAnalysis.begin(), + E = RequiredAnalysis.end(); I != E; ++I) { + if (std::find(PreservedSet.begin(), PreservedSet.end(), *I) == + PreservedSet.end()) + // This analysis is not preserved. Need new manager. + return false; + } + } return true; } @@ -157,8 +166,12 @@ /// Augment RequiredSet by adding analysis required by pass P. void CommonPassManagerImpl::noteDownRequiredAnalysis(Pass *P) { + AnalysisUsage AnUsage; + P->getAnalysisUsage(AnUsage); + const std::vector &RequiredSet = AnUsage.getRequiredSet(); - // TODO + // FIXME: What about duplicates ? + RequiredAnalysis.insert(RequiredAnalysis.end(), RequiredSet.begin(), RequiredSet.end()); } /// Remove AnalysisID from the RequiredSet @@ -375,7 +388,7 @@ bool PassManagerImpl_New::addPass(Pass *P) { - if (!activeManager) { + if (!activeManager || !activeManager->addPass(P)) { activeManager = new ModulePassManager_New(); PassManagers.push_back(activeManager); } From sabre at nondot.org Fri Nov 10 18:56:45 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 10 Nov 2006 18:56:45 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200611110056.kAB0ujo4012109@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.250 -> 1.251 --- Log message: reduce indentation by using early exits. No functionality change. --- Diffs of the changes: (+163 -156) DAGCombiner.cpp | 319 ++++++++++++++++++++++++++++---------------------------- 1 files changed, 163 insertions(+), 156 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.250 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.251 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.250 Fri Nov 10 18:39:41 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Fri Nov 10 18:56:29 2006 @@ -2737,83 +2737,89 @@ } else return false; - if ((Ptr.getOpcode() == ISD::ADD || Ptr.getOpcode() == ISD::SUB) && - Ptr.Val->use_size() > 1) { - SDOperand BasePtr; - SDOperand Offset; - ISD::MemIndexedMode AM = ISD::UNINDEXED; - if (TLI.getPreIndexedAddressParts(N, BasePtr, Offset, AM, DAG)) { - // Try turning it into a pre-indexed load / store except when - // 1) If N is a store and the ptr is either the same as or is a - // predecessor of the value being stored. - // 2) Another use of base ptr is a predecessor of N. If ptr is folded - // that would create a cycle. - // 3) All uses are load / store ops that use it as base ptr. - - // Checking #1. - if (!isLoad) { - SDOperand Val = cast(N)->getValue(); - if (Val == Ptr || Ptr.Val->isPredecessor(Val.Val)) - return false; - } - - // Now check for #2 and #3. - bool RealUse = false; - for (SDNode::use_iterator I = Ptr.Val->use_begin(), - E = Ptr.Val->use_end(); I != E; ++I) { - SDNode *Use = *I; - if (Use == N) - continue; - if (Use->isPredecessor(N)) - return false; + // If the pointer is not an add/sub, or if it doesn't have multiple uses, bail + // out. There is no reason to make this a preinc/predec. + if ((Ptr.getOpcode() != ISD::ADD && Ptr.getOpcode() != ISD::SUB) || + Ptr.Val->hasOneUse()) + return false; - if (!((Use->getOpcode() == ISD::LOAD && - cast(Use)->getBasePtr() == Ptr) || - (Use->getOpcode() == ISD::STORE) && - cast(Use)->getBasePtr() == Ptr)) - RealUse = true; - } - if (!RealUse) - return false; - - SDOperand Result = isLoad - ? DAG.getIndexedLoad(SDOperand(N,0), BasePtr, Offset, AM) - : DAG.getIndexedStore(SDOperand(N,0), BasePtr, Offset, AM); - ++PreIndexedNodes; - ++NodesCombined; - DEBUG(std::cerr << "\nReplacing.4 "; N->dump(); - std::cerr << "\nWith: "; Result.Val->dump(&DAG); - std::cerr << '\n'); - std::vector NowDead; - if (isLoad) { - DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 0), Result.getValue(0), - NowDead); - DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 1), Result.getValue(2), - NowDead); - } else { - DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 0), Result.getValue(1), - NowDead); - } + // Ask the target to do addressing mode selection. + SDOperand BasePtr; + SDOperand Offset; + ISD::MemIndexedMode AM = ISD::UNINDEXED; + if (!TLI.getPreIndexedAddressParts(N, BasePtr, Offset, AM, DAG)) + return false; + + // Try turning it into a pre-indexed load / store except when + // 1) If N is a store and the ptr is either the same as or is a + // predecessor of the value being stored. + // 2) Another use of base ptr is a predecessor of N. If ptr is folded + // that would create a cycle. + // 3) All uses are load / store ops that use it as base ptr. + + // Checking #1. + if (!isLoad) { + SDOperand Val = cast(N)->getValue(); + if (Val == Ptr || Ptr.Val->isPredecessor(Val.Val)) + return false; + } - // Nodes can end up on the worklist more than once. Make sure we do - // not process a node that has been replaced. - for (unsigned i = 0, e = NowDead.size(); i != e; ++i) - removeFromWorkList(NowDead[i]); - // Finally, since the node is now dead, remove it from the graph. - DAG.DeleteNode(N); - - // Replace the uses of Ptr with uses of the updated base value. - DAG.ReplaceAllUsesOfValueWith(Ptr, Result.getValue(isLoad ? 1 : 0), - NowDead); - removeFromWorkList(Ptr.Val); - for (unsigned i = 0, e = NowDead.size(); i != e; ++i) - removeFromWorkList(NowDead[i]); - DAG.DeleteNode(Ptr.Val); + // Now check for #2 and #3. + bool RealUse = false; + for (SDNode::use_iterator I = Ptr.Val->use_begin(), + E = Ptr.Val->use_end(); I != E; ++I) { + SDNode *Use = *I; + if (Use == N) + continue; + if (Use->isPredecessor(N)) + return false; - return true; - } + if (!((Use->getOpcode() == ISD::LOAD && + cast(Use)->getBasePtr() == Ptr) || + (Use->getOpcode() == ISD::STORE) && + cast(Use)->getBasePtr() == Ptr)) + RealUse = true; } - return false; + if (!RealUse) + return false; + + SDOperand Result; + if (isLoad) + Result = DAG.getIndexedLoad(SDOperand(N,0), BasePtr, Offset, AM); + else + Result = DAG.getIndexedStore(SDOperand(N,0), BasePtr, Offset, AM); + ++PreIndexedNodes; + ++NodesCombined; + DEBUG(std::cerr << "\nReplacing.4 "; N->dump(); + std::cerr << "\nWith: "; Result.Val->dump(&DAG); + std::cerr << '\n'); + std::vector NowDead; + if (isLoad) { + DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 0), Result.getValue(0), + NowDead); + DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 1), Result.getValue(2), + NowDead); + } else { + DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 0), Result.getValue(1), + NowDead); + } + + // Nodes can end up on the worklist more than once. Make sure we do + // not process a node that has been replaced. + for (unsigned i = 0, e = NowDead.size(); i != e; ++i) + removeFromWorkList(NowDead[i]); + // Finally, since the node is now dead, remove it from the graph. + DAG.DeleteNode(N); + + // Replace the uses of Ptr with uses of the updated base value. + DAG.ReplaceAllUsesOfValueWith(Ptr, Result.getValue(isLoad ? 1 : 0), + NowDead); + removeFromWorkList(Ptr.Val); + for (unsigned i = 0, e = NowDead.size(); i != e; ++i) + removeFromWorkList(NowDead[i]); + DAG.DeleteNode(Ptr.Val); + + return true; } /// CombineToPostIndexedLoadStore - Try combine a load / store with a @@ -2844,99 +2850,100 @@ } else return false; - if (Ptr.Val->use_size() > 1) { - for (SDNode::use_iterator I = Ptr.Val->use_begin(), - E = Ptr.Val->use_end(); I != E; ++I) { - SDNode *Op = *I; - if (Op == N || - (Op->getOpcode() != ISD::ADD && Op->getOpcode() != ISD::SUB)) + if (!Ptr.Val->hasOneUse()) + return false; + + for (SDNode::use_iterator I = Ptr.Val->use_begin(), + E = Ptr.Val->use_end(); I != E; ++I) { + SDNode *Op = *I; + if (Op == N || + (Op->getOpcode() != ISD::ADD && Op->getOpcode() != ISD::SUB)) + continue; + + SDOperand BasePtr; + SDOperand Offset; + ISD::MemIndexedMode AM = ISD::UNINDEXED; + if (TLI.getPostIndexedAddressParts(N, Op, BasePtr, Offset, AM, DAG)) { + if (Ptr == Offset) + std::swap(BasePtr, Offset); + if (Ptr != BasePtr) continue; - SDOperand BasePtr; - SDOperand Offset; - ISD::MemIndexedMode AM = ISD::UNINDEXED; - if (TLI.getPostIndexedAddressParts(N, Op, BasePtr, Offset, AM, DAG)) { - if (Ptr == Offset) - std::swap(BasePtr, Offset); - if (Ptr != BasePtr) + // Try turning it into a post-indexed load / store except when + // 1) All uses are load / store ops that use it as base ptr. + // 2) Op must be independent of N, i.e. Op is neither a predecessor + // nor a successor of N. Otherwise, if Op is folded that would + // create a cycle. + + // Check for #1. + bool TryNext = false; + for (SDNode::use_iterator II = BasePtr.Val->use_begin(), + EE = BasePtr.Val->use_end(); II != EE; ++II) { + SDNode *Use = *II; + if (Use == Ptr.Val) continue; - // Try turning it into a post-indexed load / store except when - // 1) All uses are load / store ops that use it as base ptr. - // 2) Op must be independent of N, i.e. Op is neither a predecessor - // nor a successor of N. Otherwise, if Op is folded that would - // create a cycle. - - // Check for #1. - bool TryNext = false; - for (SDNode::use_iterator II = BasePtr.Val->use_begin(), - EE = BasePtr.Val->use_end(); II != EE; ++II) { - SDNode *Use = *II; - if (Use == Ptr.Val) - continue; - - // If all the uses are load / store addresses, then don't do the - // transformation. - if (Use->getOpcode() == ISD::ADD || Use->getOpcode() == ISD::SUB){ - bool RealUse = false; - for (SDNode::use_iterator III = Use->use_begin(), - EEE = Use->use_end(); III != EEE; ++III) { - SDNode *UseUse = *III; - if (!((UseUse->getOpcode() == ISD::LOAD && - cast(UseUse)->getBasePtr().Val == Use) || - (UseUse->getOpcode() == ISD::STORE) && - cast(UseUse)->getBasePtr().Val == Use)) - RealUse = true; - } - - if (!RealUse) { - TryNext = true; - break; - } + // If all the uses are load / store addresses, then don't do the + // transformation. + if (Use->getOpcode() == ISD::ADD || Use->getOpcode() == ISD::SUB){ + bool RealUse = false; + for (SDNode::use_iterator III = Use->use_begin(), + EEE = Use->use_end(); III != EEE; ++III) { + SDNode *UseUse = *III; + if (!((UseUse->getOpcode() == ISD::LOAD && + cast(UseUse)->getBasePtr().Val == Use) || + (UseUse->getOpcode() == ISD::STORE) && + cast(UseUse)->getBasePtr().Val == Use)) + RealUse = true; } - } - if (TryNext) - continue; - // Check for #2 - if (!Op->isPredecessor(N) && !N->isPredecessor(Op)) { - SDOperand Result = isLoad - ? DAG.getIndexedLoad(SDOperand(N,0), BasePtr, Offset, AM) - : DAG.getIndexedStore(SDOperand(N,0), BasePtr, Offset, AM); - ++PostIndexedNodes; - ++NodesCombined; - DEBUG(std::cerr << "\nReplacing.5 "; N->dump(); - std::cerr << "\nWith: "; Result.Val->dump(&DAG); - std::cerr << '\n'); - std::vector NowDead; - if (isLoad) { - DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 0), Result.getValue(0), - NowDead); - DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 1), Result.getValue(2), - NowDead); - } else { - DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 0), Result.getValue(1), - NowDead); + if (!RealUse) { + TryNext = true; + break; } + } + } + if (TryNext) + continue; - // Nodes can end up on the worklist more than once. Make sure we do - // not process a node that has been replaced. - for (unsigned i = 0, e = NowDead.size(); i != e; ++i) - removeFromWorkList(NowDead[i]); - // Finally, since the node is now dead, remove it from the graph. - DAG.DeleteNode(N); - - // Replace the uses of Use with uses of the updated base value. - DAG.ReplaceAllUsesOfValueWith(SDOperand(Op, 0), - Result.getValue(isLoad ? 1 : 0), + // Check for #2 + if (!Op->isPredecessor(N) && !N->isPredecessor(Op)) { + SDOperand Result = isLoad + ? DAG.getIndexedLoad(SDOperand(N,0), BasePtr, Offset, AM) + : DAG.getIndexedStore(SDOperand(N,0), BasePtr, Offset, AM); + ++PostIndexedNodes; + ++NodesCombined; + DEBUG(std::cerr << "\nReplacing.5 "; N->dump(); + std::cerr << "\nWith: "; Result.Val->dump(&DAG); + std::cerr << '\n'); + std::vector NowDead; + if (isLoad) { + DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 0), Result.getValue(0), + NowDead); + DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 1), Result.getValue(2), + NowDead); + } else { + DAG.ReplaceAllUsesOfValueWith(SDOperand(N, 0), Result.getValue(1), NowDead); - removeFromWorkList(Op); - for (unsigned i = 0, e = NowDead.size(); i != e; ++i) - removeFromWorkList(NowDead[i]); - DAG.DeleteNode(Op); - - return true; } + + // Nodes can end up on the worklist more than once. Make sure we do + // not process a node that has been replaced. + for (unsigned i = 0, e = NowDead.size(); i != e; ++i) + removeFromWorkList(NowDead[i]); + // Finally, since the node is now dead, remove it from the graph. + DAG.DeleteNode(N); + + // Replace the uses of Use with uses of the updated base value. + DAG.ReplaceAllUsesOfValueWith(SDOperand(Op, 0), + Result.getValue(isLoad ? 1 : 0), + NowDead); + removeFromWorkList(Op); + for (unsigned i = 0, e = NowDead.size(); i != e; ++i) + removeFromWorkList(NowDead[i]); + DAG.DeleteNode(Op); + + return true; } } } From sabre at nondot.org Fri Nov 10 19:00:31 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 10 Nov 2006 19:00:31 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Message-ID: <200611110100.kAB10VVL013247@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: DAGCombiner.cpp updated: 1.251 -> 1.252 --- Log message: disallow preinc of a frameindex. This is not profitable and causes 2-addr pass to explode. This fixes a bunch of llc-beta failures on ppc last night. --- Diffs of the changes: (+11 -5) DAGCombiner.cpp | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp diff -u llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.251 llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.252 --- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1.251 Fri Nov 10 18:56:29 2006 +++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Fri Nov 10 19:00:15 2006 @@ -2750,14 +2750,20 @@ if (!TLI.getPreIndexedAddressParts(N, BasePtr, Offset, AM, DAG)) return false; - // Try turning it into a pre-indexed load / store except when - // 1) If N is a store and the ptr is either the same as or is a + // Try turning it into a pre-indexed load / store except when: + // 1) The base is a frame index. + // 2) If N is a store and the ptr is either the same as or is a // predecessor of the value being stored. - // 2) Another use of base ptr is a predecessor of N. If ptr is folded + // 3) Another use of base ptr is a predecessor of N. If ptr is folded // that would create a cycle. - // 3) All uses are load / store ops that use it as base ptr. + // 4) All uses are load / store ops that use it as base ptr. - // Checking #1. + // Check #1. Preinc'ing a frame index would require copying the stack pointer + // (plus the implicit offset) to a register to preinc anyway. + if (isa(BasePtr)) + return false; + + // Check #2. if (!isLoad) { SDOperand Val = cast(N)->getValue(); if (Val == Ptr || Ptr.Val->isPredecessor(Val.Val)) From reid at x10sys.com Fri Nov 10 19:03:01 2006 From: reid at x10sys.com (Reid Spencer) Date: Fri, 10 Nov 2006 19:03:01 -0600 Subject: [llvm-commits] CVS: llvm/test/Makefile Message-ID: <200611110103.kAB1318I013847@zion.cs.uiuc.edu> Changes in directory llvm/test: Makefile updated: 1.90 -> 1.91 --- Log message: Enable path completion when typing the TESTSUITE= option by allowing the test directory to precede the test suite name. That is, it will strip off test/ from TESTSUITE which allows path completion from the command line. --- Diffs of the changes: (+1 -0) Makefile | 1 + 1 files changed, 1 insertion(+) Index: llvm/test/Makefile diff -u llvm/test/Makefile:1.90 llvm/test/Makefile:1.91 --- llvm/test/Makefile:1.90 Mon Jul 31 19:07:58 2006 +++ llvm/test/Makefile Fri Nov 10 19:02:45 2006 @@ -24,6 +24,7 @@ ifdef TESTSUITE CLEANED_TESTSUITE := $(patsubst %/,%,$(TESTSUITE)) +CLEANED_TESTSUITE := $(patsubst test/%,%,$(CLEANED_TESTSUITE)) RUNTESTFLAGS := --tool $(CLEANED_TESTSUITE) endif From reid at x10sys.com Fri Nov 10 19:04:27 2006 From: reid at x10sys.com (Reid Spencer) Date: Fri, 10 Nov 2006 19:04:27 -0600 Subject: [llvm-commits] CVS: llvm/test/Scripts/notcast Message-ID: <200611110104.kAB14Rjt014265@zion.cs.uiuc.edu> Changes in directory llvm/test/Scripts: notcast updated: 1.3 -> 1.4 --- Log message: Instruction name changes. --- Diffs of the changes: (+1 -1) notcast | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/Scripts/notcast diff -u llvm/test/Scripts/notcast:1.3 llvm/test/Scripts/notcast:1.4 --- llvm/test/Scripts/notcast:1.3 Fri Nov 3 19:11:19 2006 +++ llvm/test/Scripts/notcast Fri Nov 10 19:04:13 2006 @@ -10,7 +10,7 @@ # prepat - optionally allow a regular expression to go at the start # -if grep "$2"'\(\([sz]ext\)\|\(trunc\)\|\(fp2[us]int\)\|\([us]int2fp\)\|\(bitconvert\)\|\(fpext\)\|\(fptrunc\)\)'"$1" +if grep "$2"'\(\([sz]ext\)\|\(trunc\)\|\(fpto[us]i\)\|\([us]itofp\)\|\(bitconvert\)\|\(fpext\)\|\(fptrunc\)\)'"$1" then exit 1 else exit 0 fi From dpatel at apple.com Fri Nov 10 19:10:36 2006 From: dpatel at apple.com (Devang Patel) Date: Fri, 10 Nov 2006 19:10:36 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/PassManager.h Message-ID: <200611110110.kAB1Aauu014392@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: PassManager.h updated: 1.28 -> 1.29 --- Log message: Keep track if analysis made available by the pass. --- Diffs of the changes: (+8 -1) PassManager.h | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletion(-) Index: llvm/include/llvm/PassManager.h diff -u llvm/include/llvm/PassManager.h:1.28 llvm/include/llvm/PassManager.h:1.29 --- llvm/include/llvm/PassManager.h:1.28 Fri Nov 10 18:42:16 2006 +++ llvm/include/llvm/PassManager.h Fri Nov 10 19:10:19 2006 @@ -19,6 +19,7 @@ #include "llvm/Pass.h" #include +#include namespace llvm { @@ -106,9 +107,12 @@ /// Return true IFF AnalysisID AID is currently available. bool analysisCurrentlyAvailable(AnalysisID AID); - /// Augment RequiredSet by adding analysis required by pass P. + /// Augment RequiredAnalysis by adding analysis required by pass P. void noteDownRequiredAnalysis(Pass *P); + /// Augment AvailableAnalysis by adding analysis made available by pass P. + void noteDownAvailableAnalysis(Pass *P); + /// Remove AnalysisID from the RequiredSet void removeAnalysis(AnalysisID AID); @@ -121,6 +125,9 @@ private: // Analysis required by the passes managed by this manager std::vector RequiredAnalysis; + + // set of available Analysis + std::set AvailableAnalysis; }; /// PassManager_New manages ModulePassManagers From dpatel at apple.com Fri Nov 10 19:10:36 2006 From: dpatel at apple.com (Devang Patel) Date: Fri, 10 Nov 2006 19:10:36 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200611110110.kAB1Aa9j014397@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.12 -> 1.13 --- Log message: Keep track if analysis made available by the pass. --- Diffs of the changes: (+22 -4) PassManager.cpp | 26 ++++++++++++++++++++++---- 1 files changed, 22 insertions(+), 4 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.12 llvm/lib/VMCore/PassManager.cpp:1.13 --- llvm/lib/VMCore/PassManager.cpp:1.12 Fri Nov 10 18:42:16 2006 +++ llvm/lib/VMCore/PassManager.cpp Fri Nov 10 19:10:19 2006 @@ -164,7 +164,7 @@ return false; } -/// Augment RequiredSet by adding analysis required by pass P. +/// Augment RequiredAnalysis by adding analysis required by pass P. void CommonPassManagerImpl::noteDownRequiredAnalysis(Pass *P) { AnalysisUsage AnUsage; P->getAnalysisUsage(AnUsage); @@ -174,6 +174,21 @@ RequiredAnalysis.insert(RequiredAnalysis.end(), RequiredSet.begin(), RequiredSet.end()); } +/// Augement AvailableAnalysis by adding analysis made available by pass P. +void CommonPassManagerImpl::noteDownAvailableAnalysis(Pass *P) { + + if (const PassInfo *PI = P->getPassInfo()) { + AvailableAnalysis.insert(PI); + + //TODO This pass is the current implementation of all of the interfaces it + //TODO implements as well. + //TODO + //TODO const std::vector &II = PI->getInterfacesImplemented(); + //TODO for (unsigned i = 0, e = II.size(); i != e; ++i) + //TODO CurrentAnalyses[II[i]] = P; + } +} + /// Remove AnalysisID from the RequiredSet void CommonPassManagerImpl::removeAnalysis(AnalysisID AID) { @@ -202,8 +217,9 @@ if (!manageablePass(P)) return false; - // Take a note of analysis required by this pass. + // Take a note of analysis required and made available by this pass noteDownRequiredAnalysis(P); + noteDownAvailableAnalysis(P); // Add pass PassVector.push_back(BP); @@ -285,8 +301,9 @@ if (!manageablePass(P)) return false; - // Take a note of analysis required by this pass. + // Take a note of analysis required and made available by this pass noteDownRequiredAnalysis(P); + noteDownAvailableAnalysis(P); PassVector.push_back(FP); activeBBPassManager = NULL; @@ -345,8 +362,9 @@ if (!manageablePass(P)) return false; - // Take a note of analysis required by this pass. + // Take a note of analysis required and made available by this pass noteDownRequiredAnalysis(P); + noteDownAvailableAnalysis(P); PassVector.push_back(MP); activeFunctionPassManager = NULL; From dpatel at apple.com Fri Nov 10 19:25:09 2006 From: dpatel at apple.com (Devang Patel) Date: Fri, 10 Nov 2006 19:25:09 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200611110125.kAB1P98V014693@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.13 -> 1.14 --- Log message: Remove analysis that is not preserved by the pass from AvailableAnalysis. --- Diffs of the changes: (+28 -3) PassManager.cpp | 31 ++++++++++++++++++++++++++++--- 1 files changed, 28 insertions(+), 3 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.13 llvm/lib/VMCore/PassManager.cpp:1.14 --- llvm/lib/VMCore/PassManager.cpp:1.13 Fri Nov 10 19:10:19 2006 +++ llvm/lib/VMCore/PassManager.cpp Fri Nov 10 19:24:55 2006 @@ -171,7 +171,8 @@ const std::vector &RequiredSet = AnUsage.getRequiredSet(); // FIXME: What about duplicates ? - RequiredAnalysis.insert(RequiredAnalysis.end(), RequiredSet.begin(), RequiredSet.end()); + RequiredAnalysis.insert(RequiredAnalysis.end(), RequiredSet.begin(), + RequiredSet.end()); } /// Augement AvailableAnalysis by adding analysis made available by pass P. @@ -197,8 +198,20 @@ /// Remove Analyss not preserved by Pass P void CommonPassManagerImpl::removeNotPreservedAnalysis(Pass *P) { - - // TODO + AnalysisUsage AnUsage; + P->getAnalysisUsage(AnUsage); + const std::vector &PreservedSet = AnUsage.getPreservedSet(); + + for (std::set::iterator I = AvailableAnalysis.begin(), + E = AvailableAnalysis.end(); I != E; ++I ) { + AnalysisID AID = *I; + if (std::find(PreservedSet.begin(), PreservedSet.end(), *I) == + PreservedSet.end()) { + // Remove this analysis + std::set::iterator J = I++; + AvailableAnalysis.erase(J); + } + } } /// BasicBlockPassManager implementation @@ -223,6 +236,10 @@ // Add pass PassVector.push_back(BP); + + // Remove the analysis not preserved by this pass + removeNotPreservedAnalysis(P); + return true; } @@ -306,6 +323,10 @@ noteDownAvailableAnalysis(P); PassVector.push_back(FP); + + // Remove the analysis not preserved by this pass + removeNotPreservedAnalysis(P); + activeBBPassManager = NULL; return true; } @@ -367,6 +388,10 @@ noteDownAvailableAnalysis(P); PassVector.push_back(MP); + + // Remove the analysis not preserved by this pass + removeNotPreservedAnalysis(P); + activeFunctionPassManager = NULL; return true; } From dpatel at apple.com Fri Nov 10 19:31:22 2006 From: dpatel at apple.com (Devang Patel) Date: Fri, 10 Nov 2006 19:31:22 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/PassManager.h Message-ID: <200611110131.kAB1VMOD014801@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: PassManager.h updated: 1.29 -> 1.30 --- Log message: Move CommonPassManagerImpl from PassManager.h to PassManager.cpp --- Diffs of the changes: (+2 -41) PassManager.h | 43 ++----------------------------------------- 1 files changed, 2 insertions(+), 41 deletions(-) Index: llvm/include/llvm/PassManager.h diff -u llvm/include/llvm/PassManager.h:1.29 llvm/include/llvm/PassManager.h:1.30 --- llvm/include/llvm/PassManager.h:1.29 Fri Nov 10 19:10:19 2006 +++ llvm/include/llvm/PassManager.h Fri Nov 10 19:31:05 2006 @@ -18,8 +18,6 @@ #define LLVM_PASSMANAGER_H #include "llvm/Pass.h" -#include -#include namespace llvm { @@ -93,45 +91,8 @@ class PassManagerImpl_New; class FunctionPassManagerImpl_New; -/// CommonPassManagerImpl helps pass manager analysis required by -/// the managed passes. It provides methods to add/remove analysis -/// available and query if certain analysis is available or not. -class CommonPassManagerImpl : public Pass{ - -public: - - /// Return true IFF pass P's required analysis set does not required new - /// manager. - bool manageablePass(Pass *P); - - /// Return true IFF AnalysisID AID is currently available. - bool analysisCurrentlyAvailable(AnalysisID AID); - - /// Augment RequiredAnalysis by adding analysis required by pass P. - void noteDownRequiredAnalysis(Pass *P); - - /// Augment AvailableAnalysis by adding analysis made available by pass P. - void noteDownAvailableAnalysis(Pass *P); - - /// Remove AnalysisID from the RequiredSet - void removeAnalysis(AnalysisID AID); - - /// Remove Analysis that is not preserved by the pass - void removeNotPreservedAnalysis(Pass *P); - - /// Remove dead passes - void removeDeadPasses() { /* TODO : Implement */ } - -private: - // Analysis required by the passes managed by this manager - std::vector RequiredAnalysis; - - // set of available Analysis - std::set AvailableAnalysis; -}; - /// PassManager_New manages ModulePassManagers -class PassManager_New : public CommonPassManagerImpl { +class PassManager_New { public: @@ -156,7 +117,7 @@ }; /// FunctionPassManager_New manages FunctionPasses and BasicBlockPassManagers. -class FunctionPassManager_New : public CommonPassManagerImpl { +class FunctionPassManager_New { public: FunctionPassManager_New(ModuleProvider *P) { /* TODO */ } FunctionPassManager_New(); From dpatel at apple.com Fri Nov 10 19:31:22 2006 From: dpatel at apple.com (Devang Patel) Date: Fri, 10 Nov 2006 19:31:22 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200611110131.kAB1VMSg014796@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.14 -> 1.15 --- Log message: Move CommonPassManagerImpl from PassManager.h to PassManager.cpp --- Diffs of the changes: (+39 -0) PassManager.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 39 insertions(+) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.14 llvm/lib/VMCore/PassManager.cpp:1.15 --- llvm/lib/VMCore/PassManager.cpp:1.14 Fri Nov 10 19:24:55 2006 +++ llvm/lib/VMCore/PassManager.cpp Fri Nov 10 19:31:05 2006 @@ -14,11 +14,50 @@ #include "llvm/PassManager.h" #include "llvm/Module.h" +#include +#include using namespace llvm; namespace llvm { +/// CommonPassManagerImpl helps pass manager analysis required by +/// the managed passes. It provides methods to add/remove analysis +/// available and query if certain analysis is available or not. +class CommonPassManagerImpl : public Pass { + +public: + + /// Return true IFF pass P's required analysis set does not required new + /// manager. + bool manageablePass(Pass *P); + + /// Return true IFF AnalysisID AID is currently available. + bool analysisCurrentlyAvailable(AnalysisID AID); + + /// Augment RequiredAnalysis by adding analysis required by pass P. + void noteDownRequiredAnalysis(Pass *P); + + /// Augment AvailableAnalysis by adding analysis made available by pass P. + void noteDownAvailableAnalysis(Pass *P); + + /// Remove AnalysisID from the RequiredSet + void removeAnalysis(AnalysisID AID); + + /// Remove Analysis that is not preserved by the pass + void removeNotPreservedAnalysis(Pass *P); + + /// Remove dead passes + void removeDeadPasses() { /* TODO : Implement */ } + +private: + // Analysis required by the passes managed by this manager + std::vector RequiredAnalysis; + + // set of available Analysis + std::set AvailableAnalysis; +}; + /// BasicBlockPassManager_New manages BasicBlockPass. It batches all the /// pass together and sequence them to process one basic block before /// processing next basic block. From dpatel at apple.com Fri Nov 10 19:51:16 2006 From: dpatel at apple.com (Devang Patel) Date: Fri, 10 Nov 2006 19:51:16 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200611110151.kAB1pGfm015163@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.15 -> 1.16 --- Log message: Code refactoring. Move common code into CommonPassManagerImpl :) --- Diffs of the changes: (+41 -49) PassManager.cpp | 90 +++++++++++++++++++++++++------------------------------- 1 files changed, 41 insertions(+), 49 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.15 llvm/lib/VMCore/PassManager.cpp:1.16 --- llvm/lib/VMCore/PassManager.cpp:1.15 Fri Nov 10 19:31:05 2006 +++ llvm/lib/VMCore/PassManager.cpp Fri Nov 10 19:51:02 2006 @@ -50,12 +50,27 @@ /// Remove dead passes void removeDeadPasses() { /* TODO : Implement */ } + /// Add pass P into the PassVector. Update RequiredAnalysis and + /// AvailableAnalysis appropriately + void addPassToManager (Pass *P); + + inline std::vector::iterator passVectorBegin() { + return PassVector.begin(); + } + + inline std::vector::iterator passVectorEnd() { + return PassVector.end(); + } + private: // Analysis required by the passes managed by this manager std::vector RequiredAnalysis; // set of available Analysis std::set AvailableAnalysis; + + // Collection of pass that are managed by this manager + std::vector PassVector; }; /// BasicBlockPassManager_New manages BasicBlockPass. It batches all the @@ -74,8 +89,6 @@ bool runOnFunction(Function &F); private: - // Collection of pass that are managed by this manager - std::vector PassVector; }; /// FunctionPassManagerImpl_New manages FunctionPasses and BasicBlockPassManagers. @@ -106,9 +119,6 @@ bool runOnModule(Module &M); private: - // Collection of pass that are manged by this manager - std::vector PassVector; - // Active Pass Managers BasicBlockPassManager_New *activeBBPassManager; }; @@ -129,9 +139,6 @@ bool runOnModule(Module &M); private: - // Collection of pass that are managed by this manager - std::vector PassVector; - // Active Pass Manager FunctionPassManagerImpl_New *activeFunctionPassManager; }; @@ -163,9 +170,6 @@ // Collection of pass managers std::vector PassManagers; - // Collection of pass that are not yet scheduled - std::vector PassVector; - // Active Pass Manager ModulePassManager_New *activeManager; }; @@ -243,7 +247,6 @@ for (std::set::iterator I = AvailableAnalysis.begin(), E = AvailableAnalysis.end(); I != E; ++I ) { - AnalysisID AID = *I; if (std::find(PreservedSet.begin(), PreservedSet.end(), *I) == PreservedSet.end()) { // Remove this analysis @@ -253,6 +256,21 @@ } } +/// Add pass P into the PassVector. Update RequiredAnalysis and +/// AvailableAnalysis appropriately +void CommonPassManagerImpl::addPassToManager (Pass *P) { + + // Take a note of analysis required and made available by this pass + noteDownRequiredAnalysis(P); + noteDownAvailableAnalysis(P); + + // Add pass + PassVector.push_back(P); + + // Remove the analysis not preserved by this pass + removeNotPreservedAnalysis(P); +} + /// BasicBlockPassManager implementation /// Add pass P into PassVector and return true. If this pass is not @@ -269,15 +287,7 @@ if (!manageablePass(P)) return false; - // Take a note of analysis required and made available by this pass - noteDownRequiredAnalysis(P); - noteDownAvailableAnalysis(P); - - // Add pass - PassVector.push_back(BP); - - // Remove the analysis not preserved by this pass - removeNotPreservedAnalysis(P); + addPassToManager (BP); return true; } @@ -290,8 +300,8 @@ bool Changed = false; for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I) - for (std::vector::iterator itr = PassVector.begin(), - e = PassVector.end(); itr != e; ++itr) { + for (std::vector::iterator itr = passVectorBegin(), + e = passVectorEnd(); itr != e; ++itr) { Pass *P = *itr; BasicBlockPass *BP = dynamic_cast(P); Changed |= BP->runOnBasicBlock(*I); @@ -340,8 +350,7 @@ || !activeBBPassManager->addPass(BP)) { activeBBPassManager = new BasicBlockPassManager_New(); - - PassVector.push_back(activeBBPassManager); + addPassToManager(activeBBPassManager); if (!activeBBPassManager->addPass(BP)) assert(0 && "Unable to add Pass"); } @@ -357,15 +366,7 @@ if (!manageablePass(P)) return false; - // Take a note of analysis required and made available by this pass - noteDownRequiredAnalysis(P); - noteDownAvailableAnalysis(P); - - PassVector.push_back(FP); - - // Remove the analysis not preserved by this pass - removeNotPreservedAnalysis(P); - + addPassToManager (FP); activeBBPassManager = NULL; return true; } @@ -378,8 +379,8 @@ bool Changed = false; for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - for (std::vector::iterator itr = PassVector.begin(), - e = PassVector.end(); itr != e; ++itr) { + for (std::vector::iterator itr = passVectorBegin(), + e = passVectorEnd(); itr != e; ++itr) { Pass *P = *itr; FunctionPass *FP = dynamic_cast(P); Changed |= FP->runOnFunction(*I); @@ -405,8 +406,7 @@ || !activeFunctionPassManager->addPass(P)) { activeFunctionPassManager = new FunctionPassManagerImpl_New(); - - PassVector.push_back(activeFunctionPassManager); + addPassToManager(activeFunctionPassManager); if (!activeFunctionPassManager->addPass(FP)) assert(0 && "Unable to add pass"); } @@ -422,15 +422,7 @@ if (!manageablePass(P)) return false; - // Take a note of analysis required and made available by this pass - noteDownRequiredAnalysis(P); - noteDownAvailableAnalysis(P); - - PassVector.push_back(MP); - - // Remove the analysis not preserved by this pass - removeNotPreservedAnalysis(P); - + addPassToManager(MP); activeFunctionPassManager = NULL; return true; } @@ -442,8 +434,8 @@ bool ModulePassManager_New::runOnModule(Module &M) { bool Changed = false; - for (std::vector::iterator itr = PassVector.begin(), - e = PassVector.end(); itr != e; ++itr) { + for (std::vector::iterator itr = passVectorBegin(), + e = passVectorEnd(); itr != e; ++itr) { Pass *P = *itr; ModulePass *MP = dynamic_cast(P); Changed |= MP->runOnModule(M); From dpatel at apple.com Fri Nov 10 19:56:53 2006 From: dpatel at apple.com (Devang Patel) Date: Fri, 10 Nov 2006 19:56:53 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200611110156.kAB1urHC015281@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.16 -> 1.17 --- Log message: Remove dead code. --- Diffs of the changes: (+0 -9) PassManager.cpp | 9 --------- 1 files changed, 9 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.16 llvm/lib/VMCore/PassManager.cpp:1.17 --- llvm/lib/VMCore/PassManager.cpp:1.16 Fri Nov 10 19:51:02 2006 +++ llvm/lib/VMCore/PassManager.cpp Fri Nov 10 19:56:39 2006 @@ -41,9 +41,6 @@ /// Augment AvailableAnalysis by adding analysis made available by pass P. void noteDownAvailableAnalysis(Pass *P); - /// Remove AnalysisID from the RequiredSet - void removeAnalysis(AnalysisID AID); - /// Remove Analysis that is not preserved by the pass void removeNotPreservedAnalysis(Pass *P); @@ -233,12 +230,6 @@ } } -/// Remove AnalysisID from the RequiredSet -void CommonPassManagerImpl::removeAnalysis(AnalysisID AID) { - - // TODO -} - /// Remove Analyss not preserved by Pass P void CommonPassManagerImpl::removeNotPreservedAnalysis(Pass *P) { AnalysisUsage AnUsage; From dpatel at apple.com Fri Nov 10 20:04:33 2006 From: dpatel at apple.com (Devang Patel) Date: Fri, 10 Nov 2006 20:04:33 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200611110204.kAB24XrH015402@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.17 -> 1.18 --- Log message: While adding pass into the manager, process Analysis only if it is required to do so. --- Diffs of the changes: (+15 -12) PassManager.cpp | 27 +++++++++++++++------------ 1 files changed, 15 insertions(+), 12 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.17 llvm/lib/VMCore/PassManager.cpp:1.18 --- llvm/lib/VMCore/PassManager.cpp:1.17 Fri Nov 10 19:56:39 2006 +++ llvm/lib/VMCore/PassManager.cpp Fri Nov 10 20:04:19 2006 @@ -48,8 +48,8 @@ void removeDeadPasses() { /* TODO : Implement */ } /// Add pass P into the PassVector. Update RequiredAnalysis and - /// AvailableAnalysis appropriately - void addPassToManager (Pass *P); + /// AvailableAnalysis appropriately if ProcessAnalysis is true. + void addPassToManager (Pass *P, bool ProcessAnalysis = true); inline std::vector::iterator passVectorBegin() { return PassVector.begin(); @@ -248,18 +248,21 @@ } /// Add pass P into the PassVector. Update RequiredAnalysis and -/// AvailableAnalysis appropriately -void CommonPassManagerImpl::addPassToManager (Pass *P) { +/// AvailableAnalysis appropriately if ProcessAnalysis is true. +void CommonPassManagerImpl::addPassToManager (Pass *P, + bool ProcessAnalysis) { + + if (ProcessAnalysis) { + // Take a note of analysis required and made available by this pass + noteDownRequiredAnalysis(P); + noteDownAvailableAnalysis(P); - // Take a note of analysis required and made available by this pass - noteDownRequiredAnalysis(P); - noteDownAvailableAnalysis(P); + // Remove the analysis not preserved by this pass + removeNotPreservedAnalysis(P); + } // Add pass PassVector.push_back(P); - - // Remove the analysis not preserved by this pass - removeNotPreservedAnalysis(P); } /// BasicBlockPassManager implementation @@ -341,7 +344,7 @@ || !activeBBPassManager->addPass(BP)) { activeBBPassManager = new BasicBlockPassManager_New(); - addPassToManager(activeBBPassManager); + addPassToManager(activeBBPassManager, false); if (!activeBBPassManager->addPass(BP)) assert(0 && "Unable to add Pass"); } @@ -397,7 +400,7 @@ || !activeFunctionPassManager->addPass(P)) { activeFunctionPassManager = new FunctionPassManagerImpl_New(); - addPassToManager(activeFunctionPassManager); + addPassToManager(activeFunctionPassManager, false); if (!activeFunctionPassManager->addPass(FP)) assert(0 && "Unable to add pass"); } From dpatel at apple.com Fri Nov 10 20:06:36 2006 From: dpatel at apple.com (Devang Patel) Date: Fri, 10 Nov 2006 20:06:36 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200611110206.kAB26aXf015446@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.18 -> 1.19 --- Log message: Implement PassManagerImpl_New::add(). Just add pass into the pass manager queue without processing analysis. --- Diffs of the changes: (+1 -1) PassManager.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.18 llvm/lib/VMCore/PassManager.cpp:1.19 --- llvm/lib/VMCore/PassManager.cpp:1.18 Fri Nov 10 20:04:19 2006 +++ llvm/lib/VMCore/PassManager.cpp Fri Nov 10 20:06:21 2006 @@ -447,7 +447,7 @@ /// Add pass P to the queue of passes to run. void PassManagerImpl_New::add(Pass *P) { - /* TODO */ + addPassToManager(P, false); } // PassManager_New implementation From dpatel at apple.com Fri Nov 10 20:22:46 2006 From: dpatel at apple.com (Devang Patel) Date: Fri, 10 Nov 2006 20:22:46 -0600 Subject: [llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp Message-ID: <200611110222.kAB2Mk6D015761@zion.cs.uiuc.edu> Changes in directory llvm/lib/VMCore: PassManager.cpp updated: 1.19 -> 1.20 --- Log message: Implement schedulePasses(). --- Diffs of the changes: (+40 -9) PassManager.cpp | 49 ++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 40 insertions(+), 9 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.19 llvm/lib/VMCore/PassManager.cpp:1.20 --- llvm/lib/VMCore/PassManager.cpp:1.19 Fri Nov 10 20:06:21 2006 +++ llvm/lib/VMCore/PassManager.cpp Fri Nov 10 20:22:31 2006 @@ -160,6 +160,11 @@ /// Add a pass into a passmanager queue. This is used by schedulePasses bool addPass(Pass *p); + /// Schedule pass P for execution. Make sure that passes required by + /// P are run before P is run. Update analysis info maintained by + /// the manager. Remove dead passes. This is a recursive function. + void schedulePass(Pass *P); + /// Schedule all passes collected in pass queue using add(). Add all the /// schedule passes into various manager's queue using addPass(). void schedulePasses(); @@ -437,24 +442,51 @@ return Changed; } +/// Schedule pass P for execution. Make sure that passes required by +/// P are run before P is run. Update analysis info maintained by +/// the manager. Remove dead passes. This is a recursive function. +void PassManagerImpl_New::schedulePass(Pass *P) { + + AnalysisUsage AnUsage; + P->getAnalysisUsage(AnUsage); + const std::vector &RequiredSet = AnUsage.getRequiredSet(); + for (std::vector::const_iterator I = RequiredSet.begin(), + E = RequiredSet.end(); I != E; ++I) { + + // TODO Check if Analysis is currently available or not. + bool available = false; + if (!available) { + // Schedule this analysis run first. + Pass *AP = (*I)->createPass(); + schedulePass(AP); + } + } + + addPass(P); + + // TODO : Walk through all managers and remove not preserved analysis + // TODO : remove dead passes +} + /// Schedule all passes from the queue by adding them in their /// respective manager's queue. -void -PassManagerImpl_New::schedulePasses() { - /* TODO */ +void PassManagerImpl_New::schedulePasses() { + for (std::vector::iterator I = passVectorBegin(), + E = passVectorEnd(); I != E; ++I) + schedulePass (*I); } /// Add pass P to the queue of passes to run. -void -PassManagerImpl_New::add(Pass *P) { +void PassManagerImpl_New::add(Pass *P) { + // Do not process Analysis now. Analysis is process while scheduling + // the pass vector. addPassToManager(P, false); } // PassManager_New implementation /// Add P into active pass manager or use new module pass manager to /// manage it. -bool -PassManagerImpl_New::addPass(Pass *P) { +bool PassManagerImpl_New::addPass(Pass *P) { if (!activeManager || !activeManager->addPass(P)) { activeManager = new ModulePassManager_New(); @@ -466,8 +498,7 @@ /// run - Execute all of the passes scheduled for execution. Keep track of /// whether any of the passes modifies the module, and if so, return true. -bool -PassManagerImpl_New::run(Module &M) { +bool PassManagerImpl_New::run(Module &M) { schedulePasses(); bool Changed = false; From sabre at nondot.org Fri Nov 10 22:51:51 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 10 Nov 2006 22:51:51 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCInstr64Bit.td PPCInstrInfo.td Message-ID: <200611110451.kAB4pp5J018612@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCInstr64Bit.td updated: 1.23 -> 1.24 PPCInstrInfo.td updated: 1.256 -> 1.257 --- Log message: Mark operands as symbol lo instead of imm32 so that they print lo(x) around globals. --- Diffs of the changes: (+11 -11) PPCInstr64Bit.td | 10 +++++----- PPCInstrInfo.td | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) Index: llvm/lib/Target/PowerPC/PPCInstr64Bit.td diff -u llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.23 llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.24 --- llvm/lib/Target/PowerPC/PPCInstr64Bit.td:1.23 Fri Nov 10 17:58:45 2006 +++ llvm/lib/Target/PowerPC/PPCInstr64Bit.td Fri Nov 10 22:51:36 2006 @@ -249,7 +249,7 @@ PPC970_DGroup_Cracked; // Update forms. -def LHAU8 : DForm_1<43, (ops G8RC:$rD, ptr_rc:$rA_result, i32imm:$disp, +def LHAU8 : DForm_1<43, (ops G8RC:$rD, ptr_rc:$rA_result, symbolLo:$disp, ptr_rc:$rA), "lhau $rD, $disp($rA)", LdStGeneral, []>, RegConstraint<"$rA = $rA_result">; @@ -281,15 +281,15 @@ // Update forms. -def LBZU8 : DForm_1<35, (ops G8RC:$rD, ptr_rc:$rA_result, i32imm:$disp, +def LBZU8 : DForm_1<35, (ops G8RC:$rD, ptr_rc:$rA_result, symbolLo:$disp, ptr_rc:$rA), "lbzu $rD, $disp($rA)", LdStGeneral, []>, RegConstraint<"$rA = $rA_result">; -def LHZU8 : DForm_1<41, (ops G8RC:$rD, ptr_rc:$rA_result, i32imm:$disp, +def LHZU8 : DForm_1<41, (ops G8RC:$rD, ptr_rc:$rA_result, symbolLo:$disp, ptr_rc:$rA), "lhzu $rD, $disp($rA)", LdStGeneral, []>, RegConstraint<"$rA = $rA_result">; -def LWZU8 : DForm_1<33, (ops G8RC:$rD, ptr_rc:$rA_result, i32imm:$disp, +def LWZU8 : DForm_1<33, (ops G8RC:$rD, ptr_rc:$rA_result, symbolLo:$disp, ptr_rc:$rA), "lwzu $rD, $disp($rA)", LdStGeneral, []>, RegConstraint<"$rA = $rA_result">; @@ -306,7 +306,7 @@ "ldx $rD, $src", LdStLD, [(set G8RC:$rD, (load xaddr:$src))]>, isPPC64; -def LDU : DSForm_1<58, 1, (ops G8RC:$rD, ptr_rc:$rA_result, i32imm:$disp, +def LDU : DSForm_1<58, 1, (ops G8RC:$rD, ptr_rc:$rA_result, symbolLo:$disp, ptr_rc:$rA), "ldu $rD, $disp($rA)", LdStLD, []>, RegConstraint<"$rA = $rA_result">, isPPC64; Index: llvm/lib/Target/PowerPC/PPCInstrInfo.td diff -u llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.256 llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.257 --- llvm/lib/Target/PowerPC/PPCInstrInfo.td:1.256 Fri Nov 10 11:51:02 2006 +++ llvm/lib/Target/PowerPC/PPCInstrInfo.td Fri Nov 10 22:51:36 2006 @@ -432,31 +432,31 @@ // FIXME: PTRRC for Pointer regs for ppc64. // 'Update' load forms. -def LBZU : DForm_1<35, (ops GPRC:$rD, ptr_rc:$rA_result, i32imm:$disp, +def LBZU : DForm_1<35, (ops GPRC:$rD, ptr_rc:$rA_result, symbolLo:$disp, ptr_rc:$rA), "lbzu $rD, $disp($rA)", LdStGeneral, []>, RegConstraint<"$rA = $rA_result">; -def LHAU : DForm_1<43, (ops GPRC:$rD, ptr_rc:$rA_result, i32imm:$disp, +def LHAU : DForm_1<43, (ops GPRC:$rD, ptr_rc:$rA_result, symbolLo:$disp, ptr_rc:$rA), "lhau $rD, $disp($rA)", LdStGeneral, []>, RegConstraint<"$rA = $rA_result">; -def LHZU : DForm_1<41, (ops GPRC:$rD, ptr_rc:$rA_result, i32imm:$disp, +def LHZU : DForm_1<41, (ops GPRC:$rD, ptr_rc:$rA_result, symbolLo:$disp, ptr_rc:$rA), "lhzu $rD, $disp($rA)", LdStGeneral, []>, RegConstraint<"$rA = $rA_result">; -def LWZU : DForm_1<33, (ops GPRC:$rD, ptr_rc:$rA_result, i32imm:$disp, +def LWZU : DForm_1<33, (ops GPRC:$rD, ptr_rc:$rA_result, symbolLo:$disp, ptr_rc:$rA), "lwzu $rD, $disp($rA)", LdStGeneral, []>, RegConstraint<"$rA = $rA_result">; -def LFSU : DForm_1<49, (ops F4RC:$rD, ptr_rc:$rA_result, i32imm:$disp, +def LFSU : DForm_1<49, (ops F4RC:$rD, ptr_rc:$rA_result, symbolLo:$disp, ptr_rc:$rA), "lfs $rD, $disp($rA)", LdStLFDU, []>, RegConstraint<"$rA = $rA_result">; -def LFDU : DForm_1<51, (ops F8RC:$rD, ptr_rc:$rA_result, i32imm:$disp, +def LFDU : DForm_1<51, (ops F8RC:$rD, ptr_rc:$rA_result, symbolLo:$disp, ptr_rc:$rA), "lfd $rD, $disp($rA)", LdStLFD, []>, RegConstraint<"$rA = $rA_result">; From sabre at nondot.org Fri Nov 10 22:53:45 2006 From: sabre at nondot.org (Chris Lattner) Date: Fri, 10 Nov 2006 22:53:45 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Message-ID: <200611110453.kAB4rjd8018687@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCISelDAGToDAG.cpp updated: 1.217 -> 1.218 --- Log message: allow the offset of a preinc'd load to be the low-part of a global. This produces this clever code: _millisecs: lis r2, ha16(_Time.1182) lwzu r3, lo16(_Time.1182)(r2) lwz r2, 4(r2) addic r4, r2, 1 addze r3, r3 blr instead of this: _millisecs: lis r2, ha16(_Time.1182) la r3, lo16(_Time.1182)(r2) lwz r2, lo16(_Time.1182)(r2) lwz r3, 4(r3) addic r4, r3, 1 addze r3, r2 blr for: long %millisecs() { %tmp = load long* %Time.1182 ; [#uses=1] %tmp1 = add long %tmp, 1 ; [#uses=1] ret long %tmp1 } --- Diffs of the changes: (+2 -1) PPCISelDAGToDAG.cpp | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) Index: llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp diff -u llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.217 llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.218 --- llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:1.217 Fri Nov 10 17:58:44 2006 +++ llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp Fri Nov 10 22:53:30 2006 @@ -856,7 +856,8 @@ } SDOperand Offset = LD->getOffset(); - if (isa(Offset)) { + if (isa(Offset) || + Offset.getOpcode() == ISD::TargetGlobalAddress) { SDOperand Chain = LD->getChain(); SDOperand Base = LD->getBasePtr(); AddToISelQueue(Chain); From evan.cheng at apple.com Sat Nov 11 01:19:50 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Sat, 11 Nov 2006 01:19:50 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Message-ID: <200611110719.kAB7JorW020826@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86ISelDAGToDAG.cpp updated: 1.124 -> 1.125 --- Log message: Add all implicit defs to FP_REG_KILL mi. --- Diffs of the changes: (+6 -1) X86ISelDAGToDAG.cpp | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletion(-) Index: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp diff -u llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.124 llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.125 --- llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.124 Fri Nov 10 15:23:04 2006 +++ llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Sat Nov 11 01:19:36 2006 @@ -525,7 +525,12 @@ // Finally, if we found any FP code, emit the FP_REG_KILL instruction. if (ContainsFPCode) { - BuildMI(*BB, BB->getFirstTerminator(), X86::FP_REG_KILL, 0); + const TargetInstrDescriptor &II= TM.getInstrInfo()->get(X86::FP_REG_KILL); + MachineInstrBuilder MIB = + BuildMI(*BB, BB->getFirstTerminator(), X86::FP_REG_KILL, 0); + for (const unsigned *ImplicitDefs = II.ImplicitDefs; + *ImplicitDefs; ++ImplicitDefs) + MIB = MIB.addReg(*ImplicitDefs, true, true); ++NumFPKill; } } From evan.cheng at apple.com Sat Nov 11 04:19:17 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Sat, 11 Nov 2006 04:19:17 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/CodeGen/MachineInstr.h MachineInstrBuilder.h Message-ID: <200611111019.kABAJHU3000394@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm/CodeGen: MachineInstr.h updated: 1.194 -> 1.195 MachineInstrBuilder.h updated: 1.38 -> 1.39 --- Log message: Add methods to add implicit def use operands to a MI. --- Diffs of the changes: (+9 -0) MachineInstr.h | 4 ++++ MachineInstrBuilder.h | 5 +++++ 2 files changed, 9 insertions(+) Index: llvm/include/llvm/CodeGen/MachineInstr.h diff -u llvm/include/llvm/CodeGen/MachineInstr.h:1.194 llvm/include/llvm/CodeGen/MachineInstr.h:1.195 --- llvm/include/llvm/CodeGen/MachineInstr.h:1.194 Fri Nov 10 08:44:12 2006 +++ llvm/include/llvm/CodeGen/MachineInstr.h Sat Nov 11 04:19:03 2006 @@ -413,6 +413,10 @@ Op.offset = 0; } + /// addImplicitDefUseOperands - Add all implicit def and use operands to + /// this instruction. + void addImplicitDefUseOperands(); + //===--------------------------------------------------------------------===// // Accessors used to modify instructions in place. // Index: llvm/include/llvm/CodeGen/MachineInstrBuilder.h diff -u llvm/include/llvm/CodeGen/MachineInstrBuilder.h:1.38 llvm/include/llvm/CodeGen/MachineInstrBuilder.h:1.39 --- llvm/include/llvm/CodeGen/MachineInstrBuilder.h:1.38 Fri Nov 10 02:32:14 2006 +++ llvm/include/llvm/CodeGen/MachineInstrBuilder.h Sat Nov 11 04:19:03 2006 @@ -77,6 +77,11 @@ MI->addExternalSymbolOperand(FnName); return *this; } + + const MachineInstrBuilder &addImplicitDefsUses() const { + MI->addImplicitDefUseOperands(); + return *this; + } }; /// BuildMI - Builder interface. Specify how to create the initial instruction From evan.cheng at apple.com Sat Nov 11 04:20:19 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Sat, 11 Nov 2006 04:20:19 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp Message-ID: <200611111020.kABAKJbU000455@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen/SelectionDAG: ScheduleDAG.cpp updated: 1.107 -> 1.108 --- Log message: Add methods to add implicit def use operands to a MI. --- Diffs of the changes: (+1 -10) ScheduleDAG.cpp | 11 +---------- 1 files changed, 1 insertion(+), 10 deletions(-) Index: llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp diff -u llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.107 llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.108 --- llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp:1.107 Fri Nov 10 02:38:20 2006 +++ llvm/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp Sat Nov 11 04:20:02 2006 @@ -442,16 +442,7 @@ } // Emit implicit def / use operands. - if (II.ImplicitDefs) { - for (const unsigned *ImplicitDefs = II.ImplicitDefs; - *ImplicitDefs; ++ImplicitDefs) - MI->addRegOperand(*ImplicitDefs, true, true); - } - if (II.ImplicitUses) { - for (const unsigned *ImplicitUses = II.ImplicitUses; - *ImplicitUses; ++ImplicitUses) - MI->addRegOperand(*ImplicitUses, false, true); - } + MI->addImplicitDefUseOperands(); // Now that we have emitted all operands, emit this instruction itself. if ((II.Flags & M_USES_CUSTOM_DAG_SCHED_INSERTION) == 0) { From evan.cheng at apple.com Sat Nov 11 04:20:19 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Sat, 11 Nov 2006 04:20:19 -0600 Subject: [llvm-commits] CVS: llvm/lib/CodeGen/MachineInstr.cpp Message-ID: <200611111020.kABAKJKT000458@zion.cs.uiuc.edu> Changes in directory llvm/lib/CodeGen: MachineInstr.cpp updated: 1.128 -> 1.129 --- Log message: Add methods to add implicit def use operands to a MI. --- Diffs of the changes: (+12 -0) MachineInstr.cpp | 12 ++++++++++++ 1 files changed, 12 insertions(+) Index: llvm/lib/CodeGen/MachineInstr.cpp diff -u llvm/lib/CodeGen/MachineInstr.cpp:1.128 llvm/lib/CodeGen/MachineInstr.cpp:1.129 --- llvm/lib/CodeGen/MachineInstr.cpp:1.128 Fri Nov 10 02:38:19 2006 +++ llvm/lib/CodeGen/MachineInstr.cpp Sat Nov 11 04:20:02 2006 @@ -125,6 +125,18 @@ } } +/// addImplicitDefUseOperands - Add all implicit def and use operands to +/// this instruction. +void MachineInstr::addImplicitDefUseOperands() { + const TargetInstrDescriptor &TID = TargetInstrDescriptors[Opcode]; + if (TID.ImplicitDefs) + for (const unsigned *ImpDefs = TID.ImplicitDefs; *ImpDefs; ++ImpDefs) + addRegOperand(*ImpDefs, true, true); + if (TID.ImplicitUses) + for (const unsigned *ImpUses = TID.ImplicitUses; *ImpUses; ++ImpUses) + addRegOperand(*ImpUses, false, true); +} + void MachineInstr::dump() const { std::cerr << " " << *this; From evan.cheng at apple.com Sat Nov 11 04:21:59 2006 From: evan.cheng at apple.com (Evan Cheng) Date: Sat, 11 Nov 2006 04:21:59 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/X86/X86FloatingPoint.cpp X86ISelDAGToDAG.cpp X86ISelLowering.cpp Message-ID: <200611111021.kABALxnp000517@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/X86: X86FloatingPoint.cpp updated: 1.56 -> 1.57 X86ISelDAGToDAG.cpp updated: 1.125 -> 1.126 X86ISelLowering.cpp updated: 1.290 -> 1.291 --- Log message: Add implicit use / def operands to created MI's. --- Diffs of the changes: (+8 -10) X86FloatingPoint.cpp | 2 +- X86ISelDAGToDAG.cpp | 14 ++++++-------- X86ISelLowering.cpp | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-) Index: llvm/lib/Target/X86/X86FloatingPoint.cpp diff -u llvm/lib/Target/X86/X86FloatingPoint.cpp:1.56 llvm/lib/Target/X86/X86FloatingPoint.cpp:1.57 --- llvm/lib/Target/X86/X86FloatingPoint.cpp:1.56 Thu Nov 9 19:28:43 2006 +++ llvm/lib/Target/X86/X86FloatingPoint.cpp Sat Nov 11 04:21:44 2006 @@ -232,7 +232,7 @@ case X86II::ZeroArgFP: handleZeroArgFP(I); break; case X86II::OneArgFP: handleOneArgFP(I); break; // fstp ST(0) case X86II::OneArgFPRW: handleOneArgFPRW(I); break; // ST(0) = fsqrt(ST(0)) - case X86II::TwoArgFP: handleTwoArgFP(I); break; + case X86II::TwoArgFP: handleTwoArgFP(I); break; case X86II::CompareFP: handleCompareFP(I); break; case X86II::CondMovFP: handleCondMovFP(I); break; case X86II::SpecialFP: handleSpecialFP(I); break; Index: llvm/lib/Target/X86/X86ISelDAGToDAG.cpp diff -u llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.125 llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.126 --- llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:1.125 Sat Nov 11 01:19:36 2006 +++ llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Sat Nov 11 04:21:44 2006 @@ -525,12 +525,8 @@ // Finally, if we found any FP code, emit the FP_REG_KILL instruction. if (ContainsFPCode) { - const TargetInstrDescriptor &II= TM.getInstrInfo()->get(X86::FP_REG_KILL); - MachineInstrBuilder MIB = - BuildMI(*BB, BB->getFirstTerminator(), X86::FP_REG_KILL, 0); - for (const unsigned *ImplicitDefs = II.ImplicitDefs; - *ImplicitDefs; ++ImplicitDefs) - MIB = MIB.addReg(*ImplicitDefs, true, true); + BuildMI(*BB, BB->getFirstTerminator(), X86::FP_REG_KILL, 0). + addImplicitDefsUses(); ++NumFPKill; } } @@ -541,7 +537,8 @@ void X86DAGToDAGISel::EmitSpecialCodeForMain(MachineBasicBlock *BB, MachineFrameInfo *MFI) { if (Subtarget->isTargetCygwin()) - BuildMI(BB, X86::CALLpcrel32, 1).addExternalSymbol("__main"); + BuildMI(BB, X86::CALLpcrel32, 1).addExternalSymbol("__main"). + addImplicitDefsUses(); // Switch the FPU to 64-bit precision mode for better compatibility and speed. int CWFrameIdx = MFI->CreateStackObject(2, 2); @@ -952,7 +949,8 @@ // type of register here. GlobalBaseReg = RegMap->createVirtualRegister(X86::GR32RegisterClass); BuildMI(FirstMBB, MBBI, X86::MovePCtoStack, 0); - BuildMI(FirstMBB, MBBI, X86::POP32r, 1, GlobalBaseReg); + BuildMI(FirstMBB, MBBI, X86::POP32r, 1, GlobalBaseReg). + addImplicitDefsUses(); } return CurDAG->getRegister(GlobalBaseReg, TLI.getPointerTy()).Val; } Index: llvm/lib/Target/X86/X86ISelLowering.cpp diff -u llvm/lib/Target/X86/X86ISelLowering.cpp:1.290 llvm/lib/Target/X86/X86ISelLowering.cpp:1.291 --- llvm/lib/Target/X86/X86ISelLowering.cpp:1.290 Fri Nov 10 15:43:37 2006 +++ llvm/lib/Target/X86/X86ISelLowering.cpp Sat Nov 11 04:21:44 2006 @@ -5076,7 +5076,7 @@ MachineBasicBlock *sinkMBB = new MachineBasicBlock(LLVM_BB); unsigned Opc = X86::GetCondBranchFromCond((X86::CondCode)MI->getOperand(3).getImm()); - BuildMI(BB, Opc, 1).addMBB(sinkMBB); + BuildMI(BB, Opc, 1).addMBB(sinkMBB).addImplicitDefsUses(); MachineFunction *F = BB->getParent(); F->getBasicBlockList().insert(It, copy0MBB); F->getBasicBlockList().insert(It, sinkMBB); From jlaskey at apple.com Sat Nov 11 04:22:13 2006 From: jlaskey at apple.com (Jim Laskey) Date: Sat, 11 Nov 2006 04:22:13 -0600 Subject: [llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp Message-ID: <200611111022.kABAMDOd000528@zion.cs.uiuc.edu> Changes in directory llvm/lib/Target/PowerPC: PPCRegisterInfo.cpp updated: 1.77 -> 1.78 --- Log message: Running with frame pointers prevented debugging, external probes and potentially some system calls/exception handling from working. TOS must always link to previous frame. This is a short term workaround until alloca scheme is reworked. --- Diffs of the changes: (+5 -2) PPCRegisterInfo.cpp | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) Index: llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp diff -u llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp:1.77 llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp:1.78 --- llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp:1.77 Thu Nov 2 14:25:49 2006 +++ llvm/lib/Target/PowerPC/PPCRegisterInfo.cpp Sat Nov 11 04:21:58 2006 @@ -382,7 +382,8 @@ MachineBasicBlock::iterator I) const { if (hasFP(MF)) { // If we have a frame pointer, convert as follows: - // ADJCALLSTACKDOWN -> addi, r1, r1, -amount + // ADJCALLSTACKDOWN -> lwz r0, 0(r31) + // stwu, r0, -amount(r1) // ADJCALLSTACKUP -> addi, r1, r1, amount MachineInstr *Old = I; unsigned Amount = Old->getOperand(0).getImmedValue(); @@ -395,7 +396,9 @@ // Replace the pseudo instruction with a new instruction... if (Old->getOpcode() == PPC::ADJCALLSTACKDOWN) { - BuildMI(MBB, I, PPC::ADDI, 2, PPC::R1).addReg(PPC::R1).addImm(-Amount); + BuildMI(MBB, I, PPC::LWZ, 2, PPC::R0).addImm(0).addReg(PPC::R31); + BuildMI(MBB, I, PPC::STWU, 3) + .addReg(PPC::R0).addImm(-Amount).addReg(PPC::R1); } else { assert(Old->getOpcode() == PPC::ADJCALLSTACKUP); BuildMI(MBB, I, PPC::ADDI, 2, PPC::R1).addReg(PPC::R1).addImm(Amount); From jlaskey at apple.com Sat Nov 11 04:23:10 2006 From: jlaskey at apple.com (Jim Laskey) Date: Sat, 11 Nov 2006 04:23:10 -0600 Subject: [llvm-commits] CVS: llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp Message-ID: <200611111023.kABANA6s000577@zion.cs.uiuc.edu> Changes in directory llvm/test/Regression/DebugInfo: 2006-11-06-StackTrace.cpp updated: 1.7 -> 1.8 --- Log message: Works for PowerPC with frame pointers. --- Diffs of the changes: (+1 -1) 2006-11-06-StackTrace.cpp | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp diff -u llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp:1.7 llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp:1.8 --- llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp:1.7 Fri Nov 10 11:56:29 2006 +++ llvm/test/Regression/DebugInfo/2006-11-06-StackTrace.cpp Sat Nov 11 04:22:56 2006 @@ -6,7 +6,7 @@ // RUN: ( echo "break DeepStack::deepest"; echo "run 17" ; echo "where" ) > Output/StackTrace.gdbin // RUN: gdb -q -batch -n -x Output/StackTrace.gdbin Output/StackTrace.exe | tee Output/StackTrace.out | grep '#0 DeepStack::deepest.*(this=.*,.*x=33)' // RUN: gdb -q -batch -n -x Output/StackTrace.gdbin Output/StackTrace.exe | grep '#7 0x.* in main.*(argc=[12],.*argv=.*)' -// XFAIL: * +// XFAIL: i[1-9]86 #include From reid at x10sys.com Sat Nov 11 04:23:05 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 11 Nov 2006 04:23:05 -0600 Subject: [llvm-commits] CVS: llvm/utils/findmisopt Message-ID: <200611111023.kABAN5HJ000567@zion.cs.uiuc.edu> Changes in directory llvm/utils: findmisopt updated: 1.3 -> 1.4 --- Log message: Add -lstdc++ to the link line for C++ programs. --- Diffs of the changes: (+2 -2) findmisopt | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) Index: llvm/utils/findmisopt diff -u llvm/utils/findmisopt:1.3 llvm/utils/findmisopt:1.4 --- llvm/utils/findmisopt:1.3 Wed Nov 8 19:47:04 2006 +++ llvm/utils/findmisopt Sat Nov 11 04:22:48 2006 @@ -60,7 +60,7 @@ # Generate the non-optimized program llc "$bcfile" -o "$s" -f || exit 1 -gcc "$s" -o "$prog" || exit 1 +gcc "$s" -o "$prog" -lstdc++ -lc -lm || exit 1 # Define the list of optimizations to run all_switches="-verify -lowersetjmp -funcresolve -raiseallocs -simplifycfg -mem2reg -globalopt -globaldce -ipconstprop -deadargelim -instcombine -simplifycfg -prune-eh -inline -simplify-libcalls -argpromotion -raise -tailduplicate -simplifycfg -scalarrepl -instcombine -predsimplify -condprop -tailcallelim -simplifycfg -reassociate -licm -loop-unswitch -instcombine -indvars -loop-unroll -instcombine -load-vn -gcse -sccp -instcombine -condprop -dse -dce -simplifycfg -deadtypeelim -constmerge" @@ -71,7 +71,7 @@ opt $switches_to_use "$bcfile" -o "$optbc" -f || exit llvm-dis "$optbc" -o "$optll" -f || exit llc "$optbc" -o "$opts" -f || exit - gcc "$opts" -o "$optprog" || exit + gcc "$opts" -o "$optprog" -lstdc++ -lc -lm || exit "$prog" $args > "$out" ex1=$? "$optprog" $args > "$optout" From reid at x10sys.com Sat Nov 11 05:54:43 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 11 Nov 2006 05:54:43 -0600 Subject: [llvm-commits] CVS: llvm/include/llvm/Linker.h Message-ID: <200611111154.kABBshU6001929@zion.cs.uiuc.edu> Changes in directory llvm/include/llvm: Linker.h updated: 1.19 -> 1.20 --- Log message: For PR998: http://llvm.org/PR998 : Fix an infinite loop in the Linker and a few other assorted link problems. Patch contributed by Scott Michel. Thanks, Scott! --- Diffs of the changes: (+3 -2) Linker.h | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) Index: llvm/include/llvm/Linker.h diff -u llvm/include/llvm/Linker.h:1.19 llvm/include/llvm/Linker.h:1.20 --- llvm/include/llvm/Linker.h:1.19 Wed Feb 22 10:23:42 2006 +++ llvm/include/llvm/Linker.h Sat Nov 11 05:54:25 2006 @@ -239,8 +239,9 @@ /// @returns True if an error occurs, false otherwise. /// @brief Link in a module. bool LinkInModule( - Module* Src ///< Module linked into \p Dest - ) { return LinkModules(Composite, Src, &Error); } + Module* Src, ///< Module linked into \p Dest + std::string* ErrorMsg = 0 /// Error/diagnostic string + ) { return LinkModules(Composite, Src, ErrorMsg ); } /// This is the heart of the linker. This method will take unconditional /// control of the \p Src module and link it into the \p Dest module. The From reid at x10sys.com Sat Nov 11 05:54:45 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 11 Nov 2006 05:54:45 -0600 Subject: [llvm-commits] CVS: llvm/lib/Linker/LinkArchives.cpp LinkItems.cpp Message-ID: <200611111154.kABBsj0X001941@zion.cs.uiuc.edu> Changes in directory llvm/lib/Linker: LinkArchives.cpp updated: 1.52 -> 1.53 LinkItems.cpp updated: 1.8 -> 1.9 --- Log message: For PR998: http://llvm.org/PR998 : Fix an infinite loop in the Linker and a few other assorted link problems. Patch contributed by Scott Michel. Thanks, Scott! --- Diffs of the changes: (+30 -16) LinkArchives.cpp | 33 +++++++++++++++++++++++---------- LinkItems.cpp | 13 +++++++------ 2 files changed, 30 insertions(+), 16 deletions(-) Index: llvm/lib/Linker/LinkArchives.cpp diff -u llvm/lib/Linker/LinkArchives.cpp:1.52 llvm/lib/Linker/LinkArchives.cpp:1.53 --- llvm/lib/Linker/LinkArchives.cpp:1.52 Thu Nov 2 14:25:49 2006 +++ llvm/lib/Linker/LinkArchives.cpp Sat Nov 11 05:54:25 2006 @@ -124,8 +124,12 @@ // variable is used to "set_subtract" from the set of undefined symbols. std::set NotDefinedByArchive; - // While we are linking in object files, loop. - while (true) { + // Save the current set of undefined symbols, because we may have to make + // multiple passes over the archive: + std::set CurrentlyUndefinedSymbols; + + do { + CurrentlyUndefinedSymbols = UndefinedSymbols; // Find the modules we need to link into the target module std::set Modules; @@ -149,17 +153,26 @@ I != E; ++I) { // Get the module we must link in. - std::auto_ptr AutoModule( (*I)->releaseModule() ); + std::string moduleErrorMsg; + std::auto_ptr AutoModule((*I)->releaseModule( &moduleErrorMsg )); Module* aModule = AutoModule.get(); - verbose(" Linking in module: " + aModule->getModuleIdentifier()); + if (aModule != NULL) { + verbose(" Linking in module: " + aModule->getModuleIdentifier()); - // Link it in - if (LinkInModule(aModule)) - return error("Cannot link in module '" + - aModule->getModuleIdentifier() + "': " + Error); + // Link it in + if (LinkInModule(aModule, &moduleErrorMsg)) { + return error("Cannot link in module '" + + aModule->getModuleIdentifier() + "': " + moduleErrorMsg); + } + } else { + // (scottm) NOTE: For some reason, Modules.empty() isn't entirely + // accurrate, least with gcc 4.1.2 on Debian and doesn't return true + // when it ought. Consequently, aModule can be NULL -- ignore it for + // the time being, since it seems relatively benign. + } } - + // Get the undefined symbols from the aggregate module. This recomputes the // symbols we still need after the new modules have been linked in. GetAllUndefinedSymbols(Composite, UndefinedSymbols); @@ -175,7 +188,7 @@ // archive. if (UndefinedSymbols.empty()) break; - } + } while (CurrentlyUndefinedSymbols != UndefinedSymbols); return false; } Index: llvm/lib/Linker/LinkItems.cpp diff -u llvm/lib/Linker/LinkItems.cpp:1.8 llvm/lib/Linker/LinkItems.cpp:1.9 --- llvm/lib/Linker/LinkItems.cpp:1.8 Mon Jan 9 21:14:40 2006 +++ llvm/lib/Linker/LinkItems.cpp Sat Nov 11 05:54:25 2006 @@ -32,10 +32,10 @@ I != E; ++I) { if (I->second) { // Link in the library suggested. - bool is_file = true; - if (LinkInLibrary(I->first,is_file)) + bool is_bytecode = true; + if (LinkInLibrary(I->first,is_bytecode)) return true; - if (!is_file) + if (!is_bytecode) NativeItems.push_back(*I); } else { // Link in the file suggested @@ -61,8 +61,8 @@ /// LinkInLibrary - links one library into the HeadModule. /// -bool Linker::LinkInLibrary(const std::string& Lib, bool& is_file) { - is_file = false; +bool Linker::LinkInLibrary(const std::string& Lib, bool& is_bytecode) { + is_bytecode = false; // Determine where this library lives. sys::Path Pathname = FindLib(Lib); if (Pathname.isEmpty()) @@ -77,11 +77,12 @@ // LLVM ".so" file. if (LinkInFile(Pathname)) return error("Cannot link file '" + Pathname.toString() + "'"); - is_file = true; + is_bytecode = true; break; case sys::ArchiveFileType: if (LinkInArchive(Pathname)) return error("Cannot link archive '" + Pathname.toString() + "'"); + is_bytecode = true; break; default: return warning("Supposed library '" + Lib + "' isn't a library."); From reid at x10sys.com Sat Nov 11 05:54:42 2006 From: reid at x10sys.com (Reid Spencer) Date: Sat, 11 Nov 2006 05:54:42 -0600 Subject: [llvm-commits] CVS: llvm/tools/llvm-ld/llvm-ld.cpp Message-ID: <200611111154.kABBsgNw001923@zion.cs.uiuc.edu> Changes in directory llvm/tools/llvm-ld: llvm-ld.cpp updated: 1.40 -> 1.41 --- Log message: For PR998: http://llvm.org/PR998 : Fix an infinite loop in the Linker and a few other assorted link problems. Patch contributed by Scott Michel. Thanks, Scott! --- Diffs of the changes: (+18 -12) llvm-ld.cpp | 30 ++++++++++++++++++------------ 1 files changed, 18 insertions(+), 12 deletions(-) Index: llvm/tools/llvm-ld/llvm-ld.cpp diff -u llvm/tools/llvm-ld/llvm-ld.cpp:1.40 llvm/tools/llvm-ld/llvm-ld.cpp:1.41 --- llvm/tools/llvm-ld/llvm-ld.cpp:1.40 Sun Nov 5 13:53:08 2006 +++ llvm/tools/llvm-ld/llvm-ld.cpp Sat Nov 11 05:54:25 2006 @@ -264,7 +264,7 @@ /// Inputs: /// InputFilename - The name of the input bytecode file. /// OutputFilename - The name of the file to generate. -/// Libraries - The list of libraries with which to link. +/// LinkItems - The native libraries, files, code with which to link /// LibPaths - The list of directories in which to find libraries. /// gcc - The pathname to use for GGC. /// envp - A copy of the process's current environment. @@ -276,7 +276,7 @@ /// static int GenerateNative(const std::string &OutputFilename, const std::string &InputFilename, - const std::vector &Libraries, + const Linker::ItemList &LinkItems, const sys::Path &gcc, char ** const envp, std::string& ErrMsg) { // Remove these environment variables from the environment of the @@ -323,10 +323,13 @@ } // Add in the libraries to link. - for (unsigned index = 0; index < Libraries.size(); index++) - if (Libraries[index] != "crtend") { - args.push_back("-l"); - args.push_back(Libraries[index].c_str()); + for (unsigned index = 0; index < LinkItems.size(); index++) + if (LinkItems[