Continue to implement IRBuilder

This commit is contained in:
Siu Kwan Lam 2013-01-28 17:55:52 -06:00
commit 59d0dfddc7
8 changed files with 125 additions and 19 deletions

View file

@ -0,0 +1,9 @@
from binding import *
from namespace import llvm
from Value import Argument
@Argument
class Argument:
_include_ = 'llvm/Argument.h'

View file

@ -1,6 +1,6 @@
from binding import *
from namespace import llvm
from Value import GlobalValue, Constant, Function
from Value import GlobalValue, Constant, Function, Argument
from Type import Type
from DerivedTypes import FunctionType
from LLVMContext import LLVMContext
@ -17,3 +17,5 @@ class Function:
getIntrinsicID = Method(cast(Unsigned, int))
isIntrinsic = Method(cast(Bool, bool))
getArgumentList = CustomMethod('Function_getArgumentList', PyObjectPtr)
getBasicBlockList = CustomMethod('Function_getBasicBlockList', PyObjectPtr)

View file

@ -2,7 +2,10 @@ from binding import *
from namespace import llvm
from LLVMContext import LLVMContext
from BasicBlock import BasicBlock
from Instruction import ReturnInst
from Instruction import ReturnInst, CallInst
from SmallVector import SmallVector_Value
from StringRef import StringRef
from Value import Value
IRBuilder = llvm.Class()
@ -19,3 +22,17 @@ class IRBuilder:
isNamePreserving = Method(cast(Bool, bool))
CreateRetVoid = Method(ptr(ReturnInst))
CreateRet = Method(ptr(ReturnInst), ptr(Value))
_CreateCall = Method(ptr(CallInst), ptr(Value), ref(SmallVector_Value),
cast(str, StringRef))
_CreateCall |= Method(ptr(CallInst), ptr(Value), ref(SmallVector_Value))
_CreateCall.realname = 'CreateCall'
@CustomPythonMethod
def CreateCall(self, *args):
import extra
args = list(args)
valuelist = args[1]
args[1] = extra.make_small_vector_from_values(*valuelist)
return IRBuilder._CreateCall(self, *args)

View file

@ -5,3 +5,9 @@ from namespace import llvm
class SmallVector_Type:
_realname_ = 'SmallVector<llvm::Type*,8>'
delete = Destructor()
@llvm.Class()
class SmallVector_Value:
_realname_ = 'SmallVector<llvm::Value*,8>'
delete = Destructor()

View file

@ -8,6 +8,7 @@ from StringRef import StringRef
Value = llvm.Class()
# forward declarations
Argument = llvm.Class(Value)
User = llvm.Class(Value)
BasicBlock = llvm.Class(Value)
Constant = llvm.Class(User)