From: Chandler Carruth Date: Wed, 26 Feb 2014 10:08:11 +0000 (+0000) Subject: Add two helpers to IRBuilder to flesh the interface out to N-width X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=18eab50e99ab1cbfff3f80629bd3311fd444a14d;p=oota-llvm.git Add two helpers to IRBuilder to flesh the interface out to N-width integers. Complements the interfaces it is wrapping. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202251 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/IR/IRBuilder.h b/include/llvm/IR/IRBuilder.h index 617f40de8f5..e43bc9fc5d3 100644 --- a/include/llvm/IR/IRBuilder.h +++ b/include/llvm/IR/IRBuilder.h @@ -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);