<div dir="ltr">The value is statically known for a specific target, I believe.<div style>In the example, the value is 8 bytes, encoded in the call instruction.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Thu, Apr 25, 2013 at 8:13 AM, B B <span dir="ltr"><<a href="mailto:blackbox.dev.ml@gmail.com" target="_blank">blackbox.dev.ml@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div>Hi! </div><div><br></div><div>When I allocate memory for a structure, in _Znwm (operator new) function I need to specify size. How can I determine this information dynamically?</div><div><br></div><div>

; ModuleID = '/tmp/webcompile/_12211_0.bc'<br>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"<br>

target triple = "x86_64-unknown-linux-gnu"<br><br>%class.A = type { i32, float }<br><br>define i32 @main() uwtable {<br>entry:<br>  %a = alloca %class.A*, align 8<br>  %call = call noalias i8* @_Znwm(i64 8)  ; << how can I determine this value?<br>

  %0 = bitcast i8* %call to %class.A*<br>  store %class.A* %0, %class.A** %a, align 8<br>  ret i32 0<br>}<br><br>declare noalias i8* @_Znwm(i64)</div><div><br></div><div>Regards</div></div>
<br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br></div>