BasicBlock* RecurseBB = new BasicBlock("recurse", FibF);
// Create the "if (arg < 2) goto exitbb"
- Value *CondInst = BinaryOperator::createSetLE(ArgX, Two, "cond", BB);
+ Value *CondInst = new ICmpInst(ICmpInst::ICMP_SLE, ArgX, Two, "cond", BB);
new BranchInst(RetBB, RecurseBB, CondInst, BB);
// Create: ret int 1
BasicBlock* RecurseBB = new BasicBlock("recurse", FibF);
// Create the "if (arg < 2) goto exitbb"
- Value *CondInst = BinaryOperator::createSetLE(ArgX, Two, "cond", BB);
+ Value *CondInst = new ICmpInst(ICmpInst::ICMP_SLE, ArgX, Two, "cond", BB);
new BranchInst(RetBB, RecurseBB, CondInst, BB);
// Create: ret int 1
/// looking at this is that it returns the first iteration number where the
/// value is not in the condition, thus computing the exit count. If the
/// iteration count can't be computed, an instance of SCEVCouldNotCompute is
- /// returned.
- SCEVHandle getNumIterationsInRange(ConstantRange Range) const;
+ /// returned. The isSigned parameter indicates whether the ConstantRange
+ /// should be treated as signed or unsigned.
+ SCEVHandle getNumIterationsInRange(ConstantRange Range,
+ bool isSigned) const;
SCEVHandle replaceSymbolicValuesWithConcrete(const SCEVHandle &Sym,
const SCEVHandle &Conc) const;
// ConstantExprs in intermediate forms.
static Constant *getTy(const Type *Ty, unsigned Opcode,
Constant *C1, Constant *C2);
- static Constant *getCompareTy(unsigned Opcode, unsigned short pred,
- Constant *C1, Constant *C2);
+ static Constant *getCompareTy(unsigned short pred, Constant *C1,
+ Constant *C2);
static Constant *getShiftTy(const Type *Ty,
unsigned Opcode, Constant *C1, Constant *C2);
static Constant *getSelectTy(const Type *Ty,
static Constant *get(unsigned Opcode, Constant *C1, Constant *C2);
/// @brief Return an ICmp or FCmp comparison operator constant expression.
- static Constant *getCompare(unsigned Opcode, unsigned short pred,
- Constant *C1, Constant *C2);
+ static Constant *getCompare(unsigned short pred, Constant *C1, Constant *C2);
/// ConstantExpr::get* - Return some common constants without having to
/// specify the full Instruction::OPCODE identifier.
static Constant *getAnd(Constant *C1, Constant *C2);
static Constant *getOr(Constant *C1, Constant *C2);
static Constant *getXor(Constant *C1, Constant *C2);
- static Constant *getSetEQ(Constant *C1, Constant *C2);
- static Constant *getSetNE(Constant *C1, Constant *C2);
- static Constant *getSetLT(Constant *C1, Constant *C2);
- static Constant *getSetGT(Constant *C1, Constant *C2);
- static Constant *getSetLE(Constant *C1, Constant *C2);
- static Constant *getSetGE(Constant *C1, Constant *C2);
static Constant* getICmp(unsigned short pred, Constant* LHS, Constant* RHS);
static Constant* getFCmp(unsigned short pred, Constant* LHS, Constant* RHS);
static Constant *getShl(Constant *C1, Constant *C2);
/// @brief Determine if this is an equals/not equals predicate.
bool isEquality();
+ /// @returns true if the predicate is unsigned, false otherwise.
+ /// @brief Determine if the predicate is an unsigned operation.
+ static bool isUnsigned(unsigned short predicate);
+
+ /// @returns true if the predicate is signed, false otherwise.
+ /// @brief Determine if the predicate is an signed operation.
+ static bool isSigned(unsigned short predicate);
+
+ /// @brief Determine if the predicate is an ordered operation.
+ static bool isOrdered(unsigned short predicate);
+
+ /// @brief Determine if the predicate is an unordered operation.
+ static bool isUnordered(unsigned short predicate);
+
/// @brief Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const CmpInst *) { return true; }
static inline bool classof(const Instruction *I) {
HANDLE_BINARY_INST(16, And , BinaryOperator)
HANDLE_BINARY_INST(17, Or , BinaryOperator)
HANDLE_BINARY_INST(18, Xor , BinaryOperator)
-
-// Binary comparison operators...
-HANDLE_BINARY_INST(19, SetEQ , SetCondInst)
-HANDLE_BINARY_INST(20, SetNE , SetCondInst)
-HANDLE_BINARY_INST(21, SetLE , SetCondInst)
-HANDLE_BINARY_INST(22, SetGE , SetCondInst)
-HANDLE_BINARY_INST(23, SetLT , SetCondInst)
-HANDLE_BINARY_INST(24, SetGT , SetCondInst)
- LAST_BINARY_INST(24)
+ LAST_BINARY_INST(18)
// Memory operators...
- FIRST_MEMORY_INST(25)
-HANDLE_MEMORY_INST(25, Malloc, MallocInst) // Heap management instructions
-HANDLE_MEMORY_INST(26, Free , FreeInst )
-HANDLE_MEMORY_INST(27, Alloca, AllocaInst) // Stack management
-HANDLE_MEMORY_INST(28, Load , LoadInst ) // Memory manipulation instrs
-HANDLE_MEMORY_INST(29, Store , StoreInst )
-HANDLE_MEMORY_INST(30, GetElementPtr, GetElementPtrInst)
- LAST_MEMORY_INST(30)
+ FIRST_MEMORY_INST(19)
+HANDLE_MEMORY_INST(19, Malloc, MallocInst) // Heap management instructions
+HANDLE_MEMORY_INST(20, Free , FreeInst )
+HANDLE_MEMORY_INST(21, Alloca, AllocaInst) // Stack management
+HANDLE_MEMORY_INST(22, Load , LoadInst ) // Memory manipulation instrs
+HANDLE_MEMORY_INST(23, Store , StoreInst )
+HANDLE_MEMORY_INST(24, GetElementPtr, GetElementPtrInst)
+ LAST_MEMORY_INST(24)
// Cast operators ...
// NOTE: The order matters here because CastInst::isEliminableCastPair
// NOTE: (see Instructions.cpp) encodes a table based on this ordering.
- FIRST_CAST_INST(31)
-HANDLE_CAST_INST(31, Trunc , TruncInst ) // Truncate integers
-HANDLE_CAST_INST(32, ZExt , ZExtInst ) // Zero extend integers
-HANDLE_CAST_INST(33, SExt , SExtInst ) // Sign extend integers
-HANDLE_CAST_INST(34, FPToUI , FPToUIInst ) // floating point -> UInt
-HANDLE_CAST_INST(35, FPToSI , FPToSIInst ) // floating point -> SInt
-HANDLE_CAST_INST(36, UIToFP , UIToFPInst ) // UInt -> floating point
-HANDLE_CAST_INST(37, SIToFP , SIToFPInst ) // SInt -> floating point
-HANDLE_CAST_INST(38, FPTrunc , FPTruncInst ) // Truncate floating point
-HANDLE_CAST_INST(39, FPExt , FPExtInst ) // Extend floating point
-HANDLE_CAST_INST(40, PtrToInt, PtrToIntInst) // Pointer -> Integer
-HANDLE_CAST_INST(41, IntToPtr, IntToPtrInst) // Integer -> Pointer
-HANDLE_CAST_INST(42, BitCast , BitCastInst ) // Type cast
- LAST_CAST_INST(42)
+ FIRST_CAST_INST(25)
+HANDLE_CAST_INST(25, Trunc , TruncInst ) // Truncate integers
+HANDLE_CAST_INST(26, ZExt , ZExtInst ) // Zero extend integers
+HANDLE_CAST_INST(27, SExt , SExtInst ) // Sign extend integers
+HANDLE_CAST_INST(28, FPToUI , FPToUIInst ) // floating point -> UInt
+HANDLE_CAST_INST(29, FPToSI , FPToSIInst ) // floating point -> SInt
+HANDLE_CAST_INST(30, UIToFP , UIToFPInst ) // UInt -> floating point
+HANDLE_CAST_INST(31, SIToFP , SIToFPInst ) // SInt -> floating point
+HANDLE_CAST_INST(32, FPTrunc , FPTruncInst ) // Truncate floating point
+HANDLE_CAST_INST(33, FPExt , FPExtInst ) // Extend floating point
+HANDLE_CAST_INST(34, PtrToInt, PtrToIntInst) // Pointer -> Integer
+HANDLE_CAST_INST(35, IntToPtr, IntToPtrInst) // Integer -> Pointer
+HANDLE_CAST_INST(36, BitCast , BitCastInst ) // Type cast
+ LAST_CAST_INST(36)
// Other operators...
- FIRST_OTHER_INST(43)
-HANDLE_OTHER_INST(43, ICmp , ICmpInst ) // Integer comparison instruction
-HANDLE_OTHER_INST(44, FCmp , FCmpInst ) // Floating point comparison instr.
-HANDLE_OTHER_INST(45, PHI , PHINode ) // PHI node instruction
-HANDLE_OTHER_INST(46, Call , CallInst ) // Call a function
-HANDLE_OTHER_INST(47, Shl , ShiftInst ) // Shift Left operations (logical)
-HANDLE_OTHER_INST(48, LShr , ShiftInst ) // Logical Shift right (unsigned)
-HANDLE_OTHER_INST(49, AShr , ShiftInst ) // Arithmetic shift right (signed)
-HANDLE_OTHER_INST(50, Select , SelectInst ) // select instruction
-HANDLE_OTHER_INST(51, UserOp1, Instruction) // May be used internally in a pass
-HANDLE_OTHER_INST(52, UserOp2, Instruction) // Internal to passes only
-HANDLE_OTHER_INST(53, VAArg , VAArgInst ) // vaarg instruction
-HANDLE_OTHER_INST(54, ExtractElement, ExtractElementInst)// extract from vector.
-HANDLE_OTHER_INST(55, InsertElement, InsertElementInst) // insert into vector
-HANDLE_OTHER_INST(56, ShuffleVector, ShuffleVectorInst) // shuffle two vectors.
- LAST_OTHER_INST(56)
+ FIRST_OTHER_INST(37)
+HANDLE_OTHER_INST(37, ICmp , ICmpInst ) // Integer comparison instruction
+HANDLE_OTHER_INST(38, FCmp , FCmpInst ) // Floating point comparison instr.
+HANDLE_OTHER_INST(39, PHI , PHINode ) // PHI node instruction
+HANDLE_OTHER_INST(40, Call , CallInst ) // Call a function
+HANDLE_OTHER_INST(41, Shl , ShiftInst ) // Shift Left operations (logical)
+HANDLE_OTHER_INST(42, LShr , ShiftInst ) // Logical Shift right (unsigned)
+HANDLE_OTHER_INST(43, AShr , ShiftInst ) // Arithmetic shift right (signed)
+HANDLE_OTHER_INST(44, Select , SelectInst ) // select instruction
+HANDLE_OTHER_INST(45, UserOp1, Instruction) // May be used internally in a pass
+HANDLE_OTHER_INST(46, UserOp2, Instruction) // Internal to passes only
+HANDLE_OTHER_INST(47, VAArg , VAArgInst ) // vaarg instruction
+HANDLE_OTHER_INST(48, ExtractElement, ExtractElementInst)// extract from vector.
+HANDLE_OTHER_INST(49, InsertElement, InsertElementInst) // insert into vector
+HANDLE_OTHER_INST(50, ShuffleVector, ShuffleVectorInst) // shuffle two vectors.
+ LAST_OTHER_INST(50)
#undef FIRST_TERM_INST
#undef HANDLE_TERM_INST
/// extra information (e.g. load is volatile) agree.
bool isIdenticalTo(Instruction *I) const;
+ /// This function determines if the specified instruction executes the same
+ /// operation as the current one. This means that the opcodes, type, operand
+ /// types and any other factors affecting the operation must be the same. This
+ /// is similar to isIdenticalTo except the operands themselves don't have to
+ /// be identical.
+ /// @returns true if the specified instruction is the same operation as
+ /// the current one.
+ /// @brief Determine if one instruction is the same operation as another.
+ bool isSameOperationAs(Instruction *I) const;
+
/// use_back - Specialize the methods defined in Value, as we know that an
/// instruction can only be used by other instructions.
Instruction *use_back() { return cast<Instruction>(*use_begin());}
bool isCommutative() const { return isCommutative(getOpcode()); }
static bool isCommutative(unsigned op);
- /// isComparison - Return true if the instruction is a Set* instruction:
- ///
- bool isComparison() const { return isComparison(getOpcode()); }
- static bool isComparison(unsigned op);
-
-
/// isTrappingInstruction - Return true if the instruction may trap.
///
bool isTrapping() const {
ICMP_SLT = 40, ///< signed less than
ICMP_SLE = 41, ///< signed less or equal
FIRST_ICMP_PREDICATE = ICMP_EQ,
- LAST_ICMP_PREDICATE = ICMP_SLE
+ LAST_ICMP_PREDICATE = ICMP_SLE,
+ BAD_ICMP_PREDICATE = ICMP_SLE + 1
};
/// @brief Constructor with insert-before-instruction semantics.
/// This is a static version that you can use without an instruction
/// available.
/// @brief Return the predicate as if the operands were swapped.
- static Predicate getSwappedPredicate(Predicate Opcode);
+ static Predicate getSwappedPredicate(Predicate pred);
+
+ /// For example, EQ->EQ, SLE->SLE, UGT->SGT, etc.
+ /// @returns the predicate that would be the result if the operand were
+ /// regarded as signed.
+ /// @brief Return the signed version of the predicate
+ Predicate getSignedPredicate() const {
+ return getSignedPredicate(getPredicate());
+ }
+
+ /// This is a static version that you can use without an instruction.
+ /// @brief Return the signed version of the predicate.
+ static Predicate getSignedPredicate(Predicate pred);
/// This also tests for commutativity. If isEquality() returns true then
- /// the predicate is also commutative. Only the equality predicates are
- /// commutative.
+ /// the predicate is also commutative.
/// @returns true if the predicate of this instruction is EQ or NE.
/// @brief Determine if this is an equality predicate.
bool isEquality() const {
return SubclassData == ICMP_EQ || SubclassData == ICMP_NE;
}
+
+ /// @returns true if the predicate of this ICmpInst is commutative
+ /// @brief Determine if this relation is commutative.
bool isCommutative() const { return isEquality(); }
/// @returns true if the predicate is relational (not EQ or NE).
return !isEquality();
}
+ /// @returns true if the predicate of this ICmpInst is signed, false otherwise
+ /// @brief Determine if this instruction's predicate is signed.
+ bool isSignedPredicate() { return isSignedPredicate(getPredicate()); }
+
+ /// @returns true if the predicate provided is signed, false otherwise
+ /// @brief Determine if the predicate is signed.
+ static bool isSignedPredicate(Predicate pred);
+
/// Exchange the two operands to this instruction in such a way that it does
/// not modify the semantics of the instruction. The predicate value may be
/// changed to retain the same result if the predicate is order dependent
FCMP_UNE =14, ///< 1 1 1 0 True if unordered or not equal
FCMP_TRUE =15, ///< 1 1 1 1 Always true (always folded)
FIRST_FCMP_PREDICATE = FCMP_FALSE,
- LAST_FCMP_PREDICATE = FCMP_TRUE
+ LAST_FCMP_PREDICATE = FCMP_TRUE,
+ BAD_FCMP_PREDICATE = FCMP_TRUE + 1
};
/// @brief Constructor with insert-before-instruction semantics.
}
};
-
-//===----------------------------------------------------------------------===//
-// SetCondInst Class
-//===----------------------------------------------------------------------===//
-
-/// SetCondInst class - Represent a setCC operator, where CC is eq, ne, lt, gt,
-/// le, or ge.
-///
-class SetCondInst : public BinaryOperator {
-public:
- SetCondInst(BinaryOps Opcode, Value *LHS, Value *RHS,
- const std::string &Name = "", Instruction *InsertBefore = 0);
- SetCondInst(BinaryOps Opcode, Value *LHS, Value *RHS,
- const std::string &Name, BasicBlock *InsertAtEnd);
-
- /// getInverseCondition - Return the inverse of the current condition opcode.
- /// For example seteq -> setne, setgt -> setle, setlt -> setge, etc...
- ///
- BinaryOps getInverseCondition() const {
- return getInverseCondition(getOpcode());
- }
-
- /// getInverseCondition - Static version that you can use without an
- /// instruction available.
- ///
- static BinaryOps getInverseCondition(BinaryOps Opcode);
-
- /// getSwappedCondition - Return the condition opcode that would be the result
- /// of exchanging the two operands of the setcc instruction without changing
- /// the result produced. Thus, seteq->seteq, setle->setge, setlt->setgt, etc.
- ///
- BinaryOps getSwappedCondition() const {
- return getSwappedCondition(getOpcode());
- }
-
- /// getSwappedCondition - Static version that you can use without an
- /// instruction available.
- ///
- static BinaryOps getSwappedCondition(BinaryOps Opcode);
-
- /// isEquality - Return true if this comparison is an ==/!= comparison.
- ///
- bool isEquality() const {
- return getOpcode() == SetEQ || getOpcode() == SetNE;
- }
-
- /// isRelational - Return true if this comparison is a </>/<=/>= comparison.
- ///
- bool isRelational() const {
- return !isEquality();
- }
-
- // Methods for support type inquiry through isa, cast, and dyn_cast:
- static inline bool classof(const SetCondInst *) { return true; }
- static inline bool classof(const Instruction *I) {
- return I->getOpcode() == SetEQ || I->getOpcode() == SetNE ||
- I->getOpcode() == SetLE || I->getOpcode() == SetGE ||
- I->getOpcode() == SetLT || I->getOpcode() == SetGT;
- }
- static inline bool classof(const Value *V) {
- return isa<Instruction>(V) && classof(cast<Instruction>(V));
- }
-};
-
-
//===----------------------------------------------------------------------===//
// CallInst Class
//===----------------------------------------------------------------------===//
#include <typeinfo>
#include <cassert>
-//#define USE_OLD_PASSMANAGER 1
+#define USE_OLD_PASSMANAGER 1
namespace llvm {
// constant, which MAY wrap around the end of the numeric range. To do this, it
// keeps track of a [lower, upper) bound, which specifies an interval just like
// STL iterators. When used with boolean values, the following are important
-// ranges (other integral ranges use min/max values for special range values):
+// ranges: :
//
// [F, F) = {} = Empty set
// [T, F) = {T}
// [F, T) = {F}
// [T, T) = {F, T} = Full set
//
+// The other integral ranges use min/max values for special range values. For
+// example, for 8-bit types, it uses:
+// [0, 0) = {} = Empty set
+// [255, 255) = {0..255} = Full Set
+//
+// Note that ConstantRange always keeps unsigned values.
//===----------------------------------------------------------------------===//
#ifndef LLVM_SUPPORT_CONSTANT_RANGE_H
///
ConstantRange(Constant *Lower, Constant *Upper);
- /// Initialize a set of values that all satisfy the condition with C.
- ///
- ConstantRange(unsigned SetCCOpcode, ConstantIntegral *C);
+ /// Initialize a set of values that all satisfy the predicate with C. The
+ /// predicate should be either an ICmpInst::Predicate or FCmpInst::Predicate
+ /// value.
+ /// @brief Get a range for a relation with a constant integral.
+ ConstantRange(unsigned short predicate, ConstantIntegral *C);
/// getLower - Return the lower value for this range...
///
/// isWrappedSet - Return true if this set wraps around the top of the range,
/// for example: [100, 8)
///
- bool isWrappedSet() const;
+ bool isWrappedSet(bool isSigned) const;
/// contains - Return true if the specified value is in the set.
+ /// The isSigned parameter indicates whether the comparisons should be
+ /// performed as if the values are signed or not.
///
- bool contains(ConstantInt *Val) const;
+ bool contains(ConstantInt *Val, bool isSigned) const;
/// getSingleElement - If this set contains a single element, return it,
/// otherwise return null.
/// one of the sets but not the other. For example: [100, 8) intersect [3,
/// 120) yields [3, 120)
///
- ConstantRange intersectWith(const ConstantRange &CR) const;
+ ConstantRange intersectWith(const ConstantRange &CR, bool isSigned) const;
/// union - Return the range that results from the union of this range with
/// another range. The resultant range is guaranteed to include the elements
/// [3, 15), which includes 9, 10, and 11, which were not included in either
/// set before.
///
- ConstantRange unionWith(const ConstantRange &CR) const;
+ ConstantRange unionWith(const ConstantRange &CR, bool isSigned) const;
/// zeroExtend - Return a new range in the specified integer type, which must
/// be strictly larger than the current type. The returned range will
RetTy visitInvokeInst(InvokeInst &I) { DELEGATE(TerminatorInst);}
RetTy visitUnwindInst(UnwindInst &I) { DELEGATE(TerminatorInst);}
RetTy visitUnreachableInst(UnreachableInst &I) { DELEGATE(TerminatorInst);}
- RetTy visitSetCondInst(SetCondInst &I) { DELEGATE(BinaryOperator);}
RetTy visitICmpInst(ICmpInst &I) { DELEGATE(CmpInst);}
RetTy visitFCmpInst(FCmpInst &I) { DELEGATE(CmpInst);}
RetTy visitMallocInst(MallocInst &I) { DELEGATE(AllocationInst);}
}
};
-template<typename LHS, typename RHS>
-inline BinaryOpClass_match<LHS, RHS, SetCondInst, Instruction::BinaryOps>
-m_SetCond(Instruction::BinaryOps &Op, const LHS &L, const RHS &R) {
- return BinaryOpClass_match<LHS, RHS,
- SetCondInst, Instruction::BinaryOps>(Op, L, R);
-}
-
template<typename LHS, typename RHS>
inline BinaryOpClass_match<LHS, RHS, ShiftInst, Instruction::OtherOps>
m_Shift(Instruction::OtherOps &Op, const LHS &L, const RHS &R) {
ShiftInst, Instruction::OtherOps>(Op, L, R);
}
+//===----------------------------------------------------------------------===//
+// Matchers for CmpInst classes
+//
+
+template<typename LHS_t, typename RHS_t, typename Class, typename PredicateTy>
+struct CmpClass_match {
+ PredicateTy &Predicate;
+ LHS_t L;
+ RHS_t R;
+
+ CmpClass_match(PredicateTy &Pred, const LHS_t &LHS,
+ const RHS_t &RHS)
+ : Predicate(Pred), L(LHS), R(RHS) {}
+
+ template<typename OpTy>
+ bool match(OpTy *V) {
+ if (Class *I = dyn_cast<Class>(V))
+ if (L.match(I->getOperand(0)) && R.match(I->getOperand(1))) {
+ Predicate = I->getPredicate();
+ return true;
+ }
+ return false;
+ }
+};
+
+template<typename LHS, typename RHS>
+inline CmpClass_match<LHS, RHS, ICmpInst, ICmpInst::Predicate>
+m_ICmp(ICmpInst::Predicate &Pred, const LHS &L, const RHS &R) {
+ return CmpClass_match<LHS, RHS,
+ ICmpInst, ICmpInst::Predicate>(Pred, L, R);
+}
+
+template<typename LHS, typename RHS>
+inline CmpClass_match<LHS, RHS, FCmpInst, FCmpInst::Predicate>
+m_FCmp(FCmpInst::Predicate &Pred, const LHS &L, const RHS &R) {
+ return CmpClass_match<LHS, RHS,
+ FCmpInst, FCmpInst::Predicate>(Pred, L, R);
+}
+
//===----------------------------------------------------------------------===//
// Matchers for unary operators
//
Constant *ConstantFoldInstruction(Instruction *I);
/// ConstantFoldInstOperands - Attempt to constant fold an instruction with the
-/// specified opcode and operands. If successful, the constant result is
-/// returned, if not, null is returned. Note that this function can fail when
-/// attempting to fold instructions like loads and stores, which have no
-/// constant expression form.
+/// specified operands. If successful, the constant result is returned, if not,
+/// null is returned. Note that this function can fail when attempting to
+/// fold instructions like loads and stores, which have no constant expression
+/// form.
///
-Constant *ConstantFoldInstOperands(unsigned Opc, const Type *DestTy,
- const std::vector<Constant*> &Ops);
+Constant *ConstantFoldInstOperands(
+ const Instruction *I, ///< The model instruction
+ const std::vector<Constant*> &Ops ///< The constant operands to use.
+);
/// ConstantFoldLoadThroughGEPConstantExpr - Given a constant and a
// Make sure they are comparable (ie, not constant expressions), and
// make sure the GEP with the smaller leading constant is GEP1.
if (G1OC) {
- Constant *Compare = ConstantExpr::getSetGT(G1OC, G2OC);
+ Constant *Compare = ConstantExpr::getICmp(ICmpInst::ICMP_SGT,
+ G1OC, G2OC);
if (ConstantBool *CV = dyn_cast<ConstantBool>(Compare)) {
if (CV->getValue()) // If they are comparable and G2 > G1
std::swap(GEP1Ops, GEP2Ops); // Make GEP1 < GEP2
#include "llvm/Support/ConstantRange.h"
#include "llvm/Constants.h"
#include "llvm/Instruction.h"
+#include "llvm/Instructions.h"
#include "llvm/Type.h"
#include "llvm/Support/Streams.h"
#include <ostream>
using namespace llvm;
-static ConstantIntegral *getMaxValue(const Type *Ty) {
- switch (Ty->getTypeID()) {
- case Type::BoolTyID: return ConstantBool::getTrue();
- case Type::SByteTyID:
- case Type::ShortTyID:
- case Type::IntTyID:
- case Type::LongTyID: {
- // Calculate 011111111111111...
- unsigned TypeBits = Ty->getPrimitiveSize()*8;
- int64_t Val = INT64_MAX; // All ones
- Val >>= 64-TypeBits; // Shift out unwanted 1 bits...
- return ConstantInt::get(Ty, Val);
- }
-
- case Type::UByteTyID:
- case Type::UShortTyID:
- case Type::UIntTyID:
- case Type::ULongTyID: return ConstantInt::getAllOnesValue(Ty);
-
- default: return 0;
+static ConstantIntegral *getMaxValue(const Type *Ty, bool isSigned = false) {
+ if (Ty == Type::BoolTy)
+ return ConstantBool::getTrue();
+ if (Ty->isInteger()) {
+ if (isSigned) {
+ // Calculate 011111111111111...
+ unsigned TypeBits = Ty->getPrimitiveSize()*8;
+ int64_t Val = INT64_MAX; // All ones
+ Val >>= 64-TypeBits; // Shift out unwanted 1 bits...
+ return ConstantInt::get(Ty, Val);
+ }
+ return ConstantInt::getAllOnesValue(Ty);
}
+ return 0;
}
// Static constructor to create the minimum constant for an integral type...
-static ConstantIntegral *getMinValue(const Type *Ty) {
- switch (Ty->getTypeID()) {
- case Type::BoolTyID: return ConstantBool::getFalse();
- case Type::SByteTyID:
- case Type::ShortTyID:
- case Type::IntTyID:
- case Type::LongTyID: {
- // Calculate 1111111111000000000000
- unsigned TypeBits = Ty->getPrimitiveSize()*8;
- int64_t Val = -1; // All ones
- Val <<= TypeBits-1; // Shift over to the right spot
- return ConstantInt::get(Ty, Val);
- }
-
- case Type::UByteTyID:
- case Type::UShortTyID:
- case Type::UIntTyID:
- case Type::ULongTyID: return ConstantInt::get(Ty, 0);
-
- default: return 0;
+static ConstantIntegral *getMinValue(const Type *Ty, bool isSigned = false) {
+ if (Ty == Type::BoolTy)
+ return ConstantBool::getFalse();
+ if (Ty->isInteger()) {
+ if (isSigned) {
+ // Calculate 1111111111000000000000
+ unsigned TypeBits = Ty->getPrimitiveSize()*8;
+ int64_t Val = -1; // All ones
+ Val <<= TypeBits-1; // Shift over to the right spot
+ return ConstantInt::get(Ty, Val);
+ }
+ return ConstantInt::get(Ty, 0);
}
+ return 0;
}
static ConstantIntegral *Next(ConstantIntegral *CI) {
if (ConstantBool *CB = dyn_cast<ConstantBool>(CI))
return cast<ConstantIntegral>(Result);
}
-static bool LT(ConstantIntegral *A, ConstantIntegral *B) {
- Constant *C = ConstantExpr::getSetLT(A, B);
+static bool LT(ConstantIntegral *A, ConstantIntegral *B, bool isSigned) {
+ Constant *C = ConstantExpr::getICmp(
+ (isSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT), A, B);
assert(isa<ConstantBool>(C) && "Constant folding of integrals not impl??");
return cast<ConstantBool>(C)->getValue();
}
-static bool LTE(ConstantIntegral *A, ConstantIntegral *B) {
- Constant *C = ConstantExpr::getSetLE(A, B);
+static bool LTE(ConstantIntegral *A, ConstantIntegral *B, bool isSigned) {
+ Constant *C = ConstantExpr::getICmp(
+ (isSigned ? ICmpInst::ICMP_SLE : ICmpInst::ICMP_ULE), A, B);
assert(isa<ConstantBool>(C) && "Constant folding of integrals not impl??");
return cast<ConstantBool>(C)->getValue();
}
-static bool GT(ConstantIntegral *A, ConstantIntegral *B) { return LT(B, A); }
+static bool GT(ConstantIntegral *A, ConstantIntegral *B, bool isSigned) {
+ return LT(B, A, isSigned); }
-static ConstantIntegral *Min(ConstantIntegral *A, ConstantIntegral *B) {
- return LT(A, B) ? A : B;
+static ConstantIntegral *Min(ConstantIntegral *A, ConstantIntegral *B,
+ bool isSigned) {
+ return LT(A, B, isSigned) ? A : B;
}
-static ConstantIntegral *Max(ConstantIntegral *A, ConstantIntegral *B) {
- return GT(A, B) ? A : B;
+static ConstantIntegral *Max(ConstantIntegral *A, ConstantIntegral *B,
+ bool isSigned) {
+ return GT(A, B, isSigned) ? A : B;
}
/// Initialize a full (the default) or empty set for the specified type.
/// Initialize a range to hold the single specified value.
///
-ConstantRange::ConstantRange(Constant *V)
- : Lower(cast<ConstantIntegral>(V)), Upper(Next(cast<ConstantIntegral>(V))) {
-}
+ConstantRange::ConstantRange(Constant *V)
+ : Lower(cast<ConstantIntegral>(V)), Upper(Next(cast<ConstantIntegral>(V))) { }
/// Initialize a range of values explicitly... this will assert out if
/// Lower==Upper and Lower != Min or Max for its type (or if the two constants
/// have different types)
///
-ConstantRange::ConstantRange(Constant *L, Constant *U)
+ConstantRange::ConstantRange(Constant *L, Constant *U)
: Lower(cast<ConstantIntegral>(L)), Upper(cast<ConstantIntegral>(U)) {
assert(Lower->getType() == Upper->getType() &&
"Incompatible types for ConstantRange!");
// Make sure that if L & U are equal that they are either Min or Max...
assert((L != U || (L == getMaxValue(L->getType()) ||
- L == getMinValue(L->getType()))) &&
- "Lower == Upper, but they aren't min or max for type!");
+ L == getMinValue(L->getType())))
+ && "Lower == Upper, but they aren't min or max for type!");
}
/// Initialize a set of values that all satisfy the condition with C.
///
-ConstantRange::ConstantRange(unsigned SetCCOpcode, ConstantIntegral *C) {
- switch (SetCCOpcode) {
- default: assert(0 && "Invalid SetCC opcode to ConstantRange ctor!");
- case Instruction::SetEQ: Lower = C; Upper = Next(C); return;
- case Instruction::SetNE: Upper = C; Lower = Next(C); return;
- case Instruction::SetLT:
+ConstantRange::ConstantRange(unsigned short ICmpOpcode, ConstantIntegral *C) {
+ switch (ICmpOpcode) {
+ default: assert(0 && "Invalid ICmp opcode to ConstantRange ctor!");
+ case ICmpInst::ICMP_EQ: Lower = C; Upper = Next(C); return;
+ case ICmpInst::ICMP_NE: Upper = C; Lower = Next(C); return;
+ case ICmpInst::ICMP_ULT:
Lower = getMinValue(C->getType());
Upper = C;
return;
- case Instruction::SetGT:
+ case ICmpInst::ICMP_SLT:
+ Lower = getMinValue(C->getType(), true);
+ Upper = C;
+ return;
+ case ICmpInst::ICMP_UGT:
+ Lower = Next(C);
+ Upper = getMinValue(C->getType()); // Min = Next(Max)
+ return;
+ case ICmpInst::ICMP_SGT:
Lower = Next(C);
- Upper = getMinValue(C->getType()); // Min = Next(Max)
+ Upper = getMinValue(C->getType(), true); // Min = Next(Max)
return;
- case Instruction::SetLE:
+ case ICmpInst::ICMP_ULE:
Lower = getMinValue(C->getType());
Upper = Next(C);
return;
- case Instruction::SetGE:
+ case ICmpInst::ICMP_SLE:
+ Lower = getMinValue(C->getType(), true);
+ Upper = Next(C);
+ return;
+ case ICmpInst::ICMP_UGE:
+ Lower = C;
+ Upper = getMinValue(C->getType()); // Min = Next(Max)
+ return;
+ case ICmpInst::ICMP_SGE:
Lower = C;
- Upper = getMinValue(C->getType()); // Min = Next(Max)
+ Upper = getMinValue(C->getType(), true); // Min = Next(Max)
return;
}
}
/// isWrappedSet - Return true if this set wraps around the top of the range,
/// for example: [100, 8)
///
-bool ConstantRange::isWrappedSet() const {
- return GT(Lower, Upper);
+bool ConstantRange::isWrappedSet(bool isSigned) const {
+ return GT(Lower, Upper, isSigned);
}
-
/// getSingleElement - If this set contains a single element, return it,
/// otherwise return null.
ConstantIntegral *ConstantRange::getSingleElement() const {
/// contains - Return true if the specified value is in the set.
///
-bool ConstantRange::contains(ConstantInt *Val) const {
+bool ConstantRange::contains(ConstantInt *Val, bool isSigned) const {
if (Lower == Upper) {
if (isFullSet()) return true;
return false;
}
- if (!isWrappedSet())
- return LTE(Lower, Val) && LT(Val, Upper);
- return LTE(Lower, Val) || LT(Val, Upper);
+ if (!isWrappedSet(isSigned))
+ return LTE(Lower, Val, isSigned) && LT(Val, Upper, isSigned);
+ return LTE(Lower, Val, isSigned) || LT(Val, Upper, isSigned);
}
-
-
/// subtract - Subtract the specified constant from the endpoints of this
/// constant range.
ConstantRange ConstantRange::subtract(ConstantInt *CI) const {
// it is known that LHS is wrapped and RHS isn't.
//
static ConstantRange intersect1Wrapped(const ConstantRange &LHS,
- const ConstantRange &RHS) {
- assert(LHS.isWrappedSet() && !RHS.isWrappedSet());
+ const ConstantRange &RHS,
+ bool isSigned) {
+ assert(LHS.isWrappedSet(isSigned) && !RHS.isWrappedSet(isSigned));
// Check to see if we overlap on the Left side of RHS...
//
- if (LT(RHS.getLower(), LHS.getUpper())) {
+ if (LT(RHS.getLower(), LHS.getUpper(), isSigned)) {
// We do overlap on the left side of RHS, see if we overlap on the right of
// RHS...
- if (GT(RHS.getUpper(), LHS.getLower())) {
+ if (GT(RHS.getUpper(), LHS.getLower(), isSigned)) {
// Ok, the result overlaps on both the left and right sides. See if the
// resultant interval will be smaller if we wrap or not...
//
// No overlap on the right, just on the left.
return ConstantRange(RHS.getLower(), LHS.getUpper());
}
-
} else {
// We don't overlap on the left side of RHS, see if we overlap on the right
// of RHS...
- if (GT(RHS.getUpper(), LHS.getLower())) {
+ if (GT(RHS.getUpper(), LHS.getLower(), isSigned)) {
// Simple overlap...
return ConstantRange(LHS.getLower(), RHS.getUpper());
} else {
/// intersect - Return the range that results from the intersection of this
/// range with another range.
///
-ConstantRange ConstantRange::intersectWith(const ConstantRange &CR) const {
+ConstantRange ConstantRange::intersectWith(const ConstantRange &CR,
+ bool isSigned) const {
assert(getType() == CR.getType() && "ConstantRange types don't agree!");
// Handle common special cases
if (isEmptySet() || CR.isFullSet()) return *this;
if (isFullSet() || CR.isEmptySet()) return CR;
- if (!isWrappedSet()) {
- if (!CR.isWrappedSet()) {
- ConstantIntegral *L = Max(Lower, CR.Lower);
- ConstantIntegral *U = Min(Upper, CR.Upper);
+ if (!isWrappedSet(isSigned)) {
+ if (!CR.isWrappedSet(isSigned)) {
+ ConstantIntegral *L = Max(Lower, CR.Lower, isSigned);
+ ConstantIntegral *U = Min(Upper, CR.Upper, isSigned);
- if (LT(L, U)) // If range isn't empty...
+ if (LT(L, U, isSigned)) // If range isn't empty...
return ConstantRange(L, U);
else
return ConstantRange(getType(), false); // Otherwise, return empty set
} else
- return intersect1Wrapped(CR, *this);
+ return intersect1Wrapped(CR, *this, isSigned);
} else { // We know "this" is wrapped...
- if (!CR.isWrappedSet())
- return intersect1Wrapped(*this, CR);
+ if (!CR.isWrappedSet(isSigned))
+ return intersect1Wrapped(*this, CR, isSigned);
else {
// Both ranges are wrapped...
- ConstantIntegral *L = Max(Lower, CR.Lower);
- ConstantIntegral *U = Min(Upper, CR.Upper);
+ ConstantIntegral *L = Max(Lower, CR.Lower, isSigned);
+ ConstantIntegral *U = Min(Upper, CR.Upper, isSigned);
return ConstantRange(L, U);
}
}
/// 15), which includes 9, 10, and 11, which were not included in either set
/// before.
///
-ConstantRange ConstantRange::unionWith(const ConstantRange &CR) const {
+ConstantRange ConstantRange::unionWith(const ConstantRange &CR,
+ bool isSigned) const {
assert(getType() == CR.getType() && "ConstantRange types don't agree!");
assert(0 && "Range union not implemented yet!");
/// zeroExtend - Return a new range in the specified integer type, which must
/// be strictly larger than the current type. The returned range will
-/// correspond to the possible range of values if the source range had been
+/// correspond to the possible range of values as if the source range had been
/// zero extended.
ConstantRange ConstantRange::zeroExtend(const Type *Ty) const {
assert(getLower()->getType()->getPrimitiveSize() < Ty->getPrimitiveSize() &&
/// truncate - Return a new range in the specified integer type, which must be
/// strictly smaller than the current type. The returned range will
-/// correspond to the possible range of values if the source range had been
+/// correspond to the possible range of values as if the source range had been
/// truncated to the specified type.
ConstantRange ConstantRange::truncate(const Type *Ty) const {
assert(getLower()->getType()->getPrimitiveSize() > Ty->getPrimitiveSize() &&
ConstantExpr::getTrunc(getUpper(), Ty));
}
-
/// print - Print out the bounds to a stream...
///
void ConstantRange::print(std::ostream &OS) const {
void visitGetElementPtrInst(GetElementPtrInst &GEP);
void visitPHINode(PHINode &PN);
void visitCastInst(CastInst &CI);
- void visitSetCondInst(SetCondInst &SCI) {} // NOOP!
+ void visitICmpInst(ICmpInst &ICI) {} // NOOP!
+ void visitFCmpInst(FCmpInst &ICI) {} // NOOP!
void visitSelectInst(SelectInst &SI);
void visitVAArg(VAArgInst &I);
void visitInstruction(Instruction &I);
case Instruction::Shl:
case Instruction::LShr:
case Instruction::AShr:
+ case Instruction::ICmp:
+ case Instruction::FCmp:
return;
default:
// Is this something we aren't handling yet?
} else {
return true;
}
- } else if (SetCondInst *SCI = dyn_cast<SetCondInst>(*UI)) {
- if (!isa<ConstantPointerNull>(SCI->getOperand(1)))
+ } else if (ICmpInst *ICI = dyn_cast<ICmpInst>(*UI)) {
+ if (!isa<ConstantPointerNull>(ICI->getOperand(1)))
return true; // Allow comparison against null.
} else if (FreeInst *F = dyn_cast<FreeInst>(*UI)) {
Writers.push_back(F->getParent()->getParent());
/// returns null.
///
Value *Loop::getTripCount() const {
- // Canonical loops will end with a 'setne I, V', where I is the incremented
+ // Canonical loops will end with a 'cmp ne I, V', where I is the incremented
// canonical induction variable and V is the trip count of the loop.
Instruction *Inc = getCanonicalInductionVariableIncrement();
if (Inc == 0) return 0;
IV->getIncomingBlock(contains(IV->getIncomingBlock(1)));
if (BranchInst *BI = dyn_cast<BranchInst>(BackedgeBlock->getTerminator()))
- if (BI->isConditional())
- if (SetCondInst *SCI = dyn_cast<SetCondInst>(BI->getCondition()))
- if (SCI->getOperand(0) == Inc)
+ if (BI->isConditional()) {
+ if (ICmpInst *ICI = dyn_cast<ICmpInst>(BI->getCondition())) {
+ if (ICI->getOperand(0) == Inc)
if (BI->getSuccessor(0) == getHeader()) {
- if (SCI->getOpcode() == Instruction::SetNE)
- return SCI->getOperand(1);
- } else if (SCI->getOpcode() == Instruction::SetEQ) {
- return SCI->getOperand(1);
+ if (ICI->getPredicate() == ICmpInst::ICMP_NE)
+ return ICI->getOperand(1);
+ } else if (ICI->getPredicate() == ICmpInst::ICMP_EQ) {
+ return ICI->getOperand(1);
}
+ }
+ }
return 0;
}
// are signless. There won't be a need to bitcast then.
if (V->getType()->isSigned()) {
const Type *NewTy = V->getType()->getUnsignedVersion();
- V = cast<ConstantInt>(
- ConstantExpr::getBitCast(V, NewTy));
+ V = cast<ConstantInt>(ConstantExpr::getBitCast(V, NewTy));
}
SCEVConstant *&R = (*SCEVConstants)[V];
C = Constant::getNullValue(Ty);
else if (Ty->isFloatingPoint())
C = ConstantFP::get(Ty, Val);
- /// FIXME:Signless. when integer types are signless, just change this to:
- /// else
- /// C = ConstantInt::get(Ty, Val);
- else if (Ty->isSigned())
+ else
C = ConstantInt::get(Ty, Val);
- else {
- C = ConstantInt::get(Ty->getSignedVersion(), Val);
- C = ConstantExpr::getBitCast(C, Ty);
- }
return SCEVUnknown::get(C);
}
for (; NumSteps; --NumSteps)
Result *= Val-(NumSteps-1);
Constant *Res = ConstantInt::get(Type::ULongTy, Result);
- return SCEVUnknown::get(
- ConstantExpr::getTruncOrBitCast(Res, V->getType()));
+ return SCEVUnknown::get(ConstantExpr::getTruncOrBitCast(Res, V->getType()));
}
const Type *Ty = V->getType();
SCEVHandle ComputeLoadConstantCompareIterationCount(LoadInst *LI,
Constant *RHS,
const Loop *L,
- unsigned SetCCOpcode);
+ ICmpInst::Predicate p);
/// ComputeIterationCountExhaustively - If the trip is known to execute a
/// constant number of times (the condition evolves only from constants),
BranchInst *ExitBr = dyn_cast<BranchInst>(ExitingBlock->getTerminator());
if (ExitBr == 0) return UnknownValue;
assert(ExitBr->isConditional() && "If unconditional, it can't be in loop!");
- SetCondInst *ExitCond = dyn_cast<SetCondInst>(ExitBr->getCondition());
- if (ExitCond == 0) // Not a setcc
+ ICmpInst *ExitCond = dyn_cast<ICmpInst>(ExitBr->getCondition());
+
+ // If its not an integer comparison then compute it the hard way.
+ // Note that ICmpInst deals with pointer comparisons too so we must check
+ // the type of the operand.
+ if (ExitCond == 0 || !ExitCond->getOperand(0)->getType()->isIntegral())
return ComputeIterationCountExhaustively(L, ExitBr->getCondition(),
ExitBr->getSuccessor(0) == ExitBlock);
- // If the condition was exit on true, convert the condition to exit on false.
- Instruction::BinaryOps Cond;
+ // If the condition was exit on true, convert the condition to exit on false
+ ICmpInst::Predicate Cond;
if (ExitBr->getSuccessor(1) == ExitBlock)
- Cond = ExitCond->getOpcode();
+ Cond = ExitCond->getPredicate();
else
- Cond = ExitCond->getInverseCondition();
+ Cond = ExitCond->getInversePredicate();
// Handle common loops like: for (X = "string"; *X; ++X)
if (LoadInst *LI = dyn_cast<LoadInst>(ExitCond->getOperand(0)))
Tmp = getSCEVAtScope(RHS, L);
if (!isa<SCEVCouldNotCompute>(Tmp)) RHS = Tmp;
- // At this point, we would like to compute how many iterations of the loop the
- // predicate will return true for these inputs.
+ // At this point, we would like to compute how many iterations of the
+ // loop the predicate will return true for these inputs.
if (isa<SCEVConstant>(LHS) && !isa<SCEVConstant>(RHS)) {
// If there is a constant, force it into the RHS.
std::swap(LHS, RHS);
- Cond = SetCondInst::getSwappedCondition(Cond);
+ Cond = ICmpInst::getSwappedPredicate(Cond);
}
// FIXME: think about handling pointer comparisons! i.e.:
CompRange = ConstantRange(NewL, NewU);
}
- SCEVHandle Ret = AddRec->getNumIterationsInRange(CompRange);
+ SCEVHandle Ret = AddRec->getNumIterationsInRange(CompRange,
+ ICmpInst::isSignedPredicate(Cond));
if (!isa<SCEVCouldNotCompute>(Ret)) return Ret;
}
}
switch (Cond) {
- case Instruction::SetNE: // while (X != Y)
+ case ICmpInst::ICMP_NE: { // while (X != Y)
// Convert to: while (X-Y != 0)
- if (LHS->getType()->isInteger()) {
- SCEVHandle TC = HowFarToZero(SCEV::getMinusSCEV(LHS, RHS), L);
- if (!isa<SCEVCouldNotCompute>(TC)) return TC;
- }
+ SCEVHandle TC = HowFarToZero(SCEV::getMinusSCEV(LHS, RHS), L);
+ if (!isa<SCEVCouldNotCompute>(TC)) return TC;
break;
- case Instruction::SetEQ:
+ }
+ case ICmpInst::ICMP_EQ: {
// Convert to: while (X-Y == 0) // while (X == Y)
- if (LHS->getType()->isInteger()) {
- SCEVHandle TC = HowFarToNonZero(SCEV::getMinusSCEV(LHS, RHS), L);
- if (!isa<SCEVCouldNotCompute>(TC)) return TC;
- }
+ SCEVHandle TC = HowFarToNonZero(SCEV::getMinusSCEV(LHS, RHS), L);
+ if (!isa<SCEVCouldNotCompute>(TC)) return TC;
break;
- case Instruction::SetLT:
- if (LHS->getType()->isInteger() &&
- ExitCond->getOperand(0)->getType()->isSigned()) {
- SCEVHandle TC = HowManyLessThans(LHS, RHS, L);
- if (!isa<SCEVCouldNotCompute>(TC)) return TC;
- }
+ }
+ case ICmpInst::ICMP_SLT: {
+ SCEVHandle TC = HowManyLessThans(LHS, RHS, L);
+ if (!isa<SCEVCouldNotCompute>(TC)) return TC;
break;
- case Instruction::SetGT:
- if (LHS->getType()->isInteger() &&
- ExitCond->getOperand(0)->getType()->isSigned()) {
- SCEVHandle TC = HowManyLessThans(RHS, LHS, L);
- if (!isa<SCEVCouldNotCompute>(TC)) return TC;
- }
+ }
+ case ICmpInst::ICMP_SGT: {
+ SCEVHandle TC = HowManyLessThans(RHS, LHS, L);
+ if (!isa<SCEVCouldNotCompute>(TC)) return TC;
break;
+ }
default:
#if 0
cerr << "ComputeIterationCount ";
if (ExitCond->getOperand(0)->getType()->isUnsigned())
cerr << "[unsigned] ";
cerr << *LHS << " "
- << Instruction::getOpcodeName(Cond) << " " << *RHS << "\n";
+ << Instruction::getOpcodeName(Instruction::ICmp)
+ << " " << *RHS << "\n";
#endif
break;
}
-
return ComputeIterationCountExhaustively(L, ExitCond,
- ExitBr->getSuccessor(0) == ExitBlock);
+ ExitBr->getSuccessor(0) == ExitBlock);
}
static ConstantInt *
/// 'setcc load X, cst', try to se if we can compute the trip count.
SCEVHandle ScalarEvolutionsImpl::
ComputeLoadConstantCompareIterationCount(LoadInst *LI, Constant *RHS,
- const Loop *L, unsigned SetCCOpcode) {
+ const Loop *L,
+ ICmpInst::Predicate predicate) {
if (LI->isVolatile()) return UnknownValue;
// Check to see if the loaded pointer is a getelementptr of a global.
if (Result == 0) break; // Cannot compute!
// Evaluate the condition for this iteration.
- Result = ConstantExpr::get(SetCCOpcode, Result, RHS);
+ Result = ConstantExpr::getICmp(predicate, Result, RHS);
if (!isa<ConstantBool>(Result)) break; // Couldn't decide for sure
if (cast<ConstantBool>(Result)->getValue() == false) {
#if 0
/// CanConstantFold - Return true if we can constant fold an instruction of the
/// specified type, assuming that all operands were constants.
static bool CanConstantFold(const Instruction *I) {
- if (isa<BinaryOperator>(I) || isa<ShiftInst>(I) ||
+ if (isa<BinaryOperator>(I) || isa<ShiftInst>(I) || isa<CmpInst>(I) ||
isa<SelectInst>(I) || isa<CastInst>(I) || isa<GetElementPtrInst>(I))
return true;
return ConstantFoldCall(cast<Function>(GV), Operands);
}
return 0;
- case Instruction::GetElementPtr:
+ case Instruction::GetElementPtr: {
Constant *Base = Operands[0];
Operands.erase(Operands.begin());
return ConstantExpr::getGetElementPtr(Base, Operands);
}
+ case Instruction::ICmp:
+ return ConstantExpr::getICmp(
+ cast<ICmpInst>(I)->getPredicate(), Operands[0], Operands[1]);
+ case Instruction::FCmp:
+ return ConstantExpr::getFCmp(
+ cast<FCmpInst>(I)->getPredicate(), Operands[0], Operands[1]);
+ }
return 0;
}
// Pick the smallest positive root value.
assert(R1->getType()->isUnsigned()&&"Didn't canonicalize to unsigned?");
if (ConstantBool *CB =
- dyn_cast<ConstantBool>(ConstantExpr::getSetLT(R1->getValue(),
- R2->getValue()))) {
+ dyn_cast<ConstantBool>(ConstantExpr::getICmp(ICmpInst::ICMP_ULT,
+ R1->getValue(), R2->getValue()))) {
if (CB->getValue() == false)
std::swap(R1, R2); // R1 is the minimum root now.
// already. If so, the backedge will execute zero times.
if (SCEVConstant *C = dyn_cast<SCEVConstant>(V)) {
Constant *Zero = Constant::getNullValue(C->getValue()->getType());
- Constant *NonZero = ConstantExpr::getSetNE(C->getValue(), Zero);
+ Constant *NonZero =
+ ConstantExpr::getICmp(ICmpInst::ICMP_NE, C->getValue(), Zero);
if (NonZero == ConstantBool::getTrue())
return getSCEV(Zero);
return UnknownValue; // Otherwise it will loop infinitely.
// Now that we found a conditional branch that dominates the loop, check to
// see if it is the comparison we are looking for.
- SetCondInst *SCI =dyn_cast<SetCondInst>(LoopEntryPredicate->getCondition());
- if (!SCI) return UnknownValue;
- Value *PreCondLHS = SCI->getOperand(0);
- Value *PreCondRHS = SCI->getOperand(1);
- Instruction::BinaryOps Cond;
- if (LoopEntryPredicate->getSuccessor(0) == PreheaderDest)
- Cond = SCI->getOpcode();
- else
- Cond = SCI->getInverseCondition();
+ if (ICmpInst *ICI = dyn_cast<ICmpInst>(LoopEntryPredicate->getCondition())){
+ Value *PreCondLHS = ICI->getOperand(0);
+ Value *PreCondRHS = ICI->getOperand(1);
+ ICmpInst::Predicate Cond;
+ if (LoopEntryPredicate->getSuccessor(0) == PreheaderDest)
+ Cond = ICI->getPredicate();
+ else
+ Cond = ICI->getInversePredicate();
- switch (Cond) {
- case Instruction::SetGT:
- std::swap(PreCondLHS, PreCondRHS);
- Cond = Instruction::SetLT;
- // Fall Through.
- case Instruction::SetLT:
- if (PreCondLHS->getType()->isInteger() &&
- PreCondLHS->getType()->isSigned()) {
- if (RHS != getSCEV(PreCondRHS))
- return UnknownValue; // Not a comparison against 'm'.
-
- if (SCEV::getMinusSCEV(AddRec->getOperand(0), One)
- != getSCEV(PreCondLHS))
- return UnknownValue; // Not a comparison against 'n-1'.
+ switch (Cond) {
+ case ICmpInst::ICMP_UGT:
+ std::swap(PreCondLHS, PreCondRHS);
+ Cond = ICmpInst::ICMP_ULT;
break;
- } else {
- return UnknownValue;
+ case ICmpInst::ICMP_SGT:
+ std::swap(PreCondLHS, PreCondRHS);
+ Cond = ICmpInst::ICMP_SLT;
+ break;
+ default: break;
}
- default: break;
- }
- //cerr << "Computed Loop Trip Count as: "
- // << *SCEV::getMinusSCEV(RHS, AddRec->getOperand(0)) << "\n";
- return SCEV::getMinusSCEV(RHS, AddRec->getOperand(0));
+ if (Cond == ICmpInst::ICMP_SLT) {
+ if (PreCondLHS->getType()->isInteger()) {
+ if (RHS != getSCEV(PreCondRHS))
+ return UnknownValue; // Not a comparison against 'm'.
+
+ if (SCEV::getMinusSCEV(AddRec->getOperand(0), One)
+ != getSCEV(PreCondLHS))
+ return UnknownValue; // Not a comparison against 'n-1'.
+ }
+ else return UnknownValue;
+ } else if (Cond == ICmpInst::ICMP_ULT)
+ return UnknownValue;
+
+ // cerr << "Computed Loop Trip Count as: "
+ // << // *SCEV::getMinusSCEV(RHS, AddRec->getOperand(0)) << "\n";
+ return SCEV::getMinusSCEV(RHS, AddRec->getOperand(0));
+ }
+ else
+ return UnknownValue;
}
return UnknownValue;
/// this is that it returns the first iteration number where the value is not in
/// the condition, thus computing the exit count. If the iteration count can't
/// be computed, an instance of SCEVCouldNotCompute is returned.
-SCEVHandle SCEVAddRecExpr::getNumIterationsInRange(ConstantRange Range) const {
+SCEVHandle SCEVAddRecExpr::getNumIterationsInRange(ConstantRange Range,
+ bool isSigned) const {
if (Range.isFullSet()) // Infinite loop.
return new SCEVCouldNotCompute();
SCEVHandle Shifted = SCEVAddRecExpr::get(Operands, getLoop());
if (SCEVAddRecExpr *ShiftedAddRec = dyn_cast<SCEVAddRecExpr>(Shifted))
return ShiftedAddRec->getNumIterationsInRange(
- Range.subtract(SC->getValue()));
+ Range.subtract(SC->getValue()),isSigned);
// This is strange and shouldn't happen.
return new SCEVCouldNotCompute();
}
// First check to see if the range contains zero. If not, the first
// iteration exits.
ConstantInt *Zero = ConstantInt::get(getType(), 0);
- if (!Range.contains(Zero)) return SCEVConstant::get(Zero);
+ if (!Range.contains(Zero, isSigned)) return SCEVConstant::get(Zero);
if (isAffine()) {
// If this is an affine expression then we have this situation:
// range, then we computed our trip count, otherwise wrap around or other
// things must have happened.
ConstantInt *Val = EvaluateConstantChrecAtConstant(this, ExitValue);
- if (Range.contains(Val))
+ if (Range.contains(Val, isSigned))
return new SCEVCouldNotCompute(); // Something strange happened
// Ensure that the previous value is in the range. This is a sanity check.
assert(Range.contains(EvaluateConstantChrecAtConstant(this,
- ConstantExpr::getSub(ExitValue, One))) &&
+ ConstantExpr::getSub(ExitValue, One)), isSigned) &&
"Linear scev computation is off in a bad way!");
return SCEVConstant::get(cast<ConstantInt>(ExitValue));
} else if (isQuadratic()) {
// Pick the smallest positive root value.
assert(R1->getType()->isUnsigned() && "Didn't canonicalize to unsigned?");
if (ConstantBool *CB =
- dyn_cast<ConstantBool>(ConstantExpr::getSetLT(R1->getValue(),
- R2->getValue()))) {
+ dyn_cast<ConstantBool>(ConstantExpr::getICmp(ICmpInst::ICMP_ULT,
+ R1->getValue(), R2->getValue()))) {
if (CB->getValue() == false)
std::swap(R1, R2); // R1 is the minimum root now.
// for "X*X < 5", for example, we should not return a root of 2.
ConstantInt *R1Val = EvaluateConstantChrecAtConstant(this,
R1->getValue());
- if (Range.contains(R1Val)) {
+ if (Range.contains(R1Val, isSigned)) {
// The next iteration must be out of the range...
Constant *NextVal =
ConstantExpr::getAdd(R1->getValue(),
ConstantInt::get(R1->getType(), 1));
R1Val = EvaluateConstantChrecAtConstant(this, NextVal);
- if (!Range.contains(R1Val))
+ if (!Range.contains(R1Val, isSigned))
return SCEVUnknown::get(NextVal);
return new SCEVCouldNotCompute(); // Something strange happened
}
ConstantExpr::getSub(R1->getValue(),
ConstantInt::get(R1->getType(), 1));
R1Val = EvaluateConstantChrecAtConstant(this, NextVal);
- if (Range.contains(R1Val))
+ if (Range.contains(R1Val, isSigned))
return R1;
return new SCEVCouldNotCompute(); // Something strange happened
}
return new SCEVCouldNotCompute();
// Check to see if we found the value!
- if (!Range.contains(cast<SCEVConstant>(Val)->getValue()))
+ if (!Range.contains(cast<SCEVConstant>(Val)->getValue(), isSigned))
return SCEVConstant::get(TestVal);
// Increment to test the next index.
I1.getParent()->getParent() != I2->getParent()->getParent())
return false;
+ // If they are CmpInst instructions, check their predicates
+ if (CmpInst *CI1 = dyn_cast<CmpInst>(&const_cast<Instruction&>(I1)))
+ if (CI1->getPredicate() != cast<CmpInst>(I2)->getPredicate())
+ return false;
+
// They are identical if both operands are the same!
if (I1.getOperand(0) == I2->getOperand(0) &&
I1.getOperand(1) == I2->getOperand(1))
*yy_cp = '\0'; \
yy_c_buf_p = yy_cp;
-#define YY_NUM_RULES 147
-#define YY_END_OF_BUFFER 148
-static yyconst short int yy_acclist[225] =
+#define YY_NUM_RULES 141
+#define YY_END_OF_BUFFER 142
+static yyconst short int yy_acclist[219] =
{ 0,
- 148, 146, 147, 145, 146, 147, 145, 147, 146, 147,
- 146, 147, 146, 147, 146, 147, 146, 147, 146, 147,
- 138, 146, 147, 138, 146, 147, 1, 146, 147, 146,
- 147, 146, 147, 146, 147, 146, 147, 146, 147, 146,
- 147, 146, 147, 146, 147, 146, 147, 146, 147, 146,
- 147, 146, 147, 146, 147, 146, 147, 146, 147, 146,
- 147, 146, 147, 146, 147, 146, 147, 146, 147, 146,
- 147, 137, 135, 134, 134, 141, 139, 143, 138, 1,
- 120, 38, 80, 81, 70, 22, 137, 134, 134, 142,
- 143, 19, 143, 144, 60, 69, 36, 31, 39, 3,
-
- 51, 62, 90, 95, 93, 94, 92, 91, 96, 100,
- 119, 85, 83, 115, 84, 82, 61, 98, 89, 87,
- 88, 86, 99, 97, 71, 136, 143, 143, 117, 46,
- 101, 79, 65, 127, 68, 78, 128, 53, 116, 21,
- 140, 64, 104, 67, 23, 4, 58, 63, 52, 66,
- 45, 11, 103, 143, 33, 2, 5, 55, 106, 57,
- 47, 73, 77, 75, 76, 74, 72, 49, 129, 102,
- 48, 54, 20, 126, 42, 56, 27, 41, 110, 109,
- 7, 122, 30, 125, 35, 59, 114, 108, 121, 24,
- 25, 107, 123, 50, 118, 113, 40, 6, 26, 105,
-
- 34, 8, 16, 9, 111, 10, 112, 32, 12, 14,
- 13, 29, 37, 15, 28, 124, 130, 132, 133, 43,
- 131, 17, 44, 18
+ 142, 140, 141, 139, 140, 141, 139, 141, 140, 141,
+ 140, 141, 140, 141, 140, 141, 140, 141, 140, 141,
+ 132, 140, 141, 132, 140, 141, 1, 140, 141, 140,
+ 141, 140, 141, 140, 141, 140, 141, 140, 141, 140,
+ 141, 140, 141, 140, 141, 140, 141, 140, 141, 140,
+ 141, 140, 141, 140, 141, 140, 141, 140, 141, 140,
+ 141, 140, 141, 140, 141, 140, 141, 140, 141, 140,
+ 141, 131, 129, 128, 128, 135, 133, 137, 132, 1,
+ 114, 38, 74, 75, 70, 22, 131, 128, 128, 136,
+ 137, 19, 137, 138, 60, 69, 36, 31, 39, 3,
+
+ 51, 62, 84, 89, 87, 88, 86, 85, 90, 94,
+ 113, 79, 77, 109, 78, 76, 61, 92, 83, 81,
+ 82, 80, 93, 91, 71, 130, 137, 137, 111, 46,
+ 95, 73, 65, 121, 68, 72, 122, 53, 110, 21,
+ 134, 64, 98, 67, 23, 4, 58, 63, 52, 66,
+ 45, 11, 97, 137, 33, 2, 5, 55, 100, 57,
+ 47, 49, 123, 96, 48, 54, 20, 120, 42, 56,
+ 27, 41, 104, 103, 7, 116, 30, 119, 35, 59,
+ 108, 102, 115, 24, 25, 101, 117, 50, 112, 107,
+ 40, 6, 26, 99, 34, 8, 16, 9, 105, 10,
+
+ 106, 32, 12, 14, 13, 29, 37, 15, 28, 118,
+ 124, 126, 127, 43, 125, 17, 44, 18
} ;
-static yyconst short int yy_accept[581] =
+static yyconst short int yy_accept[570] =
{ 0,
1, 1, 1, 2, 4, 7, 9, 11, 13, 15,
17, 19, 21, 24, 27, 30, 32, 34, 36, 38,
102, 102, 102, 102, 102, 102, 103, 103, 104, 105,
106, 107, 108, 109, 109, 110, 111, 111, 111, 112,
- 112, 112, 112, 112, 112, 112, 112, 113, 114, 115,
- 115, 115, 115, 115, 116, 117, 117, 117, 118, 118,
- 118, 118, 118, 118, 118, 118, 118, 119, 120, 121,
- 121, 121, 122, 122, 123, 123, 124, 125, 125, 125,
- 125, 125, 125, 125, 125, 125, 125, 126, 126, 126,
- 127, 128, 128, 128, 128, 129, 129, 129, 129, 130,
- 130, 130, 131, 132, 132, 132, 132, 132, 132, 132,
- 132, 132, 132, 132, 132, 132, 132, 132, 133, 134,
- 134, 134, 134, 134, 135, 136, 136, 136, 137, 137,
- 137, 137, 137, 137, 137, 137, 137, 138, 139, 140,
-
- 140, 140, 141, 141, 141, 141, 142, 142, 143, 143,
- 143, 143, 143, 143, 143, 144, 144, 144, 144, 144,
- 145, 145, 145, 146, 146, 146, 147, 147, 148, 148,
- 149, 150, 150, 150, 150, 150, 150, 151, 151, 151,
- 152, 152, 153, 153, 153, 154, 155, 156, 156, 156,
- 157, 157, 157, 157, 157, 157, 157, 157, 157, 157,
- 157, 157, 157, 157, 158, 158, 159, 160, 160, 160,
- 160, 160, 160, 160, 160, 160, 160, 160, 161, 161,
- 161, 161, 161, 161, 161, 161, 162, 162, 162, 163,
- 164, 165, 166, 167, 168, 169, 169, 169, 169, 170,
-
- 170, 170, 170, 171, 172, 172, 173, 174, 174, 174,
- 174, 174, 174, 174, 174, 174, 175, 175, 175, 176,
- 176, 176, 176, 176, 176, 176, 176, 177, 178, 178,
- 178, 179, 180, 181, 181, 181, 182, 182, 182, 182,
- 182, 183, 183, 184, 185, 186, 187, 187, 187, 187,
- 188, 188, 188, 189, 190, 191, 192, 193, 193, 194,
- 195, 196, 196, 196, 196, 196, 196, 197, 197, 198,
- 198, 199, 200, 200, 200, 200, 200, 200, 201, 201,
- 201, 201, 201, 201, 201, 201, 201, 202, 202, 202,
- 202, 202, 202, 202, 202, 202, 203, 203, 203, 203,
-
- 203, 204, 204, 204, 204, 204, 205, 206, 207, 207,
- 208, 208, 208, 208, 209, 209, 209, 209, 210, 210,
- 211, 212, 212, 212, 212, 212, 212, 212, 212, 212,
- 212, 212, 212, 212, 213, 213, 213, 213, 213, 213,
- 213, 213, 214, 214, 214, 214, 214, 215, 215, 215,
- 215, 215, 216, 216, 217, 217, 217, 217, 217, 217,
- 217, 217, 217, 217, 217, 217, 217, 218, 218, 219,
- 220, 220, 221, 221, 222, 223, 224, 224, 225, 225
+ 112, 112, 112, 112, 112, 112, 113, 114, 115, 115,
+ 115, 115, 115, 116, 117, 117, 117, 118, 118, 118,
+ 118, 118, 118, 118, 118, 118, 119, 120, 121, 121,
+ 121, 122, 122, 123, 123, 124, 125, 125, 125, 125,
+ 125, 125, 125, 125, 125, 125, 126, 126, 126, 127,
+ 128, 128, 128, 128, 129, 129, 129, 129, 130, 130,
+ 130, 131, 132, 132, 132, 132, 132, 132, 132, 132,
+ 132, 132, 132, 132, 132, 132, 132, 133, 134, 134,
+ 134, 134, 134, 135, 136, 136, 136, 137, 137, 137,
+ 137, 137, 137, 137, 137, 137, 138, 139, 140, 140,
+
+ 140, 141, 141, 141, 141, 142, 142, 143, 143, 143,
+ 144, 144, 144, 144, 144, 145, 145, 145, 146, 146,
+ 146, 147, 147, 148, 148, 149, 150, 150, 150, 150,
+ 150, 150, 151, 151, 151, 152, 152, 153, 153, 153,
+ 154, 155, 156, 156, 156, 157, 157, 157, 157, 157,
+ 157, 157, 157, 157, 157, 157, 157, 157, 157, 158,
+ 158, 159, 160, 160, 160, 160, 160, 160, 160, 160,
+ 160, 160, 160, 161, 161, 161, 161, 161, 161, 161,
+ 161, 162, 162, 162, 163, 163, 163, 163, 164, 164,
+ 164, 164, 165, 166, 166, 167, 168, 168, 168, 168,
+
+ 168, 168, 168, 168, 168, 169, 169, 169, 170, 170,
+ 170, 170, 170, 170, 170, 170, 171, 172, 172, 172,
+ 173, 174, 175, 175, 175, 176, 176, 176, 176, 176,
+ 177, 177, 178, 179, 180, 181, 181, 181, 181, 182,
+ 182, 182, 183, 184, 185, 186, 187, 187, 188, 189,
+ 190, 190, 190, 190, 190, 190, 191, 191, 192, 192,
+ 193, 194, 194, 194, 194, 194, 194, 195, 195, 195,
+ 195, 195, 195, 195, 195, 195, 196, 196, 196, 196,
+ 196, 196, 196, 196, 196, 197, 197, 197, 197, 197,
+ 198, 198, 198, 198, 198, 199, 200, 201, 201, 202,
+
+ 202, 202, 202, 203, 203, 203, 203, 204, 204, 205,
+ 206, 206, 206, 206, 206, 206, 206, 206, 206, 206,
+ 206, 206, 206, 207, 207, 207, 207, 207, 207, 207,
+ 207, 208, 208, 208, 208, 208, 209, 209, 209, 209,
+ 209, 210, 210, 211, 211, 211, 211, 211, 211, 211,
+ 211, 211, 211, 211, 211, 211, 212, 212, 213, 214,
+ 214, 215, 215, 216, 217, 218, 218, 219, 219
} ;
static yyconst int yy_ec[256] =
3, 3, 3
} ;
-static yyconst short int yy_base[585] =
+static yyconst short int yy_base[574] =
{ 0,
- 0, 0, 1248, 1249, 1249, 1249, 1243, 1232, 36, 40,
+ 0, 0, 1226, 1227, 1227, 1227, 1221, 1210, 36, 40,
44, 50, 56, 62, 0, 63, 66, 81, 89, 47,
108, 91, 95, 92, 72, 109, 134, 119, 117, 160,
- 120, 191, 139, 121, 136, 150, 1241, 1249, 1230, 1249,
+ 120, 191, 139, 121, 136, 150, 1219, 1227, 1208, 1227,
0, 165, 180, 197, 219, 70, 224, 239, 244, 0,
- 68, 152, 93, 128, 158, 190, 245, 31, 1229, 188,
- 182, 211, 48, 207, 248, 210, 122, 124, 1228, 209,
+ 68, 152, 93, 128, 158, 190, 245, 31, 1207, 188,
+ 182, 211, 48, 207, 248, 210, 122, 124, 1206, 209,
257, 258, 185, 259, 260, 261, 262, 263, 264, 265,
- 266, 276, 273, 287, 286, 278, 294, 295, 1227, 297,
+ 266, 276, 273, 287, 286, 278, 294, 295, 1205, 297,
299, 300, 305, 306, 303, 313, 307, 311, 301, 316,
- 46, 317, 318, 325, 326, 329, 333, 327, 334, 337,
- 351, 346, 354, 1226, 358, 342, 338, 360, 363, 365,
- 362, 368, 372, 369, 364, 271, 384, 387, 231, 389,
- 394, 1225, 0, 404, 408, 1224, 426, 443, 0, 1223,
- 408, 395, 1222, 409, 412, 1221, 414, 1220, 431, 430,
- 432, 1219, 420, 434, 444, 446, 448, 449, 452, 454,
- 455, 450, 457, 458, 466, 180, 462, 469, 470, 473,
- 474, 472, 475, 477, 484, 486, 480, 490, 487, 497,
- 500, 502, 503, 504, 505, 1218, 506, 1217, 1216, 1215,
- 1214, 1213, 1212, 396, 1211, 1210, 510, 507, 1209, 535,
-
- 512, 511, 516, 514, 546, 525, 1208, 1207, 1206, 526,
- 518, 549, 550, 1205, 1204, 551, 552, 1203, 553, 554,
- 559, 556, 562, 565, 560, 564, 1202, 1201, 1200, 572,
- 566, 1199, 577, 1198, 578, 1197, 1196, 581, 580, 582,
- 585, 517, 588, 586, 592, 597, 1195, 599, 600, 1249,
- 611, 628, 632, 636, 641, 602, 604, 642, 1194, 643,
- 613, 1193, 1192, 605, 644, 645, 646, 647, 649, 648,
- 650, 654, 651, 653, 658, 655, 665, 1191, 1190, 657,
- 670, 673, 676, 1189, 1188, 671, 677, 1187, 678, 681,
- 683, 685, 684, 679, 688, 690, 1186, 1185, 1184, 689,
-
- 696, 1183, 691, 699, 692, 0, 708, 1182, 701, 709,
- 712, 718, 719, 720, 1181, 713, 721, 724, 725, 1180,
- 730, 737, 1179, 734, 723, 1178, 740, 1177, 745, 1176,
- 1175, 746, 748, 750, 752, 749, 1174, 751, 753, 1173,
- 755, 1172, 758, 762, 1171, 785, 1170, 764, 763, 1169,
- 765, 770, 785, 779, 788, 773, 761, 776, 789, 791,
- 792, 796, 797, 1168, 798, 1167, 1166, 799, 801, 802,
- 806, 803, 807, 810, 811, 816, 817, 1165, 820, 821,
- 822, 825, 827, 831, 832, 1164, 824, 838, 1163, 1162,
- 1161, 1160, 1159, 1158, 1157, 839, 841, 843, 1156, 844,
-
- 846, 848, 1155, 1154, 847, 1153, 1152, 852, 850, 849,
- 853, 855, 860, 863, 867, 1151, 870, 871, 1150, 873,
- 874, 875, 876, 877, 878, 879, 1149, 1148, 887, 882,
- 1147, 1146, 1145, 888, 893, 1144, 880, 898, 901, 900,
- 1143, 904, 1142, 1141, 1140, 1139, 908, 902, 910, 1138,
- 912, 914, 1137, 1136, 1135, 1134, 1133, 913, 1132, 1131,
- 1130, 915, 916, 918, 920, 917, 1129, 922, 1128, 928,
- 1127, 1126, 931, 932, 935, 936, 939, 1125, 940, 937,
- 941, 942, 943, 950, 944, 947, 1124, 955, 958, 960,
- 962, 963, 968, 969, 972, 1123, 973, 976, 977, 978,
-
- 1122, 974, 979, 981, 982, 1121, 1118, 1108, 985, 1107,
- 984, 988, 1001, 1106, 1002, 1003, 1005, 1105, 990, 1103,
- 1102, 1006, 1010, 994, 1015, 1012, 1014, 1016, 1021, 1022,
- 1024, 1025, 1026, 1101, 1027, 1030, 1032, 1033, 1036, 1038,
- 1034, 1100, 1039, 1035, 1049, 1052, 1098, 1053, 1042, 1055,
- 1054, 1097, 1058, 1093, 1059, 1063, 1060, 1061, 1066, 1072,
- 1069, 1075, 1077, 1079, 1080, 1081, 1091, 1082, 1083, 726,
- 1088, 616, 1085, 615, 515, 476, 1089, 370, 1249, 1124,
- 1126, 341, 1130, 151
+ 46, 317, 318, 325, 326, 329, 333, 327, 334, 330,
+ 351, 342, 346, 1204, 358, 354, 337, 361, 360, 363,
+ 362, 366, 369, 383, 364, 271, 381, 388, 231, 370,
+ 397, 1203, 0, 402, 406, 1202, 429, 446, 0, 1201,
+ 406, 412, 1200, 407, 410, 1199, 408, 1198, 413, 419,
+ 422, 1197, 433, 414, 447, 448, 435, 449, 452, 451,
+ 454, 459, 455, 458, 460, 180, 466, 462, 469, 475,
+ 463, 470, 473, 478, 474, 485, 482, 486, 488, 496,
+ 497, 498, 499, 501, 503, 1196, 506, 1195, 1194, 1193,
+ 1192, 1191, 1190, 504, 1189, 1188, 511, 507, 1187, 535,
+
+ 512, 514, 513, 517, 523, 1186, 1185, 1184, 529, 515,
+ 547, 548, 1183, 1182, 549, 551, 1181, 552, 553, 558,
+ 554, 561, 555, 557, 559, 1180, 1179, 1178, 560, 563,
+ 1177, 562, 1176, 567, 1175, 1174, 577, 574, 582, 571,
+ 585, 510, 588, 591, 592, 1173, 594, 595, 1227, 604,
+ 623, 612, 627, 632, 597, 599, 633, 1172, 634, 635,
+ 1171, 1170, 636, 615, 637, 639, 641, 642, 644, 645,
+ 647, 648, 649, 652, 656, 659, 1169, 1168, 658, 663,
+ 667, 664, 1167, 1166, 668, 669, 1165, 673, 672, 675,
+ 676, 678, 680, 679, 684, 1164, 1163, 1162, 685, 687,
+
+ 1161, 677, 690, 698, 0, 700, 1160, 704, 705, 1159,
+ 706, 708, 710, 711, 1158, 714, 715, 1157, 724, 720,
+ 1156, 725, 1155, 727, 1154, 1153, 728, 726, 730, 734,
+ 731, 1152, 741, 742, 1151, 743, 1150, 745, 744, 1149,
+ 753, 1148, 753, 746, 1147, 747, 761, 759, 765, 770,
+ 756, 773, 771, 774, 776, 778, 780, 781, 1146, 782,
+ 1145, 1144, 783, 786, 784, 791, 787, 792, 794, 798,
+ 803, 804, 1143, 806, 805, 809, 810, 811, 812, 818,
+ 1142, 807, 824, 1141, 826, 827, 829, 1140, 411, 828,
+ 830, 1139, 1138, 833, 1137, 1136, 835, 832, 834, 838,
+
+ 843, 845, 836, 844, 1135, 853, 846, 1134, 854, 855,
+ 858, 863, 860, 865, 867, 1133, 1132, 870, 864, 1131,
+ 1130, 1129, 873, 868, 1128, 879, 881, 889, 876, 1127,
+ 891, 1126, 1125, 1124, 1123, 892, 878, 893, 1122, 896,
+ 897, 1121, 1120, 1119, 1118, 1117, 900, 1116, 1115, 1114,
+ 901, 902, 903, 904, 906, 1113, 908, 1112, 909, 1111,
+ 1110, 914, 915, 918, 919, 920, 1109, 921, 922, 925,
+ 926, 928, 933, 932, 937, 1108, 938, 943, 945, 946,
+ 947, 951, 948, 953, 1107, 956, 959, 961, 957, 1106,
+ 962, 968, 965, 967, 1105, 1104, 1103, 973, 1102, 969,
+
+ 972, 975, 1101, 983, 987, 989, 1098, 974, 1088, 1086,
+ 991, 994, 993, 995, 998, 999, 1001, 1004, 1005, 1006,
+ 1007, 1010, 1085, 1009, 1013, 1012, 1017, 1021, 1024, 1018,
+ 1084, 1025, 1032, 1035, 1036, 1083, 1037, 1019, 1026, 1038,
+ 1082, 1043, 1077, 1044, 1045, 1049, 1048, 1053, 1054, 1056,
+ 1057, 1060, 1063, 1058, 1066, 1076, 1064, 1073, 877, 1068,
+ 760, 1071, 707, 604, 522, 1069, 368, 1227, 1104, 1106,
+ 349, 1110, 151
} ;
-static yyconst short int yy_def[585] =
+static yyconst short int yy_def[574] =
{ 0,
- 579, 1, 579, 579, 579, 579, 580, 581, 582, 579,
- 581, 581, 581, 581, 583, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 580, 579, 581, 579,
- 584, 584, 579, 579, 581, 581, 581, 581, 581, 583,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
-
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 579, 584, 584, 579, 581, 581, 581, 49, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 49,
-
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 579,
- 579, 579, 579, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
-
- 581, 581, 581, 581, 581, 200, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 579, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
-
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
-
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 581, 581,
- 581, 581, 581, 581, 581, 581, 581, 581, 0, 579,
- 579, 579, 579, 579
+ 568, 1, 568, 568, 568, 568, 569, 570, 571, 568,
+ 570, 570, 570, 570, 572, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 569, 568, 570, 568,
+ 573, 573, 568, 568, 570, 570, 570, 570, 570, 572,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 568, 573, 573, 568, 570, 570, 570, 49, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 49,
+
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 568, 568,
+ 568, 568, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+
+ 570, 570, 570, 570, 200, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 568, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 570, 570, 570,
+ 570, 570, 570, 570, 570, 570, 570, 0, 568, 568,
+ 568, 568, 568
} ;
-static yyconst short int yy_nxt[1293] =
+static yyconst short int yy_nxt[1271] =
{ 0,
4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 14, 14, 4, 15, 8, 8, 8, 16, 17,
43, 43, 43, 40, 109, 40, 110, 111, 40, 112,
101, 40, 152, 40, 40, 135, 44, 44, 44, 44,
- 117, 166, 118, 119, 147, 120, 151, 121, 279, 122,
+ 117, 166, 118, 119, 147, 120, 151, 121, 278, 122,
40, 123, 40, 40, 40, 124, 125, 47, 45, 45,
45, 45, 40, 137, 137, 137, 137, 40, 159, 153,
- 138, 154, 246, 156, 40, 162, 138, 47, 48, 48,
+ 138, 154, 245, 156, 40, 162, 138, 47, 48, 48,
48, 48, 40, 139, 139, 139, 139, 40, 40, 139,
139, 40, 139, 139, 139, 139, 139, 139, 157, 148,
40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 158, 149, 168, 170, 40, 163, 40, 165, 242, 40,
+ 158, 149, 168, 170, 40, 163, 40, 165, 241, 40,
167, 40, 164, 173, 172, 178, 169, 174, 171, 40,
40, 175, 176, 179, 177, 181, 184, 40, 40, 180,
40, 183, 40, 40, 40, 185, 40, 182, 40, 40,
40, 194, 189, 186, 40, 187, 40, 191, 193, 40,
40, 40, 188, 196, 195, 198, 190, 197, 40, 40,
- 40, 192, 40, 41, 202, 203, 40, 40, 207, 214,
- 40, 40, 199, 204, 212, 40, 216, 209, 201, 40,
- 210, 205, 208, 215, 40, 206, 211, 40, 217, 213,
- 218, 40, 219, 40, 224, 40, 40, 40, 40, 225,
- 220, 40, 40, 40, 222, 40, 226, 228, 221, 241,
- 232, 240, 230, 235, 236, 223, 227, 40, 231, 233,
-
- 40, 229, 40, 237, 234, 245, 238, 40, 40, 40,
- 243, 239, 244, 134, 134, 134, 134, 251, 251, 251,
- 251, 40, 40, 247, 252, 40, 257, 40, 248, 303,
- 252, 258, 256, 40, 249, 137, 137, 137, 137, 40,
- 260, 264, 138, 40, 40, 40, 259, 40, 138, 253,
- 254, 261, 255, 255, 255, 255, 40, 40, 262, 40,
- 263, 40, 40, 40, 267, 40, 266, 40, 40, 265,
- 40, 40, 274, 272, 270, 40, 268, 269, 271, 40,
- 280, 273, 40, 40, 275, 40, 40, 40, 40, 40,
- 40, 287, 276, 40, 277, 284, 286, 40, 278, 40,
-
- 40, 282, 285, 40, 283, 289, 290, 288, 291, 281,
- 40, 293, 294, 40, 295, 40, 40, 40, 40, 40,
- 40, 297, 292, 40, 40, 40, 298, 40, 40, 40,
- 40, 40, 300, 296, 302, 339, 310, 299, 40, 40,
- 304, 317, 301, 305, 306, 306, 306, 306, 307, 308,
- 306, 306, 309, 306, 306, 306, 306, 306, 306, 40,
- 316, 315, 40, 40, 40, 40, 40, 40, 311, 40,
- 312, 318, 40, 40, 313, 40, 314, 40, 40, 40,
- 320, 319, 323, 324, 326, 40, 321, 328, 325, 322,
- 40, 40, 327, 40, 40, 40, 329, 332, 40, 40,
-
- 334, 40, 330, 335, 341, 40, 336, 333, 331, 340,
- 40, 337, 40, 40, 343, 40, 338, 40, 40, 342,
- 251, 251, 251, 251, 348, 352, 40, 252, 40, 40,
- 344, 351, 347, 252, 253, 253, 345, 346, 346, 346,
- 346, 346, 346, 346, 346, 255, 255, 255, 255, 40,
- 255, 255, 255, 255, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 356, 40, 40, 40, 361,
- 40, 40, 349, 350, 355, 357, 363, 364, 40, 359,
- 353, 354, 360, 40, 40, 365, 40, 362, 358, 40,
- 40, 40, 40, 366, 40, 372, 40, 40, 40, 371,
-
- 373, 40, 40, 40, 40, 40, 367, 378, 368, 40,
- 369, 377, 40, 370, 40, 374, 376, 375, 380, 379,
- 381, 40, 40, 385, 382, 40, 40, 387, 383, 388,
- 386, 40, 40, 40, 40, 384, 40, 40, 40, 40,
- 390, 392, 394, 40, 396, 389, 397, 40, 398, 395,
- 40, 402, 399, 40, 391, 393, 401, 400, 40, 40,
- 403, 40, 40, 40, 40, 40, 40, 404, 40, 405,
- 408, 40, 406, 407, 40, 40, 40, 40, 40, 409,
- 424, 413, 416, 40, 417, 410, 40, 411, 415, 40,
- 419, 412, 40, 414, 346, 346, 346, 346, 40, 421,
-
- 418, 40, 40, 420, 40, 40, 422, 423, 425, 40,
- 40, 40, 40, 427, 40, 40, 40, 430, 431, 40,
- 40, 426, 428, 40, 40, 432, 429, 433, 435, 40,
- 40, 436, 434, 40, 40, 40, 437, 40, 40, 441,
- 40, 439, 444, 443, 40, 40, 438, 445, 440, 446,
- 442, 40, 40, 447, 40, 449, 40, 40, 448, 40,
- 40, 40, 40, 40, 452, 40, 40, 451, 40, 454,
- 456, 459, 458, 40, 450, 453, 40, 461, 463, 457,
- 40, 462, 455, 40, 40, 460, 40, 40, 40, 40,
- 40, 40, 40, 40, 469, 40, 466, 465, 471, 464,
-
- 40, 40, 480, 468, 475, 476, 40, 467, 478, 473,
- 474, 40, 472, 40, 40, 40, 470, 40, 477, 482,
- 481, 40, 479, 40, 484, 40, 40, 40, 40, 40,
- 40, 40, 486, 40, 488, 40, 483, 489, 490, 493,
- 487, 40, 485, 491, 40, 40, 494, 495, 40, 40,
- 40, 492, 40, 40, 40, 40, 40, 40, 496, 497,
- 40, 502, 503, 40, 501, 498, 499, 504, 40, 505,
- 506, 40, 508, 40, 500, 40, 40, 507, 513, 509,
- 512, 40, 40, 510, 514, 40, 40, 40, 516, 40,
- 40, 40, 40, 511, 40, 40, 518, 40, 40, 515,
-
- 522, 40, 523, 40, 526, 517, 528, 40, 529, 524,
- 519, 527, 520, 521, 40, 40, 40, 525, 40, 40,
- 530, 532, 531, 40, 535, 40, 534, 40, 40, 40,
- 537, 533, 536, 538, 40, 40, 541, 40, 40, 40,
- 40, 539, 544, 40, 546, 40, 40, 40, 40, 40,
- 543, 40, 40, 545, 547, 40, 540, 542, 551, 548,
- 552, 554, 40, 555, 549, 40, 40, 40, 40, 550,
- 553, 40, 40, 40, 40, 558, 40, 556, 559, 40,
- 557, 560, 40, 564, 561, 40, 565, 563, 40, 562,
- 40, 566, 40, 40, 40, 40, 40, 571, 40, 572,
-
- 567, 40, 40, 568, 40, 569, 40, 577, 576, 570,
- 40, 40, 575, 40, 40, 40, 40, 574, 40, 40,
- 40, 40, 573, 578, 37, 37, 37, 37, 39, 39,
+ 40, 192, 40, 40, 202, 203, 40, 40, 206, 213,
+ 40, 41, 199, 204, 211, 40, 215, 208, 201, 40,
+ 209, 216, 207, 214, 40, 205, 210, 40, 218, 212,
+ 217, 40, 219, 40, 40, 40, 40, 40, 224, 40,
+ 220, 40, 40, 40, 221, 227, 223, 225, 231, 240,
+ 234, 235, 229, 226, 40, 222, 40, 232, 230, 228,
+
+ 236, 40, 233, 237, 246, 239, 244, 242, 238, 243,
+ 40, 134, 134, 134, 134, 250, 250, 250, 250, 40,
+ 40, 40, 251, 40, 40, 40, 40, 40, 251, 257,
+ 255, 247, 40, 260, 259, 40, 443, 248, 137, 137,
+ 137, 137, 40, 256, 258, 138, 40, 261, 40, 264,
+ 262, 138, 252, 253, 263, 254, 254, 254, 254, 40,
+ 40, 40, 40, 267, 40, 40, 266, 40, 40, 265,
+ 271, 40, 40, 40, 269, 40, 40, 268, 270, 40,
+ 272, 273, 40, 40, 279, 285, 40, 40, 40, 286,
+ 275, 40, 277, 274, 276, 40, 289, 283, 40, 40,
+
+ 281, 40, 280, 282, 284, 287, 288, 290, 293, 40,
+ 40, 40, 40, 292, 40, 294, 40, 40, 296, 40,
+ 40, 291, 297, 40, 40, 40, 40, 40, 40, 299,
+ 40, 335, 295, 298, 301, 40, 40, 302, 312, 309,
+ 300, 303, 40, 304, 305, 305, 305, 305, 306, 308,
+ 305, 305, 307, 305, 305, 305, 305, 305, 305, 310,
+ 40, 40, 40, 311, 40, 40, 40, 40, 40, 313,
+ 40, 40, 40, 40, 40, 40, 40, 323, 315, 314,
+ 40, 318, 319, 321, 40, 316, 320, 40, 317, 329,
+ 40, 322, 328, 324, 327, 40, 326, 325, 40, 330,
+
+ 331, 40, 333, 334, 40, 40, 336, 40, 40, 338,
+ 40, 332, 40, 250, 250, 250, 250, 40, 337, 343,
+ 251, 341, 341, 341, 341, 339, 251, 342, 40, 252,
+ 252, 340, 341, 341, 341, 341, 254, 254, 254, 254,
+ 40, 254, 254, 254, 254, 40, 40, 40, 40, 40,
+ 40, 348, 40, 346, 40, 40, 347, 40, 40, 351,
+ 40, 40, 40, 344, 345, 40, 356, 350, 352, 40,
+ 358, 40, 40, 349, 354, 355, 40, 40, 359, 360,
+ 40, 40, 40, 357, 353, 40, 40, 367, 40, 40,
+ 40, 40, 40, 40, 361, 368, 366, 40, 40, 362,
+
+ 40, 365, 363, 40, 364, 372, 369, 371, 373, 370,
+ 374, 40, 375, 40, 378, 377, 376, 40, 40, 40,
+ 40, 40, 381, 40, 40, 383, 379, 40, 40, 380,
+ 382, 385, 386, 40, 387, 389, 388, 40, 40, 40,
+ 40, 40, 384, 40, 40, 392, 390, 40, 391, 393,
+ 395, 394, 397, 396, 40, 40, 40, 40, 40, 40,
+ 40, 398, 341, 341, 341, 341, 40, 406, 402, 40,
+ 404, 405, 40, 40, 40, 399, 400, 409, 40, 401,
+ 403, 408, 407, 40, 40, 410, 40, 40, 411, 40,
+ 412, 40, 413, 40, 40, 40, 40, 40, 416, 40,
+
+ 40, 419, 420, 414, 40, 40, 415, 40, 417, 421,
+ 418, 40, 422, 424, 423, 425, 40, 40, 40, 40,
+ 40, 426, 40, 40, 40, 40, 430, 432, 428, 433,
+ 427, 40, 434, 435, 436, 429, 431, 40, 438, 40,
+ 40, 40, 40, 40, 437, 40, 40, 40, 40, 40,
+ 441, 40, 445, 448, 440, 447, 40, 40, 40, 40,
+ 439, 442, 450, 452, 444, 446, 40, 40, 40, 451,
+ 449, 40, 453, 40, 454, 458, 40, 40, 40, 455,
+ 40, 40, 456, 40, 457, 460, 40, 464, 465, 40,
+ 40, 40, 40, 467, 40, 461, 462, 468, 463, 459,
+
+ 466, 469, 40, 470, 40, 40, 40, 471, 475, 40,
+ 40, 473, 472, 40, 40, 40, 40, 40, 477, 40,
+ 478, 40, 40, 476, 482, 479, 474, 40, 40, 480,
+ 483, 40, 40, 40, 40, 40, 484, 481, 40, 40,
+ 486, 40, 491, 492, 485, 40, 40, 490, 487, 488,
+ 40, 40, 493, 494, 495, 497, 40, 489, 40, 40,
+ 40, 40, 496, 502, 40, 501, 40, 498, 503, 40,
+ 40, 505, 40, 499, 40, 40, 500, 507, 40, 511,
+ 40, 40, 40, 504, 506, 40, 40, 40, 40, 515,
+ 512, 517, 518, 508, 519, 509, 40, 510, 513, 516,
+
+ 40, 514, 40, 520, 40, 521, 40, 40, 40, 524,
+ 523, 40, 40, 527, 40, 522, 525, 40, 40, 40,
+ 40, 530, 40, 40, 533, 40, 40, 528, 535, 526,
+ 40, 40, 40, 532, 40, 534, 536, 40, 40, 40,
+ 531, 529, 537, 540, 538, 40, 541, 543, 40, 40,
+ 40, 40, 549, 539, 542, 548, 40, 40, 40, 547,
+ 544, 40, 40, 545, 546, 553, 40, 40, 550, 40,
+ 40, 40, 552, 40, 551, 554, 40, 40, 555, 40,
+ 560, 40, 40, 561, 40, 557, 40, 556, 565, 40,
+ 40, 559, 558, 566, 564, 40, 40, 40, 40, 40,
+
+ 562, 40, 563, 567, 37, 37, 37, 37, 39, 39,
50, 40, 50, 50, 40, 40, 40, 40, 40, 40,
40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
-
40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
- 40, 40, 40, 40, 40, 40, 40, 40, 250, 40,
- 40, 40, 40, 40, 132, 40, 38, 579, 3, 579,
- 579, 579, 579, 579, 579, 579, 579, 579, 579, 579,
- 579, 579, 579, 579, 579, 579, 579, 579, 579, 579,
- 579, 579, 579, 579, 579, 579, 579, 579, 579, 579,
- 579, 579, 579, 579, 579, 579, 579, 579, 579, 579,
- 579, 579
+ 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,
+ 40, 40, 40, 40, 40, 40, 249, 40, 40, 40,
+ 40, 40, 132, 40, 38, 568, 3, 568, 568, 568,
+ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568,
+ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568,
+ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568,
+ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568
} ;
-static yyconst short int yy_chk[1293] =
+static yyconst short int yy_chk[1271] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
19, 21, 26, 24, 23, 23, 21, 24, 21, 21,
29, 26, 28, 31, 34, 67, 21, 68, 31, 29,
21, 54, 21, 34, 28, 68, 26, 27, 35, 35,
- 28, 31, 33, 584, 31, 28, 27, 33, 27, 67,
+ 28, 31, 33, 573, 31, 28, 27, 33, 27, 67,
54, 31, 27, 36, 27, 52, 27, 35, 27, 30,
33, 55, 36, 30, 42, 42, 42, 42, 52, 30,
52, 30, 30, 55, 30, 30, 30, 55, 30, 43,
90, 85, 91, 92, 99, 87, 95, 84, 93, 94,
97, 95, 92, 88, 98, 90, 96, 93, 94, 100,
102, 103, 91, 97, 96, 99, 92, 98, 104, 105,
- 108, 93, 106, 582, 103, 104, 107, 109, 105, 108,
- 110, 117, 100, 104, 107, 116, 109, 106, 102, 112,
- 106, 104, 105, 108, 111, 104, 106, 113, 110, 107,
- 111, 115, 112, 118, 116, 121, 119, 125, 120, 117,
- 113, 122, 124, 578, 115, 123, 118, 120, 113, 125,
- 122, 124, 121, 123, 123, 115, 119, 127, 121, 122,
-
- 128, 120, 130, 123, 122, 128, 123, 131, 142, 194,
- 127, 123, 127, 134, 134, 134, 134, 135, 135, 135,
- 135, 141, 144, 130, 135, 145, 142, 147, 131, 194,
- 135, 144, 141, 153, 131, 137, 137, 137, 137, 137,
- 147, 153, 137, 150, 149, 151, 145, 154, 137, 138,
- 138, 149, 138, 138, 138, 138, 138, 155, 150, 156,
- 151, 157, 158, 162, 156, 159, 155, 160, 161, 154,
- 163, 164, 162, 160, 159, 167, 157, 158, 159, 165,
- 167, 161, 168, 169, 162, 172, 170, 171, 173, 576,
- 174, 172, 163, 177, 164, 170, 171, 175, 165, 176,
-
- 179, 169, 170, 178, 169, 174, 175, 173, 176, 168,
- 180, 177, 178, 181, 179, 182, 183, 184, 185, 187,
- 198, 181, 176, 197, 202, 201, 182, 204, 575, 203,
- 242, 211, 184, 180, 187, 242, 204, 183, 206, 210,
- 197, 211, 185, 198, 200, 200, 200, 200, 201, 202,
- 200, 200, 203, 200, 200, 200, 200, 200, 200, 205,
- 210, 206, 212, 213, 216, 217, 219, 220, 205, 222,
- 205, 212, 221, 225, 205, 223, 205, 226, 224, 231,
- 216, 213, 220, 221, 223, 230, 217, 224, 222, 219,
- 233, 235, 223, 239, 238, 240, 225, 231, 241, 244,
-
- 235, 243, 226, 238, 244, 245, 239, 233, 230, 243,
- 246, 240, 248, 249, 246, 256, 241, 257, 264, 245,
- 251, 251, 251, 251, 257, 264, 261, 251, 574, 572,
- 248, 261, 256, 251, 252, 252, 249, 252, 252, 252,
- 252, 253, 253, 253, 253, 254, 254, 254, 254, 254,
- 255, 255, 255, 255, 255, 258, 260, 265, 266, 267,
- 268, 270, 269, 271, 273, 268, 274, 272, 276, 273,
- 280, 275, 258, 260, 267, 269, 275, 276, 277, 271,
- 265, 266, 272, 281, 286, 277, 282, 274, 270, 283,
- 287, 289, 294, 280, 290, 287, 291, 293, 292, 286,
-
- 289, 295, 300, 296, 303, 305, 281, 294, 282, 301,
- 282, 293, 304, 283, 309, 290, 292, 291, 296, 295,
- 300, 307, 310, 305, 301, 311, 316, 309, 303, 310,
- 307, 312, 313, 314, 317, 304, 325, 318, 319, 570,
- 312, 313, 314, 321, 317, 311, 318, 324, 319, 316,
- 322, 325, 321, 327, 312, 313, 324, 322, 329, 332,
- 327, 333, 336, 334, 338, 335, 339, 329, 341, 332,
- 335, 343, 333, 334, 357, 344, 349, 348, 351, 336,
- 357, 343, 348, 352, 349, 338, 356, 339, 344, 358,
- 352, 341, 354, 343, 346, 346, 346, 346, 353, 354,
-
- 351, 355, 359, 353, 360, 361, 355, 356, 358, 362,
- 363, 365, 368, 360, 369, 370, 372, 363, 365, 371,
- 373, 359, 361, 374, 375, 368, 362, 369, 371, 376,
- 377, 372, 370, 379, 380, 381, 373, 387, 382, 377,
- 383, 375, 381, 380, 384, 385, 374, 382, 376, 383,
- 379, 388, 396, 384, 397, 387, 398, 400, 385, 401,
- 405, 402, 410, 409, 397, 408, 411, 396, 412, 400,
- 402, 409, 408, 413, 388, 398, 414, 411, 413, 405,
- 415, 412, 401, 417, 418, 410, 420, 421, 422, 423,
- 424, 425, 426, 437, 421, 430, 417, 415, 423, 414,
-
- 429, 434, 437, 420, 429, 429, 435, 418, 434, 425,
- 426, 438, 424, 440, 439, 448, 422, 442, 430, 439,
- 438, 447, 435, 449, 442, 451, 458, 452, 462, 463,
- 466, 464, 448, 465, 451, 468, 440, 452, 458, 464,
- 449, 470, 447, 462, 473, 474, 465, 466, 475, 476,
- 480, 463, 477, 479, 481, 482, 483, 485, 468, 470,
- 486, 477, 479, 484, 476, 473, 474, 480, 488, 481,
- 482, 489, 484, 490, 475, 491, 492, 483, 490, 485,
- 489, 493, 494, 486, 491, 495, 497, 502, 493, 498,
- 499, 500, 503, 488, 504, 505, 495, 511, 509, 492,
-
- 500, 512, 502, 519, 505, 494, 511, 524, 512, 503,
- 497, 509, 498, 499, 513, 515, 516, 504, 517, 522,
- 513, 516, 515, 523, 522, 526, 519, 527, 525, 528,
- 524, 517, 523, 525, 529, 530, 528, 531, 532, 533,
- 535, 526, 531, 536, 533, 537, 538, 541, 544, 539,
- 530, 540, 543, 532, 535, 549, 527, 529, 539, 536,
- 540, 543, 545, 544, 537, 546, 548, 551, 550, 538,
- 541, 553, 555, 557, 558, 548, 556, 545, 549, 559,
- 546, 550, 561, 556, 551, 560, 557, 555, 562, 553,
- 563, 558, 564, 565, 566, 568, 569, 563, 573, 564,
-
- 559, 571, 577, 560, 567, 561, 554, 573, 571, 562,
- 552, 547, 568, 542, 534, 521, 520, 566, 518, 514,
- 510, 508, 565, 577, 580, 580, 580, 580, 581, 581,
- 583, 507, 583, 583, 506, 501, 496, 487, 478, 472,
- 471, 469, 467, 461, 460, 459, 457, 456, 455, 454,
- 453, 450, 446, 445, 444, 443, 441, 436, 433, 432,
- 431, 428, 427, 419, 416, 407, 406, 404, 403, 399,
- 395, 394, 393, 392, 391, 390, 389, 386, 378, 367,
- 366, 364, 350, 347, 345, 342, 340, 337, 331, 330,
- 328, 326, 323, 320, 315, 308, 302, 299, 298, 297,
-
- 288, 285, 284, 279, 278, 263, 262, 259, 247, 237,
- 236, 234, 232, 229, 228, 227, 218, 215, 214, 209,
- 208, 207, 199, 196, 195, 193, 192, 191, 190, 189,
- 188, 186, 152, 148, 146, 143, 140, 136, 132, 114,
- 89, 69, 59, 39, 37, 8, 7, 3, 579, 579,
- 579, 579, 579, 579, 579, 579, 579, 579, 579, 579,
- 579, 579, 579, 579, 579, 579, 579, 579, 579, 579,
- 579, 579, 579, 579, 579, 579, 579, 579, 579, 579,
- 579, 579, 579, 579, 579, 579, 579, 579, 579, 579,
- 579, 579
-
+ 108, 93, 106, 110, 103, 104, 107, 109, 105, 108,
+ 117, 571, 100, 104, 107, 112, 109, 106, 102, 113,
+ 106, 110, 105, 108, 111, 104, 106, 116, 112, 107,
+ 111, 115, 113, 119, 118, 121, 120, 125, 117, 122,
+ 113, 567, 123, 130, 115, 120, 116, 118, 122, 125,
+ 123, 123, 121, 119, 127, 115, 124, 122, 121, 120,
+
+ 123, 128, 122, 123, 130, 124, 128, 127, 123, 127,
+ 131, 134, 134, 134, 134, 135, 135, 135, 135, 141,
+ 144, 147, 135, 145, 389, 142, 149, 154, 135, 144,
+ 141, 131, 150, 149, 147, 151, 389, 131, 137, 137,
+ 137, 137, 137, 142, 145, 137, 153, 150, 157, 154,
+ 151, 137, 138, 138, 153, 138, 138, 138, 138, 138,
+ 155, 156, 158, 157, 160, 159, 156, 161, 163, 155,
+ 160, 164, 162, 165, 159, 168, 171, 158, 159, 167,
+ 161, 162, 169, 172, 167, 171, 173, 175, 170, 172,
+ 163, 174, 165, 162, 164, 177, 175, 170, 176, 178,
+
+ 169, 179, 168, 169, 170, 173, 174, 176, 178, 180,
+ 181, 182, 183, 177, 184, 179, 185, 194, 181, 187,
+ 198, 176, 182, 242, 197, 201, 203, 202, 210, 184,
+ 204, 242, 180, 183, 187, 565, 205, 194, 210, 204,
+ 185, 197, 209, 198, 200, 200, 200, 200, 201, 203,
+ 200, 200, 202, 200, 200, 200, 200, 200, 200, 205,
+ 211, 212, 215, 209, 216, 218, 219, 221, 223, 211,
+ 224, 220, 225, 229, 222, 232, 230, 223, 215, 212,
+ 234, 219, 220, 222, 240, 216, 221, 238, 218, 234,
+ 237, 222, 232, 224, 230, 239, 229, 225, 241, 237,
+
+ 238, 243, 240, 241, 244, 245, 243, 247, 248, 245,
+ 255, 239, 256, 250, 250, 250, 250, 564, 244, 256,
+ 250, 252, 252, 252, 252, 247, 250, 255, 264, 251,
+ 251, 248, 251, 251, 251, 251, 253, 253, 253, 253,
+ 253, 254, 254, 254, 254, 254, 257, 259, 260, 263,
+ 265, 264, 266, 260, 267, 268, 263, 269, 270, 267,
+ 271, 272, 273, 257, 259, 274, 272, 266, 268, 275,
+ 274, 279, 276, 265, 270, 271, 280, 282, 275, 276,
+ 281, 285, 286, 273, 269, 289, 288, 286, 290, 291,
+ 302, 292, 294, 293, 279, 288, 285, 295, 299, 280,
+
+ 300, 282, 281, 303, 281, 292, 289, 291, 293, 290,
+ 294, 304, 295, 306, 302, 300, 299, 308, 309, 311,
+ 563, 312, 306, 313, 314, 309, 303, 316, 317, 304,
+ 308, 312, 313, 320, 314, 317, 316, 319, 322, 328,
+ 324, 327, 311, 329, 331, 322, 319, 330, 320, 324,
+ 328, 327, 330, 329, 333, 334, 336, 339, 338, 344,
+ 346, 331, 341, 341, 341, 341, 343, 344, 338, 351,
+ 339, 343, 348, 561, 347, 333, 334, 348, 349, 336,
+ 338, 347, 346, 350, 353, 349, 352, 354, 350, 355,
+ 351, 356, 352, 357, 358, 360, 363, 365, 355, 364,
+
+ 367, 358, 360, 353, 366, 368, 354, 369, 356, 363,
+ 357, 370, 364, 366, 365, 367, 371, 372, 375, 374,
+ 382, 368, 376, 377, 378, 379, 372, 375, 370, 376,
+ 369, 380, 377, 378, 379, 371, 374, 383, 382, 385,
+ 386, 390, 387, 391, 380, 398, 394, 399, 397, 403,
+ 386, 400, 391, 398, 385, 397, 401, 404, 402, 407,
+ 383, 387, 400, 402, 390, 394, 406, 409, 410, 401,
+ 399, 411, 403, 413, 404, 410, 412, 419, 414, 406,
+ 415, 424, 407, 418, 409, 412, 423, 418, 418, 429,
+ 559, 437, 426, 423, 427, 413, 414, 424, 415, 411,
+
+ 419, 426, 428, 427, 431, 436, 438, 428, 437, 440,
+ 441, 431, 429, 447, 451, 452, 453, 454, 440, 455,
+ 441, 457, 459, 438, 453, 447, 436, 462, 463, 451,
+ 454, 464, 465, 466, 468, 469, 455, 452, 470, 471,
+ 459, 472, 466, 468, 457, 474, 473, 465, 462, 463,
+ 475, 477, 469, 470, 471, 473, 478, 464, 479, 480,
+ 481, 483, 472, 479, 482, 478, 484, 474, 480, 486,
+ 489, 482, 487, 475, 488, 491, 477, 484, 493, 489,
+ 494, 492, 500, 481, 483, 501, 498, 508, 502, 494,
+ 491, 500, 501, 486, 502, 487, 504, 488, 492, 498,
+
+ 505, 493, 506, 504, 511, 505, 513, 512, 514, 511,
+ 508, 515, 516, 514, 517, 506, 512, 518, 519, 520,
+ 521, 517, 524, 522, 520, 526, 525, 515, 522, 513,
+ 527, 530, 538, 519, 528, 521, 524, 529, 532, 539,
+ 518, 516, 525, 528, 526, 533, 529, 532, 534, 535,
+ 537, 540, 539, 527, 530, 538, 542, 544, 545, 537,
+ 533, 547, 546, 534, 535, 545, 548, 549, 540, 550,
+ 551, 554, 544, 552, 542, 546, 553, 557, 547, 555,
+ 552, 560, 566, 553, 562, 549, 558, 548, 560, 556,
+ 543, 551, 550, 562, 557, 541, 536, 531, 523, 510,
+
+ 554, 509, 555, 566, 569, 569, 569, 569, 570, 570,
+ 572, 507, 572, 572, 503, 499, 497, 496, 495, 490,
+ 485, 476, 467, 461, 460, 458, 456, 450, 449, 448,
+ 446, 445, 444, 443, 442, 439, 435, 434, 433, 432,
+ 430, 425, 422, 421, 420, 417, 416, 408, 405, 396,
+ 395, 393, 392, 388, 384, 381, 373, 362, 361, 359,
+ 345, 342, 340, 337, 335, 332, 326, 325, 323, 321,
+ 318, 315, 310, 307, 301, 298, 297, 296, 287, 284,
+ 283, 278, 277, 262, 261, 258, 246, 236, 235, 233,
+ 231, 228, 227, 226, 217, 214, 213, 208, 207, 206,
+
+ 199, 196, 195, 193, 192, 191, 190, 189, 188, 186,
+ 152, 148, 146, 143, 140, 136, 132, 114, 89, 69,
+ 59, 39, 37, 8, 7, 3, 568, 568, 568, 568,
+ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568,
+ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568,
+ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568,
+ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568
} ;
static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr;
#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 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
#define INITIAL 0
/*===-- Lexer.l - Scanner for llvm assembly files --------------*- C++ -*--===//
//
//
//===----------------------------------------------------------------------===*/
#define YY_NEVER_INTERACTIVE 1
-#line 28 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 28 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
#include "ParserInternals.h"
#include "llvm/Module.h"
#include <list>
/* HexIntConstant - Hexadecimal constant generated by the CFE to avoid forcing
* it to deal with 64 bit numbers.
*/
-#line 1052 "Lexer.cpp"
+#line 1040 "Lexer.cpp"
/* Macros after this point can all be overridden by user definitions in
* section 1.
register char *yy_cp = NULL, *yy_bp = NULL;
register int yy_act;
-#line 186 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 186 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
-#line 1206 "Lexer.cpp"
+#line 1194 "Lexer.cpp"
if ( yy_init )
{
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 580 )
+ if ( yy_current_state >= 569 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
*yy_state_ptr++ = yy_current_state;
++yy_cp;
}
- while ( yy_current_state != 579 );
+ while ( yy_current_state != 568 );
yy_find_action:
yy_current_state = *--yy_state_ptr;
{ /* beginning of action switch */
case 1:
YY_RULE_SETUP
-#line 188 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 188 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ /* Ignore comments for now */ }
YY_BREAK
case 2:
YY_RULE_SETUP
-#line 190 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 190 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return BEGINTOK; }
YY_BREAK
case 3:
YY_RULE_SETUP
-#line 191 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 191 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return ENDTOK; }
YY_BREAK
case 4:
YY_RULE_SETUP
-#line 192 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 192 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return TRUETOK; }
YY_BREAK
case 5:
YY_RULE_SETUP
-#line 193 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 193 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return FALSETOK; }
YY_BREAK
case 6:
YY_RULE_SETUP
-#line 194 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 194 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return DECLARE; }
YY_BREAK
case 7:
YY_RULE_SETUP
-#line 195 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 195 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return GLOBAL; }
YY_BREAK
case 8:
YY_RULE_SETUP
-#line 196 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 196 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return CONSTANT; }
YY_BREAK
case 9:
YY_RULE_SETUP
-#line 197 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 197 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return INTERNAL; }
YY_BREAK
case 10:
YY_RULE_SETUP
-#line 198 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 198 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return LINKONCE; }
YY_BREAK
case 11:
YY_RULE_SETUP
-#line 199 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 199 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return WEAK; }
YY_BREAK
case 12:
YY_RULE_SETUP
-#line 200 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 200 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return APPENDING; }
YY_BREAK
case 13:
YY_RULE_SETUP
-#line 201 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 201 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return DLLIMPORT; }
YY_BREAK
case 14:
YY_RULE_SETUP
-#line 202 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 202 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return DLLEXPORT; }
YY_BREAK
case 15:
YY_RULE_SETUP
-#line 203 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 203 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return EXTERN_WEAK; }
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 204 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 204 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return EXTERNAL; }
YY_BREAK
case 17:
YY_RULE_SETUP
-#line 205 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 205 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return IMPLEMENTATION; }
YY_BREAK
case 18:
YY_RULE_SETUP
-#line 206 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 206 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return ZEROINITIALIZER; }
YY_BREAK
case 19:
YY_RULE_SETUP
-#line 207 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 207 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return DOTDOTDOT; }
YY_BREAK
case 20:
YY_RULE_SETUP
-#line 208 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 208 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return UNDEF; }
YY_BREAK
case 21:
YY_RULE_SETUP
-#line 209 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 209 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return NULL_TOK; }
YY_BREAK
case 22:
YY_RULE_SETUP
-#line 210 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 210 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return TO; }
YY_BREAK
case 23:
YY_RULE_SETUP
-#line 211 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 211 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return TAIL; }
YY_BREAK
case 24:
YY_RULE_SETUP
-#line 212 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 212 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return TARGET; }
YY_BREAK
case 25:
YY_RULE_SETUP
-#line 213 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 213 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return TRIPLE; }
YY_BREAK
case 26:
YY_RULE_SETUP
-#line 214 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 214 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return DEPLIBS; }
YY_BREAK
case 27:
YY_RULE_SETUP
-#line 215 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 215 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return ENDIAN; }
YY_BREAK
case 28:
YY_RULE_SETUP
-#line 216 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 216 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return POINTERSIZE; }
YY_BREAK
case 29:
YY_RULE_SETUP
-#line 217 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 217 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return DATALAYOUT; }
YY_BREAK
case 30:
YY_RULE_SETUP
-#line 218 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 218 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return LITTLE; }
YY_BREAK
case 31:
YY_RULE_SETUP
-#line 219 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 219 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return BIG; }
YY_BREAK
case 32:
YY_RULE_SETUP
-#line 220 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 220 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return VOLATILE; }
YY_BREAK
case 33:
YY_RULE_SETUP
-#line 221 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 221 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return ALIGN; }
YY_BREAK
case 34:
YY_RULE_SETUP
-#line 222 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 222 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return SECTION; }
YY_BREAK
case 35:
YY_RULE_SETUP
-#line 223 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 223 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return MODULE; }
YY_BREAK
case 36:
YY_RULE_SETUP
-#line 224 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 224 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return ASM_TOK; }
YY_BREAK
case 37:
YY_RULE_SETUP
-#line 225 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 225 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return SIDEEFFECT; }
YY_BREAK
case 38:
YY_RULE_SETUP
-#line 227 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 227 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return CC_TOK; }
YY_BREAK
case 39:
YY_RULE_SETUP
-#line 228 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 228 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return CCC_TOK; }
YY_BREAK
case 40:
YY_RULE_SETUP
-#line 229 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 229 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return CSRETCC_TOK; }
YY_BREAK
case 41:
YY_RULE_SETUP
-#line 230 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 230 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return FASTCC_TOK; }
YY_BREAK
case 42:
YY_RULE_SETUP
-#line 231 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 231 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return COLDCC_TOK; }
YY_BREAK
case 43:
YY_RULE_SETUP
-#line 232 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 232 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return X86_STDCALLCC_TOK; }
YY_BREAK
case 44:
YY_RULE_SETUP
-#line 233 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 233 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return X86_FASTCALLCC_TOK; }
YY_BREAK
case 45:
YY_RULE_SETUP
-#line 235 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 235 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TY(Type::VoidTy, VOID); }
YY_BREAK
case 46:
YY_RULE_SETUP
-#line 236 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 236 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TY(Type::BoolTy, BOOL); }
YY_BREAK
case 47:
YY_RULE_SETUP
-#line 237 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 237 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TY(Type::SByteTy, SBYTE); }
YY_BREAK
case 48:
YY_RULE_SETUP
-#line 238 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 238 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TY(Type::UByteTy, UBYTE); }
YY_BREAK
case 49:
YY_RULE_SETUP
-#line 239 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 239 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TY(Type::ShortTy, SHORT); }
YY_BREAK
case 50:
YY_RULE_SETUP
-#line 240 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 240 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TY(Type::UShortTy,USHORT);}
YY_BREAK
case 51:
YY_RULE_SETUP
-#line 241 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 241 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TY(Type::IntTy, INT); }
YY_BREAK
case 52:
YY_RULE_SETUP
-#line 242 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 242 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TY(Type::UIntTy, UINT); }
YY_BREAK
case 53:
YY_RULE_SETUP
-#line 243 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 243 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TY(Type::LongTy, LONG); }
YY_BREAK
case 54:
YY_RULE_SETUP
-#line 244 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 244 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TY(Type::ULongTy, ULONG); }
YY_BREAK
case 55:
YY_RULE_SETUP
-#line 245 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 245 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TY(Type::FloatTy, FLOAT); }
YY_BREAK
case 56:
YY_RULE_SETUP
-#line 246 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 246 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TY(Type::DoubleTy,DOUBLE);}
YY_BREAK
case 57:
YY_RULE_SETUP
-#line 247 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 247 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TY(Type::LabelTy, LABEL); }
YY_BREAK
case 58:
YY_RULE_SETUP
-#line 248 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 248 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return TYPE; }
YY_BREAK
case 59:
YY_RULE_SETUP
-#line 249 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 249 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return OPAQUE; }
YY_BREAK
case 60:
YY_RULE_SETUP
-#line 251 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 251 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(BinaryOpVal, Add, ADD); }
YY_BREAK
case 61:
YY_RULE_SETUP
-#line 252 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 252 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(BinaryOpVal, Sub, SUB); }
YY_BREAK
case 62:
YY_RULE_SETUP
-#line 253 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 253 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(BinaryOpVal, Mul, MUL); }
YY_BREAK
case 63:
YY_RULE_SETUP
-#line 254 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 254 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(BinaryOpVal, UDiv, UDIV); }
YY_BREAK
case 64:
YY_RULE_SETUP
-#line 255 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 255 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(BinaryOpVal, SDiv, SDIV); }
YY_BREAK
case 65:
YY_RULE_SETUP
-#line 256 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 256 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(BinaryOpVal, FDiv, FDIV); }
YY_BREAK
case 66:
YY_RULE_SETUP
-#line 257 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 257 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(BinaryOpVal, URem, UREM); }
YY_BREAK
case 67:
YY_RULE_SETUP
-#line 258 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 258 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(BinaryOpVal, SRem, SREM); }
YY_BREAK
case 68:
YY_RULE_SETUP
-#line 259 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 259 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(BinaryOpVal, FRem, FREM); }
YY_BREAK
case 69:
YY_RULE_SETUP
-#line 260 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 260 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(BinaryOpVal, And, AND); }
YY_BREAK
case 70:
YY_RULE_SETUP
-#line 261 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 261 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(BinaryOpVal, Or , OR ); }
YY_BREAK
case 71:
YY_RULE_SETUP
-#line 262 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 262 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(BinaryOpVal, Xor, XOR); }
YY_BREAK
case 72:
YY_RULE_SETUP
-#line 263 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
-{ RET_TOK(BinaryOpVal, SetNE, SETNE); }
- YY_BREAK
-case 73:
-YY_RULE_SETUP
-#line 264 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
-{ RET_TOK(BinaryOpVal, SetEQ, SETEQ); }
- YY_BREAK
-case 74:
-YY_RULE_SETUP
-#line 265 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
-{ RET_TOK(BinaryOpVal, SetLT, SETLT); }
- YY_BREAK
-case 75:
-YY_RULE_SETUP
-#line 266 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
-{ RET_TOK(BinaryOpVal, SetGT, SETGT); }
- YY_BREAK
-case 76:
-YY_RULE_SETUP
-#line 267 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
-{ RET_TOK(BinaryOpVal, SetLE, SETLE); }
- YY_BREAK
-case 77:
-YY_RULE_SETUP
-#line 268 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
-{ RET_TOK(BinaryOpVal, SetGE, SETGE); }
- YY_BREAK
-case 78:
-YY_RULE_SETUP
-#line 269 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 263 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(OtherOpVal, ICmp, ICMP); }
YY_BREAK
-case 79:
+case 73:
YY_RULE_SETUP
-#line 270 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 264 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(OtherOpVal, FCmp, FCMP); }
YY_BREAK
-case 80:
+case 74:
YY_RULE_SETUP
-#line 271 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 265 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return EQ; }
YY_BREAK
-case 81:
+case 75:
YY_RULE_SETUP
-#line 272 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 266 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return NE; }
YY_BREAK
-case 82:
+case 76:
YY_RULE_SETUP
-#line 273 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 267 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return SLT; }
YY_BREAK
-case 83:
+case 77:
YY_RULE_SETUP
-#line 274 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 268 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return SGT; }
YY_BREAK
-case 84:
+case 78:
YY_RULE_SETUP
-#line 275 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 269 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return SLE; }
YY_BREAK
-case 85:
+case 79:
YY_RULE_SETUP
-#line 276 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 270 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return SGE; }
YY_BREAK
-case 86:
+case 80:
YY_RULE_SETUP
-#line 277 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 271 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return ULT; }
YY_BREAK
-case 87:
+case 81:
YY_RULE_SETUP
-#line 278 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 272 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return UGT; }
YY_BREAK
-case 88:
+case 82:
YY_RULE_SETUP
-#line 279 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 273 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return ULE; }
YY_BREAK
-case 89:
+case 83:
YY_RULE_SETUP
-#line 280 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 274 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return UGE; }
YY_BREAK
-case 90:
+case 84:
YY_RULE_SETUP
-#line 281 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 275 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return OEQ; }
YY_BREAK
-case 91:
+case 85:
YY_RULE_SETUP
-#line 282 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 276 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return ONE; }
YY_BREAK
-case 92:
+case 86:
YY_RULE_SETUP
-#line 283 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 277 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return OLT; }
YY_BREAK
-case 93:
+case 87:
YY_RULE_SETUP
-#line 284 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 278 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return OGT; }
YY_BREAK
-case 94:
+case 88:
YY_RULE_SETUP
-#line 285 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 279 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return OLE; }
YY_BREAK
-case 95:
+case 89:
YY_RULE_SETUP
-#line 286 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 280 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return OGE; }
YY_BREAK
-case 96:
+case 90:
YY_RULE_SETUP
-#line 287 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 281 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return ORD; }
YY_BREAK
-case 97:
+case 91:
YY_RULE_SETUP
-#line 288 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 282 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return UNO; }
YY_BREAK
-case 98:
+case 92:
YY_RULE_SETUP
-#line 289 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 283 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return UEQ; }
YY_BREAK
-case 99:
+case 93:
YY_RULE_SETUP
-#line 290 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 284 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return UNE; }
YY_BREAK
-case 100:
+case 94:
YY_RULE_SETUP
-#line 292 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 286 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(OtherOpVal, PHI, PHI_TOK); }
YY_BREAK
-case 101:
+case 95:
YY_RULE_SETUP
-#line 293 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 287 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(OtherOpVal, Call, CALL); }
YY_BREAK
-case 102:
+case 96:
YY_RULE_SETUP
-#line 294 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 288 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(CastOpVal, Trunc, TRUNC); }
YY_BREAK
-case 103:
+case 97:
YY_RULE_SETUP
-#line 295 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 289 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(CastOpVal, ZExt, ZEXT); }
YY_BREAK
-case 104:
+case 98:
YY_RULE_SETUP
-#line 296 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 290 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(CastOpVal, SExt, SEXT); }
YY_BREAK
-case 105:
+case 99:
YY_RULE_SETUP
-#line 297 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 291 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(CastOpVal, FPTrunc, FPTRUNC); }
YY_BREAK
-case 106:
+case 100:
YY_RULE_SETUP
-#line 298 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 292 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(CastOpVal, FPExt, FPEXT); }
YY_BREAK
-case 107:
+case 101:
YY_RULE_SETUP
-#line 299 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 293 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(CastOpVal, UIToFP, UITOFP); }
YY_BREAK
-case 108:
+case 102:
YY_RULE_SETUP
-#line 300 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 294 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(CastOpVal, SIToFP, SITOFP); }
YY_BREAK
-case 109:
+case 103:
YY_RULE_SETUP
-#line 301 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 295 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(CastOpVal, FPToUI, FPTOUI); }
YY_BREAK
-case 110:
+case 104:
YY_RULE_SETUP
-#line 302 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 296 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(CastOpVal, FPToSI, FPTOSI); }
YY_BREAK
-case 111:
+case 105:
YY_RULE_SETUP
-#line 303 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 297 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(CastOpVal, IntToPtr, INTTOPTR); }
YY_BREAK
-case 112:
+case 106:
YY_RULE_SETUP
-#line 304 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 298 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(CastOpVal, PtrToInt, PTRTOINT); }
YY_BREAK
-case 113:
+case 107:
YY_RULE_SETUP
-#line 305 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 299 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(CastOpVal, BitCast, BITCAST); }
YY_BREAK
-case 114:
+case 108:
YY_RULE_SETUP
-#line 306 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 300 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(OtherOpVal, Select, SELECT); }
YY_BREAK
-case 115:
+case 109:
YY_RULE_SETUP
-#line 307 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 301 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(OtherOpVal, Shl, SHL); }
YY_BREAK
-case 116:
+case 110:
YY_RULE_SETUP
-#line 308 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 302 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(OtherOpVal, LShr, LSHR); }
YY_BREAK
-case 117:
+case 111:
YY_RULE_SETUP
-#line 309 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 303 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(OtherOpVal, AShr, ASHR); }
YY_BREAK
-case 118:
+case 112:
YY_RULE_SETUP
-#line 310 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 304 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(OtherOpVal, VAArg , VAARG); }
YY_BREAK
-case 119:
+case 113:
YY_RULE_SETUP
-#line 311 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 305 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(TermOpVal, Ret, RET); }
YY_BREAK
-case 120:
+case 114:
YY_RULE_SETUP
-#line 312 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 306 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(TermOpVal, Br, BR); }
YY_BREAK
-case 121:
+case 115:
YY_RULE_SETUP
-#line 313 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 307 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(TermOpVal, Switch, SWITCH); }
YY_BREAK
-case 122:
+case 116:
YY_RULE_SETUP
-#line 314 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 308 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(TermOpVal, Invoke, INVOKE); }
YY_BREAK
-case 123:
+case 117:
YY_RULE_SETUP
-#line 315 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 309 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(TermOpVal, Unwind, UNWIND); }
YY_BREAK
-case 124:
+case 118:
YY_RULE_SETUP
-#line 316 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 310 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(TermOpVal, Unreachable, UNREACHABLE); }
YY_BREAK
-case 125:
+case 119:
YY_RULE_SETUP
-#line 318 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 312 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(MemOpVal, Malloc, MALLOC); }
YY_BREAK
-case 126:
+case 120:
YY_RULE_SETUP
-#line 319 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 313 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(MemOpVal, Alloca, ALLOCA); }
YY_BREAK
-case 127:
+case 121:
YY_RULE_SETUP
-#line 320 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 314 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(MemOpVal, Free, FREE); }
YY_BREAK
-case 128:
+case 122:
YY_RULE_SETUP
-#line 321 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 315 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(MemOpVal, Load, LOAD); }
YY_BREAK
-case 129:
+case 123:
YY_RULE_SETUP
-#line 322 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 316 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(MemOpVal, Store, STORE); }
YY_BREAK
-case 130:
+case 124:
YY_RULE_SETUP
-#line 323 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 317 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(MemOpVal, GetElementPtr, GETELEMENTPTR); }
YY_BREAK
-case 131:
+case 125:
YY_RULE_SETUP
-#line 325 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 319 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(OtherOpVal, ExtractElement, EXTRACTELEMENT); }
YY_BREAK
-case 132:
+case 126:
YY_RULE_SETUP
-#line 326 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 320 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(OtherOpVal, InsertElement, INSERTELEMENT); }
YY_BREAK
-case 133:
+case 127:
YY_RULE_SETUP
-#line 327 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 321 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ RET_TOK(OtherOpVal, ShuffleVector, SHUFFLEVECTOR); }
YY_BREAK
-case 134:
+case 128:
YY_RULE_SETUP
-#line 330 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 324 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{
UnEscapeLexed(yytext+1);
llvmAsmlval.StrVal = strdup(yytext+1); // Skip %
return VAR_ID;
}
YY_BREAK
-case 135:
+case 129:
YY_RULE_SETUP
-#line 335 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 329 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{
yytext[strlen(yytext)-1] = 0; // nuke colon
UnEscapeLexed(yytext);
return LABELSTR;
}
YY_BREAK
-case 136:
+case 130:
YY_RULE_SETUP
-#line 341 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 335 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{
yytext[strlen(yytext)-2] = 0; // nuke colon, end quote
UnEscapeLexed(yytext+1);
return LABELSTR;
}
YY_BREAK
-case 137:
+case 131:
YY_RULE_SETUP
-#line 348 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 342 "/proj/llvm/llvm-3/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
return STRINGCONSTANT;
}
YY_BREAK
-case 138:
+case 132:
YY_RULE_SETUP
-#line 359 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 353 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ llvmAsmlval.UInt64Val = atoull(yytext); return EUINT64VAL; }
YY_BREAK
-case 139:
+case 133:
YY_RULE_SETUP
-#line 360 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 354 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{
uint64_t Val = atoull(yytext+1);
// +1: we have bigger negative range
return ESINT64VAL;
}
YY_BREAK
-case 140:
+case 134:
YY_RULE_SETUP
-#line 368 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 362 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{
llvmAsmlval.UInt64Val = HexIntToVal(yytext+3);
return yytext[0] == 's' ? ESINT64VAL : EUINT64VAL;
}
YY_BREAK
-case 141:
+case 135:
YY_RULE_SETUP
-#line 373 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 367 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{
uint64_t Val = atoull(yytext+1);
if ((unsigned)Val != Val)
return UINTVAL;
}
YY_BREAK
-case 142:
+case 136:
YY_RULE_SETUP
-#line 380 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 374 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{
uint64_t Val = atoull(yytext+2);
// +1: we have bigger negative range
return SINTVAL;
}
YY_BREAK
-case 143:
+case 137:
YY_RULE_SETUP
-#line 389 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 383 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ llvmAsmlval.FPVal = atof(yytext); return FPVAL; }
YY_BREAK
-case 144:
+case 138:
YY_RULE_SETUP
-#line 390 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 384 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ llvmAsmlval.FPVal = HexToFP(yytext); return FPVAL; }
YY_BREAK
case YY_STATE_EOF(INITIAL):
-#line 392 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 386 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{
/* Make sure to free the internal buffers for flex when we are
* done reading our input!
return EOF;
}
YY_BREAK
-case 145:
+case 139:
YY_RULE_SETUP
-#line 400 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 394 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ /* Ignore whitespace */ }
YY_BREAK
-case 146:
+case 140:
YY_RULE_SETUP
-#line 401 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 395 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
{ return yytext[0]; }
YY_BREAK
-case 147:
+case 141:
YY_RULE_SETUP
-#line 403 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 397 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
YY_FATAL_ERROR( "flex scanner jammed" );
YY_BREAK
-#line 2087 "Lexer.cpp"
+#line 2045 "Lexer.cpp"
case YY_END_OF_BUFFER:
{
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 580 )
+ if ( yy_current_state >= 569 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 580 )
+ if ( yy_current_state >= 569 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- yy_is_jam = (yy_current_state == 579);
+ yy_is_jam = (yy_current_state == 568);
if ( ! yy_is_jam )
*yy_state_ptr++ = yy_current_state;
return 0;
}
#endif
-#line 403 "/proj/llvm/llvm-4/lib/AsmParser/Lexer.l"
+#line 397 "/proj/llvm/llvm-3/lib/AsmParser/Lexer.l"
and { RET_TOK(BinaryOpVal, And, AND); }
or { RET_TOK(BinaryOpVal, Or , OR ); }
xor { RET_TOK(BinaryOpVal, Xor, XOR); }
-setne { RET_TOK(BinaryOpVal, SetNE, SETNE); }
-seteq { RET_TOK(BinaryOpVal, SetEQ, SETEQ); }
-setlt { RET_TOK(BinaryOpVal, SetLT, SETLT); }
-setgt { RET_TOK(BinaryOpVal, SetGT, SETGT); }
-setle { RET_TOK(BinaryOpVal, SetLE, SETLE); }
-setge { RET_TOK(BinaryOpVal, SetGE, SETGE); }
icmp { RET_TOK(OtherOpVal, ICmp, ICMP); }
fcmp { RET_TOK(OtherOpVal, FCmp, FCMP); }
eq { return EQ; }
and { RET_TOK(BinaryOpVal, And, AND); }
or { RET_TOK(BinaryOpVal, Or , OR ); }
xor { RET_TOK(BinaryOpVal, Xor, XOR); }
-setne { RET_TOK(BinaryOpVal, SetNE, SETNE); }
-seteq { RET_TOK(BinaryOpVal, SetEQ, SETEQ); }
-setlt { RET_TOK(BinaryOpVal, SetLT, SETLT); }
-setgt { RET_TOK(BinaryOpVal, SetGT, SETGT); }
-setle { RET_TOK(BinaryOpVal, SetLE, SETLE); }
-setge { RET_TOK(BinaryOpVal, SetGE, SETGE); }
icmp { RET_TOK(OtherOpVal, ICmp, ICMP); }
fcmp { RET_TOK(OtherOpVal, FCmp, FCMP); }
eq { return EQ; }
-/* A Bison parser, made by GNU Bison 1.875c. */
+/* 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 Free Software Foundation, Inc.
+ 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
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. */
+ 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.
/* Identify Bison output. */
#define YYBISON 1
+/* Bison version. */
+#define YYBISON_VERSION "2.1"
+
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
/* Using locations. */
#define YYLSP_NEEDED 0
-/* If NAME_PREFIX is specified substitute the variables and functions
- names. */
+/* Substitute the variable and function names. */
#define yyparse llvmAsmparse
#define yylex llvmAsmlex
#define yyerror llvmAsmerror
AND = 342,
OR = 343,
XOR = 344,
- SETLE = 345,
- SETGE = 346,
- SETLT = 347,
- SETGT = 348,
- SETEQ = 349,
- SETNE = 350,
- ICMP = 351,
- FCMP = 352,
- EQ = 353,
- NE = 354,
- SLT = 355,
- SGT = 356,
- SLE = 357,
- SGE = 358,
- ULT = 359,
- UGT = 360,
- ULE = 361,
- UGE = 362,
- OEQ = 363,
- ONE = 364,
- OLT = 365,
- OGT = 366,
- OLE = 367,
- OGE = 368,
- ORD = 369,
- UNO = 370,
- UEQ = 371,
- UNE = 372,
- MALLOC = 373,
- ALLOCA = 374,
- FREE = 375,
- LOAD = 376,
- STORE = 377,
- GETELEMENTPTR = 378,
- TRUNC = 379,
- ZEXT = 380,
- SEXT = 381,
- FPTRUNC = 382,
- FPEXT = 383,
- BITCAST = 384,
- UITOFP = 385,
- SITOFP = 386,
- FPTOUI = 387,
- FPTOSI = 388,
- INTTOPTR = 389,
- PTRTOINT = 390,
- PHI_TOK = 391,
- SELECT = 392,
- SHL = 393,
- LSHR = 394,
- ASHR = 395,
- VAARG = 396,
- EXTRACTELEMENT = 397,
- INSERTELEMENT = 398,
- SHUFFLEVECTOR = 399
+ ICMP = 345,
+ FCMP = 346,
+ EQ = 347,
+ NE = 348,
+ SLT = 349,
+ SGT = 350,
+ SLE = 351,
+ SGE = 352,
+ ULT = 353,
+ UGT = 354,
+ ULE = 355,
+ UGE = 356,
+ OEQ = 357,
+ ONE = 358,
+ OLT = 359,
+ OGT = 360,
+ OLE = 361,
+ OGE = 362,
+ ORD = 363,
+ UNO = 364,
+ UEQ = 365,
+ UNE = 366,
+ MALLOC = 367,
+ ALLOCA = 368,
+ FREE = 369,
+ LOAD = 370,
+ STORE = 371,
+ GETELEMENTPTR = 372,
+ TRUNC = 373,
+ ZEXT = 374,
+ SEXT = 375,
+ FPTRUNC = 376,
+ FPEXT = 377,
+ BITCAST = 378,
+ UITOFP = 379,
+ SITOFP = 380,
+ FPTOUI = 381,
+ FPTOSI = 382,
+ INTTOPTR = 383,
+ PTRTOINT = 384,
+ PHI_TOK = 385,
+ SELECT = 386,
+ SHL = 387,
+ LSHR = 388,
+ ASHR = 389,
+ VAARG = 390,
+ EXTRACTELEMENT = 391,
+ INSERTELEMENT = 392,
+ SHUFFLEVECTOR = 393
};
#endif
+/* Tokens. */
#define ESINT64VAL 258
#define EUINT64VAL 259
#define SINTVAL 260
#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 ICMP 351
-#define FCMP 352
-#define EQ 353
-#define NE 354
-#define SLT 355
-#define SGT 356
-#define SLE 357
-#define SGE 358
-#define ULT 359
-#define UGT 360
-#define ULE 361
-#define UGE 362
-#define OEQ 363
-#define ONE 364
-#define OLT 365
-#define OGT 366
-#define OLE 367
-#define OGE 368
-#define ORD 369
-#define UNO 370
-#define UEQ 371
-#define UNE 372
-#define MALLOC 373
-#define ALLOCA 374
-#define FREE 375
-#define LOAD 376
-#define STORE 377
-#define GETELEMENTPTR 378
-#define TRUNC 379
-#define ZEXT 380
-#define SEXT 381
-#define FPTRUNC 382
-#define FPEXT 383
-#define BITCAST 384
-#define UITOFP 385
-#define SITOFP 386
-#define FPTOUI 387
-#define FPTOSI 388
-#define INTTOPTR 389
-#define PTRTOINT 390
-#define PHI_TOK 391
-#define SELECT 392
-#define SHL 393
-#define LSHR 394
-#define ASHR 395
-#define VAARG 396
-#define EXTRACTELEMENT 397
-#define INSERTELEMENT 398
-#define SHUFFLEVECTOR 399
+#define ICMP 345
+#define FCMP 346
+#define EQ 347
+#define NE 348
+#define SLT 349
+#define SGT 350
+#define SLE 351
+#define SGE 352
+#define ULT 353
+#define UGT 354
+#define ULE 355
+#define UGE 356
+#define OEQ 357
+#define ONE 358
+#define OLT 359
+#define OGT 360
+#define OLE 361
+#define OGE 362
+#define ORD 363
+#define UNO 364
+#define UEQ 365
+#define UNE 366
+#define MALLOC 367
+#define ALLOCA 368
+#define FREE 369
+#define LOAD 370
+#define STORE 371
+#define GETELEMENTPTR 372
+#define TRUNC 373
+#define ZEXT 374
+#define SEXT 375
+#define FPTRUNC 376
+#define FPEXT 377
+#define BITCAST 378
+#define UITOFP 379
+#define SITOFP 380
+#define FPTOUI 381
+#define FPTOSI 382
+#define INTTOPTR 383
+#define PTRTOINT 384
+#define PHI_TOK 385
+#define SELECT 386
+#define SHL 387
+#define LSHR 388
+#define ASHR 389
+#define VAARG 390
+#define EXTRACTELEMENT 391
+#define INSERTELEMENT 392
+#define SHUFFLEVECTOR 393
/* Copy the first part of user declarations. */
-#line 14 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+#line 14 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
#include "ParserInternals.h"
#include "llvm/CallingConv.h"
# 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 855 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+#line 855 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
typedef union YYSTYPE {
llvm::Module *ModuleVal;
llvm::Function *FunctionVal;
llvm::ICmpInst::Predicate IPredicate;
llvm::FCmpInst::Predicate FPredicate;
} YYSTYPE;
-/* Line 191 of yacc.c. */
-#line 1257 "llvmAsmParser.tab.c"
+/* Line 196 of yacc.c. */
+#line 1253 "llvmAsmParser.tab.c"
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
/* Copy the second part of user declarations. */
-/* Line 214 of yacc.c. */
-#line 1269 "llvmAsmParser.tab.c"
+/* Line 219 of yacc.c. */
+#line 1265 "llvmAsmParser.tab.c"
-#if ! defined (yyoverflow) || YYERROR_VERBOSE
+#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 <stddef.h> /* INFRINGES ON USER NAME SPACE */
+# define YYSIZE_T size_t
+#endif
+#if ! defined (YYSIZE_T)
+# define YYSIZE_T unsigned int
+#endif
-# ifndef YYFREE
-# define YYFREE free
+#ifndef YY_
+# if YYENABLE_NLS
+# if ENABLE_NLS
+# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
+# define YY_(msgid) dgettext ("bison-runtime", msgid)
+# endif
# endif
-# ifndef YYMALLOC
-# define YYMALLOC malloc
+# 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
-# define YYSTACK_ALLOC alloca
-# endif
-# else
-# if defined (alloca) || defined (_ALLOCA_H)
-# define YYSTACK_ALLOC alloca
-# else
# ifdef __GNUC__
# define YYSTACK_ALLOC __builtin_alloca
+# else
+# define YYSTACK_ALLOC alloca
+# if defined (__STDC__) || defined (__cplusplus)
+# include <stdlib.h> /* 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)
-# else
-# if defined (__STDC__) || defined (__cplusplus)
-# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-# define YYSIZE_T size_t
+# 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 */
/* A type that is properly aligned for any stack member. */
union yyalloc
{
- short yyss;
+ short int yyss;
YYSTYPE yyvs;
};
/* The size of an array large to enough to hold all stacks, each with
N elements. */
# define YYSTACK_BYTES(N) \
- ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
+ ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \
+ YYSTACK_GAP_MAXIMUM)
/* Copy COUNT objects from FROM to TO. The source and destination do
# define YYCOPY(To, From, Count) \
do \
{ \
- register YYSIZE_T yyi; \
+ YYSIZE_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \
(To)[yyi] = (From)[yyi]; \
} \
#if defined (__STDC__) || defined (__cplusplus)
typedef signed char yysigned_char;
#else
- typedef short yysigned_char;
+ typedef short int yysigned_char;
#endif
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 4
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 1476
+#define YYLAST 1390
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 159
+#define YYNTOKENS 153
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 78
+#define YYNNTS 76
/* YYNRULES -- Number of rules. */
-#define YYNRULES 299
+#define YYNRULES 291
/* YYNRULES -- Number of states. */
-#define YYNSTATES 584
+#define YYNSTATES 567
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 399
+#define YYMAXUTOK 393
-#define YYTRANSLATE(YYX) \
+#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 148, 149, 157, 2, 146, 2, 2, 2, 2, 2,
+ 142, 143, 151, 2, 140, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 153, 145, 154, 2, 2, 2, 2, 2, 2, 2,
+ 147, 139, 148, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 150, 147, 152, 2, 2, 2, 2, 2, 158,
+ 2, 144, 141, 146, 2, 2, 2, 2, 2, 152,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 151, 2, 2, 155, 2, 156, 2, 2, 2, 2,
+ 145, 2, 2, 149, 2, 150, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
- 135, 136, 137, 138, 139, 140, 141, 142, 143, 144
+ 135, 136, 137, 138
};
#if YYDEBUG
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
YYRHS. */
-static const unsigned short yyprhs[] =
+static const unsigned short int yyprhs[] =
{
0, 0, 3, 5, 7, 9, 11, 13, 15, 17,
19, 21, 23, 25, 27, 29, 31, 33, 35, 37,
79, 81, 83, 85, 87, 89, 91, 93, 95, 97,
99, 101, 103, 105, 107, 109, 111, 113, 115, 117,
119, 121, 123, 125, 127, 129, 131, 133, 135, 137,
- 139, 141, 143, 145, 147, 149, 151, 153, 156, 157,
- 159, 161, 163, 165, 167, 169, 171, 172, 173, 175,
- 177, 179, 181, 183, 185, 188, 189, 192, 193, 197,
- 200, 201, 203, 204, 208, 210, 213, 215, 217, 219,
+ 140, 141, 143, 145, 147, 149, 151, 153, 155, 156,
+ 157, 159, 161, 163, 165, 167, 169, 172, 173, 176,
+ 177, 181, 184, 185, 187, 188, 192, 194, 197, 199,
+ 201, 203, 205, 207, 209, 211, 213, 215, 217, 219,
221, 223, 225, 227, 229, 231, 233, 235, 237, 239,
- 241, 243, 245, 247, 249, 251, 253, 255, 258, 263,
- 269, 275, 279, 282, 288, 293, 296, 298, 302, 304,
- 308, 310, 311, 316, 320, 324, 329, 334, 338, 341,
- 344, 347, 350, 353, 356, 359, 362, 365, 368, 375,
- 381, 390, 397, 404, 411, 419, 427, 434, 441, 450,
- 459, 463, 465, 467, 469, 471, 474, 477, 482, 485,
- 487, 492, 495, 500, 501, 509, 510, 518, 519, 527,
- 528, 536, 540, 545, 546, 548, 550, 552, 556, 560,
- 564, 568, 572, 576, 578, 579, 581, 583, 585, 586,
- 589, 593, 595, 597, 601, 603, 604, 613, 615, 617,
- 621, 623, 625, 628, 629, 631, 633, 634, 639, 640,
- 642, 644, 646, 648, 650, 652, 654, 656, 658, 662,
- 664, 670, 672, 674, 676, 678, 681, 684, 687, 691,
- 694, 695, 697, 700, 703, 707, 717, 727, 736, 750,
- 752, 754, 761, 767, 770, 777, 785, 787, 791, 793,
- 794, 797, 799, 805, 811, 817, 824, 831, 834, 839,
- 844, 851, 856, 861, 868, 875, 878, 886, 888, 891,
- 892, 894, 895, 899, 906, 910, 917, 920, 925, 932
+ 242, 247, 253, 259, 263, 266, 272, 277, 280, 282,
+ 286, 288, 292, 294, 295, 300, 304, 308, 313, 318,
+ 322, 325, 328, 331, 334, 337, 340, 343, 346, 349,
+ 352, 355, 358, 365, 371, 380, 387, 394, 402, 410,
+ 417, 424, 433, 442, 446, 448, 450, 452, 454, 457,
+ 460, 465, 468, 470, 475, 478, 483, 484, 492, 493,
+ 501, 502, 510, 511, 519, 523, 528, 529, 531, 533,
+ 535, 539, 543, 547, 551, 555, 559, 561, 562, 564,
+ 566, 568, 569, 572, 576, 578, 580, 584, 586, 587,
+ 596, 598, 600, 604, 606, 608, 611, 612, 614, 616,
+ 617, 622, 623, 625, 627, 629, 631, 633, 635, 637,
+ 639, 641, 645, 647, 653, 655, 657, 659, 661, 664,
+ 667, 670, 674, 677, 678, 680, 683, 686, 690, 700,
+ 710, 719, 733, 735, 737, 744, 750, 753, 760, 768,
+ 770, 774, 776, 777, 780, 782, 788, 794, 801, 808,
+ 811, 816, 821, 828, 833, 838, 845, 852, 855, 863,
+ 865, 868, 869, 871, 872, 876, 883, 887, 894, 897,
+ 902, 909
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
-static const short yyrhs[] =
+static const short int yyrhs[] =
{
- 193, 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, 124, -1, 125,
- -1, 126, -1, 127, -1, 128, -1, 129, -1, 130,
- -1, 131, -1, 132, -1, 133, -1, 134, -1, 135,
- -1, 138, -1, 139, -1, 140, -1, 98, -1, 99,
- -1, 100, -1, 101, -1, 102, -1, 103, -1, 104,
- -1, 105, -1, 106, -1, 107, -1, 108, -1, 109,
- -1, 110, -1, 111, -1, 112, -1, 113, -1, 114,
- -1, 115, -1, 116, -1, 117, -1, 104, -1, 105,
- -1, 106, -1, 107, -1, 27, -1, 28, -1, 16,
- -1, 14, -1, 12, -1, 10, -1, 17, -1, 15,
- -1, 13, -1, 11, -1, 169, -1, 170, -1, 18,
- -1, 19, -1, 205, 145, -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, 146, 57, 4, -1, 34, 24, -1,
- -1, 178, -1, -1, 146, 181, 180, -1, 178, -1,
- 57, 4, -1, 184, -1, 8, -1, 186, -1, 8,
- -1, 186, -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, 185, -1, 220, -1, 147, 4, -1, 183, 148,
- 188, 149, -1, 150, 4, 151, 186, 152, -1, 153,
- 4, 151, 186, 154, -1, 155, 187, 156, -1, 155,
- 156, -1, 153, 155, 187, 156, 154, -1, 153, 155,
- 156, 154, -1, 186, 157, -1, 186, -1, 187, 146,
- 186, -1, 187, -1, 187, 146, 37, -1, 37, -1,
- -1, 184, 150, 191, 152, -1, 184, 150, 152, -1,
- 184, 158, 24, -1, 184, 153, 191, 154, -1, 184,
- 155, 191, 156, -1, 184, 155, 156, -1, 184, 38,
- -1, 184, 39, -1, 184, 220, -1, 184, 190, -1,
- 184, 26, -1, 169, 161, -1, 170, 4, -1, 9,
- 27, -1, 9, 28, -1, 172, 7, -1, 165, 148,
- 189, 36, 184, 149, -1, 123, 148, 189, 234, 149,
- -1, 137, 148, 189, 146, 189, 146, 189, 149, -1,
- 162, 148, 189, 146, 189, 149, -1, 163, 148, 189,
- 146, 189, 149, -1, 164, 148, 189, 146, 189, 149,
- -1, 96, 167, 148, 189, 146, 189, 149, -1, 97,
- 168, 148, 189, 146, 189, 149, -1, 166, 148, 189,
- 146, 189, 149, -1, 142, 148, 189, 146, 189, 149,
- -1, 143, 148, 189, 146, 189, 146, 189, 149, -1,
- 144, 148, 189, 146, 189, 146, 189, 149, -1, 191,
- 146, 189, -1, 189, -1, 32, -1, 33, -1, 194,
- -1, 194, 214, -1, 194, 216, -1, 194, 62, 61,
- 200, -1, 194, 25, -1, 195, -1, 195, 173, 20,
- 182, -1, 195, 216, -1, 195, 62, 61, 200, -1,
- -1, 195, 173, 174, 192, 189, 196, 180, -1, -1,
- 195, 173, 50, 192, 184, 197, 180, -1, -1, 195,
- 173, 45, 192, 184, 198, 180, -1, -1, 195, 173,
- 47, 192, 184, 199, 180, -1, 195, 51, 202, -1,
- 195, 58, 145, 203, -1, -1, 24, -1, 56, -1,
- 55, -1, 53, 145, 201, -1, 54, 145, 4, -1,
- 52, 145, 24, -1, 71, 145, 24, -1, 150, 204,
- 152, -1, 204, 146, 24, -1, 24, -1, -1, 22,
- -1, 24, -1, 205, -1, -1, 184, 206, -1, 208,
- 146, 207, -1, 207, -1, 208, -1, 208, 146, 37,
- -1, 37, -1, -1, 175, 182, 205, 148, 209, 149,
- 179, 176, -1, 29, -1, 155, -1, 174, 210, 211,
- -1, 30, -1, 156, -1, 223, 213, -1, -1, 45,
- -1, 47, -1, -1, 31, 217, 215, 210, -1, -1,
- 63, -1, 3, -1, 4, -1, 7, -1, 27, -1,
- 28, -1, 38, -1, 39, -1, 26, -1, 153, 191,
- 154, -1, 190, -1, 61, 218, 24, 146, 24, -1,
- 160, -1, 205, -1, 220, -1, 219, -1, 184, 221,
- -1, 223, 224, -1, 212, 224, -1, 225, 173, 226,
- -1, 225, 228, -1, -1, 23, -1, 72, 222, -1,
- 72, 8, -1, 73, 21, 221, -1, 73, 9, 221,
- 146, 21, 221, 146, 21, 221, -1, 74, 171, 221,
- 146, 21, 221, 150, 227, 152, -1, 74, 171, 221,
- 146, 21, 221, 150, 152, -1, 75, 175, 182, 221,
- 148, 231, 149, 36, 21, 221, 76, 21, 221, -1,
- 76, -1, 77, -1, 227, 171, 219, 146, 21, 221,
- -1, 171, 219, 146, 21, 221, -1, 173, 233, -1,
- 184, 150, 221, 146, 221, 152, -1, 229, 146, 150,
- 221, 146, 221, 152, -1, 222, -1, 230, 146, 222,
- -1, 230, -1, -1, 60, 59, -1, 59, -1, 162,
- 184, 221, 146, 221, -1, 163, 184, 221, 146, 221,
- -1, 164, 184, 221, 146, 221, -1, 96, 167, 184,
- 221, 146, 221, -1, 97, 168, 184, 221, 146, 221,
- -1, 49, 222, -1, 166, 222, 146, 222, -1, 165,
- 222, 36, 184, -1, 137, 222, 146, 222, 146, 222,
- -1, 141, 222, 146, 184, -1, 142, 222, 146, 222,
- -1, 143, 222, 146, 222, 146, 222, -1, 144, 222,
- 146, 222, 146, 222, -1, 136, 229, -1, 232, 175,
- 182, 221, 148, 231, 149, -1, 236, -1, 146, 230,
- -1, -1, 35, -1, -1, 118, 184, 177, -1, 118,
- 184, 146, 15, 221, 177, -1, 119, 184, 177, -1,
- 119, 184, 146, 15, 221, 177, -1, 120, 222, -1,
- 235, 121, 184, 221, -1, 235, 122, 222, 146, 184,
- 221, -1, 123, 184, 221, 234, -1
+ 185, 0, -1, 5, -1, 6, -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, 118, -1, 119, -1, 120, -1, 121, -1, 122,
+ -1, 123, -1, 124, -1, 125, -1, 126, -1, 127,
+ -1, 128, -1, 129, -1, 132, -1, 133, -1, 134,
+ -1, 92, -1, 93, -1, 94, -1, 95, -1, 96,
+ -1, 97, -1, 98, -1, 99, -1, 100, -1, 101,
+ -1, 102, -1, 103, -1, 104, -1, 105, -1, 106,
+ -1, 107, -1, 108, -1, 109, -1, 110, -1, 111,
+ -1, 98, -1, 99, -1, 100, -1, 101, -1, 27,
+ -1, 28, -1, 16, -1, 14, -1, 12, -1, 10,
+ -1, 17, -1, 15, -1, 13, -1, 11, -1, 161,
+ -1, 162, -1, 18, -1, 19, -1, 197, 139, -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, 140, 57, 4,
+ -1, 34, 24, -1, -1, 170, -1, -1, 140, 173,
+ 172, -1, 170, -1, 57, 4, -1, 176, -1, 8,
+ -1, 178, -1, 8, -1, 178, -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, 177, -1, 212, -1, 141,
+ 4, -1, 175, 142, 180, 143, -1, 144, 4, 145,
+ 178, 146, -1, 147, 4, 145, 178, 148, -1, 149,
+ 179, 150, -1, 149, 150, -1, 147, 149, 179, 150,
+ 148, -1, 147, 149, 150, 148, -1, 178, 151, -1,
+ 178, -1, 179, 140, 178, -1, 179, -1, 179, 140,
+ 37, -1, 37, -1, -1, 176, 144, 183, 146, -1,
+ 176, 144, 146, -1, 176, 152, 24, -1, 176, 147,
+ 183, 148, -1, 176, 149, 183, 150, -1, 176, 149,
+ 150, -1, 176, 38, -1, 176, 39, -1, 176, 212,
+ -1, 176, 182, -1, 176, 26, -1, 161, 3, -1,
+ 161, 4, -1, 162, 4, -1, 162, 3, -1, 9,
+ 27, -1, 9, 28, -1, 164, 7, -1, 157, 142,
+ 181, 36, 176, 143, -1, 117, 142, 181, 226, 143,
+ -1, 131, 142, 181, 140, 181, 140, 181, 143, -1,
+ 155, 142, 181, 140, 181, 143, -1, 156, 142, 181,
+ 140, 181, 143, -1, 90, 159, 142, 181, 140, 181,
+ 143, -1, 91, 160, 142, 181, 140, 181, 143, -1,
+ 158, 142, 181, 140, 181, 143, -1, 136, 142, 181,
+ 140, 181, 143, -1, 137, 142, 181, 140, 181, 140,
+ 181, 143, -1, 138, 142, 181, 140, 181, 140, 181,
+ 143, -1, 183, 140, 181, -1, 181, -1, 32, -1,
+ 33, -1, 186, -1, 186, 206, -1, 186, 208, -1,
+ 186, 62, 61, 192, -1, 186, 25, -1, 187, -1,
+ 187, 165, 20, 174, -1, 187, 208, -1, 187, 62,
+ 61, 192, -1, -1, 187, 165, 166, 184, 181, 188,
+ 172, -1, -1, 187, 165, 50, 184, 176, 189, 172,
+ -1, -1, 187, 165, 45, 184, 176, 190, 172, -1,
+ -1, 187, 165, 47, 184, 176, 191, 172, -1, 187,
+ 51, 194, -1, 187, 58, 139, 195, -1, -1, 24,
+ -1, 56, -1, 55, -1, 53, 139, 193, -1, 54,
+ 139, 4, -1, 52, 139, 24, -1, 71, 139, 24,
+ -1, 144, 196, 146, -1, 196, 140, 24, -1, 24,
+ -1, -1, 22, -1, 24, -1, 197, -1, -1, 176,
+ 198, -1, 200, 140, 199, -1, 199, -1, 200, -1,
+ 200, 140, 37, -1, 37, -1, -1, 167, 174, 197,
+ 142, 201, 143, 171, 168, -1, 29, -1, 149, -1,
+ 166, 202, 203, -1, 30, -1, 150, -1, 215, 205,
+ -1, -1, 45, -1, 47, -1, -1, 31, 209, 207,
+ 202, -1, -1, 63, -1, 3, -1, 4, -1, 7,
+ -1, 27, -1, 28, -1, 38, -1, 39, -1, 26,
+ -1, 147, 183, 148, -1, 182, -1, 61, 210, 24,
+ 140, 24, -1, 154, -1, 197, -1, 212, -1, 211,
+ -1, 176, 213, -1, 215, 216, -1, 204, 216, -1,
+ 217, 165, 218, -1, 217, 220, -1, -1, 23, -1,
+ 72, 214, -1, 72, 8, -1, 73, 21, 213, -1,
+ 73, 9, 213, 140, 21, 213, 140, 21, 213, -1,
+ 74, 163, 213, 140, 21, 213, 144, 219, 146, -1,
+ 74, 163, 213, 140, 21, 213, 144, 146, -1, 75,
+ 167, 174, 213, 142, 223, 143, 36, 21, 213, 76,
+ 21, 213, -1, 76, -1, 77, -1, 219, 163, 211,
+ 140, 21, 213, -1, 163, 211, 140, 21, 213, -1,
+ 165, 225, -1, 176, 144, 213, 140, 213, 146, -1,
+ 221, 140, 144, 213, 140, 213, 146, -1, 214, -1,
+ 222, 140, 214, -1, 222, -1, -1, 60, 59, -1,
+ 59, -1, 155, 176, 213, 140, 213, -1, 156, 176,
+ 213, 140, 213, -1, 90, 159, 176, 213, 140, 213,
+ -1, 91, 160, 176, 213, 140, 213, -1, 49, 214,
+ -1, 158, 214, 140, 214, -1, 157, 214, 36, 176,
+ -1, 131, 214, 140, 214, 140, 214, -1, 135, 214,
+ 140, 176, -1, 136, 214, 140, 214, -1, 137, 214,
+ 140, 214, 140, 214, -1, 138, 214, 140, 214, 140,
+ 214, -1, 130, 221, -1, 224, 167, 174, 213, 142,
+ 223, 143, -1, 228, -1, 140, 222, -1, -1, 35,
+ -1, -1, 112, 176, 169, -1, 112, 176, 140, 15,
+ 213, 169, -1, 113, 176, 169, -1, 113, 176, 140,
+ 15, 213, 169, -1, 114, 214, -1, 227, 115, 176,
+ 213, -1, 227, 116, 214, 140, 176, 213, -1, 117,
+ 176, 213, 226, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
-static const unsigned short yyrline[] =
+static const unsigned short int yyrline[] =
{
- 0, 990, 990, 991, 999, 1000, 1010, 1010, 1010, 1010,
- 1010, 1010, 1010, 1010, 1010, 1011, 1011, 1011, 1012, 1012,
- 1012, 1012, 1012, 1012, 1013, 1013, 1013, 1013, 1013, 1013,
- 1014, 1014, 1014, 1014, 1014, 1014, 1015, 1015, 1015, 1017,
- 1017, 1018, 1018, 1019, 1019, 1020, 1020, 1021, 1021, 1025,
- 1025, 1026, 1026, 1027, 1027, 1028, 1028, 1029, 1029, 1030,
- 1030, 1031, 1031, 1032, 1033, 1038, 1038, 1038, 1038, 1039,
- 1039, 1039, 1039, 1040, 1040, 1041, 1041, 1044, 1048, 1053,
- 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1062, 1063, 1064,
- 1065, 1066, 1067, 1068, 1069, 1078, 1079, 1085, 1086, 1094,
- 1102, 1103, 1108, 1109, 1110, 1115, 1129, 1129, 1130, 1130,
- 1132, 1142, 1142, 1142, 1142, 1142, 1142, 1142, 1143, 1143,
- 1143, 1143, 1143, 1143, 1144, 1148, 1152, 1160, 1168, 1181,
- 1186, 1198, 1208, 1212, 1222, 1226, 1237, 1242, 1248, 1249,
- 1253, 1257, 1268, 1294, 1308, 1338, 1364, 1385, 1398, 1408,
- 1413, 1474, 1481, 1489, 1495, 1501, 1505, 1509, 1517, 1529,
- 1550, 1558, 1564, 1575, 1581, 1586, 1591, 1600, 1606, 1612,
- 1621, 1625, 1633, 1633, 1643, 1651, 1656, 1660, 1664, 1668,
- 1683, 1705, 1708, 1711, 1711, 1719, 1719, 1727, 1727, 1735,
- 1735, 1744, 1747, 1750, 1754, 1767, 1768, 1770, 1774, 1783,
- 1787, 1792, 1794, 1799, 1804, 1813, 1813, 1814, 1814, 1816,
- 1823, 1829, 1836, 1840, 1846, 1851, 1856, 1951, 1951, 1953,
- 1961, 1961, 1963, 1968, 1969, 1970, 1972, 1972, 1982, 1986,
- 1991, 1995, 1999, 2003, 2007, 2011, 2015, 2019, 2023, 2048,
- 2052, 2066, 2070, 2076, 2076, 2082, 2087, 2091, 2100, 2111,
- 2120, 2132, 2145, 2149, 2153, 2158, 2167, 2186, 2195, 2251,
- 2255, 2262, 2273, 2286, 2295, 2304, 2314, 2318, 2325, 2325,
- 2327, 2331, 2336, 2355, 2370, 2384, 2395, 2406, 2419, 2428,
- 2439, 2447, 2452, 2458, 2464, 2470, 2485, 2544, 2551, 2554,
- 2559, 2563, 2570, 2575, 2581, 2586, 2592, 2600, 2612, 2627
+ 0, 988, 988, 989, 999, 999, 999, 999, 999, 999,
+ 999, 999, 999, 1000, 1000, 1000, 1001, 1001, 1001, 1001,
+ 1001, 1001, 1002, 1002, 1002, 1002, 1002, 1002, 1003, 1003,
+ 1003, 1005, 1005, 1006, 1006, 1007, 1007, 1008, 1008, 1009,
+ 1009, 1013, 1013, 1014, 1014, 1015, 1015, 1016, 1016, 1017,
+ 1017, 1018, 1018, 1019, 1019, 1020, 1021, 1026, 1026, 1026,
+ 1026, 1027, 1027, 1027, 1027, 1028, 1028, 1029, 1029, 1032,
+ 1036, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1050,
+ 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1066, 1067, 1073,
+ 1074, 1082, 1090, 1091, 1096, 1097, 1098, 1103, 1117, 1117,
+ 1118, 1118, 1120, 1130, 1130, 1130, 1130, 1130, 1130, 1130,
+ 1131, 1131, 1131, 1131, 1131, 1131, 1132, 1136, 1140, 1148,
+ 1156, 1169, 1174, 1186, 1196, 1200, 1210, 1214, 1225, 1230,
+ 1236, 1237, 1241, 1245, 1256, 1282, 1296, 1326, 1352, 1373,
+ 1386, 1396, 1401, 1462, 1469, 1477, 1483, 1489, 1495, 1501,
+ 1505, 1509, 1517, 1529, 1550, 1558, 1564, 1575, 1580, 1585,
+ 1594, 1600, 1606, 1615, 1619, 1627, 1627, 1637, 1645, 1650,
+ 1654, 1658, 1662, 1677, 1699, 1702, 1705, 1705, 1713, 1713,
+ 1721, 1721, 1729, 1729, 1738, 1741, 1744, 1748, 1761, 1762,
+ 1764, 1768, 1777, 1781, 1786, 1788, 1793, 1798, 1807, 1807,
+ 1808, 1808, 1810, 1817, 1823, 1830, 1834, 1840, 1845, 1850,
+ 1945, 1945, 1947, 1955, 1955, 1957, 1962, 1963, 1964, 1966,
+ 1966, 1976, 1980, 1985, 1989, 1993, 1997, 2001, 2005, 2009,
+ 2013, 2017, 2042, 2046, 2060, 2064, 2070, 2070, 2076, 2081,
+ 2085, 2094, 2105, 2114, 2126, 2139, 2143, 2147, 2152, 2161,
+ 2180, 2189, 2245, 2249, 2256, 2267, 2280, 2289, 2298, 2308,
+ 2312, 2319, 2319, 2321, 2325, 2330, 2349, 2364, 2375, 2386,
+ 2399, 2408, 2419, 2427, 2432, 2438, 2444, 2450, 2465, 2524,
+ 2531, 2534, 2539, 2543, 2550, 2555, 2561, 2566, 2572, 2580,
+ 2592, 2607
};
#endif
-#if YYDEBUG || YYERROR_VERBOSE
-/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
+#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[] =
{
"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", "ICMP",
- "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT", "UGT", "ULE",
- "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD", "UNO", "UEQ",
- "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE", "GETELEMENTPTR",
- "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST", "UITOFP",
- "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT", "PHI_TOK",
- "SELECT", "SHL", "LSHR", "ASHR", "VAARG", "EXTRACTELEMENT",
+ "XOR", "ICMP", "FCMP", "EQ", "NE", "SLT", "SGT", "SLE", "SGE", "ULT",
+ "UGT", "ULE", "UGE", "OEQ", "ONE", "OLT", "OGT", "OLE", "OGE", "ORD",
+ "UNO", "UEQ", "UNE", "MALLOC", "ALLOCA", "FREE", "LOAD", "STORE",
+ "GETELEMENTPTR", "TRUNC", "ZEXT", "SEXT", "FPTRUNC", "FPEXT", "BITCAST",
+ "UITOFP", "SITOFP", "FPTOUI", "FPTOSI", "INTTOPTR", "PTRTOINT",
+ "PHI_TOK", "SELECT", "SHL", "LSHR", "ASHR", "VAARG", "EXTRACTELEMENT",
"INSERTELEMENT", "SHUFFLEVECTOR", "'='", "','", "'\\\\'", "'('", "')'",
"'['", "'x'", "']'", "'<'", "'>'", "'{'", "'}'", "'*'", "'c'", "$accept",
- "INTVAL", "EINT64VAL", "ArithmeticOps", "LogicalOps", "SetCondOps",
- "CastOps", "ShiftOps", "IPredicates", "FPredicates", "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",
+ "INTVAL", "ArithmeticOps", "LogicalOps", "CastOps", "ShiftOps",
+ "IPredicates", "FPredicates", "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",
# ifdef YYPRINT
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
token YYLEX-NUM. */
-static const unsigned short yytoknum[] =
+static const unsigned short int yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
375, 376, 377, 378, 379, 380, 381, 382, 383, 384,
- 385, 386, 387, 388, 389, 390, 391, 392, 393, 394,
- 395, 396, 397, 398, 399, 61, 44, 92, 40, 41,
- 91, 120, 93, 60, 62, 123, 125, 42, 99
+ 385, 386, 387, 388, 389, 390, 391, 392, 393, 61,
+ 44, 92, 40, 41, 91, 120, 93, 60, 62, 123,
+ 125, 42, 99
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const unsigned char yyr1[] =
{
- 0, 159, 160, 160, 161, 161, 162, 162, 162, 162,
- 162, 162, 162, 162, 162, 163, 163, 163, 164, 164,
- 164, 164, 164, 164, 165, 165, 165, 165, 165, 165,
- 165, 165, 165, 165, 165, 165, 166, 166, 166, 167,
- 167, 167, 167, 167, 167, 167, 167, 167, 167, 168,
- 168, 168, 168, 168, 168, 168, 168, 168, 168, 168,
- 168, 168, 168, 168, 168, 169, 169, 169, 169, 170,
- 170, 170, 170, 171, 171, 172, 172, 173, 173, 174,
- 174, 174, 174, 174, 174, 174, 174, 175, 175, 175,
- 175, 175, 175, 175, 175, 176, 176, 177, 177, 178,
- 179, 179, 180, 180, 181, 181, 182, 182, 183, 183,
- 184, 185, 185, 185, 185, 185, 185, 185, 185, 185,
- 185, 185, 185, 185, 186, 186, 186, 186, 186, 186,
- 186, 186, 186, 186, 186, 186, 187, 187, 188, 188,
- 188, 188, 189, 189, 189, 189, 189, 189, 189, 189,
- 189, 189, 189, 189, 189, 189, 189, 189, 190, 190,
- 190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
- 191, 191, 192, 192, 193, 194, 194, 194, 194, 194,
- 195, 195, 195, 196, 195, 197, 195, 198, 195, 199,
- 195, 195, 195, 195, 200, 201, 201, 202, 202, 202,
- 202, 203, 204, 204, 204, 205, 205, 206, 206, 207,
- 208, 208, 209, 209, 209, 209, 210, 211, 211, 212,
- 213, 213, 214, 215, 215, 215, 217, 216, 218, 218,
- 219, 219, 219, 219, 219, 219, 219, 219, 219, 219,
- 219, 220, 220, 221, 221, 222, 223, 223, 224, 225,
- 225, 225, 226, 226, 226, 226, 226, 226, 226, 226,
- 226, 227, 227, 228, 229, 229, 230, 230, 231, 231,
- 232, 232, 233, 233, 233, 233, 233, 233, 233, 233,
- 233, 233, 233, 233, 233, 233, 233, 233, 234, 234,
- 235, 235, 236, 236, 236, 236, 236, 236, 236, 236
+ 0, 153, 154, 154, 155, 155, 155, 155, 155, 155,
+ 155, 155, 155, 156, 156, 156, 157, 157, 157, 157,
+ 157, 157, 157, 157, 157, 157, 157, 157, 158, 158,
+ 158, 159, 159, 159, 159, 159, 159, 159, 159, 159,
+ 159, 160, 160, 160, 160, 160, 160, 160, 160, 160,
+ 160, 160, 160, 160, 160, 160, 160, 161, 161, 161,
+ 161, 162, 162, 162, 162, 163, 163, 164, 164, 165,
+ 165, 166, 166, 166, 166, 166, 166, 166, 166, 167,
+ 167, 167, 167, 167, 167, 167, 167, 168, 168, 169,
+ 169, 170, 171, 171, 172, 172, 173, 173, 174, 174,
+ 175, 175, 176, 177, 177, 177, 177, 177, 177, 177,
+ 177, 177, 177, 177, 177, 177, 178, 178, 178, 178,
+ 178, 178, 178, 178, 178, 178, 178, 178, 179, 179,
+ 180, 180, 180, 180, 181, 181, 181, 181, 181, 181,
+ 181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
+ 181, 181, 182, 182, 182, 182, 182, 182, 182, 182,
+ 182, 182, 182, 183, 183, 184, 184, 185, 186, 186,
+ 186, 186, 186, 187, 187, 187, 188, 187, 189, 187,
+ 190, 187, 191, 187, 187, 187, 187, 192, 193, 193,
+ 194, 194, 194, 194, 195, 196, 196, 196, 197, 197,
+ 198, 198, 199, 200, 200, 201, 201, 201, 201, 202,
+ 203, 203, 204, 205, 205, 206, 207, 207, 207, 209,
+ 208, 210, 210, 211, 211, 211, 211, 211, 211, 211,
+ 211, 211, 211, 211, 212, 212, 213, 213, 214, 215,
+ 215, 216, 217, 217, 217, 218, 218, 218, 218, 218,
+ 218, 218, 218, 218, 219, 219, 220, 221, 221, 222,
+ 222, 223, 223, 224, 224, 225, 225, 225, 225, 225,
+ 225, 225, 225, 225, 225, 225, 225, 225, 225, 225,
+ 226, 226, 227, 227, 228, 228, 228, 228, 228, 228,
+ 228, 228
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 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, 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, 5, 4, 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, 7, 7, 6, 6, 8, 8,
- 3, 1, 1, 1, 1, 2, 2, 4, 2, 1,
- 4, 2, 4, 0, 7, 0, 7, 0, 7, 0,
- 7, 3, 4, 0, 1, 1, 1, 3, 3, 3,
- 3, 3, 3, 1, 0, 1, 1, 1, 0, 2,
- 3, 1, 1, 3, 1, 0, 8, 1, 1, 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, 6, 6, 2, 4, 4,
- 6, 4, 4, 6, 6, 2, 7, 1, 2, 0,
- 1, 0, 3, 6, 3, 6, 2, 4, 6, 4
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
+ 4, 5, 5, 3, 2, 5, 4, 2, 1, 3,
+ 1, 3, 1, 0, 4, 3, 3, 4, 4, 3,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 6, 5, 8, 6, 6, 7, 7, 6,
+ 6, 8, 8, 3, 1, 1, 1, 1, 2, 2,
+ 4, 2, 1, 4, 2, 4, 0, 7, 0, 7,
+ 0, 7, 0, 7, 3, 4, 0, 1, 1, 1,
+ 3, 3, 3, 3, 3, 3, 1, 0, 1, 1,
+ 1, 0, 2, 3, 1, 1, 3, 1, 0, 8,
+ 1, 1, 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, 6, 6, 2,
+ 4, 4, 6, 4, 4, 6, 6, 2, 7, 1,
+ 2, 0, 1, 0, 3, 6, 3, 6, 2, 4,
+ 6, 4
};
/* 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 yydefact[] =
+static const unsigned short int yydefact[] =
{
- 193, 0, 86, 179, 1, 178, 226, 79, 80, 81,
- 82, 83, 84, 85, 0, 87, 250, 175, 176, 250,
- 205, 206, 0, 0, 0, 86, 0, 181, 223, 0,
- 0, 88, 89, 90, 91, 92, 93, 0, 0, 251,
- 247, 78, 220, 221, 222, 246, 0, 0, 0, 0,
- 191, 0, 0, 0, 0, 0, 0, 0, 77, 224,
- 225, 87, 194, 177, 94, 2, 3, 107, 111, 112,
- 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
- 123, 124, 0, 0, 0, 0, 241, 0, 0, 106,
- 125, 110, 242, 126, 217, 218, 219, 291, 249, 0,
- 0, 0, 0, 204, 192, 182, 180, 172, 173, 0,
- 0, 0, 0, 227, 127, 0, 0, 0, 109, 132,
- 136, 0, 0, 141, 135, 290, 0, 271, 0, 0,
- 0, 0, 87, 259, 260, 6, 7, 8, 9, 10,
- 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
- 21, 22, 23, 0, 0, 0, 0, 0, 0, 24,
- 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
- 35, 0, 0, 36, 37, 38, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 248, 87, 263, 0, 287,
- 199, 196, 195, 197, 198, 200, 203, 0, 187, 189,
- 185, 111, 112, 113, 114, 115, 116, 117, 118, 119,
- 120, 121, 0, 0, 0, 0, 183, 0, 0, 0,
- 0, 0, 131, 215, 140, 138, 0, 0, 277, 270,
- 253, 252, 0, 0, 68, 72, 67, 71, 66, 70,
- 65, 69, 73, 74, 0, 0, 39, 40, 41, 42,
- 43, 44, 45, 46, 47, 48, 0, 63, 64, 59,
- 60, 61, 62, 49, 50, 51, 52, 53, 54, 55,
- 56, 57, 58, 0, 97, 97, 296, 0, 0, 285,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 201, 102, 102, 102, 155, 156,
- 4, 5, 153, 154, 157, 152, 148, 149, 0, 0,
+ 186, 0, 78, 172, 1, 171, 219, 71, 72, 73,
+ 74, 75, 76, 77, 0, 79, 243, 168, 169, 243,
+ 198, 199, 0, 0, 0, 78, 0, 174, 216, 0,
+ 0, 80, 81, 82, 83, 84, 85, 0, 0, 244,
+ 240, 70, 213, 214, 215, 239, 0, 0, 0, 0,
+ 184, 0, 0, 0, 0, 0, 0, 0, 69, 217,
+ 218, 79, 187, 170, 86, 2, 3, 99, 103, 104,
+ 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
+ 115, 116, 0, 0, 0, 0, 234, 0, 0, 98,
+ 117, 102, 235, 118, 210, 211, 212, 283, 242, 0,
+ 0, 0, 0, 197, 185, 175, 173, 165, 166, 0,
+ 0, 0, 0, 220, 119, 0, 0, 0, 101, 124,
+ 128, 0, 0, 133, 127, 282, 0, 264, 0, 0,
+ 0, 0, 79, 252, 253, 4, 5, 6, 7, 8,
+ 9, 10, 11, 12, 13, 14, 15, 0, 0, 0,
+ 0, 0, 0, 16, 17, 18, 19, 20, 21, 22,
+ 23, 24, 25, 26, 27, 0, 0, 28, 29, 30,
+ 0, 0, 0, 0, 0, 0, 0, 0, 241, 79,
+ 256, 0, 279, 192, 189, 188, 190, 191, 193, 196,
+ 0, 180, 182, 178, 103, 104, 105, 106, 107, 108,
+ 109, 110, 111, 112, 113, 0, 0, 0, 0, 176,
+ 0, 0, 0, 0, 0, 123, 208, 132, 130, 0,
+ 0, 269, 263, 246, 245, 0, 0, 60, 64, 59,
+ 63, 58, 62, 57, 61, 65, 66, 0, 0, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 0,
+ 55, 56, 51, 52, 53, 54, 41, 42, 43, 44,
+ 45, 46, 47, 48, 49, 50, 0, 89, 89, 288,
+ 0, 0, 277, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 194, 94, 94, 94,
+ 149, 150, 145, 146, 148, 147, 151, 144, 140, 141,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 151, 150, 102, 108, 108, 134,
- 0, 137, 214, 208, 211, 212, 0, 0, 128, 230,
- 231, 232, 237, 233, 234, 235, 236, 228, 0, 239,
- 244, 243, 245, 0, 254, 0, 0, 0, 0, 0,
- 292, 0, 294, 289, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 202,
- 0, 188, 190, 186, 0, 0, 0, 0, 0, 0,
- 0, 143, 171, 0, 0, 147, 0, 144, 0, 0,
- 0, 0, 0, 184, 129, 130, 133, 207, 209, 0,
- 100, 139, 229, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 299, 0, 0, 0, 281, 282,
- 0, 0, 0, 0, 0, 279, 278, 0, 297, 0,
- 0, 0, 104, 102, 0, 0, 289, 0, 0, 0,
- 0, 0, 142, 145, 146, 0, 0, 0, 0, 0,
- 213, 210, 101, 95, 0, 238, 0, 0, 269, 0,
- 0, 97, 98, 97, 266, 288, 0, 0, 0, 0,
- 0, 272, 273, 274, 269, 0, 99, 105, 103, 0,
- 0, 0, 0, 0, 0, 0, 170, 0, 0, 0,
- 0, 0, 0, 216, 0, 0, 0, 268, 0, 275,
- 276, 0, 293, 295, 0, 0, 0, 280, 283, 284,
- 0, 298, 0, 0, 159, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 96, 240, 0, 0, 0, 267,
- 264, 0, 286, 0, 0, 0, 167, 0, 0, 161,
- 162, 163, 158, 166, 0, 257, 0, 0, 0, 265,
- 164, 165, 0, 0, 0, 255, 0, 256, 0, 0,
- 160, 168, 169, 0, 0, 0, 0, 0, 0, 262,
- 0, 0, 261, 258
+ 0, 0, 0, 0, 0, 143, 142, 94, 100, 100,
+ 126, 0, 129, 207, 201, 204, 205, 0, 0, 120,
+ 223, 224, 225, 230, 226, 227, 228, 229, 221, 0,
+ 232, 237, 236, 238, 0, 247, 0, 0, 0, 0,
+ 0, 284, 0, 286, 281, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 195,
+ 0, 181, 183, 179, 0, 0, 0, 0, 0, 0,
+ 0, 135, 164, 0, 0, 139, 0, 136, 0, 0,
+ 0, 0, 177, 121, 122, 125, 200, 202, 0, 92,
+ 131, 222, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 291, 0, 0, 0, 273, 274, 0,
+ 0, 0, 0, 271, 270, 0, 289, 0, 0, 0,
+ 96, 94, 0, 0, 281, 0, 0, 0, 0, 0,
+ 134, 137, 138, 0, 0, 0, 0, 206, 203, 93,
+ 87, 0, 231, 0, 0, 262, 0, 0, 89, 90,
+ 89, 259, 280, 0, 0, 0, 0, 0, 265, 266,
+ 262, 0, 91, 97, 95, 0, 0, 0, 0, 0,
+ 0, 0, 163, 0, 0, 0, 0, 0, 209, 0,
+ 0, 0, 261, 0, 267, 268, 0, 285, 287, 0,
+ 0, 0, 272, 275, 276, 0, 290, 0, 0, 153,
+ 0, 0, 0, 0, 0, 0, 0, 0, 88, 233,
+ 0, 0, 0, 260, 257, 0, 278, 0, 0, 0,
+ 160, 0, 0, 155, 156, 152, 159, 0, 250, 0,
+ 0, 0, 258, 157, 158, 0, 0, 0, 248, 0,
+ 249, 0, 0, 154, 161, 162, 0, 0, 0, 0,
+ 0, 0, 255, 0, 0, 254, 251
};
/* YYDEFGOTO[NTERM-NUM]. */
-static const short yydefgoto[] =
+static const short int yydefgoto[] =
{
- -1, 86, 302, 319, 320, 321, 322, 323, 256, 273,
- 212, 213, 244, 214, 25, 15, 37, 503, 360, 442,
- 463, 381, 443, 87, 88, 215, 90, 91, 121, 226,
- 392, 349, 393, 109, 1, 2, 3, 326, 297, 295,
- 296, 63, 193, 50, 104, 197, 92, 408, 334, 335,
- 336, 38, 96, 16, 44, 17, 61, 18, 28, 413,
- 350, 93, 352, 474, 19, 40, 41, 185, 557, 98,
- 279, 507, 508, 186, 187, 424, 188, 189
+ -1, 86, 311, 312, 313, 314, 249, 266, 205, 206,
+ 237, 207, 25, 15, 37, 488, 351, 430, 450, 371,
+ 431, 87, 88, 208, 90, 91, 121, 219, 382, 340,
+ 383, 109, 1, 2, 3, 317, 289, 287, 288, 63,
+ 186, 50, 104, 190, 92, 397, 325, 326, 327, 38,
+ 96, 16, 44, 17, 61, 18, 28, 402, 341, 93,
+ 343, 461, 19, 40, 41, 178, 540, 98, 272, 492,
+ 493, 179, 180, 413, 181, 182
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -529
-static const short yypact[] =
+#define YYPACT_NINF -514
+static const short int yypact[] =
{
- -529, 21, 408, 495, -529, -529, -529, -529, -529, -529,
- -529, -529, -529, -529, -24, 145, 43, -529, -529, -8,
- -529, -529, -20, -63, 30, 137, -51, -529, 152, 73,
- 147, -529, -529, -529, -529, -529, -529, 1211, -3, -529,
- -529, 176, -529, -529, -529, -529, -32, 57, 71, 72,
- -529, 35, 73, 1211, 46, 46, 46, 46, -529, -529,
- -529, 145, -529, -529, -529, -529, -529, 74, -529, -529,
- -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,
- -529, -529, 217, 219, 4, 90, -529, 176, 77, -529,
- -529, -105, -529, -529, -529, -529, -529, 1316, -529, 202,
- 67, 223, 204, 205, -529, -529, -529, -529, -529, 1231,
- 1231, 1231, 1276, -529, -529, 82, 83, 637, -529, -529,
- -105, -117, 87, 1018, -529, -529, 1231, -529, 179, 1321,
- 15, 178, 145, -529, -529, -529, -529, -529, -529, -529,
- -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,
- -529, -529, -529, 195, 378, 1231, 1231, 1231, 1231, -529,
- -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,
- -529, 1231, 1231, -529, -529, -529, 1231, 1231, 1231, 1231,
- 1231, 1231, 1231, 1231, 1231, -529, 145, -529, 11, -529,
- -529, -529, -529, -529, -529, -529, -529, -98, -529, -529,
- -529, 109, 157, 235, 168, 238, 173, 240, 201, 244,
- 245, 250, 203, 254, 252, 544, -529, 1231, 1231, 106,
- -111, 1231, -529, 1059, -529, 115, 113, 730, -529, -529,
- 74, -529, 730, 730, -529, -529, -529, -529, -529, -529,
- -529, -529, -529, -529, 730, 1211, -529, -529, -529, -529,
- -529, -529, -529, -529, -529, -529, 1231, -529, -529, -529,
- -529, -529, -529, -529, -529, -529, -529, -529, -529, -529,
- -529, -529, -529, 1231, 117, 124, -529, 730, 121, 129,
- 135, 136, 139, 140, 141, 730, 730, 730, 267, 158,
- 1211, 1231, 1231, 282, -529, 161, 161, 161, -529, -529,
- -529, -529, -529, -529, -529, -529, -529, -529, 195, 378,
- 160, 162, 163, 164, 165, 965, 1276, 695, 285, 167,
- 170, 171, 172, 174, -529, -529, 161, -64, -87, -529,
- 169, -105, -529, 176, -529, 175, 190, 1116, -529, -529,
- -529, -529, -529, -529, -529, -529, -529, 253, 1276, -529,
- -529, -529, -529, 182, -529, 194, 730, 730, 730, -1,
- -529, 5, -529, 196, 730, 193, 1231, 1231, 1231, 1231,
- 1231, 198, 199, 200, 1231, 1231, 730, 730, 207, -529,
- -11, -529, -529, -529, 206, 208, 1276, 1276, 1276, 1276,
- 1276, -529, -529, -66, -78, -529, -85, -529, 1276, 1276,
- 1276, 1276, 1276, -529, -529, -529, -529, -529, -529, 1170,
- 290, -529, -529, 323, -77, 327, 328, 209, 212, 216,
- 730, 346, 730, 1231, -529, 218, 730, 220, -529, -529,
- 222, 224, 730, 730, 730, -529, -529, 215, -529, 1231,
- 331, 347, -529, 161, 1276, 1276, 196, 225, 227, 229,
- 230, 1276, -529, -529, -529, 231, 234, 246, 329, 247,
- -529, -529, -529, 312, 248, -529, 730, 730, 1231, 730,
- 730, 255, -529, 255, -529, 257, 730, 264, 1231, 1231,
- 1231, -529, -529, -529, 1231, 730, -529, -529, -529, 265,
- 268, 232, 1276, 1276, 1276, 1276, -529, 1276, 1276, 1276,
- 1231, 1276, 386, -529, 375, 269, 270, 257, 251, -529,
- -529, 361, -529, -529, 1231, 271, 730, -529, -529, -529,
- 272, -529, 1276, 1276, -529, 273, 275, 276, 279, 277,
- 281, 283, 287, 291, -529, -529, 407, 114, 398, -529,
- -529, 292, -529, 296, 297, 1276, -529, 1276, 1276, -529,
- -529, -529, -529, -529, 730, -529, 872, 153, 427, -529,
- -529, -529, 307, 308, 309, -529, 313, -529, 872, 730,
- -529, -529, -529, 440, 318, 389, 730, 446, 447, -529,
- 730, 730, -529, -529
+ -514, 47, 80, 817, -514, -514, -514, -514, -514, -514,
+ -514, -514, -514, -514, -3, 79, 67, -514, -514, -9,
+ -514, -514, 33, -46, 42, 139, -29, -514, -2, 95,
+ 126, -514, -514, -514, -514, -514, -514, 1112, -18, -514,
+ -514, 96, -514, -514, -514, -514, -7, 29, 56, 61,
+ -514, 34, 95, 1112, 74, 74, 74, 74, -514, -514,
+ -514, 79, -514, -514, -514, -514, -514, 45, -514, -514,
+ -514, -514, -514, -514, -514, -514, -514, -514, -514, -514,
+ -514, -514, 209, 211, 2, 538, -514, 96, 77, -514,
+ -514, -118, -514, -514, -514, -514, -514, 1252, -514, 201,
+ 102, 224, 206, 215, -514, -514, -514, -514, -514, 1153,
+ 1153, 1153, 1173, -514, -514, 112, 115, 598, -514, -514,
+ -118, -111, 99, 643, -514, -514, 1153, -514, 207, 1214,
+ 14, 239, 79, -514, -514, -514, -514, -514, -514, -514,
+ -514, -514, -514, -514, -514, -514, -514, 110, 190, 1153,
+ 1153, 1153, 1153, -514, -514, -514, -514, -514, -514, -514,
+ -514, -514, -514, -514, -514, 1153, 1153, -514, -514, -514,
+ 1153, 1153, 1153, 1153, 1153, 1153, 1153, 1153, -514, 79,
+ -514, 48, -514, -514, -514, -514, -514, -514, -514, -514,
+ -94, -514, -514, -514, 138, 171, 173, 187, 189, 195,
+ 218, 220, 230, 258, 260, 232, 234, 267, 393, -514,
+ 1153, 1153, 129, -99, 1153, -514, 967, -514, 140, 135,
+ 691, -514, -514, 45, -514, 691, 691, -514, -514, -514,
+ -514, -514, -514, -514, -514, -514, -514, 691, 1112, -514,
+ -514, -514, -514, -514, -514, -514, -514, -514, -514, 1153,
+ -514, -514, -514, -514, -514, -514, -514, -514, -514, -514,
+ -514, -514, -514, -514, -514, -514, 1153, 145, 146, -514,
+ 691, 158, 163, 164, 165, 167, 169, 170, 691, 691,
+ 243, 172, 1112, 1153, 1153, 287, -514, 174, 174, 174,
+ -514, -514, -514, -514, -514, -514, -514, -514, -514, -514,
+ 110, 190, 176, 177, 188, 191, 192, 914, 1173, 618,
+ 289, 193, 194, 196, 197, -514, -514, 174, -119, -60,
+ -514, 181, -118, -514, 96, -514, 175, 198, 1008, -514,
+ -514, -514, -514, -514, -514, -514, -514, -514, 274, 1173,
+ -514, -514, -514, -514, 200, -514, 203, 691, 691, 691,
+ 0, -514, 13, -514, 204, 691, 202, 1153, 1153, 1153,
+ 1153, 1153, 205, 212, 1153, 1153, 691, 691, 213, -514,
+ -17, -514, -514, -514, 214, 216, 1173, 1173, 1173, 1173,
+ 1173, -514, -514, 15, -32, -514, -69, -514, 1173, 1173,
+ 1173, 1173, -514, -514, -514, -514, -514, -514, 1059, 313,
+ -514, -514, 327, -31, 333, 334, 217, 222, 223, 691,
+ 356, 691, 1153, -514, 225, 691, 226, -514, -514, 227,
+ 238, 691, 691, -514, -514, 228, -514, 1153, 357, 376,
+ -514, 174, 1173, 1173, 204, 244, 248, 249, 254, 1173,
+ -514, -514, -514, 255, 256, 347, 257, -514, -514, -514,
+ 345, 263, -514, 691, 691, 1153, 691, 691, 266, -514,
+ 266, -514, 268, 691, 269, 1153, 1153, 1153, -514, -514,
+ 1153, 691, -514, -514, -514, 272, 273, 264, 1173, 1173,
+ 1173, 1173, -514, 1173, 1173, 1153, 1173, 410, -514, 392,
+ 280, 277, 268, 283, -514, -514, 366, -514, -514, 1153,
+ 281, 691, -514, -514, -514, 291, -514, 1173, 1173, -514,
+ 295, 293, 297, 298, 296, 299, 300, 301, -514, -514,
+ 419, 51, 405, -514, -514, 304, -514, 302, 303, 1173,
+ -514, 1173, 1173, -514, -514, -514, -514, 691, -514, 827,
+ 85, 430, -514, -514, -514, 309, 311, 312, -514, 316,
+ -514, 827, 691, -514, -514, -514, 436, 318, 385, 691,
+ 442, 443, -514, 691, 691, -514, -514
};
/* YYPGOTO[NTERM-NUM]. */
-static const short yypgoto[] =
+static const short int yypgoto[] =
{
- -529, -529, -529, 372, 374, 379, 381, 382, 188, 166,
- -130, -128, -510, -529, 439, 456, -123, -529, -270, 88,
- -529, -285, -529, -49, -529, -37, -529, -68, -36, -529,
- -110, 284, -298, 60, -529, -529, -529, -529, -529, -529,
- -529, 445, -529, -529, -529, -529, 3, -529, 91, -529,
- -529, 441, -529, -529, -529, -529, -529, 498, -529, -529,
- -528, -202, 40, -119, -529, 484, -529, -529, -529, -529,
- -529, 81, 24, -529, -529, 59, -529, -529
+ -514, -514, 368, 369, 370, 371, 185, 168, -130, -129,
+ -503, -514, 429, 461, -110, -514, -264, 88, -514, -281,
+ -514, -50, -514, -37, -514, -41, 39, -514, -107, 282,
+ -289, 22, -514, -514, -514, -514, -514, -514, -514, 437,
+ -514, -514, -514, -514, 7, -514, 90, -514, -514, 432,
+ -514, -514, -514, -514, -514, 493, -514, -514, -513, -195,
+ 38, -117, -514, 478, -514, -514, -514, -514, -514, 86,
+ 30, -514, -514, 65, -514, -514
};
/* 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 -175
-static const short yytable[] =
+#define YYTABLE_NINF -168
+static const short int yytable[] =
{
- 89, 242, 216, 243, 106, 362, 26, 228, 116, 245,
- 231, 382, 383, 325, 420, 39, 89, 120, 394, 396,
- 422, 4, 42, 440, 232, 351, 94, 556, 566, 221,
- 351, 351, 46, 47, 48, 221, 233, 29, 276, 222,
- 574, 403, 351, -108, 26, 330, 441, 568, 293, 120,
- 414, 49, 124, 280, 294, 120, 421, 281, 282, 283,
- 284, 451, 421, 290, 288, 289, 39, 405, 451, 451,
- 124, 454, 198, 199, 200, 351, 453, 465, 107, 108,
- 451, 220, 51, 351, 351, 351, 452, 225, 404, 227,
- 122, 52, 227, 124, 58, 65, 66, 62, 118, 68,
- 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
- 79, 80, 20, 99, 21, 110, 111, 112, 274, 275,
- 227, 277, 191, 192, 234, 235, 236, 237, 238, 239,
- 240, 241, 291, 292, 278, 227, 298, 299, 81, 227,
- 227, 227, 227, 285, 286, 287, 227, 227, 43, 327,
- 328, 64, 95, 331, 351, 351, 351, 53, 488, 117,
- -68, -68, 351, 234, 235, 236, 237, 238, 239, 240,
- 241, -67, -67, 378, 351, 351, -66, -66, 7, 8,
- 9, 10, 54, 12, 55, 103, 333, 56, 234, 235,
- 236, 237, 238, 239, 240, 241, 356, 59, 20, 60,
- 21, 512, 100, 513, -65, -65, 300, 301, 89, 30,
- 31, 32, 33, 34, 35, 36, 101, 102, 351, 357,
- 351, 114, -109, 115, 351, 123, 190, 194, 195, 196,
- 351, 351, 351, 217, 218, 223, 358, 82, 229, -72,
- 83, 376, -71, 84, -70, 85, 119, 427, -69, 429,
- 430, 431, -75, 89, 377, 227, 436, -76, 303, 304,
- 329, 337, 338, 359, 351, 351, 555, 351, 351, 331,
- 361, 364, 353, 354, 351, 365, 446, 447, 448, 449,
- 450, 366, 367, 351, 355, 368, 369, 370, 455, 456,
- 457, 458, 459, 246, 247, 248, 249, 250, 251, 252,
- 253, 254, 255, 374, 375, 567, 379, 380, 386, 397,
- 387, 388, 389, 390, 351, 398, 412, 363, 399, 400,
- 401, 409, 402, 406, 440, 371, 372, 373, 415, 227,
- 428, 227, 227, 227, 489, 490, 407, 435, 227, 410,
- 416, 496, 423, 426, 432, 433, 434, 464, 466, 467,
- 472, 487, 351, 439, 444, 486, 445, 468, 469, 517,
- 518, 519, 470, 484, 476, 500, 478, 351, 479, 502,
- 480, 492, 333, 493, 351, 494, 495, 497, 351, 351,
- 498, 524, 525, 526, 527, 528, 227, 529, 530, 531,
- 534, 533, 499, 501, 504, 539, 417, 418, 419, 535,
- 538, 511, 485, 514, 425, 257, 258, 242, -174, 243,
- 516, 522, 543, 544, 523, 536, 437, 438, 421, 545,
- 537, 542, 547, 540, 546, 548, 549, 242, 554, 243,
- 550, 227, 551, 5, 558, 562, 552, 563, 564, 6,
- 553, 227, 227, 227, 559, 560, 561, 227, 569, 7,
- 8, 9, 10, 11, 12, 13, 570, 571, 572, 573,
- 471, 576, 473, 532, 577, 578, 477, 580, 581, 180,
- 14, 181, 481, 482, 483, 385, 182, 227, 183, 184,
- 97, 57, 259, 260, 261, 262, 263, 264, 265, 266,
- 267, 268, 269, 270, 271, 272, 384, 105, 462, 324,
- 461, 27, 113, 45, 475, 491, 505, 506, 520, 509,
- 510, 0, 0, 0, 0, -78, 515, 20, 0, 21,
- 0, 0, 0, 0, 0, 521, 6, -78, -78, 0,
- 0, 0, 0, 0, 0, 0, -78, -78, -78, -78,
- -78, -78, -78, 0, 0, -78, 22, 0, 0, 65,
- 66, 0, 0, 23, 0, 0, 541, 24, 0, 0,
- 0, 0, 0, 0, 0, 0, 20, 0, 21, 0,
- 305, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 306, 307, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 565, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 575,
- 0, 0, 0, 0, 0, 0, 579, 0, 0, 0,
- 582, 583, 135, 136, 137, 138, 139, 140, 141, 142,
- 143, 144, 145, 146, 147, 148, 149, 150, 151, 152,
- 308, 309, 65, 66, 0, 118, 68, 69, 70, 71,
- 72, 73, 74, 75, 76, 77, 78, 79, 80, 20,
- 0, 21, 0, 0, 0, 0, 0, 310, 159, 160,
- 161, 162, 163, 164, 165, 166, 167, 168, 169, 170,
- 0, 311, 173, 174, 175, 81, 312, 313, 314, 0,
- 0, 0, 0, 0, 315, 0, 0, 316, 0, 317,
- 65, 66, 318, 118, 201, 202, 203, 204, 205, 206,
- 207, 208, 209, 210, 211, 79, 80, 20, 0, 21,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 339, 340, 65, 66, 341, 0, 0,
- 0, 0, 0, 81, 0, 0, 0, 0, 0, 0,
- 0, 0, 20, 0, 21, 0, 342, 343, 344, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 345, 346,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 82, 0, 0, 83, 0, 0,
- 84, 347, 85, 219, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 135, 136,
- 137, 138, 139, 140, 141, 142, 143, 144, 145, 146,
- 147, 148, 149, 150, 151, 152, 308, 309, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 82, 0, 0, 83, 0, 0, 84, 0,
- 85, 395, 0, 310, 159, 160, 161, 162, 163, 164,
- 165, 166, 167, 168, 169, 170, 0, 311, 173, 174,
- 175, 0, 312, 313, 314, 339, 340, 0, 0, 341,
- 0, 0, 0, 348, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 342, 343,
- 344, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 345, 346, 0, 0, 0, 0, 0, 0, 0, 0,
+ 89, 235, 236, 106, 353, 209, 116, 372, 373, 221,
+ 26, 94, 224, 316, 39, 409, 89, 428, 539, 384,
+ 386, 42, 238, 225, -100, 342, 549, 393, 411, 214,
+ 342, 342, 124, 124, 269, 226, 392, 551, 557, 215,
+ 429, 214, 342, 59, 120, 60, 285, 4, 26, 273,
+ 403, 321, 286, 274, 275, 276, 277, 410, 29, 280,
+ 281, 227, 228, 229, 230, 231, 232, 233, 234, 282,
+ 410, 439, 191, 192, 193, 342, 120, 110, 111, 112,
+ -167, 442, 120, 342, 342, 46, 47, 48, 394, 220,
+ 39, 124, 220, 51, 122, 227, 228, 229, 230, 231,
+ 232, 233, 234, 52, 49, 5, 107, 108, 439, 439,
+ 58, 6, 267, 268, 220, 270, 441, 452, 20, 62,
+ 21, 7, 8, 9, 10, 11, 12, 13, 271, 220,
+ 64, 95, 99, 220, 220, 220, 220, 278, 279, 220,
+ 220, 43, 14, 30, 31, 32, 33, 34, 35, 36,
+ 474, 117, 342, 342, 342, 439, 213, 184, 185, 53,
+ 342, 440, 218, 283, 284, 290, 291, 368, 100, 318,
+ 319, 342, 342, 322, -60, -60, -64, -64, 103, 324,
+ 7, 8, 9, 10, 54, 12, 55, -101, 347, 56,
+ -59, -59, -63, -63, 497, 101, 498, 538, -58, -58,
+ 102, 89, 239, 240, 241, 242, 243, 244, 245, 246,
+ 247, 248, 348, 114, 342, 115, 342, 250, 251, 123,
+ 342, -62, -62, -57, -57, 183, 342, 342, 187, 349,
+ 188, 550, 366, -61, -61, 292, 293, 294, 295, 189,
+ 416, 216, 418, 419, 420, 89, 367, 220, 424, 227,
+ 228, 229, 230, 231, 232, 233, 234, 210, 342, 342,
+ 211, 342, 342, 344, 345, -67, 222, -68, 342, 434,
+ 435, 436, 437, 438, 296, 346, 342, 320, 329, 364,
+ 328, 443, 444, 445, 446, 350, 352, 322, 252, 253,
+ 254, 255, 256, 257, 258, 259, 260, 261, 262, 263,
+ 264, 265, 355, 356, 357, 358, 342, 359, 354, 360,
+ 361, 369, 365, 387, 370, 398, 362, 363, 376, 377,
+ 220, 417, 220, 220, 220, 475, 476, 423, 220, 395,
+ 378, 396, 482, 379, 380, 388, 389, 401, 390, 391,
+ 404, 399, 342, 405, 412, 421, 415, 428, 502, 503,
+ 504, 451, 422, 427, 453, 454, 432, 342, 433, 455,
+ 459, 324, 456, 457, 342, 463, 465, 466, 342, 342,
+ 470, 510, 511, 512, 513, 220, 514, 515, 467, 517,
+ 473, 472, 523, 485, 478, 406, 407, 408, 479, 480,
+ 471, 235, 236, 414, 481, 483, 484, 486, 65, 66,
+ 527, 528, 487, 489, 425, 426, 496, 509, 499, 501,
+ 235, 236, 507, 508, 518, 20, 519, 21, 220, 297,
+ 520, 521, 545, 410, 546, 547, 522, 524, 220, 220,
+ 220, 298, 299, 220, 526, 529, 530, 531, 532, 533,
+ 537, 541, 534, 535, 536, 543, 544, 458, 516, 460,
+ 542, 552, 553, 464, 554, 555, 556, 559, 560, 468,
+ 469, 561, 220, 563, 564, 174, 175, 176, 177, 375,
+ 97, 135, 136, 137, 138, 139, 140, 141, 142, 143,
+ 144, 145, 146, 300, 301, 374, 57, 449, 448, 105,
+ 315, 490, 491, 113, 494, 495, 27, 45, 462, 477,
+ 505, 500, 0, 0, 0, 0, 0, 0, 0, 506,
+ 302, 153, 154, 155, 156, 157, 158, 159, 160, 161,
+ 162, 163, 164, 0, 303, 167, 168, 169, 0, 304,
+ 305, 306, 0, 0, 0, 0, 0, 307, 0, 525,
+ 308, 0, 309, 65, 66, 310, 118, 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, 548, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 81, 0, 0, 0,
+ 558, 0, 0, 0, 0, 0, 0, 562, 0, 0,
+ 0, 565, 566, 65, 66, 0, 118, 68, 69, 70,
+ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
+ 20, 0, 21, 65, 66, 0, 118, 194, 195, 196,
+ 197, 198, 199, 200, 201, 202, 203, 204, 79, 80,
+ 20, 0, 21, 0, 0, 0, 81, 0, 65, 66,
+ 0, 118, 68, 69, 70, 71, 72, 73, 74, 75,
+ 76, 77, 78, 79, 80, 20, 81, 21, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 82,
+ 217, 0, 83, 0, 0, 84, 0, 85, 119, 0,
+ 0, 81, 0, 0, 330, 331, 65, 66, 332, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 347, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 20, 0, 21, 0, 333, 334, 335,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 336,
+ 337, 0, 0, 0, 0, 0, 0, 0, 0, 82,
+ 0, 0, 83, 0, 0, 84, 0, 85, 212, 0,
+ 0, 0, 338, 0, 0, 0, 0, 0, 0, 82,
+ 0, 0, 83, 0, 0, 84, 0, 85, 385, 135,
+ 136, 137, 138, 139, 140, 141, 142, 143, 144, 145,
+ 146, 300, 301, 0, 82, 0, 0, 83, 0, 0,
+ 84, 0, 85, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 302, 153,
+ 154, 155, 156, 157, 158, 159, 160, 161, 162, 163,
+ 164, 0, 303, 167, 168, 169, 0, 304, 305, 306,
+ 330, 331, 0, 0, 332, 0, 0, -70, 339, 20,
+ 0, 21, 0, 0, 0, 0, 0, 0, 6, -70,
+ -70, 0, 0, 333, 334, 335, 0, 0, -70, -70,
+ -70, -70, -70, -70, -70, 336, 337, -70, 22, 0,
+ 0, 0, 0, 0, 0, 23, 0, 0, 0, 24,
+ 0, 0, 0, 0, 0, 0, 0, 0, 338, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
- 145, 146, 147, 148, 149, 150, 151, 152, 308, 309,
- 65, 66, 0, 118, 201, 202, 203, 204, 205, 206,
- 207, 208, 209, 210, 211, 79, 80, 20, 0, 21,
- 0, 0, 0, 0, 0, 310, 159, 160, 161, 162,
- 163, 164, 165, 166, 167, 168, 169, 170, 0, 311,
- 173, 174, 175, 81, 312, 313, 314, 0, 0, 0,
- 0, 0, 0, 65, 66, 348, 118, 68, 69, 70,
+ 0, 0, 0, 0, 0, 135, 136, 137, 138, 139,
+ 140, 141, 142, 143, 144, 145, 146, 300, 301, 65,
+ 66, 0, 118, 194, 195, 196, 197, 198, 199, 200,
+ 201, 202, 203, 204, 79, 80, 20, 0, 21, 0,
+ 0, 0, 0, 0, 302, 153, 154, 155, 156, 157,
+ 158, 159, 160, 161, 162, 163, 164, 0, 303, 167,
+ 168, 169, 81, 304, 305, 306, 0, 0, 0, 0,
+ 0, 0, 65, 66, 339, 118, 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, 323, 0, 0, 0, 0, 0,
+ 0, 0, 0, 65, 66, 81, 118, 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, 224, 0, 0, 0, 0,
- 0, 0, 0, 0, 65, 66, 81, 118, 68, 69,
+ 0, 0, 0, 0, 0, 400, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 82, 81, 0, 83, 0,
+ 381, 84, 0, 85, 65, 66, 0, 118, 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, 332, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 81, 0, 0,
- 0, 0, 82, 0, 0, 83, 0, 391, 84, 0,
- 85, 65, 66, 0, 118, 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, 411, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 81, 82, 0, 0, 83, 0,
- 0, 84, 0, 85, 0, 65, 66, 0, 118, 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, 82, 460, 0, 83,
- 0, 0, 84, 0, 85, 0, 65, 66, 81, 67,
- 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
- 78, 79, 80, 20, 0, 21, 65, 66, 0, 118,
- 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
- 78, 79, 80, 20, 0, 21, 0, 0, 0, 81,
- 0, 0, 0, 82, 0, 0, 83, 0, 0, 84,
- 0, 85, 0, 0, 0, 0, 0, 0, 0, 81,
- 0, 65, 66, 0, 118, 201, 202, 203, 204, 205,
- 206, 207, 208, 209, 210, 211, 79, 80, 20, 0,
- 21, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 82, 0, 0,
- 83, 0, 0, 84, 81, 85, 65, 66, 0, 230,
- 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
- 78, 79, 80, 20, 0, 21, 0, 0, 0, 0,
- 0, 125, 0, 0, 0, 0, 0, 0, 82, 0,
- 0, 83, 0, 0, 84, 126, 85, 0, 0, 81,
- 0, 0, 0, 0, 0, 127, 128, 0, 82, 0,
- 0, 83, 0, 0, 84, 0, 85, 0, 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, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 447, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 81, 82, 0,
+ 0, 83, 0, 0, 84, 0, 85, 65, 66, 0,
+ 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, 0, 0, 0, 82,
+ 0, 0, 83, 0, 0, 84, 0, 85, 65, 66,
+ 81, 118, 68, 69, 70, 71, 72, 73, 74, 75,
+ 76, 77, 78, 79, 80, 20, 0, 21, 65, 66,
+ 0, 118, 194, 195, 196, 197, 198, 199, 200, 201,
+ 202, 203, 204, 79, 80, 20, 0, 21, 0, 0,
+ 82, 81, 0, 83, 0, 0, 84, 0, 85, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 65,
+ 66, 81, 223, 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, 0, 0, 82, 0, 0, 83, 0, 0, 84,
- 0, 85, 0, 0, 155, 156, 157, 0, 0, 158,
- 159, 160, 161, 162, 163, 164, 165, 166, 167, 168,
- 169, 170, 171, 172, 173, 174, 175, 176, 177, 178,
- 179, 0, 0, 0, 0, 0, 0, 0, 82, 0,
- 0, 83, 0, 0, 84, 0, 85
+ 0, 85, 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, 125, 0, 0,
+ 0, 0, 0, 0, 82, 0, 0, 83, 0, 0,
+ 84, 126, 85, 0, 0, 0, 0, 0, 0, 0,
+ 0, 127, 128, 0, 82, 0, 0, 83, 0, 0,
+ 84, 0, 85, 0, 129, 130, 131, 132, 133, 134,
+ 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
+ 145, 146, 147, 148, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 82, 0, 0, 83, 0,
+ 0, 84, 0, 85, 149, 150, 151, 0, 0, 152,
+ 153, 154, 155, 156, 157, 158, 159, 160, 161, 162,
+ 163, 164, 165, 166, 167, 168, 169, 170, 171, 172,
+ 173
};
-static const short yycheck[] =
+static const short int yycheck[] =
{
- 37, 131, 112, 131, 53, 275, 3, 126, 4, 132,
- 129, 296, 297, 215, 15, 23, 53, 85, 316, 317,
- 15, 0, 30, 34, 9, 227, 29, 537, 556, 146,
- 232, 233, 52, 53, 54, 146, 21, 61, 157, 156,
- 568, 326, 244, 148, 41, 156, 57, 557, 146, 117,
- 348, 71, 157, 172, 152, 123, 57, 176, 177, 178,
- 179, 146, 57, 186, 183, 184, 23, 154, 146, 146,
- 157, 156, 109, 110, 111, 277, 154, 154, 32, 33,
- 146, 117, 145, 285, 286, 287, 152, 123, 152, 126,
- 87, 61, 129, 157, 145, 5, 6, 24, 8, 9,
- 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
- 20, 21, 22, 145, 24, 55, 56, 57, 155, 156,
- 157, 158, 55, 56, 10, 11, 12, 13, 14, 15,
- 16, 17, 121, 122, 171, 172, 27, 28, 48, 176,
- 177, 178, 179, 180, 181, 182, 183, 184, 156, 217,
- 218, 4, 155, 221, 356, 357, 358, 20, 443, 155,
- 3, 4, 364, 10, 11, 12, 13, 14, 15, 16,
- 17, 3, 4, 292, 376, 377, 3, 4, 41, 42,
- 43, 44, 45, 46, 47, 150, 223, 50, 10, 11,
- 12, 13, 14, 15, 16, 17, 245, 45, 22, 47,
- 24, 471, 145, 473, 3, 4, 3, 4, 245, 64,
- 65, 66, 67, 68, 69, 70, 145, 145, 420, 256,
- 422, 4, 148, 4, 426, 148, 24, 4, 24, 24,
- 432, 433, 434, 151, 151, 148, 273, 147, 59, 4,
- 150, 290, 4, 153, 4, 155, 156, 366, 4, 368,
- 369, 370, 7, 290, 291, 292, 375, 7, 4, 7,
- 154, 146, 149, 146, 466, 467, 152, 469, 470, 337,
- 146, 150, 232, 233, 476, 146, 386, 387, 388, 389,
- 390, 146, 146, 485, 244, 146, 146, 146, 398, 399,
- 400, 401, 402, 98, 99, 100, 101, 102, 103, 104,
- 105, 106, 107, 36, 146, 152, 24, 146, 148, 24,
- 148, 148, 148, 148, 516, 148, 63, 277, 148, 148,
- 148, 146, 148, 154, 34, 285, 286, 287, 146, 366,
- 367, 368, 369, 370, 444, 445, 333, 374, 375, 149,
- 146, 451, 146, 150, 146, 146, 146, 24, 21, 21,
- 4, 4, 554, 146, 148, 24, 148, 148, 146, 478,
- 479, 480, 146, 148, 146, 36, 146, 569, 146, 57,
- 146, 146, 409, 146, 576, 146, 146, 146, 580, 581,
- 146, 149, 492, 493, 494, 495, 423, 497, 498, 499,
- 4, 501, 146, 146, 146, 514, 356, 357, 358, 24,
- 149, 146, 439, 146, 364, 27, 28, 537, 0, 537,
- 146, 146, 522, 523, 146, 146, 376, 377, 57, 146,
- 150, 149, 146, 152, 149, 146, 149, 557, 21, 557,
- 149, 468, 149, 25, 36, 545, 149, 547, 548, 31,
- 149, 478, 479, 480, 152, 149, 149, 484, 21, 41,
- 42, 43, 44, 45, 46, 47, 149, 149, 149, 146,
- 420, 21, 422, 500, 146, 76, 426, 21, 21, 97,
- 62, 97, 432, 433, 434, 309, 97, 514, 97, 97,
- 41, 25, 104, 105, 106, 107, 108, 109, 110, 111,
- 112, 113, 114, 115, 116, 117, 308, 52, 410, 215,
- 409, 3, 61, 19, 423, 446, 466, 467, 484, 469,
- 470, -1, -1, -1, -1, 20, 476, 22, -1, 24,
- -1, -1, -1, -1, -1, 485, 31, 32, 33, -1,
- -1, -1, -1, -1, -1, -1, 41, 42, 43, 44,
- 45, 46, 47, -1, -1, 50, 51, -1, -1, 5,
- 6, -1, -1, 58, -1, -1, 516, 62, -1, -1,
- -1, -1, -1, -1, -1, -1, 22, -1, 24, -1,
- 26, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 38, 39, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 554, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 569,
- -1, -1, -1, -1, -1, -1, 576, -1, -1, -1,
- 580, 581, 78, 79, 80, 81, 82, 83, 84, 85,
- 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
- 96, 97, 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, 123, 124, 125,
- 126, 127, 128, 129, 130, 131, 132, 133, 134, 135,
- -1, 137, 138, 139, 140, 48, 142, 143, 144, -1,
- -1, -1, -1, -1, 150, -1, -1, 153, -1, 155,
- 5, 6, 158, 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, -1, 3, 4, 5, 6, 7, -1, -1,
- -1, -1, -1, 48, -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, -1, -1,
- -1, -1, -1, -1, 147, -1, -1, 150, -1, -1,
- 153, 61, 155, 156, -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, 96, 97, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 147, -1, -1, 150, -1, -1, 153, -1,
- 155, 156, -1, 123, 124, 125, 126, 127, 128, 129,
- 130, 131, 132, 133, 134, 135, -1, 137, 138, 139,
- 140, -1, 142, 143, 144, 3, 4, -1, -1, 7,
- -1, -1, -1, 153, -1, -1, -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,
+ 37, 131, 131, 53, 268, 112, 4, 288, 289, 126,
+ 3, 29, 129, 208, 23, 15, 53, 34, 521, 308,
+ 309, 30, 132, 9, 142, 220, 539, 146, 15, 140,
+ 225, 226, 151, 151, 151, 21, 317, 540, 551, 150,
+ 57, 140, 237, 45, 85, 47, 140, 0, 41, 166,
+ 339, 150, 146, 170, 171, 172, 173, 57, 61, 176,
+ 177, 10, 11, 12, 13, 14, 15, 16, 17, 179,
+ 57, 140, 109, 110, 111, 270, 117, 55, 56, 57,
+ 0, 150, 123, 278, 279, 52, 53, 54, 148, 126,
+ 23, 151, 129, 139, 87, 10, 11, 12, 13, 14,
+ 15, 16, 17, 61, 71, 25, 32, 33, 140, 140,
+ 139, 31, 149, 150, 151, 152, 148, 148, 22, 24,
+ 24, 41, 42, 43, 44, 45, 46, 47, 165, 166,
+ 4, 149, 139, 170, 171, 172, 173, 174, 175, 176,
+ 177, 150, 62, 64, 65, 66, 67, 68, 69, 70,
+ 431, 149, 347, 348, 349, 140, 117, 55, 56, 20,
+ 355, 146, 123, 115, 116, 27, 28, 284, 139, 210,
+ 211, 366, 367, 214, 3, 4, 3, 4, 144, 216,
+ 41, 42, 43, 44, 45, 46, 47, 142, 238, 50,
+ 3, 4, 3, 4, 458, 139, 460, 146, 3, 4,
+ 139, 238, 92, 93, 94, 95, 96, 97, 98, 99,
+ 100, 101, 249, 4, 409, 4, 411, 27, 28, 142,
+ 415, 3, 4, 3, 4, 24, 421, 422, 4, 266,
+ 24, 146, 282, 3, 4, 3, 4, 3, 4, 24,
+ 357, 142, 359, 360, 361, 282, 283, 284, 365, 10,
+ 11, 12, 13, 14, 15, 16, 17, 145, 453, 454,
+ 145, 456, 457, 225, 226, 7, 59, 7, 463, 376,
+ 377, 378, 379, 380, 7, 237, 471, 148, 143, 36,
+ 140, 388, 389, 390, 391, 140, 140, 328, 98, 99,
+ 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
+ 110, 111, 144, 140, 140, 140, 501, 140, 270, 140,
+ 140, 24, 140, 24, 140, 140, 278, 279, 142, 142,
+ 357, 358, 359, 360, 361, 432, 433, 364, 365, 148,
+ 142, 324, 439, 142, 142, 142, 142, 63, 142, 142,
+ 140, 143, 537, 140, 140, 140, 144, 34, 465, 466,
+ 467, 24, 140, 140, 21, 21, 142, 552, 142, 142,
+ 4, 398, 140, 140, 559, 140, 140, 140, 563, 564,
+ 142, 478, 479, 480, 481, 412, 483, 484, 140, 486,
+ 4, 24, 499, 36, 140, 347, 348, 349, 140, 140,
+ 427, 521, 521, 355, 140, 140, 140, 140, 5, 6,
+ 507, 508, 57, 140, 366, 367, 140, 143, 140, 140,
+ 540, 540, 140, 140, 4, 22, 24, 24, 455, 26,
+ 140, 144, 529, 57, 531, 532, 143, 146, 465, 466,
+ 467, 38, 39, 470, 143, 140, 143, 140, 140, 143,
+ 21, 36, 143, 143, 143, 143, 143, 409, 485, 411,
+ 146, 21, 143, 415, 143, 143, 140, 21, 140, 421,
+ 422, 76, 499, 21, 21, 97, 97, 97, 97, 301,
+ 41, 78, 79, 80, 81, 82, 83, 84, 85, 86,
+ 87, 88, 89, 90, 91, 300, 25, 399, 398, 52,
+ 208, 453, 454, 61, 456, 457, 3, 19, 412, 434,
+ 470, 463, -1, -1, -1, -1, -1, -1, -1, 471,
+ 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
+ 127, 128, 129, -1, 131, 132, 133, 134, -1, 136,
+ 137, 138, -1, -1, -1, -1, -1, 144, -1, 501,
+ 147, -1, 149, 5, 6, 152, 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, 537, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 48, -1, -1, -1,
+ 552, -1, -1, -1, -1, -1, -1, 559, -1, -1,
+ -1, 563, 564, 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, 5, 6,
+ -1, 8, 9, 10, 11, 12, 13, 14, 15, 16,
+ 17, 18, 19, 20, 21, 22, 48, 24, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 141,
+ 37, -1, 144, -1, -1, 147, -1, 149, 150, -1,
+ -1, 48, -1, -1, 3, 4, 5, 6, 7, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 61, -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, 141,
+ -1, -1, 144, -1, -1, 147, -1, 149, 150, -1,
+ -1, -1, 61, -1, -1, -1, -1, -1, -1, 141,
+ -1, -1, 144, -1, -1, 147, -1, 149, 150, 78,
+ 79, 80, 81, 82, 83, 84, 85, 86, 87, 88,
+ 89, 90, 91, -1, 141, -1, -1, 144, -1, -1,
+ 147, -1, 149, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, 117, 118,
+ 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
+ 129, -1, 131, 132, 133, 134, -1, 136, 137, 138,
+ 3, 4, -1, -1, 7, -1, -1, 20, 147, 22,
+ -1, 24, -1, -1, -1, -1, -1, -1, 31, 32,
+ 33, -1, -1, 26, 27, 28, -1, -1, 41, 42,
+ 43, 44, 45, 46, 47, 38, 39, 50, 51, -1,
+ -1, -1, -1, -1, -1, 58, -1, -1, -1, 62,
+ -1, -1, -1, -1, -1, -1, -1, -1, 61, -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, 96, 97,
- 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, 123, 124, 125, 126, 127,
- 128, 129, 130, 131, 132, 133, 134, 135, -1, 137,
- 138, 139, 140, 48, 142, 143, 144, -1, -1, -1,
- -1, -1, -1, 5, 6, 153, 8, 9, 10, 11,
+ -1, -1, -1, -1, -1, 78, 79, 80, 81, 82,
+ 83, 84, 85, 86, 87, 88, 89, 90, 91, 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, 117, 118, 119, 120, 121, 122,
+ 123, 124, 125, 126, 127, 128, 129, -1, 131, 132,
+ 133, 134, 48, 136, 137, 138, -1, -1, -1, -1,
+ -1, -1, 5, 6, 147, 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,
+ -1, -1, -1, -1, -1, 141, 48, -1, 144, -1,
+ 146, 147, -1, 149, 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, -1,
-1, -1, -1, -1, -1, -1, 37, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 48, -1, -1,
- -1, -1, 147, -1, -1, 150, -1, 152, 153, -1,
- 155, 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, -1, -1, -1, -1,
- -1, -1, -1, 37, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 48, 147, -1, -1, 150, -1,
- -1, 153, -1, 155, -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,
- -1, -1, -1, -1, -1, -1, 147, 37, -1, 150,
- -1, -1, 153, -1, 155, -1, 5, 6, 48, 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, 147, -1, -1, 150, -1, -1, 153,
- -1, 155, -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, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 147, -1, -1,
- 150, -1, -1, 153, 48, 155, 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, 35, -1, -1, -1, -1, -1, -1, 147, -1,
- -1, 150, -1, -1, 153, 49, 155, -1, -1, 48,
- -1, -1, -1, -1, -1, 59, 60, -1, 147, -1,
- -1, 150, -1, -1, 153, -1, 155, -1, 72, 73,
- 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
- 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
- 94, 95, 96, 97, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 147, -1, -1, 150, -1, -1, 153,
- -1, 155, -1, -1, 118, 119, 120, -1, -1, 123,
- 124, 125, 126, 127, 128, 129, 130, 131, 132, 133,
- 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
- 144, -1, -1, -1, -1, -1, -1, -1, 147, -1,
- -1, 150, -1, -1, 153, -1, 155
+ -1, -1, -1, -1, -1, -1, -1, 48, 141, -1,
+ -1, 144, -1, -1, 147, -1, 149, 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, -1, -1, -1, -1, -1, -1, -1, 141,
+ -1, -1, 144, -1, -1, 147, -1, 149, 5, 6,
+ 48, 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,
+ 141, 48, -1, 144, -1, -1, 147, -1, 149, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 5,
+ 6, 48, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, -1, 24, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 141, -1, -1, 144, -1, -1, 147,
+ -1, 149, 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, 35, -1, -1,
+ -1, -1, -1, -1, 141, -1, -1, 144, -1, -1,
+ 147, 49, 149, -1, -1, -1, -1, -1, -1, -1,
+ -1, 59, 60, -1, 141, -1, -1, 144, -1, -1,
+ 147, -1, 149, -1, 72, 73, 74, 75, 76, 77,
+ 78, 79, 80, 81, 82, 83, 84, 85, 86, 87,
+ 88, 89, 90, 91, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 141, -1, -1, 144, -1,
+ -1, 147, -1, 149, 112, 113, 114, -1, -1, 117,
+ 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
+ 128, 129, 130, 131, 132, 133, 134, 135, 136, 137,
+ 138
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const unsigned char yystos[] =
{
- 0, 193, 194, 195, 0, 25, 31, 41, 42, 43,
- 44, 45, 46, 47, 62, 174, 212, 214, 216, 223,
- 22, 24, 51, 58, 62, 173, 205, 216, 217, 61,
- 64, 65, 66, 67, 68, 69, 70, 175, 210, 23,
- 224, 225, 30, 156, 213, 224, 52, 53, 54, 71,
- 202, 145, 61, 20, 45, 47, 50, 174, 145, 45,
- 47, 215, 24, 200, 4, 5, 6, 8, 9, 10,
+ 0, 185, 186, 187, 0, 25, 31, 41, 42, 43,
+ 44, 45, 46, 47, 62, 166, 204, 206, 208, 215,
+ 22, 24, 51, 58, 62, 165, 197, 208, 209, 61,
+ 64, 65, 66, 67, 68, 69, 70, 167, 202, 23,
+ 216, 217, 30, 150, 205, 216, 52, 53, 54, 71,
+ 194, 139, 61, 20, 45, 47, 50, 166, 139, 45,
+ 47, 207, 24, 192, 4, 5, 6, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
- 21, 48, 147, 150, 153, 155, 160, 182, 183, 184,
- 185, 186, 205, 220, 29, 155, 211, 173, 228, 145,
- 145, 145, 145, 150, 203, 200, 182, 32, 33, 192,
- 192, 192, 192, 210, 4, 4, 4, 155, 8, 156,
- 186, 187, 205, 148, 157, 35, 49, 59, 60, 72,
+ 21, 48, 141, 144, 147, 149, 154, 174, 175, 176,
+ 177, 178, 197, 212, 29, 149, 203, 165, 220, 139,
+ 139, 139, 139, 144, 195, 192, 174, 32, 33, 184,
+ 184, 184, 184, 202, 4, 4, 4, 149, 8, 150,
+ 178, 179, 197, 142, 151, 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, 118, 119, 120, 123, 124,
+ 83, 84, 85, 86, 87, 88, 89, 90, 91, 112,
+ 113, 114, 117, 118, 119, 120, 121, 122, 123, 124,
125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
- 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
- 162, 163, 164, 165, 166, 226, 232, 233, 235, 236,
- 24, 55, 56, 201, 4, 24, 24, 204, 184, 184,
- 184, 9, 10, 11, 12, 13, 14, 15, 16, 17,
- 18, 19, 169, 170, 172, 184, 189, 151, 151, 156,
- 187, 146, 156, 148, 37, 187, 188, 184, 222, 59,
- 8, 222, 9, 21, 10, 11, 12, 13, 14, 15,
- 16, 17, 169, 170, 171, 175, 98, 99, 100, 101,
- 102, 103, 104, 105, 106, 107, 167, 27, 28, 104,
- 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
- 115, 116, 117, 168, 184, 184, 222, 184, 184, 229,
- 222, 222, 222, 222, 222, 184, 184, 184, 222, 222,
- 175, 121, 122, 146, 152, 198, 199, 197, 27, 28,
- 3, 4, 161, 4, 7, 26, 38, 39, 96, 97,
- 123, 137, 142, 143, 144, 150, 153, 155, 158, 162,
- 163, 164, 165, 166, 190, 220, 196, 186, 186, 154,
- 156, 186, 37, 184, 207, 208, 209, 146, 149, 3,
- 4, 7, 26, 27, 28, 38, 39, 61, 153, 190,
- 219, 220, 221, 221, 221, 221, 182, 184, 184, 146,
- 177, 146, 177, 221, 150, 146, 146, 146, 146, 146,
- 146, 221, 221, 221, 36, 146, 182, 184, 222, 24,
- 146, 180, 180, 180, 167, 168, 148, 148, 148, 148,
- 148, 152, 189, 191, 191, 156, 191, 24, 148, 148,
- 148, 148, 148, 180, 152, 154, 154, 205, 206, 146,
- 149, 37, 63, 218, 191, 146, 146, 221, 221, 221,
- 15, 57, 15, 146, 234, 221, 150, 222, 184, 222,
- 222, 222, 146, 146, 146, 184, 222, 221, 221, 146,
- 34, 57, 178, 181, 148, 148, 189, 189, 189, 189,
- 189, 146, 152, 154, 156, 189, 189, 189, 189, 189,
- 37, 207, 178, 179, 24, 154, 21, 21, 148, 146,
- 146, 221, 4, 221, 222, 230, 146, 221, 146, 146,
- 146, 221, 221, 221, 148, 184, 24, 4, 180, 189,
- 189, 234, 146, 146, 146, 146, 189, 146, 146, 146,
- 36, 146, 57, 176, 146, 221, 221, 230, 231, 221,
- 221, 146, 177, 177, 146, 221, 146, 222, 222, 222,
- 231, 221, 146, 146, 149, 189, 189, 189, 189, 189,
- 189, 189, 184, 189, 4, 24, 146, 150, 149, 222,
- 152, 221, 149, 189, 189, 146, 149, 146, 146, 149,
- 149, 149, 149, 149, 21, 152, 171, 227, 36, 152,
- 149, 149, 189, 189, 189, 221, 219, 152, 171, 21,
- 149, 149, 149, 146, 219, 221, 21, 146, 76, 221,
- 21, 21, 221, 221
+ 135, 136, 137, 138, 155, 156, 157, 158, 218, 224,
+ 225, 227, 228, 24, 55, 56, 193, 4, 24, 24,
+ 196, 176, 176, 176, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 161, 162, 164, 176, 181,
+ 145, 145, 150, 179, 140, 150, 142, 37, 179, 180,
+ 176, 214, 59, 8, 214, 9, 21, 10, 11, 12,
+ 13, 14, 15, 16, 17, 161, 162, 163, 167, 92,
+ 93, 94, 95, 96, 97, 98, 99, 100, 101, 159,
+ 27, 28, 98, 99, 100, 101, 102, 103, 104, 105,
+ 106, 107, 108, 109, 110, 111, 160, 176, 176, 214,
+ 176, 176, 221, 214, 214, 214, 214, 214, 176, 176,
+ 214, 214, 167, 115, 116, 140, 146, 190, 191, 189,
+ 27, 28, 3, 4, 3, 4, 7, 26, 38, 39,
+ 90, 91, 117, 131, 136, 137, 138, 144, 147, 149,
+ 152, 155, 156, 157, 158, 182, 212, 188, 178, 178,
+ 148, 150, 178, 37, 176, 199, 200, 201, 140, 143,
+ 3, 4, 7, 26, 27, 28, 38, 39, 61, 147,
+ 182, 211, 212, 213, 213, 213, 213, 174, 176, 176,
+ 140, 169, 140, 169, 213, 144, 140, 140, 140, 140,
+ 140, 140, 213, 213, 36, 140, 174, 176, 214, 24,
+ 140, 172, 172, 172, 159, 160, 142, 142, 142, 142,
+ 142, 146, 181, 183, 183, 150, 183, 24, 142, 142,
+ 142, 142, 172, 146, 148, 148, 197, 198, 140, 143,
+ 37, 63, 210, 183, 140, 140, 213, 213, 213, 15,
+ 57, 15, 140, 226, 213, 144, 214, 176, 214, 214,
+ 214, 140, 140, 176, 214, 213, 213, 140, 34, 57,
+ 170, 173, 142, 142, 181, 181, 181, 181, 181, 140,
+ 146, 148, 150, 181, 181, 181, 181, 37, 199, 170,
+ 171, 24, 148, 21, 21, 142, 140, 140, 213, 4,
+ 213, 214, 222, 140, 213, 140, 140, 140, 213, 213,
+ 142, 176, 24, 4, 172, 181, 181, 226, 140, 140,
+ 140, 140, 181, 140, 140, 36, 140, 57, 168, 140,
+ 213, 213, 222, 223, 213, 213, 140, 169, 169, 140,
+ 213, 140, 214, 214, 214, 223, 213, 140, 140, 143,
+ 181, 181, 181, 181, 181, 181, 176, 181, 4, 24,
+ 140, 144, 143, 214, 146, 213, 143, 181, 181, 140,
+ 143, 140, 140, 143, 143, 143, 143, 21, 146, 163,
+ 219, 36, 146, 143, 143, 181, 181, 181, 213, 211,
+ 146, 163, 21, 143, 143, 143, 140, 211, 213, 21,
+ 140, 76, 213, 21, 21, 213, 213
};
-#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
-# define YYSIZE_T __SIZE_TYPE__
-#endif
-#if ! defined (YYSIZE_T) && defined (size_t)
-# define YYSIZE_T size_t
-#endif
-#if ! defined (YYSIZE_T)
-# if defined (__STDC__) || defined (__cplusplus)
-# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
-# define YYSIZE_T size_t
-# endif
-#endif
-#if ! defined (YYSIZE_T)
-# define YYSIZE_T unsigned int
-#endif
-
#define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY)
#define YYEMPTY (-2)
goto yybackup; \
} \
else \
- { \
- yyerror ("syntax error: cannot back up");\
+ { \
+ yyerror (YY_("syntax error: cannot back up")); \
YYERROR; \
} \
while (0)
+
#define YYTERROR 1
#define YYERRCODE 256
-/* YYLLOC_DEFAULT -- Compute the default location (before the actions
- are run). */
+/* 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) \
- ((Current).first_line = (Rhs)[1].first_line, \
- (Current).first_column = (Rhs)[1].first_column, \
- (Current).last_line = (Rhs)[N].last_line, \
- (Current).last_column = (Rhs)[N].last_column)
+# 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
+
+
+/* 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
+
/* YYLEX -- calling `yylex' with the right arguments. */
#ifdef YYLEX_PARAM
YYFPRINTF Args; \
} while (0)
-# define YYDSYMPRINT(Args) \
-do { \
- if (yydebug) \
- yysymprint Args; \
-} while (0)
-
-# define YYDSYMPRINTF(Title, Token, Value, Location) \
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
do { \
if (yydebug) \
{ \
YYFPRINTF (stderr, "%s ", Title); \
- yysymprint (stderr, \
- Token, Value); \
+ yysymprint (stderr, \
+ Type, Value); \
YYFPRINTF (stderr, "\n"); \
} \
} while (0)
#if defined (__STDC__) || defined (__cplusplus)
static void
-yy_stack_print (short *bottom, short *top)
+yy_stack_print (short int *bottom, short int *top)
#else
static void
yy_stack_print (bottom, top)
- short *bottom;
- short *top;
+ short int *bottom;
+ short int *top;
#endif
{
YYFPRINTF (stderr, "Stack now");
#endif
{
int yyi;
- unsigned int yylno = yyrline[yyrule];
- YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
+ 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]]);
+ YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
+ YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]);
}
# define YY_REDUCE_PRINT(Rule) \
int yydebug;
#else /* !YYDEBUG */
# define YYDPRINTF(Args)
-# define YYDSYMPRINT(Args)
-# define YYDSYMPRINTF(Title, Token, Value, Location)
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
# define YY_STACK_PRINT(Bottom, Top)
# define YY_REDUCE_PRINT(Rule)
#endif /* !YYDEBUG */
if the built-in stack extension method is used).
Do not make this value too large; the results are undefined if
- SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
+ YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
evaluated with infinite-precision integer arithmetic. */
-#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
-# undef YYMAXDEPTH
-#endif
-
#ifndef YYMAXDEPTH
# define YYMAXDEPTH 10000
#endif
const char *yystr;
# endif
{
- register const char *yys = yystr;
+ const char *yys = yystr;
while (*yys++ != '\0')
continue;
const char *yysrc;
# endif
{
- register char *yyd = yydest;
- register const char *yys = yysrc;
+ char *yyd = yydest;
+ const char *yys = yysrc;
while ((*yyd++ = *yys++) != '\0')
continue;
# endif
# endif
-#endif /* !YYERROR_VERBOSE */
+# ifndef yytnamerr
+/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
+ quotes and backslashes, so that it's suitable for yyerror. The
+ heuristic is that double-quoting is unnecessary unless the string
+ contains an apostrophe, a comma, or backslash (other than
+ backslash-backslash). YYSTR is taken from yytname. If YYRES is
+ null, do not copy; instead, return the length of what the result
+ would have been. */
+static YYSIZE_T
+yytnamerr (char *yyres, const char *yystr)
+{
+ if (*yystr == '"')
+ {
+ 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);
+
+ return yystpcpy (yyres, yystr) - yyres;
+}
+# endif
+
+#endif /* YYERROR_VERBOSE */
\f
(void) yyvaluep;
if (yytype < YYNTOKENS)
- {
- YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
-# ifdef YYPRINT
- YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
-# endif
- }
+ 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:
#if defined (__STDC__) || defined (__cplusplus)
static void
-yydestruct (int yytype, YYSTYPE *yyvaluep)
+yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
#else
static void
-yydestruct (yytype, yyvaluep)
+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)
{
-/* The lookahead symbol. */
+/* The look-ahead symbol. */
int yychar;
-/* The semantic value of the lookahead symbol. */
+/* The semantic value of the look-ahead symbol. */
YYSTYPE yylval;
/* Number of syntax errors so far. */
#endif
{
- register int yystate;
- register int yyn;
+ int yystate;
+ int yyn;
int yyresult;
/* Number of tokens to shift before error messages enabled. */
int yyerrstatus;
- /* Lookahead token as an internal (translated) token number. */
+ /* Look-ahead token as an internal (translated) token number. */
int yytoken = 0;
/* Three stacks and their tools:
to reallocate them elsewhere. */
/* The state stack. */
- short yyssa[YYINITDEPTH];
- short *yyss = yyssa;
- register short *yyssp;
+ short int yyssa[YYINITDEPTH];
+ short int *yyss = yyssa;
+ short int *yyssp;
/* The semantic value stack. */
YYSTYPE yyvsa[YYINITDEPTH];
YYSTYPE *yyvs = yyvsa;
- register YYSTYPE *yyvsp;
+ YYSTYPE *yyvsp;
these so that the &'s don't force the real ones into
memory. */
YYSTYPE *yyvs1 = yyvs;
- short *yyss1 = yyss;
+ 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 ("parser stack overflow",
+ yyoverflow (YY_("memory exhausted"),
&yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp),
}
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
- goto yyoverflowlab;
+ goto yyexhaustedlab;
# else
/* Extend the stack our own way. */
if (YYMAXDEPTH <= yystacksize)
- goto yyoverflowlab;
+ goto yyexhaustedlab;
yystacksize *= 2;
if (YYMAXDEPTH < yystacksize)
yystacksize = YYMAXDEPTH;
{
- short *yyss1 = yyss;
+ short int *yyss1 = yyss;
union yyalloc *yyptr =
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
if (! yyptr)
- goto yyoverflowlab;
+ goto yyexhaustedlab;
YYSTACK_RELOCATE (yyss);
YYSTACK_RELOCATE (yyvs);
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 == YYPACT_NINF)
goto yydefault;
- /* Not known => get a lookahead token if don't already have one. */
+ /* Not known => get a look-ahead token if don't already have one. */
- /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
+ /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
if (yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
else
{
yytoken = YYTRANSLATE (yychar);
- YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
+ YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
}
/* If the proper action on seeing token YYTOKEN is to reduce or to
if (yyn == YYFINAL)
YYACCEPT;
- /* Shift the lookahead token. */
- YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));
+ /* Shift the look-ahead token. */
+ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
/* Discard the token being shifted unless it is eof. */
if (yychar != YYEOF)
switch (yyn)
{
case 3:
-#line 991 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+#line 989 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- if (yyvsp[0].UIntVal > (uint32_t)INT32_MAX) // Outside of my range!
+ if ((yyvsp[0].UIntVal) > (uint32_t)INT32_MAX) // Outside of my range!
GEN_ERROR("Value too large for type!");
- yyval.SIntVal = (int32_t)yyvsp[0].UIntVal;
+ (yyval.SIntVal) = (int32_t)(yyvsp[0].UIntVal);
CHECK_FOR_ERROR
;}
break;
- case 5:
-#line 1000 "/home/vadve/alenhar2/llvm.old/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;
- CHECK_FOR_ERROR
-;}
+ case 31:
+#line 1005 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.IPredicate) = ICmpInst::ICMP_EQ; ;}
+ break;
+
+ case 32:
+#line 1005 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.IPredicate) = ICmpInst::ICMP_NE; ;}
+ break;
+
+ case 33:
+#line 1006 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.IPredicate) = ICmpInst::ICMP_SLT; ;}
+ break;
+
+ case 34:
+#line 1006 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.IPredicate) = ICmpInst::ICMP_SGT; ;}
+ break;
+
+ case 35:
+#line 1007 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.IPredicate) = ICmpInst::ICMP_SLE; ;}
+ break;
+
+ case 36:
+#line 1007 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.IPredicate) = ICmpInst::ICMP_SGE; ;}
+ break;
+
+ case 37:
+#line 1008 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.IPredicate) = ICmpInst::ICMP_ULT; ;}
+ break;
+
+ case 38:
+#line 1008 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.IPredicate) = ICmpInst::ICMP_UGT; ;}
break;
case 39:
-#line 1017 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.IPredicate = ICmpInst::ICMP_EQ; ;}
+#line 1009 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.IPredicate) = ICmpInst::ICMP_ULE; ;}
break;
case 40:
-#line 1017 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.IPredicate = ICmpInst::ICMP_NE; ;}
+#line 1009 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.IPredicate) = ICmpInst::ICMP_UGE; ;}
break;
case 41:
-#line 1018 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.IPredicate = ICmpInst::ICMP_SLT; ;}
+#line 1013 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.FPredicate) = FCmpInst::FCMP_OEQ; ;}
break;
case 42:
-#line 1018 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.IPredicate = ICmpInst::ICMP_SGT; ;}
+#line 1013 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.FPredicate) = FCmpInst::FCMP_ONE; ;}
break;
case 43:
-#line 1019 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.IPredicate = ICmpInst::ICMP_SLE; ;}
+#line 1014 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.FPredicate) = FCmpInst::FCMP_OLT; ;}
break;
case 44:
-#line 1019 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.IPredicate = ICmpInst::ICMP_SGE; ;}
+#line 1014 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.FPredicate) = FCmpInst::FCMP_OGT; ;}
break;
case 45:
-#line 1020 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.IPredicate = ICmpInst::ICMP_ULT; ;}
+#line 1015 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.FPredicate) = FCmpInst::FCMP_OLE; ;}
break;
case 46:
-#line 1020 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.IPredicate = ICmpInst::ICMP_UGT; ;}
+#line 1015 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.FPredicate) = FCmpInst::FCMP_OGE; ;}
break;
case 47:
-#line 1021 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.IPredicate = ICmpInst::ICMP_ULE; ;}
+#line 1016 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.FPredicate) = FCmpInst::FCMP_ORD; ;}
break;
case 48:
-#line 1021 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.IPredicate = ICmpInst::ICMP_UGE; ;}
+#line 1016 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.FPredicate) = FCmpInst::FCMP_UNO; ;}
break;
case 49:
-#line 1025 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.FPredicate = FCmpInst::FCMP_OEQ; ;}
+#line 1017 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.FPredicate) = FCmpInst::FCMP_UEQ; ;}
break;
case 50:
-#line 1025 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.FPredicate = FCmpInst::FCMP_ONE; ;}
+#line 1017 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.FPredicate) = FCmpInst::FCMP_UNE; ;}
break;
case 51:
-#line 1026 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.FPredicate = FCmpInst::FCMP_OLT; ;}
+#line 1018 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.FPredicate) = FCmpInst::FCMP_ULT; ;}
break;
case 52:
-#line 1026 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.FPredicate = FCmpInst::FCMP_OGT; ;}
+#line 1018 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.FPredicate) = FCmpInst::FCMP_UGT; ;}
break;
case 53:
-#line 1027 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.FPredicate = FCmpInst::FCMP_OLE; ;}
+#line 1019 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.FPredicate) = FCmpInst::FCMP_ULE; ;}
break;
case 54:
-#line 1027 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.FPredicate = FCmpInst::FCMP_OGE; ;}
+#line 1019 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.FPredicate) = FCmpInst::FCMP_UGE; ;}
break;
case 55:
-#line 1028 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.FPredicate = FCmpInst::FCMP_ORD; ;}
+#line 1020 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.FPredicate) = FCmpInst::FCMP_TRUE; ;}
break;
case 56:
-#line 1028 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.FPredicate = FCmpInst::FCMP_UNO; ;}
+#line 1021 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.FPredicate) = FCmpInst::FCMP_FALSE; ;}
break;
- case 57:
-#line 1029 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.FPredicate = FCmpInst::FCMP_UEQ; ;}
+ case 69:
+#line 1032 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ {
+ (yyval.StrVal) = (yyvsp[-1].StrVal);
+ CHECK_FOR_ERROR
+ ;}
break;
- case 58:
-#line 1029 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.FPredicate = FCmpInst::FCMP_UNE; ;}
+ case 70:
+#line 1036 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ {
+ (yyval.StrVal) = 0;
+ CHECK_FOR_ERROR
+ ;}
break;
- case 59:
-#line 1030 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.FPredicate = FCmpInst::FCMP_ULT; ;}
+ case 71:
+#line 1041 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.Linkage) = GlobalValue::InternalLinkage; ;}
break;
- case 60:
-#line 1030 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.FPredicate = FCmpInst::FCMP_UGT; ;}
+ case 72:
+#line 1042 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.Linkage) = GlobalValue::LinkOnceLinkage; ;}
break;
- case 61:
-#line 1031 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.FPredicate = FCmpInst::FCMP_ULE; ;}
+ case 73:
+#line 1043 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.Linkage) = GlobalValue::WeakLinkage; ;}
break;
- case 62:
-#line 1031 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.FPredicate = FCmpInst::FCMP_UGE; ;}
+ case 74:
+#line 1044 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.Linkage) = GlobalValue::AppendingLinkage; ;}
break;
- case 63:
-#line 1032 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.FPredicate = FCmpInst::FCMP_TRUE; ;}
+ case 75:
+#line 1045 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.Linkage) = GlobalValue::DLLImportLinkage; ;}
break;
- case 64:
-#line 1033 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.FPredicate = FCmpInst::FCMP_FALSE; ;}
+ case 76:
+#line 1046 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.Linkage) = GlobalValue::DLLExportLinkage; ;}
break;
case 77:
-#line 1044 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- {
- yyval.StrVal = yyvsp[-1].StrVal;
- CHECK_FOR_ERROR
- ;}
+#line 1047 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.Linkage) = GlobalValue::ExternalWeakLinkage; ;}
break;
case 78:
-#line 1048 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- {
- yyval.StrVal = 0;
- CHECK_FOR_ERROR
- ;}
+#line 1048 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.Linkage) = GlobalValue::ExternalLinkage; ;}
break;
case 79:
-#line 1053 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.Linkage = GlobalValue::InternalLinkage; ;}
+#line 1050 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.UIntVal) = CallingConv::C; ;}
break;
case 80:
-#line 1054 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.Linkage = GlobalValue::LinkOnceLinkage; ;}
+#line 1051 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.UIntVal) = CallingConv::C; ;}
break;
case 81:
-#line 1055 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.Linkage = GlobalValue::WeakLinkage; ;}
+#line 1052 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.UIntVal) = CallingConv::CSRet; ;}
break;
case 82:
-#line 1056 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.Linkage = GlobalValue::AppendingLinkage; ;}
+#line 1053 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.UIntVal) = CallingConv::Fast; ;}
break;
case 83:
-#line 1057 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.Linkage = GlobalValue::DLLImportLinkage; ;}
+#line 1054 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.UIntVal) = CallingConv::Cold; ;}
break;
case 84:
-#line 1058 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.Linkage = GlobalValue::DLLExportLinkage; ;}
+#line 1055 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.UIntVal) = CallingConv::X86_StdCall; ;}
break;
case 85:
-#line 1059 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.Linkage = GlobalValue::ExternalWeakLinkage; ;}
+#line 1056 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.UIntVal) = CallingConv::X86_FastCall; ;}
break;
case 86:
-#line 1060 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.Linkage = GlobalValue::ExternalLinkage; ;}
- break;
-
- case 87:
-#line 1062 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.UIntVal = CallingConv::C; ;}
- break;
-
- case 88:
-#line 1063 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.UIntVal = CallingConv::C; ;}
- break;
-
- case 89:
-#line 1064 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.UIntVal = CallingConv::CSRet; ;}
- break;
-
- case 90:
-#line 1065 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.UIntVal = CallingConv::Fast; ;}
- break;
-
- case 91:
-#line 1066 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.UIntVal = CallingConv::Cold; ;}
- break;
-
- case 92:
-#line 1067 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.UIntVal = CallingConv::X86_StdCall; ;}
- break;
-
- case 93:
-#line 1068 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.UIntVal = CallingConv::X86_FastCall; ;}
- break;
-
- case 94:
-#line 1069 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+#line 1057 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- if ((unsigned)yyvsp[0].UInt64Val != yyvsp[0].UInt64Val)
+ 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 95:
-#line 1078 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.UIntVal = 0; ;}
+ case 87:
+#line 1066 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.UIntVal) = 0; ;}
break;
- case 96:
-#line 1079 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 88:
+#line 1067 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.UIntVal = yyvsp[0].UInt64Val;
- if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
+ (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 97:
-#line 1085 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.UIntVal = 0; ;}
+ case 89:
+#line 1073 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.UIntVal) = 0; ;}
break;
- case 98:
-#line 1086 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 90:
+#line 1074 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.UIntVal = yyvsp[0].UInt64Val;
- if (yyval.UIntVal != 0 && !isPowerOf2_32(yyval.UIntVal))
+ (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 99:
-#line 1094 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 91:
+#line 1082 "/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] == '\\')
+ 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 100:
-#line 1102 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.StrVal = 0; ;}
+ case 92:
+#line 1090 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.StrVal) = 0; ;}
break;
- case 101:
-#line 1103 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.StrVal = yyvsp[0].StrVal; ;}
+ case 93:
+#line 1091 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.StrVal) = (yyvsp[0].StrVal); ;}
break;
- case 102:
-#line 1108 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 94:
+#line 1096 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{;}
break;
- case 103:
-#line 1109 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 95:
+#line 1097 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{;}
break;
- case 104:
-#line 1110 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 96:
+#line 1098 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- CurGV->setSection(yyvsp[0].StrVal);
- free(yyvsp[0].StrVal);
+ CurGV->setSection((yyvsp[0].StrVal));
+ free((yyvsp[0].StrVal));
CHECK_FOR_ERROR
;}
break;
- case 105:
-#line 1115 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 97:
+#line 1103 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- if (yyvsp[0].UInt64Val != 0 && !isPowerOf2_32(yyvsp[0].UInt64Val))
+ 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 107:
-#line 1129 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); ;}
+ case 99:
+#line 1117 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;}
break;
- case 109:
-#line 1130 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType); ;}
+ case 101:
+#line 1118 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType)); ;}
break;
- case 110:
-#line 1132 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 102:
+#line 1120 "/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 124:
-#line 1144 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 116:
+#line 1132 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.TypeVal = new PATypeHolder(OpaqueType::get());
+ (yyval.TypeVal) = new PATypeHolder(OpaqueType::get());
CHECK_FOR_ERROR
;}
break;
- case 125:
-#line 1148 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 117:
+#line 1136 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.TypeVal = new PATypeHolder(yyvsp[0].PrimType);
+ (yyval.TypeVal) = new PATypeHolder((yyvsp[0].PrimType));
CHECK_FOR_ERROR
;}
break;
- case 126:
-#line 1152 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 118:
+#line 1140 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Named types are also simple types...
- const Type* tmp = getTypeVal(yyvsp[0].ValIDVal);
+ const Type* tmp = getTypeVal((yyvsp[0].ValIDVal));
CHECK_FOR_ERROR
- yyval.TypeVal = new PATypeHolder(tmp);
+ (yyval.TypeVal) = new PATypeHolder(tmp);
;}
break;
- case 127:
-#line 1160 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 119:
+#line 1148 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Type UpReference
- if (yyvsp[0].UInt64Val > (uint64_t)~0U) GEN_ERROR("Value out of range!");
+ if ((yyvsp[0].UInt64Val) > (uint64_t)~0U) GEN_ERROR("Value out of range!");
OpaqueType *OT = OpaqueType::get(); // Use temporary placeholder
- UpRefs.push_back(UpRefRecord((unsigned)yyvsp[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 128:
-#line 1168 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 120:
+#line 1156 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Function derived type?
std::vector<const Type*> Params;
- for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-1].TypeList->begin(),
- E = yyvsp[-1].TypeList->end(); I != E; ++I)
+ for (std::list<llvm::PATypeHolder>::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
+ (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 129:
-#line 1181 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 121:
+#line 1169 "/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;
+ (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(ArrayType::get(*(yyvsp[-1].TypeVal), (unsigned)(yyvsp[-3].UInt64Val))));
+ delete (yyvsp[-1].TypeVal);
CHECK_FOR_ERROR
;}
break;
- case 130:
-#line 1186 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 122:
+#line 1174 "/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)
+ 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 131:
-#line 1198 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 123:
+#line 1186 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Structure type?
std::vector<const Type*> Elements;
- for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-1].TypeList->begin(),
- E = yyvsp[-1].TypeList->end(); I != E; ++I)
+ for (std::list<llvm::PATypeHolder>::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 132:
-#line 1208 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 124:
+#line 1196 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Empty structure type?
- yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>()));
+ (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>()));
CHECK_FOR_ERROR
;}
break;
- case 133:
-#line 1212 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 125:
+#line 1200 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
std::vector<const Type*> Elements;
- for (std::list<llvm::PATypeHolder>::iterator I = yyvsp[-2].TypeList->begin(),
- E = yyvsp[-2].TypeList->end(); I != E; ++I)
+ for (std::list<llvm::PATypeHolder>::iterator I = (yyvsp[-2].TypeList)->begin(),
+ E = (yyvsp[-2].TypeList)->end(); I != E; ++I)
Elements.push_back(*I);
- yyval.TypeVal = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
- delete yyvsp[-2].TypeList;
+ (yyval.TypeVal) = new PATypeHolder(HandleUpRefs(StructType::get(Elements, true)));
+ delete (yyvsp[-2].TypeList);
CHECK_FOR_ERROR
;}
break;
- case 134:
-#line 1222 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 126:
+#line 1210 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Empty structure type?
- yyval.TypeVal = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
+ (yyval.TypeVal) = new PATypeHolder(StructType::get(std::vector<const Type*>(), true));
CHECK_FOR_ERROR
;}
break;
- case 135:
-#line 1226 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 127:
+#line 1214 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Pointer type?
- if (*yyvsp[-1].TypeVal == Type::LabelTy)
+ 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 136:
-#line 1237 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 128:
+#line 1225 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.TypeList = new std::list<PATypeHolder>();
- yyval.TypeList->push_back(*yyvsp[0].TypeVal); delete yyvsp[0].TypeVal;
+ (yyval.TypeList) = new std::list<PATypeHolder>();
+ (yyval.TypeList)->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
CHECK_FOR_ERROR
;}
break;
- case 137:
-#line 1242 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 129:
+#line 1230 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- (yyval.TypeList=yyvsp[-2].TypeList)->push_back(*yyvsp[0].TypeVal); delete yyvsp[0].TypeVal;
+ ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(*(yyvsp[0].TypeVal)); delete (yyvsp[0].TypeVal);
CHECK_FOR_ERROR
;}
break;
- case 139:
-#line 1249 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 131:
+#line 1237 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- (yyval.TypeList=yyvsp[-2].TypeList)->push_back(Type::VoidTy);
+ ((yyval.TypeList)=(yyvsp[-2].TypeList))->push_back(Type::VoidTy);
CHECK_FOR_ERROR
;}
break;
- case 140:
-#line 1253 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 132:
+#line 1241 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- (yyval.TypeList = new std::list<PATypeHolder>())->push_back(Type::VoidTy);
+ ((yyval.TypeList) = new std::list<PATypeHolder>())->push_back(Type::VoidTy);
CHECK_FOR_ERROR
;}
break;
- case 141:
-#line 1257 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 133:
+#line 1245 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.TypeList = new std::list<PATypeHolder>();
+ (yyval.TypeList) = new std::list<PATypeHolder>();
CHECK_FOR_ERROR
;}
break;
- case 142:
-#line 1268 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 134:
+#line 1256 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Nonempty unsized arr
- const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-3].TypeVal->get());
+ const ArrayType *ATy = dyn_cast<ArrayType>((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 143:
-#line 1294 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 135:
+#line 1282 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
+ const ArrayType *ATy = dyn_cast<ArrayType>((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<Constant*>());
- delete yyvsp[-2].TypeVal;
+ (yyval.ConstVal) = ConstantArray::get(ATy, std::vector<Constant*>());
+ delete (yyvsp[-2].TypeVal);
CHECK_FOR_ERROR
;}
break;
- case 144:
-#line 1308 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 136:
+#line 1296 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- const ArrayType *ATy = dyn_cast<ArrayType>(yyvsp[-2].TypeVal->get());
+ const ArrayType *ATy = dyn_cast<ArrayType>((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<Constant*> 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;
+ free((yyvsp[0].StrVal));
+ (yyval.ConstVal) = ConstantArray::get(ATy, Vals);
+ delete (yyvsp[-2].TypeVal);
CHECK_FOR_ERROR
;}
break;
- case 145:
-#line 1338 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 137:
+#line 1326 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Nonempty unsized arr
- const PackedType *PTy = dyn_cast<PackedType>(yyvsp[-3].TypeVal->get());
+ const PackedType *PTy = dyn_cast<PackedType>((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 146:
-#line 1364 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 138:
+#line 1352 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- const StructType *STy = dyn_cast<StructType>(yyvsp[-3].TypeVal->get());
+ const StructType *STy = dyn_cast<StructType>((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 147:
-#line 1385 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 139:
+#line 1373 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- const StructType *STy = dyn_cast<StructType>(yyvsp[-2].TypeVal->get());
+ const StructType *STy = dyn_cast<StructType>((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<Constant*>());
- delete yyvsp[-2].TypeVal;
+ (yyval.ConstVal) = ConstantStruct::get(STy, std::vector<Constant*>());
+ delete (yyvsp[-2].TypeVal);
CHECK_FOR_ERROR
;}
break;
- case 148:
-#line 1398 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 140:
+#line 1386 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- const PointerType *PTy = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
+ const PointerType *PTy = dyn_cast<PointerType>((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 149:
-#line 1408 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 141:
+#line 1396 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.ConstVal = UndefValue::get(yyvsp[-1].TypeVal->get());
- delete yyvsp[-1].TypeVal;
+ (yyval.ConstVal) = UndefValue::get((yyvsp[-1].TypeVal)->get());
+ delete (yyvsp[-1].TypeVal);
CHECK_FOR_ERROR
;}
break;
- case 150:
-#line 1413 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 142:
+#line 1401 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- const PointerType *Ty = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
+ const PointerType *Ty = dyn_cast<PointerType>((yyvsp[-1].TypeVal)->get());
if (Ty == 0)
GEN_ERROR("Global const reference must be a pointer type!");
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;
// 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;
}
// 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<GlobalValue>(V);
- delete yyvsp[-1].TypeVal; // Free the type handle
+ (yyval.ConstVal) = cast<GlobalValue>(V);
+ delete (yyvsp[-1].TypeVal); // Free the type handle
CHECK_FOR_ERROR
;}
break;
- case 151:
-#line 1474 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 143:
+#line 1462 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- if (yyvsp[-1].TypeVal->get() != yyvsp[0].ConstVal->getType())
+ 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 152:
-#line 1481 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 144:
+#line 1469 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- const Type *Ty = yyvsp[-1].TypeVal->get();
+ const Type *Ty = (yyvsp[-1].TypeVal)->get();
if (isa<FunctionType>(Ty) || Ty == Type::LabelTy || isa<OpaqueType>(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 153:
-#line 1489 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 145:
+#line 1477 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // integral constants
- if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].SInt64Val))
+ 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 154:
-#line 1495 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { // integral constants
- if (!ConstantInt::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].UInt64Val))
+ case 146:
+#line 1483 "/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 155:
-#line 1501 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { // Boolean constants
- yyval.ConstVal = ConstantBool::getTrue();
+ case 147:
+#line 1489 "/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));
CHECK_FOR_ERROR
;}
break;
- case 156:
-#line 1505 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { // Boolean constants
- yyval.ConstVal = ConstantBool::getFalse();
+ case 148:
+#line 1495 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ {
+ 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));
CHECK_FOR_ERROR
;}
break;
- case 157:
-#line 1509 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 149:
+#line 1501 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { // Boolean constants
+ (yyval.ConstVal) = ConstantBool::getTrue();
+ CHECK_FOR_ERROR
+ ;}
+ break;
+
+ case 150:
+#line 1505 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { // Boolean constants
+ (yyval.ConstVal) = ConstantBool::getFalse();
+ CHECK_FOR_ERROR
+ ;}
+ break;
+
+ case 151:
+#line 1509 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Float & Double constants
- if (!ConstantFP::isValueValidForType(yyvsp[-1].PrimType, yyvsp[0].FPVal))
+ 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 158:
-#line 1517 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 152:
+#line 1517 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- Constant *Val = yyvsp[-3].ConstVal;
- const Type *Ty = yyvsp[-1].TypeVal->get();
+ Constant *Val = (yyvsp[-3].ConstVal);
+ const Type *Ty = (yyvsp[-1].TypeVal)->get();
if (!Val->getType()->isFirstClassType())
GEN_ERROR("cast constant expression from a non-primitive type: '" +
Val->getType()->getDescription() + "'!");
if (!Ty->isFirstClassType())
GEN_ERROR("cast constant expression to a non-primitive type: '" +
Ty->getDescription() + "'!");
- yyval.ConstVal = ConstantExpr::getCast(yyvsp[-5].CastOpVal, yyvsp[-3].ConstVal, yyvsp[-1].TypeVal->get());
- delete yyvsp[-1].TypeVal;
+ (yyval.ConstVal) = ConstantExpr::getCast((yyvsp[-5].CastOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].TypeVal)->get());
+ delete (yyvsp[-1].TypeVal);
;}
break;
- case 159:
-#line 1529 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 153:
+#line 1529 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- if (!isa<PointerType>(yyvsp[-2].ConstVal->getType()))
+ if (!isa<PointerType>((yyvsp[-2].ConstVal)->getType()))
GEN_ERROR("GetElementPtr requires a pointer operand!");
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<Constant*> IdxVec;
- for (unsigned i = 0, e = yyvsp[-1].ValueList->size(); i != e; ++i)
- if (Constant *C = dyn_cast<Constant>((*yyvsp[-1].ValueList)[i]))
+ for (unsigned i = 0, e = (yyvsp[-1].ValueList)->size(); i != e; ++i)
+ if (Constant *C = dyn_cast<Constant>((*(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 160:
-#line 1550 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 154:
+#line 1550 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- if (yyvsp[-5].ConstVal->getType() != Type::BoolTy)
+ 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 161:
-#line 1558 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 155:
+#line 1558 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
+ if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
GEN_ERROR("Binary operator types must match!");
CHECK_FOR_ERROR;
- yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
+ (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
;}
break;
- case 162:
-#line 1564 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 156:
+#line 1564 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
+ if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
GEN_ERROR("Logical operator types must match!");
- if (!yyvsp[-3].ConstVal->getType()->isIntegral()) {
- if (!isa<PackedType>(yyvsp[-3].ConstVal->getType()) ||
- !cast<PackedType>(yyvsp[-3].ConstVal->getType())->getElementType()->isIntegral())
+ if (!(yyvsp[-3].ConstVal)->getType()->isIntegral()) {
+ if (!isa<PackedType>((yyvsp[-3].ConstVal)->getType()) ||
+ !cast<PackedType>((yyvsp[-3].ConstVal)->getType())->getElementType()->isIntegral())
GEN_ERROR("Logical operator requires integral operands!");
}
- yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
+ (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].BinaryOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
CHECK_FOR_ERROR
;}
break;
- case 163:
-#line 1575 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- {
- if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
- GEN_ERROR("setcc operand types must match!");
- yyval.ConstVal = ConstantExpr::get(yyvsp[-5].BinaryOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
- CHECK_FOR_ERROR
- ;}
- break;
-
- case 164:
-#line 1581 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 157:
+#line 1575 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
+ if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
GEN_ERROR("icmp operand types must match!");
- yyval.ConstVal = ConstantExpr::getICmp(yyvsp[-5].IPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
+ (yyval.ConstVal) = ConstantExpr::getICmp((yyvsp[-5].IPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
;}
break;
- case 165:
-#line 1586 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 158:
+#line 1580 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- if (yyvsp[-3].ConstVal->getType() != yyvsp[-1].ConstVal->getType())
+ if ((yyvsp[-3].ConstVal)->getType() != (yyvsp[-1].ConstVal)->getType())
GEN_ERROR("fcmp operand types must match!");
- yyval.ConstVal = ConstantExpr::getFCmp(yyvsp[-5].FPredicate, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
+ (yyval.ConstVal) = ConstantExpr::getFCmp((yyvsp[-5].FPredicate), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
;}
break;
- case 166:
-#line 1591 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 159:
+#line 1585 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- if (yyvsp[-1].ConstVal->getType() != Type::UByteTy)
+ if ((yyvsp[-1].ConstVal)->getType() != Type::UByteTy)
GEN_ERROR("Shift count for shift constant must be unsigned byte!");
- if (!yyvsp[-3].ConstVal->getType()->isInteger())
+ if (!(yyvsp[-3].ConstVal)->getType()->isInteger())
GEN_ERROR("Shift constant expression requires integer operand!");
CHECK_FOR_ERROR;
- yyval.ConstVal = ConstantExpr::get(yyvsp[-5].OtherOpVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal);
+ (yyval.ConstVal) = ConstantExpr::get((yyvsp[-5].OtherOpVal), (yyvsp[-3].ConstVal), (yyvsp[-1].ConstVal));
CHECK_FOR_ERROR
;}
break;
- case 167:
-#line 1600 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 160:
+#line 1594 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- if (!ExtractElementInst::isValidOperands(yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
+ 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 168:
-#line 1606 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 161:
+#line 1600 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- if (!InsertElementInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
+ 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 169:
-#line 1612 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 162:
+#line 1606 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- if (!ShuffleVectorInst::isValidOperands(yyvsp[-5].ConstVal, yyvsp[-3].ConstVal, yyvsp[-1].ConstVal))
+ 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 170:
-#line 1621 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 163:
+#line 1615 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- (yyval.ConstVector = yyvsp[-2].ConstVector)->push_back(yyvsp[0].ConstVal);
+ ((yyval.ConstVector) = (yyvsp[-2].ConstVector))->push_back((yyvsp[0].ConstVal));
CHECK_FOR_ERROR
;}
break;
- case 171:
-#line 1625 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 164:
+#line 1619 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.ConstVector = new std::vector<Constant*>();
- yyval.ConstVector->push_back(yyvsp[0].ConstVal);
+ (yyval.ConstVector) = new std::vector<Constant*>();
+ (yyval.ConstVector)->push_back((yyvsp[0].ConstVal));
CHECK_FOR_ERROR
;}
break;
- case 172:
-#line 1633 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.BoolVal = false; ;}
+ case 165:
+#line 1627 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.BoolVal) = false; ;}
break;
- case 173:
-#line 1633 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.BoolVal = true; ;}
+ case 166:
+#line 1627 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.BoolVal) = true; ;}
break;
- case 174:
-#line 1643 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 167:
+#line 1637 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.ModuleVal = ParserResult = yyvsp[0].ModuleVal;
+ (yyval.ModuleVal) = ParserResult = (yyvsp[0].ModuleVal);
CurModule.ModuleDone();
CHECK_FOR_ERROR;
;}
break;
- case 175:
-#line 1651 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 168:
+#line 1645 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.ModuleVal = yyvsp[-1].ModuleVal;
+ (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
CurFun.FunctionDone();
CHECK_FOR_ERROR
;}
break;
- case 176:
-#line 1656 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 169:
+#line 1650 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.ModuleVal = yyvsp[-1].ModuleVal;
+ (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
CHECK_FOR_ERROR
;}
break;
- case 177:
-#line 1660 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 170:
+#line 1654 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.ModuleVal = yyvsp[-3].ModuleVal;
+ (yyval.ModuleVal) = (yyvsp[-3].ModuleVal);
CHECK_FOR_ERROR
;}
break;
- case 178:
-#line 1664 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 171:
+#line 1658 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.ModuleVal = yyvsp[-1].ModuleVal;
+ (yyval.ModuleVal) = (yyvsp[-1].ModuleVal);
CHECK_FOR_ERROR
;}
break;
- case 179:
-#line 1668 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 172:
+#line 1662 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.ModuleVal = CurModule.CurrentModule;
+ (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;
;}
break;
- case 180:
-#line 1683 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 173:
+#line 1677 "/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:
// 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 181:
-#line 1705 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 174:
+#line 1699 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Function prototypes can be in const pool
CHECK_FOR_ERROR
;}
break;
- case 182:
-#line 1708 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 175:
+#line 1702 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Asm blocks can be in the const pool
CHECK_FOR_ERROR
;}
break;
- case 183:
-#line 1711 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 176:
+#line 1705 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- if (yyvsp[0].ConstVal == 0)
+ 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 184:
-#line 1716 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 177:
+#line 1710 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
CurGV = 0;
;}
break;
- case 185:
-#line 1719 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 178:
+#line 1713 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- CurGV = ParseGlobalVariable(yyvsp[-3].StrVal, GlobalValue::ExternalLinkage, yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0);
+ CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::ExternalLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
CHECK_FOR_ERROR
- delete yyvsp[0].TypeVal;
+ delete (yyvsp[0].TypeVal);
;}
break;
- case 186:
-#line 1723 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 179:
+#line 1717 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
CurGV = 0;
CHECK_FOR_ERROR
;}
break;
- case 187:
-#line 1727 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 180:
+#line 1721 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- CurGV = ParseGlobalVariable(yyvsp[-3].StrVal, GlobalValue::DLLImportLinkage, yyvsp[-1].BoolVal, *yyvsp[0].TypeVal, 0);
+ CurGV = ParseGlobalVariable((yyvsp[-3].StrVal), GlobalValue::DLLImportLinkage, (yyvsp[-1].BoolVal), *(yyvsp[0].TypeVal), 0);
CHECK_FOR_ERROR
- delete yyvsp[0].TypeVal;
+ delete (yyvsp[0].TypeVal);
;}
break;
- case 188:
-#line 1731 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 181:
+#line 1725 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
CurGV = 0;
CHECK_FOR_ERROR
;}
break;
- case 189:
-#line 1735 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 182:
+#line 1729 "/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;
+ delete (yyvsp[0].TypeVal);
;}
break;
- case 190:
-#line 1740 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 183:
+#line 1734 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
CurGV = 0;
CHECK_FOR_ERROR
;}
break;
- case 191:
-#line 1744 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 184:
+#line 1738 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
CHECK_FOR_ERROR
;}
break;
- case 192:
-#line 1747 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 185:
+#line 1741 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
CHECK_FOR_ERROR
;}
break;
- case 193:
-#line 1750 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 186:
+#line 1744 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
;}
break;
- case 194:
-#line 1754 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 187:
+#line 1748 "/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);
;}
break;
- case 195:
-#line 1767 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.Endianness = Module::BigEndian; ;}
+ case 188:
+#line 1761 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.Endianness) = Module::BigEndian; ;}
break;
- case 196:
-#line 1768 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.Endianness = Module::LittleEndian; ;}
+ case 189:
+#line 1762 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.Endianness) = Module::LittleEndian; ;}
break;
- case 197:
-#line 1770 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 190:
+#line 1764 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- CurModule.CurrentModule->setEndianness(yyvsp[0].Endianness);
+ CurModule.CurrentModule->setEndianness((yyvsp[0].Endianness));
CHECK_FOR_ERROR
;}
break;
- case 198:
-#line 1774 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 191:
+#line 1768 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- if (yyvsp[0].UInt64Val == 32)
+ 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 199:
-#line 1783 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 192:
+#line 1777 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- CurModule.CurrentModule->setTargetTriple(yyvsp[0].StrVal);
- free(yyvsp[0].StrVal);
+ CurModule.CurrentModule->setTargetTriple((yyvsp[0].StrVal));
+ free((yyvsp[0].StrVal));
;}
break;
- case 200:
-#line 1787 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 193:
+#line 1781 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- CurModule.CurrentModule->setDataLayout(yyvsp[0].StrVal);
- free(yyvsp[0].StrVal);
+ CurModule.CurrentModule->setDataLayout((yyvsp[0].StrVal));
+ free((yyvsp[0].StrVal));
;}
break;
- case 202:
-#line 1794 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 195:
+#line 1788 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal);
- free(yyvsp[0].StrVal);
+ CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
+ free((yyvsp[0].StrVal));
CHECK_FOR_ERROR
;}
break;
- case 203:
-#line 1799 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 196:
+#line 1793 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- CurModule.CurrentModule->addLibrary(yyvsp[0].StrVal);
- free(yyvsp[0].StrVal);
+ CurModule.CurrentModule->addLibrary((yyvsp[0].StrVal));
+ free((yyvsp[0].StrVal));
CHECK_FOR_ERROR
;}
break;
- case 204:
-#line 1804 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 197:
+#line 1798 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
CHECK_FOR_ERROR
;}
break;
- case 208:
-#line 1814 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.StrVal = 0; ;}
+ case 201:
+#line 1808 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.StrVal) = 0; ;}
break;
- case 209:
-#line 1816 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 202:
+#line 1810 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- if (*yyvsp[-1].TypeVal == Type::VoidTy)
+ if (*(yyvsp[-1].TypeVal) == Type::VoidTy)
GEN_ERROR("void typed arguments are invalid!");
- yyval.ArgVal = new std::pair<PATypeHolder*, char*>(yyvsp[-1].TypeVal, yyvsp[0].StrVal);
+ (yyval.ArgVal) = new std::pair<PATypeHolder*, char*>((yyvsp[-1].TypeVal), (yyvsp[0].StrVal));
CHECK_FOR_ERROR
;}
break;
- case 210:
-#line 1823 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 203:
+#line 1817 "/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;
+ (yyval.ArgList) = (yyvsp[-2].ArgList);
+ (yyvsp[-2].ArgList)->push_back(*(yyvsp[0].ArgVal));
+ delete (yyvsp[0].ArgVal);
CHECK_FOR_ERROR
;}
break;
- case 211:
-#line 1829 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 204:
+#line 1823 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.ArgList = new std::vector<std::pair<PATypeHolder*,char*> >();
- yyval.ArgList->push_back(*yyvsp[0].ArgVal);
- delete yyvsp[0].ArgVal;
+ (yyval.ArgList) = new std::vector<std::pair<PATypeHolder*,char*> >();
+ (yyval.ArgList)->push_back(*(yyvsp[0].ArgVal));
+ delete (yyvsp[0].ArgVal);
CHECK_FOR_ERROR
;}
break;
- case 212:
-#line 1836 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 205:
+#line 1830 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.ArgList = yyvsp[0].ArgList;
+ (yyval.ArgList) = (yyvsp[0].ArgList);
CHECK_FOR_ERROR
;}
break;
- case 213:
-#line 1840 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 206:
+#line 1834 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.ArgList = yyvsp[-2].ArgList;
- yyval.ArgList->push_back(std::pair<PATypeHolder*,
+ (yyval.ArgList) = (yyvsp[-2].ArgList);
+ (yyval.ArgList)->push_back(std::pair<PATypeHolder*,
char*>(new PATypeHolder(Type::VoidTy), 0));
CHECK_FOR_ERROR
;}
break;
- case 214:
-#line 1846 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 207:
+#line 1840 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.ArgList = new std::vector<std::pair<PATypeHolder*,char*> >();
- yyval.ArgList->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0));
+ (yyval.ArgList) = new std::vector<std::pair<PATypeHolder*,char*> >();
+ (yyval.ArgList)->push_back(std::make_pair(new PATypeHolder(Type::VoidTy), (char*)0));
CHECK_FOR_ERROR
;}
break;
- case 215:
-#line 1851 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 208:
+#line 1845 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.ArgList = 0;
+ (yyval.ArgList) = 0;
CHECK_FOR_ERROR
;}
break;
- case 216:
-#line 1857 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 209:
+#line 1851 "/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!
+ 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<const Type*> ParamTypeList;
- if (yyvsp[-3].ArgList) { // If there are arguments...
- for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = yyvsp[-3].ArgList->begin();
- I != yyvsp[-3].ArgList->end(); ++I)
+ if ((yyvsp[-3].ArgList)) { // If there are arguments...
+ for (std::vector<std::pair<PATypeHolder*,char*> >::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()) {
// 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<std::pair<PATypeHolder*,char*> >::iterator I = yyvsp[-3].ArgList->begin();
- I != yyvsp[-3].ArgList->end(); ++I, ++ArgIt) {
+ for (std::vector<std::pair<PATypeHolder*,char*> >::iterator I = (yyvsp[-3].ArgList)->begin();
+ I != (yyvsp[-3].ArgList)->end(); ++I, ++ArgIt) {
delete I->first; // Delete the typeholder...
setValueName(ArgIt, I->second); // Insert arg into symtab...
InsertValue(ArgIt);
}
- delete yyvsp[-3].ArgList; // We're now done with the argument list
+ delete (yyvsp[-3].ArgList); // We're now done with the argument list
}
CHECK_FOR_ERROR
;}
break;
- case 219:
-#line 1953 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 212:
+#line 1947 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.FunctionVal = CurFun.CurrentFunction;
+ (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);
+ (yyval.FunctionVal)->setLinkage((yyvsp[-2].Linkage));
;}
break;
- case 222:
-#line 1963 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 215:
+#line 1957 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.FunctionVal = yyvsp[-1].FunctionVal;
+ (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
CHECK_FOR_ERROR
;}
break;
- case 224:
-#line 1969 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 217:
+#line 1963 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ CurFun.Linkage = GlobalValue::DLLImportLinkage; ;}
break;
- case 225:
-#line 1970 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 218:
+#line 1964 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ CurFun.Linkage = GlobalValue::ExternalWeakLinkage; ;}
break;
- case 226:
-#line 1972 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 219:
+#line 1966 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ CurFun.isDeclare = true; ;}
break;
- case 227:
-#line 1972 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 220:
+#line 1966 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.FunctionVal = CurFun.CurrentFunction;
+ (yyval.FunctionVal) = CurFun.CurrentFunction;
CurFun.FunctionDone();
CHECK_FOR_ERROR
;}
break;
- case 228:
-#line 1982 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 221:
+#line 1976 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.BoolVal = false;
+ (yyval.BoolVal) = false;
CHECK_FOR_ERROR
;}
break;
- case 229:
-#line 1986 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 222:
+#line 1980 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.BoolVal = true;
+ (yyval.BoolVal) = true;
CHECK_FOR_ERROR
;}
break;
- case 230:
-#line 1991 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 223:
+#line 1985 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // A reference to a direct constant
- yyval.ValIDVal = ValID::create(yyvsp[0].SInt64Val);
+ (yyval.ValIDVal) = ValID::create((yyvsp[0].SInt64Val));
CHECK_FOR_ERROR
;}
break;
- case 231:
-#line 1995 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 224:
+#line 1989 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.ValIDVal = ValID::create(yyvsp[0].UInt64Val);
+ (yyval.ValIDVal) = ValID::create((yyvsp[0].UInt64Val));
CHECK_FOR_ERROR
;}
break;
- case 232:
-#line 1999 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 225:
+#line 1993 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Perhaps it's an FP constant?
- yyval.ValIDVal = ValID::create(yyvsp[0].FPVal);
+ (yyval.ValIDVal) = ValID::create((yyvsp[0].FPVal));
CHECK_FOR_ERROR
;}
break;
- case 233:
-#line 2003 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 226:
+#line 1997 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.ValIDVal = ValID::create(ConstantBool::getTrue());
+ (yyval.ValIDVal) = ValID::create(ConstantBool::getTrue());
CHECK_FOR_ERROR
;}
break;
- case 234:
-#line 2007 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 227:
+#line 2001 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.ValIDVal = ValID::create(ConstantBool::getFalse());
+ (yyval.ValIDVal) = ValID::create(ConstantBool::getFalse());
CHECK_FOR_ERROR
;}
break;
- case 235:
-#line 2011 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 228:
+#line 2005 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.ValIDVal = ValID::createNull();
+ (yyval.ValIDVal) = ValID::createNull();
CHECK_FOR_ERROR
;}
break;
- case 236:
-#line 2015 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 229:
+#line 2009 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.ValIDVal = ValID::createUndef();
+ (yyval.ValIDVal) = ValID::createUndef();
CHECK_FOR_ERROR
;}
break;
- case 237:
-#line 2019 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 230:
+#line 2013 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // A vector zero constant.
- yyval.ValIDVal = ValID::createZeroInit();
+ (yyval.ValIDVal) = ValID::createZeroInit();
CHECK_FOR_ERROR
;}
break;
- case 238:
-#line 2023 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 231:
+#line 2017 "/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();
+ const Type *ETy = (*(yyvsp[-1].ConstVector))[0]->getType();
+ int NumElements = (yyvsp[-1].ConstVector)->size();
PackedType* pt = PackedType::get(ETy, NumElements);
PATypeHolder* PTy = new PATypeHolder(
);
// 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 239:
-#line 2048 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 232:
+#line 2042 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.ValIDVal = ValID::create(yyvsp[0].ConstVal);
+ (yyval.ValIDVal) = ValID::create((yyvsp[0].ConstVal));
CHECK_FOR_ERROR
;}
break;
- case 240:
-#line 2052 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 233:
+#line 2046 "/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);
+ 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 241:
-#line 2066 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 234:
+#line 2060 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Is it an integer reference...?
- yyval.ValIDVal = ValID::create(yyvsp[0].SIntVal);
+ (yyval.ValIDVal) = ValID::create((yyvsp[0].SIntVal));
CHECK_FOR_ERROR
;}
break;
- case 242:
-#line 2070 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 235:
+#line 2064 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Is it a named reference...?
- yyval.ValIDVal = ValID::create(yyvsp[0].StrVal);
+ (yyval.ValIDVal) = ValID::create((yyvsp[0].StrVal));
CHECK_FOR_ERROR
;}
break;
- case 245:
-#line 2082 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 238:
+#line 2076 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.ValueVal = getVal(*yyvsp[-1].TypeVal, yyvsp[0].ValIDVal); delete yyvsp[-1].TypeVal;
+ (yyval.ValueVal) = getVal(*(yyvsp[-1].TypeVal), (yyvsp[0].ValIDVal)); delete (yyvsp[-1].TypeVal);
CHECK_FOR_ERROR
;}
break;
- case 246:
-#line 2087 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 239:
+#line 2081 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.FunctionVal = yyvsp[-1].FunctionVal;
+ (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
CHECK_FOR_ERROR
;}
break;
- case 247:
-#line 2091 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 240:
+#line 2085 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Do not allow functions with 0 basic blocks
- yyval.FunctionVal = yyvsp[-1].FunctionVal;
+ (yyval.FunctionVal) = (yyvsp[-1].FunctionVal);
CHECK_FOR_ERROR
;}
break;
- case 248:
-#line 2100 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 241:
+#line 2094 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- setValueName(yyvsp[0].TermInstVal, yyvsp[-1].StrVal);
+ setValueName((yyvsp[0].TermInstVal), (yyvsp[-1].StrVal));
CHECK_FOR_ERROR
- InsertValue(yyvsp[0].TermInstVal);
+ InsertValue((yyvsp[0].TermInstVal));
- yyvsp[-2].BasicBlockVal->getInstList().push_back(yyvsp[0].TermInstVal);
- InsertValue(yyvsp[-2].BasicBlockVal);
- yyval.BasicBlockVal = yyvsp[-2].BasicBlockVal;
+ (yyvsp[-2].BasicBlockVal)->getInstList().push_back((yyvsp[0].TermInstVal));
+ InsertValue((yyvsp[-2].BasicBlockVal));
+ (yyval.BasicBlockVal) = (yyvsp[-2].BasicBlockVal);
CHECK_FOR_ERROR
;}
break;
- case 249:
-#line 2111 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 242:
+#line 2105 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- if (CastInst *CI1 = dyn_cast<CastInst>(yyvsp[0].InstVal))
+ if (CastInst *CI1 = dyn_cast<CastInst>((yyvsp[0].InstVal)))
if (CastInst *CI2 = dyn_cast<CastInst>(CI1->getOperand(0)))
if (CI2->getParent() == 0)
- yyvsp[-1].BasicBlockVal->getInstList().push_back(CI2);
- yyvsp[-1].BasicBlockVal->getInstList().push_back(yyvsp[0].InstVal);
- yyval.BasicBlockVal = yyvsp[-1].BasicBlockVal;
+ (yyvsp[-1].BasicBlockVal)->getInstList().push_back(CI2);
+ (yyvsp[-1].BasicBlockVal)->getInstList().push_back((yyvsp[0].InstVal));
+ (yyval.BasicBlockVal) = (yyvsp[-1].BasicBlockVal);
CHECK_FOR_ERROR
;}
break;
- case 250:
-#line 2120 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 243:
+#line 2114 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.BasicBlockVal = getBBVal(ValID::create((int)CurFun.NextBBNum++), true);
+ (yyval.BasicBlockVal) = getBBVal(ValID::create((int)CurFun.NextBBNum++), true);
CHECK_FOR_ERROR
// Make sure to move the basic block to the correct location in the
// 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 251:
-#line 2132 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 244:
+#line 2126 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.BasicBlockVal = getBBVal(ValID::create(yyvsp[0].StrVal), true);
+ (yyval.BasicBlockVal) = getBBVal(ValID::create((yyvsp[0].StrVal)), true);
CHECK_FOR_ERROR
// Make sure to move the basic block to the correct location in the
// 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 252:
-#line 2145 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 245:
+#line 2139 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Return with a result...
- yyval.TermInstVal = new ReturnInst(yyvsp[0].ValueVal);
+ (yyval.TermInstVal) = new ReturnInst((yyvsp[0].ValueVal));
CHECK_FOR_ERROR
;}
break;
- case 253:
-#line 2149 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 246:
+#line 2143 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Return with no result...
- yyval.TermInstVal = new ReturnInst();
+ (yyval.TermInstVal) = new ReturnInst();
CHECK_FOR_ERROR
;}
break;
- case 254:
-#line 2153 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 247:
+#line 2147 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Unconditional Branch...
- BasicBlock* tmpBB = getBBVal(yyvsp[0].ValIDVal);
+ BasicBlock* tmpBB = getBBVal((yyvsp[0].ValIDVal));
CHECK_FOR_ERROR
- yyval.TermInstVal = new BranchInst(tmpBB);
+ (yyval.TermInstVal) = new BranchInst(tmpBB);
;}
break;
- case 255:
-#line 2158 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 248:
+#line 2152 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- BasicBlock* tmpBBA = getBBVal(yyvsp[-3].ValIDVal);
+ BasicBlock* tmpBBA = getBBVal((yyvsp[-3].ValIDVal));
CHECK_FOR_ERROR
- BasicBlock* tmpBBB = getBBVal(yyvsp[0].ValIDVal);
+ BasicBlock* tmpBBB = getBBVal((yyvsp[0].ValIDVal));
CHECK_FOR_ERROR
- Value* tmpVal = getVal(Type::BoolTy, yyvsp[-6].ValIDVal);
+ Value* tmpVal = getVal(Type::BoolTy, (yyvsp[-6].ValIDVal));
CHECK_FOR_ERROR
- yyval.TermInstVal = new BranchInst(tmpBBA, tmpBBB, tmpVal);
+ (yyval.TermInstVal) = new BranchInst(tmpBBA, tmpBBB, tmpVal);
;}
break;
- case 256:
-#line 2167 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 249:
+#line 2161 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- Value* tmpVal = getVal(yyvsp[-7].PrimType, yyvsp[-6].ValIDVal);
+ 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<std::pair<Constant*,BasicBlock*> >::iterator I = yyvsp[-1].JumpTable->begin(),
- E = yyvsp[-1].JumpTable->end();
+ std::vector<std::pair<Constant*,BasicBlock*> >::iterator I = (yyvsp[-1].JumpTable)->begin(),
+ E = (yyvsp[-1].JumpTable)->end();
for (; I != E; ++I) {
if (ConstantInt *CI = dyn_cast<ConstantInt>(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 257:
-#line 2186 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 250:
+#line 2180 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- Value* tmpVal = getVal(yyvsp[-6].PrimType, yyvsp[-5].ValIDVal);
+ 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 258:
-#line 2196 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 251:
+#line 2190 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
const PointerType *PFTy;
const FunctionType *Ty;
- if (!(PFTy = dyn_cast<PointerType>(yyvsp[-10].TypeVal->get())) ||
+ if (!(PFTy = dyn_cast<PointerType>((yyvsp[-10].TypeVal)->get())) ||
!(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
// Pull out the types of all of the arguments...
std::vector<const Type*> ParamTypes;
- if (yyvsp[-7].ValueList) {
- for (std::vector<Value*>::iterator I = yyvsp[-7].ValueList->begin(), E = yyvsp[-7].ValueList->end();
+ if ((yyvsp[-7].ValueList)) {
+ for (std::vector<Value*>::iterator I = (yyvsp[-7].ValueList)->begin(), E = (yyvsp[-7].ValueList)->end();
I != E; ++I)
ParamTypes.push_back((*I)->getType());
}
bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
if (isVarArg) ParamTypes.pop_back();
- Ty = FunctionType::get(yyvsp[-10].TypeVal->get(), ParamTypes, isVarArg);
+ 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<Value*>());
+ if (!(yyvsp[-7].ValueList)) { // Has no arguments?
+ (yyval.TermInstVal) = new InvokeInst(V, Normal, Except, std::vector<Value*>());
} 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<Value*>::iterator ArgI = yyvsp[-7].ValueList->begin(), ArgE = yyvsp[-7].ValueList->end();
+ std::vector<Value*>::iterator ArgI = (yyvsp[-7].ValueList)->begin(), ArgE = (yyvsp[-7].ValueList)->end();
for (; ArgI != ArgE && I != E; ++ArgI, ++I)
if ((*ArgI)->getType() != *I)
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<InvokeInst>(yyval.TermInstVal)->setCallingConv(yyvsp[-11].UIntVal);
+ cast<InvokeInst>((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 259:
-#line 2251 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 252:
+#line 2245 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.TermInstVal = new UnwindInst();
+ (yyval.TermInstVal) = new UnwindInst();
CHECK_FOR_ERROR
;}
break;
- case 260:
-#line 2255 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 253:
+#line 2249 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.TermInstVal = new UnreachableInst();
+ (yyval.TermInstVal) = new UnreachableInst();
CHECK_FOR_ERROR
;}
break;
- case 261:
-#line 2262 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 254:
+#line 2256 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.JumpTable = yyvsp[-5].JumpTable;
- Constant *V = cast<Constant>(getValNonImprovising(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
+ (yyval.JumpTable) = (yyvsp[-5].JumpTable);
+ Constant *V = cast<Constant>(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));
+ (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
;}
break;
- case 262:
-#line 2273 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 255:
+#line 2267 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.JumpTable = new std::vector<std::pair<Constant*, BasicBlock*> >();
- Constant *V = cast<Constant>(getValNonImprovising(yyvsp[-4].PrimType, yyvsp[-3].ValIDVal));
+ (yyval.JumpTable) = new std::vector<std::pair<Constant*, BasicBlock*> >();
+ Constant *V = cast<Constant>(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));
+ (yyval.JumpTable)->push_back(std::make_pair(V, tmpBB));
;}
break;
- case 263:
-#line 2286 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 256:
+#line 2280 "/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 264:
-#line 2295 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 257:
+#line 2289 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Used for PHI nodes
- yyval.PHIList = new std::list<std::pair<Value*, BasicBlock*> >();
- Value* tmpVal = getVal(*yyvsp[-5].TypeVal, yyvsp[-3].ValIDVal);
+ (yyval.PHIList) = new std::list<std::pair<Value*, BasicBlock*> >();
+ Value* tmpVal = getVal(*(yyvsp[-5].TypeVal), (yyvsp[-3].ValIDVal));
CHECK_FOR_ERROR
- BasicBlock* tmpBB = getBBVal(yyvsp[-1].ValIDVal);
+ BasicBlock* tmpBB = getBBVal((yyvsp[-1].ValIDVal));
CHECK_FOR_ERROR
- yyval.PHIList->push_back(std::make_pair(tmpVal, tmpBB));
- delete yyvsp[-5].TypeVal;
+ (yyval.PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
+ delete (yyvsp[-5].TypeVal);
;}
break;
- case 265:
-#line 2304 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 258:
+#line 2298 "/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);
+ (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));
+ (yyvsp[-6].PHIList)->push_back(std::make_pair(tmpVal, tmpBB));
;}
break;
- case 266:
-#line 2314 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 259:
+#line 2308 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{ // Used for call statements, and memory insts...
- yyval.ValueList = new std::vector<Value*>();
- yyval.ValueList->push_back(yyvsp[0].ValueVal);
+ (yyval.ValueList) = new std::vector<Value*>();
+ (yyval.ValueList)->push_back((yyvsp[0].ValueVal));
;}
break;
- case 267:
-#line 2318 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 260:
+#line 2312 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.ValueList = yyvsp[-2].ValueList;
- yyvsp[-2].ValueList->push_back(yyvsp[0].ValueVal);
+ (yyval.ValueList) = (yyvsp[-2].ValueList);
+ (yyvsp[-2].ValueList)->push_back((yyvsp[0].ValueVal));
CHECK_FOR_ERROR
;}
break;
- case 269:
-#line 2325 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- { yyval.ValueList = 0; ;}
+ case 262:
+#line 2319 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
+ { (yyval.ValueList) = 0; ;}
break;
- case 270:
-#line 2327 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 263:
+#line 2321 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.BoolVal = true;
+ (yyval.BoolVal) = true;
CHECK_FOR_ERROR
;}
break;
- case 271:
-#line 2331 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 264:
+#line 2325 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.BoolVal = false;
+ (yyval.BoolVal) = false;
CHECK_FOR_ERROR
;}
break;
- case 272:
-#line 2336 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 265:
+#line 2330 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- if (!(*yyvsp[-3].TypeVal)->isInteger() && !(*yyvsp[-3].TypeVal)->isFloatingPoint() &&
- !isa<PackedType>((*yyvsp[-3].TypeVal).get()))
+ if (!(*(yyvsp[-3].TypeVal))->isInteger() && !(*(yyvsp[-3].TypeVal))->isFloatingPoint() &&
+ !isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
GEN_ERROR(
"Arithmetic operator requires integer, FP, or packed operands!");
- if (isa<PackedType>((*yyvsp[-3].TypeVal).get()) &&
- (yyvsp[-4].BinaryOpVal == Instruction::URem ||
- yyvsp[-4].BinaryOpVal == Instruction::SRem ||
- yyvsp[-4].BinaryOpVal == Instruction::FRem))
+ if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()) &&
+ ((yyvsp[-4].BinaryOpVal) == Instruction::URem ||
+ (yyvsp[-4].BinaryOpVal) == Instruction::SRem ||
+ (yyvsp[-4].BinaryOpVal) == Instruction::FRem))
GEN_ERROR("U/S/FRem not supported on packed types!");
- Value* val1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
+ Value* val1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
CHECK_FOR_ERROR
- Value* val2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
+ Value* val2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
CHECK_FOR_ERROR
- yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, val1, val2);
- if (yyval.InstVal == 0)
+ (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), val1, val2);
+ if ((yyval.InstVal) == 0)
GEN_ERROR("binary operator returned null!");
- delete yyvsp[-3].TypeVal;
+ delete (yyvsp[-3].TypeVal);
;}
break;
- case 273:
-#line 2355 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 266:
+#line 2349 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- if (!(*yyvsp[-3].TypeVal)->isIntegral()) {
- if (!isa<PackedType>(yyvsp[-3].TypeVal->get()) ||
- !cast<PackedType>(yyvsp[-3].TypeVal->get())->getElementType()->isIntegral())
+ if (!(*(yyvsp[-3].TypeVal))->isIntegral()) {
+ if (!isa<PackedType>((yyvsp[-3].TypeVal)->get()) ||
+ !cast<PackedType>((yyvsp[-3].TypeVal)->get())->getElementType()->isIntegral())
GEN_ERROR("Logical operator requires integral operands!");
}
- Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
+ Value* tmpVal1 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[-2].ValIDVal));
CHECK_FOR_ERROR
- Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
+ Value* tmpVal2 = getVal(*(yyvsp[-3].TypeVal), (yyvsp[0].ValIDVal));
CHECK_FOR_ERROR
- yyval.InstVal = BinaryOperator::create(yyvsp[-4].BinaryOpVal, tmpVal1, tmpVal2);
- if (yyval.InstVal == 0)
+ (yyval.InstVal) = BinaryOperator::create((yyvsp[-4].BinaryOpVal), tmpVal1, tmpVal2);
+ if ((yyval.InstVal) == 0)
GEN_ERROR("binary operator returned null!");
- delete yyvsp[-3].TypeVal;
+ delete (yyvsp[-3].TypeVal);
;}
break;
- case 274:
-#line 2370 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
- {
- if(isa<PackedType>((*yyvsp[-3].TypeVal).get())) {
- GEN_ERROR(
- "PackedTypes currently not supported in setcc instructions!");
- }
- Value* tmpVal1 = getVal(*yyvsp[-3].TypeVal, yyvsp[-2].ValIDVal);
- CHECK_FOR_ERROR
- Value* tmpVal2 = getVal(*yyvsp[-3].TypeVal, yyvsp[0].ValIDVal);
- CHECK_FOR_ERROR
- yyval.InstVal = new SetCondInst(yyvsp[-4].BinaryOpVal, tmpVal1, tmpVal2);
- if (yyval.InstVal == 0)
- GEN_ERROR("binary operator returned null!");
- delete yyvsp[-3].TypeVal;
- ;}
- break;
-
- case 275:
-#line 2384 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 267:
+#line 2364 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- if (isa<PackedType>((*yyvsp[-3].TypeVal).get()))
+ if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
GEN_ERROR("Packed types not supported by icmp instruction");
- 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 = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].IPredicate, tmpVal1, tmpVal2);
- if (yyval.InstVal == 0)
+ (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].IPredicate), tmpVal1, tmpVal2);
+ if ((yyval.InstVal) == 0)
GEN_ERROR("icmp operator returned null!");
;}
break;
- case 276:
-#line 2395 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 268:
+#line 2375 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- if (isa<PackedType>((*yyvsp[-3].TypeVal).get()))
+ if (isa<PackedType>((*(yyvsp[-3].TypeVal)).get()))
GEN_ERROR("Packed types not supported by fcmp instruction");
- 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 = CmpInst::create(yyvsp[-5].OtherOpVal, yyvsp[-4].FPredicate, tmpVal1, tmpVal2);
- if (yyval.InstVal == 0)
+ (yyval.InstVal) = CmpInst::create((yyvsp[-5].OtherOpVal), (yyvsp[-4].FPredicate), tmpVal1, tmpVal2);
+ if ((yyval.InstVal) == 0)
GEN_ERROR("fcmp operator returned null!");
;}
break;
- case 277:
-#line 2406 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 269:
+#line 2386 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
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 278:
-#line 2419 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 270:
+#line 2399 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- if (yyvsp[0].ValueVal->getType() != Type::UByteTy)
+ 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!");
CHECK_FOR_ERROR;
- yyval.InstVal = new ShiftInst(yyvsp[-3].OtherOpVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal);
+ (yyval.InstVal) = new ShiftInst((yyvsp[-3].OtherOpVal), (yyvsp[-2].ValueVal), (yyvsp[0].ValueVal));
CHECK_FOR_ERROR
;}
break;
- case 279:
-#line 2428 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 271:
+#line 2408 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- Value* Val = yyvsp[-2].ValueVal;
- const Type* Ty = yyvsp[0].TypeVal->get();
+ Value* Val = (yyvsp[-2].ValueVal);
+ const Type* Ty = (yyvsp[0].TypeVal)->get();
if (!Val->getType()->isFirstClassType())
GEN_ERROR("cast from a non-primitive type: '" +
Val->getType()->getDescription() + "'!");
if (!Ty->isFirstClassType())
GEN_ERROR("cast to a non-primitive type: '" + Ty->getDescription() +"'!");
- yyval.InstVal = CastInst::create(yyvsp[-3].CastOpVal, yyvsp[-2].ValueVal, yyvsp[0].TypeVal->get());
- delete yyvsp[0].TypeVal;
+ (yyval.InstVal) = CastInst::create((yyvsp[-3].CastOpVal), (yyvsp[-2].ValueVal), (yyvsp[0].TypeVal)->get());
+ delete (yyvsp[0].TypeVal);
;}
break;
- case 280:
-#line 2439 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 272:
+#line 2419 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- if (yyvsp[-4].ValueVal->getType() != Type::BoolTy)
+ 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 281:
-#line 2447 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 273:
+#line 2427 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- 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 282:
-#line 2452 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 274:
+#line 2432 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- if (!ExtractElementInst::isValidOperands(yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
+ 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 283:
-#line 2458 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 275:
+#line 2438 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- if (!InsertElementInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
+ 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 284:
-#line 2464 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 276:
+#line 2444 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- if (!ShuffleVectorInst::isValidOperands(yyvsp[-4].ValueVal, yyvsp[-2].ValueVal, yyvsp[0].ValueVal))
+ 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 285:
-#line 2470 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 277:
+#line 2450 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- const Type *Ty = yyvsp[0].PHIList->front().first->getType();
+ const Type *Ty = (yyvsp[0].PHIList)->front().first->getType();
if (!Ty->isFirstClassType())
GEN_ERROR("PHI node operands must be of first class type!");
- yyval.InstVal = new PHINode(Ty);
- ((PHINode*)yyval.InstVal)->reserveOperandSpace(yyvsp[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<PHINode>(yyval.InstVal)->addIncoming(yyvsp[0].PHIList->front().first, yyvsp[0].PHIList->front().second);
- yyvsp[0].PHIList->pop_front();
+ cast<PHINode>((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 286:
-#line 2485 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 278:
+#line 2465 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
const PointerType *PFTy = 0;
const FunctionType *Ty = 0;
- if (!(PFTy = dyn_cast<PointerType>(yyvsp[-4].TypeVal->get())) ||
+ if (!(PFTy = dyn_cast<PointerType>((yyvsp[-4].TypeVal)->get())) ||
!(Ty = dyn_cast<FunctionType>(PFTy->getElementType()))) {
// Pull out the types of all of the arguments...
std::vector<const Type*> ParamTypes;
- if (yyvsp[-1].ValueList) {
- for (std::vector<Value*>::iterator I = yyvsp[-1].ValueList->begin(), E = yyvsp[-1].ValueList->end();
+ if ((yyvsp[-1].ValueList)) {
+ for (std::vector<Value*>::iterator I = (yyvsp[-1].ValueList)->begin(), E = (yyvsp[-1].ValueList)->end();
I != E; ++I)
ParamTypes.push_back((*I)->getType());
}
bool isVarArg = ParamTypes.size() && ParamTypes.back() == Type::VoidTy;
if (isVarArg) ParamTypes.pop_back();
- if (!(*yyvsp[-4].TypeVal)->isFirstClassType() && *yyvsp[-4].TypeVal != Type::VoidTy)
+ 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<Value*>());
+ (yyval.InstVal) = new CallInst(V, std::vector<Value*>());
} 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<Value*>::iterator ArgI = yyvsp[-1].ValueList->begin(), ArgE = yyvsp[-1].ValueList->end();
+ std::vector<Value*>::iterator ArgI = (yyvsp[-1].ValueList)->begin(), ArgE = (yyvsp[-1].ValueList)->end();
for (; ArgI != ArgE && I != E; ++ArgI, ++I)
if ((*ArgI)->getType() != *I)
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<CallInst>(yyval.InstVal)->setTailCall(yyvsp[-6].BoolVal);
- cast<CallInst>(yyval.InstVal)->setCallingConv(yyvsp[-5].UIntVal);
- delete yyvsp[-4].TypeVal;
- delete yyvsp[-1].ValueList;
+ cast<CallInst>((yyval.InstVal))->setTailCall((yyvsp[-6].BoolVal));
+ cast<CallInst>((yyval.InstVal))->setCallingConv((yyvsp[-5].UIntVal));
+ delete (yyvsp[-4].TypeVal);
+ delete (yyvsp[-1].ValueList);
CHECK_FOR_ERROR
;}
break;
- case 287:
-#line 2544 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 279:
+#line 2524 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.InstVal = yyvsp[0].InstVal;
+ (yyval.InstVal) = (yyvsp[0].InstVal);
CHECK_FOR_ERROR
;}
break;
- case 288:
-#line 2551 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 280:
+#line 2531 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.ValueList = yyvsp[0].ValueList;
+ (yyval.ValueList) = (yyvsp[0].ValueList);
CHECK_FOR_ERROR
;}
break;
- case 289:
-#line 2554 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 281:
+#line 2534 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.ValueList = new std::vector<Value*>();
+ (yyval.ValueList) = new std::vector<Value*>();
CHECK_FOR_ERROR
;}
break;
- case 290:
-#line 2559 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 282:
+#line 2539 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.BoolVal = true;
+ (yyval.BoolVal) = true;
CHECK_FOR_ERROR
;}
break;
- case 291:
-#line 2563 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 283:
+#line 2543 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.BoolVal = false;
+ (yyval.BoolVal) = false;
CHECK_FOR_ERROR
;}
break;
- case 292:
-#line 2570 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 284:
+#line 2550 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.InstVal = new MallocInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
- delete yyvsp[-1].TypeVal;
+ (yyval.InstVal) = new MallocInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
+ delete (yyvsp[-1].TypeVal);
CHECK_FOR_ERROR
;}
break;
- case 293:
-#line 2575 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 285:
+#line 2555 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal);
+ 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;
+ (yyval.InstVal) = new MallocInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
+ delete (yyvsp[-4].TypeVal);
;}
break;
- case 294:
-#line 2581 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 286:
+#line 2561 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- yyval.InstVal = new AllocaInst(*yyvsp[-1].TypeVal, 0, yyvsp[0].UIntVal);
- delete yyvsp[-1].TypeVal;
+ (yyval.InstVal) = new AllocaInst(*(yyvsp[-1].TypeVal), 0, (yyvsp[0].UIntVal));
+ delete (yyvsp[-1].TypeVal);
CHECK_FOR_ERROR
;}
break;
- case 295:
-#line 2586 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 287:
+#line 2566 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- Value* tmpVal = getVal(yyvsp[-2].PrimType, yyvsp[-1].ValIDVal);
+ 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;
+ (yyval.InstVal) = new AllocaInst(*(yyvsp[-4].TypeVal), tmpVal, (yyvsp[0].UIntVal));
+ delete (yyvsp[-4].TypeVal);
;}
break;
- case 296:
-#line 2592 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 288:
+#line 2572 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- if (!isa<PointerType>(yyvsp[0].ValueVal->getType()))
+ if (!isa<PointerType>((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 297:
-#line 2600 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 289:
+#line 2580 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- if (!isa<PointerType>(yyvsp[-1].TypeVal->get()))
+ if (!isa<PointerType>((yyvsp[-1].TypeVal)->get()))
GEN_ERROR("Can't load from nonpointer type: " +
- (*yyvsp[-1].TypeVal)->getDescription());
- if (!cast<PointerType>(yyvsp[-1].TypeVal->get())->getElementType()->isFirstClassType())
+ (*(yyvsp[-1].TypeVal))->getDescription());
+ if (!cast<PointerType>((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;
+ (yyval.InstVal) = new LoadInst(tmpVal, "", (yyvsp[-3].BoolVal));
+ delete (yyvsp[-1].TypeVal);
;}
break;
- case 298:
-#line 2612 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 290:
+#line 2592 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- const PointerType *PT = dyn_cast<PointerType>(yyvsp[-1].TypeVal->get());
+ const PointerType *PT = dyn_cast<PointerType>((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;
+ (yyval.InstVal) = new StoreInst((yyvsp[-3].ValueVal), tmpVal, (yyvsp[-5].BoolVal));
+ delete (yyvsp[-1].TypeVal);
;}
break;
- case 299:
-#line 2627 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+ case 291:
+#line 2607 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
{
- if (!isa<PointerType>(yyvsp[-2].TypeVal->get()))
+ if (!isa<PointerType>((yyvsp[-2].TypeVal)->get()))
GEN_ERROR("getelementptr insn requires pointer operand!");
- 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;
+ (yyval.InstVal) = new GetElementPtrInst(tmpVal, *(yyvsp[0].ValueList));
+ delete (yyvsp[-2].TypeVal);
+ delete (yyvsp[0].ValueList);
;}
break;
+ default: break;
}
-/* Line 1000 of yacc.c. */
-#line 5287 "llvmAsmParser.tab.c"
+/* Line 1126 of yacc.c. */
+#line 5345 "llvmAsmParser.tab.c"
\f
yyvsp -= yylen;
yyssp -= yylen;
if (YYPACT_NINF < yyn && yyn < YYLAST)
{
- YYSIZE_T yysize = 0;
int yytype = YYTRANSLATE (yychar);
- const char* yyprefix;
- char *yymsg;
+ 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 = 0;
+ int yycount = 1;
+
+ yyarg[0] = yytname[yytype];
+ yyfmt = yystpcpy (yyformat, yyunexpected);
- yyprefix = ", expecting ";
for (yyx = yyxbegin; yyx < yyxend; ++yyx)
if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
{
- yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
- yycount += 1;
- if (yycount == 5)
+ if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
{
- yysize = 0;
+ 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;
}
- yysize += (sizeof ("syntax error, unexpected ")
- + yystrlen (yytname[yytype]));
- yymsg = (char *) YYSTACK_ALLOC (yysize);
- if (yymsg != 0)
- {
- char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
- yyp = yystpcpy (yyp, yytname[yytype]);
- if (yycount < 5)
+ 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))
{
- yyprefix = ", expecting ";
- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
- {
- yyp = yystpcpy (yyp, yyprefix);
- yyp = yystpcpy (yyp, yytname[yyx]);
- yyprefix = " or ";
- }
+ if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
+ {
+ yyp += yytnamerr (yyp, yyarg[yyi++]);
+ yyf += 2;
+ }
+ else
+ {
+ yyp++;
+ yyf++;
+ }
}
yyerror (yymsg);
YYSTACK_FREE (yymsg);
}
else
- yyerror ("syntax error; also virtual memory exhausted");
+ {
+ yyerror (YY_("syntax error"));
+ goto yyexhaustedlab;
+ }
}
else
#endif /* YYERROR_VERBOSE */
- yyerror ("syntax error");
+ yyerror (YY_("syntax error"));
}
if (yyerrstatus == 3)
{
- /* If just tried and failed to reuse lookahead token after an
+ /* If just tried and failed to reuse look-ahead token after an
error, discard it. */
if (yychar <= YYEOF)
{
- /* If at end of input, pop the error token,
- then the rest of the stack, then return failure. */
+ /* Return failure if at end of input. */
if (yychar == YYEOF)
- for (;;)
- {
- YYPOPSTACK;
- if (yyssp == yyss)
- YYABORT;
- YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
- yydestruct (yystos[*yyssp], yyvsp);
- }
+ YYABORT;
}
else
{
- YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
- yydestruct (yytoken, &yylval);
+ yydestruct ("Error: discarding", yytoken, &yylval);
yychar = YYEMPTY;
-
}
}
- /* Else will try to reuse lookahead token after shifting the error
+ /* Else will try to reuse look-ahead token after shifting the error
token. */
goto yyerrlab1;
`---------------------------------------------------*/
yyerrorlab:
-#ifdef __GNUC__
- /* Pacify GCC when the user code never invokes YYERROR and the label
- yyerrorlab therefore never appears in user code. */
+ /* 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;
-#endif
- yyvsp -= yylen;
+yyvsp -= yylen;
yyssp -= yylen;
yystate = *yyssp;
goto yyerrlab1;
if (yyssp == yyss)
YYABORT;
- YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
- yydestruct (yystos[yystate], yyvsp);
+
+ yydestruct ("Error: popping", yystos[yystate], yyvsp);
YYPOPSTACK;
yystate = *yyssp;
YY_STACK_PRINT (yyss, yyssp);
if (yyn == YYFINAL)
YYACCEPT;
- YYDPRINTF ((stderr, "Shifting error token, "));
-
*++yyvsp = yylval;
+ /* Shift the error token. */
+ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
+
yystate = yyn;
goto yynewstate;
goto yyreturn;
#ifndef yyoverflow
-/*----------------------------------------------.
-| yyoverflowlab -- parser overflow comes here. |
-`----------------------------------------------*/
-yyoverflowlab:
- yyerror ("parser stack overflow");
+/*-------------------------------------------------.
+| 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);
}
-#line 2642 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+#line 2622 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
void llvm::GenerateError(const std::string &message, int LineNo) {
-/* A Bison parser, made by GNU Bison 1.875c. */
+/* 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 Free Software Foundation, Inc.
+ 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
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. */
+ 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.
AND = 342,
OR = 343,
XOR = 344,
- SETLE = 345,
- SETGE = 346,
- SETLT = 347,
- SETGT = 348,
- SETEQ = 349,
- SETNE = 350,
- ICMP = 351,
- FCMP = 352,
- EQ = 353,
- NE = 354,
- SLT = 355,
- SGT = 356,
- SLE = 357,
- SGE = 358,
- ULT = 359,
- UGT = 360,
- ULE = 361,
- UGE = 362,
- OEQ = 363,
- ONE = 364,
- OLT = 365,
- OGT = 366,
- OLE = 367,
- OGE = 368,
- ORD = 369,
- UNO = 370,
- UEQ = 371,
- UNE = 372,
- MALLOC = 373,
- ALLOCA = 374,
- FREE = 375,
- LOAD = 376,
- STORE = 377,
- GETELEMENTPTR = 378,
- TRUNC = 379,
- ZEXT = 380,
- SEXT = 381,
- FPTRUNC = 382,
- FPEXT = 383,
- BITCAST = 384,
- UITOFP = 385,
- SITOFP = 386,
- FPTOUI = 387,
- FPTOSI = 388,
- INTTOPTR = 389,
- PTRTOINT = 390,
- PHI_TOK = 391,
- SELECT = 392,
- SHL = 393,
- LSHR = 394,
- ASHR = 395,
- VAARG = 396,
- EXTRACTELEMENT = 397,
- INSERTELEMENT = 398,
- SHUFFLEVECTOR = 399
+ ICMP = 345,
+ FCMP = 346,
+ EQ = 347,
+ NE = 348,
+ SLT = 349,
+ SGT = 350,
+ SLE = 351,
+ SGE = 352,
+ ULT = 353,
+ UGT = 354,
+ ULE = 355,
+ UGE = 356,
+ OEQ = 357,
+ ONE = 358,
+ OLT = 359,
+ OGT = 360,
+ OLE = 361,
+ OGE = 362,
+ ORD = 363,
+ UNO = 364,
+ UEQ = 365,
+ UNE = 366,
+ MALLOC = 367,
+ ALLOCA = 368,
+ FREE = 369,
+ LOAD = 370,
+ STORE = 371,
+ GETELEMENTPTR = 372,
+ TRUNC = 373,
+ ZEXT = 374,
+ SEXT = 375,
+ FPTRUNC = 376,
+ FPEXT = 377,
+ BITCAST = 378,
+ UITOFP = 379,
+ SITOFP = 380,
+ FPTOUI = 381,
+ FPTOSI = 382,
+ INTTOPTR = 383,
+ PTRTOINT = 384,
+ PHI_TOK = 385,
+ SELECT = 386,
+ SHL = 387,
+ LSHR = 388,
+ ASHR = 389,
+ VAARG = 390,
+ EXTRACTELEMENT = 391,
+ INSERTELEMENT = 392,
+ SHUFFLEVECTOR = 393
};
#endif
+/* Tokens. */
#define ESINT64VAL 258
#define EUINT64VAL 259
#define SINTVAL 260
#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 ICMP 351
-#define FCMP 352
-#define EQ 353
-#define NE 354
-#define SLT 355
-#define SGT 356
-#define SLE 357
-#define SGE 358
-#define ULT 359
-#define UGT 360
-#define ULE 361
-#define UGE 362
-#define OEQ 363
-#define ONE 364
-#define OLT 365
-#define OGT 366
-#define OLE 367
-#define OGE 368
-#define ORD 369
-#define UNO 370
-#define UEQ 371
-#define UNE 372
-#define MALLOC 373
-#define ALLOCA 374
-#define FREE 375
-#define LOAD 376
-#define STORE 377
-#define GETELEMENTPTR 378
-#define TRUNC 379
-#define ZEXT 380
-#define SEXT 381
-#define FPTRUNC 382
-#define FPEXT 383
-#define BITCAST 384
-#define UITOFP 385
-#define SITOFP 386
-#define FPTOUI 387
-#define FPTOSI 388
-#define INTTOPTR 389
-#define PTRTOINT 390
-#define PHI_TOK 391
-#define SELECT 392
-#define SHL 393
-#define LSHR 394
-#define ASHR 395
-#define VAARG 396
-#define EXTRACTELEMENT 397
-#define INSERTELEMENT 398
-#define SHUFFLEVECTOR 399
+#define ICMP 345
+#define FCMP 346
+#define EQ 347
+#define NE 348
+#define SLT 349
+#define SGT 350
+#define SLE 351
+#define SGE 352
+#define ULT 353
+#define UGT 354
+#define ULE 355
+#define UGE 356
+#define OEQ 357
+#define ONE 358
+#define OLT 359
+#define OGT 360
+#define OLE 361
+#define OGE 362
+#define ORD 363
+#define UNO 364
+#define UEQ 365
+#define UNE 366
+#define MALLOC 367
+#define ALLOCA 368
+#define FREE 369
+#define LOAD 370
+#define STORE 371
+#define GETELEMENTPTR 372
+#define TRUNC 373
+#define ZEXT 374
+#define SEXT 375
+#define FPTRUNC 376
+#define FPEXT 377
+#define BITCAST 378
+#define UITOFP 379
+#define SITOFP 380
+#define FPTOUI 381
+#define FPTOSI 382
+#define INTTOPTR 383
+#define PTRTOINT 384
+#define PHI_TOK 385
+#define SELECT 386
+#define SHL 387
+#define LSHR 388
+#define ASHR 389
+#define VAARG 390
+#define EXTRACTELEMENT 391
+#define INSERTELEMENT 392
+#define SHUFFLEVECTOR 393
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
-#line 855 "/home/vadve/alenhar2/llvm.old/lib/AsmParser/llvmAsmParser.y"
+#line 855 "/proj/llvm/llvm-3/lib/AsmParser/llvmAsmParser.y"
typedef union YYSTYPE {
llvm::Module *ModuleVal;
llvm::Function *FunctionVal;
llvm::ICmpInst::Predicate IPredicate;
llvm::FCmpInst::Predicate FPredicate;
} YYSTYPE;
-/* Line 1275 of yacc.c. */
-#line 368 "llvmAsmParser.tab.h"
+/* Line 1447 of yacc.c. */
+#line 357 "llvmAsmParser.tab.h"
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
%token <TermOpVal> RET BR SWITCH INVOKE UNWIND UNREACHABLE
// Binary Operators
-%type <BinaryOpVal> ArithmeticOps LogicalOps SetCondOps // Binops Subcatagories
+%type <BinaryOpVal> ArithmeticOps LogicalOps // Binops Subcatagories
%token <BinaryOpVal> ADD SUB MUL UDIV SDIV FDIV UREM SREM FREM AND OR XOR
-%token <BinaryOpVal> SETLE SETGE SETLT SETGT SETEQ SETNE // Binary Comparators
%token <OtherOpVal> ICMP FCMP
%type <IPredicate> IPredicates
%type <FPredicate> FPredicates
//
ArithmeticOps: ADD | SUB | MUL | UDIV | SDIV | FDIV | UREM | SREM | FREM;
LogicalOps : AND | OR | XOR;
-SetCondOps : SETLE | SETGE | SETLT | SETGT | SETEQ | SETNE;
CastOps : TRUNC | ZEXT | SEXT | FPTRUNC | FPEXT | BITCAST |
UITOFP | SITOFP | FPTOUI | FPTOSI | INTTOPTR | PTRTOINT;
ShiftOps : SHL | LSHR | ASHR;
$$ = ConstantExpr::get($1, $3, $5);
CHECK_FOR_ERROR
}
- | SetCondOps '(' ConstVal ',' ConstVal ')' {
- if ($3->getType() != $5->getType())
- GEN_ERROR("setcc operand types must match!");
- $$ = ConstantExpr::get($1, $3, $5);
- CHECK_FOR_ERROR
- }
| ICMP IPredicates '(' ConstVal ',' ConstVal ')' {
if ($4->getType() != $6->getType())
GEN_ERROR("icmp operand types must match!");
GEN_ERROR("binary operator returned null!");
delete $2;
}
- | SetCondOps Types ValueRef ',' ValueRef {
- if(isa<PackedType>((*$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, tmpVal1, tmpVal2);
- if ($$ == 0)
- GEN_ERROR("binary operator returned null!");
- delete $2;
- }
| ICMP IPredicates Types ValueRef ',' ValueRef {
if (isa<PackedType>((*$3).get()))
GEN_ERROR("Packed types not supported by icmp instruction");
// EUINT64VAL - A positive number within uns. long long range
%token <UInt64Val> EUINT64VAL
-%type <SInt64Val> EINT64VAL
%token <SIntVal> SINTVAL // Signed 32 bit ints...
%token <UIntVal> UINTVAL // Unsigned 32 bit ints...
%token <TermOpVal> RET BR SWITCH INVOKE UNWIND UNREACHABLE
// Binary Operators
-%type <BinaryOpVal> ArithmeticOps LogicalOps SetCondOps // Binops Subcatagories
+%type <BinaryOpVal> ArithmeticOps LogicalOps // Binops Subcatagories
%token <BinaryOpVal> ADD SUB MUL UDIV SDIV FDIV UREM SREM FREM AND OR XOR
-%token <BinaryOpVal> SETLE SETGE SETLT SETGT SETEQ SETNE // Binary Comparators
%token <OtherOpVal> ICMP FCMP
%type <IPredicate> IPredicates
%type <FPredicate> FPredicates
CHECK_FOR_ERROR
};
-
-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!");
- $$ = (int64_t)$1;
- CHECK_FOR_ERROR
-};
-
// 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;
CastOps : TRUNC | ZEXT | SEXT | FPTRUNC | FPEXT | BITCAST |
UITOFP | SITOFP | FPTOUI | FPTOSI | INTTOPTR | PTRTOINT;
ShiftOps : SHL | LSHR | ASHR;
delete $1;
CHECK_FOR_ERROR
}
- | SIntType EINT64VAL { // integral constants
+ | SIntType ESINT64VAL { // integral constants
+ if (!ConstantInt::isValueValidForType($1, $2))
+ GEN_ERROR("Constant value doesn't fit in type!");
+ $$ = ConstantInt::get($1, $2);
+ CHECK_FOR_ERROR
+ }
+ | SIntType EUINT64VAL { // integral constants
if (!ConstantInt::isValueValidForType($1, $2))
GEN_ERROR("Constant value doesn't fit in type!");
$$ = ConstantInt::get($1, $2);
$$ = ConstantInt::get($1, $2);
CHECK_FOR_ERROR
}
+ | UIntType ESINT64VAL {
+ 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
$$ = ConstantExpr::get($1, $3, $5);
CHECK_FOR_ERROR
}
- | SetCondOps '(' ConstVal ',' ConstVal ')' {
- if ($3->getType() != $5->getType())
- GEN_ERROR("setcc operand types must match!");
- $$ = ConstantExpr::get($1, $3, $5);
- CHECK_FOR_ERROR
- }
| ICMP IPredicates '(' ConstVal ',' ConstVal ')' {
if ($4->getType() != $6->getType())
GEN_ERROR("icmp operand types must match!");
GEN_ERROR("binary operator returned null!");
delete $2;
}
- | SetCondOps Types ValueRef ',' ValueRef {
- if(isa<PackedType>((*$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, tmpVal1, tmpVal2);
- if ($$ == 0)
- GEN_ERROR("binary operator returned null!");
- delete $2;
- }
| ICMP IPredicates Types ValueRef ',' ValueRef {
if (isa<PackedType>((*$3).get()))
GEN_ERROR("Packed types not supported by icmp instruction");
Value *L = CI->getOperand(1);
Value *R = CI->getOperand(2);
- Value *LIsNan = new SetCondInst(Instruction::SetNE, L, L, "LIsNan", CI);
- Value *RIsNan = new SetCondInst(Instruction::SetNE, R, R, "RIsNan", CI);
+ Value *LIsNan = new FCmpInst(FCmpInst::FCMP_ONE, L, L, "LIsNan", CI);
+ Value *RIsNan = new FCmpInst(FCmpInst::FCMP_ONE, R, R, "RIsNan", CI);
CI->replaceAllUsesWith(
BinaryOperator::create(Instruction::Or, LIsNan, RIsNan,
"isunordered", CI));
void visitAShr(User &I) { visitShift(I, ISD::SRA); }
void visitICmp(User &I);
void visitFCmp(User &I);
- void visitSetCC(User &I, ISD::CondCode SignedOpc, ISD::CondCode UnsignedOpc,
- ISD::CondCode FPOpc);
- void visitSetEQ(User &I) { visitSetCC(I, ISD::SETEQ, ISD::SETEQ,
- ISD::SETOEQ); }
- void visitSetNE(User &I) { visitSetCC(I, ISD::SETNE, ISD::SETNE,
- ISD::SETUNE); }
- void visitSetLE(User &I) { visitSetCC(I, ISD::SETLE, ISD::SETULE,
- ISD::SETOLE); }
- void visitSetGE(User &I) { visitSetCC(I, ISD::SETGE, ISD::SETUGE,
- ISD::SETOGE); }
- void visitSetLT(User &I) { visitSetCC(I, ISD::SETLT, ISD::SETULT,
- ISD::SETOLT); }
- void visitSetGT(User &I) { visitSetCC(I, ISD::SETGT, ISD::SETUGT,
- ISD::SETOGT); }
// Visit the conversion instructions
void visitTrunc(User &I);
void visitZExt(User &I);
MachineBasicBlock *CurBB,
unsigned Opc) {
// If this node is not part of the or/and tree, emit it as a branch.
- BinaryOperator *BOp = dyn_cast<BinaryOperator>(Cond);
+ Instruction *BOp = dyn_cast<Instruction>(Cond);
- if (!BOp || (unsigned)BOp->getOpcode() != Opc || !BOp->hasOneUse() ||
+ if (!BOp || !(isa<BinaryOperator>(BOp) || isa<CmpInst>(BOp)) ||
+ (unsigned)BOp->getOpcode() != Opc || !BOp->hasOneUse() ||
BOp->getParent() != CurBB->getBasicBlock() ||
!InBlock(BOp->getOperand(0), CurBB->getBasicBlock()) ||
!InBlock(BOp->getOperand(1), CurBB->getBasicBlock())) {
}
- // If the leaf of the tree is a setcond inst, merge the condition into the
- // caseblock.
- if (BOp && isa<SetCondInst>(BOp) &&
- // The operands of the setcc have to be in this block. We don't know
+ // If the leaf of the tree is a comparison, merge the condition into
+ // the caseblock.
+ if ((isa<ICmpInst>(Cond) || isa<FCmpInst>(Cond)) &&
+ // The operands of the cmp have to be in this block. We don't know
// how to export them from some other block. If this is the first block
// of the sequence, no exporting is needed.
(CurBB == CurMBB ||
(isExportableFromCurrentBlock(BOp->getOperand(0), BB) &&
isExportableFromCurrentBlock(BOp->getOperand(1), BB)))) {
- ISD::CondCode SignCond, UnsCond, FPCond, Condition;
- switch (BOp->getOpcode()) {
- default: assert(0 && "Unknown setcc opcode!");
- case Instruction::SetEQ:
- SignCond = ISD::SETEQ;
- UnsCond = ISD::SETEQ;
- FPCond = ISD::SETOEQ;
- break;
- case Instruction::SetNE:
- SignCond = ISD::SETNE;
- UnsCond = ISD::SETNE;
- FPCond = ISD::SETUNE;
- break;
- case Instruction::SetLE:
- SignCond = ISD::SETLE;
- UnsCond = ISD::SETULE;
- FPCond = ISD::SETOLE;
- break;
- case Instruction::SetGE:
- SignCond = ISD::SETGE;
- UnsCond = ISD::SETUGE;
- FPCond = ISD::SETOGE;
- break;
- case Instruction::SetLT:
- SignCond = ISD::SETLT;
- UnsCond = ISD::SETULT;
- FPCond = ISD::SETOLT;
- break;
- case Instruction::SetGT:
- SignCond = ISD::SETGT;
- UnsCond = ISD::SETUGT;
- FPCond = ISD::SETOGT;
- break;
+ BOp = cast<Instruction>(Cond);
+ ISD::CondCode Condition;
+ if (ICmpInst *IC = dyn_cast<ICmpInst>(Cond)) {
+ switch (IC->getPredicate()) {
+ default: assert(0 && "Unknown icmp predicate opcode!");
+ case ICmpInst::ICMP_EQ: Condition = ISD::SETEQ; break;
+ case ICmpInst::ICMP_NE: Condition = ISD::SETNE; break;
+ case ICmpInst::ICMP_SLE: Condition = ISD::SETLE; break;
+ case ICmpInst::ICMP_ULE: Condition = ISD::SETULE; break;
+ case ICmpInst::ICMP_SGE: Condition = ISD::SETGE; break;
+ case ICmpInst::ICMP_UGE: Condition = ISD::SETUGE; break;
+ case ICmpInst::ICMP_SLT: Condition = ISD::SETLT; break;
+ case ICmpInst::ICMP_ULT: Condition = ISD::SETULT; break;
+ case ICmpInst::ICMP_SGT: Condition = ISD::SETGT; break;
+ case ICmpInst::ICMP_UGT: Condition = ISD::SETUGT; break;
+ }
+ } else if (FCmpInst *FC = dyn_cast<FCmpInst>(Cond)) {
+ ISD::CondCode FPC, FOC;
+ switch (FC->getPredicate()) {
+ default: assert(0 && "Unknown fcmp predicate opcode!");
+ case FCmpInst::FCMP_FALSE: FOC = FPC = ISD::SETFALSE; break;
+ case FCmpInst::FCMP_OEQ: FOC = ISD::SETEQ; FPC = ISD::SETOEQ; break;
+ case FCmpInst::FCMP_OGT: FOC = ISD::SETGT; FPC = ISD::SETOGT; break;
+ case FCmpInst::FCMP_OGE: FOC = ISD::SETGE; FPC = ISD::SETOGE; break;
+ case FCmpInst::FCMP_OLT: FOC = ISD::SETLT; FPC = ISD::SETOLT; break;
+ case FCmpInst::FCMP_OLE: FOC = ISD::SETLE; FPC = ISD::SETOLE; break;
+ case FCmpInst::FCMP_ONE: FOC = ISD::SETNE; FPC = ISD::SETONE; break;
+ case FCmpInst::FCMP_ORD: FOC = ISD::SETEQ; FPC = ISD::SETO; break;
+ case FCmpInst::FCMP_UNO: FOC = ISD::SETNE; FPC = ISD::SETUO; break;
+ case FCmpInst::FCMP_UEQ: FOC = ISD::SETEQ; FPC = ISD::SETUEQ; break;
+ case FCmpInst::FCMP_UGT: FOC = ISD::SETGT; FPC = ISD::SETUGT; break;
+ case FCmpInst::FCMP_UGE: FOC = ISD::SETGE; FPC = ISD::SETUGE; break;
+ case FCmpInst::FCMP_ULT: FOC = ISD::SETLT; FPC = ISD::SETULT; break;
+ case FCmpInst::FCMP_ULE: FOC = ISD::SETLE; FPC = ISD::SETULE; break;
+ case FCmpInst::FCMP_UNE: FOC = ISD::SETNE; FPC = ISD::SETUNE; break;
+ case FCmpInst::FCMP_TRUE: FOC = FPC = ISD::SETTRUE; break;
+ }
+ if (FiniteOnlyFPMath())
+ Condition = FOC;
+ else
+ Condition = FPC;
+ } else {
+ assert(0 && "Unknown compare instruction");
}
- const Type *OpType = BOp->getOperand(0)->getType();
- if (const PackedType *PTy = dyn_cast<PackedType>(OpType))
- OpType = PTy->getElementType();
-
- if (!FiniteOnlyFPMath() && OpType->isFloatingPoint())
- Condition = FPCond;
- else if (OpType->isUnsigned())
- Condition = UnsCond;
- else
- Condition = SignCond;
-
SelectionDAGISel::CaseBlock CB(Condition, BOp->getOperand(0),
BOp->getOperand(1), TBB, FBB, CurBB);
SwitchCases.push_back(CB);
}
void SelectionDAGLowering::visitICmp(User &I) {
- ICmpInst *IC = cast<ICmpInst>(&I);
- SDOperand Op1 = getValue(IC->getOperand(0));
- SDOperand Op2 = getValue(IC->getOperand(1));
+ ICmpInst::Predicate predicate = ICmpInst::BAD_ICMP_PREDICATE;
+ if (ICmpInst *IC = dyn_cast<ICmpInst>(&I))
+ predicate = IC->getPredicate();
+ else if (ConstantExpr *IC = dyn_cast<ConstantExpr>(&I))
+ predicate = ICmpInst::Predicate(IC->getPredicate());
+ SDOperand Op1 = getValue(I.getOperand(0));
+ SDOperand Op2 = getValue(I.getOperand(1));
ISD::CondCode Opcode;
- switch (IC->getPredicate()) {
+ switch (predicate) {
case ICmpInst::ICMP_EQ : Opcode = ISD::SETEQ; break;
case ICmpInst::ICMP_NE : Opcode = ISD::SETNE; break;
case ICmpInst::ICMP_UGT : Opcode = ISD::SETUGT; break;
}
void SelectionDAGLowering::visitFCmp(User &I) {
- FCmpInst *FC = cast<FCmpInst>(&I);
- SDOperand Op1 = getValue(FC->getOperand(0));
- SDOperand Op2 = getValue(FC->getOperand(1));
- ISD::CondCode Opcode;
- switch (FC->getPredicate()) {
- case FCmpInst::FCMP_FALSE : Opcode = ISD::SETFALSE;
- case FCmpInst::FCMP_OEQ : Opcode = ISD::SETOEQ;
- case FCmpInst::FCMP_OGT : Opcode = ISD::SETOGT;
- case FCmpInst::FCMP_OGE : Opcode = ISD::SETOGE;
- case FCmpInst::FCMP_OLT : Opcode = ISD::SETOLT;
- case FCmpInst::FCMP_OLE : Opcode = ISD::SETOLE;
- case FCmpInst::FCMP_ONE : Opcode = ISD::SETONE;
- case FCmpInst::FCMP_ORD : Opcode = ISD::SETO;
- case FCmpInst::FCMP_UNO : Opcode = ISD::SETUO;
- case FCmpInst::FCMP_UEQ : Opcode = ISD::SETUEQ;
- case FCmpInst::FCMP_UGT : Opcode = ISD::SETUGT;
- case FCmpInst::FCMP_UGE : Opcode = ISD::SETUGE;
- case FCmpInst::FCMP_ULT : Opcode = ISD::SETULT;
- case FCmpInst::FCMP_ULE : Opcode = ISD::SETULE;
- case FCmpInst::FCMP_UNE : Opcode = ISD::SETUNE;
- case FCmpInst::FCMP_TRUE : Opcode = ISD::SETTRUE;
+ FCmpInst::Predicate predicate = FCmpInst::BAD_FCMP_PREDICATE;
+ if (FCmpInst *FC = dyn_cast<FCmpInst>(&I))
+ predicate = FC->getPredicate();
+ else if (ConstantExpr *FC = dyn_cast<ConstantExpr>(&I))
+ predicate = FCmpInst::Predicate(FC->getPredicate());
+ SDOperand Op1 = getValue(I.getOperand(0));
+ SDOperand Op2 = getValue(I.getOperand(1));
+ ISD::CondCode Condition, FOC, FPC;
+ switch (predicate) {
+ case FCmpInst::FCMP_FALSE: FOC = FPC = ISD::SETFALSE; break;
+ case FCmpInst::FCMP_OEQ: FOC = ISD::SETEQ; FPC = ISD::SETOEQ; break;
+ case FCmpInst::FCMP_OGT: FOC = ISD::SETGT; FPC = ISD::SETOGT; break;
+ case FCmpInst::FCMP_OGE: FOC = ISD::SETGE; FPC = ISD::SETOGE; break;
+ case FCmpInst::FCMP_OLT: FOC = ISD::SETLT; FPC = ISD::SETOLT; break;
+ case FCmpInst::FCMP_OLE: FOC = ISD::SETLE; FPC = ISD::SETOLE; break;
+ case FCmpInst::FCMP_ONE: FOC = ISD::SETNE; FPC = ISD::SETONE; break;
+ case FCmpInst::FCMP_ORD: FOC = ISD::SETEQ; FPC = ISD::SETO; break;
+ case FCmpInst::FCMP_UNO: FOC = ISD::SETNE; FPC = ISD::SETUO; break;
+ case FCmpInst::FCMP_UEQ: FOC = ISD::SETEQ; FPC = ISD::SETUEQ; break;
+ case FCmpInst::FCMP_UGT: FOC = ISD::SETGT; FPC = ISD::SETUGT; break;
+ case FCmpInst::FCMP_UGE: FOC = ISD::SETGE; FPC = ISD::SETUGE; break;
+ case FCmpInst::FCMP_ULT: FOC = ISD::SETLT; FPC = ISD::SETULT; break;
+ case FCmpInst::FCMP_ULE: FOC = ISD::SETLE; FPC = ISD::SETULE; break;
+ case FCmpInst::FCMP_UNE: FOC = ISD::SETNE; FPC = ISD::SETUNE; break;
+ case FCmpInst::FCMP_TRUE: FOC = FPC = ISD::SETTRUE; break;
default:
assert(!"Invalid FCmp predicate value");
- Opcode = ISD::SETFALSE;
+ FOC = FPC = ISD::SETFALSE;
break;
}
- setValue(&I, DAG.getSetCC(MVT::i1, Op1, Op2, Opcode));
-}
-
-void SelectionDAGLowering::visitSetCC(User &I,ISD::CondCode SignedOpcode,
- ISD::CondCode UnsignedOpcode,
- ISD::CondCode FPOpcode) {
- SDOperand Op1 = getValue(I.getOperand(0));
- SDOperand Op2 = getValue(I.getOperand(1));
- ISD::CondCode Opcode = SignedOpcode;
- if (!FiniteOnlyFPMath() && I.getOperand(0)->getType()->isFloatingPoint())
- Opcode = FPOpcode;
- else if (I.getOperand(0)->getType()->isUnsigned())
- Opcode = UnsignedOpcode;
- setValue(&I, DAG.getSetCC(MVT::i1, Op1, Op2, Opcode));
+ if (FiniteOnlyFPMath())
+ Condition = FOC;
+ else
+ Condition = FPC;
+ setValue(&I, DAG.getSetCC(MVT::i1, Op1, Op2, Condition));
}
void SelectionDAGLowering::visitSelect(User &I) {
const Type *Ty);
static GenericValue executeXorInst(GenericValue Src1, GenericValue Src2,
const Type *Ty);
-static GenericValue executeSetEQInst(GenericValue Src1, GenericValue Src2,
- const Type *Ty);
-static GenericValue executeSetNEInst(GenericValue Src1, GenericValue Src2,
- const Type *Ty);
-static GenericValue executeSetLTInst(GenericValue Src1, GenericValue Src2,
- const Type *Ty);
-static GenericValue executeSetGTInst(GenericValue Src1, GenericValue Src2,
- const Type *Ty);
-static GenericValue executeSetLEInst(GenericValue Src1, GenericValue Src2,
- const Type *Ty);
-static GenericValue executeSetGEInst(GenericValue Src1, GenericValue Src2,
- const Type *Ty);
+static GenericValue executeCmpInst(unsigned predicate, GenericValue Src1,
+ GenericValue Src2, const Type *Ty);
static GenericValue executeShlInst(GenericValue Src1, GenericValue Src2,
const Type *Ty);
static GenericValue executeLShrInst(GenericValue Src1, GenericValue Src2,
return executeXorInst(getOperandValue(CE->getOperand(0), SF),
getOperandValue(CE->getOperand(1), SF),
CE->getOperand(0)->getType());
- case Instruction::SetEQ:
- return executeSetEQInst(getOperandValue(CE->getOperand(0), SF),
- getOperandValue(CE->getOperand(1), SF),
- CE->getOperand(0)->getType());
- case Instruction::SetNE:
- return executeSetNEInst(getOperandValue(CE->getOperand(0), SF),
- getOperandValue(CE->getOperand(1), SF),
- CE->getOperand(0)->getType());
- case Instruction::SetLE:
- return executeSetLEInst(getOperandValue(CE->getOperand(0), SF),
- getOperandValue(CE->getOperand(1), SF),
- CE->getOperand(0)->getType());
- case Instruction::SetGE:
- return executeSetGEInst(getOperandValue(CE->getOperand(0), SF),
- getOperandValue(CE->getOperand(1), SF),
- CE->getOperand(0)->getType());
- case Instruction::SetLT:
- return executeSetLTInst(getOperandValue(CE->getOperand(0), SF),
- getOperandValue(CE->getOperand(1), SF),
- CE->getOperand(0)->getType());
- case Instruction::SetGT:
- return executeSetGTInst(getOperandValue(CE->getOperand(0), SF),
- getOperandValue(CE->getOperand(1), SF),
- CE->getOperand(0)->getType());
+ case Instruction::FCmp:
+ case Instruction::ICmp:
+ return executeCmpInst(CE->getPredicate(),
+ getOperandValue(CE->getOperand(0), SF),
+ getOperandValue(CE->getOperand(1), SF),
+ CE->getOperand(0)->getType());
case Instruction::Shl:
return executeShlInst(getOperandValue(CE->getOperand(0), SF),
getOperandValue(CE->getOperand(1), SF),
return Dest;
}
-#define IMPLEMENT_SETCC(OP, TY) \
- case Type::TY##TyID: Dest.BoolVal = Src1.TY##Val OP Src2.TY##Val; break
+#define IMPLEMENT_CMP(OP, TY1, TY2) \
+ case Type::TY1##TyID: Dest.BoolVal = Src1.TY2##Val OP Src2.TY2##Val; break
// Handle pointers specially because they must be compared with only as much
// width as the host has. We _do not_ want to be comparing 64 bit values when
// running on a 32-bit target, otherwise the upper 32 bits might mess up
// comparisons if they contain garbage.
-#define IMPLEMENT_POINTERSETCC(OP) \
+#define IMPLEMENT_POINTERCMP(OP) \
case Type::PointerTyID: \
Dest.BoolVal = (void*)(intptr_t)Src1.PointerVal OP \
(void*)(intptr_t)Src2.PointerVal; break
-static GenericValue executeSetEQInst(GenericValue Src1, GenericValue Src2,
- const Type *Ty) {
+static GenericValue executeICMP_EQ(GenericValue Src1, GenericValue Src2,
+ const Type *Ty) {
+ GenericValue Dest;
+ switch (Ty->getTypeID()) {
+ IMPLEMENT_CMP(==, UByte, UByte);
+ IMPLEMENT_CMP(==, SByte, SByte);
+ IMPLEMENT_CMP(==, UShort, UShort);
+ IMPLEMENT_CMP(==, Short, Short);
+ IMPLEMENT_CMP(==, UInt, UInt);
+ IMPLEMENT_CMP(==, Int, Int);
+ IMPLEMENT_CMP(==, ULong, ULong);
+ IMPLEMENT_CMP(==, Long, Long);
+ IMPLEMENT_POINTERCMP(==);
+ default:
+ cerr << "Unhandled type for ICMP_EQ predicate: " << *Ty << "\n";
+ abort();
+ }
+ return Dest;
+}
+
+static GenericValue executeICMP_NE(GenericValue Src1, GenericValue Src2,
+ const Type *Ty) {
+ GenericValue Dest;
+ switch (Ty->getTypeID()) {
+ IMPLEMENT_CMP(!=, UByte, UByte);
+ IMPLEMENT_CMP(!=, SByte, SByte);
+ IMPLEMENT_CMP(!=, UShort,UShort);
+ IMPLEMENT_CMP(!=, Short, Short);
+ IMPLEMENT_CMP(!=, UInt, UInt);
+ IMPLEMENT_CMP(!=, Int, Int);
+ IMPLEMENT_CMP(!=, ULong, ULong);
+ IMPLEMENT_CMP(!=, Long, Long);
+ IMPLEMENT_POINTERCMP(!=);
+ default:
+ cerr << "Unhandled type for ICMP_NE predicate: " << *Ty << "\n";
+ abort();
+ }
+ return Dest;
+}
+
+static GenericValue executeICMP_ULT(GenericValue Src1, GenericValue Src2,
+ const Type *Ty) {
+ GenericValue Dest;
+ switch (Ty->getTypeID()) {
+ IMPLEMENT_CMP(<, SByte, UByte);
+ IMPLEMENT_CMP(<, Short, UShort);
+ IMPLEMENT_CMP(<, Int, UInt);
+ IMPLEMENT_CMP(<, Long, ULong);
+ IMPLEMENT_CMP(<, UByte, UByte);
+ IMPLEMENT_CMP(<, UShort, UShort);
+ IMPLEMENT_CMP(<, UInt, UInt);
+ IMPLEMENT_CMP(<, ULong, ULong);
+ IMPLEMENT_POINTERCMP(<);
+ default:
+ cerr << "Unhandled type for ICMP_ULT predicate: " << *Ty << "\n";
+ abort();
+ }
+ return Dest;
+}
+
+static GenericValue executeICMP_SLT(GenericValue Src1, GenericValue Src2,
+ const Type *Ty) {
+ GenericValue Dest;
+ switch (Ty->getTypeID()) {
+ IMPLEMENT_CMP(<, SByte, SByte);
+ IMPLEMENT_CMP(<, Short, Short);
+ IMPLEMENT_CMP(<, Int, Int);
+ IMPLEMENT_CMP(<, Long, Long);
+ IMPLEMENT_CMP(<, UByte, SByte);
+ IMPLEMENT_CMP(<, UShort, Short);
+ IMPLEMENT_CMP(<, UInt, Int);
+ IMPLEMENT_CMP(<, ULong, Long);
+ IMPLEMENT_POINTERCMP(<);
+ default:
+ cerr << "Unhandled type for ICMP_SLT predicate: " << *Ty << "\n";
+ abort();
+ }
+ return Dest;
+}
+
+static GenericValue executeICMP_UGT(GenericValue Src1, GenericValue Src2,
+ const Type *Ty) {
+ GenericValue Dest;
+ switch (Ty->getTypeID()) {
+ IMPLEMENT_CMP(>, SByte, UByte);
+ IMPLEMENT_CMP(>, Short, UShort);
+ IMPLEMENT_CMP(>, Int, UInt);
+ IMPLEMENT_CMP(>, Long, ULong);
+ IMPLEMENT_CMP(>, UByte, UByte);
+ IMPLEMENT_CMP(>, UShort, UShort);
+ IMPLEMENT_CMP(>, UInt, UInt);
+ IMPLEMENT_CMP(>, ULong, ULong);
+ IMPLEMENT_POINTERCMP(>);
+ default:
+ cerr << "Unhandled type for ICMP_UGT predicate: " << *Ty << "\n";
+ abort();
+ }
+ return Dest;
+}
+
+static GenericValue executeICMP_SGT(GenericValue Src1, GenericValue Src2,
+ const Type *Ty) {
+ GenericValue Dest;
+ switch (Ty->getTypeID()) {
+ IMPLEMENT_CMP(>, SByte, SByte);
+ IMPLEMENT_CMP(>, Short, Short);
+ IMPLEMENT_CMP(>, Int, Int);
+ IMPLEMENT_CMP(>, Long, Long);
+ IMPLEMENT_CMP(>, UByte, SByte);
+ IMPLEMENT_CMP(>, UShort, Short);
+ IMPLEMENT_CMP(>, UInt, Int);
+ IMPLEMENT_CMP(>, ULong, Long);
+ IMPLEMENT_POINTERCMP(>);
+ default:
+ cerr << "Unhandled type for ICMP_SGT predicate: " << *Ty << "\n";
+ abort();
+ }
+ return Dest;
+}
+
+static GenericValue executeICMP_ULE(GenericValue Src1, GenericValue Src2,
+ const Type *Ty) {
+ GenericValue Dest;
+ switch (Ty->getTypeID()) {
+ IMPLEMENT_CMP(<=, SByte, UByte);
+ IMPLEMENT_CMP(<=, Short, UShort);
+ IMPLEMENT_CMP(<=, Int, UInt);
+ IMPLEMENT_CMP(<=, Long, ULong);
+ IMPLEMENT_CMP(<=, UByte, UByte);
+ IMPLEMENT_CMP(<=, UShort, UShort);
+ IMPLEMENT_CMP(<=, UInt, UInt);
+ IMPLEMENT_CMP(<=, ULong, ULong);
+ IMPLEMENT_POINTERCMP(<=);
+ default:
+ cerr << "Unhandled type for ICMP_ULE predicate: " << *Ty << "\n";
+ abort();
+ }
+ return Dest;
+}
+
+static GenericValue executeICMP_SLE(GenericValue Src1, GenericValue Src2,
+ const Type *Ty) {
+ GenericValue Dest;
+ switch (Ty->getTypeID()) {
+ IMPLEMENT_CMP(<=, SByte, SByte);
+ IMPLEMENT_CMP(<=, Short, Short);
+ IMPLEMENT_CMP(<=, Int, Int);
+ IMPLEMENT_CMP(<=, Long, Long);
+ IMPLEMENT_CMP(<=, UByte, SByte);
+ IMPLEMENT_CMP(<=, UShort, Short);
+ IMPLEMENT_CMP(<=, UInt, Int);
+ IMPLEMENT_CMP(<=, ULong, Long);
+ IMPLEMENT_POINTERCMP(<=);
+ default:
+ cerr << "Unhandled type for ICMP_SLE predicate: " << *Ty << "\n";
+ abort();
+ }
+ return Dest;
+}
+
+static GenericValue executeICMP_UGE(GenericValue Src1, GenericValue Src2,
+ const Type *Ty) {
+ GenericValue Dest;
+ switch (Ty->getTypeID()) {
+ IMPLEMENT_CMP(>=, SByte, UByte);
+ IMPLEMENT_CMP(>=, Short, UShort);
+ IMPLEMENT_CMP(>=, Int, UInt);
+ IMPLEMENT_CMP(>=, Long, ULong);
+ IMPLEMENT_CMP(>=, UByte, UByte);
+ IMPLEMENT_CMP(>=, UShort, UShort);
+ IMPLEMENT_CMP(>=, UInt, UInt);
+ IMPLEMENT_CMP(>=, ULong, ULong);
+ IMPLEMENT_POINTERCMP(>=);
+ default:
+ cerr << "Unhandled type for ICMP_UGE predicate: " << *Ty << "\n";
+ abort();
+ }
+ return Dest;
+}
+
+static GenericValue executeICMP_SGE(GenericValue Src1, GenericValue Src2,
+ const Type *Ty) {
+ GenericValue Dest;
+ switch (Ty->getTypeID()) {
+ IMPLEMENT_CMP(>=, SByte, SByte);
+ IMPLEMENT_CMP(>=, Short, Short);
+ IMPLEMENT_CMP(>=, Int, Int);
+ IMPLEMENT_CMP(>=, Long, Long);
+ IMPLEMENT_CMP(>=, UByte, SByte);
+ IMPLEMENT_CMP(>=, UShort, Short);
+ IMPLEMENT_CMP(>=, UInt, Int);
+ IMPLEMENT_CMP(>=, ULong, Long);
+ IMPLEMENT_POINTERCMP(>=);
+ default:
+ cerr << "Unhandled type for ICMP_SGE predicate: " << *Ty << "\n";
+ abort();
+ }
+ return Dest;
+}
+
+#define IMPLEMENT_SETCC(OP, TY) \
+ case Type::TY##TyID: Dest.BoolVal = Src1.TY##Val OP Src2.TY##Val; break
+
+static GenericValue executeFCMP_EQ(GenericValue Src1, GenericValue Src2,
+ const Type *Ty) {
GenericValue Dest;
switch (Ty->getTypeID()) {
- IMPLEMENT_SETCC(==, UByte);
- IMPLEMENT_SETCC(==, SByte);
- IMPLEMENT_SETCC(==, UShort);
- IMPLEMENT_SETCC(==, Short);
- IMPLEMENT_SETCC(==, UInt);
- IMPLEMENT_SETCC(==, Int);
- IMPLEMENT_SETCC(==, ULong);
- IMPLEMENT_SETCC(==, Long);
IMPLEMENT_SETCC(==, Float);
IMPLEMENT_SETCC(==, Double);
- IMPLEMENT_POINTERSETCC(==);
default:
cerr << "Unhandled type for SetEQ instruction: " << *Ty << "\n";
abort();
return Dest;
}
-static GenericValue executeSetNEInst(GenericValue Src1, GenericValue Src2,
- const Type *Ty) {
+static GenericValue executeFCMP_NE(GenericValue Src1, GenericValue Src2,
+ const Type *Ty) {
GenericValue Dest;
switch (Ty->getTypeID()) {
- IMPLEMENT_SETCC(!=, UByte);
- IMPLEMENT_SETCC(!=, SByte);
- IMPLEMENT_SETCC(!=, UShort);
- IMPLEMENT_SETCC(!=, Short);
- IMPLEMENT_SETCC(!=, UInt);
- IMPLEMENT_SETCC(!=, Int);
- IMPLEMENT_SETCC(!=, ULong);
- IMPLEMENT_SETCC(!=, Long);
IMPLEMENT_SETCC(!=, Float);
IMPLEMENT_SETCC(!=, Double);
- IMPLEMENT_POINTERSETCC(!=);
default:
cerr << "Unhandled type for SetNE instruction: " << *Ty << "\n";
return Dest;
}
-static GenericValue executeSetLEInst(GenericValue Src1, GenericValue Src2,
- const Type *Ty) {
+static GenericValue executeFCMP_LE(GenericValue Src1, GenericValue Src2,
+ const Type *Ty) {
GenericValue Dest;
switch (Ty->getTypeID()) {
- IMPLEMENT_SETCC(<=, UByte);
- IMPLEMENT_SETCC(<=, SByte);
- IMPLEMENT_SETCC(<=, UShort);
- IMPLEMENT_SETCC(<=, Short);
- IMPLEMENT_SETCC(<=, UInt);
- IMPLEMENT_SETCC(<=, Int);
- IMPLEMENT_SETCC(<=, ULong);
- IMPLEMENT_SETCC(<=, Long);
IMPLEMENT_SETCC(<=, Float);
IMPLEMENT_SETCC(<=, Double);
- IMPLEMENT_POINTERSETCC(<=);
default:
cerr << "Unhandled type for SetLE instruction: " << *Ty << "\n";
abort();
return Dest;
}
-static GenericValue executeSetGEInst(GenericValue Src1, GenericValue Src2,
- const Type *Ty) {
+static GenericValue executeFCMP_GE(GenericValue Src1, GenericValue Src2,
+ const Type *Ty) {
GenericValue Dest;
switch (Ty->getTypeID()) {
- IMPLEMENT_SETCC(>=, UByte);
- IMPLEMENT_SETCC(>=, SByte);
- IMPLEMENT_SETCC(>=, UShort);
- IMPLEMENT_SETCC(>=, Short);
- IMPLEMENT_SETCC(>=, UInt);
- IMPLEMENT_SETCC(>=, Int);
- IMPLEMENT_SETCC(>=, ULong);
- IMPLEMENT_SETCC(>=, Long);
IMPLEMENT_SETCC(>=, Float);
IMPLEMENT_SETCC(>=, Double);
- IMPLEMENT_POINTERSETCC(>=);
default:
cerr << "Unhandled type for SetGE instruction: " << *Ty << "\n";
abort();
return Dest;
}
-static GenericValue executeSetLTInst(GenericValue Src1, GenericValue Src2,
- const Type *Ty) {
+static GenericValue executeFCMP_LT(GenericValue Src1, GenericValue Src2,
+ const Type *Ty) {
GenericValue Dest;
switch (Ty->getTypeID()) {
- IMPLEMENT_SETCC(<, UByte);
- IMPLEMENT_SETCC(<, SByte);
- IMPLEMENT_SETCC(<, UShort);
- IMPLEMENT_SETCC(<, Short);
- IMPLEMENT_SETCC(<, UInt);
- IMPLEMENT_SETCC(<, Int);
- IMPLEMENT_SETCC(<, ULong);
- IMPLEMENT_SETCC(<, Long);
IMPLEMENT_SETCC(<, Float);
IMPLEMENT_SETCC(<, Double);
- IMPLEMENT_POINTERSETCC(<);
default:
cerr << "Unhandled type for SetLT instruction: " << *Ty << "\n";
abort();
return Dest;
}
-static GenericValue executeSetGTInst(GenericValue Src1, GenericValue Src2,
+static GenericValue executeFCMP_GT(GenericValue Src1, GenericValue Src2,
const Type *Ty) {
GenericValue Dest;
switch (Ty->getTypeID()) {
- IMPLEMENT_SETCC(>, UByte);
- IMPLEMENT_SETCC(>, SByte);
- IMPLEMENT_SETCC(>, UShort);
- IMPLEMENT_SETCC(>, Short);
- IMPLEMENT_SETCC(>, UInt);
- IMPLEMENT_SETCC(>, Int);
- IMPLEMENT_SETCC(>, ULong);
- IMPLEMENT_SETCC(>, Long);
IMPLEMENT_SETCC(>, Float);
IMPLEMENT_SETCC(>, Double);
- IMPLEMENT_POINTERSETCC(>);
default:
cerr << "Unhandled type for SetGT instruction: " << *Ty << "\n";
abort();
return Dest;
}
+void Interpreter::visitFCmpInst(FCmpInst &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 R; // Result
+
+ switch (I.getPredicate()) {
+ case FCmpInst::FCMP_FALSE: R.BoolVal = false;
+ case FCmpInst::FCMP_ORD: R = executeFCMP_EQ(Src1, Src2, Ty); break; ///???
+ case FCmpInst::FCMP_UNO: R = executeFCMP_NE(Src1, Src2, Ty); break; ///???
+ case FCmpInst::FCMP_OEQ:
+ case FCmpInst::FCMP_UEQ: R = executeFCMP_EQ(Src1, Src2, Ty); break;
+ case FCmpInst::FCMP_ONE:
+ case FCmpInst::FCMP_UNE: R = executeFCMP_NE(Src1, Src2, Ty); break;
+ case FCmpInst::FCMP_OLT:
+ case FCmpInst::FCMP_ULT: R = executeFCMP_LT(Src1, Src2, Ty); break;
+ case FCmpInst::FCMP_OGT:
+ case FCmpInst::FCMP_UGT: R = executeFCMP_GT(Src1, Src2, Ty); break;
+ case FCmpInst::FCMP_OLE:
+ case FCmpInst::FCMP_ULE: R = executeFCMP_LE(Src1, Src2, Ty); break;
+ case FCmpInst::FCMP_OGE:
+ case FCmpInst::FCMP_UGE: R = executeFCMP_GE(Src1, Src2, Ty); break;
+ case FCmpInst::FCMP_TRUE: R.BoolVal = true;
+ default:
+ cerr << "Don't know how to handle this FCmp predicate!\n-->" << I;
+ abort();
+ }
+
+ SetValue(&I, R, SF);
+}
+
+void Interpreter::visitICmpInst(ICmpInst &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 R; // Result
+
+ switch (I.getPredicate()) {
+ case ICmpInst::ICMP_EQ: R = executeICMP_EQ(Src1, Src2, Ty); break;
+ case ICmpInst::ICMP_NE: R = executeICMP_NE(Src1, Src2, Ty); break;
+ case ICmpInst::ICMP_ULT: R = executeICMP_ULT(Src1, Src2, Ty); break;
+ case ICmpInst::ICMP_SLT: R = executeICMP_SLT(Src1, Src2, Ty); break;
+ case ICmpInst::ICMP_UGT: R = executeICMP_UGT(Src1, Src2, Ty); break;
+ case ICmpInst::ICMP_SGT: R = executeICMP_SGT(Src1, Src2, Ty); break;
+ case ICmpInst::ICMP_ULE: R = executeICMP_ULE(Src1, Src2, Ty); break;
+ case ICmpInst::ICMP_SLE: R = executeICMP_SLE(Src1, Src2, Ty); break;
+ case ICmpInst::ICMP_UGE: R = executeICMP_UGE(Src1, Src2, Ty); break;
+ case ICmpInst::ICMP_SGE: R = executeICMP_SGE(Src1, Src2, Ty); break;
+ default:
+ cerr << "Don't know how to handle this ICmp predicate!\n-->" << I;
+ abort();
+ }
+
+ SetValue(&I, R, SF);
+}
+
+static GenericValue executeCmpInst(unsigned predicate, GenericValue Src1,
+ GenericValue Src2, const Type *Ty) {
+ GenericValue Result;
+ switch (predicate) {
+ case ICmpInst::ICMP_EQ: return executeICMP_EQ(Src1, Src2, Ty);
+ case ICmpInst::ICMP_NE: return executeICMP_NE(Src1, Src2, Ty);
+ case ICmpInst::ICMP_UGT: return executeICMP_UGT(Src1, Src2, Ty);
+ case ICmpInst::ICMP_SGT: return executeICMP_SGT(Src1, Src2, Ty);
+ case ICmpInst::ICMP_ULT: return executeICMP_ULT(Src1, Src2, Ty);
+ case ICmpInst::ICMP_SLT: return executeICMP_SLT(Src1, Src2, Ty);
+ case ICmpInst::ICMP_UGE: return executeICMP_UGE(Src1, Src2, Ty);
+ case ICmpInst::ICMP_SGE: return executeICMP_SGE(Src1, Src2, Ty);
+ case ICmpInst::ICMP_ULE: return executeICMP_ULE(Src1, Src2, Ty);
+ case ICmpInst::ICMP_SLE: return executeICMP_SLE(Src1, Src2, Ty);
+ case FCmpInst::FCMP_ORD: return executeFCMP_EQ(Src1, Src2, Ty); break;
+ case FCmpInst::FCMP_UNO: return executeFCMP_NE(Src1, Src2, Ty); break;
+ case FCmpInst::FCMP_OEQ:
+ case FCmpInst::FCMP_UEQ: return executeFCMP_EQ(Src1, Src2, Ty); break;
+ case FCmpInst::FCMP_ONE:
+ case FCmpInst::FCMP_UNE: return executeFCMP_NE(Src1, Src2, Ty); break;
+ case FCmpInst::FCMP_OLT:
+ case FCmpInst::FCMP_ULT: return executeFCMP_LT(Src1, Src2, Ty); break;
+ case FCmpInst::FCMP_OGT:
+ case FCmpInst::FCMP_UGT: return executeFCMP_GT(Src1, Src2, Ty); break;
+ case FCmpInst::FCMP_OLE:
+ case FCmpInst::FCMP_ULE: return executeFCMP_LE(Src1, Src2, Ty); break;
+ case FCmpInst::FCMP_OGE:
+ case FCmpInst::FCMP_UGE: return executeFCMP_GE(Src1, Src2, Ty); break;
+ case FCmpInst::FCMP_FALSE: {
+ GenericValue Result;
+ Result.BoolVal = false;
+ return Result;
+ }
+ case FCmpInst::FCMP_TRUE: {
+ GenericValue Result;
+ Result.BoolVal = true;
+ return Result;
+ }
+ default:
+ cerr << "Unhandled Cmp predicate\n";
+ abort();
+ }
+}
+
void Interpreter::visitBinaryOperator(BinaryOperator &I) {
ExecutionContext &SF = ECStack.back();
const Type *Ty = I.getOperand(0)->getType();
case Instruction::And: R = executeAndInst (Src1, Src2, Ty); break;
case Instruction::Or: R = executeOrInst (Src1, Src2, Ty); break;
case Instruction::Xor: R = executeXorInst (Src1, Src2, Ty); break;
- case Instruction::SetEQ: R = executeSetEQInst(Src1, Src2, Ty); break;
- case Instruction::SetNE: R = executeSetNEInst(Src1, Src2, Ty); break;
- case Instruction::SetLE: R = executeSetLEInst(Src1, Src2, Ty); break;
- case Instruction::SetGE: R = executeSetGEInst(Src1, Src2, Ty); break;
- case Instruction::SetLT: R = executeSetLTInst(Src1, Src2, Ty); break;
- case Instruction::SetGT: R = executeSetGTInst(Src1, Src2, Ty); break;
default:
cerr << "Don't know how to handle this binary operator!\n-->" << I;
abort();
// Check to see if any of the cases match...
BasicBlock *Dest = 0;
for (unsigned i = 2, e = I.getNumOperands(); i != e; i += 2)
- if (executeSetEQInst(CondVal,
- getOperandValue(I.getOperand(i), SF), ElTy).BoolVal) {
+ if (executeICMP_EQ(CondVal,
+ getOperandValue(I.getOperand(i), SF), ElTy).BoolVal) {
Dest = cast<BasicBlock>(I.getOperand(i+1));
break;
}
void visitSwitchInst(SwitchInst &I);
void visitBinaryOperator(BinaryOperator &I);
+ void visitICmpInst(ICmpInst &I);
+ void visitFCmpInst(FCmpInst &I);
void visitAllocationInst(AllocationInst &I);
void visitFreeInst(FreeInst &I);
void visitLoadInst(LoadInst &I);
#include "llvm/Support/ConstantRange.h"
#include "llvm/Constants.h"
#include "llvm/Instruction.h"
+#include "llvm/Instructions.h"
#include "llvm/Type.h"
#include "llvm/Support/Streams.h"
#include <ostream>
using namespace llvm;
-static ConstantIntegral *getMaxValue(const Type *Ty) {
- switch (Ty->getTypeID()) {
- case Type::BoolTyID: return ConstantBool::getTrue();
- case Type::SByteTyID:
- case Type::ShortTyID:
- case Type::IntTyID:
- case Type::LongTyID: {
- // Calculate 011111111111111...
- unsigned TypeBits = Ty->getPrimitiveSize()*8;
- int64_t Val = INT64_MAX; // All ones
- Val >>= 64-TypeBits; // Shift out unwanted 1 bits...
- return ConstantInt::get(Ty, Val);
- }
-
- case Type::UByteTyID:
- case Type::UShortTyID:
- case Type::UIntTyID:
- case Type::ULongTyID: return ConstantInt::getAllOnesValue(Ty);
-
- default: return 0;
+static ConstantIntegral *getMaxValue(const Type *Ty, bool isSigned = false) {
+ if (Ty == Type::BoolTy)
+ return ConstantBool::getTrue();
+ if (Ty->isInteger()) {
+ if (isSigned) {
+ // Calculate 011111111111111...
+ unsigned TypeBits = Ty->getPrimitiveSize()*8;
+ int64_t Val = INT64_MAX; // All ones
+ Val >>= 64-TypeBits; // Shift out unwanted 1 bits...
+ return ConstantInt::get(Ty, Val);
+ }
+ return ConstantInt::getAllOnesValue(Ty);
}
+ return 0;
}
// Static constructor to create the minimum constant for an integral type...
-static ConstantIntegral *getMinValue(const Type *Ty) {
- switch (Ty->getTypeID()) {
- case Type::BoolTyID: return ConstantBool::getFalse();
- case Type::SByteTyID:
- case Type::ShortTyID:
- case Type::IntTyID:
- case Type::LongTyID: {
- // Calculate 1111111111000000000000
- unsigned TypeBits = Ty->getPrimitiveSize()*8;
- int64_t Val = -1; // All ones
- Val <<= TypeBits-1; // Shift over to the right spot
- return ConstantInt::get(Ty, Val);
- }
-
- case Type::UByteTyID:
- case Type::UShortTyID:
- case Type::UIntTyID:
- case Type::ULongTyID: return ConstantInt::get(Ty, 0);
-
- default: return 0;
+static ConstantIntegral *getMinValue(const Type *Ty, bool isSigned = false) {
+ if (Ty == Type::BoolTy)
+ return ConstantBool::getFalse();
+ if (Ty->isInteger()) {
+ if (isSigned) {
+ // Calculate 1111111111000000000000
+ unsigned TypeBits = Ty->getPrimitiveSize()*8;
+ int64_t Val = -1; // All ones
+ Val <<= TypeBits-1; // Shift over to the right spot
+ return ConstantInt::get(Ty, Val);
+ }
+ return ConstantInt::get(Ty, 0);
}
+ return 0;
}
static ConstantIntegral *Next(ConstantIntegral *CI) {
if (ConstantBool *CB = dyn_cast<ConstantBool>(CI))
return cast<ConstantIntegral>(Result);
}
-static bool LT(ConstantIntegral *A, ConstantIntegral *B) {
- Constant *C = ConstantExpr::getSetLT(A, B);
+static bool LT(ConstantIntegral *A, ConstantIntegral *B, bool isSigned) {
+ Constant *C = ConstantExpr::getICmp(
+ (isSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT), A, B);
assert(isa<ConstantBool>(C) && "Constant folding of integrals not impl??");
return cast<ConstantBool>(C)->getValue();
}
-static bool LTE(ConstantIntegral *A, ConstantIntegral *B) {
- Constant *C = ConstantExpr::getSetLE(A, B);
+static bool LTE(ConstantIntegral *A, ConstantIntegral *B, bool isSigned) {
+ Constant *C = ConstantExpr::getICmp(
+ (isSigned ? ICmpInst::ICMP_SLE : ICmpInst::ICMP_ULE), A, B);
assert(isa<ConstantBool>(C) && "Constant folding of integrals not impl??");
return cast<ConstantBool>(C)->getValue();
}
-static bool GT(ConstantIntegral *A, ConstantIntegral *B) { return LT(B, A); }
+static bool GT(ConstantIntegral *A, ConstantIntegral *B, bool isSigned) {
+ return LT(B, A, isSigned); }
-static ConstantIntegral *Min(ConstantIntegral *A, ConstantIntegral *B) {
- return LT(A, B) ? A : B;
+static ConstantIntegral *Min(ConstantIntegral *A, ConstantIntegral *B,
+ bool isSigned) {
+ return LT(A, B, isSigned) ? A : B;
}
-static ConstantIntegral *Max(ConstantIntegral *A, ConstantIntegral *B) {
- return GT(A, B) ? A : B;
+static ConstantIntegral *Max(ConstantIntegral *A, ConstantIntegral *B,
+ bool isSigned) {
+ return GT(A, B, isSigned) ? A : B;
}
/// Initialize a full (the default) or empty set for the specified type.
/// Initialize a range to hold the single specified value.
///
-ConstantRange::ConstantRange(Constant *V)
- : Lower(cast<ConstantIntegral>(V)), Upper(Next(cast<ConstantIntegral>(V))) {
-}
+ConstantRange::ConstantRange(Constant *V)
+ : Lower(cast<ConstantIntegral>(V)), Upper(Next(cast<ConstantIntegral>(V))) { }
/// Initialize a range of values explicitly... this will assert out if
/// Lower==Upper and Lower != Min or Max for its type (or if the two constants
/// have different types)
///
-ConstantRange::ConstantRange(Constant *L, Constant *U)
+ConstantRange::ConstantRange(Constant *L, Constant *U)
: Lower(cast<ConstantIntegral>(L)), Upper(cast<ConstantIntegral>(U)) {
assert(Lower->getType() == Upper->getType() &&
"Incompatible types for ConstantRange!");
// Make sure that if L & U are equal that they are either Min or Max...
assert((L != U || (L == getMaxValue(L->getType()) ||
- L == getMinValue(L->getType()))) &&
- "Lower == Upper, but they aren't min or max for type!");
+ L == getMinValue(L->getType())))
+ && "Lower == Upper, but they aren't min or max for type!");
}
/// Initialize a set of values that all satisfy the condition with C.
///
-ConstantRange::ConstantRange(unsigned SetCCOpcode, ConstantIntegral *C) {
- switch (SetCCOpcode) {
- default: assert(0 && "Invalid SetCC opcode to ConstantRange ctor!");
- case Instruction::SetEQ: Lower = C; Upper = Next(C); return;
- case Instruction::SetNE: Upper = C; Lower = Next(C); return;
- case Instruction::SetLT:
+ConstantRange::ConstantRange(unsigned short ICmpOpcode, ConstantIntegral *C) {
+ switch (ICmpOpcode) {
+ default: assert(0 && "Invalid ICmp opcode to ConstantRange ctor!");
+ case ICmpInst::ICMP_EQ: Lower = C; Upper = Next(C); return;
+ case ICmpInst::ICMP_NE: Upper = C; Lower = Next(C); return;
+ case ICmpInst::ICMP_ULT:
Lower = getMinValue(C->getType());
Upper = C;
return;
- case Instruction::SetGT:
+ case ICmpInst::ICMP_SLT:
+ Lower = getMinValue(C->getType(), true);
+ Upper = C;
+ return;
+ case ICmpInst::ICMP_UGT:
+ Lower = Next(C);
+ Upper = getMinValue(C->getType()); // Min = Next(Max)
+ return;
+ case ICmpInst::ICMP_SGT:
Lower = Next(C);
- Upper = getMinValue(C->getType()); // Min = Next(Max)
+ Upper = getMinValue(C->getType(), true); // Min = Next(Max)
return;
- case Instruction::SetLE:
+ case ICmpInst::ICMP_ULE:
Lower = getMinValue(C->getType());
Upper = Next(C);
return;
- case Instruction::SetGE:
+ case ICmpInst::ICMP_SLE:
+ Lower = getMinValue(C->getType(), true);
+ Upper = Next(C);
+ return;
+ case ICmpInst::ICMP_UGE:
+ Lower = C;
+ Upper = getMinValue(C->getType()); // Min = Next(Max)
+ return;
+ case ICmpInst::ICMP_SGE:
Lower = C;
- Upper = getMinValue(C->getType()); // Min = Next(Max)
+ Upper = getMinValue(C->getType(), true); // Min = Next(Max)
return;
}
}
/// isWrappedSet - Return true if this set wraps around the top of the range,
/// for example: [100, 8)
///
-bool ConstantRange::isWrappedSet() const {
- return GT(Lower, Upper);
+bool ConstantRange::isWrappedSet(bool isSigned) const {
+ return GT(Lower, Upper, isSigned);
}
-
/// getSingleElement - If this set contains a single element, return it,
/// otherwise return null.
ConstantIntegral *ConstantRange::getSingleElement() const {
/// contains - Return true if the specified value is in the set.
///
-bool ConstantRange::contains(ConstantInt *Val) const {
+bool ConstantRange::contains(ConstantInt *Val, bool isSigned) const {
if (Lower == Upper) {
if (isFullSet()) return true;
return false;
}
- if (!isWrappedSet())
- return LTE(Lower, Val) && LT(Val, Upper);
- return LTE(Lower, Val) || LT(Val, Upper);
+ if (!isWrappedSet(isSigned))
+ return LTE(Lower, Val, isSigned) && LT(Val, Upper, isSigned);
+ return LTE(Lower, Val, isSigned) || LT(Val, Upper, isSigned);
}
-
-
/// subtract - Subtract the specified constant from the endpoints of this
/// constant range.
ConstantRange ConstantRange::subtract(ConstantInt *CI) const {
// it is known that LHS is wrapped and RHS isn't.
//
static ConstantRange intersect1Wrapped(const ConstantRange &LHS,
- const ConstantRange &RHS) {
- assert(LHS.isWrappedSet() && !RHS.isWrappedSet());
+ const ConstantRange &RHS,
+ bool isSigned) {
+ assert(LHS.isWrappedSet(isSigned) && !RHS.isWrappedSet(isSigned));
// Check to see if we overlap on the Left side of RHS...
//
- if (LT(RHS.getLower(), LHS.getUpper())) {
+ if (LT(RHS.getLower(), LHS.getUpper(), isSigned)) {
// We do overlap on the left side of RHS, see if we overlap on the right of
// RHS...
- if (GT(RHS.getUpper(), LHS.getLower())) {
+ if (GT(RHS.getUpper(), LHS.getLower(), isSigned)) {
// Ok, the result overlaps on both the left and right sides. See if the
// resultant interval will be smaller if we wrap or not...
//
// No overlap on the right, just on the left.
return ConstantRange(RHS.getLower(), LHS.getUpper());
}
-
} else {
// We don't overlap on the left side of RHS, see if we overlap on the right
// of RHS...
- if (GT(RHS.getUpper(), LHS.getLower())) {
+ if (GT(RHS.getUpper(), LHS.getLower(), isSigned)) {
// Simple overlap...
return ConstantRange(LHS.getLower(), RHS.getUpper());
} else {
/// intersect - Return the range that results from the intersection of this
/// range with another range.
///
-ConstantRange ConstantRange::intersectWith(const ConstantRange &CR) const {
+ConstantRange ConstantRange::intersectWith(const ConstantRange &CR,
+ bool isSigned) const {
assert(getType() == CR.getType() && "ConstantRange types don't agree!");
// Handle common special cases
if (isEmptySet() || CR.isFullSet()) return *this;
if (isFullSet() || CR.isEmptySet()) return CR;
- if (!isWrappedSet()) {
- if (!CR.isWrappedSet()) {
- ConstantIntegral *L = Max(Lower, CR.Lower);
- ConstantIntegral *U = Min(Upper, CR.Upper);
+ if (!isWrappedSet(isSigned)) {
+ if (!CR.isWrappedSet(isSigned)) {
+ ConstantIntegral *L = Max(Lower, CR.Lower, isSigned);
+ ConstantIntegral *U = Min(Upper, CR.Upper, isSigned);
- if (LT(L, U)) // If range isn't empty...
+ if (LT(L, U, isSigned)) // If range isn't empty...
return ConstantRange(L, U);
else
return ConstantRange(getType(), false); // Otherwise, return empty set
} else
- return intersect1Wrapped(CR, *this);
+ return intersect1Wrapped(CR, *this, isSigned);
} else { // We know "this" is wrapped...
- if (!CR.isWrappedSet())
- return intersect1Wrapped(*this, CR);
+ if (!CR.isWrappedSet(isSigned))
+ return intersect1Wrapped(*this, CR, isSigned);
else {
// Both ranges are wrapped...
- ConstantIntegral *L = Max(Lower, CR.Lower);
- ConstantIntegral *U = Min(Upper, CR.Upper);
+ ConstantIntegral *L = Max(Lower, CR.Lower, isSigned);
+ ConstantIntegral *U = Min(Upper, CR.Upper, isSigned);
return ConstantRange(L, U);
}
}
/// 15), which includes 9, 10, and 11, which were not included in either set
/// before.
///
-ConstantRange ConstantRange::unionWith(const ConstantRange &CR) const {
+ConstantRange ConstantRange::unionWith(const ConstantRange &CR,
+ bool isSigned) const {
assert(getType() == CR.getType() && "ConstantRange types don't agree!");
assert(0 && "Range union not implemented yet!");
/// zeroExtend - Return a new range in the specified integer type, which must
/// be strictly larger than the current type. The returned range will
-/// correspond to the possible range of values if the source range had been
+/// correspond to the possible range of values as if the source range had been
/// zero extended.
ConstantRange ConstantRange::zeroExtend(const Type *Ty) const {
assert(getLower()->getType()->getPrimitiveSize() < Ty->getPrimitiveSize() &&
/// truncate - Return a new range in the specified integer type, which must be
/// strictly smaller than the current type. The returned range will
-/// correspond to the possible range of values if the source range had been
+/// correspond to the possible range of values as if the source range had been
/// truncated to the specified type.
ConstantRange ConstantRange::truncate(const Type *Ty) const {
assert(getLower()->getType()->getPrimitiveSize() > Ty->getPrimitiveSize() &&
ConstantExpr::getTrunc(getUpper(), Ty));
}
-
/// print - Print out the bounds to a stream...
///
void ConstantRange::print(std::ostream &OS) const {
std::ostream &printType(std::ostream &Out, const Type *Ty,
const std::string &VariableName = "",
bool IgnoreName = false);
+ std::ostream &printPrimitiveType(std::ostream &Out, const Type *Ty,
+ bool isSigned,
+ const std::string &NameSoFar = "");
void printStructReturnPointerFunctionType(std::ostream &Out,
const PointerType *Ty);
void writeOperandRaw(Value *Operand);
void writeOperandInternal(Value *Operand);
void writeOperandWithCast(Value* Operand, unsigned Opcode);
+ void writeOperandWithCast(Value* Operand, ICmpInst::Predicate predicate);
bool writeInstructionCast(const Instruction &I);
private :
// printed and an extra copy of the expr is not emitted.
//
static bool isInlinableInst(const Instruction &I) {
- // Always inline setcc instructions, even if they are shared by multiple
+ // Always inline cmp instructions, even if they are shared by multiple
// expressions. GCC generates horrible code if we don't.
- if (isa<SetCondInst>(I)) return true;
+ if (isa<CmpInst>(I))
+ return true;
// Must be an expression, must be used exactly once. If it is dead, we
// emit it inline where it would go.
void visitPHINode(PHINode &I);
void visitBinaryOperator(Instruction &I);
+ void visitICmpInst(ICmpInst &I);
+ void visitFCmpInst(FCmpInst &I);
void visitCastInst (CastInst &I);
void visitSelectInst(SelectInst &I);
printType(Out, RetTy, tstr);
}
+std::ostream &
+CWriter::printPrimitiveType(std::ostream &Out, const Type *Ty, bool isSigned,
+ const std::string &NameSoFar) {
+ assert(Ty->isPrimitiveType() && "Invalid type for printPrimitiveType");
+ switch (Ty->getTypeID()) {
+ case Type::VoidTyID: return Out << "void " << NameSoFar;
+ case Type::BoolTyID: return Out << "bool " << NameSoFar;
+ case Type::UByteTyID:
+ case Type::SByteTyID:
+ return Out << (isSigned?"signed":"unsigned") << " char " << NameSoFar;
+ case Type::UShortTyID:
+ case Type::ShortTyID:
+ return Out << (isSigned?"signed":"unsigned") << " short " << NameSoFar;
+ case Type::UIntTyID:
+ case Type::IntTyID:
+ return Out << (isSigned?"signed":"unsigned") << " int " << NameSoFar;
+ case Type::ULongTyID:
+ case Type::LongTyID:
+ return Out << (isSigned?"signed":"unsigned") << " long long " << NameSoFar;
+ case Type::FloatTyID: return Out << "float " << NameSoFar;
+ case Type::DoubleTyID: return Out << "double " << NameSoFar;
+ default :
+ cerr << "Unknown primitive type: " << *Ty << "\n";
+ abort();
+ }
+}
// Pass the Type* and the variable name and this prints out the variable
// declaration.
std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty,
const std::string &NameSoFar,
bool IgnoreName) {
- if (Ty->isPrimitiveType())
- switch (Ty->getTypeID()) {
- case Type::VoidTyID: return Out << "void " << NameSoFar;
- case Type::BoolTyID: return Out << "bool " << NameSoFar;
- case Type::UByteTyID: return Out << "unsigned char " << NameSoFar;
- case Type::SByteTyID: return Out << "signed char " << NameSoFar;
- case Type::UShortTyID: return Out << "unsigned short " << NameSoFar;
- case Type::ShortTyID: return Out << "short " << NameSoFar;
- case Type::UIntTyID: return Out << "unsigned " << NameSoFar;
- case Type::IntTyID: return Out << "int " << NameSoFar;
- case Type::ULongTyID: return Out << "unsigned long long " << NameSoFar;
- case Type::LongTyID: return Out << "signed long long " << NameSoFar;
- case Type::FloatTyID: return Out << "float " << NameSoFar;
- case Type::DoubleTyID: return Out << "double " << NameSoFar;
- default :
- cerr << "Unknown primitive type: " << *Ty << "\n";
- abort();
- }
+ if (Ty->isPrimitiveType()) {
+ // FIXME:Signedness. When integer types are signless, this should just
+ // always pass "false" for the sign of the primitive type. The instructions
+ // will figure out how the value is to be interpreted.
+ printPrimitiveType(Out, Ty, true, NameSoFar);
+ return Out;
+ }
// Check to see if the type is named.
if (!IgnoreName || isa<OpaqueType>(Ty)) {
/// Print out the casting for a cast operation. This does the double casting
/// necessary for conversion to the destination type, if necessary.
-/// @returns true if a closing paren is necessary
/// @brief Print a cast
void CWriter::printCast(unsigned opc, const Type *SrcTy, const Type *DstTy) {
- Out << '(';
- printType(Out, DstTy);
- Out << ')';
+ // Print the destination type cast
switch (opc) {
case Instruction::UIToFP:
+ case Instruction::SIToFP:
+ case Instruction::IntToPtr:
+ case Instruction::Trunc:
+ case Instruction::BitCast:
+ case Instruction::FPExt:
+ case Instruction::FPTrunc: // For these the DstTy sign doesn't matter
+ Out << '(';
+ printType(Out, DstTy);
+ Out << ')';
+ break;
case Instruction::ZExt:
- if (SrcTy->isSigned()) {
- Out << '(';
- printType(Out, SrcTy->getUnsignedVersion());
- Out << ')';
- }
+ case Instruction::PtrToInt:
+ case Instruction::FPToUI: // For these, make sure we get an unsigned dest
+ Out << '(';
+ printPrimitiveType(Out, DstTy, false);
+ Out << ')';
+ break;
+ case Instruction::SExt:
+ case Instruction::FPToSI: // For these, make sure we get a signed dest
+ Out << '(';
+ printPrimitiveType(Out, DstTy, true);
+ Out << ')';
+ break;
+ default:
+ assert(0 && "Invalid cast opcode");
+ }
+
+ // Print the source type cast
+ switch (opc) {
+ case Instruction::UIToFP:
+ case Instruction::ZExt:
+ Out << '(';
+ printPrimitiveType(Out, SrcTy, false);
+ Out << ')';
break;
case Instruction::SIToFP:
case Instruction::SExt:
- if (SrcTy->isUnsigned()) {
- Out << '(';
- printType(Out, SrcTy->getSignedVersion());
- Out << ')';
- }
+ Out << '(';
+ printPrimitiveType(Out, SrcTy, true);
+ Out << ')';
break;
case Instruction::IntToPtr:
case Instruction::PtrToInt:
- // Avoid "cast to pointer from integer of different size" warnings
- Out << "(unsigned long)";
- break;
+ // Avoid "cast to pointer from integer of different size" warnings
+ Out << "(unsigned long)";
+ break;
case Instruction::Trunc:
case Instruction::BitCast:
case Instruction::FPExt:
case Instruction::FPTrunc:
case Instruction::FPToSI:
case Instruction::FPToUI:
+ break; // These don't need a source cast.
default:
+ assert(0 && "Invalid cast opcode");
break;
}
}
case Instruction::And:
case Instruction::Or:
case Instruction::Xor:
- case Instruction::SetEQ:
- case Instruction::SetNE:
- case Instruction::SetLT:
- case Instruction::SetLE:
- case Instruction::SetGT:
- case Instruction::SetGE:
+ case Instruction::ICmp:
+ case Instruction::FCmp:
case Instruction::Shl:
case Instruction::LShr:
case Instruction::AShr:
case Instruction::And: Out << " & "; break;
case Instruction::Or: Out << " | "; break;
case Instruction::Xor: Out << " ^ "; break;
- case Instruction::SetEQ: Out << " == "; break;
- case Instruction::SetNE: Out << " != "; break;
- case Instruction::SetLT: Out << " < "; break;
- case Instruction::SetLE: Out << " <= "; break;
- case Instruction::SetGT: Out << " > "; break;
- case Instruction::SetGE: Out << " >= "; break;
case Instruction::Shl: Out << " << "; break;
case Instruction::LShr:
case Instruction::AShr: Out << " >> "; break;
+ case Instruction::ICmp:
+ switch (CE->getPredicate()) {
+ case ICmpInst::ICMP_EQ: Out << " == "; break;
+ case ICmpInst::ICMP_NE: Out << " != "; break;
+ case ICmpInst::ICMP_SLT:
+ case ICmpInst::ICMP_ULT: Out << " < "; break;
+ case ICmpInst::ICMP_SLE:
+ case ICmpInst::ICMP_ULE: Out << " <= "; break;
+ case ICmpInst::ICMP_SGT:
+ case ICmpInst::ICMP_UGT: Out << " > "; break;
+ case ICmpInst::ICMP_SGE:
+ case ICmpInst::ICMP_UGE: Out << " >= "; break;
+ default: assert(0 && "Illegal ICmp predicate");
+ }
+ break;
+ case Instruction::FCmp:
+ switch (CE->getPredicate()) {
+ case FCmpInst::FCMP_ORD:
+ case FCmpInst::FCMP_UEQ:
+ case FCmpInst::FCMP_OEQ: Out << " == "; break;
+ case FCmpInst::FCMP_UNO:
+ case FCmpInst::FCMP_UNE:
+ case FCmpInst::FCMP_ONE: Out << " != "; break;
+ case FCmpInst::FCMP_OLT:
+ case FCmpInst::FCMP_ULT: Out << " < "; break;
+ case FCmpInst::FCMP_OLE:
+ case FCmpInst::FCMP_ULE: Out << " <= "; break;
+ case FCmpInst::FCMP_OGT:
+ case FCmpInst::FCMP_UGT: Out << " > "; break;
+ case FCmpInst::FCMP_OGE:
+ case FCmpInst::FCMP_UGE: Out << " >= "; break;
+ default: assert(0 && "Illegal FCmp predicate");
+ }
+ break;
default: assert(0 && "Illegal opcode here!");
}
printConstantWithCast(CE->getOperand(1), CE->getOpcode());
}
} else if (isa<UndefValue>(CPV) && CPV->getType()->isFirstClassType()) {
Out << "((";
- printType(Out, CPV->getType());
+ printType(Out, CPV->getType()); // sign doesn't matter
Out << ")/*UNDEF*/0)";
return;
}
Out << (cast<ConstantBool>(CPV)->getValue() ? '1' : '0');
break;
case Type::SByteTyID:
+ case Type::UByteTyID:
+ Out << "((char)" << cast<ConstantInt>(CPV)->getSExtValue() << ")";
+ break;
case Type::ShortTyID:
- Out << cast<ConstantInt>(CPV)->getSExtValue();
+ case Type::UShortTyID:
+ Out << "((short)" << cast<ConstantInt>(CPV)->getSExtValue() << ")";
break;
+ case Type::IntTyID:
+ case Type::UIntTyID:
+ Out << "((int)" << cast<ConstantInt>(CPV)->getSExtValue() << ")";
+ break;
+ case Type::LongTyID:
+ case Type::ULongTyID:
+ Out << "((long long)" << cast<ConstantInt>(CPV)->getSExtValue() << "ll)";
+ break;
+
+#if 0
case Type::IntTyID:
if ((int)cast<ConstantInt>(CPV)->getSExtValue() == (int)0x80000000)
Out << "((int)0x80000000U)"; // Handle MININT specially to avoid warning
case Type::ULongTyID:
Out << cast<ConstantInt>(CPV)->getZExtValue() << "ull";
break;
+#endif
case Type::FloatTyID:
case Type::DoubleTyID: {
case Type::PointerTyID:
if (isa<ConstantPointerNull>(CPV)) {
Out << "((";
- printType(Out, CPV->getType());
+ printType(Out, CPV->getType()); // sign doesn't matter
Out << ")/*NULL*/0)";
break;
} else if (GlobalValue *GV = dyn_cast<GlobalValue>(CPV)) {
bool CWriter::printConstExprCast(const ConstantExpr* CE) {
bool NeedsExplicitCast = false;
const Type *Ty = CE->getOperand(0)->getType();
+ bool TypeIsSigned = false;
switch (CE->getOpcode()) {
case Instruction::LShr:
case Instruction::URem:
- case Instruction::UDiv:
- NeedsExplicitCast = Ty->isSigned(); break;
+ case Instruction::UDiv: NeedsExplicitCast = true; break;
case Instruction::AShr:
case Instruction::SRem:
- case Instruction::SDiv:
- NeedsExplicitCast = Ty->isUnsigned(); break;
- case Instruction::ZExt:
+ case Instruction::SDiv: NeedsExplicitCast = true; TypeIsSigned = true; break;
case Instruction::SExt:
+ Ty = CE->getType();
+ NeedsExplicitCast = true;
+ TypeIsSigned = true;
+ break;
+ case Instruction::ZExt:
case Instruction::Trunc:
case Instruction::FPTrunc:
case Instruction::FPExt:
}
if (NeedsExplicitCast) {
Out << "((";
- printType(Out, Ty);
+ if (Ty->isPrimitiveType())
+ printPrimitiveType(Out, Ty, TypeIsSigned);
+ else
+ printType(Out, Ty);
Out << ")(";
}
return NeedsExplicitCast;
// Indicate whether to do the cast or not.
bool shouldCast = false;
+ bool typeIsSigned = false;
// Based on the Opcode for which this Constant is being written, determine
// the new type to which the operand should be casted by setting the value
case Instruction::LShr:
case Instruction::UDiv:
case Instruction::URem:
- // For UDiv/URem get correct type
- if (OpTy->isSigned()) {
- OpTy = OpTy->getUnsignedVersion();
- shouldCast = true;
- }
+ shouldCast = true;
break;
case Instruction::AShr:
case Instruction::SDiv:
case Instruction::SRem:
- // For SDiv/SRem get correct type
- if (OpTy->isUnsigned()) {
- OpTy = OpTy->getSignedVersion();
- shouldCast = true;
- }
+ shouldCast = true;
+ typeIsSigned = true;
break;
}
// operand.
if (shouldCast) {
Out << "((";
- printType(Out, OpTy);
+ printPrimitiveType(Out, OpTy, typeIsSigned);
Out << ")";
printConstant(CPV);
Out << ")";
} else
- writeOperand(CPV);
-
+ printConstant(CPV);
}
void CWriter::writeOperandInternal(Value *Operand) {
// This function takes care of detecting that case and printing the cast
// for the Instruction.
bool CWriter::writeInstructionCast(const Instruction &I) {
- bool NeedsExplicitCast = false;
const Type *Ty = I.getOperand(0)->getType();
switch (I.getOpcode()) {
case Instruction::LShr:
case Instruction::URem:
case Instruction::UDiv:
- NeedsExplicitCast = Ty->isSigned(); break;
+ Out << "((";
+ printPrimitiveType(Out, Ty, false);
+ Out << ")(";
+ return true;
case Instruction::AShr:
case Instruction::SRem:
case Instruction::SDiv:
- NeedsExplicitCast = Ty->isUnsigned(); break;
- case Instruction::ZExt:
- case Instruction::SExt:
- case Instruction::Trunc:
- case Instruction::FPTrunc:
- case Instruction::FPExt:
- case Instruction::UIToFP:
- case Instruction::SIToFP:
- case Instruction::FPToUI:
- case Instruction::FPToSI:
- case Instruction::PtrToInt:
- case Instruction::IntToPtr:
- case Instruction::BitCast:
- Ty = I.getType();
- NeedsExplicitCast = true;
- break;
- default: break;
- }
- if (NeedsExplicitCast) {
Out << "((";
- printType(Out, Ty);
+ printPrimitiveType(Out, Ty, true);
Out << ")(";
+ return true;
+ default: break;
}
- return NeedsExplicitCast;
+ return false;
}
// Write the operand with a cast to another type based on the Opcode being used.
// Indicate whether to do the cast or not.
bool shouldCast = false;
+ // Indicate whether the cast should be to a signed type or not.
+ bool castIsSigned = false;
+
// Based on the Opcode for which this Operand is being written, determine
// the new type to which the operand should be casted by setting the value
// of OpTy. If we change OpTy, also set shouldCast to true.
break;
case Instruction::LShr:
case Instruction::UDiv:
- case Instruction::URem:
- // For UDiv to have unsigned operands
- if (OpTy->isSigned()) {
- OpTy = OpTy->getUnsignedVersion();
- shouldCast = true;
- }
+ case Instruction::URem: // Cast to unsigned first
+ shouldCast = true;
+ castIsSigned = false;
break;
case Instruction::AShr:
case Instruction::SDiv:
- case Instruction::SRem:
- if (OpTy->isUnsigned()) {
- OpTy = OpTy->getSignedVersion();
- shouldCast = true;
- }
+ case Instruction::SRem: // Cast to signed first
+ shouldCast = true;
+ castIsSigned = true;
break;
}
// operand.
if (shouldCast) {
Out << "((";
- printType(Out, OpTy);
+ printPrimitiveType(Out, OpTy, castIsSigned);
Out << ")";
writeOperand(Operand);
Out << ")";
} else
writeOperand(Operand);
+}
+
+// Write the operand with a cast to another type based on the icmp predicate
+// being used.
+void CWriter::writeOperandWithCast(Value* Operand, ICmpInst::Predicate predicate) {
+
+ // Extract the operand's type, we'll need it.
+ const Type* OpTy = Operand->getType();
+
+ // Indicate whether to do the cast or not.
+ bool shouldCast = false;
+
+ // Indicate whether the cast should be to a signed type or not.
+ bool castIsSigned = false;
+
+ // Based on the Opcode for which this Operand is being written, determine
+ // the new type to which the operand should be casted by setting the value
+ // of OpTy. If we change OpTy, also set shouldCast to true.
+ switch (predicate) {
+ default:
+ // for eq and ne, it doesn't matter
+ break;
+ case ICmpInst::ICMP_UGT:
+ case ICmpInst::ICMP_UGE:
+ case ICmpInst::ICMP_ULT:
+ case ICmpInst::ICMP_ULE:
+ shouldCast = true;
+ break;
+ case ICmpInst::ICMP_SGT:
+ case ICmpInst::ICMP_SGE:
+ case ICmpInst::ICMP_SLT:
+ case ICmpInst::ICMP_SLE:
+ shouldCast = true;
+ castIsSigned = true;
+ break;
+ }
+ // Write out the casted operand if we should, otherwise just write the
+ // operand.
+ if (shouldCast) {
+ Out << "((";
+ if (OpTy->isPrimitiveType())
+ printPrimitiveType(Out, OpTy, castIsSigned);
+ else
+ printType(Out, OpTy);
+ Out << ")";
+ writeOperand(Operand);
+ Out << ")";
+ } else
+ writeOperand(Operand);
}
// generateCompilerSpecificCode - This is where we add conditional compilation
PrintedVar = true;
}
// We need a temporary for the BitCast to use so it can pluck a value out
- // of a uniont to do the BitCast. This is separate from the need for a
+ // of a union to do the BitCast. This is separate from the need for a
// variable to hold the result of the BitCast.
if (isFPIntBitCast(*I)) {
Out << " llvmBitCastUnion " << Mang->getValueName(&*I)
case Instruction::And: Out << " & "; break;
case Instruction::Or: Out << " | "; break;
case Instruction::Xor: Out << " ^ "; break;
- case Instruction::SetEQ: Out << " == "; break;
- case Instruction::SetNE: Out << " != "; break;
- case Instruction::SetLE: Out << " <= "; break;
- case Instruction::SetGE: Out << " >= "; break;
- case Instruction::SetLT: Out << " < "; break;
- case Instruction::SetGT: Out << " > "; break;
case Instruction::Shl : Out << " << "; break;
case Instruction::LShr:
case Instruction::AShr: Out << " >> "; break;
}
}
+void CWriter::visitICmpInst(ICmpInst &I) {
+ // We must cast the results of icmp which might be promoted.
+ bool needsCast = false;
+
+ // Write out the cast of the instruction's value back to the proper type
+ // if necessary.
+ bool NeedsClosingParens = writeInstructionCast(I);
+
+ // Certain icmp predicate require the operand to be forced to a specific type
+ // so we use writeOperandWithCast here instead of writeOperand. Similarly
+ // below for operand 1
+ writeOperandWithCast(I.getOperand(0), I.getPredicate());
+
+ switch (I.getPredicate()) {
+ case ICmpInst::ICMP_EQ: Out << " == "; break;
+ case ICmpInst::ICMP_NE: Out << " != "; break;
+ case ICmpInst::ICMP_ULE:
+ case ICmpInst::ICMP_SLE: Out << " <= "; break;
+ case ICmpInst::ICMP_UGE:
+ case ICmpInst::ICMP_SGE: Out << " >= "; break;
+ case ICmpInst::ICMP_ULT:
+ case ICmpInst::ICMP_SLT: Out << " < "; break;
+ case ICmpInst::ICMP_UGT:
+ case ICmpInst::ICMP_SGT: Out << " > "; break;
+ default: cerr << "Invalid icmp predicate!" << I; abort();
+ }
+
+ writeOperandWithCast(I.getOperand(1), I.getPredicate());
+ if (NeedsClosingParens)
+ Out << "))";
+
+ if (needsCast) {
+ Out << "))";
+ }
+}
+
+void CWriter::visitFCmpInst(FCmpInst &I) {
+ // Write the first operand
+ writeOperand(I.getOperand(0));
+
+ // Write the predicate
+ switch (I.getPredicate()) {
+ case FCmpInst::FCMP_FALSE: Out << " 0 "; break;
+ case FCmpInst::FCMP_ORD:
+ case FCmpInst::FCMP_OEQ:
+ case FCmpInst::FCMP_UEQ: Out << " == "; break;
+ case FCmpInst::FCMP_UNO:
+ case FCmpInst::FCMP_ONE:
+ case FCmpInst::FCMP_UNE: Out << " != "; break;
+ case FCmpInst::FCMP_ULE:
+ case FCmpInst::FCMP_OLE: Out << " <= "; break;
+ case FCmpInst::FCMP_UGE:
+ case FCmpInst::FCMP_OGE: Out << " >= "; break;
+ case FCmpInst::FCMP_ULT:
+ case FCmpInst::FCMP_OLT: Out << " < "; break;
+ case FCmpInst::FCMP_UGT:
+ case FCmpInst::FCMP_OGT: Out << " > "; break;
+ case FCmpInst::FCMP_TRUE: Out << " 1 "; break;
+ default: cerr << "Invalid fcmp predicate!" << I; abort();
+ }
+ // Write the second operand
+ writeOperand(I.getOperand(1));
+}
+
static const char * getFloatBitCastField(const Type *Ty) {
switch (Ty->getTypeID()) {
default: assert(0 && "Invalid Type");
LIBRARYNAME = LLVMCBackend
include $(LEVEL)/Makefile.common
-CompileCommonOpts := $(CompileCommonOpts) -Wno-format
+CompileCommonOpts += -Wno-format
std::ostream &printType(std::ostream &Out, const Type *Ty,
const std::string &VariableName = "",
bool IgnoreName = false);
+ std::ostream &printPrimitiveType(std::ostream &Out, const Type *Ty,
+ bool isSigned,
+ const std::string &NameSoFar = "");
void printStructReturnPointerFunctionType(std::ostream &Out,
const PointerType *Ty);
void writeOperandRaw(Value *Operand);
void writeOperandInternal(Value *Operand);
void writeOperandWithCast(Value* Operand, unsigned Opcode);
+ void writeOperandWithCast(Value* Operand, ICmpInst::Predicate predicate);
bool writeInstructionCast(const Instruction &I);
private :
// printed and an extra copy of the expr is not emitted.
//
static bool isInlinableInst(const Instruction &I) {
- // Always inline setcc instructions, even if they are shared by multiple
+ // Always inline cmp instructions, even if they are shared by multiple
// expressions. GCC generates horrible code if we don't.
- if (isa<SetCondInst>(I)) return true;
+ if (isa<CmpInst>(I))
+ return true;
// Must be an expression, must be used exactly once. If it is dead, we
// emit it inline where it would go.
void visitPHINode(PHINode &I);
void visitBinaryOperator(Instruction &I);
+ void visitICmpInst(ICmpInst &I);
+ void visitFCmpInst(FCmpInst &I);
void visitCastInst (CastInst &I);
void visitSelectInst(SelectInst &I);
printType(Out, RetTy, tstr);
}
+std::ostream &
+CWriter::printPrimitiveType(std::ostream &Out, const Type *Ty, bool isSigned,
+ const std::string &NameSoFar) {
+ assert(Ty->isPrimitiveType() && "Invalid type for printPrimitiveType");
+ switch (Ty->getTypeID()) {
+ case Type::VoidTyID: return Out << "void " << NameSoFar;
+ case Type::BoolTyID: return Out << "bool " << NameSoFar;
+ case Type::UByteTyID:
+ case Type::SByteTyID:
+ return Out << (isSigned?"signed":"unsigned") << " char " << NameSoFar;
+ case Type::UShortTyID:
+ case Type::ShortTyID:
+ return Out << (isSigned?"signed":"unsigned") << " short " << NameSoFar;
+ case Type::UIntTyID:
+ case Type::IntTyID:
+ return Out << (isSigned?"signed":"unsigned") << " int " << NameSoFar;
+ case Type::ULongTyID:
+ case Type::LongTyID:
+ return Out << (isSigned?"signed":"unsigned") << " long long " << NameSoFar;
+ case Type::FloatTyID: return Out << "float " << NameSoFar;
+ case Type::DoubleTyID: return Out << "double " << NameSoFar;
+ default :
+ cerr << "Unknown primitive type: " << *Ty << "\n";
+ abort();
+ }
+}
// Pass the Type* and the variable name and this prints out the variable
// declaration.
std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty,
const std::string &NameSoFar,
bool IgnoreName) {
- if (Ty->isPrimitiveType())
- switch (Ty->getTypeID()) {
- case Type::VoidTyID: return Out << "void " << NameSoFar;
- case Type::BoolTyID: return Out << "bool " << NameSoFar;
- case Type::UByteTyID: return Out << "unsigned char " << NameSoFar;
- case Type::SByteTyID: return Out << "signed char " << NameSoFar;
- case Type::UShortTyID: return Out << "unsigned short " << NameSoFar;
- case Type::ShortTyID: return Out << "short " << NameSoFar;
- case Type::UIntTyID: return Out << "unsigned " << NameSoFar;
- case Type::IntTyID: return Out << "int " << NameSoFar;
- case Type::ULongTyID: return Out << "unsigned long long " << NameSoFar;
- case Type::LongTyID: return Out << "signed long long " << NameSoFar;
- case Type::FloatTyID: return Out << "float " << NameSoFar;
- case Type::DoubleTyID: return Out << "double " << NameSoFar;
- default :
- cerr << "Unknown primitive type: " << *Ty << "\n";
- abort();
- }
+ if (Ty->isPrimitiveType()) {
+ // FIXME:Signedness. When integer types are signless, this should just
+ // always pass "false" for the sign of the primitive type. The instructions
+ // will figure out how the value is to be interpreted.
+ printPrimitiveType(Out, Ty, true, NameSoFar);
+ return Out;
+ }
// Check to see if the type is named.
if (!IgnoreName || isa<OpaqueType>(Ty)) {
/// Print out the casting for a cast operation. This does the double casting
/// necessary for conversion to the destination type, if necessary.
-/// @returns true if a closing paren is necessary
/// @brief Print a cast
void CWriter::printCast(unsigned opc, const Type *SrcTy, const Type *DstTy) {
- Out << '(';
- printType(Out, DstTy);
- Out << ')';
+ // Print the destination type cast
switch (opc) {
case Instruction::UIToFP:
+ case Instruction::SIToFP:
+ case Instruction::IntToPtr:
+ case Instruction::Trunc:
+ case Instruction::BitCast:
+ case Instruction::FPExt:
+ case Instruction::FPTrunc: // For these the DstTy sign doesn't matter
+ Out << '(';
+ printType(Out, DstTy);
+ Out << ')';
+ break;
case Instruction::ZExt:
- if (SrcTy->isSigned()) {
- Out << '(';
- printType(Out, SrcTy->getUnsignedVersion());
- Out << ')';
- }
+ case Instruction::PtrToInt:
+ case Instruction::FPToUI: // For these, make sure we get an unsigned dest
+ Out << '(';
+ printPrimitiveType(Out, DstTy, false);
+ Out << ')';
+ break;
+ case Instruction::SExt:
+ case Instruction::FPToSI: // For these, make sure we get a signed dest
+ Out << '(';
+ printPrimitiveType(Out, DstTy, true);
+ Out << ')';
+ break;
+ default:
+ assert(0 && "Invalid cast opcode");
+ }
+
+ // Print the source type cast
+ switch (opc) {
+ case Instruction::UIToFP:
+ case Instruction::ZExt:
+ Out << '(';
+ printPrimitiveType(Out, SrcTy, false);
+ Out << ')';
break;
case Instruction::SIToFP:
case Instruction::SExt:
- if (SrcTy->isUnsigned()) {
- Out << '(';
- printType(Out, SrcTy->getSignedVersion());
- Out << ')';
- }
+ Out << '(';
+ printPrimitiveType(Out, SrcTy, true);
+ Out << ')';
break;
case Instruction::IntToPtr:
case Instruction::PtrToInt:
- // Avoid "cast to pointer from integer of different size" warnings
- Out << "(unsigned long)";
- break;
+ // Avoid "cast to pointer from integer of different size" warnings
+ Out << "(unsigned long)";
+ break;
case Instruction::Trunc:
case Instruction::BitCast:
case Instruction::FPExt:
case Instruction::FPTrunc:
case Instruction::FPToSI:
case Instruction::FPToUI:
+ break; // These don't need a source cast.
default:
+ assert(0 && "Invalid cast opcode");
break;
}
}
case Instruction::And:
case Instruction::Or:
case Instruction::Xor:
- case Instruction::SetEQ:
- case Instruction::SetNE:
- case Instruction::SetLT:
- case Instruction::SetLE:
- case Instruction::SetGT:
- case Instruction::SetGE:
+ case Instruction::ICmp:
+ case Instruction::FCmp:
case Instruction::Shl:
case Instruction::LShr:
case Instruction::AShr:
case Instruction::And: Out << " & "; break;
case Instruction::Or: Out << " | "; break;
case Instruction::Xor: Out << " ^ "; break;
- case Instruction::SetEQ: Out << " == "; break;
- case Instruction::SetNE: Out << " != "; break;
- case Instruction::SetLT: Out << " < "; break;
- case Instruction::SetLE: Out << " <= "; break;
- case Instruction::SetGT: Out << " > "; break;
- case Instruction::SetGE: Out << " >= "; break;
case Instruction::Shl: Out << " << "; break;
case Instruction::LShr:
case Instruction::AShr: Out << " >> "; break;
+ case Instruction::ICmp:
+ switch (CE->getPredicate()) {
+ case ICmpInst::ICMP_EQ: Out << " == "; break;
+ case ICmpInst::ICMP_NE: Out << " != "; break;
+ case ICmpInst::ICMP_SLT:
+ case ICmpInst::ICMP_ULT: Out << " < "; break;
+ case ICmpInst::ICMP_SLE:
+ case ICmpInst::ICMP_ULE: Out << " <= "; break;
+ case ICmpInst::ICMP_SGT:
+ case ICmpInst::ICMP_UGT: Out << " > "; break;
+ case ICmpInst::ICMP_SGE:
+ case ICmpInst::ICMP_UGE: Out << " >= "; break;
+ default: assert(0 && "Illegal ICmp predicate");
+ }
+ break;
+ case Instruction::FCmp:
+ switch (CE->getPredicate()) {
+ case FCmpInst::FCMP_ORD:
+ case FCmpInst::FCMP_UEQ:
+ case FCmpInst::FCMP_OEQ: Out << " == "; break;
+ case FCmpInst::FCMP_UNO:
+ case FCmpInst::FCMP_UNE:
+ case FCmpInst::FCMP_ONE: Out << " != "; break;
+ case FCmpInst::FCMP_OLT:
+ case FCmpInst::FCMP_ULT: Out << " < "; break;
+ case FCmpInst::FCMP_OLE:
+ case FCmpInst::FCMP_ULE: Out << " <= "; break;
+ case FCmpInst::FCMP_OGT:
+ case FCmpInst::FCMP_UGT: Out << " > "; break;
+ case FCmpInst::FCMP_OGE:
+ case FCmpInst::FCMP_UGE: Out << " >= "; break;
+ default: assert(0 && "Illegal FCmp predicate");
+ }
+ break;
default: assert(0 && "Illegal opcode here!");
}
printConstantWithCast(CE->getOperand(1), CE->getOpcode());
}
} else if (isa<UndefValue>(CPV) && CPV->getType()->isFirstClassType()) {
Out << "((";
- printType(Out, CPV->getType());
+ printType(Out, CPV->getType()); // sign doesn't matter
Out << ")/*UNDEF*/0)";
return;
}
Out << (cast<ConstantBool>(CPV)->getValue() ? '1' : '0');
break;
case Type::SByteTyID:
+ case Type::UByteTyID:
+ Out << "((char)" << cast<ConstantInt>(CPV)->getSExtValue() << ")";
+ break;
case Type::ShortTyID:
- Out << cast<ConstantInt>(CPV)->getSExtValue();
+ case Type::UShortTyID:
+ Out << "((short)" << cast<ConstantInt>(CPV)->getSExtValue() << ")";
break;
+ case Type::IntTyID:
+ case Type::UIntTyID:
+ Out << "((int)" << cast<ConstantInt>(CPV)->getSExtValue() << ")";
+ break;
+ case Type::LongTyID:
+ case Type::ULongTyID:
+ Out << "((long long)" << cast<ConstantInt>(CPV)->getSExtValue() << "ll)";
+ break;
+
+#if 0
case Type::IntTyID:
if ((int)cast<ConstantInt>(CPV)->getSExtValue() == (int)0x80000000)
Out << "((int)0x80000000U)"; // Handle MININT specially to avoid warning
case Type::ULongTyID:
Out << cast<ConstantInt>(CPV)->getZExtValue() << "ull";
break;
+#endif
case Type::FloatTyID:
case Type::DoubleTyID: {
case Type::PointerTyID:
if (isa<ConstantPointerNull>(CPV)) {
Out << "((";
- printType(Out, CPV->getType());
+ printType(Out, CPV->getType()); // sign doesn't matter
Out << ")/*NULL*/0)";
break;
} else if (GlobalValue *GV = dyn_cast<GlobalValue>(CPV)) {
bool CWriter::printConstExprCast(const ConstantExpr* CE) {
bool NeedsExplicitCast = false;
const Type *Ty = CE->getOperand(0)->getType();
+ bool TypeIsSigned = false;
switch (CE->getOpcode()) {
case Instruction::LShr:
case Instruction::URem:
- case Instruction::UDiv:
- NeedsExplicitCast = Ty->isSigned(); break;
+ case Instruction::UDiv: NeedsExplicitCast = true; break;
case Instruction::AShr:
case Instruction::SRem:
- case Instruction::SDiv:
- NeedsExplicitCast = Ty->isUnsigned(); break;
- case Instruction::ZExt:
+ case Instruction::SDiv: NeedsExplicitCast = true; TypeIsSigned = true; break;
case Instruction::SExt:
+ Ty = CE->getType();
+ NeedsExplicitCast = true;
+ TypeIsSigned = true;
+ break;
+ case Instruction::ZExt:
case Instruction::Trunc:
case Instruction::FPTrunc:
case Instruction::FPExt:
}
if (NeedsExplicitCast) {
Out << "((";
- printType(Out, Ty);
+ if (Ty->isPrimitiveType())
+ printPrimitiveType(Out, Ty, TypeIsSigned);
+ else
+ printType(Out, Ty);
Out << ")(";
}
return NeedsExplicitCast;
// Indicate whether to do the cast or not.
bool shouldCast = false;
+ bool typeIsSigned = false;
// Based on the Opcode for which this Constant is being written, determine
// the new type to which the operand should be casted by setting the value
case Instruction::LShr:
case Instruction::UDiv:
case Instruction::URem:
- // For UDiv/URem get correct type
- if (OpTy->isSigned()) {
- OpTy = OpTy->getUnsignedVersion();
- shouldCast = true;
- }
+ shouldCast = true;
break;
case Instruction::AShr:
case Instruction::SDiv:
case Instruction::SRem:
- // For SDiv/SRem get correct type
- if (OpTy->isUnsigned()) {
- OpTy = OpTy->getSignedVersion();
- shouldCast = true;
- }
+ shouldCast = true;
+ typeIsSigned = true;
break;
}
// operand.
if (shouldCast) {
Out << "((";
- printType(Out, OpTy);
+ printPrimitiveType(Out, OpTy, typeIsSigned);
Out << ")";
printConstant(CPV);
Out << ")";
} else
- writeOperand(CPV);
-
+ printConstant(CPV);
}
void CWriter::writeOperandInternal(Value *Operand) {
// This function takes care of detecting that case and printing the cast
// for the Instruction.
bool CWriter::writeInstructionCast(const Instruction &I) {
- bool NeedsExplicitCast = false;
const Type *Ty = I.getOperand(0)->getType();
switch (I.getOpcode()) {
case Instruction::LShr:
case Instruction::URem:
case Instruction::UDiv:
- NeedsExplicitCast = Ty->isSigned(); break;
+ Out << "((";
+ printPrimitiveType(Out, Ty, false);
+ Out << ")(";
+ return true;
case Instruction::AShr:
case Instruction::SRem:
case Instruction::SDiv:
- NeedsExplicitCast = Ty->isUnsigned(); break;
- case Instruction::ZExt:
- case Instruction::SExt:
- case Instruction::Trunc:
- case Instruction::FPTrunc:
- case Instruction::FPExt:
- case Instruction::UIToFP:
- case Instruction::SIToFP:
- case Instruction::FPToUI:
- case Instruction::FPToSI:
- case Instruction::PtrToInt:
- case Instruction::IntToPtr:
- case Instruction::BitCast:
- Ty = I.getType();
- NeedsExplicitCast = true;
- break;
- default: break;
- }
- if (NeedsExplicitCast) {
Out << "((";
- printType(Out, Ty);
+ printPrimitiveType(Out, Ty, true);
Out << ")(";
+ return true;
+ default: break;
}
- return NeedsExplicitCast;
+ return false;
}
// Write the operand with a cast to another type based on the Opcode being used.
// Indicate whether to do the cast or not.
bool shouldCast = false;
+ // Indicate whether the cast should be to a signed type or not.
+ bool castIsSigned = false;
+
// Based on the Opcode for which this Operand is being written, determine
// the new type to which the operand should be casted by setting the value
// of OpTy. If we change OpTy, also set shouldCast to true.
break;
case Instruction::LShr:
case Instruction::UDiv:
- case Instruction::URem:
- // For UDiv to have unsigned operands
- if (OpTy->isSigned()) {
- OpTy = OpTy->getUnsignedVersion();
- shouldCast = true;
- }
+ case Instruction::URem: // Cast to unsigned first
+ shouldCast = true;
+ castIsSigned = false;
break;
case Instruction::AShr:
case Instruction::SDiv:
- case Instruction::SRem:
- if (OpTy->isUnsigned()) {
- OpTy = OpTy->getSignedVersion();
- shouldCast = true;
- }
+ case Instruction::SRem: // Cast to signed first
+ shouldCast = true;
+ castIsSigned = true;
break;
}
// operand.
if (shouldCast) {
Out << "((";
- printType(Out, OpTy);
+ printPrimitiveType(Out, OpTy, castIsSigned);
Out << ")";
writeOperand(Operand);
Out << ")";
} else
writeOperand(Operand);
+}
+
+// Write the operand with a cast to another type based on the icmp predicate
+// being used.
+void CWriter::writeOperandWithCast(Value* Operand, ICmpInst::Predicate predicate) {
+
+ // Extract the operand's type, we'll need it.
+ const Type* OpTy = Operand->getType();
+
+ // Indicate whether to do the cast or not.
+ bool shouldCast = false;
+
+ // Indicate whether the cast should be to a signed type or not.
+ bool castIsSigned = false;
+
+ // Based on the Opcode for which this Operand is being written, determine
+ // the new type to which the operand should be casted by setting the value
+ // of OpTy. If we change OpTy, also set shouldCast to true.
+ switch (predicate) {
+ default:
+ // for eq and ne, it doesn't matter
+ break;
+ case ICmpInst::ICMP_UGT:
+ case ICmpInst::ICMP_UGE:
+ case ICmpInst::ICMP_ULT:
+ case ICmpInst::ICMP_ULE:
+ shouldCast = true;
+ break;
+ case ICmpInst::ICMP_SGT:
+ case ICmpInst::ICMP_SGE:
+ case ICmpInst::ICMP_SLT:
+ case ICmpInst::ICMP_SLE:
+ shouldCast = true;
+ castIsSigned = true;
+ break;
+ }
+ // Write out the casted operand if we should, otherwise just write the
+ // operand.
+ if (shouldCast) {
+ Out << "((";
+ if (OpTy->isPrimitiveType())
+ printPrimitiveType(Out, OpTy, castIsSigned);
+ else
+ printType(Out, OpTy);
+ Out << ")";
+ writeOperand(Operand);
+ Out << ")";
+ } else
+ writeOperand(Operand);
}
// generateCompilerSpecificCode - This is where we add conditional compilation
PrintedVar = true;
}
// We need a temporary for the BitCast to use so it can pluck a value out
- // of a uniont to do the BitCast. This is separate from the need for a
+ // of a union to do the BitCast. This is separate from the need for a
// variable to hold the result of the BitCast.
if (isFPIntBitCast(*I)) {
Out << " llvmBitCastUnion " << Mang->getValueName(&*I)
case Instruction::And: Out << " & "; break;
case Instruction::Or: Out << " | "; break;
case Instruction::Xor: Out << " ^ "; break;
- case Instruction::SetEQ: Out << " == "; break;
- case Instruction::SetNE: Out << " != "; break;
- case Instruction::SetLE: Out << " <= "; break;
- case Instruction::SetGE: Out << " >= "; break;
- case Instruction::SetLT: Out << " < "; break;
- case Instruction::SetGT: Out << " > "; break;
case Instruction::Shl : Out << " << "; break;
case Instruction::LShr:
case Instruction::AShr: Out << " >> "; break;
}
}
+void CWriter::visitICmpInst(ICmpInst &I) {
+ // We must cast the results of icmp which might be promoted.
+ bool needsCast = false;
+
+ // Write out the cast of the instruction's value back to the proper type
+ // if necessary.
+ bool NeedsClosingParens = writeInstructionCast(I);
+
+ // Certain icmp predicate require the operand to be forced to a specific type
+ // so we use writeOperandWithCast here instead of writeOperand. Similarly
+ // below for operand 1
+ writeOperandWithCast(I.getOperand(0), I.getPredicate());
+
+ switch (I.getPredicate()) {
+ case ICmpInst::ICMP_EQ: Out << " == "; break;
+ case ICmpInst::ICMP_NE: Out << " != "; break;
+ case ICmpInst::ICMP_ULE:
+ case ICmpInst::ICMP_SLE: Out << " <= "; break;
+ case ICmpInst::ICMP_UGE:
+ case ICmpInst::ICMP_SGE: Out << " >= "; break;
+ case ICmpInst::ICMP_ULT:
+ case ICmpInst::ICMP_SLT: Out << " < "; break;
+ case ICmpInst::ICMP_UGT:
+ case ICmpInst::ICMP_SGT: Out << " > "; break;
+ default: cerr << "Invalid icmp predicate!" << I; abort();
+ }
+
+ writeOperandWithCast(I.getOperand(1), I.getPredicate());
+ if (NeedsClosingParens)
+ Out << "))";
+
+ if (needsCast) {
+ Out << "))";
+ }
+}
+
+void CWriter::visitFCmpInst(FCmpInst &I) {
+ // Write the first operand
+ writeOperand(I.getOperand(0));
+
+ // Write the predicate
+ switch (I.getPredicate()) {
+ case FCmpInst::FCMP_FALSE: Out << " 0 "; break;
+ case FCmpInst::FCMP_ORD:
+ case FCmpInst::FCMP_OEQ:
+ case FCmpInst::FCMP_UEQ: Out << " == "; break;
+ case FCmpInst::FCMP_UNO:
+ case FCmpInst::FCMP_ONE:
+ case FCmpInst::FCMP_UNE: Out << " != "; break;
+ case FCmpInst::FCMP_ULE:
+ case FCmpInst::FCMP_OLE: Out << " <= "; break;
+ case FCmpInst::FCMP_UGE:
+ case FCmpInst::FCMP_OGE: Out << " >= "; break;
+ case FCmpInst::FCMP_ULT:
+ case FCmpInst::FCMP_OLT: Out << " < "; break;
+ case FCmpInst::FCMP_UGT:
+ case FCmpInst::FCMP_OGT: Out << " > "; break;
+ case FCmpInst::FCMP_TRUE: Out << " 1 "; break;
+ default: cerr << "Invalid fcmp predicate!" << I; abort();
+ }
+ // Write the second operand
+ writeOperand(I.getOperand(1));
+}
+
static const char * getFloatBitCastField(const Type *Ty) {
switch (Ty->getTypeID()) {
default: assert(0 && "Invalid Type");
//===---------------------------------------------------------------------===//
-instcombine should handle this transform:
- setcc (sdiv X / C1 ), C2
+ icmp pred (sdiv X / C1 ), C2
when X, C1, and C2 are unsigned. Similarly for udiv and signed operands.
Currently InstCombine avoids this transform but will do it when the signs of
return ValueConvertibleToType(I, Ty, CTMap, TD) &&
ExpressionConvertibleToType(OtherOp, Ty, CTMap, TD);
}
- case Instruction::SetEQ:
- case Instruction::SetNE: {
- Value *OtherOp = I->getOperand((V == I->getOperand(0)) ? 1 : 0);
- return ExpressionConvertibleToType(OtherOp, Ty, CTMap, TD);
+ case Instruction::ICmp: {
+ if (cast<ICmpInst>(I)->getPredicate() == ICmpInst::ICMP_EQ ||
+ cast<ICmpInst>(I)->getPredicate() == ICmpInst::ICMP_NE) {
+ Value *OtherOp = I->getOperand((V == I->getOperand(0)) ? 1 : 0);
+ return ExpressionConvertibleToType(OtherOp, Ty, CTMap, TD);
+ }
+ return false;
}
case Instruction::LShr:
case Instruction::AShr:
}
case Instruction::Add:
- case Instruction::Sub:
- case Instruction::SetEQ:
- case Instruction::SetNE: {
+ case Instruction::Sub: {
Res = BinaryOperator::create(cast<BinaryOperator>(I)->getOpcode(),
Dummy, Dummy, Name);
VMC.ExprMap[I] = Res; // Add node to expression eagerly
Res->setOperand(OtherIdx, NewOther);
break;
}
+ case Instruction::ICmp: {
+ ICmpInst::Predicate pred = cast<ICmpInst>(I)->getPredicate();
+ if (pred == ICmpInst::ICMP_EQ || pred == ICmpInst::ICMP_NE) {
+ Res = new ICmpInst(pred, Dummy, Dummy, Name);
+ VMC.ExprMap[I] = Res; // Add node to expression eagerly
+ unsigned OtherIdx = (OldVal == I->getOperand(0)) ? 1 : 0;
+ Value *OtherOp = I->getOperand(OtherIdx);
+ Res->setOperand(!OtherIdx, NewVal);
+ Value *NewOther = ConvertExpressionToType(OtherOp, NewTy, VMC, TD);
+ Res->setOperand(OtherIdx, NewOther);
+ }
+ break;
+ }
case Instruction::Shl:
case Instruction::LShr:
case Instruction::AShr:
if (AnalyzeGlobal(I, GS, PHIUsers)) return true;
GS.isNotSuitableForSRA = true;
GS.HasPHIUser = true;
- } else if (isa<SetCondInst>(I)) {
+ } else if (isa<CmpInst>(I)) {
GS.isNotSuitableForSRA = true;
} else if (isa<MemCpyInst>(I) || isa<MemMoveInst>(I)) {
if (I->getOperand(1) == V)
if (!AllUsesOfValueWillTrapIfNull(CI)) return false;
} else if (GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(*UI)) {
if (!AllUsesOfValueWillTrapIfNull(GEPI)) return false;
- } else if (isa<SetCondInst>(*UI) &&
+ } else if (isa<ICmpInst>(*UI) &&
isa<ConstantPointerNull>(UI->getOperand(1))) {
// Ignore setcc X, null
} else {
if (LoadInst *LI = dyn_cast<LoadInst>(GV->use_back())) {
while (!LI->use_empty()) {
Use &LoadUse = LI->use_begin().getUse();
- if (!isa<SetCondInst>(LoadUse.getUser()))
+ if (!isa<ICmpInst>(LoadUse.getUser()))
LoadUse = RepValue;
else {
- // Replace the setcc X, 0 with a use of the bool value.
- SetCondInst *SCI = cast<SetCondInst>(LoadUse.getUser());
- Value *LV = new LoadInst(InitBool, InitBool->getName()+".val", SCI);
+ ICmpInst *CI = cast<ICmpInst>(LoadUse.getUser());
+ // Replace the cmp X, 0 with a use of the bool value.
+ Value *LV = new LoadInst(InitBool, InitBool->getName()+".val", CI);
InitBoolUsed = true;
- switch (SCI->getOpcode()) {
- default: assert(0 && "Unknown opcode!");
- case Instruction::SetLT:
+ switch (CI->getPredicate()) {
+ default: assert(0 && "Unknown ICmp Predicate!");
+ case ICmpInst::ICMP_ULT:
+ case ICmpInst::ICMP_SLT:
LV = ConstantBool::getFalse(); // X < null -> always false
break;
- case Instruction::SetEQ:
- case Instruction::SetLE:
- LV = BinaryOperator::createNot(LV, "notinit", SCI);
+ case ICmpInst::ICMP_ULE:
+ case ICmpInst::ICMP_SLE:
+ case ICmpInst::ICMP_EQ:
+ LV = BinaryOperator::createNot(LV, "notinit", CI);
break;
- case Instruction::SetNE:
- case Instruction::SetGE:
- case Instruction::SetGT:
+ case ICmpInst::ICMP_NE:
+ case ICmpInst::ICMP_UGE:
+ case ICmpInst::ICMP_SGE:
+ case ICmpInst::ICMP_UGT:
+ case ICmpInst::ICMP_SGT:
break; // no change.
}
- SCI->replaceAllUsesWith(LV);
- SCI->eraseFromParent();
+ CI->replaceAllUsesWith(LV);
+ CI->eraseFromParent();
}
}
LI->eraseFromParent();
static bool ValueIsOnlyUsedLocallyOrStoredToOneGlobal(Instruction *V,
GlobalVariable *GV) {
for (Value::use_iterator UI = V->use_begin(), E = V->use_end(); UI != E;++UI)
- if (isa<LoadInst>(*UI) || isa<SetCondInst>(*UI)) {
+ if (isa<LoadInst>(*UI) || isa<CmpInst>(*UI)) {
// Fine, ignore.
} else if (StoreInst *SI = dyn_cast<StoreInst>(*UI)) {
if (SI->getOperand(0) == V && SI->getOperand(1) != GV)
for (Value::use_iterator UI = LI->use_begin(), E = LI->use_end(); UI != E;
++UI) {
// Comparison against null is ok.
- if (SetCondInst *SCI = dyn_cast<SetCondInst>(*UI)) {
- if (!isa<ConstantPointerNull>(SCI->getOperand(1)))
+ if (ICmpInst *ICI = dyn_cast<ICmpInst>(*UI)) {
+ if (!isa<ConstantPointerNull>(ICI->getOperand(1)))
return false;
continue;
}
Instruction *User = Ptr->use_back();
// If this is a comparison against null, handle it.
- if (SetCondInst *SCI = dyn_cast<SetCondInst>(User)) {
+ if (ICmpInst *SCI = dyn_cast<ICmpInst>(User)) {
assert(isa<ConstantPointerNull>(SCI->getOperand(1)));
// If we have a setcc of the loaded pointer, we can use a setcc of any
// field.
NPtr = InsertedLoadsForPtr.back();
}
- Value *New = new SetCondInst(SCI->getOpcode(), NPtr,
- Constant::getNullValue(NPtr->getType()),
- SCI->getName(), SCI);
+ Value *New = new ICmpInst(SCI->getPredicate(), NPtr,
+ Constant::getNullValue(NPtr->getType()),
+ SCI->getName(), SCI);
SCI->replaceAllUsesWith(New);
SCI->eraseFromParent();
continue;
// }
Value *RunningOr = 0;
for (unsigned i = 0, e = FieldMallocs.size(); i != e; ++i) {
- Value *Cond = new SetCondInst(Instruction::SetEQ, FieldMallocs[i],
+ Value *Cond = new ICmpInst(ICmpInst::ICMP_EQ, FieldMallocs[i],
Constant::getNullValue(FieldMallocs[i]->getType()),
"isnull", MI);
if (!RunningOr)
// pointer, because some may be null while others are not.
for (unsigned i = 0, e = FieldGlobals.size(); i != e; ++i) {
Value *GVVal = new LoadInst(FieldGlobals[i], "tmp", NullPtrBlock);
- Value *Cmp = new SetCondInst(Instruction::SetNE, GVVal,
- Constant::getNullValue(GVVal->getType()),
- "tmp", NullPtrBlock);
+ Value *Cmp = new ICmpInst(ICmpInst::ICMP_NE, GVVal,
+ Constant::getNullValue(GVVal->getType()),
+ "tmp", NullPtrBlock);
BasicBlock *FreeBlock = new BasicBlock("free_it", OrigBB->getParent());
BasicBlock *NextBlock = new BasicBlock("next", OrigBB->getParent());
new BranchInst(FreeBlock, NextBlock, Cmp, NullPtrBlock);
InstResult = ConstantExpr::get(SI->getOpcode(),
getVal(Values, SI->getOperand(0)),
getVal(Values, SI->getOperand(1)));
+ } else if (CmpInst *CI = dyn_cast<CmpInst>(CurInst)) {
+ InstResult = ConstantExpr::getCompare(CI->getPredicate(),
+ getVal(Values, CI->getOperand(0)),
+ getVal(Values, CI->getOperand(1)));
} else if (CastInst *CI = dyn_cast<CastInst>(CurInst)) {
InstResult = ConstantExpr::getCast(CI->getOpcode(),
getVal(Values, CI->getOperand(0)),
// Does the call to strlen have exactly one use?
if (ci->hasOneUse())
- // Is that single use a binary operator?
- if (BinaryOperator* bop = dyn_cast<BinaryOperator>(ci->use_back()))
+ // Is that single use a icmp operator?
+ if (ICmpInst* bop = dyn_cast<ICmpInst>(ci->use_back()))
// Is it compared against a constant integer?
if (ConstantInt* CI = dyn_cast<ConstantInt>(bop->getOperand(1)))
{
// If its compared against length 0 with == or !=
if (val == 0 &&
- (bop->getOpcode() == Instruction::SetEQ ||
- bop->getOpcode() == Instruction::SetNE))
+ (bop->getPredicate() == ICmpInst::ICMP_EQ ||
+ bop->getPredicate() == ICmpInst::ICMP_NE))
{
// strlen(x) != 0 -> *x != 0
// strlen(x) == 0 -> *x == 0
LoadInst* load = new LoadInst(str,str->getName()+".first",ci);
- BinaryOperator* rbop = BinaryOperator::create(bop->getOpcode(),
- load, ConstantInt::get(Type::SByteTy,0),
- bop->getName()+".strlen", ci);
+ ICmpInst* rbop = new ICmpInst(bop->getPredicate(), load,
+ ConstantInt::get(Type::SByteTy,0),
+ bop->getName()+".strlen", ci);
bop->replaceAllUsesWith(rbop);
bop->eraseFromParent();
ci->eraseFromParent();
for (Value::use_iterator UI = I->use_begin(), E = I->use_end();
UI != E; ++UI) {
Instruction *User = cast<Instruction>(*UI);
- if (User->getOpcode() == Instruction::SetNE ||
- User->getOpcode() == Instruction::SetEQ) {
- if (isa<Constant>(User->getOperand(1)) &&
- cast<Constant>(User->getOperand(1))->isNullValue())
+ if (ICmpInst *IC = dyn_cast<ICmpInst>(User)) {
+ if ((IC->getPredicate() == ICmpInst::ICMP_NE ||
+ IC->getPredicate() == ICmpInst::ICMP_EQ) &&
+ isa<Constant>(IC->getOperand(1)) &&
+ cast<Constant>(IC->getOperand(1))->isNullValue())
continue;
} else if (CastInst *CI = dyn_cast<CastInst>(User))
if (CI->getType() == Type::BoolTy)
BinaryOperator* sub_inst = BinaryOperator::createSub(cast,
ConstantInt::get(Type::UIntTy,0x30),
ci->getOperand(1)->getName()+".sub",ci);
- SetCondInst* setcond_inst = new SetCondInst(Instruction::SetLE,sub_inst,
+ ICmpInst* setcond_inst = new ICmpInst(ICmpInst::ICMP_ULE,sub_inst,
ConstantInt::get(Type::UIntTy,9),
ci->getOperand(1)->getName()+".cmp",ci);
CastInst* c2 = new ZExtInst(setcond_inst, Type::IntTy,
virtual bool OptimizeCall(CallInst *CI, SimplifyLibCalls &SLC) {
// isascii(c) -> (unsigned)c < 128
Value *V = CI->getOperand(1);
- if (V->getType()->isSigned())
- V = new BitCastInst(V, V->getType()->getUnsignedVersion(), V->getName(),
- CI);
- Value *Cmp = BinaryOperator::createSetLT(V, ConstantInt::get(V->getType(),
- 128),
- V->getName()+".isascii", CI);
+ Value *Cmp = new ICmpInst(ICmpInst::ICMP_ULT, V,
+ ConstantInt::get(V->getType(), 128),
+ V->getName()+".isascii", CI);
if (Cmp->getType() != CI->getType())
Cmp = new BitCastInst(Cmp, CI->getType(), Cmp->getName(), CI);
CI->replaceAllUsesWith(Cmp);
"tmp", TheCall);
V2 = BinaryOperator::createAdd(V2, ConstantInt::get(Type::IntTy, 1),
"tmp", TheCall);
- Value *Cond =
- BinaryOperator::createSetEQ(V, Constant::getNullValue(V->getType()),
- "tmp", TheCall);
+ Value *Cond = new ICmpInst(ICmpInst::ICMP_EQ, V,
+ Constant::getNullValue(V->getType()), "tmp",
+ TheCall);
V2 = new SelectInst(Cond, ConstantInt::get(Type::IntTy, 0), V2,
TheCall->getName(), TheCall);
TheCall->replaceAllUsesWith(V2);
//decrement counter
LoadInst* l = new LoadInst(Counter, "counter", t);
- SetCondInst* s = new SetCondInst(Instruction::SetEQ, l,
- ConstantInt::get(T, 0),
- "countercc", t);
+ ICmpInst* s = new ICmpInst(ICmpInst::ICMP_EQ, l, ConstantInt::get(T, 0),
+ "countercc", t);
+
Value* nv = BinaryOperator::createSub(l, ConstantInt::get(T, 1),
"counternew", t);
new StoreInst(nv, Counter, t);
//decrement counter
LoadInst* l = new LoadInst(AI, "counter", t);
- SetCondInst* s = new SetCondInst(Instruction::SetEQ, l,
- ConstantInt::get(T, 0),
- "countercc", t);
+ ICmpInst* s = new ICmpInst(ICmpInst::ICMP_EQ, l, ConstantInt::get(T, 0),
+ "countercc", t);
+
Value* nv = BinaryOperator::createSub(l, ConstantInt::get(T, 1),
"counternew", t);
new StoreInst(nv, AI, t);
BinaryOperator::createAnd(c, ConstantInt::get(Type::ULongTy, rm),
"mrdcc", t);
- SetCondInst* s = new SetCondInst(Instruction::SetEQ, b,
- ConstantInt::get(Type::ULongTy, 0),
- "mrdccc", t);
+ ICmpInst *s = new ICmpInst(ICmpInst::ICMP_EQ, b,
+ ConstantInt::get(Type::ULongTy, 0),
+ "mrdccc", t);
+
t->setCondition(s);
}
return false;
}
-
-
-
bool RPR::DoRaisePass(Function &F) {
bool Changed = false;
for (Function::iterator BB = F.begin(), BBE = F.end(); BB != BBE; ++BB)
#include <algorithm>
using namespace llvm;
-STATISTIC(NumSetCCRemoved, "Number of setcc instruction eliminated");
+STATISTIC(NumCmpRemoved, "Number of cmp instruction eliminated");
STATISTIC(NumOperandsCann, "Number of operands canonicalized");
STATISTIC(BranchRevectors, "Number of branches revectored");
namespace {
class ValueInfo;
class Relation {
- Value *Val; // Relation to what value?
- Instruction::BinaryOps Rel; // SetCC relation, or Add if no information
+ Value *Val; // Relation to what value?
+ unsigned Rel; // SetCC or ICmp relation, or Add if no information
public:
Relation(Value *V) : Val(V), Rel(Instruction::Add) {}
bool operator<(const Relation &R) const { return Val < R.Val; }
Value *getValue() const { return Val; }
- Instruction::BinaryOps getRelation() const { return Rel; }
+ unsigned getRelation() const { return Rel; }
// contradicts - Return true if the relationship specified by the operand
// contradicts already known information.
//
- bool contradicts(Instruction::BinaryOps Rel, const ValueInfo &VI) const;
+ bool contradicts(unsigned Rel, const ValueInfo &VI) const;
// incorporate - Incorporate information in the argument into this relation
// entry. This assumes that the information doesn't contradict itself. If
// any new information is gained, true is returned, otherwise false is
// returned to indicate that nothing was updated.
//
- bool incorporate(Instruction::BinaryOps Rel, ValueInfo &VI);
+ bool incorporate(unsigned Rel, ValueInfo &VI);
// KnownResult - Whether or not this condition determines the result of a
- // setcc in the program. False & True are intentionally 0 & 1 so we can
- // convert to bool by casting after checking for unknown.
+ // setcc or icmp in the program. False & True are intentionally 0 & 1
+ // so we can convert to bool by casting after checking for unknown.
//
enum KnownResult { KnownFalse = 0, KnownTrue = 1, Unknown = 2 };
// the specified relationship is true or false, return that. If we cannot
// determine the result required, return Unknown.
//
- KnownResult getImpliedResult(Instruction::BinaryOps Rel) const;
+ KnownResult getImpliedResult(unsigned Rel) const;
// print - Output this relation to the specified stream
void print(std::ostream &OS) const;
void PropagateBranchInfo(BranchInst *BI);
void PropagateSwitchInfo(SwitchInst *SI);
void PropagateEquality(Value *Op0, Value *Op1, RegionInfo &RI);
- void PropagateRelation(Instruction::BinaryOps Opcode, Value *Op0,
+ void PropagateRelation(unsigned Opcode, Value *Op0,
Value *Op1, RegionInfo &RI);
void UpdateUsersOfValue(Value *V, RegionInfo &RI);
void IncorporateInstruction(Instruction *Inst, RegionInfo &RI);
void ComputeReplacements(RegionInfo &RI);
-
- // getSetCCResult - Given a setcc instruction, determine if the result is
+ // getCmpResult - Given a icmp instruction, determine if the result is
// determined by facts we already know about the region under analysis.
- // Return KnownTrue, KnownFalse, or Unknown based on what we can determine.
- //
- Relation::KnownResult getSetCCResult(SetCondInst *SC, const RegionInfo &RI);
-
+ // Return KnownTrue, KnownFalse, or UnKnown based on what we can determine.
+ Relation::KnownResult getCmpResult(CmpInst *ICI, const RegionInfo &RI);
bool SimplifyBasicBlock(BasicBlock &BB, const RegionInfo &RI);
bool SimplifyInstruction(Instruction *Inst, const RegionInfo &RI);
return false;
// We can only forward the branch over the block if the block ends with a
- // setcc we can determine the outcome for.
+ // cmp we can determine the outcome for.
//
// FIXME: we can make this more generic. Code below already handles more
// generic case.
- SetCondInst *SCI = dyn_cast<SetCondInst>(BI->getCondition());
- if (SCI == 0) return false;
+ if (!isa<CmpInst>(BI->getCondition()))
+ return false;
// Make a new RegionInfo structure so that we can simulate the effect of the
// PHI nodes in the block we are skipping over...
int OpNum = PN->getBasicBlockIndex(BB);
assert(OpNum != -1 && "PHI doesn't have incoming edge for predecessor!?");
PropagateEquality(PN, PN->getIncomingValue(OpNum), NewRI);
- } else if (SetCondInst *SCI = dyn_cast<SetCondInst>(I)) {
- Relation::KnownResult Res = getSetCCResult(SCI, NewRI);
+ } else if (CmpInst *CI = dyn_cast<CmpInst>(I)) {
+ Relation::KnownResult Res = getCmpResult(CI, NewRI);
if (Res == Relation::Unknown) return false;
- PropagateEquality(SCI, ConstantBool::get(Res), NewRI);
+ PropagateEquality(CI, ConstantBool::get(Res), NewRI);
} else {
assert(isa<BranchInst>(*I) && "Unexpected instruction type!");
}
Relation &KnownRelation = VI.getRelation(Op1);
// If we already know they're equal, don't reprocess...
- if (KnownRelation.getRelation() == Instruction::SetEQ)
+ if (KnownRelation.getRelation() == FCmpInst::FCMP_OEQ ||
+ KnownRelation.getRelation() == ICmpInst::ICMP_EQ)
return;
// If this is boolean, check to see if one of the operands is a constant. If
PropagateEquality(BinaryOperator::getNotArgument(BOp),
ConstantBool::get(!CB->getValue()), RI);
- // If we know the value of a SetCC instruction, propagate the information
+ // If we know the value of a FCmp instruction, propagate the information
// about the relation into this region as well.
//
- if (SetCondInst *SCI = dyn_cast<SetCondInst>(Inst)) {
+ if (FCmpInst *FCI = dyn_cast<FCmpInst>(Inst)) {
if (CB->getValue()) { // If we know the condition is true...
// Propagate info about the LHS to the RHS & RHS to LHS
- PropagateRelation(SCI->getOpcode(), SCI->getOperand(0),
- SCI->getOperand(1), RI);
- PropagateRelation(SCI->getSwappedCondition(),
- SCI->getOperand(1), SCI->getOperand(0), RI);
+ PropagateRelation(FCI->getPredicate(), FCI->getOperand(0),
+ FCI->getOperand(1), RI);
+ PropagateRelation(FCI->getSwappedPredicate(),
+ FCI->getOperand(1), FCI->getOperand(0), RI);
} else { // If we know the condition is false...
// We know the opposite of the condition is true...
- Instruction::BinaryOps C = SCI->getInverseCondition();
+ FCmpInst::Predicate C = FCI->getInversePredicate();
- PropagateRelation(C, SCI->getOperand(0), SCI->getOperand(1), RI);
- PropagateRelation(SetCondInst::getSwappedCondition(C),
- SCI->getOperand(1), SCI->getOperand(0), RI);
+ PropagateRelation(C, FCI->getOperand(0), FCI->getOperand(1), RI);
+ PropagateRelation(FCmpInst::getSwappedPredicate(C),
+ FCI->getOperand(1), FCI->getOperand(0), RI);
+ }
+ }
+
+ // If we know the value of a ICmp instruction, propagate the information
+ // about the relation into this region as well.
+ //
+ if (ICmpInst *ICI = dyn_cast<ICmpInst>(Inst)) {
+ if (CB->getValue()) { // If we know the condition is true...
+ // Propagate info about the LHS to the RHS & RHS to LHS
+ PropagateRelation(ICI->getPredicate(), ICI->getOperand(0),
+ ICI->getOperand(1), RI);
+ PropagateRelation(ICI->getSwappedPredicate(), ICI->getOperand(1),
+ ICI->getOperand(1), RI);
+
+ } else { // If we know the condition is false ...
+ // We know the opposite of the condition is true...
+ ICmpInst::Predicate C = ICI->getInversePredicate();
+
+ PropagateRelation(C, ICI->getOperand(0), ICI->getOperand(1), RI);
+ PropagateRelation(ICmpInst::getSwappedPredicate(C),
+ ICI->getOperand(1), ICI->getOperand(0), RI);
}
}
}
}
// Propagate information about Op0 to Op1 & visa versa
- PropagateRelation(Instruction::SetEQ, Op0, Op1, RI);
- PropagateRelation(Instruction::SetEQ, Op1, Op0, RI);
+ PropagateRelation(ICmpInst::ICMP_EQ, Op0, Op1, RI);
+ PropagateRelation(ICmpInst::ICMP_EQ, Op1, Op0, RI);
+ PropagateRelation(FCmpInst::FCMP_OEQ, Op0, Op1, RI);
+ PropagateRelation(FCmpInst::FCMP_OEQ, Op1, Op0, RI);
}
// blocks in the specified region. Propagate the information about Op0 and
// anything derived from it into this region.
//
-void CEE::PropagateRelation(Instruction::BinaryOps Opcode, Value *Op0,
+void CEE::PropagateRelation(unsigned Opcode, Value *Op0,
Value *Op1, RegionInfo &RI) {
assert(Op0->getType() == Op1->getType() && "Equal types expected!");
if (Op1R.contradicts(Opcode, VI)) {
Op1R.contradicts(Opcode, VI);
cerr << "Contradiction found for opcode: "
- << Instruction::getOpcodeName(Opcode) << "\n";
+ << ((isa<ICmpInst>(Op0)||isa<ICmpInst>(Op1)) ?
+ Instruction::getOpcodeName(Instruction::ICmp) :
+ Instruction::getOpcodeName(Opcode))
+ << "\n";
Op1R.print(*cerr.stream());
return;
}
// value produced by this instruction
//
void CEE::IncorporateInstruction(Instruction *Inst, RegionInfo &RI) {
- if (SetCondInst *SCI = dyn_cast<SetCondInst>(Inst)) {
+ if (CmpInst *CI = dyn_cast<CmpInst>(Inst)) {
// See if we can figure out a result for this instruction...
- Relation::KnownResult Result = getSetCCResult(SCI, RI);
+ Relation::KnownResult Result = getCmpResult(CI, RI);
if (Result != Relation::Unknown) {
- PropagateEquality(SCI, ConstantBool::get(Result != 0), RI);
+ PropagateEquality(CI, ConstantBool::get(Result != 0), RI);
}
}
}
// Loop over the relationships known about Op0.
const std::vector<Relation> &Relationships = VI.getRelationships();
for (unsigned i = 0, e = Relationships.size(); i != e; ++i)
- if (Relationships[i].getRelation() == Instruction::SetEQ) {
+ if (Relationships[i].getRelation() == FCmpInst::FCMP_OEQ) {
+ unsigned R = getRank(Relationships[i].getValue());
+ if (R < MinRank) {
+ MinRank = R;
+ Replacement = Relationships[i].getValue();
+ }
+ }
+ else if (Relationships[i].getRelation() == ICmpInst::ICMP_EQ) {
unsigned R = getRank(Relationships[i].getValue());
if (R < MinRank) {
MinRank = R;
// Convert instruction arguments to canonical forms...
Changed |= SimplifyInstruction(Inst, RI);
- if (SetCondInst *SCI = dyn_cast<SetCondInst>(Inst)) {
+ if (CmpInst *CI = dyn_cast<CmpInst>(Inst)) {
// Try to simplify a setcc instruction based on inherited information
- Relation::KnownResult Result = getSetCCResult(SCI, RI);
+ Relation::KnownResult Result = getCmpResult(CI, RI);
if (Result != Relation::Unknown) {
- DOUT << "Replacing setcc with " << Result << " constant: " << *SCI;
+ DEBUG(cerr << "Replacing icmp with " << Result
+ << " constant: " << *CI);
- SCI->replaceAllUsesWith(ConstantBool::get((bool)Result));
+ CI->replaceAllUsesWith(ConstantBool::get((bool)Result));
// The instruction is now dead, remove it from the program.
- SCI->getParent()->getInstList().erase(SCI);
- ++NumSetCCRemoved;
+ CI->getParent()->getInstList().erase(CI);
+ ++NumCmpRemoved;
Changed = true;
}
}
return Changed;
}
-
-// getSetCCResult - Try to simplify a setcc instruction based on information
-// inherited from a dominating setcc instruction. V is one of the operands to
-// the setcc instruction, and VI is the set of information known about it. We
+// getCmpResult - Try to simplify a cmp instruction based on information
+// inherited from a dominating icmp instruction. V is one of the operands to
+// the icmp instruction, and VI is the set of information known about it. We
// take two cases into consideration here. If the comparison is against a
// constant value, we can use the constant range to see if the comparison is
// possible to succeed. If it is not a comparison against a constant, we check
// to see if there is a known relationship between the two values. If so, we
// may be able to eliminate the check.
//
-Relation::KnownResult CEE::getSetCCResult(SetCondInst *SCI,
- const RegionInfo &RI) {
- Value *Op0 = SCI->getOperand(0), *Op1 = SCI->getOperand(1);
- Instruction::BinaryOps Opcode = SCI->getOpcode();
+Relation::KnownResult CEE::getCmpResult(CmpInst *CI,
+ const RegionInfo &RI) {
+ Value *Op0 = CI->getOperand(0), *Op1 = CI->getOperand(1);
+ unsigned short predicate = CI->getPredicate();
if (isa<Constant>(Op0)) {
if (isa<Constant>(Op1)) {
- if (Constant *Result = ConstantFoldInstruction(SCI)) {
- // Wow, this is easy, directly eliminate the SetCondInst.
- DOUT << "Replacing setcc with constant fold: " << *SCI;
+ if (Constant *Result = ConstantFoldInstruction(CI)) {
+ // Wow, this is easy, directly eliminate the ICmpInst.
+ DEBUG(cerr << "Replacing cmp with constant fold: " << *CI);
return cast<ConstantBool>(Result)->getValue()
? Relation::KnownTrue : Relation::KnownFalse;
}
} else {
// We want to swap this instruction so that operand #0 is the constant.
std::swap(Op0, Op1);
- Opcode = SCI->getSwappedCondition();
+ if (isa<ICmpInst>(CI))
+ predicate = cast<ICmpInst>(CI)->getSwappedPredicate();
+ else
+ predicate = cast<FCmpInst>(CI)->getSwappedPredicate();
}
}
// At this point, we know that if we have a constant argument that it is in
// Op1. Check to see if we know anything about comparing value with a
- // constant, and if we can use this info to fold the setcc.
+ // constant, and if we can use this info to fold the icmp.
//
if (ConstantIntegral *C = dyn_cast<ConstantIntegral>(Op1)) {
// Check to see if we already know the result of this comparison...
- ConstantRange R = ConstantRange(Opcode, C);
- ConstantRange Int = R.intersectWith(Op0VI->getBounds());
+ ConstantRange R = ConstantRange(predicate, C);
+ ConstantRange Int = R.intersectWith(Op0VI->getBounds(),
+ ICmpInst::isSignedPredicate(ICmpInst::Predicate(predicate)));
// If the intersection of the two ranges is empty, then the condition
// could never be true!
//
// Do we have value information about Op0 and a relation to Op1?
if (const Relation *Op2R = Op0VI->requestRelation(Op1))
- Result = Op2R->getImpliedResult(Opcode);
+ Result = Op2R->getImpliedResult(predicate);
}
}
return Result;
// contradicts - Return true if the relationship specified by the operand
// contradicts already known information.
//
-bool Relation::contradicts(Instruction::BinaryOps Op,
+bool Relation::contradicts(unsigned Op,
const ValueInfo &VI) const {
assert (Op != Instruction::Add && "Invalid relation argument!");
// does not contradict properties known about the bounds of the constant.
//
if (ConstantIntegral *C = dyn_cast<ConstantIntegral>(Val))
- if (ConstantRange(Op, C).intersectWith(VI.getBounds()).isEmptySet())
- return true;
+ if (Op >= ICmpInst::FIRST_ICMP_PREDICATE &&
+ Op <= ICmpInst::LAST_ICMP_PREDICATE)
+ if (ConstantRange(Op, C).intersectWith(VI.getBounds(),
+ ICmpInst::isSignedPredicate(ICmpInst::Predicate(Op))).isEmptySet())
+ return true;
switch (Rel) {
default: assert(0 && "Unknown Relationship code!");
case Instruction::Add: return false; // Nothing known, nothing contradicts
- case Instruction::SetEQ:
- return Op == Instruction::SetLT || Op == Instruction::SetGT ||
- Op == Instruction::SetNE;
- case Instruction::SetNE: return Op == Instruction::SetEQ;
- case Instruction::SetLE: return Op == Instruction::SetGT;
- case Instruction::SetGE: return Op == Instruction::SetLT;
- case Instruction::SetLT:
- return Op == Instruction::SetEQ || Op == Instruction::SetGT ||
- Op == Instruction::SetGE;
- case Instruction::SetGT:
- return Op == Instruction::SetEQ || Op == Instruction::SetLT ||
- Op == Instruction::SetLE;
+ case ICmpInst::ICMP_EQ:
+ return Op == ICmpInst::ICMP_ULT || Op == ICmpInst::ICMP_SLT ||
+ Op == ICmpInst::ICMP_UGT || Op == ICmpInst::ICMP_SGT ||
+ Op == ICmpInst::ICMP_NE;
+ case ICmpInst::ICMP_NE: return Op == ICmpInst::ICMP_EQ;
+ case ICmpInst::ICMP_ULE:
+ case ICmpInst::ICMP_SLE: return Op == ICmpInst::ICMP_UGT ||
+ Op == ICmpInst::ICMP_SGT;
+ case ICmpInst::ICMP_UGE:
+ case ICmpInst::ICMP_SGE: return Op == ICmpInst::ICMP_ULT ||
+ Op == ICmpInst::ICMP_SLT;
+ case ICmpInst::ICMP_ULT:
+ case ICmpInst::ICMP_SLT:
+ return Op == ICmpInst::ICMP_EQ || Op == ICmpInst::ICMP_UGT ||
+ Op == ICmpInst::ICMP_SGT || Op == ICmpInst::ICMP_UGE ||
+ Op == ICmpInst::ICMP_SGE;
+ case ICmpInst::ICMP_UGT:
+ case ICmpInst::ICMP_SGT:
+ return Op == ICmpInst::ICMP_EQ || Op == ICmpInst::ICMP_ULT ||
+ Op == ICmpInst::ICMP_SLT || Op == ICmpInst::ICMP_ULE ||
+ Op == ICmpInst::ICMP_SLE;
+ case FCmpInst::FCMP_OEQ:
+ return Op == FCmpInst::FCMP_OLT || Op == FCmpInst::FCMP_OGT ||
+ Op == FCmpInst::FCMP_ONE;
+ case FCmpInst::FCMP_ONE: return Op == FCmpInst::FCMP_OEQ;
+ case FCmpInst::FCMP_OLE: return Op == FCmpInst::FCMP_OGT;
+ case FCmpInst::FCMP_OGE: return Op == FCmpInst::FCMP_OLT;
+ case FCmpInst::FCMP_OLT:
+ return Op == FCmpInst::FCMP_OEQ || Op == FCmpInst::FCMP_OGT ||
+ Op == FCmpInst::FCMP_OGE;
+ case FCmpInst::FCMP_OGT:
+ return Op == FCmpInst::FCMP_OEQ || Op == FCmpInst::FCMP_OLT ||
+ Op == FCmpInst::FCMP_OLE;
}
}
// new information is gained, true is returned, otherwise false is returned to
// indicate that nothing was updated.
//
-bool Relation::incorporate(Instruction::BinaryOps Op, ValueInfo &VI) {
+bool Relation::incorporate(unsigned Op, ValueInfo &VI) {
assert(!contradicts(Op, VI) &&
"Cannot incorporate contradictory information!");
// range that is possible for the value to have...
//
if (ConstantIntegral *C = dyn_cast<ConstantIntegral>(Val))
- VI.getBounds() = ConstantRange(Op, C).intersectWith(VI.getBounds());
+ if (Op >= ICmpInst::FIRST_ICMP_PREDICATE &&
+ Op <= ICmpInst::LAST_ICMP_PREDICATE)
+ VI.getBounds() = ConstantRange(Op, C).intersectWith(VI.getBounds(),
+ ICmpInst::isSignedPredicate(ICmpInst::Predicate(Op)));
switch (Rel) {
default: assert(0 && "Unknown prior value!");
case Instruction::Add: Rel = Op; return true;
- case Instruction::SetEQ: return false; // Nothing is more precise
- case Instruction::SetNE: return false; // Nothing is more precise
- case Instruction::SetLT: return false; // Nothing is more precise
- case Instruction::SetGT: return false; // Nothing is more precise
- case Instruction::SetLE:
- if (Op == Instruction::SetEQ || Op == Instruction::SetLT) {
+ case ICmpInst::ICMP_EQ:
+ case ICmpInst::ICMP_NE:
+ case ICmpInst::ICMP_ULT:
+ case ICmpInst::ICMP_SLT:
+ case ICmpInst::ICMP_UGT:
+ case ICmpInst::ICMP_SGT: return false; // Nothing is more precise
+ case ICmpInst::ICMP_ULE:
+ case ICmpInst::ICMP_SLE:
+ if (Op == ICmpInst::ICMP_EQ || Op == ICmpInst::ICMP_ULT ||
+ Op == ICmpInst::ICMP_SLT) {
Rel = Op;
return true;
- } else if (Op == Instruction::SetNE) {
- Rel = Instruction::SetLT;
+ } else if (Op == ICmpInst::ICMP_NE) {
+ Rel = Rel == ICmpInst::ICMP_ULE ? ICmpInst::ICMP_ULT :
+ ICmpInst::ICMP_SLT;
return true;
}
return false;
- case Instruction::SetGE: return Op == Instruction::SetLT;
- if (Op == Instruction::SetEQ || Op == Instruction::SetGT) {
+ case ICmpInst::ICMP_UGE:
+ case ICmpInst::ICMP_SGE:
+ if (Op == ICmpInst::ICMP_EQ || ICmpInst::ICMP_UGT ||
+ Op == ICmpInst::ICMP_SGT) {
Rel = Op;
return true;
- } else if (Op == Instruction::SetNE) {
- Rel = Instruction::SetGT;
+ } else if (Op == ICmpInst::ICMP_NE) {
+ Rel = Rel == ICmpInst::ICMP_UGE ? ICmpInst::ICMP_UGT :
+ ICmpInst::ICMP_SGT;
+ return true;
+ }
+ return false;
+ case FCmpInst::FCMP_OEQ: return false; // Nothing is more precise
+ case FCmpInst::FCMP_ONE: return false; // Nothing is more precise
+ case FCmpInst::FCMP_OLT: return false; // Nothing is more precise
+ case FCmpInst::FCMP_OGT: return false; // Nothing is more precise
+ case FCmpInst::FCMP_OLE:
+ if (Op == FCmpInst::FCMP_OEQ || Op == FCmpInst::FCMP_OLT) {
+ Rel = Op;
+ return true;
+ } else if (Op == FCmpInst::FCMP_ONE) {
+ Rel = FCmpInst::FCMP_OLT;
+ return true;
+ }
+ return false;
+ case FCmpInst::FCMP_OGE:
+ return Op == FCmpInst::FCMP_OLT;
+ if (Op == FCmpInst::FCMP_OEQ || Op == FCmpInst::FCMP_OGT) {
+ Rel = Op;
+ return true;
+ } else if (Op == FCmpInst::FCMP_ONE) {
+ Rel = FCmpInst::FCMP_OGT;
return true;
}
return false;
// determine the result required, return Unknown.
//
Relation::KnownResult
-Relation::getImpliedResult(Instruction::BinaryOps Op) const {
+Relation::getImpliedResult(unsigned Op) const {
if (Rel == Op) return KnownTrue;
- if (Rel == SetCondInst::getInverseCondition(Op)) return KnownFalse;
+ if (Op >= ICmpInst::FIRST_ICMP_PREDICATE &&
+ Op <= ICmpInst::LAST_ICMP_PREDICATE) {
+ if (Rel == unsigned(ICmpInst::getInversePredicate(ICmpInst::Predicate(Op))))
+ return KnownFalse;
+ } else if (Op <= FCmpInst::LAST_FCMP_PREDICATE) {
+ if (Rel == unsigned(FCmpInst::getInversePredicate(FCmpInst::Predicate(Op))))
+ return KnownFalse;
+ }
switch (Rel) {
default: assert(0 && "Unknown prior value!");
- case Instruction::SetEQ:
- if (Op == Instruction::SetLE || Op == Instruction::SetGE) return KnownTrue;
- if (Op == Instruction::SetLT || Op == Instruction::SetGT) return KnownFalse;
+ case ICmpInst::ICMP_EQ:
+ if (Op == ICmpInst::ICMP_ULE || Op == ICmpInst::ICMP_SLE ||
+ Op == ICmpInst::ICMP_UGE || Op == ICmpInst::ICMP_SGE) return KnownTrue;
+ if (Op == ICmpInst::ICMP_ULT || Op == ICmpInst::ICMP_SLT ||
+ Op == ICmpInst::ICMP_UGT || Op == ICmpInst::ICMP_SGT) return KnownFalse;
+ break;
+ case ICmpInst::ICMP_ULT:
+ case ICmpInst::ICMP_SLT:
+ if (Op == ICmpInst::ICMP_ULE || Op == ICmpInst::ICMP_SLE ||
+ Op == ICmpInst::ICMP_NE) return KnownTrue;
+ if (Op == ICmpInst::ICMP_EQ) return KnownFalse;
+ break;
+ case ICmpInst::ICMP_UGT:
+ case ICmpInst::ICMP_SGT:
+ if (Op == ICmpInst::ICMP_UGE || Op == ICmpInst::ICMP_SGE ||
+ Op == ICmpInst::ICMP_NE) return KnownTrue;
+ if (Op == ICmpInst::ICMP_EQ) return KnownFalse;
+ break;
+ case FCmpInst::FCMP_OEQ:
+ if (Op == FCmpInst::FCMP_OLE || Op == FCmpInst::FCMP_OGE) return KnownTrue;
+ if (Op == FCmpInst::FCMP_OLT || Op == FCmpInst::FCMP_OGT) return KnownFalse;
break;
- case Instruction::SetLT:
- if (Op == Instruction::SetNE || Op == Instruction::SetLE) return KnownTrue;
- if (Op == Instruction::SetEQ) return KnownFalse;
+ case FCmpInst::FCMP_OLT:
+ if (Op == FCmpInst::FCMP_ONE || Op == FCmpInst::FCMP_OLE) return KnownTrue;
+ if (Op == FCmpInst::FCMP_OEQ) return KnownFalse;
break;
- case Instruction::SetGT:
- if (Op == Instruction::SetNE || Op == Instruction::SetGE) return KnownTrue;
- if (Op == Instruction::SetEQ) return KnownFalse;
+ case FCmpInst::FCMP_OGT:
+ if (Op == FCmpInst::FCMP_ONE || Op == FCmpInst::FCMP_OGE) return KnownTrue;
+ if (Op == FCmpInst::FCMP_OEQ) return KnownFalse;
break;
- case Instruction::SetNE:
- case Instruction::SetLE:
- case Instruction::SetGE:
- case Instruction::Add:
+ case ICmpInst::ICMP_NE:
+ case ICmpInst::ICMP_SLE:
+ case ICmpInst::ICMP_ULE:
+ case ICmpInst::ICMP_UGE:
+ case ICmpInst::ICMP_SGE:
+ case FCmpInst::FCMP_ONE:
+ case FCmpInst::FCMP_OLE:
+ case FCmpInst::FCMP_OGE:
+ case FCmpInst::FCMP_FALSE:
+ case FCmpInst::FCMP_ORD:
+ case FCmpInst::FCMP_UNO:
+ case FCmpInst::FCMP_UEQ:
+ case FCmpInst::FCMP_UGT:
+ case FCmpInst::FCMP_UGE:
+ case FCmpInst::FCMP_ULT:
+ case FCmpInst::FCMP_ULE:
+ case FCmpInst::FCMP_UNE:
+ case FCmpInst::FCMP_TRUE:
break;
}
return Unknown;
OS << " is ";
switch (Rel) {
default: OS << "*UNKNOWN*"; break;
- case Instruction::SetEQ: OS << "== "; break;
- case Instruction::SetNE: OS << "!= "; break;
- case Instruction::SetLT: OS << "< "; break;
- case Instruction::SetGT: OS << "> "; break;
- case Instruction::SetLE: OS << "<= "; break;
- case Instruction::SetGE: OS << ">= "; break;
+ case ICmpInst::ICMP_EQ:
+ case FCmpInst::FCMP_ORD:
+ case FCmpInst::FCMP_UEQ:
+ case FCmpInst::FCMP_OEQ: OS << "== "; break;
+ case ICmpInst::ICMP_NE:
+ case FCmpInst::FCMP_UNO:
+ case FCmpInst::FCMP_UNE:
+ case FCmpInst::FCMP_ONE: OS << "!= "; break;
+ case ICmpInst::ICMP_ULT:
+ case ICmpInst::ICMP_SLT:
+ case FCmpInst::FCMP_ULT:
+ case FCmpInst::FCMP_OLT: OS << "< "; break;
+ case ICmpInst::ICMP_UGT:
+ case ICmpInst::ICMP_SGT:
+ case FCmpInst::FCMP_UGT:
+ case FCmpInst::FCMP_OGT: OS << "> "; break;
+ case ICmpInst::ICMP_ULE:
+ case ICmpInst::ICMP_SLE:
+ case FCmpInst::FCMP_ULE:
+ case FCmpInst::FCMP_OLE: OS << "<= "; break;
+ case ICmpInst::ICMP_UGE:
+ case ICmpInst::ICMP_SGE:
+ case FCmpInst::FCMP_UGE:
+ case FCmpInst::FCMP_OGE: OS << ">= "; break;
}
WriteAsOperand(OS, Val);
Value *ExitCnt = RW.expandCodeFor(TripCount, Preheader->getTerminator(),
IndVar->getType());
- // Insert a new setne or seteq instruction before the branch.
- Instruction::BinaryOps Opcode;
+ // Insert a new icmp_ne or icmp_eq instruction before the branch.
+ ICmpInst::Predicate Opcode;
if (L->contains(BI->getSuccessor(0)))
- Opcode = Instruction::SetNE;
+ Opcode = ICmpInst::ICMP_NE;
else
- Opcode = Instruction::SetEQ;
+ Opcode = ICmpInst::ICMP_EQ;
- Value *Cond = new SetCondInst(Opcode, IndVar, ExitCnt, "exitcond", BI);
+ Value *Cond = new ICmpInst(Opcode, IndVar, ExitCnt, "exitcond", BI);
BI->setCondition(Cond);
++NumLFTR;
Changed = true;
// 1. If a binary operator has a constant operand, it is moved to the RHS
// 2. Bitwise operators with constant operands are always grouped so that
// shifts are performed first, then or's, then and's, then xor's.
-// 3. SetCC instructions are converted from <,>,<=,>= to ==,!= if possible
-// 4. All SetCC instructions on boolean values are replaced with logical ops
+// 3. Compare instructions are converted from <,>,<=,>= to ==,!= if possible
+// 4. All cmp instructions on boolean values are replaced with logical ops
// 5. add X, X is represented as (X*2) => (X << 1)
// 6. Multiplies with a power-of-two constant argument are transformed into
// shifts.
Instruction *visitAnd(BinaryOperator &I);
Instruction *visitOr (BinaryOperator &I);
Instruction *visitXor(BinaryOperator &I);
- Instruction *visitSetCondInst(SetCondInst &I);
- Instruction *visitSetCondInstWithCastAndCast(SetCondInst &SCI);
+ Instruction *visitFCmpInst(FCmpInst &I);
+ Instruction *visitICmpInst(ICmpInst &I);
+ Instruction *visitICmpInstWithCastAndCast(ICmpInst &ICI);
- Instruction *FoldGEPSetCC(User *GEPLHS, Value *RHS,
- Instruction::BinaryOps Cond, Instruction &I);
+ Instruction *FoldGEPICmp(User *GEPLHS, Value *RHS,
+ ICmpInst::Predicate Cond, Instruction &I);
Instruction *visitShiftInst(ShiftInst &I);
Instruction *FoldShiftByConstant(Value *Op0, ConstantInt *Op1,
ShiftInst &I);
Value *V, const Type *DestTy,
Instruction *InsertBefore);
- // SimplifyCommutative - This performs a few simplifications for commutative
- // operators.
+ /// SimplifyCommutative - This performs a few simplifications for
+ /// commutative operators.
bool SimplifyCommutative(BinaryOperator &I);
+ /// SimplifyCompare - This reorders the operands of a CmpInst to get them in
+ /// most-complex to least-complex order.
+ bool SimplifyCompare(CmpInst &I);
+
bool SimplifyDemandedBits(Value *V, uint64_t Mask,
uint64_t &KnownZero, uint64_t &KnownOne,
unsigned Depth = 0);
Value *FoldLogicalPlusAnd(Value *LHS, Value *RHS, ConstantIntegral *Mask,
bool isSub, Instruction &I);
Instruction *InsertRangeTest(Value *V, Constant *Lo, Constant *Hi,
- bool Inside, Instruction &IB);
+ bool isSigned, bool Inside, Instruction &IB);
Instruction *PromoteCastOfAllocation(CastInst &CI, AllocationInst &AI);
Instruction *MatchBSwap(BinaryOperator &I);
/// ValueRequiresCast - Return true if the cast from "V to Ty" actually results
/// in any code being generated. It does not require codegen if V is simple
/// enough or if the cast can be folded into other casts.
-static bool ValueRequiresCast(const Value *V, const Type *Ty, TargetData *TD) {
+static bool ValueRequiresCast(Instruction::CastOps opcode, const Value *V,
+ const Type *Ty, TargetData *TD) {
if (V->getType() == Ty || isa<Constant>(V)) return false;
// If this is a noop cast, it isn't real codegen.
// If this is another cast that can be eliminated, it isn't codegen either.
if (const CastInst *CI = dyn_cast<CastInst>(V))
- if (isEliminableCastPair(CI, CastInst::getCastOpcode(
- V, V->getType()->isSigned(), Ty, Ty->isSigned()), Ty, TD))
+ if (isEliminableCastPair(CI, opcode, Ty, TD))
return false;
return true;
}
return Changed;
}
+/// SimplifyCompare - For a CmpInst this function just orders the operands
+/// so that theyare listed from right (least complex) to left (most complex).
+/// This puts constants before unary operators before binary operators.
+bool InstCombiner::SimplifyCompare(CmpInst &I) {
+ if (getComplexity(I.getOperand(0)) >= getComplexity(I.getOperand(1)))
+ return false;
+ I.swapOperands();
+ // Compare instructions are not associative so there's nothing else we can do.
+ return true;
+}
+
// dyn_castNegVal - Given a 'sub' instruction, return the RHS of the instruction
// if the LHS is a constant zero (which is the 'negate' form).
//
return MadeChange ? I : 0;
}
-// isTrueWhenEqual - Return true if the specified setcondinst instruction is
-// true when both operands are equal...
-//
-static bool isTrueWhenEqual(Instruction &I) {
- return I.getOpcode() == Instruction::SetEQ ||
- I.getOpcode() == Instruction::SetGE ||
- I.getOpcode() == Instruction::SetLE;
+/// @returns true if the specified compare instruction is
+/// true when both operands are equal...
+/// @brief Determine if the ICmpInst returns true if both operands are equal
+static bool isTrueWhenEqual(ICmpInst &ICI) {
+ ICmpInst::Predicate pred = ICI.getPredicate();
+ return pred == ICmpInst::ICMP_EQ || pred == ICmpInst::ICMP_UGE ||
+ pred == ICmpInst::ICMP_SGE || pred == ICmpInst::ICMP_ULE ||
+ pred == ICmpInst::ICMP_SLE;
+}
+
+/// @returns true if the specified compare instruction is
+/// true when both operands are equal...
+/// @brief Determine if the FCmpInst returns true if both operands are equal
+static bool isTrueWhenEqual(FCmpInst &FCI) {
+ FCmpInst::Predicate pred = FCI.getPredicate();
+ return pred == FCmpInst::FCMP_OEQ || pred == FCmpInst::FCMP_UEQ ||
+ pred == FCmpInst::FCMP_OGE || pred == FCmpInst::FCMP_UGE ||
+ pred == FCmpInst::FCMP_OLE || pred == FCmpInst::FCMP_ULE;
}
/// AssociativeOpt - Perform an optimization on an associative operator. This
Instruction *New;
if (BinaryOperator *BO = dyn_cast<BinaryOperator>(&I))
New = BinaryOperator::create(BO->getOpcode(), Op0, Op1,SO->getName()+".op");
+ else if (CmpInst *CI = dyn_cast<CmpInst>(&I))
+ New = CmpInst::create(CI->getOpcode(), CI->getPredicate(), Op0, Op1,
+ SO->getName()+".cmp");
else if (ShiftInst *SI = dyn_cast<ShiftInst>(&I))
New = new ShiftInst(SI->getOpcode(), Op0, Op1, SO->getName()+".sh");
else {
for (unsigned i = 0; i != NumPHIValues; ++i) {
Value *InV;
if (Constant *InC = dyn_cast<Constant>(PN->getIncomingValue(i))) {
- InV = ConstantExpr::get(I.getOpcode(), InC, C);
+ if (CmpInst *CI = dyn_cast<CmpInst>(&I))
+ InV = ConstantExpr::getCompare(CI->getPredicate(), InC, C);
+ else
+ InV = ConstantExpr::get(I.getOpcode(), InC, C);
} else {
assert(PN->getIncomingBlock(i) == NonConstBB);
if (BinaryOperator *BO = dyn_cast<BinaryOperator>(&I))
InV = BinaryOperator::create(BO->getOpcode(),
PN->getIncomingValue(i), C, "phitmp",
NonConstBB->getTerminator());
+ else if (CmpInst *CI = dyn_cast<CmpInst>(&I))
+ InV = CmpInst::create(CI->getOpcode(),
+ CI->getPredicate(),
+ PN->getIncomingValue(i), C, "phitmp",
+ NonConstBB->getTerminator());
else if (ShiftInst *SI = dyn_cast<ShiftInst>(&I))
InV = new ShiftInst(SI->getOpcode(),
PN->getIncomingValue(i), C, "phitmp",
return 0;
}
-/// isSignBitCheck - Given an exploded setcc instruction, return true if it is
+/// isSignBitCheck - Given an exploded icmp instruction, return true if it
/// really just returns true if the most significant (sign) bit is set.
-static bool isSignBitCheck(unsigned Opcode, Value *LHS, ConstantInt *RHS) {
- if (RHS->getType()->isSigned()) {
- // True if source is LHS < 0 or LHS <= -1
- return Opcode == Instruction::SetLT && RHS->isNullValue() ||
- Opcode == Instruction::SetLE && RHS->isAllOnesValue();
- } else {
- ConstantInt *RHSC = cast<ConstantInt>(RHS);
- // True if source is LHS > 127 or LHS >= 128, where the constants depend on
- // the size of the integer type.
- if (Opcode == Instruction::SetGE)
- return RHSC->getZExtValue() ==
- 1ULL << (RHS->getType()->getPrimitiveSizeInBits()-1);
- if (Opcode == Instruction::SetGT)
- return RHSC->getZExtValue() ==
+static bool isSignBitCheck(ICmpInst::Predicate pred, ConstantInt *RHS) {
+ switch (pred) {
+ case ICmpInst::ICMP_SLT:
+ // True if LHS s< RHS and RHS == 0
+ return RHS->isNullValue();
+ case ICmpInst::ICMP_SLE:
+ // True if LHS s<= RHS and RHS == -1
+ return RHS->isAllOnesValue();
+ case ICmpInst::ICMP_UGE:
+ // True if LHS u>= RHS and RHS == high-bit-mask (2^7, 2^15, 2^31, etc)
+ return RHS->getZExtValue() == (1ULL <<
+ (RHS->getType()->getPrimitiveSizeInBits()-1));
+ case ICmpInst::ICMP_UGT:
+ // True if LHS u> RHS and RHS == high-bit-mask - 1
+ return RHS->getZExtValue() ==
(1ULL << (RHS->getType()->getPrimitiveSizeInBits()-1))-1;
+ default:
+ return false;
}
- return false;
}
Instruction *InstCombiner::visitMul(BinaryOperator &I) {
if (CI->getOperand(0)->getType() == Type::BoolTy)
BoolCast = CI;
if (BoolCast) {
- if (SetCondInst *SCI = dyn_cast<SetCondInst>(BoolCast->getOperand(0))) {
+ if (ICmpInst *SCI = dyn_cast<ICmpInst>(BoolCast->getOperand(0))) {
Value *SCIOp0 = SCI->getOperand(0), *SCIOp1 = SCI->getOperand(1);
const Type *SCOpTy = SCIOp0->getType();
- // If the setcc is true iff the sign bit of X is set, then convert this
+ // If the icmp is true iff the sign bit of X is set, then convert this
// multiply into a shift/and combination.
if (isa<ConstantInt>(SCIOp1) &&
- isSignBitCheck(SCI->getOpcode(), SCIOp0, cast<ConstantInt>(SCIOp1))) {
+ isSignBitCheck(SCI->getPredicate(), cast<ConstantInt>(SCIOp1))) {
// Shift the X value right to turn it into "all signbits".
Constant *Amt = ConstantInt::get(Type::UByteTy,
SCOpTy->getPrimitiveSizeInBits()-1);
}
// isMaxValueMinusOne - return true if this is Max-1
-static bool isMaxValueMinusOne(const ConstantInt *C) {
- if (C->getType()->isUnsigned())
- return C->getZExtValue() == C->getType()->getIntegralTypeMask()-1;
-
- // Calculate 0111111111..11111
- unsigned TypeBits = C->getType()->getPrimitiveSizeInBits();
- int64_t Val = INT64_MAX; // All ones
- Val >>= 64-TypeBits; // Shift out unwanted 1 bits...
- return C->getSExtValue() == Val-1;
+static bool isMaxValueMinusOne(const ConstantInt *C, bool isSigned) {
+ if (isSigned) {
+ // Calculate 0111111111..11111
+ unsigned TypeBits = C->getType()->getPrimitiveSizeInBits();
+ int64_t Val = INT64_MAX; // All ones
+ Val >>= 64-TypeBits; // Shift out unwanted 1 bits...
+ return C->getSExtValue() == Val-1;
+ }
+ return C->getZExtValue() == C->getType()->getIntegralTypeMask()-1;
}
// isMinValuePlusOne - return true if this is Min+1
-static bool isMinValuePlusOne(const ConstantInt *C) {
- if (C->getType()->isUnsigned())
- return C->getZExtValue() == 1;
-
- // Calculate 1111111111000000000000
- unsigned TypeBits = C->getType()->getPrimitiveSizeInBits();
- int64_t Val = -1; // All ones
- Val <<= TypeBits-1; // Shift over to the right spot
- return C->getSExtValue() == Val+1;
+static bool isMinValuePlusOne(const ConstantInt *C, bool isSigned) {
+ if (isSigned) {
+ // Calculate 1111111111000000000000
+ unsigned TypeBits = C->getType()->getPrimitiveSizeInBits();
+ int64_t Val = -1; // All ones
+ Val <<= TypeBits-1; // Shift over to the right spot
+ return C->getSExtValue() == Val+1;
+ }
+ return C->getZExtValue() == 1; // unsigned
}
// isOneBitSet - Return true if there is exactly one bit set in the specified
return U && V && (U & V) == 0;
}
-
-/// getSetCondCode - Encode a setcc opcode into a three bit mask. These bits
+/// getICmpCode - Encode a icmp predicate into a three bit mask. These bits
/// are carefully arranged to allow folding of expressions such as:
///
/// (A < B) | (A > B) --> (A != B)
///
-/// Bit value '4' represents that the comparison is true if A > B, bit value '2'
-/// represents that the comparison is true if A == B, and bit value '1' is true
-/// if A < B.
+/// Note that this is only valid if the first and second predicates have the
+/// same sign. Is illegal to do: (A u< B) | (A s> B)
+///
+/// Three bits are used to represent the condition, as follows:
+/// 0 A > B
+/// 1 A == B
+/// 2 A < B
///
-static unsigned getSetCondCode(const SetCondInst *SCI) {
- switch (SCI->getOpcode()) {
+/// <=> Value Definition
+/// 000 0 Always false
+/// 001 1 A > B
+/// 010 2 A == B
+/// 011 3 A >= B
+/// 100 4 A < B
+/// 101 5 A != B
+/// 110 6 A <= B
+/// 111 7 Always true
+///
+static unsigned getICmpCode(const ICmpInst *ICI) {
+ switch (ICI->getPredicate()) {
// False -> 0
- case Instruction::SetGT: return 1;
- case Instruction::SetEQ: return 2;
- case Instruction::SetGE: return 3;
- case Instruction::SetLT: return 4;
- case Instruction::SetNE: return 5;
- case Instruction::SetLE: return 6;
+ case ICmpInst::ICMP_UGT: return 1; // 001
+ case ICmpInst::ICMP_SGT: return 1; // 001
+ case ICmpInst::ICMP_EQ: return 2; // 010
+ case ICmpInst::ICMP_UGE: return 3; // 011
+ case ICmpInst::ICMP_SGE: return 3; // 011
+ case ICmpInst::ICMP_ULT: return 4; // 100
+ case ICmpInst::ICMP_SLT: return 4; // 100
+ case ICmpInst::ICMP_NE: return 5; // 101
+ case ICmpInst::ICMP_ULE: return 6; // 110
+ case ICmpInst::ICMP_SLE: return 6; // 110
// True -> 7
default:
- assert(0 && "Invalid SetCC opcode!");
+ assert(0 && "Invalid ICmp predicate!");
return 0;
}
}
-/// getSetCCValue - This is the complement of getSetCondCode, which turns an
-/// opcode and two operands into either a constant true or false, or a brand new
-/// SetCC instruction.
-static Value *getSetCCValue(unsigned Opcode, Value *LHS, Value *RHS) {
- switch (Opcode) {
- case 0: return ConstantBool::getFalse();
- case 1: return new SetCondInst(Instruction::SetGT, LHS, RHS);
- case 2: return new SetCondInst(Instruction::SetEQ, LHS, RHS);
- case 3: return new SetCondInst(Instruction::SetGE, LHS, RHS);
- case 4: return new SetCondInst(Instruction::SetLT, LHS, RHS);
- case 5: return new SetCondInst(Instruction::SetNE, LHS, RHS);
- case 6: return new SetCondInst(Instruction::SetLE, LHS, RHS);
- case 7: return ConstantBool::getTrue();
- default: assert(0 && "Illegal SetCCCode!"); return 0;
+/// getICmpValue - This is the complement of getICmpCode, which turns an
+/// opcode and two operands into either a constant true or false, or a brand
+/// new /// ICmp instruction. The sign is passed in to determine which kind
+/// of predicate to use in new icmp instructions.
+static Value *getICmpValue(bool sign, unsigned code, Value *LHS, Value *RHS) {
+ switch (code) {
+ default: assert(0 && "Illegal ICmp code!");
+ case 0: return ConstantBool::getFalse();
+ case 1:
+ if (sign)
+ return new ICmpInst(ICmpInst::ICMP_SGT, LHS, RHS);
+ else
+ return new ICmpInst(ICmpInst::ICMP_UGT, LHS, RHS);
+ case 2: return new ICmpInst(ICmpInst::ICMP_EQ, LHS, RHS);
+ case 3:
+ if (sign)
+ return new ICmpInst(ICmpInst::ICMP_SGE, LHS, RHS);
+ else
+ return new ICmpInst(ICmpInst::ICMP_UGE, LHS, RHS);
+ case 4:
+ if (sign)
+ return new ICmpInst(ICmpInst::ICMP_SLT, LHS, RHS);
+ else
+ return new ICmpInst(ICmpInst::ICMP_ULT, LHS, RHS);
+ case 5: return new ICmpInst(ICmpInst::ICMP_NE, LHS, RHS);
+ case 6:
+ if (sign)
+ return new ICmpInst(ICmpInst::ICMP_SLE, LHS, RHS);
+ else
+ return new ICmpInst(ICmpInst::ICMP_ULE, LHS, RHS);
+ case 7: return ConstantBool::getTrue();
}
}
-// FoldSetCCLogical - Implements (setcc1 A, B) & (setcc2 A, B) --> (setcc3 A, B)
-namespace {
-struct FoldSetCCLogical {
+static bool PredicatesFoldable(ICmpInst::Predicate p1, ICmpInst::Predicate p2) {
+ return (ICmpInst::isSignedPredicate(p1) == ICmpInst::isSignedPredicate(p2)) ||
+ (ICmpInst::isSignedPredicate(p1) &&
+ (p2 == ICmpInst::ICMP_EQ || p2 == ICmpInst::ICMP_NE)) ||
+ (ICmpInst::isSignedPredicate(p2) &&
+ (p1 == ICmpInst::ICMP_EQ || p1 == ICmpInst::ICMP_NE));
+}
+
+namespace {
+// FoldICmpLogical - Implements (icmp1 A, B) & (icmp2 A, B) --> (icmp3 A, B)
+struct FoldICmpLogical {
InstCombiner &IC;
Value *LHS, *RHS;
- FoldSetCCLogical(InstCombiner &ic, SetCondInst *SCI)
- : IC(ic), LHS(SCI->getOperand(0)), RHS(SCI->getOperand(1)) {}
+ ICmpInst::Predicate pred;
+ FoldICmpLogical(InstCombiner &ic, ICmpInst *ICI)
+ : IC(ic), LHS(ICI->getOperand(0)), RHS(ICI->getOperand(1)),
+ pred(ICI->getPredicate()) {}
bool shouldApply(Value *V) const {
- if (SetCondInst *SCI = dyn_cast<SetCondInst>(V))
- return (SCI->getOperand(0) == LHS && SCI->getOperand(1) == RHS ||
- SCI->getOperand(0) == RHS && SCI->getOperand(1) == LHS);
+ if (ICmpInst *ICI = dyn_cast<ICmpInst>(V))
+ if (PredicatesFoldable(pred, ICI->getPredicate()))
+ return (ICI->getOperand(0) == LHS && ICI->getOperand(1) == RHS ||
+ ICI->getOperand(0) == RHS && ICI->getOperand(1) == LHS);
return false;
}
- Instruction *apply(BinaryOperator &Log) const {
- SetCondInst *SCI = cast<SetCondInst>(Log.getOperand(0));
- if (SCI->getOperand(0) != LHS) {
- assert(SCI->getOperand(1) == LHS);
- SCI->swapOperands(); // Swap the LHS and RHS of the SetCC
+ Instruction *apply(Instruction &Log) const {
+ ICmpInst *ICI = cast<ICmpInst>(Log.getOperand(0));
+ if (ICI->getOperand(0) != LHS) {
+ assert(ICI->getOperand(1) == LHS);
+ ICI->swapOperands(); // Swap the LHS and RHS of the ICmp
}
- unsigned LHSCode = getSetCondCode(SCI);
- unsigned RHSCode = getSetCondCode(cast<SetCondInst>(Log.getOperand(1)));
+ unsigned LHSCode = getICmpCode(ICI);
+ unsigned RHSCode = getICmpCode(cast<ICmpInst>(Log.getOperand(1)));
unsigned Code;
switch (Log.getOpcode()) {
case Instruction::And: Code = LHSCode & RHSCode; break;
default: assert(0 && "Illegal logical opcode!"); return 0;
}
- Value *RV = getSetCCValue(Code, LHS, RHS);
+ Value *RV = getICmpValue(ICmpInst::isSignedPredicate(pred), Code, LHS, RHS);
if (Instruction *I = dyn_cast<Instruction>(RV))
return I;
// Otherwise, it's a constant boolean value...
/// InsertRangeTest - Emit a computation of: (V >= Lo && V < Hi) if Inside is
/// true, otherwise (V < Lo || V >= Hi). In pratice, we emit the more efficient
-/// (V-Lo) <u Hi-Lo. This method expects that Lo <= Hi. IB is the location to
+/// (V-Lo) <u Hi-Lo. This method expects that Lo <= Hi. isSigned indicates
+/// whether to treat the V, Lo and HI as signed or not. IB is the location to
/// insert new instructions.
Instruction *InstCombiner::InsertRangeTest(Value *V, Constant *Lo, Constant *Hi,
- bool Inside, Instruction &IB) {
- assert(cast<ConstantBool>(ConstantExpr::getSetLE(Lo, Hi))->getValue() &&
+ bool isSigned, bool Inside,
+ Instruction &IB) {
+ assert(cast<ConstantBool>(ConstantExpr::getICmp((isSigned ?
+ ICmpInst::ICMP_SLE:ICmpInst::ICMP_ULE), Lo, Hi))->getValue() &&
"Lo is not <= Hi in range emission code!");
+
if (Inside) {
if (Lo == Hi) // Trivially false.
- return new SetCondInst(Instruction::SetNE, V, V);
- if (cast<ConstantIntegral>(Lo)->isMinValue(Lo->getType()->isSigned()))
- return new SetCondInst(Instruction::SetLT, V, Hi);
+ return new ICmpInst(ICmpInst::ICMP_NE, V, V);
- Constant *AddCST = ConstantExpr::getNeg(Lo);
- Instruction *Add = BinaryOperator::createAdd(V, AddCST,V->getName()+".off");
+ // V >= Min && V < Hi --> V < Hi
+ if (cast<ConstantIntegral>(Lo)->isMinValue(isSigned)) {
+ ICmpInst::Predicate pred = (isSigned ?
+ ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT);
+ return new ICmpInst(pred, V, Hi);
+ }
+
+ // Emit V-Lo <u Hi-Lo
+ Constant *NegLo = ConstantExpr::getNeg(Lo);
+ Instruction *Add = BinaryOperator::createAdd(V, NegLo, V->getName()+".off");
InsertNewInstBefore(Add, IB);
- // Convert to unsigned for the comparison.
- const Type *UnsType = Add->getType()->getUnsignedVersion();
- Value *OffsetVal = InsertCastBefore(Instruction::BitCast, Add, UnsType, IB);
- AddCST = ConstantExpr::getAdd(AddCST, Hi);
- AddCST = ConstantExpr::getBitCast(AddCST, UnsType);
- return new SetCondInst(Instruction::SetLT, OffsetVal, AddCST);
+ Constant *UpperBound = ConstantExpr::getAdd(NegLo, Hi);
+ return new ICmpInst(ICmpInst::ICMP_ULT, Add, UpperBound);
}
if (Lo == Hi) // Trivially true.
- return new SetCondInst(Instruction::SetEQ, V, V);
+ return new ICmpInst(ICmpInst::ICMP_EQ, V, V);
+ // V < Min || V >= Hi ->'V > Hi-1'
Hi = SubOne(cast<ConstantInt>(Hi));
+ if (cast<ConstantIntegral>(Lo)->isMinValue(isSigned)) {
+ ICmpInst::Predicate pred = (isSigned ?
+ ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT);
+ return new ICmpInst(pred, V, Hi);
+ }
- // V < 0 || V >= Hi ->'V > Hi-1'
- if (cast<ConstantIntegral>(Lo)->isMinValue(Lo->getType()->isSigned()))
- return new SetCondInst(Instruction::SetGT, V, Hi);
-
- // Emit X-Lo > Hi-Lo-1
- Constant *AddCST = ConstantExpr::getNeg(Lo);
- Instruction *Add = BinaryOperator::createAdd(V, AddCST, V->getName()+".off");
+ // Emit V-Lo > Hi-1-Lo
+ Constant *NegLo = ConstantExpr::getNeg(Lo);
+ Instruction *Add = BinaryOperator::createAdd(V, NegLo, V->getName()+".off");
InsertNewInstBefore(Add, IB);
- // Convert to unsigned for the comparison.
- const Type *UnsType = Add->getType()->getUnsignedVersion();
- Value *OffsetVal = InsertCastBefore(Instruction::BitCast, Add, UnsType, IB);
- AddCST = ConstantExpr::getAdd(AddCST, Hi);
- AddCST = ConstantExpr::getBitCast(AddCST, UnsType);
- return new SetCondInst(Instruction::SetGT, OffsetVal, AddCST);
+ Constant *LowerBound = ConstantExpr::getAdd(NegLo, Hi);
+ return new ICmpInst(ICmpInst::ICMP_UGT, Add, LowerBound);
}
// isRunOfOnes - Returns true iff Val consists of one contiguous run of 1s with
}
}
-
- if (SetCondInst *RHS = dyn_cast<SetCondInst>(Op1)) {
- // (setcc1 A, B) & (setcc2 A, B) --> (setcc3 A, B)
- if (Instruction *R = AssociativeOpt(I, FoldSetCCLogical(*this, RHS)))
+ if (ICmpInst *RHS = dyn_cast<ICmpInst>(Op1)) {
+ // (icmp1 A, B) & (icmp2 A, B) --> (icmp3 A, B)
+ if (Instruction *R = AssociativeOpt(I, FoldICmpLogical(*this, RHS)))
return R;
Value *LHSVal, *RHSVal;
ConstantInt *LHSCst, *RHSCst;
- Instruction::BinaryOps LHSCC, RHSCC;
- if (match(Op0, m_SetCond(LHSCC, m_Value(LHSVal), m_ConstantInt(LHSCst))))
- if (match(RHS, m_SetCond(RHSCC, m_Value(RHSVal), m_ConstantInt(RHSCst))))
- if (LHSVal == RHSVal && // Found (X setcc C1) & (X setcc C2)
- // Set[GL]E X, CST is folded to Set[GL]T elsewhere.
- LHSCC != Instruction::SetGE && LHSCC != Instruction::SetLE &&
- RHSCC != Instruction::SetGE && RHSCC != Instruction::SetLE) {
+ ICmpInst::Predicate LHSCC, RHSCC;
+ if (match(Op0, m_ICmp(LHSCC, m_Value(LHSVal), m_ConstantInt(LHSCst))))
+ if (match(RHS, m_ICmp(RHSCC, m_Value(RHSVal), m_ConstantInt(RHSCst))))
+ if (LHSVal == RHSVal && // Found (X icmp C1) & (X icmp C2)
+ // ICMP_[GL]E X, CST is folded to ICMP_[GL]T elsewhere.
+ LHSCC != ICmpInst::ICMP_UGE && LHSCC != ICmpInst::ICMP_ULE &&
+ RHSCC != ICmpInst::ICMP_UGE && RHSCC != ICmpInst::ICMP_ULE &&
+ LHSCC != ICmpInst::ICMP_SGE && LHSCC != ICmpInst::ICMP_SLE &&
+ RHSCC != ICmpInst::ICMP_SGE && RHSCC != ICmpInst::ICMP_SLE) {
// Ensure that the larger constant is on the RHS.
- Constant *Cmp = ConstantExpr::getSetGT(LHSCst, RHSCst);
- SetCondInst *LHS = cast<SetCondInst>(Op0);
+ ICmpInst::Predicate GT = ICmpInst::isSignedPredicate(LHSCC) ?
+ ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT;
+ Constant *Cmp = ConstantExpr::getICmp(GT, LHSCst, RHSCst);
+ ICmpInst *LHS = cast<ICmpInst>(Op0);
if (cast<ConstantBool>(Cmp)->getValue()) {
std::swap(LHS, RHS);
std::swap(LHSCst, RHSCst);
std::swap(LHSCC, RHSCC);
}
- // At this point, we know we have have two setcc instructions
+ // At this point, we know we have have two icmp instructions
// comparing a value against two constants and and'ing the result
// together. Because of the above check, we know that we only have
- // SetEQ, SetNE, SetLT, and SetGT here. We also know (from the
- // FoldSetCCLogical check above), that the two constants are not
- // equal.
+ // icmp eq, icmp ne, icmp [su]lt, and icmp [SU]gt here. We also know
+ // (from the FoldICmpLogical check above), that the two constants
+ // are not equal and that the larger constant is on the RHS
assert(LHSCst != RHSCst && "Compares not folded above?");
switch (LHSCC) {
default: assert(0 && "Unknown integer condition code!");
- case Instruction::SetEQ:
+ case ICmpInst::ICMP_EQ:
switch (RHSCC) {
default: assert(0 && "Unknown integer condition code!");
- case Instruction::SetEQ: // (X == 13 & X == 15) -> false
- case Instruction::SetGT: // (X == 13 & X > 15) -> false
+ case ICmpInst::ICMP_EQ: // (X == 13 & X == 15) -> false
+ case ICmpInst::ICMP_UGT: // (X == 13 & X > 15) -> false
+ case ICmpInst::ICMP_SGT: // (X == 13 & X > 15) -> false
return ReplaceInstUsesWith(I, ConstantBool::getFalse());
- case Instruction::SetNE: // (X == 13 & X != 15) -> X == 13
- case Instruction::SetLT: // (X == 13 & X < 15) -> X == 13
+ case ICmpInst::ICMP_NE: // (X == 13 & X != 15) -> X == 13
+ case ICmpInst::ICMP_ULT: // (X == 13 & X < 15) -> X == 13
+ case ICmpInst::ICMP_SLT: // (X == 13 & X < 15) -> X == 13
return ReplaceInstUsesWith(I, LHS);
}
- case Instruction::SetNE:
+ case ICmpInst::ICMP_NE:
switch (RHSCC) {
default: assert(0 && "Unknown integer condition code!");
- case Instruction::SetLT:
- if (LHSCst == SubOne(RHSCst)) // (X != 13 & X < 14) -> X < 13
- return new SetCondInst(Instruction::SetLT, LHSVal, LHSCst);
- break; // (X != 13 & X < 15) -> no change
- case Instruction::SetEQ: // (X != 13 & X == 15) -> X == 15
- case Instruction::SetGT: // (X != 13 & X > 15) -> X > 15
+ case ICmpInst::ICMP_ULT:
+ if (LHSCst == SubOne(RHSCst)) // (X != 13 & X u< 14) -> X < 13
+ return new ICmpInst(ICmpInst::ICMP_ULT, LHSVal, LHSCst);
+ break; // (X != 13 & X u< 15) -> no change
+ case ICmpInst::ICMP_SLT:
+ if (LHSCst == SubOne(RHSCst)) // (X != 13 & X s< 14) -> X < 13
+ return new ICmpInst(ICmpInst::ICMP_SLT, LHSVal, LHSCst);
+ break; // (X != 13 & X s< 15) -> no change
+ case ICmpInst::ICMP_EQ: // (X != 13 & X == 15) -> X == 15
+ case ICmpInst::ICMP_UGT: // (X != 13 & X u> 15) -> X u> 15
+ case ICmpInst::ICMP_SGT: // (X != 13 & X s> 15) -> X s> 15
return ReplaceInstUsesWith(I, RHS);
- case Instruction::SetNE:
- if (LHSCst == SubOne(RHSCst)) {// (X != 13 & X != 14) -> X-13 >u 1
+ case ICmpInst::ICMP_NE:
+ if (LHSCst == SubOne(RHSCst)){// (X != 13 & X != 14) -> X-13 >u 1
Constant *AddCST = ConstantExpr::getNeg(LHSCst);
Instruction *Add = BinaryOperator::createAdd(LHSVal, AddCST,
LHSVal->getName()+".off");
UnsType, I);
AddCST = ConstantExpr::getSub(RHSCst, LHSCst);
AddCST = ConstantExpr::getBitCast(AddCST, UnsType);
- return new SetCondInst(Instruction::SetGT, OffsetVal, AddCST);
+ return new ICmpInst(ICmpInst::ICMP_UGT, OffsetVal, AddCST);
}
break; // (X != 13 & X != 15) -> no change
}
break;
- case Instruction::SetLT:
+ case ICmpInst::ICMP_ULT:
+ switch (RHSCC) {
+ default: assert(0 && "Unknown integer condition code!");
+ case ICmpInst::ICMP_EQ: // (X u< 13 & X == 15) -> false
+ case ICmpInst::ICMP_UGT: // (X u< 13 & X u> 15) -> false
+ return ReplaceInstUsesWith(I, ConstantBool::getFalse());
+ case ICmpInst::ICMP_SGT: // (X u< 13 & X s> 15) -> no change
+ break;
+ case ICmpInst::ICMP_NE: // (X u< 13 & X != 15) -> X u< 13
+ case ICmpInst::ICMP_ULT: // (X u< 13 & X u< 15) -> X u< 13
+ return ReplaceInstUsesWith(I, LHS);
+ case ICmpInst::ICMP_SLT: // (X u< 13 & X s< 15) -> no change
+ break;
+ }
+ break;
+ case ICmpInst::ICMP_SLT:
switch (RHSCC) {
default: assert(0 && "Unknown integer condition code!");
- case Instruction::SetEQ: // (X < 13 & X == 15) -> false
- case Instruction::SetGT: // (X < 13 & X > 15) -> false
+ case ICmpInst::ICMP_EQ: // (X s< 13 & X == 15) -> false
+ case ICmpInst::ICMP_SGT: // (X s< 13 & X s> 15) -> false
return ReplaceInstUsesWith(I, ConstantBool::getFalse());
- case Instruction::SetNE: // (X < 13 & X != 15) -> X < 13
- case Instruction::SetLT: // (X < 13 & X < 15) -> X < 13
+ case ICmpInst::ICMP_UGT: // (X s< 13 & X u> 15) -> no change
+ break;
+ case ICmpInst::ICMP_NE: // (X s< 13 & X != 15) -> X < 13
+ case ICmpInst::ICMP_SLT: // (X s< 13 & X s< 15) -> X < 13
+ return ReplaceInstUsesWith(I, LHS);
+ case ICmpInst::ICMP_ULT: // (X s< 13 & X u< 15) -> no change
+ break;
+ }
+ break;
+ case ICmpInst::ICMP_UGT:
+ switch (RHSCC) {
+ default: assert(0 && "Unknown integer condition code!");
+ case ICmpInst::ICMP_EQ: // (X u> 13 & X == 15) -> X > 13
return ReplaceInstUsesWith(I, LHS);
+ case ICmpInst::ICMP_UGT: // (X u> 13 & X u> 15) -> X u> 15
+ return ReplaceInstUsesWith(I, RHS);
+ case ICmpInst::ICMP_SGT: // (X u> 13 & X s> 15) -> no change
+ break;
+ case ICmpInst::ICMP_NE:
+ if (RHSCst == AddOne(LHSCst)) // (X u> 13 & X != 14) -> X u> 14
+ return new ICmpInst(LHSCC, LHSVal, RHSCst);
+ break; // (X u> 13 & X != 15) -> no change
+ case ICmpInst::ICMP_ULT: // (X u> 13 & X u< 15) ->(X-14) <u 1
+ return InsertRangeTest(LHSVal, AddOne(LHSCst), RHSCst, false,
+ true, I);
+ case ICmpInst::ICMP_SLT: // (X u> 13 & X s< 15) -> no change
+ break;
}
- case Instruction::SetGT:
+ break;
+ case ICmpInst::ICMP_SGT:
switch (RHSCC) {
default: assert(0 && "Unknown integer condition code!");
- case Instruction::SetEQ: // (X > 13 & X == 15) -> X > 13
+ case ICmpInst::ICMP_EQ: // (X s> 13 & X == 15) -> X s> 13
return ReplaceInstUsesWith(I, LHS);
- case Instruction::SetGT: // (X > 13 & X > 15) -> X > 15
+ case ICmpInst::ICMP_SGT: // (X s> 13 & X s> 15) -> X s> 15
return ReplaceInstUsesWith(I, RHS);
- case Instruction::SetNE:
- if (RHSCst == AddOne(LHSCst)) // (X > 13 & X != 14) -> X > 14
- return new SetCondInst(Instruction::SetGT, LHSVal, RHSCst);
- break; // (X > 13 & X != 15) -> no change
- case Instruction::SetLT: // (X > 13 & X < 15) -> (X-14) <u 1
- return InsertRangeTest(LHSVal, AddOne(LHSCst), RHSCst, true, I);
+ case ICmpInst::ICMP_UGT: // (X s> 13 & X u> 15) -> no change
+ break;
+ case ICmpInst::ICMP_NE:
+ if (RHSCst == AddOne(LHSCst)) // (X s> 13 & X != 14) -> X s> 14
+ return new ICmpInst(LHSCC, LHSVal, RHSCst);
+ break; // (X s> 13 & X != 15) -> no change
+ case ICmpInst::ICMP_SLT: // (X s> 13 & X s< 15) ->(X-14) s< 1
+ return InsertRangeTest(LHSVal, AddOne(LHSCst), RHSCst, true,
+ true, I);
+ case ICmpInst::ICMP_ULT: // (X s> 13 & X u< 15) -> no change
+ break;
}
+ break;
}
}
}
const Type *SrcTy = Op0C->getOperand(0)->getType();
if (SrcTy == Op1C->getOperand(0)->getType() && SrcTy->isIntegral() &&
// Only do this if the casts both really cause code to be generated.
- ValueRequiresCast(Op0C->getOperand(0), I.getType(), TD) &&
- ValueRequiresCast(Op1C->getOperand(0), I.getType(), TD)) {
+ ValueRequiresCast(Op0C->getOpcode(), Op0C->getOperand(0),
+ I.getType(), TD) &&
+ ValueRequiresCast(Op1C->getOpcode(), Op1C->getOperand(0),
+ I.getType(), TD)) {
Instruction *NewOp = BinaryOperator::createAnd(Op0C->getOperand(0),
Op1C->getOperand(0),
I.getName());
}
}
- // (setcc1 A, B) | (setcc2 A, B) --> (setcc3 A, B)
- if (SetCondInst *RHS = dyn_cast<SetCondInst>(I.getOperand(1))) {
- if (Instruction *R = AssociativeOpt(I, FoldSetCCLogical(*this, RHS)))
+ // (icmp1 A, B) | (icmp2 A, B) --> (icmp3 A, B)
+ if (ICmpInst *RHS = dyn_cast<ICmpInst>(I.getOperand(1))) {
+ if (Instruction *R = AssociativeOpt(I, FoldICmpLogical(*this, RHS)))
return R;
Value *LHSVal, *RHSVal;
ConstantInt *LHSCst, *RHSCst;
- Instruction::BinaryOps LHSCC, RHSCC;
- if (match(Op0, m_SetCond(LHSCC, m_Value(LHSVal), m_ConstantInt(LHSCst))))
- if (match(RHS, m_SetCond(RHSCC, m_Value(RHSVal), m_ConstantInt(RHSCst))))
- if (LHSVal == RHSVal && // Found (X setcc C1) | (X setcc C2)
- // Set[GL]E X, CST is folded to Set[GL]T elsewhere.
- LHSCC != Instruction::SetGE && LHSCC != Instruction::SetLE &&
- RHSCC != Instruction::SetGE && RHSCC != Instruction::SetLE) {
+ ICmpInst::Predicate LHSCC, RHSCC;
+ if (match(Op0, m_ICmp(LHSCC, m_Value(LHSVal), m_ConstantInt(LHSCst))))
+ if (match(RHS, m_ICmp(RHSCC, m_Value(RHSVal), m_ConstantInt(RHSCst))))
+ if (LHSVal == RHSVal && // Found (X icmp C1) | (X icmp C2)
+ // icmp [us][gl]e x, cst is folded to icmp [us][gl]t elsewhere.
+ LHSCC != ICmpInst::ICMP_UGE && LHSCC != ICmpInst::ICMP_ULE &&
+ RHSCC != ICmpInst::ICMP_UGE && RHSCC != ICmpInst::ICMP_ULE &&
+ LHSCC != ICmpInst::ICMP_SGE && LHSCC != ICmpInst::ICMP_SLE &&
+ RHSCC != ICmpInst::ICMP_SGE && RHSCC != ICmpInst::ICMP_SLE) {
// Ensure that the larger constant is on the RHS.
- Constant *Cmp = ConstantExpr::getSetGT(LHSCst, RHSCst);
- SetCondInst *LHS = cast<SetCondInst>(Op0);
+ ICmpInst::Predicate GT = ICmpInst::isSignedPredicate(LHSCC) ?
+ ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT;
+ Constant *Cmp = ConstantExpr::getICmp(GT, LHSCst, RHSCst);
+ ICmpInst *LHS = cast<ICmpInst>(Op0);
if (cast<ConstantBool>(Cmp)->getValue()) {
std::swap(LHS, RHS);
std::swap(LHSCst, RHSCst);
std::swap(LHSCC, RHSCC);
}
- // At this point, we know we have have two setcc instructions
+ // At this point, we know we have have two icmp instructions
// comparing a value against two constants and or'ing the result
// together. Because of the above check, we know that we only have
- // SetEQ, SetNE, SetLT, and SetGT here. We also know (from the
- // FoldSetCCLogical check above), that the two constants are not
+ // ICMP_EQ, ICMP_NE, ICMP_LT, and ICMP_GT here. We also know (from the
+ // FoldICmpLogical check above), that the two constants are not
// equal.
assert(LHSCst != RHSCst && "Compares not folded above?");
switch (LHSCC) {
default: assert(0 && "Unknown integer condition code!");
- case Instruction::SetEQ:
+ case ICmpInst::ICMP_EQ:
switch (RHSCC) {
default: assert(0 && "Unknown integer condition code!");
- case Instruction::SetEQ:
+ case ICmpInst::ICMP_EQ:
if (LHSCst == SubOne(RHSCst)) {// (X == 13 | X == 14) -> X-13 <u 2
Constant *AddCST = ConstantExpr::getNeg(LHSCst);
Instruction *Add = BinaryOperator::createAdd(LHSVal, AddCST,
LHSVal->getName()+".off");
InsertNewInstBefore(Add, I);
- const Type *UnsType = Add->getType()->getUnsignedVersion();
- Value *OffsetVal = InsertCastBefore(Instruction::BitCast, Add,
- UnsType, I);
AddCST = ConstantExpr::getSub(AddOne(RHSCst), LHSCst);
- AddCST = ConstantExpr::getBitCast(AddCST, UnsType);
- return new SetCondInst(Instruction::SetLT, OffsetVal, AddCST);
+ return new ICmpInst(ICmpInst::ICMP_ULT, Add, AddCST);
}
- break; // (X == 13 | X == 15) -> no change
-
- case Instruction::SetGT: // (X == 13 | X > 14) -> no change
+ break; // (X == 13 | X == 15) -> no change
+ case ICmpInst::ICMP_UGT: // (X == 13 | X u> 14) -> no change
+ case ICmpInst::ICMP_SGT: // (X == 13 | X s> 14) -> no change
break;
- case Instruction::SetNE: // (X == 13 | X != 15) -> X != 15
- case Instruction::SetLT: // (X == 13 | X < 15) -> X < 15
+ case ICmpInst::ICMP_NE: // (X == 13 | X != 15) -> X != 15
+ case ICmpInst::ICMP_ULT: // (X == 13 | X u< 15) -> X u< 15
+ case ICmpInst::ICMP_SLT: // (X == 13 | X s< 15) -> X s< 15
return ReplaceInstUsesWith(I, RHS);
}
break;
- case Instruction::SetNE:
+ case ICmpInst::ICMP_NE:
switch (RHSCC) {
default: assert(0 && "Unknown integer condition code!");
- case Instruction::SetEQ: // (X != 13 | X == 15) -> X != 13
- case Instruction::SetGT: // (X != 13 | X > 15) -> X != 13
+ case ICmpInst::ICMP_EQ: // (X != 13 | X == 15) -> X != 13
+ case ICmpInst::ICMP_UGT: // (X != 13 | X u> 15) -> X != 13
+ case ICmpInst::ICMP_SGT: // (X != 13 | X s> 15) -> X != 13
return ReplaceInstUsesWith(I, LHS);
- case Instruction::SetNE: // (X != 13 | X != 15) -> true
- case Instruction::SetLT: // (X != 13 | X < 15) -> true
+ case ICmpInst::ICMP_NE: // (X != 13 | X != 15) -> true
+ case ICmpInst::ICMP_ULT: // (X != 13 | X u< 15) -> true
+ case ICmpInst::ICMP_SLT: // (X != 13 | X s< 15) -> true
return ReplaceInstUsesWith(I, ConstantBool::getTrue());
}
break;
- case Instruction::SetLT:
+ case ICmpInst::ICMP_ULT:
switch (RHSCC) {
default: assert(0 && "Unknown integer condition code!");
- case Instruction::SetEQ: // (X < 13 | X == 14) -> no change
+ case ICmpInst::ICMP_EQ: // (X u< 13 | X == 14) -> no change
+ break;
+ case ICmpInst::ICMP_UGT: // (X u< 13 | X u> 15) ->(X-13) u> 2
+ return InsertRangeTest(LHSVal, LHSCst, AddOne(RHSCst), false,
+ false, I);
+ case ICmpInst::ICMP_SGT: // (X u< 13 | X s> 15) -> no change
break;
- case Instruction::SetGT: // (X < 13 | X > 15) -> (X-13) > 2
- return InsertRangeTest(LHSVal, LHSCst, AddOne(RHSCst), false, I);
- case Instruction::SetNE: // (X < 13 | X != 15) -> X != 15
- case Instruction::SetLT: // (X < 13 | X < 15) -> X < 15
+ case ICmpInst::ICMP_NE: // (X u< 13 | X != 15) -> X != 15
+ case ICmpInst::ICMP_ULT: // (X u< 13 | X u< 15) -> X u< 15
return ReplaceInstUsesWith(I, RHS);
+ case ICmpInst::ICMP_SLT: // (X u< 13 | X s< 15) -> no change
+ break;
}
break;
- case Instruction::SetGT:
+ case ICmpInst::ICMP_SLT:
switch (RHSCC) {
default: assert(0 && "Unknown integer condition code!");
- case Instruction::SetEQ: // (X > 13 | X == 15) -> X > 13
- case Instruction::SetGT: // (X > 13 | X > 15) -> X > 13
+ case ICmpInst::ICMP_EQ: // (X s< 13 | X == 14) -> no change
+ break;
+ case ICmpInst::ICMP_SGT: // (X s< 13 | X s> 15) ->(X-13) s> 2
+ return InsertRangeTest(LHSVal, LHSCst, AddOne(RHSCst), true,
+ false, I);
+ case ICmpInst::ICMP_UGT: // (X s< 13 | X u> 15) -> no change
+ break;
+ case ICmpInst::ICMP_NE: // (X s< 13 | X != 15) -> X != 15
+ case ICmpInst::ICMP_SLT: // (X s< 13 | X s< 15) -> X s< 15
+ return ReplaceInstUsesWith(I, RHS);
+ case ICmpInst::ICMP_ULT: // (X s< 13 | X u< 15) -> no change
+ break;
+ }
+ break;
+ case ICmpInst::ICMP_UGT:
+ switch (RHSCC) {
+ default: assert(0 && "Unknown integer condition code!");
+ case ICmpInst::ICMP_EQ: // (X u> 13 | X == 15) -> X u> 13
+ case ICmpInst::ICMP_UGT: // (X u> 13 | X u> 15) -> X u> 13
+ return ReplaceInstUsesWith(I, LHS);
+ case ICmpInst::ICMP_SGT: // (X u> 13 | X s> 15) -> no change
+ break;
+ case ICmpInst::ICMP_NE: // (X u> 13 | X != 15) -> true
+ case ICmpInst::ICMP_ULT: // (X u> 13 | X u< 15) -> true
+ return ReplaceInstUsesWith(I, ConstantBool::getTrue());
+ case ICmpInst::ICMP_SLT: // (X u> 13 | X s< 15) -> no change
+ break;
+ }
+ break;
+ case ICmpInst::ICMP_SGT:
+ switch (RHSCC) {
+ default: assert(0 && "Unknown integer condition code!");
+ case ICmpInst::ICMP_EQ: // (X s> 13 | X == 15) -> X > 13
+ case ICmpInst::ICMP_SGT: // (X s> 13 | X s> 15) -> X > 13
return ReplaceInstUsesWith(I, LHS);
- case Instruction::SetNE: // (X > 13 | X != 15) -> true
- case Instruction::SetLT: // (X > 13 | X < 15) -> true
+ case ICmpInst::ICMP_UGT: // (X s> 13 | X u> 15) -> no change
+ break;
+ case ICmpInst::ICMP_NE: // (X s> 13 | X != 15) -> true
+ case ICmpInst::ICMP_SLT: // (X s> 13 | X s< 15) -> true
return ReplaceInstUsesWith(I, ConstantBool::getTrue());
+ case ICmpInst::ICMP_ULT: // (X s> 13 | X u< 15) -> no change
+ break;
}
+ break;
}
}
}
const Type *SrcTy = Op0C->getOperand(0)->getType();
if (SrcTy == Op1C->getOperand(0)->getType() && SrcTy->isIntegral() &&
// Only do this if the casts both really cause code to be generated.
- ValueRequiresCast(Op0C->getOperand(0), I.getType(), TD) &&
- ValueRequiresCast(Op1C->getOperand(0), I.getType(), TD)) {
+ ValueRequiresCast(Op0C->getOpcode(), Op0C->getOperand(0),
+ I.getType(), TD) &&
+ ValueRequiresCast(Op1C->getOpcode(), Op1C->getOperand(0),
+ I.getType(), TD)) {
Instruction *NewOp = BinaryOperator::createOr(Op0C->getOperand(0),
Op1C->getOperand(0),
I.getName());
return &I;
if (ConstantIntegral *RHS = dyn_cast<ConstantIntegral>(Op1)) {
- if (BinaryOperator *Op0I = dyn_cast<BinaryOperator>(Op0)) {
- // xor (setcc A, B), true = not (setcc A, B) = setncc A, B
- if (SetCondInst *SCI = dyn_cast<SetCondInst>(Op0I))
- if (RHS == ConstantBool::getTrue() && SCI->hasOneUse())
- return new SetCondInst(SCI->getInverseCondition(),
- SCI->getOperand(0), SCI->getOperand(1));
+ // xor (icmp A, B), true = not (icmp A, B) = !icmp A, B
+ if (ICmpInst *ICI = dyn_cast<ICmpInst>(Op0))
+ if (RHS == ConstantBool::getTrue() && ICI->hasOneUse())
+ return new ICmpInst(ICI->getInversePredicate(),
+ ICI->getOperand(0), ICI->getOperand(1));
+ if (BinaryOperator *Op0I = dyn_cast<BinaryOperator>(Op0)) {
// ~(c-X) == X-c-1 == X+(-c-1)
if (Op0I->getOpcode() == Instruction::Sub && RHS->isAllOnesValue())
if (Constant *Op0I0C = dyn_cast<Constant>(Op0I->getOperand(0))) {
}
}
- // (setcc1 A, B) ^ (setcc2 A, B) --> (setcc3 A, B)
- if (SetCondInst *RHS = dyn_cast<SetCondInst>(I.getOperand(1)))
- if (Instruction *R = AssociativeOpt(I, FoldSetCCLogical(*this, RHS)))
+ // (icmp1 A, B) ^ (icmp2 A, B) --> (icmp3 A, B)
+ if (ICmpInst *RHS = dyn_cast<ICmpInst>(I.getOperand(1)))
+ if (Instruction *R = AssociativeOpt(I, FoldICmpLogical(*this, RHS)))
return R;
// fold (xor (cast A), (cast B)) -> (cast (xor A, B))
const Type *SrcTy = Op0C->getOperand(0)->getType();
if (SrcTy == Op1C->getOperand(0)->getType() && SrcTy->isIntegral() &&
// Only do this if the casts both really cause code to be generated.
- ValueRequiresCast(Op0C->getOperand(0), I.getType(), TD) &&
- ValueRequiresCast(Op1C->getOperand(0), I.getType(), TD)) {
+ ValueRequiresCast(Op0C->getOpcode(), Op0C->getOperand(0),
+ I.getType(), TD) &&
+ ValueRequiresCast(Op1C->getOpcode(), Op1C->getOperand(0),
+ I.getType(), TD)) {
Instruction *NewOp = BinaryOperator::createXor(Op0C->getOperand(0),
Op1C->getOperand(0),
I.getName());
static Value *EmitGEPOffset(User *GEP, Instruction &I, InstCombiner &IC) {
TargetData &TD = IC.getTargetData();
gep_type_iterator GTI = gep_type_begin(GEP);
- const Type *UIntPtrTy = TD.getIntPtrType();
- const Type *SIntPtrTy = UIntPtrTy->getSignedVersion();
- Value *Result = Constant::getNullValue(SIntPtrTy);
+ const Type *IntPtrTy = TD.getIntPtrType();
+ Value *Result = Constant::getNullValue(IntPtrTy);
// Build a mask for high order bits.
uint64_t PtrSizeMask = ~0ULL >> (64-TD.getPointerSize()*8);
for (unsigned i = 1, e = GEP->getNumOperands(); i != e; ++i, ++GTI) {
Value *Op = GEP->getOperand(i);
uint64_t Size = TD.getTypeSize(GTI.getIndexedType()) & PtrSizeMask;
- Constant *Scale = ConstantInt::get(SIntPtrTy, Size);
+ Constant *Scale = ConstantInt::get(IntPtrTy, Size);
if (Constant *OpC = dyn_cast<Constant>(Op)) {
if (!OpC->isNullValue()) {
- OpC = ConstantExpr::getIntegerCast(OpC, SIntPtrTy, true /*SExt*/);
+ OpC = ConstantExpr::getIntegerCast(OpC, IntPtrTy, true /*SExt*/);
Scale = ConstantExpr::getMul(OpC, Scale);
if (Constant *RC = dyn_cast<Constant>(Result))
Result = ConstantExpr::getAdd(RC, Scale);
}
} else {
// Convert to correct type.
- Op = IC.InsertNewInstBefore(CastInst::createSExtOrBitCast(Op, SIntPtrTy,
+ Op = IC.InsertNewInstBefore(CastInst::createSExtOrBitCast(Op, IntPtrTy,
Op->getName()+".c"), I);
if (Size != 1)
// We'll let instcombine(mul) convert this to a shl if possible.
return Result;
}
-/// FoldGEPSetCC - Fold comparisons between a GEP instruction and something
+/// FoldGEPICmp - Fold comparisons between a GEP instruction and something
/// else. At this point we know that the GEP is on the LHS of the comparison.
-Instruction *InstCombiner::FoldGEPSetCC(User *GEPLHS, Value *RHS,
- Instruction::BinaryOps Cond,
- Instruction &I) {
+Instruction *InstCombiner::FoldGEPICmp(User *GEPLHS, Value *RHS,
+ ICmpInst::Predicate Cond,
+ Instruction &I) {
assert(dyn_castGetElementPtr(GEPLHS) && "LHS is not a getelementptr!");
if (CastInst *CI = dyn_cast<CastInst>(RHS))
Value *PtrBase = GEPLHS->getOperand(0);
if (PtrBase == RHS) {
// As an optimization, we don't actually have to compute the actual value of
- // OFFSET if this is a seteq or setne comparison, just return whether each
- // index is zero or not.
- if (Cond == Instruction::SetEQ || Cond == Instruction::SetNE) {
+ // OFFSET if this is a icmp_eq or icmp_ne comparison, just return whether
+ // each index is zero or not.
+ if (Cond == ICmpInst::ICMP_EQ || Cond == ICmpInst::ICMP_NE) {
Instruction *InVal = 0;
gep_type_iterator GTI = gep_type_begin(GEPLHS);
for (unsigned i = 1, e = GEPLHS->getNumOperands(); i != e; ++i, ++GTI) {
EmitIt = false; // This is indexing into a zero sized array?
} else if (isa<ConstantInt>(C))
return ReplaceInstUsesWith(I, // No comparison is needed here.
- ConstantBool::get(Cond == Instruction::SetNE));
+ ConstantBool::get(Cond == ICmpInst::ICMP_NE));
}
if (EmitIt) {
Instruction *Comp =
- new SetCondInst(Cond, GEPLHS->getOperand(i),
+ new ICmpInst(Cond, GEPLHS->getOperand(i),
Constant::getNullValue(GEPLHS->getOperand(i)->getType()));
if (InVal == 0)
InVal = Comp;
else {
InVal = InsertNewInstBefore(InVal, I);
InsertNewInstBefore(Comp, I);
- if (Cond == Instruction::SetNE) // True if any are unequal
+ if (Cond == ICmpInst::ICMP_NE) // True if any are unequal
InVal = BinaryOperator::createOr(InVal, Comp);
else // True if all are equal
InVal = BinaryOperator::createAnd(InVal, Comp);
if (InVal)
return InVal;
else
- ReplaceInstUsesWith(I, // No comparison is needed here, all indexes = 0
- ConstantBool::get(Cond == Instruction::SetEQ));
+ // No comparison is needed here, all indexes = 0
+ ReplaceInstUsesWith(I, ConstantBool::get(Cond == ICmpInst::ICMP_EQ));
}
- // Only lower this if the setcc is the only user of the GEP or if we expect
+ // Only lower this if the icmp is the only user of the GEP or if we expect
// the result to fold to a constant!
if (isa<ConstantExpr>(GEPLHS) || GEPLHS->hasOneUse()) {
// ((gep Ptr, OFFSET) cmp Ptr) ---> (OFFSET cmp 0).
Value *Offset = EmitGEPOffset(GEPLHS, I, *this);
- return new SetCondInst(Cond, Offset,
- Constant::getNullValue(Offset->getType()));
+ return new ICmpInst(ICmpInst::getSignedPredicate(Cond), Offset,
+ Constant::getNullValue(Offset->getType()));
}
} else if (User *GEPRHS = dyn_castGetElementPtr(RHS)) {
// If the base pointers are different, but the indices are the same, just
// If all indices are the same, just compare the base pointers.
if (IndicesTheSame)
- return new SetCondInst(Cond, GEPLHS->getOperand(0),
- GEPRHS->getOperand(0));
+ return new ICmpInst(ICmpInst::getSignedPredicate(Cond),
+ GEPLHS->getOperand(0), GEPRHS->getOperand(0));
// Otherwise, the base pointers are different and the indices are
// different, bail out.
break;
}
if (AllZeros)
- return FoldGEPSetCC(GEPRHS, GEPLHS->getOperand(0),
- SetCondInst::getSwappedCondition(Cond), I);
+ return FoldGEPICmp(GEPRHS, GEPLHS->getOperand(0),
+ ICmpInst::getSwappedPredicate(Cond), I);
// If the other GEP has all zero indices, recurse.
AllZeros = true;
break;
}
if (AllZeros)
- return FoldGEPSetCC(GEPLHS, GEPRHS->getOperand(0), Cond, I);
+ return FoldGEPICmp(GEPLHS, GEPRHS->getOperand(0), Cond, I);
if (GEPLHS->getNumOperands() == GEPRHS->getNumOperands()) {
// If the GEPs only differ by one index, compare it.
if (NumDifferences == 0) // SAME GEP?
return ReplaceInstUsesWith(I, // No comparison is needed here.
- ConstantBool::get(Cond == Instruction::SetEQ));
+ ConstantBool::get(Cond == ICmpInst::ICMP_EQ));
else if (NumDifferences == 1) {
Value *LHSV = GEPLHS->getOperand(DiffOperand);
Value *RHSV = GEPRHS->getOperand(DiffOperand);
-
- // Convert the operands to signed values to make sure to perform a
- // signed comparison.
- const Type *NewTy = LHSV->getType()->getSignedVersion();
- if (LHSV->getType() != NewTy)
- LHSV = InsertCastBefore(Instruction::BitCast, LHSV, NewTy, I);
- if (RHSV->getType() != NewTy)
- RHSV = InsertCastBefore(Instruction::BitCast, RHSV, NewTy, I);
- return new SetCondInst(Cond, LHSV, RHSV);
+ if (LHSV->getType() != RHSV->getType())
+ // Doesn't matter which one we bitconvert here.
+ LHSV = InsertCastBefore(Instruction::BitCast, LHSV, RHSV->getType(),
+ I);
+ // Make sure we do a signed comparison here.
+ return new ICmpInst(ICmpInst::getSignedPredicate(Cond), LHSV, RHSV);
}
}
- // Only lower this if the setcc is the only user of the GEP or if we expect
+ // Only lower this if the icmp is the only user of the GEP or if we expect
// the result to fold to a constant!
if ((isa<ConstantExpr>(GEPLHS) || GEPLHS->hasOneUse()) &&
(isa<ConstantExpr>(GEPRHS) || GEPRHS->hasOneUse())) {
// ((gep Ptr, OFFSET1) cmp (gep Ptr, OFFSET2) ---> (OFFSET1 cmp OFFSET2)
Value *L = EmitGEPOffset(GEPLHS, I, *this);
Value *R = EmitGEPOffset(GEPRHS, I, *this);
- return new SetCondInst(Cond, L, R);
+ return new ICmpInst(ICmpInst::getSignedPredicate(Cond), L, R);
}
}
return 0;
}
+Instruction *InstCombiner::visitFCmpInst(FCmpInst &I) {
+ bool Changed = SimplifyCompare(I);
+ Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
-Instruction *InstCombiner::visitSetCondInst(SetCondInst &I) {
- bool Changed = SimplifyCommutative(I);
+ // fcmp pred X, X
+ if (Op0 == Op1)
+ return ReplaceInstUsesWith(I, ConstantBool::get(isTrueWhenEqual(I)));
+
+ if (isa<UndefValue>(Op1)) // fcmp pred X, undef -> undef
+ return ReplaceInstUsesWith(I, UndefValue::get(Type::BoolTy));
+
+ // Handle fcmp with constant RHS
+ if (Constant *RHSC = dyn_cast<Constant>(Op1)) {
+ if (Instruction *LHSI = dyn_cast<Instruction>(Op0))
+ switch (LHSI->getOpcode()) {
+ case Instruction::PHI:
+ if (Instruction *NV = FoldOpIntoPhi(I))
+ return NV;
+ break;
+ case Instruction::Select:
+ // If either operand of the select is a constant, we can fold the
+ // comparison into the select arms, which will cause one to be
+ // constant folded and the select turned into a bitwise or.
+ Value *Op1 = 0, *Op2 = 0;
+ if (LHSI->hasOneUse()) {
+ if (Constant *C = dyn_cast<Constant>(LHSI->getOperand(1))) {
+ // Fold the known value into the constant operand.
+ Op1 = ConstantExpr::getCompare(I.getPredicate(), C, RHSC);
+ // Insert a new FCmp of the other select operand.
+ Op2 = InsertNewInstBefore(new FCmpInst(I.getPredicate(),
+ LHSI->getOperand(2), RHSC,
+ I.getName()), I);
+ } else if (Constant *C = dyn_cast<Constant>(LHSI->getOperand(2))) {
+ // Fold the known value into the constant operand.
+ Op2 = ConstantExpr::getCompare(I.getPredicate(), C, RHSC);
+ // Insert a new FCmp of the other select operand.
+ Op1 = InsertNewInstBefore(new FCmpInst(I.getPredicate(),
+ LHSI->getOperand(1), RHSC,
+ I.getName()), I);
+ }
+ }
+
+ if (Op1)
+ return new SelectInst(LHSI->getOperand(0), Op1, Op2);
+ break;
+ }
+ }
+
+ return Changed ? &I : 0;
+}
+
+Instruction *InstCombiner::visitICmpInst(ICmpInst &I) {
+ bool Changed = SimplifyCompare(I);
Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
const Type *Ty = Op0->getType();
- // setcc X, X
+ // icmp X, X
if (Op0 == Op1)
return ReplaceInstUsesWith(I, ConstantBool::get(isTrueWhenEqual(I)));
- if (isa<UndefValue>(Op1)) // X setcc undef -> undef
+ if (isa<UndefValue>(Op1)) // X icmp undef -> undef
return ReplaceInstUsesWith(I, UndefValue::get(Type::BoolTy));
- // setcc <global/alloca*/null>, <global/alloca*/null> - Global/Stack value
+ // icmp of GlobalValues can never equal each other as long as they aren't
+ // external weak linkage type.
+ if (GlobalValue *GV0 = dyn_cast<GlobalValue>(Op0))
+ if (GlobalValue *GV1 = dyn_cast<GlobalValue>(Op1))
+ if (!GV0->hasExternalWeakLinkage() || !GV1->hasExternalWeakLinkage())
+ return ReplaceInstUsesWith(I, ConstantBool::get(!isTrueWhenEqual(I)));
+
+ // icmp <global/alloca*/null>, <global/alloca*/null> - Global/Stack value
// addresses never equal each other! We already know that Op0 != Op1.
if ((isa<GlobalValue>(Op0) || isa<AllocaInst>(Op0) ||
isa<ConstantPointerNull>(Op0)) &&
isa<ConstantPointerNull>(Op1)))
return ReplaceInstUsesWith(I, ConstantBool::get(!isTrueWhenEqual(I)));
- // setcc's with boolean values can always be turned into bitwise operations
+ // icmp's with boolean values can always be turned into bitwise operations
if (Ty == Type::BoolTy) {
- switch (I.getOpcode()) {
- default: assert(0 && "Invalid setcc instruction!");
- case Instruction::SetEQ: { // seteq bool %A, %B -> ~(A^B)
+ switch (I.getPredicate()) {
+ default: assert(0 && "Invalid icmp instruction!");
+ case ICmpInst::ICMP_EQ: { // icmp eq bool %A, %B -> ~(A^B)
Instruction *Xor = BinaryOperator::createXor(Op0, Op1, I.getName()+"tmp");
InsertNewInstBefore(Xor, I);
return BinaryOperator::createNot(Xor);
}
- case Instruction::SetNE:
+ case ICmpInst::ICMP_NE: // icmp eq bool %A, %B -> A^B
return BinaryOperator::createXor(Op0, Op1);
- case Instruction::SetGT:
- std::swap(Op0, Op1); // Change setgt -> setlt
+ case ICmpInst::ICMP_UGT:
+ case ICmpInst::ICMP_SGT:
+ std::swap(Op0, Op1); // Change icmp gt -> icmp lt
// FALL THROUGH
- case Instruction::SetLT: { // setlt bool A, B -> ~X & Y
+ case ICmpInst::ICMP_ULT:
+ case ICmpInst::ICMP_SLT: { // icmp lt bool A, B -> ~X & Y
Instruction *Not = BinaryOperator::createNot(Op0, I.getName()+"tmp");
InsertNewInstBefore(Not, I);
return BinaryOperator::createAnd(Not, Op1);
}
- case Instruction::SetGE:
- std::swap(Op0, Op1); // Change setge -> setle
+ case ICmpInst::ICMP_UGE:
+ case ICmpInst::ICMP_SGE:
+ std::swap(Op0, Op1); // Change icmp ge -> icmp le
// FALL THROUGH
- case Instruction::SetLE: { // setle bool %A, %B -> ~A | B
+ case ICmpInst::ICMP_ULE:
+ case ICmpInst::ICMP_SLE: { // icmp le bool %A, %B -> ~A | B
Instruction *Not = BinaryOperator::createNot(Op0, I.getName()+"tmp");
InsertNewInstBefore(Not, I);
return BinaryOperator::createOr(Not, Op1);
// See if we are doing a comparison between a constant and an instruction that
// can be folded into the comparison.
if (ConstantInt *CI = dyn_cast<ConstantInt>(Op1)) {
- // Check to see if we are comparing against the minimum or maximum value...
- if (CI->isMinValue(CI->getType()->isSigned())) {
- if (I.getOpcode() == Instruction::SetLT) // A < MIN -> FALSE
+ switch (I.getPredicate()) {
+ default: break;
+ case ICmpInst::ICMP_ULT: // A <u MIN -> FALSE
+ if (CI->isMinValue(false))
return ReplaceInstUsesWith(I, ConstantBool::getFalse());
- if (I.getOpcode() == Instruction::SetGE) // A >= MIN -> TRUE
- return ReplaceInstUsesWith(I, ConstantBool::getTrue());
- if (I.getOpcode() == Instruction::SetLE) // A <= MIN -> A == MIN
- return BinaryOperator::createSetEQ(Op0, Op1);
- if (I.getOpcode() == Instruction::SetGT) // A > MIN -> A != MIN
- return BinaryOperator::createSetNE(Op0, Op1);
+ if (CI->isMaxValue(false)) // A <u MAX -> A != MAX
+ return new ICmpInst(ICmpInst::ICMP_NE, Op0,Op1);
+ if (isMinValuePlusOne(CI,false)) // A <u MIN+1 -> A == MIN
+ return new ICmpInst(ICmpInst::ICMP_EQ, Op0, SubOne(CI));
+ break;
- } else if (CI->isMaxValue(CI->getType()->isSigned())) {
- if (I.getOpcode() == Instruction::SetGT) // A > MAX -> FALSE
+ case ICmpInst::ICMP_SLT:
+ if (CI->isMinValue(true)) // A <s MIN -> FALSE
return ReplaceInstUsesWith(I, ConstantBool::getFalse());
- if (I.getOpcode() == Instruction::SetLE) // A <= MAX -> TRUE
+ if (CI->isMaxValue(true)) // A <s MAX -> A != MAX
+ return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);
+ if (isMinValuePlusOne(CI,true)) // A <s MIN+1 -> A == MIN
+ return new ICmpInst(ICmpInst::ICMP_EQ, Op0, SubOne(CI));
+ break;
+
+ case ICmpInst::ICMP_UGT:
+ if (CI->isMaxValue(false)) // A >u MAX -> FALSE
+ return ReplaceInstUsesWith(I, ConstantBool::getFalse());
+ if (CI->isMinValue(false)) // A >u MIN -> A != MIN
+ return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);
+ if (isMaxValueMinusOne(CI, false)) // A >u MAX-1 -> A == MAX
+ return new ICmpInst(ICmpInst::ICMP_EQ, Op0, AddOne(CI));
+ break;
+
+ case ICmpInst::ICMP_SGT:
+ if (CI->isMaxValue(true)) // A >s MAX -> FALSE
+ return ReplaceInstUsesWith(I, ConstantBool::getFalse());
+ if (CI->isMinValue(true)) // A >s MIN -> A != MIN
+ return new ICmpInst(ICmpInst::ICMP_NE, Op0, Op1);
+ if (isMaxValueMinusOne(CI, true)) // A >s MAX-1 -> A == MAX
+ return new ICmpInst(ICmpInst::ICMP_EQ, Op0, AddOne(CI));
+ break;
+
+ case ICmpInst::ICMP_ULE:
+ if (CI->isMaxValue(false)) // A <=u MAX -> TRUE
+ return ReplaceInstUsesWith(I, ConstantBool::getTrue());
+ if (CI->isMinValue(false)) // A <=u MIN -> A == MIN
+ return new ICmpInst(ICmpInst::ICMP_EQ, Op0, Op1);
+ if (isMaxValueMinusOne(CI,false)) // A <=u MAX-1 -> A != MAX
+ return new ICmpInst(ICmpInst::ICMP_NE, Op0, AddOne(CI));
+ break;
+
+ case ICmpInst::ICMP_SLE:
+ if (CI->isMaxValue(true)) // A <=s MAX -> TRUE
+ return ReplaceInstUsesWith(I, ConstantBool::getTrue());
+ if (CI->isMinValue(true)) // A <=s MIN -> A == MIN
+ return new ICmpInst(ICmpInst::ICMP_EQ, Op0, Op1);
+ if (isMaxValueMinusOne(CI,true)) // A <=s MAX-1 -> A != MAX
+ return new ICmpInst(ICmpInst::ICMP_NE, Op0, AddOne(CI));
+ break;
+
+ case ICmpInst::ICMP_UGE:
+ if (CI->isMinValue(false)) // A >=u MIN -> TRUE
+ return ReplaceInstUsesWith(I, ConstantBool::getTrue());
+ if (CI->isMaxValue(false)) // A >=u MAX -> A == MAX
+ return new ICmpInst(ICmpInst::ICMP_EQ, Op0, Op1);
+ if (isMinValuePlusOne(CI,false)) // A >=u MIN-1 -> A != MIN
+ return new ICmpInst(ICmpInst::ICMP_NE, Op0, SubOne(CI));
+ break;
+
+ case ICmpInst::ICMP_SGE:
+ if (CI->isMinValue(true)) // A >=s MIN -> TRUE
return ReplaceInstUsesWith(I, ConstantBool::getTrue());
- if (I.getOpcode() == Instruction::SetGE) // A >= MAX -> A == MAX
- return BinaryOperator::createSetEQ(Op0, Op1);
- if (I.getOpcode() == Instruction::SetLT) // A < MAX -> A != MAX
- return BinaryOperator::createSetNE(Op0, Op1);
-
- // Comparing against a value really close to min or max?
- } else if (isMinValuePlusOne(CI)) {
- if (I.getOpcode() == Instruction::SetLT) // A < MIN+1 -> A == MIN
- return BinaryOperator::createSetEQ(Op0, SubOne(CI));
- if (I.getOpcode() == Instruction::SetGE) // A >= MIN-1 -> A != MIN
- return BinaryOperator::createSetNE(Op0, SubOne(CI));
-
- } else if (isMaxValueMinusOne(CI)) {
- if (I.getOpcode() == Instruction::SetGT) // A > MAX-1 -> A == MAX
- return BinaryOperator::createSetEQ(Op0, AddOne(CI));
- if (I.getOpcode() == Instruction::SetLE) // A <= MAX-1 -> A != MAX
- return BinaryOperator::createSetNE(Op0, AddOne(CI));
- }
-
- // If we still have a setle or setge instruction, turn it into the
- // appropriate setlt or setgt instruction. Since the border cases have
+ if (CI->isMaxValue(true)) // A >=s MAX -> A == MAX
+ return new ICmpInst(ICmpInst::ICMP_EQ, Op0, Op1);
+ if (isMinValuePlusOne(CI,true)) // A >=s MIN-1 -> A != MIN
+ return new ICmpInst(ICmpInst::ICMP_NE, Op0, SubOne(CI));
+ break;
+ }
+
+ // If we still have a icmp le or icmp ge instruction, turn it into the
+ // appropriate icmp lt or icmp gt instruction. Since the border cases have
// already been handled above, this requires little checking.
//
- if (I.getOpcode() == Instruction::SetLE)
- return BinaryOperator::createSetLT(Op0, AddOne(CI));
- if (I.getOpcode() == Instruction::SetGE)
- return BinaryOperator::createSetGT(Op0, SubOne(CI));
-
+ if (I.getPredicate() == ICmpInst::ICMP_ULE)
+ return new ICmpInst(ICmpInst::ICMP_ULT, Op0, AddOne(CI));
+ if (I.getPredicate() == ICmpInst::ICMP_SLE)
+ return new ICmpInst(ICmpInst::ICMP_SLT, Op0, AddOne(CI));
+ if (I.getPredicate() == ICmpInst::ICMP_UGE)
+ return new ICmpInst( ICmpInst::ICMP_UGT, Op0, SubOne(CI));
+ if (I.getPredicate() == ICmpInst::ICMP_SGE)
+ return new ICmpInst(ICmpInst::ICMP_SGT, Op0, SubOne(CI));
// See if we can fold the comparison based on bits known to be zero or one
// in the input.
// Given the known and unknown bits, compute a range that the LHS could be
// in.
if (KnownOne | KnownZero) {
- if (Ty->isUnsigned()) { // Unsigned comparison.
- uint64_t Min, Max;
- uint64_t RHSVal = CI->getZExtValue();
- ComputeUnsignedMinMaxValuesFromKnownBits(Ty, KnownZero, KnownOne,
- Min, Max);
- switch (I.getOpcode()) { // LE/GE have been folded already.
- default: assert(0 && "Unknown setcc opcode!");
- case Instruction::SetEQ:
- if (Max < RHSVal || Min > RHSVal)
- return ReplaceInstUsesWith(I, ConstantBool::getFalse());
- break;
- case Instruction::SetNE:
- if (Max < RHSVal || Min > RHSVal)
- return ReplaceInstUsesWith(I, ConstantBool::getTrue());
- break;
- case Instruction::SetLT:
- if (Max < RHSVal)
- return ReplaceInstUsesWith(I, ConstantBool::getTrue());
- if (Min > RHSVal)
- return ReplaceInstUsesWith(I, ConstantBool::getFalse());
- break;
- case Instruction::SetGT:
- if (Min > RHSVal)
- return ReplaceInstUsesWith(I, ConstantBool::getTrue());
- if (Max < RHSVal)
- return ReplaceInstUsesWith(I, ConstantBool::getFalse());
- break;
- }
- } else { // Signed comparison.
- int64_t Min, Max;
- int64_t RHSVal = CI->getSExtValue();
- ComputeSignedMinMaxValuesFromKnownBits(Ty, KnownZero, KnownOne,
- Min, Max);
- switch (I.getOpcode()) { // LE/GE have been folded already.
- default: assert(0 && "Unknown setcc opcode!");
- case Instruction::SetEQ:
- if (Max < RHSVal || Min > RHSVal)
- return ReplaceInstUsesWith(I, ConstantBool::getFalse());
- break;
- case Instruction::SetNE:
- if (Max < RHSVal || Min > RHSVal)
- return ReplaceInstUsesWith(I, ConstantBool::getTrue());
- break;
- case Instruction::SetLT:
- if (Max < RHSVal)
- return ReplaceInstUsesWith(I, ConstantBool::getTrue());
- if (Min > RHSVal)
- return ReplaceInstUsesWith(I, ConstantBool::getFalse());
- break;
- case Instruction::SetGT:
- if (Min > RHSVal)
- return ReplaceInstUsesWith(I, ConstantBool::getTrue());
- if (Max < RHSVal)
- return ReplaceInstUsesWith(I, ConstantBool::getFalse());
- break;
- }
+ // Compute the Min, Max and RHS values based on the known bits. For the
+ // EQ and NE we use unsigned values.
+ uint64_t UMin, UMax, URHSVal;
+ int64_t SMin, SMax, SRHSVal;
+ if (ICmpInst::isSignedPredicate(I.getPredicate())) {
+ SRHSVal = CI->getSExtValue();
+ ComputeSignedMinMaxValuesFromKnownBits(Ty, KnownZero, KnownOne, SMin,
+ SMax);
+ } else {
+ URHSVal = CI->getZExtValue();
+ ComputeUnsignedMinMaxValuesFromKnownBits(Ty, KnownZero, KnownOne, UMin,
+ UMax);
+ }
+ switch (I.getPredicate()) { // LE/GE have been folded already.
+ default: assert(0 && "Unknown icmp opcode!");
+ case ICmpInst::ICMP_EQ:
+ if (UMax < URHSVal || UMin > URHSVal)
+ return ReplaceInstUsesWith(I, ConstantBool::getFalse());
+ break;
+ case ICmpInst::ICMP_NE:
+ if (UMax < URHSVal || UMin > URHSVal)
+ return ReplaceInstUsesWith(I, ConstantBool::getTrue());
+ break;
+ case ICmpInst::ICMP_ULT:
+ if (UMax < URHSVal)
+ return ReplaceInstUsesWith(I, ConstantBool::getTrue());
+ if (UMin > URHSVal)
+ return ReplaceInstUsesWith(I, ConstantBool::getFalse());
+ break;
+ case ICmpInst::ICMP_UGT:
+ if (UMin > URHSVal)
+ return ReplaceInstUsesWith(I, ConstantBool::getTrue());
+ if (UMax < URHSVal)
+ return ReplaceInstUsesWith(I, ConstantBool::getFalse());
+ break;
+ case ICmpInst::ICMP_SLT:
+ if (SMax < SRHSVal)
+ return ReplaceInstUsesWith(I, ConstantBool::getTrue());
+ if (SMin > SRHSVal)
+ return ReplaceInstUsesWith(I, ConstantBool::getFalse());
+ break;
+ case ICmpInst::ICMP_SGT:
+ if (SMin > SRHSVal)
+ return ReplaceInstUsesWith(I, ConstantBool::getTrue());
+ if (SMax < SRHSVal)
+ return ReplaceInstUsesWith(I, ConstantBool::getFalse());
+ break;
}
}
- // Since the RHS is a constantInt (CI), if the left hand side is an
+ // Since the RHS is a ConstantInt (CI), if the left hand side is an
// instruction, see if that instruction also has constants so that the
- // instruction can be folded into the setcc
+ // instruction can be folded into the icmp
if (Instruction *LHSI = dyn_cast<Instruction>(Op0))
switch (LHSI->getOpcode()) {
case Instruction::And:
LHSI->getOperand(0)->hasOneUse()) {
ConstantInt *AndCST = cast<ConstantInt>(LHSI->getOperand(1));
- // If an operand is an AND of a truncating cast, we can widen the
+ // If the LHS is an AND of a truncating cast, we can widen the
// and/compare to be the input width without changing the value
// produced, eliminating a cast.
if (CastInst *Cast = dyn_cast<CastInst>(LHSI->getOperand(0))) {
BinaryOperator::createAnd(Cast->getOperand(0), NewCST,
LHSI->getName());
InsertNewInstBefore(NewAnd, I);
- return new SetCondInst(I.getOpcode(), NewAnd, NewCI);
+ return new ICmpInst(I.getPredicate(), NewAnd, NewCI);
}
}
// If we shifted bits out, the fold is not going to work out.
// As a special case, check to see if this means that the
// result is always true or false now.
- if (I.getOpcode() == Instruction::SetEQ)
+ if (I.getPredicate() == ICmpInst::ICMP_EQ)
return ReplaceInstUsesWith(I, ConstantBool::getFalse());
- if (I.getOpcode() == Instruction::SetNE)
+ if (I.getPredicate() == ICmpInst::ICMP_NE)
return ReplaceInstUsesWith(I, ConstantBool::getTrue());
} else {
I.setOperand(1, NewCst);
}
break;
- case Instruction::Shl: // (setcc (shl X, ShAmt), CI)
+ case Instruction::Shl: // (icmp pred (shl X, ShAmt), CI)
if (ConstantInt *ShAmt = dyn_cast<ConstantInt>(LHSI->getOperand(1))) {
if (I.isEquality()) {
unsigned TypeBits = CI->getType()->getPrimitiveSizeInBits();
Constant *Comp =
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);
+ bool IsICMP_NE = I.getPredicate() == ICmpInst::ICMP_NE;
+ Constant *Cst = ConstantBool::get(IsICMP_NE);
return ReplaceInstUsesWith(I, Cst);
}
BinaryOperator::createAnd(LHSI->getOperand(0),
Mask, LHSI->getName()+".mask");
Value *And = InsertNewInstBefore(AndI, I);
- return new SetCondInst(I.getOpcode(), And,
+ return new ICmpInst(I.getPredicate(), And,
ConstantExpr::getLShr(CI, ShAmt));
}
}
}
break;
- case Instruction::LShr: // (setcc (shr X, ShAmt), CI)
+ case Instruction::LShr: // (icmp pred (shr X, ShAmt), CI)
case Instruction::AShr:
if (ConstantInt *ShAmt = dyn_cast<ConstantInt>(LHSI->getOperand(1))) {
if (I.isEquality()) {
ShAmt);
if (Comp != CI) {// Comparing against a bit that we know is zero.
- bool IsSetNE = I.getOpcode() == Instruction::SetNE;
- Constant *Cst = ConstantBool::get(IsSetNE);
+ bool IsICMP_NE = I.getPredicate() == ICmpInst::ICMP_NE;
+ Constant *Cst = ConstantBool::get(IsICMP_NE);
return ReplaceInstUsesWith(I, Cst);
}
BinaryOperator::createAnd(LHSI->getOperand(0),
Mask, LHSI->getName()+".mask");
Value *And = InsertNewInstBefore(AndI, I);
- return new SetCondInst(I.getOpcode(), And,
+ return new ICmpInst(I.getPredicate(), And,
ConstantExpr::getShl(CI, ShAmt));
}
}
case Instruction::SDiv:
case Instruction::UDiv:
- // Fold: setcc ([us]div X, C1), C2 -> range test
+ // Fold: icmp pred ([us]div X, C1), C2 -> range test
// Fold this div into the comparison, producing a range check.
// Determine, based on the divide type, what the range is being
// checked. If there is an overflow on the low or high side, remember
// (x /u C1) <u C2. Simply casting the operands and result won't
// work. :( The if statement below tests that condition and bails
// if it finds it.
- const Type *DivRHSTy = DivRHS->getType();
- unsigned DivOpCode = LHSI->getOpcode();
- if (I.isEquality() &&
- ((DivOpCode == Instruction::SDiv && DivRHSTy->isUnsigned()) ||
- (DivOpCode == Instruction::UDiv && DivRHSTy->isSigned())))
+ bool DivIsSigned = LHSI->getOpcode() == Instruction::SDiv;
+ if (!I.isEquality() && DivIsSigned != I.isSignedPredicate())
break;
// Initialize the variables that will indicate the nature of the
// not equal to the divide. Make sure we do the same kind of divide
// as in the LHS instruction that we're folding.
bool ProdOV = !DivRHS->isNullValue() &&
- (DivOpCode == Instruction::SDiv ?
- ConstantExpr::getSDiv(Prod, DivRHS) :
+ (DivIsSigned ? ConstantExpr::getSDiv(Prod, DivRHS) :
ConstantExpr::getUDiv(Prod, DivRHS)) != CI;
- // Get the SetCC opcode
- Instruction::BinaryOps Opcode = I.getOpcode();
+ // Get the ICmp opcode
+ ICmpInst::Predicate predicate = I.getPredicate();
if (DivRHS->isNullValue()) {
// Don't hack on divide by zeros!
- } else if (DivOpCode == Instruction::UDiv) { // udiv
+ } else if (!DivIsSigned) { // udiv
LoBound = Prod;
LoOverflow = ProdOV;
HiOverflow = ProdOV || AddWithOverflow(HiBound, LoBound, DivRHS);
}
// Dividing by a negate swaps the condition.
- Opcode = SetCondInst::getSwappedCondition(Opcode);
+ predicate = ICmpInst::getSwappedPredicate(predicate);
}
if (LoBound) {
Value *X = LHSI->getOperand(0);
- switch (Opcode) {
- default: assert(0 && "Unhandled setcc opcode!");
- case Instruction::SetEQ:
+ switch (predicate) {
+ default: assert(0 && "Unhandled icmp opcode!");
+ case ICmpInst::ICMP_EQ:
if (LoOverflow && HiOverflow)
return ReplaceInstUsesWith(I, ConstantBool::getFalse());
else if (HiOverflow)
- return new SetCondInst(Instruction::SetGE, X, LoBound);
+ return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SGE :
+ ICmpInst::ICMP_UGE, X, LoBound);
else if (LoOverflow)
- return new SetCondInst(Instruction::SetLT, X, HiBound);
+ return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SLT :
+ ICmpInst::ICMP_ULT, X, HiBound);
else
- return InsertRangeTest(X, LoBound, HiBound, true, I);
- case Instruction::SetNE:
+ return InsertRangeTest(X, LoBound, HiBound, DivIsSigned,
+ true, I);
+ case ICmpInst::ICMP_NE:
if (LoOverflow && HiOverflow)
return ReplaceInstUsesWith(I, ConstantBool::getTrue());
else if (HiOverflow)
- return new SetCondInst(Instruction::SetLT, X, LoBound);
+ return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SLT :
+ ICmpInst::ICMP_ULT, X, LoBound);
else if (LoOverflow)
- return new SetCondInst(Instruction::SetGE, X, HiBound);
+ return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SGE :
+ ICmpInst::ICMP_UGE, X, HiBound);
else
- return InsertRangeTest(X, LoBound, HiBound, false, I);
- case Instruction::SetLT:
+ return InsertRangeTest(X, LoBound, HiBound, DivIsSigned,
+ false, I);
+ case ICmpInst::ICMP_ULT:
+ case ICmpInst::ICMP_SLT:
if (LoOverflow)
return ReplaceInstUsesWith(I, ConstantBool::getFalse());
- return new SetCondInst(Instruction::SetLT, X, LoBound);
- case Instruction::SetGT:
+ return new ICmpInst(predicate, X, LoBound);
+ case ICmpInst::ICMP_UGT:
+ case ICmpInst::ICMP_SGT:
if (HiOverflow)
return ReplaceInstUsesWith(I, ConstantBool::getFalse());
- return new SetCondInst(Instruction::SetGE, X, HiBound);
+ if (predicate == ICmpInst::ICMP_UGT)
+ return new ICmpInst(ICmpInst::ICMP_UGE, X, HiBound);
+ else
+ return new ICmpInst(ICmpInst::ICMP_SGE, X, HiBound);
}
}
}
break;
}
- // Simplify seteq and setne instructions with integer constant RHS.
+ // Simplify icmp_eq and icmp_ne instructions with integer constant RHS.
if (I.isEquality()) {
- bool isSetNE = I.getOpcode() == Instruction::SetNE;
+ bool isICMP_NE = I.getPredicate() == ICmpInst::ICMP_NE;
// If the first operand is (add|sub|and|or|xor|rem) with a constant, and
// the second operand is a constant, simplify a bit.
if (V > 1 && isPowerOf2_64(V)) {
Value *NewRem = InsertNewInstBefore(BinaryOperator::createURem(
BO->getOperand(0), BO->getOperand(1), BO->getName()), I);
- return BinaryOperator::create(I.getOpcode(), NewRem,
- Constant::getNullValue(BO->getType()));
+ return new ICmpInst(I.getPredicate(), NewRem,
+ Constant::getNullValue(BO->getType()));
}
}
break;
// Replace ((add A, B) != C) with (A != C-B) if B & C are constants.
if (ConstantInt *BOp1C = dyn_cast<ConstantInt>(BO->getOperand(1))) {
if (BO->hasOneUse())
- return new SetCondInst(I.getOpcode(), BO->getOperand(0),
- ConstantExpr::getSub(CI, BOp1C));
+ return new ICmpInst(I.getPredicate(), BO->getOperand(0),
+ ConstantExpr::getSub(CI, BOp1C));
} else if (CI->isNullValue()) {
// Replace ((add A, B) != 0) with (A != -B) if A or B is
// efficiently invertible, or if the add has just this one use.
Value *BOp0 = BO->getOperand(0), *BOp1 = BO->getOperand(1);
if (Value *NegVal = dyn_castNegVal(BOp1))
- return new SetCondInst(I.getOpcode(), BOp0, NegVal);
+ return new ICmpInst(I.getPredicate(), BOp0, NegVal);
else if (Value *NegVal = dyn_castNegVal(BOp0))
- return new SetCondInst(I.getOpcode(), NegVal, BOp1);
+ return new ICmpInst(I.getPredicate(), NegVal, BOp1);
else if (BO->hasOneUse()) {
Instruction *Neg = BinaryOperator::createNeg(BOp1, BO->getName());
BO->setName("");
InsertNewInstBefore(Neg, I);
- return new SetCondInst(I.getOpcode(), BOp0, Neg);
+ return new ICmpInst(I.getPredicate(), BOp0, Neg);
}
}
break;
// For the xor case, we can xor two constants together, eliminating
// the explicit xor.
if (Constant *BOC = dyn_cast<Constant>(BO->getOperand(1)))
- return BinaryOperator::create(I.getOpcode(), BO->getOperand(0),
- ConstantExpr::getXor(CI, BOC));
+ return new ICmpInst(I.getPredicate(), BO->getOperand(0),
+ ConstantExpr::getXor(CI, BOC));
// FALLTHROUGH
case Instruction::Sub:
// Replace (([sub|xor] A, B) != 0) with (A != B)
if (CI->isNullValue())
- return new SetCondInst(I.getOpcode(), BO->getOperand(0),
- BO->getOperand(1));
+ return new ICmpInst(I.getPredicate(), BO->getOperand(0),
+ BO->getOperand(1));
break;
case Instruction::Or:
if (Constant *BOC = dyn_cast<Constant>(BO->getOperand(1))) {
Constant *NotCI = ConstantExpr::getNot(CI);
if (!ConstantExpr::getAnd(BOC, NotCI)->isNullValue())
- return ReplaceInstUsesWith(I, ConstantBool::get(isSetNE));
+ return ReplaceInstUsesWith(I, ConstantBool::get(isICMP_NE));
}
break;
// comparison can never succeed!
if (!ConstantExpr::getAnd(CI,
ConstantExpr::getNot(BOC))->isNullValue())
- return ReplaceInstUsesWith(I, ConstantBool::get(isSetNE));
+ return ReplaceInstUsesWith(I, ConstantBool::get(isICMP_NE));
// If we have ((X & C) == C), turn it into ((X & C) != 0).
if (CI == BOC && isOneBitSet(CI))
- return new SetCondInst(isSetNE ? Instruction::SetEQ :
- Instruction::SetNE, Op0,
- Constant::getNullValue(CI->getType()));
+ return new ICmpInst(isICMP_NE ? ICmpInst::ICMP_EQ :
+ ICmpInst::ICMP_NE, Op0,
+ Constant::getNullValue(CI->getType()));
- // Replace (and X, (1 << size(X)-1) != 0) with x < 0, converting X
- // to be a signed value as appropriate.
+ // Replace (and X, (1 << size(X)-1) != 0) with x s< 0
if (isSignBit(BOC)) {
Value *X = BO->getOperand(0);
// If 'X' is not signed, insert a cast now...
const Type *DestTy = BOC->getType()->getSignedVersion();
X = InsertCastBefore(Instruction::BitCast, X, DestTy, I);
}
- return new SetCondInst(isSetNE ? Instruction::SetLT :
- Instruction::SetGE, X,
- Constant::getNullValue(X->getType()));
+ Constant *Zero = Constant::getNullValue(X->getType());
+ ICmpInst::Predicate pred = isICMP_NE ?
+ ICmpInst::ICMP_SLT : ICmpInst::ICMP_SGE;
+ return new ICmpInst(pred, X, Zero);
}
// ((X & ~7) == 0) --> X < 8
if (CI->isNullValue() && isHighOnes(BOC)) {
Value *X = BO->getOperand(0);
Constant *NegX = ConstantExpr::getNeg(BOC);
-
- // If 'X' is signed, insert a cast now.
- if (NegX->getType()->isSigned()) {
- const Type *DestTy = NegX->getType()->getUnsignedVersion();
- X = InsertCastBefore(Instruction::BitCast, X, DestTy, I);
- NegX = ConstantExpr::getBitCast(NegX, DestTy);
- }
-
- return new SetCondInst(isSetNE ? Instruction::SetGE :
- Instruction::SetLT, X, NegX);
+ ICmpInst::Predicate pred = isICMP_NE ?
+ ICmpInst::ICMP_UGE : ICmpInst::ICMP_ULT;
+ return new ICmpInst(pred, X, NegX);
}
}
// Handle set{eq|ne} <intrinsic>, intcst.
switch (II->getIntrinsicID()) {
default: break;
- case Intrinsic::bswap_i16: // seteq (bswap(x)), c -> seteq(x,bswap(c))
+ case Intrinsic::bswap_i16:
+ // icmp eq (bswap(x)), c -> icmp eq (x,bswap(c))
WorkList.push_back(II); // Dead?
I.setOperand(0, II->getOperand(1));
I.setOperand(1, ConstantInt::get(Type::UShortTy,
ByteSwap_16(CI->getZExtValue())));
return &I;
- case Intrinsic::bswap_i32: // seteq (bswap(x)), c -> seteq(x,bswap(c))
+ case Intrinsic::bswap_i32:
+ // icmp eq (bswap(x)), c -> icmp eq (x,bswap(c))
WorkList.push_back(II); // Dead?
I.setOperand(0, II->getOperand(1));
I.setOperand(1, ConstantInt::get(Type::UIntTy,
ByteSwap_32(CI->getZExtValue())));
return &I;
- case Intrinsic::bswap_i64: // seteq (bswap(x)), c -> seteq(x,bswap(c))
+ case Intrinsic::bswap_i64:
+ // icmp eq (bswap(x)), c -> icmp eq (x,bswap(c))
WorkList.push_back(II); // Dead?
I.setOperand(0, II->getOperand(1));
I.setOperand(1, ConstantInt::get(Type::ULongTy,
return &I;
}
}
- } else { // Not a SetEQ/SetNE
- // If the LHS is a cast from an integral value of the same size,
+ } else { // Not a ICMP_EQ/ICMP_NE
+ // If the LHS is a cast from an integral value of the same size, then
+ // since we know the RHS is a constant, try to simlify.
if (CastInst *Cast = dyn_cast<CastInst>(Op0)) {
Value *CastOp = Cast->getOperand(0);
const Type *SrcTy = CastOp->getType();
unsigned SrcTySize = SrcTy->getPrimitiveSizeInBits();
- if (SrcTy != Cast->getType() && SrcTy->isInteger() &&
+ if (SrcTy->isInteger() &&
SrcTySize == Cast->getType()->getPrimitiveSizeInBits()) {
- assert((SrcTy->isSigned() ^ Cast->getType()->isSigned()) &&
- "Source and destination signednesses should differ!");
- if (Cast->getType()->isSigned()) {
- // If this is a signed comparison, check for comparisons in the
- // vicinity of zero.
- if (I.getOpcode() == Instruction::SetLT && CI->isNullValue())
- // X < 0 => x > 127
- return BinaryOperator::createSetGT(CastOp,
- ConstantInt::get(SrcTy, (1ULL << (SrcTySize-1))-1));
- else if (I.getOpcode() == Instruction::SetGT &&
- cast<ConstantInt>(CI)->getSExtValue() == -1)
- // X > -1 => x < 128
- return BinaryOperator::createSetLT(CastOp,
- ConstantInt::get(SrcTy, 1ULL << (SrcTySize-1)));
- } else {
- ConstantInt *CUI = cast<ConstantInt>(CI);
- if (I.getOpcode() == Instruction::SetLT &&
- CUI->getZExtValue() == 1ULL << (SrcTySize-1))
- // X < 128 => X > -1
- return BinaryOperator::createSetGT(CastOp,
- ConstantInt::get(SrcTy, -1));
- else if (I.getOpcode() == Instruction::SetGT &&
- CUI->getZExtValue() == (1ULL << (SrcTySize-1))-1)
- // X > 127 => X < 0
- return BinaryOperator::createSetLT(CastOp,
- Constant::getNullValue(SrcTy));
+ // If this is an unsigned comparison, try to make the comparison use
+ // smaller constant values.
+ switch (I.getPredicate()) {
+ default: break;
+ case ICmpInst::ICMP_ULT: { // X u< 128 => X s> -1
+ ConstantInt *CUI = cast<ConstantInt>(CI);
+ if (CUI->getZExtValue() == 1ULL << (SrcTySize-1))
+ return new ICmpInst(ICmpInst::ICMP_SGT, CastOp,
+ ConstantInt::get(SrcTy, -1));
+ break;
+ }
+ case ICmpInst::ICMP_UGT: { // X u> 127 => X s< 0
+ ConstantInt *CUI = cast<ConstantInt>(CI);
+ if (CUI->getZExtValue() == (1ULL << (SrcTySize-1))-1)
+ return new ICmpInst(ICmpInst::ICMP_SLT, CastOp,
+ Constant::getNullValue(SrcTy));
+ break;
+ }
}
+
}
}
}
}
- // Handle setcc with constant RHS's that can be integer, FP or pointer.
+ // Handle icmp with constant RHS
if (Constant *RHSC = dyn_cast<Constant>(Op1)) {
if (Instruction *LHSI = dyn_cast<Instruction>(Op0))
switch (LHSI->getOpcode()) {
case Instruction::GetElementPtr:
if (RHSC->isNullValue()) {
- // Transform setcc GEP P, int 0, int 0, int 0, null -> setcc P, null
+ // icmp pred GEP (P, int 0, int 0, int 0), null -> icmp pred P, null
bool isAllZeros = true;
for (unsigned i = 1, e = LHSI->getNumOperands(); i != e; ++i)
if (!isa<Constant>(LHSI->getOperand(i)) ||
break;
}
if (isAllZeros)
- return new SetCondInst(I.getOpcode(), LHSI->getOperand(0),
+ return new ICmpInst(I.getPredicate(), LHSI->getOperand(0),
Constant::getNullValue(LHSI->getOperand(0)->getType()));
}
break;
if (LHSI->hasOneUse()) {
if (Constant *C = dyn_cast<Constant>(LHSI->getOperand(1))) {
// Fold the known value into the constant operand.
- Op1 = ConstantExpr::get(I.getOpcode(), C, RHSC);
- // Insert a new SetCC of the other select operand.
- Op2 = InsertNewInstBefore(new SetCondInst(I.getOpcode(),
- LHSI->getOperand(2), RHSC,
- I.getName()), I);
+ Op1 = ConstantExpr::getICmp(I.getPredicate(), C, RHSC);
+ // Insert a new ICmp of the other select operand.
+ Op2 = InsertNewInstBefore(new ICmpInst(I.getPredicate(),
+ LHSI->getOperand(2), RHSC,
+ I.getName()), I);
} else if (Constant *C = dyn_cast<Constant>(LHSI->getOperand(2))) {
// Fold the known value into the constant operand.
- Op2 = ConstantExpr::get(I.getOpcode(), C, RHSC);
- // Insert a new SetCC of the other select operand.
- Op1 = InsertNewInstBefore(new SetCondInst(I.getOpcode(),
- LHSI->getOperand(1), RHSC,
- I.getName()), I);
+ Op2 = ConstantExpr::getICmp(I.getPredicate(), C, RHSC);
+ // Insert a new ICmp of the other select operand.
+ Op1 = InsertNewInstBefore(new ICmpInst(I.getPredicate(),
+ LHSI->getOperand(1), RHSC,
+ I.getName()), I);
}
}
}
}
- // If we can optimize a 'setcc GEP, P' or 'setcc P, GEP', do so now.
+ // If we can optimize a 'icmp GEP, P' or 'icmp P, GEP', do so now.
if (User *GEP = dyn_castGetElementPtr(Op0))
- if (Instruction *NI = FoldGEPSetCC(GEP, Op1, I.getOpcode(), I))
+ if (Instruction *NI = FoldGEPICmp(GEP, Op1, I.getPredicate(), I))
return NI;
if (User *GEP = dyn_castGetElementPtr(Op1))
- if (Instruction *NI = FoldGEPSetCC(GEP, Op0,
- SetCondInst::getSwappedCondition(I.getOpcode()), I))
+ if (Instruction *NI = FoldGEPICmp(GEP, Op0,
+ ICmpInst::getSwappedPredicate(I.getPredicate()), I))
return NI;
- // Test to see if the operands of the setcc are casted versions of other
+ // Test to see if the operands of the icmp are casted versions of other
// values. If the cast can be stripped off both arguments, we do so now.
if (CastInst *CI = dyn_cast<CastInst>(Op0)) {
Value *CastOp0 = CI->getOperand(0);
if (Constant *Op1C = dyn_cast<Constant>(Op1)) {
Op1 = ConstantExpr::getBitCast(Op1C, Op0->getType());
} else {
- // Otherwise, cast the RHS right before the setcc
+ // Otherwise, cast the RHS right before the icmp
Op1 = InsertCastBefore(Instruction::BitCast, Op1, Op0->getType(), I);
}
- return BinaryOperator::create(I.getOpcode(), Op0, Op1);
+ return new ICmpInst(I.getPredicate(), Op0, Op1);
}
- // Handle the special case of: setcc (cast bool to X), <cst>
+ // Handle the special case of: icmp (cast bool to X), <cst>
// This comes up when you have code like
// int X = A < B;
// if (X) ...
// For generality, we handle any zero-extension of any operand comparison
// with a constant or another cast from the same type.
if (isa<ConstantInt>(Op1) || isa<CastInst>(Op1))
- if (Instruction *R = visitSetCondInstWithCastAndCast(I))
+ if (Instruction *R = visitICmpInstWithCastAndCast(I))
return R;
}
(A == Op1 || B == Op1)) {
// (A^B) == A -> B == 0
Value *OtherVal = A == Op1 ? B : A;
- return BinaryOperator::create(I.getOpcode(), OtherVal,
- Constant::getNullValue(A->getType()));
+ return new ICmpInst(I.getPredicate(), OtherVal,
+ Constant::getNullValue(A->getType()));
} else if (match(Op1, m_Xor(m_Value(A), m_Value(B))) &&
(A == Op0 || B == Op0)) {
// A == (A^B) -> B == 0
Value *OtherVal = A == Op0 ? B : A;
- return BinaryOperator::create(I.getOpcode(), OtherVal,
- Constant::getNullValue(A->getType()));
+ return new ICmpInst(I.getPredicate(), OtherVal,
+ Constant::getNullValue(A->getType()));
} else if (match(Op0, m_Sub(m_Value(A), m_Value(B))) && A == Op1) {
// (A-B) == A -> B == 0
- return BinaryOperator::create(I.getOpcode(), B,
- Constant::getNullValue(B->getType()));
+ return new ICmpInst(I.getPredicate(), B,
+ Constant::getNullValue(B->getType()));
} else if (match(Op1, m_Sub(m_Value(A), m_Value(B))) && A == Op0) {
// A == (A-B) -> B == 0
- return BinaryOperator::create(I.getOpcode(), B,
- Constant::getNullValue(B->getType()));
+ return new ICmpInst(I.getPredicate(), B,
+ Constant::getNullValue(B->getType()));
}
Value *C, *D;
return Changed ? &I : 0;
}
-// visitSetCondInstWithCastAndCast - Handle setcond (cast x to y), (cast/cst).
+// visitICmpInstWithCastAndCast - Handle icmp (cast x to y), (cast/cst).
// We only handle extending casts so far.
//
-Instruction *InstCombiner::visitSetCondInstWithCastAndCast(SetCondInst &SCI) {
- const CastInst *LHSCI = cast<CastInst>(SCI.getOperand(0));
+Instruction *InstCombiner::visitICmpInstWithCastAndCast(ICmpInst &ICI) {
+ const CastInst *LHSCI = cast<CastInst>(ICI.getOperand(0));
Value *LHSCIOp = LHSCI->getOperand(0);
const Type *SrcTy = LHSCIOp->getType();
- const Type *DestTy = SCI.getOperand(0)->getType();
+ const Type *DestTy = LHSCI->getType();
Value *RHSCIOp;
- if (!DestTy->isIntegral() || !SrcTy->isIntegral())
+ // We only handle extension cast instructions, so far. Enforce this.
+ if (LHSCI->getOpcode() != Instruction::ZExt &&
+ LHSCI->getOpcode() != Instruction::SExt)
return 0;
- unsigned SrcBits = SrcTy->getPrimitiveSizeInBits();
- unsigned DestBits = DestTy->getPrimitiveSizeInBits();
- if (SrcBits >= DestBits) return 0; // Only handle extending cast.
+ bool isSignedExt = LHSCI->getOpcode() == Instruction::SExt;
+ bool isSignedCmp = ICI.isSignedPredicate();
- // Is this a sign or zero extension?
- bool isSignSrc = SrcTy->isSigned();
- bool isSignDest = DestTy->isSigned();
-
- if (CastInst *CI = dyn_cast<CastInst>(SCI.getOperand(1))) {
+ if (CastInst *CI = dyn_cast<CastInst>(ICI.getOperand(1))) {
// Not an extension from the same type?
RHSCIOp = CI->getOperand(0);
- if (RHSCIOp->getType() != LHSCIOp->getType()) return 0;
- } else if (ConstantInt *CI = dyn_cast<ConstantInt>(SCI.getOperand(1))) {
- // Compute the constant that would happen if we truncated to SrcTy then
- // reextended to DestTy.
- Constant *Res1 = ConstantExpr::getTrunc(CI, SrcTy);
- Constant *Res2 = ConstantExpr::getCast(LHSCI->getOpcode(), Res1, DestTy);
-
- if (Res2 == CI) {
- // Make sure that src sign and dest sign match. For example,
- //
- // %A = cast short %X to uint
- // %B = setgt uint %A, 1330
- //
- // It is incorrect to transform this into
- //
- // %B = setgt short %X, 1330
- //
- // because %A may have negative value.
- // However, it is OK if SrcTy is bool (See cast-set.ll testcase)
- // OR operation is EQ/NE.
- if (isSignSrc == isSignDest || SrcTy == Type::BoolTy || SCI.isEquality())
- RHSCIOp = Res1;
- else
- return 0;
- } else {
- // If the value cannot be represented in the shorter type, we cannot emit
- // a simple comparison.
- if (SCI.getOpcode() == Instruction::SetEQ)
- return ReplaceInstUsesWith(SCI, ConstantBool::getFalse());
- if (SCI.getOpcode() == Instruction::SetNE)
- return ReplaceInstUsesWith(SCI, ConstantBool::getTrue());
-
- // Evaluate the comparison for LT.
- Value *Result;
- if (DestTy->isSigned()) {
- // We're performing a signed comparison.
- if (isSignSrc) {
- // Signed extend and signed comparison.
- if (cast<ConstantInt>(CI)->getSExtValue() < 0)// X < (small) --> false
- Result = ConstantBool::getFalse();
- else
- Result = ConstantBool::getTrue(); // X < (large) --> true
- } else {
- // Unsigned extend and signed comparison.
- if (cast<ConstantInt>(CI)->getSExtValue() < 0)
- Result = ConstantBool::getFalse();
- else
- Result = ConstantBool::getTrue();
- }
- } else {
- // We're performing an unsigned comparison.
- if (!isSignSrc) {
- // Unsigned extend & compare -> always true.
- Result = ConstantBool::getTrue();
- } else {
- // We're performing an unsigned comp with a sign extended value.
- // This is true if the input is >= 0. [aka >s -1]
- Constant *NegOne = ConstantIntegral::getAllOnesValue(SrcTy);
- Result = InsertNewInstBefore(BinaryOperator::createSetGT(LHSCIOp,
- NegOne, SCI.getName()), SCI);
- }
- }
+ if (RHSCIOp->getType() != LHSCIOp->getType())
+ return 0;
+ else
+ // Okay, just insert a compare of the reduced operands now!
+ return new ICmpInst(ICI.getPredicate(), LHSCIOp, RHSCIOp);
+ }
- // Finally, return the value computed.
- if (SCI.getOpcode() == Instruction::SetLT) {
- return ReplaceInstUsesWith(SCI, Result);
- } else {
- assert(SCI.getOpcode()==Instruction::SetGT &&"SetCC should be folded!");
- if (Constant *CI = dyn_cast<Constant>(Result))
- return ReplaceInstUsesWith(SCI, ConstantExpr::getNot(CI));
- else
- return BinaryOperator::createNot(Result);
- }
- }
- } else {
+ // If we aren't dealing with a constant on the RHS, exit early
+ ConstantInt *CI = dyn_cast<ConstantInt>(ICI.getOperand(1));
+ if (!CI)
return 0;
+
+ // Compute the constant that would happen if we truncated to SrcTy then
+ // reextended to DestTy.
+ Constant *Res1 = ConstantExpr::getTrunc(CI, SrcTy);
+ Constant *Res2 = ConstantExpr::getCast(LHSCI->getOpcode(), Res1, DestTy);
+
+ // If the re-extended constant didn't change...
+ if (Res2 == CI) {
+ // Make sure that sign of the Cmp and the sign of the Cast are the same.
+ // For example, we might have:
+ // %A = sext short %X to uint
+ // %B = icmp ugt uint %A, 1330
+ // It is incorrect to transform this into
+ // %B = icmp ugt short %X, 1330
+ // because %A may have negative value.
+ //
+ // However, it is OK if SrcTy is bool (See cast-set.ll testcase)
+ // OR operation is EQ/NE.
+ if (isSignedExt == isSignedCmp || SrcTy == Type::BoolTy || ICI.isEquality())
+ return new ICmpInst(ICI.getPredicate(), LHSCIOp, Res1);
+ else
+ return 0;
}
- // Okay, just insert a compare of the reduced operands now!
- return BinaryOperator::create(SCI.getOpcode(), LHSCIOp, RHSCIOp);
+ // The re-extended constant changed so the constant cannot be represented
+ // in the shorter type. Consequently, we cannot emit a simple comparison.
+
+ // First, handle some easy cases. We know the result cannot be equal at this
+ // point so handle the ICI.isEquality() cases
+ if (ICI.getPredicate() == ICmpInst::ICMP_EQ)
+ return ReplaceInstUsesWith(ICI, ConstantBool::getFalse());
+ if (ICI.getPredicate() == ICmpInst::ICMP_NE)
+ return ReplaceInstUsesWith(ICI, ConstantBool::getTrue());
+
+ // Evaluate the comparison for LT (we invert for GT below). LE and GE cases
+ // should have been folded away previously and not enter in here.
+ Value *Result;
+ if (isSignedCmp) {
+ // We're performing a signed comparison.
+ if (cast<ConstantInt>(CI)->getSExtValue() < 0)
+ Result = ConstantBool::getFalse(); // X < (small) --> false
+ else
+ Result = ConstantBool::getTrue(); // X < (large) --> true
+ } else {
+ // We're performing an unsigned comparison.
+ if (isSignedExt) {
+ // We're performing an unsigned comp with a sign extended value.
+ // This is true if the input is >= 0. [aka >s -1]
+ Constant *NegOne = ConstantIntegral::getAllOnesValue(SrcTy);
+ Result = InsertNewInstBefore(new ICmpInst(ICmpInst::ICMP_SGT, LHSCIOp,
+ NegOne, ICI.getName()), ICI);
+ } else {
+ // Unsigned extend & unsigned compare -> always true.
+ Result = ConstantBool::getTrue();
+ }
+ }
+
+ // Finally, return the value computed.
+ if (ICI.getPredicate() == ICmpInst::ICMP_ULT ||
+ ICI.getPredicate() == ICmpInst::ICMP_SLT) {
+ return ReplaceInstUsesWith(ICI, Result);
+ } else {
+ assert((ICI.getPredicate()==ICmpInst::ICMP_UGT ||
+ ICI.getPredicate()==ICmpInst::ICMP_SGT) &&
+ "ICmp should be folded!");
+ if (Constant *CI = dyn_cast<Constant>(Result))
+ return ReplaceInstUsesWith(ICI, ConstantExpr::getNot(CI));
+ else
+ return BinaryOperator::createNot(Result);
+ }
}
Instruction *InstCombiner::visitShiftInst(ShiftInst &I) {
assert(I.getOperand(1)->getType() == Type::UByteTy);
Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
- bool isLeftShift = I.getOpcode() == Instruction::Shl;
// shl X, 0 == X and shr X, 0 == X
// shl 0, X == 0 and shr 0, X == 0
Op0 == Constant::getNullValue(Op0->getType()))
return ReplaceInstUsesWith(I, Op0);
- if (isa<UndefValue>(Op0)) { // undef >>s X -> undef
- if (!isLeftShift && I.getType()->isSigned())
+ if (isa<UndefValue>(Op0)) {
+ if (I.getOpcode() == Instruction::AShr) // undef >>s X -> undef
return ReplaceInstUsesWith(I, Op0);
- else // undef << X -> 0 AND undef >>u X -> 0
+ else // undef << X -> 0, undef >>u X -> 0
return ReplaceInstUsesWith(I, Constant::getNullValue(I.getType()));
}
if (isa<UndefValue>(Op1)) {
- if (isLeftShift || I.getType()->isUnsigned())// X << undef, X >>u undef -> 0
+ if (I.getOpcode() == Instruction::AShr) // X >>s undef -> X
+ return ReplaceInstUsesWith(I, Op0);
+ else // X << undef, X >>u undef -> 0
return ReplaceInstUsesWith(I, Constant::getNullValue(I.getType()));
- else
- return ReplaceInstUsesWith(I, Op0); // X >>s undef -> X
}
// ashr int -1, X = -1 (for any arithmetic shift rights of ~0)
Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantInt *Op1,
ShiftInst &I) {
- bool isLeftShift = I.getOpcode() == Instruction::Shl;
- bool isSignedShift = isLeftShift ? Op0->getType()->isSigned() :
- I.getOpcode() == Instruction::AShr;
+ bool isLeftShift = I.getOpcode() == Instruction::Shl;
+ bool isSignedShift = I.getOpcode() == Instruction::AShr;
bool isUnsignedShift = !isSignedShift;
// See if we can simplify any instructions used by the instruction whose sole
// Find the operands and properties of the input shift. Note that the
// 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 = isShiftOfLeftShift ?
- ShiftOp->getType()->isSigned() :
- ShiftOp->getOpcode() == Instruction::AShr;
+ bool isShiftOfLeftShift = ShiftOp->getOpcode() == Instruction::Shl;
+ bool isShiftOfSignedShift = ShiftOp->getOpcode() == Instruction::AShr;
bool isShiftOfUnsignedShift = !isShiftOfSignedShift;
ConstantInt *ShiftAmt1C = cast<ConstantInt>(ShiftOp->getOperand(1));
// If the source isn't an instruction or has more than one use then we
// can't do anything more.
- if (!isa<Instruction>(Src) || !Src->hasOneUse())
+ Instruction *SrcI = dyn_cast<Instruction>(Src);
+ if (!SrcI || !Src->hasOneUse())
return 0;
// Attempt to propagate the cast into the instruction.
- Instruction *SrcI = cast<Instruction>(Src);
int NumCastsRemoved = 0;
if (CanEvaluateInDifferentType(SrcI, DestTy, NumCastsRemoved)) {
// If this cast is a truncate, evaluting in a different type always
// two casts to be inserted if the sizes are the same. This could
// only be converting signedness, which is a noop.
if (DestBitSize == SrcBitSize ||
- !ValueRequiresCast(Op1, DestTy,TD) ||
- !ValueRequiresCast(Op0, DestTy, TD)) {
+ !ValueRequiresCast(CI.getOpcode(), Op1, DestTy,TD) ||
+ !ValueRequiresCast(CI.getOpcode(), Op0, DestTy, TD)) {
Instruction::CastOps opcode = CI.getOpcode();
Value *Op0c = InsertOperandCastBefore(opcode, Op0, DestTy, SrcI);
Value *Op1c = InsertOperandCastBefore(opcode, Op1, DestTy, SrcI);
if (isa<ZExtInst>(CI) && SrcBitSize == 1 &&
SrcI->getOpcode() == Instruction::Xor &&
Op1 == ConstantBool::getTrue() &&
- (!Op0->hasOneUse() || !isa<SetCondInst>(Op0))) {
+ (!Op0->hasOneUse() || !isa<CmpInst>(Op0))) {
Value *New = InsertOperandCastBefore(Instruction::ZExt, Op0, DestTy, &CI);
return BinaryOperator::createXor(New, ConstantInt::get(CI.getType(), 1));
}
// Don't insert two casts if they cannot be eliminated. We allow
// two casts to be inserted if the sizes are the same. This could
// only be converting signedness, which is a noop.
- if (!ValueRequiresCast(Op1, DestTy,TD) ||
- !ValueRequiresCast(Op0, DestTy, TD)) {
+ if (!ValueRequiresCast(CI.getOpcode(), Op1, DestTy, TD) ||
+ !ValueRequiresCast(CI.getOpcode(), Op0, DestTy, TD)) {
Value *Op0c = InsertOperandCastBefore(Instruction::BitCast,
Op0, DestTy, SrcI);
Value *Op1c = InsertOperandCastBefore(Instruction::BitCast,
}
break;
- case Instruction::SetEQ:
- case Instruction::SetNE:
- // If we are just checking for a seteq of a single bit and casting it
- // to an integer. If so, shift the bit to the appropriate place then
+ case Instruction::ICmp:
+ // If we are just checking for a icmp eq of a single bit and casting it
+ // to an integer, then shift the bit to the appropriate place and then
// cast to integer to avoid the comparison.
if (ConstantInt *Op1C = dyn_cast<ConstantInt>(Op1)) {
uint64_t Op1CV = Op1C->getZExtValue();
uint64_t KnownZero, KnownOne;
uint64_t TypeMask = Op1->getType()->getIntegralTypeMask();
ComputeMaskedBits(Op0, TypeMask, KnownZero, KnownOne);
+
+ // This only works for EQ and NE
+ ICmpInst::Predicate pred = cast<ICmpInst>(SrcI)->getPredicate();
+ if (pred != ICmpInst::ICMP_NE && pred != ICmpInst::ICMP_EQ)
+ break;
if (isPowerOf2_64(KnownZero^TypeMask)) { // Exactly 1 possible 1?
- bool isSetNE = SrcI->getOpcode() == Instruction::SetNE;
+ bool isNE = pred == ICmpInst::ICMP_NE;
if (Op1CV && (Op1CV != (KnownZero^TypeMask))) {
// (X&4) == 2 --> false
// (X&4) != 2 --> true
- Constant *Res = ConstantBool::get(isSetNE);
+ Constant *Res = ConstantBool::get(isNE);
Res = ConstantExpr::getZExt(Res, CI.getType());
return ReplaceInstUsesWith(CI, Res);
}
In->getName()+".lobit"), CI);
}
- if ((Op1CV != 0) == isSetNE) { // Toggle the low bit.
+ if ((Op1CV != 0) == isNE) { // Toggle the low bit.
Constant *One = ConstantInt::get(In->getType(), 1);
In = BinaryOperator::createXor(In, One, "tmp");
InsertNewInstBefore(cast<Instruction>(In), CI);
SrcI->getOperand(0),
"tmp"), CI);
Value *Zero = Constant::getNullValue(V->getType());
- return BinaryOperator::createSetNE(V, Zero);
+ return new ICmpInst(ICmpInst::ICMP_NE, V, Zero);
}
}
break;
TI->getType());
}
- // Only handle binary operators here.
- if (!isa<ShiftInst>(TI) && !isa<BinaryOperator>(TI))
+ // Only handle binary, compare and shift operators here.
+ if (!isa<ShiftInst>(TI) && !isa<BinaryOperator>(TI) && !isa<CmpInst>(TI))
+ return 0;
+
+ // If the CmpInst predicates don't match, then the instructions aren't the
+ // same and we can't continue.
+ if (isa<CmpInst>(TI) && isa<CmpInst>(FI) &&
+ (cast<CmpInst>(TI)->getPredicate() != cast<CmpInst>(FI)->getPredicate()))
return 0;
// Figure out if the operations have any operands in common.
return CastInst::create(Instruction::ZExt, NotCond, SI.getType());
}
- if (SetCondInst *IC = dyn_cast<SetCondInst>(SI.getCondition())) {
+ if (ICmpInst *IC = dyn_cast<ICmpInst>(SI.getCondition())) {
- // (x <s 0) ? -1 : 0 -> sra x, 31
- // (x >u 2147483647) ? -1 : 0 -> sra x, 31
+ // (x <s 0) ? -1 : 0 -> ashr x, 31
+ // (x >u 2147483647) ? -1 : 0 -> ashr x, 31
if (TrueValC->isAllOnesValue() && FalseValC->isNullValue())
if (ConstantInt *CmpCst = dyn_cast<ConstantInt>(IC->getOperand(1))) {
bool CanXForm = false;
- if (CmpCst->getType()->isSigned())
+ if (IC->isSignedPredicate())
CanXForm = CmpCst->isNullValue() &&
- IC->getOpcode() == Instruction::SetLT;
+ IC->getPredicate() == ICmpInst::ICMP_SLT;
else {
unsigned Bits = CmpCst->getType()->getPrimitiveSizeInBits();
CanXForm = (CmpCst->getZExtValue() == ~0ULL >> (64-Bits+1)) &&
- IC->getOpcode() == Instruction::SetGT;
+ IC->getPredicate() == ICmpInst::ICMP_UGT;
}
if (CanXForm) {
// If one of the constants is zero (we know they can't both be) and we
- // have a setcc instruction with zero, and we have an 'and' with the
+ // have a fcmp instruction with zero, and we have an 'and' with the
// non-constant value, eliminate this whole mess. This corresponds to
// cases like this: ((X & 27) ? 27 : 0)
if (TrueValC->isNullValue() || FalseValC->isNullValue())
ICA->getOperand(1) == FalseValC) &&
isOneBitSet(cast<ConstantInt>(ICA->getOperand(1)))) {
// Okay, now we know that everything is set up, we just don't
- // know whether we have a setne or seteq and whether the true or
- // false val is the zero.
+ // know whether we have a icmp_ne or icmp_eq and whether the
+ // true or false val is the zero.
bool ShouldNotVal = !TrueValC->isNullValue();
- ShouldNotVal ^= IC->getOpcode() == Instruction::SetNE;
+ ShouldNotVal ^= IC->getPredicate() == ICmpInst::ICMP_NE;
Value *V = ICA;
if (ShouldNotVal)
V = InsertNewInstBefore(BinaryOperator::create(
}
// See if we are selecting two values based on a comparison of the two values.
- if (SetCondInst *SCI = dyn_cast<SetCondInst>(CondVal)) {
- if (SCI->getOperand(0) == TrueVal && SCI->getOperand(1) == FalseVal) {
+ if (FCmpInst *FCI = dyn_cast<FCmpInst>(CondVal)) {
+ if (FCI->getOperand(0) == TrueVal && FCI->getOperand(1) == FalseVal) {
// Transform (X == Y) ? X : Y -> Y
- if (SCI->getOpcode() == Instruction::SetEQ)
+ if (FCI->getPredicate() == FCmpInst::FCMP_OEQ)
return ReplaceInstUsesWith(SI, FalseVal);
// Transform (X != Y) ? X : Y -> X
- if (SCI->getOpcode() == Instruction::SetNE)
+ if (FCI->getPredicate() == FCmpInst::FCMP_ONE)
return ReplaceInstUsesWith(SI, TrueVal);
// NOTE: if we wanted to, this is where to detect MIN/MAX/ABS/etc.
- } else if (SCI->getOperand(0) == FalseVal && SCI->getOperand(1) == TrueVal){
+ } else if (FCI->getOperand(0) == FalseVal && FCI->getOperand(1) == TrueVal){
// Transform (X == Y) ? Y : X -> X
- if (SCI->getOpcode() == Instruction::SetEQ)
+ if (FCI->getPredicate() == FCmpInst::FCMP_OEQ)
return ReplaceInstUsesWith(SI, FalseVal);
// Transform (X != Y) ? Y : X -> Y
- if (SCI->getOpcode() == Instruction::SetNE)
+ if (FCI->getPredicate() == FCmpInst::FCMP_ONE)
+ return ReplaceInstUsesWith(SI, TrueVal);
+ // NOTE: if we wanted to, this is where to detect MIN/MAX/ABS/etc.
+ }
+ }
+
+ // See if we are selecting two values based on a comparison of the two values.
+ if (ICmpInst *ICI = dyn_cast<ICmpInst>(CondVal)) {
+ if (ICI->getOperand(0) == TrueVal && ICI->getOperand(1) == FalseVal) {
+ // Transform (X == Y) ? X : Y -> Y
+ if (ICI->getPredicate() == ICmpInst::ICMP_EQ)
+ return ReplaceInstUsesWith(SI, FalseVal);
+ // Transform (X != Y) ? X : Y -> X
+ if (ICI->getPredicate() == ICmpInst::ICMP_NE)
+ return ReplaceInstUsesWith(SI, TrueVal);
+ // NOTE: if we wanted to, this is where to detect MIN/MAX/ABS/etc.
+
+ } else if (ICI->getOperand(0) == FalseVal && ICI->getOperand(1) == TrueVal){
+ // Transform (X == Y) ? Y : X -> X
+ if (ICI->getPredicate() == ICmpInst::ICMP_EQ)
+ return ReplaceInstUsesWith(SI, FalseVal);
+ // Transform (X != Y) ? Y : X -> Y
+ if (ICI->getPredicate() == ICmpInst::ICMP_NE)
return ReplaceInstUsesWith(SI, TrueVal);
// NOTE: if we wanted to, this is where to detect MIN/MAX/ABS/etc.
}
Instruction *InstCombiner::FoldPHIArgBinOpIntoPHI(PHINode &PN) {
Instruction *FirstInst = cast<Instruction>(PN.getIncomingValue(0));
assert(isa<BinaryOperator>(FirstInst) || isa<ShiftInst>(FirstInst) ||
- isa<GetElementPtrInst>(FirstInst));
+ isa<GetElementPtrInst>(FirstInst) || isa<CmpInst>(FirstInst));
unsigned Opc = FirstInst->getOpcode();
Value *LHSVal = FirstInst->getOperand(0);
Value *RHSVal = FirstInst->getOperand(1);
for (unsigned i = 0; i != PN.getNumIncomingValues(); ++i) {
Instruction *I = dyn_cast<Instruction>(PN.getIncomingValue(i));
if (!I || I->getOpcode() != Opc || !I->hasOneUse() ||
- // Verify type of the LHS matches so we don't fold setcc's of different
+ // Verify type of the LHS matches so we don't fold cmp's of different
// types or GEP's with different index types.
I->getOperand(0)->getType() != LHSType ||
I->getOperand(1)->getType() != RHSType)
return 0;
+
+ // If they are CmpInst instructions, check their predicates
+ if (Opc == Instruction::ICmp || Opc == Instruction::FCmp)
+ if (cast<CmpInst>(I)->getPredicate() !=
+ cast<CmpInst>(FirstInst)->getPredicate())
+ return 0;
// Keep track of which operand needs a phi node.
if (I->getOperand(0) != LHSVal) LHSVal = 0;
if (BinaryOperator *BinOp = dyn_cast<BinaryOperator>(FirstInst))
return BinaryOperator::create(BinOp->getOpcode(), LHSVal, RHSVal);
+ else if (CmpInst *CIOp = dyn_cast<CmpInst>(FirstInst))
+ return CmpInst::create(CIOp->getOpcode(), CIOp->getPredicate(), LHSVal,
+ RHSVal);
else if (ShiftInst *SI = dyn_cast<ShiftInst>(FirstInst))
return new ShiftInst(SI->getOpcode(), LHSVal, RHSVal);
else {
bool isVolatile = false;
if (isa<CastInst>(FirstInst)) {
CastSrcTy = FirstInst->getOperand(0)->getType();
- } else if (isa<BinaryOperator>(FirstInst) || isa<ShiftInst>(FirstInst)) {
- // Can fold binop or shift here if the RHS is a constant, otherwise call
- // FoldPHIArgBinOpIntoPHI.
+ } else if (isa<BinaryOperator>(FirstInst) || isa<ShiftInst>(FirstInst) ||
+ isa<CmpInst>(FirstInst)) {
+ // Can fold binop, compare or shift here if the RHS is a constant,
+ // otherwise call FoldPHIArgBinOpIntoPHI.
ConstantOp = dyn_cast<Constant>(FirstInst->getOperand(1));
if (ConstantOp == 0)
return FoldPHIArgBinOpIntoPHI(PN);
for (unsigned i = 1, e = PN.getNumIncomingValues(); i != e; ++i) {
if (!isa<Instruction>(PN.getIncomingValue(i))) return 0;
Instruction *I = cast<Instruction>(PN.getIncomingValue(i));
- if (!I->hasOneUse() || I->getOpcode() != FirstInst->getOpcode())
+ if (!I->hasOneUse() || !I->isSameOperationAs(FirstInst))
return 0;
if (CastSrcTy) {
if (I->getOperand(0)->getType() != CastSrcTy)
return 0; // Cast operation must match.
} else if (LoadInst *LI = dyn_cast<LoadInst>(I)) {
- // We can't sink the load if the loaded value could be modified between the
- // load and the PHI.
+ // We can't sink the load if the loaded value could be modified between
+ // the load and the PHI.
if (LI->isVolatile() != isVolatile ||
LI->getParent() != PN.getIncomingBlock(i) ||
!isSafeToSinkLoad(LI))
return new LoadInst(PhiVal, "", isVolatile);
else if (BinaryOperator *BinOp = dyn_cast<BinaryOperator>(FirstInst))
return BinaryOperator::create(BinOp->getOpcode(), PhiVal, ConstantOp);
+ else if (CmpInst *CIOp = dyn_cast<CmpInst>(FirstInst))
+ return CmpInst::create(CIOp->getOpcode(), CIOp->getPredicate(),
+ PhiVal, ConstantOp);
else
return new ShiftInst(cast<ShiftInst>(FirstInst)->getOpcode(),
PhiVal, ConstantOp);
}
} else if (SrcTy->getPrimitiveSize() < DestTy->getPrimitiveSize() &&
SrcTy->getPrimitiveSize() == 4) {
- // We can always eliminate a cast from int to [u]long. We can
- // eliminate a cast from uint to [u]long iff the target is a 32-bit
- // pointer target.
- if (SrcTy->isSigned() ||
- SrcTy->getPrimitiveSizeInBits() >= TD->getPointerSizeInBits()) {
+ // We can eliminate a cast from [u]int to [u]long iff the target
+ // is a 32-bit pointer target.
+ if (SrcTy->getPrimitiveSizeInBits() >= TD->getPointerSizeInBits()) {
MadeChange = true;
GEP.setOperand(i, Src);
}
Value *Op = GEP.getOperand(i);
if (Op->getType()->getPrimitiveSize() > TD->getPointerSize())
if (Constant *C = dyn_cast<Constant>(Op)) {
- GEP.setOperand(i, ConstantExpr::getTrunc(C,
- TD->getIntPtrType()->getSignedVersion()));
+ GEP.setOperand(i, ConstantExpr::getTrunc(C, TD->getIntPtrType()));
MadeChange = true;
} else {
Op = InsertCastBefore(Instruction::Trunc, Op, TD->getIntPtrType(),
GEP.setOperand(i, Op);
MadeChange = true;
}
-
// If this is a constant idx, make sure to canonicalize it to be a signed
// operand, otherwise CSE and other optimizations are pessimized.
if (ConstantInt *CUI = dyn_cast<ConstantInt>(Op))
isa<ConstantInt>(Inst->getOperand(1))) {
unsigned ShAmt =
cast<ConstantInt>(Inst->getOperand(1))->getZExtValue();
- if (Inst->getType()->isSigned())
- Scale = ConstantInt::get(Inst->getType(), 1ULL << ShAmt);
- else
- Scale = ConstantInt::get(Inst->getType(), 1ULL << ShAmt);
+ Scale = ConstantInt::get(Inst->getType(), 1ULL << ShAmt);
NewIdx = Inst->getOperand(0);
} else if (Inst->getOpcode() == Instruction::Mul &&
isa<ConstantInt>(Inst->getOperand(1))) {
return &BI;
}
- // Cannonicalize setne -> seteq
- Instruction::BinaryOps Op; Value *Y;
- if (match(&BI, m_Br(m_SetCond(Op, m_Value(X), m_Value(Y)),
+ // Cannonicalize fcmp_one -> fcmp_oeq
+ FCmpInst::Predicate FPred; Value *Y;
+ if (match(&BI, m_Br(m_FCmp(FPred, m_Value(X), m_Value(Y)),
+ TrueDest, FalseDest)))
+ if ((FPred == FCmpInst::FCMP_ONE || FPred == FCmpInst::FCMP_OLE ||
+ FPred == FCmpInst::FCMP_OGE) && BI.getCondition()->hasOneUse()) {
+ FCmpInst *I = cast<FCmpInst>(BI.getCondition());
+ std::string Name = I->getName(); I->setName("");
+ FCmpInst::Predicate NewPred = FCmpInst::getInversePredicate(FPred);
+ Value *NewSCC = new FCmpInst(NewPred, X, Y, Name, I);
+ // Swap Destinations and condition...
+ BI.setCondition(NewSCC);
+ BI.setSuccessor(0, FalseDest);
+ BI.setSuccessor(1, TrueDest);
+ removeFromWorkList(I);
+ I->getParent()->getInstList().erase(I);
+ WorkList.push_back(cast<Instruction>(NewSCC));
+ return &BI;
+ }
+
+ // Cannonicalize icmp_ne -> icmp_eq
+ ICmpInst::Predicate IPred;
+ if (match(&BI, m_Br(m_ICmp(IPred, m_Value(X), m_Value(Y)),
TrueDest, FalseDest)))
- if ((Op == Instruction::SetNE || Op == Instruction::SetLE ||
- Op == Instruction::SetGE) && BI.getCondition()->hasOneUse()) {
- SetCondInst *I = cast<SetCondInst>(BI.getCondition());
+ if ((IPred == ICmpInst::ICMP_NE || IPred == ICmpInst::ICMP_ULE ||
+ IPred == ICmpInst::ICMP_SLE || IPred == ICmpInst::ICMP_UGE ||
+ IPred == ICmpInst::ICMP_SGE) && BI.getCondition()->hasOneUse()) {
+ ICmpInst *I = cast<ICmpInst>(BI.getCondition());
std::string Name = I->getName(); I->setName("");
- Instruction::BinaryOps NewOpcode = SetCondInst::getInverseCondition(Op);
- Value *NewSCC = BinaryOperator::create(NewOpcode, X, Y, Name, I);
+ ICmpInst::Predicate NewPred = ICmpInst::getInversePredicate(IPred);
+ Value *NewSCC = new ICmpInst(NewPred, X, Y, Name, I);
// Swap Destinations and condition...
BI.setCondition(NewSCC);
BI.setSuccessor(0, FalseDest);
(CheapToScalarize(BO->getOperand(0), isConstant) ||
CheapToScalarize(BO->getOperand(1), isConstant)))
return true;
+ if (CmpInst *CI = dyn_cast<CmpInst>(I))
+ if (CI->hasOneUse() &&
+ (CheapToScalarize(CI->getOperand(0), isConstant) ||
+ CheapToScalarize(CI->getOperand(1), isConstant)))
+ return true;
return false;
}
// Otherwise these instructions are hoistable/sinkable
return isa<BinaryOperator>(I) || isa<ShiftInst>(I) || isa<CastInst>(I) ||
- isa<SelectInst>(I) || isa<GetElementPtrInst>(I);
+ isa<SelectInst>(I) || isa<GetElementPtrInst>(I) || isa<CmpInst>(I);
}
/// isNotUsedInLoop - Return true if the only users of this instruction are
void LoopStrengthReduce::OptimizeIndvars(Loop *L) {
// TODO: implement optzns here.
-
-
-
// Finally, get the terminating condition for the loop if possible. If we
// can, we want to change it to use a post-incremented version of its
// induction variable, to allow coalescing the live ranges for the IV into
BasicBlock *LatchBlock =
SomePHI->getIncomingBlock(SomePHI->getIncomingBlock(0) == Preheader);
BranchInst *TermBr = dyn_cast<BranchInst>(LatchBlock->getTerminator());
- if (!TermBr || TermBr->isUnconditional() ||
- !isa<SetCondInst>(TermBr->getCondition()))
+ if (!TermBr || TermBr->isUnconditional() ||
+ !isa<ICmpInst>(TermBr->getCondition()))
return;
- SetCondInst *Cond = cast<SetCondInst>(TermBr->getCondition());
+ ICmpInst *Cond = cast<ICmpInst>(TermBr->getCondition());
// Search IVUsesByStride to find Cond's IVUse if there is one.
IVStrideUse *CondUse = 0;
Cond->moveBefore(TermBr);
} else {
// Otherwise, clone the terminating condition and insert into the loopend.
- Cond = cast<SetCondInst>(Cond->clone());
+ Cond = cast<ICmpInst>(Cond->clone());
Cond->setName(L->getHeader()->getName() + ".termcond");
LatchBlock->getInstList().insert(TermBr, Cond);
// FIXME: this needs to eliminate an induction variable even if it's being
// compared against some value to decide loop termination.
if (PN->hasOneUse()) {
- BinaryOperator *BO = dyn_cast<BinaryOperator>(*(PN->use_begin()));
- if (BO && BO->hasOneUse()) {
- if (PN == *(BO->use_begin())) {
+ Instruction *BO = dyn_cast<Instruction>(*PN->use_begin());
+ if (BO && (isa<BinaryOperator>(BO) || isa<CmpInst>(BO))) {
+ if (BO->hasOneUse() && PN == *(BO->use_begin())) {
DeadInsts.insert(BO);
// Break the cycle, then delete the PHI.
PN->replaceAllUsesWith(UndefValue::get(PN->getType()));
// Insert a conditional branch on LIC to the two preheaders. The original
// code is the true version and the new code is the false version.
Value *BranchVal = LIC;
- if (!isa<ConstantBool>(Val)) {
- BranchVal = BinaryOperator::createSetEQ(LIC, Val, "tmp", InsertPt);
- } else if (Val != ConstantBool::getTrue()) {
+ if (!isa<ConstantBool>(Val))
+ BranchVal = new ICmpInst(ICmpInst::ICMP_EQ, LIC, Val, "tmp", InsertPt);
+ else if (Val != ConstantBool::getTrue())
// We want to enter the new loop when the condition is true.
std::swap(TrueDest, FalseDest);
- }
// Insert the new branch.
new BranchInst(TrueDest, FalseDest, BranchVal, InsertPt);
/// @param BO the binary operator to convert
void visitBinaryOperator(BinaryOperator& BO);
+ /// @brief Lowers packed icmp operations.
+ /// @param CI the icmp operator to convert
+ void visitICmpInst(ICmpInst& IC);
+
/// @brief Lowers packed select instructions.
/// @param SELI the select operator to convert
void visitSelectInst(SelectInst& SELI);
}
}
+void LowerPacked::visitICmpInst(ICmpInst& IC)
+{
+ // Make sure both operands are PackedTypes
+ if (isa<PackedType>(IC.getOperand(0)->getType())) {
+ std::vector<Value*>& op0Vals = getValues(IC.getOperand(0));
+ std::vector<Value*>& op1Vals = getValues(IC.getOperand(1));
+ std::vector<Value*> result;
+ assert((op0Vals.size() == op1Vals.size()) &&
+ "The two packed operand to scalar maps must be equal in size.");
+
+ result.reserve(op0Vals.size());
+
+ // generate the new binary op and save the result
+ for (unsigned i = 0; i != op0Vals.size(); ++i) {
+ result.push_back(CmpInst::create(IC.getOpcode(),
+ IC.getPredicate(),
+ op0Vals[i],
+ op1Vals[i],
+ IC.getName() +
+ "." + utostr(i),
+ &IC));
+ }
+
+ setValues(&IC,result);
+ Changed = true;
+ instrsToRemove.push_back(&IC);
+ }
+}
+
void LowerPacked::visitStoreInst(StoreInst& SI)
{
if (const PackedType* PKT =
}
} else {
for (unsigned i = 0; i != Vals.size(); ++i) {
- SetCondInst *setcc =
- new SetCondInst(Instruction::SetEQ, Idx,
- ConstantInt::get(Type::UIntTy, i),
- "setcc", &IE);
+ ICmpInst *icmp =
+ new ICmpInst(ICmpInst::ICMP_EQ, Idx,
+ ConstantInt::get(Type::UIntTy, i),
+ "icmp", &IE);
SelectInst *select =
- new SelectInst(setcc, Elt, Vals[i], "select", &IE);
+ new SelectInst(icmp, Elt, Vals[i], "select", &IE);
result.push_back(select);
}
}
void addToWorklist(Instruction *I) {
//DOUT << "addToWorklist: " << *I << "\n";
- if (!isa<BinaryOperator>(I) && !isa<SelectInst>(I)) return;
+ if (!isa<BinaryOperator>(I) && !isa<SelectInst>(I) && !isa<CmpInst>(I))
+ return;
const Type *Ty = I->getType();
if (Ty == Type::VoidTy || Ty->isFPOrFPVector()) return;
addEqual(BO, ConstantExpr::get(BO->getOpcode(), CI1, CI2));
switch (BO->getOpcode()) {
- case Instruction::SetEQ:
- // "seteq int %a, %b" EQ true then %a EQ %b
- // "seteq int %a, %b" EQ false then %a NE %b
- if (Canonical == ConstantBool::getTrue())
- addEqual(Op0, Op1);
- else if (Canonical == ConstantBool::getFalse())
- addNotEqual(Op0, Op1);
-
- // %a EQ %b then "seteq int %a, %b" EQ true
- // %a NE %b then "seteq int %a, %b" EQ false
- if (isEqual(Op0, Op1))
- addEqual(BO, ConstantBool::getTrue());
- else if (isNotEqual(Op0, Op1))
- addEqual(BO, ConstantBool::getFalse());
-
- break;
- case Instruction::SetNE:
- // "setne int %a, %b" EQ true then %a NE %b
- // "setne int %a, %b" EQ false then %a EQ %b
- if (Canonical == ConstantBool::getTrue())
- addNotEqual(Op0, Op1);
- else if (Canonical == ConstantBool::getFalse())
- addEqual(Op0, Op1);
-
- // %a EQ %b then "setne int %a, %b" EQ false
- // %a NE %b then "setne int %a, %b" EQ true
- if (isEqual(Op0, Op1))
- addEqual(BO, ConstantBool::getFalse());
- else if (isNotEqual(Op0, Op1))
- addEqual(BO, ConstantBool::getTrue());
-
- break;
- case Instruction::SetLT:
- // "setlt int %a, %b" EQ true then %a LT %b
- // "setlt int %a, %b" EQ false then %b LE %a
- if (Canonical == ConstantBool::getTrue())
- addLess(Op0, Op1);
- else if (Canonical == ConstantBool::getFalse())
- addLessEqual(Op1, Op0);
-
- // %a LT %b then "setlt int %a, %b" EQ true
- // %a GE %b then "setlt int %a, %b" EQ false
- if (isLess(Op0, Op1))
- addEqual(BO, ConstantBool::getTrue());
- else if (isGreaterEqual(Op0, Op1))
- addEqual(BO, ConstantBool::getFalse());
-
- break;
- case Instruction::SetLE:
- // "setle int %a, %b" EQ true then %a LE %b
- // "setle int %a, %b" EQ false then %b LT %a
- if (Canonical == ConstantBool::getTrue())
- addLessEqual(Op0, Op1);
- else if (Canonical == ConstantBool::getFalse())
- addLess(Op1, Op0);
-
- // %a LE %b then "setle int %a, %b" EQ true
- // %a GT %b then "setle int %a, %b" EQ false
- if (isLessEqual(Op0, Op1))
- addEqual(BO, ConstantBool::getTrue());
- else if (isGreater(Op0, Op1))
- addEqual(BO, ConstantBool::getFalse());
-
- break;
- case Instruction::SetGT:
- // "setgt int %a, %b" EQ true then %b LT %a
- // "setgt int %a, %b" EQ false then %a LE %b
- if (Canonical == ConstantBool::getTrue())
- addLess(Op1, Op0);
- else if (Canonical == ConstantBool::getFalse())
- addLessEqual(Op0, Op1);
-
- // %a GT %b then "setgt int %a, %b" EQ true
- // %a LE %b then "setgt int %a, %b" EQ false
- if (isGreater(Op0, Op1))
- addEqual(BO, ConstantBool::getTrue());
- else if (isLessEqual(Op0, Op1))
- addEqual(BO, ConstantBool::getFalse());
-
- break;
- case Instruction::SetGE:
- // "setge int %a, %b" EQ true then %b LE %a
- // "setge int %a, %b" EQ false then %a LT %b
- if (Canonical == ConstantBool::getTrue())
- addLessEqual(Op1, Op0);
- else if (Canonical == ConstantBool::getFalse())
- addLess(Op0, Op1);
-
- // %a GE %b then "setge int %a, %b" EQ true
- // %a LT %b then "setlt int %a, %b" EQ false
- if (isGreaterEqual(Op0, Op1))
- addEqual(BO, ConstantBool::getTrue());
- else if (isLess(Op0, Op1))
- addEqual(BO, ConstantBool::getFalse());
-
- break;
case Instruction::And: {
// "and int %a, %b" EQ -1 then %a EQ -1 and %b EQ -1
// "and bool %a, %b" EQ true then %a EQ true and %b EQ true
break;
}
}
+ } else if (FCmpInst *CI = dyn_cast<FCmpInst>(I)) {
+ Value *Op0 = cIG.canonicalize(CI->getOperand(0)),
+ *Op1 = cIG.canonicalize(CI->getOperand(1));
+
+ ConstantFP *CI1 = dyn_cast<ConstantFP>(Op0),
+ *CI2 = dyn_cast<ConstantFP>(Op1);
+
+ if (CI1 && CI2)
+ addEqual(CI, ConstantExpr::getFCmp(CI->getPredicate(), CI1, CI2));
+
+ switch (CI->getPredicate()) {
+ case FCmpInst::FCMP_OEQ:
+ case FCmpInst::FCMP_UEQ:
+ // "eq int %a, %b" EQ true then %a EQ %b
+ // "eq int %a, %b" EQ false then %a NE %b
+ if (Canonical == ConstantBool::getTrue())
+ addEqual(Op0, Op1);
+ else if (Canonical == ConstantBool::getFalse())
+ addNotEqual(Op0, Op1);
+
+ // %a EQ %b then "eq int %a, %b" EQ true
+ // %a NE %b then "eq int %a, %b" EQ false
+ if (isEqual(Op0, Op1))
+ addEqual(CI, ConstantBool::getTrue());
+ else if (isNotEqual(Op0, Op1))
+ addEqual(CI, ConstantBool::getFalse());
+
+ break;
+ case FCmpInst::FCMP_ONE:
+ case FCmpInst::FCMP_UNE:
+ // "ne int %a, %b" EQ true then %a NE %b
+ // "ne int %a, %b" EQ false then %a EQ %b
+ if (Canonical == ConstantBool::getTrue())
+ addNotEqual(Op0, Op1);
+ else if (Canonical == ConstantBool::getFalse())
+ addEqual(Op0, Op1);
+
+ // %a EQ %b then "ne int %a, %b" EQ false
+ // %a NE %b then "ne int %a, %b" EQ true
+ if (isEqual(Op0, Op1))
+ addEqual(CI, ConstantBool::getFalse());
+ else if (isNotEqual(Op0, Op1))
+ addEqual(CI, ConstantBool::getTrue());
+
+ break;
+ case FCmpInst::FCMP_ULT:
+ case FCmpInst::FCMP_OLT:
+ // "lt int %a, %b" EQ true then %a LT %b
+ // "lt int %a, %b" EQ false then %b LE %a
+ if (Canonical == ConstantBool::getTrue())
+ addLess(Op0, Op1);
+ else if (Canonical == ConstantBool::getFalse())
+ addLessEqual(Op1, Op0);
+
+ // %a LT %b then "lt int %a, %b" EQ true
+ // %a GE %b then "lt int %a, %b" EQ false
+ if (isLess(Op0, Op1))
+ addEqual(CI, ConstantBool::getTrue());
+ else if (isGreaterEqual(Op0, Op1))
+ addEqual(CI, ConstantBool::getFalse());
+
+ break;
+ case FCmpInst::FCMP_ULE:
+ case FCmpInst::FCMP_OLE:
+ // "le int %a, %b" EQ true then %a LE %b
+ // "le int %a, %b" EQ false then %b LT %a
+ if (Canonical == ConstantBool::getTrue())
+ addLessEqual(Op0, Op1);
+ else if (Canonical == ConstantBool::getFalse())
+ addLess(Op1, Op0);
+
+ // %a LE %b then "le int %a, %b" EQ true
+ // %a GT %b then "le int %a, %b" EQ false
+ if (isLessEqual(Op0, Op1))
+ addEqual(CI, ConstantBool::getTrue());
+ else if (isGreater(Op0, Op1))
+ addEqual(CI, ConstantBool::getFalse());
+
+ break;
+ case FCmpInst::FCMP_UGT:
+ case FCmpInst::FCMP_OGT:
+ // "gt int %a, %b" EQ true then %b LT %a
+ // "gt int %a, %b" EQ false then %a LE %b
+ if (Canonical == ConstantBool::getTrue())
+ addLess(Op1, Op0);
+ else if (Canonical == ConstantBool::getFalse())
+ addLessEqual(Op0, Op1);
+
+ // %a GT %b then "gt int %a, %b" EQ true
+ // %a LE %b then "gt int %a, %b" EQ false
+ if (isGreater(Op0, Op1))
+ addEqual(CI, ConstantBool::getTrue());
+ else if (isLessEqual(Op0, Op1))
+ addEqual(CI, ConstantBool::getFalse());
+
+ break;
+ case FCmpInst::FCMP_UGE:
+ case FCmpInst::FCMP_OGE:
+ // "ge int %a, %b" EQ true then %b LE %a
+ // "ge int %a, %b" EQ false then %a LT %b
+ if (Canonical == ConstantBool::getTrue())
+ addLessEqual(Op1, Op0);
+ else if (Canonical == ConstantBool::getFalse())
+ addLess(Op0, Op1);
+
+ // %a GE %b then "ge int %a, %b" EQ true
+ // %a LT %b then "lt int %a, %b" EQ false
+ if (isGreaterEqual(Op0, Op1))
+ addEqual(CI, ConstantBool::getTrue());
+ else if (isLess(Op0, Op1))
+ addEqual(CI, ConstantBool::getFalse());
+
+ break;
+ default:
+ break;
+ }
+
+ // "%x = add int %y, %z" and %x EQ %y then %z EQ 0
+ // "%x = mul int %y, %z" and %x EQ %y then %z EQ 1
+ // 1. Repeat all of the above, with order of operands reversed.
+ // "%x = fdiv float %y, %z" and %x EQ %y then %z EQ 1
+ Value *Known = Op0, *Unknown = Op1;
+ if (Known != BO) std::swap(Known, Unknown);
+ } else if (ICmpInst *CI = dyn_cast<ICmpInst>(I)) {
+ Value *Op0 = cIG.canonicalize(CI->getOperand(0)),
+ *Op1 = cIG.canonicalize(CI->getOperand(1));
+
+ ConstantIntegral *CI1 = dyn_cast<ConstantIntegral>(Op0),
+ *CI2 = dyn_cast<ConstantIntegral>(Op1);
+
+ if (CI1 && CI2)
+ addEqual(CI, ConstantExpr::getICmp(CI->getPredicate(), CI1, CI2));
+
+ switch (CI->getPredicate()) {
+ case ICmpInst::ICMP_EQ:
+ // "eq int %a, %b" EQ true then %a EQ %b
+ // "eq int %a, %b" EQ false then %a NE %b
+ if (Canonical == ConstantBool::getTrue())
+ addEqual(Op0, Op1);
+ else if (Canonical == ConstantBool::getFalse())
+ addNotEqual(Op0, Op1);
+
+ // %a EQ %b then "eq int %a, %b" EQ true
+ // %a NE %b then "eq int %a, %b" EQ false
+ if (isEqual(Op0, Op1))
+ addEqual(CI, ConstantBool::getTrue());
+ else if (isNotEqual(Op0, Op1))
+ addEqual(CI, ConstantBool::getFalse());
+
+ break;
+ case ICmpInst::ICMP_NE:
+ // "ne int %a, %b" EQ true then %a NE %b
+ // "ne int %a, %b" EQ false then %a EQ %b
+ if (Canonical == ConstantBool::getTrue())
+ addNotEqual(Op0, Op1);
+ else if (Canonical == ConstantBool::getFalse())
+ addEqual(Op0, Op1);
+
+ // %a EQ %b then "ne int %a, %b" EQ false
+ // %a NE %b then "ne int %a, %b" EQ true
+ if (isEqual(Op0, Op1))
+ addEqual(CI, ConstantBool::getFalse());
+ else if (isNotEqual(Op0, Op1))
+ addEqual(CI, ConstantBool::getTrue());
+
+ break;
+ case ICmpInst::ICMP_ULT:
+ case ICmpInst::ICMP_SLT:
+ // "lt int %a, %b" EQ true then %a LT %b
+ // "lt int %a, %b" EQ false then %b LE %a
+ if (Canonical == ConstantBool::getTrue())
+ addLess(Op0, Op1);
+ else if (Canonical == ConstantBool::getFalse())
+ addLessEqual(Op1, Op0);
+
+ // %a LT %b then "lt int %a, %b" EQ true
+ // %a GE %b then "lt int %a, %b" EQ false
+ if (isLess(Op0, Op1))
+ addEqual(CI, ConstantBool::getTrue());
+ else if (isGreaterEqual(Op0, Op1))
+ addEqual(CI, ConstantBool::getFalse());
+
+ break;
+ case ICmpInst::ICMP_ULE:
+ case ICmpInst::ICMP_SLE:
+ // "le int %a, %b" EQ true then %a LE %b
+ // "le int %a, %b" EQ false then %b LT %a
+ if (Canonical == ConstantBool::getTrue())
+ addLessEqual(Op0, Op1);
+ else if (Canonical == ConstantBool::getFalse())
+ addLess(Op1, Op0);
+
+ // %a LE %b then "le int %a, %b" EQ true
+ // %a GT %b then "le int %a, %b" EQ false
+ if (isLessEqual(Op0, Op1))
+ addEqual(CI, ConstantBool::getTrue());
+ else if (isGreater(Op0, Op1))
+ addEqual(CI, ConstantBool::getFalse());
+
+ break;
+ case ICmpInst::ICMP_UGT:
+ case ICmpInst::ICMP_SGT:
+ // "gt int %a, %b" EQ true then %b LT %a
+ // "gt int %a, %b" EQ false then %a LE %b
+ if (Canonical == ConstantBool::getTrue())
+ addLess(Op1, Op0);
+ else if (Canonical == ConstantBool::getFalse())
+ addLessEqual(Op0, Op1);
+
+ // %a GT %b then "gt int %a, %b" EQ true
+ // %a LE %b then "gt int %a, %b" EQ false
+ if (isGreater(Op0, Op1))
+ addEqual(CI, ConstantBool::getTrue());
+ else if (isLessEqual(Op0, Op1))
+ addEqual(CI, ConstantBool::getFalse());
+
+ break;
+ case ICmpInst::ICMP_UGE:
+ case ICmpInst::ICMP_SGE:
+ // "ge int %a, %b" EQ true then %b LE %a
+ // "ge int %a, %b" EQ false then %a LT %b
+ if (Canonical == ConstantBool::getTrue())
+ addLessEqual(Op1, Op0);
+ else if (Canonical == ConstantBool::getFalse())
+ addLess(Op0, Op1);
+
+ // %a GE %b then "ge int %a, %b" EQ true
+ // %a LT %b then "lt int %a, %b" EQ false
+ if (isGreaterEqual(Op0, Op1))
+ addEqual(CI, ConstantBool::getTrue());
+ else if (isLess(Op0, Op1))
+ addEqual(CI, ConstantBool::getFalse());
+
+ break;
+ default:
+ break;
+ }
+
+ // "%x = add int %y, %z" and %x EQ %y then %z EQ 0
+ // "%x = mul int %y, %z" and %x EQ %y then %z EQ 1
+ // 1. Repeat all of the above, with order of operands reversed.
+ // "%x = fdiv float %y, %z" and %x EQ %y then %z EQ 1
+ Value *Known = Op0, *Unknown = Op1;
+ if (Known != BO) std::swap(Known, Unknown);
} else if (SelectInst *SI = dyn_cast<SelectInst>(I)) {
// Given: "%a = select bool %x, int %b, int %c"
// %a EQ %b then %x EQ true
void visitStoreInst(StoreInst &SI);
void visitBinaryOperator(BinaryOperator &BO);
+ void visitCmpInst(CmpInst &CI) {}
};
// Used by terminator instructions to proceed from the current basic
FunctionPass *llvm::createReassociatePass() { return new Reassociate(); }
void Reassociate::RemoveDeadBinaryOp(Value *V) {
- BinaryOperator *BOp = dyn_cast<BinaryOperator>(V);
- if (!BOp || !BOp->use_empty()) return;
+ Instruction *Op = dyn_cast<Instruction>(V);
+ if (!Op || !isa<BinaryOperator>(Op) || !isa<CmpInst>(Op) || !Op->use_empty())
+ return;
- Value *LHS = BOp->getOperand(0), *RHS = BOp->getOperand(1);
+ Value *LHS = Op->getOperand(0), *RHS = Op->getOperand(1);
RemoveDeadBinaryOp(LHS);
RemoveDeadBinaryOp(RHS);
}
}
// Reject cases where it is pointless to do this.
- if (!isa<BinaryOperator>(BI) || BI->getType()->isFloatingPoint() ||
+ if (!isa<BinaryOperator>(BI) || BI->getType()->isFloatingPoint() ||
isa<PackedType>(BI->getType()))
continue; // Floating point ops are not associative.
void visitCastInst(CastInst &I);
void visitSelectInst(SelectInst &I);
void visitBinaryOperator(Instruction &I);
+ void visitCmpInst(CmpInst &I);
void visitShiftInst(ShiftInst &I) { visitBinaryOperator(I); }
void visitExtractElementInst(ExtractElementInst &I);
void visitInsertElementInst(InsertElementInst &I);
}
}
+// Handle ICmpInst instruction...
+void SCCPSolver::visitCmpInst(CmpInst &I) {
+ LatticeVal &IV = ValueState[&I];
+ if (IV.isOverdefined()) return;
+
+ LatticeVal &V1State = getValueState(I.getOperand(0));
+ LatticeVal &V2State = getValueState(I.getOperand(1));
+
+ if (V1State.isOverdefined() || V2State.isOverdefined()) {
+ // If both operands are PHI nodes, it is possible that this instruction has
+ // a constant value, despite the fact that the PHI node doesn't. Check for
+ // this condition now.
+ if (PHINode *PN1 = dyn_cast<PHINode>(I.getOperand(0)))
+ if (PHINode *PN2 = dyn_cast<PHINode>(I.getOperand(1)))
+ if (PN1->getParent() == PN2->getParent()) {
+ // Since the two PHI nodes are in the same basic block, they must have
+ // entries for the same predecessors. Walk the predecessor list, and
+ // if all of the incoming values are constants, and the result of
+ // evaluating this expression with all incoming value pairs is the
+ // same, then this expression is a constant even though the PHI node
+ // is not a constant!
+ LatticeVal Result;
+ for (unsigned i = 0, e = PN1->getNumIncomingValues(); i != e; ++i) {
+ LatticeVal &In1 = getValueState(PN1->getIncomingValue(i));
+ BasicBlock *InBlock = PN1->getIncomingBlock(i);
+ LatticeVal &In2 =
+ getValueState(PN2->getIncomingValueForBlock(InBlock));
+
+ if (In1.isOverdefined() || In2.isOverdefined()) {
+ Result.markOverdefined();
+ break; // Cannot fold this operation over the PHI nodes!
+ } else if (In1.isConstant() && In2.isConstant()) {
+ Constant *V = ConstantExpr::getCompare(I.getPredicate(),
+ In1.getConstant(),
+ In2.getConstant());
+ if (Result.isUndefined())
+ Result.markConstant(V);
+ else if (Result.isConstant() && Result.getConstant() != V) {
+ Result.markOverdefined();
+ break;
+ }
+ }
+ }
+
+ // If we found a constant value here, then we know the instruction is
+ // constant despite the fact that the PHI nodes are overdefined.
+ if (Result.isConstant()) {
+ markConstant(IV, &I, Result.getConstant());
+ // Remember that this instruction is virtually using the PHI node
+ // operands.
+ UsersOfOverdefinedPHIs.insert(std::make_pair(PN1, &I));
+ UsersOfOverdefinedPHIs.insert(std::make_pair(PN2, &I));
+ return;
+ } else if (Result.isUndefined()) {
+ return;
+ }
+
+ // Okay, this really is overdefined now. Since we might have
+ // speculatively thought that this was not overdefined before, and
+ // added ourselves to the UsersOfOverdefinedPHIs list for the PHIs,
+ // make sure to clean out any entries that we put there, for
+ // efficiency.
+ std::multimap<PHINode*, Instruction*>::iterator It, E;
+ tie(It, E) = UsersOfOverdefinedPHIs.equal_range(PN1);
+ while (It != E) {
+ if (It->second == &I) {
+ UsersOfOverdefinedPHIs.erase(It++);
+ } else
+ ++It;
+ }
+ tie(It, E) = UsersOfOverdefinedPHIs.equal_range(PN2);
+ while (It != E) {
+ if (It->second == &I) {
+ UsersOfOverdefinedPHIs.erase(It++);
+ } else
+ ++It;
+ }
+ }
+
+ markOverdefined(IV, &I);
+ } else if (V1State.isConstant() && V2State.isConstant()) {
+ markConstant(IV, &I, ConstantExpr::getCompare(I.getPredicate(),
+ V1State.getConstant(),
+ V2State.getConstant()));
+ }
+}
+
void SCCPSolver::visitExtractElementInst(ExtractElementInst &I) {
// FIXME : SCCP does not handle vectors properly.
markOverdefined(&I);
assert(NumElements == 2 && "Unhandled case!");
// All users of the GEP must be loads. At each use of the GEP, insert
// two loads of the appropriate indexed GEP and select between them.
- Value *IsOne = BinaryOperator::createSetNE(I.getOperand(),
+ Value *IsOne = new ICmpInst(ICmpInst::ICMP_NE, I.getOperand(),
Constant::getNullValue(I.getOperand()->getType()),
- "isone", GEPI);
+ "isone", GEPI);
// Insert the new GEP instructions, which are properly indexed.
std::vector<Value*> Indices(GEPI->op_begin()+1, GEPI->op_end());
Indices[1] = Constant::getNullValue(Type::IntTy);
/// mapping its operands through ValueMap if they are available.
Constant *PruningFunctionCloner::
ConstantFoldMappedInstruction(const Instruction *I) {
- if (isa<BinaryOperator>(I) || isa<ShiftInst>(I)) {
+ if (isa<CmpInst>(I)) {
+ if (Constant *Op0 = dyn_cast_or_null<Constant>(MapValue(I->getOperand(0),
+ ValueMap)))
+ if (Constant *Op1 = dyn_cast_or_null<Constant>(MapValue(I->getOperand(1),
+ ValueMap)))
+ return ConstantExpr::getCompare(cast<CmpInst>(I)->getPredicate(), Op0,
+ Op1);
+ return 0;
+ } else if (isa<BinaryOperator>(I) || isa<ShiftInst>(I)) {
if (Constant *Op0 = dyn_cast_or_null<Constant>(MapValue(I->getOperand(0),
ValueMap)))
if (Constant *Op1 = dyn_cast_or_null<Constant>(MapValue(I->getOperand(1),
else
return 0; // All operands not constant!
- return ConstantFoldInstOperands(I->getOpcode(), I->getType(), Ops);
+ return ConstantFoldInstOperands(I, Ops);
}
/// CloneAndPruneFunctionInto - This works exactly like CloneFunctionInto,
case 2:
Op1 = dyn_cast<Constant>(I->getOperand(1));
if (Op1 == 0) return 0; // Not a constant?, can't fold
+ /* FALL THROUGH */
case 1:
Op0 = dyn_cast<Constant>(I->getOperand(0));
if (Op0 == 0) return 0; // Not a constant?, can't fold
}
if (isa<BinaryOperator>(I) || isa<ShiftInst>(I)) {
- if (Constant *Op0 = dyn_cast<Constant>(I->getOperand(0)))
- if (Constant *Op1 = dyn_cast<Constant>(I->getOperand(1)))
- return ConstantExpr::get(I->getOpcode(), Op0, Op1);
- return 0; // Operands not constants.
+ return ConstantExpr::get(I->getOpcode(), Op0, Op1);
+ } else if (isa<ICmpInst>(I)) {
+ return ConstantExpr::getICmp(cast<ICmpInst>(I)->getPredicate(), Op0, Op1);
+ } else if (isa<FCmpInst>(I)) {
+ return ConstantExpr::getFCmp(cast<FCmpInst>(I)->getPredicate(), Op0, Op1);
}
- // Scan the operand list, checking to see if the are all constants, if so,
+ // Scan the operand list, checking to see if they are all constants, if so,
// hand off to ConstantFoldInstOperands.
std::vector<Constant*> Ops;
for (unsigned i = 0, e = I->getNumOperands(); i != e; ++i)
else
return 0; // All operands not constant!
- return ConstantFoldInstOperands(I->getOpcode(), I->getType(), Ops);
+ return ConstantFoldInstOperands(I, Ops);
}
/// ConstantFoldInstOperands - Attempt to constant fold an instruction with the
/// attempting to fold instructions like loads and stores, which have no
/// constant expression form.
///
-Constant *llvm::ConstantFoldInstOperands(unsigned Opc, const Type *DestTy,
+Constant *llvm::ConstantFoldInstOperands(const Instruction* I,
const std::vector<Constant*> &Ops) {
- if (Opc >= Instruction::BinaryOpsBegin && Opc < Instruction::BinaryOpsEnd)
+ unsigned Opc = I->getOpcode();
+ const Type *DestTy = I->getType();
+
+ // Handle easy binops first
+ if (isa<BinaryOperator>(I))
return ConstantExpr::get(Opc, Ops[0], Ops[1]);
switch (Opc) {
}
}
return 0;
+ case Instruction::ICmp:
+ case Instruction::FCmp:
+ return ConstantExpr::getCompare(cast<CmpInst>(I)->getPredicate(), Ops[0],
+ Ops[1]);
case Instruction::Shl:
case Instruction::LShr:
case Instruction::AShr:
} else if (SI->getNumSuccessors() == 2) {
// Otherwise, we can fold this switch into a conditional branch
// instruction if it has only one non-default destination.
- Value *Cond = new SetCondInst(Instruction::SetEQ, SI->getCondition(),
- SI->getSuccessorValue(1), "cond", SI);
+ Value *Cond = new ICmpInst(ICmpInst::ICMP_EQ, SI->getCondition(),
+ SI->getSuccessorValue(1), "cond", SI);
// Insert the new branch...
new BranchInst(SI->getSuccessor(1), SI->getSuccessor(0), Cond, SI);
EntryBB->getTerminator());
// Compare the return value to zero.
- Value *IsNormal = BinaryOperator::createSetEQ(SJRet,
- Constant::getNullValue(SJRet->getType()),
- "notunwind", EntryBB->getTerminator());
+ Value *IsNormal = new ICmpInst(ICmpInst::ICMP_EQ, SJRet,
+ Constant::getNullValue(SJRet->getType()),
+ "notunwind", EntryBB->getTerminator());
// Nuke the uncond branch.
EntryBB->getTerminator()->eraseFromParent();
}
// Load the JBList, if it's null, then there was no catch!
- Value *NotNull = BinaryOperator::createSetNE(BufPtr,
- Constant::getNullValue(BufPtr->getType()),
- "notnull", UnwindHandler);
+ Value *NotNull = new ICmpInst(ICmpInst::ICMP_NE, BufPtr,
+ Constant::getNullValue(BufPtr->getType()),
+ "notnull", UnwindHandler);
new BranchInst(UnwindBlock, TermBlock, NotNull, UnwindHandler);
// Create the block to do the longjmp.
BasicBlock* NewNode = new BasicBlock("NodeBlock");
F->getBasicBlockList().insert(OrigBlock->getNext(), NewNode);
- SetCondInst* Comp = new SetCondInst(Instruction::SetLT, Val, Pivot.first,
- "Pivot");
+ ICmpInst* Comp = new ICmpInst(ICmpInst::ICMP_ULT, Val, Pivot.first, "Pivot");
NewNode->getInstList().push_back(Comp);
new BranchInst(LBranch, RBranch, Comp, NewNode);
return NewNode;
F->getBasicBlockList().insert(OrigBlock->getNext(), NewLeaf);
// Make the seteq instruction...
- SetCondInst* Comp = new SetCondInst(Instruction::SetEQ, Val,
- Leaf.first, "SwitchLeaf");
+ ICmpInst* Comp = new ICmpInst(ICmpInst::ICMP_EQ, Val,
+ Leaf.first, "SwitchLeaf");
NewLeaf->getInstList().push_back(Comp);
// Make the conditional branch...
case Instruction::Shl:
case Instruction::LShr:
case Instruction::AShr:
- case Instruction::SetEQ:
- case Instruction::SetNE:
- case Instruction::SetLT:
- case Instruction::SetGT:
- case Instruction::SetLE:
- case Instruction::SetGE:
+ case Instruction::ICmp:
+ case Instruction::FCmp:
break; // These are all cheap and non-trapping instructions.
}
return true;
}
-// GatherConstantSetEQs - Given a potentially 'or'd together collection of seteq
-// instructions that compare a value against a constant, return the value being
-// compared, and stick the constant into the Values vector.
+// GatherConstantSetEQs - Given a potentially 'or'd together collection of
+// icmp_eq instructions that compare a value against a constant, return the
+// value being compared, and stick the constant into the Values vector.
static Value *GatherConstantSetEQs(Value *V, std::vector<ConstantInt*> &Values){
if (Instruction *Inst = dyn_cast<Instruction>(V))
- if (Inst->getOpcode() == Instruction::SetEQ) {
+ if (Inst->getOpcode() == Instruction::ICmp &&
+ cast<ICmpInst>(Inst)->getPredicate() == ICmpInst::ICMP_EQ) {
if (ConstantInt *C = dyn_cast<ConstantInt>(Inst->getOperand(1))) {
Values.push_back(C);
return Inst->getOperand(0);
// being compared, and stick the constant into the Values vector.
static Value *GatherConstantSetNEs(Value *V, std::vector<ConstantInt*> &Values){
if (Instruction *Inst = dyn_cast<Instruction>(V))
- if (Inst->getOpcode() == Instruction::SetNE) {
+ if (Inst->getOpcode() == Instruction::ICmp &&
+ cast<ICmpInst>(Inst)->getPredicate() == ICmpInst::ICMP_NE) {
if (ConstantInt *C = dyn_cast<ConstantInt>(Inst->getOperand(1))) {
Values.push_back(C);
return Inst->getOperand(0);
}
if (BranchInst *BI = dyn_cast<BranchInst>(TI))
if (BI->isConditional() && BI->getCondition()->hasOneUse())
- if (SetCondInst *SCI = dyn_cast<SetCondInst>(BI->getCondition()))
- if ((SCI->getOpcode() == Instruction::SetEQ ||
- SCI->getOpcode() == Instruction::SetNE) &&
- isa<ConstantInt>(SCI->getOperand(1)))
- return SCI->getOperand(0);
+ if (ICmpInst *ICI = dyn_cast<ICmpInst>(BI->getCondition()))
+ if ((ICI->getPredicate() == ICmpInst::ICMP_EQ ||
+ ICI->getPredicate() == ICmpInst::ICMP_NE) &&
+ isa<ConstantInt>(ICI->getOperand(1)))
+ return ICI->getOperand(0);
return 0;
}
}
BranchInst *BI = cast<BranchInst>(TI);
- SetCondInst *SCI = cast<SetCondInst>(BI->getCondition());
- Cases.push_back(std::make_pair(cast<ConstantInt>(SCI->getOperand(1)),
- BI->getSuccessor(SCI->getOpcode() ==
- Instruction::SetNE)));
- return BI->getSuccessor(SCI->getOpcode() == Instruction::SetEQ);
+ ICmpInst *ICI = cast<ICmpInst>(BI->getCondition());
+ Cases.push_back(std::make_pair(cast<ConstantInt>(ICI->getOperand(1)),
+ BI->getSuccessor(ICI->getPredicate() ==
+ ICmpInst::ICMP_NE)));
+ return BI->getSuccessor(ICI->getPredicate() == ICmpInst::ICMP_EQ);
}
BasicBlock *BB2 = BI->getSuccessor(1); // The false destination
Instruction *I1 = BB1->begin(), *I2 = BB2->begin();
- if (I1->getOpcode() != I2->getOpcode() || !I1->isIdenticalTo(I2) ||
- isa<PHINode>(I1) || isa<InvokeInst>(I1))
+ if (I1->getOpcode() != I2->getOpcode() || isa<PHINode>(I1) ||
+ isa<InvokeInst>(I1) || !I1->isIdenticalTo(I2))
return false;
// If we get here, we can hoist at least one instruction.
// predecessor and use logical operations to pick the right destination.
BasicBlock *TrueDest = BI->getSuccessor(0);
BasicBlock *FalseDest = BI->getSuccessor(1);
- if (BinaryOperator *Cond = dyn_cast<BinaryOperator>(BI->getCondition()))
- if (Cond->getParent() == BB && &BB->front() == Cond &&
+ if (Instruction *Cond = dyn_cast<Instruction>(BI->getCondition()))
+ if ((isa<CmpInst>(Cond) || isa<BinaryOperator>(Cond)) &&
+ Cond->getParent() == BB && &BB->front() == Cond &&
Cond->getNext() == BI && Cond->hasOneUse() &&
TrueDest != BB && FalseDest != BB)
for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI!=E; ++PI)
#include <limits>
using namespace llvm;
-namespace {
- struct VISIBILITY_HIDDEN ConstRules {
- ConstRules() {}
- virtual ~ConstRules() {}
-
- // Binary Operators...
- virtual Constant *add(const Constant *V1, const Constant *V2) const = 0;
- virtual Constant *sub(const Constant *V1, const Constant *V2) const = 0;
- virtual Constant *mul(const Constant *V1, const Constant *V2) const = 0;
- virtual Constant *urem(const Constant *V1, const Constant *V2) const = 0;
- virtual Constant *srem(const Constant *V1, const Constant *V2) const = 0;
- virtual Constant *frem(const Constant *V1, const Constant *V2) const = 0;
- virtual Constant *udiv(const Constant *V1, const Constant *V2) const = 0;
- virtual Constant *sdiv(const Constant *V1, const Constant *V2) const = 0;
- virtual Constant *fdiv(const Constant *V1, const Constant *V2) const = 0;
- virtual Constant *op_and(const Constant *V1, const Constant *V2) const = 0;
- 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 *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;
-
- // ConstRules::get - Return an instance of ConstRules for the specified
- // constant operands.
- //
- static ConstRules &get(const Constant *V1, const Constant *V2);
- private:
- ConstRules(const ConstRules &); // Do not implement
- ConstRules &operator=(const ConstRules &); // Do not implement
- };
-}
-
-
-//===----------------------------------------------------------------------===//
-// TemplateRules Class
-//===----------------------------------------------------------------------===//
-//
-// TemplateRules - Implement a subclass of ConstRules that provides all
-// operations as noops. All other rules classes inherit from this class so
-// that if functionality is needed in the future, it can simply be added here
-// and to ConstRules without changing anything else...
-//
-// This class also provides subclasses with typesafe implementations of methods
-// so that don't have to do type casting.
-//
-namespace {
-template<class ArgType, class SubClassName>
-class VISIBILITY_HIDDEN TemplateRules : public ConstRules {
-
-
- //===--------------------------------------------------------------------===//
- // Redirecting functions that cast to the appropriate types
- //===--------------------------------------------------------------------===//
-
- virtual Constant *add(const Constant *V1, const Constant *V2) const {
- return SubClassName::Add((const ArgType *)V1, (const ArgType *)V2);
- }
- virtual Constant *sub(const Constant *V1, const Constant *V2) const {
- return SubClassName::Sub((const ArgType *)V1, (const ArgType *)V2);
- }
- virtual Constant *mul(const Constant *V1, const Constant *V2) const {
- return SubClassName::Mul((const ArgType *)V1, (const ArgType *)V2);
- }
- virtual Constant *udiv(const Constant *V1, const Constant *V2) const {
- return SubClassName::UDiv((const ArgType *)V1, (const ArgType *)V2);
- }
- virtual Constant *sdiv(const Constant *V1, const Constant *V2) const {
- return SubClassName::SDiv((const ArgType *)V1, (const ArgType *)V2);
- }
- virtual Constant *fdiv(const Constant *V1, const Constant *V2) const {
- return SubClassName::FDiv((const ArgType *)V1, (const ArgType *)V2);
- }
- virtual Constant *urem(const Constant *V1, const Constant *V2) const {
- return SubClassName::URem((const ArgType *)V1, (const ArgType *)V2);
- }
- virtual Constant *srem(const Constant *V1, const Constant *V2) const {
- return SubClassName::SRem((const ArgType *)V1, (const ArgType *)V2);
- }
- virtual Constant *frem(const Constant *V1, const Constant *V2) const {
- return SubClassName::FRem((const ArgType *)V1, (const ArgType *)V2);
- }
- virtual Constant *op_and(const Constant *V1, const Constant *V2) const {
- return SubClassName::And((const ArgType *)V1, (const ArgType *)V2);
- }
- virtual Constant *op_or(const Constant *V1, const Constant *V2) const {
- return SubClassName::Or((const ArgType *)V1, (const ArgType *)V2);
- }
- virtual Constant *op_xor(const Constant *V1, const Constant *V2) const {
- return SubClassName::Xor((const ArgType *)V1, (const ArgType *)V2);
- }
- virtual Constant *shl(const Constant *V1, const Constant *V2) const {
- return SubClassName::Shl((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 {
- return SubClassName::LessThan((const ArgType *)V1, (const ArgType *)V2);
- }
- virtual Constant *equalto(const Constant *V1, const Constant *V2) const {
- return SubClassName::EqualTo((const ArgType *)V1, (const ArgType *)V2);
- }
-
-
- //===--------------------------------------------------------------------===//
- // Default "noop" implementations
- //===--------------------------------------------------------------------===//
-
- static Constant *Add (const ArgType *V1, const ArgType *V2) { return 0; }
- static Constant *Sub (const ArgType *V1, const ArgType *V2) { return 0; }
- static Constant *Mul (const ArgType *V1, const ArgType *V2) { return 0; }
- static Constant *SDiv(const ArgType *V1, const ArgType *V2) { return 0; }
- static Constant *UDiv(const ArgType *V1, const ArgType *V2) { return 0; }
- static Constant *FDiv(const ArgType *V1, const ArgType *V2) { return 0; }
- static Constant *URem(const ArgType *V1, const ArgType *V2) { return 0; }
- static Constant *SRem(const ArgType *V1, const ArgType *V2) { return 0; }
- static Constant *FRem(const ArgType *V1, const ArgType *V2) { return 0; }
- static Constant *And (const ArgType *V1, const ArgType *V2) { return 0; }
- 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 *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;
- }
- static Constant *EqualTo(const ArgType *V1, const ArgType *V2) {
- return 0;
- }
-
-public:
- virtual ~TemplateRules() {}
-};
-} // end anonymous namespace
-
-
-//===----------------------------------------------------------------------===//
-// EmptyRules Class
-//===----------------------------------------------------------------------===//
-//
-// EmptyRules provides a concrete base class of ConstRules that does nothing
-//
-namespace {
-struct VISIBILITY_HIDDEN EmptyRules
- : public TemplateRules<Constant, EmptyRules> {
- static Constant *EqualTo(const Constant *V1, const Constant *V2) {
- if (V1 == V2) return ConstantBool::getTrue();
- return 0;
- }
-};
-} // end anonymous namespace
-
-
-
-//===----------------------------------------------------------------------===//
-// BoolRules Class
-//===----------------------------------------------------------------------===//
-//
-// BoolRules provides a concrete base class of ConstRules for the 'bool' type.
-//
-namespace {
-struct VISIBILITY_HIDDEN BoolRules
- : public TemplateRules<ConstantBool, BoolRules> {
-
- static Constant *LessThan(const ConstantBool *V1, const ConstantBool *V2) {
- return ConstantBool::get(V1->getValue() < V2->getValue());
- }
-
- static Constant *EqualTo(const Constant *V1, const Constant *V2) {
- return ConstantBool::get(V1 == V2);
- }
-
- static Constant *And(const ConstantBool *V1, const ConstantBool *V2) {
- return ConstantBool::get(V1->getValue() & V2->getValue());
- }
-
- static Constant *Or(const ConstantBool *V1, const ConstantBool *V2) {
- return ConstantBool::get(V1->getValue() | V2->getValue());
- }
-
- static Constant *Xor(const ConstantBool *V1, const ConstantBool *V2) {
- return ConstantBool::get(V1->getValue() ^ V2->getValue());
- }
-};
-} // end anonymous namespace
-
-
-//===----------------------------------------------------------------------===//
-// NullPointerRules Class
-//===----------------------------------------------------------------------===//
-//
-// NullPointerRules provides a concrete base class of ConstRules for null
-// pointers.
-//
-namespace {
-struct VISIBILITY_HIDDEN NullPointerRules
- : public TemplateRules<ConstantPointerNull, NullPointerRules> {
- static Constant *EqualTo(const Constant *V1, const Constant *V2) {
- return ConstantBool::getTrue(); // Null pointers are always equal
- }
-};
-} // end anonymous namespace
-
-//===----------------------------------------------------------------------===//
-// ConstantPackedRules Class
-//===----------------------------------------------------------------------===//
-
-/// DoVectorOp - Given two packed constants and a function pointer, apply the
-/// function pointer to each element pair, producing a new ConstantPacked
-/// constant.
-static Constant *EvalVectorOp(const ConstantPacked *V1,
- const ConstantPacked *V2,
- Constant *(*FP)(Constant*, Constant*)) {
- std::vector<Constant*> Res;
- for (unsigned i = 0, e = V1->getNumOperands(); i != e; ++i)
- Res.push_back(FP(const_cast<Constant*>(V1->getOperand(i)),
- const_cast<Constant*>(V2->getOperand(i))));
- return ConstantPacked::get(Res);
-}
-
-/// PackedTypeRules provides a concrete base class of ConstRules for
-/// ConstantPacked operands.
-///
-namespace {
-struct VISIBILITY_HIDDEN ConstantPackedRules
- : public TemplateRules<ConstantPacked, ConstantPackedRules> {
-
- static Constant *Add(const ConstantPacked *V1, const ConstantPacked *V2) {
- return EvalVectorOp(V1, V2, ConstantExpr::getAdd);
- }
- static Constant *Sub(const ConstantPacked *V1, const ConstantPacked *V2) {
- return EvalVectorOp(V1, V2, ConstantExpr::getSub);
- }
- static Constant *Mul(const ConstantPacked *V1, const ConstantPacked *V2) {
- return EvalVectorOp(V1, V2, ConstantExpr::getMul);
- }
- static Constant *UDiv(const ConstantPacked *V1, const ConstantPacked *V2) {
- return EvalVectorOp(V1, V2, ConstantExpr::getUDiv);
- }
- static Constant *SDiv(const ConstantPacked *V1, const ConstantPacked *V2) {
- return EvalVectorOp(V1, V2, ConstantExpr::getSDiv);
- }
- static Constant *FDiv(const ConstantPacked *V1, const ConstantPacked *V2) {
- return EvalVectorOp(V1, V2, ConstantExpr::getFDiv);
- }
- static Constant *URem(const ConstantPacked *V1, const ConstantPacked *V2) {
- return EvalVectorOp(V1, V2, ConstantExpr::getURem);
- }
- static Constant *SRem(const ConstantPacked *V1, const ConstantPacked *V2) {
- return EvalVectorOp(V1, V2, ConstantExpr::getSRem);
- }
- static Constant *FRem(const ConstantPacked *V1, const ConstantPacked *V2) {
- return EvalVectorOp(V1, V2, ConstantExpr::getFRem);
- }
- static Constant *And(const ConstantPacked *V1, const ConstantPacked *V2) {
- return EvalVectorOp(V1, V2, ConstantExpr::getAnd);
- }
- static Constant *Or (const ConstantPacked *V1, const ConstantPacked *V2) {
- return EvalVectorOp(V1, V2, ConstantExpr::getOr);
- }
- static Constant *Xor(const ConstantPacked *V1, const ConstantPacked *V2) {
- return EvalVectorOp(V1, V2, ConstantExpr::getXor);
- }
- static Constant *LessThan(const ConstantPacked *V1, const ConstantPacked *V2){
- return 0;
- }
- static Constant *EqualTo(const ConstantPacked *V1, const ConstantPacked *V2) {
- for (unsigned i = 0, e = V1->getNumOperands(); i != e; ++i) {
- Constant *C =
- ConstantExpr::getSetEQ(const_cast<Constant*>(V1->getOperand(i)),
- const_cast<Constant*>(V2->getOperand(i)));
- if (ConstantBool *CB = dyn_cast<ConstantBool>(C))
- return CB;
- }
- // Otherwise, could not decide from any element pairs.
- return 0;
- }
-};
-} // end anonymous namespace
-
-
-//===----------------------------------------------------------------------===//
-// GeneralPackedRules Class
-//===----------------------------------------------------------------------===//
-
-/// GeneralPackedRules provides a concrete base class of ConstRules for
-/// PackedType operands, where both operands are not ConstantPacked. The usual
-/// cause for this is that one operand is a ConstantAggregateZero.
-///
-namespace {
-struct VISIBILITY_HIDDEN GeneralPackedRules
- : public TemplateRules<Constant, GeneralPackedRules> {
-};
-} // end anonymous namespace
-
-
-//===----------------------------------------------------------------------===//
-// DirectIntRules Class
-//===----------------------------------------------------------------------===//
-//
-// DirectIntRules provides implementations of functions that are valid on
-// integer types, but not all types in general.
-//
-namespace {
-template <class BuiltinType, Type **Ty>
-struct VISIBILITY_HIDDEN DirectIntRules
- : public TemplateRules<ConstantInt, DirectIntRules<BuiltinType, Ty> > {
-
- static Constant *Add(const ConstantInt *V1, const ConstantInt *V2) {
- BuiltinType R = (BuiltinType)V1->getZExtValue() +
- (BuiltinType)V2->getZExtValue();
- return ConstantInt::get(*Ty, R);
- }
-
- static Constant *Sub(const ConstantInt *V1, const ConstantInt *V2) {
- BuiltinType R = (BuiltinType)V1->getZExtValue() -
- (BuiltinType)V2->getZExtValue();
- return ConstantInt::get(*Ty, R);
- }
-
- static Constant *Mul(const ConstantInt *V1, const ConstantInt *V2) {
- BuiltinType R = (BuiltinType)V1->getZExtValue() *
- (BuiltinType)V2->getZExtValue();
- return ConstantInt::get(*Ty, R);
- }
-
- static Constant *LessThan(const ConstantInt *V1, const ConstantInt *V2) {
- bool R = (BuiltinType)V1->getZExtValue() < (BuiltinType)V2->getZExtValue();
- return ConstantBool::get(R);
- }
-
- static Constant *EqualTo(const ConstantInt *V1, const ConstantInt *V2) {
- bool R = (BuiltinType)V1->getZExtValue() == (BuiltinType)V2->getZExtValue();
- return ConstantBool::get(R);
- }
-
- static Constant *UDiv(const ConstantInt *V1, const ConstantInt *V2) {
- if (V2->isNullValue()) // X / 0
- return 0;
- BuiltinType R = (BuiltinType)(V1->getZExtValue() / V2->getZExtValue());
- return ConstantInt::get(*Ty, R);
- }
-
- static Constant *SDiv(const ConstantInt *V1, const ConstantInt *V2) {
- if (V2->isNullValue()) // X / 0
- return 0;
- if (V2->isAllOnesValue() && // MIN_INT / -1
- (BuiltinType)V1->getSExtValue() == -(BuiltinType)V1->getSExtValue())
- return 0;
- BuiltinType R = (BuiltinType)(V1->getSExtValue() / V2->getSExtValue());
- return ConstantInt::get(*Ty, R);
- }
-
- static Constant *URem(const ConstantInt *V1,
- const ConstantInt *V2) {
- if (V2->isNullValue()) return 0; // X / 0
- BuiltinType R = (BuiltinType)(V1->getZExtValue() % V2->getZExtValue());
- return ConstantInt::get(*Ty, R);
- }
-
- static Constant *SRem(const ConstantInt *V1,
- const ConstantInt *V2) {
- if (V2->isNullValue()) return 0; // X % 0
- if (V2->isAllOnesValue() && // MIN_INT % -1
- (BuiltinType)V1->getSExtValue() == -(BuiltinType)V1->getSExtValue())
- return 0;
- BuiltinType R = (BuiltinType)(V1->getSExtValue() % V2->getSExtValue());
- return ConstantInt::get(*Ty, R);
- }
-
- static Constant *And(const ConstantInt *V1, const ConstantInt *V2) {
- BuiltinType R =
- (BuiltinType)V1->getZExtValue() & (BuiltinType)V2->getZExtValue();
- return ConstantInt::get(*Ty, R);
- }
- static Constant *Or(const ConstantInt *V1, const ConstantInt *V2) {
- BuiltinType R =
- (BuiltinType)V1->getZExtValue() | (BuiltinType)V2->getZExtValue();
- return ConstantInt::get(*Ty, R);
- }
- static Constant *Xor(const ConstantInt *V1, const ConstantInt *V2) {
- BuiltinType R =
- (BuiltinType)V1->getZExtValue() ^ (BuiltinType)V2->getZExtValue();
- return ConstantInt::get(*Ty, R);
- }
-
- static Constant *Shl(const ConstantInt *V1, const ConstantInt *V2) {
- BuiltinType R =
- (BuiltinType)V1->getZExtValue() << (BuiltinType)V2->getZExtValue();
- return ConstantInt::get(*Ty, R);
- }
-
- 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);
- }
-};
-} // end anonymous namespace
-
-
-//===----------------------------------------------------------------------===//
-// DirectFPRules Class
-//===----------------------------------------------------------------------===//
-//
-/// DirectFPRules provides implementations of functions that are valid on
-/// floating point types, but not all types in general.
-///
-namespace {
-template <class BuiltinType, Type **Ty>
-struct VISIBILITY_HIDDEN DirectFPRules
- : public TemplateRules<ConstantFP, DirectFPRules<BuiltinType, Ty> > {
-
- static Constant *Add(const ConstantFP *V1, const ConstantFP *V2) {
- BuiltinType R = (BuiltinType)V1->getValue() +
- (BuiltinType)V2->getValue();
- return ConstantFP::get(*Ty, R);
- }
-
- static Constant *Sub(const ConstantFP *V1, const ConstantFP *V2) {
- BuiltinType R = (BuiltinType)V1->getValue() - (BuiltinType)V2->getValue();
- return ConstantFP::get(*Ty, R);
- }
-
- static Constant *Mul(const ConstantFP *V1, const ConstantFP *V2) {
- BuiltinType R = (BuiltinType)V1->getValue() * (BuiltinType)V2->getValue();
- return ConstantFP::get(*Ty, R);
- }
-
- static Constant *LessThan(const ConstantFP *V1, const ConstantFP *V2) {
- bool R = (BuiltinType)V1->getValue() < (BuiltinType)V2->getValue();
- return ConstantBool::get(R);
- }
-
- static Constant *EqualTo(const ConstantFP *V1, const ConstantFP *V2) {
- bool R = (BuiltinType)V1->getValue() == (BuiltinType)V2->getValue();
- return ConstantBool::get(R);
- }
-
- static Constant *FRem(const ConstantFP *V1, const ConstantFP *V2) {
- if (V2->isNullValue()) return 0;
- BuiltinType Result = std::fmod((BuiltinType)V1->getValue(),
- (BuiltinType)V2->getValue());
- return ConstantFP::get(*Ty, Result);
- }
- static Constant *FDiv(const ConstantFP *V1, const ConstantFP *V2) {
- BuiltinType inf = std::numeric_limits<BuiltinType>::infinity();
- if (V2->isExactlyValue(0.0)) return ConstantFP::get(*Ty, inf);
- if (V2->isExactlyValue(-0.0)) return ConstantFP::get(*Ty, -inf);
- BuiltinType R = (BuiltinType)V1->getValue() / (BuiltinType)V2->getValue();
- return ConstantFP::get(*Ty, R);
- }
-};
-} // end anonymous namespace
-
-static ManagedStatic<EmptyRules> EmptyR;
-static ManagedStatic<BoolRules> BoolR;
-static ManagedStatic<NullPointerRules> NullPointerR;
-static ManagedStatic<ConstantPackedRules> ConstantPackedR;
-static ManagedStatic<GeneralPackedRules> GeneralPackedR;
-static ManagedStatic<DirectIntRules<signed char , &Type::SByteTy> > SByteR;
-static ManagedStatic<DirectIntRules<unsigned char , &Type::UByteTy> > UByteR;
-static ManagedStatic<DirectIntRules<signed short , &Type::ShortTy> > ShortR;
-static ManagedStatic<DirectIntRules<unsigned short, &Type::UShortTy> > UShortR;
-static ManagedStatic<DirectIntRules<signed int , &Type::IntTy> > IntR;
-static ManagedStatic<DirectIntRules<unsigned int , &Type::UIntTy> > UIntR;
-static ManagedStatic<DirectIntRules<int64_t , &Type::LongTy> > LongR;
-static ManagedStatic<DirectIntRules<uint64_t , &Type::ULongTy> > ULongR;
-static ManagedStatic<DirectFPRules <float , &Type::FloatTy> > FloatR;
-static ManagedStatic<DirectFPRules <double , &Type::DoubleTy> > DoubleR;
-
-/// ConstRules::get - This method returns the constant rules implementation that
-/// implements the semantics of the two specified constants.
-ConstRules &ConstRules::get(const Constant *V1, const Constant *V2) {
- if (isa<ConstantExpr>(V1) || isa<ConstantExpr>(V2) ||
- isa<GlobalValue>(V1) || isa<GlobalValue>(V2) ||
- isa<UndefValue>(V1) || isa<UndefValue>(V2))
- return *EmptyR;
-
- switch (V1->getType()->getTypeID()) {
- default: assert(0 && "Unknown value type for constant folding!");
- case Type::BoolTyID: return *BoolR;
- case Type::PointerTyID: return *NullPointerR;
- case Type::SByteTyID: return *SByteR;
- case Type::UByteTyID: return *UByteR;
- case Type::ShortTyID: return *ShortR;
- case Type::UShortTyID: return *UShortR;
- case Type::IntTyID: return *IntR;
- case Type::UIntTyID: return *UIntR;
- case Type::LongTyID: return *LongR;
- case Type::ULongTyID: return *ULongR;
- case Type::FloatTyID: return *FloatR;
- case Type::DoubleTyID: return *DoubleR;
- case Type::PackedTyID:
- if (isa<ConstantPacked>(V1) && isa<ConstantPacked>(V2))
- return *ConstantPackedR;
- return *GeneralPackedR; // Constant folding rules for ConstantAggregateZero.
- }
-}
-
-
//===----------------------------------------------------------------------===//
// ConstantFold*Instruction Implementations
//===----------------------------------------------------------------------===//
return 0;
}
+/// EvalVectorOp - Given two packed constants and a function pointer, apply the
+/// function pointer to each element pair, producing a new ConstantPacked
+/// constant.
+static Constant *EvalVectorOp(const ConstantPacked *V1,
+ const ConstantPacked *V2,
+ Constant *(*FP)(Constant*, Constant*)) {
+ std::vector<Constant*> Res;
+ for (unsigned i = 0, e = V1->getNumOperands(); i != e; ++i)
+ Res.push_back(FP(const_cast<Constant*>(V1->getOperand(i)),
+ const_cast<Constant*>(V2->getOperand(i))));
+ return ConstantPacked::get(Res);
+}
+
+Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode,
+ const Constant *C1,
+ const Constant *C2) {
+ // Handle UndefValue up front
+ if (isa<UndefValue>(C1) || isa<UndefValue>(C2)) {
+ switch (Opcode) {
+ case Instruction::Add:
+ case Instruction::Sub:
+ case Instruction::Xor:
+ return UndefValue::get(C1->getType());
+ case Instruction::Mul:
+ case Instruction::And:
+ return Constant::getNullValue(C1->getType());
+ case Instruction::UDiv:
+ case Instruction::SDiv:
+ case Instruction::FDiv:
+ case Instruction::URem:
+ case Instruction::SRem:
+ case Instruction::FRem:
+ if (!isa<UndefValue>(C2)) // undef / X -> 0
+ return Constant::getNullValue(C1->getType());
+ return const_cast<Constant*>(C2); // X / undef -> undef
+ case Instruction::Or: // X | undef -> -1
+ return ConstantInt::getAllOnesValue(C1->getType());
+ case Instruction::LShr:
+ if (isa<UndefValue>(C2) && isa<UndefValue>(C1))
+ return const_cast<Constant*>(C1); // undef lshr undef -> undef
+ return Constant::getNullValue(C1->getType()); // X lshr undef -> 0
+ // undef lshr X -> 0
+ case Instruction::AShr:
+ if (!isa<UndefValue>(C2))
+ return const_cast<Constant*>(C1); // undef ashr X --> undef
+ else if (isa<UndefValue>(C1))
+ return const_cast<Constant*>(C1); // undef ashr undef -> undef
+ else
+ return const_cast<Constant*>(C1); // X ashr undef --> X
+ case Instruction::Shl:
+ // undef << X -> 0 or X << undef -> 0
+ return Constant::getNullValue(C1->getType());
+ }
+ }
+
+ if (const ConstantExpr *CE1 = dyn_cast<ConstantExpr>(C1)) {
+ if (isa<ConstantExpr>(C2)) {
+ // There are many possible foldings we could do here. We should probably
+ // at least fold add of a pointer with an integer into the appropriate
+ // getelementptr. This will improve alias analysis a bit.
+ } else {
+ // Just implement a couple of simple identities.
+ switch (Opcode) {
+ case Instruction::Add:
+ if (C2->isNullValue()) return const_cast<Constant*>(C1); // X + 0 == X
+ break;
+ case Instruction::Sub:
+ if (C2->isNullValue()) return const_cast<Constant*>(C1); // X - 0 == X
+ break;
+ case Instruction::Mul:
+ if (C2->isNullValue()) return const_cast<Constant*>(C2); // X * 0 == 0
+ if (const ConstantInt *CI = dyn_cast<ConstantInt>(C2))
+ if (CI->getZExtValue() == 1)
+ return const_cast<Constant*>(C1); // X * 1 == X
+ break;
+ case Instruction::UDiv:
+ case Instruction::SDiv:
+ if (const ConstantInt *CI = dyn_cast<ConstantInt>(C2))
+ if (CI->getZExtValue() == 1)
+ return const_cast<Constant*>(C1); // X / 1 == X
+ break;
+ case Instruction::URem:
+ case Instruction::SRem:
+ if (const ConstantInt *CI = dyn_cast<ConstantInt>(C2))
+ if (CI->getZExtValue() == 1)
+ return Constant::getNullValue(CI->getType()); // X % 1 == 0
+ break;
+ case Instruction::And:
+ if (cast<ConstantIntegral>(C2)->isAllOnesValue())
+ return const_cast<Constant*>(C1); // X & -1 == X
+ if (C2->isNullValue()) return const_cast<Constant*>(C2); // X & 0 == 0
+ if (CE1->isCast() && isa<GlobalValue>(CE1->getOperand(0))) {
+ GlobalValue *CPR = cast<GlobalValue>(CE1->getOperand(0));
+
+ // Functions are at least 4-byte aligned. If and'ing the address of a
+ // function with a constant < 4, fold it to zero.
+ if (const ConstantInt *CI = dyn_cast<ConstantInt>(C2))
+ if (CI->getZExtValue() < 4 && isa<Function>(CPR))
+ return Constant::getNullValue(CI->getType());
+ }
+ break;
+ case Instruction::Or:
+ if (C2->isNullValue()) return const_cast<Constant*>(C1); // X | 0 == X
+ if (cast<ConstantIntegral>(C2)->isAllOnesValue())
+ return const_cast<Constant*>(C2); // X | -1 == -1
+ break;
+ case Instruction::Xor:
+ if (C2->isNullValue()) return const_cast<Constant*>(C1); // X ^ 0 == X
+ break;
+ }
+ }
+ } else if (isa<ConstantExpr>(C2)) {
+ // If C2 is a constant expr and C1 isn't, flop them around and fold the
+ // other way if possible.
+ switch (Opcode) {
+ case Instruction::Add:
+ case Instruction::Mul:
+ case Instruction::And:
+ case Instruction::Or:
+ case Instruction::Xor:
+ // No change of opcode required.
+ return ConstantFoldBinaryInstruction(Opcode, C2, C1);
+
+ case Instruction::Shl:
+ case Instruction::LShr:
+ case Instruction::AShr:
+ case Instruction::Sub:
+ case Instruction::SDiv:
+ case Instruction::UDiv:
+ case Instruction::FDiv:
+ case Instruction::URem:
+ case Instruction::SRem:
+ case Instruction::FRem:
+ default: // These instructions cannot be flopped around.
+ return 0;
+ }
+ }
+
+ // At this point we know neither constant is an UndefValue nor a ConstantExpr
+ // so look at directly computing the
+ if (const ConstantBool *CB1 = dyn_cast<ConstantBool>(C1)) {
+ if (const ConstantBool *CB2 = dyn_cast<ConstantBool>(C2)) {
+ switch (Opcode) {
+ default:
+ break;
+ case Instruction::And:
+ return ConstantBool::get(CB1->getValue() & CB2->getValue());
+ case Instruction::Or:
+ return ConstantBool::get(CB1->getValue() | CB2->getValue());
+ case Instruction::Xor:
+ return ConstantBool::get(CB1->getValue() ^ CB2->getValue());
+ }
+ }
+ } else if (const ConstantInt *CI1 = dyn_cast<ConstantInt>(C1)) {
+ if (const ConstantInt *CI2 = dyn_cast<ConstantInt>(C2)) {
+ uint64_t C1Val = CI1->getZExtValue();
+ uint64_t C2Val = CI2->getZExtValue();
+ switch (Opcode) {
+ default:
+ break;
+ case Instruction::Add:
+ return ConstantInt::get(C1->getType(), C1Val + C2Val);
+ case Instruction::Sub:
+ return ConstantInt::get(C1->getType(), C1Val - C2Val);
+ case Instruction::Mul:
+ return ConstantInt::get(C1->getType(), C1Val * C2Val);
+ case Instruction::UDiv:
+ if (CI2->isNullValue()) // X / 0 -> can't fold
+ return 0;
+ return ConstantInt::get(C1->getType(), C1Val / C2Val);
+ case Instruction::SDiv:
+ if (CI2->isNullValue()) return 0; // X / 0 -> can't fold
+ if (CI2->isAllOnesValue() &&
+ (((CI1->getType()->getPrimitiveSizeInBits() == 64) &&
+ (CI1->getSExtValue() == INT64_MIN)) ||
+ (CI1->getSExtValue() == -CI1->getSExtValue())))
+ return 0; // MIN_INT / -1 -> overflow
+ return ConstantInt::get(C1->getType(),
+ CI1->getSExtValue() / CI2->getSExtValue());
+ case Instruction::URem:
+ if (C2->isNullValue()) return 0; // X / 0 -> can't fold
+ return ConstantInt::get(C1->getType(), C1Val % C2Val);
+ case Instruction::SRem:
+ if (CI2->isNullValue()) return 0; // X % 0 -> can't fold
+ if (CI2->isAllOnesValue() &&
+ (((CI1->getType()->getPrimitiveSizeInBits() == 64) &&
+ (CI1->getSExtValue() == INT64_MIN)) ||
+ (CI1->getSExtValue() == -CI1->getSExtValue())))
+ return 0; // MIN_INT % -1 -> overflow
+ return ConstantInt::get(C1->getType(),
+ CI1->getSExtValue() % CI2->getSExtValue());
+ case Instruction::And:
+ return ConstantInt::get(C1->getType(), C1Val & C2Val);
+ case Instruction::Or:
+ return ConstantInt::get(C1->getType(), C1Val | C2Val);
+ case Instruction::Xor:
+ return ConstantInt::get(C1->getType(), C1Val ^ C2Val);
+ case Instruction::Shl:
+ return ConstantInt::get(C1->getType(), C1Val << C2Val);
+ case Instruction::LShr:
+ return ConstantInt::get(C1->getType(), C1Val >> C2Val);
+ case Instruction::AShr:
+ return ConstantInt::get(C1->getType(),
+ CI1->getSExtValue() >> C2Val);
+ }
+ }
+ } else if (const ConstantFP *CFP1 = dyn_cast<ConstantFP>(C1)) {
+ if (const ConstantFP *CFP2 = dyn_cast<ConstantFP>(C2)) {
+ double C1Val = CFP1->getValue();
+ double C2Val = CFP2->getValue();
+ switch (Opcode) {
+ default:
+ break;
+ case Instruction::Add:
+ return ConstantFP::get(CFP1->getType(), C1Val + C2Val);
+ case Instruction::Sub:
+ return ConstantFP::get(CFP1->getType(), C1Val - C2Val);
+ case Instruction::Mul:
+ return ConstantFP::get(CFP1->getType(), C1Val * C2Val);
+ case Instruction::FDiv:
+ if (CFP2->isExactlyValue(0.0))
+ return ConstantFP::get(CFP1->getType(),
+ std::numeric_limits<double>::infinity());
+ if (CFP2->isExactlyValue(-0.0))
+ return ConstantFP::get(CFP1->getType(),
+ -std::numeric_limits<double>::infinity());
+ return ConstantFP::get(CFP1->getType(), C1Val / C2Val);
+ case Instruction::FRem:
+ if (CFP2->isNullValue())
+ return 0;
+ return ConstantFP::get(CFP1->getType(), std::fmod(C1Val, C2Val));
+ }
+ }
+ } else if (const ConstantPacked *CP1 = dyn_cast<ConstantPacked>(C1)) {
+ if (const ConstantPacked *CP2 = dyn_cast<ConstantPacked>(C2)) {
+ switch (Opcode) {
+ default:
+ break;
+ case Instruction::Add:
+ return EvalVectorOp(CP1, CP2, ConstantExpr::getAdd);
+ case Instruction::Sub:
+ return EvalVectorOp(CP1, CP2, ConstantExpr::getSub);
+ case Instruction::Mul:
+ return EvalVectorOp(CP1, CP2, ConstantExpr::getMul);
+ case Instruction::UDiv:
+ return EvalVectorOp(CP1, CP2, ConstantExpr::getUDiv);
+ case Instruction::SDiv:
+ return EvalVectorOp(CP1, CP2, ConstantExpr::getSDiv);
+ case Instruction::FDiv:
+ return EvalVectorOp(CP1, CP2, ConstantExpr::getFDiv);
+ case Instruction::URem:
+ return EvalVectorOp(CP1, CP2, ConstantExpr::getURem);
+ case Instruction::SRem:
+ return EvalVectorOp(CP1, CP2, ConstantExpr::getSRem);
+ case Instruction::FRem:
+ return EvalVectorOp(CP1, CP2, ConstantExpr::getFRem);
+ case Instruction::And:
+ return EvalVectorOp(CP1, CP2, ConstantExpr::getAnd);
+ case Instruction::Or:
+ return EvalVectorOp(CP1, CP2, ConstantExpr::getOr);
+ case Instruction::Xor:
+ return EvalVectorOp(CP1, CP2, ConstantExpr::getXor);
+ }
+ }
+ }
+
+ // We don't know how to fold this
+ return 0;
+}
/// isZeroSizedType - This type is zero sized if its an array or structure of
/// zero sized types. The only leaf zero sized type is an empty structure.
return 1;
}
-/// evaluateRelation - This function determines if there is anything we can
+/// evaluatFCmpeRelation - This function determines if there is anything we can
+/// decide about the two constants provided. This doesn't need to handle simple
+/// things like ConstantFP comparisons, but should instead handle ConstantExprs.
+/// If we can determine that the two constants have a particular relation to
+/// each other, we should return the corresponding FCmpInst predicate,
+/// otherwise return FCmpInst::BAD_FCMP_PREDICATE.
+///
+/// To simplify this code we canonicalize the relation so that the first
+/// operand is always the most "complex" of the two. We consider simple
+/// constants (like ConstantFP) to be the simplest, followed by
+/// GlobalValues, followed by ConstantExpr's (the most complex).
+static FCmpInst::Predicate evaluateFCmpRelation(Constant *V1, Constant *V2) {
+ assert(V1->getType() == V2->getType() &&
+ "Cannot compare different types of values!");
+ if (V1 == V2) return FCmpInst::FCMP_OEQ;
+
+ if (!isa<ConstantExpr>(V1) && !isa<GlobalValue>(V1)) {
+ if (!isa<GlobalValue>(V2) && !isa<ConstantExpr>(V2)) {
+ // We distilled this down to a simple case, use the standard constant
+ // folder.
+ ConstantBool *R = dyn_cast<ConstantBool>(
+ ConstantExpr::getFCmp(FCmpInst::FCMP_OEQ, V1, V2));
+ if (R && R->getValue())
+ return FCmpInst::FCMP_OEQ;
+ R = dyn_cast<ConstantBool>(
+ ConstantExpr::getFCmp(FCmpInst::FCMP_OLT, V1, V2));
+ if (R && R->getValue())
+ return FCmpInst::FCMP_OLT;
+ R = dyn_cast<ConstantBool>(
+ ConstantExpr::getFCmp(FCmpInst::FCMP_OGT, V1, V2));
+ if (R && R->getValue()) return FCmpInst::FCMP_OGT;
+
+ // If we couldn't figure it out, bail.
+ return FCmpInst::BAD_FCMP_PREDICATE;
+ }
+
+ // If the first operand is simple, swap operands.
+ FCmpInst::Predicate SwappedPredicate = evaluateFCmpRelation(V2, V1);
+ if (SwappedPredicate != FCmpInst::BAD_FCMP_PREDICATE)
+ return FCmpInst::getSwappedPredicate(SwappedPredicate);
+
+ return FCmpInst::BAD_FCMP_PREDICATE;
+ }
+
+ // Ok, the LHS is known to be a constantexpr. The RHS can be any of a
+ // constantexpr, a CPR, or a simple constant.
+ // ConstantExpr *CE1 = cast<ConstantExpr>(V1);
+ // Constant *CE1Op0 = CE1->getOperand(0);
+
+ // There are MANY other foldings that we could perform here. They will
+ // probably be added on demand, as they seem needed.
+ return FCmpInst::BAD_FCMP_PREDICATE;
+}
+
+/// evaluateICmpRelation - This function determines if there is anything we can
/// decide about the two constants provided. This doesn't need to handle simple
/// things like integer comparisons, but should instead handle ConstantExprs
/// and GlobalValues. If we can determine that the two constants have a
-/// particular relation to each other, we should return the corresponding SetCC
-/// code, otherwise return Instruction::BinaryOpsEnd.
+/// particular relation to each other, we should return the corresponding ICmp
+/// predicate, otherwise return ICmpInst::BAD_ICMP_PREDICATE.
///
/// To simplify this code we canonicalize the relation so that the first
/// operand is always the most "complex" of the two. We consider simple
/// constants (like ConstantInt) to be the simplest, followed by
/// GlobalValues, followed by ConstantExpr's (the most complex).
///
-static Instruction::BinaryOps evaluateRelation(Constant *V1, Constant *V2) {
+static ICmpInst::Predicate evaluateICmpRelation(Constant *V1, Constant *V2,
+ bool isSigned) {
assert(V1->getType() == V2->getType() &&
"Cannot compare different types of values!");
- if (V1 == V2) return Instruction::SetEQ;
+ if (V1 == V2) return ICmpInst::ICMP_EQ;
if (!isa<ConstantExpr>(V1) && !isa<GlobalValue>(V1)) {
if (!isa<GlobalValue>(V2) && !isa<ConstantExpr>(V2)) {
// We distilled this down to a simple case, use the standard constant
// folder.
- ConstantBool *R = dyn_cast<ConstantBool>(ConstantExpr::getSetEQ(V1, V2));
- if (R && R->getValue()) return Instruction::SetEQ;
- R = dyn_cast<ConstantBool>(ConstantExpr::getSetLT(V1, V2));
- if (R && R->getValue()) return Instruction::SetLT;
- R = dyn_cast<ConstantBool>(ConstantExpr::getSetGT(V1, V2));
- if (R && R->getValue()) return Instruction::SetGT;
+ ICmpInst::Predicate pred = ICmpInst::ICMP_EQ;
+ ConstantBool *R =
+ dyn_cast<ConstantBool>(ConstantExpr::getICmp(pred, V1, V2));
+ if (R && R->getValue())
+ return pred;
+ pred = isSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT;
+ R = dyn_cast<ConstantBool>(ConstantExpr::getICmp(pred, V1, V2));
+ if (R && R->getValue())
+ return pred;
+ pred = isSigned ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT;
+ R = dyn_cast<ConstantBool>(ConstantExpr::getICmp(pred, V1, V2));
+ if (R && R->getValue())
+ return pred;
// If we couldn't figure it out, bail.
- return Instruction::BinaryOpsEnd;
+ return ICmpInst::BAD_ICMP_PREDICATE;
}
// If the first operand is simple, swap operands.
- Instruction::BinaryOps SwappedRelation = evaluateRelation(V2, V1);
- if (SwappedRelation != Instruction::BinaryOpsEnd)
- return SetCondInst::getSwappedCondition(SwappedRelation);
+ ICmpInst::Predicate SwappedRelation =
+ evaluateICmpRelation(V2, V1, isSigned);
+ if (SwappedRelation != ICmpInst::BAD_ICMP_PREDICATE)
+ return ICmpInst::getSwappedPredicate(SwappedRelation);
} else if (const GlobalValue *CPR1 = dyn_cast<GlobalValue>(V1)) {
if (isa<ConstantExpr>(V2)) { // Swap as necessary.
- Instruction::BinaryOps SwappedRelation = evaluateRelation(V2, V1);
- if (SwappedRelation != Instruction::BinaryOpsEnd)
- return SetCondInst::getSwappedCondition(SwappedRelation);
+ ICmpInst::Predicate SwappedRelation =
+ evaluateICmpRelation(V2, V1, isSigned);
+ if (SwappedRelation != ICmpInst::BAD_ICMP_PREDICATE)
+ return ICmpInst::getSwappedPredicate(SwappedRelation);
else
- return Instruction::BinaryOpsEnd;
+ return ICmpInst::BAD_ICMP_PREDICATE;
}
// Now we know that the RHS is a GlobalValue or simple constant,
// which (since the types must match) means that it's a ConstantPointerNull.
if (const GlobalValue *CPR2 = dyn_cast<GlobalValue>(V2)) {
if (!CPR1->hasExternalWeakLinkage() || !CPR2->hasExternalWeakLinkage())
- return Instruction::SetNE;
+ return ICmpInst::ICMP_NE;
} else {
// GlobalVals can never be null.
assert(isa<ConstantPointerNull>(V2) && "Canonicalization guarantee!");
if (!CPR1->hasExternalWeakLinkage())
- return Instruction::SetNE;
+ return ICmpInst::ICMP_NE;
}
} else {
// Ok, the LHS is known to be a constantexpr. The RHS can be any of a
case Instruction::FPExt:
case Instruction::FPToUI:
case Instruction::FPToSI:
- break; // We don't do anything with floating point.
- case Instruction::ZExt:
- case Instruction::SExt:
+ break; // We can't evaluate floating point casts or truncations.
+
case Instruction::UIToFP:
case Instruction::SIToFP:
- case Instruction::PtrToInt:
case Instruction::IntToPtr:
case Instruction::BitCast:
+ case Instruction::ZExt:
+ case Instruction::SExt:
+ case Instruction::PtrToInt:
// If the cast is not actually changing bits, and the second operand is a
// null pointer, do the comparison with the pre-casted value.
if (V2->isNullValue() &&
- (isa<PointerType>(CE1->getType()) || CE1->getType()->isIntegral()))
- return evaluateRelation(CE1Op0,
- Constant::getNullValue(CE1Op0->getType()));
+ (isa<PointerType>(CE1->getType()) || CE1->getType()->isIntegral())) {
+ bool isSigned = CE1->getOpcode() == Instruction::ZExt ? false :
+ (CE1->getOpcode() == Instruction::SExt ? true :
+ (CE1->getOpcode() == Instruction::PtrToInt ? false : isSigned));
+ return evaluateICmpRelation(
+ CE1Op0, Constant::getNullValue(CE1Op0->getType()), isSigned);
+ }
// If the dest type is a pointer type, and the RHS is a constantexpr cast
// from the same type as the src of the LHS, evaluate the inputs. This is
- // important for things like "seteq (cast 4 to int*), (cast 5 to int*)",
+ // important for things like "icmp eq (cast 4 to int*), (cast 5 to int*)",
// which happens a lot in compilers with tagged integers.
if (ConstantExpr *CE2 = dyn_cast<ConstantExpr>(V2))
- if (isa<PointerType>(CE1->getType()) && CE2->isCast() &&
+ if (CE2->isCast() && isa<PointerType>(CE1->getType()) &&
CE1->getOperand(0)->getType() == CE2->getOperand(0)->getType() &&
CE1->getOperand(0)->getType()->isIntegral()) {
- return evaluateRelation(CE1->getOperand(0), CE2->getOperand(0));
+ bool isSigned = CE1->getOpcode() == Instruction::ZExt ? false :
+ (CE1->getOpcode() == Instruction::SExt ? true :
+ (CE1->getOpcode() == Instruction::PtrToInt ? false : isSigned));
+ return evaluateICmpRelation(CE1->getOperand(0), CE2->getOperand(0),
+ isSigned);
}
break;
if (GV->hasExternalWeakLinkage())
// Weak linkage GVals could be zero or not. We're comparing that
// to null pointer so its greater-or-equal
- return Instruction::SetGE;
+ return isSigned ? ICmpInst::ICMP_SGE : ICmpInst::ICMP_UGE;
else
// If its not weak linkage, the GVal must have a non-zero address
// so the result is greater-than
- return Instruction::SetGT;
+ return isSigned ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT;
} else if (isa<ConstantPointerNull>(CE1Op0)) {
// If we are indexing from a null pointer, check to see if we have any
// non-zero indices.
for (unsigned i = 1, e = CE1->getNumOperands(); i != e; ++i)
if (!CE1->getOperand(i)->isNullValue())
// Offsetting from null, must not be equal.
- return Instruction::SetGT;
+ return isSigned ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT;
// Only zero indexes from null, must still be zero.
- return Instruction::SetEQ;
+ return ICmpInst::ICMP_EQ;
}
// Otherwise, we can't really say if the first operand is null or not.
} else if (const GlobalValue *CPR2 = dyn_cast<GlobalValue>(V2)) {
if (CPR2->hasExternalWeakLinkage())
// Weak linkage GVals could be zero or not. We're comparing it to
// a null pointer, so its less-or-equal
- return Instruction::SetLE;
+ return isSigned ? ICmpInst::ICMP_SLE : ICmpInst::ICMP_ULE;
else
// If its not weak linkage, the GVal must have a non-zero address
// so the result is less-than
- return Instruction::SetLT;
+ return isSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT;
} else if (const GlobalValue *CPR1 = dyn_cast<GlobalValue>(CE1Op0)) {
if (CPR1 == CPR2) {
// If this is a getelementptr of the same global, then it must be
assert(CE1->getNumOperands() == 2 &&
!CE1->getOperand(1)->isNullValue() &&
"Suprising getelementptr!");
- return Instruction::SetGT;
+ return isSigned ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT;
} else {
// If they are different globals, we don't know what the value is,
// but they can't be equal.
- return Instruction::SetNE;
+ return ICmpInst::ICMP_NE;
}
}
} else {
// obviously to the same or different globals.
if (isa<GlobalValue>(CE1Op0) && isa<GlobalValue>(CE2Op0)) {
if (CE1Op0 != CE2Op0) // Don't know relative ordering, but not equal
- return Instruction::SetNE;
+ return ICmpInst::ICMP_NE;
// Ok, we know that both getelementptr instructions are based on the
// same global. From this, we can precisely determine the relative
// ordering of the resultant pointers.
++i, ++GTI)
switch (IdxCompare(CE1->getOperand(i), CE2->getOperand(i),
GTI.getIndexedType())) {
- case -1: return Instruction::SetLT;
- case 1: return Instruction::SetGT;
- case -2: return Instruction::BinaryOpsEnd;
+ case -1: return isSigned ? ICmpInst::ICMP_SLT:ICmpInst::ICMP_ULT;
+ case 1: return isSigned ? ICmpInst::ICMP_SGT:ICmpInst::ICMP_UGT;
+ case -2: return ICmpInst::BAD_ICMP_PREDICATE;
}
// Ok, we ran out of things they have in common. If any leftovers
for (; i < CE1->getNumOperands(); ++i)
if (!CE1->getOperand(i)->isNullValue())
if (isa<ConstantIntegral>(CE1->getOperand(i)))
- return Instruction::SetGT;
+ return isSigned ? ICmpInst::ICMP_SGT : ICmpInst::ICMP_UGT;
else
- return Instruction::BinaryOpsEnd; // Might be equal.
+ return ICmpInst::BAD_ICMP_PREDICATE; // Might be equal.
for (; i < CE2->getNumOperands(); ++i)
if (!CE2->getOperand(i)->isNullValue())
if (isa<ConstantIntegral>(CE2->getOperand(i)))
- return Instruction::SetLT;
+ return isSigned ? ICmpInst::ICMP_SLT : ICmpInst::ICMP_ULT;
else
- return Instruction::BinaryOpsEnd; // Might be equal.
- return Instruction::SetEQ;
+ return ICmpInst::BAD_ICMP_PREDICATE; // Might be equal.
+ return ICmpInst::ICMP_EQ;
}
}
}
-
default:
break;
}
}
- return Instruction::BinaryOpsEnd;
+ return ICmpInst::BAD_ICMP_PREDICATE;
}
-Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode,
- const Constant *V1,
- const Constant *V2) {
- Constant *C = 0;
- switch (Opcode) {
- default: break;
- case Instruction::Add: C = ConstRules::get(V1, V2).add(V1, V2); break;
- case Instruction::Sub: C = ConstRules::get(V1, V2).sub(V1, V2); break;
- case Instruction::Mul: C = ConstRules::get(V1, V2).mul(V1, V2); break;
- case Instruction::UDiv: C = ConstRules::get(V1, V2).udiv(V1, V2); break;
- case Instruction::SDiv: C = ConstRules::get(V1, V2).sdiv(V1, V2); break;
- case Instruction::FDiv: C = ConstRules::get(V1, V2).fdiv(V1, V2); break;
- case Instruction::URem: C = ConstRules::get(V1, V2).urem(V1, V2); break;
- case Instruction::SRem: C = ConstRules::get(V1, V2).srem(V1, V2); break;
- case Instruction::FRem: C = ConstRules::get(V1, V2).frem(V1, V2); break;
- case Instruction::And: C = ConstRules::get(V1, V2).op_and(V1, V2); break;
- 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::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:
- // SetEQ(null,GV) -> false
- if (V1->isNullValue()) {
- if (const GlobalValue *GV = dyn_cast<GlobalValue>(V2))
- if (!GV->hasExternalWeakLinkage())
- return ConstantBool::getFalse();
- // SetEQ(GV,null) -> false
- } else if (V2->isNullValue()) {
- if (const GlobalValue *GV = dyn_cast<GlobalValue>(V1))
- if (!GV->hasExternalWeakLinkage())
+Constant *llvm::ConstantFoldCompareInstruction(unsigned short predicate,
+ Constant *C1, Constant *C2) {
+
+ // Handle some degenerate cases first
+ if (isa<UndefValue>(C1) || isa<UndefValue>(C2))
+ return UndefValue::get(Type::BoolTy);
+
+ // icmp eq/ne(null,GV) -> false/true
+ if (C1->isNullValue()) {
+ if (const GlobalValue *GV = dyn_cast<GlobalValue>(C2))
+ if (!GV->hasExternalWeakLinkage()) // External weak GV can be null
+ if (predicate == ICmpInst::ICMP_EQ)
return ConstantBool::getFalse();
- }
- 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;
- case Instruction::SetNE:
- // SetNE(null,GV) -> true
- if (V1->isNullValue()) {
- if (const GlobalValue *GV = dyn_cast<GlobalValue>(V2))
- if (!GV->hasExternalWeakLinkage())
+ else if (predicate == ICmpInst::ICMP_NE)
return ConstantBool::getTrue();
- // SetNE(GV,null) -> true
- } else if (V2->isNullValue()) {
- if (const GlobalValue *GV = dyn_cast<GlobalValue>(V1))
- if (!GV->hasExternalWeakLinkage())
+ // icmp eq/ne(GV,null) -> false/true
+ } else if (C2->isNullValue()) {
+ if (const GlobalValue *GV = dyn_cast<GlobalValue>(C1))
+ if (!GV->hasExternalWeakLinkage()) // External weak GV can be null
+ if (predicate == ICmpInst::ICMP_EQ)
+ return ConstantBool::getFalse();
+ else if (predicate == ICmpInst::ICMP_NE)
return ConstantBool::getTrue();
- }
- // V1 != V2 === !(V1 == V2)
- C = ConstRules::get(V1, V2).equalto(V1, V2);
- if (C) return ConstantExpr::getNot(C);
- break;
- case Instruction::SetLE: // V1 <= V2 === !(V2 < V1)
- C = ConstRules::get(V1, V2).lessthan(V2, V1);
- if (C) return ConstantExpr::getNot(C);
- break;
- case Instruction::SetGE: // V1 >= V2 === !(V1 < V2)
- C = ConstRules::get(V1, V2).lessthan(V1, V2);
- if (C) return ConstantExpr::getNot(C);
- break;
}
- // If we successfully folded the expression, return it now.
- if (C) return C;
-
- if (SetCondInst::isComparison(Opcode)) {
- if (isa<UndefValue>(V1) || isa<UndefValue>(V2))
- return UndefValue::get(Type::BoolTy);
- switch (evaluateRelation(const_cast<Constant*>(V1),
- const_cast<Constant*>(V2))) {
- default: assert(0 && "Unknown relational!");
- case Instruction::BinaryOpsEnd:
- break; // Couldn't determine anything about these constants.
- case Instruction::SetEQ: // We know the constants are equal!
- // If we know the constants are equal, we can decide the result of this
- // computation precisely.
- return ConstantBool::get(Opcode == Instruction::SetEQ ||
- Opcode == Instruction::SetLE ||
- Opcode == Instruction::SetGE);
- case Instruction::SetLT:
- // If we know that V1 < V2, we can decide the result of this computation
- // precisely.
- return ConstantBool::get(Opcode == Instruction::SetLT ||
- Opcode == Instruction::SetNE ||
- Opcode == Instruction::SetLE);
- case Instruction::SetGT:
- // If we know that V1 > V2, we can decide the result of this computation
- // precisely.
- return ConstantBool::get(Opcode == Instruction::SetGT ||
- Opcode == Instruction::SetNE ||
- Opcode == Instruction::SetGE);
- case Instruction::SetLE:
- // If we know that V1 <= V2, we can only partially decide this relation.
- if (Opcode == Instruction::SetGT) return ConstantBool::getFalse();
- if (Opcode == Instruction::SetLT) return ConstantBool::getTrue();
- break;
-
- case Instruction::SetGE:
- // If we know that V1 >= V2, we can only partially decide this relation.
- if (Opcode == Instruction::SetLT) return ConstantBool::getFalse();
- if (Opcode == Instruction::SetGT) return ConstantBool::getTrue();
- break;
-
- case Instruction::SetNE:
- // If we know that V1 != V2, we can only partially decide this relation.
- if (Opcode == Instruction::SetEQ) return ConstantBool::getFalse();
- if (Opcode == Instruction::SetNE) return ConstantBool::getTrue();
- break;
+ if (isa<ConstantBool>(C1) && isa<ConstantBool>(C2)) {
+ bool C1Val = cast<ConstantBool>(C1)->getValue();
+ bool C2Val = cast<ConstantBool>(C2)->getValue();
+ switch (predicate) {
+ default: assert(0 && "Invalid ICmp Predicate"); return 0;
+ case ICmpInst::ICMP_EQ: return ConstantBool::get(C1Val == C2Val);
+ case ICmpInst::ICMP_NE: return ConstantBool::get(C1Val != C2Val);
+ case ICmpInst::ICMP_ULT:return ConstantBool::get(C1Val < C2Val);
+ case ICmpInst::ICMP_UGT:return ConstantBool::get(C1Val > C2Val);
+ case ICmpInst::ICMP_ULE:return ConstantBool::get(C1Val <= C2Val);
+ case ICmpInst::ICMP_UGE:return ConstantBool::get(C1Val >= C2Val);
+ case ICmpInst::ICMP_SLT:return ConstantBool::get(C1Val < C2Val);
+ case ICmpInst::ICMP_SGT:return ConstantBool::get(C1Val > C2Val);
+ case ICmpInst::ICMP_SLE:return ConstantBool::get(C1Val <= C2Val);
+ case ICmpInst::ICMP_SGE:return ConstantBool::get(C1Val >= C2Val);
}
- }
-
- if (isa<UndefValue>(V1) || isa<UndefValue>(V2)) {
- switch (Opcode) {
- case Instruction::Add:
- case Instruction::Sub:
- case Instruction::Xor:
- return UndefValue::get(V1->getType());
-
- case Instruction::Mul:
- case Instruction::And:
- return Constant::getNullValue(V1->getType());
- case Instruction::UDiv:
- case Instruction::SDiv:
- case Instruction::FDiv:
- case Instruction::URem:
- case Instruction::SRem:
- case Instruction::FRem:
- if (!isa<UndefValue>(V2)) // undef / X -> 0
- return Constant::getNullValue(V1->getType());
- return const_cast<Constant*>(V2); // X / undef -> undef
- case Instruction::Or: // X | undef -> -1
- return ConstantInt::getAllOnesValue(V1->getType());
- case Instruction::LShr:
- if (isa<UndefValue>(V2) && isa<UndefValue>(V1))
- return const_cast<Constant*>(V1); // undef lshr undef -> undef
- return Constant::getNullValue(V1->getType()); // X lshr undef -> 0
- // undef lshr X -> 0
- case Instruction::AShr:
- if (!isa<UndefValue>(V2))
- return const_cast<Constant*>(V1); // undef ashr X --> undef
- else if (isa<UndefValue>(V1))
- return const_cast<Constant*>(V1); // undef ashr undef -> undef
- else
- return const_cast<Constant*>(V1); // X ashr undef --> X
- case Instruction::Shl:
- // undef << X -> 0 or X << undef -> 0
- return Constant::getNullValue(V1->getType());
- }
- }
-
- if (const ConstantExpr *CE1 = dyn_cast<ConstantExpr>(V1)) {
- if (isa<ConstantExpr>(V2)) {
- // There are many possible foldings we could do here. We should probably
- // at least fold add of a pointer with an integer into the appropriate
- // getelementptr. This will improve alias analysis a bit.
+ } else if (isa<ConstantInt>(C1) && isa<ConstantInt>(C2)) {
+ if (ICmpInst::isSignedPredicate(ICmpInst::Predicate(predicate))) {
+ int64_t V1 = cast<ConstantInt>(C1)->getSExtValue();
+ int64_t V2 = cast<ConstantInt>(C2)->getSExtValue();
+ switch (predicate) {
+ default: assert(0 && "Invalid ICmp Predicate"); return 0;
+ case ICmpInst::ICMP_SLT:return ConstantBool::get(V1 < V2);
+ case ICmpInst::ICMP_SGT:return ConstantBool::get(V1 > V2);
+ case ICmpInst::ICMP_SLE:return ConstantBool::get(V1 <= V2);
+ case ICmpInst::ICMP_SGE:return ConstantBool::get(V1 >= V2);
+ }
} else {
- // Just implement a couple of simple identities.
- switch (Opcode) {
- case Instruction::Add:
- if (V2->isNullValue()) return const_cast<Constant*>(V1); // X + 0 == X
- break;
- case Instruction::Sub:
- if (V2->isNullValue()) return const_cast<Constant*>(V1); // X - 0 == X
- break;
- case Instruction::Mul:
- if (V2->isNullValue()) return const_cast<Constant*>(V2); // X * 0 == 0
- if (const ConstantInt *CI = dyn_cast<ConstantInt>(V2))
- if (CI->getZExtValue() == 1)
- return const_cast<Constant*>(V1); // X * 1 == X
- break;
- case Instruction::UDiv:
- case Instruction::SDiv:
- if (const ConstantInt *CI = dyn_cast<ConstantInt>(V2))
- if (CI->getZExtValue() == 1)
- return const_cast<Constant*>(V1); // X / 1 == X
- break;
- case Instruction::URem:
- case Instruction::SRem:
- if (const ConstantInt *CI = dyn_cast<ConstantInt>(V2))
- if (CI->getZExtValue() == 1)
- return Constant::getNullValue(CI->getType()); // X % 1 == 0
- break;
- case Instruction::And:
- if (cast<ConstantIntegral>(V2)->isAllOnesValue())
- return const_cast<Constant*>(V1); // X & -1 == X
- if (V2->isNullValue()) return const_cast<Constant*>(V2); // X & 0 == 0
- if (CE1->isCast() && isa<GlobalValue>(CE1->getOperand(0))) {
- GlobalValue *CPR = cast<GlobalValue>(CE1->getOperand(0));
-
- // Functions are at least 4-byte aligned. If and'ing the address of a
- // function with a constant < 4, fold it to zero.
- if (const ConstantInt *CI = dyn_cast<ConstantInt>(V2))
- if (CI->getZExtValue() < 4 && isa<Function>(CPR))
- return Constant::getNullValue(CI->getType());
+ uint64_t V1 = cast<ConstantInt>(C1)->getZExtValue();
+ uint64_t V2 = cast<ConstantInt>(C2)->getZExtValue();
+ switch (predicate) {
+ default: assert(0 && "Invalid ICmp Predicate"); return 0;
+ case ICmpInst::ICMP_EQ: return ConstantBool::get(V1 == V2);
+ case ICmpInst::ICMP_NE: return ConstantBool::get(V1 != V2);
+ case ICmpInst::ICMP_ULT:return ConstantBool::get(V1 < V2);
+ case ICmpInst::ICMP_UGT:return ConstantBool::get(V1 > V2);
+ case ICmpInst::ICMP_ULE:return ConstantBool::get(V1 <= V2);
+ case ICmpInst::ICMP_UGE:return ConstantBool::get(V1 >= V2);
+ }
+ }
+ } else if (isa<ConstantFP>(C1) && isa<ConstantFP>(C2)) {
+ double C1Val = cast<ConstantFP>(C1)->getValue();
+ double C2Val = cast<ConstantFP>(C2)->getValue();
+ switch (predicate) {
+ default: assert(0 && "Invalid FCmp Predicate"); return 0;
+ case FCmpInst::FCMP_FALSE: return ConstantBool::getFalse();
+ case FCmpInst::FCMP_TRUE: return ConstantBool::getTrue();
+ case FCmpInst::FCMP_UNO:
+ case FCmpInst::FCMP_ORD: break; // Can't fold these
+ case FCmpInst::FCMP_UEQ:
+ case FCmpInst::FCMP_OEQ: return ConstantBool::get(C1Val == C2Val);
+ case FCmpInst::FCMP_ONE:
+ case FCmpInst::FCMP_UNE: return ConstantBool::get(C1Val != C2Val);
+ case FCmpInst::FCMP_OLT:
+ case FCmpInst::FCMP_ULT: return ConstantBool::get(C1Val < C2Val);
+ case FCmpInst::FCMP_UGT:
+ case FCmpInst::FCMP_OGT: return ConstantBool::get(C1Val > C2Val);
+ case FCmpInst::FCMP_OLE:
+ case FCmpInst::FCMP_ULE: return ConstantBool::get(C1Val <= C2Val);
+ case FCmpInst::FCMP_UGE:
+ case FCmpInst::FCMP_OGE: return ConstantBool::get(C1Val >= C2Val);
+ }
+ } else if (ConstantPacked *CP1 = dyn_cast<ConstantPacked>(C1)) {
+ if (ConstantPacked *CP2 = dyn_cast<ConstantPacked>(C2)) {
+ if (predicate == FCmpInst::FCMP_OEQ || predicate == FCmpInst::FCMP_UEQ) {
+ for (unsigned i = 0, e = CP1->getNumOperands(); i != e; ++i) {
+ Constant *C= ConstantExpr::getFCmp(FCmpInst::FCMP_OEQ,
+ const_cast<Constant*>(CP1->getOperand(i)),
+ const_cast<Constant*>(CP2->getOperand(i)));
+ if (ConstantBool *CB = dyn_cast<ConstantBool>(C))
+ return CB;
}
- break;
- case Instruction::Or:
- if (V2->isNullValue()) return const_cast<Constant*>(V1); // X | 0 == X
- if (cast<ConstantIntegral>(V2)->isAllOnesValue())
- return const_cast<Constant*>(V2); // X | -1 == -1
- break;
- case Instruction::Xor:
- if (V2->isNullValue()) return const_cast<Constant*>(V1); // X ^ 0 == X
- break;
+ // Otherwise, could not decide from any element pairs.
+ return 0;
+ } else if (predicate == ICmpInst::ICMP_EQ) {
+ for (unsigned i = 0, e = CP1->getNumOperands(); i != e; ++i) {
+ Constant *C = ConstantExpr::getICmp(ICmpInst::ICMP_EQ,
+ const_cast<Constant*>(CP1->getOperand(i)),
+ const_cast<Constant*>(CP2->getOperand(i)));
+ if (ConstantBool *CB = dyn_cast<ConstantBool>(C))
+ return CB;
+ }
+ // Otherwise, could not decide from any element pairs.
+ return 0;
}
}
+ }
- } else if (isa<ConstantExpr>(V2)) {
- // If V2 is a constant expr and V1 isn't, flop them around and fold the
- // other way if possible.
- switch (Opcode) {
- case Instruction::Add:
- case Instruction::Mul:
- case Instruction::And:
- case Instruction::Or:
- case Instruction::Xor:
- case Instruction::SetEQ:
- case Instruction::SetNE:
- // No change of opcode required.
- return ConstantFoldBinaryInstruction(Opcode, V2, V1);
+ // Evaluate the relation between the two constants, per the predicate.
+ switch (evaluateICmpRelation(const_cast<Constant*>(C1),
+ const_cast<Constant*>(C2),
+ CmpInst::isSigned(predicate))) {
+ default: assert(0 && "Unknown relational!");
+ case ICmpInst::BAD_ICMP_PREDICATE:
+ break; // Couldn't determine anything about these constants.
+ case ICmpInst::ICMP_EQ: // We know the constants are equal!
+ // If we know the constants are equal, we can decide the result of this
+ // computation precisely.
+ return ConstantBool::get(predicate == ICmpInst::ICMP_EQ ||
+ predicate == ICmpInst::ICMP_ULE ||
+ predicate == ICmpInst::ICMP_SLE ||
+ predicate == ICmpInst::ICMP_UGE ||
+ predicate == ICmpInst::ICMP_SGE);
+ case ICmpInst::ICMP_ULT:
+ // If we know that C1 < C2, we can decide the result of this computation
+ // precisely.
+ return ConstantBool::get(predicate == ICmpInst::ICMP_ULT ||
+ predicate == ICmpInst::ICMP_NE ||
+ predicate == ICmpInst::ICMP_ULE);
+ case ICmpInst::ICMP_SLT:
+ // If we know that C1 < C2, we can decide the result of this computation
+ // precisely.
+ return ConstantBool::get(predicate == ICmpInst::ICMP_SLT ||
+ predicate == ICmpInst::ICMP_NE ||
+ predicate == ICmpInst::ICMP_SLE);
+ case ICmpInst::ICMP_UGT:
+ // If we know that C1 > C2, we can decide the result of this computation
+ // precisely.
+ return ConstantBool::get(predicate == ICmpInst::ICMP_UGT ||
+ predicate == ICmpInst::ICMP_NE ||
+ predicate == ICmpInst::ICMP_UGE);
+ case ICmpInst::ICMP_SGT:
+ // If we know that C1 > C2, we can decide the result of this computation
+ // precisely.
+ return ConstantBool::get(predicate == ICmpInst::ICMP_SGT ||
+ predicate == ICmpInst::ICMP_NE ||
+ predicate == ICmpInst::ICMP_SGE);
+ case ICmpInst::ICMP_ULE:
+ // If we know that C1 <= C2, we can only partially decide this relation.
+ if (predicate == ICmpInst::ICMP_UGT) return ConstantBool::getFalse();
+ if (predicate == ICmpInst::ICMP_ULT) return ConstantBool::getTrue();
+ break;
+ case ICmpInst::ICMP_SLE:
+ // If we know that C1 <= C2, we can only partially decide this relation.
+ if (predicate == ICmpInst::ICMP_SGT) return ConstantBool::getFalse();
+ if (predicate == ICmpInst::ICMP_SLT) return ConstantBool::getTrue();
+ break;
- case Instruction::SetLT:
- case Instruction::SetGT:
- case Instruction::SetLE:
- case Instruction::SetGE:
- // Change the opcode as necessary to swap the operands.
- Opcode = SetCondInst::getSwappedCondition((Instruction::BinaryOps)Opcode);
- return ConstantFoldBinaryInstruction(Opcode, V2, V1);
+ case ICmpInst::ICMP_UGE:
+ // If we know that C1 >= C2, we can only partially decide this relation.
+ if (predicate == ICmpInst::ICMP_ULT) return ConstantBool::getFalse();
+ if (predicate == ICmpInst::ICMP_UGT) return ConstantBool::getTrue();
+ break;
+ case ICmpInst::ICMP_SGE:
+ // If we know that C1 >= C2, we can only partially decide this relation.
+ if (predicate == ICmpInst::ICMP_SLT) return ConstantBool::getFalse();
+ if (predicate == ICmpInst::ICMP_SGT) return ConstantBool::getTrue();
+ break;
- case Instruction::Shl:
- case Instruction::LShr:
- case Instruction::AShr:
- case Instruction::Sub:
- case Instruction::SDiv:
- case Instruction::UDiv:
- case Instruction::FDiv:
- case Instruction::URem:
- case Instruction::SRem:
- case Instruction::FRem:
- default: // These instructions cannot be flopped around.
+ case ICmpInst::ICMP_NE:
+ // If we know that C1 != C2, we can only partially decide this relation.
+ if (predicate == ICmpInst::ICMP_EQ) return ConstantBool::getFalse();
+ if (predicate == ICmpInst::ICMP_NE) return ConstantBool::getTrue();
+ break;
+ }
+
+ if (!isa<ConstantExpr>(C1) && isa<ConstantExpr>(C2)) {
+ // If C2 is a constant expr and C1 isn't, flop them around and fold the
+ // other way if possible.
+ switch (predicate) {
+ case ICmpInst::ICMP_EQ:
+ case ICmpInst::ICMP_NE:
+ // No change of predicate required.
+ return ConstantFoldCompareInstruction(predicate, C2, C1);
+
+ case ICmpInst::ICMP_ULT:
+ case ICmpInst::ICMP_SLT:
+ case ICmpInst::ICMP_UGT:
+ case ICmpInst::ICMP_SGT:
+ case ICmpInst::ICMP_ULE:
+ case ICmpInst::ICMP_SLE:
+ case ICmpInst::ICMP_UGE:
+ case ICmpInst::ICMP_SGE:
+ // Change the predicate as necessary to swap the operands.
+ predicate = ICmpInst::getSwappedPredicate((ICmpInst::Predicate)predicate);
+ return ConstantFoldCompareInstruction(predicate, C2, C1);
+
+ default: // These predicates cannot be flopped around.
break;
}
}
return 0;
}
-Constant *llvm::ConstantFoldCompare(
- unsigned opcode, Constant *C1, Constant *C2, unsigned short predicate)
-{
- // Place holder for future folding of ICmp and FCmp instructions
- return 0;
-}
-
Constant *llvm::ConstantFoldGetElementPtr(const Constant *C,
const std::vector<Value*> &IdxList) {
if (IdxList.size() == 0 ||
const Constant *Mask);
Constant *ConstantFoldBinaryInstruction(unsigned Opcode, const Constant *V1,
const Constant *V2);
- Constant *ConstantFoldCompare(unsigned opcode, Constant *C1, Constant *C2,
- unsigned short predicate);
+ Constant *ConstantFoldCompareInstruction(unsigned short predicate,
+ Constant *C1, Constant *C2);
Constant *ConstantFoldGetElementPtr(const Constant *C,
const std::vector<Value*> &IdxList);
} // End llvm namespace
const Constant *Mask);
Constant *ConstantFoldBinaryInstruction(unsigned Opcode, const Constant *V1,
const Constant *V2);
- Constant *ConstantFoldCompare(unsigned opcode, Constant *C1, Constant *C2,
- unsigned short predicate);
+ Constant *ConstantFoldCompareInstruction(unsigned short predicate,
+ Constant *C1, Constant *C2);
Constant *ConstantFoldGetElementPtr(const Constant *C,
const std::vector<Value*> &IdxList);
} // End llvm namespace
delete [] OperandList;
}
-static bool isSetCC(unsigned Opcode) {
- return Opcode == Instruction::SetEQ || Opcode == Instruction::SetNE ||
- Opcode == Instruction::SetLT || Opcode == Instruction::SetGT ||
- Opcode == Instruction::SetLE || Opcode == Instruction::SetGE;
-}
-
// We declare several classes private to this file, so use an anonymous
// namespace
namespace {
Use Ops[2];
public:
BinaryConstantExpr(unsigned Opcode, Constant *C1, Constant *C2)
- : ConstantExpr(isSetCC(Opcode) ? Type::BoolTy : C1->getType(),
- Opcode, Ops, 2) {
+ : ConstantExpr(C1->getType(), Opcode, Ops, 2) {
Ops[0].init(C1, this);
Ops[1].init(C2, this);
}
Constant *ConstantExpr::getXor(Constant *C1, Constant *C2) {
return get(Instruction::Xor, C1, C2);
}
-Constant *ConstantExpr::getSetEQ(Constant *C1, Constant *C2) {
- return get(Instruction::SetEQ, C1, C2);
-}
-Constant *ConstantExpr::getSetNE(Constant *C1, Constant *C2) {
- return get(Instruction::SetNE, C1, C2);
-}
-Constant *ConstantExpr::getSetLT(Constant *C1, Constant *C2) {
- return get(Instruction::SetLT, C1, C2);
-}
-Constant *ConstantExpr::getSetGT(Constant *C1, Constant *C2) {
- return get(Instruction::SetGT, C1, C2);
-}
-Constant *ConstantExpr::getSetLE(Constant *C1, Constant *C2) {
- return get(Instruction::SetLE, C1, C2);
-}
-Constant *ConstantExpr::getSetGE(Constant *C1, Constant *C2) {
- return get(Instruction::SetGE, C1, C2);
-}
unsigned ConstantExpr::getPredicate() const {
assert(getOpcode() == Instruction::FCmp || getOpcode() == Instruction::ICmp);
return dynamic_cast<const CompareConstantExpr*>(this)->predicate;
std::vector<Constant*> ActualOps(Ops.begin()+1, Ops.end());
return ConstantExpr::getGetElementPtr(Ops[0], ActualOps);
}
+ case Instruction::ICmp:
+ case Instruction::FCmp:
+ return ConstantExpr::getCompare(getPredicate(), Ops[0], Ops[1]);
default:
assert(getNumOperands() == 2 && "Must be binary operator?");
return ConstantExpr::get(getOpcode(), Ops[0], Ops[1]);
assert(C1->getType() == C2->getType() &&
"Operand types in binary constant expression should match");
- if (ReqTy == C1->getType() || (Instruction::isComparison(Opcode) &&
- ReqTy == Type::BoolTy))
+ if (ReqTy == C1->getType() || ReqTy == Type::BoolTy)
if (Constant *FC = ConstantFoldBinaryInstruction(Opcode, C1, C2))
return FC; // Fold a few common cases...
return ExprConstants->getOrCreate(ReqTy, Key);
}
-Constant *ConstantExpr::getCompareTy(unsigned Opcode, unsigned short predicate,
+Constant *ConstantExpr::getCompareTy(unsigned short predicate,
Constant *C1, Constant *C2) {
- if (Opcode == Instruction::ICmp)
- return getICmp(predicate, C1, C2);
- return getFCmp(predicate, C1, C2);
+ switch (predicate) {
+ default: assert(0 && "Invalid CmpInst predicate");
+ case FCmpInst::FCMP_FALSE: case FCmpInst::FCMP_OEQ: case FCmpInst::FCMP_OGT:
+ case FCmpInst::FCMP_OGE: case FCmpInst::FCMP_OLT: case FCmpInst::FCMP_OLE:
+ case FCmpInst::FCMP_ONE: case FCmpInst::FCMP_ORD: case FCmpInst::FCMP_UNO:
+ case FCmpInst::FCMP_UEQ: case FCmpInst::FCMP_UGT: case FCmpInst::FCMP_UGE:
+ case FCmpInst::FCMP_ULT: case FCmpInst::FCMP_ULE: case FCmpInst::FCMP_UNE:
+ case FCmpInst::FCMP_TRUE:
+ return getFCmp(predicate, C1, C2);
+ case ICmpInst::ICMP_EQ: case ICmpInst::ICMP_NE: case ICmpInst::ICMP_UGT:
+ case ICmpInst::ICMP_UGE: case ICmpInst::ICMP_ULT: case ICmpInst::ICMP_ULE:
+ case ICmpInst::ICMP_SGT: case ICmpInst::ICMP_SGE: case ICmpInst::ICMP_SLT:
+ case ICmpInst::ICMP_SLE:
+ return getICmp(predicate, C1, C2);
+ }
}
Constant *ConstantExpr::get(unsigned Opcode, Constant *C1, Constant *C2) {
assert((C1->getType()->isIntegral() || isa<PackedType>(C1->getType())) &&
"Tried to create a logical operation on a non-integral type!");
break;
- case Instruction::SetLT: case Instruction::SetGT: case Instruction::SetLE:
- case Instruction::SetGE: case Instruction::SetEQ: case Instruction::SetNE:
- assert(C1->getType() == C2->getType() && "Op types should be identical!");
- break;
case Instruction::Shl:
case Instruction::LShr:
case Instruction::AShr:
return getTy(C1->getType(), Opcode, C1, C2);
}
-Constant *ConstantExpr::getCompare(unsigned Opcode, unsigned short pred,
+Constant *ConstantExpr::getCompare(unsigned short pred,
Constant *C1, Constant *C2) {
assert(C1->getType() == C2->getType() && "Op types should be identical!");
- return getCompareTy(Opcode, pred, C1, C2);
+ return getCompareTy(pred, C1, C2);
}
Constant *ConstantExpr::getSelectTy(const Type *ReqTy, Constant *C,
assert(pred >= ICmpInst::FIRST_ICMP_PREDICATE &&
pred <= ICmpInst::LAST_ICMP_PREDICATE && "Invalid ICmp Predicate");
- if (Constant *FC = ConstantFoldCompare(Instruction::ICmp, LHS, RHS, pred))
+ if (Constant *FC = ConstantFoldCompareInstruction(pred, LHS, RHS))
return FC; // Fold a few common cases...
// Look up the constant in the table first to ensure uniqueness
assert(LHS->getType() == RHS->getType());
assert(pred <= FCmpInst::LAST_FCMP_PREDICATE && "Invalid FCmp Predicate");
- if (Constant *FC = ConstantFoldCompare(Instruction::FCmp, LHS, RHS, pred))
+ if (Constant *FC = ConstantFoldCompareInstruction(pred, LHS, RHS))
return FC; // Fold a few common cases...
// Look up the constant in the table first to ensure uniqueness
case Or : return "or";
case Xor: return "xor";
- // SetCC operators...
- case SetLE: return "setle";
- case SetGE: return "setge";
- case SetLT: return "setlt";
- case SetGT: return "setgt";
- case SetEQ: return "seteq";
- case SetNE: return "setne";
-
// Memory instructions...
case Malloc: return "malloc";
case Free: return "free";
return LI->isVolatile() == cast<LoadInst>(I)->isVolatile();
if (const StoreInst *SI = dyn_cast<StoreInst>(this))
return SI->isVolatile() == cast<StoreInst>(I)->isVolatile();
+ if (const CmpInst *CI = dyn_cast<CmpInst>(this))
+ return CI->getPredicate() == cast<CmpInst>(I)->getPredicate();
+ if (const CallInst *CI = dyn_cast<CallInst>(this))
+ return CI->isTailCall() == cast<CallInst>(I)->isTailCall();
+ return true;
+}
+
+// isSameOperationAs
+bool Instruction::isSameOperationAs(Instruction *I) const {
+ if (getOpcode() != I->getOpcode() || getType() != I->getType() ||
+ getNumOperands() != I->getNumOperands())
+ return false;
+
+ // We have two instructions of identical opcode and #operands. Check to see
+ // if all operands are the same type
+ for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
+ if (getOperand(i)->getType() != I->getOperand(i)->getType())
+ return false;
+
+ // Check special state that is a part of some instructions.
+ if (const LoadInst *LI = dyn_cast<LoadInst>(this))
+ return LI->isVolatile() == cast<LoadInst>(I)->isVolatile();
+ if (const StoreInst *SI = dyn_cast<StoreInst>(this))
+ return SI->isVolatile() == cast<StoreInst>(I)->isVolatile();
+ if (const CmpInst *CI = dyn_cast<CmpInst>(this))
+ return CI->getPredicate() == cast<CmpInst>(I)->getPredicate();
if (const CallInst *CI = dyn_cast<CallInst>(this))
return CI->isTailCall() == cast<CallInst>(I)->isTailCall();
+
return true;
}
case And:
case Or:
case Xor:
- case SetEQ:
- case SetNE:
return true;
default:
return false;
}
}
-/// isComparison - Return true if the instruction is a Set* instruction:
-///
-bool Instruction::isComparison(unsigned op) {
- switch (op) {
- case SetEQ:
- case SetNE:
- case SetLT:
- case SetGT:
- case SetLE:
- case SetGE:
- return true;
- }
- return false;
-}
-
-
-
/// isTrappingInstruction - Return true if the instruction may trap.
///
bool Instruction::isTrapping(unsigned op) {
cast<PackedType>(getType())->getElementType()->isIntegral())) &&
"Tried to create a logical operation on a non-integral type!");
break;
- case SetLT: case SetGT: case SetLE:
- case SetGE: case SetEQ: case SetNE:
- assert(getType() == Type::BoolTy && "Setcc must return bool!");
default:
break;
}
Instruction *InsertBefore) {
assert(S1->getType() == S2->getType() &&
"Cannot create binary operator with two operands of differing type!");
- switch (Op) {
- // Binary comparison operators...
- case SetLT: case SetGT: case SetLE:
- case SetGE: case SetEQ: case SetNE:
- return new SetCondInst(Op, S1, S2, Name, InsertBefore);
-
- default:
- return new BinaryOperator(Op, S1, S2, S1->getType(), Name, InsertBefore);
- }
+ return new BinaryOperator(Op, S1, S2, S1->getType(), Name, InsertBefore);
}
BinaryOperator *BinaryOperator::create(BinaryOps Op, Value *S1, Value *S2,
// order dependent (SetLT f.e.) the opcode is changed.
//
bool BinaryOperator::swapOperands() {
- if (isCommutative())
- ; // If the instruction is commutative, it is safe to swap the operands
- else if (SetCondInst *SCI = dyn_cast<SetCondInst>(this))
- /// FIXME: SetCC instructions shouldn't all have different opcodes.
- setOpcode(SCI->getSwappedCondition());
- else
- return true; // Can't commute operands
-
+ if (!isCommutative())
+ return true; // Can't commute operands
std::swap(Ops[0], Ops[1]);
return false;
}
assert(checkCast(getOpcode(), S, Ty) && "Illegal BitCast");
}
-//===----------------------------------------------------------------------===//
-// SetCondInst Class
-//===----------------------------------------------------------------------===//
-
-SetCondInst::SetCondInst(BinaryOps Opcode, Value *S1, Value *S2,
- const std::string &Name, Instruction *InsertBefore)
- : BinaryOperator(Opcode, S1, S2, Type::BoolTy, Name, InsertBefore) {
-
- // Make sure it's a valid type... getInverseCondition will assert out if not.
- assert(getInverseCondition(Opcode));
-}
-
-SetCondInst::SetCondInst(BinaryOps Opcode, Value *S1, Value *S2,
- const std::string &Name, BasicBlock *InsertAtEnd)
- : BinaryOperator(Opcode, S1, S2, Type::BoolTy, Name, InsertAtEnd) {
-
- // Make sure it's a valid type... getInverseCondition will assert out if not.
- assert(getInverseCondition(Opcode));
-}
-
-// getInverseCondition - Return the inverse of the current condition opcode.
-// For example seteq -> setne, setgt -> setle, setlt -> setge, etc...
-//
-Instruction::BinaryOps SetCondInst::getInverseCondition(BinaryOps Opcode) {
- switch (Opcode) {
- default:
- assert(0 && "Unknown setcc opcode!");
- case SetEQ: return SetNE;
- case SetNE: return SetEQ;
- case SetGT: return SetLE;
- case SetLT: return SetGE;
- case SetGE: return SetLT;
- case SetLE: return SetGT;
- }
-}
-
-// getSwappedCondition - Return the condition opcode that would be the result
-// of exchanging the two operands of the setcc instruction without changing
-// the result produced. Thus, seteq->seteq, setle->setge, setlt->setgt, etc.
-//
-Instruction::BinaryOps SetCondInst::getSwappedCondition(BinaryOps Opcode) {
- switch (Opcode) {
- default: assert(0 && "Unknown setcc instruction!");
- case SetEQ: case SetNE: return Opcode;
- case SetGT: return SetLT;
- case SetLT: return SetGT;
- case SetGE: return SetLE;
- case SetLE: return SetGE;
- }
-}
-
-
//===----------------------------------------------------------------------===//
// CmpInst Classes
//===----------------------------------------------------------------------===//
ICmpInst::Predicate ICmpInst::getSwappedPredicate(Predicate pred) {
switch (pred) {
- default: assert(! "Unknown setcc instruction!");
+ default: assert(! "Unknown icmp predicate!");
case ICMP_EQ: case ICMP_NE:
return pred;
case ICMP_SGT: return ICMP_SLT;
}
}
+ICmpInst::Predicate ICmpInst::getSignedPredicate(Predicate pred) {
+ switch (pred) {
+ default: assert(! "Unknown icmp predicate!");
+ case ICMP_EQ: case ICMP_NE:
+ case ICMP_SGT: case ICMP_SLT: case ICMP_SGE: case ICMP_SLE:
+ return pred;
+ case ICMP_UGT: return ICMP_SGT;
+ case ICMP_ULT: return ICMP_SLT;
+ case ICMP_UGE: return ICMP_SGE;
+ case ICMP_ULE: return ICMP_SLE;
+ }
+}
+
+bool ICmpInst::isSignedPredicate(Predicate pred) {
+ switch (pred) {
+ default: assert(! "Unknown icmp predicate!");
+ case ICMP_SGT: case ICMP_SLT: case ICMP_SGE: case ICMP_SLE:
+ return true;
+ case ICMP_EQ: case ICMP_NE: case ICMP_UGT: case ICMP_ULT:
+ case ICMP_UGE: case ICMP_ULE:
+ return false;
+ }
+}
+
FCmpInst::Predicate FCmpInst::getInversePredicate(Predicate pred) {
switch (pred) {
default:
FCmpInst::Predicate FCmpInst::getSwappedPredicate(Predicate pred) {
switch (pred) {
- default: assert(!"Unknown setcc instruction!");
+ default: assert(!"Unknown fcmp predicate!");
case FCMP_FALSE: case FCMP_TRUE:
case FCMP_OEQ: case FCMP_ONE:
case FCMP_UEQ: case FCMP_UNE:
}
}
+bool CmpInst::isUnsigned(unsigned short predicate) {
+ switch (predicate) {
+ default: return false;
+ case ICmpInst::ICMP_ULT: case ICmpInst::ICMP_ULE: case ICmpInst::ICMP_UGT:
+ case ICmpInst::ICMP_UGE: return true;
+ }
+}
+
+bool CmpInst::isSigned(unsigned short predicate){
+ switch (predicate) {
+ default: return false;
+ case ICmpInst::ICMP_SLT: case ICmpInst::ICMP_SLE: case ICmpInst::ICMP_SGT:
+ case ICmpInst::ICMP_SGE: return true;
+ }
+}
+
+bool CmpInst::isOrdered(unsigned short predicate) {
+ switch (predicate) {
+ default: return false;
+ case FCmpInst::FCMP_OEQ: case FCmpInst::FCMP_ONE: case FCmpInst::FCMP_OGT:
+ case FCmpInst::FCMP_OLT: case FCmpInst::FCMP_OGE: case FCmpInst::FCMP_OLE:
+ case FCmpInst::FCMP_ORD: return true;
+ }
+}
+
+bool CmpInst::isUnordered(unsigned short predicate) {
+ switch (predicate) {
+ default: return false;
+ case FCmpInst::FCMP_UEQ: case FCmpInst::FCMP_UNE: case FCmpInst::FCMP_UGT:
+ case FCmpInst::FCMP_ULT: case FCmpInst::FCMP_UGE: case FCmpInst::FCMP_ULE:
+ case FCmpInst::FCMP_UNO: return true;
+ }
+}
+
//===----------------------------------------------------------------------===//
// SwitchInst Implementation
//===----------------------------------------------------------------------===//
}
-// insertEntry - Insert a value into the symbol table with the specified
+// insertEntry - Insert a type into the symbol table with the specified
// name...
//
void SymbolTable::insert(const std::string& Name, const Type* T) {
Assert1(B.getType() == B.getOperand(0)->getType(),
"Logical operators must have same type for operands and result!",
&B);
- } else if (isa<SetCondInst>(B)) {
- // Check that setcc instructions return bool
- Assert1(B.getType() == Type::BoolTy,
- "setcc instructions must return boolean values!", &B);
} else {
// Arithmetic operators only work on integer or fp values
Assert1(B.getType() == B.getOperand(0)->getType(),
LoadInst* cond = cast<LoadInst>( pop_integer(bb) );
// Compare the condition against 0
- SetCondInst* cond_inst = new SetCondInst( Instruction::SetNE, cond,
+ ICmpInst* cond_inst = new ICmpInst( ICmpInst::ICMP_NE, cond,
ConstantInt::get( Type::LongTy, 0) );
bb->getInstList().push_back( cond_inst );
BasicBlock* false_bb = 0;
if ( ifFalse ) false_bb = new BasicBlock((echo?"else":""));
- // Create a branch on the SetCond
+ // Create a branch on the ICmp
BranchInst* br_inst = new BranchInst( true_bb,
( ifFalse ? false_bb : exit_bb ), cond_inst );
bb->getInstList().push_back( br_inst );
LoadInst* cond = cast<LoadInst>( stack_top(test) );
// Compare the condition against 0
- SetCondInst* cond_inst = new SetCondInst(
- Instruction::SetNE, cond, ConstantInt::get( Type::LongTy, 0));
+ ICmpInst* cond_inst = new ICmpInst(
+ ICmpInst::ICMP_NE, cond, ConstantInt::get( Type::LongTy, 0));
test->getInstList().push_back( cond_inst );
// Add the branch instruction
if (echo) bb->setName("LESS");
LoadInst* op1 = cast<LoadInst>(pop_integer(bb));
LoadInst* op2 = cast<LoadInst>(pop_integer(bb));
- SetCondInst* cond_inst =
- new SetCondInst( Instruction::SetLT, op1, op2 );
+ ICmpInst* cond_inst =
+ new ICmpInst( ICmpInst::ICMP_SLT, op1, op2 );
bb->getInstList().push_back( cond_inst );
push_value( bb, cond_inst );
break;
if (echo) bb->setName("MORE");
LoadInst* op1 = cast<LoadInst>(pop_integer(bb));
LoadInst* op2 = cast<LoadInst>(pop_integer(bb));
- SetCondInst* cond_inst =
- new SetCondInst( Instruction::SetGT, op1, op2 );
+ ICmpInst* cond_inst =
+ new ICmpInst( ICmpInst::ICMP_SGT, op1, op2 );
bb->getInstList().push_back( cond_inst );
push_value( bb, cond_inst );
break;
if (echo) bb->setName("LE");
LoadInst* op1 = cast<LoadInst>(pop_integer(bb));
LoadInst* op2 = cast<LoadInst>(pop_integer(bb));
- SetCondInst* cond_inst =
- new SetCondInst( Instruction::SetLE, op1, op2 );
+ ICmpInst* cond_inst =
+ new ICmpInst( ICmpInst::ICMP_SLE, op1, op2 );
bb->getInstList().push_back( cond_inst );
push_value( bb, cond_inst );
break;
if (echo) bb->setName("GE");
LoadInst* op1 = cast<LoadInst>(pop_integer(bb));
LoadInst* op2 = cast<LoadInst>(pop_integer(bb));
- SetCondInst* cond_inst =
- new SetCondInst( Instruction::SetGE, op1, op2 );
+ ICmpInst* cond_inst =
+ new ICmpInst( ICmpInst::ICMP_SGE, op1, op2 );
bb->getInstList().push_back( cond_inst );
push_value( bb, cond_inst );
break;
if (echo) bb->setName("NE");
LoadInst* op1 = cast<LoadInst>(pop_integer(bb));
LoadInst* op2 = cast<LoadInst>(pop_integer(bb));
- SetCondInst* cond_inst =
- new SetCondInst( Instruction::SetNE, op1, op2 );
+ ICmpInst* cond_inst =
+ new ICmpInst( ICmpInst::ICMP_NE, op1, op2 );
bb->getInstList().push_back( cond_inst );
push_value( bb, cond_inst );
break;
if (echo) bb->setName("EQ");
LoadInst* op1 = cast<LoadInst>(pop_integer(bb));
LoadInst* op2 = cast<LoadInst>(pop_integer(bb));
- SetCondInst* cond_inst =
- new SetCondInst( Instruction::SetEQ, op1, op2 );
+ ICmpInst* cond_inst =
+ new ICmpInst( ICmpInst::ICMP_EQ, op1, op2 );
bb->getInstList().push_back( cond_inst );
push_value( bb, cond_inst );
break;
LoadInst* op1 = cast<LoadInst>(stack_top(bb));
// Determine if its negative
- SetCondInst* cond_inst =
- new SetCondInst( Instruction::SetLT, op1, Zero );
+ ICmpInst* cond_inst =
+ new ICmpInst( ICmpInst::ICMP_SLT, op1, Zero );
bb->getInstList().push_back( cond_inst );
// Create a block for storing the result
// Create a block for making it a positive value
BasicBlock* pos_bb = new BasicBlock((echo?"neg":""));
- // Create the branch on the SetCond
+ // Create the branch on the ICmp
BranchInst* br_inst = new BranchInst( pos_bb, exit_bb, cond_inst );
bb->getInstList().push_back( br_inst );
LoadInst* op2 = cast<LoadInst>(pop_integer(bb));
// Compare them
- SetCondInst* cond_inst =
- new SetCondInst( Instruction::SetLT, op1, op2);
+ ICmpInst* cond_inst =
+ new ICmpInst( ICmpInst::ICMP_SLT, op1, op2);
bb->getInstList().push_back( cond_inst );
- // Create a branch on the SetCond
+ // Create a branch on the ICmp
BranchInst* br_inst =
new BranchInst( op1_block, op2_block, cond_inst );
bb->getInstList().push_back( br_inst );
LoadInst* op2 = cast<LoadInst>(pop_integer(bb));
// Compare them
- SetCondInst* cond_inst =
- new SetCondInst( Instruction::SetGT, op1, op2);
+ ICmpInst* cond_inst =
+ new ICmpInst( ICmpInst::ICMP_SGT, op1, op2);
bb->getInstList().push_back( cond_inst );
// Create an exit block
push_value(op2_block, op2);
op2_block->getInstList().push_back( new BranchInst( exit_bb ) );
- // Create a banch on the SetCond
+ // Create a banch on the ICmp
BranchInst* br_inst =
new BranchInst( op1_block, op2_block, cond_inst );
bb->getInstList().push_back( br_inst );
-// RUN: %llvmgcc -O3 -S %s -o - | grep llvm.isunordered &&
-// RUN: %llvmgcc -O3 -S %s -o - | grep xor
+// RUN: %llvmgcc -O3 -S %s -o - | grep 'fcmp ord float %X, %Y'
int test2(float X, float Y) {
return !__builtin_isunordered(X, Y);
; These tests have an infinite trip count. We obviously shouldn't remove the
; loops! :)
;
-; RUN: llvm-upgrade < %s | llvm-as | opt -indvars -adce -simplifycfg | llvm-dis | grep set | wc -l > %t2
-; RUN: llvm-upgrade < %s | llvm-as | llvm-dis | grep set | wc -l > %t1
+; RUN: llvm-upgrade < %s | llvm-as | opt -indvars -adce -simplifycfg | llvm-dis | grep icmp | wc -l > %t2
+; RUN: llvm-upgrade < %s | llvm-as | llvm-dis | grep icmp | wc -l > %t1
; RUN: diff %t1 %t2
int %infinite_linear() { ;; test for (i = 1; i != 100; i += 2)
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep 'setlt'
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis|grep 'icmp slt'
; ModuleID = 'visible.bc'
target datalayout = "e-p:32:32"
target endian = little
--- /dev/null
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
+; RUN: grep -v 'icmp ult int'
+; ModuleID = 'good.bc'
+target datalayout = "e-p:32:32"
+target endian = little
+target pointersize = 32
+target triple = "i686-pc-linux-gnu"
+ %struct.edgeBox = type { short, short, short, short, short, short }
+%qsz = external global int ; <int*> [#uses=12]
+%thresh = external global int ; <int*> [#uses=2]
+%mthresh = external global int ; <int*> [#uses=1]
+
+implementation ; Functions:
+
+int %qsorte(sbyte* %base, int %n, int %size) {
+entry:
+ %tmp = setgt int %n, 1 ; <bool> [#uses=1]
+ br bool %tmp, label %cond_next, label %return
+
+cond_next: ; preds = %entry
+ store int %size, int* %qsz
+ %tmp3 = shl int %size, ubyte 2 ; <int> [#uses=1]
+ store int %tmp3, int* %thresh
+ %tmp4 = load int* %qsz ; <int> [#uses=1]
+ %tmp5 = mul int %tmp4, 6 ; <int> [#uses=1]
+ store int %tmp5, int* %mthresh
+ %tmp6 = load int* %qsz ; <int> [#uses=1]
+ %tmp8 = mul int %tmp6, %n ; <int> [#uses=1]
+ %tmp9 = getelementptr sbyte* %base, int %tmp8 ; <sbyte*> [#uses=3]
+ %tmp11 = setgt int %n, 3 ; <bool> [#uses=1]
+ br bool %tmp11, label %cond_true12, label %bb30
+
+cond_true12: ; preds = %cond_next
+ %tmp156 = call int %qste( sbyte* %base, sbyte* %tmp9 ) ; <int> [#uses=0]
+ %tmp16 = load int* %thresh ; <int> [#uses=1]
+ %tmp18 = getelementptr sbyte* %base, int %tmp16 ; <sbyte*> [#uses=2]
+ %tmp3117 = load int* %qsz ; <int> [#uses=1]
+ %tmp3318 = getelementptr sbyte* %base, int %tmp3117 ; <sbyte*> [#uses=2]
+ %tmp3621 = setlt sbyte* %tmp3318, %tmp18 ; <bool> [#uses=1]
+ br bool %tmp3621, label %bb, label %bb37
+
+bb: ; preds = %bb30, %cond_true12
+ %hi.0.0 = phi sbyte* [ %tmp18, %cond_true12 ], [ %hi.0, %bb30 ] ; <sbyte*> [#uses=4]
+ %j.1.0 = phi sbyte* [ %base, %cond_true12 ], [ %j.1, %bb30 ] ; <sbyte*> [#uses=4]
+ %tmp33.0 = phi sbyte* [ %tmp3318, %cond_true12 ], [ %tmp33, %bb30 ] ; <sbyte*> [#uses=6]
+ %tmp3 = bitcast sbyte* %j.1.0 to %struct.edgeBox* ; <%struct.edgeBox*> [#uses=1]
+ %tmp4 = bitcast sbyte* %tmp33.0 to %struct.edgeBox* ; <%struct.edgeBox*> [#uses=1]
+ %tmp255 = call int %comparee( %struct.edgeBox* %tmp3, %struct.edgeBox* %tmp4 ) ; <int> [#uses=1]
+ %tmp26 = setgt int %tmp255, 0 ; <bool> [#uses=1]
+ br bool %tmp26, label %cond_true27, label %bb30
+
+cond_true27: ; preds = %bb
+ br label %bb30
+
+bb30: ; preds = %cond_true27, %bb, %cond_next
+ %hi.0.3 = phi sbyte* [ %hi.0.0, %cond_true27 ], [ %hi.0.0, %bb ], [ undef, %cond_next ] ; <sbyte*> [#uses=0]
+ %j.1.3 = phi sbyte* [ %j.1.0, %cond_true27 ], [ %j.1.0, %bb ], [ undef, %cond_next ] ; <sbyte*> [#uses=0]
+ %tmp33.3 = phi sbyte* [ %tmp33.0, %cond_true27 ], [ %tmp33.0, %bb ], [ undef, %cond_next ] ; <sbyte*> [#uses=0]
+ %hi.0 = phi sbyte* [ %tmp9, %cond_next ], [ %hi.0.0, %bb ], [ %hi.0.0, %cond_true27 ] ; <sbyte*> [#uses=2]
+ %lo.1 = phi sbyte* [ %tmp33.0, %cond_true27 ], [ %tmp33.0, %bb ], [ %base, %cond_next ] ; <sbyte*> [#uses=1]
+ %j.1 = phi sbyte* [ %tmp33.0, %cond_true27 ], [ %j.1.0, %bb ], [ %base, %cond_next ] ; <sbyte*> [#uses=2]
+ %tmp31 = load int* %qsz ; <int> [#uses=1]
+ %tmp33 = getelementptr sbyte* %lo.1, int %tmp31 ; <sbyte*> [#uses=2]
+ %tmp36 = setlt sbyte* %tmp33, %hi.0 ; <bool> [#uses=1]
+ br bool %tmp36, label %bb, label %bb37
+
+bb37: ; preds = %bb30, %cond_true12
+ %j.1.1 = phi sbyte* [ %j.1, %bb30 ], [ %base, %cond_true12 ] ; <sbyte*> [#uses=4]
+ %tmp40 = seteq sbyte* %j.1.1, %base ; <bool> [#uses=1]
+ br bool %tmp40, label %bb115, label %cond_true41
+
+cond_true41: ; preds = %bb37
+ %tmp43 = load int* %qsz ; <int> [#uses=1]
+ %tmp45 = getelementptr sbyte* %base, int %tmp43 ; <sbyte*> [#uses=2]
+ %tmp6030 = setlt sbyte* %base, %tmp45 ; <bool> [#uses=1]
+ br bool %tmp6030, label %bb46, label %bb115
+
+bb46: ; preds = %bb46, %cond_true41
+ %j.2.0 = phi sbyte* [ %j.1.1, %cond_true41 ], [ %tmp52, %bb46 ] ; <sbyte*> [#uses=3]
+ %i.2.0 = phi sbyte* [ %base, %cond_true41 ], [ %tmp56, %bb46 ] ; <sbyte*> [#uses=3]
+ %tmp = load sbyte* %j.2.0 ; <sbyte> [#uses=2]
+ %tmp49 = load sbyte* %i.2.0 ; <sbyte> [#uses=1]
+ store sbyte %tmp49, sbyte* %j.2.0
+ %tmp52 = getelementptr sbyte* %j.2.0, int 1 ; <sbyte*> [#uses=2]
+ store sbyte %tmp, sbyte* %i.2.0
+ %tmp56 = getelementptr sbyte* %i.2.0, int 1 ; <sbyte*> [#uses=3]
+ %tmp60 = setlt sbyte* %tmp56, %tmp45 ; <bool> [#uses=1]
+ br bool %tmp60, label %bb46, label %bb115
+
+bb66: ; preds = %bb115, %bb66
+ %hi.3 = phi sbyte* [ %tmp118, %bb115 ], [ %tmp70, %bb66 ] ; <sbyte*> [#uses=2]
+ %tmp67 = load int* %qsz ; <int> [#uses=2]
+ %tmp68 = sub int 0, %tmp67 ; <int> [#uses=1]
+ %tmp70 = getelementptr sbyte* %hi.3, int %tmp68 ; <sbyte*> [#uses=2]
+ %tmp = bitcast sbyte* %tmp70 to %struct.edgeBox* ; <%struct.edgeBox*> [#uses=1]
+ %tmp1 = bitcast sbyte* %tmp118 to %struct.edgeBox* ; <%struct.edgeBox*> [#uses=1]
+ %tmp732 = call int %comparee( %struct.edgeBox* %tmp, %struct.edgeBox* %tmp1 ) ; <int> [#uses=1]
+ %tmp74 = setgt int %tmp732, 0 ; <bool> [#uses=1]
+ br bool %tmp74, label %bb66, label %bb75
+
+bb75: ; preds = %bb66
+ %tmp76 = load int* %qsz ; <int> [#uses=1]
+ %tmp70.sum = sub int %tmp76, %tmp67 ; <int> [#uses=1]
+ %tmp78 = getelementptr sbyte* %hi.3, int %tmp70.sum ; <sbyte*> [#uses=3]
+ %tmp81 = seteq sbyte* %tmp78, %tmp118 ; <bool> [#uses=1]
+ br bool %tmp81, label %bb115, label %cond_true82
+
+cond_true82: ; preds = %bb75
+ %tmp83 = load int* %qsz ; <int> [#uses=1]
+ %tmp118.sum = add int %tmp116, %tmp83 ; <int> [#uses=1]
+ %tmp85 = getelementptr sbyte* %min.1, int %tmp118.sum ; <sbyte*> [#uses=1]
+ %tmp10937 = getelementptr sbyte* %tmp85, int -1 ; <sbyte*> [#uses=3]
+ %tmp11239 = setlt sbyte* %tmp10937, %tmp118 ; <bool> [#uses=1]
+ br bool %tmp11239, label %bb115, label %bb86
+
+bb86: ; preds = %bb104, %cond_true82
+ %tmp109.0 = phi sbyte* [ %tmp10937, %cond_true82 ], [ %tmp109, %bb104 ] ; <sbyte*> [#uses=5]
+ %i.5.2 = phi sbyte* [ %i.5.3, %cond_true82 ], [ %i.5.1, %bb104 ] ; <sbyte*> [#uses=0]
+ %tmp100.2 = phi sbyte* [ %tmp100.3, %cond_true82 ], [ %tmp100.1, %bb104 ] ; <sbyte*> [#uses=0]
+ %tmp88 = load sbyte* %tmp109.0 ; <sbyte> [#uses=2]
+ %tmp9746 = load int* %qsz ; <int> [#uses=1]
+ %tmp9847 = sub int 0, %tmp9746 ; <int> [#uses=1]
+ %tmp10048 = getelementptr sbyte* %tmp109.0, int %tmp9847 ; <sbyte*> [#uses=3]
+ %tmp10350 = setlt sbyte* %tmp10048, %tmp78 ; <bool> [#uses=1]
+ br bool %tmp10350, label %bb104, label %bb91
+
+bb91: ; preds = %bb91, %bb86
+ %i.5.0 = phi sbyte* [ %tmp109.0, %bb86 ], [ %tmp100.0, %bb91 ] ; <sbyte*> [#uses=1]
+ %tmp100.0 = phi sbyte* [ %tmp10048, %bb86 ], [ %tmp100, %bb91 ] ; <sbyte*> [#uses=4]
+ %tmp93 = load sbyte* %tmp100.0 ; <sbyte> [#uses=1]
+ store sbyte %tmp93, sbyte* %i.5.0
+ %tmp97 = load int* %qsz ; <int> [#uses=1]
+ %tmp98 = sub int 0, %tmp97 ; <int> [#uses=1]
+ %tmp100 = getelementptr sbyte* %tmp100.0, int %tmp98 ; <sbyte*> [#uses=3]
+ %tmp103 = setlt sbyte* %tmp100, %tmp78 ; <bool> [#uses=1]
+ br bool %tmp103, label %bb104, label %bb91
+
+bb104: ; preds = %bb91, %bb86
+ %i.5.1 = phi sbyte* [ %tmp109.0, %bb86 ], [ %tmp100.0, %bb91 ] ; <sbyte*> [#uses=4]
+ %tmp100.1 = phi sbyte* [ %tmp10048, %bb86 ], [ %tmp100, %bb91 ] ; <sbyte*> [#uses=3]
+ store sbyte %tmp88, sbyte* %i.5.1
+ %tmp109 = getelementptr sbyte* %tmp109.0, int -1 ; <sbyte*> [#uses=3]
+ %tmp112 = setlt sbyte* %tmp109, %tmp118 ; <bool> [#uses=1]
+ br bool %tmp112, label %bb115, label %bb86
+
+bb115: ; preds = %bb104, %cond_true82, %bb75, %bb46, %cond_true41, %bb37
+ %tmp109.1 = phi sbyte* [ undef, %bb37 ], [ %tmp109.1, %bb75 ], [ %tmp10937, %cond_true82 ], [ %tmp109, %bb104 ], [ undef, %bb46 ], [ undef, %cond_true41 ] ; <sbyte*> [#uses=1]
+ %i.5.3 = phi sbyte* [ undef, %bb37 ], [ %i.5.3, %bb75 ], [ %i.5.3, %cond_true82 ], [ %i.5.1, %bb104 ], [ undef, %bb46 ], [ undef, %cond_true41 ] ; <sbyte*> [#uses=3]
+ %tmp100.3 = phi sbyte* [ undef, %bb37 ], [ %tmp100.3, %bb75 ], [ %tmp100.3, %cond_true82 ], [ %tmp100.1, %bb104 ], [ undef, %bb46 ], [ undef, %cond_true41 ] ; <sbyte*> [#uses=3]
+ %min.1 = phi sbyte* [ %tmp118, %bb104 ], [ %tmp118, %bb75 ], [ %base, %bb37 ], [ %base, %bb46 ], [ %base, %cond_true41 ], [ %tmp118, %cond_true82 ] ; <sbyte*> [#uses=2]
+ %j.5 = phi sbyte* [ %tmp100.1, %bb104 ], [ %j.5, %bb75 ], [ %tmp52, %bb46 ], [ %j.1.1, %bb37 ], [ %j.1.1, %cond_true41 ], [ %j.5, %cond_true82 ] ; <sbyte*> [#uses=2]
+ %i.4 = phi sbyte* [ %i.5.1, %bb104 ], [ %i.4, %bb75 ], [ %tmp56, %bb46 ], [ undef, %bb37 ], [ %base, %cond_true41 ], [ %i.4, %cond_true82 ] ; <sbyte*> [#uses=2]
+ %c.4 = phi sbyte [ %tmp88, %bb104 ], [ %c.4, %bb75 ], [ %tmp, %bb46 ], [ undef, %bb37 ], [ undef, %cond_true41 ], [ %c.4, %cond_true82 ] ; <sbyte> [#uses=2]
+ %tmp116 = load int* %qsz ; <int> [#uses=2]
+ %tmp118 = getelementptr sbyte* %min.1, int %tmp116 ; <sbyte*> [#uses=9]
+ %tmp122 = setlt sbyte* %tmp118, %tmp9 ; <bool> [#uses=1]
+ br bool %tmp122, label %bb66, label %return
+
+return: ; preds = %bb115, %entry
+ ret int undef
+}
+
+declare int %qste(sbyte*, sbyte*)
+
+declare int %comparee(%struct.edgeBox*, %struct.edgeBox*)
--- /dev/null
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep 'icmp' | wc -l | grep 1
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep 'icmp ugt' | wc -l | grep 1
+; ModuleID = 'bugpoint-tooptimize.bc'
+target datalayout = "e-p:32:32"
+target endian = little
+target pointersize = 32
+target triple = "i686-pc-linux-gnu"
+%r = external global [17 x int] ; <[17 x int]*> [#uses=1]
+
+implementation ; Functions:
+
+bool %print_pgm_cond_true(int %tmp12.reload, int* %tmp16.out) {
+newFuncRoot:
+ br label %cond_true
+
+bb27.exitStub: ; preds = %cond_true
+ store int %tmp16, int* %tmp16.out
+ ret bool true
+
+cond_next23.exitStub: ; preds = %cond_true
+ store int %tmp16, int* %tmp16.out
+ ret bool false
+
+cond_true: ; preds = %newFuncRoot
+ %tmp15 = getelementptr [17 x int]* %r, int 0, int %tmp12.reload ; <int*> [#uses=1]
+ %tmp16 = load int* %tmp15 ; <int> [#uses=4]
+ %tmp18 = icmp slt int %tmp16, -31 ; <bool> [#uses=1]
+ %tmp21 = icmp sgt int %tmp16, 31 ; <bool> [#uses=1]
+ %bothcond = or bool %tmp18, %tmp21 ; <bool> [#uses=1]
+ br bool %bothcond, label %bb27.exitStub, label %cond_next23.exitStub
+}
+
; This is the sequence of stuff that the Java front-end expands for a single
; <= comparison. Check to make sure we turn it into a <= (only)
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep -v 'setle'| not grep '#uses'
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep -v 'icmp sle'| not grep '#uses'
bool %le(int %A, int %B) {
%c1 = setgt int %A, %B;
ret bool %X
}
-bool %test15(ubyte %A) {
- %c = cast ubyte %A to sbyte
- %X = setlt sbyte %c, 0 ; setgt %A, 127
- ret bool %X
-}
+; This just won't occur when there's no difference between ubyte and sbyte
+;bool %test15(ubyte %A) {
+; %c = cast ubyte %A to sbyte
+; %X = setlt sbyte %c, 0 ; setgt %A, 127
+; ret bool %X
+;}
bool %test16(int* %P) {
%c = cast int* %P to bool ;; setne P, null
; This test makes sure that these instructions are properly eliminated.
;
; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine -disable-output &&
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep set
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep icmp
%X = uninitialized global int
; into equivalent setne,eq instructions.
;
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep -v seteq | grep -v setne | not grep set
+; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep -v 'icmp eq' | grep -v 'icmp ne' | not grep icmp
bool %test1(uint %A) {
%B = setge uint %A, 1 ; setne %A, 0
; having overlapping live ranges that result in copies. We want the setcc instruction
; immediately before the conditional branch.
;
-; RUN: llvm-upgrade < %s | llvm-as | opt -loop-reduce | llvm-dis | %prcontext 'br bool' 1 | grep set
+; RUN: llvm-upgrade < %s | llvm-as | opt -loop-reduce | llvm-dis | %prcontext 'br bool' 1 | grep icmp
void %foo(float* %D, uint %E) {
entry:
--- /dev/null
+; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis
+; ModuleID = 'bugpoint-tooptimize.bc'
+target datalayout = "e-p:32:32"
+target endian = little
+target pointersize = 32
+target triple = "i686-pc-linux-gnu"
+ %struct.FILE = type { int, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, %struct._IO_marker*, %struct.FILE*, int, int, int, ushort, sbyte, [1 x sbyte], sbyte*, long, sbyte*, sbyte*, sbyte*, sbyte*, uint, int, [40 x sbyte] }
+ %struct._IO_FILE = type { int, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, %struct._IO_marker*, %struct.FILE*, int, int, int, ushort, sbyte, [1 x sbyte], sbyte*, long, sbyte*, sbyte*, sbyte*, sbyte*, uint, int, [40 x sbyte] }
+ %struct._IO_marker = type { %struct._IO_marker*, %struct.FILE*, int }
+ %struct.charsequence = type { sbyte*, uint, uint }
+ %struct.trie_s = type { [26 x %struct.trie_s*], int }
+%str = external global [14 x sbyte] ; <[14 x sbyte]*> [#uses=0]
+%str = external global [32 x sbyte] ; <[32 x sbyte]*> [#uses=0]
+%str = external global [12 x sbyte] ; <[12 x sbyte]*> [#uses=0]
+%C.0.2294 = external global %struct.charsequence ; <%struct.charsequence*> [#uses=3]
+%t = external global %struct.trie_s* ; <%struct.trie_s**> [#uses=0]
+%str = external global [3 x sbyte] ; <[3 x sbyte]*> [#uses=0]
+%str = external global [26 x sbyte] ; <[26 x sbyte]*> [#uses=0]
+
+implementation ; Functions:
+
+declare void %charsequence_reset(%struct.charsequence*)
+declare void %free(sbyte*)
+declare void %charsequence_push(%struct.charsequence*, sbyte)
+declare sbyte* %charsequence_val(%struct.charsequence*)
+declare int %_IO_getc(%struct.FILE*)
+declare int %tolower(int)
+declare %struct.trie_s* %trie_insert(%struct.trie_s*, sbyte*)
+declare int %feof(%struct.FILE*)
+
+void %addfile(%struct.trie_s* %t, %struct.FILE* %f) {
+entry:
+ %t_addr = alloca %struct.trie_s* ; <%struct.trie_s**> [#uses=2]
+ %f_addr = alloca %struct.FILE* ; <%struct.FILE**> [#uses=3]
+ %c = alloca sbyte, align 1 ; <sbyte*> [#uses=7]
+ %wstate = alloca int, align 4 ; <int*> [#uses=4]
+ %cs = alloca %struct.charsequence, align 16 ; <%struct.charsequence*> [#uses=7]
+ %str = alloca sbyte*, align 4 ; <sbyte**> [#uses=3]
+ "alloca point" = bitcast int 0 to int ; <int> [#uses=0]
+ store %struct.trie_s* %t, %struct.trie_s** %t_addr
+ store %struct.FILE* %f, %struct.FILE** %f_addr
+ store int 0, int* %wstate
+ %tmp = getelementptr %struct.charsequence* %cs, uint 0, uint 0 ; <sbyte**> [#uses=1]
+ %tmp1 = getelementptr %struct.charsequence* %C.0.2294, uint 0, uint 0 ; <sbyte**> [#uses=1]
+ %tmp = load sbyte** %tmp1 ; <sbyte*> [#uses=1]
+ store sbyte* %tmp, sbyte** %tmp
+ %tmp = getelementptr %struct.charsequence* %cs, uint 0, uint 1 ; <uint*> [#uses=1]
+ %tmp2 = getelementptr %struct.charsequence* %C.0.2294, uint 0, uint 1 ; <uint*> [#uses=1]
+ %tmp = load uint* %tmp2 ; <uint> [#uses=1]
+ store uint %tmp, uint* %tmp
+ %tmp3 = getelementptr %struct.charsequence* %cs, uint 0, uint 2 ; <uint*> [#uses=1]
+ %tmp4 = getelementptr %struct.charsequence* %C.0.2294, uint 0, uint 2 ; <uint*> [#uses=1]
+ %tmp5 = load uint* %tmp4 ; <uint> [#uses=1]
+ store uint %tmp5, uint* %tmp3
+ br label %bb33
+
+bb: ; preds = %bb33
+ %tmp = load %struct.FILE** %f_addr ; <%struct.FILE*> [#uses=1]
+ %tmp = call int %_IO_getc( %struct.FILE* %tmp ) ; <int> [#uses=1]
+ %tmp6 = call int %tolower( int %tmp ) ; <int> [#uses=1]
+ %tmp6 = trunc int %tmp6 to sbyte ; <sbyte> [#uses=1]
+ store sbyte %tmp6, sbyte* %c
+ %tmp7 = load int* %wstate ; <int> [#uses=1]
+ %tmp = icmp ne int %tmp7, 0 ; <bool> [#uses=1]
+ br bool %tmp, label %cond_true, label %cond_false
+
+cond_true: ; preds = %bb
+ %tmp = load sbyte* %c ; <sbyte> [#uses=1]
+ %tmp8 = icmp sle sbyte %tmp, 96 ; <bool> [#uses=1]
+ br bool %tmp8, label %cond_true9, label %cond_next
+
+cond_true9: ; preds = %cond_true
+ br label %bb16
+
+cond_next: ; preds = %cond_true
+ %tmp10 = load sbyte* %c ; <sbyte> [#uses=1]
+ %tmp11 = icmp sgt sbyte %tmp10, 122 ; <bool> [#uses=1]
+ br bool %tmp11, label %cond_true12, label %cond_next13
+
+cond_true12: ; preds = %cond_next
+ br label %bb16
+
+cond_next13: ; preds = %cond_next
+ %tmp14 = load sbyte* %c ; <sbyte> [#uses=1]
+ %tmp14 = sext sbyte %tmp14 to int ; <int> [#uses=1]
+ %tmp1415 = trunc int %tmp14 to sbyte ; <sbyte> [#uses=1]
+ call void %charsequence_push( %struct.charsequence* %cs, sbyte %tmp1415 )
+ br label %bb21
+
+bb16: ; preds = %cond_true12, %cond_true9
+ %tmp17 = call sbyte* %charsequence_val( %struct.charsequence* %cs ) ; <sbyte*> [#uses=1]
+ store sbyte* %tmp17, sbyte** %str
+ %tmp = load %struct.trie_s** %t_addr ; <%struct.trie_s*> [#uses=1]
+ %tmp18 = load sbyte** %str ; <sbyte*> [#uses=1]
+ %tmp19 = call %struct.trie_s* %trie_insert( %struct.trie_s* %tmp, sbyte* %tmp18 ) ; <%struct.trie_s*> [#uses=0]
+ %tmp20 = load sbyte** %str ; <sbyte*> [#uses=1]
+ call void %free( sbyte* %tmp20 )
+ store int 0, int* %wstate
+ br label %bb21
+
+bb21: ; preds = %bb16, %cond_next13
+ br label %cond_next32
+
+cond_false: ; preds = %bb
+ %tmp22 = load sbyte* %c ; <sbyte> [#uses=1]
+ %tmp23 = icmp sgt sbyte %tmp22, 96 ; <bool> [#uses=1]
+ br bool %tmp23, label %cond_true24, label %cond_next31
+
+cond_true24: ; preds = %cond_false
+ %tmp25 = load sbyte* %c ; <sbyte> [#uses=1]
+ %tmp26 = icmp sle sbyte %tmp25, 122 ; <bool> [#uses=1]
+ br bool %tmp26, label %cond_true27, label %cond_next30
+
+cond_true27: ; preds = %cond_true24
+ call void %charsequence_reset( %struct.charsequence* %cs )
+ %tmp28 = load sbyte* %c ; <sbyte> [#uses=1]
+ %tmp28 = sext sbyte %tmp28 to int ; <int> [#uses=1]
+ %tmp2829 = trunc int %tmp28 to sbyte ; <sbyte> [#uses=1]
+ call void %charsequence_push( %struct.charsequence* %cs, sbyte %tmp2829 )
+ store int 1, int* %wstate
+ br label %cond_next30
+
+cond_next30: ; preds = %cond_true27, %cond_true24
+ br label %cond_next31
+
+cond_next31: ; preds = %cond_next30, %cond_false
+ br label %cond_next32
+
+cond_next32: ; preds = %cond_next31, %bb21
+ br label %bb33
+
+bb33: ; preds = %cond_next32, %entry
+ %tmp34 = load %struct.FILE** %f_addr ; <%struct.FILE*> [#uses=1]
+ %tmp35 = call int %feof( %struct.FILE* %tmp34 ) ; <int> [#uses=1]
+ %tmp36 = icmp eq int %tmp35, 0 ; <bool> [#uses=1]
+ br bool %tmp36, label %bb, label %bb37
+
+bb37: ; preds = %bb33
+ br label %return
+
+return: ; preds = %bb37
+ ret void
+}
+
-; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not grep seteq
+; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg | llvm-dis | not grep 'icmp eq'
; Check that simplifycfg deletes a dead 'seteq' instruction when it
; folds a conditional branch into a switch instruction.
// Check to see if we already looked up the value.
Value *CachedVal = new LoadInst(Cache, "fpcache", EntryBB);
- Value *IsNull = new SetCondInst(Instruction::SetEQ, CachedVal,
- NullPtr, "isNull", EntryBB);
+ Value *IsNull = new ICmpInst(ICmpInst::ICMP_EQ, CachedVal,
+ NullPtr, "isNull", EntryBB);
new BranchInst(LookupBB, DoCallBB, IsNull, EntryBB);
// Resolve the call to function F via the JIT API:
/* Copy the first part of user declarations. */
-#line 14 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 14 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
#include "ParserInternals.h"
#include <llvm/ADT/StringExtras.h>
#define YYERROR_VERBOSE 1
#define YYINCLUDED_STDLIB_H
#define YYDEBUG 1
-#define UPGRADE_SETCOND_OPS 0
-#define GENERATE_FCMP_INSTS 0
int yylex(); // declaration" of xxx warnings.
int yyparse();
// the original intent by replace the cast with a setne
const char* comparator = SrcTy.isPointer() ? ", null" :
(SrcTy.isFloatingPoint() ? ", 0.0" : ", 0");
-#if UPGRADE_SETCOND_OPS
- const char* compareOp = SrcTy.isFloatingPoint() ? "setne " : "icmp ne ";
-#else
- const char* compareOp = "setne";
-#endif
+ const char* compareOp = SrcTy.isFloatingPoint() ? "fcmp one " : "icmp ne ";
if (isConst) {
Result = "(" + Source + comparator + ")";
Result = compareOp + Result;
result[6] = cc1;
result[7] = cc2;
if (TI.isFloatingPoint()) {
-#if GENERATE_FCMP_INSTS
result[0] = 'f';
- result[5] = 'o'; // FIXME: Always map to ordered comparison ?
+ result[5] = 'o';
if (cc1 == 'n')
result[5] = 'u'; // NE maps to unordered
else
result[5] = 'o'; // everything else maps to ordered
-#else
- result = setcc;
-#endif
} else if (TI.isIntegral() || TI.isPointer()) {
result[0] = 'i';
if ((cc1 == 'e' && cc2 == 'q') || (cc1 == 'n' && cc2 == 'e'))
#endif
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
-#line 285 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 275 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
typedef union YYSTYPE {
std::string* String;
TypeInfo Type;
ValueList* ValList;
} YYSTYPE;
/* Line 196 of yacc.c. */
-#line 670 "UpgradeParser.tab.c"
+#line 660 "UpgradeParser.tab.c"
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
/* Line 219 of yacc.c. */
-#line 682 "UpgradeParser.tab.c"
+#line 672 "UpgradeParser.tab.c"
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
# define YYSIZE_T __SIZE_TYPE__
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const unsigned short int yyrline[] =
{
- 0, 348, 348, 348, 349, 349, 353, 353, 353, 353,
- 353, 353, 353, 354, 354, 354, 354, 355, 355, 355,
- 356, 356, 356, 356, 356, 356, 357, 357, 357, 357,
- 357, 357, 357, 357, 357, 357, 358, 358, 358, 358,
- 358, 358, 358, 358, 358, 358, 359, 359, 359, 359,
- 359, 359, 360, 360, 360, 360, 361, 361, 361, 361,
- 361, 361, 361, 362, 362, 362, 362, 362, 362, 367,
- 367, 367, 367, 368, 368, 368, 368, 369, 369, 370,
- 370, 373, 376, 381, 381, 381, 381, 381, 381, 382,
- 383, 386, 386, 386, 386, 386, 387, 388, 393, 398,
- 399, 402, 403, 411, 417, 418, 421, 422, 431, 432,
- 445, 445, 446, 446, 447, 451, 451, 451, 451, 451,
- 451, 451, 452, 452, 452, 452, 452, 454, 458, 462,
- 465, 470, 476, 484, 492, 498, 502, 513, 516, 524,
- 525, 530, 533, 543, 549, 554, 560, 566, 572, 577,
- 583, 589, 595, 601, 607, 613, 619, 625, 631, 639,
- 653, 665, 670, 676, 681, 689, 694, 699, 707, 712,
- 717, 727, 732, 737, 737, 747, 752, 755, 760, 764,
- 768, 770, 770, 773, 785, 790, 795, 804, 813, 822,
- 831, 836, 841, 846, 848, 848, 851, 856, 863, 868,
- 875, 882, 887, 888, 896, 896, 897, 897, 899, 906,
- 910, 914, 917, 922, 925, 927, 947, 948, 950, 959,
- 960, 962, 970, 971, 972, 976, 989, 990, 993, 993,
- 993, 993, 993, 993, 993, 994, 995, 1000, 1001, 1010,
- 1010, 1014, 1020, 1031, 1037, 1040, 1048, 1052, 1057, 1060,
- 1066, 1066, 1068, 1073, 1078, 1083, 1091, 1098, 1104, 1124,
- 1129, 1135, 1140, 1148, 1157, 1164, 1172, 1176, 1183, 1184,
- 1188, 1193, 1196, 1202, 1207, 1215, 1220, 1225, 1230, 1238,
- 1252, 1257, 1262, 1267, 1272, 1277, 1282, 1299, 1304, 1305,
- 1309, 1310, 1313, 1320, 1327, 1334, 1341, 1346, 1353, 1360
+ 0, 338, 338, 338, 339, 339, 343, 343, 343, 343,
+ 343, 343, 343, 344, 344, 344, 344, 345, 345, 345,
+ 346, 346, 346, 346, 346, 346, 347, 347, 347, 347,
+ 347, 347, 347, 347, 347, 347, 348, 348, 348, 348,
+ 348, 348, 348, 348, 348, 348, 349, 349, 349, 349,
+ 349, 349, 350, 350, 350, 350, 351, 351, 351, 351,
+ 351, 351, 351, 352, 352, 352, 352, 352, 352, 357,
+ 357, 357, 357, 358, 358, 358, 358, 359, 359, 360,
+ 360, 363, 366, 371, 371, 371, 371, 371, 371, 372,
+ 373, 376, 376, 376, 376, 376, 377, 378, 383, 388,
+ 389, 392, 393, 401, 407, 408, 411, 412, 421, 422,
+ 435, 435, 436, 436, 437, 441, 441, 441, 441, 441,
+ 441, 441, 442, 442, 442, 442, 442, 444, 448, 452,
+ 455, 460, 466, 474, 482, 488, 492, 503, 506, 514,
+ 515, 520, 523, 533, 539, 544, 550, 556, 562, 567,
+ 573, 579, 585, 591, 597, 603, 609, 615, 621, 629,
+ 643, 655, 660, 666, 671, 677, 682, 687, 695, 700,
+ 705, 715, 720, 725, 725, 735, 740, 743, 748, 752,
+ 756, 758, 758, 761, 773, 778, 783, 792, 801, 810,
+ 819, 824, 829, 834, 836, 836, 839, 844, 851, 856,
+ 863, 870, 875, 876, 884, 884, 885, 885, 887, 894,
+ 898, 902, 905, 910, 913, 915, 935, 936, 938, 947,
+ 948, 950, 958, 959, 960, 964, 977, 978, 981, 981,
+ 981, 981, 981, 981, 981, 982, 983, 988, 989, 998,
+ 998, 1002, 1008, 1019, 1025, 1028, 1036, 1040, 1045, 1048,
+ 1054, 1054, 1056, 1061, 1066, 1071, 1079, 1086, 1092, 1112,
+ 1117, 1123, 1128, 1136, 1145, 1152, 1160, 1164, 1171, 1172,
+ 1176, 1181, 1184, 1190, 1195, 1201, 1206, 1211, 1216, 1224,
+ 1238, 1243, 1248, 1253, 1258, 1263, 1268, 1285, 1290, 1291,
+ 1295, 1296, 1299, 1306, 1313, 1320, 1327, 1332, 1339, 1346
};
#endif
switch (yyn)
{
case 81:
-#line 373 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 363 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = (yyvsp[-1].String);
;}
break;
case 82:
-#line 376 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 366 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = new std::string("");
;}
break;
case 90:
-#line 383 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 373 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(""); ;}
break;
case 97:
-#line 388 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 378 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-1].String) += *(yyvsp[0].String);
delete (yyvsp[0].String);
break;
case 98:
-#line 393 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 383 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(""); ;}
break;
case 99:
-#line 398 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 388 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 100:
-#line 399 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 389 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ *(yyvsp[-1].String) += " " + *(yyvsp[0].String); delete (yyvsp[0].String); (yyval.String) = (yyvsp[-1].String); ;}
break;
case 101:
-#line 402 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 392 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 102:
-#line 403 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 393 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyvsp[-1].String)->insert(0, ", ");
*(yyvsp[-1].String) += " " + *(yyvsp[0].String);
break;
case 103:
-#line 411 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 401 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-1].String) += " " + *(yyvsp[0].String);
delete (yyvsp[0].String);
break;
case 104:
-#line 417 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 407 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 106:
-#line 421 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 411 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 107:
-#line 422 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 412 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyvsp[-1].String)->insert(0, ", ");
if (!(yyvsp[0].String)->empty())
break;
case 109:
-#line 432 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 422 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-1].String) += " " + *(yyvsp[0].String);
delete (yyvsp[0].String);
break;
case 127:
-#line 454 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 444 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Type).newTy = (yyvsp[0].String);
(yyval.Type).oldTy = OpaqueTy;
break;
case 128:
-#line 458 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 448 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Type).newTy = (yyvsp[0].String);
(yyval.Type).oldTy = UnresolvedTy;
break;
case 129:
-#line 462 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 452 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Type) = (yyvsp[0].Type);
;}
break;
case 130:
-#line 465 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 455 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Type UpReference
(yyvsp[0].String)->insert(0, "\\");
(yyval.Type).newTy = (yyvsp[0].String);
break;
case 131:
-#line 470 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 460 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Function derived type?
*(yyvsp[-3].Type).newTy += "( " + *(yyvsp[-1].String) + " )";
delete (yyvsp[-1].String);
break;
case 132:
-#line 476 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 466 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Sized array type?
(yyvsp[-3].String)->insert(0,"[ ");
*(yyvsp[-3].String) += " x " + *(yyvsp[-1].Type).newTy + " ]";
break;
case 133:
-#line 484 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 474 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Packed array type?
(yyvsp[-3].String)->insert(0,"< ");
*(yyvsp[-3].String) += " x " + *(yyvsp[-1].Type).newTy + " >";
break;
case 134:
-#line 492 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 482 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Structure type?
(yyvsp[-1].String)->insert(0, "{ ");
*(yyvsp[-1].String) += " }";
break;
case 135:
-#line 498 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 488 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Empty structure type?
(yyval.Type).newTy = new std::string("{}");
(yyval.Type).oldTy = StructTy;
break;
case 136:
-#line 502 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 492 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Pointer type?
*(yyvsp[-1].Type).newTy += '*';
(yyval.Type).elemTy = (yyvsp[-1].Type).oldTy;
break;
case 137:
-#line 513 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 503 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = (yyvsp[0].Type).newTy;
;}
break;
case 138:
-#line 516 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 506 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += ", " + *(yyvsp[0].Type).newTy;
delete (yyvsp[0].Type).newTy;
break;
case 140:
-#line 525 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 515 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += ", ...";
delete (yyvsp[0].String);
break;
case 141:
-#line 530 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 520 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = (yyvsp[0].String);
;}
break;
case 142:
-#line 533 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 523 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = new std::string();
;}
break;
case 143:
-#line 543 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 533 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Nonempty unsized arr
(yyval.Const).type = (yyvsp[-3].Type);
(yyval.Const).cnst = new std::string(*(yyvsp[-3].Type).newTy);
break;
case 144:
-#line 549 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 539 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Const).type = (yyvsp[-2].Type);
(yyval.Const).cnst = new std::string(*(yyvsp[-2].Type).newTy);
break;
case 145:
-#line 554 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 544 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Const).type = (yyvsp[-2].Type);
(yyval.Const).cnst = new std::string(*(yyvsp[-2].Type).newTy);
break;
case 146:
-#line 560 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 550 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Nonempty unsized arr
(yyval.Const).type = (yyvsp[-3].Type);
(yyval.Const).cnst = new std::string(*(yyvsp[-3].Type).newTy);
break;
case 147:
-#line 566 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 556 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Const).type = (yyvsp[-3].Type);
(yyval.Const).cnst = new std::string(*(yyvsp[-3].Type).newTy);
break;
case 148:
-#line 572 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 562 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Const).type = (yyvsp[-2].Type);
(yyval.Const).cnst = new std::string(*(yyvsp[-2].Type).newTy);
break;
case 149:
-#line 577 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 567 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Const).type = (yyvsp[-1].Type);
(yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
break;
case 150:
-#line 583 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 573 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Const).type = (yyvsp[-1].Type);
(yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
break;
case 151:
-#line 589 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 579 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Const).type = (yyvsp[-1].Type);
(yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
break;
case 152:
-#line 595 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 585 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Const).type = (yyvsp[-1].Type);
(yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
break;
case 153:
-#line 601 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 591 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Const).type = (yyvsp[-1].Type);
(yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
break;
case 154:
-#line 607 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 597 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // integral constants
(yyval.Const).type = (yyvsp[-1].Type);
(yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
break;
case 155:
-#line 613 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 603 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // integral constants
(yyval.Const).type = (yyvsp[-1].Type);
(yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
break;
case 156:
-#line 619 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 609 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Boolean constants
(yyval.Const).type = (yyvsp[-1].Type);
(yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
break;
case 157:
-#line 625 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 615 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Boolean constants
(yyval.Const).type = (yyvsp[-1].Type);
(yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
break;
case 158:
-#line 631 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 621 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Float & Double constants
(yyval.Const).type = (yyvsp[-1].Type);
(yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
break;
case 159:
-#line 639 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 629 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
std::string source = *(yyvsp[-3].Const).cnst;
TypeInfo DstTy = (yyvsp[-1].Type);
break;
case 160:
-#line 653 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 643 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-4].String) += "(" + *(yyvsp[-2].Const).cnst;
for (unsigned i = 0; i < (yyvsp[-1].ValList)->size(); ++i) {
break;
case 161:
-#line 665 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 655 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const).cnst + "," + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
(yyvsp[-5].Const).destroy(); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
break;
case 162:
-#line 670 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 660 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
const char* op = getDivRemOpcode(*(yyvsp[-5].String), (yyvsp[-3].Const).type);
(yyval.String) = new std::string(op);
break;
case 163:
-#line 676 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 666 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
(yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
break;
case 164:
-#line 681 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 671 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
-#if UPGRADE_SETCOND_OPS
*(yyvsp[-5].String) = getCompareOp(*(yyvsp[-5].String), (yyvsp[-3].Const).type);
-#endif
*(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
(yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
(yyval.String) = (yyvsp[-5].String);
break;
case 165:
-#line 689 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 677 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-6].String) += "(" + *(yyvsp[-5].String) + "," + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
delete (yyvsp[-5].String); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
break;
case 166:
-#line 694 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 682 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-6].String) += "(" + *(yyvsp[-5].String) + "," + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
delete (yyvsp[-5].String); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
break;
case 167:
-#line 699 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 687 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
const char* shiftop = (yyvsp[-5].String)->c_str();
if (*(yyvsp[-5].String) == "shr")
break;
case 168:
-#line 707 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 695 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
(yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
break;
case 169:
-#line 712 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 700 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const).cnst + "," + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
(yyvsp[-5].Const).destroy(); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
break;
case 170:
-#line 717 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 705 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const).cnst + "," + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
(yyvsp[-5].Const).destroy(); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
break;
case 171:
-#line 727 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 715 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += ", " + *(yyvsp[0].Const).cnst;
(yyvsp[0].Const).destroy();
break;
case 172:
-#line 732 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 720 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(*(yyvsp[0].Const).cnst); (yyvsp[0].Const).destroy(); ;}
break;
case 175:
-#line 747 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 735 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
;}
break;
case 176:
-#line 752 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 740 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = 0;
;}
break;
case 177:
-#line 755 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 743 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << *(yyvsp[0].String) << "\n";
delete (yyvsp[0].String);
break;
case 178:
-#line 760 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 748 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << "module asm " << " " << *(yyvsp[0].String) << "\n";
(yyval.String) = 0;
break;
case 179:
-#line 764 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 752 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << "implementation\n";
(yyval.String) = 0;
break;
case 180:
-#line 768 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 756 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = 0; ;}
break;
case 182:
-#line 770 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 758 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = (yyvsp[0].String); *(yyval.String) = "external"; ;}
break;
case 183:
-#line 773 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 761 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
EnumeratedTypes.push_back((yyvsp[0].Type));
if (!(yyvsp[-2].String)->empty()) {
break;
case 184:
-#line 785 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 773 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Function prototypes can be in const pool
*O << *(yyvsp[0].String) << "\n";
delete (yyvsp[0].String);
break;
case 185:
-#line 790 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 778 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Asm blocks can be in the const pool
*O << *(yyvsp[-2].String) << " " << *(yyvsp[-1].String) << " " << *(yyvsp[0].String) << "\n";
delete (yyvsp[-2].String); delete (yyvsp[-1].String); delete (yyvsp[0].String);
break;
case 186:
-#line 795 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 783 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-4].String)->empty()) {
*O << *(yyvsp[-4].String) << " = ";
break;
case 187:
-#line 804 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 792 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-4].String)->empty()) {
*O << *(yyvsp[-4].String) << " = ";
break;
case 188:
-#line 813 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 801 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-4].String)->empty()) {
*O << *(yyvsp[-4].String) << " = ";
break;
case 189:
-#line 822 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 810 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-4].String)->empty()) {
*O << *(yyvsp[-4].String) << " = ";
break;
case 190:
-#line 831 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 819 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << *(yyvsp[-1].String) << " " << *(yyvsp[0].String) << "\n";
delete (yyvsp[-1].String); delete (yyvsp[0].String);
break;
case 191:
-#line 836 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 824 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << *(yyvsp[-2].String) << " = " << *(yyvsp[0].String) << "\n";
delete (yyvsp[-2].String); delete (yyvsp[0].String);
break;
case 192:
-#line 841 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 829 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = 0;
;}
break;
case 196:
-#line 851 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 839 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
delete (yyvsp[0].String);
break;
case 197:
-#line 856 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 844 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
if (*(yyvsp[0].String) == "64")
break;
case 198:
-#line 863 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 851 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
delete (yyvsp[0].String);
break;
case 199:
-#line 868 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 856 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
delete (yyvsp[0].String);
break;
case 200:
-#line 875 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 863 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyvsp[-1].String)->insert(0, "[ ");
*(yyvsp[-1].String) += " ]";
break;
case 201:
-#line 882 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 870 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += ", " + *(yyvsp[0].String);
delete (yyvsp[0].String);
break;
case 203:
-#line 888 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 876 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = new std::string();
;}
break;
case 207:
-#line 897 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 885 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 208:
-#line 899 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 887 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = (yyvsp[-1].Type).newTy;
if (!(yyvsp[0].String)->empty())
break;
case 209:
-#line 906 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 894 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += ", " + *(yyvsp[0].String);
delete (yyvsp[0].String);
break;
case 210:
-#line 910 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 898 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = (yyvsp[0].String);
;}
break;
case 211:
-#line 914 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 902 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = (yyvsp[0].String);
;}
break;
case 212:
-#line 917 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 905 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += ", ...";
(yyval.String) = (yyvsp[-2].String);
break;
case 213:
-#line 922 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 910 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = (yyvsp[0].String);
;}
break;
case 214:
-#line 925 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 913 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 215:
-#line 928 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 916 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-7].String)->empty()) {
*(yyvsp[-7].String) += " ";
break;
case 216:
-#line 947 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 935 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string("{"); delete (yyvsp[0].String); ;}
break;
case 217:
-#line 948 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 936 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string ("{"); ;}
break;
case 218:
-#line 950 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 938 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-2].String)->empty()) {
*O << *(yyvsp[-2].String) << " ";
break;
case 219:
-#line 959 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 947 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string("}"); delete (yyvsp[0].String); ;}
break;
case 220:
-#line 960 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 948 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string("}"); ;}
break;
case 221:
-#line 962 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 950 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if ((yyvsp[-1].String))
*O << *(yyvsp[-1].String);
break;
case 222:
-#line 970 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 958 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 225:
-#line 976 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 964 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-1].String)->empty())
*(yyvsp[-2].String) += " " + *(yyvsp[-1].String);
break;
case 226:
-#line 989 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 977 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 236:
-#line 995 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 983 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyvsp[-1].String)->insert(0, "<");
*(yyvsp[-1].String) += ">";
break;
case 238:
-#line 1001 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 989 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-3].String)->empty()) {
*(yyvsp[-4].String) += " " + *(yyvsp[-3].String);
break;
case 241:
-#line 1014 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1002 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Value).val = (yyvsp[0].String);
(yyval.Value).constant = false;
break;
case 242:
-#line 1020 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1008 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Value).val = (yyvsp[0].String);
(yyval.Value).constant = true;
break;
case 243:
-#line 1031 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1019 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Value) = (yyvsp[0].Value);
(yyval.Value).type = (yyvsp[-1].Type);
break;
case 244:
-#line 1037 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1025 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = 0;
;}
break;
case 245:
-#line 1040 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1028 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Do not allow functions with 0 basic blocks
(yyval.String) = 0;
;}
break;
case 246:
-#line 1048 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1036 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = 0;
;}
break;
case 247:
-#line 1052 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1040 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << " " << *(yyvsp[0].String) << "\n";
delete (yyvsp[0].String);
break;
case 248:
-#line 1057 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1045 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = 0;
;}
break;
case 249:
-#line 1060 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1048 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << *(yyvsp[0].String) << "\n";
delete (yyvsp[0].String);
break;
case 251:
-#line 1066 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1054 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = (yyvsp[0].String); *(yyval.String) = "unwind"; ;}
break;
case 252:
-#line 1068 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1056 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Return with a result...
*O << " " << *(yyvsp[-1].String) << " " << *(yyvsp[0].Value).val << "\n";
delete (yyvsp[-1].String); (yyvsp[0].Value).destroy();
break;
case 253:
-#line 1073 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1061 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Return with no result...
*O << " " << *(yyvsp[-1].String) << " " << *(yyvsp[0].Type).newTy << "\n";
delete (yyvsp[-1].String); (yyvsp[0].Type).destroy();
break;
case 254:
-#line 1078 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1066 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Unconditional Branch...
*O << " " << *(yyvsp[-2].String) << " " << *(yyvsp[-1].Type).newTy << " " << *(yyvsp[0].Value).val << "\n";
delete (yyvsp[-2].String); (yyvsp[-1].Type).destroy(); (yyvsp[0].Value).destroy();
break;
case 255:
-#line 1083 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1071 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << " " << *(yyvsp[-8].String) << " " << *(yyvsp[-7].Type).newTy << " " << *(yyvsp[-6].Value).val << ", "
<< *(yyvsp[-4].Type).newTy << " " << *(yyvsp[-3].Value).val << ", " << *(yyvsp[-1].Type).newTy << " "
break;
case 256:
-#line 1091 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1079 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << " " << *(yyvsp[-8].String) << " " << *(yyvsp[-7].Type).newTy << " " << *(yyvsp[-6].Value).val << ", "
<< *(yyvsp[-4].Type).newTy << " " << *(yyvsp[-3].Value).val << " [" << *(yyvsp[-1].String) << " ]\n";
break;
case 257:
-#line 1098 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1086 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << " " << *(yyvsp[-7].String) << " " << *(yyvsp[-6].Type).newTy << " " << *(yyvsp[-5].Value).val << ", "
<< *(yyvsp[-3].Type).newTy << " " << *(yyvsp[-2].Value).val << "[]\n";
break;
case 258:
-#line 1105 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1093 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << " ";
if (!(yyvsp[-13].String)->empty())
break;
case 259:
-#line 1124 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1112 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << " " << *(yyvsp[0].String) << "\n";
delete (yyvsp[0].String);
break;
case 260:
-#line 1129 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1117 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << " " << *(yyvsp[0].String) << "\n";
delete (yyvsp[0].String);
break;
case 261:
-#line 1135 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1123 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-5].String) += " " + *(yyvsp[-4].Type).newTy + " " + *(yyvsp[-3].String) + ", " + *(yyvsp[-1].Type).newTy + " " + *(yyvsp[0].Value).val;
(yyvsp[-4].Type).destroy(); delete (yyvsp[-3].String); (yyvsp[-1].Type).destroy(); (yyvsp[0].Value).destroy();
break;
case 262:
-#line 1140 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1128 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyvsp[-3].String)->insert(0, *(yyvsp[-4].Type).newTy + " " );
*(yyvsp[-3].String) += ", " + *(yyvsp[-1].Type).newTy + " " + *(yyvsp[0].Value).val;
break;
case 263:
-#line 1148 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1136 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-1].String)->empty())
*(yyvsp[-1].String) += " = ";
break;
case 264:
-#line 1157 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1145 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Used for PHI nodes
(yyvsp[-3].Value).val->insert(0, *(yyvsp[-5].Type).newTy + "[");
*(yyvsp[-3].Value).val += "," + *(yyvsp[-1].Value).val + "]";
break;
case 265:
-#line 1164 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1152 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-6].String) += ", [" + *(yyvsp[-3].Value).val + "," + *(yyvsp[-1].Value).val + "]";
(yyvsp[-3].Value).destroy(); (yyvsp[-1].Value).destroy();
break;
case 266:
-#line 1172 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1160 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.ValList) = new ValueList();
(yyval.ValList)->push_back((yyvsp[0].Value));
break;
case 267:
-#line 1176 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1164 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyvsp[-2].ValList)->push_back((yyvsp[0].Value));
(yyval.ValList) = (yyvsp[-2].ValList);
break;
case 268:
-#line 1183 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1171 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.ValList) = (yyvsp[0].ValList); ;}
break;
case 269:
-#line 1184 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1172 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.ValList) = new ValueList(); ;}
break;
case 270:
-#line 1188 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1176 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-1].String) += " " + *(yyvsp[0].String);
delete (yyvsp[0].String);
break;
case 272:
-#line 1196 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1184 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
const char* op = getDivRemOpcode(*(yyvsp[-4].String), (yyvsp[-3].Type));
(yyval.String) = new std::string(op);
break;
case 273:
-#line 1202 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1190 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-4].String) += " " + *(yyvsp[-3].Type).newTy + " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
(yyvsp[-3].Type).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
break;
case 274:
-#line 1207 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1195 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
-#if UPGRADE_SETCOND_OPS
*(yyvsp[-4].String) = getCompareOp(*(yyvsp[-4].String), (yyvsp[-3].Type));
-#endif
*(yyvsp[-4].String) += " " + *(yyvsp[-3].Type).newTy + " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
(yyvsp[-3].Type).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
(yyval.String) = (yyvsp[-4].String);
break;
case 275:
-#line 1215 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1201 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-6].String) += " " + *(yyvsp[-5].String) + " " + *(yyvsp[-3].Value).val + "," + *(yyvsp[-1].Value).val + ")";
delete (yyvsp[-5].String); (yyvsp[-3].Value).destroy(); (yyvsp[-1].Value).destroy();
break;
case 276:
-#line 1220 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1206 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-6].String) += " " + *(yyvsp[-5].String) + " " + *(yyvsp[-3].Value).val + "," + *(yyvsp[-1].Value).val + ")";
delete (yyvsp[-5].String); (yyvsp[-3].Value).destroy(); (yyvsp[-1].Value).destroy();
break;
case 277:
-#line 1225 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1211 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-1].String) += " " + *(yyvsp[0].Value).val;
(yyvsp[0].Value).destroy();
break;
case 278:
-#line 1230 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1216 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
const char* shiftop = (yyvsp[-3].String)->c_str();
if (*(yyvsp[-3].String) == "shr")
break;
case 279:
-#line 1238 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1224 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
std::string source = *(yyvsp[-2].Value).val;
TypeInfo SrcTy = (yyvsp[-2].Value).type;
break;
case 280:
-#line 1252 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1238 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-5].String) += " " + *(yyvsp[-4].Value).val + ", " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
(yyvsp[-4].Value).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
break;
case 281:
-#line 1257 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1243 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-3].String) += " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Type).newTy;
(yyvsp[-2].Value).destroy(); (yyvsp[0].Type).destroy();
break;
case 282:
-#line 1262 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1248 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-3].String) += " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
(yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
break;
case 283:
-#line 1267 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1253 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-5].String) += " " + *(yyvsp[-4].Value).val + ", " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
(yyvsp[-4].Value).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
break;
case 284:
-#line 1272 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1258 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-5].String) += " " + *(yyvsp[-4].Value).val + ", " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
(yyvsp[-4].Value).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
break;
case 285:
-#line 1277 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1263 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-1].String) += " " + *(yyvsp[0].String);
delete (yyvsp[0].String);
break;
case 286:
-#line 1282 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1268 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-5].String)->empty())
*(yyvsp[-6].String) += " " + *(yyvsp[-5].String);
break;
case 288:
-#line 1304 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1290 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.ValList) = (yyvsp[0].ValList); ;}
break;
case 289:
-#line 1305 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1291 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.ValList) = new ValueList(); ;}
break;
case 291:
-#line 1310 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1296 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 292:
-#line 1313 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1299 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += " " + *(yyvsp[-1].Type).newTy;
if (!(yyvsp[0].String)->empty())
break;
case 293:
-#line 1320 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1306 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-5].String) += " " + *(yyvsp[-4].Type).newTy + ", " + *(yyvsp[-2].Type).newTy + " " + *(yyvsp[-1].Value).val;
if (!(yyvsp[0].String)->empty())
break;
case 294:
-#line 1327 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1313 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += " " + *(yyvsp[-1].Type).newTy;
if (!(yyvsp[0].String)->empty())
break;
case 295:
-#line 1334 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1320 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-5].String) += " " + *(yyvsp[-4].Type).newTy + ", " + *(yyvsp[-2].Type).newTy + " " + *(yyvsp[-1].Value).val;
if (!(yyvsp[0].String)->empty())
break;
case 296:
-#line 1341 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1327 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-1].String) += " " + *(yyvsp[0].Value).val;
(yyvsp[0].Value).destroy();
break;
case 297:
-#line 1346 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1332 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-3].String)->empty())
*(yyvsp[-3].String) += " ";
break;
case 298:
-#line 1353 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1339 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-5].String)->empty())
*(yyvsp[-5].String) += " ";
break;
case 299:
-#line 1360 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1346 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
// Upgrade the indices
for (unsigned i = 0; i < (yyvsp[0].ValList)->size(); ++i) {
}
/* Line 1126 of yacc.c. */
-#line 3882 "UpgradeParser.tab.c"
+#line 3868 "UpgradeParser.tab.c"
\f
yyvsp -= yylen;
yyssp -= yylen;
}
-#line 1384 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1370 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
int yyerror(const char *ErrorMsg) {
/* Copy the first part of user declarations. */
-#line 14 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 14 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
#include "ParserInternals.h"
#include <llvm/ADT/StringExtras.h>
#define YYERROR_VERBOSE 1
#define YYINCLUDED_STDLIB_H
#define YYDEBUG 1
-#define UPGRADE_SETCOND_OPS 0
-#define GENERATE_FCMP_INSTS 0
int yylex(); // declaration" of xxx warnings.
int yyparse();
// the original intent by replace the cast with a setne
const char* comparator = SrcTy.isPointer() ? ", null" :
(SrcTy.isFloatingPoint() ? ", 0.0" : ", 0");
-#if UPGRADE_SETCOND_OPS
- const char* compareOp = SrcTy.isFloatingPoint() ? "setne " : "icmp ne ";
-#else
- const char* compareOp = "setne";
-#endif
+ const char* compareOp = SrcTy.isFloatingPoint() ? "fcmp one " : "icmp ne ";
if (isConst) {
Result = "(" + Source + comparator + ")";
Result = compareOp + Result;
result[6] = cc1;
result[7] = cc2;
if (TI.isFloatingPoint()) {
-#if GENERATE_FCMP_INSTS
result[0] = 'f';
- result[5] = 'o'; // FIXME: Always map to ordered comparison ?
+ result[5] = 'o';
if (cc1 == 'n')
result[5] = 'u'; // NE maps to unordered
else
result[5] = 'o'; // everything else maps to ordered
-#else
- result = setcc;
-#endif
} else if (TI.isIntegral() || TI.isPointer()) {
result[0] = 'i';
if ((cc1 == 'e' && cc2 == 'q') || (cc1 == 'n' && cc2 == 'e'))
#endif
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
-#line 285 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 275 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
typedef union YYSTYPE {
std::string* String;
TypeInfo Type;
ValueList* ValList;
} YYSTYPE;
/* Line 196 of yacc.c. */
-#line 670 "UpgradeParser.tab.c"
+#line 660 "UpgradeParser.tab.c"
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
/* Line 219 of yacc.c. */
-#line 682 "UpgradeParser.tab.c"
+#line 672 "UpgradeParser.tab.c"
#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
# define YYSIZE_T __SIZE_TYPE__
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const unsigned short int yyrline[] =
{
- 0, 348, 348, 348, 349, 349, 353, 353, 353, 353,
- 353, 353, 353, 354, 354, 354, 354, 355, 355, 355,
- 356, 356, 356, 356, 356, 356, 357, 357, 357, 357,
- 357, 357, 357, 357, 357, 357, 358, 358, 358, 358,
- 358, 358, 358, 358, 358, 358, 359, 359, 359, 359,
- 359, 359, 360, 360, 360, 360, 361, 361, 361, 361,
- 361, 361, 361, 362, 362, 362, 362, 362, 362, 367,
- 367, 367, 367, 368, 368, 368, 368, 369, 369, 370,
- 370, 373, 376, 381, 381, 381, 381, 381, 381, 382,
- 383, 386, 386, 386, 386, 386, 387, 388, 393, 398,
- 399, 402, 403, 411, 417, 418, 421, 422, 431, 432,
- 445, 445, 446, 446, 447, 451, 451, 451, 451, 451,
- 451, 451, 452, 452, 452, 452, 452, 454, 458, 462,
- 465, 470, 476, 484, 492, 498, 502, 513, 516, 524,
- 525, 530, 533, 543, 549, 554, 560, 566, 572, 577,
- 583, 589, 595, 601, 607, 613, 619, 625, 631, 639,
- 653, 665, 670, 676, 681, 689, 694, 699, 707, 712,
- 717, 727, 732, 737, 737, 747, 752, 755, 760, 764,
- 768, 770, 770, 773, 785, 790, 795, 804, 813, 822,
- 831, 836, 841, 846, 848, 848, 851, 856, 863, 868,
- 875, 882, 887, 888, 896, 896, 897, 897, 899, 906,
- 910, 914, 917, 922, 925, 927, 947, 948, 950, 959,
- 960, 962, 970, 971, 972, 976, 989, 990, 993, 993,
- 993, 993, 993, 993, 993, 994, 995, 1000, 1001, 1010,
- 1010, 1014, 1020, 1031, 1037, 1040, 1048, 1052, 1057, 1060,
- 1066, 1066, 1068, 1073, 1078, 1083, 1091, 1098, 1104, 1124,
- 1129, 1135, 1140, 1148, 1157, 1164, 1172, 1176, 1183, 1184,
- 1188, 1193, 1196, 1202, 1207, 1215, 1220, 1225, 1230, 1238,
- 1252, 1257, 1262, 1267, 1272, 1277, 1282, 1299, 1304, 1305,
- 1309, 1310, 1313, 1320, 1327, 1334, 1341, 1346, 1353, 1360
+ 0, 338, 338, 338, 339, 339, 343, 343, 343, 343,
+ 343, 343, 343, 344, 344, 344, 344, 345, 345, 345,
+ 346, 346, 346, 346, 346, 346, 347, 347, 347, 347,
+ 347, 347, 347, 347, 347, 347, 348, 348, 348, 348,
+ 348, 348, 348, 348, 348, 348, 349, 349, 349, 349,
+ 349, 349, 350, 350, 350, 350, 351, 351, 351, 351,
+ 351, 351, 351, 352, 352, 352, 352, 352, 352, 357,
+ 357, 357, 357, 358, 358, 358, 358, 359, 359, 360,
+ 360, 363, 366, 371, 371, 371, 371, 371, 371, 372,
+ 373, 376, 376, 376, 376, 376, 377, 378, 383, 388,
+ 389, 392, 393, 401, 407, 408, 411, 412, 421, 422,
+ 435, 435, 436, 436, 437, 441, 441, 441, 441, 441,
+ 441, 441, 442, 442, 442, 442, 442, 444, 448, 452,
+ 455, 460, 466, 474, 482, 488, 492, 503, 506, 514,
+ 515, 520, 523, 533, 539, 544, 550, 556, 562, 567,
+ 573, 579, 585, 591, 597, 603, 609, 615, 621, 629,
+ 643, 655, 660, 666, 671, 677, 682, 687, 695, 700,
+ 705, 715, 720, 725, 725, 735, 740, 743, 748, 752,
+ 756, 758, 758, 761, 773, 778, 783, 792, 801, 810,
+ 819, 824, 829, 834, 836, 836, 839, 844, 851, 856,
+ 863, 870, 875, 876, 884, 884, 885, 885, 887, 894,
+ 898, 902, 905, 910, 913, 915, 935, 936, 938, 947,
+ 948, 950, 958, 959, 960, 964, 977, 978, 981, 981,
+ 981, 981, 981, 981, 981, 982, 983, 988, 989, 998,
+ 998, 1002, 1008, 1019, 1025, 1028, 1036, 1040, 1045, 1048,
+ 1054, 1054, 1056, 1061, 1066, 1071, 1079, 1086, 1092, 1112,
+ 1117, 1123, 1128, 1136, 1145, 1152, 1160, 1164, 1171, 1172,
+ 1176, 1181, 1184, 1190, 1195, 1201, 1206, 1211, 1216, 1224,
+ 1238, 1243, 1248, 1253, 1258, 1263, 1268, 1285, 1290, 1291,
+ 1295, 1296, 1299, 1306, 1313, 1320, 1327, 1332, 1339, 1346
};
#endif
switch (yyn)
{
case 81:
-#line 373 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 363 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = (yyvsp[-1].String);
;}
break;
case 82:
-#line 376 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 366 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = new std::string("");
;}
break;
case 90:
-#line 383 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 373 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(""); ;}
break;
case 97:
-#line 388 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 378 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-1].String) += *(yyvsp[0].String);
delete (yyvsp[0].String);
break;
case 98:
-#line 393 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 383 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(""); ;}
break;
case 99:
-#line 398 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 388 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 100:
-#line 399 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 389 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ *(yyvsp[-1].String) += " " + *(yyvsp[0].String); delete (yyvsp[0].String); (yyval.String) = (yyvsp[-1].String); ;}
break;
case 101:
-#line 402 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 392 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 102:
-#line 403 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 393 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyvsp[-1].String)->insert(0, ", ");
*(yyvsp[-1].String) += " " + *(yyvsp[0].String);
break;
case 103:
-#line 411 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 401 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-1].String) += " " + *(yyvsp[0].String);
delete (yyvsp[0].String);
break;
case 104:
-#line 417 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 407 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 106:
-#line 421 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 411 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 107:
-#line 422 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 412 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyvsp[-1].String)->insert(0, ", ");
if (!(yyvsp[0].String)->empty())
break;
case 109:
-#line 432 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 422 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-1].String) += " " + *(yyvsp[0].String);
delete (yyvsp[0].String);
break;
case 127:
-#line 454 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 444 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Type).newTy = (yyvsp[0].String);
(yyval.Type).oldTy = OpaqueTy;
break;
case 128:
-#line 458 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 448 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Type).newTy = (yyvsp[0].String);
(yyval.Type).oldTy = UnresolvedTy;
break;
case 129:
-#line 462 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 452 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Type) = (yyvsp[0].Type);
;}
break;
case 130:
-#line 465 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 455 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Type UpReference
(yyvsp[0].String)->insert(0, "\\");
(yyval.Type).newTy = (yyvsp[0].String);
break;
case 131:
-#line 470 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 460 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Function derived type?
*(yyvsp[-3].Type).newTy += "( " + *(yyvsp[-1].String) + " )";
delete (yyvsp[-1].String);
break;
case 132:
-#line 476 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 466 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Sized array type?
(yyvsp[-3].String)->insert(0,"[ ");
*(yyvsp[-3].String) += " x " + *(yyvsp[-1].Type).newTy + " ]";
break;
case 133:
-#line 484 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 474 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Packed array type?
(yyvsp[-3].String)->insert(0,"< ");
*(yyvsp[-3].String) += " x " + *(yyvsp[-1].Type).newTy + " >";
break;
case 134:
-#line 492 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 482 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Structure type?
(yyvsp[-1].String)->insert(0, "{ ");
*(yyvsp[-1].String) += " }";
break;
case 135:
-#line 498 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 488 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Empty structure type?
(yyval.Type).newTy = new std::string("{}");
(yyval.Type).oldTy = StructTy;
break;
case 136:
-#line 502 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 492 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Pointer type?
*(yyvsp[-1].Type).newTy += '*';
(yyval.Type).elemTy = (yyvsp[-1].Type).oldTy;
break;
case 137:
-#line 513 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 503 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = (yyvsp[0].Type).newTy;
;}
break;
case 138:
-#line 516 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 506 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += ", " + *(yyvsp[0].Type).newTy;
delete (yyvsp[0].Type).newTy;
break;
case 140:
-#line 525 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 515 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += ", ...";
delete (yyvsp[0].String);
break;
case 141:
-#line 530 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 520 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = (yyvsp[0].String);
;}
break;
case 142:
-#line 533 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 523 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = new std::string();
;}
break;
case 143:
-#line 543 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 533 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Nonempty unsized arr
(yyval.Const).type = (yyvsp[-3].Type);
(yyval.Const).cnst = new std::string(*(yyvsp[-3].Type).newTy);
break;
case 144:
-#line 549 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 539 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Const).type = (yyvsp[-2].Type);
(yyval.Const).cnst = new std::string(*(yyvsp[-2].Type).newTy);
break;
case 145:
-#line 554 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 544 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Const).type = (yyvsp[-2].Type);
(yyval.Const).cnst = new std::string(*(yyvsp[-2].Type).newTy);
break;
case 146:
-#line 560 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 550 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Nonempty unsized arr
(yyval.Const).type = (yyvsp[-3].Type);
(yyval.Const).cnst = new std::string(*(yyvsp[-3].Type).newTy);
break;
case 147:
-#line 566 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 556 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Const).type = (yyvsp[-3].Type);
(yyval.Const).cnst = new std::string(*(yyvsp[-3].Type).newTy);
break;
case 148:
-#line 572 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 562 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Const).type = (yyvsp[-2].Type);
(yyval.Const).cnst = new std::string(*(yyvsp[-2].Type).newTy);
break;
case 149:
-#line 577 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 567 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Const).type = (yyvsp[-1].Type);
(yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
break;
case 150:
-#line 583 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 573 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Const).type = (yyvsp[-1].Type);
(yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
break;
case 151:
-#line 589 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 579 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Const).type = (yyvsp[-1].Type);
(yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
break;
case 152:
-#line 595 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 585 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Const).type = (yyvsp[-1].Type);
(yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
break;
case 153:
-#line 601 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 591 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Const).type = (yyvsp[-1].Type);
(yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
break;
case 154:
-#line 607 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 597 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // integral constants
(yyval.Const).type = (yyvsp[-1].Type);
(yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
break;
case 155:
-#line 613 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 603 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // integral constants
(yyval.Const).type = (yyvsp[-1].Type);
(yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
break;
case 156:
-#line 619 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 609 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Boolean constants
(yyval.Const).type = (yyvsp[-1].Type);
(yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
break;
case 157:
-#line 625 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 615 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Boolean constants
(yyval.Const).type = (yyvsp[-1].Type);
(yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
break;
case 158:
-#line 631 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 621 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Float & Double constants
(yyval.Const).type = (yyvsp[-1].Type);
(yyval.Const).cnst = new std::string(*(yyvsp[-1].Type).newTy);
break;
case 159:
-#line 639 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 629 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
std::string source = *(yyvsp[-3].Const).cnst;
TypeInfo DstTy = (yyvsp[-1].Type);
break;
case 160:
-#line 653 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 643 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-4].String) += "(" + *(yyvsp[-2].Const).cnst;
for (unsigned i = 0; i < (yyvsp[-1].ValList)->size(); ++i) {
break;
case 161:
-#line 665 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 655 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const).cnst + "," + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
(yyvsp[-5].Const).destroy(); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
break;
case 162:
-#line 670 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 660 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
const char* op = getDivRemOpcode(*(yyvsp[-5].String), (yyvsp[-3].Const).type);
(yyval.String) = new std::string(op);
break;
case 163:
-#line 676 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 666 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
(yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
break;
case 164:
-#line 681 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 671 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
-#if UPGRADE_SETCOND_OPS
*(yyvsp[-5].String) = getCompareOp(*(yyvsp[-5].String), (yyvsp[-3].Const).type);
-#endif
*(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
(yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
(yyval.String) = (yyvsp[-5].String);
break;
case 165:
-#line 689 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 677 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-6].String) += "(" + *(yyvsp[-5].String) + "," + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
delete (yyvsp[-5].String); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
break;
case 166:
-#line 694 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 682 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-6].String) += "(" + *(yyvsp[-5].String) + "," + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
delete (yyvsp[-5].String); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
break;
case 167:
-#line 699 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 687 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
const char* shiftop = (yyvsp[-5].String)->c_str();
if (*(yyvsp[-5].String) == "shr")
break;
case 168:
-#line 707 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 695 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-5].String) += "(" + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
(yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
break;
case 169:
-#line 712 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 700 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const).cnst + "," + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
(yyvsp[-5].Const).destroy(); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
break;
case 170:
-#line 717 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 705 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-7].String) += "(" + *(yyvsp[-5].Const).cnst + "," + *(yyvsp[-3].Const).cnst + "," + *(yyvsp[-1].Const).cnst + ")";
(yyvsp[-5].Const).destroy(); (yyvsp[-3].Const).destroy(); (yyvsp[-1].Const).destroy();
break;
case 171:
-#line 727 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 715 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += ", " + *(yyvsp[0].Const).cnst;
(yyvsp[0].Const).destroy();
break;
case 172:
-#line 732 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 720 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(*(yyvsp[0].Const).cnst); (yyvsp[0].Const).destroy(); ;}
break;
case 175:
-#line 747 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 735 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
;}
break;
case 176:
-#line 752 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 740 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = 0;
;}
break;
case 177:
-#line 755 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 743 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << *(yyvsp[0].String) << "\n";
delete (yyvsp[0].String);
break;
case 178:
-#line 760 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 748 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << "module asm " << " " << *(yyvsp[0].String) << "\n";
(yyval.String) = 0;
break;
case 179:
-#line 764 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 752 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << "implementation\n";
(yyval.String) = 0;
break;
case 180:
-#line 768 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 756 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = 0; ;}
break;
case 182:
-#line 770 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 758 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = (yyvsp[0].String); *(yyval.String) = "external"; ;}
break;
case 183:
-#line 773 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 761 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
EnumeratedTypes.push_back((yyvsp[0].Type));
if (!(yyvsp[-2].String)->empty()) {
break;
case 184:
-#line 785 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 773 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Function prototypes can be in const pool
*O << *(yyvsp[0].String) << "\n";
delete (yyvsp[0].String);
break;
case 185:
-#line 790 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 778 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Asm blocks can be in the const pool
*O << *(yyvsp[-2].String) << " " << *(yyvsp[-1].String) << " " << *(yyvsp[0].String) << "\n";
delete (yyvsp[-2].String); delete (yyvsp[-1].String); delete (yyvsp[0].String);
break;
case 186:
-#line 795 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 783 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-4].String)->empty()) {
*O << *(yyvsp[-4].String) << " = ";
break;
case 187:
-#line 804 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 792 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-4].String)->empty()) {
*O << *(yyvsp[-4].String) << " = ";
break;
case 188:
-#line 813 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 801 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-4].String)->empty()) {
*O << *(yyvsp[-4].String) << " = ";
break;
case 189:
-#line 822 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 810 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-4].String)->empty()) {
*O << *(yyvsp[-4].String) << " = ";
break;
case 190:
-#line 831 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 819 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << *(yyvsp[-1].String) << " " << *(yyvsp[0].String) << "\n";
delete (yyvsp[-1].String); delete (yyvsp[0].String);
break;
case 191:
-#line 836 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 824 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << *(yyvsp[-2].String) << " = " << *(yyvsp[0].String) << "\n";
delete (yyvsp[-2].String); delete (yyvsp[0].String);
break;
case 192:
-#line 841 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 829 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = 0;
;}
break;
case 196:
-#line 851 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 839 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
delete (yyvsp[0].String);
break;
case 197:
-#line 856 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 844 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
if (*(yyvsp[0].String) == "64")
break;
case 198:
-#line 863 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 851 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
delete (yyvsp[0].String);
break;
case 199:
-#line 868 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 856 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += " = " + *(yyvsp[0].String);
delete (yyvsp[0].String);
break;
case 200:
-#line 875 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 863 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyvsp[-1].String)->insert(0, "[ ");
*(yyvsp[-1].String) += " ]";
break;
case 201:
-#line 882 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 870 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += ", " + *(yyvsp[0].String);
delete (yyvsp[0].String);
break;
case 203:
-#line 888 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 876 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = new std::string();
;}
break;
case 207:
-#line 897 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 885 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 208:
-#line 899 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 887 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = (yyvsp[-1].Type).newTy;
if (!(yyvsp[0].String)->empty())
break;
case 209:
-#line 906 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 894 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += ", " + *(yyvsp[0].String);
delete (yyvsp[0].String);
break;
case 210:
-#line 910 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 898 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = (yyvsp[0].String);
;}
break;
case 211:
-#line 914 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 902 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = (yyvsp[0].String);
;}
break;
case 212:
-#line 917 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 905 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += ", ...";
(yyval.String) = (yyvsp[-2].String);
break;
case 213:
-#line 922 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 910 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = (yyvsp[0].String);
;}
break;
case 214:
-#line 925 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 913 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 215:
-#line 928 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 916 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-7].String)->empty()) {
*(yyvsp[-7].String) += " ";
break;
case 216:
-#line 947 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 935 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string("{"); delete (yyvsp[0].String); ;}
break;
case 217:
-#line 948 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 936 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string ("{"); ;}
break;
case 218:
-#line 950 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 938 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-2].String)->empty()) {
*O << *(yyvsp[-2].String) << " ";
break;
case 219:
-#line 959 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 947 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string("}"); delete (yyvsp[0].String); ;}
break;
case 220:
-#line 960 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 948 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string("}"); ;}
break;
case 221:
-#line 962 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 950 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if ((yyvsp[-1].String))
*O << *(yyvsp[-1].String);
break;
case 222:
-#line 970 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 958 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 225:
-#line 976 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 964 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-1].String)->empty())
*(yyvsp[-2].String) += " " + *(yyvsp[-1].String);
break;
case 226:
-#line 989 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 977 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 236:
-#line 995 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 983 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyvsp[-1].String)->insert(0, "<");
*(yyvsp[-1].String) += ">";
break;
case 238:
-#line 1001 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 989 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-3].String)->empty()) {
*(yyvsp[-4].String) += " " + *(yyvsp[-3].String);
break;
case 241:
-#line 1014 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1002 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Value).val = (yyvsp[0].String);
(yyval.Value).constant = false;
break;
case 242:
-#line 1020 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1008 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Value).val = (yyvsp[0].String);
(yyval.Value).constant = true;
break;
case 243:
-#line 1031 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1019 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.Value) = (yyvsp[0].Value);
(yyval.Value).type = (yyvsp[-1].Type);
break;
case 244:
-#line 1037 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1025 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = 0;
;}
break;
case 245:
-#line 1040 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1028 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Do not allow functions with 0 basic blocks
(yyval.String) = 0;
;}
break;
case 246:
-#line 1048 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1036 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = 0;
;}
break;
case 247:
-#line 1052 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1040 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << " " << *(yyvsp[0].String) << "\n";
delete (yyvsp[0].String);
break;
case 248:
-#line 1057 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1045 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.String) = 0;
;}
break;
case 249:
-#line 1060 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1048 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << *(yyvsp[0].String) << "\n";
delete (yyvsp[0].String);
break;
case 251:
-#line 1066 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1054 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = (yyvsp[0].String); *(yyval.String) = "unwind"; ;}
break;
case 252:
-#line 1068 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1056 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Return with a result...
*O << " " << *(yyvsp[-1].String) << " " << *(yyvsp[0].Value).val << "\n";
delete (yyvsp[-1].String); (yyvsp[0].Value).destroy();
break;
case 253:
-#line 1073 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1061 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Return with no result...
*O << " " << *(yyvsp[-1].String) << " " << *(yyvsp[0].Type).newTy << "\n";
delete (yyvsp[-1].String); (yyvsp[0].Type).destroy();
break;
case 254:
-#line 1078 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1066 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Unconditional Branch...
*O << " " << *(yyvsp[-2].String) << " " << *(yyvsp[-1].Type).newTy << " " << *(yyvsp[0].Value).val << "\n";
delete (yyvsp[-2].String); (yyvsp[-1].Type).destroy(); (yyvsp[0].Value).destroy();
break;
case 255:
-#line 1083 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1071 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << " " << *(yyvsp[-8].String) << " " << *(yyvsp[-7].Type).newTy << " " << *(yyvsp[-6].Value).val << ", "
<< *(yyvsp[-4].Type).newTy << " " << *(yyvsp[-3].Value).val << ", " << *(yyvsp[-1].Type).newTy << " "
break;
case 256:
-#line 1091 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1079 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << " " << *(yyvsp[-8].String) << " " << *(yyvsp[-7].Type).newTy << " " << *(yyvsp[-6].Value).val << ", "
<< *(yyvsp[-4].Type).newTy << " " << *(yyvsp[-3].Value).val << " [" << *(yyvsp[-1].String) << " ]\n";
break;
case 257:
-#line 1098 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1086 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << " " << *(yyvsp[-7].String) << " " << *(yyvsp[-6].Type).newTy << " " << *(yyvsp[-5].Value).val << ", "
<< *(yyvsp[-3].Type).newTy << " " << *(yyvsp[-2].Value).val << "[]\n";
break;
case 258:
-#line 1105 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1093 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << " ";
if (!(yyvsp[-13].String)->empty())
break;
case 259:
-#line 1124 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1112 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << " " << *(yyvsp[0].String) << "\n";
delete (yyvsp[0].String);
break;
case 260:
-#line 1129 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1117 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*O << " " << *(yyvsp[0].String) << "\n";
delete (yyvsp[0].String);
break;
case 261:
-#line 1135 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1123 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-5].String) += " " + *(yyvsp[-4].Type).newTy + " " + *(yyvsp[-3].String) + ", " + *(yyvsp[-1].Type).newTy + " " + *(yyvsp[0].Value).val;
(yyvsp[-4].Type).destroy(); delete (yyvsp[-3].String); (yyvsp[-1].Type).destroy(); (yyvsp[0].Value).destroy();
break;
case 262:
-#line 1140 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1128 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyvsp[-3].String)->insert(0, *(yyvsp[-4].Type).newTy + " " );
*(yyvsp[-3].String) += ", " + *(yyvsp[-1].Type).newTy + " " + *(yyvsp[0].Value).val;
break;
case 263:
-#line 1148 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1136 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-1].String)->empty())
*(yyvsp[-1].String) += " = ";
break;
case 264:
-#line 1157 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1145 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ // Used for PHI nodes
(yyvsp[-3].Value).val->insert(0, *(yyvsp[-5].Type).newTy + "[");
*(yyvsp[-3].Value).val += "," + *(yyvsp[-1].Value).val + "]";
break;
case 265:
-#line 1164 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1152 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-6].String) += ", [" + *(yyvsp[-3].Value).val + "," + *(yyvsp[-1].Value).val + "]";
(yyvsp[-3].Value).destroy(); (yyvsp[-1].Value).destroy();
break;
case 266:
-#line 1172 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1160 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyval.ValList) = new ValueList();
(yyval.ValList)->push_back((yyvsp[0].Value));
break;
case 267:
-#line 1176 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1164 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
(yyvsp[-2].ValList)->push_back((yyvsp[0].Value));
(yyval.ValList) = (yyvsp[-2].ValList);
break;
case 268:
-#line 1183 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1171 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.ValList) = (yyvsp[0].ValList); ;}
break;
case 269:
-#line 1184 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1172 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.ValList) = new ValueList(); ;}
break;
case 270:
-#line 1188 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1176 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-1].String) += " " + *(yyvsp[0].String);
delete (yyvsp[0].String);
break;
case 272:
-#line 1196 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1184 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
const char* op = getDivRemOpcode(*(yyvsp[-4].String), (yyvsp[-3].Type));
(yyval.String) = new std::string(op);
break;
case 273:
-#line 1202 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1190 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-4].String) += " " + *(yyvsp[-3].Type).newTy + " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
(yyvsp[-3].Type).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
break;
case 274:
-#line 1207 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1195 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
-#if UPGRADE_SETCOND_OPS
*(yyvsp[-4].String) = getCompareOp(*(yyvsp[-4].String), (yyvsp[-3].Type));
-#endif
*(yyvsp[-4].String) += " " + *(yyvsp[-3].Type).newTy + " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
(yyvsp[-3].Type).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
(yyval.String) = (yyvsp[-4].String);
break;
case 275:
-#line 1215 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1201 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-6].String) += " " + *(yyvsp[-5].String) + " " + *(yyvsp[-3].Value).val + "," + *(yyvsp[-1].Value).val + ")";
delete (yyvsp[-5].String); (yyvsp[-3].Value).destroy(); (yyvsp[-1].Value).destroy();
break;
case 276:
-#line 1220 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1206 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-6].String) += " " + *(yyvsp[-5].String) + " " + *(yyvsp[-3].Value).val + "," + *(yyvsp[-1].Value).val + ")";
delete (yyvsp[-5].String); (yyvsp[-3].Value).destroy(); (yyvsp[-1].Value).destroy();
break;
case 277:
-#line 1225 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1211 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-1].String) += " " + *(yyvsp[0].Value).val;
(yyvsp[0].Value).destroy();
break;
case 278:
-#line 1230 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1216 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
const char* shiftop = (yyvsp[-3].String)->c_str();
if (*(yyvsp[-3].String) == "shr")
break;
case 279:
-#line 1238 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1224 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
std::string source = *(yyvsp[-2].Value).val;
TypeInfo SrcTy = (yyvsp[-2].Value).type;
break;
case 280:
-#line 1252 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1238 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-5].String) += " " + *(yyvsp[-4].Value).val + ", " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
(yyvsp[-4].Value).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
break;
case 281:
-#line 1257 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1243 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-3].String) += " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Type).newTy;
(yyvsp[-2].Value).destroy(); (yyvsp[0].Type).destroy();
break;
case 282:
-#line 1262 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1248 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-3].String) += " " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
(yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
break;
case 283:
-#line 1267 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1253 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-5].String) += " " + *(yyvsp[-4].Value).val + ", " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
(yyvsp[-4].Value).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
break;
case 284:
-#line 1272 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1258 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-5].String) += " " + *(yyvsp[-4].Value).val + ", " + *(yyvsp[-2].Value).val + ", " + *(yyvsp[0].Value).val;
(yyvsp[-4].Value).destroy(); (yyvsp[-2].Value).destroy(); (yyvsp[0].Value).destroy();
break;
case 285:
-#line 1277 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1263 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-1].String) += " " + *(yyvsp[0].String);
delete (yyvsp[0].String);
break;
case 286:
-#line 1282 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1268 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-5].String)->empty())
*(yyvsp[-6].String) += " " + *(yyvsp[-5].String);
break;
case 288:
-#line 1304 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1290 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.ValList) = (yyvsp[0].ValList); ;}
break;
case 289:
-#line 1305 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1291 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.ValList) = new ValueList(); ;}
break;
case 291:
-#line 1310 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1296 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{ (yyval.String) = new std::string(); ;}
break;
case 292:
-#line 1313 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1299 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += " " + *(yyvsp[-1].Type).newTy;
if (!(yyvsp[0].String)->empty())
break;
case 293:
-#line 1320 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1306 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-5].String) += " " + *(yyvsp[-4].Type).newTy + ", " + *(yyvsp[-2].Type).newTy + " " + *(yyvsp[-1].Value).val;
if (!(yyvsp[0].String)->empty())
break;
case 294:
-#line 1327 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1313 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-2].String) += " " + *(yyvsp[-1].Type).newTy;
if (!(yyvsp[0].String)->empty())
break;
case 295:
-#line 1334 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1320 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-5].String) += " " + *(yyvsp[-4].Type).newTy + ", " + *(yyvsp[-2].Type).newTy + " " + *(yyvsp[-1].Value).val;
if (!(yyvsp[0].String)->empty())
break;
case 296:
-#line 1341 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1327 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
*(yyvsp[-1].String) += " " + *(yyvsp[0].Value).val;
(yyvsp[0].Value).destroy();
break;
case 297:
-#line 1346 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1332 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-3].String)->empty())
*(yyvsp[-3].String) += " ";
break;
case 298:
-#line 1353 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1339 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
if (!(yyvsp[-5].String)->empty())
*(yyvsp[-5].String) += " ";
break;
case 299:
-#line 1360 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1346 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
{
// Upgrade the indices
for (unsigned i = 0; i < (yyvsp[0].ValList)->size(); ++i) {
}
/* Line 1126 of yacc.c. */
-#line 3882 "UpgradeParser.tab.c"
+#line 3868 "UpgradeParser.tab.c"
\f
yyvsp -= yylen;
yyssp -= yylen;
}
-#line 1384 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 1370 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
int yyerror(const char *ErrorMsg) {
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
-#line 285 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 275 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
typedef union YYSTYPE {
std::string* String;
TypeInfo Type;
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
-#line 285 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
+#line 275 "/proj/llvm/llvm-3/tools/llvm-upgrade/UpgradeParser.y"
typedef union YYSTYPE {
std::string* String;
TypeInfo Type;
#define YYERROR_VERBOSE 1
#define YYINCLUDED_STDLIB_H
#define YYDEBUG 1
-#define UPGRADE_SETCOND_OPS 0
-#define GENERATE_FCMP_INSTS 0
int yylex(); // declaration" of xxx warnings.
int yyparse();
// the original intent by replace the cast with a setne
const char* comparator = SrcTy.isPointer() ? ", null" :
(SrcTy.isFloatingPoint() ? ", 0.0" : ", 0");
-#if UPGRADE_SETCOND_OPS
- const char* compareOp = SrcTy.isFloatingPoint() ? "setne " : "icmp ne ";
-#else
- const char* compareOp = "setne";
-#endif
+ const char* compareOp = SrcTy.isFloatingPoint() ? "fcmp one " : "icmp ne ";
if (isConst) {
Result = "(" + Source + comparator + ")";
Result = compareOp + Result;
result[6] = cc1;
result[7] = cc2;
if (TI.isFloatingPoint()) {
-#if GENERATE_FCMP_INSTS
result[0] = 'f';
- result[5] = 'o'; // FIXME: Always map to ordered comparison ?
+ result[5] = 'o';
if (cc1 == 'n')
result[5] = 'u'; // NE maps to unordered
else
result[5] = 'o'; // everything else maps to ordered
-#else
- result = setcc;
-#endif
} else if (TI.isIntegral() || TI.isPointer()) {
result[0] = 'i';
if ((cc1 == 'e' && cc2 == 'q') || (cc1 == 'n' && cc2 == 'e'))
$$ = $1;
}
| SetCondOps '(' ConstVal ',' ConstVal ')' {
-#if UPGRADE_SETCOND_OPS
*$1 = getCompareOp(*$1, $3.type);
-#endif
*$1 += "(" + *$3.cnst + "," + *$5.cnst + ")";
$3.destroy(); $5.destroy();
$$ = $1;
$$ = $1;
}
| SetCondOps Types ValueRef ',' ValueRef {
-#if UPGRADE_SETCOND_OPS
*$1 = getCompareOp(*$1, $2);
-#endif
*$1 += " " + *$2.newTy + " " + *$3.val + ", " + *$5.val;
$2.destroy(); $3.destroy(); $5.destroy();
$$ = $1;
#define YYERROR_VERBOSE 1
#define YYINCLUDED_STDLIB_H
#define YYDEBUG 1
-#define UPGRADE_SETCOND_OPS 0
-#define GENERATE_FCMP_INSTS 0
int yylex(); // declaration" of xxx warnings.
int yyparse();
// the original intent by replace the cast with a setne
const char* comparator = SrcTy.isPointer() ? ", null" :
(SrcTy.isFloatingPoint() ? ", 0.0" : ", 0");
-#if UPGRADE_SETCOND_OPS
- const char* compareOp = SrcTy.isFloatingPoint() ? "setne " : "icmp ne ";
-#else
- const char* compareOp = "setne";
-#endif
+ const char* compareOp = SrcTy.isFloatingPoint() ? "fcmp one " : "icmp ne ";
if (isConst) {
Result = "(" + Source + comparator + ")";
Result = compareOp + Result;
result[6] = cc1;
result[7] = cc2;
if (TI.isFloatingPoint()) {
-#if GENERATE_FCMP_INSTS
result[0] = 'f';
- result[5] = 'o'; // FIXME: Always map to ordered comparison ?
+ result[5] = 'o';
if (cc1 == 'n')
result[5] = 'u'; // NE maps to unordered
else
result[5] = 'o'; // everything else maps to ordered
-#else
- result = setcc;
-#endif
} else if (TI.isIntegral() || TI.isPointer()) {
result[0] = 'i';
if ((cc1 == 'e' && cc2 == 'q') || (cc1 == 'n' && cc2 == 'e'))
$$ = $1;
}
| SetCondOps '(' ConstVal ',' ConstVal ')' {
-#if UPGRADE_SETCOND_OPS
*$1 = getCompareOp(*$1, $3.type);
-#endif
*$1 += "(" + *$3.cnst + "," + *$5.cnst + ")";
$3.destroy(); $5.destroy();
$$ = $1;
$$ = $1;
}
| SetCondOps Types ValueRef ',' ValueRef {
-#if UPGRADE_SETCOND_OPS
*$1 = getCompareOp(*$1, $2);
-#endif
*$1 += " " + *$2.newTy + " " + *$3.val + ", " + *$5.val;
$2.destroy(); $3.destroy(); $5.destroy();
$$ = $1;
}
Out << "Constant* " << constName << " = ConstantExpr::";
switch (CE->getOpcode()) {
- case Instruction::Add: Out << "getAdd"; break;
- case Instruction::Sub: Out << "getSub"; break;
- case Instruction::Mul: Out << "getMul"; break;
- case Instruction::UDiv: Out << "getUDiv"; break;
- case Instruction::SDiv: Out << "getSDiv"; break;
- case Instruction::FDiv: Out << "getFDiv"; break;
- case Instruction::URem: Out << "getURem"; break;
- case Instruction::SRem: Out << "getSRem"; break;
- case Instruction::FRem: Out << "getFRem"; break;
- case Instruction::And: Out << "getAnd"; break;
- case Instruction::Or: Out << "getOr"; break;
- case Instruction::Xor: Out << "getXor"; break;
- case Instruction::SetEQ: Out << "getSetEQ"; break;
- case Instruction::SetNE: Out << "getSetNE"; break;
- case Instruction::SetLE: Out << "getSetLE"; break;
- case Instruction::SetGE: Out << "getSetGE"; break;
- case Instruction::SetLT: Out << "getSetLT"; break;
- case Instruction::SetGT: Out << "getSetGT"; break;
- case Instruction::Shl: Out << "getShl"; 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;
- case Instruction::ShuffleVector: Out << "getShuffleVector"; break;
+ case Instruction::Add: Out << "getAdd("; break;
+ case Instruction::Sub: Out << "getSub("; break;
+ case Instruction::Mul: Out << "getMul("; break;
+ case Instruction::UDiv: Out << "getUDiv("; break;
+ case Instruction::SDiv: Out << "getSDiv("; break;
+ case Instruction::FDiv: Out << "getFDiv("; break;
+ case Instruction::URem: Out << "getURem("; break;
+ case Instruction::SRem: Out << "getSRem("; break;
+ case Instruction::FRem: Out << "getFRem("; break;
+ case Instruction::And: Out << "getAnd("; break;
+ case Instruction::Or: Out << "getOr("; break;
+ case Instruction::Xor: Out << "getXor("; break;
+ case Instruction::ICmp:
+ Out << "getICmp(ICmpInst::ICMP_";
+ switch (CE->getPredicate()) {
+ case ICmpInst::ICMP_EQ: Out << "EQ"; break;
+ case ICmpInst::ICMP_NE: Out << "NE"; break;
+ case ICmpInst::ICMP_SLT: Out << "SLT"; break;
+ case ICmpInst::ICMP_ULT: Out << "ULT"; break;
+ case ICmpInst::ICMP_SGT: Out << "SGT"; break;
+ case ICmpInst::ICMP_UGT: Out << "UGT"; break;
+ case ICmpInst::ICMP_SLE: Out << "SLE"; break;
+ case ICmpInst::ICMP_ULE: Out << "ULE"; break;
+ case ICmpInst::ICMP_SGE: Out << "SGE"; break;
+ case ICmpInst::ICMP_UGE: Out << "UGE"; break;
+ default: error("Invalid ICmp Predicate");
+ }
+ break;
+ case Instruction::FCmp:
+ Out << "getFCmp(FCmpInst::FCMP_";
+ switch (CE->getPredicate()) {
+ case FCmpInst::FCMP_FALSE: Out << "FALSE"; break;
+ case FCmpInst::FCMP_ORD: Out << "ORD"; break;
+ case FCmpInst::FCMP_UNO: Out << "UNO"; break;
+ case FCmpInst::FCMP_OEQ: Out << "OEQ"; break;
+ case FCmpInst::FCMP_UEQ: Out << "UEQ"; break;
+ case FCmpInst::FCMP_ONE: Out << "ONE"; break;
+ case FCmpInst::FCMP_UNE: Out << "UNE"; break;
+ case FCmpInst::FCMP_OLT: Out << "OLT"; break;
+ case FCmpInst::FCMP_ULT: Out << "ULT"; break;
+ case FCmpInst::FCMP_OGT: Out << "OGT"; break;
+ case FCmpInst::FCMP_UGT: Out << "UGT"; break;
+ case FCmpInst::FCMP_OLE: Out << "OLE"; break;
+ case FCmpInst::FCMP_ULE: Out << "ULE"; break;
+ case FCmpInst::FCMP_OGE: Out << "OGE"; break;
+ case FCmpInst::FCMP_UGE: Out << "UGE"; break;
+ case FCmpInst::FCMP_TRUE: Out << "TRUE"; break;
+ default: error("Invalid FCmp Predicate");
+ }
+ break;
+ case Instruction::Shl: Out << "getShl("; 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;
+ case Instruction::ShuffleVector: Out << "getShuffleVector("; break;
default:
error("Invalid constant expression");
break;
Out << "\", " << bbname << ");";
break;
}
- case Instruction::SetEQ:
- case Instruction::SetNE:
- case Instruction::SetLE:
- case Instruction::SetGE:
- case Instruction::SetLT:
- case Instruction::SetGT: {
- Out << "SetCondInst* " << iName << " = new SetCondInst(";
- switch (I->getOpcode()) {
- case Instruction::SetEQ: Out << "Instruction::SetEQ"; break;
- case Instruction::SetNE: Out << "Instruction::SetNE"; break;
- case Instruction::SetLE: Out << "Instruction::SetLE"; break;
- case Instruction::SetGE: Out << "Instruction::SetGE"; break;
- case Instruction::SetLT: Out << "Instruction::SetLT"; break;
- case Instruction::SetGT: Out << "Instruction::SetGT"; break;
- default: Out << "Instruction::BadOpCode"; break;
+ case Instruction::FCmp: {
+ Out << "FCmpInst* " << iName << " = new FCmpInst(";
+ switch (cast<FCmpInst>(I)->getPredicate()) {
+ case FCmpInst::FCMP_FALSE: Out << "FCmpInst::FCMP_FALSE"; break;
+ case FCmpInst::FCMP_OEQ : Out << "FCmpInst::FCMP_OEQ"; break;
+ case FCmpInst::FCMP_OGT : Out << "FCmpInst::FCMP_OGT"; break;
+ case FCmpInst::FCMP_OGE : Out << "FCmpInst::FCMP_OGE"; break;
+ case FCmpInst::FCMP_OLT : Out << "FCmpInst::FCMP_OLT"; break;
+ case FCmpInst::FCMP_OLE : Out << "FCmpInst::FCMP_OLE"; break;
+ case FCmpInst::FCMP_ONE : Out << "FCmpInst::FCMP_ONE"; break;
+ case FCmpInst::FCMP_ORD : Out << "FCmpInst::FCMP_ORD"; break;
+ case FCmpInst::FCMP_UNO : Out << "FCmpInst::FCMP_UNO"; break;
+ case FCmpInst::FCMP_UEQ : Out << "FCmpInst::FCMP_UEQ"; break;
+ case FCmpInst::FCMP_UGT : Out << "FCmpInst::FCMP_UGT"; break;
+ case FCmpInst::FCMP_UGE : Out << "FCmpInst::FCMP_UGE"; break;
+ case FCmpInst::FCMP_ULT : Out << "FCmpInst::FCMP_ULT"; break;
+ case FCmpInst::FCMP_ULE : Out << "FCmpInst::FCMP_ULE"; break;
+ case FCmpInst::FCMP_UNE : Out << "FCmpInst::FCMP_UNE"; break;
+ case FCmpInst::FCMP_TRUE : Out << "FCmpInst::FCMP_TRUE"; break;
+ default: Out << "FCmpInst::BAD_ICMP_PREDICATE"; break;
+ }
+ Out << ", " << opNames[0] << ", " << opNames[1] << ", \"";
+ printEscapedString(I->getName());
+ Out << "\", " << bbname << ");";
+ break;
+ }
+ case Instruction::ICmp: {
+ Out << "ICmpInst* " << iName << " = new ICmpInst(";
+ switch (cast<ICmpInst>(I)->getPredicate()) {
+ case ICmpInst::ICMP_EQ: Out << "ICmpInst::ICMP_EQ"; break;
+ case ICmpInst::ICMP_NE: Out << "ICmpInst::ICMP_NE"; break;
+ case ICmpInst::ICMP_ULE: Out << "ICmpInst::ICMP_ULE"; break;
+ case ICmpInst::ICMP_SLE: Out << "ICmpInst::ICMP_SLE"; break;
+ case ICmpInst::ICMP_UGE: Out << "ICmpInst::ICMP_UGE"; break;
+ case ICmpInst::ICMP_SGE: Out << "ICmpInst::ICMP_SGE"; break;
+ case ICmpInst::ICMP_ULT: Out << "ICmpInst::ICMP_ULT"; break;
+ case ICmpInst::ICMP_SLT: Out << "ICmpInst::ICMP_SLT"; break;
+ case ICmpInst::ICMP_UGT: Out << "ICmpInst::ICMP_UGT"; break;
+ case ICmpInst::ICMP_SGT: Out << "ICmpInst::ICMP_SGT"; break;
+ default: Out << "ICmpInst::BAD_ICMP_PREDICATE"; break;
}
Out << ", " << opNames[0] << ", " << opNames[1] << ", \"";
printEscapedString(I->getName());