First commit fixes the warnings about the new object safety rules. I hope I fixed it correctly. If not, you (or I) can delete that commit.
Second commit implements more functionality for globals.
There are three types of global:
Functions
Aliases
Variables/Constants
All of these dereference into a new type, GlobalValue, which in turn, dereferences into a Value.
Module.add_global_constant() has been removed in favour of Module.add_global_variable(), which can optionally be set to a constant by calling GlobalVariable.set_constant(true). The old behaviour didn't set it to constant anyway, so this breaking change has the benefit of alerting people as to whether their globals should be constant or not.
Global variables/constants can also have their initialiser changed through GlobalVariable.set_initializer() (or you can obtain the value through GlobalVariable.get_initializer())
All global values can have their linkage type changed through the GlobalValue.set_linkage() function using the new Linkage enum.
Also added Module.add_global_in_address_space(), which takes an argument of the new AddressSpace enum.
Some tests are probably needed but I'm too busy over the next few days. As far as I've used the new functionality, it works correctly.
First commit fixes the warnings about the new object safety rules. I hope I fixed it correctly. If not, you (or I) can delete that commit.
Second commit implements more functionality for globals.
All of these dereference into a new type,
GlobalValue
, which in turn, dereferences into aValue
.Module.add_global_constant()
has been removed in favour ofModule.add_global_variable()
, which can optionally be set to a constant by callingGlobalVariable.set_constant(true)
. The old behaviour didn't set it to constant anyway, so this breaking change has the benefit of alerting people as to whether their globals should be constant or not.Global variables/constants can also have their initialiser changed through
GlobalVariable.set_initializer()
(or you can obtain the value throughGlobalVariable.get_initializer()
)All global values can have their linkage type changed through the
GlobalValue.set_linkage()
function using the newLinkage
enum.Also added
Module.add_global_in_address_space()
, which takes an argument of the newAddressSpace
enum.Some tests are probably needed but I'm too busy over the next few days. As far as I've used the new functionality, it works correctly.