Permalink
Browse files

計算メインループが完成

  • Loading branch information...
1 parent a3c6af3 commit 38a15e3e1cc926d76e4278de38590b579b5bb199 @sile committed Nov 11, 2010
Showing with 35 additions and 0 deletions.
  1. +35 −0 sample/calc/main.ll
View
@@ -2,3 +2,38 @@
;;;;
;;;; [説明]
;;;;
+
+include(`type.inc')
+include(`global.inc')
+define i32 @main() {
+HEAD:
+ %init_obj = call %Object* @parse()
+ br label %LOOP
+
+LOOP:
+ %obj = phi %Object* [%init_obj, %HEAD], [%next_obj, %NEXT]
+ %end = icmp eq %Object* null, %obj
+ br i1 %end, label %END, label %NEXT
+
+NEXT:
+ call void @out.write_char(i8 61)
+ call void @out.write_char(i8 62)
+ call void @out.write_char(i8 32)
+ call void @pprint(%Object* %obj)
+ call void @out.newline()
+
+ %num = call i32 @eval_exp(%Object* %obj)
+ call void @out.write_char(i8 61)
+ call void @out.write_char(i8 61)
+ call void @out.write_char(i8 62)
+ call void @out.write_char(i8 32)
+ call void @out.write_int(i32 %num)
+ call void @out.newline()
+ call void @out.newline()
+
+ %next_obj = call %Object* @parse()
+ br label %LOOP
+
+END:
+ ret i32 0
+}

0 comments on commit 38a15e3

Please sign in to comment.