Module: Stone::LLVMModuleExtensions

Defined in:
lib/extensions/llvm_module.rb

Instance Method Summary collapse

Instance Method Details

#function_aliasesObject

Get the function aliases hash, creating it if it doesn't exist



21
22
23
# File 'lib/extensions/llvm_module.rb', line 21

def function_aliases
  @function_aliases ||= {}
end

#lambda_param_storageObject

Get the current lambda parameter storage context



36
37
38
# File 'lib/extensions/llvm_module.rb', line 36

def lambda_param_storage
  @lambda_param_storage
end

#lambda_param_storage=(storage) ⇒ Object

Set the lambda parameter storage context (used during lambda compilation)



41
42
43
# File 'lib/extensions/llvm_module.rb', line 41

def lambda_param_storage=(storage)
  @lambda_param_storage = storage
end

#lookup_function(name) ⇒ Object

Look up a function by name, checking aliases if not found in the module's function table



31
32
33
# File 'lib/extensions/llvm_module.rb', line 31

def lookup_function(name)
  functions[name] || function_aliases[name]
end

#record_instance?(variable_name) ⇒ Boolean

Returns:

  • (Boolean)


89
90
91
# File 'lib/extensions/llvm_module.rb', line 89

def record_instance?(variable_name)
  record_instances.key?(variable_name)
end

#record_instance_type(variable_name) ⇒ Object



93
94
95
# File 'lib/extensions/llvm_module.rb', line 93

def record_instance_type(variable_name)
  record_instances[variable_name]
end

#record_instancesObject

Track which variables hold record instances (maps variable name -> record type name)



81
82
83
# File 'lib/extensions/llvm_module.rb', line 81

def record_instances
  @record_instances ||= {}
end

#record_type?(name) ⇒ Boolean

Returns:

  • (Boolean)


76
77
78
# File 'lib/extensions/llvm_module.rb', line 76

def record_type?(name)
  record_types.key?(name)
end

#record_typesObject

Track record type definitions



68
69
70
# File 'lib/extensions/llvm_module.rb', line 68

def record_types
  @record_types ||= {}
end

#register_function_alias(name, function) ⇒ Object

Register a function alias (e.g., for lambdas assigned to constants)



26
27
28
# File 'lib/extensions/llvm_module.rb', line 26

def register_function_alias(name, function)
  function_aliases[name] = function
end

#register_record_instance(variable_name, record_type_name) ⇒ Object



85
86
87
# File 'lib/extensions/llvm_module.rb', line 85

def register_record_instance(variable_name, record_type_name)
  record_instances[variable_name] = record_type_name
end

#register_record_type(name, record_definition) ⇒ Object



72
73
74
# File 'lib/extensions/llvm_module.rb', line 72

def register_record_type(name, record_definition)
  record_types[name] = record_definition
end

#register_string_constant(name, string_literal) ⇒ Object



50
51
52
# File 'lib/extensions/llvm_module.rb', line 50

def register_string_constant(name, string_literal)
  string_constants[name] = string_literal
end

#string_constant?(name) ⇒ Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/extensions/llvm_module.rb', line 54

def string_constant?(name)
  string_constants.key?(name)
end

#string_constantsObject

Track which constants are strings (for type checking during returns)



46
47
48
# File 'lib/extensions/llvm_module.rb', line 46

def string_constants
  @string_constants ||= {}
end