[LLVMdev] malloc instruction

Misha Brukman brukman at uiuc.edu
Tue Mar 23 01:18:01 PST 2004

On Tue, Mar 23, 2004 at 04:53:15PM +1100, Patrick wrote:
> There are 2 types of AllocationInst - Alloca and Malloc.  But most of
> the time from the compiled byte code I can only find the Alloca
> statement (actually I never come across a single Malloc statement).
> the function "malloc" is called tho.  Does anybody know when will a
> "MallocInst" be generated?  Thanks heaps.

That is done by the Raise Allocations pass, -raiseallocs on the command
line. It is automatically run by gccas which is invoked by the C and C++
front ends.

If you manage to turn it off, you can get the effect by post-processing
your own bytecode modules by using

  opt -raiseallocs < input.bc > output.bc

Misha Brukman :: http://misha.brukman.net :: http://llvm.cs.uiuc.edu

More information about the llvm-dev mailing list