Mercurial > hg > Papers > 2011 > nobu-prosym
annotate presen/index.html @ 74:275073032132
modify
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 03 Jan 2012 19:21:51 +0900 |
parents | 9250ac87c2c7 |
children | 454ddda8d306 |
rev | line source |
---|---|
54 | 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" |
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
3 | |
4 <html xmlns="http://www.w3.org/1999/xhtml"> | |
5 | |
6 <head> | |
71 | 7 <style type="text/css"> |
8 tr.srctr { | |
9 font-size:28px; | |
10 } | |
11 td.srctd { | |
74 | 12 height:17em; |
70
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
13 } |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
14 pre.srcbox { |
71 | 15 height: 100%; |
70
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
16 overflow: scroll; |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
17 } |
64 | 18 .src{ |
19 overflow: scroll; | |
20 width: 90%; | |
21 height: 60%; | |
22 } | |
54 | 23 .center { |
24 margin-left: auto; | |
25 margin-right: auto; | |
26 text-align: center; | |
27 } | |
28 .textcenter { | |
29 text-align: center; | |
30 } | |
31 .taninaritop { | |
32 margin: auto; | |
33 width: 95%; | |
34 font-weight: bold; | |
35 } | |
36 </style> | |
37 <title>2012/ 1/ 7</title> | |
38 <!-- metadata --> | |
39 <meta name="generator" content="S5" /> | |
40 <meta name="version" content="S5 1.1" /> | |
41 <meta name="presdate" content="20120107" /> | |
42 <meta name="author" content="Nobuyasu Oshiro" /> | |
43 <meta name="company" content="University of the Ryukyu" /> | |
44 <!-- meta temporary --> | |
45 <meta http-equiv="content-type" content="text/html; charset=utf-8" /> | |
46 <meta http-equiv="Content-Script-Type" content="text/javascript" /> | |
47 <meta http-equiv="Content-Style-Type" content="text/css" /> | |
48 <!-- configuration parameters --> | |
49 <meta name="defaultView" content="slideshow" /> | |
50 <meta name="controlVis" content="hidden" /> | |
51 <!-- configuration extensions --> | |
52 <meta name="tranSitions" content="true" /> | |
53 <meta name="fadeDuration" content="500" /> | |
54 <meta name="incrDuration" content="250" /> | |
55 <!-- configuration autoplay extension --> | |
56 <meta name="autoMatic" content="false" /> | |
57 <meta name="playLoop" content="true" /> | |
58 <meta name="playDelay" content="10" /> | |
59 <!-- configuration audio extension --> | |
60 <meta name="audioSupport" content="false" /> | |
61 <meta name="audioVolume" content="100" /> | |
62 <meta name="audioError" content="false" /> | |
63 <!-- configuration audio debug --> | |
64 <meta name="audioDebug" content="false" /> | |
65 <!-- style sheet links --> | |
66 <link rel="stylesheet" href="ui/default_utf/slides.css" type="text/css" media="projection" id="slideProj" /> | |
67 <link rel="stylesheet" href="ui/default_utf/outline.css" type="text/css" media="screen" id="outlineStyle" /> | |
68 <link rel="stylesheet" href="ui/default_utf/print.css" type="text/css" media="print" id="slidePrint" /> | |
69 <link rel="stylesheet" href="ui/default_utf/opera.css" type="text/css" media="projection" id="operaFix" /> | |
70 <!-- embedded styles --> | |
71 <style type="text/css" media="all"> | |
72 .imgcon {width: 100%; margin: 0 auto; padding: 0; text-align: center;} | |
73 #anim {width: 33%; height: 320px; position: relative;} | |
74 #anim img {position: absolute; top: 0px; left: 0px;} | |
75 </style> | |
76 <!-- S5 JS --> | |
77 <script src="ui/default_utf/slides.js" type="text/javascript"></script> | |
78 </head> | |
79 <body> | |
80 | |
81 <div class="layout"> | |
82 <div id="controls"><!-- DO NOT EDIT --></div> | |
83 <div id="currentSlide"><!-- DO NOT EDIT --></div> | |
84 <div id="header"></div> | |
85 <div id="footer"> | |
86 <h1>プログラミングシンポジウム: 2012/ 1/ 7</h1> | |
87 <h2>並列信頼研</h2> | |
88 </div> | |
89 </div> | |
90 | |
91 <div class="presentation"> | |
92 | |
93 <div class="slide"> | |
94 <h1>Continuation based Cの GCC 4.6 上の実装について</li> | |
95 <h3></h3> | |
96 <li>大城 信康</li> | |
97 <h4><a href="http://ie.u-ryukyu.ac.jp/" rel="external">琉球大学 並列信頼研究室</a></h4> | |
98 <div class="handout"></div> | |
99 </div> | |
100 <!-- PAGE --> | |
101 <div class="slide"> | |
102 <h1>目的と背景(1)</h1> | |
73 | 103 <li>当研究室ではコードセグメント単位で記述するプログラミング言語Continuation based C (以下CbC)を開発している。</li> |
54 | 104 <li>コードセグメントは並列実行の単位として使うことができ、プログラムの正しさを示す単位としても使用することができる。</li> |
63
3cc4a8603489
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
62
diff
changeset
|
105 <li>Many Core での並列実行を高い性能と高い信頼性で実現することができると考えている。</li> |
54 | 106 </div> |
107 <!-- PAGE --> | |
108 <div class="slide"> | |
109 <h1>目的と背景(2)</h1> | |
73 | 110 <li>CbC のコンパイラは2001年に Micro-C 版、2008年には GCC-4.2 をベースとしたコンパイラが開発された。</li> |
63
3cc4a8603489
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
62
diff
changeset
|
111 <li>GCC をベースとした CbC コンパイラは、修正・追加されていく最適化の機能を使用する為に、 GCC のアップデートに合わせ変更する必要がある。</li> |
58 | 112 <li>本研究ではCbC コンパイラを GCC-4.6 へとアップデートを行った。 </li> |
54 | 113 </div> |
114 <!-- PAGE --> | |
115 <div class="slide"> | |
116 <h1>発表内容</h1> | |
117 <ol> | |
118 <li>CbC の紹介</li> | |
119 <li>GCC でのコンパイルの流れ</li> | |
58 | 120 <font color="red"> |
121 <li>CbC の実装</li> | |
122 </font> | |
54 | 123 <!-- |
124 <ul> | |
125 <li>Tail Call Elimination</li> | |
126 <li>goto シンタックスの追加</li> | |
127 <li>環境付き継続</li> | |
128 </ul> | |
129 --> | |
130 <li>Micro-C との性能比較</li> | |
64 | 131 <!-- |
54 | 132 <li>mercurial を用いたアップデートの方法</li> |
64 | 133 --> |
54 | 134 <li>まとめ</li> |
135 <ol> | |
136 </div> | |
137 <!-- PAGE --> | |
138 <div class="slide"> | |
139 <h1>Continuation based C </h1> | |
55
06ce8fb8e278
modify presen/index.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
140 <h2>コードセグメント単位での記述と継続を基本としたプログラミング言語。</h2> |
63
3cc4a8603489
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
62
diff
changeset
|
141 <ul> |
73 | 142 <li>コードセグメント:CbCにおけるプログラムの基本単位</li> |
55
06ce8fb8e278
modify presen/index.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
143 <ul> |
73 | 144 <li>C の関数よりも細かい単位になる。</li> |
145 <li>コードセグメントの末尾処理で別のコードセグメントへ継続(goto)することでCbCのプログラムは続いていく。</li> | |
146 <li>Cから関数コールとループ制御が取り除かれた形となる。</li> | |
147 </ul> | |
148 <p class="center"> | |
149 <img src="./pix/codesegment.png" style="height:6em;"> | |
150 </p> | |
55
06ce8fb8e278
modify presen/index.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
151 </ul> |
54 | 152 </div> |
153 <!-- PAGE --> | |
154 <div class="slide"> | |
73 | 155 <h1>Continuation based C </h1> |
156 <ul> | |
157 <li>継続(C言語):現在の処理を実行していく為の情報</li> | |
58 | 158 <ul> |
159 <li>続く命令のアドレス</li> | |
160 <li>命令に必要なデータ</li> | |
161 <li>スタックに積まれている値(環境)</li> | |
162 </ul> | |
73 | 163 </ul> |
164 <li class="incremental">CbC: 関数コールが無い -> 呼び出し元への復帰がない</li> | |
165 <ul class="incremental"> | |
166 <li>CbCの継続:軽量継続(light-weight continuation)</li> | |
167 <ul> | |
168 <li>Cの継続から環境を除外</li> | |
169 <li>続く命令とその命令に必要なデータのみ</li> | |
170 </ul> | |
171 </ul> | |
60
a21d16da431a
modify addition of goto syntax
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
172 </div> |
a21d16da431a
modify addition of goto syntax
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
173 <!-- PAGE --> |
a21d16da431a
modify addition of goto syntax
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
174 <div class="slide"> |
a21d16da431a
modify addition of goto syntax
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
175 <h1>Continuation Based C (軽量継続)</h1> |
59
6ef99d3e66b2
modify light-weight continuation
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
58
diff
changeset
|
176 <p style=" margin-right:auto; margin-left:auto;"> |
66
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
177 <table width=90% class="center" border=1> |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
178 <tr> |
68
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
179 <td><small>Cの関数呼び出し</small></td> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
180 <td><small>CbCの継続</></small></td> |
66
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
181 </tr> |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
182 <tr> |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
183 <td> |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
184 <img class="scale" src="./pix/func_call.png" style="height: 6em;"> |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
185 </td> |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
186 <td> |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
187 <img class="scale" src="./pix/cs_stack.png" style="height: 6em;"> |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
188 </td> |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
189 </tr> |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
190 </table> |
59
6ef99d3e66b2
modify light-weight continuation
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
58
diff
changeset
|
191 </p> |
73 | 192 <li>コードセグメントへの継続はcallではなくjmp命令で行われる</li> |
193 <li>スタックに載るデータは1つのコードセグメントの必要なデータのみ。</li> | |
59
6ef99d3e66b2
modify light-weight continuation
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
58
diff
changeset
|
194 </div> |
6ef99d3e66b2
modify light-weight continuation
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
58
diff
changeset
|
195 <!-- PAGE --> |
58 | 196 <div class="slide"> |
54 | 197 <h1>Continuation based C </h1> |
68
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
198 <table width=100% border=1> |
73 | 199 <caption><small>階乗を求めるCbCのプログラム</small></caption> |
71 | 200 <tr class="srctr"> |
54 | 201 <td width=50%> |
70
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
202 <pre class="srcbox"> |
73 | 203 |
54 | 204 __code print_factorial(int prod) { |
205 printf("factorial = %d\n",prod); | |
206 exit(0); | |
207 } | |
58 | 208 |
54 | 209 __code factorial0(int prod, int x) { |
210 if ( x >= 1) { | |
211 goto factorial0(prod*x, x-1); | |
212 }else{ | |
213 goto print_factorial(prod); | |
214 } | |
215 } | |
216 </pre> | |
217 </td> | |
218 <td> | |
70
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
219 <pre class="srcbox"> |
73 | 220 |
54 | 221 __code factorial(int x) { |
222 goto factorial0(1, x); | |
223 } | |
58 | 224 |
54 | 225 int main(int argc, char **argv) { |
226 int i; | |
227 i = atoi(argv[1]); | |
228 goto factorial(i); | |
229 return 0; | |
230 } | |
231 </pre> | |
232 </td> | |
233 </tr> | |
234 </table> | |
73 | 235 <ul> |
236 <li><small>__code キーワードによるコードセグメントの宣言</small></li> | |
237 <li><small>goto によるコードセグメントへの継続(Cの関数呼び出しと同等)</small></li> | |
238 </ul> | |
239 <li class="incremental"><small>以上がCbCについての紹介となる。</small></li> | |
54 | 240 </div> |
241 <!-- PAGE --> | |
242 <div class="slide"> | |
68
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
243 <h1>GCC</h1> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
244 <li>本来はGnu Compiler Collectionのことを指すが、 |
70
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
245 <br>ここで扱うのはGnu C Compiler(cc1)になる。</li> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
246 <ul> |
73 | 247 <li class="incremental">GCCではアセンブラ言語を出力するまでに読み込まれたソースコードは次の4つの中間言語へと変換される。</li> |
70
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
248 </ul> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
249 </div> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
250 <!-- PAGE --> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
251 <div class="slide"> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
252 <h1>GCC</h1> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
253 <ol> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
254 <li>Generic Tree:ソースコードを構文木の形に直したもの</li> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
255 <li>GIMPLE: Generic Treeの命令を簡単にした構文木</li> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
256 <li>Tree SSA: GIMPLEの中で変数代入を一度しか行わせない形にした構文木</li> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
257 <li>RTL: レジスタの割り当てといった低レベルの表現でアセンブラとほぼ同じ命令の表現ができる。</li> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
258 </ol> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
259 <li class="incremental">それぞれは次のようなデータを構文木にして持っている。</li> |
68
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
260 </div> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
261 <!-- PAGE --> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
262 <div class="slide"> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
263 <h1>GCC</h1> |
70
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
264 <table width=100% border=1> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
265 <tr> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
266 <td>Generic(ソースコード)</td> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
267 <td>GIMPLE</td> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
268 </tr> |
71 | 269 <tr class="srctr"> |
70
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
270 <td> |
71 | 271 <pre class="srcbox"> |
70
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
272 void factorial(int x) |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
273 { |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
274 int prod,i; |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
275 for(i=1,prod=1; i <= x; i++){ |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
276 prod = prod*i; |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
277 } |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
278 print_factorial(prod); |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
279 } |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
280 </pre> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
281 </td> |
71 | 282 <td width=50%> |
283 <pre class="srcbox"> | |
70
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
284 factorial (int x) |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
285 { |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
286 int prod; |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
287 int i; |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
288 |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
289 i = 1; |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
290 prod = 1; |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
291 goto <D.2846>; |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
292 <D.2845>: |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
293 prod = prod * i; |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
294 i = i + 1; |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
295 <D.2846>: |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
296 if (i <= x) goto <D.2845>; else goto <D.2847>; |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
297 <D.2847>: |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
298 print_factorial (prod); |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
299 } |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
300 </pre> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
301 </td> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
302 </tr> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
303 </table> |
68
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
304 </div> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
305 <!-- PAGE --> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
306 <div class="slide"> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
307 <h1>GCC</h1> |
71 | 308 <table border=1 width=100% height=100%> |
70
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
309 <tr> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
310 <td width=50%>SSA</td> |
72
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
311 <td width=50%>RTL(一部)</td> |
70
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
312 </tr> |
71 | 313 <tr class="srctr"> |
314 <td class="srctd"> | |
315 <pre class="srcbox"> | |
70
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
316 factorial (int x) |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
317 { |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
318 int i; |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
319 int prod; |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
320 |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
321 <bb 2>: |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
322 i_3 = 1; |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
323 prod_4 = 1; |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
324 goto <bb 4>; |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
325 |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
326 <bb 3>: |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
327 prod_6 = prod_1 * i_2; |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
328 i_7 = i_2 + 1; |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
329 |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
330 <bb 4>: |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
331 # prod_1 = PHI <prod_4(2), prod_6(3)> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
332 # i_2 = PHI <i_3(2), i_7(3)> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
333 if (i_2 <= x_5(D)) |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
334 goto <bb 3>; |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
335 else |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
336 goto <bb 5>; |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
337 |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
338 <bb 5>: |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
339 print_factorial (prod_1); |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
340 return; |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
341 } |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
342 |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
343 </pre> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
344 </td> |
71 | 345 <td class="srctd"> |
346 <pre class="srcbox" style="width:25em;"> | |
72
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
347 (jump_insn 20 19 21 5 (set (pc) |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
348 (if_then_else (le (reg:CCGC 17 flags) |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
349 (const_int 0 [0])) |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
350 (label_ref 17) |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
351 (pc))) factorial.c:12 -1 |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
352 (nil) |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
353 -> 17) |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
354 |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
355 (note 21 20 22 6 [bb 6] NOTE_INSN_BASIC_BLOCK) |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
356 |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
357 (insn 22 21 23 6 (set (reg:SI 62) |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
358 (mem/c/i:SI (plus:DI (reg/f:DI 54 virtual-stack-vars) |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
359 (const_int -4 [0xfffffffffffffffc])) [0 prod+0 S4 A32])) factorial.c:15 -1 |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
360 (nil)) |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
361 |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
362 (insn 23 22 24 6 (set (reg:SI 5 di) |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
363 (reg:SI 62)) factorial.c:15 -1 |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
364 (nil)) |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
365 |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
366 (call_insn 24 23 25 6 (call (mem:QI (symbol_ref:DI ("print_factorial") [flags 0x403] <function_decl 0x146f6b200 print_factorial>) [0 S1 A8]) |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
367 (const_int 0 [0])) factorial.c:15 -1 |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
368 (nil) |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
369 (expr_list:REG_DEP_TRUE (use (reg:SI 5 di)) |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
370 (nil))) |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
371 |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
372 (code_label 25 24 26 7 2 "" [0 uses]) |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
373 |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
374 (note 26 25 0 7 [bb 7] NOTE_INSN_BASIC_BLOCK) |
70
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
375 </pre> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
376 </td> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
377 </tr> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
378 </table> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
379 </div> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
380 <!-- PAGE --> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
381 <div class="slide"> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
382 <h1>GCC</h1> |
68
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
383 <p class="center"> |
69
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
384 <img src="./pix/ir.png" style="height: 6em;"> |
68
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
385 </p> |
73 | 386 <li class="incremental">CbCの実装においてはGeneric Tree生成部分とRTLへの変換部分に修正が加えられている。</li> |
69
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
387 <li class="incremental">Generic Tree生成部分について詳しく触れてみる。</li> |
68
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
388 </div> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
389 <!-- PAGE --> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
390 <div class="slide"> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
391 <h1>GCC:Generic Tree</h1> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
392 <li>Generic Treeではソースコードの内容が FUNCTION_TYPE, CALL_EXPR, MODIFY_EXPR 等と言った形で表される。</li> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
393 <table class="center" width=100% border=1> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
394 <tr> |
69
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
395 <td></td> |
68
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
396 <td><small>値の代入:MODIFY_EXPR</small></td> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
397 <td><small>関数呼び出し:CALL_EXPR</small></td> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
398 </t> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
399 <tr> |
69
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
400 <td>命令</td> |
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
401 <td>b = a * 10</td> |
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
402 <td>func(a,10)</td> |
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
403 </t> |
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
404 <tr> |
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
405 <td><small>Generic<br>Tree</small></td> |
68
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
406 <td> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
407 <img src="./pix/MODIFY_EXPR.png" style="height: 6em;"> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
408 </td> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
409 <td> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
410 <img src="./pix/CALL_EXPR.png" style="height: 7em;"> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
411 </td> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
412 </tr> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
413 </table> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
414 <p class="center"><small>Generic Treeでの表現</small></p> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
415 </div> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
416 <!-- PAGE --> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
417 <div class="slide"> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
418 <h1>GCC:Generic Tree</h1> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
419 <li>それぞれの命令はSTATEMENT_LISTでまとめて保持される。</li> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
420 <table width=100% border=1> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
421 <tr> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
422 <td class="center"><small>ソースコード</small></td> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
423 <td class="center"><small>Generic Treeでの表現</small></td> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
424 </tr> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
425 <tr> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
426 <td> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
427 <small> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
428 <pre> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
429 int main() { |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
430 int a, b; |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
431 a = 3; |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
432 b = func(a, 10); |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
433 return b; |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
434 } |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
435 </pre> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
436 </small> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
437 </td> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
438 <td> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
439 <p class="center"> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
440 <img src="./pix/STATEMENT_LIST.png" style="height: 6em;"> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
441 </p> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
442 </td> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
443 </tr> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
444 </table> |
69
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
445 <li class="incremental">CbCの実装においてこのGeneric Treeの生成を意識していくことになる。</li> |
68
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
446 </div> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
447 <!-- PAGE --> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
448 <!-- |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
449 <div class="slide"> |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
450 <h1>GCC</h1> |
54 | 451 <li>GCC についての簡単な説明を行う...</li> |
60
a21d16da431a
modify addition of goto syntax
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
452 <li>TODO: NEXT_PASS() の把握</li> |
54 | 453 <img src="./pix/ir.png" style="height: 6em;"> |
454 <li>CbCの実装は主に Parser の部分と RTL を生成する部分に行われる。</li> | |
455 </div> | |
68
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
456 --> |
54 | 457 <!-- PAGE --> |
458 <div class="slide"> | |
61
2c543a47737b
modify explanation of fastcall
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
60
diff
changeset
|
459 <h1>CbCの実装</h1> |
54 | 460 <ul> |
461 <li>シンタックスの追加</li> | |
73 | 462 <li>末尾除去:Tail Call Elimination(TCE)</li> |
61
2c543a47737b
modify explanation of fastcall
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
60
diff
changeset
|
463 <li>レジスタによる引数渡し(fastcall属性の付与)</li> |
54 | 464 <li>環境付き継続</li> |
60
a21d16da431a
modify addition of goto syntax
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
465 <li>__rectype の実装</li> |
54 | 466 </ul> |
467 </div> | |
468 <!-- PAGE --> | |
469 <div class="slide"> | |
60
a21d16da431a
modify addition of goto syntax
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
470 <h1>CbCの実装:シンタックスの追加</h1> |
54 | 471 <ul> |
60
a21d16da431a
modify addition of goto syntax
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
472 <li>__code キーワードでのコードセグメントの宣言</li> |
a21d16da431a
modify addition of goto syntax
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
473 <ul> |
a21d16da431a
modify addition of goto syntax
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
474 <li>__code 用idとkeywordを作成。</li> |
a21d16da431a
modify addition of goto syntax
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
475 <li>戻り値が無い為、コードセグメントは void 型の関数で作成される木と同じ木が作られる。</li> |
a21d16da431a
modify addition of goto syntax
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
476 </ul> |
73 | 477 </ul> |
478 <table width=100% border=1> | |
479 <tr class="srctr"> | |
480 <td> | |
481 <pre> | |
482 const struct c_common_resword c_common_reswords[] = | |
483 { | |
484 { "_Bool", RID_BOOL, D_CONLY }, | |
485 : | |
486 { "__code", RID_CbC_CODE, 0 }, | |
487 </pre> | |
488 </td> | |
489 </tr> | |
490 <tr class="srctr"> | |
491 <td> | |
492 <pre> | |
493 case RID_CbC_CODE: | |
494 : | |
495 specs->typespec_word = cts_CbC_code; | |
496 </pre> | |
497 </td> | |
498 </tr> | |
499 <tr class="srctr"> | |
500 <td> | |
501 <pre> | |
502 case cts_CbC_code: | |
503 : | |
504 specs->type = void_type_node; | |
505 break; | |
506 </pre> | |
507 </td> | |
508 </tr> | |
509 </table> | |
510 </div> | |
511 <!-- PAGE --> | |
512 <div class="slide"> | |
513 <h1>CbCの実装:シンタックスの追加</h1> | |
60
a21d16da431a
modify addition of goto syntax
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
514 <li>goto によるコードセグメントへの継続</li> |
a21d16da431a
modify addition of goto syntax
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
515 <ul> |
63
3cc4a8603489
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
62
diff
changeset
|
516 <li>通常の goto に加え、コードセグメントへ継続する処理を追加。</li> |
3cc4a8603489
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
62
diff
changeset
|
517 <li>コードセグメントへのgotoの後に、returnの処理を自動で追加。</li> |
60
a21d16da431a
modify addition of goto syntax
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
518 </ul> |
61
2c543a47737b
modify explanation of fastcall
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
60
diff
changeset
|
519 <li class="incremental">追加したgotoシンタックスの実際のソースは次のようになる。</li> |
54 | 520 </div> |
521 <!-- PAGE --> | |
522 <div class="slide"> | |
60
a21d16da431a
modify addition of goto syntax
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
523 <h1>CbCの実装:シンタックスの追加</h1> |
a21d16da431a
modify addition of goto syntax
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
524 <h2>gotoシンタックスの追加</h2> |
73 | 525 <pre class="srcbox" style="font-size:25px; height:17em;"> |
70
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
526 case RID_GOTO: |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
527 c_parser_consume_token (parser); |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
528 if ( c_parser_next_token_is (parser, CPP_NAME) |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
529 && c_parser_peek_2nd_token (parser)->type == CPP_SEMICOLON ) |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
530 { |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
531 stmt = c_finish_goto_label (loc, |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
532 c_parser_peek_token (parser)->value); |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
533 c_parser_consume_token (parser); |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
534 } |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
535 else if (c_parser_next_token_is (parser, CPP_MULT)) |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
536 { |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
537 tree val; |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
538 |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
539 c_parser_consume_token (parser); |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
540 val = c_parser_expression (parser).value; |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
541 mark_exp_read (val); |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
542 stmt = c_finish_goto_ptr (loc, val); |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
543 } |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
544 else |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
545 expr = c_parser_expr_no_commas (parser, NULL); |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
546 if (TREE_CODE(expr.value) == CALL_EXPR ) |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
547 { |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
548 location_t loc = c_parser_peek_token (parser)->location; |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
549 cbc_replace_arguments (loc, expr.value); |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
550 TREE_TYPE(expr.value) = void_type_node; |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
551 CbC_IS_CbC_GOTO (expr.value) = 1; |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
552 CALL_EXPR_TAILCALL (expr.value) = 1; |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
553 add_stmt(expr.value); |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
554 stmt = c_finish_return(loc, NULL_TREE, NULL_TREE); |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
555 } |
60
a21d16da431a
modify addition of goto syntax
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
556 </pre> |
63
3cc4a8603489
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
62
diff
changeset
|
557 <small> |
3cc4a8603489
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
62
diff
changeset
|
558 <li>cbc_replace_arguments関数は引数のデータを一時的な変数へ避難させる。</li> |
73 | 559 <li class="incremental">CALL_EXPR_TAILCALLマクロでtail callフラグを立てる。</li> |
69
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
560 <li class="incremental">最後にc_finish_return関数によりreturn文を生成している。</li> |
63
3cc4a8603489
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
62
diff
changeset
|
561 </small> |
54 | 562 </div> |
563 <!-- PAGE --> | |
564 <div class="slide"> | |
60
a21d16da431a
modify addition of goto syntax
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
565 <h1>CbCの実装:シンタックスの追加</h1> |
61
2c543a47737b
modify explanation of fastcall
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
60
diff
changeset
|
566 <h2>gotoシンタックスの追加</h2> |
73 | 567 <ul> |
568 <li>tail callフラグを立てることで、関数呼び出しに末尾除去(末尾最適化)をかけることができる。</li> | |
569 <li>最後のリターン文生成も、末尾除去にかける為に必要な処理。</li> | |
570 </ul> | |
55
06ce8fb8e278
modify presen/index.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
571 <table border=1 width=100%> |
73 | 572 <!-- |
573 <caption><small>return 自動生成</small></caption> | |
574 --> | |
55
06ce8fb8e278
modify presen/index.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
575 <tr class="center"> |
06ce8fb8e278
modify presen/index.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
576 <small> |
06ce8fb8e278
modify presen/index.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
577 <td>実際のコード </td> |
06ce8fb8e278
modify presen/index.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
578 <td>GCC 内で処理されるコード</td> |
06ce8fb8e278
modify presen/index.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
579 </small> |
06ce8fb8e278
modify presen/index.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
580 </tr> |
73 | 581 <tr class="srctr"> |
55
06ce8fb8e278
modify presen/index.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
582 <td> |
06ce8fb8e278
modify presen/index.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
583 <pre> |
73 | 584 |
585 __code test() { | |
586 : | |
587 goto factorial0(1, x); | |
588 } | |
55
06ce8fb8e278
modify presen/index.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
589 </pre> |
06ce8fb8e278
modify presen/index.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
590 </td> |
06ce8fb8e278
modify presen/index.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
591 <td> |
06ce8fb8e278
modify presen/index.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
592 <pre> |
73 | 593 |
594 void test() { | |
595 : | |
596 factorial0(1, x); | |
597 return; | |
598 } | |
55
06ce8fb8e278
modify presen/index.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
599 </pre> |
06ce8fb8e278
modify presen/index.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
600 </td> |
06ce8fb8e278
modify presen/index.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
601 </tr> |
06ce8fb8e278
modify presen/index.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
54
diff
changeset
|
602 </table> |
73 | 603 <!-- |
60
a21d16da431a
modify addition of goto syntax
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
59
diff
changeset
|
604 <li>末尾最適化(末尾除去)については後ほど詳しく説明する。</li> |
73 | 605 --> |
63
3cc4a8603489
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
62
diff
changeset
|
606 </div> |
3cc4a8603489
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
62
diff
changeset
|
607 <!-- PAGE --> |
3cc4a8603489
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
62
diff
changeset
|
608 <div class="slide"> |
71 | 609 <h1>CbCの実装:TCE(末尾除去)</h1> |
73 | 610 <h2>末尾除去:Tail Call Elimination(TCE)</h2> |
69
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
611 <ul> |
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
612 <li>関数呼び出しをcallではなくjmp命令で行う最適化。</li> |
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
613 </ul> |
73 | 614 <li><small>以下のソースの場合 関数g から関数f へjmp命令で処理が移る。</small></li> |
71 | 615 <br> |
69
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
616 <table width=100%> |
71 | 617 <tr class="srctr"> |
618 <td width=50%> | |
73 | 619 <!-- |
71 | 620 <pre class="srcbox"> |
69
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
621 int main() { |
70
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
622 int num = a(2); |
69
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
623 printf("main:num=%d\n",num); |
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
624 return 0; |
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
625 } |
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
626 int a(int num) { |
70
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
627 return b(num+5); |
69
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
628 } |
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
629 int b(int num) { |
70
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
630 printf("b:a = %d\n",num); |
69
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
631 return num+3; |
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
632 } |
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
633 </pre> |
73 | 634 --> |
635 <pre class="srcbox"> | |
636 | |
637 void f(int a, int b) { | |
638 printf("f: a=%d b=%d\n",a,b); | |
639 return ; | |
640 } | |
641 void g(int a, int b){ | |
642 printf("g: a=%d b=%d\n",a,b); | |
643 f(a,b); | |
644 return; | |
645 } | |
646 | |
647 int main() { | |
648 g(3,4); | |
649 return 0; | |
650 } | |
651 | |
652 </pre> | |
69
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
653 </td> |
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
654 <td class="center"> |
71 | 655 <img src="./pix/continuation.png" style="height:100%;"> |
69
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
656 </td> |
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
657 </tr> |
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
658 </table> |
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
659 </div> |
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
660 <!-- PAGE --> |
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
661 <div class="slide"> |
71 | 662 <h1>CbCの実装:TCE(末尾除去)の動作</h1> |
70
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
663 <li>スタック:呼び出し元関数と同じ範囲を使うことになる。</li> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
664 <table width=100% border=1> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
665 <td> |
69
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
666 <p class="center"> |
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
667 <img src="./pix/tce.png" style="height: 6em;"> |
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
668 </p> |
70
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
669 </td> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
670 <td> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
671 <ul> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
672 <li><small>func_bの引数はfunc_aのスタックに上書する</small></li> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
673 <li><small>func_bの為にスタックポインタは伸ばされない</small></li> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
674 </ul> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
675 </td> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
676 </table> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
677 <li class="incremental">CbCにおけるコードセグメントへの継続はこのTCEを用いて実装されている。</li> |
69
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
678 <li class="incremental">TCEにかかるには条件が幾つかある。</li> |
63
3cc4a8603489
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
62
diff
changeset
|
679 </div> |
3cc4a8603489
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
62
diff
changeset
|
680 <!-- PAGE --> |
3cc4a8603489
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
62
diff
changeset
|
681 <div class="slide"> |
71 | 682 <h1>CbCの実装:TCE(末尾除去)</h1> |
69
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
683 <li>TCEにかかる条件</li> |
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
684 <ol> |
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
685 <li>caller側とcallee側の戻値の型の一致している。</li> |
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
686 <li>関数呼び出しがリターン直前に行われている。</li> |
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
687 <li>呼出先関数の引数に用いられるスタックサイズが呼出元のそれより少ない。</li> |
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
688 <li>引数の並びのコピーに上書きがない。</li> |
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
689 </ol> |
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
690 </div> |
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
691 <!-- PAGE --> |
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
692 <div class="slide"> |
71 | 693 <h1>CbCの実装:TCE(末尾除去)</h1> |
69
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
694 <li>条件を回避する為以下の実装にする。</li> |
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
695 <ol> |
70
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
696 <li>型はvoid型で統一する。</li> |
69
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
697 <li>gotoの直後にreturnを置く。</li> |
73 | 698 <li>スタックサイズは固定にする。</li> |
69
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
699 <li>引数は一旦、一時変数にコピーする。</li> |
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
700 </ol> |
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
701 </div> |
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
702 <!-- PAGE --> |
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
703 <div class="slide"> |
71 | 704 <h1>CbCの実装:TCE(末尾除去)</h1> |
70
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
705 <li>TCEの条件はexpand_call関数で調べられる。</li> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
706 <ul> |
73 | 707 <li>expand_call関数</li> |
708 <ul> | |
70
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
709 <li>Treeで表された関数からRTLを生成する関数</li> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
710 <li>スタックの領域確保、引数の格納、関数へのcall命令の発行が行わる。</li> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
711 <li>try_taill_call(変数名)フラグがあり、TCEの条件に合わなければこのフラグが落とされる。</li> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
712 </ul> |
73 | 713 <li class="incremental">具体的な実装内容</li> |
70
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
714 <ul> |
73 | 715 <li class="incremental">try_tail_callフラグを落とすif文の条件をかわすようにする。</li> |
716 <li class="incremental">try_tail_callフラグを立たせる処理の追加。</li> | |
70
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
717 </ul> |
73 | 718 <ul> |
719 | |
70
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
720 </div> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
721 <!-- PAGE --> |
69
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
722 <!-- |
70
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
723 <div class="slide"> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
724 <h1>CbCの実装:TCE</h1> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
725 <li>TCEにかかる条件</li> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
726 <ul> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
727 <li>try_tail_callフラグを落とさせない。</li> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
728 </ul> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
729 <li></li> |
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
730 </div> |
69
9dc6013b0559
modify explanation of tce
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
68
diff
changeset
|
731 --> |
54 | 732 <!-- PAGE --> |
733 <div class="slide"> | |
71 | 734 <h1>CbCの実装:TCE(末尾除去)</h1> |
72
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
735 <li>try_tail_callフラグが落とされる部分</li> |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
736 <table width=100%> |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
737 <tr class="srctr"> |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
738 <td> |
71 | 739 <pre class="srcbox"> |
740 if (currently_expanding_call++ != 0 | |
741 || ((!fndecl || !CbC_IS_CODE_SEGMENT (TREE_TYPE (fndecl))) | |
742 && !flag_optimize_sibling_calls) | |
743 || args_size.var | |
744 || dbg_cnt (tail_call) == false) | |
745 try_tail_call = 0; | |
746 </pre> | |
72
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
747 </td> |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
748 </tr> |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
749 </table> |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
750 <li><string>!CbC_IS_CODE_SEGMENT (TREE_TYPE (fndecl)により条件を回避</string></li> |
71 | 751 </div> |
752 <!-- PAGE --> | |
753 <div class="slide"> | |
72
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
754 <h1>CbCの実装:TCE(末尾除去)</h1> |
71 | 755 <li>try_tail_callフラグが落とされる部分</li> |
72
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
756 <table width=100%> |
71 | 757 <tr class="srctr"> |
758 <td class="srctd"> | |
759 <pre class="srcbox"> | |
760 if ( | |
761 #ifdef HAVE_sibcall_epilogue | |
762 !HAVE_sibcall_epilogue | |
763 #else | |
764 1 | |
765 #endif | |
766 || !try_tail_call | |
767 || structure_value_addr != NULL_RTX | |
768 #ifdef REG_PARM_STACK_SPACE | |
769 || (OUTGOING_REG_PARM_STACK_SPACE (funtype) | |
770 != OUTGOING_REG_PARM_STACK_SPACE (TREE_TYPE (current_function_decl))) | |
771 || (reg_parm_stack_space != REG_PARM_STACK_SPACE (fndecl)) | |
772 #endif | |
773 || !targetm.function_ok_for_sibcall (fndecl, exp) | |
774 || (flags & (ECF_RETURNS_TWICE | ECF_NORETURN)) | |
775 || TYPE_VOLATILE (TREE_TYPE (TREE_TYPE (addr))) | |
776 || (fndecl && decl_function_context (fndecl) == current_function_decl) | |
777 || args_size.constant > (crtl->args.size | |
778 - crtl->args.pretend_args_size) | |
779 || (targetm.calls.return_pops_args (fndecl, funtype, args_size.constant) | |
780 != targetm.calls.return_pops_args (current_function_decl, | |
781 TREE_TYPE (current_function_decl), | |
782 crtl->args.size)) | |
783 || !lang_hooks.decls.ok_for_sibcall (fndecl)) | |
784 try_tail_call = 0; | |
785 </pre> | |
786 </td> | |
787 </tr> | |
788 </table> | |
72
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
789 <li><small>引数のスタックサイズ、関数の型のチェックが行われる。</small></li> |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
790 </div> |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
791 <!-- PAGE --> |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
792 <div class="slide"> |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
793 <h1>CbCの実装:TCE(末尾除去)</h1> |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
794 <li>try_tail_callフラグが落とされる部分</li> |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
795 <table width=100% > |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
796 <tr class="srctr"> |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
797 <td class="srctd"> |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
798 <pre class="srcbox" style=""> |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
799 /* Check if caller and callee disagree in promotion of function |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
800 return value. */ |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
801 #ifndef noCbC |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
802 if (try_tail_call && (!fndecl || !CbC_IS_CODE_SEGMENT (TREE_TYPE (fndecl)))) |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
803 #else |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
804 if (try_tail_call) |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
805 #endif |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
806 { |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
807 enum machine_mode caller_mode, caller_promoted_mode; |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
808 enum machine_mode callee_mode, callee_promoted_mode; |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
809 int caller_unsignedp, callee_unsignedp; |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
810 tree caller_res = DECL_RESULT (current_function_decl); |
71 | 811 |
72
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
812 caller_unsignedp = TYPE_UNSIGNED (TREE_TYPE (caller_res)); |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
813 caller_mode = DECL_MODE (caller_res); |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
814 callee_unsignedp = TYPE_UNSIGNED (TREE_TYPE (funtype)); |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
815 callee_mode = TYPE_MODE (TREE_TYPE (funtype)); |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
816 caller_promoted_mode |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
817 = promote_function_mode (TREE_TYPE (caller_res), caller_mode, |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
818 &caller_unsignedp, |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
819 TREE_TYPE (current_function_decl), 1); |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
820 callee_promoted_mode |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
821 = promote_function_mode (TREE_TYPE (funtype), callee_mode, |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
822 &callee_unsignedp, |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
823 funtype, 1); |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
824 if (caller_mode != VOIDmode |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
825 && (caller_promoted_mode != callee_promoted_mode |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
826 || ((caller_mode != caller_promoted_mode |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
827 || callee_mode != callee_promoted_mode) |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
828 && (caller_unsignedp != callee_unsignedp |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
829 || GET_MODE_BITSIZE (caller_mode) |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
830 < GET_MODE_BITSIZE (callee_mode))))) |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
831 try_tail_call = 0; |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
832 } |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
833 </pre> |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
834 </td> |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
835 </tr> |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
836 </table> |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
837 <li>関数の型のチェックが行われる。</li> |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
838 </div> |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
839 <!-- PAGE --> |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
840 <div class="slide"> |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
841 <h1>CbCの実装:TCE(末尾除去)</h1> |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
842 <li>try_tail_callフラグ矯正付与のソースコード</li> |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
843 <table width=100%> |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
844 <tr class="srctr"> |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
845 <td> |
73 | 846 <pre class="srcbox"> |
72
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
847 #ifndef noCbC |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
848 if (fndecl && CbC_IS_CODE_SEGMENT (TREE_TYPE (fndecl)) |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
849 && CbC_IS_CODE_SEGMENT (TREE_TYPE (current_function_decl)) |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
850 && try_tail_call == 0) |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
851 { |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
852 location_t loc = EXPR_LOCATION (exp); |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
853 char *name_callee = IDENTIFIER_POINTER(DECL_NAME(fndecl)); |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
854 warning_at (loc, 0, "transition to code segment \"%s\" with CbC goto, but tail call optimization was cut.", |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
855 name_callee); |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
856 try_tail_call = 1; |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
857 } |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
858 #endif |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
859 </pre> |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
860 </td> |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
861 </tr> |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
862 </table> |
73 | 863 <ul> |
864 <li>try_tail_callフラグが落とされた場合warningを出してフラグを立たせる。 | |
865 <br><small>(最適化の矯正付与)</small></li> | |
866 </ul> | |
72
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
867 </div> |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
868 <!-- PAGE --> |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
869 <div class="slide"> |
73 | 870 <h1>CbCの実装:TCE(末尾除去)の実装について</h1> |
72
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
871 <ul> |
74 | 872 <li>以前はexpand_call関数を元にしたexpand_cbc_goto関数を作り条件を回避させていた。</li> |
72
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
873 <li>だがその方法だとexpand_call関数の修正にも合わせていく必要もあり管理も面倒であった。</li> |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
874 <li>しかしtry_tail_callフラグを落とさせない方法にすることでexpand_cbc_goto関数はいらなくなり、管理が容易くなった。</li> |
48de60dd51d1
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
71
diff
changeset
|
875 </ul> |
63
3cc4a8603489
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
62
diff
changeset
|
876 </div> |
3cc4a8603489
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
62
diff
changeset
|
877 <!-- PAGE --> |
73 | 878 <div class="slide"> |
879 <h1>CbCの実装</h1> | |
74 | 880 <li>CbCの基本機能を実現する為の実装は以上の2つになる。</li> |
73 | 881 <ul> |
882 <li>シンタックスの追加</li> | |
883 <li>末尾除去によるコードセグメントへjmp命令での処理の移り</li> | |
884 </ul> | |
885 <li class="incremental">ここからはCbCの機能の拡張になる。</li> | |
886 </div> | |
887 <!-- PAGE --> | |
64 | 888 <!-- |
63
3cc4a8603489
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
62
diff
changeset
|
889 <div class="slide"> |
3cc4a8603489
modify explanation of TCE
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
62
diff
changeset
|
890 <h1>CbCの実装:環境付き継続</h1> |
62 | 891 <li>CbCにおけるCとの互換性を保つための機能。</li> |
892 <li>コードセグメントを呼び出したCの関数に戻ることができる。</li> | |
64 | 893 <li>論文における訂正</li> |
894 <li>『GCC 4.6 と Lion の組合せでは Closure は正しく動作していないことが分かった.』</li> | |
895 <ul> | |
896 <li>GCC 4.6 への CbC の実装のせいでクロージャがうまくできていなかったことが判明。</li> | |
897 <li>GCC 4.6 と Lion でのクロージャは特に問題はない。</li> | |
898 </ul> | |
899 </div> | |
900 --> | |
901 <!-- PAGE --> | |
902 <!-- | |
903 <div class="slide"> | |
904 <h1>環境付き継続:論文におけるクロージャの問題の訂正</h1> | |
905 <p><small>『GCC 4.6とLionの組み合わせではclosureは正しく動作してないことが分かった。』<br> | |
906 とあるが、これはCbCの実装でTCEを強制的に立てることが原因であったことを訂正させて頂きます。</small></p> | |
907 </div> | |
908 --> | |
909 <!-- PAGE --> | |
910 <div class="slide"> | |
73 | 911 <h1>CbCの実装:引数渡し</h1> |
912 <li>GCC版コンパイラー開発当初、コンパイルしたCbCのプログラムはMicro-C版に速度面で勝てなかった。</li> | |
913 <ul> | |
914 <li class="incremental">Micro-Cでは関数呼び出しの際にできるだけレジスタを使うようにしていた。</li> | |
915 </ul> | |
916 <li class="incremental">そこで、GCC版CbCコンパイラの引数渡しもできるだけレジスタで行うことに。</li> | |
917 </div> | |
918 <!-- PAGE --> | |
919 <div class="slide"> | |
920 <h1>CbCの実装:引数渡し(fastcall)</h1> | |
921 <h2>fastcall</h2> | |
922 <ul> | |
923 <li>i386 において関数呼び出しの際、引数渡しをできるだけレジスタを用いるGCCの拡張機能。</li> | |
924 <li>関数に『__attribute__ ((fastcall))』をつけることで使えるようになる。</li> | |
925 </ul> | |
926 <li>__codeで宣言された関数は自動でfastcall属性が付与されるように以下のコードを追加。</li> | |
927 <small> | |
928 <pre> | |
929 if(!TARGET_64BIT) { | |
930 attrs = build_tree_list (get_identifier("fastcall"), NULL_TREE); | |
931 declspecs_add_attrs(specs, attrs); | |
932 } | |
933 </pre> | |
934 </small> | |
935 <p><small>Intel64 ではレジスタが増えている為、fastcallは標準でつくようになっている。</small></p> | |
936 </div> | |
937 <!-- PAGE --> | |
938 <div class="slide"> | |
939 <h1>CbCの実装:引数渡し</h1> | |
940 <ul> | |
941 <li>fastcall属性の付与によりMicro-C版に速度で勝るようになった。</li> | |
942 <li></li> | |
943 </ul> | |
944 <table width=100% border=1 class="center"> | |
945 <caption>引数渡しに使われるレジスタの数(gcc)</caption> | |
946 <tr> | |
947 <td>arch</td> | |
948 <td>int(整数型)</td> | |
949 <td>float(浮動小数点型)</td> | |
950 <td>double(浮動小数点型)</td> | |
951 </tr> | |
952 <tr> | |
953 <td>i386</td> | |
954 <td>2</td> | |
955 <td>0<br>(stackを使用)</td> | |
956 <td>0<br>(stackを使用)</td> | |
957 </tr> | |
958 <tr> | |
959 <td>x86_64</td> | |
960 <td>6</td> | |
961 <td>8</td> | |
962 <td>8</td> | |
963 </tr> | |
964 </table> | |
965 </div> | |
966 <!-- PAGE --> | |
967 <div class="slide"> | |
64 | 968 <h1>CbCの実装:環境付き継続</h1> |
70
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
969 <ul> |
64 | 970 <li>CbCにおけるCとの互換性を保つための機能。コードセグメントを呼び出したCの関数に戻ることができる。</li> |
971 <li>__returnキーワードを引数に渡すことで使うことができる。</li> | |
70
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
972 </ul> |
64 | 973 <li>以下の使い方の場合は1を返す。</li> |
71 | 974 <table border=1 width=100%> |
975 <td> | |
64 | 976 <small> |
71 | 977 <pre class="srcbox"> |
64 | 978 __code c1(__code ret(int,void *),void *env) { |
979 goto ret(1,env); | |
980 } | |
981 int main() { | |
982 goto c1(__return, __environment); | |
983 } | |
984 </pre> | |
71 | 985 </small> |
986 </td> | |
987 </table> | |
988 <p><small>__environmentキーワードは関数の環境を保持する。</small></p> | |
54 | 989 </div> |
990 <!-- PAGE --> | |
991 <div class="slide"> | |
64 | 992 <h1>CbCの実装:環境付き継続</h1> |
74 | 993 <!-- |
73 | 994 <li><small>生成しているコードと生成する為のコード</small></li> |
74 | 995 --> |
73 | 996 <table border=1 width=100%> |
997 <tr> | |
998 <td><small>生成しているコード</small></td> | |
999 <td><small>生成する為のコード</small></td> | |
1000 </tr> | |
1001 <tr class="srctr"> | |
1002 <td width=50% class="srctd"> | |
1003 <pre class="srcbox" style="width:25em;"> | |
64 | 1004 |
74 | 1005 //goto c1(__return, __environment); |
68
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
1006 goto c1(({ |
64 | 1007 __label__ _cbc_exit0; |
1008 static int retval; | |
68
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
1009 void _cbc_internal_return(int retval_, void *_envp) { |
64 | 1010 retval = retval_; |
68
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
1011 goto _cbc_exit0; |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
1012 } |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
1013 if (0) { |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
1014 _cbc_exit0: |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
1015 return retval; |
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
1016 } |
64 | 1017 _cbc_internal_return; |
68
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
1018 }), __environment); |
64 | 1019 </pre> |
73 | 1020 </td> |
1021 <td width=50% class="srctd"> | |
74 | 1022 <img src="./pix/STATEMENT_LIST_1.png" style="height: 10em;"> |
1023 </td> | |
1024 </tr> | |
1025 </table> | |
1026 <li><small>retval変数の型は継続を行った関数と同じ戻値の型となる。</small></li> | |
1027 <!-- | |
1028 <li class="incremental">上記のコードをGCC内で生成すると次のようなTreeができる。</li> | |
1029 --> | |
1030 </div> | |
1031 <!-- PAGE --> | |
1032 <div class="slide"> | |
1033 <h1>CbCの実装:環境付き継続</h1> | |
1034 <table border=1 width=100%> | |
1035 <tr> | |
1036 <td width=50%><small>生成されるTree</small></td> | |
1037 <td width=50%><small>生成する為のコード</small></td> | |
1038 </tr> | |
1039 <tr class="srctr"> | |
1040 <td class="srctd"> | |
1041 <img src="./pix/STATEMENT_LIST_1.png" style="height: 10em;"> | |
1042 </td> | |
1043 <td class="srctd"> | |
73 | 1044 <pre class="srcbox" style="width:25em;"> |
74 | 1045 |
73 | 1046 case RID_CbC_RET: |
64 | 1047 { |
1048 tree value, stmt, label, tlab, decl; | |
1049 c_parser_consume_token (parser); | |
1050 | |
1051 stmt = c_begin_stmt_expr (); | |
1052 cbc_return_f = c_parser_peek_token (parser)->value; | |
1053 location_t location = c_parser_peek_token (parser)->location; | |
1054 | |
1055 /* create label. (__label__ _cbc_exit0;) */ | |
1056 label = get_identifier ("_cbc_exit0"); | |
1057 tlab = declare_label (label); | |
1058 C_DECLARED_LABEL_FLAG (tlab) = 1; | |
1059 add_stmt (build_stmt (location, DECL_EXPR, tlab)); | |
1060 | |
1061 /* declare retval. (int retval;) */ | |
1062 tree decl_cond = | |
1063 build_decl (location, VAR_DECL, get_identifier ("retval"), | |
1064 TREE_TYPE (TREE_TYPE (current_function_decl))); | |
1065 TREE_STATIC (decl_cond) = 1; | |
1066 TREE_USED (decl_cond) = 1; | |
1067 | |
1068 /* Use thread-local */ | |
1069 DECL_TLS_MODEL (decl_cond) = decl_default_tls_model (decl_cond); | |
1070 DECL_NONLOCAL (decl_cond) = 1; | |
1071 add_stmt (build_stmt(location, DECL_EXPR, pushdecl (decl_cond))); | |
1072 | |
1073 /* define nested function. */ | |
1074 decl = | |
1075 cbc_finish_nested_function (location, label, decl_cond); | |
1076 TREE_USED(decl) = 1; | |
1077 | |
1078 /* define if-ed goto label and return statement. */ | |
1079 cbc_finish_labeled_goto (location, label, decl_cond); | |
1080 | |
1081 /* get pointer to nested function. */ | |
1082 value = build_addr (decl , current_function_decl); | |
1083 TREE_USED (current_function_decl) = 1; | |
1084 SET_EXPR_LOCATION (value, location); | |
1085 add_stmt (value); | |
1086 | |
1087 TREE_SIDE_EFFECTS (stmt) = 1; | |
1088 expr.value = c_finish_stmt_expr (location, stmt); | |
1089 expr.original_code = ERROR_MARK; | |
1090 } | |
74 | 1091 </pre> |
73 | 1092 </td> |
1093 </tr> | |
74 | 1094 </table> |
64 | 1095 <!-- |
1096 <small> | |
1097 <pre> | |
1098 ({ | |
1099 __label__ _cbc_exit0; | |
1100 static int retval; | |
1101 void _cbc_internal_return(int retval_, void *_envp){ | |
1102 retval = retval_; | |
1103 goto _cbc_exit0; } | |
1104 if (0) { _cbc_exit0: | |
1105 return retval; } | |
1106 _cbc_internal_return; | |
1107 }), | |
1108 </pre> | |
1109 </small> | |
1110 --> | |
1111 </div> | |
1112 <!-- PAGE --> | |
1113 <div class="slide"> | |
1114 <h1>環境付き継続:実装の問題</h1> | |
1115 <ul> | |
1116 <li>リターンするretval変数が重要になってくる。</li> | |
1117 <li>retval変数のデータをどうやって確保するか。</li> | |
1118 </ul> | |
1119 <li>次の方法が考えられる。</li> | |
1120 <ul> | |
1121 <li>クロージャでの確保</li> | |
1122 <li>staticでの確保</li> | |
1123 <li>static thread local storage(tls)を用いての確保</li> | |
1124 </ul> | |
1125 </div> | |
1126 <!-- PAGE --> | |
1127 <div class="slide"> | |
1128 <h1>環境付き継続:実装の問題</h1> | |
1129 <li>クロージャでの実装</li> | |
54 | 1130 <ul> |
64 | 1131 <li>クロージャにしてスタックに値を確保する。</li> |
1132 <li></li> | |
1133 </ul> | |
1134 <li>問題点</li> | |
1135 <ul> | |
1136 <li class="incremental">しかしCbCではスタックの値は破棄されていく。</li> | |
1137 <li class="incremental">その為スタックに値を確保するのは好ましくない。</li> | |
1138 </ul> | |
1139 </div> | |
1140 <!-- PAGE --> | |
1141 <div class="slide"> | |
1142 <h1>環境付き継続:実装の問題</h1> | |
1143 <li>staticでの実装</li> | |
1144 <ul> | |
1145 <li>静的に値を確保することでスタック破棄の影響を受けない。</li> | |
1146 </ul> | |
1147 <li>問題点</li> | |
1148 <ul> | |
1149 <li class="incremental">マルチスレッドのプログラムに対応できない。</li> | |
1150 <li class="incremental">値を返し切る前に別スレッドによって値が書き換えられる可能性がある。</li> | |
54 | 1151 </ul> |
64 | 1152 </div> |
1153 <!-- PAGE --> | |
1154 <div class="slide"> | |
1155 <h1>環境付き継続:実装の問題</h1> | |
1156 <li>static tlsでの実装</li> | |
1157 <ul> | |
1158 <li>スレッド毎に静的に値を確保する。</li> | |
1159 </ul> | |
1160 <li>現在はこの方法で実装を行なっている。</li> | |
1161 <li>しかし、最適化にかけると正しい値が返ってこない。 | |
1162 <br>(恐らくTreeの生成の部分が間違っている。)</li> | |
1163 </div> | |
1164 <!-- PAGE --> | |
1165 <div class="slide"> | |
1166 <h1>環境付き継続:その他の実装方法</h1> | |
1167 <ul> | |
1168 <li>setjmpでの実装</li> | |
1169 <ul> | |
1170 <li>setjmpを行うTreeを生成するのが少し手間になる。</li> | |
1171 <li>int型の戻値しか得られない。</li> | |
1172 </ul> | |
1173 <li>戻値を入れるレジスタを明示的に指定する。</li> | |
1174 <ul> | |
1175 <li>まだ実装を試していない。</li> | |
1176 </ul> | |
1177 </ul> | |
54 | 1178 </div> |
1179 <!-- PAGE --> | |
1180 <div class="slide"> | |
68
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
1181 <h1>CbCの機能の拡張:__rectype の実装</h1> |
57
ce844f6c504d
modify __rectype
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1182 <li>通常、関数の引数に関数ポインタを渡した際は以下の様に使われる。</li> |
ce844f6c504d
modify __rectype
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1183 <small> |
ce844f6c504d
modify __rectype
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1184 <pre> |
ce844f6c504d
modify __rectype
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1185 void factorial(int n, int result, void(*print)()){ |
ce844f6c504d
modify __rectype
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1186 : |
ce844f6c504d
modify __rectype
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1187 (*print)(n,result,print,exit1, envp); |
ce844f6c504d
modify __rectype
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1188 } |
ce844f6c504d
modify __rectype
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1189 </pre> |
ce844f6c504d
modify __rectype
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1190 </small> |
70
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
1191 <li>以下の様に引数に()をつけて受けてることをやめたい。</li> |
57
ce844f6c504d
modify __rectype
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1192 <small> |
ce844f6c504d
modify __rectype
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1193 <pre> |
ce844f6c504d
modify __rectype
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1194 void factorial(int n, int result, void *print){ |
ce844f6c504d
modify __rectype
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1195 : |
70
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
1196 void(*print)(n,result,print,exit1, envp); |
57
ce844f6c504d
modify __rectype
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1197 } |
ce844f6c504d
modify __rectype
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1198 </pre> |
ce844f6c504d
modify __rectype
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1199 </small> |
54 | 1200 </div> |
1201 <!-- PAGE --> | |
1202 <div class="slide"> | |
68
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
1203 <h1>CbCの機能の拡張:__rectype の実装</h1> |
57
ce844f6c504d
modify __rectype
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1204 <li>そこで、__rectype という予約後を作り、以下の宣言を行えるようにした。</li> |
ce844f6c504d
modify __rectype
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1205 <pre> |
ce844f6c504d
modify __rectype
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1206 __code factorial(int n, int result, __rectype *print) { |
ce844f6c504d
modify __rectype
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1207 : |
70
79894ca66a9a
modify explanation of GCC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
69
diff
changeset
|
1208 goto (*print)(n,result,print,exit1, envp); |
57
ce844f6c504d
modify __rectype
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1209 } |
ce844f6c504d
modify __rectype
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
55
diff
changeset
|
1210 </pre> |
54 | 1211 </div> |
1212 <!-- PAGE --> | |
1213 <div class="slide"> | |
68
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
1214 <h1>CbCの機能の拡張:selftype</h1> |
64 | 1215 <h2>selftypeの実装</h2> |
1216 <li>以下の宣言が行えるようにしたい。</li> | |
1217 <small> | |
1218 <pre> | |
1219 typedef sturct node { | |
1220 selftype *left; | |
1221 selftype *right; | |
1222 int num; | |
1223 }*NODE | |
1224 </pre> | |
1225 <p>selftype は struct node を指す。</p> | |
1226 </small> | |
1227 <ul> | |
1228 <li>上記の構文は実装を行う予定である。</li> | |
1229 </ul> | |
1230 </div> | |
1231 <!-- PAGE --> | |
1232 <div class="slide"> | |
66
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
1233 <h1>Micro-Cとの比較</h1> |
68
1399414ea3f6
modify explanation of Generic Tree
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
66
diff
changeset
|
1234 <li>Micro-C,GCC-4.4とGCC-4.6のCbCコンパイラでコンパイルしたプログラムの実行の速度</li> |
66
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
1235 <table width=100% class="center"> |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
1236 <td> |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
1237 <img src="./pix/mac_conv.png"> |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
1238 </td> |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
1239 <td> |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
1240 <img src="./pix/linux_conv.png"> |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
1241 </td> |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
1242 </table> |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
1243 <li>GCC版の最適化無しの場合、引数を全て一時変数に代入するという処理が入る。 |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
1244 その為に明らかに遅くなっていることが分かる。</li> |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
1245 <li>だがGCCの最適化有りの場合はMicro-C版よりも早い。</li> |
54 | 1246 </div> |
1247 <!-- PAGE --> | |
64 | 1248 <div class="slide"> |
1249 <h1>まとめ</h1> | |
66
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
1250 <ul> |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
1251 <li>今回GCC版CbCコンパイラのアップデートを行った。</li> |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
1252 <li>TCEにかかる判定の部分と環境付き継続の実装の修正を行った。 |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
1253 <br>おかげで、以前より楽な管理ができる実装にすることができた。</li> |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
1254 <li>後は環境付き継続の最適化の問題の修正とselftypeの実装を行う。</li> |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
1255 <li>全ての実装を終えたらGCC版CbCコンパイラの実装はアップデートを行なっていくだけとなる。</li> |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
1256 </ul> |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
1257 </div> |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
1258 <!-- PAGE --> |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
1259 <div class="slide"> |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
1260 <h1>今後の予定</h1> |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
1261 <ul> |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
1262 <li>CbCを用いたプログラムの作成</li> |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
1263 <ul> |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
1264 <li>CbCによるタスクマネージャの作成</li> |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
1265 </ul> |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
1266 <li>llvmへのCbCの実装</li> |
26a3713b2989
modify explanation of CbC
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
64
diff
changeset
|
1267 </ul> |
64 | 1268 </div> |
1269 <!-- PAGE --> | |
54 | 1270 </div> |
1271 </body> | |
1272 </html> |