changeset 1:f516c12e5232

update
author mir3636
date Sat, 11 Feb 2017 18:23:22 +0900
parents 30a433a94a9a
children 72e058e7e594
files final_main/chapter4.tex final_main/main.aux final_main/main.dvi final_main/main.log final_main/main.lol final_main/main.pdf final_main/main.toc
diffstat 7 files changed, 67 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/final_main/chapter4.tex	Fri Feb 10 16:24:11 2017 +0900
+++ b/final_main/chapter4.tex	Sat Feb 11 18:23:22 2017 +0900
@@ -46,9 +46,54 @@
 
 局所変数でポインタを参照していると clang は生成する LLVM IR にオブジェクトの寿命を示す lifetime.start と lifetime.end を書き出す。
 
-ここでオブジェクトの lifetime の終わりを示す lifetime.end が tail call の後に書き出されてしまうことにより、tail call の際に局所変数が解放されておらず lifetime が残っているので tail call が無視されてしまう。
+ここでリスト\ref{ir_b}のようにオブジェクトの lifetime の終わりを示す lifetime.end が tail call の後に書き出されてしまうことにより、tail call の際に局所変数が解放されておらず lifetime が残っているので tail call が無視されてしまう。
 
 しかし CbC では継続を行った後、継続前の Code Segment に戻ることはないので局所変数の解放は継続前に行っても良い。
 そこで lifetime.end を tail call の直前で生成を行うことで tail call を出すようにした。
 
+修正後に生成された LLVM IR コード(リスト\ref{ir_a})では tail call の直前に生成された。
 
+\begin{lstlisting}[frame=lrbt,label=ir_a,caption={\footnotesize LLVM IR コード 修正前}]
+if.then:                                          ; preds = %entry
+  %code_stack = getelementptr inbounds %struct.Context, %struct.Context* %context, i64 0, i32 8
+  %4 = load %struct.stack*, %struct.stack** %code_stack, align 8, !tbaa !7
+  %next = getelementptr inbounds %struct.Context, %struct.Context* %context, i64 0, i32 0
+  %call1 = call i32 (%struct.stack*, i32*, ...) bitcast (i32 (...)* @stack_pop to i32 (%struct.stack*, i32*, ...)*)(%struct.stack* %4, i32* %next) #3
+  %5 = load i32, i32* %next, align 8, !tbaa !11
+  tail call fastcc void @meta(%struct.Context* nonnull %context, i32 %5) #3
+  br label %cleanup
+
+if.end:                                           ; preds = %entry
+  %6 = load %struct.stack*, %struct.stack** %node_stack, align 8, !tbaa !24
+  %call4 = call i32 (%struct.stack*, %struct.Node**, ...) bitcast (i32 (...)* @stack_push to i32 (%struct.stack*, %struct.Node**, ...)*)(%struct.stack*     %6, %struct.Node** nonnull %parent) #3
+  tail call fastcc void @meta(%struct.Context* nonnull %context, i32 18) #3
+  br label %cleanup
+
+cleanup:                                          ; preds = %if.end, %if.then
+  call void @llvm.lifetime.end(i64 8, i8* %0) #3
+  ret void
+\end{lstlisting}
+
+\begin{lstlisting}[frame=lrbt,label=ir_b,caption={\footnotesize LLVM IR コード 修正後}]
+if.then:                                          ; preds = %entry
+  %code_stack = getelementptr inbounds %struct.Context, %struct.Context* %context, i64 0, i32 8
+  %4 = load %struct.stack*, %struct.stack** %code_stack, align 8, !tbaa !7
+  %next = getelementptr inbounds %struct.Context, %struct.Context* %context, i64 0, i32 0
+  %call1 = call i32 (%struct.stack*, i32*, ...) bitcast (i32 (...)* @stack_pop to i32 (%struct.stack*, i32*, ...)*)    (%struct.stack* %4, i32* %next) #3
+  %5 = load i32, i32* %next, align 8, !tbaa !11
+  call void @llvm.lifetime.end(i64 8, i8* %0) #3
+  tail call fastcc void @meta(%struct.Context* nonnull %context, i32 %5) #3
+  br label %cleanup
+  
+if.end:                                           ; preds = %entry
+  %6 = load %struct.stack*, %struct.stack** %node_stack, align 8, !tbaa !24
+  %call4 = call i32 (%struct.stack*, %struct.Node**, ...) bitcast (i32 (...)* @stack_push to i32 (%struct.stack*, %    struct.Node**, ...)*)(%struct.stack* %6, %struct.Node** nonnull %parent) #3
+  call void @llvm.lifetime.end(i64 8, i8* %0) #3
+  tail call fastcc void @meta(%struct.Context* nonnull %context, i32 18) #3
+  br label %cleanup
+  
+cleanup:                                          ; preds = %if.end, %if.then
+  ret void
+\end{lstlisting}
+
+
--- a/final_main/main.aux	Fri Feb 10 16:24:11 2017 +0900
+++ b/final_main/main.aux	Sat Feb 11 18:23:22 2017 +0900
@@ -35,9 +35,13 @@
 \@writefile{lof}{\contentsline {figure}{\numberline {4.1}{\ignorespaces LLVM の 処理過程}}{8}}
 \newlabel{fig:llvmProcess}{{4.1}{8}}
 \@writefile{toc}{\contentsline {section}{\numberline {4.3}LLVM/clang のデバッグ}{8}}
