LLVM for ARM cortex -M4

I want to generate LLVM IR for ARM cortex M4. Which flags I need to use while building LLVM in order to achieve this?

Thank You

See the documentation How To Cross-Compile Clang/LLVM using Clang/LLVM — LLVM 16.0.0git documentation, Download the requirements, and proceed with the steps.

See https://clang.llvm.org/docs/CrossCompilation.html to know cross compilation issues.

So if you look at clang driver testing you can find the commands that you need to run.

Short answer --target & --mcpu flag is used, also substitute the command according to your system setup.

Correct me if you find something wrong, As I didn’t it try myself.