The value is statically known for a specific target, I believe.
In the example, the value is 8 bytes, encoded in the call instruction.
On Thu, Apr 25, 2013 at 8:13 AM, B B <blackbox.dev.ml at gmail.com> wrote:
> Hi!
>
> When I allocate memory for a structure, in _Znwm (operator new) function I
> need to specify size. How can I determine this information dynamically?
>
> ; ModuleID = '/tmp/webcompile/_12211_0.bc'
> target datalayout >
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
> target triple = "x86_64-unknown-linux-gnu"
>
> %class.A = type { i32, float }
>
> define i32 @main() uwtable {
> entry:
> %a = alloca %class.A*, align 8
> %call = call noalias i8* @_Znwm(i64 8) ; << how can I determine this
> value?
> %0 = bitcast i8* %call to %class.A*
> store %class.A* %0, %class.A** %a, align 8
> ret i32 0
> }
>
> declare noalias i8* @_Znwm(i64)
>
> Regards
>
> _______________________________________________
> 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/20130425/30db6d09/attachment.html>