@@ -822,41 +822,37 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
822
822
InlineAsmOperandRef :: InOut { reg, late, in_value, out_place }
823
823
}
824
824
mir:: InlineAsmOperand :: Const { ref value } => {
825
- if let mir:: Operand :: Constant ( constant) = value {
826
- let const_value = self
827
- . eval_mir_constant ( constant)
828
- . unwrap_or_else ( |_| span_bug ! ( span, "asm const cannot be resolved" ) ) ;
829
- let ty = constant. ty ( ) ;
830
- let size = bx. layout_of ( ty) . size ;
831
- let scalar = match const_value {
832
- ConstValue :: Scalar ( s) => s,
833
- _ => span_bug ! (
834
- span,
835
- "expected Scalar for promoted asm const, but got {:#?}" ,
836
- const_value
837
- ) ,
838
- } ;
839
- let value = scalar. assert_bits ( size) ;
840
- let string = match ty. kind ( ) {
841
- ty:: Uint ( _) => value. to_string ( ) ,
842
- ty:: Int ( int_ty) => {
843
- match int_ty. normalize ( bx. tcx ( ) . sess . target . pointer_width ) {
844
- ty:: IntTy :: I8 => ( value as i8 ) . to_string ( ) ,
845
- ty:: IntTy :: I16 => ( value as i16 ) . to_string ( ) ,
846
- ty:: IntTy :: I32 => ( value as i32 ) . to_string ( ) ,
847
- ty:: IntTy :: I64 => ( value as i64 ) . to_string ( ) ,
848
- ty:: IntTy :: I128 => ( value as i128 ) . to_string ( ) ,
849
- ty:: IntTy :: Isize => unreachable ! ( ) ,
850
- }
825
+ let const_value = self
826
+ . eval_mir_constant ( value)
827
+ . unwrap_or_else ( |_| span_bug ! ( span, "asm const cannot be resolved" ) ) ;
828
+ let ty = value. ty ( ) ;
829
+ let size = bx. layout_of ( ty) . size ;
830
+ let scalar = match const_value {
831
+ ConstValue :: Scalar ( s) => s,
832
+ _ => span_bug ! (
833
+ span,
834
+ "expected Scalar for promoted asm const, but got {:#?}" ,
835
+ const_value
836
+ ) ,
837
+ } ;
838
+ let value = scalar. assert_bits ( size) ;
839
+ let string = match ty. kind ( ) {
840
+ ty:: Uint ( _) => value. to_string ( ) ,
841
+ ty:: Int ( int_ty) => {
842
+ match int_ty. normalize ( bx. tcx ( ) . sess . target . pointer_width ) {
843
+ ty:: IntTy :: I8 => ( value as i8 ) . to_string ( ) ,
844
+ ty:: IntTy :: I16 => ( value as i16 ) . to_string ( ) ,
845
+ ty:: IntTy :: I32 => ( value as i32 ) . to_string ( ) ,
846
+ ty:: IntTy :: I64 => ( value as i64 ) . to_string ( ) ,
847
+ ty:: IntTy :: I128 => ( value as i128 ) . to_string ( ) ,
848
+ ty:: IntTy :: Isize => unreachable ! ( ) ,
851
849
}
852
- ty:: Float ( ty:: FloatTy :: F32 ) => f32:: from_bits ( value as u32 ) . to_string ( ) ,
853
- ty:: Float ( ty:: FloatTy :: F64 ) => f64:: from_bits ( value as u64 ) . to_string ( ) ,
854
- _ => span_bug ! ( span, "asm const has bad type {}" , ty) ,
855
- } ;
856
- InlineAsmOperandRef :: Const { string }
857
- } else {
858
- span_bug ! ( span, "asm const is not a constant" ) ;
859
- }
850
+ }
851
+ ty:: Float ( ty:: FloatTy :: F32 ) => f32:: from_bits ( value as u32 ) . to_string ( ) ,
852
+ ty:: Float ( ty:: FloatTy :: F64 ) => f64:: from_bits ( value as u64 ) . to_string ( ) ,
853
+ _ => span_bug ! ( span, "asm const has bad type {}" , ty) ,
854
+ } ;
855
+ InlineAsmOperandRef :: Const { string }
860
856
}
861
857
mir:: InlineAsmOperand :: SymFn { ref value } => {
862
858
let literal = self . monomorphize ( value. literal ) ;
0 commit comments