Skip to content

Instantly share code, notes, and snippets.

@chriswailes
Created June 20, 2012 23:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chriswailes/2962792 to your computer and use it in GitHub Desktop.
Save chriswailes/2962792 to your computer and use it in GitHub Desktop.
RLTK/LLVM-ECB Example File
# Ruby Language Toolkit
require 'rltk/cg/llvm'
require 'rltk/cg/module'
require 'rltk/cg/execution_engine'
require 'rltk/cg/target'
require 'rltk/cg/type'
require 'rltk/cg/value'
RLTK::CG::LLVM.init(:all)
RLTK::CG::LLVM.init_asm_parser(:all)
RLTK::CG::LLVM.init_asm_printer(:all)
mod = RLTK::CG::Module.new('Testing Module')
mod.functions.add('test_fun', RLTK::CG::NativeIntType, [RLTK::CG::NativeIntType]) do |fun|
blocks.append { ret add(RLTK::CG::NativeInt.new(40), fun.params[0]) }
end
mod.print('foo.ll')
mod.compile('foo.S', :asm)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment