From 9d8e17488decc9b383ee73dff3e054cfc428e9d5 Mon Sep 17 00:00:00 2001 From: Dimitar Trendafilov Date: Mon, 5 Oct 2020 22:10:48 +0300 Subject: Add more IR samples --- website/content/slides/01_dragons/_index.md | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/website/content/slides/01_dragons/_index.md b/website/content/slides/01_dragons/_index.md index 7892a65..916c25a 100644 --- a/website/content/slides/01_dragons/_index.md +++ b/website/content/slides/01_dragons/_index.md @@ -251,6 +251,37 @@ that is convenient for: ret i32 %tmp2 } +--- +### WebAssembly + +WebAssembly is actually an IR. + + (module + (func (export "add") (param $n1 i32) (param $n2 i32) (result i32) + get_local $n1 + get_local $n2 + i32.add + ) + ) + +--- +### .NET CIL + +- C#, F#, Basic (some versions), etc target the .NET virtual machine +- Common Intermediate Language + + .class public Foo + { + .method public static int32 Add(int32, int32) cil managed + { + .maxstack 2 + ldarg.0 // load the first argument; + ldarg.1 // load the second argument; + add // add them; + ret // return the result; + } + } + --- ### Back end -- cgit v1.3.1-23-gd82d