82 APInt Result(
IT->getBitWidth(), 0);
83 for (
unsigned i = 0; i != NumSrcElts; ++i) {
101 if (isa<ConstantFP>(C) || isa<ConstantInt>(C)) {
107 if (!isa<ConstantDataVector>(C) && !isa<ConstantVector>(C))
113 if (NumDstElt == NumSrcElt)
150 if (!isa<ConstantVector>(C) &&
151 !isa<ConstantDataVector>(C))
162 if (NumDstElt < NumSrcElt) {
165 unsigned Ratio = NumSrcElt/NumDstElt;
168 for (
unsigned i = 0; i != NumDstElt; ++i) {
171 unsigned ShiftAmt = isLittleEndian ? 0 : SrcBitSize*(Ratio-1);
172 for (
unsigned j = 0; j != Ratio; ++j) {
183 ShiftAmt += isLittleEndian ? SrcBitSize : -SrcBitSize;
194 unsigned Ratio = NumDstElt/NumSrcElt;
198 for (
unsigned i = 0; i != NumSrcElt; ++i) {
203 unsigned ShiftAmt = isLittleEndian ? 0 : DstBitSize*(Ratio-1);
204 for (
unsigned j = 0; j != Ratio; ++j) {
209 ShiftAmt += isLittleEndian ? DstBitSize : -DstBitSize;
226 if ((GV = dyn_cast<GlobalValue>(C))) {
228 Offset =
APInt(BitWidth, 0);
234 if (!CE)
return false;
237 if (CE->
getOpcode() == Instruction::PtrToInt ||
247 APInt TmpOffset(BitWidth, 0);
266 unsigned char *CurPtr,
unsigned BytesLeft,
269 "Out of range access");
273 if (isa<ConstantAggregateZero>(C) || isa<UndefValue>(C))
277 if (CI->getBitWidth() > 64 ||
278 (CI->getBitWidth() & 7) != 0)
281 uint64_t Val = CI->getZExtValue();
282 unsigned IntBytes =
unsigned(CI->getBitWidth()/8);
284 for (
unsigned i = 0; i != BytesLeft && ByteOffset != IntBytes; ++i) {
287 n = IntBytes - n - 1;
288 CurPtr[i] = (
unsigned char)(Val >> (n * 8));
294 if (
ConstantFP *CFP = dyn_cast<ConstantFP>(C)) {
295 if (CFP->getType()->isDoubleTy()) {
299 if (CFP->getType()->isFloatTy()){
303 if (CFP->getType()->isHalfTy()){
314 ByteOffset -= CurEltOffset;
321 if (ByteOffset < EltSize &&
329 if (Index == CS->getType()->getNumElements())
335 if (BytesLeft <= NextEltOffset - CurEltOffset - ByteOffset)
339 CurPtr += NextEltOffset - CurEltOffset - ByteOffset;
340 BytesLeft -= NextEltOffset - CurEltOffset - ByteOffset;
342 CurEltOffset = NextEltOffset;
347 if (isa<ConstantArray>(C) || isa<ConstantVector>(C) ||
348 isa<ConstantDataSequential>(C)) {
351 uint64_t Index = ByteOffset / EltSize;
352 uint64_t Offset = ByteOffset - Index * EltSize;
355 NumElts = AT->getNumElements();
359 for (; Index != NumElts; ++Index) {
364 uint64_t BytesWritten = EltSize - Offset;
365 assert(BytesWritten <= EltSize &&
"Not indexing into this element?");
366 if (BytesWritten >= BytesLeft)
370 BytesLeft -= BytesWritten;
371 CurPtr += BytesWritten;
377 if (CE->getOpcode() == Instruction::IntToPtr &&
378 CE->getOperand(0)->getType() == TD.
getIntPtrType(CE->getType())) {
403 if (LoadTy->isHalfTy())
405 else if (LoadTy->isFloatTy())
407 else if (LoadTy->isDoubleTy())
409 else if (LoadTy->isVectorTy()) {
422 unsigned BytesLoaded = (IntType->
getBitWidth() + 7) / 8;
423 if (BytesLoaded > 32 || BytesLoaded == 0)
446 unsigned char RawBytes[32] = {0};
453 ResultVal = RawBytes[BytesLoaded - 1];
454 for (
unsigned i = 1; i != BytesLoaded; ++i) {
456 ResultVal |= RawBytes[BytesLoaded - 1 - i];
459 ResultVal = RawBytes[0];
460 for (
unsigned i = 1; i != BytesLoaded; ++i) {
462 ResultVal |= RawBytes[i];
476 if (GV->isConstant() && GV->hasDefinitiveInitializer())
477 return GV->getInitializer();
484 if (CE->
getOpcode() == Instruction::GetElementPtr) {
486 if (GV->isConstant() && GV->hasDefinitiveInitializer()) {
499 Type *Ty = cast<PointerType>(CE->
getType())->getElementType();
503 if ((NumBits >> 3) == StrLen + 1 && (NumBits & 7) == 0 &&
506 APInt SingleChar(NumBits, 0);
508 for (
signed i = StrLen-1; i >= 0; i--) {
509 SingleChar = (uint64_t) Str[i] & UCHAR_MAX;
510 StrVal = (StrVal << 8) | SingleChar;
513 for (
unsigned i = 0; i <
StrLen; i++) {
514 SingleChar = (uint64_t) Str[i] & UCHAR_MAX;
515 StrVal = (StrVal << 8) | SingleChar;
519 StrVal = (StrVal << 8) | SingleChar;
533 if (GV->isConstant() && GV->hasDefinitiveInitializer()) {
534 Type *ResTy = cast<PointerType>(C->
getType())->getElementType();
535 if (GV->getInitializer()->isNullValue())
537 if (isa<UndefValue>(GV->getInitializer()))
572 APInt KnownZero0(BitWidth, 0), KnownOne0(BitWidth, 0);
573 APInt KnownZero1(BitWidth, 0), KnownOne1(BitWidth, 0);
576 if ((KnownOne1 | KnownZero0).isAllOnesValue()) {
580 if ((KnownOne0 | KnownZero1).isAllOnesValue()) {
585 APInt KnownZero = KnownZero0 | KnownZero1;
586 APInt KnownOne = KnownOne0 & KnownOne1;
587 if ((KnownZero | KnownOne).isAllOnesValue()) {
594 if (Opc == Instruction::Sub && DL) {
627 for (
unsigned i = 1, e = Ops.
size(); i != e; ++i) {
631 Ops.
slice(1, i - 1)))) &&
632 Ops[i]->
getType() != IntPtrTy) {
659 Ptr = cast<Constant>(Ptr->stripPointerCasts());
660 PointerType *NewPtrTy = cast<PointerType>(Ptr->getType());
663 if (NewPtrTy->getAddressSpace() != OldPtrTy->getAddressSpace()) {
665 OldPtrTy->getAddressSpace());
686 for (
unsigned i = 1, e = Ops.
size(); i != e; ++i)
687 if (!isa<ConstantInt>(Ops[i])) {
693 assert((CE == 0 || CE->
getType() == IntPtrTy) &&
694 "CastGEPIndices didn't canonicalize index types!");
695 if (CE && CE->
getOpcode() == Instruction::Sub &&
717 while (
GEPOperator *GEP = dyn_cast<GEPOperator>(Ptr)) {
721 bool AllConstantInt =
true;
722 for (
unsigned i = 0, e = NestedOps.size(); i != e; ++i)
723 if (!isa<ConstantInt>(NestedOps[i])) {
724 AllConstantInt =
false;
730 Ptr = cast<Constant>(GEP->getOperand(0));
731 Offset +=
APInt(BitWidth,
738 APInt BasePtr(BitWidth, 0);
740 if (CE->getOpcode() == Instruction::IntToPtr) {
741 if (
ConstantInt *Base = dyn_cast<ConstantInt>(CE->getOperand(0)))
746 if (Ptr->isNullValue() || BasePtr != 0) {
755 Type *Ty = Ptr->getType();
756 assert(Ty->
isPointerTy() &&
"Forming regular GEP of non-pointer type");
761 if (ATy->isPointerTy()) {
763 if (!NewIdxs.empty())
767 if (!ATy->getElementType()->isSized())
782 Offset -= NewIdx * ElemSize;
785 Ty = ATy->getElementType();
786 }
else if (
StructType *STy = dyn_cast<StructType>(Ty)) {
802 Ty = STy->getTypeAtIndex(ElIdx);
807 }
while (Ty != ResultElementTy);
818 "Computed GetElementPtr has unexpected type!");
822 if (Ty != ResultElementTy)
843 if (
PHINode *PN = dyn_cast<PHINode>(I)) {
846 for (
unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i) {
847 Value *Incoming = PN->getIncomingValue(i);
852 if (isa<UndefValue>(Incoming))
863 if (CommonValue && C != CommonValue)
888 if (
const CmpInst *CI = dyn_cast<CmpInst>(I))
892 if (
const LoadInst *
LI = dyn_cast<LoadInst>(I))
897 cast<Constant>(IVI->getAggregateOperand()),
898 cast<Constant>(IVI->getInsertedValueOperand()),
904 cast<Constant>(EVI->getAggregateOperand()),
918 Constant *NewC = cast<Constant>(*i);
921 if (
ConstantExpr *NewCE = dyn_cast<ConstantExpr>(NewC)) {
922 if (FoldedOps.
insert(NewCE))
960 if (isa<ConstantExpr>(Ops[0]) || isa<ConstantExpr>(Ops[1])) {
970 case Instruction::ICmp:
977 case Instruction::PtrToInt:
980 if (
ConstantExpr *CE = dyn_cast<ConstantExpr>(Ops[0])) {
981 if (TD && CE->getOpcode() == Instruction::IntToPtr) {
985 if (PtrWidth < InWidth) {
996 case Instruction::IntToPtr:
1001 if (
ConstantExpr *CE = dyn_cast<ConstantExpr>(Ops[0])) {
1002 if (TD && CE->getOpcode() == Instruction::PtrToInt) {
1005 unsigned MidIntSize = CE->getType()->getScalarSizeInBits();
1007 if (MidIntSize >= SrcPtrSize) {
1016 case Instruction::Trunc:
1017 case Instruction::ZExt:
1018 case Instruction::SExt:
1019 case Instruction::FPTrunc:
1020 case Instruction::FPExt:
1021 case Instruction::UIToFP:
1022 case Instruction::SIToFP:
1023 case Instruction::FPToUI:
1024 case Instruction::FPToSI:
1025 case Instruction::AddrSpaceCast:
1027 case Instruction::BitCast:
1035 case Instruction::InsertElement:
1037 case Instruction::ShuffleVector:
1039 case Instruction::GetElementPtr:
1064 if (
ConstantExpr *CE0 = dyn_cast<ConstantExpr>(Ops0)) {
1066 if (CE0->getOpcode() == Instruction::IntToPtr) {
1078 if (CE0->getOpcode() == Instruction::PtrToInt) {
1080 if (CE0->getType() == IntPtrTy) {
1088 if (
ConstantExpr *CE1 = dyn_cast<ConstantExpr>(Ops1)) {
1089 if (TD && CE0->getOpcode() == CE1->getOpcode()) {
1090 if (CE0->getOpcode() == Instruction::IntToPtr) {
1104 if (CE0->getOpcode() == Instruction::PtrToInt) {
1106 if (CE0->getType() == IntPtrTy &&
1107 CE0->getOperand(0)->getType() == CE1->getOperand(0)->getType()) {
1165 for (
unsigned i = 0, e = Indices.
size(); i != e; ++i) {
1226 default:
return false;
1228 return Name ==
"acos" || Name ==
"asin" || Name ==
"atan" || Name ==
"atan2";
1230 return Name ==
"cos" || Name ==
"ceil" || Name ==
"cosf" || Name ==
"cosh";
1232 return Name ==
"exp" || Name ==
"exp2";
1234 return Name ==
"fabs" || Name ==
"fmod" || Name ==
"floor";
1236 return Name ==
"log" || Name ==
"log10";
1238 return Name ==
"pow";
1240 return Name ==
"sin" || Name ==
"sinh" || Name ==
"sqrt" ||
1241 Name ==
"sinf" || Name ==
"sqrtf";
1243 return Name ==
"tan" || Name ==
"tanh";
1270 double V,
double W,
Type *Ty) {
1300 bool roundTowardZero,
Type *Ty) {
1303 assert(ResultWidth <= 64 &&
1304 "Can only constant fold conversions to 64 and 32 bit ints");
1307 bool isExact =
false;
1328 if (Operands.
size() == 1) {
1329 if (
ConstantFP *Op = dyn_cast<ConstantFP>(Operands[0])) {
1331 APFloat Val(Op->getValueAPF());
1347 if (Op->getValueAPF().isNaN() || Op->getValueAPF().isInfinity())
1356 V = Op->getValueAPF().convertToFloat();
1358 V = Op->getValueAPF().convertToDouble();
1361 APFloat APF = Op->getValueAPF();
1466 if (
ConstantInt *Op = dyn_cast<ConstantInt>(Operands[0])) {
1482 "Precision lost during fp16 constfolding");
1492 if (isa<ConstantVector>(Operands[0]) ||
1493 isa<ConstantDataVector>(Operands[0])) {
1494 Constant *Op = cast<Constant>(Operands[0]);
1516 if (isa<UndefValue>(Operands[0])) {
1525 if (Operands.
size() == 2) {
1526 if (
ConstantFP *Op1 = dyn_cast<ConstantFP>(Operands[0])) {
1531 Op1V = Op1->getValueAPF().convertToFloat();
1533 Op1V = Op1->getValueAPF().convertToDouble();
1536 APFloat APF = Op1->getValueAPF();
1541 if (
ConstantFP *Op2 = dyn_cast<ConstantFP>(Operands[1])) {
1542 if (Op2->getType() != Op1->getType())
1547 Op2V = Op2->getValueAPF().convertToFloat();
1549 Op2V = Op2->getValueAPF().convertToDouble();
1552 APFloat APF = Op2->getValueAPF();
1568 }
else if (
ConstantInt *Op2C = dyn_cast<ConstantInt>(Operands[1])) {
1572 (
int)Op2C->getZExtValue())));
1576 (
int)Op2C->getZExtValue())));
1580 (
int)Op2C->getZExtValue())));
1585 if (
ConstantInt *Op1 = dyn_cast<ConstantInt>(Operands[0])) {
1586 if (
ConstantInt *Op2 = dyn_cast<ConstantInt>(Operands[1])) {
1600 Res = Op1->getValue().
sadd_ov(Op2->getValue(), Overflow);
1603 Res = Op1->getValue().
uadd_ov(Op2->getValue(), Overflow);
1606 Res = Op1->getValue().
ssub_ov(Op2->getValue(), Overflow);
1609 Res = Op1->getValue().
usub_ov(Op2->getValue(), Overflow);
1612 Res = Op1->getValue().
smul_ov(Op2->getValue(), Overflow);
1615 Res = Op1->getValue().
umul_ov(Op2->getValue(), Overflow);
1625 if (Op2->isOne() && Op1->isZero())
1629 if (Op2->isOne() && Op1->isZero())
void push_back(const T &Elt)
Abstract base class of comparison instructions.
static IntegerType * getInt1Ty(LLVMContext &C)
static Constant * getShuffleVector(Constant *V1, Constant *V2, Constant *Mask)
LLVMContext & getContext() const
uint64_t getZExtValue() const
Get zero extended value.
Type * getSequentialElementType() const
size_t size() const
size - Get the string size.
Constant * ConstantFoldLoadThroughGEPConstantExpr(Constant *C, ConstantExpr *CE)
unsigned getScalarSizeInBits()
static const fltSemantics IEEEdouble
bool canConstantFoldCallTo(const Function *F)
static bool IsConstantOffsetFromGlobal(Constant *C, GlobalValue *&GV, APInt &Offset, const DataLayout &TD)
static Constant * getSelect(Constant *C, Constant *V1, Constant *V2)
enable_if_c<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
unsigned getNumOperands() const
unsigned getPointerTypeSizeInBits(Type *) const
static Constant * getGetElementPtr(Constant *C, ArrayRef< Constant * > IdxList, bool InBounds=false)
APInt smul_ov(const APInt &RHS, bool &Overflow) const
static APInt getLowBitsSet(unsigned numBits, unsigned loBitsSet)
Get a value with low bits set.
static PointerType * getInt32PtrTy(LLVMContext &C, unsigned AS=0)
static Constant * getExtractElement(Constant *Vec, Constant *Idx)
static Constant * ConstantFoldConvertToInt(const APFloat &Val, bool roundTowardZero, Type *Ty)
bool isDoubleTy() const
isDoubleTy - Return true if this is 'double', a 64-bit IEEE fp type.
Type * getReturnType() const
static bool ReadDataFromGlobal(Constant *C, uint64_t ByteOffset, unsigned char *CurPtr, unsigned BytesLeft, const DataLayout &TD)
unsigned getAddressSpace() const
Return the address space of the Pointer type.
unsigned getBitWidth() const
Get the number of bits in this IntegerType.
static IntegerType * getInt64Ty(LLVMContext &C)
FunctionType * getType(LLVMContext &Context, ID id, ArrayRef< Type * > Tys=None)
static Constant * getSub(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
unsigned getPointerAddressSpace() const
Get the address space of this pointer or pointer vector type.
static IntegerType * getInt16Ty(LLVMContext &C)
const Constant * getInitializer() const
APInt LLVM_ATTRIBUTE_UNUSED_RESULT zextOrTrunc(unsigned width) const
Zero extend or truncate to width.
unsigned getOpcode() const
getOpcode - Return the opcode at the root of this constant expression
static Constant * ConstantFoldBinaryFP(double(*NativeFP)(double, double), double V, double W, Type *Ty)
static PointerType * getInt64PtrTy(LLVMContext &C, unsigned AS=0)
APInt ssub_ov(const APInt &RHS, bool &Overflow) const
LoopInfoBase< BlockT, LoopT > * LI
Type * getPointerElementType() const
uint64_t getTypeAllocSizeInBits(Type *Ty) const
static Constant * getNullValue(Type *Ty)
StringRef getName() const
bool isNegative() const
Determine sign of this APInt.
Value * GetUnderlyingObject(Value *V, const DataLayout *TD=0, unsigned MaxLookup=6)
static Constant * getIntegerCast(Constant *C, Type *Ty, bool isSigned)
Create a ZExt, Bitcast or Trunc for integer -> integer casts.
const StructLayout * getStructLayout(StructType *Ty) const
static cl::opt< ITMode > IT(cl::desc("IT block support"), cl::Hidden, cl::init(DefaultIT), cl::ZeroOrMore, cl::values(clEnumValN(DefaultIT,"arm-default-it","Generate IT block based on arch"), clEnumValN(RestrictedIT,"arm-restrict-it","Disallow deprecated IT based on ARMv8"), clEnumValN(NoRestrictedIT,"arm-no-restrict-it","Allow IT blocks based on ARMv7"), clEnumValEnd))
static Constant * get(unsigned Opcode, Constant *C1, Constant *C2, unsigned Flags=0)
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
bool has(LibFunc::Func F) const
opStatus convertToInteger(integerPart *, unsigned int, bool, roundingMode, bool *) const
#define llvm_unreachable(msg)
static Constant * getLShr(Constant *C1, Constant *C2, bool isExact=false)
static Constant * get(ArrayRef< Constant * > V)
static bool llvm_fenv_testexcept()
llvm_fenv_testexcept - Test if a floating-point exception was raised.
static Constant * getExtractValue(Constant *Agg, ArrayRef< unsigned > Idxs)
static PointerType * getInt16PtrTy(LLVMContext &C, unsigned AS=0)
uint64_t getIndexedOffset(Type *Ty, ArrayRef< Value * > Indices) const
static ConstantInt * ExtractElement(Constant *V, Constant *Idx)
Type * getVectorElementType() const
static Constant * StripPtrCastKeepAS(Constant *Ptr)
Strip the pointer casts, but preserve the address space information.
LLVMContext & getContext() const
getContext - Return the LLVMContext in which this type was uniqued.
bool accumulateConstantOffset(const DataLayout &DL, APInt &Offset) const
Accumulate the constant address offset of this GEP if possible.
APInt usub_ov(const APInt &RHS, bool &Overflow) const
bool isHalfTy() const
isHalfTy - Return true if this is 'half', a 16-bit IEEE fp type.
ArrayRef< T > slice(unsigned N) const
slice(n) - Chop off the first N elements of the array.
Constant * ConstantFoldConstantExpression(const ConstantExpr *CE, const DataLayout *TD=0, const TargetLibraryInfo *TLI=0)
static Constant * getPtrToInt(Constant *C, Type *Ty)
double fmod(double x, double y);
double convertToDouble() const
Constant * ConstantFoldInstruction(Instruction *I, const DataLayout *TD=0, const TargetLibraryInfo *TLI=0)
bool isFloatingPointTy() const
bool isLittleEndian() const
Layout endianness...
bool hasDefinitiveInitializer() const
APInt umul_ov(const APInt &RHS, bool &Overflow) const
unsigned getNumElements() const
Return the number of elements in the Vector type.
static Constant * getIntToPtr(Constant *C, Type *Ty)
Type * getElementType() const
size_t size() const
size - Get the array size.
void ComputeMaskedBits(Value *V, APInt &KnownZero, APInt &KnownOne, const DataLayout *TD=0, unsigned Depth=0)
static Constant * ConstantFoldLoadInst(const LoadInst *LI, const DataLayout *TD)
Constant * ConstantFoldCall(Function *F, ArrayRef< Constant * > Operands, const TargetLibraryInfo *TLI=0)
uint64_t getElementOffset(unsigned Idx) const
A self-contained host- and target-independent arbitrary-precision floating-point software implementat...
bool isX86_MMXTy() const
isX86_MMXTy - Return true if this is X86 MMX.
error_code status(const Twine &path, file_status &result)
Get file status as if by POSIX stat().
static Constant * SymbolicallyEvaluateBinop(unsigned Opc, Constant *Op0, Constant *Op1, const DataLayout *DL)
unsigned getIntrinsicID() const LLVM_READONLY
LLVM Constant Representation.
bool isFloatTy() const
isFloatTy - Return true if this is 'float', a 32-bit IEEE fp type.
static Constant * getAnd(Constant *C1, Constant *C2)
APInt Or(const APInt &LHS, const APInt &RHS)
Bitwise OR function for APInt.
static Constant * CastGEPIndices(ArrayRef< Constant * > Ops, Type *ResultTy, const DataLayout *TD, const TargetLibraryInfo *TLI)
static Constant * ConstantFoldFP(double(*NativeFP)(double), double V, Type *Ty)
opStatus convert(const fltSemantics &, roundingMode, bool *)
bool uge(const APInt &RHS) const
Unsigned greater or equal comparison.
double pow(double x, double y);
static Constant * FoldReinterpretLoadFromConstPtr(Constant *C, const DataLayout &TD)
Value * getOperand(unsigned i) const
Constant * ConstantFoldCompareInstOperands(unsigned Predicate, Constant *LHS, Constant *RHS, const DataLayout *TD=0, const TargetLibraryInfo *TLI=0)
Integer representation type.
static Constant * get(StructType *T, ArrayRef< Constant * > V)
Constant * ConstantFoldLoadFromConstPtr(Constant *C, const DataLayout *TD=0)
Constant * getAggregateElement(unsigned Elt) const
static Constant * getAllOnesValue(Type *Ty)
Get the all ones value.
unsigned getPredicate() const
uint64_t getElementAsInteger(unsigned i) const
static UndefValue * get(Type *T)
LLVMContext & getContext() const
All values hold a context through their type.
PointerType * getPointerTo(unsigned AddrSpace=0)
static const fltSemantics IEEEhalf
const T & back() const
back - Get the last element.
static Constant * SymbolicallyEvaluateGEP(ArrayRef< Constant * > Ops, Type *ResultTy, const DataLayout *TD, const TargetLibraryInfo *TLI)
bool isCompare() const
Return true if this is a compare constant expression.
IntegerType * getIntPtrType(LLVMContext &C, unsigned AddressSpace=0) const
static Constant * getPointerCast(Constant *C, Type *Ty)
Create a BitCast or a PtrToInt cast constant expression.
static IntegerType * get(LLVMContext &C, unsigned NumBits)
Get or create an IntegerType instance.
static Constant * getBitCast(Constant *C, Type *Ty)
roundingMode
IEEE-754R 4.3: Rounding-direction attributes.
static void llvm_fenv_clearexcept()
llvm_fenv_clearexcept - Clear the floating-point exception state.
unsigned getIntegerBitWidth() const
Class for constant integers.
uint64_t getTypeAllocSize(Type *Ty) const
unsigned getVectorNumElements() const
static Constant * ConstantFoldConstantExpressionImpl(const ConstantExpr *CE, const DataLayout *TD, const TargetLibraryInfo *TLI, SmallPtrSet< ConstantExpr *, 4 > &FoldedOps)
uint64_t getSizeInBytes() const
unsigned getElementContainingOffset(uint64_t Offset) const
static Constant * get(Type *Ty, uint64_t V, bool isSigned=false)
static Constant * getTrunc(Constant *C, Type *Ty)
static Constant * get(Type *Ty, double V)
bool isAllOnesValue() const
Class for arbitrary precision integers.
APInt uadd_ov(const APInt &RHS, bool &Overflow) const
APInt And(const APInt &LHS, const APInt &RHS)
Bitwise AND function for APInt.
PointerType * getType() const
getType - Global values are always pointers.
static const fltSemantics IEEEsingle
APInt LLVM_ATTRIBUTE_UNUSED_RESULT udiv(const APInt &RHS) const
Unsigned division operation.
static IntegerType * getInt32Ty(LLVMContext &C)
static Constant * getZExt(Constant *C, Type *Ty)
static Instruction::CastOps getCastOpcode(const Value *Val, bool SrcIsSigned, Type *Ty, bool DstIsSigned)
Infer the opcode for cast operand and type.
static Constant * getOr(Constant *C1, Constant *C2)
static Constant * getShl(Constant *C1, Constant *C2, bool HasNUW=false, bool HasNSW=false)
const Type * getScalarType() const
APInt sadd_ov(const APInt &RHS, bool &Overflow) const
unsigned getPrimitiveSizeInBits() const
static Constant * getInsertValue(Constant *Agg, Constant *Val, ArrayRef< unsigned > Idxs)
static PointerType * getIntNPtrTy(LLVMContext &C, unsigned N, unsigned AS=0)
bool getConstantStringInfo(const Value *V, StringRef &Str, uint64_t Offset=0, bool TrimAtNul=true)
static Type * getIndexedType(Type *Ptr, ArrayRef< Value * > IdxList)
double atan2(double y, double x);
LLVM Value Representation.
unsigned getOpcode() const
getOpcode() returns a member of one of the enums like Instruction::Add.
static VectorType * get(Type *ElementType, unsigned NumElements)
Constant * ConstantFoldInstOperands(unsigned Opcode, Type *DestTy, ArrayRef< Constant * > Ops, const DataLayout *TD=0, const TargetLibraryInfo *TLI=0)
uint64_t getTypeSizeInBits(Type *Ty) const
static Constant * getCompare(unsigned short pred, Constant *C1, Constant *C2)
Return an ICmp or FCmp comparison operator constant expression.
Constant * ConstantFoldLoadThroughGEPIndices(Constant *C, ArrayRef< Constant * > Indices)
static Constant * FoldBitCast(Constant *C, Type *DestTy, const DataLayout &TD)
static Constant * getCast(unsigned ops, Constant *C, Type *Ty)
INITIALIZE_PASS(GlobalMerge,"global-merge","Global Merge", false, false) bool GlobalMerge const DataLayout * TD
static Constant * getInsertElement(Constant *Vec, Constant *Elt, Constant *Idx)
bool empty() const
empty - Check if the string is empty.