How do I store a value in LLVM?

199 Views Asked by At

I am using LLVM's Python bindings - and, so far, I've been able to generate Constant values using LLVM. However, I am confused as to how to store them within an address.

This is probably a very basic question - how do I store a constant in memory? How do I later access that memory location for that value?

1

There are 1 best solutions below

1
On BEST ANSWER

In general, storing values to an address is done via a store instruction (builder.store) and accessing a value within an address is done via a load instruction (builder.load). It doesn't matter if the argument to the store instruction is a constant or not.

If you're referring to constant GlobalVariables, however, be aware they are already stored in an address when you create them.