-\@writefile{toc}{\contentsline {chapter}{\numberline {第5章}Context、stub の自動生成}{9}}
+\newlabel{ir_a}{{4.1}{8}}
+\@writefile{lol}{\contentsline {lstlisting}{\numberline {4.1}\relax \fontsize  {10}{12}\selectfont  \abovedisplayskip 10\p@ plus2\p@ minus5\p@ \abovedisplayshortskip \z@ plus3\p@ \belowdisplayshortskip 6\p@ plus3\p@ minus3\p@ \def \leftmargin \leftmargini \parsep 5\p@ plus2.5\p@ minus\p@ \topsep 10\p@ plus4\p@ minus6\p@ \itemsep 5\p@ plus2.5\p@ minus\p@ {\leftmargin \leftmargini \topsep 6\p@ plus2\p@ minus2\p@ \parsep 3\p@ plus2\p@ minus\p@ \itemsep \parsep }\belowdisplayskip \abovedisplayskip LLVM IR コード 修正前}{8}}
+\newlabel{ir_b}{{4.2}{9}}
+\@writefile{lol}{\contentsline {lstlisting}{\numberline {4.2}\relax \fontsize  {10}{12}\selectfont  \abovedisplayskip 10\p@ plus2\p@ minus5\p@ \abovedisplayshortskip \z@ plus3\p@ \belowdisplayshortskip 6\p@ plus3\p@ minus3\p@ \def \leftmargin \leftmargini \parsep 5\p@ plus2.5\p@ minus\p@ \topsep 10\p@ plus4\p@ minus6\p@ \itemsep 5\p@ plus2.5\p@ minus\p@ {\leftmargin \leftmargini \topsep 6\p@ plus2\p@ minus2\p@ \parsep 3\p@ plus2\p@ minus\p@ \itemsep \parsep }\belowdisplayskip \abovedisplayskip LLVM IR コード 修正後}{9}}
+\@writefile{toc}{\contentsline {chapter}{\numberline {第5章}Context、stub の自動生成}{10}}
 \@writefile{lof}{\addvspace {10\p@ }}
 \@writefile{lot}{\addvspace {10\p@ }}
-\@writefile{toc}{\contentsline {chapter}{\numberline {第6章}今後の課題}{10}}
+\@writefile{toc}{\contentsline {chapter}{\numberline {第6章}今後の課題}{11}}
 \@writefile{lof}{\addvspace {10\p@ }}
 \@writefile{lot}{\addvspace {10\p@ }}
Binary file final_main/main.dvi has changed
--- a/final_main/main.log	Fri Feb 10 16:24:11 2017 +0900
+++ b/final_main/main.log	Sat Feb 11 18:23:22 2017 +0900
@@ -1,4 +1,4 @@
-This is e-pTeX, Version 3.14159265-p3.7-160201-2.6 (utf8.euc) (TeX Live 2016) (preloaded format=platex 2017.2.4)  10 FEB 2017 13:06
+This is e-pTeX, Version 3.14159265-p3.7-160201-2.6 (utf8.euc) (TeX Live 2016) (preloaded format=platex 2017.2.4)  11 FEB 2017 18:04
 entering extended mode
  restricted \write18 enabled.
  %&-line parsing enabled.
@@ -212,21 +212,21 @@
  [] 
  []
 
