Is alloca the only way to create a structure?


I failed to find answer in docs.

Hi lost,

I failed to find answer in docs.

it's not clear what you mean by "create a structure":

(1) you want a local stack variable of struct type. Then use AllocaInst.
(2) you want a register of struct type. You can create these using
the extractvalue and insertvalue instructions.
(3) you want to allocate heap memory of struct type. Call malloc.
(4) you want a global variable of struct type. Use GlobalVariable.