"
Copyright (C) 2015-now Jan Vrany
This code is not an open-source (yet). You may use this code
for your own experiments and projects, given that:
* all modification to the code will be sent to the
original author for inclusion in future releases
* this is not used in any commercial software
This license is provisional and may (will) change in
a future.
"
"{ Package: 'jv:llvm_s' }"
"{ NameSpace: Smalltalk }"
LLVMValue subclass:#LLVMFunction
instanceVariableNames:'numArgs'
classVariableNames:''
poolDictionaries:''
category:'LLVM-S-Core'
!
!LLVMFunction class methodsFor:'documentation'!
copyright
"
Copyright (C) 2015-now Jan Vrany
This code is not an open-source (yet). You may use this code
for your own experiments and projects, given that:
* all modification to the code will be sent to the
original author for inclusion in future releases
* this is not used in any commercial software
This license is provisional and may (will) change in
a future.
"
! !
!LLVMFunction methodsFor:'accessing'!
numArgs
| last current |
numArgs isNil ifTrue:[
numArgs := 0.
"/ current := LLVM GetFirstParam: self.
"/ last := LLVM GetLastParam: self.
"/ [ current ~= last ] whileTrue:[
"/ numArgs := numArgs + 1.
"/ current := LLVM GetNextFunction: current.
"/ self halt.
"/ ].
].
^ numArgs
"Created: / 11-07-2015 / 09:42:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 11-07-2015 / 11:23:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
parameterAt: index
^ LLVM GetParam: self _: index - 1.
"Created: / 07-07-2015 / 22:49:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 11-07-2015 / 10:13:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!LLVMFunction methodsFor:'functions-adding'!
addBasicBlockNamed: name
| bb |
self assert: name isSingleByteString.
bb := LLVM AppendBasicBlock: self _: name.
bb module: self.
^ bb
"Created: / 08-07-2015 / 23:09:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 11-07-2015 / 12:55:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!LLVMFunction methodsFor:'initialization'!
initialize
super initialize.
self initializeArgumentsNames
"Created: / 11-07-2015 / 10:13:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
initializeArgumentsNames
1 to: self numArgs do:[:numArg |
(self parameterAt: numArg) name: 'arg', numArg printString
].
"Created: / 11-07-2015 / 10:13:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !