Question about LLVM backend

Hi everyone,

first at all I would like to thanks llvm developers for their incredible jobs on llvm .

I have a question , and I didn't find any answers.

Is it possible to an llvm backend to only emit assembly code and not machine code ?

I'm asking this question because I know the answer for gcc and for this compiler it's possible. In fact , gcc produces only assembly code.

Is it possible to do so with llvm ?

Thanks you in advance for your answers


Hi Gaspard,

I think it is possible. There is a “UseIntegratedAssembler” variable in llvm/include/llvm/MC/MCAsmInfo.h Several targets set it to false in the constructors for their MCAsmInfo subclasses.

clang has a command line option -fno-integrated-as that can disable the use of the integrated assembler.

There are at least 2 virtual functions in clang/include/clang/Driver/ToolChain.h related to whether clang needs to invoke a separate assembler by default.

/// IsIntegratedAssemblerDefault - Does this tool chain enable -integrated-as
/// by default.
virtual bool IsIntegratedAssemblerDefault() const { return false; }

/// Check if the toolchain should use the integrated assembler.
virtual bool useIntegratedAs() const;

I hope that helps or at least gives you some places to start looking.