File tree 4 files changed +19
-1
lines changed
rustc_codegen_gcc/src/back
rustc_codegen_llvm/src/back
rustc_codegen_ssa/src/back
4 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -78,14 +78,20 @@ pub(crate) unsafe fn codegen(
78
78
79
79
if config. emit_ir {
80
80
let out = cgcx. output_filenames . temp_path ( OutputType :: LlvmAssembly , module_name) ;
81
- std:: fs:: write ( out, "" ) . expect ( "write file" ) ;
81
+ std:: fs:: write ( & out, "" ) . expect ( "write file" ) ;
82
+ if config. json_artifact_notifications {
83
+ dcx. emit_artifact_notification ( & out, "llvm_ir" ) ;
84
+ }
82
85
}
83
86
84
87
if config. emit_asm {
85
88
let _timer =
86
89
cgcx. prof . generic_activity_with_arg ( "GCC_module_codegen_emit_asm" , & * module. name ) ;
87
90
let path = cgcx. output_filenames . temp_path ( OutputType :: Assembly , module_name) ;
88
91
context. compile_to_file ( OutputKind :: Assembler , path. to_str ( ) . expect ( "path to str" ) ) ;
92
+ if config. json_artifact_notifications {
93
+ dcx. emit_artifact_notification ( & path, "asm" ) ;
94
+ }
89
95
}
90
96
91
97
match config. emit_obj {
Original file line number Diff line number Diff line change @@ -781,6 +781,10 @@ pub(crate) unsafe fn codegen(
781
781
}
782
782
783
783
result. into_result ( ) . map_err ( |( ) | llvm_err ( dcx, LlvmError :: WriteIr { path : & out } ) ) ?;
784
+
785
+ if config. json_artifact_notifications {
786
+ dcx. emit_artifact_notification ( & out, "llvm_ir" ) ;
787
+ }
784
788
}
785
789
786
790
if config. emit_asm {
@@ -809,6 +813,10 @@ pub(crate) unsafe fn codegen(
809
813
& cgcx. prof ,
810
814
)
811
815
} ) ?;
816
+
817
+ if config. json_artifact_notifications {
818
+ dcx. emit_artifact_notification ( & path, "asm" ) ;
819
+ }
812
820
}
813
821
814
822
match config. emit_obj {
Original file line number Diff line number Diff line change @@ -106,6 +106,7 @@ pub struct ModuleConfig {
106
106
pub emit_asm : bool ,
107
107
pub emit_obj : EmitObj ,
108
108
pub emit_thin_lto : bool ,
109
+ pub json_artifact_notifications : bool ,
109
110
pub bc_cmdline : String ,
110
111
111
112
// Miscellaneous flags. These are mostly copied from command-line
@@ -276,6 +277,7 @@ impl ModuleConfig {
276
277
inline_threshold : sess. opts . cg . inline_threshold ,
277
278
emit_lifetime_markers : sess. emit_lifetime_markers ( ) ,
278
279
llvm_plugins : if_regular ! ( sess. opts. unstable_opts. llvm_plugins. clone( ) , vec![ ] ) ,
280
+ json_artifact_notifications : sess. opts . json_artifact_notifications ,
279
281
}
280
282
}
281
283
Original file line number Diff line number Diff line change @@ -229,6 +229,8 @@ flag][option-emit] documentation.
229
229
- "link": The generated crate as specified by the crate-type.
230
230
- "dep-info": The `.d` file with dependency information in a Makefile-like syntax.
231
231
- "metadata": The Rust `.rmeta` file containing metadata about the crate.
232
+ - "asm": The `.s` file with generated assembly
233
+ - "llvm_ir": The `.ll` file with generated textual LLVM IR
232
234
*/
233
235
" emit" : " link"
234
236
}
You can’t perform that action at this time.
0 commit comments