[llvm-dev] Question about LLVM backend

Skip to first unread message

via llvm-dev

Nov 24, 2021, 1:30:12 PM11/24/21
to llvm...@lists.llvm.org
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


LLVM Developers mailing list

Craig Topper via llvm-dev

Nov 24, 2021, 1:55:27 PM11/24/21
to gas...@courchinoux.org, llvm-dev
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.


Reply all
Reply to author
0 new messages