mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
Make fib be more real
llvm-svn: 413
This commit is contained in:
parent
fb626ffffe
commit
6efa48a664
17
test/fib.ll
17
test/fib.ll
@ -1,13 +1,7 @@
|
||||
|
||||
;; TODO:
|
||||
;; [ ] Get rid out outside class & begin stuff
|
||||
;; [ ] Allow global const pool to be expanded continually
|
||||
;; [ ] Support global variable declaration & definition
|
||||
;; [ ] Support function definition: %fib = prototype ulong (ulong)
|
||||
;; [x] Support Type definition
|
||||
|
||||
implementation
|
||||
|
||||
declare int "atoi"(sbyte *)
|
||||
|
||||
ulong "fib"(ulong %n)
|
||||
begin
|
||||
setlt ulong %n, 2 ; {bool}:0
|
||||
@ -26,18 +20,17 @@ RecurseCase:
|
||||
end
|
||||
|
||||
ulong "main"(int %argc, sbyte ** %argv)
|
||||
;; %n2 = int 1
|
||||
begin
|
||||
seteq int %argc, 2 ; {bool}:0
|
||||
br bool %0, label %HasArg, label %Continue
|
||||
HasArg:
|
||||
; %n1 = atoi(argv[1])
|
||||
;;; %n1 = add int 1, 1
|
||||
%n1 = add int 1, 1
|
||||
br label %Continue
|
||||
|
||||
Continue:
|
||||
;;; %n = phi int %n1, %n2
|
||||
%N = add ulong 1, 1 ;; TODO: CAST
|
||||
%n = phi int [%n1, %HasArg], [1, %0]
|
||||
%N = cast int %n to ulong
|
||||
%F = call ulong(ulong) %fib(ulong %N)
|
||||
ret ulong %F
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user