@@ -316,41 +316,31 @@ fn prepare_compiler_for_check(
316
316
}
317
317
}
318
318
319
- /// Checks a single codegen backend.
319
+ /// Check the Cranelift codegen backend.
320
320
#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
321
- pub struct CodegenBackend {
322
- pub build_compiler : Compiler ,
323
- pub target : TargetSelection ,
324
- pub backend : CodegenBackendKind ,
321
+ pub struct CraneliftCodegenBackend {
322
+ build_compiler : Compiler ,
323
+ target : TargetSelection ,
325
324
}
326
325
327
- impl Step for CodegenBackend {
326
+ impl Step for CraneliftCodegenBackend {
328
327
type Output = ( ) ;
328
+
329
329
const ONLY_HOSTS : bool = true ;
330
330
const DEFAULT : bool = true ;
331
331
332
332
fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > {
333
- run. paths ( & [ "compiler/ rustc_codegen_cranelift", "compiler/rustc_codegen_gcc" ] )
333
+ run. alias ( " rustc_codegen_cranelift") . alias ( "cg_clif" )
334
334
}
335
335
336
336
fn make_run ( run : RunConfig < ' _ > ) {
337
- // FIXME: only check the backend(s) that were actually selected in run.paths
338
337
let build_compiler = prepare_compiler_for_check ( run. builder , run. target , Mode :: Codegen ) ;
339
- for backend in [ CodegenBackendKind :: Cranelift , CodegenBackendKind :: Gcc ] {
340
- run. builder . ensure ( CodegenBackend { build_compiler, target : run. target , backend } ) ;
341
- }
338
+ run. builder . ensure ( CraneliftCodegenBackend { build_compiler, target : run. target } ) ;
342
339
}
343
340
344
341
fn run ( self , builder : & Builder < ' _ > ) {
345
- // FIXME: remove once https://github.com/rust-lang/rust/issues/112393 is resolved
346
- if builder. build . config . vendor && self . backend . is_gcc ( ) {
347
- println ! ( "Skipping checking of `rustc_codegen_gcc` with vendoring enabled." ) ;
348
- return ;
349
- }
350
-
351
342
let build_compiler = self . build_compiler ;
352
343
let target = self . target ;
353
- let backend = self . backend ;
354
344
355
345
let mut cargo = builder:: Cargo :: new (
356
346
builder,
@@ -363,31 +353,104 @@ impl Step for CodegenBackend {
363
353
364
354
cargo
365
355
. arg ( "--manifest-path" )
366
- . arg ( builder. src . join ( format ! ( "compiler/{} /Cargo.toml" , backend . crate_name ( ) ) ) ) ;
356
+ . arg ( builder. src . join ( "compiler/rustc_codegen_cranelift /Cargo.toml" ) ) ;
367
357
rustc_cargo_env ( builder, & mut cargo, target) ;
368
358
369
359
let _guard = builder. msg (
370
360
Kind :: Check ,
371
- backend . crate_name ( ) ,
361
+ "rustc_codegen_cranelift" ,
372
362
Mode :: Codegen ,
373
363
self . build_compiler ,
374
364
target,
375
365
) ;
376
366
377
- let stamp = build_stamp:: codegen_backend_stamp ( builder, build_compiler, target, & backend)
378
- . with_prefix ( "check" ) ;
367
+ let stamp = build_stamp:: codegen_backend_stamp (
368
+ builder,
369
+ build_compiler,
370
+ target,
371
+ & CodegenBackendKind :: Cranelift ,
372
+ )
373
+ . with_prefix ( "check" ) ;
379
374
380
375
run_cargo ( builder, cargo, builder. config . free_args . clone ( ) , & stamp, vec ! [ ] , true , false ) ;
381
376
}
382
377
383
378
fn metadata ( & self ) -> Option < StepMetadata > {
384
379
Some (
385
- StepMetadata :: check ( & self . backend . crate_name ( ) , self . target )
380
+ StepMetadata :: check ( "rustc_codegen_cranelift" , self . target )
386
381
. built_by ( self . build_compiler ) ,
387
382
)
388
383
}
389
384
}
390
385
386
+ /// Check the GCC codegen backend.
387
+ #[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
388
+ pub struct GccCodegenBackend {
389
+ build_compiler : Compiler ,
390
+ target : TargetSelection ,
391
+ }
392
+
393
+ impl Step for GccCodegenBackend {
394
+ type Output = ( ) ;
395
+
396
+ const ONLY_HOSTS : bool = true ;
397
+ const DEFAULT : bool = true ;
398
+
399
+ fn should_run ( run : ShouldRun < ' _ > ) -> ShouldRun < ' _ > {
400
+ run. alias ( "rustc_codegen_gcc" ) . alias ( "cg_gcc" )
401
+ }
402
+
403
+ fn make_run ( run : RunConfig < ' _ > ) {
404
+ let build_compiler = prepare_compiler_for_check ( run. builder , run. target , Mode :: Codegen ) ;
405
+ run. builder . ensure ( GccCodegenBackend { build_compiler, target : run. target } ) ;
406
+ }
407
+
408
+ fn run ( self , builder : & Builder < ' _ > ) {
409
+ // FIXME: remove once https://github.com/rust-lang/rust/issues/112393 is resolved
410
+ if builder. build . config . vendor {
411
+ println ! ( "Skipping checking of `rustc_codegen_gcc` with vendoring enabled." ) ;
412
+ return ;
413
+ }
414
+
415
+ let build_compiler = self . build_compiler ;
416
+ let target = self . target ;
417
+
418
+ let mut cargo = builder:: Cargo :: new (
419
+ builder,
420
+ build_compiler,
421
+ Mode :: Codegen ,
422
+ SourceType :: InTree ,
423
+ target,
424
+ builder. kind ,
425
+ ) ;
426
+
427
+ cargo. arg ( "--manifest-path" ) . arg ( builder. src . join ( "compiler/rustc_codegen_gcc/Cargo.toml" ) ) ;
428
+ rustc_cargo_env ( builder, & mut cargo, target) ;
429
+
430
+ let _guard = builder. msg (
431
+ Kind :: Check ,
432
+ "rustc_codegen_gcc" ,
433
+ Mode :: Codegen ,
434
+ self . build_compiler ,
435
+ target,
436
+ ) ;
437
+
438
+ let stamp = build_stamp:: codegen_backend_stamp (
439
+ builder,
440
+ build_compiler,
441
+ target,
442
+ & CodegenBackendKind :: Gcc ,
443
+ )
444
+ . with_prefix ( "check" ) ;
445
+
446
+ run_cargo ( builder, cargo, builder. config . free_args . clone ( ) , & stamp, vec ! [ ] , true , false ) ;
447
+ }
448
+
449
+ fn metadata ( & self ) -> Option < StepMetadata > {
450
+ Some ( StepMetadata :: check ( "rustc_codegen_gcc" , self . target ) . built_by ( self . build_compiler ) )
451
+ }
452
+ }
453
+
391
454
macro_rules! tool_check_step {
392
455
(
393
456
$name: ident {
0 commit comments