92
92
//! source-level module, functions from the same module will be available for
93
93
//! inlining, even when they are not marked `#[inline]`.
94
94
95
- // Manuel, fixing rebase
96
95
use rustc_symbol_mangling:: symbol_name_for_instance_in_crate;
97
96
use rustc_middle:: middle:: typetree:: { Kind , Type , TypeTree } ;
98
97
use rustc_target:: abi:: FieldsShape ;
@@ -1143,7 +1142,6 @@ fn collect_and_partition_mono_items(tcx: TyCtxt<'_>, (): ()) -> (&DefIdSet, &[Au
1143
1142
} )
1144
1143
. collect ( ) ;
1145
1144
1146
-
1147
1145
let autodiff_items = items
1148
1146
. iter ( )
1149
1147
. filter_map ( |item| match * item {
@@ -1156,6 +1154,7 @@ fn collect_and_partition_mono_items(tcx: TyCtxt<'_>, (): ()) -> (&DefIdSet, &[Au
1156
1154
if !target_attrs. apply_autodiff ( ) {
1157
1155
return None ;
1158
1156
}
1157
+ println ! ( "target_id: {:?}" , target_id) ;
1159
1158
1160
1159
let target_symbol =
1161
1160
symbol_name_for_instance_in_crate ( tcx, instance. clone ( ) , LOCAL_CRATE ) ;
@@ -1250,9 +1249,6 @@ fn collect_and_partition_mono_items(tcx: TyCtxt<'_>, (): ()) -> (&DefIdSet, &[Au
1250
1249
1251
1250
( tcx. arena . alloc ( mono_items) , autodiff_items, codegen_units)
1252
1251
}
1253
- //use rustc_middle::ty::{self, Adt, ParamEnvAnd, Ty};
1254
- //use rustc_target::abi::FieldsShape;
1255
- //use std::iter;
1256
1252
1257
1253
pub fn typetree_empty ( ) -> TypeTree {
1258
1254
TypeTree ( vec ! [ ] )
@@ -1263,19 +1259,14 @@ pub fn typetree_from_ty<'a>(ty: Ty<'a>, tcx: TyCtxt<'a>, depth: usize) -> TypeTr
1263
1259
if ty. is_fn_ptr ( ) {
1264
1260
unimplemented ! ( "what to do whith fn ptr?" ) ;
1265
1261
}
1266
-
1267
1262
let inner_ty = ty. builtin_deref ( true ) . unwrap ( ) . ty ;
1268
1263
let child = typetree_from_ty ( inner_ty, tcx, depth + 1 ) ;
1269
-
1270
1264
let tt = Type { offset : -1 , kind : Kind :: Pointer , size : 8 , child } ;
1271
- //println!("{:depth$} add indirection {:?}", "", tt);
1272
-
1273
1265
return TypeTree ( vec ! [ tt] ) ;
1274
1266
}
1275
1267
1276
1268
if ty. is_scalar ( ) {
1277
1269
assert ! ( !ty. is_any_ptr( ) ) ;
1278
-
1279
1270
let ( kind, size) = if ty. is_integral ( ) {
1280
1271
( Kind :: Integer , 8 )
1281
1272
} else {
@@ -1286,7 +1277,6 @@ pub fn typetree_from_ty<'a>(ty: Ty<'a>, tcx: TyCtxt<'a>, depth: usize) -> TypeTr
1286
1277
_ => panic ! ( "floatTy scalar that is neither f32 nor f64" ) ,
1287
1278
}
1288
1279
} ;
1289
-
1290
1280
return TypeTree ( vec ! [ Type { offset: -1 , child: typetree_empty( ) , kind, size } ] ) ;
1291
1281
}
1292
1282
@@ -1311,7 +1301,6 @@ pub fn typetree_from_ty<'a>(ty: Ty<'a>, tcx: TyCtxt<'a>, depth: usize) -> TypeTr
1311
1301
FieldsShape :: Arbitrary { offsets : o, memory_index : m } => ( o, m) ,
1312
1302
_ => panic ! ( "" ) ,
1313
1303
} ;
1314
- //println!("{:depth$} combine fields", "");
1315
1304
1316
1305
let fields = adt_def. all_fields ( ) ;
1317
1306
let fields = fields
@@ -1336,17 +1325,12 @@ pub fn typetree_from_ty<'a>(ty: Ty<'a>, tcx: TyCtxt<'a>, depth: usize) -> TypeTr
1336
1325
}
1337
1326
}
1338
1327
1339
- //inner_tt.offset = offset;
1340
-
1341
- //println!("{:depth$} -> {:?}", "", child);
1342
-
1343
1328
Some ( child)
1344
1329
} )
1345
1330
. flatten ( )
1346
1331
. collect :: < Vec < Type > > ( ) ;
1347
1332
1348
1333
let ret_tt = TypeTree ( fields) ;
1349
- //println!("{:depth$} into {:?}", "", ret_tt);
1350
1334
return ret_tt;
1351
1335
} else {
1352
1336
unimplemented ! ( "adt that isn't a struct" ) ;
@@ -1378,8 +1362,6 @@ pub fn typetree_from_ty<'a>(ty: Ty<'a>, tcx: TyCtxt<'a>, depth: usize) -> TypeTr
1378
1362
. collect ( ) ,
1379
1363
) ;
1380
1364
1381
- //println!("{:depth$} repeated array into {:?}", "", tt);
1382
-
1383
1365
return tt;
1384
1366
}
1385
1367
@@ -1390,7 +1372,6 @@ pub fn typetree_from_ty<'a>(ty: Ty<'a>, tcx: TyCtxt<'a>, depth: usize) -> TypeTr
1390
1372
return subtt;
1391
1373
}
1392
1374
1393
- //println!("Warning: create empty typetree for {}", ty);
1394
1375
typetree_empty ( )
1395
1376
}
1396
1377
0 commit comments