llvm_c_ext: Improved `LLVMSetMetadata2()` to support also function values
...in addition to instruction values. This is handy to attach data to functions,
such as debugging information. Added Smalltalk API for setting metadata nodes
on instructions and functions.
"
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 }"
LLVMObject subclass:#LLVMBasicBlock
instanceVariableNames:'function'
classVariableNames:''
poolDictionaries:''
category:'LLVM-S-Core'
!
!LLVMBasicBlock 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.
"
! !
!LLVMBasicBlock methodsFor:'accessing'!
builder
"Return a builder positioned at the end of the receiver"
| builder |
builder := LLVMIRBuilder new.
builder positionAtEnd:self.
^ builder
"Created: / 08-08-2015 / 03:25:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
function
^ function
"Created: / 08-08-2015 / 03:22:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
lastInstruction
^ LLVM GetLastInstruction: self.
"Created: / 20-04-2016 / 22:02:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!LLVMBasicBlock methodsFor:'converting'!
asLLVMValue
"Return representation of the receiver as LLVMValue"
^ LLVM BasicBlockAsValue: self
"Created: / 08-08-2015 / 02:11:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
asLLVMasicBlock
^ self.
"Created: / 21-04-2016 / 22:11:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!LLVMBasicBlock methodsFor:'initialization'!
function:anLLVMFunction
function := anLLVMFunction.
"Created: / 08-08-2015 / 03:22:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!LLVMBasicBlock methodsFor:'testing'!
isLLVMBasicBlock
^ true
"Created: / 21-04-2016 / 22:29:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
isTerminated
"Return true if this block is terminated, i.e, if it's
last instruction is a terminator. False otherwise or if
block has no instruction at all"
| last |
last := self lastInstruction.
last notNil ifTrue:[ ^ last isTerminatorInst ].
^ false
"Created: / 22-04-2016 / 10:14:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !