diff --git a/llvm/include/llvm/IR/Type.h b/llvm/include/llvm/IR/Type.h --- a/llvm/include/llvm/IR/Type.h +++ b/llvm/include/llvm/IR/Type.h @@ -405,24 +405,24 @@ //===--------------------------------------------------------------------===// // These are the builtin types that are always available. // - static Type *getVoidTy(LLVMContext &C); - static Type *getLabelTy(LLVMContext &C); - static Type *getHalfTy(LLVMContext &C); - static Type *getFloatTy(LLVMContext &C); - static Type *getDoubleTy(LLVMContext &C); - static Type *getMetadataTy(LLVMContext &C); - static Type *getX86_FP80Ty(LLVMContext &C); - static Type *getFP128Ty(LLVMContext &C); - static Type *getPPC_FP128Ty(LLVMContext &C); - static Type *getX86_MMXTy(LLVMContext &C); - static Type *getTokenTy(LLVMContext &C); + static Type *getVoidTy(const LLVMContext &C); + static Type *getLabelTy(const LLVMContext &C); + static Type *getHalfTy(const LLVMContext &C); + static Type *getFloatTy(const LLVMContext &C); + static Type *getDoubleTy(const LLVMContext &C); + static Type *getMetadataTy(const LLVMContext &C); + static Type *getX86_FP80Ty(const LLVMContext &C); + static Type *getFP128Ty(const LLVMContext &C); + static Type *getPPC_FP128Ty(const LLVMContext &C); + static Type *getX86_MMXTy(const LLVMContext &C); + static Type *getTokenTy(const LLVMContext &C); static IntegerType *getIntNTy(LLVMContext &C, unsigned N); - static IntegerType *getInt1Ty(LLVMContext &C); - static IntegerType *getInt8Ty(LLVMContext &C); - static IntegerType *getInt16Ty(LLVMContext &C); - static IntegerType *getInt32Ty(LLVMContext &C); - static IntegerType *getInt64Ty(LLVMContext &C); - static IntegerType *getInt128Ty(LLVMContext &C); + static IntegerType *getInt1Ty(const LLVMContext &C); + static IntegerType *getInt8Ty(const LLVMContext &C); + static IntegerType *getInt16Ty(const LLVMContext &C); + static IntegerType *getInt32Ty(const LLVMContext &C); + static IntegerType *getInt64Ty(const LLVMContext &C); + static IntegerType *getInt128Ty(const LLVMContext &C); template static Type *getScalarTy(LLVMContext &C) { int noOfBits = sizeof(ScalarTy) * CHAR_BIT; if (std::is_integral::value) { @@ -442,19 +442,19 @@ // Convenience methods for getting pointer types with one of the above builtin // types as pointee. // - static PointerType *getHalfPtrTy(LLVMContext &C, unsigned AS = 0); - static PointerType *getFloatPtrTy(LLVMContext &C, unsigned AS = 0); - static PointerType *getDoublePtrTy(LLVMContext &C, unsigned AS = 0); - static PointerType *getX86_FP80PtrTy(LLVMContext &C, unsigned AS = 0); - static PointerType *getFP128PtrTy(LLVMContext &C, unsigned AS = 0); - static PointerType *getPPC_FP128PtrTy(LLVMContext &C, unsigned AS = 0); - static PointerType *getX86_MMXPtrTy(LLVMContext &C, unsigned AS = 0); + static PointerType *getHalfPtrTy(const LLVMContext &C, unsigned AS = 0); + static PointerType *getFloatPtrTy(const LLVMContext &C, unsigned AS = 0); + static PointerType *getDoublePtrTy(const LLVMContext &C, unsigned AS = 0); + static PointerType *getX86_FP80PtrTy(const LLVMContext &C, unsigned AS = 0); + static PointerType *getFP128PtrTy(const LLVMContext &C, unsigned AS = 0); + static PointerType *getPPC_FP128PtrTy(const LLVMContext &C, unsigned AS = 0); + static PointerType *getX86_MMXPtrTy(const LLVMContext &C, unsigned AS = 0); static PointerType *getIntNPtrTy(LLVMContext &C, unsigned N, unsigned AS = 0); - static PointerType *getInt1PtrTy(LLVMContext &C, unsigned AS = 0); - static PointerType *getInt8PtrTy(LLVMContext &C, unsigned AS = 0); - static PointerType *getInt16PtrTy(LLVMContext &C, unsigned AS = 0); - static PointerType *getInt32PtrTy(LLVMContext &C, unsigned AS = 0); - static PointerType *getInt64PtrTy(LLVMContext &C, unsigned AS = 0); + static PointerType *getInt1PtrTy(const LLVMContext &C, unsigned AS = 0); + static PointerType *getInt8PtrTy(const LLVMContext &C, unsigned AS = 0); + static PointerType *getInt16PtrTy(const LLVMContext &C, unsigned AS = 0); + static PointerType *getInt32PtrTy(const LLVMContext &C, unsigned AS = 0); + static PointerType *getInt64PtrTy(const LLVMContext &C, unsigned AS = 0); /// Return a pointer to the current type. This is equivalent to /// PointerType::get(Foo, AddrSpace). diff --git a/llvm/lib/IR/Type.cpp b/llvm/lib/IR/Type.cpp --- a/llvm/lib/IR/Type.cpp +++ b/llvm/lib/IR/Type.cpp @@ -162,54 +162,54 @@ // Primitive 'Type' data //===----------------------------------------------------------------------===// -Type *Type::getVoidTy(LLVMContext &C) { return &C.pImpl->VoidTy; } -Type *Type::getLabelTy(LLVMContext &C) { return &C.pImpl->LabelTy; } -Type *Type::getHalfTy(LLVMContext &C) { return &C.pImpl->HalfTy; } -Type *Type::getFloatTy(LLVMContext &C) { return &C.pImpl->FloatTy; } -Type *Type::getDoubleTy(LLVMContext &C) { return &C.pImpl->DoubleTy; } -Type *Type::getMetadataTy(LLVMContext &C) { return &C.pImpl->MetadataTy; } -Type *Type::getTokenTy(LLVMContext &C) { return &C.pImpl->TokenTy; } -Type *Type::getX86_FP80Ty(LLVMContext &C) { return &C.pImpl->X86_FP80Ty; } -Type *Type::getFP128Ty(LLVMContext &C) { return &C.pImpl->FP128Ty; } -Type *Type::getPPC_FP128Ty(LLVMContext &C) { return &C.pImpl->PPC_FP128Ty; } -Type *Type::getX86_MMXTy(LLVMContext &C) { return &C.pImpl->X86_MMXTy; } - -IntegerType *Type::getInt1Ty(LLVMContext &C) { return &C.pImpl->Int1Ty; } -IntegerType *Type::getInt8Ty(LLVMContext &C) { return &C.pImpl->Int8Ty; } -IntegerType *Type::getInt16Ty(LLVMContext &C) { return &C.pImpl->Int16Ty; } -IntegerType *Type::getInt32Ty(LLVMContext &C) { return &C.pImpl->Int32Ty; } -IntegerType *Type::getInt64Ty(LLVMContext &C) { return &C.pImpl->Int64Ty; } -IntegerType *Type::getInt128Ty(LLVMContext &C) { return &C.pImpl->Int128Ty; } +Type *Type::getVoidTy(const LLVMContext &C) { return &C.pImpl->VoidTy; } +Type *Type::getLabelTy(const LLVMContext &C) { return &C.pImpl->LabelTy; } +Type *Type::getHalfTy(const LLVMContext &C) { return &C.pImpl->HalfTy; } +Type *Type::getFloatTy(const LLVMContext &C) { return &C.pImpl->FloatTy; } +Type *Type::getDoubleTy(const LLVMContext &C) { return &C.pImpl->DoubleTy; } +Type *Type::getMetadataTy(const LLVMContext &C) { return &C.pImpl->MetadataTy; } +Type *Type::getTokenTy(const LLVMContext &C) { return &C.pImpl->TokenTy; } +Type *Type::getX86_FP80Ty(const LLVMContext &C) { return &C.pImpl->X86_FP80Ty; } +Type *Type::getFP128Ty(const LLVMContext &C) { return &C.pImpl->FP128Ty; } +Type *Type::getPPC_FP128Ty(const LLVMContext &C) { return &C.pImpl->PPC_FP128Ty; } +Type *Type::getX86_MMXTy(const LLVMContext &C) { return &C.pImpl->X86_MMXTy; } + +IntegerType *Type::getInt1Ty(const LLVMContext &C) { return &C.pImpl->Int1Ty; } +IntegerType *Type::getInt8Ty(const LLVMContext &C) { return &C.pImpl->Int8Ty; } +IntegerType *Type::getInt16Ty(const LLVMContext &C) { return &C.pImpl->Int16Ty; } +IntegerType *Type::getInt32Ty(const LLVMContext &C) { return &C.pImpl->Int32Ty; } +IntegerType *Type::getInt64Ty(const LLVMContext &C) { return &C.pImpl->Int64Ty; } +IntegerType *Type::getInt128Ty(const LLVMContext &C) { return &C.pImpl->Int128Ty; } IntegerType *Type::getIntNTy(LLVMContext &C, unsigned N) { return IntegerType::get(C, N); } -PointerType *Type::getHalfPtrTy(LLVMContext &C, unsigned AS) { +PointerType *Type::getHalfPtrTy(const LLVMContext &C, unsigned AS) { return getHalfTy(C)->getPointerTo(AS); } -PointerType *Type::getFloatPtrTy(LLVMContext &C, unsigned AS) { +PointerType *Type::getFloatPtrTy(const LLVMContext &C, unsigned AS) { return getFloatTy(C)->getPointerTo(AS); } -PointerType *Type::getDoublePtrTy(LLVMContext &C, unsigned AS) { +PointerType *Type::getDoublePtrTy(const LLVMContext &C, unsigned AS) { return getDoubleTy(C)->getPointerTo(AS); } -PointerType *Type::getX86_FP80PtrTy(LLVMContext &C, unsigned AS) { +PointerType *Type::getX86_FP80PtrTy(const LLVMContext &C, unsigned AS) { return getX86_FP80Ty(C)->getPointerTo(AS); } -PointerType *Type::getFP128PtrTy(LLVMContext &C, unsigned AS) { +PointerType *Type::getFP128PtrTy(const LLVMContext &C, unsigned AS) { return getFP128Ty(C)->getPointerTo(AS); } -PointerType *Type::getPPC_FP128PtrTy(LLVMContext &C, unsigned AS) { +PointerType *Type::getPPC_FP128PtrTy(const LLVMContext &C, unsigned AS) { return getPPC_FP128Ty(C)->getPointerTo(AS); } -PointerType *Type::getX86_MMXPtrTy(LLVMContext &C, unsigned AS) { +PointerType *Type::getX86_MMXPtrTy(const LLVMContext &C, unsigned AS) { return getX86_MMXTy(C)->getPointerTo(AS); } @@ -217,23 +217,23 @@ return getIntNTy(C, N)->getPointerTo(AS); } -PointerType *Type::getInt1PtrTy(LLVMContext &C, unsigned AS) { +PointerType *Type::getInt1PtrTy(const LLVMContext &C, unsigned AS) { return getInt1Ty(C)->getPointerTo(AS); } -PointerType *Type::getInt8PtrTy(LLVMContext &C, unsigned AS) { +PointerType *Type::getInt8PtrTy(const LLVMContext &C, unsigned AS) { return getInt8Ty(C)->getPointerTo(AS); } -PointerType *Type::getInt16PtrTy(LLVMContext &C, unsigned AS) { +PointerType *Type::getInt16PtrTy(const LLVMContext &C, unsigned AS) { return getInt16Ty(C)->getPointerTo(AS); } -PointerType *Type::getInt32PtrTy(LLVMContext &C, unsigned AS) { +PointerType *Type::getInt32PtrTy(const LLVMContext &C, unsigned AS) { return getInt32Ty(C)->getPointerTo(AS); } -PointerType *Type::getInt64PtrTy(LLVMContext &C, unsigned AS) { +PointerType *Type::getInt64PtrTy(const LLVMContext &C, unsigned AS) { return getInt64Ty(C)->getPointerTo(AS); }