@@ -73,6 +73,23 @@ pub fn trans_intrinsic(ccx: @CrateContext,
73
73
}
74
74
}
75
75
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
+
76
93
fn copy_intrinsic ( bcx : @Block , allow_overlap : bool , tp_ty : ty:: t ) {
77
94
let ccx = bcx. ccx ( ) ;
78
95
let lltp_ty = type_of:: type_of ( ccx, tp_ty) ;
@@ -480,6 +497,9 @@ pub fn trans_intrinsic(ccx: @CrateContext,
480
497
"bswap32" => simple_llvm_intrinsic ( bcx, "llvm.bswap.i32" , 1 ) ,
481
498
"bswap64" => simple_llvm_intrinsic ( bcx, "llvm.bswap.i64" , 1 ) ,
482
499
500
+ "volatile_load" => volatile_load_intrinsic ( bcx) ,
501
+ "volatile_store" => volatile_store_intrinsic ( bcx) ,
502
+
483
503
"i8_add_with_overflow" =>
484
504
with_overflow_instrinsic ( bcx, "llvm.sadd.with.overflow.i8" , output_type) ,
485
505
"i16_add_with_overflow" =>
0 commit comments