|
1 "{ Package: 'stx:goodies/petitparser/compiler' }" |
|
2 |
|
3 "{ NameSpace: Smalltalk }" |
|
4 |
|
5 PPCNodeVisitor subclass:#PPCPassVisitor |
|
6 instanceVariableNames:'context' |
|
7 classVariableNames:'' |
|
8 poolDictionaries:'' |
|
9 category:'PetitCompiler-Visitors' |
|
10 ! |
|
11 |
|
12 |
|
13 !PPCPassVisitor class methodsFor:'converting'! |
|
14 |
|
15 asPPCPass |
|
16 ^ self new |
|
17 |
|
18 "Created: / 29-08-2015 / 07:12:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
19 ! ! |
|
20 |
|
21 !PPCPassVisitor methodsFor:'accessing'! |
|
22 |
|
23 context |
|
24 ^ context |
|
25 ! |
|
26 |
|
27 context: aPPCCompilationContext |
|
28 context := aPPCCompilationContext. |
|
29 |
|
30 "Created: / 26-08-2015 / 22:05:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
31 ! ! |
|
32 |
|
33 !PPCPassVisitor methodsFor:'converting'! |
|
34 |
|
35 asPPCPass |
|
36 ^ self |
|
37 |
|
38 "Created: / 29-08-2015 / 07:13:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
39 ! ! |
|
40 |
|
41 !PPCPassVisitor methodsFor:'running'! |
|
42 |
|
43 run: ir |
|
44 "Actually run the pass on given IR (tree of PPCNode) and return |
|
45 (possibly transformed or completely new) another IR." |
|
46 |
|
47 context isNil ifTrue:[ |
|
48 PPCCompilationError new signal: 'oops, no context set, use #context: before running a pass!!'. |
|
49 ]. |
|
50 ^ self visit: ir. |
|
51 |
|
52 "Created: / 26-08-2015 / 22:30:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
53 ! |
|
54 |
|
55 run: ir in: ctx |
|
56 "Actually run the pass on given IR (tree of PPCNode) in given |
|
57 compilation context and return (possibly transformed or completely |
|
58 new) another IR." |
|
59 |
|
60 context := ctx. |
|
61 ^ self run: ir. |
|
62 |
|
63 "Created: / 26-08-2015 / 22:33:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
64 ! ! |
|
65 |
|
66 !PPCPassVisitor class methodsFor:'documentation'! |
|
67 |
|
68 version |
|
69 ^ 'Path: stx/goodies/petitparser/compiler/PPCPass.st, Version: 1.0, User: jv, Time: 2015-08-29T07:53:24.558+01' |
|
70 ! |
|
71 |
|
72 version_HG |
|
73 ^ 'Path: stx/goodies/petitparser/compiler/PPCPass.st, Version: 1.0, User: jv, Time: 2015-08-29T07:53:24.558+01' |
|
74 ! ! |
|
75 |