[LLVMdev] lower-lever IR (A-normal form)

John Criswell criswell at illinois.edu
Wed Jul 10 12:33:56 PDT 2013


On 7/10/13 1:35 PM, Eirini _ wrote:
> Hi,
>
>  i would like to ask you, if i can get a lower-level representation 
> than the llvm IR.
> For example, having the following instruction in the llvm IR,
>  call void @llvm.memcpy.i32(i8* %19, i8* getelementptr inbounds ([2 x 
> [2 x [3 x i8]]]* @main.s, i32 0, i32 0, i32 0, i32 0), i32 12, i32 1)

As Tim has pointed out, the "nested" getelementptr isn't really a nested 
instruction.  It is a compile-time constant.  The reason why it looks 
like a GEP is that it is in a symbolic form.

If you really want to convert these constants into instructions, take a 
look at the BreakConstantGEPs pass in SAFECode.  It converts some (but 
not all) constant expressions into LLVM instructions and will alleviate 
the "nesting" that you see.

As Tim also said, this conversion is not an optimization.  You should 
not expect the resulting IR to compile into efficient code.

-- John T.

>
> i would like to get something like this (in _A-normal form_ (without 
> nested instructions):
> *%temp* = i8* getelementptr inbounds ([2 x [2 x [3 x i8]]]* @main.s, 
> i32 0, i32 0, i32 0, i32 0)
>  call void @llvm.memcpy.i32(i8* %19,* %temp*, i32 12, i32 1)
>
>
> Thanks
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130710/3c93c975/attachment.html>


More information about the llvm-dev mailing list