LLVMValue.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Thu, 17 Sep 2015 17:17:56 +0100
changeset 42 23ae490859cd
parent 33 feabf14b6c1d
child 43 597181c496f0
permissions -rw-r--r--
Fixed LLVMExamples>>example7_factorial_with_debug_info Pass DIFile instead of DICompileUnit to #createTypeFunctionIn:parameterTypes: Fixed #createParameterVariable: - parameters are numbered starting with 1.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14
c7dea3fcc5a7 Added short README, license.txt and updated copyright information
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13
diff changeset
     1
"
c7dea3fcc5a7 Added short README, license.txt and updated copyright information
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13
diff changeset
     2
    Copyright (C) 2015-now Jan Vrany
c7dea3fcc5a7 Added short README, license.txt and updated copyright information
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13
diff changeset
     3
c7dea3fcc5a7 Added short README, license.txt and updated copyright information
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13
diff changeset
     4
    This code is not an open-source (yet). You may use this code
c7dea3fcc5a7 Added short README, license.txt and updated copyright information
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13
diff changeset
     5
    for your own experiments and projects, given that:
c7dea3fcc5a7 Added short README, license.txt and updated copyright information
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13
diff changeset
     6
c7dea3fcc5a7 Added short README, license.txt and updated copyright information
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13
diff changeset
     7
    * all modification to the code will be sent to the
c7dea3fcc5a7 Added short README, license.txt and updated copyright information
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13
diff changeset
     8
      original author for inclusion in future releases
c7dea3fcc5a7 Added short README, license.txt and updated copyright information
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13
diff changeset
     9
    * this is not used in any commercial software
c7dea3fcc5a7 Added short README, license.txt and updated copyright information
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13
diff changeset
    10
c7dea3fcc5a7 Added short README, license.txt and updated copyright information
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13
diff changeset
    11
    This license is provisional and may (will) change in
c7dea3fcc5a7 Added short README, license.txt and updated copyright information
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13
diff changeset
    12
    a future.
c7dea3fcc5a7 Added short README, license.txt and updated copyright information
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13
diff changeset
    13
"
12
f98e97fd02ef Package renamed from jv:libllvms to jv:llvm_s
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 5
diff changeset
    14
"{ Package: 'jv:llvm_s' }"
0
38af781b75ab First shot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    15
38af781b75ab First shot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    16
"{ NameSpace: Smalltalk }"
38af781b75ab First shot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    17
1
e3dcb6272f0b Introduced abstract superclasses LLVMObject and LLVMDisposableObject
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 0
diff changeset
    18
LLVMObject subclass:#LLVMValue
5
3ac0c9381634 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    19
	instanceVariableNames:'type'
0
38af781b75ab First shot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    20
	classVariableNames:''
38af781b75ab First shot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    21
	poolDictionaries:''
13
fa967c0e1827 Renamed class categories to begin with LLVM-S
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 12
diff changeset
    22
	category:'LLVM-S-Core'
0
38af781b75ab First shot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    23
!
38af781b75ab First shot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    24
14
c7dea3fcc5a7 Added short README, license.txt and updated copyright information
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13
diff changeset
    25
!LLVMValue class methodsFor:'documentation'!
c7dea3fcc5a7 Added short README, license.txt and updated copyright information
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13
diff changeset
    26
c7dea3fcc5a7 Added short README, license.txt and updated copyright information
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13
diff changeset
    27
copyright
c7dea3fcc5a7 Added short README, license.txt and updated copyright information
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13
diff changeset
    28
"
c7dea3fcc5a7 Added short README, license.txt and updated copyright information
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13
diff changeset
    29
    Copyright (C) 2015-now Jan Vrany
c7dea3fcc5a7 Added short README, license.txt and updated copyright information
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13
diff changeset
    30
c7dea3fcc5a7 Added short README, license.txt and updated copyright information
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13
diff changeset
    31
    This code is not an open-source (yet). You may use this code
c7dea3fcc5a7 Added short README, license.txt and updated copyright information
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13
diff changeset
    32
    for your own experiments and projects, given that:
c7dea3fcc5a7 Added short README, license.txt and updated copyright information
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13
diff changeset
    33
c7dea3fcc5a7 Added short README, license.txt and updated copyright information
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13
diff changeset
    34
    * all modification to the code will be sent to the
c7dea3fcc5a7 Added short README, license.txt and updated copyright information
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13
diff changeset
    35
      original author for inclusion in future releases
c7dea3fcc5a7 Added short README, license.txt and updated copyright information
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13
diff changeset
    36
    * this is not used in any commercial software
c7dea3fcc5a7 Added short README, license.txt and updated copyright information
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13
diff changeset
    37
c7dea3fcc5a7 Added short README, license.txt and updated copyright information
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13
diff changeset
    38
    This license is provisional and may (will) change in
