Hi we have a project that need to put different machine code line by line into one object.
The project is under time pressure so we figure out a way using functions to do this, like the following example:
int run_arch1()
{
int a = 23;
run_on_arch2(
"arch2 asm inst1\n"
"arch2 asm inst2\n"
);
return 0;
}
We plan to compile the above C code into arch1 assembly, and using llvm-mc to compile the assembly into the target code.
In order to compile the string parameter of function run_on_arch2, we would like to put a hook in llvm-mc, So it will call the arch2 assembler to generate machine code and insert them into the position of calling run_on_arch2.
However, I’m new to llvm and do not familiar with llvm source code. Searching result from internet are also limited for llvm-mc.
Thus I would like to ask if anyone can give me a general idea of how it work, what is the basic code structure of llvm-mc and where I can find docs that can help me to finish my task.
I’m also debugging the source and hope to find it myself. But due to the time pressure I hope some one can give some directions.
Thanks a lot!!!