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