title: In LLVM, how can I get a Value's ValuetoValueMapTy (VMap)? What its purpose?
body: <p>On the context of cloning functions, one of the used objects is the <code>ValueToValueMapTy &amp;VMap</code> which is a <code>typedef</code> of<code>ValueMap&lt;const Value *, WeakVH&gt;</code>.</p>
  
  <p>For example, it is used during <code>cloneFunctionInto(...)</code> in <code>llvm/lib/Transforms/Utils/CloneFunction.cpp</code></p>
  
  <p>Thus I have <strong>questions</strong> that will help me clarify its purpose:</p>
  
  <ol>
  <li>Does every <code>llvm::Value</code> has its on VMap? Or this only belongs to Functions or Modules or what?</li>
  <li>How do I get this ValueMap for a specific function?</li>
  <li>Is it correct that its purpose is to hold information of <code>llvm::Values</code> of the function?</li>
  </ol>
  
  <hr>
  
  <p>ps.:</p>
  
  <p>I have already checked those links that may be helpful to others asking questions on Vmap, but none of them could completely answer my questions.</p>
  
  <p><a href="https://stackoverflow.com/questions/13104085/what-to-pass-for-the-vmap-argument-of-clonefunction-in-llvm">What to pass for the vmap argument of CloneFunction in llvm?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/35441711/filling-the-llvm-clonefunction-vmap">Filling the LLVM CloneFunction VMAP</a></p>
  
  <p><a href="http://llvm.org/doxygen/CloneFunction_8cpp_source.html" rel="nofollow noreferrer">LLVM CloneFunction.cpp</a></p>