diff options
author | John Hodge <tpg@mutabah.net> | 2017-02-12 16:48:56 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2017-05-05 14:44:18 +0800 |
commit | b2b3c5c397d6b3e0862714aa194faff22ce33519 (patch) | |
tree | 5fbe07fb0dc1b66849c9ccff587e4a5211aa4603 | |
parent | da78ba38d75fe70cd8388ece22bb7756136414f9 (diff) | |
download | mrust-b2b3c5c397d6b3e0862714aa194faff22ce33519.tar.gz |
Codegen C - volatile_load/store
-rw-r--r-- | src/trans/codegen_c.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/trans/codegen_c.cpp b/src/trans/codegen_c.cpp index 0c9f7805..2790a788 100644 --- a/src/trans/codegen_c.cpp +++ b/src/trans/codegen_c.cpp @@ -2370,6 +2370,13 @@ namespace { else if( name == "fmaf32" || name == "fmaf64" ) { emit_lvalue(e.ret_val); m_of << " = fma" << (name.back()=='2'?"f":"") << "("; emit_param(e.args.at(0)); m_of << ", "; emit_param(e.args.at(1)); m_of << ", "; emit_param(e.args.at(1)); m_of << ")"; } + // --- Volatile Load/Store + else if( name == "volatile_load" ) { + emit_lvalue(e.ret_val); m_of << " = *(volatile "; emit_ctype(params.m_types.at(0)); m_of << "*)"; emit_lvalue(e.args.at(0)); + } + else if( name == "volatile_store" ) { + m_of << "*(volatile "; emit_ctype(params.m_types.at(0)); m_of << "*)"; emit_lvalue(e.args.at(0)); m_of << " = "; emit_lvalue(e.args.at(1)); + } // --- Atomics! // > Single-ordering atomics else if( name == "atomic_xadd" || name.compare(0, 7+4+1, "atomic_xadd_") == 0 ) { |