I am working on the assembly printer for RISC-V, more specifically on
the AsmPrinter class.
I altered the RISCV Backend to print C code instead of Assembly,
interpreted by libraries... (but that's not important)
My problem is that, for my application to work, I need to treat my
functions in the order they are in the original C file.
I discovered that these functions are not treated in this order.
My question is : Is there a way to force llvm to treat the functions in
the order given in the original C file ? and how?
I treat each function in the EmitFunctionBody funtion of the AsmPrinter
class, and the function is passed through the MachineFunction passed
trhough the runOnMachineFunction function. I didn't find where this last
function is called.
So I wish maybe to alter the way this function is called for each
Function to call it in the "right" order...
Thanks,
Best regards,
IG
_______________________________________________
LLVM Developers mailing list
llvm...@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
The LLVM backend should generally print functions in the same order they
appear in the IR. This is an implementation detail, not a guarantee,
but there currently aren't any backend passes that rearrange functions.
That said, clang doesn't really try to emit functions in source order:
it will delay emitting functions for various reasons. If that's truly
necessary for your use-case, you'll probably have to modify clang
somehow. Or maybe -femit-all-decls is close enough if your input is pure C?
-Eli
--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project