For PR1195:

Rename PackedType -> VectorType, ConstantPacked -> ConstantVector, and
PackedTyID -> VectorTyID. No functional changes.

llvm-svn: 34293
This commit is contained in:
Reid Spencer 2007-02-15 02:26:10 +00:00
parent dad84a7c02
commit d84d35ba70
49 changed files with 9208 additions and 7003 deletions

View File

@ -2314,7 +2314,7 @@ the <tt>lib/VMCore</tt> directory.</p>
</dd> </dd>
<dt><tt>PointerType</tt></dt> <dt><tt>PointerType</tt></dt>
<dd>Subclass of SequentialType for pointer types.</dd> <dd>Subclass of SequentialType for pointer types.</dd>
<dt><tt>PackedType</tt></dt> <dt><tt>VectorType</tt></dt>
<dd>Subclass of SequentialType for packed (vector) types. A <dd>Subclass of SequentialType for packed (vector) types. A
packed type is similar to an ArrayType but is distinguished because it is packed type is similar to an ArrayType but is distinguished because it is
a first class type wherease ArrayType is not. Packed types are used for a first class type wherease ArrayType is not. Packed types are used for

View File

@ -23,7 +23,7 @@ namespace llvm {
class ArrayType; class ArrayType;
class StructType; class StructType;
class PointerType; class PointerType;
class PackedType; class VectorType;
class ConstantArray; class ConstantArray;
class Module; class Module;
@ -242,8 +242,8 @@ public:
) {} ) {}
/// @brief Handle a constant packed /// @brief Handle a constant packed
virtual void handleConstantPacked( virtual void handleConstantVector(
const PackedType* PT, ///< Type of the array const VectorType* PT, ///< Type of the array
Constant**ElementSlots, unsigned NumElts,///< Slot nums for packed values Constant**ElementSlots, unsigned NumElts,///< Slot nums for packed values
unsigned TypeSlot, ///< Slot # of type unsigned TypeSlot, ///< Slot # of type
Constant* Val ///< The constant value Constant* Val ///< The constant value

View File

@ -28,7 +28,7 @@ namespace llvm {
class ArrayType; class ArrayType;
class StructType; class StructType;
class PointerType; class PointerType;
class PackedType; class VectorType;
template<class ConstantClass, class TypeClass, class ValType> template<class ConstantClass, class TypeClass, class ValType>
struct ConstantCreator; struct ConstantCreator;
@ -334,31 +334,31 @@ public:
}; };
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
/// ConstantPacked - Constant Packed Declarations /// ConstantVector - Constant Vector Declarations
/// ///
class ConstantPacked : public Constant { class ConstantVector : public Constant {
friend struct ConstantCreator<ConstantPacked, PackedType, friend struct ConstantCreator<ConstantVector, VectorType,
std::vector<Constant*> >; std::vector<Constant*> >;
ConstantPacked(const ConstantPacked &); // DO NOT IMPLEMENT ConstantVector(const ConstantVector &); // DO NOT IMPLEMENT
protected: protected:
ConstantPacked(const PackedType *T, const std::vector<Constant*> &Val); ConstantVector(const VectorType *T, const std::vector<Constant*> &Val);
~ConstantPacked(); ~ConstantVector();
public: public:
/// get() - Static factory methods - Return objects of the specified value /// get() - Static factory methods - Return objects of the specified value
static Constant *get(const PackedType *T, const std::vector<Constant*> &); static Constant *get(const VectorType *T, const std::vector<Constant*> &);
static Constant *get(const std::vector<Constant*> &V); static Constant *get(const std::vector<Constant*> &V);
/// getType - Specialize the getType() method to always return an PackedType, /// getType - Specialize the getType() method to always return an VectorType,
/// which reduces the amount of casting needed in parts of the compiler. /// which reduces the amount of casting needed in parts of the compiler.
/// ///
inline const PackedType *getType() const { inline const VectorType *getType() const {
return reinterpret_cast<const PackedType*>(Value::getType()); return reinterpret_cast<const VectorType*>(Value::getType());
} }
/// @returns the value for an packed integer constant of the given type that /// @returns the value for an packed integer constant of the given type that
/// has all its bits set to true. /// has all its bits set to true.
/// @brief Get the all ones value /// @brief Get the all ones value
static ConstantPacked *getAllOnesValue(const PackedType *Ty); static ConstantVector *getAllOnesValue(const VectorType *Ty);
/// isNullValue - Return true if this is the value that would be returned by /// isNullValue - Return true if this is the value that would be returned by
/// getNullValue. This always returns false because zero arrays are always /// getNullValue. This always returns false because zero arrays are always
@ -375,9 +375,9 @@ public:
virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U); virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U);
/// Methods for support type inquiry through isa, cast, and dyn_cast: /// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const ConstantPacked *) { return true; } static inline bool classof(const ConstantVector *) { return true; }
static bool classof(const Value *V) { static bool classof(const Value *V) {
return V->getValueType() == ConstantPackedVal; return V->getValueType() == ConstantVectorVal;
} }
}; };

View File

@ -28,7 +28,7 @@ class FunctionValType;
class ArrayValType; class ArrayValType;
class StructValType; class StructValType;
class PointerValType; class PointerValType;
class PackedValType; class VectorValType;
class IntegerValType; class IntegerValType;
class DerivedType : public Type { class DerivedType : public Type {
@ -214,7 +214,7 @@ public:
/// CompositeType - Common super class of ArrayType, StructType, PointerType /// CompositeType - Common super class of ArrayType, StructType, PointerType
/// and PackedType /// and VectorType
class CompositeType : public DerivedType { class CompositeType : public DerivedType {
protected: protected:
inline CompositeType(TypeID id) : DerivedType(id) { } inline CompositeType(TypeID id) : DerivedType(id) { }
@ -232,7 +232,7 @@ public:
return T->getTypeID() == ArrayTyID || return T->getTypeID() == ArrayTyID ||
T->getTypeID() == StructTyID || T->getTypeID() == StructTyID ||
T->getTypeID() == PointerTyID || T->getTypeID() == PointerTyID ||
T->getTypeID() == PackedTyID; T->getTypeID() == VectorTyID;
} }
}; };
@ -317,7 +317,7 @@ public:
static inline bool classof(const Type *T) { static inline bool classof(const Type *T) {
return T->getTypeID() == ArrayTyID || return T->getTypeID() == ArrayTyID ||
T->getTypeID() == PointerTyID || T->getTypeID() == PointerTyID ||
T->getTypeID() == PackedTyID; T->getTypeID() == VectorTyID;
} }
}; };
@ -350,25 +350,25 @@ public:
} }
}; };
/// PackedType - Class to represent packed types /// VectorType - Class to represent packed types
/// ///
class PackedType : public SequentialType { class VectorType : public SequentialType {
friend class TypeMap<PackedValType, PackedType>; friend class TypeMap<VectorValType, VectorType>;
unsigned NumElements; unsigned NumElements;
PackedType(const PackedType &); // Do not implement VectorType(const VectorType &); // Do not implement
const PackedType &operator=(const PackedType &); // Do not implement const VectorType &operator=(const VectorType &); // Do not implement
PackedType(const Type *ElType, unsigned NumEl); VectorType(const Type *ElType, unsigned NumEl);
public: public:
/// PackedType::get - This static method is the primary way to construct an /// VectorType::get - This static method is the primary way to construct an
/// PackedType /// VectorType
/// ///
static PackedType *get(const Type *ElementType, unsigned NumElements); static VectorType *get(const Type *ElementType, unsigned NumElements);
/// @brief Return the number of elements in the Packed type. /// @brief Return the number of elements in the Vector type.
inline unsigned getNumElements() const { return NumElements; } inline unsigned getNumElements() const { return NumElements; }
/// @brief Return the number of bits in the Packed type. /// @brief Return the number of bits in the Vector type.
inline unsigned getBitWidth() const { inline unsigned getBitWidth() const {
return NumElements *getElementType()->getPrimitiveSizeInBits(); return NumElements *getElementType()->getPrimitiveSizeInBits();
} }
@ -378,9 +378,9 @@ public:
virtual void typeBecameConcrete(const DerivedType *AbsTy); virtual void typeBecameConcrete(const DerivedType *AbsTy);
// Methods for support type inquiry through isa, cast, and dyn_cast: // Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const PackedType *T) { return true; } static inline bool classof(const VectorType *T) { return true; }
static inline bool classof(const Type *T) { static inline bool classof(const Type *T) {
return T->getTypeID() == PackedTyID; return T->getTypeID() == VectorTyID;
} }
}; };

View File

@ -23,7 +23,7 @@ namespace llvm {
class BasicBlock; class BasicBlock;
class ConstantInt; class ConstantInt;
class PointerType; class PointerType;
class PackedType; class VectorType;
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// AllocationInst Class // AllocationInst Class
@ -862,7 +862,7 @@ public:
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
/// ExtractElementInst - This instruction extracts a single (scalar) /// ExtractElementInst - This instruction extracts a single (scalar)
/// element from a PackedType value /// element from a VectorType value
/// ///
class ExtractElementInst : public Instruction { class ExtractElementInst : public Instruction {
Use Ops[2]; Use Ops[2];
@ -916,7 +916,7 @@ public:
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
/// InsertElementInst - This instruction inserts a single (scalar) /// InsertElementInst - This instruction inserts a single (scalar)
/// element into a PackedType value /// element into a VectorType value
/// ///
class InsertElementInst : public Instruction { class InsertElementInst : public Instruction {
Use Ops[3]; Use Ops[3];
@ -942,8 +942,8 @@ public:
/// getType - Overload to return most specific packed type. /// getType - Overload to return most specific packed type.
/// ///
inline const PackedType *getType() const { inline const VectorType *getType() const {
return reinterpret_cast<const PackedType*>(Instruction::getType()); return reinterpret_cast<const VectorType*>(Instruction::getType());
} }
/// Transparently provide more efficient getOperand methods. /// Transparently provide more efficient getOperand methods.
@ -994,8 +994,8 @@ public:
/// getType - Overload to return most specific packed type. /// getType - Overload to return most specific packed type.
/// ///
inline const PackedType *getType() const { inline const VectorType *getType() const {
return reinterpret_cast<const PackedType*>(Instruction::getType()); return reinterpret_cast<const VectorType*>(Instruction::getType());
} }
/// Transparently provide more efficient getOperand methods. /// Transparently provide more efficient getOperand methods.

View File

@ -62,8 +62,8 @@ class LLVMIntegerType<ValueType VT, int width>
int Width = width; int Width = width;
} }
class LLVMPackedType<ValueType VT, int numelts, LLVMType elty> class LLVMVectorType<ValueType VT, int numelts, LLVMType elty>
: LLVMType<VT, "Type::PackedTyID">{ : LLVMType<VT, "Type::VectorTyID">{
int NumElts = numelts; int NumElts = numelts;
LLVMType ElTy = elty; LLVMType ElTy = elty;
} }
@ -90,13 +90,13 @@ def llvm_ptrptr_ty : LLVMPointerType<llvm_ptr_ty>; // i8**
def llvm_empty_ty : LLVMEmptyStructType; // { } def llvm_empty_ty : LLVMEmptyStructType; // { }
def llvm_descriptor_ty : LLVMPointerType<llvm_empty_ty>; // { }* def llvm_descriptor_ty : LLVMPointerType<llvm_empty_ty>; // { }*
def llvm_v16i8_ty : LLVMPackedType<v16i8,16, llvm_i8_ty>; // 16 x i8 def llvm_v16i8_ty : LLVMVectorType<v16i8,16, llvm_i8_ty>; // 16 x i8
def llvm_v8i16_ty : LLVMPackedType<v8i16, 8, llvm_i16_ty>; // 8 x i16 def llvm_v8i16_ty : LLVMVectorType<v8i16, 8, llvm_i16_ty>; // 8 x i16
def llvm_v2i64_ty : LLVMPackedType<v2i64, 2, llvm_i64_ty>; // 2 x i64 def llvm_v2i64_ty : LLVMVectorType<v2i64, 2, llvm_i64_ty>; // 2 x i64
def llvm_v2i32_ty : LLVMPackedType<v2i32, 2, llvm_i32_ty>; // 2 x i32 def llvm_v2i32_ty : LLVMVectorType<v2i32, 2, llvm_i32_ty>; // 2 x i32
def llvm_v4i32_ty : LLVMPackedType<v4i32, 4, llvm_i32_ty>; // 4 x i32 def llvm_v4i32_ty : LLVMVectorType<v4i32, 4, llvm_i32_ty>; // 4 x i32
def llvm_v4f32_ty : LLVMPackedType<v4f32, 4, llvm_float_ty>; // 4 x float def llvm_v4f32_ty : LLVMVectorType<v4f32, 4, llvm_float_ty>; // 4 x float
def llvm_v2f64_ty : LLVMPackedType<v2f64, 2, llvm_double_ty>;// 2 x double def llvm_v2f64_ty : LLVMVectorType<v2f64, 2, llvm_double_ty>;// 2 x double
def llvm_vararg_ty : LLVMType<isVoid, "...">; // vararg def llvm_vararg_ty : LLVMType<isVoid, "...">; // vararg

View File

@ -38,7 +38,7 @@ namespace llvm {
class SelectionDAG; class SelectionDAG;
class MachineBasicBlock; class MachineBasicBlock;
class MachineInstr; class MachineInstr;
class PackedType; class VectorType;
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
/// TargetLowering - This class defines information used to lower LLVM code to /// TargetLowering - This class defines information used to lower LLVM code to
@ -198,16 +198,16 @@ public:
return VT; return VT;
} }
/// getPackedTypeBreakdown - Packed types are broken down into some number of /// getVectorTypeBreakdown - Packed types are broken down into some number of
/// legal first class types. For example, <8 x float> maps to 2 MVT::v4f32 /// legal first class types. For example, <8 x float> maps to 2 MVT::v4f32
/// with Altivec or SSE1, or 8 promoted MVT::f64 values with the X86 FP stack. /// with Altivec or SSE1, or 8 promoted MVT::f64 values with the X86 FP stack.
/// Similarly, <2 x long> turns into 4 MVT::i32 values with both PPC and X86. /// Similarly, <2 x long> turns into 4 MVT::i32 values with both PPC and X86.
/// ///
/// This method returns the number of registers needed, and the VT for each /// This method returns the number of registers needed, and the VT for each
/// register. It also returns the VT of the PackedType elements before they /// register. It also returns the VT of the VectorType elements before they
/// are promoted/expanded. /// are promoted/expanded.
/// ///
unsigned getPackedTypeBreakdown(const PackedType *PTy, unsigned getVectorTypeBreakdown(const VectorType *PTy,
MVT::ValueType &PTyElementVT, MVT::ValueType &PTyElementVT,
MVT::ValueType &PTyLegalElementVT) const; MVT::ValueType &PTyLegalElementVT) const;

View File

@ -261,7 +261,7 @@ extern const PassInfo *LowerSwitchID;
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// //
// LowerPacked - This pass converts PackedType operations into low-level scalar // LowerPacked - This pass converts VectorType operations into low-level scalar
// operations. // operations.
// //
FunctionPass *createLowerPackedPass(); FunctionPass *createLowerPackedPass();

View File

@ -81,7 +81,7 @@ public:
ArrayTyID, ///< 8: Arrays ArrayTyID, ///< 8: Arrays
PointerTyID, ///< 9: Pointers PointerTyID, ///< 9: Pointers
OpaqueTyID, ///< 10: Opaque: type with unknown structure OpaqueTyID, ///< 10: Opaque: type with unknown structure
PackedTyID, ///< 11: SIMD 'packed' format, or other vector type VectorTyID, ///< 11: SIMD 'packed' format, or other vector type
NumTypeIDs, // Must remain as last defined ID NumTypeIDs, // Must remain as last defined ID
LastPrimitiveTyID = LabelTyID, LastPrimitiveTyID = LabelTyID,
@ -191,7 +191,7 @@ public:
/// ///
inline bool isFirstClassType() const { inline bool isFirstClassType() const {
return (ID != VoidTyID && ID <= LastPrimitiveTyID) || return (ID != VoidTyID && ID <= LastPrimitiveTyID) ||
ID == IntegerTyID || ID == PointerTyID || ID == PackedTyID; ID == IntegerTyID || ID == PointerTyID || ID == VectorTyID;
} }
/// isSized - Return true if it makes sense to take the size of this type. To /// isSized - Return true if it makes sense to take the size of this type. To
@ -204,7 +204,7 @@ public:
return true; return true;
// If it is not something that can have a size (e.g. a function or label), // If it is not something that can have a size (e.g. a function or label),
// it doesn't have a size. // it doesn't have a size.
if (ID != StructTyID && ID != ArrayTyID && ID != PackedTyID && if (ID != StructTyID && ID != ArrayTyID && ID != VectorTyID &&
ID != PackedStructTyID) ID != PackedStructTyID)
return false; return false;
// If it is something that can have a size and it's concrete, it definitely // If it is something that can have a size and it's concrete, it definitely

View File

@ -167,7 +167,7 @@ public:
ConstantFPVal, // This is an instance of ConstantFP ConstantFPVal, // This is an instance of ConstantFP
ConstantArrayVal, // This is an instance of ConstantArray ConstantArrayVal, // This is an instance of ConstantArray
ConstantStructVal, // This is an instance of ConstantStruct ConstantStructVal, // This is an instance of ConstantStruct
ConstantPackedVal, // This is an instance of ConstantPacked ConstantVectorVal, // This is an instance of ConstantPacked
ConstantPointerNullVal, // This is an instance of ConstantPointerNull ConstantPointerNullVal, // This is an instance of ConstantPointerNull
InlineAsmVal, // This is an instance of InlineAsm InlineAsmVal, // This is an instance of InlineAsm
InstructionVal, // This is an instance of Instruction InstructionVal, // This is an instance of Instruction

View File

@ -689,7 +689,7 @@ BasicAliasAnalysis::CheckGEPInstructions(
if (const ArrayType *AT = dyn_cast<ArrayType>(BasePtr1Ty)) { if (const ArrayType *AT = dyn_cast<ArrayType>(BasePtr1Ty)) {
if (Op1C->getZExtValue() >= AT->getNumElements()) if (Op1C->getZExtValue() >= AT->getNumElements())
return MayAlias; // Be conservative with out-of-range accesses return MayAlias; // Be conservative with out-of-range accesses
} else if (const PackedType *PT = dyn_cast<PackedType>(BasePtr1Ty)) { } else if (const VectorType *PT = dyn_cast<VectorType>(BasePtr1Ty)) {
if (Op1C->getZExtValue() >= PT->getNumElements()) if (Op1C->getZExtValue() >= PT->getNumElements())
return MayAlias; // Be conservative with out-of-range accesses return MayAlias; // Be conservative with out-of-range accesses
} }
@ -707,7 +707,7 @@ BasicAliasAnalysis::CheckGEPInstructions(
// //
if (const ArrayType *AT = dyn_cast<ArrayType>(BasePtr1Ty)) if (const ArrayType *AT = dyn_cast<ArrayType>(BasePtr1Ty))
GEP1Ops[i] = ConstantInt::get(Type::Int64Ty,AT->getNumElements()-1); GEP1Ops[i] = ConstantInt::get(Type::Int64Ty,AT->getNumElements()-1);
else if (const PackedType *PT = dyn_cast<PackedType>(BasePtr1Ty)) else if (const VectorType *PT = dyn_cast<VectorType>(BasePtr1Ty))
GEP1Ops[i] = ConstantInt::get(Type::Int64Ty,PT->getNumElements()-1); GEP1Ops[i] = ConstantInt::get(Type::Int64Ty,PT->getNumElements()-1);
} }
@ -719,7 +719,7 @@ BasicAliasAnalysis::CheckGEPInstructions(
if (const ArrayType *AT = dyn_cast<ArrayType>(BasePtr1Ty)) { if (const ArrayType *AT = dyn_cast<ArrayType>(BasePtr1Ty)) {
if (Op2C->getZExtValue() >= AT->getNumElements()) if (Op2C->getZExtValue() >= AT->getNumElements())
return MayAlias; // Be conservative with out-of-range accesses return MayAlias; // Be conservative with out-of-range accesses
} else if (const PackedType *PT = dyn_cast<PackedType>(BasePtr1Ty)) { } else if (const VectorType *PT = dyn_cast<VectorType>(BasePtr1Ty)) {
if (Op2C->getZExtValue() >= PT->getNumElements()) if (Op2C->getZExtValue() >= PT->getNumElements())
return MayAlias; // Be conservative with out-of-range accesses return MayAlias; // Be conservative with out-of-range accesses
} }

View File

@ -283,10 +283,10 @@ Constant *llvm::ConstantFoldLoadThroughGEPConstantExpr(Constant *C,
C = UndefValue::get(ATy->getElementType()); C = UndefValue::get(ATy->getElementType());
else else
return 0; return 0;
} else if (const PackedType *PTy = dyn_cast<PackedType>(*I)) { } else if (const VectorType *PTy = dyn_cast<VectorType>(*I)) {
if (CI->getZExtValue() >= PTy->getNumElements()) if (CI->getZExtValue() >= PTy->getNumElements())
return 0; return 0;
if (ConstantPacked *CP = dyn_cast<ConstantPacked>(C)) if (ConstantVector *CP = dyn_cast<ConstantVector>(C))
C = CP->getOperand(CI->getZExtValue()); C = CP->getOperand(CI->getZExtValue());
else if (isa<ConstantAggregateZero>(C)) else if (isa<ConstantAggregateZero>(C))
C = Constant::getNullValue(PTy->getElementType()); C = Constant::getNullValue(PTy->getElementType());

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,302 @@
typedef union { /* A Bison parser, made by GNU Bison 2.1. */
/* Skeleton parser for Yacc-like parsing with Bison,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction.
This special exception was added by the Free Software Foundation
in version 1.24 of Bison. */
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
ESINT64VAL = 258,
EUINT64VAL = 259,
LOCALVAL_ID = 260,
GLOBALVAL_ID = 261,
FPVAL = 262,
VOID = 263,
INTTYPE = 264,
FLOAT = 265,
DOUBLE = 266,
LABEL = 267,
TYPE = 268,
LOCALVAR = 269,
GLOBALVAR = 270,
LABELSTR = 271,
STRINGCONSTANT = 272,
ATSTRINGCONSTANT = 273,
IMPLEMENTATION = 274,
ZEROINITIALIZER = 275,
TRUETOK = 276,
FALSETOK = 277,
BEGINTOK = 278,
ENDTOK = 279,
DECLARE = 280,
DEFINE = 281,
GLOBAL = 282,
CONSTANT = 283,
SECTION = 284,
VOLATILE = 285,
TO = 286,
DOTDOTDOT = 287,
NULL_TOK = 288,
UNDEF = 289,
INTERNAL = 290,
LINKONCE = 291,
WEAK = 292,
APPENDING = 293,
DLLIMPORT = 294,
DLLEXPORT = 295,
EXTERN_WEAK = 296,
OPAQUE = 297,
EXTERNAL = 298,
TARGET = 299,
TRIPLE = 300,
ALIGN = 301,
DEPLIBS = 302,
CALL = 303,
TAIL = 304,
ASM_TOK = 305,
MODULE = 306,
SIDEEFFECT = 307,
CC_TOK = 308,
CCC_TOK = 309,
FASTCC_TOK = 310,
COLDCC_TOK = 311,
X86_STDCALLCC_TOK = 312,
X86_FASTCALLCC_TOK = 313,
DATALAYOUT = 314,
RET = 315,
BR = 316,
SWITCH = 317,
INVOKE = 318,
UNWIND = 319,
UNREACHABLE = 320,
ADD = 321,
SUB = 322,
MUL = 323,
UDIV = 324,
SDIV = 325,
FDIV = 326,
UREM = 327,
SREM = 328,
FREM = 329,
AND = 330,
OR = 331,
XOR = 332,
SHL = 333,
LSHR = 334,
ASHR = 335,
ICMP = 336,
FCMP = 337,
EQ = 338,
NE = 339,
SLT = 340,
SGT = 341,
SLE = 342,
SGE = 343,
ULT = 344,
UGT = 345,
ULE = 346,
UGE = 347,
OEQ = 348,
ONE = 349,
OLT = 350,
OGT = 351,
OLE = 352,
OGE = 353,
ORD = 354,
UNO = 355,
UEQ = 356,
UNE = 357,
MALLOC = 358,
ALLOCA = 359,
FREE = 360,
LOAD = 361,
STORE = 362,
GETELEMENTPTR = 363,
TRUNC = 364,
ZEXT = 365,
SEXT = 366,
FPTRUNC = 367,
FPEXT = 368,
BITCAST = 369,
UITOFP = 370,
SITOFP = 371,
FPTOUI = 372,
FPTOSI = 373,
INTTOPTR = 374,
PTRTOINT = 375,
PHI_TOK = 376,
SELECT = 377,
VAARG = 378,
EXTRACTELEMENT = 379,
INSERTELEMENT = 380,
SHUFFLEVECTOR = 381,
NORETURN = 382,
INREG = 383,
SRET = 384,
DEFAULT = 385,
HIDDEN = 386
};
#endif
/* Tokens. */
#define ESINT64VAL 258
#define EUINT64VAL 259
#define LOCALVAL_ID 260
#define GLOBALVAL_ID 261
#define FPVAL 262
#define VOID 263
#define INTTYPE 264
#define FLOAT 265
#define DOUBLE 266
#define LABEL 267
#define TYPE 268
#define LOCALVAR 269
#define GLOBALVAR 270
#define LABELSTR 271
#define STRINGCONSTANT 272
#define ATSTRINGCONSTANT 273
#define IMPLEMENTATION 274
#define ZEROINITIALIZER 275
#define TRUETOK 276
#define FALSETOK 277
#define BEGINTOK 278
#define ENDTOK 279
#define DECLARE 280
#define DEFINE 281
#define GLOBAL 282
#define CONSTANT 283
#define SECTION 284
#define VOLATILE 285
#define TO 286
#define DOTDOTDOT 287
#define NULL_TOK 288
#define UNDEF 289
#define INTERNAL 290
#define LINKONCE 291
#define WEAK 292
#define APPENDING 293
#define DLLIMPORT 294
#define DLLEXPORT 295
#define EXTERN_WEAK 296
#define OPAQUE 297
#define EXTERNAL 298
#define TARGET 299
#define TRIPLE 300
#define ALIGN 301
#define DEPLIBS 302
#define CALL 303
#define TAIL 304
#define ASM_TOK 305
#define MODULE 306
#define SIDEEFFECT 307
#define CC_TOK 308
#define CCC_TOK 309
#define FASTCC_TOK 310
#define COLDCC_TOK 311
#define X86_STDCALLCC_TOK 312
#define X86_FASTCALLCC_TOK 313
#define DATALAYOUT 314
#define RET 315
#define BR 316
#define SWITCH 317
#define INVOKE 318
#define UNWIND 319
#define UNREACHABLE 320
#define ADD 321
#define SUB 322
#define MUL 323
#define UDIV 324
#define SDIV 325
#define FDIV 326
#define UREM 327
#define SREM 328
#define FREM 329
#define AND 330
#define OR 331
#define XOR 332
#define SHL 333
#define LSHR 334
#define ASHR 335
#define ICMP 336
#define FCMP 337
#define EQ 338
#define NE 339
#define SLT 340
#define SGT 341
#define SLE 342
#define SGE 343
#define ULT 344
#define UGT 345
#define ULE 346
#define UGE 347
#define OEQ 348
#define ONE 349
#define OLT 350
#define OGT 351
#define OLE 352
#define OGE 353
#define ORD 354
#define UNO 355
#define UEQ 356
#define UNE 357
#define MALLOC 358
#define ALLOCA 359
#define FREE 360
#define LOAD 361
#define STORE 362
#define GETELEMENTPTR 363
#define TRUNC 364
#define ZEXT 365
#define SEXT 366
#define FPTRUNC 367
#define FPEXT 368
#define BITCAST 369
#define UITOFP 370
#define SITOFP 371
#define FPTOUI 372
#define FPTOSI 373
#define INTTOPTR 374
#define PTRTOINT 375
#define PHI_TOK 376
#define SELECT 377
#define VAARG 378
#define EXTRACTELEMENT 379
#define INSERTELEMENT 380
#define SHUFFLEVECTOR 381
#define NORETURN 382
#define INREG 383
#define SRET 384
#define DEFAULT 385
#define HIDDEN 386
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
#line 901 "/proj/llvm/llvm-1/lib/AsmParser/llvmAsmParser.y"
typedef union YYSTYPE {
llvm::Module *ModuleVal; llvm::Module *ModuleVal;
llvm::Function *FunctionVal; llvm::Function *FunctionVal;
llvm::BasicBlock *BasicBlockVal; llvm::BasicBlock *BasicBlockVal;
@ -43,135 +341,14 @@ typedef union {
llvm::ICmpInst::Predicate IPredicate; llvm::ICmpInst::Predicate IPredicate;
llvm::FCmpInst::Predicate FPredicate; llvm::FCmpInst::Predicate FPredicate;
} YYSTYPE; } YYSTYPE;
#define ESINT64VAL 257 /* Line 1447 of yacc.c. */
#define EUINT64VAL 258 #line 346 "llvmAsmParser.tab.h"
#define LOCALVAL_ID 259 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
#define GLOBALVAL_ID 260 # define YYSTYPE_IS_DECLARED 1
#define FPVAL 261 # define YYSTYPE_IS_TRIVIAL 1
#define VOID 262 #endif
#define INTTYPE 263
#define FLOAT 264
#define DOUBLE 265
#define LABEL 266
#define TYPE 267
#define LOCALVAR 268
#define GLOBALVAR 269
#define LABELSTR 270
#define STRINGCONSTANT 271
#define ATSTRINGCONSTANT 272
#define IMPLEMENTATION 273
#define ZEROINITIALIZER 274
#define TRUETOK 275
#define FALSETOK 276
#define BEGINTOK 277
#define ENDTOK 278
#define DECLARE 279
#define DEFINE 280
#define GLOBAL 281
#define CONSTANT 282
#define SECTION 283
#define VOLATILE 284
#define TO 285
#define DOTDOTDOT 286
#define NULL_TOK 287
#define UNDEF 288
#define INTERNAL 289
#define LINKONCE 290
#define WEAK 291
#define APPENDING 292
#define DLLIMPORT 293
#define DLLEXPORT 294
#define EXTERN_WEAK 295
#define OPAQUE 296
#define EXTERNAL 297
#define TARGET 298
#define TRIPLE 299
#define ALIGN 300
#define DEPLIBS 301
#define CALL 302
#define TAIL 303
#define ASM_TOK 304
#define MODULE 305
#define SIDEEFFECT 306
#define CC_TOK 307
#define CCC_TOK 308
#define FASTCC_TOK 309
#define COLDCC_TOK 310
#define X86_STDCALLCC_TOK 311
#define X86_FASTCALLCC_TOK 312
#define DATALAYOUT 313
#define RET 314
#define BR 315
#define SWITCH 316
#define INVOKE 317
#define UNWIND 318
#define UNREACHABLE 319
#define ADD 320
#define SUB 321
#define MUL 322
#define UDIV 323
#define SDIV 324
#define FDIV 325
#define UREM 326
#define SREM 327
#define FREM 328
#define AND 329
#define OR 330
#define XOR 331
#define SHL 332
#define LSHR 333
#define ASHR 334
#define ICMP 335
#define FCMP 336
#define EQ 337
#define NE 338
#define SLT 339
#define SGT 340
#define SLE 341
#define SGE 342
#define ULT 343
#define UGT 344
#define ULE 345
#define UGE 346
#define OEQ 347
#define ONE 348
#define OLT 349
#define OGT 350
#define OLE 351
#define OGE 352
#define ORD 353
#define UNO 354
#define UEQ 355
#define UNE 356
#define MALLOC 357
#define ALLOCA 358
#define FREE 359
#define LOAD 360
#define STORE 361
#define GETELEMENTPTR 362
#define TRUNC 363
#define ZEXT 364
#define SEXT 365
#define FPTRUNC 366
#define FPEXT 367
#define BITCAST 368
#define UITOFP 369
#define SITOFP 370
#define FPTOUI 371
#define FPTOSI 372
#define INTTOPTR 373
#define PTRTOINT 374
#define PHI_TOK 375
#define SELECT 376
#define VAARG 377
#define EXTRACTELEMENT 378
#define INSERTELEMENT 379
#define SHUFFLEVECTOR 380
#define NORETURN 381
#define INREG 382
#define SRET 383
#define DEFAULT 384
#define HIDDEN 385
extern YYSTYPE llvmAsmlval; extern YYSTYPE llvmAsmlval;

View File

@ -1297,10 +1297,10 @@ Types
if ((unsigned)$2 != $2) if ((unsigned)$2 != $2)
GEN_ERROR("Unsigned result not equal to signed result"); GEN_ERROR("Unsigned result not equal to signed result");
if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger()) if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
GEN_ERROR("Element type of a PackedType must be primitive"); GEN_ERROR("Element type of a VectorType must be primitive");
if (!isPowerOf2_32($2)) if (!isPowerOf2_32($2))
GEN_ERROR("Vector length should be a power of 2"); GEN_ERROR("Vector length should be a power of 2");
$$ = new PATypeHolder(HandleUpRefs(PackedType::get(*$4, (unsigned)$2))); $$ = new PATypeHolder(HandleUpRefs(VectorType::get(*$4, (unsigned)$2)));
delete $4; delete $4;
CHECK_FOR_ERROR CHECK_FOR_ERROR
} }
@ -1481,7 +1481,7 @@ ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr
| Types '<' ConstVector '>' { // Nonempty unsized arr | Types '<' ConstVector '>' { // Nonempty unsized arr
if (!UpRefs.empty()) if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*$1)->getDescription()); GEN_ERROR("Invalid upreference in type: " + (*$1)->getDescription());
const PackedType *PTy = dyn_cast<PackedType>($1->get()); const VectorType *PTy = dyn_cast<VectorType>($1->get());
if (PTy == 0) if (PTy == 0)
GEN_ERROR("Cannot make packed constant with type: '" + GEN_ERROR("Cannot make packed constant with type: '" +
(*$1)->getDescription() + "'"); (*$1)->getDescription() + "'");
@ -1502,7 +1502,7 @@ ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr
(*$3)[i]->getType()->getDescription() + "'."); (*$3)[i]->getType()->getDescription() + "'.");
} }
$$ = ConstantPacked::get(PTy, *$3); $$ = ConstantVector::get(PTy, *$3);
delete $1; delete $3; delete $1; delete $3;
CHECK_FOR_ERROR CHECK_FOR_ERROR
} }
@ -1781,8 +1781,8 @@ ConstExpr: CastOps '(' ConstVal TO Types ')' {
if ($3->getType() != $5->getType()) if ($3->getType() != $5->getType())
GEN_ERROR("Logical operator types must match"); GEN_ERROR("Logical operator types must match");
if (!$3->getType()->isInteger()) { if (!$3->getType()->isInteger()) {
if (Instruction::isShift($1) || !isa<PackedType>($3->getType()) || if (Instruction::isShift($1) || !isa<VectorType>($3->getType()) ||
!cast<PackedType>($3->getType())->getElementType()->isInteger()) !cast<VectorType>($3->getType())->getElementType()->isInteger())
GEN_ERROR("Logical operator requires integral operands"); GEN_ERROR("Logical operator requires integral operands");
} }
$$ = ConstantExpr::get($1, $3, $5); $$ = ConstantExpr::get($1, $3, $5);
@ -2232,10 +2232,10 @@ ConstValueRef : ESINT64VAL { // A reference to a direct constant
const Type *ETy = (*$2)[0]->getType(); const Type *ETy = (*$2)[0]->getType();
int NumElements = $2->size(); int NumElements = $2->size();
PackedType* pt = PackedType::get(ETy, NumElements); VectorType* pt = VectorType::get(ETy, NumElements);
PATypeHolder* PTy = new PATypeHolder( PATypeHolder* PTy = new PATypeHolder(
HandleUpRefs( HandleUpRefs(
PackedType::get( VectorType::get(
ETy, ETy,
NumElements) NumElements)
) )
@ -2249,7 +2249,7 @@ ConstValueRef : ESINT64VAL { // A reference to a direct constant
(*$2)[i]->getType()->getDescription() + "'."); (*$2)[i]->getType()->getDescription() + "'.");
} }
$$ = ValID::create(ConstantPacked::get(pt, *$2)); $$ = ValID::create(ConstantVector::get(pt, *$2));
delete PTy; delete $2; delete PTy; delete $2;
CHECK_FOR_ERROR CHECK_FOR_ERROR
} }
@ -2585,10 +2585,10 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
if (!UpRefs.empty()) if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*$2)->getDescription()); GEN_ERROR("Invalid upreference in type: " + (*$2)->getDescription());
if (!(*$2)->isInteger() && !(*$2)->isFloatingPoint() && if (!(*$2)->isInteger() && !(*$2)->isFloatingPoint() &&
!isa<PackedType>((*$2).get())) !isa<VectorType>((*$2).get()))
GEN_ERROR( GEN_ERROR(
"Arithmetic operator requires integer, FP, or packed operands"); "Arithmetic operator requires integer, FP, or packed operands");
if (isa<PackedType>((*$2).get()) && if (isa<VectorType>((*$2).get()) &&
($1 == Instruction::URem || ($1 == Instruction::URem ||
$1 == Instruction::SRem || $1 == Instruction::SRem ||
$1 == Instruction::FRem)) $1 == Instruction::FRem))
@ -2606,8 +2606,8 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
if (!UpRefs.empty()) if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*$2)->getDescription()); GEN_ERROR("Invalid upreference in type: " + (*$2)->getDescription());
if (!(*$2)->isInteger()) { if (!(*$2)->isInteger()) {
if (Instruction::isShift($1) || !isa<PackedType>($2->get()) || if (Instruction::isShift($1) || !isa<VectorType>($2->get()) ||
!cast<PackedType>($2->get())->getElementType()->isInteger()) !cast<VectorType>($2->get())->getElementType()->isInteger())
GEN_ERROR("Logical operator requires integral operands"); GEN_ERROR("Logical operator requires integral operands");
} }
Value* tmpVal1 = getVal(*$2, $3); Value* tmpVal1 = getVal(*$2, $3);
@ -2622,7 +2622,7 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
| ICMP IPredicates Types ValueRef ',' ValueRef { | ICMP IPredicates Types ValueRef ',' ValueRef {
if (!UpRefs.empty()) if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*$3)->getDescription()); GEN_ERROR("Invalid upreference in type: " + (*$3)->getDescription());
if (isa<PackedType>((*$3).get())) if (isa<VectorType>((*$3).get()))
GEN_ERROR("Packed types not supported by icmp instruction"); GEN_ERROR("Packed types not supported by icmp instruction");
Value* tmpVal1 = getVal(*$3, $4); Value* tmpVal1 = getVal(*$3, $4);
CHECK_FOR_ERROR CHECK_FOR_ERROR
@ -2635,7 +2635,7 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
| FCMP FPredicates Types ValueRef ',' ValueRef { | FCMP FPredicates Types ValueRef ',' ValueRef {
if (!UpRefs.empty()) if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*$3)->getDescription()); GEN_ERROR("Invalid upreference in type: " + (*$3)->getDescription());
if (isa<PackedType>((*$3).get())) if (isa<VectorType>((*$3).get()))
GEN_ERROR("Packed types not supported by fcmp instruction"); GEN_ERROR("Packed types not supported by fcmp instruction");
Value* tmpVal1 = getVal(*$3, $4); Value* tmpVal1 = getVal(*$3, $4);
CHECK_FOR_ERROR CHECK_FOR_ERROR

View File

@ -1297,10 +1297,10 @@ Types
if ((unsigned)$2 != $2) if ((unsigned)$2 != $2)
GEN_ERROR("Unsigned result not equal to signed result"); GEN_ERROR("Unsigned result not equal to signed result");
if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger()) if (!ElemTy->isFloatingPoint() && !ElemTy->isInteger())
GEN_ERROR("Element type of a PackedType must be primitive"); GEN_ERROR("Element type of a VectorType must be primitive");
if (!isPowerOf2_32($2)) if (!isPowerOf2_32($2))
GEN_ERROR("Vector length should be a power of 2"); GEN_ERROR("Vector length should be a power of 2");
$$ = new PATypeHolder(HandleUpRefs(PackedType::get(*$4, (unsigned)$2))); $$ = new PATypeHolder(HandleUpRefs(VectorType::get(*$4, (unsigned)$2)));
delete $4; delete $4;
CHECK_FOR_ERROR CHECK_FOR_ERROR
} }
@ -1481,7 +1481,7 @@ ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr
| Types '<' ConstVector '>' { // Nonempty unsized arr | Types '<' ConstVector '>' { // Nonempty unsized arr
if (!UpRefs.empty()) if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*$1)->getDescription()); GEN_ERROR("Invalid upreference in type: " + (*$1)->getDescription());
const PackedType *PTy = dyn_cast<PackedType>($1->get()); const VectorType *PTy = dyn_cast<VectorType>($1->get());
if (PTy == 0) if (PTy == 0)
GEN_ERROR("Cannot make packed constant with type: '" + GEN_ERROR("Cannot make packed constant with type: '" +
(*$1)->getDescription() + "'"); (*$1)->getDescription() + "'");
@ -1502,7 +1502,7 @@ ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr
(*$3)[i]->getType()->getDescription() + "'."); (*$3)[i]->getType()->getDescription() + "'.");
} }
$$ = ConstantPacked::get(PTy, *$3); $$ = ConstantVector::get(PTy, *$3);
delete $1; delete $3; delete $1; delete $3;
CHECK_FOR_ERROR CHECK_FOR_ERROR
} }
@ -1781,8 +1781,8 @@ ConstExpr: CastOps '(' ConstVal TO Types ')' {
if ($3->getType() != $5->getType()) if ($3->getType() != $5->getType())
GEN_ERROR("Logical operator types must match"); GEN_ERROR("Logical operator types must match");
if (!$3->getType()->isInteger()) { if (!$3->getType()->isInteger()) {
if (Instruction::isShift($1) || !isa<PackedType>($3->getType()) || if (Instruction::isShift($1) || !isa<VectorType>($3->getType()) ||
!cast<PackedType>($3->getType())->getElementType()->isInteger()) !cast<VectorType>($3->getType())->getElementType()->isInteger())
GEN_ERROR("Logical operator requires integral operands"); GEN_ERROR("Logical operator requires integral operands");
} }
$$ = ConstantExpr::get($1, $3, $5); $$ = ConstantExpr::get($1, $3, $5);
@ -2232,10 +2232,10 @@ ConstValueRef : ESINT64VAL { // A reference to a direct constant
const Type *ETy = (*$2)[0]->getType(); const Type *ETy = (*$2)[0]->getType();
int NumElements = $2->size(); int NumElements = $2->size();
PackedType* pt = PackedType::get(ETy, NumElements); VectorType* pt = VectorType::get(ETy, NumElements);
PATypeHolder* PTy = new PATypeHolder( PATypeHolder* PTy = new PATypeHolder(
HandleUpRefs( HandleUpRefs(
PackedType::get( VectorType::get(
ETy, ETy,
NumElements) NumElements)
) )
@ -2249,7 +2249,7 @@ ConstValueRef : ESINT64VAL { // A reference to a direct constant
(*$2)[i]->getType()->getDescription() + "'."); (*$2)[i]->getType()->getDescription() + "'.");
} }
$$ = ValID::create(ConstantPacked::get(pt, *$2)); $$ = ValID::create(ConstantVector::get(pt, *$2));
delete PTy; delete $2; delete PTy; delete $2;
CHECK_FOR_ERROR CHECK_FOR_ERROR
} }
@ -2585,10 +2585,10 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
if (!UpRefs.empty()) if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*$2)->getDescription()); GEN_ERROR("Invalid upreference in type: " + (*$2)->getDescription());
if (!(*$2)->isInteger() && !(*$2)->isFloatingPoint() && if (!(*$2)->isInteger() && !(*$2)->isFloatingPoint() &&
!isa<PackedType>((*$2).get())) !isa<VectorType>((*$2).get()))
GEN_ERROR( GEN_ERROR(
"Arithmetic operator requires integer, FP, or packed operands"); "Arithmetic operator requires integer, FP, or packed operands");
if (isa<PackedType>((*$2).get()) && if (isa<VectorType>((*$2).get()) &&
($1 == Instruction::URem || ($1 == Instruction::URem ||
$1 == Instruction::SRem || $1 == Instruction::SRem ||
$1 == Instruction::FRem)) $1 == Instruction::FRem))
@ -2606,8 +2606,8 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
if (!UpRefs.empty()) if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*$2)->getDescription()); GEN_ERROR("Invalid upreference in type: " + (*$2)->getDescription());
if (!(*$2)->isInteger()) { if (!(*$2)->isInteger()) {
if (Instruction::isShift($1) || !isa<PackedType>($2->get()) || if (Instruction::isShift($1) || !isa<VectorType>($2->get()) ||
!cast<PackedType>($2->get())->getElementType()->isInteger()) !cast<VectorType>($2->get())->getElementType()->isInteger())
GEN_ERROR("Logical operator requires integral operands"); GEN_ERROR("Logical operator requires integral operands");
} }
Value* tmpVal1 = getVal(*$2, $3); Value* tmpVal1 = getVal(*$2, $3);
@ -2622,7 +2622,7 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
| ICMP IPredicates Types ValueRef ',' ValueRef { | ICMP IPredicates Types ValueRef ',' ValueRef {
if (!UpRefs.empty()) if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*$3)->getDescription()); GEN_ERROR("Invalid upreference in type: " + (*$3)->getDescription());
if (isa<PackedType>((*$3).get())) if (isa<VectorType>((*$3).get()))
GEN_ERROR("Packed types not supported by icmp instruction"); GEN_ERROR("Packed types not supported by icmp instruction");
Value* tmpVal1 = getVal(*$3, $4); Value* tmpVal1 = getVal(*$3, $4);
CHECK_FOR_ERROR CHECK_FOR_ERROR
@ -2635,7 +2635,7 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef {
| FCMP FPredicates Types ValueRef ',' ValueRef { | FCMP FPredicates Types ValueRef ',' ValueRef {
if (!UpRefs.empty()) if (!UpRefs.empty())
GEN_ERROR("Invalid upreference in type: " + (*$3)->getDescription()); GEN_ERROR("Invalid upreference in type: " + (*$3)->getDescription());
if (isa<PackedType>((*$3).get())) if (isa<VectorType>((*$3).get()))
GEN_ERROR("Packed types not supported by fcmp instruction"); GEN_ERROR("Packed types not supported by fcmp instruction");
Value* tmpVal1 = getVal(*$3, $4); Value* tmpVal1 = getVal(*$3, $4);
CHECK_FOR_ERROR CHECK_FOR_ERROR

View File

@ -423,8 +423,8 @@ public:
bca.numValues++; bca.numValues++;
} }
virtual void handleConstantPacked( virtual void handleConstantVector(
const PackedType* PT, const VectorType* PT,
Constant**Elements, unsigned NumElts, Constant**Elements, unsigned NumElts,
unsigned TypeSlot, unsigned TypeSlot,
Constant* PackedVal) Constant* PackedVal)

View File

@ -482,7 +482,7 @@ void BytecodeReader::ParseInstruction(SmallVector<unsigned, 8> &Oprnds,
break; break;
} }
case Instruction::InsertElement: { case Instruction::InsertElement: {
const PackedType *PackedTy = dyn_cast<PackedType>(InstTy); const VectorType *PackedTy = dyn_cast<VectorType>(InstTy);
if (!PackedTy || Oprnds.size() != 3) if (!PackedTy || Oprnds.size() != 3)
error("Invalid insertelement instruction!"); error("Invalid insertelement instruction!");
@ -496,13 +496,13 @@ void BytecodeReader::ParseInstruction(SmallVector<unsigned, 8> &Oprnds,
break; break;
} }
case Instruction::ShuffleVector: { case Instruction::ShuffleVector: {
const PackedType *PackedTy = dyn_cast<PackedType>(InstTy); const VectorType *PackedTy = dyn_cast<VectorType>(InstTy);
if (!PackedTy || Oprnds.size() != 3) if (!PackedTy || Oprnds.size() != 3)
error("Invalid shufflevector instruction!"); error("Invalid shufflevector instruction!");
Value *V1 = getValue(iType, Oprnds[0]); Value *V1 = getValue(iType, Oprnds[0]);
Value *V2 = getValue(iType, Oprnds[1]); Value *V2 = getValue(iType, Oprnds[1]);
const PackedType *EltTy = const VectorType *EltTy =
PackedType::get(Type::Int32Ty, PackedTy->getNumElements()); VectorType::get(Type::Int32Ty, PackedTy->getNumElements());
Value *V3 = getValue(getTypeSlot(EltTy), Oprnds[2]); Value *V3 = getValue(getTypeSlot(EltTy), Oprnds[2]);
if (!ShuffleVectorInst::isValidOperands(V1, V2, V3)) if (!ShuffleVectorInst::isValidOperands(V1, V2, V3))
error("Invalid shufflevector instruction!"); error("Invalid shufflevector instruction!");
@ -1029,10 +1029,10 @@ const Type *BytecodeReader::ParseType() {
Result = ArrayType::get(ElementType, NumElements); Result = ArrayType::get(ElementType, NumElements);
break; break;
} }
case Type::PackedTyID: { case Type::VectorTyID: {
const Type *ElementType = readType(); const Type *ElementType = readType();
unsigned NumElements = read_vbr_uint(); unsigned NumElements = read_vbr_uint();
Result = PackedType::get(ElementType, NumElements); Result = VectorType::get(ElementType, NumElements);
break; break;
} }
case Type::StructTyID: { case Type::StructTyID: {
@ -1314,8 +1314,8 @@ Value *BytecodeReader::ParseConstantPoolValue(unsigned TypeID) {
break; break;
} }
case Type::PackedTyID: { case Type::VectorTyID: {
const PackedType *PT = cast<PackedType>(Ty); const VectorType *PT = cast<VectorType>(Ty);
unsigned NumElements = PT->getNumElements(); unsigned NumElements = PT->getNumElements();
unsigned TypeSlot = getTypeSlot(PT->getElementType()); unsigned TypeSlot = getTypeSlot(PT->getElementType());
std::vector<Constant*> Elements; std::vector<Constant*> Elements;
@ -1323,8 +1323,8 @@ Value *BytecodeReader::ParseConstantPoolValue(unsigned TypeID) {
while (NumElements--) // Read all of the elements of the constant. while (NumElements--) // Read all of the elements of the constant.
Elements.push_back(getConstantValue(TypeSlot, Elements.push_back(getConstantValue(TypeSlot,
read_vbr_uint())); read_vbr_uint()));
Result = ConstantPacked::get(PT, Elements); Result = ConstantVector::get(PT, Elements);
if (Handler) Handler->handleConstantPacked(PT, &Elements[0],Elements.size(), if (Handler) Handler->handleConstantVector(PT, &Elements[0],Elements.size(),
TypeSlot, Result); TypeSlot, Result);
break; break;
} }

View File

@ -242,8 +242,8 @@ void BytecodeWriter::outputType(const Type *T) {
break; break;
} }
case Type::PackedTyID: { case Type::VectorTyID: {
const PackedType *PT = cast<PackedType>(T); const VectorType *PT = cast<VectorType>(T);
output_typeid(Table.getTypeSlot(PT->getElementType())); output_typeid(Table.getTypeSlot(PT->getElementType()));
output_vbr(PT->getNumElements()); output_vbr(PT->getNumElements());
break; break;
@ -326,8 +326,8 @@ void BytecodeWriter::outputConstant(const Constant *CPV) {
break; break;
} }
case Type::PackedTyID: { case Type::VectorTyID: {
const ConstantPacked *CP = cast<ConstantPacked>(CPV); const ConstantVector *CP = cast<ConstantVector>(CPV);
for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i) for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i)
output_vbr(Table.getSlot(CP->getOperand(i))); output_vbr(Table.getSlot(CP->getOperand(i)));
break; break;

View File

@ -805,8 +805,8 @@ void AsmPrinter::EmitGlobalConstant(const Constant *CV) {
} }
return; return;
} }
} else if (const ConstantPacked *CP = dyn_cast<ConstantPacked>(CV)) { } else if (const ConstantVector *CP = dyn_cast<ConstantVector>(CV)) {
const PackedType *PTy = CP->getType(); const VectorType *PTy = CP->getType();
for (unsigned I = 0, E = PTy->getNumElements(); I < E; ++I) for (unsigned I = 0, E = PTy->getNumElements(); I < E; ++I)
EmitGlobalConstant(CP->getOperand(I)); EmitGlobalConstant(CP->getOperand(I));

View File

@ -769,7 +769,7 @@ void MachOWriter::InitMem(const Constant *C, void *Addr, intptr_t Offset,
if (isa<UndefValue>(PC)) { if (isa<UndefValue>(PC)) {
continue; continue;
} else if (const ConstantPacked *CP = dyn_cast<ConstantPacked>(PC)) { } else if (const ConstantVector *CP = dyn_cast<ConstantVector>(PC)) {
unsigned ElementSize = TD->getTypeSize(CP->getType()->getElementType()); unsigned ElementSize = TD->getTypeSize(CP->getType()->getElementType());
for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i) for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i)
WorkList.push_back(CPair(CP->getOperand(i), PA+i*ElementSize)); WorkList.push_back(CPair(CP->getOperand(i), PA+i*ElementSize));

View File

@ -3874,7 +3874,7 @@ SDOperand SelectionDAGLegalize::ExpandBUILD_VECTOR(SDNode *Node) {
CV.push_back(UndefValue::get(OpNTy)); CV.push_back(UndefValue::get(OpNTy));
} }
} }
Constant *CP = ConstantPacked::get(CV); Constant *CP = ConstantVector::get(CV);
SDOperand CPIdx = DAG.getConstantPool(CP, TLI.getPointerTy()); SDOperand CPIdx = DAG.getConstantPool(CP, TLI.getPointerTy());
return DAG.getLoad(VT, DAG.getEntryNode(), CPIdx, NULL, 0); return DAG.getLoad(VT, DAG.getEntryNode(), CPIdx, NULL, 0);
} }

View File

