diff options
72 files changed, 7690 insertions, 7061 deletions
diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h index e502a71f53..3d4ff90fcc 100644 --- a/include/llvm/Constants.h +++ b/include/llvm/Constants.h @@ -442,8 +442,6 @@ protected: 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, Constant *C1, Constant *C2, Constant *C3); static Constant *getGetElementPtrTy(const Type *Ty, Constant *C, diff --git a/include/llvm/Instruction.def b/include/llvm/Instruction.def index c33c4483be..41540c2a9c 100644 --- a/include/llvm/Instruction.def +++ b/include/llvm/Instruction.def @@ -114,49 +114,49 @@ HANDLE_BINARY_INST(13, URem , BinaryOperator) HANDLE_BINARY_INST(14, SRem , BinaryOperator) HANDLE_BINARY_INST(15, FRem , BinaryOperator) -// Logical operators... -HANDLE_BINARY_INST(16, And , BinaryOperator) -HANDLE_BINARY_INST(17, Or , BinaryOperator) -HANDLE_BINARY_INST(18, Xor , BinaryOperator) - LAST_BINARY_INST(18) +// Logical operators (integer operands) +HANDLE_BINARY_INST(16, Shl , BinaryOperator) // Shift left (logical) +HANDLE_BINARY_INST(17, LShr , BinaryOperator) // Shift right (logical) +HANDLE_BINARY_INST(18, AShr , BinaryOperator) // shift right (arithmetic) +HANDLE_BINARY_INST(19, And , BinaryOperator) +HANDLE_BINARY_INST(20, Or , BinaryOperator) +HANDLE_BINARY_INST(21, Xor , BinaryOperator) + LAST_BINARY_INST(21) // Memory operators... - 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) + FIRST_MEMORY_INST(22) +HANDLE_MEMORY_INST(22, Malloc, MallocInst) // Heap management instructions +HANDLE_MEMORY_INST(23, Free , FreeInst ) +HANDLE_MEMORY_INST(24, Alloca, AllocaInst) // Stack management +HANDLE_MEMORY_INST(25, Load , LoadInst ) // Memory manipulation instrs +HANDLE_MEMORY_INST(26, Store , StoreInst ) +HANDLE_MEMORY_INST(27, GetElementPtr, GetElementPtrInst) + LAST_MEMORY_INST(27) // Cast operators ... // NOTE: The order matters here because CastInst::isEliminableCastPair // NOTE: (see Instructions.cpp) encodes a table based on this ordering. - 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) + FIRST_CAST_INST(28) +HANDLE_CAST_INST(28, Trunc , TruncInst ) // Truncate integers +HANDLE_CAST_INST(29, ZExt , ZExtInst ) // Zero extend integers +HANDLE_CAST_INST(30, SExt , SExtInst ) // Sign extend integers +HANDLE_CAST_INST(31, FPToUI , FPToUIInst ) // floating point -> UInt +HANDLE_CAST_INST(32, FPToSI , FPToSIInst ) // floating point -> SInt +HANDLE_CAST_INST(33, UIToFP , UIToFPInst ) // UInt -> floating point +HANDLE_CAST_INST(34, SIToFP , SIToFPInst ) // SInt -> floating point +HANDLE_CAST_INST(35, FPTrunc , FPTruncInst ) // Truncate floating point +HANDLE_CAST_INST(36, FPExt , FPExtInst ) // Extend floating point +HANDLE_CAST_INST(37, PtrToInt, PtrToIntInst) // Pointer -> Integer +HANDLE_CAST_INST(38, IntToPtr, IntToPtrInst) // Integer -> Pointer +HANDLE_CAST_INST(39, BitCast , BitCastInst ) // Type cast + LAST_CAST_INST(39) // Other operators... - 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) + FIRST_OTHER_INST(40) +HANDLE_OTHER_INST(40, ICmp , ICmpInst ) // Integer comparison instruction +HANDLE_OTHER_INST(41, FCmp , FCmpInst ) // Floating point comparison instr. +HANDLE_OTHER_INST(42, PHI , PHINode ) // PHI node instruction +HANDLE_OTHER_INST(43, Call , CallInst ) // Call a function 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 diff --git a/include/llvm/Instruction.h b/include/llvm/Instruction.h index 3e9f749602..15c5919304 100644 --- a/include/llvm/Instruction.h +++ b/include/llvm/Instruction.h @@ -129,6 +129,27 @@ public: return getOpcode() >= BinaryOpsBegin && getOpcode() < BinaryOpsEnd; } + /// @brief Determine if the Opcode is one of the shift instructions. + static inline bool isShift(unsigned Opcode) { + return Opcode >= Shl && Opcode <= AShr; + } + + /// @brief Determine if the instruction's opcode is one of the shift + /// instructions. + inline bool isShift() { return isShift(getOpcode()); } + + /// isLogicalShift - Return true if this is a logical shift left or a logical + /// shift right. + inline bool isLogicalShift() { + return getOpcode() == Shl || getOpcode() == LShr; + } + + /// isLogicalShift - Return true if this is a logical shift left or a logical + /// shift right. + inline bool isArithmeticShift() { + return getOpcode() == AShr; + } + /// @brief Determine if the OpCode is one of the CastInst instructions. static inline bool isCast(unsigned OpCode) { return OpCode >= CastOpsBegin && OpCode < CastOpsEnd; diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h index 7812cdb591..1c79bb4dda 100644 --- a/include/llvm/Instructions.h +++ b/include/llvm/Instructions.h @@ -760,83 +760,6 @@ public: } }; - -//===----------------------------------------------------------------------===// -// ShiftInst Class -//===----------------------------------------------------------------------===// - -/// ShiftInst - This class represents left and right shift instructions. -/// -class ShiftInst : public Instruction { - Use Ops[2]; - ShiftInst(const ShiftInst &SI) - : Instruction(SI.getType(), SI.getOpcode(), Ops, 2) { - Ops[0].init(SI.Ops[0], this); - Ops[1].init(SI.Ops[1], this); - } - void init(OtherOps Opcode, Value *S, Value *SA) { - assert((Opcode == Shl || Opcode == LShr || Opcode == AShr) && - "ShiftInst Opcode invalid!"); - Ops[0].init(S, this); - Ops[1].init(SA, this); - } - -public: - ShiftInst(OtherOps Opcode, Value *S, Value *SA, const std::string &Name = "", - Instruction *InsertBefore = 0) - : Instruction(S->getType(), Opcode, Ops, 2, Name, InsertBefore) { - init(Opcode, S, SA); - } - ShiftInst(OtherOps Opcode, Value *S, Value *SA, const std::string &Name, - BasicBlock *InsertAtEnd) - : Instruction(S->getType(), Opcode, Ops, 2, Name, InsertAtEnd) { - init(Opcode, S, SA); - } - - OtherOps getOpcode() const { - return static_cast<OtherOps>(Instruction::getOpcode()); - } - - /// Transparently provide more efficient getOperand methods. - Value *getOperand(unsigned i) const { - assert(i < 2 && "getOperand() out of range!"); - return Ops[i]; - } - void setOperand(unsigned i, Value *Val) { - assert(i < 2 && "setOperand() out of range!"); - Ops[i] = Val; - } - unsigned getNumOperands() const { return 2; } - - /// isLogicalShift - Return true if this is a logical shift left or a logical - /// shift right. - bool isLogicalShift() const { - unsigned opcode = getOpcode(); - return opcode == Instruction::Shl || opcode == Instruction::LShr; - } - - - /// isArithmeticShift - Return true if this is a sign-extending shift right - /// operation. - bool isArithmeticShift() const { - return !isLogicalShift(); - } - - - virtual ShiftInst *clone() const; - - // Methods for support type inquiry through isa, cast, and dyn_cast: - static inline bool classof(const ShiftInst *) { return true; } - static inline bool classof(const Instruction *I) { - return (I->getOpcode() == Instruction::LShr) | - (I->getOpcode() == Instruction::AShr) | - (I->getOpcode() == Instruction::Shl); - } - static inline bool classof(const Value *V) { - return isa<Instruction>(V) && classof(cast<Instruction>(V)); - } -}; - //===----------------------------------------------------------------------===// // SelectInst Class //===----------------------------------------------------------------------===// diff --git a/include/llvm/Support/InstVisitor.h b/include/llvm/Support/InstVisitor.h index 15e5e9822b..e848c9b576 100644 --- a/include/llvm/Support/InstVisitor.h +++ b/include/llvm/Support/InstVisitor.h @@ -190,7 +190,6 @@ public: RetTy visitBitCastInst(BitCastInst &I) { DELEGATE(CastInst); } RetTy visitSelectInst(SelectInst &I) { DELEGATE(Instruction); } RetTy visitCallInst(CallInst &I) { DELEGATE(Instruction); } - RetTy visitShiftInst(ShiftInst &I) { DELEGATE(Instruction); } RetTy visitVAArgInst(VAArgInst &I) { DELEGATE(Instruction); } RetTy visitExtractElementInst(ExtractElementInst &I) { DELEGATE(Instruction);} RetTy visitInsertElementInst(InsertElementInst &I) { DELEGATE(Instruction); } diff --git a/include/llvm/Support/PatternMatch.h b/include/llvm/Support/PatternMatch.h index 97e9b5f961..3cf037fa05 100644 --- a/include/llvm/Support/PatternMatch.h +++ b/include/llvm/Support/PatternMatch.h @@ -166,27 +166,27 @@ inline BinaryOp_match<LHS, RHS, Instruction::Xor> m_Xor(const LHS &L, } template<typename LHS, typename RHS> -inline BinaryOp_match<LHS, RHS, Instruction::Shl, - ShiftInst> m_Shl(const LHS &L, const RHS &R) { - return BinaryOp_match<LHS, RHS, Instruction::Shl, ShiftInst>(L, R); +inline BinaryOp_match<LHS, RHS, Instruction::Shl> m_Shl(const LHS &L, + const RHS &R) { + return BinaryOp_match<LHS, RHS, Instruction::Shl>(L, R); } template<typename LHS, typename RHS> -inline BinaryOp_match<LHS, RHS, Instruction::LShr, - ShiftInst> m_LShr(const LHS &L, const RHS &R) { - return BinaryOp_match<LHS, RHS, Instruction::LShr, ShiftInst>(L, R); +inline BinaryOp_match<LHS, RHS, Instruction::LShr> m_LShr(const LHS &L, + const RHS &R) { + return BinaryOp_match<LHS, RHS, Instruction::LShr>(L, R); } template<typename LHS, typename RHS> -inline BinaryOp_match<LHS, RHS, Instruction::AShr, - ShiftInst> m_AShr(const LHS &L, const RHS &R) { - return BinaryOp_match<LHS, RHS, Instruction::AShr, ShiftInst>(L, R); +inline BinaryOp_match<LHS, RHS, Instruction::AShr> m_AShr(const LHS &L, + const RHS &R) { + return BinaryOp_match<LHS, RHS, Instruction::AShr>(L, R); } //===----------------------------------------------------------------------===// // Matchers for either AShr or LShr .. for convenience // -template<typename LHS_t, typename RHS_t, typename ConcreteTy = ShiftInst> +template<typename LHS_t, typename RHS_t, typename ConcreteTy = BinaryOperator> struct Shr_match { LHS_t L; RHS_t R; @@ -248,18 +248,18 @@ struct BinaryOpClass_match { }; template<typename LHS, typename RHS> -inline BinaryOpClass_match<LHS, RHS, ShiftInst, Instruction::OtherOps> -m_Shift(Instruction::OtherOps &Op, const LHS &L, const RHS &R) { +inline BinaryOpClass_match<LHS, RHS, BinaryOperator, Instruction::BinaryOps> +m_Shift(Instruction::BinaryOps &Op, const LHS &L, const RHS &R) { return BinaryOpClass_match<LHS, RHS, - ShiftInst, Instruction::OtherOps>(Op, L, R); + BinaryOperator, Instruction::BinaryOps>(Op, L, R); } template<typename LHS, typename RHS> -inline BinaryOpClass_match<LHS, RHS, ShiftInst, Instruction::OtherOps> +inline BinaryOpClass_match<LHS, RHS, BinaryOperator, Instruction::BinaryOps> m_Shift(const LHS &L, const RHS &R) { - Instruction::OtherOps Op; + Instruction::BinaryOps Op; return BinaryOpClass_match<LHS, RHS, - ShiftInst, Instruction::OtherOps>(Op, L, R); + BinaryOperator, Instruction::BinaryOps>(Op, L, R); } //===----------------------------------------------------------------------===// diff --git a/lib/Analysis/ConstantFolding.cpp b/lib/Analysis/ConstantFolding.cpp index 1bf6b50333..25a64ab9a6 100644 --- a/lib/Analysis/ConstantFolding.cpp +++ b/lib/Analysis/ConstantFolding.cpp @@ -216,10 +216,6 @@ Constant *llvm::ConstantFoldInstOperands(const Instruction* I, case Instruction::FCmp: return ConstantExpr::getCompare(cast<CmpInst>(I)->getPredicate(), Ops[0], Ops[1]); - case Instruction::Shl: - case Instruction::LShr: - case Instruction::AShr: - return ConstantExpr::get(Opc, Ops[0], Ops[1]); case Instruction::Trunc: case Instruction::ZExt: case Instruction::SExt: diff --git a/lib/Analysis/IPA/Andersens.cpp b/lib/Analysis/IPA/Andersens.cpp index b6855f6503..aa2188bc95 100644 --- a/lib/Analysis/IPA/Andersens.cpp +++ b/lib/Analysis/IPA/Andersens.cpp @@ -776,9 +776,6 @@ void Andersens::visitInstruction(Instruction &I) { case Instruction::Unwind: case Instruction::Unreachable: case Instruction::Free: - case Instruction::Shl: - case Instruction::LShr: - case Instruction::AShr: case Instruction::ICmp: case Instruction::FCmp: return; diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index 75dabf7cad..a81f24f117 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -1736,7 +1736,7 @@ ComputeLoadConstantCompareIterationCount(LoadInst *LI, Constant *RHS, /// 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) || isa<CmpInst>(I) || + if (isa<BinaryOperator>(I) || isa<CmpInst>(I) || isa<SelectInst>(I) || isa<CastInst>(I) || isa<GetElementPtrInst>(I)) return true; diff --git a/lib/AsmParser/Lexer.cpp.cvs b/lib/AsmParser/Lexer.cpp.cvs index 991f4690dd..f2e3e13a92 100644 --- a/lib/AsmParser/Lexer.cpp.cvs +++ b/lib/AsmParser/Lexer.cpp.cvs @@ -1,94 +1,51 @@ -#line 2 "Lexer.cpp" - -#line 4 "Lexer.cpp" - -#define YY_INT_ALIGNED short int - -/* A lexical scanner generated by flex */ +#define yy_create_buffer llvmAsm_create_buffer +#define yy_delete_buffer llvmAsm_delete_buffer +#define yy_scan_buffer llvmAsm_scan_buffer +#define yy_scan_string llvmAsm_scan_string +#define yy_scan_bytes llvmAsm_scan_bytes +#define yy_flex_debug llvmAsm_flex_debug +#define yy_init_buffer llvmAsm_init_buffer +#define yy_flush_buffer llvmAsm_flush_buffer +#define yy_load_buffer_state llvmAsm_load_buffer_state +#define yy_switch_to_buffer llvmAsm_switch_to_buffer +#define yyin llvmAsmin +#define yyleng llvmAsmleng +#define yylex llvmAsmlex +#define yyout llvmAsmout +#define yyrestart llvmAsmrestart +#define yytext llvmAsmtext +#define yylineno llvmAsmlineno + +#line 20 "Lexer.cpp" +/* A lexical scanner generated by flex*/ + +/* Scanner skeleton version: + * $Header$ + */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 33 -#if YY_FLEX_SUBMINOR_VERSION > 0 -#define FLEX_BETA -#endif -/* First, we deal with platform-specific or compiler-specific issues. */ - -/* begin standard C headers. */ #include <stdio.h> -#include <string.h> -#include <errno.h> -#include <stdlib.h> - -/* end standard C headers. */ - -/* flex integer type definitions */ - -#ifndef FLEXINT_ |