Reputation: 571
LLVM is the backend for many languages such as C#, Ruby, Zig and so on.
My question is: can all LLVM frontend languages “in principle” produce the same LLVM bytecode?
Are there any minimum requirements for a frontend to be able to produce the same byte code as say, C++?
Upvotes: 0
Views: 116
Reputation: 9685
In principle, yes… except not quite. Because the C++ language requires that the bytecode access c++ vtbls and other constructs that aren't quite the same in other languages.
One language may require that a null pointer check be inserted in a particular spot, another language makes it possible to elide that check. The output from two languages will always have tiny differences like that.
Upvotes: 0