@@ -129,7 +129,7 @@ pub fn trans_intrinsic(ccx: &CrateContext,
129
129
RetVoid ( bcx) ;
130
130
}
131
131
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 ) {
133
133
let ccx = bcx. ccx ( ) ;
134
134
let lltp_ty = type_of:: type_of ( ccx, tp_ty) ;
135
135
let align = C_i32 ( ccx, machine:: llalign_of_min ( ccx, lltp_ty) as i32 ) ;
@@ -154,13 +154,12 @@ pub fn trans_intrinsic(ccx: &CrateContext,
154
154
let dst_ptr = PointerCast ( bcx, get_param ( decl, first_real_arg) , Type :: i8p ( ccx) ) ;
155
155
let src_ptr = PointerCast ( bcx, get_param ( decl, first_real_arg + 1 ) , Type :: i8p ( ccx) ) ;
156
156
let count = get_param ( decl, first_real_arg + 2 ) ;
157
- let volatile = C_i1 ( ccx, false ) ;
158
157
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) ] , [ ] ) ;
160
159
RetVoid ( bcx) ;
161
160
}
162
161
163
- fn memset_intrinsic ( bcx : & Block , tp_ty : ty:: t ) {
162
+ fn memset_intrinsic ( bcx : & Block , volatile : bool , tp_ty : ty:: t ) {
164
163
let ccx = bcx. ccx ( ) ;
165
164
let lltp_ty = type_of:: type_of ( ccx, tp_ty) ;
166
165
let align = C_i32 ( ccx, machine:: llalign_of_min ( ccx, lltp_ty) as i32 ) ;
@@ -176,9 +175,8 @@ pub fn trans_intrinsic(ccx: &CrateContext,
176
175
let dst_ptr = PointerCast ( bcx, get_param ( decl, first_real_arg) , Type :: i8p ( ccx) ) ;
177
176
let val = get_param ( decl, first_real_arg + 1 ) ;
178
177
let count = get_param ( decl, first_real_arg + 2 ) ;
179
- let volatile = C_i1 ( ccx, false ) ;
180
178
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) ] , [ ] ) ;
182
180
RetVoid ( bcx) ;
183
181
}
184
182
@@ -466,11 +464,15 @@ pub fn trans_intrinsic(ccx: &CrateContext,
466
464
let lladdr = InBoundsGEP ( bcx, ptr, [ offset] ) ;
467
465
Ret ( bcx, lladdr) ;
468
466
}
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
+
474
476
"ctlz8" => count_zeros_intrinsic ( bcx, "llvm.ctlz.i8" ) ,
475
477
"ctlz16" => count_zeros_intrinsic ( bcx, "llvm.ctlz.i16" ) ,
476
478
"ctlz32" => count_zeros_intrinsic ( bcx, "llvm.ctlz.i32" ) ,
0 commit comments