Created
December 15, 2013 14:11
-
-
Save agrif/7973490 to your computer and use it in GitHub Desktop.
a quick llvm-backed compiled lisp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ; lisp source file | |
| (defun incr (x) | |
| (+ x 1)) | |
| (defun main () | |
| (incr 42)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ; LLVM IR | |
| ; ModuleID = 'test' | |
| define i32 @incr(i32 %x) { | |
| entry: | |
| %0 = add i32 %x, 1 | |
| ret i32 %0 | |
| } | |
| define i32 @main() { | |
| entry: | |
| %0 = call i32 @incr(i32 42) | |
| ret i32 %0 | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # GNU AS source (from llc) | |
| .file "<stdin>" | |
| .text | |
| .globl incr | |
| .align 16, 0x90 | |
| .type incr,@function | |
| incr: # @incr | |
| .cfi_startproc | |
| # BB#0: # %entry | |
| leal 1(%rdi), %eax | |
| ret | |
| .Ltmp0: | |
| .size incr, .Ltmp0-incr | |
| .cfi_endproc | |
| .globl main | |
| .align 16, 0x90 | |
| .type main,@function | |
| main: # @main | |
| .cfi_startproc | |
| # BB#0: # %entry | |
| pushq %rax | |
| .Ltmp2: | |
| .cfi_def_cfa_offset 16 | |
| movl $42, %edi | |
| callq incr | |
| popq %rdx | |
| ret | |
| .Ltmp3: | |
| .size main, .Ltmp3-main | |
| .cfi_endproc | |
| .section ".note.GNU-stack","",@progbits |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment