title: Is it possible to translate an assembly language to LLVM IR, optimize it and then recompile it to a different architecture?
body: <p>Is it possible to translate an assembly language to LLVM IR, optimize it and then recompile it to a different architecture? How would you handle "push"es and "pop"s on the stack in the IR? This is the simplest objection I found, but I'm sure that there're tons like this.</p>
  
  <p>I'm planning to build a dynamic recompiler, and it seems that this would be an excellent solution, since LLVM would automatically optimize my code for the new architecture. Is all this possible with LLVM?</p>
  
  <p>Thanks</p>