Add the i128 builtin type to LLVM.
authorKit Barton <kbarton@ca.ibm.com>
Fri, 17 Apr 2015 15:32:15 +0000 (15:32 +0000)
committerKit Barton <kbarton@ca.ibm.com>
Fri, 17 Apr 2015 15:32:15 +0000 (15:32 +0000)
The i128 type is needed as a builtin type in order to support the v1i128 vector
type. The PowerPC ABI requires that the i128 and v1i128 types are handled
differently when passed as parameters to functions (i128 is passed in pairs of
GPRs, v1i128 is passed in a single vector register).

http://reviews.llvm.org/D8564

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235196 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/IR/IRBuilder.h
include/llvm/IR/Type.h
lib/IR/Core.cpp
lib/IR/LLVMContextImpl.cpp
lib/IR/LLVMContextImpl.h
lib/IR/Type.cpp

index 9c4ba0789952484d6c3f7a7d248b2ea15a5aae12..daa65cdb012e47be2ce4a453859a281a4c6d8be2 100644 (file)
@@ -321,6 +321,11 @@ public:
     return Type::getInt64Ty(Context);
   }
 
+  /// \brief Fetch the type representing a 128-bit integer.
+  IntegerType *getInt128Ty() {
+    return Type::getInt128Ty(Context);
+  }
+  
   /// \brief Fetch the type representing an N-bit integer.
   IntegerType *getIntNTy(unsigned N) {
     return Type::getIntNTy(Context, N);
index 09b6388bd26e5e232bdd12f50bd230e288517b39..6ab0bd0631a0191afc9299677123d76ba15bb2d6 100644 (file)
@@ -395,7 +395,8 @@ public:
   static IntegerType *getInt16Ty(LLVMContext &C);
   static IntegerType *getInt32Ty(LLVMContext &C);
   static IntegerType *getInt64Ty(LLVMContext &C);
-
+  static IntegerType *getInt128Ty(LLVMContext &C);
+  
   //===--------------------------------------------------------------------===//
   // Convenience methods for getting pointer types with one of the above builtin
   // types as pointee.
index 7fe7beb40c6b47fe3913de269045d1e2b14cc849..0c1023c73484eacf878f8558154b908696a721d7 100644 (file)
@@ -310,6 +310,9 @@ LLVMTypeRef LLVMInt32TypeInContext(LLVMContextRef C) {
 LLVMTypeRef LLVMInt64TypeInContext(LLVMContextRef C) {
   return (LLVMTypeRef) Type::getInt64Ty(*unwrap(C));
 }
+LLVMTypeRef LLVMInt128TypeInContext(LLVMContextRef C) {
+  return (LLVMTypeRef) Type::getInt128Ty(*unwrap(C));
+}
 LLVMTypeRef LLVMIntTypeInContext(LLVMContextRef C, unsigned NumBits) {
   return wrap(IntegerType::get(*unwrap(C), NumBits));
 }
@@ -329,6 +332,9 @@ LLVMTypeRef LLVMInt32Type(void) {
 LLVMTypeRef LLVMInt64Type(void) {
   return LLVMInt64TypeInContext(LLVMGetGlobalContext());
 }
+LLVMTypeRef LLVMInt128Type(void) {
+  return LLVMInt128TypeInContext(LLVMGetGlobalContext());
+}
 LLVMTypeRef LLVMIntType(unsigned NumBits) {
   return LLVMIntTypeInContext(LLVMGetGlobalContext(), NumBits);
 }
index d717b92d9fe1e0cdb95416982622b25e6991abb3..1e2080770fcd596da00cb62d50ea4a4a9c79d483 100644 (file)
@@ -35,7 +35,8 @@ LLVMContextImpl::LLVMContextImpl(LLVMContext &C)
     Int8Ty(C, 8),
     Int16Ty(C, 16),
     Int32Ty(C, 32),
-    Int64Ty(C, 64) {
+    Int64Ty(C, 64),
+    Int128Ty(C, 128) {
   InlineAsmDiagHandler = nullptr;
   InlineAsmDiagContext = nullptr;
   DiagnosticHandler = nullptr;
index c096a831b20a458a93ab2e11cea1e0b94b7d74e6..4eb37fd14be0fe9d4888d097f64423fb0eecae09 100644 (file)
@@ -920,7 +920,7 @@ public:
   // Basic type instances.
   Type VoidTy, LabelTy, HalfTy, FloatTy, DoubleTy, MetadataTy;
   Type X86_FP80Ty, FP128Ty, PPC_FP128Ty, X86_MMXTy;
-  IntegerType Int1Ty, Int8Ty, Int16Ty, Int32Ty, Int64Ty;
+  IntegerType Int1Ty, Int8Ty, Int16Ty, Int32Ty, Int64Ty, Int128Ty;
 
   
   /// TypeAllocator - All dynamically allocated types are allocated from this.
index 65060dc39d277c583ae9db4b866bb5227a6c37a2..d8baf7c9d332b2c1c9ce3d77675186a955f1afff 100644 (file)
@@ -238,6 +238,7 @@ 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; }
 
 IntegerType *Type::getIntNTy(LLVMContext &C, unsigned N) {
   return IntegerType::get(C, N);