I am writing a simple compiler. I have written lexer and parser and it now generates assembly code from given code. Now I need to write an assembler which generates machine code. But the problem is that I want to make my compiler portable. it should run at least on major architectures. One way of doing it is writing different assemblers for each architecture, but it seems too difficult and time-consuming.
Is there a "least common denominator" for most architectures that I could work with to make my compiler portable? For instance, is it only necessary to "write one backend that produces LLVM IR instead of assembly"?