Fixed LLVMExamples>>example7_factorial_with_debug_info
Pass DIFile instead of DICompileUnit to #createTypeFunctionIn:parameterTypes:
Fixed #createParameterVariable: - parameters are numbered starting with 1.
"
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:#LLVMValue
instanceVariableNames:'type'
classVariableNames:''
poolDictionaries:''
category:'LLVM-S-Core'
!
!LLVMValue 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.
"
! !
!LLVMValue methodsFor:'accessing'!
name
^ LLVM GetValueName: self
"Created: / 11-07-2015 / 07:28:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
name: aString
^ LLVM SetValueName: self _: aString
"Created: / 11-07-2015 / 07:31:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
type
type isNil ifTrue:[
type := LLVM TypeOf: self.
].
^ type
"Created: / 11-07-2015 / 14:53:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!LLVMValue methodsFor:'converting'!
asBasicBlock
"Return the underlying basic block if the value represents
a basic block. Otherwise raise an error"
self isBasicBlockValue ifFalse:[
self error: 'Not a basic block value'.
].
^ LLVM ValueAsBasicBlock: self
"Created: / 08-08-2015 / 02:16:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
asLLVMMetadata
^ LLVMCEXT ValueAsMetadata: self
"Created: / 15-08-2015 / 06:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
asLLVMValue
^ self
"Created: / 08-08-2015 / 02:28:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!LLVMValue methodsFor:'debugging'!
inspectorExtraAttributes
| d |
d := super inspectorExtraAttributes.
d add: '-dump' -> [ self dumpString ].
^ d
"Created: / 10-07-2015 / 14:36:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!LLVMValue methodsFor:'debugging-dumping'!
dumpOn: aStream
aStream nextPutAll: self dumpString
"Created: / 10-07-2015 / 14:32:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
dumpString
| cstr str|
cstr := LLVM PrintValueToString: self.
str := cstr copyCStringFromHeap.
LLVM DisposeMessage: cstr.
^ str
"Created: / 10-07-2015 / 14:31:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
printOn: aStream
| name |
super printOn: aStream.
aStream nextPut: $(.
name := self name.
name notEmptyOrNil ifTrue:[
aStream nextPutAll: name
] ifFalse:[
aStream nextPutAll: '<anon>'
].
aStream space.
aStream nextPutAll: self type dumpString.
aStream nextPut: $)
"Created: / 11-07-2015 / 07:09:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 08-08-2015 / 04:22:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!LLVMValue methodsFor:'testing'!
isBasicBlockValue
"Return true, if receiver represent a LLVMBasicBlock, i.e.,
if it can be used in branch instructions as target"
^ LLVM ValueIsBasicBlock:self
"Created: / 08-08-2015 / 02:14:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
isConstantValue
^ LLVM IsConstant: self
"Created: / 08-08-2015 / 02:43:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
isIntegerOrIntegerVectorValue
^ self type isIntegerType or:[ self type isVectorType ]
"Created: / 11-07-2015 / 14:55:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 07-08-2015 / 18:34:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
isIntegerValue
^ self type isIntegerType
"Created: / 11-07-2015 / 14:55:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
"Modified: / 03-08-2015 / 16:38:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
isLLVMValue
^ true
"Created: / 08-08-2015 / 03:28:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!LLVMValue class methodsFor:'documentation'!
version_HG
^ '$Changeset: <not expanded> $'
! !