@ -281,7 +281,7 @@ FunctionLoweringInfo::FunctionLoweringInfo(TargetLowering &tli,
else { else {
MVT::ValueType VT1,VT2; MVT::ValueType VT1,VT2;
NumElements = NumElements =
TLI.getPackedTypeBreakdown(cast<PackedType>(PN->getType()), TLI.getVectorTypeBreakdown(cast<VectorType>(PN->getType()),
VT1, VT2); VT1, VT2);
} }
unsigned PHIReg = ValueMap[PN]; unsigned PHIReg = ValueMap[PN];
@ -306,7 +306,7 @@ unsigned FunctionLoweringInfo::CreateRegForValue(const Value *V) {
// If this is a packed type, figure out what type it will decompose into // If this is a packed type, figure out what type it will decompose into
// and how many of the elements it will use. // and how many of the elements it will use.
if (VT == MVT::Vector) { if (VT == MVT::Vector) {
const PackedType *PTy = cast<PackedType>(V->getType()); const VectorType *PTy = cast<VectorType>(V->getType());
unsigned NumElts = PTy->getNumElements(); unsigned NumElts = PTy->getNumElements();
MVT::ValueType EltTy = TLI.getValueType(PTy->getElementType()); MVT::ValueType EltTy = TLI.getValueType(PTy->getElementType());
@ -504,7 +504,7 @@ public:
void visitEitherBinary(User &I, unsigned ScalarOp, unsigned VectorOp); void visitEitherBinary(User &I, unsigned ScalarOp, unsigned VectorOp);
void visitShift(User &I, unsigned Opcode); void visitShift(User &I, unsigned Opcode);
void visitAdd(User &I) { void visitAdd(User &I) {
if (isa<PackedType>(I.getType())) if (isa<VectorType>(I.getType()))
visitVectorBinary(I, ISD::VADD); visitVectorBinary(I, ISD::VADD);
else if (I.getType()->isFloatingPoint()) else if (I.getType()->isFloatingPoint())
visitScalarBinary(I, ISD::FADD); visitScalarBinary(I, ISD::FADD);
@ -513,7 +513,7 @@ public:
} }
void visitSub(User &I); void visitSub(User &I);
void visitMul(User &I) { void visitMul(User &I) {
if (isa<PackedType>(I.getType())) if (isa<VectorType>(I.getType()))
visitVectorBinary(I, ISD::VMUL); visitVectorBinary(I, ISD::VMUL);
else if (I.getType()->isFloatingPoint()) else if (I.getType()->isFloatingPoint())
visitScalarBinary(I, ISD::FMUL); visitScalarBinary(I, ISD::FMUL);
@ -601,11 +601,11 @@ SDOperand SelectionDAGLowering::getValue(const Value *V) {
} else if (isa<ConstantPointerNull>(C)) { } else if (isa<ConstantPointerNull>(C)) {
return N = DAG.getConstant(0, TLI.getPointerTy()); return N = DAG.getConstant(0, TLI.getPointerTy());
} else if (isa<UndefValue>(C)) { } else if (isa<UndefValue>(C)) {
if (!isa<PackedType>(VTy)) if (!isa<VectorType>(VTy))
return N = DAG.getNode(ISD::UNDEF, VT); return N = DAG.getNode(ISD::UNDEF, VT);
// Create a VBUILD_VECTOR of undef nodes. // Create a VBUILD_VECTOR of undef nodes.
const PackedType *PTy = cast<PackedType>(VTy); const VectorType *PTy = cast<VectorType>(VTy);
unsigned NumElements = PTy->getNumElements(); unsigned NumElements = PTy->getNumElements();
MVT::ValueType PVT = TLI.getValueType(PTy->getElementType()); MVT::ValueType PVT = TLI.getValueType(PTy->getElementType());
@ -619,7 +619,7 @@ SDOperand SelectionDAGLowering::getValue(const Value *V) {
&Ops[0], Ops.size()); &Ops[0], Ops.size());
} else if (ConstantFP *CFP = dyn_cast<ConstantFP>(C)) { } else if (ConstantFP *CFP = dyn_cast<ConstantFP>(C)) {
return N = DAG.getConstantFP(CFP->getValue(), VT); return N = DAG.getConstantFP(CFP->getValue(), VT);
} else if (const PackedType *PTy = dyn_cast<PackedType>(VTy)) { } else if (const VectorType *PTy = dyn_cast<VectorType>(VTy)) {
unsigned NumElements = PTy->getNumElements(); unsigned NumElements = PTy->getNumElements();
MVT::ValueType PVT = TLI.getValueType(PTy->getElementType()); MVT::ValueType PVT = TLI.getValueType(PTy->getElementType());
@ -627,7 +627,7 @@ SDOperand SelectionDAGLowering::getValue(const Value *V) {
// Constant or ConstantFP node onto the ops list for each element of // Constant or ConstantFP node onto the ops list for each element of
// the packed constant. // the packed constant.
SmallVector<SDOperand, 8> Ops; SmallVector<SDOperand, 8> Ops;
if (ConstantPacked *CP = dyn_cast<ConstantPacked>(C)) { if (ConstantVector *CP = dyn_cast<ConstantVector>(C)) {
for (unsigned i = 0; i != NumElements; ++i) for (unsigned i = 0; i != NumElements; ++i)
Ops.push_back(getValue(CP->getOperand(i))); Ops.push_back(getValue(CP->getOperand(i)));
} else { } else {
@ -691,8 +691,8 @@ SDOperand SelectionDAGLowering::getValue(const Value *V) {
// Otherwise, if this is a vector, make it available as a generic vector // Otherwise, if this is a vector, make it available as a generic vector
// here. // here.
MVT::ValueType PTyElementVT, PTyLegalElementVT; MVT::ValueType PTyElementVT, PTyLegalElementVT;
const PackedType *PTy = cast<PackedType>(VTy); const VectorType *PTy = cast<VectorType>(VTy);
unsigned NE = TLI.getPackedTypeBreakdown(PTy, PTyElementVT, unsigned NE = TLI.getVectorTypeBreakdown(PTy, PTyElementVT,
PTyLegalElementVT); PTyLegalElementVT);
// Build a VBUILD_VECTOR with the input registers. // Build a VBUILD_VECTOR with the input registers.
@ -1377,7 +1377,7 @@ void SelectionDAGLowering::visitSwitch(SwitchInst &I) {
void SelectionDAGLowering::visitSub(User &I) { void SelectionDAGLowering::visitSub(User &I) {
// -0.0 - X --> fneg // -0.0 - X --> fneg
const Type *Ty = I.getType(); const Type *Ty = I.getType();
if (isa<PackedType>(Ty)) { if (isa<VectorType>(Ty)) {
visitVectorBinary(I, ISD::VSUB); visitVectorBinary(I, ISD::VSUB);
} else if (Ty->isFloatingPoint()) { } else if (Ty->isFloatingPoint()) {
if (ConstantFP *CFP = dyn_cast<ConstantFP>(I.getOperand(0))) if (ConstantFP *CFP = dyn_cast<ConstantFP>(I.getOperand(0)))
@ -1400,8 +1400,8 @@ void SelectionDAGLowering::visitScalarBinary(User &I, unsigned OpCode) {
void void
SelectionDAGLowering::visitVectorBinary(User &I, unsigned OpCode) { SelectionDAGLowering::visitVectorBinary(User &I, unsigned OpCode) {
assert(isa<PackedType>(I.getType())); assert(isa<VectorType>(I.getType()));
const PackedType *Ty = cast<PackedType>(I.getType()); const VectorType *Ty = cast<VectorType>(I.getType());
SDOperand Typ = DAG.getValueType(TLI.getValueType(Ty->getElementType())); SDOperand Typ = DAG.getValueType(TLI.getValueType(Ty->getElementType()));
setValue(&I, DAG.getNode(OpCode, MVT::Vector, setValue(&I, DAG.getNode(OpCode, MVT::Vector,
@ -1413,7 +1413,7 @@ SelectionDAGLowering::visitVectorBinary(User &I, unsigned OpCode) {
void SelectionDAGLowering::visitEitherBinary(User &I, unsigned ScalarOp, void SelectionDAGLowering::visitEitherBinary(User &I, unsigned ScalarOp,
unsigned VectorOp) { unsigned VectorOp) {
if (isa<PackedType>(I.getType())) if (isa<VectorType>(I.getType()))
visitVectorBinary(I, VectorOp); visitVectorBinary(I, VectorOp);
else else
visitScalarBinary(I, ScalarOp); visitScalarBinary(I, ScalarOp);
@ -1501,7 +1501,7 @@ void SelectionDAGLowering::visitSelect(User &I) {
SDOperand Cond = getValue(I.getOperand(0)); SDOperand Cond = getValue(I.getOperand(0));
SDOperand TrueVal = getValue(I.getOperand(1)); SDOperand TrueVal = getValue(I.getOperand(1));
SDOperand FalseVal = getValue(I.getOperand(2)); SDOperand FalseVal = getValue(I.getOperand(2));
if (!isa<PackedType>(I.getType())) { if (!isa<VectorType>(I.getType())) {
setValue(&I, DAG.getNode(ISD::SELECT, TrueVal.getValueType(), Cond, setValue(&I, DAG.getNode(ISD::SELECT, TrueVal.getValueType(), Cond,
TrueVal, FalseVal)); TrueVal, FalseVal));
} else { } else {
@ -1611,7 +1611,7 @@ void SelectionDAGLowering::visitBitCast(User &I) {
if (DestVT == MVT::Vector) { if (DestVT == MVT::Vector) {
// This is a cast to a vector from something else. // This is a cast to a vector from something else.
// Get information about the output vector. // Get information about the output vector.
const PackedType *DestTy = cast<PackedType>(I.getType()); const VectorType *DestTy = cast<VectorType>(I.getType());
MVT::ValueType EltVT = TLI.getValueType(DestTy->getElementType()); MVT::ValueType EltVT = TLI.getValueType(DestTy->getElementType());
setValue(&I, DAG.getNode(ISD::VBIT_CONVERT, DestVT, N, setValue(&I, DAG.getNode(ISD::VBIT_CONVERT, DestVT, N,
DAG.getConstant(DestTy->getNumElements(),MVT::i32), DAG.getConstant(DestTy->getNumElements(),MVT::i32),
@ -1793,7 +1793,7 @@ SDOperand SelectionDAGLowering::getLoadFrom(const Type *Ty, SDOperand Ptr,
const Value *SV, SDOperand Root, const Value *SV, SDOperand Root,
bool isVolatile) { bool isVolatile) {
SDOperand L; SDOperand L;
if (const PackedType *PTy = dyn_cast<PackedType>(Ty)) { if (const VectorType *PTy = dyn_cast<VectorType>(Ty)) {
MVT::ValueType PVT = TLI.getValueType(PTy->getElementType()); MVT::ValueType PVT = TLI.getValueType(PTy->getElementType());
L = DAG.getVecLoad(PTy->getNumElements(), PVT, Root, Ptr, L = DAG.getVecLoad(PTy->getNumElements(), PVT, Root, Ptr,
DAG.getSrcValue(SV)); DAG.getSrcValue(SV));
@ -1863,7 +1863,7 @@ void SelectionDAGLowering::visitTargetIntrinsic(CallInst &I,
// If this is a vector type, force it to the right packed type. // If this is a vector type, force it to the right packed type.
if (Op.getValueType() == MVT::Vector) { if (Op.getValueType() == MVT::Vector) {
const PackedType *OpTy = cast<PackedType>(I.getOperand(i)->getType()); const VectorType *OpTy = cast<VectorType>(I.getOperand(i)->getType());
MVT::ValueType EltVT = TLI.getValueType(OpTy->getElementType()); MVT::ValueType EltVT = TLI.getValueType(OpTy->getElementType());
MVT::ValueType VVT = MVT::getVectorType(EltVT, OpTy->getNumElements()); MVT::ValueType VVT = MVT::getVectorType(EltVT, OpTy->getNumElements());
@ -1880,7 +1880,7 @@ void SelectionDAGLowering::visitTargetIntrinsic(CallInst &I,
if (I.getType() != Type::VoidTy) { if (I.getType() != Type::VoidTy) {
MVT::ValueType VT = TLI.getValueType(I.getType()); MVT::ValueType VT = TLI.getValueType(I.getType());
if (VT == MVT::Vector) { if (VT == MVT::Vector) {
const PackedType *DestTy = cast<PackedType>(I.getType()); const VectorType *DestTy = cast<VectorType>(I.getType());
MVT::ValueType EltVT = TLI.getValueType(DestTy->getElementType()); MVT::ValueType EltVT = TLI.getValueType(DestTy->getElementType());
VT = MVT::getVectorType(EltVT, DestTy->getNumElements()); VT = MVT::getVectorType(EltVT, DestTy->getNumElements());
@ -1915,7 +1915,7 @@ void SelectionDAGLowering::visitTargetIntrinsic(CallInst &I,
DAG.setRoot(Chain); DAG.setRoot(Chain);
} }
if (I.getType() != Type::VoidTy) { if (I.getType() != Type::VoidTy) {
if (const PackedType *PTy = dyn_cast<PackedType>(I.getType())) { if (const VectorType *PTy = dyn_cast<VectorType>(I.getType())) {
MVT::ValueType EVT = TLI.getValueType(PTy->getElementType()); MVT::ValueType EVT = TLI.getValueType(PTy->getElementType());
Result = DAG.getNode(ISD::VBIT_CONVERT, MVT::Vector, Result, Result = DAG.getNode(ISD::VBIT_CONVERT, MVT::Vector, Result,
DAG.getConstant(PTy->getNumElements(), MVT::i32), DAG.getConstant(PTy->getNumElements(), MVT::i32),
@ -2966,8 +2966,8 @@ TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG) {
} else { } else {
// Otherwise, this is a vector type. We only support legal vectors // Otherwise, this is a vector type. We only support legal vectors
// right now. // right now.
unsigned NumElems = cast<PackedType>(I->getType())->getNumElements(); unsigned NumElems = cast<VectorType>(I->getType())->getNumElements();
const Type *EltTy = cast<PackedType>(I->getType())->getElementType(); const Type *EltTy = cast<VectorType>(I->getType())->getElementType();
// Figure out if there is a Packed type corresponding to this Vector // Figure out if there is a Packed type corresponding to this Vector
// type. If so, convert to the packed type. // type. If so, convert to the packed type.
@ -3031,7 +3031,7 @@ TargetLowering::LowerArguments(Function &F, SelectionDAG &DAG) {
} else { } else {
// Otherwise, this is a vector type. We only support legal vectors // Otherwise, this is a vector type. We only support legal vectors
// right now. // right now.
const PackedType *PTy = cast<PackedType>(I->getType()); const VectorType *PTy = cast<VectorType>(I->getType());
unsigned NumElems = PTy->getNumElements(); unsigned NumElems = PTy->getNumElements();
const Type *EltTy = PTy->getElementType(); const Type *EltTy = PTy->getElementType();
@ -3154,7 +3154,7 @@ TargetLowering::LowerCallTo(SDOperand Chain, const Type *RetTy,
} else { } else {
// Otherwise, this is a vector type. We only support legal vectors // Otherwise, this is a vector type. We only support legal vectors
// right now. // right now.
const PackedType *PTy = cast<PackedType>(Args[i].Ty); const VectorType *PTy = cast<VectorType>(Args[i].Ty);
unsigned NumElems = PTy->getNumElements(); unsigned NumElems = PTy->getNumElements();
const Type *EltTy = PTy->getElementType(); const Type *EltTy = PTy->getElementType();
@ -3200,7 +3200,7 @@ TargetLowering::LowerCallTo(SDOperand Chain, const Type *RetTy,
} else { } else {
// Otherwise, this is a vector type. We only support legal vectors // Otherwise, this is a vector type. We only support legal vectors
// right now. // right now.
const PackedType *PTy = cast<PackedType>(RetTy); const VectorType *PTy = cast<VectorType>(RetTy);
unsigned NumElems = PTy->getNumElements(); unsigned NumElems = PTy->getNumElements();
const Type *EltTy = PTy->getElementType(); const Type *EltTy = PTy->getElementType();
@ -3238,8 +3238,8 @@ TargetLowering::LowerCallTo(SDOperand Chain, const Type *RetTy,
if (VT == MVT::Vector) { if (VT == MVT::Vector) {
// Insert a VBITCONVERT to convert from the packed result type to the // Insert a VBITCONVERT to convert from the packed result type to the
// MVT::Vector type. // MVT::Vector type.
unsigned NumElems = cast<PackedType>(RetTy)->getNumElements(); unsigned NumElems = cast<VectorType>(RetTy)->getNumElements();
const Type *EltTy = cast<PackedType>(RetTy)->getElementType(); const Type *EltTy = cast<VectorType>(RetTy)->getElementType();
// Figure out if there is a Packed type corresponding to this Vector // Figure out if there is a Packed type corresponding to this Vector
// type. If so, convert to the packed type. // type. If so, convert to the packed type.
@ -3938,7 +3938,7 @@ SDOperand SelectionDAGLowering::CopyValueToVirtualRegister(Value *V,
} else if (SrcVT == MVT::Vector) { } else if (SrcVT == MVT::Vector) {
// Handle copies from generic vectors to registers. // Handle copies from generic vectors to registers.
MVT::ValueType PTyElementVT, PTyLegalElementVT; MVT::ValueType PTyElementVT, PTyLegalElementVT;
unsigned NE = TLI.getPackedTypeBreakdown(cast<PackedType>(V->getType()), unsigned NE = TLI.getVectorTypeBreakdown(cast<VectorType>(V->getType()),
PTyElementVT, PTyLegalElementVT); PTyElementVT, PTyLegalElementVT);
// Insert a VBIT_CONVERT of the input vector to a "N x PTyElementVT" // Insert a VBIT_CONVERT of the input vector to a "N x PTyElementVT"
@ -4133,7 +4133,7 @@ void SelectionDAGISel::BuildSelectionDAG(SelectionDAG &DAG, BasicBlock *LLVMBB,
else { else {
MVT::ValueType VT1,VT2; MVT::ValueType VT1,VT2;
NumElements = NumElements =
TLI.getPackedTypeBreakdown(cast<PackedType>(PN->getType()), TLI.getVectorTypeBreakdown(cast<VectorType>(PN->getType()),
VT1, VT2); VT1, VT2);
} }
for (unsigned i = 0, e = NumElements; i != e; ++i) for (unsigned i = 0, e = NumElements; i != e; ++i)

View File

@ -278,13 +278,13 @@ const char *TargetLowering::getTargetNodeName(unsigned Opcode) const {
return NULL; return NULL;
} }
/// getPackedTypeBreakdown - Packed types are broken down into some number of /// getVectorTypeBreakdown - Packed types are broken down into some number of
/// legal first class types. For example, <8 x float> maps to 2 MVT::v4f32 /// legal first class types. For example, <8 x float> maps to 2 MVT::v4f32
/// with Altivec or SSE1, or 8 promoted MVT::f64 values with the X86 FP stack. /// with Altivec or SSE1, or 8 promoted MVT::f64 values with the X86 FP stack.
/// ///
/// This method returns the number and type of the resultant breakdown. /// This method returns the number and type of the resultant breakdown.
/// ///
unsigned TargetLowering::getPackedTypeBreakdown(const PackedType *PTy, unsigned TargetLowering::getVectorTypeBreakdown(const VectorType *PTy,
MVT::ValueType &PTyElementVT, MVT::ValueType &PTyElementVT,
MVT::ValueType &PTyLegalElementVT) const { MVT::ValueType &PTyLegalElementVT) const {
// Figure out the right, legal destination reg to copy into. // Figure out the right, legal destination reg to copy into.
@ -2206,6 +2206,6 @@ MVT::ValueType TargetLowering::getValueType(const Type *Ty) const {
case Type::FloatTyID: return MVT::f32; case Type::FloatTyID: return MVT::f32;
case Type::DoubleTyID: return MVT::f64; case Type::DoubleTyID: return MVT::f64;
case Type::PointerTyID: return PointerTy; case Type::PointerTyID: return PointerTy;
case Type::PackedTyID: return MVT::Vector; case Type::VectorTyID: return MVT::Vector;
} }
} }

View File

@ -687,7 +687,7 @@ GenericValue ExecutionEngine::LoadValueFromMemory(GenericValue *Ptr,
void ExecutionEngine::InitializeMemory(const Constant *Init, void *Addr) { void ExecutionEngine::InitializeMemory(const Constant *Init, void *Addr) {
if (isa<UndefValue>(Init)) { if (isa<UndefValue>(Init)) {
return; return;
} else if (const ConstantPacked *CP = dyn_cast<ConstantPacked>(Init)) { } else if (const ConstantVector *CP = dyn_cast<ConstantVector>(Init)) {
unsigned ElementSize = unsigned ElementSize =
getTargetData()->getTypeSize(CP->getType()->getElementType()); getTargetData()->getTypeSize(CP->getType()->getElementType());
for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i) for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i)

View File

@ -295,11 +295,11 @@ static Value *RemapOperand(const Value *In,
Result = ConstantStruct::get(cast<StructType>(CPS->getType()), Operands); Result = ConstantStruct::get(cast<StructType>(CPS->getType()), Operands);
} else if (isa<ConstantPointerNull>(CPV) || isa<UndefValue>(CPV)) { } else if (isa<ConstantPointerNull>(CPV) || isa<UndefValue>(CPV)) {
Result = const_cast<Constant*>(CPV); Result = const_cast<Constant*>(CPV);
} else if (const ConstantPacked *CP = dyn_cast<ConstantPacked>(CPV)) { } else if (const ConstantVector *CP = dyn_cast<ConstantVector>(CPV)) {
std::vector<Constant*> Operands(CP->getNumOperands()); std::vector<Constant*> Operands(CP->getNumOperands());
for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i) for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i)
Operands[i] = cast<Constant>(RemapOperand(CP->getOperand(i), ValueMap)); Operands[i] = cast<Constant>(RemapOperand(CP->getOperand(i), ValueMap));
Result = ConstantPacked::get(Operands); Result = ConstantVector::get(Operands);
} else if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CPV)) { } else if (const ConstantExpr *CE = dyn_cast<ConstantExpr>(CPV)) {
std::vector<Constant*> Ops; std::vector<Constant*> Ops;
for (unsigned i = 0, e = CE->getNumOperands(); i != e; ++i) for (unsigned i = 0, e = CE->getNumOperands(); i != e; ++i)

View File

@ -151,7 +151,7 @@ namespace {
void printConstantWithCast(Constant *CPV, unsigned Opcode); void printConstantWithCast(Constant *CPV, unsigned Opcode);
bool printConstExprCast(const ConstantExpr *CE); bool printConstExprCast(const ConstantExpr *CE);
void printConstantArray(ConstantArray *CPA); void printConstantArray(ConstantArray *CPA);
void printConstantPacked(ConstantPacked *CP); void printConstantVector(ConstantVector *CP);
// isInlinableInst - Attempt to inline instructions into their uses to build // isInlinableInst - Attempt to inline instructions into their uses to build
// trees as much as possible. To do this, we have to consistently decide // trees as much as possible. To do this, we have to consistently decide
@ -458,7 +458,7 @@ std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty,
std::string ptrName = "*" + NameSoFar; std::string ptrName = "*" + NameSoFar;
if (isa<ArrayType>(PTy->getElementType()) || if (isa<ArrayType>(PTy->getElementType()) ||
isa<PackedType>(PTy->getElementType())) isa<VectorType>(PTy->getElementType()))
ptrName = "(" + ptrName + ")"; ptrName = "(" + ptrName + ")";
return printType(Out, PTy->getElementType(), false, ptrName); return printType(Out, PTy->getElementType(), false, ptrName);
@ -472,8 +472,8 @@ std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty,
NameSoFar + "[" + utostr(NumElements) + "]"); NameSoFar + "[" + utostr(NumElements) + "]");
} }
case Type::PackedTyID: { case Type::VectorTyID: {
const PackedType *PTy = cast<PackedType>(Ty); const VectorType *PTy = cast<VectorType>(Ty);
unsigned NumElements = PTy->getNumElements(); unsigned NumElements = PTy->getNumElements();
if (NumElements == 0) NumElements = 1; if (NumElements == 0) NumElements = 1;
return printType(Out, PTy->getElementType(), false, return printType(Out, PTy->getElementType(), false,
@ -563,7 +563,7 @@ void CWriter::printConstantArray(ConstantArray *CPA) {
} }
} }
void CWriter::printConstantPacked(ConstantPacked *CP) { void CWriter::printConstantVector(ConstantVector *CP) {
Out << '{'; Out << '{';
if (CP->getNumOperands()) { if (CP->getNumOperands()) {
Out << ' '; Out << ' ';
@ -926,9 +926,9 @@ void CWriter::printConstant(Constant *CPV) {
} }
break; break;
case Type::PackedTyID: case Type::VectorTyID:
if (isa<ConstantAggregateZero>(CPV) || isa<UndefValue>(CPV)) { if (isa<ConstantAggregateZero>(CPV) || isa<UndefValue>(CPV)) {
const PackedType *AT = cast<PackedType>(CPV->getType()); const VectorType *AT = cast<VectorType>(CPV->getType());
Out << '{'; Out << '{';
if (AT->getNumElements()) { if (AT->getNumElements()) {
Out << ' '; Out << ' ';
@ -941,7 +941,7 @@ void CWriter::printConstant(Constant *CPV) {
} }
Out << " }"; Out << " }";
} else { } else {
printConstantPacked(cast<ConstantPacked>(CPV)); printConstantVector(cast<ConstantVector>(CPV));
} }
break; break;
@ -1589,7 +1589,7 @@ bool CWriter::doInitialization(Module &M) {
Out << " = " ; Out << " = " ;
if (isa<StructType>(I->getInitializer()->getType()) || if (isa<StructType>(I->getInitializer()->getType()) ||
isa<ArrayType>(I->getInitializer()->getType()) || isa<ArrayType>(I->getInitializer()->getType()) ||
isa<PackedType>(I->getInitializer()->getType())) { isa<VectorType>(I->getInitializer()->getType())) {
Out << "{ 0 }"; Out << "{ 0 }";
} else { } else {
// Just print it out normally. // Just print it out normally.

View File

@ -414,8 +414,8 @@ uint64_t TargetData::getTypeSize(const Type *Ty) const {
return 4; return 4;
case Type::DoubleTyID: case Type::DoubleTyID:
return 8; return 8;
case Type::PackedTyID: { case Type::VectorTyID: {
const PackedType *PTy = cast<PackedType>(Ty); const VectorType *PTy = cast<VectorType>(Ty);
return PTy->getBitWidth() / 8; return PTy->getBitWidth() / 8;
} }
default: default:
@ -483,7 +483,7 @@ unsigned char TargetData::getAlignment(const Type *Ty, bool abi_or_pref) const
case Type::DoubleTyID: case Type::DoubleTyID:
AlignType = FLOAT_ALIGN; AlignType = FLOAT_ALIGN;
break; break;
case Type::PackedTyID: case Type::VectorTyID:
AlignType = PACKED_ALIGN; AlignType = PACKED_ALIGN;
break; break;
default: default:

View File

@ -278,7 +278,7 @@ static Constant *getAggregateConstantElement(Constant *Agg, Constant *Idx) {
if (IdxV < CS->getNumOperands()) return CS->getOperand(IdxV); if (IdxV < CS->getNumOperands()) return CS->getOperand(IdxV);
} else if (ConstantArray *CA = dyn_cast<ConstantArray>(Agg)) { } else if (ConstantArray *CA = dyn_cast<ConstantArray>(Agg)) {
if (IdxV < CA->getNumOperands()) return CA->getOperand(IdxV); if (IdxV < CA->getNumOperands()) return CA->getOperand(IdxV);
} else if (ConstantPacked *CP = dyn_cast<ConstantPacked>(Agg)) { } else if (ConstantVector *CP = dyn_cast<ConstantVector>(Agg)) {
if (IdxV < CP->getNumOperands()) return CP->getOperand(IdxV); if (IdxV < CP->getNumOperands()) return CP->getOperand(IdxV);
} else if (isa<ConstantAggregateZero>(Agg)) { } else if (isa<ConstantAggregateZero>(Agg)) {
if (const StructType *STy = dyn_cast<StructType>(Agg->getType())) { if (const StructType *STy = dyn_cast<StructType>(Agg->getType())) {
@ -398,7 +398,7 @@ static GlobalVariable *SRAGlobal(GlobalVariable *GV) {
unsigned NumElements = 0; unsigned NumElements = 0;
if (const ArrayType *ATy = dyn_cast<ArrayType>(STy)) if (const ArrayType *ATy = dyn_cast<ArrayType>(STy))
NumElements = ATy->getNumElements(); NumElements = ATy->getNumElements();
else if (const PackedType *PTy = dyn_cast<PackedType>(STy)) else if (const VectorType *PTy = dyn_cast<VectorType>(STy))
NumElements = PTy->getNumElements(); NumElements = PTy->getNumElements();
else else
assert(0 && "Unknown aggregate sequential type!"); assert(0 && "Unknown aggregate sequential type!");
@ -1346,7 +1346,7 @@ bool GlobalOpt::ProcessInternalGlobal(GlobalVariable *GV,
if (Constant *SOVConstant = dyn_cast<Constant>(GS.StoredOnceValue)) if (Constant *SOVConstant = dyn_cast<Constant>(GS.StoredOnceValue))
if (GV->getType()->getElementType() != Type::Int1Ty && if (GV->getType()->getElementType() != Type::Int1Ty &&
!GV->getType()->getElementType()->isFloatingPoint() && !GV->getType()->getElementType()->isFloatingPoint() &&
!isa<PackedType>(GV->getType()->getElementType()) && !isa<VectorType>(GV->getType()->getElementType()) &&
!GS.HasPHIUser) { !GS.HasPHIUser) {
DOUT << " *** SHRINKING TO BOOL: " << *GV; DOUT << " *** SHRINKING TO BOOL: " << *GV;
ShrinkGlobalToBoolean(GV, SOVConstant); ShrinkGlobalToBoolean(GV, SOVConstant);

View File

@ -1262,7 +1262,7 @@ bool InstCombiner::SimplifyDemandedBits(Value *V, uint64_t DemandedMask,
Value *InstCombiner::SimplifyDemandedVectorElts(Value *V, uint64_t DemandedElts, Value *InstCombiner::SimplifyDemandedVectorElts(Value *V, uint64_t DemandedElts,
uint64_t &UndefElts, uint64_t &UndefElts,
unsigned Depth) { unsigned Depth) {
unsigned VWidth = cast<PackedType>(V->getType())->getNumElements(); unsigned VWidth = cast<VectorType>(V->getType())->getNumElements();
assert(VWidth <= 64 && "Vector too wide to analyze!"); assert(VWidth <= 64 && "Vector too wide to analyze!");
uint64_t EltMask = ~0ULL >> (64-VWidth); uint64_t EltMask = ~0ULL >> (64-VWidth);
assert(DemandedElts != EltMask && (DemandedElts & ~EltMask) == 0 && assert(DemandedElts != EltMask && (DemandedElts & ~EltMask) == 0 &&
@ -1278,8 +1278,8 @@ Value *InstCombiner::SimplifyDemandedVectorElts(Value *V, uint64_t DemandedElts,
} }
UndefElts = 0; UndefElts = 0;
if (ConstantPacked *CP = dyn_cast<ConstantPacked>(V)) { if (ConstantVector *CP = dyn_cast<ConstantVector>(V)) {
const Type *EltTy = cast<PackedType>(V->getType())->getElementType(); const Type *EltTy = cast<VectorType>(V->getType())->getElementType();
Constant *Undef = UndefValue::get(EltTy); Constant *Undef = UndefValue::get(EltTy);
std::vector<Constant*> Elts; std::vector<Constant*> Elts;
@ -1295,19 +1295,19 @@ Value *InstCombiner::SimplifyDemandedVectorElts(Value *V, uint64_t DemandedElts,
} }
// If we changed the constant, return it. // If we changed the constant, return it.
Constant *NewCP = ConstantPacked::get(Elts); Constant *NewCP = ConstantVector::get(Elts);
return NewCP != CP ? NewCP : 0; return NewCP != CP ? NewCP : 0;
} else if (isa<ConstantAggregateZero>(V)) { } else if (isa<ConstantAggregateZero>(V)) {
// Simplify the CAZ to a ConstantPacked where the non-demanded elements are // Simplify the CAZ to a ConstantVector where the non-demanded elements are
// set to undef. // set to undef.
const Type *EltTy = cast<PackedType>(V->getType())->getElementType(); const Type *EltTy = cast<VectorType>(V->getType())->getElementType();
Constant *Zero = Constant::getNullValue(EltTy); Constant *Zero = Constant::getNullValue(EltTy);
Constant *Undef = UndefValue::get(EltTy); Constant *Undef = UndefValue::get(EltTy);
std::vector<Constant*> Elts; std::vector<Constant*> Elts;
for (unsigned i = 0; i != VWidth; ++i) for (unsigned i = 0; i != VWidth; ++i)
Elts.push_back((DemandedElts & (1ULL << i)) ? Zero : Undef); Elts.push_back((DemandedElts & (1ULL << i)) ? Zero : Undef);
UndefElts = DemandedElts ^ EltMask; UndefElts = DemandedElts ^ EltMask;
return ConstantPacked::get(Elts); return ConstantVector::get(Elts);
} }
if (!V->hasOneUse()) { // Other users may use these bits. if (!V->hasOneUse()) { // Other users may use these bits.
@ -1743,7 +1743,7 @@ Instruction *InstCombiner::visitAdd(BinaryOperator &I) {
// See if SimplifyDemandedBits can simplify this. This handles stuff like // See if SimplifyDemandedBits can simplify this. This handles stuff like
// (X & 254)+1 -> (X&254)|1 // (X & 254)+1 -> (X&254)|1
uint64_t KnownZero, KnownOne; uint64_t KnownZero, KnownOne;
if (!isa<PackedType>(I.getType()) && if (!isa<VectorType>(I.getType()) &&
SimplifyDemandedBits(&I, cast<IntegerType>(I.getType())->getBitMask(), SimplifyDemandedBits(&I, cast<IntegerType>(I.getType())->getBitMask(),
KnownZero, KnownOne)) KnownZero, KnownOne))
return &I; return &I;
@ -3064,12 +3064,12 @@ Instruction *InstCombiner::visitAnd(BinaryOperator &I) {
// See if we can simplify any instructions used by the instruction whose sole // See if we can simplify any instructions used by the instruction whose sole
// purpose is to compute bits we don't care about. // purpose is to compute bits we don't care about.
uint64_t KnownZero, KnownOne; uint64_t KnownZero, KnownOne;
if (!isa<PackedType>(I.getType())) { if (!isa<VectorType>(I.getType())) {
if (SimplifyDemandedBits(&I, cast<IntegerType>(I.getType())->getBitMask(), if (SimplifyDemandedBits(&I, cast<IntegerType>(I.getType())->getBitMask(),
KnownZero, KnownOne)) KnownZero, KnownOne))
return &I; return &I;
} else { } else {
if (ConstantPacked *CP = dyn_cast<ConstantPacked>(Op1)) { if (ConstantVector *CP = dyn_cast<ConstantVector>(Op1)) {
if (CP->isAllOnesValue()) if (CP->isAllOnesValue())
return ReplaceInstUsesWith(I, I.getOperand(0)); return ReplaceInstUsesWith(I, I.getOperand(0));
} }
@ -3543,7 +3543,7 @@ Instruction *InstCombiner::visitOr(BinaryOperator &I) {
// See if we can simplify any instructions used by the instruction whose sole // See if we can simplify any instructions used by the instruction whose sole
// purpose is to compute bits we don't care about. // purpose is to compute bits we don't care about.
uint64_t KnownZero, KnownOne; uint64_t KnownZero, KnownOne;
if (!isa<PackedType>(I.getType()) && if (!isa<VectorType>(I.getType()) &&
SimplifyDemandedBits(&I, cast<IntegerType>(I.getType())->getBitMask(), SimplifyDemandedBits(&I, cast<IntegerType>(I.getType())->getBitMask(),
KnownZero, KnownOne)) KnownZero, KnownOne))
return &I; return &I;
@ -3874,7 +3874,7 @@ Instruction *InstCombiner::visitXor(BinaryOperator &I) {
// See if we can simplify any instructions used by the instruction whose sole // See if we can simplify any instructions used by the instruction whose sole
// purpose is to compute bits we don't care about. // purpose is to compute bits we don't care about.
uint64_t KnownZero, KnownOne; uint64_t KnownZero, KnownOne;
if (!isa<PackedType>(I.getType()) && if (!isa<VectorType>(I.getType()) &&
SimplifyDemandedBits(&I, cast<IntegerType>(I.getType())->getBitMask(), SimplifyDemandedBits(&I, cast<IntegerType>(I.getType())->getBitMask(),
KnownZero, KnownOne)) KnownZero, KnownOne))
return &I; return &I;
@ -6460,8 +6460,8 @@ Instruction *InstCombiner::visitBitCast(CastInst &CI) {
if (SVI->hasOneUse()) { if (SVI->hasOneUse()) {
// Okay, we have (bitconvert (shuffle ..)). Check to see if this is // Okay, we have (bitconvert (shuffle ..)). Check to see if this is
// a bitconvert to a vector with the same # elts. // a bitconvert to a vector with the same # elts.
if (isa<PackedType>(DestTy) && if (isa<VectorType>(DestTy) &&
cast<PackedType>(DestTy)->getNumElements() == cast<VectorType>(DestTy)->getNumElements() ==
SVI->getType()->getNumElements()) { SVI->getType()->getNumElements()) {
CastInst *Tmp; CastInst *Tmp;
// If either of the operands is a cast from CI.getType(), then // If either of the operands is a cast from CI.getType(), then
@ -7082,7 +7082,7 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) {
case Intrinsic::ppc_altivec_vperm: case Intrinsic::ppc_altivec_vperm:
// Turn vperm(V1,V2,mask) -> shuffle(V1,V2,mask) if mask is a constant. // Turn vperm(V1,V2,mask) -> shuffle(V1,V2,mask) if mask is a constant.
if (ConstantPacked *Mask = dyn_cast<ConstantPacked>(II->getOperand(3))) { if (ConstantVector *Mask = dyn_cast<ConstantVector>(II->getOperand(3))) {
assert(Mask->getNumOperands() == 16 && "Bad type for intrinsic!"); assert(Mask->getNumOperands() == 16 && "Bad type for intrinsic!");
// Check that all of the elements are integer constants or undefs. // Check that all of the elements are integer constants or undefs.
@ -8037,7 +8037,7 @@ static Instruction *InstCombineLoadCast(InstCombiner &IC, LoadInst &LI) {
const Type *SrcPTy = SrcTy->getElementType(); const Type *SrcPTy = SrcTy->getElementType();
if (DestPTy->isInteger() || isa<PointerType>(DestPTy) || if (DestPTy->isInteger() || isa<PointerType>(DestPTy) ||
isa<PackedType>(DestPTy)) { isa<VectorType>(DestPTy)) {
// If the source is an array, the code below will not succeed. Check to // If the source is an array, the code below will not succeed. Check to
// see if a trivial 'gep P, 0, 0' will help matters. Only do this for // see if a trivial 'gep P, 0, 0' will help matters. Only do this for
// constants. // constants.
@ -8052,7 +8052,7 @@ static Instruction *InstCombineLoadCast(InstCombiner &IC, LoadInst &LI) {
} }
if ((SrcPTy->isInteger() || isa<PointerType>(SrcPTy) || if ((SrcPTy->isInteger() || isa<PointerType>(SrcPTy) ||
isa<PackedType>(SrcPTy)) && isa<VectorType>(SrcPTy)) &&
// Do not allow turning this into a load of an integer, which is then // Do not allow turning this into a load of an integer, which is then
// casted to a pointer, this pessimizes pointer analysis a lot. // casted to a pointer, this pessimizes pointer analysis a lot.
(isa<PointerType>(SrcPTy) == isa<PointerType>(LI.getType())) && (isa<PointerType>(SrcPTy) == isa<PointerType>(LI.getType())) &&
@ -8516,7 +8516,7 @@ Instruction *InstCombiner::visitSwitchInst(SwitchInst &SI) {
static bool CheapToScalarize(Value *V, bool isConstant) { static bool CheapToScalarize(Value *V, bool isConstant) {
if (isa<ConstantAggregateZero>(V)) if (isa<ConstantAggregateZero>(V))
return true; return true;
if (ConstantPacked *C = dyn_cast<ConstantPacked>(V)) { if (ConstantVector *C = dyn_cast<ConstantVector>(V)) {
if (isConstant) return true; if (isConstant) return true;
// If all elts are the same, we can extract. // If all elts are the same, we can extract.
Constant *Op0 = C->getOperand(0); Constant *Op0 = C->getOperand(0);
@ -8561,7 +8561,7 @@ static std::vector<unsigned> getShuffleMask(const ShuffleVectorInst *SVI) {
return std::vector<unsigned>(NElts, 2*NElts); return std::vector<unsigned>(NElts, 2*NElts);
std::vector<unsigned> Result; std::vector<unsigned> Result;
const ConstantPacked *CP = cast<ConstantPacked>(SVI->getOperand(2)); const ConstantVector *CP = cast<ConstantVector>(SVI->getOperand(2));
for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i) for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i)
if (isa<UndefValue>(CP->getOperand(i))) if (isa<UndefValue>(CP->getOperand(i)))
Result.push_back(NElts*2); // undef -> 8 Result.push_back(NElts*2); // undef -> 8
@ -8574,8 +8574,8 @@ static std::vector<unsigned> getShuffleMask(const ShuffleVectorInst *SVI) {
/// value is already around as a register, for example if it were inserted then /// value is already around as a register, for example if it were inserted then
/// extracted from the vector. /// extracted from the vector.
static Value *FindScalarElement(Value *V, unsigned EltNo) { static Value *FindScalarElement(Value *V, unsigned EltNo) {
assert(isa<PackedType>(V->getType()) && "Not looking at a vector?"); assert(isa<VectorType>(V->getType()) && "Not looking at a vector?");
const PackedType *PTy = cast<PackedType>(V->getType()); const VectorType *PTy = cast<VectorType>(V->getType());
unsigned Width = PTy->getNumElements(); unsigned Width = PTy->getNumElements();
if (EltNo >= Width) // Out of range access. if (EltNo >= Width) // Out of range access.
return UndefValue::get(PTy->getElementType()); return UndefValue::get(PTy->getElementType());
@ -8584,7 +8584,7 @@ static Value *FindScalarElement(Value *V, unsigned EltNo) {
return UndefValue::get(PTy->getElementType()); return UndefValue::get(PTy->getElementType());
else if (isa<ConstantAggregateZero>(V)) else if (isa<ConstantAggregateZero>(V))
return Constant::getNullValue(PTy->getElementType()); return Constant::getNullValue(PTy->getElementType());
else if (ConstantPacked *CP = dyn_cast<ConstantPacked>(V)) else if (ConstantVector *CP = dyn_cast<ConstantVector>(V))
return CP->getOperand(EltNo); return CP->getOperand(EltNo);
else if (InsertElementInst *III = dyn_cast<InsertElementInst>(V)) { else if (InsertElementInst *III = dyn_cast<InsertElementInst>(V)) {
// If this is an insert to a variable element, we don't know what it is. // If this is an insert to a variable element, we don't know what it is.
@ -8624,7 +8624,7 @@ Instruction *InstCombiner::visitExtractElementInst(ExtractElementInst &EI) {
if (isa<ConstantAggregateZero>(EI.getOperand(0))) if (isa<ConstantAggregateZero>(EI.getOperand(0)))
return ReplaceInstUsesWith(EI, Constant::getNullValue(EI.getType())); return ReplaceInstUsesWith(EI, Constant::getNullValue(EI.getType()));
if (ConstantPacked *C = dyn_cast<ConstantPacked>(EI.getOperand(0))) { if (ConstantVector *C = dyn_cast<ConstantVector>(EI.getOperand(0))) {
// If packed val is constant with uniform operands, replace EI // If packed val is constant with uniform operands, replace EI
// with that operand // with that operand
Constant *op0 = C->getOperand(0); Constant *op0 = C->getOperand(0);
@ -8724,7 +8724,7 @@ static bool CollectSingleShuffleElements(Value *V, Value *LHS, Value *RHS,
std::vector<Constant*> &Mask) { std::vector<Constant*> &Mask) {
assert(V->getType() == LHS->getType() && V->getType() == RHS->getType() && assert(V->getType() == LHS->getType() && V->getType() == RHS->getType() &&
"Invalid CollectSingleShuffleElements"); "Invalid CollectSingleShuffleElements");
unsigned NumElts = cast<PackedType>(V->getType())->getNumElements(); unsigned NumElts = cast<VectorType>(V->getType())->getNumElements();
if (isa<UndefValue>(V)) { if (isa<UndefValue>(V)) {
Mask.assign(NumElts, UndefValue::get(Type::Int32Ty)); Mask.assign(NumElts, UndefValue::get(Type::Int32Ty));
@ -8792,10 +8792,10 @@ static bool CollectSingleShuffleElements(Value *V, Value *LHS, Value *RHS,
/// that computes V and the LHS value of the shuffle. /// that computes V and the LHS value of the shuffle.
static Value *CollectShuffleElements(Value *V, std::vector<Constant*> &Mask, static Value *CollectShuffleElements(Value *V, std::vector<Constant*> &Mask,
Value *&RHS) { Value *&RHS) {
assert(isa<PackedType>(V->getType()) && assert(isa<VectorType>(V->getType()) &&
(RHS == 0 || V->getType() == RHS->getType()) && (RHS == 0 || V->getType() == RHS->getType()) &&
"Invalid shuffle!"); "Invalid shuffle!");
unsigned NumElts = cast<PackedType>(V->getType())->getNumElements(); unsigned NumElts = cast<VectorType>(V->getType())->getNumElements();
if (isa<UndefValue>(V)) { if (isa<UndefValue>(V)) {
Mask.assign(NumElts, UndefValue::get(Type::Int32Ty)); Mask.assign(NumElts, UndefValue::get(Type::Int32Ty));
@ -8895,7 +8895,7 @@ Instruction *InstCombiner::visitInsertElementInst(InsertElementInst &IE) {
} }
Mask[InsertedIdx] = ConstantInt::get(Type::Int32Ty, ExtractedIdx); Mask[InsertedIdx] = ConstantInt::get(Type::Int32Ty, ExtractedIdx);
return new ShuffleVectorInst(EI->getOperand(0), VecOp, return new ShuffleVectorInst(EI->getOperand(0), VecOp,
ConstantPacked::get(Mask)); ConstantVector::get(Mask));
} }
// If this insertelement isn't used by some other insertelement, turn it // If this insertelement isn't used by some other insertelement, turn it
@ -8906,7 +8906,7 @@ Instruction *InstCombiner::visitInsertElementInst(InsertElementInst &IE) {
Value *LHS = CollectShuffleElements(&IE, Mask, RHS); Value *LHS = CollectShuffleElements(&IE, Mask, RHS);
if (RHS == 0) RHS = UndefValue::get(LHS->getType()); if (RHS == 0) RHS = UndefValue::get(LHS->getType());
// We now have a shuffle of LHS, RHS, Mask. // We now have a shuffle of LHS, RHS, Mask.
return new ShuffleVectorInst(LHS, RHS, ConstantPacked::get(Mask)); return new ShuffleVectorInst(LHS, RHS, ConstantVector::get(Mask));
} }
} }
} }
@ -8947,7 +8947,7 @@ Instruction *InstCombiner::visitShuffleVectorInst(ShuffleVectorInst &SVI) {
else else
Elts.push_back(ConstantInt::get(Type::Int32Ty, Mask[i])); Elts.push_back(ConstantInt::get(Type::Int32Ty, Mask[i]));
} }
SVI.setOperand(2, ConstantPacked::get(Elts)); SVI.setOperand(2, ConstantVector::get(Elts));
} }
} }
@ -8975,7 +8975,7 @@ Instruction *InstCombiner::visitShuffleVectorInst(ShuffleVectorInst &SVI) {
} }
SVI.setOperand(0, SVI.getOperand(1)); SVI.setOperand(0, SVI.getOperand(1));
SVI.setOperand(1, UndefValue::get(RHS->getType())); SVI.setOperand(1, UndefValue::get(RHS->getType()));
SVI.setOperand(2, ConstantPacked::get(Elts)); SVI.setOperand(2, ConstantVector::get(Elts));
LHS = SVI.getOperand(0); LHS = SVI.getOperand(0);
RHS = SVI.getOperand(1); RHS = SVI.getOperand(1);
MadeChange = true; MadeChange = true;
@ -9030,7 +9030,7 @@ Instruction *InstCombiner::visitShuffleVectorInst(ShuffleVectorInst &SVI) {
} }
return new ShuffleVectorInst(LHSSVI->getOperand(0), return new ShuffleVectorInst(LHSSVI->getOperand(0),
LHSSVI->getOperand(1), LHSSVI->getOperand(1),
ConstantPacked::get(Elts)); ConstantVector::get(Elts));
} }
} }
} }

View File

@ -72,13 +72,13 @@ public:
/// @param EI the insertelement operator to convert /// @param EI the insertelement operator to convert
void visitInsertElementInst(InsertElementInst& IE); void visitInsertElementInst(InsertElementInst& IE);
/// This function asserts if the instruction is a PackedType but /// This function asserts if the instruction is a VectorType but
/// is handled by another function. /// is handled by another function.
/// ///
/// @brief Asserts if PackedType instruction is not handled elsewhere. /// @brief Asserts if VectorType instruction is not handled elsewhere.
/// @param I the unhandled instruction /// @param I the unhandled instruction
void visitInstruction(Instruction &I) { void visitInstruction(Instruction &I) {
if (isa<PackedType>(I.getType())) if (isa<VectorType>(I.getType()))
cerr << "Unhandled Instruction with Packed ReturnType: " << I << '\n'; cerr << "Unhandled Instruction with Packed ReturnType: " << I << '\n';
} }
private: private:
@ -150,8 +150,8 @@ void LowerPacked::setValues(Value* value,const std::vector<Value*>& values)
// the program. // the program.
std::vector<Value*>& LowerPacked::getValues(Value* value) std::vector<Value*>& LowerPacked::getValues(Value* value)
{ {
assert(isa<PackedType>(value->getType()) && assert(isa<VectorType>(value->getType()) &&
"Value must be PackedType"); "Value must be VectorType");
// reject further processing if this one has // reject further processing if this one has
// already been handled // already been handled
@ -161,7 +161,7 @@ std::vector<Value*>& LowerPacked::getValues(Value* value)
return it->second; return it->second;
} }
if (ConstantPacked* CP = dyn_cast<ConstantPacked>(value)) { if (ConstantVector* CP = dyn_cast<ConstantVector>(value)) {
// non-zero constant case // non-zero constant case
std::vector<Value*> results; std::vector<Value*> results;
results.reserve(CP->getNumOperands()); results.reserve(CP->getNumOperands());
@ -174,7 +174,7 @@ std::vector<Value*>& LowerPacked::getValues(Value* value)
else if (ConstantAggregateZero* CAZ = else if (ConstantAggregateZero* CAZ =
dyn_cast<ConstantAggregateZero>(value)) { dyn_cast<ConstantAggregateZero>(value)) {
// zero constant // zero constant
const PackedType* PKT = cast<PackedType>(CAZ->getType()); const VectorType* PKT = cast<VectorType>(CAZ->getType());
std::vector<Value*> results; std::vector<Value*> results;
results.reserve(PKT->getNumElements()); results.reserve(PKT->getNumElements());
@ -187,7 +187,7 @@ std::vector<Value*>& LowerPacked::getValues(Value* value)
} }
else if (isa<Instruction>(value)) { else if (isa<Instruction>(value)) {
// foward reference // foward reference
const PackedType* PKT = cast<PackedType>(value->getType()); const VectorType* PKT = cast<VectorType>(value->getType());
std::vector<Value*> results; std::vector<Value*> results;
results.reserve(PKT->getNumElements()); results.reserve(PKT->getNumElements());
@ -200,7 +200,7 @@ std::vector<Value*>& LowerPacked::getValues(Value* value)
else { else {
// we don't know what it is, and we are trying to retrieve // we don't know what it is, and we are trying to retrieve
// a value for it // a value for it
assert(false && "Unhandled PackedType value"); assert(false && "Unhandled VectorType value");
abort(); abort();
} }
} }
@ -208,7 +208,7 @@ std::vector<Value*>& LowerPacked::getValues(Value* value)
void LowerPacked::visitLoadInst(LoadInst& LI) void LowerPacked::visitLoadInst(LoadInst& LI)
{ {
// Make sure what we are dealing with is a packed type // Make sure what we are dealing with is a packed type
if (const PackedType* PKT = dyn_cast<PackedType>(LI.getType())) { if (const VectorType* PKT = dyn_cast<VectorType>(LI.getType())) {
// Initialization, Idx is needed for getelementptr needed later // Initialization, Idx is needed for getelementptr needed later
std::vector<Value*> Idx(2); std::vector<Value*> Idx(2);
Idx[0] = ConstantInt::get(Type::Int32Ty,0); Idx[0] = ConstantInt::get(Type::Int32Ty,0);
@ -249,8 +249,8 @@ void LowerPacked::visitLoadInst(LoadInst& LI)
void LowerPacked::visitBinaryOperator(BinaryOperator& BO) void LowerPacked::visitBinaryOperator(BinaryOperator& BO)
{ {
// Make sure both operands are PackedTypes // Make sure both operands are VectorTypes
if (isa<PackedType>(BO.getOperand(0)->getType())) { if (isa<VectorType>(BO.getOperand(0)->getType())) {
std::vector<Value*>& op0Vals = getValues(BO.getOperand(0)); std::vector<Value*>& op0Vals = getValues(BO.getOperand(0));
std::vector<Value*>& op1Vals = getValues(BO.getOperand(1)); std::vector<Value*>& op1Vals = getValues(BO.getOperand(1));
std::vector<Value*> result; std::vector<Value*> result;
@ -277,8 +277,8 @@ void LowerPacked::visitBinaryOperator(BinaryOperator& BO)
void LowerPacked::visitICmpInst(ICmpInst& IC) void LowerPacked::visitICmpInst(ICmpInst& IC)
{ {
// Make sure both operands are PackedTypes // Make sure both operands are VectorTypes
if (isa<PackedType>(IC.getOperand(0)->getType())) { if (isa<VectorType>(IC.getOperand(0)->getType())) {
std::vector<Value*>& op0Vals = getValues(IC.getOperand(0)); std::vector<Value*>& op0Vals = getValues(IC.getOperand(0));
std::vector<Value*>& op1Vals = getValues(IC.getOperand(1)); std::vector<Value*>& op1Vals = getValues(IC.getOperand(1));
std::vector<Value*> result; std::vector<Value*> result;
@ -306,8 +306,8 @@ void LowerPacked::visitICmpInst(ICmpInst& IC)
void LowerPacked::visitStoreInst(StoreInst& SI) void LowerPacked::visitStoreInst(StoreInst& SI)
{ {
if (const PackedType* PKT = if (const VectorType* PKT =
dyn_cast<PackedType>(SI.getOperand(0)->getType())) { dyn_cast<VectorType>(SI.getOperand(0)->getType())) {
// We will need this for getelementptr // We will need this for getelementptr
std::vector<Value*> Idx(2); std::vector<Value*> Idx(2);
Idx[0] = ConstantInt::get(Type::Int32Ty,0); Idx[0] = ConstantInt::get(Type::Int32Ty,0);
@ -343,8 +343,8 @@ void LowerPacked::visitStoreInst(StoreInst& SI)
void LowerPacked::visitSelectInst(SelectInst& SELI) void LowerPacked::visitSelectInst(SelectInst& SELI)
{ {
// Make sure both operands are PackedTypes // Make sure both operands are VectorTypes
if (isa<PackedType>(SELI.getType())) { if (isa<VectorType>(SELI.getType())) {
std::vector<Value*>& op0Vals = getValues(SELI.getTrueValue()); std::vector<Value*>& op0Vals = getValues(SELI.getTrueValue());
std::vector<Value*>& op1Vals = getValues(SELI.getFalseValue()); std::vector<Value*>& op1Vals = getValues(SELI.getFalseValue());
std::vector<Value*> result; std::vector<Value*> result;
@ -369,7 +369,7 @@ void LowerPacked::visitSelectInst(SelectInst& SELI)
void LowerPacked::visitExtractElementInst(ExtractElementInst& EI) void LowerPacked::visitExtractElementInst(ExtractElementInst& EI)
{ {
std::vector<Value*>& op0Vals = getValues(EI.getOperand(0)); std::vector<Value*>& op0Vals = getValues(EI.getOperand(0));
const PackedType *PTy = cast<PackedType>(EI.getOperand(0)->getType()); const VectorType *PTy = cast<VectorType>(EI.getOperand(0)->getType());
Value *op1 = EI.getOperand(1); Value *op1 = EI.getOperand(1);
if (ConstantInt *C = dyn_cast<ConstantInt>(op1)) { if (ConstantInt *C = dyn_cast<ConstantInt>(op1)) {

View File

@ -752,7 +752,7 @@ void Reassociate::ReassociateBB(BasicBlock *BB) {
// Reject cases where it is pointless to do this. // 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())) isa<VectorType>(BI->getType()))
continue; // Floating point ops are not associative. continue; // Floating point ops are not associative.
// If this is a subtract instruction which is not already in negate form, // If this is a subtract instruction which is not already in negate form,

View File

@ -702,8 +702,8 @@ void SCCPSolver::visitBinaryOperator(Instruction &I) {
// Could annihilate value. // Could annihilate value.
if (I.getOpcode() == Instruction::And) if (I.getOpcode() == Instruction::And)
markConstant(IV, &I, Constant::getNullValue(I.getType())); markConstant(IV, &I, Constant::getNullValue(I.getType()));
else if (const PackedType *PT = dyn_cast<PackedType>(I.getType())) else if (const VectorType *PT = dyn_cast<VectorType>(I.getType()))
markConstant(IV, &I, ConstantPacked::getAllOnesValue(PT)); markConstant(IV, &I, ConstantVector::getAllOnesValue(PT));
else else
markConstant(IV, &I, ConstantInt::getAllOnesValue(I.getType())); markConstant(IV, &I, ConstantInt::getAllOnesValue(I.getType()));
return; return;
@ -1237,8 +1237,8 @@ bool SCCPSolver::ResolvedUndefsIn(Function &F) {
case Instruction::Or: case Instruction::Or:
// undef | X -> -1. X could be -1. // undef | X -> -1. X could be -1.
if (const PackedType *PTy = dyn_cast<PackedType>(ITy)) if (const VectorType *PTy = dyn_cast<VectorType>(ITy))
markForcedConstant(LV, I, ConstantPacked::getAllOnesValue(PTy)); markForcedConstant(LV, I, ConstantVector::getAllOnesValue(PTy));
else else
markForcedConstant(LV, I, ConstantInt::getAllOnesValue(ITy)); markForcedConstant(LV, I, ConstantInt::getAllOnesValue(ITy));
return true; return true;

View File

@ -323,12 +323,12 @@ int SROA::isSafeUseOfAllocation(Instruction *User) {
// //
// Scalar replacing *just* the outer index of the array is probably not // Scalar replacing *just* the outer index of the array is probably not
// going to be a win anyway, so just give up. // going to be a win anyway, so just give up.
for (++I; I != E && (isa<ArrayType>(*I) || isa<PackedType>(*I)); ++I) { for (++I; I != E && (isa<ArrayType>(*I) || isa<VectorType>(*I)); ++I) {
uint64_t NumElements; uint64_t NumElements;
if (const ArrayType *SubArrayTy = dyn_cast<ArrayType>(*I)) if (const ArrayType *SubArrayTy = dyn_cast<ArrayType>(*I))
NumElements = SubArrayTy->getNumElements(); NumElements = SubArrayTy->getNumElements();
else else
NumElements = cast<PackedType>(*I)->getNumElements(); NumElements = cast<VectorType>(*I)->getNumElements();
if (!isa<ConstantInt>(I.getOperand())) return 0; if (!isa<ConstantInt>(I.getOperand())) return 0;
if (cast<ConstantInt>(I.getOperand())->getZExtValue() >= NumElements) if (cast<ConstantInt>(I.getOperand())->getZExtValue() >= NumElements)
@ -440,7 +440,7 @@ void SROA::CanonicalizeAllocaUsers(AllocationInst *AI) {
static bool MergeInType(const Type *In, const Type *&Accum, static bool MergeInType(const Type *In, const Type *&Accum,
const TargetData &TD) { const TargetData &TD) {
// If this is our first type, just use it. // If this is our first type, just use it.
const PackedType *PTy; const VectorType *PTy;
if (Accum == Type::VoidTy || In == Accum) { if (Accum == Type::VoidTy || In == Accum) {
Accum = In; Accum = In;
} else if (In == Type::VoidTy) { } else if (In == Type::VoidTy) {
@ -452,16 +452,16 @@ static bool MergeInType(const Type *In, const Type *&Accum,
Accum = In; Accum = In;
} else if (isa<PointerType>(In) && isa<PointerType>(Accum)) { } else if (isa<PointerType>(In) && isa<PointerType>(Accum)) {
// Pointer unions just stay as one of the pointers. // Pointer unions just stay as one of the pointers.
} else if (isa<PackedType>(In) || isa<PackedType>(Accum)) { } else if (isa<VectorType>(In) || isa<VectorType>(Accum)) {
if ((PTy = dyn_cast<PackedType>(Accum)) && if ((PTy = dyn_cast<VectorType>(Accum)) &&
PTy->getElementType() == In) { PTy->getElementType() == In) {
// Accum is a vector, and we are accessing an element: ok. // Accum is a vector, and we are accessing an element: ok.
} else if ((PTy = dyn_cast<PackedType>(In)) && } else if ((PTy = dyn_cast<VectorType>(In)) &&
PTy->getElementType() == Accum) { PTy->getElementType() == Accum) {
// In is a vector, and accum is an element: ok, remember In. // In is a vector, and accum is an element: ok, remember In.
Accum = In; Accum = In;
} else if ((PTy = dyn_cast<PackedType>(In)) && isa<PackedType>(Accum) && } else if ((PTy = dyn_cast<VectorType>(In)) && isa<VectorType>(Accum) &&
PTy->getBitWidth() == cast<PackedType>(Accum)->getBitWidth()) { PTy->getBitWidth() == cast<VectorType>(Accum)->getBitWidth()) {
// Two vectors of the same size: keep Accum. // Two vectors of the same size: keep Accum.
} else { } else {
// Cannot insert an short into a <4 x int> or handle // Cannot insert an short into a <4 x int> or handle
@ -561,7 +561,7 @@ const Type *SROA::CanConvertToScalar(Value *V, bool &IsNotTrivial) {
if (const ArrayType *ATy = dyn_cast<ArrayType>(AggTy)) { if (const ArrayType *ATy = dyn_cast<ArrayType>(AggTy)) {
if (Idx >= ATy->getNumElements()) return 0; // Out of range. if (Idx >= ATy->getNumElements()) return 0; // Out of range.
} else if (const PackedType *PackedTy = dyn_cast<PackedType>(AggTy)) { } else if (const VectorType *PackedTy = dyn_cast<VectorType>(AggTy)) {
// Getting an element of the packed vector. // Getting an element of the packed vector.
if (Idx >= PackedTy->getNumElements()) return 0; // Out of range. if (Idx >= PackedTy->getNumElements()) return 0; // Out of range.
@ -630,7 +630,7 @@ void SROA::ConvertToScalar(AllocationInst *AI, const Type *ActualTy) {
/// Offset is an offset from the original alloca, in bits that need to be /// Offset is an offset from the original alloca, in bits that need to be
/// shifted to the right. By the end of this, there should be no uses of Ptr. /// shifted to the right. By the end of this, there should be no uses of Ptr.
void SROA::ConvertUsesToScalar(Value *Ptr, AllocaInst *NewAI, unsigned Offset) { void SROA::ConvertUsesToScalar(Value *Ptr, AllocaInst *NewAI, unsigned Offset) {
bool isVectorInsert = isa<PackedType>(NewAI->getType()->getElementType()); bool isVectorInsert = isa<VectorType>(NewAI->getType()->getElementType());
const TargetData &TD = getAnalysis<TargetData>(); const TargetData &TD = getAnalysis<TargetData>();
while (!Ptr->use_empty()) { while (!Ptr->use_empty()) {
Instruction *User = cast<Instruction>(Ptr->use_back()); Instruction *User = cast<Instruction>(Ptr->use_back());
@ -639,10 +639,10 @@ void SROA::ConvertUsesToScalar(Value *Ptr, AllocaInst *NewAI, unsigned Offset) {
// The load is a bit extract from NewAI shifted right by Offset bits. // The load is a bit extract from NewAI shifted right by Offset bits.
Value *NV = new LoadInst(NewAI, LI->getName(), LI); Value *NV = new LoadInst(NewAI, LI->getName(), LI);
if (NV->getType() != LI->getType()) { if (NV->getType() != LI->getType()) {
if (const PackedType *PTy = dyn_cast<PackedType>(NV->getType())) { if (const VectorType *PTy = dyn_cast<VectorType>(NV->getType())) {
// If the result alloca is a packed type, this is either an element // If the result alloca is a packed type, this is either an element
// access or a bitcast to another packed type. // access or a bitcast to another packed type.
if (isa<PackedType>(LI->getType())) { if (isa<VectorType>(LI->getType())) {
NV = new BitCastInst(NV, LI->getType(), LI->getName(), LI); NV = new BitCastInst(NV, LI->getType(), LI->getName(), LI);
} else { } else {
// Must be an element access. // Must be an element access.
@ -702,10 +702,10 @@ void SROA::ConvertUsesToScalar(Value *Ptr, AllocaInst *NewAI, unsigned Offset) {
if (SV->getType() != AllocaType) { if (SV->getType() != AllocaType) {
Value *Old = new LoadInst(NewAI, NewAI->getName()+".in", SI); Value *Old = new LoadInst(NewAI, NewAI->getName()+".in", SI);
if (const PackedType *PTy = dyn_cast<PackedType>(AllocaType)) { if (const VectorType *PTy = dyn_cast<VectorType>(AllocaType)) {
// If the result alloca is a packed type, this is either an element // If the result alloca is a packed type, this is either an element
// access or a bitcast to another packed type. // access or a bitcast to another packed type.
if (isa<PackedType>(SV->getType())) { if (isa<VectorType>(SV->getType())) {
SV = new BitCastInst(SV, AllocaType, SV->getName(), SI); SV = new BitCastInst(SV, AllocaType, SV->getName(), SI);
} else { } else {
// Must be an element insertion. // Must be an element insertion.

View File

@ -78,7 +78,7 @@ Value *llvm::MapValue(const Value *V, ValueMapTy &VM) {
for (unsigned i = 0, e = CE->getNumOperands(); i != e; ++i) for (unsigned i = 0, e = CE->getNumOperands(); i != e; ++i)
Ops.push_back(cast<Constant>(MapValue(CE->getOperand(i), VM))); Ops.push_back(cast<Constant>(MapValue(CE->getOperand(i), VM)));
return VM[V] = CE->getWithOperands(Ops); return VM[V] = CE->getWithOperands(Ops);
} else if (ConstantPacked *CP = dyn_cast<ConstantPacked>(C)) { } else if (ConstantVector *CP = dyn_cast<ConstantVector>(C)) {
for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i) { for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i) {
Value *MV = MapValue(CP->getOperand(i), VM); Value *MV = MapValue(CP->getOperand(i), VM);
if (MV != CP->getOperand(i)) { if (MV != CP->getOperand(i)) {
@ -92,7 +92,7 @@ Value *llvm::MapValue(const Value *V, ValueMapTy &VM) {
Values.push_back(cast<Constant>(MV)); Values.push_back(cast<Constant>(MV));
for (++i; i != e; ++i) for (++i; i != e; ++i)
Values.push_back(cast<Constant>(MapValue(CP->getOperand(i), VM))); Values.push_back(cast<Constant>(MapValue(CP->getOperand(i), VM)));
return VM[V] = ConstantPacked::get(Values); return VM[V] = ConstantVector::get(Values);
} }
} }
return VMSlot = C; return VMSlot = C;

View File

@ -342,8 +342,8 @@ static void calcTypeName(const Type *Ty,
Result += "]"; Result += "]";
break; break;
} }
case Type::PackedTyID: { case Type::VectorTyID: {
const PackedType *PTy = cast<PackedType>(Ty); const VectorType *PTy = cast<VectorType>(Ty);
Result += "<" + utostr(PTy->getNumElements()) + " x "; Result += "<" + utostr(PTy->getNumElements()) + " x ";
calcTypeName(PTy->getElementType(), TypeStack, TypeNames, Result); calcTypeName(PTy->getElementType(), TypeStack, TypeNames, Result);
Result += ">"; Result += ">";
@ -548,7 +548,7 @@ static void WriteConstantInt(std::ostream &Out, const Constant *CV,
Out << " }"; Out << " }";
if (CS->getType()->isPacked()) if (CS->getType()->isPacked())
Out << '>'; Out << '>';
} else if (const ConstantPacked *CP = dyn_cast<ConstantPacked>(CV)) { } else if (const ConstantVector *CP = dyn_cast<ConstantVector>(CV)) {
const Type *ETy = CP->getType()->getElementType(); const Type *ETy = CP->getType()->getElementType();
assert(CP->getNumOperands() > 0 && assert(CP->getNumOperands() > 0 &&
"Number of operands for a PackedConst must be > 0"); "Number of operands for a PackedConst must be > 0");
@ -772,7 +772,7 @@ std::ostream &AssemblyWriter::printTypeAtLeastOneLevel(const Type *Ty) {
} else if (const ArrayType *ATy = dyn_cast<ArrayType>(Ty)) { } else if (const ArrayType *ATy = dyn_cast<ArrayType>(Ty)) {
Out << '[' << ATy->getNumElements() << " x "; Out << '[' << ATy->getNumElements() << " x ";
printType(ATy->getElementType()) << ']'; printType(ATy->getElementType()) << ']';
} else if (const PackedType *PTy = dyn_cast<PackedType>(Ty)) { } else if (const VectorType *PTy = dyn_cast<VectorType>(Ty)) {
Out << '<' << PTy->getNumElements() << " x "; Out << '<' << PTy->getNumElements() << " x ";
printType(PTy->getElementType()) << '>'; printType(PTy->getElementType()) << '>';
} }

View File

@ -35,11 +35,11 @@ using namespace llvm;
// ConstantFold*Instruction Implementations // ConstantFold*Instruction Implementations
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
/// CastConstantPacked - Convert the specified ConstantPacked node to the /// CastConstantVector - Convert the specified ConstantVector node to the
/// specified packed type. At this point, we know that the elements of the /// specified packed type. At this point, we know that the elements of the
/// input packed constant are all simple integer or FP values. /// input packed constant are all simple integer or FP values.
static Constant *CastConstantPacked(ConstantPacked *CP, static Constant *CastConstantVector(ConstantVector *CP,
const PackedType *DstTy) { const VectorType *DstTy) {
unsigned SrcNumElts = CP->getType()->getNumElements(); unsigned SrcNumElts = CP->getType()->getNumElements();
unsigned DstNumElts = DstTy->getNumElements(); unsigned DstNumElts = DstTy->getNumElements();
const Type *SrcEltTy = CP->getType()->getElementType(); const Type *SrcEltTy = CP->getType()->getElementType();
@ -57,7 +57,7 @@ static Constant *CastConstantPacked(ConstantPacked *CP,
for (unsigned i = 0; i != SrcNumElts; ++i) for (unsigned i = 0; i != SrcNumElts; ++i)
Result.push_back( Result.push_back(
ConstantExpr::getBitCast(CP->getOperand(i), DstEltTy)); ConstantExpr::getBitCast(CP->getOperand(i), DstEltTy));
return ConstantPacked::get(Result); return ConstantVector::get(Result);
} }
// If this is an int-to-fp cast .. // If this is an int-to-fp cast ..
@ -70,7 +70,7 @@ static Constant *CastConstantPacked(ConstantPacked *CP,
BitsToDouble(cast<ConstantInt>(CP->getOperand(i))->getZExtValue()); BitsToDouble(cast<ConstantInt>(CP->getOperand(i))->getZExtValue());
Result.push_back(ConstantFP::get(Type::DoubleTy, V)); Result.push_back(ConstantFP::get(Type::DoubleTy, V));
} }
return ConstantPacked::get(Result); return ConstantVector::get(Result);
} }
assert(DstEltTy == Type::FloatTy && "Unknown fp type!"); assert(DstEltTy == Type::FloatTy && "Unknown fp type!");
for (unsigned i = 0; i != SrcNumElts; ++i) { for (unsigned i = 0; i != SrcNumElts; ++i) {
@ -78,7 +78,7 @@ static Constant *CastConstantPacked(ConstantPacked *CP,
BitsToFloat(cast<ConstantInt>(CP->getOperand(i))->getZExtValue()); BitsToFloat(cast<ConstantInt>(CP->getOperand(i))->getZExtValue());
Result.push_back(ConstantFP::get(Type::FloatTy, V)); Result.push_back(ConstantFP::get(Type::FloatTy, V));
} }
return ConstantPacked::get(Result); return ConstantVector::get(Result);
} }
// Otherwise, this is an fp-to-int cast. // Otherwise, this is an fp-to-int cast.
@ -91,7 +91,7 @@ static Constant *CastConstantPacked(ConstantPacked *CP,
Constant *C = ConstantInt::get(Type::Int64Ty, V); Constant *C = ConstantInt::get(Type::Int64Ty, V);
Result.push_back(ConstantExpr::getBitCast(C, DstEltTy )); Result.push_back(ConstantExpr::getBitCast(C, DstEltTy ));
} }
return ConstantPacked::get(Result); return ConstantVector::get(Result);
} }
assert(SrcEltTy->getTypeID() == Type::FloatTyID); assert(SrcEltTy->getTypeID() == Type::FloatTyID);
@ -100,7 +100,7 @@ static Constant *CastConstantPacked(ConstantPacked *CP,
Constant *C = ConstantInt::get(Type::Int32Ty, V); Constant *C = ConstantInt::get(Type::Int32Ty, V);
Result.push_back(ConstantExpr::getBitCast(C, DstEltTy)); Result.push_back(ConstantExpr::getBitCast(C, DstEltTy));
} }
return ConstantPacked::get(Result); return ConstantVector::get(Result);
} }
// Otherwise, this is a cast that changes element count and size. Handle // Otherwise, this is a cast that changes element count and size. Handle
@ -242,8 +242,8 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, const Constant *V,
// Handle casts from one packed constant to another. We know that the src // Handle casts from one packed constant to another. We know that the src
// and dest type have the same size (otherwise its an illegal cast). // and dest type have the same size (otherwise its an illegal cast).
if (const PackedType *DestPTy = dyn_cast<PackedType>(DestTy)) { if (const VectorType *DestPTy = dyn_cast<VectorType>(DestTy)) {
if (const PackedType *SrcTy = dyn_cast<PackedType>(V->getType())) { if (const VectorType *SrcTy = dyn_cast<VectorType>(V->getType())) {
assert(DestPTy->getBitWidth() == SrcTy->getBitWidth() && assert(DestPTy->getBitWidth() == SrcTy->getBitWidth() &&
"Not cast between same sized vectors!"); "Not cast between same sized vectors!");
// First, check for null and undef // First, check for null and undef
@ -252,9 +252,9 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, const Constant *V,
if (isa<UndefValue>(V)) if (isa<UndefValue>(V))
return UndefValue::get(DestTy); return UndefValue::get(DestTy);
if (const ConstantPacked *CP = dyn_cast<ConstantPacked>(V)) { if (const ConstantVector *CP = dyn_cast<ConstantVector>(V)) {
// This is a cast from a ConstantPacked of one type to a // This is a cast from a ConstantVector of one type to a
// ConstantPacked of another type. Check to see if all elements of // ConstantVector of another type. Check to see if all elements of
// the input are simple. // the input are simple.
bool AllSimpleConstants = true; bool AllSimpleConstants = true;
for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i) { for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i) {
@ -267,7 +267,7 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, const Constant *V,
// If all of the elements are simple constants, we can fold this. // If all of the elements are simple constants, we can fold this.
if (AllSimpleConstants) if (AllSimpleConstants)
return CastConstantPacked(const_cast<ConstantPacked*>(CP), DestPTy); return CastConstantVector(const_cast<ConstantVector*>(CP), DestPTy);
} }
} }
} }
@ -329,12 +329,12 @@ Constant *llvm::ConstantFoldSelectInstruction(const Constant *Cond,
Constant *llvm::ConstantFoldExtractElementInstruction(const Constant *Val, Constant *llvm::ConstantFoldExtractElementInstruction(const Constant *Val,
const Constant *Idx) { const Constant *Idx) {
if (isa<UndefValue>(Val)) // ee(undef, x) -> undef if (isa<UndefValue>(Val)) // ee(undef, x) -> undef
return UndefValue::get(cast<PackedType>(Val->getType())->getElementType()); return UndefValue::get(cast<VectorType>(Val->getType())->getElementType());
if (Val->isNullValue()) // ee(zero, x) -> zero if (Val->isNullValue()) // ee(zero, x) -> zero
return Constant::getNullValue( return Constant::getNullValue(
cast<PackedType>(Val->getType())->getElementType()); cast<VectorType>(Val->getType())->getElementType());
if (const ConstantPacked *CVal = dyn_cast<ConstantPacked>(Val)) { if (const ConstantVector *CVal = dyn_cast<ConstantVector>(Val)) {
if (const ConstantInt *CIdx = dyn_cast<ConstantInt>(Idx)) { if (const ConstantInt *CIdx = dyn_cast<ConstantInt>(Idx)) {
return const_cast<Constant*>(CVal->getOperand(CIdx->getZExtValue())); return const_cast<Constant*>(CVal->getOperand(CIdx->getZExtValue()));
} else if (isa<UndefValue>(Idx)) { } else if (isa<UndefValue>(Idx)) {
@ -359,7 +359,7 @@ Constant *llvm::ConstantFoldInsertElementInstruction(const Constant *Val,
// Otherwise break the aggregate undef into multiple undefs and do // Otherwise break the aggregate undef into multiple undefs and do
// the insertion // the insertion
unsigned numOps = unsigned numOps =
cast<PackedType>(Val->getType())->getNumElements(); cast<VectorType>(Val->getType())->getNumElements();
std::vector<Constant*> Ops; std::vector<Constant*> Ops;
Ops.reserve(numOps); Ops.reserve(numOps);
for (unsigned i = 0; i < numOps; ++i) { for (unsigned i = 0; i < numOps; ++i) {
@ -367,7 +367,7 @@ Constant *llvm::ConstantFoldInsertElementInstruction(const Constant *Val,
(i == idxVal) ? Elt : UndefValue::get(Elt->getType()); (i == idxVal) ? Elt : UndefValue::get(Elt->getType());
Ops.push_back(const_cast<Constant*>(Op)); Ops.push_back(const_cast<Constant*>(Op));
} }
return ConstantPacked::get(Ops); return ConstantVector::get(Ops);
} }
if (isa<ConstantAggregateZero>(Val)) { if (isa<ConstantAggregateZero>(Val)) {
// Insertion of scalar constant into packed aggregate zero // Insertion of scalar constant into packed aggregate zero
@ -377,7 +377,7 @@ Constant *llvm::ConstantFoldInsertElementInstruction(const Constant *Val,
// Otherwise break the aggregate zero into multiple zeros and do // Otherwise break the aggregate zero into multiple zeros and do
// the insertion // the insertion
unsigned numOps = unsigned numOps =
cast<PackedType>(Val->getType())->getNumElements(); cast<VectorType>(Val->getType())->getNumElements();
std::vector<Constant*> Ops; std::vector<Constant*> Ops;
Ops.reserve(numOps); Ops.reserve(numOps);
for (unsigned i = 0; i < numOps; ++i) { for (unsigned i = 0; i < numOps; ++i) {
@ -385,9 +385,9 @@ Constant *llvm::ConstantFoldInsertElementInstruction(const Constant *Val,
(i == idxVal) ? Elt : Constant::getNullValue(Elt->getType()); (i == idxVal) ? Elt : Constant::getNullValue(Elt->getType());
Ops.push_back(const_cast<Constant*>(Op)); Ops.push_back(const_cast<Constant*>(Op));
} }
return ConstantPacked::get(Ops); return ConstantVector::get(Ops);
} }
if (const ConstantPacked *CVal = dyn_cast<ConstantPacked>(Val)) { if (const ConstantVector *CVal = dyn_cast<ConstantVector>(Val)) {
// Insertion of scalar constant into packed constant // Insertion of scalar constant into packed constant
std::vector<Constant*> Ops; std::vector<Constant*> Ops;
Ops.reserve(CVal->getNumOperands()); Ops.reserve(CVal->getNumOperands());
@ -396,7 +396,7 @@ Constant *llvm::ConstantFoldInsertElementInstruction(const Constant *Val,
(i == idxVal) ? Elt : cast<Constant>(CVal->getOperand(i)); (i == idxVal) ? Elt : cast<Constant>(CVal->getOperand(i));
Ops.push_back(const_cast<Constant*>(Op)); Ops.push_back(const_cast<Constant*>(Op));
} }
return ConstantPacked::get(Ops); return ConstantVector::get(Ops);
} }
return 0; return 0;
} }
@ -409,16 +409,16 @@ Constant *llvm::ConstantFoldShuffleVectorInstruction(const Constant *V1,
} }
/// EvalVectorOp - Given two packed constants and a function pointer, apply the /// EvalVectorOp - Given two packed constants and a function pointer, apply the
/// function pointer to each element pair, producing a new ConstantPacked /// function pointer to each element pair, producing a new ConstantVector
/// constant. /// constant.
static Constant *EvalVectorOp(const ConstantPacked *V1, static Constant *EvalVectorOp(const ConstantVector *V1,
const ConstantPacked *V2, const ConstantVector *V2,
Constant *(*FP)(Constant*, Constant*)) { Constant *(*FP)(Constant*, Constant*)) {
std::vector<Constant*> Res; std::vector<Constant*> Res;
for (unsigned i = 0, e = V1->getNumOperands(); i != e; ++i) for (unsigned i = 0, e = V1->getNumOperands(); i != e; ++i)
Res.push_back(FP(const_cast<Constant*>(V1->getOperand(i)), Res.push_back(FP(const_cast<Constant*>(V1->getOperand(i)),
const_cast<Constant*>(V2->getOperand(i)))); const_cast<Constant*>(V2->getOperand(i))));
return ConstantPacked::get(Res); return ConstantVector::get(Res);
} }
Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode, Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode,
@ -444,8 +444,8 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode,
return Constant::getNullValue(C1->getType()); return Constant::getNullValue(C1->getType());
return const_cast<Constant*>(C2); // X / undef -> undef return const_cast<Constant*>(C2); // X / undef -> undef
case Instruction::Or: // X | undef -> -1 case Instruction::Or: // X | undef -> -1
if (const PackedType *PTy = dyn_cast<PackedType>(C1->getType())) if (const VectorType *PTy = dyn_cast<VectorType>(C1->getType()))
return ConstantPacked::getAllOnesValue(PTy); return ConstantVector::getAllOnesValue(PTy);
return ConstantInt::getAllOnesValue(C1->getType()); return ConstantInt::getAllOnesValue(C1->getType());
case Instruction::LShr: case Instruction::LShr:
if (isa<UndefValue>(C2) && isa<UndefValue>(C1)) if (isa<UndefValue>(C2) && isa<UndefValue>(C1))
@ -632,8 +632,8 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode,
return ConstantFP::get(CFP1->getType(), std::fmod(C1Val, C2Val)); return ConstantFP::get(CFP1->getType(), std::fmod(C1Val, C2Val));
} }
} }
} else if (const ConstantPacked *CP1 = dyn_cast<ConstantPacked>(C1)) { } else if (const ConstantVector *CP1 = dyn_cast<ConstantVector>(C1)) {
if (const ConstantPacked *CP2 = dyn_cast<ConstantPacked>(C2)) { if (const ConstantVector *CP2 = dyn_cast<ConstantVector>(C2)) {
switch (Opcode) { switch (Opcode) {
default: default:
break; break;
@ -1115,8 +1115,8 @@ Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred,
case FCmpInst::FCMP_OGE: case FCmpInst::FCMP_OGE:
return ConstantInt::get(Type::Int1Ty, C1Val >= C2Val); return ConstantInt::get(Type::Int1Ty, C1Val >= C2Val);
} }
} else if (const ConstantPacked *CP1 = dyn_cast<ConstantPacked>(C1)) { } else if (const ConstantVector *CP1 = dyn_cast<ConstantVector>(C1)) {
if (const ConstantPacked *CP2 = dyn_cast<ConstantPacked>(C2)) { if (const ConstantVector *CP2 = dyn_cast<ConstantVector>(C2)) {
if (pred == FCmpInst::FCMP_OEQ || pred == FCmpInst::FCMP_UEQ) { if (pred == FCmpInst::FCMP_OEQ || pred == FCmpInst::FCMP_UEQ) {
for (unsigned i = 0, e = CP1->getNumOperands(); i != e; ++i) { for (unsigned i = 0, e = CP1->getNumOperands(); i != e; ++i) {
Constant *C= ConstantExpr::getFCmp(FCmpInst::FCMP_OEQ, Constant *C= ConstantExpr::getFCmp(FCmpInst::FCMP_OEQ,

View File

@ -131,7 +131,7 @@ Constant *Constant::getNullValue(const Type *Ty) {
return ConstantPointerNull::get(cast<PointerType>(Ty)); return ConstantPointerNull::get(cast<PointerType>(Ty));
case Type::StructTyID: case Type::StructTyID:
case Type::ArrayTyID: case Type::ArrayTyID:
case Type::PackedTyID: case Type::VectorTyID:
return ConstantAggregateZero::get(Ty); return ConstantAggregateZero::get(Ty);
default: default:
// Function, Label, or Opaque type? // Function, Label, or Opaque type?
@ -154,12 +154,12 @@ ConstantInt *ConstantInt::getAllOnesValue(const Type *Ty) {
/// @returns the value for an packed integer constant of the given type that /// @returns the value for an packed integer constant of the given type that
/// has all its bits set to true. /// has all its bits set to true.
/// @brief Get the all ones value /// @brief Get the all ones value
ConstantPacked *ConstantPacked::getAllOnesValue(const PackedType *Ty) { ConstantVector *ConstantVector::getAllOnesValue(const VectorType *Ty) {
std::vector<Constant*> Elts; std::vector<Constant*> Elts;
Elts.resize(Ty->getNumElements(), Elts.resize(Ty->getNumElements(),
ConstantInt::getAllOnesValue(Ty->getElementType())); ConstantInt::getAllOnesValue(Ty->getElementType()));
assert(Elts[0] && "Not a packed integer type!"); assert(Elts[0] && "Not a packed integer type!");
return cast<ConstantPacked>(ConstantPacked::get(Elts)); return cast<ConstantVector>(ConstantVector::get(Elts));
} }
@ -229,9 +229,9 @@ ConstantStruct::~ConstantStruct() {
} }
ConstantPacked::ConstantPacked(const PackedType *T, ConstantVector::ConstantVector(const VectorType *T,
const std::vector<Constant*> &V) const std::vector<Constant*> &V)
: Constant(T, ConstantPackedVal, new Use[V.size()], V.size()) { : Constant(T, ConstantVectorVal, new Use[V.size()], V.size()) {
Use *OL = OperandList; Use *OL = OperandList;
for (std::vector<Constant*>::const_iterator I = V.begin(), E = V.end(); for (std::vector<Constant*>::const_iterator I = V.begin(), E = V.end();
I != E; ++I, ++OL) { I != E; ++I, ++OL) {
@ -244,7 +244,7 @@ ConstantPacked::ConstantPacked(const PackedType *T,
} }
} }
ConstantPacked::~ConstantPacked() { ConstantVector::~ConstantVector() {
delete [] OperandList; delete [] OperandList;
} }
@ -293,7 +293,7 @@ class VISIBILITY_HIDDEN ExtractElementConstantExpr : public ConstantExpr {
Use Ops[2]; Use Ops[2];
public: public:
ExtractElementConstantExpr(Constant *C1, Constant *C2) ExtractElementConstantExpr(Constant *C1, Constant *C2)
: ConstantExpr(cast<PackedType>(C1->getType())->getElementType(), : ConstantExpr(cast<VectorType>(C1->getType())->getElementType(),
Instruction::ExtractElement, Ops, 2) { Instruction::ExtractElement, Ops, 2) {
Ops[0].init(C1, this); Ops[0].init(C1, this);
Ops[1].init(C2, this); Ops[1].init(C2, this);
@ -919,7 +919,7 @@ static ManagedStatic<ValueMap<char, Type,
static char getValType(ConstantAggregateZero *CPZ) { return 0; } static char getValType(ConstantAggregateZero *CPZ) { return 0; }
Constant *ConstantAggregateZero::get(const Type *Ty) { Constant *ConstantAggregateZero::get(const Type *Ty) {
assert((isa<StructType>(Ty) || isa<ArrayType>(Ty) || isa<PackedType>(Ty)) && assert((isa<StructType>(Ty) || isa<ArrayType>(Ty) || isa<VectorType>(Ty)) &&
"Cannot create an aggregate zero of non-aggregate type!"); "Cannot create an aggregate zero of non-aggregate type!");
return AggZeroConstants->getOrCreate(Ty, 0); return AggZeroConstants->getOrCreate(Ty, 0);
} }
@ -1108,17 +1108,17 @@ void ConstantStruct::destroyConstant() {
destroyConstantImpl(); destroyConstantImpl();
} }
//---- ConstantPacked::get() implementation... //---- ConstantVector::get() implementation...
// //
namespace llvm { namespace llvm {
template<> template<>
struct ConvertConstantType<ConstantPacked, PackedType> { struct ConvertConstantType<ConstantVector, VectorType> {
static void convert(ConstantPacked *OldC, const PackedType *NewTy) { static void convert(ConstantVector *OldC, const VectorType *NewTy) {
// Make everyone now use a constant of the new type... // Make everyone now use a constant of the new type...
std::vector<Constant*> C; std::vector<Constant*> C;
for (unsigned i = 0, e = OldC->getNumOperands(); i != e; ++i) for (unsigned i = 0, e = OldC->getNumOperands(); i != e; ++i)
C.push_back(cast<Constant>(OldC->getOperand(i))); C.push_back(cast<Constant>(OldC->getOperand(i)));
Constant *New = ConstantPacked::get(NewTy, C); Constant *New = ConstantVector::get(NewTy, C);
assert(New != OldC && "Didn't replace constant??"); assert(New != OldC && "Didn't replace constant??");
OldC->uncheckedReplaceAllUsesWith(New); OldC->uncheckedReplaceAllUsesWith(New);
OldC->destroyConstant(); // This constant is now dead, destroy it. OldC->destroyConstant(); // This constant is now dead, destroy it.
@ -1126,7 +1126,7 @@ namespace llvm {
}; };
} }
static std::vector<Constant*> getValType(ConstantPacked *CP) { static std::vector<Constant*> getValType(ConstantVector *CP) {
std::vector<Constant*> Elements; std::vector<Constant*> Elements;
Elements.reserve(CP->getNumOperands()); Elements.reserve(CP->getNumOperands());
for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i) for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i)
@ -1134,10 +1134,10 @@ static std::vector<Constant*> getValType(ConstantPacked *CP) {
return Elements; return Elements;
} }
static ManagedStatic<ValueMap<std::vector<Constant*>, PackedType, static ManagedStatic<ValueMap<std::vector<Constant*>, VectorType,
ConstantPacked> > PackedConstants; ConstantVector> > PackedConstants;
Constant *ConstantPacked::get(const PackedType *Ty, Constant *ConstantVector::get(const VectorType *Ty,
const std::vector<Constant*> &V) { const std::vector<Constant*> &V) {
// If this is an all-zero packed, return a ConstantAggregateZero object // If this is an all-zero packed, return a ConstantAggregateZero object
if (!V.empty()) { if (!V.empty()) {
@ -1151,14 +1151,14 @@ Constant *ConstantPacked::get(const PackedType *Ty,
return ConstantAggregateZero::get(Ty); return ConstantAggregateZero::get(Ty);
} }
Constant *ConstantPacked::get(const std::vector<Constant*> &V) { Constant *ConstantVector::get(const std::vector<Constant*> &V) {
assert(!V.empty() && "Cannot infer type if V is empty"); assert(!V.empty() && "Cannot infer type if V is empty");
return get(PackedType::get(V.front()->getType(),V.size()), V); return get(VectorType::get(V.front()->getType(),V.size()), V);
} }
// destroyConstant - Remove the constant from the constant table... // destroyConstant - Remove the constant from the constant table...
// //
void ConstantPacked::destroyConstant() { void ConstantVector::destroyConstant() {
PackedConstants->remove(this); PackedConstants->remove(this);
destroyConstantImpl(); destroyConstantImpl();
} }
@ -1167,7 +1167,7 @@ void ConstantPacked::destroyConstant() {
/// is set to all ones. /// is set to all ones.
/// @returns true iff this constant's emements are all set to all ones. /// @returns true iff this constant's emements are all set to all ones.
/// @brief Determine if the value is all ones. /// @brief Determine if the value is all ones.
bool ConstantPacked::isAllOnesValue() const { bool ConstantVector::isAllOnesValue() const {
// Check out first element. // Check out first element.
const Constant *Elt = getOperand(0); const Constant *Elt = getOperand(0);
const ConstantInt *CI = dyn_cast<ConstantInt>(Elt); const ConstantInt *CI = dyn_cast<ConstantInt>(Elt);
@ -1635,40 +1635,40 @@ Constant *ConstantExpr::get(unsigned Opcode, Constant *C1, Constant *C2) {
case Instruction::Mul: case Instruction::Mul:
assert(C1->getType() == C2->getType() && "Op types should be identical!"); assert(C1->getType() == C2->getType() && "Op types should be identical!");
assert((C1->getType()->isInteger() || C1->getType()->isFloatingPoint() || assert((C1->getType()->isInteger() || C1->getType()->isFloatingPoint() ||
isa<PackedType>(C1->getType())) && isa<VectorType>(C1->getType())) &&
"Tried to create an arithmetic operation on a non-arithmetic type!"); "Tried to create an arithmetic operation on a non-arithmetic type!");
break; break;
case Instruction::UDiv: case Instruction::UDiv:
case Instruction::SDiv: case Instruction::SDiv:
assert(C1->getType() == C2->getType() && "Op types should be identical!"); assert(C1->getType() == C2->getType() && "Op types should be identical!");
assert((C1->getType()->isInteger() || (isa<PackedType>(C1->getType()) && assert((C1->getType()->isInteger() || (isa<VectorType>(C1->getType()) &&
cast<PackedType>(C1->getType())->getElementType()->isInteger())) && cast<VectorType>(C1->getType())->getElementType()->isInteger())) &&
"Tried to create an arithmetic operation on a non-arithmetic type!"); "Tried to create an arithmetic operation on a non-arithmetic type!");
break; break;
case Instruction::FDiv: case Instruction::FDiv:
assert(C1->getType() == C2->getType() && "Op types should be identical!"); assert(C1->getType() == C2->getType() && "Op types should be identical!");
assert((C1->getType()->isFloatingPoint() || (isa<PackedType>(C1->getType()) assert((C1->getType()->isFloatingPoint() || (isa<VectorType>(C1->getType())
&& cast<PackedType>(C1->getType())->getElementType()->isFloatingPoint())) && cast<VectorType>(C1->getType())->getElementType()->isFloatingPoint()))
&& "Tried to create an arithmetic operation on a non-arithmetic type!"); && "Tried to create an arithmetic operation on a non-arithmetic type!");
break; break;
case Instruction::URem: case Instruction::URem:
case Instruction::SRem: case Instruction::SRem:
assert(C1->getType() == C2->getType() && "Op types should be identical!"); assert(C1->getType() == C2->getType() && "Op types should be identical!");
assert((C1->getType()->isInteger() || (isa<PackedType>(C1->getType()) && assert((C1->getType()->isInteger() || (isa<VectorType>(C1->getType()) &&
cast<PackedType>(C1->getType())->getElementType()->isInteger())) && cast<VectorType>(C1->getType())->getElementType()->isInteger())) &&
"Tried to create an arithmetic operation on a non-arithmetic type!"); "Tried to create an arithmetic operation on a non-arithmetic type!");
break; break;
case Instruction::FRem: case Instruction::FRem:
assert(C1->getType() == C2->getType() && "Op types should be identical!"); assert(C1->getType() == C2->getType() && "Op types should be identical!");
assert((C1->getType()->isFloatingPoint() || (isa<PackedType>(C1->getType()) assert((C1->getType()->isFloatingPoint() || (isa<VectorType>(C1->getType())
&& cast<PackedType>(C1->getType())->getElementType()->isFloatingPoint())) && cast<VectorType>(C1->getType())->getElementType()->isFloatingPoint()))
&& "Tried to create an arithmetic operation on a non-arithmetic type!"); && "Tried to create an arithmetic operation on a non-arithmetic type!");
break; break;
case Instruction::And: case Instruction::And:
case Instruction::Or: case Instruction::Or:
case Instruction::Xor: case Instruction::Xor:
assert(C1->getType() == C2->getType() && "Op types should be identical!"); assert(C1->getType() == C2->getType() && "Op types should be identical!");
assert((C1->getType()->isInteger() || isa<PackedType>(C1->getType())) && assert((C1->getType()->isInteger() || isa<VectorType>(C1->getType())) &&
"Tried to create a logical operation on a non-integral type!"); "Tried to create a logical operation on a non-integral type!");
break; break;
case Instruction::Shl: case Instruction::Shl:
@ -1792,11 +1792,11 @@ Constant *ConstantExpr::getExtractElementTy(const Type *ReqTy, Constant *Val,
} }
Constant *ConstantExpr::getExtractElement(Constant *Val, Constant *Idx) { Constant *ConstantExpr::getExtractElement(Constant *Val, Constant *Idx) {
assert(isa<PackedType>(Val->getType()) && assert(isa<VectorType>(Val->getType()) &&
"Tried to create extractelement operation on non-packed type!"); "Tried to create extractelement operation on non-packed type!");
assert(Idx->getType() == Type::Int32Ty && assert(Idx->getType() == Type::Int32Ty &&
"Extractelement index must be i32 type!"); "Extractelement index must be i32 type!");
return getExtractElementTy(cast<PackedType>(Val->getType())->getElementType(), return getExtractElementTy(cast<VectorType>(Val->getType())->getElementType(),
Val, Idx); Val, Idx);
} }
@ -1814,13 +1814,13 @@ Constant *ConstantExpr::getInsertElementTy(const Type *ReqTy, Constant *Val,
Constant *ConstantExpr::getInsertElement(Constant *Val, Constant *Elt, Constant *ConstantExpr::getInsertElement(Constant *Val, Constant *Elt,
Constant *Idx) { Constant *Idx) {
assert(isa<PackedType>(Val->getType()) && assert(isa<VectorType>(Val->getType()) &&
"Tried to create insertelement operation on non-packed type!"); "Tried to create insertelement operation on non-packed type!");
assert(Elt->getType() == cast<PackedType>(Val->getType())->getElementType() assert(Elt->getType() == cast<VectorType>(Val->getType())->getElementType()
&& "Insertelement types must match!"); && "Insertelement types must match!");
assert(Idx->getType() == Type::Int32Ty && assert(Idx->getType() == Type::Int32Ty &&
"Insertelement index must be i32 type!"); "Insertelement index must be i32 type!");
return getInsertElementTy(cast<PackedType>(Val->getType())->getElementType(), return getInsertElementTy(cast<VectorType>(Val->getType())->getElementType(),
Val, Elt, Idx); Val, Elt, Idx);
} }
@ -1844,11 +1844,11 @@ Constant *ConstantExpr::getShuffleVector(Constant *V1, Constant *V2,
} }
Constant *ConstantExpr::getZeroValueForNegationExpr(const Type *Ty) { Constant *ConstantExpr::getZeroValueForNegationExpr(const Type *Ty) {
if (const PackedType *PTy = dyn_cast<PackedType>(Ty)) if (const VectorType *PTy = dyn_cast<VectorType>(Ty))
if (PTy->getElementType()->isFloatingPoint()) { if (PTy->getElementType()->isFloatingPoint()) {
std::vector<Constant*> zeros(PTy->getNumElements(), std::vector<Constant*> zeros(PTy->getNumElements(),
ConstantFP::get(PTy->getElementType(),-0.0)); ConstantFP::get(PTy->getElementType(),-0.0));
return ConstantPacked::get(PTy, zeros); return ConstantVector::get(PTy, zeros);
} }
if (Ty->isFloatingPoint()) if (Ty->isFloatingPoint())
@ -2000,7 +2000,7 @@ void ConstantStruct::replaceUsesOfWithOnConstant(Value *From, Value *To,
destroyConstant(); destroyConstant();
} }
void ConstantPacked::replaceUsesOfWithOnConstant(Value *From, Value *To, void ConstantVector::replaceUsesOfWithOnConstant(Value *From, Value *To,
Use *U) { Use *U) {
assert(isa<Constant>(To) && "Cannot make Constant refer to non-constant!"); assert(isa<Constant>(To) && "Cannot make Constant refer to non-constant!");
@ -2012,7 +2012,7 @@ void ConstantPacked::replaceUsesOfWithOnConstant(Value *From, Value *To,
Values.push_back(Val); Values.push_back(Val);
} }
Constant *Replacement = ConstantPacked::get(getType(), Values); Constant *Replacement = ConstantVector::get(getType(), Values);
assert(Replacement != this && "I didn't contain From!"); assert(Replacement != this && "I didn't contain From!");
// Everyone using this now uses the replacement. // Everyone using this now uses the replacement.

View File

@ -884,7 +884,7 @@ const Type* GetElementPtrInst::getIndexedType(const Type *Ptr, Value *Idx) {
ExtractElementInst::ExtractElementInst(Value *Val, Value *Index, ExtractElementInst::ExtractElementInst(Value *Val, Value *Index,
const std::string &Name, const std::string &Name,
Instruction *InsertBef) Instruction *InsertBef)
: Instruction(cast<PackedType>(Val->getType())->getElementType(), : Instruction(cast<VectorType>(Val->getType())->getElementType(),
ExtractElement, Ops, 2, Name, InsertBef) { ExtractElement, Ops, 2, Name, InsertBef) {
assert(isValidOperands(Val, Index) && assert(isValidOperands(Val, Index) &&
"Invalid extractelement instruction operands!"); "Invalid extractelement instruction operands!");
@ -895,7 +895,7 @@ ExtractElementInst::ExtractElementInst(Value *Val, Value *Index,
ExtractElementInst::ExtractElementInst(Value *Val, unsigned IndexV, ExtractElementInst::ExtractElementInst(Value *Val, unsigned IndexV,
const std::string &Name, const std::string &Name,
Instruction *InsertBef) Instruction *InsertBef)
: Instruction(cast<PackedType>(Val->getType())->getElementType(), : Instruction(cast<VectorType>(Val->getType())->getElementType(),
ExtractElement, Ops, 2, Name, InsertBef) { ExtractElement, Ops, 2, Name, InsertBef) {
Constant *Index = ConstantInt::get(Type::Int32Ty, IndexV); Constant *Index = ConstantInt::get(Type::Int32Ty, IndexV);
assert(isValidOperands(Val, Index) && assert(isValidOperands(Val, Index) &&
@ -908,7 +908,7 @@ ExtractElementInst::ExtractElementInst(Value *Val, unsigned IndexV,
ExtractElementInst::ExtractElementInst(Value *Val, Value *Index, ExtractElementInst::ExtractElementInst(Value *Val, Value *Index,
const std::string &Name, const std::string &Name,
BasicBlock *InsertAE) BasicBlock *InsertAE)
: Instruction(cast<PackedType>(Val->getType())->getElementType(), : Instruction(cast<VectorType>(Val->getType())->getElementType(),
ExtractElement, Ops, 2, Name, InsertAE) { ExtractElement, Ops, 2, Name, InsertAE) {
assert(isValidOperands(Val, Index) && assert(isValidOperands(Val, Index) &&
"Invalid extractelement instruction operands!"); "Invalid extractelement instruction operands!");
@ -920,7 +920,7 @@ ExtractElementInst::ExtractElementInst(Value *Val, Value *Index,
ExtractElementInst::ExtractElementInst(Value *Val, unsigned IndexV, ExtractElementInst::ExtractElementInst(Value *Val, unsigned IndexV,
const std::string &Name, const std::string &Name,
BasicBlock *InsertAE) BasicBlock *InsertAE)
: Instruction(cast<PackedType>(Val->getType())->getElementType(), : Instruction(cast<VectorType>(Val->getType())->getElementType(),
ExtractElement, Ops, 2, Name, InsertAE) { ExtractElement, Ops, 2, Name, InsertAE) {
Constant *Index = ConstantInt::get(Type::Int32Ty, IndexV); Constant *Index = ConstantInt::get(Type::Int32Ty, IndexV);
assert(isValidOperands(Val, Index) && assert(isValidOperands(Val, Index) &&
@ -932,7 +932,7 @@ ExtractElementInst::ExtractElementInst(Value *Val, unsigned IndexV,
bool ExtractElementInst::isValidOperands(const Value *Val, const Value *Index) { bool ExtractElementInst::isValidOperands(const Value *Val, const Value *Index) {
if (!isa<PackedType>(Val->getType()) || Index->getType() != Type::Int32Ty) if (!isa<VectorType>(Val->getType()) || Index->getType() != Type::Int32Ty)
return false; return false;
return true; return true;
} }
@ -999,10 +999,10 @@ InsertElementInst::InsertElementInst(Value *Vec, Value *Elt, unsigned IndexV,
bool InsertElementInst::isValidOperands(const Value *Vec, const Value *Elt, bool InsertElementInst::isValidOperands(const Value *Vec, const Value *Elt,
const Value *Index) { const Value *Index) {
if (!isa<PackedType>(Vec->getType())) if (!isa<VectorType>(Vec->getType()))
return false; // First operand of insertelement must be packed type. return false; // First operand of insertelement must be packed type.
if (Elt->getType() != cast<PackedType>(Vec->getType())->getElementType()) if (Elt->getType() != cast<VectorType>(Vec->getType())->getElementType())
return false;// Second operand of insertelement must be packed element type. return false;// Second operand of insertelement must be packed element type.
if (Index->getType() != Type::Int32Ty) if (Index->getType() != Type::Int32Ty)
@ -1047,12 +1047,12 @@ ShuffleVectorInst::ShuffleVectorInst(Value *V1, Value *V2, Value *Mask,
bool ShuffleVectorInst::isValidOperands(const Value *V1, const Value *V2, bool ShuffleVectorInst::isValidOperands(const Value *V1, const Value *V2,
const Value *Mask) { const Value *Mask) {
if (!isa<PackedType>(V1->getType())) return false; if (!isa<VectorType>(V1->getType())) return false;
if (V1->getType() != V2->getType()) return false; if (V1->getType() != V2->getType()) return false;
if (!isa<PackedType>(Mask->getType()) || if (!isa<VectorType>(Mask->getType()) ||
cast<PackedType>(Mask->getType())->getElementType() != Type::Int32Ty || cast<VectorType>(Mask->getType())->getElementType() != Type::Int32Ty ||
cast<PackedType>(Mask->getType())->getNumElements() != cast<VectorType>(Mask->getType())->getNumElements() !=
cast<PackedType>(V1->getType())->getNumElements()) cast<VectorType>(V1->getType())->getNumElements())
return false; return false;
return true; return true;
} }
@ -1075,37 +1075,37 @@ void BinaryOperator::init(BinaryOps iType)
assert(getType() == LHS->getType() && assert(getType() == LHS->getType() &&
"Arithmetic operation should return same type as operands!"); "Arithmetic operation should return same type as operands!");
assert((getType()->isInteger() || getType()->isFloatingPoint() || assert((getType()->isInteger() || getType()->isFloatingPoint() ||
isa<PackedType>(getType())) && isa<VectorType>(getType())) &&
"Tried to create an arithmetic operation on a non-arithmetic type!"); "Tried to create an arithmetic operation on a non-arithmetic type!");
break; break;
case UDiv: case UDiv:
case SDiv: case SDiv:
assert(getType() == LHS->getType() && assert(getType() == LHS->getType() &&
"Arithmetic operation should return same type as operands!"); "Arithmetic operation should return same type as operands!");
assert((getType()->isInteger() || (isa<PackedType>(getType()) && assert((getType()->isInteger() || (isa<VectorType>(getType()) &&
cast<PackedType>(getType())->getElementType()->isInteger())) && cast<VectorType>(getType())->getElementType()->isInteger())) &&
"Incorrect operand type (not integer) for S/UDIV"); "Incorrect operand type (not integer) for S/UDIV");
break; break;
case FDiv: case FDiv:
assert(getType() == LHS->getType() && assert(getType() == LHS->getType() &&
"Arithmetic operation should return same type as operands!"); "Arithmetic operation should return same type as operands!");
assert((getType()->isFloatingPoint() || (isa<PackedType>(getType()) && assert((getType()->isFloatingPoint() || (isa<VectorType>(getType()) &&
cast<PackedType>(getType())->getElementType()->isFloatingPoint())) cast<VectorType>(getType())->getElementType()->isFloatingPoint()))
&& "Incorrect operand type (not floating point) for FDIV"); && "Incorrect operand type (not floating point) for FDIV");
break; break;
case URem: case URem:
case SRem: case SRem:
assert(getType() == LHS->getType() && assert(getType() == LHS->getType() &&
"Arithmetic operation should return same type as operands!"); "Arithmetic operation should return same type as operands!");
assert((getType()->isInteger() || (isa<PackedType>(getType()) && assert((getType()->isInteger() || (isa<VectorType>(getType()) &&
cast<PackedType>(getType())->getElementType()->isInteger())) && cast<VectorType>(getType())->getElementType()->isInteger())) &&
"Incorrect operand type (not integer) for S/UREM"); "Incorrect operand type (not integer) for S/UREM");
break; break;
case FRem: case FRem:
assert(getType() == LHS->getType() && assert(getType() == LHS->getType() &&
"Arithmetic operation should return same type as operands!"); "Arithmetic operation should return same type as operands!");
assert((getType()->isFloatingPoint() || (isa<PackedType>(getType()) && assert((getType()->isFloatingPoint() || (isa<VectorType>(getType()) &&
cast<PackedType>(getType())->getElementType()->isFloatingPoint())) cast<VectorType>(getType())->getElementType()->isFloatingPoint()))
&& "Incorrect operand type (not floating point) for FREM"); && "Incorrect operand type (not floating point) for FREM");
break; break;
case Shl: case Shl:
@ -1121,8 +1121,8 @@ void BinaryOperator::init(BinaryOps iType)
assert(getType() == LHS->getType() && assert(getType() == LHS->getType() &&
"Logical operation should return same type as operands!"); "Logical operation should return same type as operands!");
assert((getType()->isInteger() || assert((getType()->isInteger() ||
(isa<PackedType>(getType()) && (isa<VectorType>(getType()) &&
cast<PackedType>(getType())->getElementType()->isInteger())) && cast<VectorType>(getType())->getElementType()->isInteger())) &&
"Tried to create a logical operation on a non-integral type!"); "Tried to create a logical operation on a non-integral type!");
break; break;
default: default:
@ -1166,9 +1166,9 @@ BinaryOperator *BinaryOperator::createNeg(Value *Op, const std::string &Name,
BinaryOperator *BinaryOperator::createNot(Value *Op, const std::string &Name, BinaryOperator *BinaryOperator::createNot(Value *Op, const std::string &Name,
Instruction *InsertBefore) { Instruction *InsertBefore) {
Constant *C; Constant *C;
if (const PackedType *PTy = dyn_cast<PackedType>(Op->getType())) { if (const VectorType *PTy = dyn_cast<VectorType>(Op->getType())) {
C = ConstantInt::getAllOnesValue(PTy->getElementType()); C = ConstantInt::getAllOnesValue(PTy->getElementType());
C = ConstantPacked::get(std::vector<Constant*>(PTy->getNumElements(), C)); C = ConstantVector::get(std::vector<Constant*>(PTy->getNumElements(), C));
} else { } else {
C = ConstantInt::getAllOnesValue(Op->getType()); C = ConstantInt::getAllOnesValue(Op->getType());
} }
@ -1180,11 +1180,11 @@ BinaryOperator *BinaryOperator::createNot(Value *Op, const std::string &Name,
BinaryOperator *BinaryOperator::createNot(Value *Op, const std::string &Name, BinaryOperator *BinaryOperator::createNot(Value *Op, const std::string &Name,
BasicBlock *InsertAtEnd) { BasicBlock *InsertAtEnd) {
Constant *AllOnes; Constant *AllOnes;
if (const PackedType *PTy = dyn_cast<PackedType>(Op->getType())) { if (const VectorType *PTy = dyn_cast<VectorType>(Op->getType())) {
// Create a vector of all ones values. // Create a vector of all ones values.
Constant *Elt = ConstantInt::getAllOnesValue(PTy->getElementType()); Constant *Elt = ConstantInt::getAllOnesValue(PTy->getElementType());
AllOnes = AllOnes =
ConstantPacked::get(std::vector<Constant*>(PTy->getNumElements(), Elt)); ConstantVector::get(std::vector<Constant*>(PTy->getNumElements(), Elt));
} else { } else {
AllOnes = ConstantInt::getAllOnesValue(Op->getType()); AllOnes = ConstantInt::getAllOnesValue(Op->getType());
} }
@ -1680,7 +1680,7 @@ CastInst::getCastOpcode(
return FPToSI; // FP -> sint return FPToSI; // FP -> sint
else else
return FPToUI; // FP -> uint return FPToUI; // FP -> uint
} else if (const PackedType *PTy = dyn_cast<PackedType>(SrcTy)) { } else if (const VectorType *PTy = dyn_cast<VectorType>(SrcTy)) {
assert(DestBits == PTy->getBitWidth() && assert(DestBits == PTy->getBitWidth() &&
"Casting packed to integer of different width"); "Casting packed to integer of different width");
return BitCast; // Same size, no-op cast return BitCast; // Same size, no-op cast
@ -1703,15 +1703,15 @@ CastInst::getCastOpcode(
} else { } else {
return BitCast; // same size, no-op cast return BitCast; // same size, no-op cast
} }
} else if (const PackedType *PTy = dyn_cast<PackedType>(SrcTy)) { } else if (const VectorType *PTy = dyn_cast<VectorType>(SrcTy)) {
assert(DestBits == PTy->getBitWidth() && assert(DestBits == PTy->getBitWidth() &&
"Casting packed to floating point of different width"); "Casting packed to floating point of different width");
return BitCast; // same size, no-op cast return BitCast; // same size, no-op cast
} else { } else {
assert(0 && "Casting pointer or non-first class to float"); assert(0 && "Casting pointer or non-first class to float");
} }
} else if (const PackedType *DestPTy = dyn_cast<PackedType>(DestTy)) { } else if (const VectorType *DestPTy = dyn_cast<VectorType>(DestTy)) {
if (const PackedType *SrcPTy = dyn_cast<PackedType>(SrcTy)) { if (const VectorType *SrcPTy = dyn_cast<VectorType>(SrcTy)) {
assert(DestPTy->getBitWidth() == SrcPTy->getBitWidth() && assert(DestPTy->getBitWidth() == SrcPTy->getBitWidth() &&
"Casting packed to packed of different widths"); "Casting packed to packed of different widths");
return BitCast; // packed -> packed return BitCast; // packed -> packed

View File

@ -93,9 +93,9 @@ const Type *Type::getVAArgsPromotedType() const {
/// ///
bool Type::isFPOrFPVector() const { bool Type::isFPOrFPVector() const {
if (ID == Type::FloatTyID || ID == Type::DoubleTyID) return true; if (ID == Type::FloatTyID || ID == Type::DoubleTyID) return true;
if (ID != Type::PackedTyID) return false; if (ID != Type::VectorTyID) return false;
return cast<PackedType>(this)->getElementType()->isFloatingPoint(); return cast<VectorType>(this)->getElementType()->isFloatingPoint();
} }
// canLosslesllyBitCastTo - Return true if this type can be converted to // canLosslesllyBitCastTo - Return true if this type can be converted to
@ -112,8 +112,8 @@ bool Type::canLosslesslyBitCastTo(const Type *Ty) const {
// Packed -> Packed conversions are always lossless if the two packed types // Packed -> Packed conversions are always lossless if the two packed types
// have the same size, otherwise not. // have the same size, otherwise not.
if (const PackedType *thisPTy = dyn_cast<PackedType>(this)) if (const VectorType *thisPTy = dyn_cast<VectorType>(this))
if (const PackedType *thatPTy = dyn_cast<PackedType>(Ty)) if (const VectorType *thatPTy = dyn_cast<VectorType>(Ty))
return thisPTy->getBitWidth() == thatPTy->getBitWidth(); return thisPTy->getBitWidth() == thatPTy->getBitWidth();
// At this point we have only various mismatches of the first class types // At this point we have only various mismatches of the first class types
@ -129,7 +129,7 @@ unsigned Type::getPrimitiveSizeInBits() const {
case Type::FloatTyID: return 32; case Type::FloatTyID: return 32;
case Type::DoubleTyID: return 64; case Type::DoubleTyID: return 64;
case Type::IntegerTyID: return cast<IntegerType>(this)->getBitWidth(); case Type::IntegerTyID: return cast<IntegerType>(this)->getBitWidth();
case Type::PackedTyID: return cast<PackedType>(this)->getBitWidth(); case Type::VectorTyID: return cast<VectorType>(this)->getBitWidth();
default: return 0; default: return 0;
} }
} }
@ -144,7 +144,7 @@ bool Type::isSizedDerivedType() const {
if (const ArrayType *ATy = dyn_cast<ArrayType>(this)) if (const ArrayType *ATy = dyn_cast<ArrayType>(this))
return ATy->getElementType()->isSized(); return ATy->getElementType()->isSized();
if (const PackedType *PTy = dyn_cast<PackedType>(this)) if (const VectorType *PTy = dyn_cast<VectorType>(this))
return PTy->getElementType()->isSized(); return PTy->getElementType()->isSized();
if (!isa<StructType>(this)) if (!isa<StructType>(this))
@ -287,8 +287,8 @@ static std::string getTypeDescription(const Type *Ty,
Result += getTypeDescription(ATy->getElementType(), TypeStack) + "]"; Result += getTypeDescription(ATy->getElementType(), TypeStack) + "]";
break; break;
} }
case Type::PackedTyID: { case Type::VectorTyID: {
const PackedType *PTy = cast<PackedType>(Ty); const VectorType *PTy = cast<VectorType>(Ty);
unsigned NumElements = PTy->getNumElements(); unsigned NumElements = PTy->getNumElements();
Result = "<"; Result = "<";
Result += utostr(NumElements) + " x "; Result += utostr(NumElements) + " x ";
@ -421,14 +421,14 @@ ArrayType::ArrayType(const Type *ElType, uint64_t NumEl)
setAbstract(ElType->isAbstract()); setAbstract(ElType->isAbstract());
} }
PackedType::PackedType(const Type *ElType, unsigned NumEl) VectorType::VectorType(const Type *ElType, unsigned NumEl)
: SequentialType(PackedTyID, ElType) { : SequentialType(VectorTyID, ElType) {
NumElements = NumEl; NumElements = NumEl;
setAbstract(ElType->isAbstract()); setAbstract(ElType->isAbstract());
assert(NumEl > 0 && "NumEl of a PackedType must be greater than 0"); assert(NumEl > 0 && "NumEl of a VectorType must be greater than 0");
assert((ElType->isInteger() || ElType->isFloatingPoint() || assert((ElType->isInteger() || ElType->isFloatingPoint() ||
isa<OpaqueType>(ElType)) && isa<OpaqueType>(ElType)) &&
"Elements of a PackedType must be a primitive type"); "Elements of a VectorType must be a primitive type");
} }
@ -589,8 +589,8 @@ static bool TypesEqual(const Type *Ty, const Type *Ty2,
const ArrayType *ATy2 = cast<ArrayType>(Ty2); const ArrayType *ATy2 = cast<ArrayType>(Ty2);
return ATy->getNumElements() == ATy2->getNumElements() && return ATy->getNumElements() == ATy2->getNumElements() &&
TypesEqual(ATy->getElementType(), ATy2->getElementType(), EqTypes); TypesEqual(ATy->getElementType(), ATy2->getElementType(), EqTypes);
} else if (const PackedType *PTy = dyn_cast<PackedType>(Ty)) { } else if (const VectorType *PTy = dyn_cast<VectorType>(Ty)) {
const PackedType *PTy2 = cast<PackedType>(Ty2); const VectorType *PTy2 = cast<VectorType>(Ty2);
return PTy->getNumElements() == PTy2->getNumElements() && return PTy->getNumElements() == PTy2->getNumElements() &&
TypesEqual(PTy->getElementType(), PTy2->getElementType(), EqTypes); TypesEqual(PTy->getElementType(), PTy2->getElementType(), EqTypes);
} else if (const FunctionType *FTy = dyn_cast<FunctionType>(Ty)) { } else if (const FunctionType *FTy = dyn_cast<FunctionType>(Ty)) {
@ -695,8 +695,8 @@ static unsigned getSubElementHash(const Type *Ty) {
case Type::ArrayTyID: case Type::ArrayTyID:
HashVal ^= cast<ArrayType>(SubTy)->getNumElements(); HashVal ^= cast<ArrayType>(SubTy)->getNumElements();
break; break;
case Type::PackedTyID: case Type::VectorTyID:
HashVal ^= cast<PackedType>(SubTy)->getNumElements(); HashVal ^= cast<VectorType>(SubTy)->getNumElements();
break; break;
case Type::StructTyID: case Type::StructTyID:
HashVal ^= cast<StructType>(SubTy)->getNumElements(); HashVal ^= cast<StructType>(SubTy)->getNumElements();
@ -1132,39 +1132,39 @@ ArrayType *ArrayType::get(const Type *ElementType, uint64_t NumElements) {
// Packed Type Factory... // Packed Type Factory...
// //
namespace llvm { namespace llvm {
class PackedValType { class VectorValType {
const Type *ValTy; const Type *ValTy;
unsigned Size; unsigned Size;
public: public:
PackedValType(const Type *val, int sz) : ValTy(val), Size(sz) {} VectorValType(const Type *val, int sz) : ValTy(val), Size(sz) {}
static PackedValType get(const PackedType *PT) { static VectorValType get(const VectorType *PT) {
return PackedValType(PT->getElementType(), PT->getNumElements()); return VectorValType(PT->getElementType(), PT->getNumElements());
} }
static unsigned hashTypeStructure(const PackedType *PT) { static unsigned hashTypeStructure(const VectorType *PT) {
return PT->getNumElements(); return PT->getNumElements();
} }
inline bool operator<(const PackedValType &MTV) const { inline bool operator<(const VectorValType &MTV) const {
if (Size < MTV.Size) return true; if (Size < MTV.Size) return true;
return Size == MTV.Size && ValTy < MTV.ValTy; return Size == MTV.Size && ValTy < MTV.ValTy;
} }
}; };
} }
static ManagedStatic<TypeMap<PackedValType, PackedType> > PackedTypes; static ManagedStatic<TypeMap<VectorValType, VectorType> > VectorTypes;
PackedType *PackedType::get(const Type *ElementType, unsigned NumElements) { VectorType *VectorType::get(const Type *ElementType, unsigned NumElements) {
assert(ElementType && "Can't get packed of null types!"); assert(ElementType && "Can't get packed of null types!");
assert(isPowerOf2_32(NumElements) && "Vector length should be a power of 2!"); assert(isPowerOf2_32(NumElements) && "Vector length should be a power of 2!");
PackedValType PVT(ElementType, NumElements); VectorValType PVT(ElementType, NumElements);
PackedType *PT = PackedTypes->get(PVT); VectorType *PT = VectorTypes->get(PVT);
if (PT) return PT; // Found a match, return it! if (PT) return PT; // Found a match, return it!
// Value not found. Derive a new type! // Value not found. Derive a new type!
PackedTypes->add(PVT, PT = new PackedType(ElementType, NumElements)); VectorTypes->add(PVT, PT = new VectorType(ElementType, NumElements));
#ifdef DEBUG_MERGE_TYPES #ifdef DEBUG_MERGE_TYPES
DOUT << "Derived new type: " << *PT << "\n"; DOUT << "Derived new type: " << *PT << "\n";
@ -1429,13 +1429,13 @@ void ArrayType::typeBecameConcrete(const DerivedType *AbsTy) {
// concrete - this could potentially change us from an abstract type to a // concrete - this could potentially change us from an abstract type to a
// concrete type. // concrete type.
// //
void PackedType::refineAbstractType(const DerivedType *OldType, void VectorType::refineAbstractType(const DerivedType *OldType,
const Type *NewType) { const Type *NewType) {
PackedTypes->RefineAbstractType(this, OldType, NewType); VectorTypes->RefineAbstractType(this, OldType, NewType);
} }
void PackedType::typeBecameConcrete(const DerivedType *AbsTy) { void VectorType::typeBecameConcrete(const DerivedType *AbsTy) {
PackedTypes->TypeBecameConcrete(this, AbsTy); VectorTypes->TypeBecameConcrete(this, AbsTy);
} }
// refineAbstractType - Called when a contained type is found to be more // refineAbstractType - Called when a contained type is found to be more

View File

@ -96,14 +96,14 @@ const Type *MVT::getTypeForValueType(MVT::ValueType VT) {
case MVT::i128: return IntegerType::get(128); case MVT::i128: return IntegerType::get(128);
case MVT::f32: return Type::FloatTy; case MVT::f32: return Type::FloatTy;
case MVT::f64: return Type::DoubleTy; case MVT::f64: return Type::DoubleTy;
case MVT::v8i8: return PackedType::get(Type::Int8Ty, 8); case MVT::v8i8: return VectorType::get(Type::Int8Ty, 8);
case MVT::v4i16: return PackedType::get(Type::Int16Ty, 4); case MVT::v4i16: return VectorType::get(Type::Int16Ty, 4);
case MVT::v2i32: return PackedType::get(Type::Int32Ty, 2); case MVT::v2i32: return VectorType::get(Type::Int32Ty, 2);
case MVT::v16i8: return PackedType::get(Type::Int8Ty, 16); case MVT::v16i8: return VectorType::get(Type::Int8Ty, 16);
case MVT::v8i16: return PackedType::get(Type::Int16Ty, 8); case MVT::v8i16: return VectorType::get(Type::Int16Ty, 8);
case MVT::v4i32: return PackedType::get(Type::Int32Ty, 4); case MVT::v4i32: return VectorType::get(Type::Int32Ty, 4);
case MVT::v2i64: return PackedType::get(Type::Int64Ty, 2); case MVT::v2i64: return VectorType::get(Type::Int64Ty, 2);
case MVT::v4f32: return PackedType::get(Type::FloatTy, 4); case MVT::v4f32: return VectorType::get(Type::FloatTy, 4);
case MVT::v2f64: return PackedType::get(Type::DoubleTy, 2); case MVT::v2f64: return VectorType::get(Type::DoubleTy, 2);
} }
} }

View File

@ -698,8 +698,8 @@ void Verifier::visitBinaryOperator(BinaryOperator &B) {
case Instruction::Or: case Instruction::Or:
case Instruction::Xor: case Instruction::Xor:
Assert1(B.getType()->isInteger() || Assert1(B.getType()->isInteger() ||
(isa<PackedType>(B.getType()) && (isa<VectorType>(B.getType()) &&
cast<PackedType>(B.getType())->getElementType()->isInteger()), cast<VectorType>(B.getType())->getElementType()->isInteger()),
"Logical operators only work with integral types!", &B); "Logical operators only work with integral types!", &B);
Assert1(B.getType() == B.getOperand(0)->getType(), Assert1(B.getType() == B.getOperand(0)->getType(),
"Logical operators must have same type for operands and result!", "Logical operators must have same type for operands and result!",
@ -719,7 +719,7 @@ void Verifier::visitBinaryOperator(BinaryOperator &B) {
"Arithmetic operators must have same type for operands and result!", "Arithmetic operators must have same type for operands and result!",
&B); &B);
Assert1(B.getType()->isInteger() || B.getType()->isFloatingPoint() || Assert1(B.getType()->isInteger() || B.getType()->isFloatingPoint() ||
isa<PackedType>(B.getType()), isa<VectorType>(B.getType()),
"Arithmetic operators must have integer, fp, or packed type!", &B); "Arithmetic operators must have integer, fp, or packed type!", &B);
break; break;
} }
@ -774,7 +774,7 @@ void Verifier::visitShuffleVectorInst(ShuffleVectorInst &SV) {
"Result of shufflevector must match first operand type!", &SV); "Result of shufflevector must match first operand type!", &SV);
// Check to see if Mask is valid. // Check to see if Mask is valid.
if (const ConstantPacked *MV = dyn_cast<ConstantPacked>(SV.getOperand(2))) { if (const ConstantVector *MV = dyn_cast<ConstantVector>(SV.getOperand(2))) {
for (unsigned i = 0, e = MV->getNumOperands(); i != e; ++i) { for (unsigned i = 0, e = MV->getNumOperands(); i != e; ++i) {
Assert1(isa<ConstantInt>(MV->getOperand(i)) || Assert1(isa<ConstantInt>(MV->getOperand(i)) ||
isa<UndefValue>(MV->getOperand(i)), isa<UndefValue>(MV->getOperand(i)),
@ -1014,9 +1014,9 @@ void Verifier::VerifyIntrinsicPrototype(Function *F, ...) {
"incorrect integer width!" + bitmsg, F); "incorrect integer width!" + bitmsg, F);
break; break;
} }
} else if (TypeID == Type::PackedTyID) { } else if (TypeID == Type::VectorTyID) {
// If this is a packed argument, verify the number and type of elements. // If this is a packed argument, verify the number and type of elements.
const PackedType *PTy = cast<PackedType>(Ty); const VectorType *PTy = cast<VectorType>(Ty);
int ElemTy = va_arg(VA, int); int ElemTy = va_arg(VA, int);
if (ElemTy != PTy->getElementType()->getTypeID()) { if (ElemTy != PTy->getElementType()->getTypeID()) {
CheckFailed("Intrinsic prototype has incorrect vector element type!", CheckFailed("Intrinsic prototype has incorrect vector element type!",

View File

@ -1,5 +1,5 @@
; Test PackedType handling by SCCP. ; Test VectorType handling by SCCP.
; SCCP ignores PackedTypes until PR 1034 is fixed ; SCCP ignores VectorTypes until PR 1034 is fixed
; ;
; RUN: llvm-upgrade < %s | llvm-as | opt -sccp ; RUN: llvm-upgrade < %s | llvm-as | opt -sccp
target datalayout = "E-p:32:32" target datalayout = "E-p:32:32"

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,342 @@
typedef union { /* A Bison parser, made by GNU Bison 2.1. */
/* Skeleton parser for Yacc-like parsing with Bison,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction.
This special exception was added by the Free Software Foundation
in version 1.24 of Bison. */
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
ESINT64VAL = 258,
EUINT64VAL = 259,
SINTVAL = 260,
UINTVAL = 261,
FPVAL = 262,
VOID = 263,
BOOL = 264,
SBYTE = 265,
UBYTE = 266,
SHORT = 267,
USHORT = 268,
INT = 269,
UINT = 270,
LONG = 271,
ULONG = 272,
FLOAT = 273,
DOUBLE = 274,
TYPE = 275,
LABEL = 276,
VAR_ID = 277,
LABELSTR = 278,
STRINGCONSTANT = 279,
IMPLEMENTATION = 280,
ZEROINITIALIZER = 281,
TRUETOK = 282,
FALSETOK = 283,
BEGINTOK = 284,
ENDTOK = 285,
DECLARE = 286,
GLOBAL = 287,
CONSTANT = 288,
SECTION = 289,
VOLATILE = 290,
TO = 291,
DOTDOTDOT = 292,
NULL_TOK = 293,
UNDEF = 294,
CONST = 295,
INTERNAL = 296,
LINKONCE = 297,
WEAK = 298,
APPENDING = 299,
DLLIMPORT = 300,
DLLEXPORT = 301,
EXTERN_WEAK = 302,
OPAQUE = 303,
NOT = 304,
EXTERNAL = 305,
TARGET = 306,
TRIPLE = 307,
ENDIAN = 308,
POINTERSIZE = 309,
LITTLE = 310,
BIG = 311,
ALIGN = 312,
DEPLIBS = 313,
CALL = 314,
TAIL = 315,
ASM_TOK = 316,
MODULE = 317,
SIDEEFFECT = 318,
CC_TOK = 319,
CCC_TOK = 320,
CSRETCC_TOK = 321,
FASTCC_TOK = 322,
COLDCC_TOK = 323,
X86_STDCALLCC_TOK = 324,
X86_FASTCALLCC_TOK = 325,
DATALAYOUT = 326,
RET = 327,
BR = 328,
SWITCH = 329,
INVOKE = 330,
UNREACHABLE = 331,
UNWIND = 332,
EXCEPT = 333,
ADD = 334,
SUB = 335,
MUL = 336,
DIV = 337,
UDIV = 338,
SDIV = 339,
FDIV = 340,
REM = 341,
UREM = 342,
SREM = 343,
FREM = 344,
AND = 345,
OR = 346,
XOR = 347,
SHL = 348,
SHR = 349,
ASHR = 350,
LSHR = 351,
SETLE = 352,
SETGE = 353,
SETLT = 354,
SETGT = 355,
SETEQ = 356,
SETNE = 357,
ICMP = 358,
FCMP = 359,
MALLOC = 360,
ALLOCA = 361,
FREE = 362,
LOAD = 363,
STORE = 364,
GETELEMENTPTR = 365,
PHI_TOK = 366,
SELECT = 367,
VAARG = 368,
EXTRACTELEMENT = 369,
INSERTELEMENT = 370,
SHUFFLEVECTOR = 371,
VAARG_old = 372,
VANEXT_old = 373,
EQ = 374,
NE = 375,
SLT = 376,
SGT = 377,
SLE = 378,
SGE = 379,
ULT = 380,
UGT = 381,
ULE = 382,
UGE = 383,
OEQ = 384,
ONE = 385,
OLT = 386,
OGT = 387,
OLE = 388,
OGE = 389,
ORD = 390,
UNO = 391,
UEQ = 392,
UNE = 393,
CAST = 394,
TRUNC = 395,
ZEXT = 396,
SEXT = 397,
FPTRUNC = 398,
FPEXT = 399,
FPTOUI = 400,
FPTOSI = 401,
UITOFP = 402,
SITOFP = 403,
PTRTOINT = 404,
INTTOPTR = 405,
BITCAST = 406
};
#endif
/* Tokens. */
#define ESINT64VAL 258
#define EUINT64VAL 259
#define SINTVAL 260
#define UINTVAL 261
#define FPVAL 262
#define VOID 263
#define BOOL 264
#define SBYTE 265
#define UBYTE 266
#define SHORT 267
#define USHORT 268
#define INT 269
#define UINT 270
#define LONG 271
#define ULONG 272
#define FLOAT 273
#define DOUBLE 274
#define TYPE 275
#define LABEL 276
#define VAR_ID 277
#define LABELSTR 278
#define STRINGCONSTANT 279
#define IMPLEMENTATION 280
#define ZEROINITIALIZER 281
#define TRUETOK 282
#define FALSETOK 283
#define BEGINTOK 284
#define ENDTOK 285
#define DECLARE 286
#define GLOBAL 287
#define CONSTANT 288
#define SECTION 289
#define VOLATILE 290
#define TO 291
#define DOTDOTDOT 292
#define NULL_TOK 293
#define UNDEF 294
#define CONST 295
#define INTERNAL 296
#define LINKONCE 297
#define WEAK 298
#define APPENDING 299
#define DLLIMPORT 300
#define DLLEXPORT 301
#define EXTERN_WEAK 302
#define OPAQUE 303
#define NOT 304
#define EXTERNAL 305
#define TARGET 306
#define TRIPLE 307
#define ENDIAN 308
#define POINTERSIZE 309
#define LITTLE 310
#define BIG 311
#define ALIGN 312
#define DEPLIBS 313
#define CALL 314
#define TAIL 315
#define ASM_TOK 316
#define MODULE 317
#define SIDEEFFECT 318
#define CC_TOK 319
#define CCC_TOK 320
#define CSRETCC_TOK 321
#define FASTCC_TOK 322
#define COLDCC_TOK 323
#define X86_STDCALLCC_TOK 324
#define X86_FASTCALLCC_TOK 325
#define DATALAYOUT 326
#define RET 327
#define BR 328
#define SWITCH 329
#define INVOKE 330
#define UNREACHABLE 331
#define UNWIND 332
#define EXCEPT 333
#define ADD 334
#define SUB 335
#define MUL 336
#define DIV 337
#define UDIV 338
#define SDIV 339
#define FDIV 340
#define REM 341
#define UREM 342
#define SREM 343
#define FREM 344
#define AND 345
#define OR 346
#define XOR 347
#define SHL 348
#define SHR 349
#define ASHR 350
#define LSHR 351
#define SETLE 352
#define SETGE 353
#define SETLT 354
#define SETGT 355
#define SETEQ 356
#define SETNE 357
#define ICMP 358
#define FCMP 359
#define MALLOC 360
#define ALLOCA 361
#define FREE 362
#define LOAD 363
#define STORE 364
#define GETELEMENTPTR 365
#define PHI_TOK 366
#define SELECT 367
#define VAARG 368
#define EXTRACTELEMENT 369
#define INSERTELEMENT 370
#define SHUFFLEVECTOR 371
#define VAARG_old 372
#define VANEXT_old 373
#define EQ 374
#define NE 375
#define SLT 376
#define SGT 377
#define SLE 378
#define SGE 379
#define ULT 380
#define UGT 381
#define ULE 382
#define UGE 383
#define OEQ 384
#define ONE 385
#define OLT 386
#define OGT 387
#define OLE 388
#define OGE 389
#define ORD 390
#define UNO 391
#define UEQ 392
#define UNE 393
#define CAST 394
#define TRUNC 395
#define ZEXT 396
#define SEXT 397
#define FPTRUNC 398
#define FPEXT 399
#define FPTOUI 400
#define FPTOSI 401
#define UITOFP 402
#define SITOFP 403
#define PTRTOINT 404
#define INTTOPTR 405
#define BITCAST 406
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
#line 1454 "/proj/llvm/llvm-1/tools/llvm-upgrade/UpgradeParser.y"
typedef union YYSTYPE {
llvm::Module *ModuleVal; llvm::Module *ModuleVal;
llvm::Function *FunctionVal; llvm::Function *FunctionVal;
std::pair<llvm::PATypeInfo, char*> *ArgVal; std::pair<llvm::PATypeInfo, char*> *ArgVal;
@ -39,155 +377,14 @@ typedef union {
llvm::FCmpInst::Predicate FPred; llvm::FCmpInst::Predicate FPred;
llvm::Module::Endianness Endianness; llvm::Module::Endianness Endianness;
} YYSTYPE; } YYSTYPE;
#define ESINT64VAL 257 /* Line 1447 of yacc.c. */
#define EUINT64VAL 258 #line 382 "UpgradeParser.tab.h"
#define SINTVAL 259 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
#define UINTVAL 260 # define YYSTYPE_IS_DECLARED 1
#define FPVAL 261 # define YYSTYPE_IS_TRIVIAL 1
#define VOID 262 #endif
#define BOOL 263
#define SBYTE 264
#define UBYTE 265
#define SHORT 266
#define USHORT 267
#define INT 268
#define UINT 269
#define LONG 270
#define ULONG 271
#define FLOAT 272
#define DOUBLE 273
#define TYPE 274
#define LABEL 275
#define VAR_ID 276
#define LABELSTR 277
#define STRINGCONSTANT 278
#define IMPLEMENTATION 279
#define ZEROINITIALIZER 280
#define TRUETOK 281
#define FALSETOK 282
#define BEGINTOK 283
#define ENDTOK 284
#define DECLARE 285
#define GLOBAL 286
#define CONSTANT 287
#define SECTION 288
#define VOLATILE 289
#define TO 290
#define DOTDOTDOT 291
#define NULL_TOK 292
#define UNDEF 293
#define CONST 294
#define INTERNAL 295
#define LINKONCE 296
#define WEAK 297
#define APPENDING 298
#define DLLIMPORT 299
#define DLLEXPORT 300
#define EXTERN_WEAK 301
#define OPAQUE 302
#define NOT 303
#define EXTERNAL 304
#define TARGET 305
#define TRIPLE 306
#define ENDIAN 307
#define POINTERSIZE 308
#define LITTLE 309
#define BIG 310
#define ALIGN 311
#define DEPLIBS 312
#define CALL 313
#define TAIL 314
#define ASM_TOK 315
#define MODULE 316
#define SIDEEFFECT 317
#define CC_TOK 318
#define CCC_TOK 319
#define CSRETCC_TOK 320
#define FASTCC_TOK 321
#define COLDCC_TOK 322
#define X86_STDCALLCC_TOK 323
#define X86_FASTCALLCC_TOK 324
#define DATALAYOUT 325
#define RET 326
#define BR 327
#define SWITCH 328
#define INVOKE 329
#define UNREACHABLE 330
#define UNWIND 331
#define EXCEPT 332
#define ADD 333
#define SUB 334
#define MUL 335
#define DIV 336
#define UDIV 337
#define SDIV 338
#define FDIV 339
#define REM 340
#define UREM 341
#define SREM 342
#define FREM 343
#define AND 344
#define OR 345
#define XOR 346
#define SHL 347
#define SHR 348
#define ASHR 349
#define LSHR 350
#define SETLE 351
#define SETGE 352
#define SETLT 353
#define SETGT 354
#define SETEQ 355
#define SETNE 356
#define ICMP 357
#define FCMP 358
#define MALLOC 359
#define ALLOCA 360
#define FREE 361
#define LOAD 362
#define STORE 363
#define GETELEMENTPTR 364
#define PHI_TOK 365
#define SELECT 366
#define VAARG 367
#define EXTRACTELEMENT 368
#define INSERTELEMENT 369
#define SHUFFLEVECTOR 370
#define VAARG_old 371
#define VANEXT_old 372
#define EQ 373
#define NE 374
#define SLT 375
#define SGT 376
#define SLE 377
#define SGE 378
#define ULT 379
#define UGT 380
#define ULE 381
#define UGE 382
#define OEQ 383
#define ONE 384
#define OLT 385
#define OGT 386
#define OLE 387
#define OGE 388
#define ORD 389
#define UNO 390
#define UEQ 391
#define UNE 392
#define CAST 393
#define TRUNC 394
#define ZEXT 395
#define SEXT 396
#define FPTRUNC 397
#define FPEXT 398
#define FPTOUI 399
#define FPTOSI 400
#define UITOFP 401
#define SITOFP 402
#define PTRTOINT 403
#define INTTOPTR 404
#define BITCAST 405
extern YYSTYPE Upgradelval; extern YYSTYPE Upgradelval;

View File

@ -998,7 +998,7 @@ getBinaryOp(BinaryOps op, const Type *Ty, Signedness Sign) {
// This is an obsolete instruction so we must upgrade it based on the // This is an obsolete instruction so we must upgrade it based on the
// types of its operands. // types of its operands.
bool isFP = Ty->isFloatingPoint(); bool isFP = Ty->isFloatingPoint();
if (const PackedType* PTy = dyn_cast<PackedType>(Ty)) if (const VectorType* PTy = dyn_cast<VectorType>(Ty))
// If its a packed type we want to use the element type // If its a packed type we want to use the element type
isFP = PTy->getElementType()->isFloatingPoint(); isFP = PTy->getElementType()->isFloatingPoint();
if (isFP) if (isFP)
@ -1014,7 +1014,7 @@ getBinaryOp(BinaryOps op, const Type *Ty, Signedness Sign) {
// This is an obsolete instruction so we must upgrade it based on the // This is an obsolete instruction so we must upgrade it based on the
// types of its operands. // types of its operands.
bool isFP = Ty->isFloatingPoint(); bool isFP = Ty->isFloatingPoint();
if (const PackedType* PTy = dyn_cast<PackedType>(Ty)) if (const VectorType* PTy = dyn_cast<VectorType>(Ty))
// If its a packed type we want to use the element type // If its a packed type we want to use the element type
isFP = PTy->getElementType()->isFloatingPoint(); isFP = PTy->getElementType()->isFloatingPoint();
// Select correct opcode // Select correct opcode
@ -1846,10 +1846,10 @@ UpRTypes
if ((unsigned)$2 != $2) if ((unsigned)$2 != $2)
error("Unsigned result not equal to signed result"); error("Unsigned result not equal to signed result");
if (!(ElemTy->isInteger() || ElemTy->isFloatingPoint())) if (!(ElemTy->isInteger() || ElemTy->isFloatingPoint()))
error("Elements of a PackedType must be integer or floating point"); error("Elements of a VectorType must be integer or floating point");
if (!isPowerOf2_32($2)) if (!isPowerOf2_32($2))
error("PackedType length should be a power of 2"); error("VectorType length should be a power of 2");
$$.PAT = new PATypeHolder(HandleUpRefs(PackedType::get(ElemTy, $$.PAT = new PATypeHolder(HandleUpRefs(VectorType::get(ElemTy,
(unsigned)$2))); (unsigned)$2)));
$$.S = $4.S; $$.S = $4.S;
delete $4.PAT; delete $4.PAT;
@ -1999,7 +1999,7 @@ ConstVal
delete $1.PAT; delete $1.PAT;
} }
| Types '<' ConstVector '>' { // Nonempty unsized arr | Types '<' ConstVector '>' { // Nonempty unsized arr
const PackedType *PTy = dyn_cast<PackedType>($1.PAT->get()); const VectorType *PTy = dyn_cast<VectorType>($1.PAT->get());
if (PTy == 0) if (PTy == 0)
error("Cannot make packed constant with type: '" + error("Cannot make packed constant with type: '" +
$1.PAT->get()->getDescription() + "'"); $1.PAT->get()->getDescription() + "'");
@ -2021,7 +2021,7 @@ ConstVal
ValTy->getDescription() + "'"); ValTy->getDescription() + "'");
Elems.push_back(C); Elems.push_back(C);
} }
$$.C = ConstantPacked::get(PTy, Elems); $$.C = ConstantVector::get(PTy, Elems);
$$.S = $1.S; $$.S = $1.S;
delete $1.PAT; delete $1.PAT;
delete $3; delete $3;
@ -2280,8 +2280,8 @@ ConstExpr
if (Ty != $5.C->getType()) if (Ty != $5.C->getType())
error("Logical operator types must match"); error("Logical operator types must match");
if (!Ty->isInteger()) { if (!Ty->isInteger()) {
if (!isa<PackedType>(Ty) || if (!isa<VectorType>(Ty) ||
!cast<PackedType>(Ty)->getElementType()->isInteger()) !cast<VectorType>(Ty)->getElementType()->isInteger())
error("Logical operator requires integer operands"); error("Logical operator requires integer operands");
} }
Instruction::BinaryOps Opcode = getBinaryOp($1, Ty, $3.S); Instruction::BinaryOps Opcode = getBinaryOp($1, Ty, $3.S);
@ -2802,9 +2802,9 @@ ConstValueRef
| '<' ConstVector '>' { // Nonempty unsized packed vector | '<' ConstVector '>' { // Nonempty unsized packed vector
const Type *ETy = (*$2)[0].C->getType(); const Type *ETy = (*$2)[0].C->getType();
int NumElements = $2->size(); int NumElements = $2->size();
PackedType* pt = PackedType::get(ETy, NumElements); VectorType* pt = VectorType::get(ETy, NumElements);
PATypeHolder* PTy = new PATypeHolder( PATypeHolder* PTy = new PATypeHolder(
HandleUpRefs(PackedType::get(ETy, NumElements))); HandleUpRefs(VectorType::get(ETy, NumElements)));
// Verify all elements are correct type! // Verify all elements are correct type!
std::vector<Constant*> Elems; std::vector<Constant*> Elems;
@ -2817,7 +2817,7 @@ ConstValueRef
CTy->getDescription() + "'"); CTy->getDescription() + "'");
Elems.push_back(C); Elems.push_back(C);
} }
$$ = ValID::create(ConstantPacked::get(pt, Elems)); $$ = ValID::create(ConstantVector::get(pt, Elems));
delete PTy; delete $2; delete PTy; delete $2;
} }
| ConstExpr { | ConstExpr {
@ -3108,9 +3108,9 @@ OptTailCall
InstVal InstVal
: ArithmeticOps Types ValueRef ',' ValueRef { : ArithmeticOps Types ValueRef ',' ValueRef {
const Type* Ty = $2.PAT->get(); const Type* Ty = $2.PAT->get();
if (!Ty->isInteger() && !Ty->isFloatingPoint() && !isa<PackedType>(Ty)) if (!Ty->isInteger() && !Ty->isFloatingPoint() && !isa<VectorType>(Ty))
error("Arithmetic operator requires integer, FP, or packed operands"); error("Arithmetic operator requires integer, FP, or packed operands");
if (isa<PackedType>(Ty) && if (isa<VectorType>(Ty) &&
($1 == URemOp || $1 == SRemOp || $1 == FRemOp || $1 == RemOp)) ($1 == URemOp || $1 == SRemOp || $1 == FRemOp || $1 == RemOp))
error("Remainder not supported on packed types"); error("Remainder not supported on packed types");
// Upgrade the opcode from obsolete versions before we do anything with it. // Upgrade the opcode from obsolete versions before we do anything with it.
@ -3126,8 +3126,8 @@ InstVal
| LogicalOps Types ValueRef ',' ValueRef { | LogicalOps Types ValueRef ',' ValueRef {
const Type *Ty = $2.PAT->get(); const Type *Ty = $2.PAT->get();
if (!Ty->isInteger()) { if (!Ty->isInteger()) {
if (!isa<PackedType>(Ty) || if (!isa<VectorType>(Ty) ||
!cast<PackedType>(Ty)->getElementType()->isInteger()) !cast<VectorType>(Ty)->getElementType()->isInteger())
error("Logical operator requires integral operands"); error("Logical operator requires integral operands");
} }
Instruction::BinaryOps Opcode = getBinaryOp($1, Ty, $2.S); Instruction::BinaryOps Opcode = getBinaryOp($1, Ty, $2.S);
@ -3141,8 +3141,8 @@ InstVal
} }
| SetCondOps Types ValueRef ',' ValueRef { | SetCondOps Types ValueRef ',' ValueRef {
const Type* Ty = $2.PAT->get(); const Type* Ty = $2.PAT->get();
if(isa<PackedType>(Ty)) if(isa<VectorType>(Ty))
error("PackedTypes currently not supported in setcc instructions"); error("VectorTypes currently not supported in setcc instructions");
unsigned short pred; unsigned short pred;
Instruction::OtherOps Opcode = getCompareOp($1, pred, Ty, $2.S); Instruction::OtherOps Opcode = getCompareOp($1, pred, Ty, $2.S);
Value* tmpVal1 = getVal(Ty, $3); Value* tmpVal1 = getVal(Ty, $3);
@ -3155,8 +3155,8 @@ InstVal
} }
| ICMP IPredicates Types ValueRef ',' ValueRef { | ICMP IPredicates Types ValueRef ',' ValueRef {
const Type *Ty = $3.PAT->get(); const Type *Ty = $3.PAT->get();
if (isa<PackedType>(Ty)) if (isa<VectorType>(Ty))
error("PackedTypes currently not supported in icmp instructions"); error("VectorTypes currently not supported in icmp instructions");
else if (!Ty->isInteger() && !isa<PointerType>(Ty)) else if (!Ty->isInteger() && !isa<PointerType>(Ty))
error("icmp requires integer or pointer typed operands"); error("icmp requires integer or pointer typed operands");
Value* tmpVal1 = getVal(Ty, $4); Value* tmpVal1 = getVal(Ty, $4);
@ -3167,8 +3167,8 @@ InstVal
} }
| FCMP FPredicates Types ValueRef ',' ValueRef { | FCMP FPredicates Types ValueRef ',' ValueRef {
const Type *Ty = $3.PAT->get(); const Type *Ty = $3.PAT->get();
if (isa<PackedType>(Ty)) if (isa<VectorType>(Ty))
error("PackedTypes currently not supported in fcmp instructions"); error("VectorTypes currently not supported in fcmp instructions");
else if (!Ty->isFloatingPoint()) else if (!Ty->isFloatingPoint())
error("fcmp instruction requires floating point operands"); error("fcmp instruction requires floating point operands");
Value* tmpVal1 = getVal(Ty, $4); Value* tmpVal1 = getVal(Ty, $4);

View File

@ -998,7 +998,7 @@ getBinaryOp(BinaryOps op, const Type *Ty, Signedness Sign) {
// This is an obsolete instruction so we must upgrade it based on the // This is an obsolete instruction so we must upgrade it based on the
// types of its operands. // types of its operands.
bool isFP = Ty->isFloatingPoint(); bool isFP = Ty->isFloatingPoint();
if (const PackedType* PTy = dyn_cast<PackedType>(Ty)) if (const VectorType* PTy = dyn_cast<VectorType>(Ty))
// If its a packed type we want to use the element type // If its a packed type we want to use the element type
isFP = PTy->getElementType()->isFloatingPoint(); isFP = PTy->getElementType()->isFloatingPoint();
if (isFP) if (isFP)
@ -1014,7 +1014,7 @@ getBinaryOp(BinaryOps op, const Type *Ty, Signedness Sign) {
// This is an obsolete instruction so we must upgrade it based on the // This is an obsolete instruction so we must upgrade it based on the
// types of its operands. // types of its operands.
bool isFP = Ty->isFloatingPoint(); bool isFP = Ty->isFloatingPoint();
if (const PackedType* PTy = dyn_cast<PackedType>(Ty)) if (const VectorType* PTy = dyn_cast<VectorType>(Ty))
// If its a packed type we want to use the element type // If its a packed type we want to use the element type
isFP = PTy->getElementType()->isFloatingPoint(); isFP = PTy->getElementType()->isFloatingPoint();
// Select correct opcode // Select correct opcode
@ -1846,10 +1846,10 @@ UpRTypes
if ((unsigned)$2 != $2) if ((unsigned)$2 != $2)
error("Unsigned result not equal to signed result"); error("Unsigned result not equal to signed result");
if (!(ElemTy->isInteger() || ElemTy->isFloatingPoint())) if (!(ElemTy->isInteger() || ElemTy->isFloatingPoint()))
error("Elements of a PackedType must be integer or floating point"); error("Elements of a VectorType must be integer or floating point");
if (!isPowerOf2_32($2)) if (!isPowerOf2_32($2))
error("PackedType length should be a power of 2"); error("VectorType length should be a power of 2");
$$.PAT = new PATypeHolder(HandleUpRefs(PackedType::get(ElemTy, $$.PAT = new PATypeHolder(HandleUpRefs(VectorType::get(ElemTy,
(unsigned)$2))); (unsigned)$2)));
$$.S = $4.S; $$.S = $4.S;
delete $4.PAT; delete $4.PAT;
@ -1999,7 +1999,7 @@ ConstVal
delete $1.PAT; delete $1.PAT;
} }
| Types '<' ConstVector '>' { // Nonempty unsized arr | Types '<' ConstVector '>' { // Nonempty unsized arr
const PackedType *PTy = dyn_cast<PackedType>($1.PAT->get()); const VectorType *PTy = dyn_cast<VectorType>($1.PAT->get());
if (PTy == 0) if (PTy == 0)
error("Cannot make packed constant with type: '" + error("Cannot make packed constant with type: '" +
$1.PAT->get()->getDescription() + "'"); $1.PAT->get()->getDescription() + "'");
@ -2021,7 +2021,7 @@ ConstVal
ValTy->getDescription() + "'"); ValTy->getDescription() + "'");
Elems.push_back(C); Elems.push_back(C);
} }
$$.C = ConstantPacked::get(PTy, Elems); $$.C = ConstantVector::get(PTy, Elems);
$$.S = $1.S; $$.S = $1.S;
delete $1.PAT; delete $1.PAT;
delete $3; delete $3;
@ -2280,8 +2280,8 @@ ConstExpr
if (Ty != $5.C->getType()) if (Ty != $5.C->getType())
error("Logical operator types must match"); error("Logical operator types must match");
if (!Ty->isInteger()) { if (!Ty->isInteger()) {
if (!isa<PackedType>(Ty) || if (!isa<VectorType>(Ty) ||
!cast<PackedType>(Ty)->getElementType()->isInteger()) !cast<VectorType>(Ty)->getElementType()->isInteger())
error("Logical operator requires integer operands"); error("Logical operator requires integer operands");
} }
Instruction::BinaryOps Opcode = getBinaryOp($1, Ty, $3.S); Instruction::BinaryOps Opcode = getBinaryOp($1, Ty, $3.S);
@ -2802,9 +2802,9 @@ ConstValueRef
| '<' ConstVector '>' { // Nonempty unsized packed vector | '<' ConstVector '>' { // Nonempty unsized packed vector
const Type *ETy = (*$2)[0].C->getType(); const Type *ETy = (*$2)[0].C->getType();
int NumElements = $2->size(); int NumElements = $2->size();
PackedType* pt = PackedType::get(ETy, NumElements); VectorType* pt = VectorType::get(ETy, NumElements);
PATypeHolder* PTy = new PATypeHolder( PATypeHolder* PTy = new PATypeHolder(
HandleUpRefs(PackedType::get(ETy, NumElements))); HandleUpRefs(VectorType::get(ETy, NumElements)));
// Verify all elements are correct type! // Verify all elements are correct type!
std::vector<Constant*> Elems; std::vector<Constant*> Elems;
@ -2817,7 +2817,7 @@ ConstValueRef
CTy->getDescription() + "'"); CTy->getDescription() + "'");
Elems.push_back(C); Elems.push_back(C);
} }
$$ = ValID::create(ConstantPacked::get(pt, Elems)); $$ = ValID::create(ConstantVector::get(pt, Elems));
delete PTy; delete $2; delete PTy; delete $2;
} }
| ConstExpr { | ConstExpr {
@ -3108,9 +3108,9 @@ OptTailCall
InstVal InstVal
: ArithmeticOps Types ValueRef ',' ValueRef { : ArithmeticOps Types ValueRef ',' ValueRef {
const Type* Ty = $2.PAT->get(); const Type* Ty = $2.PAT->get();
if (!Ty->isInteger() && !Ty->isFloatingPoint() && !isa<PackedType>(Ty)) if (!Ty->isInteger() && !Ty->isFloatingPoint() && !isa<VectorType>(Ty))
error("Arithmetic operator requires integer, FP, or packed operands"); error("Arithmetic operator requires integer, FP, or packed operands");
if (isa<PackedType>(Ty) && if (isa<VectorType>(Ty) &&
($1 == URemOp || $1 == SRemOp || $1 == FRemOp || $1 == RemOp)) ($1 == URemOp || $1 == SRemOp || $1 == FRemOp || $1 == RemOp))
error("Remainder not supported on packed types"); error("Remainder not supported on packed types");
// Upgrade the opcode from obsolete versions before we do anything with it. // Upgrade the opcode from obsolete versions before we do anything with it.
@ -3126,8 +3126,8 @@ InstVal
| LogicalOps Types ValueRef ',' ValueRef { | LogicalOps Types ValueRef ',' ValueRef {
const Type *Ty = $2.PAT->get(); const Type *Ty = $2.PAT->get();
if (!Ty->isInteger()) { if (!Ty->isInteger()) {
if (!isa<PackedType>(Ty) || if (!isa<VectorType>(Ty) ||
!cast<PackedType>(Ty)->getElementType()->isInteger()) !cast<VectorType>(Ty)->getElementType()->isInteger())
error("Logical operator requires integral operands"); error("Logical operator requires integral operands");
} }
Instruction::BinaryOps Opcode = getBinaryOp($1, Ty, $2.S); Instruction::BinaryOps Opcode = getBinaryOp($1, Ty, $2.S);
@ -3141,8 +3141,8 @@ InstVal
} }
| SetCondOps Types ValueRef ',' ValueRef { | SetCondOps Types ValueRef ',' ValueRef {
const Type* Ty = $2.PAT->get(); const Type* Ty = $2.PAT->get();
if(isa<PackedType>(Ty)) if(isa<VectorType>(Ty))
error("PackedTypes currently not supported in setcc instructions"); error("VectorTypes currently not supported in setcc instructions");
unsigned short pred; unsigned short pred;
Instruction::OtherOps Opcode = getCompareOp($1, pred, Ty, $2.S); Instruction::OtherOps Opcode = getCompareOp($1, pred, Ty, $2.S);
Value* tmpVal1 = getVal(Ty, $3); Value* tmpVal1 = getVal(Ty, $3);
@ -3155,8 +3155,8 @@ InstVal
} }
| ICMP IPredicates Types ValueRef ',' ValueRef { | ICMP IPredicates Types ValueRef ',' ValueRef {
const Type *Ty = $3.PAT->get(); const Type *Ty = $3.PAT->get();
if (isa<PackedType>(Ty)) if (isa<VectorType>(Ty))
error("PackedTypes currently not supported in icmp instructions"); error("VectorTypes currently not supported in icmp instructions");
else if (!Ty->isInteger() && !isa<PointerType>(Ty)) else if (!Ty->isInteger() && !isa<PointerType>(Ty))
error("icmp requires integer or pointer typed operands"); error("icmp requires integer or pointer typed operands");
Value* tmpVal1 = getVal(Ty, $4); Value* tmpVal1 = getVal(Ty, $4);
@ -3167,8 +3167,8 @@ InstVal
} }
| FCMP FPredicates Types ValueRef ',' ValueRef { | FCMP FPredicates Types ValueRef ',' ValueRef {
const Type *Ty = $3.PAT->get(); const Type *Ty = $3.PAT->get();
if (isa<PackedType>(Ty)) if (isa<VectorType>(Ty))
error("PackedTypes currently not supported in fcmp instructions"); error("VectorTypes currently not supported in fcmp instructions");
else if (!Ty->isFloatingPoint()) else if (!Ty->isFloatingPoint())
error("fcmp instruction requires floating point operands"); error("fcmp instruction requires floating point operands");
Value* tmpVal1 = getVal(Ty, $4); Value* tmpVal1 = getVal(Ty, $4);

View File

@ -174,7 +174,7 @@ getTypePrefix(const Type* Ty ) {
case Type::StructTyID: return "struct_"; case Type::StructTyID: return "struct_";
case Type::ArrayTyID: return "array_"; case Type::ArrayTyID: return "array_";
case Type::PointerTyID: return "ptr_"; case Type::PointerTyID: return "ptr_";
case Type::PackedTyID: return "packed_"; case Type::VectorTyID: return "packed_";
case Type::OpaqueTyID: return "opaque_"; case Type::OpaqueTyID: return "opaque_";
default: return "other_"; default: return "other_";
} }
@ -338,7 +338,7 @@ CppWriter::getCppName(const Type* Ty)
case Type::ArrayTyID: prefix = "ArrayTy_"; break; case Type::ArrayTyID: prefix = "ArrayTy_"; break;
case Type::PointerTyID: prefix = "PointerTy_"; break; case Type::PointerTyID: prefix = "PointerTy_"; break;
case Type::OpaqueTyID: prefix = "OpaqueTy_"; break; case Type::OpaqueTyID: prefix = "OpaqueTy_"; break;
case Type::PackedTyID: prefix = "PackedTy_"; break; case Type::VectorTyID: prefix = "PackedTy_"; break;
default: prefix = "OtherTy_"; break; // prevent breakage default: prefix = "OtherTy_"; break; // prevent breakage
} }
@ -512,12 +512,12 @@ CppWriter::printTypeInternal(const Type* Ty) {
nl(Out); nl(Out);
break; break;
} }
case Type::PackedTyID: { case Type::VectorTyID: {
const PackedType* PT = cast<PackedType>(Ty); const VectorType* PT = cast<VectorType>(Ty);
const Type* ET = PT->getElementType(); const Type* ET = PT->getElementType();
bool isForward = printTypeInternal(ET); bool isForward = printTypeInternal(ET);
std::string elemName(getCppName(ET)); std::string elemName(getCppName(ET));
Out << "PackedType* " << typeName << " = PackedType::get(" Out << "VectorType* " << typeName << " = VectorType::get("
<< elemName << (isForward ? "_fwd" : "") << elemName << (isForward ? "_fwd" : "")
<< ", " << utostr(PT->getNumElements()) << ");"; << ", " << utostr(PT->getNumElements()) << ");";
nl(Out); nl(Out);
@ -560,7 +560,7 @@ CppWriter::printTypeInternal(const Type* Ty) {
case Type::FunctionTyID: Out << "FunctionType"; break; case Type::FunctionTyID: Out << "FunctionType"; break;
case Type::ArrayTyID: Out << "ArrayType"; break; case Type::ArrayTyID: Out << "ArrayType"; break;
case Type::StructTyID: Out << "StructType"; break; case Type::StructTyID: Out << "StructType"; break;
case Type::PackedTyID: Out << "PackedType"; break; case Type::VectorTyID: Out << "VectorType"; break;
case Type::PointerTyID: Out << "PointerType"; break; case Type::PointerTyID: Out << "PointerType"; break;
case Type::OpaqueTyID: Out << "OpaqueType"; break; case Type::OpaqueTyID: Out << "OpaqueType"; break;
default: Out << "NoSuchDerivedType"; break; default: Out << "NoSuchDerivedType"; break;
@ -711,7 +711,7 @@ void CppWriter::printConstant(const Constant *CV) {
} }
Out << "Constant* " << constName << " = ConstantStruct::get(" Out << "Constant* " << constName << " = ConstantStruct::get("
<< typeName << ", " << constName << "_fields);"; << typeName << ", " << constName << "_fields);";
} else if (const ConstantPacked *CP = dyn_cast<ConstantPacked>(CV)) { } else if (const ConstantVector *CP = dyn_cast<ConstantVector>(CV)) {
Out << "std::vector<Constant*> " << constName << "_elems;"; Out << "std::vector<Constant*> " << constName << "_elems;";
nl(Out); nl(Out);
unsigned N = CP->getNumOperands(); unsigned N = CP->getNumOperands();
@ -721,7 +721,7 @@ void CppWriter::printConstant(const Constant *CV) {
<< getCppName(CP->getOperand(i)) << ");"; << getCppName(CP->getOperand(i)) << ");";
nl(Out); nl(Out);
} }
Out << "Constant* " << constName << " = ConstantPacked::get(" Out << "Constant* " << constName << " = ConstantVector::get("
<< typeName << ", " << constName << "_elems);"; << typeName << ", " << constName << "_elems);";
} else if (isa<UndefValue>(CV)) { } else if (isa<UndefValue>(CV)) {
Out << "UndefValue* " << constName << " = UndefValue::get(" Out << "UndefValue* " << constName << " = UndefValue::get("

View File

@ -120,7 +120,7 @@ static bool EmitTypeVerify(std::ostream &OS, Record *ArgType) {
OS << ArgType->getValueAsInt("Width") << ", "; OS << ArgType->getValueAsInt("Width") << ", ";
// If this is a packed type, check that the subtype and size are correct. // If this is a packed type, check that the subtype and size are correct.
else if (ArgType->isSubClassOf("LLVMPackedType")) { else if (ArgType->isSubClassOf("LLVMVectorType")) {
EmitTypeVerify(OS, ArgType->getValueAsDef("ElTy")); EmitTypeVerify(OS, ArgType->getValueAsDef("ElTy"));
OS << ArgType->getValueAsInt("NumElts") << ", "; OS << ArgType->getValueAsInt("NumElts") << ", ";
} }
@ -131,8 +131,8 @@ static bool EmitTypeVerify(std::ostream &OS, Record *ArgType) {
static void EmitTypeGenerate(std::ostream &OS, Record *ArgType) { static void EmitTypeGenerate(std::ostream &OS, Record *ArgType) {
if (ArgType->isSubClassOf("LLVMIntegerType")) { if (ArgType->isSubClassOf("LLVMIntegerType")) {
OS << "IntegerType::get(" << ArgType->getValueAsInt("Width") << ")"; OS << "IntegerType::get(" << ArgType->getValueAsInt("Width") << ")";
} else if (ArgType->isSubClassOf("LLVMPackedType")) { } else if (ArgType->isSubClassOf("LLVMVectorType")) {
OS << "PackedType::get("; OS << "VectorType::get(";
EmitTypeGenerate(OS, ArgType->getValueAsDef("ElTy")); EmitTypeGenerate(OS, ArgType->getValueAsDef("ElTy"));
OS << ", " << ArgType->getValueAsInt("NumElts") << ")"; OS << ", " << ArgType->getValueAsInt("NumElts") << ")";
} else if (ArgType->isSubClassOf("LLVMPointerType")) { } else if (ArgType->isSubClassOf("LLVMPointerType")) {