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>
<dt><tt>PointerType</tt></dt>
<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
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

View File

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

View File

@ -28,7 +28,7 @@ namespace llvm {
class ArrayType;
class StructType;
class PointerType;
class PackedType;
class VectorType;
template<class ConstantClass, class TypeClass, class ValType>
struct ConstantCreator;
@ -334,31 +334,31 @@ public:
};
//===----------------------------------------------------------------------===//
/// ConstantPacked - Constant Packed Declarations
/// ConstantVector - Constant Vector Declarations
///
class ConstantPacked : public Constant {
friend struct ConstantCreator<ConstantPacked, PackedType,
class ConstantVector : public Constant {
friend struct ConstantCreator<ConstantVector, VectorType,
std::vector<Constant*> >;
ConstantPacked(const ConstantPacked &); // DO NOT IMPLEMENT
ConstantVector(const ConstantVector &); // DO NOT IMPLEMENT
protected:
ConstantPacked(const PackedType *T, const std::vector<Constant*> &Val);
~ConstantPacked();
ConstantVector(const VectorType *T, const std::vector<Constant*> &Val);
~ConstantVector();
public:
/// 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);
/// 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.
///
inline const PackedType *getType() const {
return reinterpret_cast<const PackedType*>(Value::getType());
inline const VectorType *getType() const {
return reinterpret_cast<const VectorType*>(Value::getType());
}
/// @returns the value for an packed integer constant of the given type that
/// has all its bits set to true.
/// @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
/// getNullValue. This always returns false because zero arrays are always
@ -375,9 +375,9 @@ public:
virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U);
/// 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) {
return V->getValueType() == ConstantPackedVal;
return V->getValueType() == ConstantVectorVal;
}
};

View File

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

View File

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

View File

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

View File

@ -38,7 +38,7 @@ namespace llvm {
class SelectionDAG;
class MachineBasicBlock;
class MachineInstr;
class PackedType;
class VectorType;
//===----------------------------------------------------------------------===//
/// TargetLowering - This class defines information used to lower LLVM code to
@ -198,16 +198,16 @@ public:
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
/// 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.
///
/// 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.
///
unsigned getPackedTypeBreakdown(const PackedType *PTy,
unsigned getVectorTypeBreakdown(const VectorType *PTy,
MVT::ValueType &PTyElementVT,
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.
//
FunctionPass *createLowerPackedPass();

View File

@ -81,7 +81,7 @@ public:
ArrayTyID, ///< 8: Arrays
PointerTyID, ///< 9: Pointers
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
LastPrimitiveTyID = LabelTyID,
@ -191,7 +191,7 @@ public:
///
inline bool isFirstClassType() const {
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
@ -204,7 +204,7 @@ public:
return true;
// If it is not something that can have a size (e.g. a function or label),
// it doesn't have a size.
if (ID != StructTyID && ID != ArrayTyID && ID != PackedTyID &&
if (ID != StructTyID && ID != ArrayTyID && ID != VectorTyID &&
ID != PackedStructTyID)
return false;
// 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
ConstantArrayVal, // This is an instance of ConstantArray
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
InlineAsmVal, // This is an instance of InlineAsm
InstructionVal, // This is an instance of Instruction

View File

@ -689,7 +689,7 @@ BasicAliasAnalysis::CheckGEPInstructions(
if (const ArrayType *AT = dyn_cast<ArrayType>(BasePtr1Ty)) {
if (Op1C->getZExtValue() >= AT->getNumElements())
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())
return MayAlias; // Be conservative with out-of-range accesses
}
@ -707,7 +707,7 @@ BasicAliasAnalysis::CheckGEPInstructions(
//
if (const ArrayType *AT = dyn_cast<ArrayType>(BasePtr1Ty))
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);
}
@ -719,7 +719,7 @@ BasicAliasAnalysis::CheckGEPInstructions(
if (const ArrayType *AT = dyn_cast<ArrayType>(BasePtr1Ty)) {
if (Op2C->getZExtValue() >= AT->getNumElements())
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())
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());
else
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())
return 0;
if (ConstantPacked *CP = dyn_cast<ConstantPacked>(C))
if (ConstantVector *CP = dyn_cast<ConstantVector>(C))
C = CP->getOperand(CI->getZExtValue());
else if (isa<ConstantAggregateZero>(C))
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::Function *FunctionVal;
llvm::BasicBlock *BasicBlockVal;
@ -43,135 +341,14 @@ typedef union {
llvm::ICmpInst::Predicate IPredicate;
llvm::FCmpInst::Predicate FPredicate;
} YYSTYPE;
#define ESINT64VAL 257
#define EUINT64VAL 258
#define LOCALVAL_ID 259
#define GLOBALVAL_ID 260
#define FPVAL 261
#define VOID 262
#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
/* Line 1447 of yacc.c. */
#line 346 "llvmAsmParser.tab.h"
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif
extern YYSTYPE llvmAsmlval;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -805,8 +805,8 @@ void AsmPrinter::EmitGlobalConstant(const Constant *CV) {
}
return;
}
} else if (const ConstantPacked *CP = dyn_cast<ConstantPacked>(CV)) {
const PackedType *PTy = CP->getType();
} else if (const ConstantVector *CP = dyn_cast<ConstantVector>(CV)) {
const VectorType *PTy = CP->getType();
for (unsigned I = 0, E = PTy->getNumElements(); I < E; ++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)) {
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());
for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i)
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));
}
}
Constant *CP = ConstantPacked::get(CV);
Constant *CP = ConstantVector::get(CV);
SDOperand CPIdx = DAG.getConstantPool(CP, TLI.getPointerTy());
return DAG.getLoad(VT, DAG.getEntryNode(), CPIdx, NULL, 0);
}

View File

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

View File

