How can I initialize a local string in llvm IR. I know how to do Int using AllocaInst and StoreInst. Is there similar ways to initialize a string?
First, you create a constant GlobalVariable
that holds a byte array representing your string. Any GlobalVariable
is of pointer type, so you can use it in your function right away.
For example, you can use getelementptr
instruction in conjunction with load
to access string characters.