File tree Expand file tree Collapse file tree 7 files changed +20
-3
lines changed Expand file tree Collapse file tree 7 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -364,6 +364,9 @@ class TypeEncoder final : public TypeVisitor<TypeEncoder> {
364
364
case BuiltinType::ULong: tag = TagULong; break ;
365
365
case BuiltinType::ULongLong: tag = TagULongLong; break ;
366
366
case BuiltinType::Half: tag = TagHalf; break ;
367
+ #if CLANG_VERSION_MAJOR >= 11
368
+ case BuiltinType::BFloat16: tag = TagBFloat16; break ;
369
+ #endif
367
370
case BuiltinType::Float: tag = TagFloat; break ;
368
371
case BuiltinType::Double: tag = TagDouble; break ;
369
372
case BuiltinType::LongDouble: tag = TagLongDouble; break ;
Original file line number Diff line number Diff line change @@ -141,6 +141,7 @@ enum TypeTag {
141
141
TagBlockPointer,
142
142
TagComplexType,
143
143
TagHalf,
144
+ TagBFloat16,
144
145
};
145
146
146
147
enum StringTypeTag {
Original file line number Diff line number Diff line change @@ -578,6 +578,11 @@ impl ConversionContext {
578
578
self . processed_nodes . insert ( new_id, OTHER_TYPE ) ;
579
579
}
580
580
581
+ TypeTag :: TagBFloat16 if expected_ty & OTHER_TYPE != 0 => {
582
+ self . add_type ( new_id, not_located ( CTypeKind :: BFloat16 ) ) ;
583
+ self . processed_nodes . insert ( new_id, OTHER_TYPE ) ;
584
+ }
585
+
581
586
TypeTag :: TagInt128 if expected_ty & OTHER_TYPE != 0 => {
582
587
self . add_type ( new_id, not_located ( CTypeKind :: Int128 ) ) ;
583
588
self . processed_nodes . insert ( new_id, OTHER_TYPE ) ;
@@ -783,6 +788,12 @@ impl ConversionContext {
783
788
self . processed_nodes . insert ( new_id, OTHER_TYPE ) ;
784
789
}
785
790
791
+ TypeTag :: TagBFloat16 => {
792
+ let ty = CTypeKind :: BuiltinFn ;
793
+ self . add_type ( new_id, not_located ( ty) ) ;
794
+ self . processed_nodes . insert ( new_id, OTHER_TYPE ) ;
795
+ }
796
+
786
797
TypeTag :: TagVectorType => {
787
798
let elt = from_value ( ty_node. extras [ 0 ] . clone ( ) ) . expect ( "Vector child not found" ) ;
788
799
let elt_new = self . visit_qualified_type ( elt) ;
Original file line number Diff line number Diff line change @@ -267,7 +267,8 @@ fn immediate_type_children(kind: &CTypeKind) -> Vec<SomeId> {
267
267
Elaborated ( _) => vec ! [ ] , // These are references to previous definitions
268
268
TypeOfExpr ( e) => intos ! [ e] ,
269
269
Void | Bool | Short | Int | Long | LongLong | UShort | UInt | ULong | ULongLong | SChar
270
- | UChar | Char | Double | LongDouble | Float | Int128 | UInt128 | BuiltinFn | Half => {
270
+ | UChar | Char | Double | LongDouble | Float | Int128 | UInt128 | BuiltinFn | Half
271
+ | BFloat16 => {
271
272
vec ! [ ]
272
273
}
273
274
Original file line number Diff line number Diff line change @@ -1577,6 +1577,7 @@ pub enum CTypeKind {
1577
1577
Vector ( CQualTypeId , usize ) ,
1578
1578
1579
1579
Half ,
1580
+ BFloat16 ,
1580
1581
}
1581
1582
1582
1583
#[ derive( Copy , Clone , Debug ) ]
Original file line number Diff line number Diff line change @@ -332,7 +332,7 @@ impl TypeConverter {
332
332
CTypeKind :: LongDouble => Ok ( mk ( ) . path_ty ( mk ( ) . path ( vec ! [ "f128" , "f128" ] ) ) ) ,
333
333
CTypeKind :: Float => Ok ( mk ( ) . path_ty ( mk ( ) . path ( vec ! [ "libc" , "c_float" ] ) ) ) ,
334
334
CTypeKind :: Int128 => Ok ( mk ( ) . path_ty ( mk ( ) . path ( vec ! [ "i128" ] ) ) ) ,
335
- CTypeKind :: UInt128 => Ok ( mk ( ) . path_ty ( mk ( ) . path ( vec ! [ "u128 " ] ) ) ) ,
335
+ CTypeKind :: UInt128 => Ok ( mk ( ) . path_ty ( mk ( ) . path ( vec ! [ "bf16 " ] ) ) ) ,
336
336
337
337
CTypeKind :: Pointer ( qtype) => self . convert_pointer ( ctxt, qtype) ,
338
338
Original file line number Diff line number Diff line change @@ -4675,7 +4675,7 @@ impl<'c> Translation<'c> {
4675
4675
match type_kind {
4676
4676
// libc can be accessed from anywhere as of Rust 2019 by full path
4677
4677
Void | Char | SChar | UChar | Short | UShort | Int | UInt | Long | ULong | LongLong
4678
- | ULongLong | Int128 | UInt128 | Half | Float | Double | LongDouble => { }
4678
+ | ULongLong | Int128 | UInt128 | Half | BFloat16 | Float | Double | LongDouble => { }
4679
4679
// Bool uses the bool type, so no dependency on libc
4680
4680
Bool => { }
4681
4681
Paren ( ctype)
You can’t perform that action at this time.
0 commit comments