title: Calling conventions in LLVM IR
body: <p>LLVM allows <code>call</code> instructions and <code>define</code>s to specify a calling convention. Does the IR itself already need to adhere to the specified convention? For example when using <code>ccc</code>, I believe that the return value would need to fit in the 64-bit <code>eax</code> on my OS/architecture. Am I allowed to write LLVM IR code that returns a struct of 3 <code>i32</code>'s? Does LLVM convert that to something that adheres to the C calling convention? Could I change the calling convention without changing any other code?</p>
  
  <p>When I look at the output of compiling a C file with <code>-emit-llvm</code>, the IR generator already applied the calling convention, and would allocate at the call site, and convert the return value as a pointer parameter. Is that absolutely necessary at this stage? What does LLVM do with the information of which calling convention to use at the next stage, <code>-emit-obj</code>?</p>