translating etc to llvm assembly
play

Translating ETC to LLVM Assembly Carl Ritson C.G.Ritson@kent.ac.uk - PowerPoint PPT Presentation

Translating ETC to LLVM Assembly Carl Ritson C.G.Ritson@kent.ac.uk School of Computing, University of Kent 2009 11 3 1983-1984 INMOS Transputer released. occam is born. 2009 11 3 1989 SGS Thompson


  1. Translating ETC to LLVM Assembly Carl Ritson C.G.Ritson@kent.ac.uk School of Computing, University of Kent 2009 年 11 月 3 日火曜日

  2. 1983-1984 INMOS Transputer released. occam is born. 2009 年 11 月 3 日火曜日

  3. 1989 SGS Thompson acquires INMOS. occam reaches version 2.1 (occ21). 2009 年 11 月 3 日火曜日

  4. 1993-1994 INMOS subsumed. Transputer and occam development ends. 2009 年 11 月 3 日火曜日

  5. 1995-1997 occam for All (Welch, BAE, Formal Systems, Marconi, etc) KRoC is born (octran, tranpc). 2009 年 11 月 3 日火曜日

  6. 2000-2003 occam- π (Welch, Barnes) tranx86 (Barnes) 2009 年 11 月 3 日火曜日

  7. 2004-2007 More occam- π (Welch, Barnes) The Transterpreter (Jacobsen, Jadud, Dimmich) 2009 年 11 月 3 日火曜日

  8. Native CCSP occ21 tranx86 Object kernel Code System Executable Linker ETC Native Source Execution object Libraries TVM plinker/slinker TVM Bytecode ETC Libraries 2009 年 11 月 3 日火曜日

  9. Native CCSP occ21 tranx86 Object kernel Code System Executable Linker llc ETC LLVM LLVM Native Source Execution object Converter Assembly Libraries TVM plinker/slinker TVM Bytecode ETC Libraries 2009 年 11 月 3 日火曜日

  10. Extended Transputer Code Targets 3-place stack machine, with workspace. Small set of RISC-like instructions with CISC secondaries. 2009 年 11 月 3 日火曜日

  11. LLVM Machine independent program representation. Generic analysis and optimisation passes. 2009 年 11 月 3 日火曜日

  12. Why LLVM? More control than C. Code generation for x86, x86-64, ARM, PPC, ... 2009 年 11 月 3 日火曜日

  13. LLVM Assembly Typed SSA-form with procedures and calling conventions. Obviates data flow and control flow graphs. 2009 年 11 月 3 日火曜日

  14. define i32 @cube (i32 %x) { %x_0 = mul i32 %x ,%x %x_1 = mul i32 %x_0,%x ret i32 %x_1 } 2009 年 11 月 3 日火曜日

  15. PROC foo (VAL INT x, y, CHAN INT out!) INT z: SEQ z := x + y out ! z : 2009 年 11 月 3 日火曜日

  16. .L0: AJW -1 -- allocate workspace LDL 2 -- load x LDL 3 -- load y ADD STL 0 -- store to z LDLP 0 -- load pointer to z LDL 4 -- load channel LDC 4 -- load size of INT OUT AJW 1 -- deallocate workspace RET 2009 年 11 月 3 日火曜日

  17. The Transformation Trace and numerate operand stack. Extract control flow into procedures. 2009 年 11 月 3 日火曜日

  18. .L0: AJW -1 LDL 2 -- => %reg_0 LDL 3 -- => %reg_1 ADD -- %reg_1, %reg_0 => %reg_2 STL 0 -- %reg_2 => () LDLP 0 -- => %reg_3 LDL 4 -- => %reg_4 LDC 4 -- => %reg_5 OUT -- %reg_5, %reg_4, %reg_3 => () AJW 1 RET 2009 年 11 月 3 日火曜日

  19. define void @O_foo (i8* %sched, i32* %wptr_0) { L0: ; AJW -1 %wptr_1 = getelementptr i32* %wptr_0, i32 -1 2009 年 11 月 3 日火曜日

  20. ; LDL 2 %tmp_0 = getelementptr i32* %wptr_1, i32 2 %reg_0 = load i32* %tmp_0 ; LDL 3 %tmp_1 = getelementptr i32* %wptr_1, i32 2 %reg_1 = load i32* %tmp_1 2009 年 11 月 3 日火曜日

  21. ; ADD { (reg_1, reg_0) => (reg_2) } %tmp_2 = call {i32, i1} @llvm.sadd.with.overflow.i32 (i32 %reg_0, i32 %reg_1) %reg_2 = extractvalue {i32, i1} %tmp_2, 0 %tmp_3 = extractvalue {i32, i1} %tmp_2, 1 2009 年 11 月 3 日火曜日

  22. br i1 %tmp_3, label %tmp_4_overflow_error, label %tmp_4_ok tmp_4_overflow_error: %tmp_5 = load i8** @C_0 ; “foo.occ” call void @etc_error_overflow (i8* %sched, i32* %wptr_1, i8* %tmp_5, i32 5) tmp_4_ok: ; STL 0 store i32 %reg_2, i32* %wptr_1 2009 年 11 月 3 日火曜日

  23. Control Flow Branching and blocking, via co-operate scheduling. Functions over workspaces, e.g. P = <f 1 ,f 2 ,f 3 ,...,f n >. 2009 年 11 月 3 日火曜日

  24. f 1 f 2 f n Process A Kernel Process B g 1 g 2 g m 2009 年 11 月 3 日火曜日

  25. Continuation Passing Style Collapses stack, obviates dependencies. Very appropriate for occam-like languages. 2009 年 11 月 3 日火曜日

  26. Run-time Simplification Kernel calls become native C calls. Run-time state more tractable. 2009 年 11 月 3 日火曜日

  27. mandelbrot KRoC Distribution 2009 年 11 月 3 日火曜日

  28. 2009 年 11 月 3 日火曜日

  29. 308% 249% tranx86 llvm plain llvm optimised 100% 2009 年 11 月 3 日火曜日

  30. spectralnorm Language Games 2009 年 11 月 3 日火曜日

  31. 161% 150% 100% tranx86 llvm plain llvm optimised 2009 年 11 月 3 日火曜日

  32. agents CCSP Comparisons 2009 年 11 月 3 日火曜日

  33. 104% 100% 79% tranx86 llvm plain llvm optimised 2009 年 11 月 3 日火曜日

  34. Benefits Simplifies: run-time, floating point, corner cases. Off-the-shelf optimisations improve performance. 2009 年 11 月 3 日火曜日

  35. Difficulties Unclear semantics of tail-calls (for CPS). Toolchain issues. 2009 年 11 月 3 日火曜日

  36. Future Work Porting, refactoring, bypass ETC. Add to LLVM support for this style of compilation. 2009 年 11 月 3 日火曜日

  37. Thanks Questions? EPSRC grant EP/D061822 2009 年 11 月 3 日火曜日

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend