author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Thu, 17 Sep 2015 17:17:56 +0100 | |
changeset 42 | 23ae490859cd |
parent 38 | 52be9bfdf7e1 |
child 43 | 597181c496f0 |
permissions | -rw-r--r-- |
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:
9
diff
changeset
|
14 |
"{ Package: 'jv:llvm_s' }" |
0 | 15 |
|
16 |
"{ NameSpace: Smalltalk }" |
|
17 |
||
28
97013ae2abae
Renamed LLVMBuilder to LLVMIRBuilder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
24
diff
changeset
|
18 |
LLVMDisposableObject subclass:#LLVMIRBuilder |
38
52be9bfdf7e1
Added LLVMIRBuilder>>block returning current insertion block
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
33
diff
changeset
|
19 |
instanceVariableNames:'block' |
0 | 20 |
classVariableNames:'' |
23
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
21 |
poolDictionaries:'LLVMIntPredicate LLVMRealPredicate LLVMTypeKind' |
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 | 23 |
! |
24 |
||
28
97013ae2abae
Renamed LLVMBuilder to LLVMIRBuilder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
24
diff
changeset
|
25 |
!LLVMIRBuilder class methodsFor:'documentation'! |
14
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 |
! ! |
1
e3dcb6272f0b
Introduced abstract superclasses LLVMObject and LLVMDisposableObject
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
42 |
|
28
97013ae2abae
Renamed LLVMBuilder to LLVMIRBuilder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
24
diff
changeset
|
43 |
!LLVMIRBuilder class methodsFor:'instance creation'! |
0 | 44 |
|
45 |
new |
|
46 |
^ LLVM CreateBuilder |
|
47 |
||
48 |
"Created: / 07-07-2015 / 22:38:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
49 |
! ! |
|
50 |
||
28
97013ae2abae
Renamed LLVMBuilder to LLVMIRBuilder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
24
diff
changeset
|
51 |
!LLVMIRBuilder class methodsFor:'generators'! |
5 | 52 |
|
53 |
instructions |
|
54 |
^ #( |
|
55 |
add:to: (isIntegerOrVector isIntegerOrVector) |
|
56 |
lsrh:by: (isIntegerOrVector isIntegerOrVector) |
|
57 |
) |
|
58 |
||
59 |
"Created: / 11-07-2015 / 13:05:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
60 |
! ! |
|
61 |
||
28
97013ae2abae
Renamed LLVMBuilder to LLVMIRBuilder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
24
diff
changeset
|
62 |
!LLVMIRBuilder methodsFor:'accessing'! |
23
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
63 |
|
38
52be9bfdf7e1
Added LLVMIRBuilder>>block returning current insertion block
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
33
diff
changeset
|
64 |
block |
52be9bfdf7e1
Added LLVMIRBuilder>>block returning current insertion block
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
33
diff
changeset
|
65 |
"Returns the 'current' basic block as `anLLVMBasicBlock`" |
52be9bfdf7e1
Added LLVMIRBuilder>>block returning current insertion block
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
33
diff
changeset
|
66 |
|
52be9bfdf7e1
Added LLVMIRBuilder>>block returning current insertion block
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
33
diff
changeset
|
67 |
^ block |
52be9bfdf7e1
Added LLVMIRBuilder>>block returning current insertion block
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
33
diff
changeset
|
68 |
|
52be9bfdf7e1
Added LLVMIRBuilder>>block returning current insertion block
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
33
diff
changeset
|
69 |
"Created: / 15-09-2015 / 11:49:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
52be9bfdf7e1
Added LLVMIRBuilder>>block returning current insertion block
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
33
diff
changeset
|
70 |
"Modified: / 15-09-2015 / 18:16:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
52be9bfdf7e1
Added LLVMIRBuilder>>block returning current insertion block
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
33
diff
changeset
|
71 |
! |
52be9bfdf7e1
Added LLVMIRBuilder>>block returning current insertion block
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
33
diff
changeset
|
72 |
|
23
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
73 |
block: anLLVMBasicBlock |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
74 |
"Sets the 'current' basic block to `anLLVMBasicBlock` and |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
75 |
position to it's end so that instructions will be generated |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
76 |
at the end of the block." |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
77 |
|
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
78 |
^ self positionAtEnd: anLLVMBasicBlock |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
79 |
|
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
80 |
"Created: / 10-08-2015 / 09:03:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
33
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
81 |
! |
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
82 |
|
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
83 |
line: line column: column scope: scope |
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
84 |
"Sets the current location in original source (i.e., on source being |
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
85 |
translated to LLVM IR). This information is used generate debug information." |
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
86 |
|
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
87 |
^ self line: line column: column scope: scope inlinedAt: nil |
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
88 |
|
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
89 |
"Created: / 15-08-2015 / 21:26:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
90 |
! |
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
91 |
|
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
92 |
line: line column: column scope: scope inlinedAt: inlinedScope |
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
93 |
"Sets the current location in original source (i.e., on source being |
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
94 |
translated to LLVM IR). This information is used generate debug information." |
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
95 |
|
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
96 |
self assertIsIntegerUnsigned: line. |
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
97 |
self assertIsIntegerUnsigned: column. |
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
98 |
self assertIsMetadata: scope. |
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
99 |
inlinedScope notNil ifTrue:[ |
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
100 |
self assertIsMetadata: inlinedScope. |
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
101 |
]. |
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
102 |
|
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
103 |
LLVMCEXT SetCurrentDebugLocation2: self _: line _: column _: scope _: inlinedScope |
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
104 |
|
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
105 |
"Created: / 15-08-2015 / 21:26:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
106 |
! |
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
107 |
|
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
108 |
location |
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
109 |
"Return current location as LLVMMetadata." |
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
110 |
|
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
111 |
^ LLVMCEXT GetCurrentDebugLocation2: self |
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
112 |
|
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
113 |
"Created: / 15-08-2015 / 23:52:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
23
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
114 |
! ! |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
115 |
|
28
97013ae2abae
Renamed LLVMBuilder to LLVMIRBuilder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
24
diff
changeset
|
116 |
!LLVMIRBuilder methodsFor:'initialization & release'! |
0 | 117 |
|
1
e3dcb6272f0b
Introduced abstract superclasses LLVMObject and LLVMDisposableObject
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
118 |
dispose |
e3dcb6272f0b
Introduced abstract superclasses LLVMObject and LLVMDisposableObject
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
119 |
^ LLVM DisposeBuilder: self. |
0 | 120 |
|
1
e3dcb6272f0b
Introduced abstract superclasses LLVMObject and LLVMDisposableObject
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
121 |
"Modified (comment): / 08-07-2015 / 22:39:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
0 | 122 |
! ! |
123 |
||
28
97013ae2abae
Renamed LLVMBuilder to LLVMIRBuilder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
24
diff
changeset
|
124 |
!LLVMIRBuilder methodsFor:'instructions - aggregates'! |
24
7e7ddd55174c
Added support for intrinsics.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
125 |
|
7e7ddd55174c
Added support for intrinsics.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
126 |
extractvalue: value at: index |
7e7ddd55174c
Added support for intrinsics.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
127 |
^ self extractvalue: value at: index as: '' |
7e7ddd55174c
Added support for intrinsics.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
128 |
|
7e7ddd55174c
Added support for intrinsics.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
129 |
"Created: / 10-08-2015 / 17:38:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
7e7ddd55174c
Added support for intrinsics.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
130 |
! |
7e7ddd55174c
Added support for intrinsics.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
131 |
|
7e7ddd55174c
Added support for intrinsics.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
132 |
extractvalue: value at: index as: name |
7e7ddd55174c
Added support for intrinsics.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
133 |
|
7e7ddd55174c
Added support for intrinsics.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
134 |
|
7e7ddd55174c
Added support for intrinsics.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
135 |
self assertIsValue: value. |
7e7ddd55174c
Added support for intrinsics.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
136 |
self assert: ((value type kind == LLVMStructTypeKind) or:[ value type kind == LLVMArrayTypeKind ]) message: 'value is not a struct or an array'. |
7e7ddd55174c
Added support for intrinsics.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
137 |
self assert: index isInteger message: 'index is not an integer'. |
7e7ddd55174c
Added support for intrinsics.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
138 |
|
7e7ddd55174c
Added support for intrinsics.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
139 |
^ LLVM BuildExtractValue: self _: value _: index _: name. |
7e7ddd55174c
Added support for intrinsics.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
140 |
|
7e7ddd55174c
Added support for intrinsics.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
141 |
|
7e7ddd55174c
Added support for intrinsics.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
142 |
"Created: / 10-08-2015 / 17:39:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
7e7ddd55174c
Added support for intrinsics.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
143 |
! ! |
7e7ddd55174c
Added support for intrinsics.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
144 |
|
28
97013ae2abae
Renamed LLVMBuilder to LLVMIRBuilder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
24
diff
changeset
|
145 |
!LLVMIRBuilder methodsFor:'instructions - binary'! |
5 | 146 |
|
22
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
147 |
add:value1 _:value2 |
23
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
148 |
^ self add:value1 _:value2 as:'' |
0 | 149 |
|
5 | 150 |
"Created: / 07-07-2015 / 22:52:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
23
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
151 |
"Modified (format): / 10-08-2015 / 09:42:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5 | 152 |
! |
153 |
||
22
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
154 |
add:value1 _:value2 as:name |
23
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
155 |
self assertIsIntegerOrIntegerVectorValue: value1. |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
156 |
self assertIsIntegerOrIntegerVectorValue: value2. |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
157 |
self assertIsValueOfSameType: value1 as: value2. |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
158 |
self assertIsString: name. |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
159 |
|
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
160 |
^ LLVM BuildAdd:self _:value1 _:value2 _:name |
0 | 161 |
|
162 |
"Created: / 07-07-2015 / 22:52:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
23
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
163 |
"Modified: / 10-08-2015 / 09:41:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5 | 164 |
! |
165 |
||
22
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
166 |
and:value1 _:value2 |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
167 |
^ self and:value1 _:value2 as:'' |
5 | 168 |
|
22
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
169 |
"Created: / 07-08-2015 / 16:51:53 / 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:
19
diff
changeset
|
170 |
"Modified: / 07-08-2015 / 17:56:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5 | 171 |
! |
172 |
||
22
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
173 |
and:value1 _:value2 as: name |
5 | 174 |
self assert: (value1 isKindOf: LLVMValue). |
22
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
175 |
self assert: value1 isIntegerOrIntegerVectorValue. |
5 | 176 |
self assert: (value2 isKindOf: LLVMValue). |
22
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
177 |
self assert: value2 isIntegerOrIntegerVectorValue. |
5 | 178 |
self assert: (name isSingleByteString). |
179 |
^LLVM BuildAnd: self _: value1 _: value2 _: name |
|
180 |
||
22
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
181 |
"Created: / 07-08-2015 / 17:56:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5 | 182 |
! |
183 |
||
22
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
184 |
ashr:value1 _:value2 |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
185 |
^ self |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
186 |
ashr:value1 |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
187 |
_:value2 |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
188 |
as:'' |
5 | 189 |
|
190 |
"Created: / 11-07-2015 / 16:46:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
0 | 191 |
! |
192 |
||
22
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
193 |
ashr:value1 _:value2 as:name |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
194 |
self assert:(value1 isKindOf:LLVMValue). |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
195 |
self assert:value1 isIntegerOrIntegerVectorValue. |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
196 |
self assert:(value2 isKindOf:LLVMValue). |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
197 |
self assert:value2 isIntegerOrIntegerVectorValue. |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
198 |
self assert:(name isSingleByteString). |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
199 |
^ LLVM |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
200 |
BuildAShr:self |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
201 |
_:value1 |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
202 |
_:value2 |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
203 |
_:name |
5 | 204 |
|
205 |
"Created: / 11-07-2015 / 16:46:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
206 |
! |
|
207 |
||
22
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
208 |
lshr:value1 _:value2 |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
209 |
^ self |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
210 |
lshr:value1 |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
211 |
_:value2 |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
212 |
as:'' |
5 | 213 |
|
214 |
"Created: / 11-07-2015 / 13:02:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
215 |
! |
|
216 |
||
22
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
217 |
lshr:value1 _:value2 as:name |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
218 |
self assert:(value1 isKindOf:LLVMValue). |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
219 |
self assert:value1 isIntegerOrIntegerVectorValue. |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
220 |
self assert:(value2 isKindOf:LLVMValue). |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
221 |
self assert:value2 isIntegerOrIntegerVectorValue. |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
222 |
self assert:(name isSingleByteString). |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
223 |
^ LLVM |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
224 |
BuildLShr:self |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
225 |
_:value1 |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
226 |
_:value2 |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
227 |
_:name |
5 | 228 |
|
229 |
"Created: / 11-07-2015 / 14:49:13 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
230 |
! |
|
231 |
||
23
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
232 |
mul:value1 _:value2 |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
233 |
^ self mul:value1 _:value2 as:'' |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
234 |
|
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
235 |
"Created: / 10-08-2015 / 09:42:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
236 |
! |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
237 |
|
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
238 |
mul:value1 _:value2 as:name |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
239 |
self assertIsIntegerOrIntegerVectorValue: value1. |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
240 |
self assertIsIntegerOrIntegerVectorValue: value2. |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
241 |
self assertIsValueOfSameType: value1 as: value2. |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
242 |
self assertIsString: name. |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
243 |
|
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
244 |
^ LLVM BuildMul:self _:value1 _:value2 _:name |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
245 |
|
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
246 |
"Created: / 10-08-2015 / 09:41:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
247 |
! |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
248 |
|
22
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
249 |
or:value1 _:value2 |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
250 |
^ self |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
251 |
or:value1 |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
252 |
_:value2 |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
253 |
as:'' |
6 | 254 |
|
255 |
"Created: / 11-07-2015 / 17:17:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
256 |
! |
|
257 |
||
22
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
258 |
or:value1 _:value2 as:name |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
259 |
self assert:(value1 isKindOf:LLVMValue). |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
260 |
self assert:value1 isIntegerOrIntegerVectorValue. |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
261 |
self assert:(value2 isKindOf:LLVMValue). |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
262 |
self assert:value2 isIntegerOrIntegerVectorValue. |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
263 |
self assert:(name isSingleByteString). |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
264 |
^ LLVM |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
265 |
BuildOr:self |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
266 |
_:value1 |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
267 |
_:value2 |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
268 |
_:name |
6 | 269 |
|
270 |
"Created: / 11-07-2015 / 17:16:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
271 |
! |
|
272 |
||
22
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
273 |
shl:value1 _:value2 |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
274 |
^ self shl:value1 _:value2 as:'' |
5 | 275 |
|
276 |
"Created: / 11-07-2015 / 16:37:17 / 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:
19
diff
changeset
|
277 |
"Modified (format): / 07-08-2015 / 17:58:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5 | 278 |
! |
0 | 279 |
|
22
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
280 |
shl:value1 _:value2 as:name |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
281 |
self assert:(value1 isKindOf:LLVMValue). |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
282 |
self assert:value1 isIntegerOrIntegerVectorValue. |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
283 |
self assert:(value2 isKindOf:LLVMValue). |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
284 |
self assert:value2 isIntegerOrIntegerVectorValue. |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
285 |
self assert:(name isSingleByteString). |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
286 |
^ LLVM |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
287 |
BuildShl:self |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
288 |
_:value1 |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
289 |
_:value2 |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
290 |
_:name |
5 | 291 |
|
292 |
"Created: / 11-07-2015 / 16:37:05 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
23
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
293 |
! |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
294 |
|
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
295 |
sub:value1 _:value2 |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
296 |
^ self sub:value1 _:value2 as:'' |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
297 |
|
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
298 |
"Created: / 10-08-2015 / 09:42:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
299 |
! |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
300 |
|
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
301 |
sub:value1 _:value2 as:name |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
302 |
self assertIsIntegerOrIntegerVectorValue: value1. |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
303 |
self assertIsIntegerOrIntegerVectorValue: value2. |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
304 |
self assertIsValueOfSameType: value1 as: value2. |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
305 |
self assertIsString: name. |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
306 |
|
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
307 |
^ LLVM BuildSub:self _:value1 _:value2 _:name |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
308 |
|
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
309 |
"Created: / 10-08-2015 / 09:42:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
5 | 310 |
! ! |
311 |
||
28
97013ae2abae
Renamed LLVMBuilder to LLVMIRBuilder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
24
diff
changeset
|
312 |
!LLVMIRBuilder methodsFor:'instructions - binary - compare'! |
22
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
313 |
|
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
314 |
icmp:value1 _:value2 cond: cond |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
315 |
^ self icmp:value1 _:value2 cond: cond as: '' |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
316 |
|
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
317 |
"Created: / 07-08-2015 / 18:39:45 / 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:
19
diff
changeset
|
318 |
! |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
319 |
|
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
320 |
icmp:value1 _:value2 cond: cond as: name |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
321 |
|
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
322 |
self assertIsIntegerOrIntegerVectorValue:value1. |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
323 |
self assertIsIntegerOrIntegerVectorValue:value2. |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
324 |
self assertIsValueOfSameType:value1 as:value2. |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
325 |
self assertIsString:name. |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
326 |
^ LLVM BuildICmp: self _: cond _: value1 _: value2 _: name |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
327 |
|
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
328 |
"Created: / 07-08-2015 / 18:18:39 / 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:
19
diff
changeset
|
329 |
! ! |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
330 |
|
28
97013ae2abae
Renamed LLVMBuilder to LLVMIRBuilder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
24
diff
changeset
|
331 |
!LLVMIRBuilder methodsFor:'instructions - memory'! |
23
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
332 |
|
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
333 |
alloca: type |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
334 |
^ self alloca: type as: '' |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
335 |
|
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
336 |
"Created: / 10-08-2015 / 06:33:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
337 |
! |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
338 |
|
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
339 |
alloca: type as: name |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
340 |
self assertIsType: type. |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
341 |
self assertIsString: name. |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
342 |
|
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
343 |
^ LLVM BuildAlloca: self _: type _: name |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
344 |
|
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
345 |
"Created: / 10-08-2015 / 06:26:37 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
346 |
! |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
347 |
|
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
348 |
gep: pointer at: integerOrArrayOfIntegers |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
349 |
^ self gep: pointer at: integerOrArrayOfIntegers as: '' |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
350 |
|
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
351 |
"Created: / 05-08-2015 / 20:58:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
352 |
! |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
353 |
|
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
354 |
gep: pointer at: integerOrArrayOfIntegers as: name |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
355 |
| indices | |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
356 |
|
24
7e7ddd55174c
Added support for intrinsics.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
357 |
self assertIsValue: pointer ofKind: LLVMPointerTypeKind. |
23
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
358 |
self assert: (integerOrArrayOfIntegers isInteger |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
359 |
or:[ integerOrArrayOfIntegers isSequenceable and:[ integerOrArrayOfIntegers allSatisfy:[:e|e isInteger] ] ]). |
24
7e7ddd55174c
Added support for intrinsics.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
360 |
self assertIsString: name. |
23
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
361 |
integerOrArrayOfIntegers isInteger ifTrue:[ |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
362 |
indices := LLVMObjectArray with: (LLVMConstant uint32: integerOrArrayOfIntegers) |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
363 |
] ifFalse:[ |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
364 |
indices := LLVMObjectArray new: integerOrArrayOfIntegers size. |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
365 |
1 to: indices size do:[:i | |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
366 |
indices at: i put: (LLVMConstant uint32: (integerOrArrayOfIntegers at: i)). |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
367 |
]. |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
368 |
]. |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
369 |
^ LLVM BuildGEP: self _: pointer _: indices _: indices size _: name. |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
370 |
|
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
371 |
"Created: / 05-08-2015 / 20:58:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
24
7e7ddd55174c
Added support for intrinsics.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
372 |
"Modified: / 10-08-2015 / 17:41:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
23
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
373 |
! |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
374 |
|
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
375 |
load: pointer |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
376 |
^ self load: pointer as: '' |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
377 |
|
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
378 |
"Created: / 10-08-2015 / 06:45:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
379 |
! |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
380 |
|
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
381 |
load: pointer as: name |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
382 |
self assertIsValue: pointer. |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
383 |
self assertIsString: name. |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
384 |
|
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
385 |
^ LLVM BuildLoad: self _: pointer _: name |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
386 |
|
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
387 |
"Created: / 10-08-2015 / 06:45:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
388 |
! |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
389 |
|
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
390 |
store: value _: pointer |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
391 |
self assertIsValue: value. |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
392 |
self assertIsValue: pointer. |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
393 |
|
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
394 |
^ LLVM BuildStore: self _: value _: pointer |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
395 |
|
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
396 |
"Created: / 10-08-2015 / 06:45:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
397 |
! ! |
0744cd9c0acc
Added an example of iterative factorial function
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
22
diff
changeset
|
398 |
|
28
97013ae2abae
Renamed LLVMBuilder to LLVMIRBuilder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
24
diff
changeset
|
399 |
!LLVMIRBuilder methodsFor:'instructions - other'! |
9
540c1c31a33d
Added basic support for calling functions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6
diff
changeset
|
400 |
|
24
7e7ddd55174c
Added support for intrinsics.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
401 |
call: function _: args |
7e7ddd55174c
Added support for intrinsics.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
402 |
^ self call: function _: args as: ''. |
9
540c1c31a33d
Added basic support for calling functions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6
diff
changeset
|
403 |
|
24
7e7ddd55174c
Added support for intrinsics.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
404 |
"Created: / 10-08-2015 / 18:53:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9
540c1c31a33d
Added basic support for calling functions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6
diff
changeset
|
405 |
! |
540c1c31a33d
Added basic support for calling functions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6
diff
changeset
|
406 |
|
24
7e7ddd55174c
Added support for intrinsics.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
407 |
call: function _: arguments as: name |
9
540c1c31a33d
Added basic support for calling functions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6
diff
changeset
|
408 |
| argumentsArray argumentsSize | |
540c1c31a33d
Added basic support for calling functions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6
diff
changeset
|
409 |
|
24
7e7ddd55174c
Added support for intrinsics.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
410 |
self assertIsFunctionValue: function. |
7e7ddd55174c
Added support for intrinsics.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
411 |
self assertIsValueArray: arguments. |
7e7ddd55174c
Added support for intrinsics.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
412 |
self assertIsString: name. |
9
540c1c31a33d
Added basic support for calling functions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6
diff
changeset
|
413 |
|
540c1c31a33d
Added basic support for calling functions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6
diff
changeset
|
414 |
argumentsSize := arguments size. |
540c1c31a33d
Added basic support for calling functions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6
diff
changeset
|
415 |
argumentsArray := arguments asLLVMObjectArray. |
540c1c31a33d
Added basic support for calling functions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6
diff
changeset
|
416 |
^ LLVM BuildCall: self _: function _: argumentsArray _: argumentsSize _: name |
540c1c31a33d
Added basic support for calling functions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6
diff
changeset
|
417 |
|
24
7e7ddd55174c
Added support for intrinsics.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
23
diff
changeset
|
418 |
"Created: / 10-08-2015 / 18:53:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
9
540c1c31a33d
Added basic support for calling functions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6
diff
changeset
|
419 |
! ! |
540c1c31a33d
Added basic support for calling functions.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
6
diff
changeset
|
420 |
|
28
97013ae2abae
Renamed LLVMBuilder to LLVMIRBuilder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
24
diff
changeset
|
421 |
!LLVMIRBuilder methodsFor:'instructions - terminators'! |
0 | 422 |
|
22
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
423 |
br: target |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
424 |
| targetAsValue | |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
425 |
|
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
426 |
targetAsValue := target asLLVMValue. |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
427 |
|
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
428 |
self assertIsBasicBlockValue: targetAsValue. |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
429 |
|
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
430 |
^ LLVM BuildBr: self _: targetAsValue |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
431 |
|
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
432 |
"Created: / 08-08-2015 / 02:59:25 / 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:
19
diff
changeset
|
433 |
! |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
434 |
|
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
435 |
if: cond then: then else: else |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
436 |
^ self if: cond then: then else: else as: '' |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
437 |
|
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
438 |
"Created: / 08-08-2015 / 04:15: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:
19
diff
changeset
|
439 |
! |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
440 |
|
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
441 |
if: cond then: then else: else as: name |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
442 |
| thenAsValue elseAsValue | |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
443 |
|
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
444 |
thenAsValue := then asLLVMValue. |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
445 |
elseAsValue := else asLLVMValue. |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
446 |
|
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
447 |
self assertIsBasicBlockValue: thenAsValue. |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
448 |
self assertIsBasicBlockValue: elseAsValue. |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
449 |
self assertIsValue: cond ofType: LLVMType int1. |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
450 |
|
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
451 |
^ LLVM BuildCondBr: self _: cond _: thenAsValue _: elseAsValue |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
452 |
|
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
453 |
"Created: / 07-08-2015 / 18:42: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:
19
diff
changeset
|
454 |
"Modified: / 08-08-2015 / 02:58:39 / 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:
19
diff
changeset
|
455 |
! |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
456 |
|
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
457 |
ret |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
458 |
^ LLVM BuildRetVoid: self |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
459 |
|
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
460 |
"Created: / 07-08-2015 / 18:14:37 / 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:
19
diff
changeset
|
461 |
! |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
462 |
|
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
463 |
ret:value1 |
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
464 |
|
789a35bd30ac
Added example for compiling conditional. Added convenience API to simply code generation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
19
diff
changeset
|
465 |
self assertIsValue: value1. |
0 | 466 |
^ LLVM BuildRet: self _: value1 |
467 |
||
468 |
"Created: / 07-07-2015 / 22:55:27 / 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:
19
diff
changeset
|
469 |
"Modified: / 08-08-2015 / 03:11:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
0 | 470 |
! ! |
471 |
||
28
97013ae2abae
Renamed LLVMBuilder to LLVMIRBuilder
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
24
diff
changeset
|
472 |
!LLVMIRBuilder methodsFor:'positioning'! |
1
e3dcb6272f0b
Introduced abstract superclasses LLVMObject and LLVMDisposableObject
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
473 |
|
38
52be9bfdf7e1
Added LLVMIRBuilder>>block returning current insertion block
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
33
diff
changeset
|
474 |
positionAtEnd: aLLVMBasicBlock |
52be9bfdf7e1
Added LLVMIRBuilder>>block returning current insertion block
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
33
diff
changeset
|
475 |
self assertIsBasicBlock: aLLVMBasicBlock. |
52be9bfdf7e1
Added LLVMIRBuilder>>block returning current insertion block
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
33
diff
changeset
|
476 |
LLVM PositionBuilderAtEnd: self _: aLLVMBasicBlock. |
52be9bfdf7e1
Added LLVMIRBuilder>>block returning current insertion block
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
33
diff
changeset
|
477 |
block := aLLVMBasicBlock |
1
e3dcb6272f0b
Introduced abstract superclasses LLVMObject and LLVMDisposableObject
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
478 |
|
e3dcb6272f0b
Introduced abstract superclasses LLVMObject and LLVMDisposableObject
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
479 |
"Created: / 07-07-2015 / 22:45:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
38
52be9bfdf7e1
Added LLVMIRBuilder>>block returning current insertion block
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
33
diff
changeset
|
480 |
"Modified: / 15-09-2015 / 18:16:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1
e3dcb6272f0b
Introduced abstract superclasses LLVMObject and LLVMDisposableObject
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
481 |
! ! |
e3dcb6272f0b
Introduced abstract superclasses LLVMObject and LLVMDisposableObject
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
0
diff
changeset
|
482 |
|
33
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
483 |
!LLVMIRBuilder class methodsFor:'documentation'! |
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
484 |
|
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
485 |
version_HG |
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
486 |
|
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
487 |
^ '$Changeset: <not expanded> $' |
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
488 |
! ! |
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
28
diff
changeset
|
489 |