[PATCH] C API: implement LLVMIntPtrType{,ForAS}InContext

Peter Zotov whitequark at whitequark.org
Sat Oct 12 23:07:04 PDT 2013


  Changed argument order to make context the first argument.

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

CHANGE SINCE LAST DIFF
  http://llvm-reviews.chandlerc.com/D1912?vs=4864&id=4887#toc

Files:
  include/llvm-c/Target.h
  lib/Target/Target.cpp

Index: include/llvm-c/Target.h
===================================================================
--- include/llvm-c/Target.h
+++ include/llvm-c/Target.h
@@ -186,6 +186,15 @@
     See the method llvm::DataLayout::getIntPtrType. */
 LLVMTypeRef LLVMIntPtrTypeForAS(LLVMTargetDataRef, unsigned AS);
 
+/** Returns the integer type that is the same size as a pointer on a target.
+    See the method llvm::DataLayout::getIntPtrType. */
+LLVMTypeRef LLVMIntPtrTypeInContext(LLVMContextRef, LLVMTargetDataRef);
+
+/** Returns the integer type that is the same size as a pointer on a target.
+    This version allows the address space to be specified.
+    See the method llvm::DataLayout::getIntPtrType. */
+LLVMTypeRef LLVMIntPtrTypeForASInContext(LLVMContextRef, LLVMTargetDataRef, unsigned AS);
+
 /** Computes the size of a type in bytes for a target.
     See the method llvm::DataLayout::getTypeSizeInBits. */
 unsigned long long LLVMSizeOfTypeInBits(LLVMTargetDataRef, LLVMTypeRef);
Index: lib/Target/Target.cpp
===================================================================
--- lib/Target/Target.cpp
+++ lib/Target/Target.cpp
@@ -88,6 +88,14 @@
   return wrap(unwrap(TD)->getIntPtrType(getGlobalContext(), AS));
 }
 
+LLVMTypeRef LLVMIntPtrTypeInContext(LLVMContextRef C, LLVMTargetDataRef TD) {
+  return wrap(unwrap(TD)->getIntPtrType(*unwrap(C)));
+}
+
+LLVMTypeRef LLVMIntPtrTypeForASInContext(LLVMContextRef C, LLVMTargetDataRef TD, unsigned AS) {
+  return wrap(unwrap(TD)->getIntPtrType(*unwrap(C), AS));
+}
+
 unsigned long long LLVMSizeOfTypeInBits(LLVMTargetDataRef TD, LLVMTypeRef Ty) {
   return unwrap(TD)->getTypeSizeInBits(unwrap(Ty));
 }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1912.2.patch
Type: text/x-patch
Size: 1663 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131012/df4a6761/attachment.bin>


More information about the llvm-commits mailing list