c7dea3fcc5a7 Added short README, license.txt and updated copyright information
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13
diff changeset
    39
    a future.
c7dea3fcc5a7 Added short README, license.txt and updated copyright information
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13
diff changeset
    40
"
c7dea3fcc5a7 Added short README, license.txt and updated copyright information
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13
diff changeset
    41
! !
c7dea3fcc5a7 Added short README, license.txt and updated copyright information
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 13
diff changeset
    42
4
d33c64726c86 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
    43
!LLVMValue methodsFor:'accessing'!
d33c64726c86 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
    44
d33c64726c86 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
    45
name
d33c64726c86 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
    46
    ^ LLVM GetValueName: self
d33c64726c86 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
    47
d33c64726c86 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
    48
    "Created: / 11-07-2015 / 07:28:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
d33c64726c86 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
    49
!
d33c64726c86 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
    50
d33c64726c86 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
    51
name: aString
d33c64726c86 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
    52
    ^ LLVM SetValueName: self  _: aString
d33c64726c86 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
    53
d33c64726c86 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
    54
    "Created: / 11-07-2015 / 07:31:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
5
3ac0c9381634 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    55
!
3ac0c9381634 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    56
3ac0c9381634 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    57
type
3ac0c9381634 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    58
    type isNil ifTrue:[ 
3ac0c9381634 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    59
        type := LLVM TypeOf: self.  
3ac0c9381634 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    60
    ].
3ac0c9381634 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    61
    ^ type
3ac0c9381634 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    62
3ac0c9381634 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
    63
    "Created: / 11-07-2015 / 14:53:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
4
d33c64726c86 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
    64
! !
d33c64726c86 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
    65
22
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    66
!LLVMValue methodsFor:'converting'!
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    67
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    68
asBasicBlock
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    69
    "Return the underlying basic block if the value represents
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    70
     a basic block. Otherwise raise an error"
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    71
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    72
    self isBasicBlockValue ifFalse:[ 
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    73
        self error: 'Not a basic block value'.
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    74
    ].
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    75
    ^ LLVM ValueAsBasicBlock: self
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    76
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    77
    "Created: / 08-08-2015 / 02:16:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    78
!
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    79
33
feabf14b6c1d Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23
diff changeset
    80
asLLVMMetadata
feabf14b6c1d Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23
diff changeset
    81
    ^ LLVMCEXT ValueAsMetadata: self
feabf14b6c1d Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23
diff changeset
    82
feabf14b6c1d Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23
diff changeset
    83
    "Created: / 15-08-2015 / 06:41:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
feabf14b6c1d Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23
diff changeset
    84
!
feabf14b6c1d Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 23
diff changeset
    85
22
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    86
asLLVMValue
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    87
    ^ self
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    88
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    89
    "Created: / 08-08-2015 / 02:28:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    90
! !
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
    91
0
38af781b75ab First shot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    92
!LLVMValue methodsFor:'debugging'!
38af781b75ab First shot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    93
2
53abac7217de Added support for creating execution engines and fetching function addresses.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1
diff changeset
    94
inspectorExtraAttributes 
53abac7217de Added support for creating execution engines and fetching function addresses.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1
diff changeset
    95
    | d |
53abac7217de Added support for creating execution engines and fetching function addresses.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1
diff changeset
    96
53abac7217de Added support for creating execution engines and fetching function addresses.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1
diff changeset
    97
    d := super inspectorExtraAttributes.      
53abac7217de Added support for creating execution engines and fetching function addresses.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1
diff changeset
    98
    d add: '-dump' -> [ self dumpString ].
53abac7217de Added support for creating execution engines and fetching function addresses.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1
diff changeset
    99
    ^ d
53abac7217de Added support for creating execution engines and fetching function addresses.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1
diff changeset
   100
53abac7217de Added support for creating execution engines and fetching function addresses.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1
diff changeset
   101
    "Created: / 10-07-2015 / 14:36:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
53abac7217de Added support for creating execution engines and fetching function addresses.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1
diff changeset
   102
! !
53abac7217de Added support for creating execution engines and fetching function addresses.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1
diff changeset
   103
53abac7217de Added support for creating execution engines and fetching function addresses.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1
diff changeset
   104
!LLVMValue methodsFor:'debugging-dumping'!
0
38af781b75ab First shot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   105
2
53abac7217de Added support for creating execution engines and fetching function addresses.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1
diff changeset
   106
dumpOn: aStream
53abac7217de Added support for creating execution engines and fetching function addresses.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1
diff changeset
   107
    aStream nextPutAll: self dumpString
53abac7217de Added support for creating execution engines and fetching function addresses.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1
diff changeset
   108
