extensions.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Fri, 05 Aug 2016 17:12:05 +0100
changeset 72 2c876bd46960
parent 61 c2e287d54de5
permissions -rw-r--r--
Added builder support for zext, sext and trunc IR instructions

"{ Package: 'jv:llvm_s' }"!

!Object methodsFor:'converting'!

asLLVMBasicBlock
    "Return representation of the receiver as LLVMBasicBlock"

    "Raise an error - arbitrary object cannot be represented
     as LLVM value"
    self error: 'cannot be converted to an LLVM basic block'

    "Created: / 21-04-2016 / 22:11:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!Object methodsFor:'converting'!

asLLVMMetadata
    "Return representation of the receiver as LLVMMetadata."

    "Raise an error - arbitrary object cannot be represented
     as LLVM metadata"
    self error: 'cannot be converted to an LLVM metadata'

    "Created: / 15-08-2015 / 06:43:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!Object methodsFor:'converting'!

asLLVMValue
    "Return representation of the receiver as LLVMValue."

    "Raise an error - arbitrary object cannot be represented
     as LLVM value"
    self error: 'cannot be converted to an LLVM value'

    "Created: / 08-08-2015 / 02:11:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!Object methodsFor:'converting'!

asLLVMValueOfType: anLLVMType
    "Return representation of the receiver as LLVMValue with given LLVMType. 
     If the object cannot be converted to the balue of requested type, 
     raise an error."

    self error: 'cannot be converted to an LLVM value'

    "Created: / 08-08-2015 / 02:27:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!Object methodsFor:'testing'!

isLLVMFunction
    "Return true, if receiver represents an LLVM value representing a function"

    ^ false

    "Created: / 10-08-2015 / 19:01:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!Object methodsFor:'testing'!

isLLVMType
    "Return true, if receiver represents an LLVM type"

    ^ false

    "Created: / 08-08-2015 / 02:45:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!Object methodsFor:'testing'!

isLLVMValue
    "Return true, if receiver represents an LLVM value"

    ^ false

    "Created: / 08-08-2015 / 02:21:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!SequenceableCollection methodsFor:'converting'!

asLLVMObjectArray
    | array size | 

    size := self size.
    size == 0 ifTrue:[ 
        ^ nil
    ].
    array := LLVMObjectArray new: size.
    array replaceFrom: 1 count: size with: self.
    ^array

    "Created: / 08-07-2015 / 22:58:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    "Modified: / 03-08-2015 / 17:04:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!jv_llvm_s class methodsFor:'documentation'!

extensionsVersion_HG

    ^ '$Changeset: <not expanded> $'
! !