@@ -73,6 +73,23 @@ pub fn trans_intrinsic(ccx: @CrateContext,
7373 }
7474 }
7575
76+ fn volatile_load_intrinsic ( bcx : @Block ) {
77+ let first_real_arg = bcx. fcx . arg_pos ( 0 u) ;
78+ let src = get_param ( bcx. fcx . llfn , first_real_arg) ;
79+
80+ let val = VolatileLoad ( bcx, src) ;
81+ Ret ( bcx, val) ;
82+ }
83+
84+ fn volatile_store_intrinsic ( bcx : @Block ) {
85+ let first_real_arg = bcx. fcx . arg_pos ( 0 u) ;
86+ let dst = get_param ( bcx. fcx . llfn , first_real_arg) ;
87+ let val = get_param ( bcx. fcx . llfn , first_real_arg + 1 ) ;
88+
89+ VolatileStore ( bcx, val, dst) ;
90+ RetVoid ( bcx) ;
91+ }
92+
7693 fn copy_intrinsic ( bcx : @Block , allow_overlap : bool , tp_ty : ty:: t ) {
7794 let ccx = bcx. ccx ( ) ;
7895 let lltp_ty = type_of:: type_of ( ccx, tp_ty) ;
@@ -480,6 +497,9 @@ pub fn trans_intrinsic(ccx: @CrateContext,
480497 "bswap32" => simple_llvm_intrinsic ( bcx, "llvm.bswap.i32" , 1 ) ,
481498 "bswap64" => simple_llvm_intrinsic ( bcx, "llvm.bswap.i64" , 1 ) ,
482499
500+ "volatile_load" => volatile_load_intrinsic ( bcx) ,
501+ "volatile_store" => volatile_store_intrinsic ( bcx) ,
502+
483503 "i8_add_with_overflow" =>
484504 with_overflow_instrinsic ( bcx, "llvm.sadd.with.overflow.i8" , output_type) ,
485505 "i16_add_with_overflow" =>
0 commit comments