LLVMConstant.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 27 Jan 2016 14:20:58 +0000
changeset 54 a288aced3dd1
parent 50 dbda820d4d24
child 55 41b3437f1fc7
permissions -rw-r--r--
LLVM C API Extensions: Fixed DIBuilerCreateFunction() and DIBuilderCreateSubroutineType() for LLVM 3.9 In LLVM 3.9 some parameters to these functions were dropped. The DIBuilder interface has been changed to reflect these changes (i.e., C functions no longer require dropped argument). The LLVM C Extensions library can still be compiled against LLVM 3.8 (via #ifdef), but the API will be different. Also, the Smalltallks bindings will make use of LLVM 3.9 interface. That said, LLVM C API Extensions library may still be used by *other* projects on top of LLVM 3.8, though Smalltalk bindings require LLVM 3.9 from now on.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
16
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     1
"
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     2
    Copyright (C) 2015-now Jan Vrany
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     3
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     4
    This code is not an open-source (yet). You may use this code
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     5
    for your own experiments and projects, given that:
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     6
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     7
    * all modification to the code will be sent to the
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     8
      original author for inclusion in future releases
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     9
    * this is not used in any commercial software
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    10
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    11
    This license is provisional and may (will) change in
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    12
    a future.
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    13
"
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    14
"{ Package: 'jv:llvm_s' }"
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    15
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    16
"{ NameSpace: Smalltalk }"
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    17
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    18
Object subclass:#LLVMConstant
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    19
	instanceVariableNames:''
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    20
	classVariableNames:''
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    21
	poolDictionaries:''
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    22
	category:'LLVM-S-Core'
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    23
!
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    24
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    25
!LLVMConstant class methodsFor:'documentation'!
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    26
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    27
copyright
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    28
"
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    29
    Copyright (C) 2015-now Jan Vrany
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    30
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    31
    This code is not an open-source (yet). You may use this code
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    32
    for your own experiments and projects, given that:
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    33
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    34
    * all modification to the code will be sent to the
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    35
      original author for inclusion in future releases
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    36
    * this is not used in any commercial software
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    37
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    38
    This license is provisional and may (will) change in
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    39
    a future.
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    40
"
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    41
!
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    42
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    43
documentation
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    44
"
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    45
    A simple factory for creating constant values.
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    46
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    47
    LLVMConstant sint16: 10.
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    48
    LLVMConstant string: 'Hello World!!'.
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    49
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    50
    [author:]
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    51
        Jan Vrany <jan.vrany@fit.cvut.cz>
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    52
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    53
    [instance variables:]
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    54
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    55
    [class variables:]
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    56
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    57
    [see also:]
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    58
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    59
"
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    60
! !
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    61
50
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    62
!LLVMConstant class methodsFor:'assertions'!
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    63
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    64
assertIsType: type
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    65
    <resource: #skipInDebuggersWalkBack>
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    66
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    67
    self assert: type isLLVMType message: 'value is not an LLVMType'.
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    68
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    69
    "Created: / 10-08-2015 / 06:26:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    70
    "Modified: / 14-09-2015 / 11:09:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    71
    "Modified (format): / 17-09-2015 / 16:51:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    72
!
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    73
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    74
assertIsValue: value
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    75
    <resource: #skipInDebuggersWalkBack>
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    76
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    77
    self assert: value isLLVMValue message: 'value is not an LLVMValue'.
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    78
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    79
    "Created: / 08-08-2015 / 03:11:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    80
    "Modified: / 14-09-2015 / 11:09:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    81
!
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    82
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    83
assertIsValue: value ofKind: kind
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    84
    <resource: #skipInDebuggersWalkBack>
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    85
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    86
    self assert: value isLLVMValue message: 'value is not an LLVMValue'.
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    87
    self assert: value type kind = kind message: 'value has incorrect kind'
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    88
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    89
    "Created: / 10-08-2015 / 17:40:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    90
    "Modified: / 14-09-2015 / 11:09:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    91
!
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    92
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    93
assertIsValue: value ofType: type
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    94
    <resource: #skipInDebuggersWalkBack>
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    95
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    96
    self assert: value isLLVMValue message: 'value is not an LLVMValue'.
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    97
    self assert: value type = type message: 'value has incorrect type'
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    98
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    99
    "Created: / 08-08-2015 / 02:49:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   100
    "Modified: / 14-09-2015 / 11:09:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   101
! !
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   102
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   103
!LLVMConstant class methodsFor:'constants - construction'!
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   104
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   105
bitcast: value to: type
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   106
    self assertIsValue: value.
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   107
    self assertIsType: type.
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   108
    ^ LLVM ConstBitCast: value _: type.
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   109
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   110
    "Created: / 12-10-2015 / 16:11:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   111
! !
dbda820d4d24 Support for creating recursive structures.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   112
16
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   113
!LLVMConstant class methodsFor:'constants - int - signed'!
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   114
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   115
sint16:value 
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   116
    ^ self sint:value type:LLVMType int16
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   117
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   118
    "Created: / 11-07-2015 / 16:43:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   119
!
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   120
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   121
sint1:value 
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   122
    ^ self sint:value type:LLVMType int1
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   123
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   124
    "Created: / 11-07-2015 / 16:44:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   125
!
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   126
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   127
sint32:value 
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   128
    ^ self sint:value type:LLVMType int32
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   129
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   130
    "Created: / 03-08-2015 / 15:59:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   131
!
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   132
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   133
sint64:value 
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   134
    ^ self sint:value type:LLVMType int64
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   135
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   136
    "Created: / 03-08-2015 / 15:59:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   137
!
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   138
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   139
sint:value type:type 
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   140
    self assert:type isIntegerType.
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   141
    self assert:value isInteger.
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   142
    ^ LLVM ConstInt:type _:value _:1
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   143
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   144
    "Created: / 11-07-2015 / 16:41:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   145
    "Modified (format): / 03-08-2015 / 17:08:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   146
!
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   147
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   148
sintptr:value 
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   149
    ^ self sint:value type:LLVMType intptr
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   150
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   151
    "Created: / 03-08-2015 / 15:59:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   152
! !
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   153
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   154
!LLVMConstant class methodsFor:'constants - int - unsigned'!
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   155
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   156
uint16:value 
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   157
    ^ self uint:value type:LLVMType int16
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   158
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   159
    "Created: / 03-08-2015 / 16:00:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   160
!
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   161
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   162
uint1:value 
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   163
    ^ self uint:value type:LLVMType int1
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   164
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   165
    "Created: / 03-08-2015 / 16:01:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   166
!
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   167
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   168
uint32:value 
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   169
    ^ self uint:value type:LLVMType int32
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   170
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   171
    "Created: / 03-08-2015 / 16:01:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   172
!
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   173
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   174
uint64:value 
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   175
    ^ self uint:value type:LLVMType int64
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   176
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   177
    "Created: / 03-08-2015 / 16:01:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   178
!
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   179
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   180
uint:value type:type 
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   181
    self assert:type isIntegerType.
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   182
    self assert:value isInteger.
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   183
    ^ LLVM 
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   184
        ConstInt:type
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   185
        _:value
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   186
        _:0
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   187
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   188
    "Created: / 11-07-2015 / 16:41:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   189
!
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   190
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   191
uintptr:value 
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   192
    ^ self uint:value type:LLVMType intptr
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   193
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   194
    "Created: / 03-08-2015 / 16:01:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   195
! !
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   196
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   197
!LLVMConstant class methodsFor:'constants - strings'!
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   198
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   199
string:aString 
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   200
    ^ self string:aString nullTerminate:true
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   201
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   202
    "Created: / 03-08-2015 / 16:18:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   203
!
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   204
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   205
string:aString nullTerminate:nullTerminate 
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   206
    self assert:aString isSingleByteString.
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   207
    ^ LLVM 
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   208
        ConstString:aString
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   209
        _:aString size
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   210
        _:((nullTerminate == true) ifTrue:[ 1 ] ifFalse:[ 0 ])
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   211
             "Created: / 03-08-2015 / 16:17:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   212
! !
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   213