@@ -129,7 +129,7 @@ pub fn trans_intrinsic(ccx: &CrateContext,
129129 RetVoid ( bcx) ;
130130 }
131131
132- fn copy_intrinsic ( bcx : & Block , allow_overlap : bool , tp_ty : ty:: t ) {
132+ fn copy_intrinsic ( bcx : & Block , allow_overlap : bool , volatile : bool , tp_ty : ty:: t ) {
133133 let ccx = bcx. ccx ( ) ;
134134 let lltp_ty = type_of:: type_of ( ccx, tp_ty) ;
135135 let align = C_i32 ( ccx, machine:: llalign_of_min ( ccx, lltp_ty) as i32 ) ;
@@ -154,13 +154,12 @@ pub fn trans_intrinsic(ccx: &CrateContext,
154154 let dst_ptr = PointerCast ( bcx, get_param ( decl, first_real_arg) , Type :: i8p ( ccx) ) ;
155155 let src_ptr = PointerCast ( bcx, get_param ( decl, first_real_arg + 1 ) , Type :: i8p ( ccx) ) ;
156156 let count = get_param ( decl, first_real_arg + 2 ) ;
157- let volatile = C_i1 ( ccx, false ) ;
158157 let llfn = ccx. get_intrinsic ( & name) ;
159- Call ( bcx, llfn, [ dst_ptr, src_ptr, Mul ( bcx, size, count) , align, volatile] , [ ] ) ;
158+ Call ( bcx, llfn, [ dst_ptr, src_ptr, Mul ( bcx, size, count) , align, C_i1 ( ccx , volatile) ] , [ ] ) ;
160159 RetVoid ( bcx) ;
161160 }
162161
163- fn memset_intrinsic ( bcx : & Block , tp_ty : ty:: t ) {
162+ fn memset_intrinsic ( bcx : & Block , volatile : bool , tp_ty : ty:: t ) {
164163 let ccx = bcx. ccx ( ) ;
165164 let lltp_ty = type_of:: type_of ( ccx, tp_ty) ;
166165 let align = C_i32 ( ccx, machine:: llalign_of_min ( ccx, lltp_ty) as i32 ) ;
@@ -176,9 +175,8 @@ pub fn trans_intrinsic(ccx: &CrateContext,
176175 let dst_ptr = PointerCast ( bcx, get_param ( decl, first_real_arg) , Type :: i8p ( ccx) ) ;
177176 let val = get_param ( decl, first_real_arg + 1 ) ;
178177 let count = get_param ( decl, first_real_arg + 2 ) ;
179- let volatile = C_i1 ( ccx, false ) ;
180178 let llfn = ccx. get_intrinsic ( & name) ;
181- Call ( bcx, llfn, [ dst_ptr, val, Mul ( bcx, size, count) , align, volatile] , [ ] ) ;
179+ Call ( bcx, llfn, [ dst_ptr, val, Mul ( bcx, size, count) , align, C_i1 ( ccx , volatile) ] , [ ] ) ;
182180 RetVoid ( bcx) ;
183181 }
184182
@@ -466,11 +464,15 @@ pub fn trans_intrinsic(ccx: &CrateContext,
466464 let lladdr = InBoundsGEP ( bcx, ptr, [ offset] ) ;
467465 Ret ( bcx, lladdr) ;
468466 }
469- "copy_nonoverlapping_memory" => {
470- copy_intrinsic ( bcx, false , * substs. tys . get ( 0 ) )
471- }
472- "copy_memory" => copy_intrinsic ( bcx, true , * substs. tys . get ( 0 ) ) ,
473- "set_memory" => memset_intrinsic ( bcx, * substs. tys . get ( 0 ) ) ,
467+ "copy_nonoverlapping_memory" => copy_intrinsic ( bcx, false , false , * substs. tys . get ( 0 ) ) ,
468+ "copy_memory" => copy_intrinsic ( bcx, true , false , * substs. tys . get ( 0 ) ) ,
469+ "set_memory" => memset_intrinsic ( bcx, false , * substs. tys . get ( 0 ) ) ,
470+
471+ "volatile_copy_nonoverlapping_memory" =>
472+ copy_intrinsic ( bcx, false , true , * substs. tys . get ( 0 ) ) ,
473+ "volatile_copy_memory" => copy_intrinsic ( bcx, true , true , * substs. tys . get ( 0 ) ) ,
474+ "volatile_set_memory" => memset_intrinsic ( bcx, true , * substs. tys . get ( 0 ) ) ,
475+
474476 "ctlz8" => count_zeros_intrinsic ( bcx, "llvm.ctlz.i8" ) ,
475477 "ctlz16" => count_zeros_intrinsic ( bcx, "llvm.ctlz.i16" ) ,
476478 "ctlz32" => count_zeros_intrinsic ( bcx, "llvm.ctlz.i32" ) ,
0 commit comments