Class: LLVM::Module
- Inherits:
-
Object
- Object
- LLVM::Module
- Defined in:
- lib/llvm/analysis.rb,
lib/llvm/core/module.rb
Defined Under Namespace
Classes: FunctionCollection, GlobalCollection, TypeCollection
Class Method Summary collapse
-
.create(name) ⇒ Object
Creates a module with the given name.
- .from_ptr(ptr) ⇒ Object
Instance Method Summary collapse
-
#==(other) ⇒ Object
Checks if the module is equal to other.
-
#dispose ⇒ Object
Dispose the module.
-
#dump ⇒ Object
Print the module’s IR to stdout.
-
#eql?(other) ⇒ Boolean
Checks if the module is equal to other.
-
#functions ⇒ Object
Returns a FunctionCollection of all the Functions in the module.
-
#globals ⇒ Object
Returns an Enumerable of all the GlobalVariables in the module.
-
#initialize(ptr) ⇒ Module
constructor
A new instance of Module.
- #to_ptr ⇒ Object
-
#types ⇒ Object
Returns a TypeCollection of all the Types in the module.
- #verify ⇒ Object
- #verify! ⇒ Object
Constructor Details
#initialize(ptr) ⇒ Module
Returns a new instance of Module.
11 12 13 |
# File 'lib/llvm/core/module.rb', line 11 def initialize(ptr) @ptr = ptr end |
Class Method Details
.create(name) ⇒ Object
Creates a module with the given name.
36 37 38 |
# File 'lib/llvm/core/module.rb', line 36 def self.create(name) new(C.LLVMModuleCreateWithName(name)) end |
.from_ptr(ptr) ⇒ Object
6 7 8 |
# File 'lib/llvm/core/module.rb', line 6 def self.from_ptr(ptr) ptr.null? ? nil : new(ptr) end |
Instance Method Details
#==(other) ⇒ Object
Checks if the module is equal to other.
21 22 23 24 25 26 27 28 |
# File 'lib/llvm/core/module.rb', line 21 def ==(other) case other when LLVM::Module @ptr == other.to_ptr else false end end |
#dispose ⇒ Object
Dispose the module.
233 234 235 |
# File 'lib/llvm/core/module.rb', line 233 def dispose C.LLVMDisposeModule(@ptr) end |
#dump ⇒ Object
Print the module’s IR to stdout.
228 229 230 |
# File 'lib/llvm/core/module.rb', line 228 def dump C.LLVMDumpModule(self) end |
#eql?(other) ⇒ Boolean
Checks if the module is equal to other.
31 32 33 |
# File 'lib/llvm/core/module.rb', line 31 def eql?(other) other.instance_of?(self.class) && self == other end |
#functions ⇒ Object
Returns a FunctionCollection of all the Functions in the module.
144 145 146 |
# File 'lib/llvm/core/module.rb', line 144 def functions @functions ||= FunctionCollection.new(self) end |
#globals ⇒ Object
Returns an Enumerable of all the GlobalVariables in the module.
72 73 74 |
# File 'lib/llvm/core/module.rb', line 72 def globals @globals ||= GlobalCollection.new(self) end |
#to_ptr ⇒ Object
16 17 18 |
# File 'lib/llvm/core/module.rb', line 16 def to_ptr @ptr end |
#types ⇒ Object
Returns a TypeCollection of all the Types in the module.
41 42 43 |
# File 'lib/llvm/core/module.rb', line 41 def types @types ||= TypeCollection.new(self) end |
#verify ⇒ Object
19 20 21 |
# File 'lib/llvm/analysis.rb', line 19 def verify do_verification(:return_status) end |
#verify! ⇒ Object
23 24 25 |
# File 'lib/llvm/analysis.rb', line 23 def verify! do_verification(:abort_process) end |