Category : alloca

I am building a lifter that translates armv7m assembly instructions into llvm IR. A sample of my C++ code is: IRBuilder<> builder(TheContext); //line 0 llvm::ConstantInt* I_0 = llvm::ConstantInt::get(TheContext, llvm::APInt(/nbits/32, 0, true)); //line 1 V = builder.CreateAlloca(Type::getInt32Ty(TheContext), nullptr, "V"); //line 2 Value* s3 = builder.CreateStore(I_0, V, /isVolatile=/false); //line 3 Value* loaded_V = builder.CreateLoad(V); //line 4 Value* ..

Read more

I’m using alloca a lot these days, to allocate temporary buffers. In my application (signal processing) this is a common need. The question is – when allocating multiple arrays, is it better (performance-wise) to use alloca just once like this: float *array1 = (float*)alloca(4096 * 4); float *array2 = array1 + 1024; float *array3 = ..

Read more