sdasdadas
sdasdadas

Reputation: 25096

How do I store a value in LLVM?

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?

Upvotes: 0

Views: 203

Answers (1)

Oak
Oak

Reputation: 26868

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.

Upvotes: 1

Related Questions