Added README, licenses and copyright notices.
"
Copyright (c) 2012-2016 Igor Stasenko
Martin McClure
Damien Pollet
Camillo Bruni
Guido Chari
2016-now Jan Vrany <jan.vrany [at] fit . cvut . cz>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the 'Software'), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"
"{ Package: 'jv:dragonfly/asm' }"
"{ NameSpace: Smalltalk }"
Object subclass:#AJOperand
instanceVariableNames:'data compilerData operandId x64padding annotation'
classVariableNames:''
poolDictionaries:'AJConstants'
category:'AsmJit-Operands'
!
AJOperand comment:'I am a generic operand used in the ASMJit assembler.
I define the interface for setting the final instruction code and annotations.'
!
!AJOperand class methodsFor:'documentation'!
copyright
"
Copyright (c) 2012-2016 Igor Stasenko
Martin McClure
Damien Pollet
Camillo Bruni
Guido Chari
2016-now Jan Vrany <jan.vrany [at] fit . cvut . cz>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the 'Software'), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
"
! !
!AJOperand methodsFor:'accessing'!
annotation
^ annotation
!
annotation: anObject
annotation := anObject
!
clearId
operandId := 0.
!
compilerData
^ compilerData
!
operandId
^ operandId
!
size
"Return size of operand in bytes."
self shouldBeImplemented
!
size16
^ self size: 2
!
size32
^ self size: 4
!
size64
^ self size: 8
!
size8
^ self size: 1
!
stackSize
^ self size
! !
!AJOperand methodsFor:'code generation'!
emitPushOnStack: asm
asm push: self
! !
!AJOperand methodsFor:'converting'!
asAJOperand
"receiver is already an operand. no nothing"
!
ptr
"turn receiver into a memory operand "
self subclassResponsibility
!
ptr16
"turn receiver into a memory operand with receiver as base,
with 2 bytes size"
^ self ptr size: 2
!
ptr32
"turn receiver into a memory operand with receiver as base,
with 4 bytes size"
^ self ptr size: 4
!
ptr64
"turn receiver into a memory operand with receiver as base,
with 8 bytes size"
^ self ptr size: 8
!
ptr8
"turn receiver into a memory operand with receiver as base,
with 1 byte size"
^ self ptr size: 1
! !
!AJOperand methodsFor:'labels'!
extractLabels: aBlockClosure
" do nothing"
! !
!AJOperand methodsFor:'printing'!
printAnnotationOn: aStream
annotation ifNil: [ ^ self ].
aStream
nextPut: $" ;
nextPutAll: annotation asString;
nextPut: $"; space.
!
printAsOperandOn: aStream
self printAnnotationOn: aStream.
^ self printOn: aStream
! !
!AJOperand methodsFor:'testing'!
hasUpperBankIndex
"True iff I have an index register, and it is one of r8-r15"
^ false "Only can be true for memory references."
!
is16
^ self size == 2
!
is32
^ self size == 4
!
is64
^ self size == 8
!
is8
^ self size == 1
!
isImm
^ false
!
isLabel
^ false
!
isMem
^ false
!
isNone
"Return true if operand is none (OP_NONE)."
self shouldBeImplemented
!
isReg
^ false
!
isRegCode: aRegCode
self shouldBeImplemented
!
isRegIndex: aRegIndex
^ self isReg and: [ self index == (aRegIndex bitAnd: RegCodeMask ) ]
!
isRegMem
^ self isReg or: [ self isMem ]
!
isRegMem: aRegType
self shouldBeImplemented
!
isRegType: aRegType
^ self isReg and: [self type == aRegType]
!
isRegTypeGPB
^ self isRegType: RegGPB
!
isRegTypeGPD
^ self isRegType: RegGPD
!
isRegTypeGPQ
^ self isRegType: RegGPQ
!
isRegTypeGPW
^ self isRegType: RegGPW
!
isRegTypeMM
^ false
!
isRegTypeX87
^ false
!
isRegTypeXMM
^ false
!
isRip
^ false
!
prohibitsRex
"Answer true if use of this operand requires that the instruction *not* have a REX prefix."
self subclassResponsibility
!
requiresRex
"Answer true if use of this operand requires that the instruction have a REX prefix."
self subclassResponsibility
! !