-) (./chapter5.tex [8]
+[8]) (./chapter5.tex [9]
 第 5 章
-) (./chapter6.tex [9
+) (./chapter6.tex [10
 
 ]
 第 6 章
-) (./bibliography.tex [10
+) (./bibliography.tex [11
 
 ]
 
 LaTeX Warning: Empty `thebibliography' environment on input line 11.
 
-) (./thanks.tex [11
+) (./thanks.tex [12
 
-]) [12
+]) [13
 
 ] (./main.aux)
 
@@ -237,12 +237,12 @@
 
  ) 
 Here is how much of TeX's memory you used:
- 2276 strings out of 493683
- 31496 string characters out of 6149654
- 180243 words of memory out of 5000000
- 5821 multiletter control sequences out of 15000+600000
+ 2344 strings out of 493683
+ 32210 string characters out of 6149654
+ 378243 words of memory out of 5000000
+ 5889 multiletter control sequences out of 15000+600000
  14691 words of font info for 58 fonts, out of 8000000 for 9000
  929 hyphenation exceptions out of 8191
  26i,5n,49p,556b,1689s stack positions out of 5000i,500n,10000p,200000b,80000s
 
-Output written on main.dvi (16 pages, 29544 bytes).
+Output written on main.dvi (17 pages, 40364 bytes).
--- a/final_main/main.lol	Fri Feb 10 16:24:11 2017 +0900
+++ b/final_main/main.lol	Sat Feb 11 18:23:22 2017 +0900
@@ -1,3 +1,5 @@
 \contentsline {lstlisting}{\numberline {2.1}\relax \fontsize {10}{12}\selectfont \abovedisplayskip 10\p@ plus2\p@ minus5\p@ \abovedisplayshortskip \z@ plus3\p@ \belowdisplayshortskip 6\p@ plus3\p@ minus3\p@ \def \leftmargin \leftmargini \parsep 5\p@ plus2.5\p@ minus\p@ \topsep 10\p@ plus4\p@ minus6\p@ \itemsep 5\p@ plus2.5\p@ minus\p@ {\leftmargin \leftmargini \topsep 6\p@ plus2\p@ minus2\p@ \parsep 3\p@ plus2\p@ minus\p@ \itemsep \parsep }\belowdisplayskip \abovedisplayskip code segment の軽量継続}{2}
 \contentsline {lstlisting}{\numberline {2.2}環境付き継続}{3}
 \contentsline {lstlisting}{\numberline {3.1}stack の interface}{6}
+\contentsline {lstlisting}{\numberline {4.1}\relax \fontsize {10}{12}\selectfont \abovedisplayskip 10\p@ plus2\p@ minus5\p@ \abovedisplayshortskip \z@ plus3\p@ \belowdisplayshortskip 6\p@ plus3\p@ minus3\p@ \def \leftmargin \leftmargini \parsep 5\p@ plus2.5\p@ minus\p@ \topsep 10\p@ plus4\p@ minus6\p@ \itemsep 5\p@ plus2.5\p@ minus\p@ {\leftmargin \leftmargini \topsep 6\p@ plus2\p@ minus2\p@ \parsep 3\p@ plus2\p@ minus\p@ \itemsep \parsep }\belowdisplayskip \abovedisplayskip LLVM IR コード 修正前}{8}
+\contentsline {lstlisting}{\numberline {4.2}\relax \fontsize {10}{12}\selectfont \abovedisplayskip 10\p@ plus2\p@ minus5\p@ \abovedisplayshortskip \z@ plus3\p@ \belowdisplayshortskip 6\p@ plus3\p@ minus3\p@ \def \leftmargin \leftmargini \parsep 5\p@ plus2.5\p@ minus\p@ \topsep 10\p@ plus4\p@ minus6\p@ \itemsep 5\p@ plus2.5\p@ minus\p@ {\leftmargin \leftmargini \topsep 6\p@ plus2\p@ minus2\p@ \parsep 3\p@ plus2\p@ minus\p@ \itemsep \parsep }\belowdisplayskip \abovedisplayskip LLVM IR コード 修正後}{9}
Binary file final_main/main.pdf has changed
--- a/final_main/main.toc	Fri Feb 10 16:24:11 2017 +0900
+++ b/final_main/main.toc	Sat Feb 11 18:23:22 2017 +0900
@@ -11,5 +11,5 @@
 \contentsline {section}{\numberline {4.1}LLVM clang}{7}
 \contentsline {section}{\numberline {4.2}LLVM の基本構造}{7}
 \contentsline {section}{\numberline {4.3}LLVM/clang のデバッグ}{8}
-\contentsline {chapter}{\numberline {第5章}Context、stub の自動生成}{9}
-\contentsline {chapter}{\numberline {第6章}今後の課題}{10}
+\contentsline {chapter}{\numberline {第5章}Context、stub の自動生成}{10}
+\contentsline {chapter}{\numberline {第6章}今後の課題}{11}