From 2c8d949da599dacd7676ea49010e8a739845bac4 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 20 Jun 2009 18:21:12 +0000 Subject: Fix building with explicit stack frames. Tidy. git-svn-id: http://svn.drobilla.net/resp/tuplr@134 ad02d1e2-f140-0410-9f75-f8b11f17cedd --- llvm.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/llvm.cpp b/llvm.cpp index dbe647b..5024f85 100644 --- a/llvm.cpp +++ b/llvm.cpp @@ -286,6 +286,8 @@ AClosure::liftCall(CEnv& cenv, const AType& argsT) #ifdef EXPLICIT_STACK_FRAMES + IRBuilder<> builder = llengine(cenv)->builder; + // Scan out definitions for (size_t i = 0; i < size(); ++i) { ADefinition* def = at(i)->to(); @@ -298,15 +300,11 @@ AClosure::liftCall(CEnv& cenv, const AType& argsT) } // Create stack frame - StructType* frameT = StructType::get(types, false); - PointerType* framePtrT = PointerType::get(frameT, 0); - - Value* tag = ConstantInt::get(Type::Int8Ty, (uint8_t)GC::TAG_FRAME); - - Value* frameSize = ConstantInt::get(Type::Int32Ty, s / 8); - Value* frame = builder.CreateCall2(llVal(cenv.alloc), frameSize, tag, "frame"); - - Value* framePtr = builder.CreateBitCast(frame, framePtrT, "frameptr"); + StructType* frameT = StructType::get(types, false); + Value* tag = ConstantInt::get(Type::Int8Ty, GC::TAG_FRAME); + Value* frameSize = ConstantInt::get(Type::Int32Ty, s / 8); + Value* frame = builder.CreateCall2(llVal(cenv.alloc), frameSize, tag, "frame"); + Value* framePtr = builder.CreateBitCast(frame, PointerType::get(frameT, 0)); // Bind parameter values in stack frame i = 2; -- cgit v1.2.1