I realize that LLVM has a long way to go, but theoretically, can the optimizations that are in GCC/ICC/etc. for individual languages be applied to LLVM byte code? If so, does t
Coming back to the your question "is it theoretically possible?" , let's imagine/assume - Just for a sake of discussion - following :
IMHO - from computer science point of view, it's mostly question of resources, to apply almost anything.
Now let's try following
function machinecode_to_sourcecode( given_machinecode ){
it = all_posibble_strings_iterator()
while (true) {
possible_sourcecode = it->get_string()
machine_code = compile possible_sourcecode with X
if (compilation succeeded)
if(machine_code == given_machinecode)
return possible_sourcecode;
else
it = it->next_string()
}
}
So we try all possible strings, as input for compiler X, in case of success compilation - ones results equal, we have source.
Once we have source, we have as much information about program as we can, so we are able to apply all possible optimizations.
All looks very costly, but as you've asked "theoretically", I will say
because
so
whole operation is going to take finite amount of computation time.