@ -278,13 +278,13 @@ const char *TargetLowering::getTargetNodeName(unsigned Opcode) const {
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
/// 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.
///
unsigned TargetLowering::getPackedTypeBreakdown(const PackedType *PTy,
unsigned TargetLowering::getVectorTypeBreakdown(const VectorType *PTy,
MVT::ValueType &PTyElementVT,
MVT::ValueType &PTyLegalElementVT) const {
// 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::DoubleTyID: return MVT::f64;
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) {
if (isa<UndefValue>(Init)) {
return;
} else if (const ConstantPacked *CP = dyn_cast<ConstantPacked>(Init)) {
} else if (const ConstantVector *CP = dyn_cast<ConstantVector>(Init)) {
unsigned ElementSize =
getTargetData()->getTypeSize(CP->getType()->getElementType());
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);
} else if (isa<ConstantPointerNull>(CPV) || isa<UndefValue>(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());
for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i)
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)) {
std::vector<Constant*> Ops;
for (unsigned i = 0, e = CE->getNumOperands(); i != e; ++i)

View File

@ -151,7 +151,7 @@ namespace {
void printConstantWithCast(Constant *CPV, unsigned Opcode);
bool printConstExprCast(const ConstantExpr *CE);
void printConstantArray(ConstantArray *CPA);
void printConstantPacked(ConstantPacked *CP);
void printConstantVector(ConstantVector *CP);
// isInlinableInst - Attempt to inline instructions into their uses to build
// 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;
if (isa<ArrayType>(PTy->getElementType()) ||
isa<PackedType>(PTy->getElementType()))
isa<VectorType>(PTy->getElementType()))
ptrName = "(" + 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) + "]");
}
case Type::PackedTyID: {
const PackedType *PTy = cast<PackedType>(Ty);
case Type::VectorTyID: {
const VectorType *PTy = cast<VectorType>(Ty);
unsigned NumElements = PTy->getNumElements();
if (NumElements == 0) NumElements = 1;
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 << '{';
if (CP->getNumOperands()) {
Out << ' ';
@ -926,9 +926,9 @@ void CWriter::printConstant(Constant *CPV) {
}
break;
case Type::PackedTyID:
case Type::VectorTyID:
if (isa<ConstantAggregateZero>(CPV) || isa<UndefValue>(CPV)) {
const PackedType *AT = cast<PackedType>(CPV->getType());
const VectorType *AT = cast<VectorType>(CPV->getType());
Out << '{';
if (AT->getNumElements()) {
Out << ' ';
@ -941,7 +941,7 @@ void CWriter::printConstant(Constant *CPV) {
}
Out << " }";
} else {
printConstantPacked(cast<ConstantPacked>(CPV));
printConstantVector(cast<ConstantVector>(CPV));
}
break;
@ -1589,7 +1589,7 @@ bool CWriter::doInitialization(Module &M) {
Out << " = " ;
if (isa<StructType>(I->getInitializer()->getType()) ||
isa<ArrayType>(I->getInitializer()->getType()) ||
isa<PackedType>(I->getInitializer()->getType())) {
isa<VectorType>(I->getInitializer()->getType())) {
Out << "{ 0 }";
} else {
// Just print it out normally.

View File

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

View File

@ -278,7 +278,7 @@ static Constant *getAggregateConstantElement(Constant *Agg, Constant *Idx) {
if (IdxV < CS->getNumOperands()) return CS->getOperand(IdxV);
} else if (ConstantArray *CA = dyn_cast<ConstantArray>(Agg)) {
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);
} else if (isa<ConstantAggregateZero>(Agg)) {
if (const StructType *STy = dyn_cast<StructType>(Agg->getType())) {
@ -398,7 +398,7 @@ static GlobalVariable *SRAGlobal(GlobalVariable *GV) {
unsigned NumElements = 0;
if (const ArrayType *ATy = dyn_cast<ArrayType>(STy))
NumElements = ATy->getNumElements();
else if (const PackedType *PTy = dyn_cast<PackedType>(STy))
else if (const VectorType *PTy = dyn_cast<VectorType>(STy))
NumElements = PTy->getNumElements();
else
assert(0 && "Unknown aggregate sequential type!");
@ -1346,7 +1346,7 @@ bool GlobalOpt::ProcessInternalGlobal(GlobalVariable *GV,
if (Constant *SOVConstant = dyn_cast<Constant>(GS.StoredOnceValue))
if (GV->getType()->getElementType() != Type::Int1Ty &&
!GV->getType()->getElementType()->isFloatingPoint() &&
!isa<PackedType>(GV->getType()->getElementType()) &&
!isa<VectorType>(GV->getType()->getElementType()) &&
!GS.HasPHIUser) {
DOUT << " *** SHRINKING TO BOOL: " << *GV;
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,
uint64_t &UndefElts,
unsigned Depth) {
unsigned VWidth = cast<PackedType>(V->getType())->getNumElements();
unsigned VWidth = cast<VectorType>(V->getType())->getNumElements();
assert(VWidth <= 64 && "Vector too wide to analyze!");
uint64_t EltMask = ~0ULL >> (64-VWidth);
assert(DemandedElts != EltMask && (DemandedElts & ~EltMask) == 0 &&
@ -1278,8 +1278,8 @@ Value *InstCombiner::SimplifyDemandedVectorElts(Value *V, uint64_t DemandedElts,
}
UndefElts = 0;
if (ConstantPacked *CP = dyn_cast<ConstantPacked>(V)) {
const Type *EltTy = cast<PackedType>(V->getType())->getElementType();
if (ConstantVector *CP = dyn_cast<ConstantVector>(V)) {
const Type *EltTy = cast<VectorType>(V->getType())->getElementType();
Constant *Undef = UndefValue::get(EltTy);
std::vector<Constant*> Elts;
@ -1295,19 +1295,19 @@ Value *InstCombiner::SimplifyDemandedVectorElts(Value *V, uint64_t DemandedElts,
}
// If we changed the constant, return it.
Constant *NewCP = ConstantPacked::get(Elts);
Constant *NewCP = ConstantVector::get(Elts);
return NewCP != CP ? NewCP : 0;
} 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.
const Type *EltTy = cast<PackedType>(V->getType())->getElementType();
const Type *EltTy = cast<VectorType>(V->getType())->getElementType();
Constant *Zero = Constant::getNullValue(EltTy);
Constant *Undef = UndefValue::get(EltTy);
std::vector<Constant*> Elts;
for (unsigned i = 0; i != VWidth; ++i)
Elts.push_back((DemandedElts & (1ULL << i)) ? Zero : Undef);
UndefElts = DemandedElts ^ EltMask;
return ConstantPacked::get(Elts);
return ConstantVector::get(Elts);
}
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
// (X & 254)+1 -> (X&254)|1
uint64_t KnownZero, KnownOne;
if (!isa<PackedType>(I.getType()) &&
if (!isa<VectorType>(I.getType()) &&
SimplifyDemandedBits(&I, cast<IntegerType>(I.getType())->getBitMask(),
KnownZero, KnownOne))
return &I;
@ -3064,12 +3064,12 @@ Instruction *InstCombiner::visitAnd(BinaryOperator &I) {
// See if we can simplify any instructions used by the instruction whose sole
// purpose is to compute bits we don't care about.
uint64_t KnownZero, KnownOne;
if (!isa<PackedType>(I.getType())) {
if (!isa<VectorType>(I.getType())) {
if (SimplifyDemandedBits(&I, cast<IntegerType>(I.getType())->getBitMask(),
KnownZero, KnownOne))
return &I;
} else {
if (ConstantPacked *CP = dyn_cast<ConstantPacked>(Op1)) {
if (ConstantVector *CP = dyn_cast<ConstantVector>(Op1)) {
if (CP->isAllOnesValue())
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
// purpose is to compute bits we don't care about.
uint64_t KnownZero, KnownOne;
if (!isa<PackedType>(I.getType()) &&
if (!isa<VectorType>(I.getType()) &&
SimplifyDemandedBits(&I, cast<IntegerType>(I.getType())->getBitMask(),
KnownZero, KnownOne))
return &I;
@ -3874,7 +3874,7 @@ Instruction *InstCombiner::visitXor(BinaryOperator &I) {
// See if we can simplify any instructions used by the instruction whose sole
// purpose is to compute bits we don't care about.
uint64_t KnownZero, KnownOne;
if (!isa<PackedType>(I.getType()) &&
if (!isa<VectorType>(I.getType()) &&
SimplifyDemandedBits(&I, cast<IntegerType>(I.getType())->getBitMask(),
KnownZero, KnownOne))
return &I;
@ -6460,8 +6460,8 @@ Instruction *InstCombiner::visitBitCast(CastInst &CI) {
if (SVI->hasOneUse()) {
// Okay, we have (bitconvert (shuffle ..)). Check to see if this is
// a bitconvert to a vector with the same # elts.
if (isa<PackedType>(DestTy) &&
cast<PackedType>(DestTy)->getNumElements() ==
if (isa<VectorType>(DestTy) &&
cast<VectorType>(DestTy)->getNumElements() ==
SVI->getType()->getNumElements()) {
CastInst *Tmp;
// 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:
// 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!");
// 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();
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
// see if a trivial 'gep P, 0, 0' will help matters. Only do this for
// constants.
@ -8052,7 +8052,7 @@ static Instruction *InstCombineLoadCast(InstCombiner &IC, LoadInst &LI) {
}
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
// casted to a pointer, this pessimizes pointer analysis a lot.
(isa<PointerType>(SrcPTy) == isa<PointerType>(LI.getType())) &&
@ -8516,7 +8516,7 @@ Instruction *InstCombiner::visitSwitchInst(SwitchInst &SI) {
static bool CheapToScalarize(Value *V, bool isConstant) {
if (isa<ConstantAggregateZero>(V))
return true;
if (ConstantPacked *C = dyn_cast<ConstantPacked>(V)) {
if (ConstantVector *C = dyn_cast<ConstantVector>(V)) {
if (isConstant) return true;
// If all elts are the same, we can extract.
Constant *Op0 = C->getOperand(0);
@ -8561,7 +8561,7 @@ static std::vector<unsigned> getShuffleMask(const ShuffleVectorInst *SVI) {
return std::vector<unsigned>(NElts, 2*NElts);
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)
if (isa<UndefValue>(CP->getOperand(i)))
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
/// extracted from the vector.
static Value *FindScalarElement(Value *V, unsigned EltNo) {
assert(isa<PackedType>(V->getType()) && "Not looking at a vector?");
const PackedType *PTy = cast<PackedType>(V->getType());
assert(isa<VectorType>(V->getType()) && "Not looking at a vector?");
const VectorType *PTy = cast<VectorType>(V->getType());
unsigned Width = PTy->getNumElements();
if (EltNo >= Width) // Out of range access.
return UndefValue::get(PTy->getElementType());
@ -8584,7 +8584,7 @@ static Value *FindScalarElement(Value *V, unsigned EltNo) {
return UndefValue::get(PTy->getElementType());
else if (isa<ConstantAggregateZero>(V))
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);
else if (InsertElementInst *III = dyn_cast<InsertElementInst>(V)) {
// 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)))
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
// with that operand
Constant *op0 = C->getOperand(0);
@ -8724,7 +8724,7 @@ static bool CollectSingleShuffleElements(Value *V, Value *LHS, Value *RHS,
std::vector<Constant*> &Mask) {
assert(V->getType() == LHS->getType() && V->getType() == RHS->getType() &&
"Invalid CollectSingleShuffleElements");
unsigned NumElts = cast<PackedType>(V->getType())->getNumElements();
unsigned NumElts = cast<VectorType>(V->getType())->getNumElements();
if (isa<UndefValue>(V)) {
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.
static Value *CollectShuffleElements(Value *V, std::vector<Constant*> &Mask,
Value *&RHS) {
assert(isa<PackedType>(V->getType()) &&
assert(isa<VectorType>(V->getType()) &&
(RHS == 0 || V->getType() == RHS->getType()) &&
"Invalid shuffle!");
unsigned NumElts = cast<PackedType>(V->getType())->getNumElements();
unsigned NumElts = cast<VectorType>(V->getType())->getNumElements();
if (isa<UndefValue>(V)) {
Mask.assign(NumElts, UndefValue::get(Type::Int32Ty));
@ -8895,7 +8895,7 @@ Instruction *InstCombiner::visitInsertElementInst(InsertElementInst &IE) {
}
Mask[InsertedIdx] = ConstantInt::get(Type::Int32Ty, ExtractedIdx);
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
@ -8906,7 +8906,7 @@ Instruction *InstCombiner::visitInsertElementInst(InsertElementInst &IE) {
Value *LHS = CollectShuffleElements(&IE, Mask, RHS);
if (RHS == 0) RHS = UndefValue::get(LHS->getType());
// 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
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(1, UndefValue::get(RHS->getType()));
SVI.setOperand(2, ConstantPacked::get(Elts));
SVI.setOperand(2, ConstantVector::get(Elts));
LHS = SVI.getOperand(0);
RHS = SVI.getOperand(1);
MadeChange = true;
@ -9030,7 +9030,7 @@ Instruction *InstCombiner::visitShuffleVectorInst(ShuffleVectorInst &SVI) {
}
return new ShuffleVectorInst(LHSSVI->getOperand(0),
LHSSVI->getOperand(1),
ConstantPacked::get(Elts));
ConstantVector::get(Elts));
}
}
}

View File

@ -72,13 +72,13 @@ public:
/// @param EI the insertelement operator to convert
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.
///
/// @brief Asserts if PackedType instruction is not handled elsewhere.
/// @brief Asserts if VectorType instruction is not handled elsewhere.
/// @param I the unhandled instruction
void visitInstruction(Instruction &I) {
if (isa<PackedType>(I.getType()))
if (isa<VectorType>(I.getType()))
cerr << "Unhandled Instruction with Packed ReturnType: " << I << '\n';
}
private:
@ -150,8 +150,8 @@ void LowerPacked::setValues(Value* value,const std::vector<Value*>& values)
// the program.
std::vector<Value*>& LowerPacked::getValues(Value* value)
{
assert(isa<PackedType>(value->getType()) &&
"Value must be PackedType");
assert(isa<VectorType>(value->getType()) &&
"Value must be VectorType");
// reject further processing if this one has
// already been handled
@ -161,7 +161,7 @@ std::vector<Value*>& LowerPacked::getValues(Value* value)
return it->second;
}
if (ConstantPacked* CP = dyn_cast<ConstantPacked>(value)) {
if (ConstantVector* CP = dyn_cast<ConstantVector>(value)) {
// non-zero constant case
std::vector<Value*> results;
results.reserve(CP->getNumOperands());
@ -174,7 +174,7 @@ std::vector<Value*>& LowerPacked::getValues(Value* value)
else if (ConstantAggregateZero* CAZ =
dyn_cast<ConstantAggregateZero>(value)) {
// zero constant
const PackedType* PKT = cast<PackedType>(CAZ->getType());
const VectorType* PKT = cast<VectorType>(CAZ->getType());
std::vector<Value*> results;
results.reserve(PKT->getNumElements());
@ -187,7 +187,7 @@ std::vector<Value*>& LowerPacked::getValues(Value* value)
}
else if (isa<Instruction>(value)) {
// foward reference
const PackedType* PKT = cast<PackedType>(value->getType());
const VectorType* PKT = cast<VectorType>(value->getType());
std::vector<Value*> results;
results.reserve(PKT->getNumElements());
@ -200,7 +200,7 @@ std::vector<Value*>& LowerPacked::getValues(Value* value)
else {
// we don't know what it is, and we are trying to retrieve
// a value for it
assert(false && "Unhandled PackedType value");
assert(false && "Unhandled VectorType value");
abort();
}
}
@ -208,7 +208,7 @@ std::vector<Value*>& LowerPacked::getValues(Value* value)
void LowerPacked::visitLoadInst(LoadInst& LI)
{
// 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
std::vector<Value*> Idx(2);
Idx[0] = ConstantInt::get(Type::Int32Ty,0);
@ -249,8 +249,8 @@ void LowerPacked::visitLoadInst(LoadInst& LI)
void LowerPacked::visitBinaryOperator(BinaryOperator& BO)
{
// Make sure both operands are PackedTypes
if (isa<PackedType>(BO.getOperand(0)->getType())) {
// Make sure both operands are VectorTypes
if (isa<VectorType>(BO.getOperand(0)->getType())) {
std::vector<Value*>& op0Vals = getValues(BO.getOperand(0));
std::vector<Value*>& op1Vals = getValues(BO.getOperand(1));
std::vector<Value*> result;
@ -277,8 +277,8 @@ void LowerPacked::visitBinaryOperator(BinaryOperator& BO)
void LowerPacked::visitICmpInst(ICmpInst& IC)
{
// Make sure both operands are PackedTypes
if (isa<PackedType>(IC.getOperand(0)->getType())) {
// Make sure both operands are VectorTypes
if (isa<VectorType>(IC.getOperand(0)->getType())) {
std::vector<Value*>& op0Vals = getValues(IC.getOperand(0));
std::vector<Value*>& op1Vals = getValues(IC.getOperand(1));
std::vector<Value*> result;
@ -306,8 +306,8 @@ void LowerPacked::visitICmpInst(ICmpInst& IC)
void LowerPacked::visitStoreInst(StoreInst& SI)
{
if (const PackedType* PKT =
dyn_cast<PackedType>(SI.getOperand(0)->getType())) {
if (const VectorType* PKT =
dyn_cast<VectorType>(SI.getOperand(0)->getType())) {
// We will need this for getelementptr
std::vector<Value*> Idx(2);
Idx[0] = ConstantInt::get(Type::Int32Ty,0);
@ -343,8 +343,8 @@ void LowerPacked::visitStoreInst(StoreInst& SI)
void LowerPacked::visitSelectInst(SelectInst& SELI)
{
// Make sure both operands are PackedTypes
if (isa<PackedType>(SELI.getType())) {
// Make sure both operands are VectorTypes
if (isa<VectorType>(SELI.getType())) {
std::vector<Value*>& op0Vals = getValues(SELI.getTrueValue());
std::vector<Value*>& op1Vals = getValues(SELI.getFalseValue());
std::vector<Value*> result;
@ -369,7 +369,7 @@ void LowerPacked::visitSelectInst(SelectInst& SELI)
void LowerPacked::visitExtractElementInst(ExtractElementInst& EI)
{
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);
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.
if (!isa<BinaryOperator>(BI) || BI->getType()->isFloatingPoint() ||
isa<PackedType>(BI->getType()))
isa<VectorType>(BI->getType()))
continue; // Floating point ops are not associative.
// 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.
if (I.getOpcode() == Instruction::And)
markConstant(IV, &I, Constant::getNullValue(I.getType()));
else if (const PackedType *PT = dyn_cast<PackedType>(I.getType()))
markConstant(IV, &I, ConstantPacked::getAllOnesValue(PT));
else if (const VectorType *PT = dyn_cast<VectorType>(I.getType()))
markConstant(IV, &I, ConstantVector::getAllOnesValue(PT));
else
markConstant(IV, &I, ConstantInt::getAllOnesValue(I.getType()));
return;
@ -1237,8 +1237,8 @@ bool SCCPSolver::ResolvedUndefsIn(Function &F) {
case Instruction::Or:
// undef | X -> -1. X could be -1.
if (const PackedType *PTy = dyn_cast<PackedType>(ITy))
markForcedConstant(LV, I, ConstantPacked::getAllOnesValue(PTy));
if (const VectorType *PTy = dyn_cast<VectorType>(ITy))
markForcedConstant(LV, I, ConstantVector::getAllOnesValue(PTy));
else
markForcedConstant(LV, I, ConstantInt::getAllOnesValue(ITy));
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
// 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;
if (const ArrayType *SubArrayTy = dyn_cast<ArrayType>(*I))
NumElements = SubArrayTy->getNumElements();
else
NumElements = cast<PackedType>(*I)->getNumElements();
NumElements = cast<VectorType>(*I)->getNumElements();
if (!isa<ConstantInt>(I.getOperand())) return 0;
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,
const TargetData &TD) {
// If this is our first type, just use it.
const PackedType *PTy;
const VectorType *PTy;
if (Accum == Type::VoidTy || In == Accum) {
Accum = In;
} else if (In == Type::VoidTy) {
@ -452,16 +452,16 @@ static bool MergeInType(const Type *In, const Type *&Accum,
Accum = In;
} else if (isa<PointerType>(In) && isa<PointerType>(Accum)) {
// Pointer unions just stay as one of the pointers.
} else if (isa<PackedType>(In) || isa<PackedType>(Accum)) {
if ((PTy = dyn_cast<PackedType>(Accum)) &&
} else if (isa<VectorType>(In) || isa<VectorType>(Accum)) {
if ((PTy = dyn_cast<VectorType>(Accum)) &&
PTy->getElementType() == In) {
// 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) {
// In is a vector, and accum is an element: ok, remember In.
Accum = In;
} else if ((PTy = dyn_cast<PackedType>(In)) && isa<PackedType>(Accum) &&
PTy->getBitWidth() == cast<PackedType>(Accum)->getBitWidth()) {
} else if ((PTy = dyn_cast<VectorType>(In)) && isa<VectorType>(Accum) &&
PTy->getBitWidth() == cast<VectorType>(Accum)->getBitWidth()) {
// Two vectors of the same size: keep Accum.
} else {
// 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 (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.
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
/// 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) {
bool isVectorInsert = isa<PackedType>(NewAI->getType()->getElementType());
bool isVectorInsert = isa<VectorType>(NewAI->getType()->getElementType());
const TargetData &TD = getAnalysis<TargetData>();
while (!Ptr->use_empty()) {
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.
Value *NV = new LoadInst(NewAI, LI->getName(), LI);
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
// 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);
} else {
// Must be an element access.
@ -702,10 +702,10 @@ void SROA::ConvertUsesToScalar(Value *Ptr, AllocaInst *NewAI, unsigned Offset) {
if (SV->getType() != AllocaType) {
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
// 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);
} else {
// 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)
Ops.push_back(cast<Constant>(MapValue(CE->getOperand(i), VM)));
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) {
Value *MV = MapValue(CP->getOperand(i), VM);
if (MV != CP->getOperand(i)) {
@ -92,7 +92,7 @@ Value *llvm::MapValue(const Value *V, ValueMapTy &VM) {
Values.push_back(cast<Constant>(MV));
for (++i; i != e; ++i)
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;

View File

@ -342,8 +342,8 @@ static void calcTypeName(const Type *Ty,
Result += "]";
break;
}
case Type::PackedTyID: {
const PackedType *PTy = cast<PackedType>(Ty);
case Type::VectorTyID: {
const VectorType *PTy = cast<VectorType>(Ty);
Result += "<" + utostr(PTy->getNumElements()) + " x ";
calcTypeName(PTy->getElementType(), TypeStack, TypeNames, Result);
Result += ">";
@ -548,7 +548,7 @@ static void WriteConstantInt(std::ostream &Out, const Constant *CV,
Out << " }";
if (CS->getType()->isPacked())
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();
assert(CP->getNumOperands() > 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)) {
Out << '[' << ATy->getNumElements() << " x ";
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 ";
printType(PTy->getElementType()) << '>';
}

View File

@ -35,11 +35,11 @@ using namespace llvm;
// 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
/// input packed constant are all simple integer or FP values.
static Constant *CastConstantPacked(ConstantPacked *CP,
const PackedType *DstTy) {
static Constant *CastConstantVector(ConstantVector *CP,
const VectorType *DstTy) {
unsigned SrcNumElts = CP->getType()->getNumElements();
unsigned DstNumElts = DstTy->getNumElements();
const Type *SrcEltTy = CP->getType()->getElementType();
@ -57,7 +57,7 @@ static Constant *CastConstantPacked(ConstantPacked *CP,
for (unsigned i = 0; i != SrcNumElts; ++i)
Result.push_back(
ConstantExpr::getBitCast(CP->getOperand(i), DstEltTy));
return ConstantPacked::get(Result);
return ConstantVector::get(Result);
}
// If this is an int-to-fp cast ..
@ -70,7 +70,7 @@ static Constant *CastConstantPacked(ConstantPacked *CP,
BitsToDouble(cast<ConstantInt>(CP->getOperand(i))->getZExtValue());
Result.push_back(ConstantFP::get(Type::DoubleTy, V));
}
return ConstantPacked::get(Result);
return ConstantVector::get(Result);
}
assert(DstEltTy == Type::FloatTy && "Unknown fp type!");
for (unsigned i = 0; i != SrcNumElts; ++i) {
@ -78,7 +78,7 @@ static Constant *CastConstantPacked(ConstantPacked *CP,
BitsToFloat(cast<ConstantInt>(CP->getOperand(i))->getZExtValue());
Result.push_back(ConstantFP::get(Type::FloatTy, V));
}
return ConstantPacked::get(Result);
return ConstantVector::get(Result);
}
// Otherwise, this is an fp-to-int cast.
@ -91,7 +91,7 @@ static Constant *CastConstantPacked(ConstantPacked *CP,
Constant *C = ConstantInt::get(Type::Int64Ty, V);
Result.push_back(ConstantExpr::getBitCast(C, DstEltTy ));
}
return ConstantPacked::get(Result);
return ConstantVector::get(Result);
}
assert(SrcEltTy->getTypeID() == Type::FloatTyID);
@ -100,7 +100,7 @@ static Constant *CastConstantPacked(ConstantPacked *CP,
Constant *C = ConstantInt::get(Type::Int32Ty, V);
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
@ -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
// and dest type have the same size (otherwise its an illegal cast).
if (const PackedType *DestPTy = dyn_cast<PackedType>(DestTy)) {
if (const PackedType *SrcTy = dyn_cast<PackedType>(V->getType())) {
if (const VectorType *DestPTy = dyn_cast<VectorType>(DestTy)) {
if (const VectorType *SrcTy = dyn_cast<VectorType>(V->getType())) {
assert(DestPTy->getBitWidth() == SrcTy->getBitWidth() &&
"Not cast between same sized vectors!");
// First, check for null and undef
@ -252,9 +252,9 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, const Constant *V,
if (isa<UndefValue>(V))
return UndefValue::get(DestTy);
if (const ConstantPacked *CP = dyn_cast<ConstantPacked>(V)) {
// This is a cast from a ConstantPacked of one type to a
// ConstantPacked of another type. Check to see if all elements of
if (const ConstantVector *CP = dyn_cast<ConstantVector>(V)) {
// This is a cast from a ConstantVector of one type to a
// ConstantVector of another type. Check to see if all elements of
// the input are simple.
bool AllSimpleConstants = true;
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 (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,
const Constant *Idx) {
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
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)) {
return const_cast<Constant*>(CVal->getOperand(CIdx->getZExtValue()));
} 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
// the insertion
unsigned numOps =
cast<PackedType>(Val->getType())->getNumElements();
cast<VectorType>(Val->getType())->getNumElements();
std::vector<Constant*> Ops;
Ops.reserve(numOps);
for (unsigned i = 0; i < numOps; ++i) {
@ -367,7 +367,7 @@ Constant *llvm::ConstantFoldInsertElementInstruction(const Constant *Val,
(i == idxVal) ? Elt : UndefValue::get(Elt->getType());
Ops.push_back(const_cast<Constant*>(Op));
}
return ConstantPacked::get(Ops);
return ConstantVector::get(Ops);
}
if (isa<ConstantAggregateZero>(Val)) {
// 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
// the insertion
unsigned numOps =
cast<PackedType>(Val->getType())->getNumElements();
cast<VectorType>(Val->getType())->getNumElements();
std::vector<Constant*> Ops;
Ops.reserve(numOps);
for (unsigned i = 0; i < numOps; ++i) {
@ -385,9 +385,9 @@ Constant *llvm::ConstantFoldInsertElementInstruction(const Constant *Val,
(i == idxVal) ? Elt : Constant::getNullValue(Elt->getType());
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
std::vector<Constant*> Ops;
Ops.reserve(CVal->getNumOperands());
@ -396,7 +396,7 @@ Constant *llvm::ConstantFoldInsertElementInstruction(const Constant *Val,
(i == idxVal) ? Elt : cast<Constant>(CVal->getOperand(i));
Ops.push_back(const_cast<Constant*>(Op));
}
return ConstantPacked::get(Ops);
return ConstantVector::get(Ops);
}
return 0;
}
@ -409,16 +409,16 @@ Constant *llvm::ConstantFoldShuffleVectorInstruction(const Constant *V1,
}
/// 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.
static Constant *EvalVectorOp(const ConstantPacked *V1,
const ConstantPacked *V2,
static Constant *EvalVectorOp(const ConstantVector *V1,
const ConstantVector *V2,
Constant *(*FP)(Constant*, Constant*)) {
std::vector<Constant*> Res;
for (unsigned i = 0, e = V1->getNumOperands(); i != e; ++i)
Res.push_back(FP(const_cast<Constant*>(V1->getOperand(i)),
const_cast<Constant*>(V2->getOperand(i))));
return ConstantPacked::get(Res);
return ConstantVector::get(Res);
}
Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode,
@ -444,8 +444,8 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode,
return Constant::getNullValue(C1->getType());
return const_cast<Constant*>(C2); // X / undef -> undef
case Instruction::Or: // X | undef -> -1
if (const PackedType *PTy = dyn_cast<PackedType>(C1->getType()))
return ConstantPacked::getAllOnesValue(PTy);
if (const VectorType *PTy = dyn_cast<VectorType>(C1->getType()))
return ConstantVector::getAllOnesValue(PTy);
return ConstantInt::getAllOnesValue(C1->getType());
case Instruction::LShr:
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));
}
}
} else if (const ConstantPacked *CP1 = dyn_cast<ConstantPacked>(C1)) {
if (const ConstantPacked *CP2 = dyn_cast<ConstantPacked>(C2)) {
} else if (const ConstantVector *CP1 = dyn_cast<ConstantVector>(C1)) {
if (const ConstantVector *CP2 = dyn_cast<ConstantVector>(C2)) {
switch (Opcode) {
default:
break;
@ -1115,8 +1115,8 @@ Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred,
case FCmpInst::FCMP_OGE:
return ConstantInt::get(Type::Int1Ty, C1Val >= C2Val);
}
} else if (const ConstantPacked *CP1 = dyn_cast<ConstantPacked>(C1)) {
if (const ConstantPacked *CP2 = dyn_cast<ConstantPacked>(C2)) {
} else if (const ConstantVector *CP1 = dyn_cast<ConstantVector>(C1)) {
if (const ConstantVector *CP2 = dyn_cast<ConstantVector>(C2)) {
if (pred == FCmpInst::FCMP_OEQ || pred == FCmpInst::FCMP_UEQ) {
for (unsigned i = 0, e = CP1->getNumOperands(); i != e; ++i) {
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));
case Type::StructTyID:
case Type::ArrayTyID:
case Type::PackedTyID:
case Type::VectorTyID:
return ConstantAggregateZero::get(Ty);
default:
// 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
/// has all its bits set to true.
/// @brief Get the all ones value
ConstantPacked *ConstantPacked::getAllOnesValue(const PackedType *Ty) {
ConstantVector *ConstantVector::getAllOnesValue(const VectorType *Ty) {
std::vector<Constant*> Elts;
Elts.resize(Ty->getNumElements(),
ConstantInt::getAllOnesValue(Ty->getElementType()));
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)
: Constant(T, ConstantPackedVal, new Use[V.size()], V.size()) {
: Constant(T, ConstantVectorVal, new Use[V.size()], V.size()) {
Use *OL = OperandList;
for (std::vector<Constant*>::const_iterator I = V.begin(), E = V.end();
I != E; ++I, ++OL) {
@ -244,7 +244,7 @@ ConstantPacked::ConstantPacked(const PackedType *T,
}
}
ConstantPacked::~ConstantPacked() {
ConstantVector::~ConstantVector() {
delete [] OperandList;
}
@ -293,7 +293,7 @@ class VISIBILITY_HIDDEN ExtractElementConstantExpr : public ConstantExpr {
Use Ops[2];
public:
ExtractElementConstantExpr(Constant *C1, Constant *C2)
: ConstantExpr(cast<PackedType>(C1->getType())->getElementType(),
: ConstantExpr(cast<VectorType>(C1->getType())->getElementType(),
Instruction::ExtractElement, Ops, 2) {
Ops[0].init(C1, this);
Ops[1].init(C2, this);
@ -919,7 +919,7 @@ static ManagedStatic<ValueMap<char, Type,
static char getValType(ConstantAggregateZero *CPZ) { return 0; }
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!");
return AggZeroConstants->getOrCreate(Ty, 0);
}
@ -1108,17 +1108,17 @@ void ConstantStruct::destroyConstant() {
destroyConstantImpl();
}
//---- ConstantPacked::get() implementation...
//---- ConstantVector::get() implementation...
//
namespace llvm {
template<>
struct ConvertConstantType<ConstantPacked, PackedType> {
static void convert(ConstantPacked *OldC, const PackedType *NewTy) {
struct ConvertConstantType<ConstantVector, VectorType> {
static void convert(ConstantVector *OldC, const VectorType *NewTy) {
// Make everyone now use a constant of the new type...
std::vector<Constant*> C;
for (unsigned i = 0, e = OldC->getNumOperands(); i != e; ++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??");
OldC->uncheckedReplaceAllUsesWith(New);
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;
Elements.reserve(CP->getNumOperands());
for (unsigned i = 0, e = CP->getNumOperands(); i != e; ++i)
@ -1134,10 +1134,10 @@ static std::vector<Constant*> getValType(ConstantPacked *CP) {
return Elements;
}
static ManagedStatic<ValueMap<std::vector<Constant*>, PackedType,
ConstantPacked> > PackedConstants;
static ManagedStatic<ValueMap<std::vector<Constant*>, VectorType,
ConstantVector> > PackedConstants;
Constant *ConstantPacked::get(const PackedType *Ty,
Constant *ConstantVector::get(const VectorType *Ty,
const std::vector<Constant*> &V) {
// If this is an all-zero packed, return a ConstantAggregateZero object
if (!V.empty()) {
@ -1151,14 +1151,14 @@ Constant *ConstantPacked::get(const PackedType *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");
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...
//
void ConstantPacked::destroyConstant() {
void ConstantVector::destroyConstant() {
PackedConstants->remove(this);
destroyConstantImpl();
}
@ -1167,7 +1167,7 @@ void ConstantPacked::destroyConstant() {
/// is 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.
bool ConstantPacked::isAllOnesValue() const {
bool ConstantVector::isAllOnesValue() const {
// Check out first element.
const Constant *Elt = getOperand(0);
const ConstantInt *CI = dyn_cast<ConstantInt>(Elt);
@ -1635,40 +1635,40 @@ Constant *ConstantExpr::get(unsigned Opcode, Constant *C1, Constant *C2) {
case Instruction::Mul:
assert(C1->getType() == C2->getType() && "Op types should be identical!");
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!");
break;
case Instruction::UDiv:
case Instruction::SDiv:
assert(C1->getType() == C2->getType() && "Op types should be identical!");
assert((C1->getType()->isInteger() || (isa<PackedType>(C1->getType()) &&
cast<PackedType>(C1->getType())->getElementType()->isInteger())) &&
assert((C1->getType()->isInteger() || (isa<VectorType>(C1->getType()) &&
cast<VectorType>(C1->getType())->getElementType()->isInteger())) &&
"Tried to create an arithmetic operation on a non-arithmetic type!");
break;
case Instruction::FDiv:
assert(C1->getType() == C2->getType() && "Op types should be identical!");
assert((C1->getType()->isFloatingPoint() || (isa<PackedType>(C1->getType())
&& cast<PackedType>(C1->getType())->getElementType()->isFloatingPoint()))
assert((C1->getType()->isFloatingPoint() || (isa<VectorType>(C1->getType())
&& cast<VectorType>(C1->getType())->getElementType()->isFloatingPoint()))
&& "Tried to create an arithmetic operation on a non-arithmetic type!");
break;
case Instruction::URem:
case Instruction::SRem:
assert(C1->getType() == C2->getType() && "Op types should be identical!");
assert((C1->getType()->isInteger() || (isa<PackedType>(C1->getType()) &&
cast<PackedType>(C1->getType())->getElementType()->isInteger())) &&
assert((C1->getType()->isInteger() || (isa<VectorType>(C1->getType()) &&
cast<VectorType>(C1->getType())->getElementType()->isInteger())) &&
"Tried to create an arithmetic operation on a non-arithmetic type!");
break;
case Instruction::FRem:
assert(C1->getType() == C2->getType() && "Op types should be identical!");
assert((C1->getType()->isFloatingPoint() || (isa<PackedType>(C1->getType())
&& cast<PackedType>(C1->getType())->getElementType()->isFloatingPoint()))
assert((C1->getType()->isFloatingPoint() || (isa<VectorType>(C1->getType())
&& cast<VectorType>(C1->getType())->getElementType()->isFloatingPoint()))
&& "Tried to create an arithmetic operation on a non-arithmetic type!");
break;
case Instruction::And:
case Instruction::Or:
case Instruction::Xor:
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!");
break;
case Instruction::Shl:
@ -1792,11 +1792,11 @@ Constant *ConstantExpr::getExtractElementTy(const Type *ReqTy, Constant *Val,
}
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!");
assert(Idx->getType() == Type::Int32Ty &&
"Extractelement index must be i32 type!");
return getExtractElementTy(cast<PackedType>(Val->getType())->getElementType(),
return getExtractElementTy(cast<VectorType>(Val->getType())->getElementType(),
Val, Idx);
}
@ -1814,13 +1814,13 @@ Constant *ConstantExpr::getInsertElementTy(const Type *ReqTy, Constant *Val,
Constant *ConstantExpr::getInsertElement(Constant *Val, Constant *Elt,
Constant *Idx) {
assert(isa<PackedType>(Val->getType()) &&
assert(isa<VectorType>(Val->getType()) &&
"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!");
assert(Idx->getType() == Type::Int32Ty &&
"Insertelement index must be i32 type!");
return getInsertElementTy(cast<PackedType>(Val->getType())->getElementType(),
return getInsertElementTy(cast<VectorType>(Val->getType())->getElementType(),
Val, Elt, Idx);
}
@ -1844,11 +1844,11 @@ Constant *ConstantExpr::getShuffleVector(Constant *V1, Constant *V2,
}
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()) {
std::vector<Constant*> zeros(PTy->getNumElements(),
ConstantFP::get(PTy->getElementType(),-0.0));
return ConstantPacked::get(PTy, zeros);
return ConstantVector::get(PTy, zeros);
}
if (Ty->isFloatingPoint())
@ -2000,7 +2000,7 @@ void ConstantStruct::replaceUsesOfWithOnConstant(Value *From, Value *To,
destroyConstant();
}
void ConstantPacked::replaceUsesOfWithOnConstant(Value *From, Value *To,
void ConstantVector::replaceUsesOfWithOnConstant(Value *From, Value *To,
Use *U) {
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);
}
Constant *Replacement = ConstantPacked::get(getType(), Values);
Constant *Replacement = ConstantVector::get(getType(), Values);
assert(Replacement != this && "I didn't contain From!");
// 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,
const std::string &Name,
Instruction *InsertBef)
: Instruction(cast<PackedType>(Val->getType())->getElementType(),
: Instruction(cast<VectorType>(Val->getType())->getElementType(),
ExtractElement, Ops, 2, Name, InsertBef) {
assert(isValidOperands(Val, Index) &&
"Invalid extractelement instruction operands!");
@ -895,7 +895,7 @@ ExtractElementInst::ExtractElementInst(Value *Val, Value *Index,
ExtractElementInst::ExtractElementInst(Value *Val, unsigned IndexV,
const std::string &Name,
Instruction *InsertBef)
: Instruction(cast<PackedType>(Val->getType())->getElementType(),
: Instruction(cast<VectorType>(Val->getType())->getElementType(),
ExtractElement, Ops, 2, Name, InsertBef) {
Constant *Index = ConstantInt::get(Type::Int32Ty, IndexV);
assert(isValidOperands(Val, Index) &&
@ -908,7 +908,7 @@ ExtractElementInst::ExtractElementInst(Value *Val, unsigned IndexV,
ExtractElementInst::ExtractElementInst(Value *Val, Value *Index,
const std::string &Name,
BasicBlock *InsertAE)
: Instruction(cast<PackedType>(Val->getType())->getElementType(),
: Instruction(cast<VectorType>(Val->getType())->getElementType(),
ExtractElement, Ops, 2, Name, InsertAE) {
assert(isValidOperands(Val, Index) &&
"Invalid extractelement instruction operands!");
@ -920,7 +920,7 @@ ExtractElementInst::ExtractElementInst(Value *Val, Value *Index,
ExtractElementInst::ExtractElementInst(Value *Val, unsigned IndexV,
const std::string &Name,
BasicBlock *InsertAE)
: Instruction(cast<PackedType>(Val->getType())->getElementType(),
: Instruction(cast<VectorType>(Val->getType())->getElementType(),
ExtractElement, Ops, 2, Name, InsertAE) {
Constant *Index = ConstantInt::get(Type::Int32Ty, IndexV);
assert(isValidOperands(Val, Index) &&
@ -932,7 +932,7 @@ ExtractElementInst::ExtractElementInst(Value *Val, unsigned IndexV,
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 true;
}
@ -999,10 +999,10 @@ InsertElementInst::InsertElementInst(Value *Vec, Value *Elt, unsigned IndexV,
bool InsertElementInst::isValidOperands(const Value *Vec, const Value *Elt,
const Value *Index) {
if (!isa<PackedType>(Vec->getType()))
if (!isa<VectorType>(Vec->getType()))
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.
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,
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 (!isa<PackedType>(Mask->getType()) ||
cast<PackedType>(Mask->getType())->getElementType() != Type::Int32Ty ||
cast<PackedType>(Mask->getType())->getNumElements() !=
cast<PackedType>(V1->getType())->getNumElements())
if (!isa<VectorType>(Mask->getType()) ||
cast<VectorType>(Mask->getType())->getElementType() != Type::Int32Ty ||
cast<VectorType>(Mask->getType())->getNumElements() !=
cast<VectorType>(V1->getType())->getNumElements())
return false;
return true;
}
@ -1075,37 +1075,37 @@ void BinaryOperator::init(BinaryOps iType)
assert(getType() == LHS->getType() &&
"Arithmetic operation should return same type as operands!");
assert((getType()->isInteger() || getType()->isFloatingPoint() ||
isa<PackedType>(getType())) &&
isa<VectorType>(getType())) &&
"Tried to create an arithmetic operation on a non-arithmetic type!");
break;
case UDiv:
case SDiv:
assert(getType() == LHS->getType() &&
"Arithmetic operation should return same type as operands!");
assert((getType()->isInteger() || (isa<PackedType>(getType()) &&
cast<PackedType>(getType())->getElementType()->isInteger())) &&
assert((getType()->isInteger() || (isa<VectorType>(getType()) &&
cast<VectorType>(getType())->getElementType()->isInteger())) &&
"Incorrect operand type (not integer) for S/UDIV");
break;
case FDiv:
assert(getType() == LHS->getType() &&
"Arithmetic operation should return same type as operands!");
assert((getType()->isFloatingPoint() || (isa<PackedType>(getType()) &&
cast<PackedType>(getType())->getElementType()->isFloatingPoint()))
assert((getType()->isFloatingPoint() || (isa<VectorType>(getType()) &&
cast<VectorType>(getType())->getElementType()->isFloatingPoint()))
&& "Incorrect operand type (not floating point) for FDIV");
break;
case URem:
case SRem:
assert(getType() == LHS->getType() &&
"Arithmetic operation should return same type as operands!");
assert((getType()->isInteger() || (isa<PackedType>(getType()) &&
cast<PackedType>(getType())->getElementType()->isInteger())) &&
assert((getType()->isInteger() || (isa<VectorType>(getType()) &&
cast<VectorType>(getType())->getElementType()->isInteger())) &&
"Incorrect operand type (not integer) for S/UREM");
break;
case FRem:
assert(getType() == LHS->getType() &&
"Arithmetic operation should return same type as operands!");
assert((getType()->isFloatingPoint() || (isa<PackedType>(getType()) &&
cast<PackedType>(getType())->getElementType()->isFloatingPoint()))
assert((getType()->isFloatingPoint() || (isa<VectorType>(getType()) &&
cast<VectorType>(getType())->getElementType()->isFloatingPoint()))
&& "Incorrect operand type (not floating point) for FREM");
break;
case Shl:
@ -1121,8 +1121,8 @@ void BinaryOperator::init(BinaryOps iType)
assert(getType() == LHS->getType() &&
"Logical operation should return same type as operands!");
assert((getType()->isInteger() ||
(isa<PackedType>(getType()) &&
cast<PackedType>(getType())->getElementType()->isInteger())) &&
(isa<VectorType>(getType()) &&
cast<VectorType>(getType())->getElementType()->isInteger())) &&
"Tried to create a logical operation on a non-integral type!");
break;
default:
@ -1166,9 +1166,9 @@ BinaryOperator *BinaryOperator::createNeg(Value *Op, const std::string &Name,
BinaryOperator *BinaryOperator::createNot(Value *Op, const std::string &Name,
Instruction *InsertBefore) {
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 = ConstantPacked::get(std::vector<Constant*>(PTy->getNumElements(), C));
C = ConstantVector::get(std::vector<Constant*>(PTy->getNumElements(), C));
} else {
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,
BasicBlock *InsertAtEnd) {
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.
Constant *Elt = ConstantInt::getAllOnesValue(PTy->getElementType());
AllOnes =
ConstantPacked::get(std::vector<Constant*>(PTy->getNumElements(), Elt));
ConstantVector::get(std::vector<Constant*>(PTy->getNumElements(), Elt));
} else {
AllOnes = ConstantInt::getAllOnesValue(Op->getType());
}
@ -1680,7 +1680,7 @@ CastInst::getCastOpcode(
return FPToSI; // FP -> sint
else
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() &&
"Casting packed to integer of different width");
return BitCast; // Same size, no-op cast
@ -1703,15 +1703,15 @@ CastInst::getCastOpcode(
} else {
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() &&
"Casting packed to floating point of different width");
return BitCast; // same size, no-op cast
} else {
assert(0 && "Casting pointer or non-first class to float");
}
} else if (const PackedType *DestPTy = dyn_cast<PackedType>(DestTy)) {
if (const PackedType *SrcPTy = dyn_cast<PackedType>(SrcTy)) {
} else if (const VectorType *DestPTy = dyn_cast<VectorType>(DestTy)) {
if (const VectorType *SrcPTy = dyn_cast<VectorType>(SrcTy)) {
assert(DestPTy->getBitWidth() == SrcPTy->getBitWidth() &&
"Casting packed to packed of different widths");
return BitCast; // packed -> packed

View File

@ -93,9 +93,9 @@ const Type *Type::getVAArgsPromotedType() const {
///
bool Type::isFPOrFPVector() const {
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
@ -112,8 +112,8 @@ bool Type::canLosslesslyBitCastTo(const Type *Ty) const {
// Packed -> Packed conversions are always lossless if the two packed types
// have the same size, otherwise not.
if (const PackedType *thisPTy = dyn_cast<PackedType>(this))
if (const PackedType *thatPTy = dyn_cast<PackedType>(Ty))
if (const VectorType *thisPTy = dyn_cast<VectorType>(this))
if (const VectorType *thatPTy = dyn_cast<VectorType>(Ty))
return thisPTy->getBitWidth() == thatPTy->getBitWidth();
// 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::DoubleTyID: return 64;
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;
}
}
@ -144,7 +144,7 @@ bool Type::isSizedDerivedType() const {
if (const ArrayType *ATy = dyn_cast<ArrayType>(this))
return ATy->getElementType()->isSized();
if (const PackedType *PTy = dyn_cast<PackedType>(this))
if (const VectorType *PTy = dyn_cast<VectorType>(this))
return PTy->getElementType()->isSized();
if (!isa<StructType>(this))
@ -287,8 +287,8 @@ static std::string getTypeDescription(const Type *Ty,
Result += getTypeDescription(ATy->getElementType(), TypeStack) + "]";
break;
}
case Type::PackedTyID: {
const PackedType *PTy = cast<PackedType>(Ty);
case Type::VectorTyID: {
const VectorType *PTy = cast<VectorType>(Ty);
unsigned NumElements = PTy->getNumElements();
Result = "<";
Result += utostr(NumElements) + " x ";
@ -421,14 +421,14 @@ ArrayType::ArrayType(const Type *ElType, uint64_t NumEl)
setAbstract(ElType->isAbstract());
}
PackedType::PackedType(const Type *ElType, unsigned NumEl)
: SequentialType(PackedTyID, ElType) {
VectorType::VectorType(const Type *ElType, unsigned NumEl)
: SequentialType(VectorTyID, ElType) {
NumElements = NumEl;
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() ||
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);
return ATy->getNumElements() == ATy2->getNumElements() &&
TypesEqual(ATy->getElementType(), ATy2->getElementType(), EqTypes);
} else if (const PackedType *PTy = dyn_cast<PackedType>(Ty)) {
const PackedType *PTy2 = cast<PackedType>(Ty2);
} else if (const VectorType *PTy = dyn_cast<VectorType>(Ty)) {
const VectorType *PTy2 = cast<VectorType>(Ty2);
return PTy->getNumElements() == PTy2->getNumElements() &&
TypesEqual(PTy->getElementType(), PTy2->getElementType(), EqTypes);
} else if (const FunctionType *FTy = dyn_cast<FunctionType>(Ty)) {
@ -695,8 +695,8 @@ static unsigned getSubElementHash(const Type *Ty) {
case Type::ArrayTyID:
HashVal ^= cast<ArrayType>(SubTy)->getNumElements();
break;
case Type::PackedTyID:
HashVal ^= cast<PackedType>(SubTy)->getNumElements();
case Type::VectorTyID:
HashVal ^= cast<VectorType>(SubTy)->getNumElements();
break;
case Type::StructTyID:
HashVal ^= cast<StructType>(SubTy)->getNumElements();
@ -1132,39 +1132,39 @@ ArrayType *ArrayType::get(const Type *ElementType, uint64_t NumElements) {
// Packed Type Factory...
//
namespace llvm {
class PackedValType {
class VectorValType {
const Type *ValTy;
unsigned Size;
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) {
return PackedValType(PT->getElementType(), PT->getNumElements());
static VectorValType get(const VectorType *PT) {
return VectorValType(PT->getElementType(), PT->getNumElements());
}
static unsigned hashTypeStructure(const PackedType *PT) {
static unsigned hashTypeStructure(const VectorType *PT) {
return PT->getNumElements();
}
inline bool operator<(const PackedValType &MTV) const {
inline bool operator<(const VectorValType &MTV) const {
if (Size < MTV.Size) return true;
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(isPowerOf2_32(NumElements) && "Vector length should be a power of 2!");
PackedValType PVT(ElementType, NumElements);
PackedType *PT = PackedTypes->get(PVT);
VectorValType PVT(ElementType, NumElements);
VectorType *PT = VectorTypes->get(PVT);
if (PT) return PT; // Found a match, return it!
// Value not found. Derive a new type!
PackedTypes->add(PVT, PT = new PackedType(ElementType, NumElements));
VectorTypes->add(PVT, PT = new VectorType(ElementType, NumElements));
#ifdef DEBUG_MERGE_TYPES
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 type.
//
void PackedType::refineAbstractType(const DerivedType *OldType,
void VectorType::refineAbstractType(const DerivedType *OldType,
const Type *NewType) {
PackedTypes->RefineAbstractType(this, OldType, NewType);
VectorTypes->RefineAbstractType(this, OldType, NewType);
}
void PackedType::typeBecameConcrete(const DerivedType *AbsTy) {
PackedTypes->TypeBecameConcrete(this, AbsTy);
void VectorType::typeBecameConcrete(const DerivedType *AbsTy) {
VectorTypes->TypeBecameConcrete(this, AbsTy);
}
// 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::f32: return Type::FloatTy;
case MVT::f64: return Type::DoubleTy;
case MVT::v8i8: return PackedType::get(Type::Int8Ty, 8);
case MVT::v4i16: return PackedType::get(Type::Int16Ty, 4);
case MVT::v2i32: return PackedType::get(Type::Int32Ty, 2);
case MVT::v16i8: return PackedType::get(Type::Int8Ty, 16);
case MVT::v8i16: return PackedType::get(Type::Int16Ty, 8);
case MVT::v4i32: return PackedType::get(Type::Int32Ty, 4);
case MVT::v2i64: return PackedType::get(Type::Int64Ty, 2);
case MVT::v4f32: return PackedType::get(Type::FloatTy, 4);
case MVT::v2f64: return PackedType::get(Type::DoubleTy, 2);
case MVT::v8i8: return VectorType::get(Type::Int8Ty, 8);
case MVT::v4i16: return VectorType::get(Type::Int16Ty, 4);
case MVT::v2i32: return VectorType::get(Type::Int32Ty, 2);
case MVT::v16i8: return VectorType::get(Type::Int8Ty, 16);
case MVT::v8i16: return VectorType::get(Type::Int16Ty, 8);
case MVT::v4i32: return VectorType::get(Type::Int32Ty, 4);
case MVT::v2i64: return VectorType::get(Type::Int64Ty, 2);
case MVT::v4f32: return VectorType::get(Type::FloatTy, 4);
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::Xor:
Assert1(B.getType()->isInteger() ||
(isa<PackedType>(B.getType()) &&
cast<PackedType>(B.getType())->getElementType()->isInteger()),
(isa<VectorType>(B.getType()) &&
cast<VectorType>(B.getType())->getElementType()->isInteger()),
"Logical operators only work with integral types!", &B);
Assert1(B.getType() == B.getOperand(0)->getType(),
"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!",
&B);
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);
break;
}
@ -774,7 +774,7 @@ void Verifier::visitShuffleVectorInst(ShuffleVectorInst &SV) {
"Result of shufflevector must match first operand type!", &SV);
// 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) {
Assert1(isa<ConstantInt>(MV->getOperand(i)) ||
isa<UndefValue>(MV->getOperand(i)),
@ -1014,9 +1014,9 @@ void Verifier::VerifyIntrinsicPrototype(Function *F, ...) {
"incorrect integer width!" + bitmsg, F);
break;
}
} else if (TypeID == Type::PackedTyID) {
} else if (TypeID == Type::VectorTyID) {
// 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);
if (ElemTy != PTy->getElementType()->getTypeID()) {
CheckFailed("Intrinsic prototype has incorrect vector element type!",

View File

@ -1,5 +1,5 @@
; Test PackedType handling by SCCP.
; SCCP ignores PackedTypes until PR 1034 is fixed
; Test VectorType handling by SCCP.
; SCCP ignores VectorTypes until PR 1034 is fixed
;
; RUN: llvm-upgrade < %s | llvm-as | opt -sccp
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::Function *FunctionVal;
std::pair<llvm::PATypeInfo, char*> *ArgVal;
@ -39,155 +377,14 @@ typedef union {
llvm::FCmpInst::Predicate FPred;
llvm::Module::Endianness Endianness;
} YYSTYPE;
#define ESINT64VAL 257
#define EUINT64VAL 258
#define SINTVAL 259
#define UINTVAL 260
#define FPVAL 261
#define VOID 262
#define BOOL 263
#define SBYTE 264
#define UBYTE 265
#define SHORT 266
#define USHORT 267
#define INT 268
#define UINT 269
#define LONG 270
#define ULONG 271
#define FLOAT 272
#define DOUBLE 273
#define TYPE 274
#define LABEL 275
#define VAR_ID 276
#define LABELSTR 277
#define STRINGCONSTANT 278
#define IMPLEMENTATION 279
#define ZEROINITIALIZER 280
#define TRUETOK 281
#define FALSETOK 282
#define BEGINTOK 283
#define ENDTOK 284
#define DECLARE 285
#define GLOBAL 286
#define CONSTANT 287
#define SECTION 288
#define VOLATILE 289
#define TO 290
#define DOTDOTDOT 291
#define NULL_TOK 292
#define UNDEF 293
#define CONST 294
#define INTERNAL 295
#define LINKONCE 296
#define WEAK 297
#define APPENDING 298
#define DLLIMPORT 299
#define DLLEXPORT 300
#define EXTERN_WEAK 301
#define OPAQUE 302
#define NOT 303
#define EXTERNAL 304
#define TARGET 305
#define TRIPLE 306
#define ENDIAN 307
#define POINTERSIZE 308
#define LITTLE 309
#define BIG 310
#define ALIGN 311
#define DEPLIBS 312
#define CALL 313
#define TAIL 314
#define ASM_TOK 315
#define MODULE 316
#define SIDEEFFECT 317
#define CC_TOK 318
#define CCC_TOK 319
#define CSRETCC_TOK 320
#define FASTCC_TOK 321
#define COLDCC_TOK 322
#define X86_STDCALLCC_TOK 323
#define X86_FASTCALLCC_TOK 324
#define DATALAYOUT 325
#define RET 326
#define BR 327
#define SWITCH 328
#define INVOKE 329
#define 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
/* Line 1447 of yacc.c. */
#line 382 "UpgradeParser.tab.h"
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif
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
// types of its operands.
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
isFP = PTy->getElementType()->isFloatingPoint();
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
// types of its operands.
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
isFP = PTy->getElementType()->isFloatingPoint();
// Select correct opcode
@ -1846,10 +1846,10 @@ UpRTypes
if ((unsigned)$2 != $2)
error("Unsigned result not equal to signed result");
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))
error("PackedType length should be a power of 2");
$$.PAT = new PATypeHolder(HandleUpRefs(PackedType::get(ElemTy,
error("VectorType length should be a power of 2");
$$.PAT = new PATypeHolder(HandleUpRefs(VectorType::get(ElemTy,
(unsigned)$2)));
$$.S = $4.S;
delete $4.PAT;
@ -1999,7 +1999,7 @@ ConstVal
delete $1.PAT;
}
| 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)
error("Cannot make packed constant with type: '" +
$1.PAT->get()->getDescription() + "'");
@ -2021,7 +2021,7 @@ ConstVal
ValTy->getDescription() + "'");
Elems.push_back(C);
}
$$.C = ConstantPacked::get(PTy, Elems);
$$.C = ConstantVector::get(PTy, Elems);
$$.S = $1.S;
delete $1.PAT;
delete $3;
@ -2280,8 +2280,8 @@ ConstExpr
if (Ty != $5.C->getType())
error("Logical operator types must match");
if (!Ty->isInteger()) {
if (!isa<PackedType>(Ty) ||
!cast<PackedType>(Ty)->getElementType()->isInteger())
if (!isa<VectorType>(Ty) ||
!cast<VectorType>(Ty)->getElementType()->isInteger())
error("Logical operator requires integer operands");
}
Instruction::BinaryOps Opcode = getBinaryOp($1, Ty, $3.S);
@ -2802,9 +2802,9 @@ ConstValueRef
| '<' ConstVector '>' { // Nonempty unsized packed vector
const Type *ETy = (*$2)[0].C->getType();
int NumElements = $2->size();
PackedType* pt = PackedType::get(ETy, NumElements);
VectorType* pt = VectorType::get(ETy, NumElements);
PATypeHolder* PTy = new PATypeHolder(
HandleUpRefs(PackedType::get(ETy, NumElements)));
HandleUpRefs(VectorType::get(ETy, NumElements)));
// Verify all elements are correct type!
std::vector<Constant*> Elems;
@ -2817,7 +2817,7 @@ ConstValueRef
CTy->getDescription() + "'");
Elems.push_back(C);
}
$$ = ValID::create(ConstantPacked::get(pt, Elems));
$$ = ValID::create(ConstantVector::get(pt, Elems));
delete PTy; delete $2;
}
| ConstExpr {
@ -3108,9 +3108,9 @@ OptTailCall
InstVal
: ArithmeticOps Types ValueRef ',' ValueRef {
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");
if (isa<PackedType>(Ty) &&
if (isa<VectorType>(Ty) &&
($1 == URemOp || $1 == SRemOp || $1 == FRemOp || $1 == RemOp))
error("Remainder not supported on packed types");
// Upgrade the opcode from obsolete versions before we do anything with it.
@ -3126,8 +3126,8 @@ InstVal
| LogicalOps Types ValueRef ',' ValueRef {
const Type *Ty = $2.PAT->get();
if (!Ty->isInteger()) {
if (!isa<PackedType>(Ty) ||
!cast<PackedType>(Ty)->getElementType()->isInteger())
if (!isa<VectorType>(Ty) ||
!cast<VectorType>(Ty)->getElementType()->isInteger())
error("Logical operator requires integral operands");
}
Instruction::BinaryOps Opcode = getBinaryOp($1, Ty, $2.S);
@ -3141,8 +3141,8 @@ InstVal
}
| SetCondOps Types ValueRef ',' ValueRef {
const Type* Ty = $2.PAT->get();
if(isa<PackedType>(Ty))
error("PackedTypes currently not supported in setcc instructions");
if(isa<VectorType>(Ty))
error("VectorTypes currently not supported in setcc instructions");
unsigned short pred;
Instruction::OtherOps Opcode = getCompareOp($1, pred, Ty, $2.S);
Value* tmpVal1 = getVal(Ty, $3);
@ -3155,8 +3155,8 @@ InstVal
}
| ICMP IPredicates Types ValueRef ',' ValueRef {
const Type *Ty = $3.PAT->get();
if (isa<PackedType>(Ty))
error("PackedTypes currently not supported in icmp instructions");
if (isa<VectorType>(Ty))
error("VectorTypes currently not supported in icmp instructions");
else if (!Ty->isInteger() && !isa<PointerType>(Ty))
error("icmp requires integer or pointer typed operands");
Value* tmpVal1 = getVal(Ty, $4);
@ -3167,8 +3167,8 @@ InstVal
}
| FCMP FPredicates Types ValueRef ',' ValueRef {
const Type *Ty = $3.PAT->get();
if (isa<PackedType>(Ty))
error("PackedTypes currently not supported in fcmp instructions");
if (isa<VectorType>(Ty))
error("VectorTypes currently not supported in fcmp instructions");
else if (!Ty->isFloatingPoint())
error("fcmp instruction requires floating point operands");
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
// types of its operands.
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
isFP = PTy->getElementType()->isFloatingPoint();
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
// types of its operands.
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
isFP = PTy->getElementType()->isFloatingPoint();
// Select correct opcode
@ -1846,10 +1846,10 @@ UpRTypes
if ((unsigned)$2 != $2)
error("Unsigned result not equal to signed result");
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))
error("PackedType length should be a power of 2");
$$.PAT = new PATypeHolder(HandleUpRefs(PackedType::get(ElemTy,
error("VectorType length should be a power of 2");
$$.PAT = new PATypeHolder(HandleUpRefs(VectorType::get(ElemTy,
(unsigned)$2)));
$$.S = $4.S;
delete $4.PAT;
@ -1999,7 +1999,7 @@ ConstVal
delete $1.PAT;
}
| 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)
error("Cannot make packed constant with type: '" +
$1.PAT->get()->getDescription() + "'");
@ -2021,7 +2021,7 @@ ConstVal
ValTy->getDescription() + "'");
Elems.push_back(C);
}
$$.C = ConstantPacked::get(PTy, Elems);
$$.C = ConstantVector::get(PTy, Elems);
$$.S = $1.S;
delete $1.PAT;
delete $3;
@ -2280,8 +2280,8 @@ ConstExpr
if (Ty != $5.C->getType())
error("Logical operator types must match");
if (!Ty->isInteger()) {
if (!isa<PackedType>(Ty) ||
!cast<PackedType>(Ty)->getElementType()->isInteger())
if (!isa<VectorType>(Ty) ||
!cast<VectorType>(Ty)->getElementType()->isInteger())
error("Logical operator requires integer operands");
}
Instruction::BinaryOps Opcode = getBinaryOp($1, Ty, $3.S);
@ -2802,9 +2802,9 @@ ConstValueRef
| '<' ConstVector '>' { // Nonempty unsized packed vector
const Type *ETy = (*$2)[0].C->getType();
int NumElements = $2->size();
PackedType* pt = PackedType::get(ETy, NumElements);
VectorType* pt = VectorType::get(ETy, NumElements);
PATypeHolder* PTy = new PATypeHolder(
HandleUpRefs(PackedType::get(ETy, NumElements)));
HandleUpRefs(VectorType::get(ETy, NumElements)));
// Verify all elements are correct type!
std::vector<Constant*> Elems;
@ -2817,7 +2817,7 @@ ConstValueRef
CTy->getDescription() + "'");
Elems.push_back(C);
}
$$ = ValID::create(ConstantPacked::get(pt, Elems));
$$ = ValID::create(ConstantVector::get(pt, Elems));
delete PTy; delete $2;
}
| ConstExpr {
@ -3108,9 +3108,9 @@ OptTailCall
InstVal
: ArithmeticOps Types ValueRef ',' ValueRef {
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");
if (isa<PackedType>(Ty) &&
if (isa<VectorType>(Ty) &&
($1 == URemOp || $1 == SRemOp || $1 == FRemOp || $1 == RemOp))
error("Remainder not supported on packed types");
// Upgrade the opcode from obsolete versions before we do anything with it.
@ -3126,8 +3126,8 @@ InstVal
| LogicalOps Types ValueRef ',' ValueRef {
const Type *Ty = $2.PAT->get();
if (!Ty->isInteger()) {
if (!isa<PackedType>(Ty) ||
!cast<PackedType>(Ty)->getElementType()->isInteger())
if (!isa<VectorType>(Ty) ||
!cast<VectorType>(Ty)->getElementType()->isInteger())
error("Logical operator requires integral operands");
}
Instruction::BinaryOps Opcode = getBinaryOp($1, Ty, $2.S);
@ -3141,8 +3141,8 @@ InstVal
}
| SetCondOps Types ValueRef ',' ValueRef {
const Type* Ty = $2.PAT->get();
if(isa<PackedType>(Ty))
error("PackedTypes currently not supported in setcc instructions");
if(isa<VectorType>(Ty))
error("VectorTypes currently not supported in setcc instructions");
unsigned short pred;
Instruction::OtherOps Opcode = getCompareOp($1, pred, Ty, $2.S);
Value* tmpVal1 = getVal(Ty, $3);
@ -3155,8 +3155,8 @@ InstVal
}
| ICMP IPredicates Types ValueRef ',' ValueRef {
const Type *Ty = $3.PAT->get();
if (isa<PackedType>(Ty))
error("PackedTypes currently not supported in icmp instructions");
if (isa<VectorType>(Ty))
error("VectorTypes currently not supported in icmp instructions");
else if (!Ty->isInteger() && !isa<PointerType>(Ty))
error("icmp requires integer or pointer typed operands");
Value* tmpVal1 = getVal(Ty, $4);
@ -3167,8 +3167,8 @@ InstVal
}
| FCMP FPredicates Types ValueRef ',' ValueRef {
const Type *Ty = $3.PAT->get();
if (isa<PackedType>(Ty))
error("PackedTypes currently not supported in fcmp instructions");
if (isa<VectorType>(Ty))
error("VectorTypes currently not supported in fcmp instructions");
else if (!Ty->isFloatingPoint())
error("fcmp instruction requires floating point operands");
Value* tmpVal1 = getVal(Ty, $4);

View File

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

View File

@ -120,7 +120,7 @@ static bool EmitTypeVerify(std::ostream &OS, Record *ArgType) {
OS << ArgType->getValueAsInt("Width") << ", ";
// 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"));
OS << ArgType->getValueAsInt("NumElts") << ", ";
}
@ -131,8 +131,8 @@ static bool EmitTypeVerify(std::ostream &OS, Record *ArgType) {
static void EmitTypeGenerate(std::ostream &OS, Record *ArgType) {
if (ArgType->isSubClassOf("LLVMIntegerType")) {
OS << "IntegerType::get(" << ArgType->getValueAsInt("Width") << ")";
} else if (ArgType->isSubClassOf("LLVMPackedType")) {
OS << "PackedType::get(";
} else if (ArgType->isSubClassOf("LLVMVectorType")) {
OS << "VectorType::get(";
EmitTypeGenerate(OS, ArgType->getValueAsDef("ElTy"));
OS << ", " << ArgType->getValueAsInt("NumElts") << ")";
} else if (ArgType->isSubClassOf("LLVMPointerType")) {