Module: LLVM
- Defined in:
- lib/llvm.rb,
lib/llvm/core.rb,
lib/llvm/target.rb,
lib/llvm/support.rb,
lib/llvm/analysis.rb,
lib/llvm/core/type.rb,
lib/llvm/core/value.rb,
lib/llvm/core/module.rb,
lib/llvm/core/bitcode.rb,
lib/llvm/core/builder.rb,
lib/llvm/core/context.rb,
lib/llvm/transforms/ipo.rb,
lib/llvm/execution_engine.rb,
lib/llvm/core/pass_manager.rb,
lib/llvm/transforms/scalar.rb
Defined Under Namespace
Modules: C, Support Classes: Argument, BasicBlock, Builder, CallInst, Constant, ConstantArray, ConstantExpr, ConstantInt, ConstantReal, ConstantStruct, ConstantVector, Context, Double, Float, Function, FunctionPassManager, FunctionType, GenericValue, GlobalAlias, GlobalValue, GlobalVariable, Instruction, IntType, JITCompiler, MemoryBuffer, Module, PassManager, Phi, SwitchInst, Type, User, Value
Constant Summary collapse
- Int =
const_get("Int#{bits}")
- TRUE =
Boolean values
::LLVM::Int1.from_i(-1)
- FALSE =
::LLVM::Int1.from_i(0)
Class Method Summary collapse
-
.Array(ty, sz = 0) ⇒ Object
Shortcut to Type.array.
- .const_missing(const) ⇒ Object
- .Double(val) ⇒ Object
-
.Float(val) ⇒ Object
Create a LLVM::Float from a Ruby Float (val).
-
.Function(argtypes, rettype, options = {}) ⇒ Object
Shortcut to Type.function.
- .init_x86 ⇒ Object
-
.Int(val) ⇒ Object
Creates a LLVM Int (subclass of ConstantInt) at the NATIVE_INT_SIZE from a integer (val).
- .load_library(libname) ⇒ Object
- .make_generic_value(ty, val) ⇒ Object
-
.Pointer(ty) ⇒ Object
Shortcut to Type.pointer.
-
.Struct(*elt_types) ⇒ Object
Shortcut to Type.struct.
-
.Type(ty) ⇒ Object
Creates a Type from the given object.
-
.Vector(ty, sz) ⇒ Object
Shortcut to Type.vector.
-
.Void ⇒ Object
Shortcut to Type.void.
Class Method Details
.Array(ty, sz = 0) ⇒ Object
Shortcut to Type.array.
145 146 147 |
# File 'lib/llvm/core/type.rb', line 145 def Array(ty, sz = 0) LLVM::Type.array(ty, sz) end |
.const_missing(const) ⇒ Object
396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 |
# File 'lib/llvm/core/value.rb', line 396 def LLVM.const_missing(const) case const.to_s when /Int(\d+)/ width = $1.to_i name = "Int#{width}" eval <<-KLASS class #{name} < ConstantInt def self.type IntType.from_ptr(C.LLVMIntType(#{width})) end end KLASS const_get(name) else super end end |
.Double(val) ⇒ Object
506 507 508 |
# File 'lib/llvm/core/value.rb', line 506 def LLVM.Double(val) Double.from_f(val) end |
.Float(val) ⇒ Object
Create a LLVM::Float from a Ruby Float (val).
496 497 498 |
# File 'lib/llvm/core/value.rb', line 496 def LLVM.Float(val) Float.from_f(val) end |
.Function(argtypes, rettype, options = {}) ⇒ Object
Shortcut to Type.function.
160 161 162 |
# File 'lib/llvm/core/type.rb', line 160 def Function(argtypes, rettype, = {}) LLVM::Type.function(argtypes, rettype, ) end |
.init_x86 ⇒ Object
50 51 52 53 |
# File 'lib/llvm/execution_engine.rb', line 50 def LLVM.init_x86 LLVM::C.LLVMInitializeX86Target LLVM::C.LLVMInitializeX86TargetInfo end |
.Int(val) ⇒ Object
Creates a LLVM Int (subclass of ConstantInt) at the NATIVE_INT_SIZE from a integer (val).
419 420 421 422 423 424 |
# File 'lib/llvm/core/value.rb', line 419 def LLVM.Int(val) case val when LLVM::ConstantInt then val when Integer then Int.from_i(val) end end |
.load_library(libname) ⇒ Object
16 17 18 19 |
# File 'lib/llvm/support.rb', line 16 def load_library(libname) Support::C.LLVMLoadLibraryPermanently(libname) nil end |
.make_generic_value(ty, val) ⇒ Object
158 159 160 161 162 163 164 165 166 167 |
# File 'lib/llvm/execution_engine.rb', line 158 def make_generic_value(ty, val) case ty.kind when :double then GenericValue.from_d(val) when :float then GenericValue.from_f(val) when :pointer then GenericValue.from_value_ptr(val) when :integer then GenericValue.from_i(val, :type => ty) else raise "Unsupported type #{ty.kind}." end end |
.Pointer(ty) ⇒ Object
Shortcut to Type.pointer.
150 151 152 |
# File 'lib/llvm/core/type.rb', line 150 def Pointer(ty) LLVM::Type.pointer(ty) end |
.Struct(*elt_types) ⇒ Object
Shortcut to Type.struct.
165 166 167 |
# File 'lib/llvm/core/type.rb', line 165 def Struct(*elt_types) LLVM::Type.struct(elt_types, false) end |
.Type(ty) ⇒ Object
Creates a Type from the given object.
137 138 139 140 141 142 |
# File 'lib/llvm/core/type.rb', line 137 def Type(ty) case ty when LLVM::Type then ty else ty.type end end |