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
-
.enable_pretty_stack_trace ⇒ void
Enable LLVM’s built-in stack trace code.
-
.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.
-
.initialize_all_target_mcs ⇒ void
Initialize access to all available target MC that LLVM is configured to support.
- .multithreaded? ⇒ Boolean
-
.shutdown ⇒ void
Deallocate and destroy all ManagedStatic variables.
-
.start_multithreaded ⇒ void
Initialize LLVM’s multithreaded infrestructure.
-
.stop_multithreaded ⇒ Object
Shutdown and cleanup LLVM’s multithreaded infrastructure.
-
.version ⇒ String
String representing the version of LLVM targeted by these bindings.
Class Method Details
.enable_pretty_stack_trace ⇒ void
This method returns an undefined value.
Enable LLVM’s built-in stack trace code. This intercepts the OS’s crash signals and prints which component of LLVM you were in at the time if the crash.
28 29 30 |
# File 'lib/rltk/cg/llvm.rb', line 28 def self.enable_pretty_stack_trace Bindings.enable_pretty_stack_trace end |
.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.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/rltk/cg/llvm.rb', line 43 def self.init(arch) if arch == :all Bindings.initialize_all_targets elsif arch == :native Bindings.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.
80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/rltk/cg/llvm.rb', line 80 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.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/rltk/cg/llvm.rb', line 105 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 |
.initialize_all_target_mcs ⇒ void
This method returns an undefined value.
Initialize access to all available target MC that LLVM is configured to support.
66 67 68 |
# File 'lib/rltk/cg/llvm.rb', line 66 def self.initialize_all_target_mcs Bindings.initialize_all_target_mcs end |
.multithreaded? ⇒ Boolean
122 123 124 |
# File 'lib/rltk/cg/llvm.rb', line 122 def self.multithreaded? Bindings.is_multithreaded.to_bool end |
.shutdown ⇒ void
This method returns an undefined value.
Deallocate and destroy all ManagedStatic variables.
129 130 131 |
# File 'lib/rltk/cg/llvm.rb', line 129 def self.shutdown Bindings.shutdown end |
.start_multithreaded ⇒ void
This method returns an undefined value.
Initialize LLVM’s multithreaded infrestructure.
136 137 138 |
# File 'lib/rltk/cg/llvm.rb', line 136 def self.start_multithreaded Bindings.start_multithreaded end |
.stop_multithreaded ⇒ Object
Shutdown and cleanup LLVM’s multithreaded infrastructure.
141 142 143 |
# File 'lib/rltk/cg/llvm.rb', line 141 def self.stop_multithreaded Bindings.stop_multithreaded end |
.version ⇒ String
Returns String representing the version of LLVM targeted by these bindings.
146 147 148 |
# File 'lib/rltk/cg/llvm.rb', line 146 def self.version RLTK::LLVM_TARGET_VERSION end |