Module: RLTK::CG::LLVM
- Defined in:
- lib/rltk/cg/llvm.rb
Overview
This module contains global operations on the LLVM compiler infrastructure.
Class Method Summary collapse
-
.init(arch) ⇒ void
Initialize LLVM to generate code for a given architecture.
-
.init_asm_parser(asm) ⇒ void
Initialize a given ASM parser inside LLVM.
-
.init_asm_printer(asm) ⇒ void
Initialize a given ASM printer inside LLVM.
-
.version ⇒ String
String representing the version of LLVM targeted by these bindings.
Class Method Details
.init(arch) ⇒ void
This method returns an undefined value.
Initialize LLVM to generate code for a given architecture. You may also specify :all to initialize all targets or :native to initialize the host target.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/rltk/cg/llvm.rb', line 33 def self.init(arch) if arch == :all Bindings.ecb_initialize_all_targets elsif arch == :native Bindings.ecb_initialize_native_target elsif Bindings::ARCHS.include?(arch) or Bindings::ARCHS.map { |sym| sym.to_s.downcase.to_sym }.include?(arch) arch = Bindings.get_bname(arch) Bindings.send("initialize_#{arch}_target".to_sym) Bindings.send("initialize_#{arch}_target_info".to_sym) Bindings.send("initialize_#{arch}_target_mc".to_sym) else raise ArgumentError, "Unsupported architecture specified: #{arch}." end end |
.init_asm_parser(asm) ⇒ void
This method returns an undefined value.
Initialize a given ASM parser inside LLVM. You may also specify :all to initialize all ASM parsers.
62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/rltk/cg/llvm.rb', line 62 def self.init_asm_parser(asm) if asm == :all Bindings.initialize_all_asm_parsers elsif Bindings::ASM_PARSERS.include?(asm) or Bindings::ASM_PARSERS.map { |sym| sym.to_s.downcase.to_sym }.include?(asm) asm = Bindings.get_bname(asm) Bindings.send("initialize_#{asm}_asm_parser".to_sym) else raise ArgumentError, "Unsupported assembler type specified: #{asm}" end end |
.init_asm_printer(asm) ⇒ void
This method returns an undefined value.
Initialize a given ASM printer inside LLVM. You may also specify :all to initialize all ASM printers or :native to initialize the printer for the host machine’s assembly language.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/rltk/cg/llvm.rb', line 87 def self.init_asm_printer(asm) if asm == :all Bindings.initialize_all_asm_printers elsif asm == :native Bindings.initialize_native_asm_printer elsif Bindings::ASM_PRINTERS.include?(asm) or Bindings::ASM_PRINTERS.map { |sym| sym.to_s.downcase.to_sym }.include?(asm) asm = Bindings.get_bname(asm) Bindings.send("initialize_#{asm}_asm_printer".to_sym) else raise ArgumentError, "Unsupported assembler type specified: #{asm}" end end |
.version ⇒ String
Returns String representing the version of LLVM targeted by these bindings.
105 106 107 |
# File 'lib/rltk/cg/llvm.rb', line 105 def self.version RLTK::LLVM_TARGET_VERSION end |