53abac7217de Added support for creating execution engines and fetching function addresses.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1
diff changeset
   109
    "Created: / 10-07-2015 / 14:32:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
53abac7217de Added support for creating execution engines and fetching function addresses.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1
diff changeset
   110
!
53abac7217de Added support for creating execution engines and fetching function addresses.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1
diff changeset
   111
53abac7217de Added support for creating execution engines and fetching function addresses.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1
diff changeset
   112
dumpString
53abac7217de Added support for creating execution engines and fetching function addresses.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1
diff changeset
   113
    | cstr str|
53abac7217de Added support for creating execution engines and fetching function addresses.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1
diff changeset
   114
53abac7217de Added support for creating execution engines and fetching function addresses.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1
diff changeset
   115
    cstr := LLVM PrintValueToString: self.
53abac7217de Added support for creating execution engines and fetching function addresses.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1
diff changeset
   116
    str := cstr copyCStringFromHeap.
53abac7217de Added support for creating execution engines and fetching function addresses.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1
diff changeset
   117
    LLVM DisposeMessage: cstr.
53abac7217de Added support for creating execution engines and fetching function addresses.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1
diff changeset
   118
    ^ str
53abac7217de Added support for creating execution engines and fetching function addresses.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1
diff changeset
   119
53abac7217de Added support for creating execution engines and fetching function addresses.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 1
diff changeset
   120
    "Created: / 10-07-2015 / 14:31:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
4
d33c64726c86 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
   121
!
0
38af781b75ab First shot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   122
4
d33c64726c86 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
   123
printOn: aStream
22
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   124
    | name |
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   125
4
d33c64726c86 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
   126
    super printOn: aStream.
22
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   127
    aStream nextPut: $(.
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   128
    name := self name.
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   129
    name notEmptyOrNil ifTrue:[ 
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   130
        aStream nextPutAll: name
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   131
    ] ifFalse:[ 
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   132
        aStream nextPutAll: '<anon>'
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   133
    ].
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   134
    aStream space.
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   135
    aStream nextPutAll: self type dumpString.
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   136
    aStream nextPut: $)
0
38af781b75ab First shot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   137
4
d33c64726c86 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2
diff changeset
   138
    "Created: / 11-07-2015 / 07:09:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
22
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   139
    "Modified: / 08-08-2015 / 04:22:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
0
38af781b75ab First shot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   140
! !
38af781b75ab First shot.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   141
5
3ac0c9381634 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   142
!LLVMValue methodsFor:'testing'!
3ac0c9381634 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   143
22
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   144
isBasicBlockValue
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   145
    "Return true, if receiver represent a LLVMBasicBlock, i.e.,
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   146
     if it can be used in branch instructions as target"
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   147
    
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   148
    ^ LLVM ValueIsBasicBlock:self
16
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 14
diff changeset
   149
22
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   150
    "Created: / 08-08-2015 / 02:14:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
16
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 14
diff changeset
   151
!
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 14
diff changeset
   152
22
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   153
isConstantValue
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   154
    ^ LLVM IsConstant: self
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   155
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   156
    "Created: / 08-08-2015 / 02:43:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   157
!
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   158
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   159
isIntegerOrIntegerVectorValue
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   160
    ^ self type isIntegerType or:[ self type isVectorType ]
5
3ac0c9381634 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   161
3ac0c9381634 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   162
    "Created: / 11-07-2015 / 14:55:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
22
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   163
    "Modified: / 07-08-2015 / 18:34:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
5
3ac0c9381634 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   164
!
3ac0c9381634 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   165
3ac0c9381634 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   166
isIntegerValue
16
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 14
diff changeset
   167
    ^ self type isIntegerType
5
3ac0c9381634 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   168
3ac0c9381634 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   169
    "Created: / 11-07-2015 / 14:55:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
16
23e82cf19788 Tests refactored to be actually a testcase. Introduced LLVMConstant class
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 14
diff changeset
   170
    "Modified: / 03-08-2015 / 16:38:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
22
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   171
!
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   172
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   173
isLLVMValue
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   174
    ^ true
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   175
789a35bd30ac Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16
diff changeset
   176
    "Created: / 08-08-2015 / 03:28:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
5
3ac0c9381634 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   177
! !
3ac0c9381634 Temporary commit
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4
diff changeset
   178
23
0744cd9c0acc Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 22
diff changeset
   179
!LLVMValue class methodsFor:'documentation'!
0744cd9c0acc Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 22
diff changeset
   180
0744cd9c0acc Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 22
diff changeset
   181
version_HG
0744cd9c0acc Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 22
diff changeset
   182
0744cd9c0acc Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 22
diff changeset
   183
    ^ '$Changeset: <not expanded> $'
0744cd9c0acc Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 22
diff changeset
   184
! !
0744cd9c0acc Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 22
diff changeset
   185