LLVMConstant.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 03 Aug 2015 18:08:14 +0100
changeset 16 23e82cf19788
child 50 dbda820d4d24
permissions -rw-r--r--
Tests refactored to be actually a testcase. Introduced LLVMConstant class as a factory for LLVM constant values (such as integer or string constants)
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
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    62
!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
    63
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    64
sint16:value 
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    65
    ^ 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
    66
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    67
    "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
    68
!
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    69
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    70
sint1:value 
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    71
    ^ 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
    72
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    73
    "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
    74
!
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    75
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    76
sint32:value 
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    77
    ^ 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
    78
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    79
    "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
    80
!
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    81
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    82
sint64:value 
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    83
    ^ 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
    84
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    85
    "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
    86
!
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    87
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    88
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
    89
    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
    90
    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
    91
    ^ 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
    92
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    93
    "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
    94
    "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
    95
!
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    96
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    97
sintptr:value 
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    98
    ^ 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
    99
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   100
    "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
   101
! !
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   102
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   103
!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
   104
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   105
uint16:value 
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   106
    ^ 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
   107
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   108
    "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
   109
!
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   110
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   111
uint1:value 
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   112
    ^ 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
   113
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   114
    "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
   115
!
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   116
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   117
uint32:value 
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   118
    ^ 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
   119
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   120
    "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
   121
!
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   122
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   123
uint64:value 
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   124
    ^ 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
   125
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   126
    "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
   127
!
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   128
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   129
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
   130
    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
   131
    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
   132
    ^ LLVM 
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   133
        ConstInt:type
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   134
        _:value
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   135
        _:0
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   136
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   137
    "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
   138
!
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   139
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   140
uintptr:value 
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   141
    ^ 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
   142
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   143
    "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
   144
! !
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   145
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   146
!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
   147
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   148
string:aString 
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   149
    ^ 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
   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 / 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
   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
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
   155
    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
   156
    ^ LLVM 
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   157
        ConstString:aString
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   158
        _:aString size
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   159
        _:((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
   160
             "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
   161
! !
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   162