view llvm.patch @ 167:cbebde9ba2c8

proper patch for llvm bindings
author dan amlund <danamlund@gmail.com>
date Wed, 23 Jul 2008 00:31:11 +0200
parents 575c267bdd1f
children
line wrap: on
line source

diff -Naur -X exclude llvmbindings/llvm/llvm.d llvmbindings_ny/llvm/llvm.d
--- llvmbindings/llvm/llvm.d	2008-07-23 00:11:36.000000000 +0200
+++ llvmbindings_ny/llvm/llvm.d	2008-07-22 23:51:15.000000000 +0200
@@ -44,6 +44,8 @@
 alias LLVMVisibility Visibility;
 ///
 alias LLVMValueKind ValueKind;
+///
+public alias LLVMParamAttr ParamAttr;
 
 ///
 class Module
@@ -837,6 +839,20 @@
         return getValueOf(v);
     }
     ///
+    void addParamAttr(uint idx, ParamAttr PA)
+    {
+        auto v = LLVMGetParam(value, idx);
+        assert(v !is null);
+        LLVMAddParamAttr(v, PA);
+    }
+    ///
+    void removeParamAttr(uint idx, ParamAttr PA)
+    {
+        auto v = LLVMGetParam(value, idx);
+        assert(v !is null);
+        LLVMRemoveParamAttr(v, PA);
+    }
+    ///
     uint intrinsicID()
     {
         return LLVMGetIntrinsicID(value);
diff -Naur -X exclude llvmbindings/llvm/type.d llvmbindings_ny/llvm/type.d
--- llvmbindings/llvm/type.d	2008-07-23 00:11:36.000000000 +0200
+++ llvmbindings_ny/llvm/type.d	2008-07-23 00:07:46.000000000 +0200
@@ -111,7 +111,7 @@
     Type refineAbstractType(Type to) {
         assert(isAbstract());
         
-        LLVMRefineAbstractType(type, to.type);
+        //LLVMRefineAbstractType(type, to.type);
         
         // Either type will do. Go through the registry to try to use the
         // "canonical" Type object for the type.
diff -Naur -X exclude llvmbindings/llvm.patch llvmbindings_ny/llvm.patch
--- llvmbindings/llvm.patch	1970-01-01 01:00:00.000000000 +0100
+++ llvmbindings_ny/llvm.patch	2008-07-22 23:45:58.000000000 +0200
@@ -0,0 +1,107 @@
+Index: llvm/c/Core.d
+===================================================================
+--- llvm/c/Core.d	(revision 170)
++++ llvm/c/Core.d	(working copy)
+@@ -82,6 +82,20 @@
+  */
+ typedef LLVM_OpaqueMemoryBuffer* LLVMMemoryBufferRef;
+ 
++enum LLVMParamAttr {
++    ZExt = 1<<0,
++    SExt = 1<<1,
++    NoReturn = 1<<2,
++    InReg = 1<<3,
++    StructRet = 1<<4,
++    NoUnwind = 1<<5,
++    NoAlias = 1<<6,
++    ByVal = 1<<7,
++    Nest = 1<<8,
++    ReadNone = 1<<9,
++    ReadOnly = 1<<10
++}
++
+ enum LLVMTypeKind {
+   Void,        /**< type with no size */
+   Float,       /**< 32 bit floating point type */
+@@ -388,6 +402,14 @@
+ /*const*/ char *LLVMGetCollector(LLVMValueRef Fn);
+ void LLVMSetCollector(LLVMValueRef Fn, /*const*/ char *Coll);
+ 
++void LLVMAddParamAttr(LLVMValueRef Arg, LLVMParamAttr Attr);
++void LLVMRemoveParamAttr(LLVMValueRef Arg, LLVMParamAttr Attr);
++void LLVMSetParamAlignment(LLVMValueRef Arg, uint Align);
++void LLVMAddInstrParamAttr(LLVMValueRef Inst, uint Index, LLVMParamAttr Attr);
++void LLVMRemoveInstrParamAttr(LLVMValueRef Inst, uint Index, LLVMParamAttr Attr);
++void LLVMSetInstrParamAlignment(LLVMValueRef Inst, uint Index, uint Align);
++
++
+ /* Operations on basic blocks */
+ LLVMValueRef LLVMBasicBlockAsValue(LLVMBasicBlockRef Bb);
+ int LLVMValueIsBasicBlock(LLVMValueRef Val);
+Index: llvm/llvm.d
+===================================================================
+--- llvm/llvm.d	(revision 170)
++++ llvm/llvm.d	(working copy)
+@@ -43,6 +43,8 @@
+ alias LLVMVisibility Visibility;
+ ///
+ alias LLVMValueKind ValueKind;
++///
++public alias LLVMParamAttr ParamAttr;
+ 
+ ///
+ class Module
+@@ -836,6 +838,20 @@
+         return getValueOf(v);
+     }
+     ///
++    void addParamAttr(uint idx, ParamAttr PA)
++    {
++        auto v = LLVMGetParam(value, idx);
++        assert(v !is null);
++        LLVMAddParamAttr(v, PA);
++    }
++    ///
++    void removeParamAttr(uint idx, ParamAttr PA)
++    {
++        auto v = LLVMGetParam(value, idx);
++        assert(v !is null);
++        LLVMRemoveParamAttr(v, PA);
++    }
++    ///
+     uint intrinsicID()
+     {
+         return LLVMGetIntrinsicID(value);
+Index: llvm-fix.cpp
+===================================================================
+--- llvm-fix.cpp	(revision 170)
++++ llvm-fix.cpp	(working copy)
+@@ -29,10 +29,10 @@
+   APN.convert(SemanticsForType(unwrap(RealTy)), APFloat::rmNearestTiesToEven);
+   return wrap(ConstantFP::get(unwrap(RealTy), APN));
+ }
+-
++/*
+ LLVMValueRef LLVMConstRealOfString(LLVMTypeRef RealTy, const char *Text) {
+   return wrap(ConstantFP::get(unwrap(RealTy),
+                               APFloat(SemanticsForType(unwrap(RealTy)), Text)));
+ }
+-
++*/
+ }
+Index: llvm-ext.cpp
+===================================================================
+--- llvm-ext.cpp	(revision 170)
++++ llvm-ext.cpp	(working copy)
+@@ -80,9 +80,11 @@
+ LLVMTargetDataRef LLVMGetTargetDataFromModule(LLVMModuleRef M) {
+     return wrap(new TargetData(unwrap(M)));
+ }
++/*
+ void LLVMDisposeTargetData(LLVMTargetDataRef TD) {
+     delete unwrap(TD);
+ }
++*/
+ 
+ // we need to be able to query the ABI size of a type as an integer
+ size_t LLVMGetABITypeSize(LLVMTargetDataRef TD, LLVMTypeRef T) {