author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Wed, 27 Jan 2016 14:20:58 +0000 | |
changeset 54 | a288aced3dd1 |
parent 33 | feabf14b6c1d |
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 |
LLVMFunction subclass:#LLVMStXMethod |
|
19 |
instanceVariableNames:'' |
|
20 |
classVariableNames:'SelectorSpecialCharMappingTable' |
|
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-StX' |
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 |
!LLVMStXMethod 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 |
!LLVMStXMethod class methodsFor:'initialization'! |
44 |
||
45 |
initialize |
|
46 |
"Invoked at system start or when the class is dynamically loaded." |
|
47 |
||
48 |
"/ please change as required (and remove this comment) |
|
49 |
||
50 |
SelectorSpecialCharMappingTable := Dictionary withKeysAndValues: |
|
51 |
#($+ 'pl' |
|
52 |
$- 'mi' |
|
53 |
$* 'mu' |
|
54 |
$/ 'di' |
|
55 |
$, 'co' |
|
56 |
$@ 'at' |
|
57 |
$< 'le' |
|
58 |
$> 'gr' |
|
59 |
$= 'eq' |
|
60 |
$~ 'ne' |
|
61 |
$| 'pi' |
|
62 |
$\ 'mo' |
|
63 |
$& 'am'). |
|
64 |
||
65 |
"Modified: / 11-07-2015 / 09:24:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
66 |
! ! |
|
67 |
||
68 |
!LLVMStXMethod class methodsFor:'utilities'! |
|
69 |
||
70 |
llvmFunctionNameForClass: class selector: selector |
|
71 |
"For given class name and selector, returns the name |
|
72 |
used by LLVM" |
|
73 |
||
74 |
^ String streamContents:[ :s| |
|
75 |
s nextPutAll: '__M_L_'. |
|
76 |
s nextPutAll: (class name copyReplaceAll: $: with: $_). |
|
77 |
s nextPut: $_. |
|
78 |
selector isBinarySelector ifTrue:[ |
|
79 |
selector do:[:c | |
|
80 |
s nextPutAll: (SelectorSpecialCharMappingTable at: c) |
|
81 |
]. |
|
82 |
] ifFalse:[ |
|
83 |
selector do:[:c | |
|
84 |
c isAlphaNumeric ifTrue:[ |
|
85 |
s nextPut: c |
|
86 |
] ifFalse:[ |
|
87 |
c == $: ifTrue:[ |
|
88 |
s nextPut: $_ |
|
89 |
] ifFalse:[ |
|
90 |
s nextPut: $_. |
|
91 |
c codePoint printOn: s. |
|
92 |
] |
|
93 |
]. |
|
94 |
] |
|
95 |
]. |
|
96 |
]. |
|
97 |
||
98 |
" |
|
99 |
LLVMStXMethod llvmFunctionNameForClass: LLVMStXMethod selector: #llvmFunctionNameForClass:selector: |
|
100 |
LLVMStXMethod llvmFunctionNameForClass: SmallInteger selector: #+ |
|
101 |
LLVMStXMethod llvmFunctionNameForClass: Object selector: #~= |
|
102 |
||
103 |
" |
|
104 |
||
105 |
"Created: / 11-07-2015 / 09:26:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
106 |
! ! |
|
107 |
||
108 |
!LLVMStXMethod methodsFor:'accessing'! |
|
109 |
||
33
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14
diff
changeset
|
110 |
numParams |
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14
diff
changeset
|
111 |
^ super numParams - 4 |
4 | 112 |
|
33
feabf14b6c1d
Initial support for generating (DWARF) debug info.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
14
diff
changeset
|
113 |
"Created: / 14-08-2015 / 12:54:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
4 | 114 |
! |
115 |
||
116 |
parameterAt: index |
|
117 |
^ super parameterAt: 4 + index. |
|
118 |
||
119 |
"Created: / 11-07-2015 / 09:39:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
120 |
! ! |
|
121 |
||
122 |
!LLVMStXMethod methodsFor:'initialization'! |
|
123 |
||
5 | 124 |
initializeArgumentsNames |
4 | 125 |
"Assign human readable names to parameters" |
126 |
(super parameterAt: 1) name: 'self'. |
|
127 |
(super parameterAt: 2) name: 'selector'. |
|
128 |
(super parameterAt: 3) name: 'searchClass'. |
|
129 |
(super parameterAt: 4) name: 'pIlc'. |
|
5 | 130 |
1 to: super numArgs - 4 do:[:numArg | |
131 |
self halt. |
|
4 | 132 |
(super parameterAt: 4+numArg) name: 'marg', numArg printString. |
133 |
]. |
|
134 |
||
5 | 135 |
"Created: / 11-07-2015 / 10:18:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
136 |
"Modified: / 11-07-2015 / 11:21:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4 | 137 |
! ! |
138 |
||
139 |
||
140 |
LLVMStXMethod initialize! |