@@ -28,6 +28,19 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
28
28
global
29
29
// TODO(antoyo): set linkage.
30
30
}
31
+
32
+ pub fn const_bitcast ( & self , value : RValue < ' gcc > , typ : Type < ' gcc > ) -> RValue < ' gcc > {
33
+ if value. get_type ( ) == self . bool_type . make_pointer ( ) {
34
+ if let Some ( pointee) = typ. get_pointee ( ) {
35
+ if pointee. dyncast_vector ( ) . is_some ( ) {
36
+ panic ! ( )
37
+ }
38
+ }
39
+ }
40
+ // NOTE: since bitcast makes a value non-constant, don't bitcast if not necessary as some
41
+ // SIMD builtins require a constant value.
42
+ self . bitcast_if_needed ( value, typ)
43
+ }
31
44
}
32
45
33
46
pub fn bytes_in_context < ' gcc , ' tcx > ( cx : & CodegenCx < ' gcc , ' tcx > , bytes : & [ u8 ] ) -> RValue < ' gcc > {
@@ -239,19 +252,6 @@ impl<'gcc, 'tcx> ConstMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
239
252
const_alloc_to_gcc ( self , alloc)
240
253
}
241
254
242
- fn const_bitcast ( & self , value : RValue < ' gcc > , typ : Type < ' gcc > ) -> RValue < ' gcc > {
243
- if value. get_type ( ) == self . bool_type . make_pointer ( ) {
244
- if let Some ( pointee) = typ. get_pointee ( ) {
245
- if pointee. dyncast_vector ( ) . is_some ( ) {
246
- panic ! ( )
247
- }
248
- }
249
- }
250
- // NOTE: since bitcast makes a value non-constant, don't bitcast if not necessary as some
251
- // SIMD builtins require a constant value.
252
- self . bitcast_if_needed ( value, typ)
253
- }
254
-
255
255
fn const_ptr_byte_offset ( & self , base_addr : Self :: Value , offset : abi:: Size ) -> Self :: Value {
256
256
self . context
257
257
. new_array_access ( None , base_addr, self . const_usize ( offset. bytes ( ) ) )
0 commit comments