author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Sat, 01 Aug 2015 07:07:46 +0100 | |
changeset 14 | c7dea3fcc5a7 |
parent 13 | fa967c0e1827 |
child 22 | 789a35bd30ac |
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:
5
diff
changeset
|
14 |
"{ Package: 'jv:llvm_s' }" |
4 | 15 |
|
16 |
"{ NameSpace: Smalltalk }" |
|
17 |
||
18 |
LLVMValue subclass:#LLVMFunction |
|
5 | 19 |
instanceVariableNames:'numArgs' |
4 | 20 |
classVariableNames:'' |
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' |
4 | 23 |
! |
24 |
||
14
c7dea3fcc5a7
Added short README, license.txt and updated copyright information
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
13
diff
changeset
|
25 |
!LLVMFunction 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 | 43 |
!LLVMFunction methodsFor:'accessing'! |
44 |
||
45 |
numArgs |
|
5 | 46 |
| last current | |
47 |
||
48 |
numArgs isNil ifTrue:[ |
|
49 |
numArgs := 0. |
|
50 |
"/ current := LLVM GetFirstParam: self. |
|
51 |
"/ last := LLVM GetLastParam: self. |
|
52 |
"/ [ current ~= last ] whileTrue:[ |
|
53 |
"/ numArgs := numArgs + 1. |
|
54 |
"/ current := LLVM GetNextFunction: current. |
|
55 |
"/ self halt. |
|
56 |
"/ ]. |
|
57 |
]. |
|
58 |
^ numArgs |
|
4 | 59 |
|
60 |
"Created: / 11-07-2015 / 09:42:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
5 | 61 |
"Modified: / 11-07-2015 / 11:23:52 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4 | 62 |
! |
63 |
||
64 |
parameterAt: index |
|
5 | 65 |
^ LLVM GetParam: self _: index - 1. |
4 | 66 |
|
67 |
"Created: / 07-07-2015 / 22:49:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
5 | 68 |
"Modified: / 11-07-2015 / 10:13:18 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4 | 69 |
! ! |
70 |
||
71 |
!LLVMFunction methodsFor:'functions-adding'! |
|
72 |
||
73 |
addBasicBlockNamed: name |
|
5 | 74 |
| bb | |
75 |
||
4 | 76 |
self assert: name isSingleByteString. |
5 | 77 |
bb := LLVM AppendBasicBlock: self _: name. |
78 |
bb module: self. |
|
79 |
^ bb |
|
4 | 80 |
|
81 |
"Created: / 08-07-2015 / 23:09:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
5 | 82 |
"Modified: / 11-07-2015 / 12:55:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4 | 83 |
! ! |
84 |
||
5 | 85 |
!LLVMFunction methodsFor:'initialization'! |
86 |
||
87 |
initialize |
|
88 |
super initialize. |
|
89 |
self initializeArgumentsNames |
|
90 |
||
91 |
"Created: / 11-07-2015 / 10:13:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
92 |
! |
|
93 |
||
94 |
initializeArgumentsNames |
|
95 |
1 to: self numArgs do:[:numArg | |
|
96 |
(self parameterAt: numArg) name: 'arg', numArg printString |
|
97 |
]. |
|
98 |
||
99 |
"Created: / 11-07-2015 / 10:13:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
100 |
! ! |
|
101 |