Skip to content

rustc needs sensible options for the emission of LLVM IR/LLVM bitcode/ASM  #7791

Closed
@chris-morgan

Description

@chris-morgan

At present,

  • rustc foo.rs emits a binary;
  • rustc --emit-llvm foo.rs emits LLVM bitcode;
  • rustc -S foo.rs emits the final Assembler code;
  • rustc --emit-llvm -S foo.rs emits LLVM IR.

This is madness!

Here is my desired behaviour:

  • rustc --emit-binary foo.rs emits a binary;
  • rustc --emit-llvm-bc foo.rs emits LLVM bitcode;
  • rustc --emit-asm foo.rs emits the final Assembler code;
  • rustc --emit-llvm-ir foo.rs emits LLVM IR.

More than one of these options may be specified, in which case multiple things would be built; if no --emit-* option is specified, it will of course default to --emit-binary.

A brief look at the code suggests that at present it is only designed to produce one of these. An alternative, if staying within this constraint, would be --emit=(binary|llvm-(bc|ir)|asm); however, I feel allowing multiple outputs would be nicer, though I guess just -o wouldn't cut it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-driverArea: rustc_driver that ties everything together into the `rustc` compiler

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions