[llvm-commits] [PATCH] Add IRBuilderBase::getIntPtrTy

Evgeniy Stepanov eugenis at google.com
Wed Oct 31 01:34:59 PDT 2012


This trivial patch adds a method to build a pointer-wide integer type to IRBuilder.

http://llvm-reviews.chandlerc.com/D90

Files:
  llvm/include/llvm/IRBuilder.h

Index: llvm/include/llvm/IRBuilder.h
===================================================================
--- llvm/include/llvm/IRBuilder.h
+++ llvm/include/llvm/IRBuilder.h
@@ -17,6 +17,7 @@
 
 #include "llvm/Instructions.h"
 #include "llvm/BasicBlock.h"
+#include "llvm/DataLayout.h"
 #include "llvm/LLVMContext.h"
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/StringRef.h"
@@ -266,6 +267,10 @@
     return Type::getInt8PtrTy(Context, AddrSpace);
   }
 
+  IntegerType* getIntPtrTy(DataLayout *DL, unsigned AddrSpace = 0) {
+    return Type::getIntNTy(Context, DL->getPointerSizeInBits(AddrSpace));
+  }
+
   //===--------------------------------------------------------------------===//
   // Intrinsic creation methods
   //===--------------------------------------------------------------------===//
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90.1.patch
Type: text/x-patch
Size: 810 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121031/d289257a/attachment.bin>


More information about the llvm-commits mailing list