summaryrefslogtreecommitdiff
path: root/src/trans/codegen_mmir.cpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2019-08-18 10:50:49 +0800
committerJohn Hodge <tpg@ucc.asn.au>2019-08-18 10:50:49 +0800
commit2159f5a48c4557087f39b710b8009ebdc5d7cd07 (patch)
tree2f68475b818338384fef3d23d5d3591e58926ac3 /src/trans/codegen_mmir.cpp
parent3817f9e19020b04d1a39a5c2a8f30814eb0bc065 (diff)
downloadmrust-2159f5a48c4557087f39b710b8009ebdc5d7cd07.tar.gz
Codegen MMIR - panic_impl stub
Diffstat (limited to 'src/trans/codegen_mmir.cpp')
-rw-r--r--src/trans/codegen_mmir.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/trans/codegen_mmir.cpp b/src/trans/codegen_mmir.cpp
index 19957948..97ac00eb 100644
--- a/src/trans/codegen_mmir.cpp
+++ b/src/trans/codegen_mmir.cpp
@@ -59,6 +59,7 @@ namespace
bool prev_was_num = was_num; was_num = false;
switch(w.tag())
{
+ case ::MIR::LValue::Wrapper::TAGDEAD: throw "";
TU_ARM(w, Deref, e)
os << ")";
break;
@@ -190,6 +191,20 @@ namespace
m_of << "\t\tRETURN\n";
m_of << "\t}\n";
m_of << "}\n";
+
+ {
+ // Bind `panic_impl` lang item to the item tagged with `panic_implementation`
+ const auto& panic_impl_path = m_crate.get_lang_item_path(Span(), "mrustc-panic_implementation");
+ m_of << "fn ::panic_impl#(usize): u32 = \"panic_impl\":\"Rust\" {\n";
+ m_of << "\t0: {\n";
+ m_of << "\t\tCALL RETURN = " << panic_impl_path << "(arg0) goto 1 else 2\n";
+ m_of << "\t}\n";
+ m_of << "\t1: { RETURN }\n";
+ m_of << "\t2: { DIVERGE }\n";
+ m_of << "}\n";
+
+ // TODO: OOM impl?
+ }
}
m_of.flush();