[llvm] r202251 - Add two helpers to IRBuilder to flesh the interface out to N-width

Chandler Carruth chandlerc at gmail.com
Wed Feb 26 02:08:12 PST 2014


Author: chandlerc
Date: Wed Feb 26 04:08:11 2014
New Revision: 202251

URL: http://llvm.org/viewvc/llvm-project?rev=202251&view=rev
Log:
Add two helpers to IRBuilder to flesh the interface out to N-width
integers. Complements the interfaces it is wrapping.

Modified:
    llvm/trunk/include/llvm/IR/IRBuilder.h

Modified: llvm/trunk/include/llvm/IR/IRBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/IRBuilder.h?rev=202251&r1=202250&r2=202251&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/IRBuilder.h (original)
+++ llvm/trunk/include/llvm/IR/IRBuilder.h Wed Feb 26 04:08:11 2014
@@ -282,6 +282,12 @@ public:
     return ConstantInt::get(getInt64Ty(), C);
   }
 
+  /// \brief Get a constant N-bit value, zero extended or truncated from
+  /// a 64-bit value.
+  ConstantInt *getIntN(unsigned N, uint64_t C) {
+    return ConstantInt::get(getIntNTy(N), C);
+  }
+
   /// \brief Get a constant integer value.
   ConstantInt *getInt(const APInt &AI) {
     return ConstantInt::get(Context, AI);
@@ -316,6 +322,11 @@ public:
     return Type::getInt64Ty(Context);
   }
 
+  /// \brief Fetch the type representing an N-bit integer.
+  IntegerType *getIntNTy(unsigned N) {
+    return Type::getIntNTy(Context, N);
+  }
+
   /// \brief Fetch the type representing a 32-bit floating point value.
   Type *getFloatTy() {
     return Type::getFloatTy(Context);





More information about the llvm-commits mailing list