[llvm] r192913 - llvm-c: Add LLVMIntPtrType{,ForAS}InContext
Anders Waldenborg
anders at 0x63.nu
Thu Oct 17 11:51:01 PDT 2013
Author: andersg
Date: Thu Oct 17 13:51:01 2013
New Revision: 192913
URL: http://llvm.org/viewvc/llvm-project?rev=192913&view=rev
Log:
llvm-c: Add LLVMIntPtrType{,ForAS}InContext
All of the Core API functions have versions which accept explicit context, in
addition to ones which work on global context. This commit adds functions
which accept explicit context to the Target API for consistency.
Patch by Peter Zotov
Differential Revision: http://llvm-reviews.chandlerc.com/D1912
Modified:
llvm/trunk/include/llvm-c/Target.h
llvm/trunk/lib/Target/Target.cpp
Modified: llvm/trunk/include/llvm-c/Target.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Target.h?rev=192913&r1=192912&r2=192913&view=diff
==============================================================================
--- llvm/trunk/include/llvm-c/Target.h (original)
+++ llvm/trunk/include/llvm-c/Target.h Thu Oct 17 13:51:01 2013
@@ -186,6 +186,15 @@ LLVMTypeRef LLVMIntPtrType(LLVMTargetDat
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);
Modified: llvm/trunk/lib/Target/Target.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Target.cpp?rev=192913&r1=192912&r2=192913&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Target.cpp (original)
+++ llvm/trunk/lib/Target/Target.cpp Thu Oct 17 13:51:01 2013
@@ -88,6 +88,14 @@ LLVMTypeRef LLVMIntPtrTypeForAS(LLVMTarg
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));
}
More information about the llvm-commits
mailing list