0

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?

sdasdadas
  • 23,917
  • 20
  • 63
  • 148

1 Answers1

1

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.

Oak
  • 26,231
  • 8
  • 93
  • 152