[LLVMdev] Functions: sret and readnone
Dan Gohman
gohman at apple.com
Mon Oct 5 14:33:44 PDT 2009
On Oct 5, 2009, at 7:21 AM, Stephan Reiter wrote:
> Hi all,
>
> I'm currently building a DSL for a computer graphics project that is
> not unlike NVIDIA's Cg. I have an intrinsic with the following
> signature
>
> float4 sample(texture tex, float2 coords);
>
> that is translated to this LLVM IR code:
>
> declare void @"sample"(%float4* noalias nocapture sret, %texture,
> $float2) nounwind readnone
>
> The type float4 is basically an array of four floats, which cannot be
> returned directly on an x86 using the traditional calling conventions
> but only via the sret mechanism.
Is there a reason it needs to be an array? A vector of four floats
wouldn't have this problem, if that's an option.
Dan
More information about the llvm-dev
mailing list