[LLVMdev] FP Constants spilling to memory in x86 code generation

Morten Ofstad morten at hue.no
Mon Dec 6 06:45:27 PST 2004


Hello,

I've tracked down a new memory leak which started happening when I 
enabled constant propagation (I created my own passmanager which I run 
before calling getPointerToGlobal to JIT the function I have generated - 
is this OK?). The reason is that FP constants are being spilled to 
memory as there is no immediate fp load available. In my case this is a 
bit unnecessary since the constant is in fact a (constant) global 
variable which I have already added a memory mapping for. But the 
constant folding can of course end up making new constants which _have_ 
to be spilled to memory.

I guess what I'd like to know is if the process of spilling constants to 
memory could be a bit more controlled, maybe using the JIT memory 
manager and putting it in with the function stubs? If not, I have to add 
tracking to the allocations here so they can be freed when the function 
is deleted. This is not so easy since there is no reference to the 
function which we are generating machine code for inside the 
copyConstantToRegister function. Any ideas?

m.

PS. Regarding my earlier post about function stubs -- The stub 
generation is working fine for the x86 target, it was Visual Studio 
generating the stubs I was seing because I have Fix&Continue turned on :-P




More information about the llvm-dev mailing list