diff options
author | John Hodge <tpg@mutabah.net> | 2018-05-12 17:54:27 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2018-05-12 17:54:27 +0800 |
commit | 835519441441dcff3bb39e9a82f433a37c61d6ef (patch) | |
tree | 1d406288ed9a4b0985fa8846d1d3ed9d48f87fd7 /tools/standalone_miri/module_tree.hpp | |
parent | d667b43bd5971f63d396d2a1a587743c3cfceb68 (diff) | |
download | mrust-835519441441dcff3bb39e9a82f433a37c61d6ef.tar.gz |
Standalone MIRI - Get type for statics, add some pthread_* FFI stubs
Diffstat (limited to 'tools/standalone_miri/module_tree.hpp')
-rw-r--r-- | tools/standalone_miri/module_tree.hpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/tools/standalone_miri/module_tree.hpp b/tools/standalone_miri/module_tree.hpp index ca24b06a..5479d9ef 100644 --- a/tools/standalone_miri/module_tree.hpp +++ b/tools/standalone_miri/module_tree.hpp @@ -9,15 +9,14 @@ #include "../../src/mir/mir.hpp" #include "hir_sim.hpp" - -struct Value; +#include "value.hpp" struct Function { ::HIR::Path my_path; ::std::vector<::HIR::TypeRef> args; ::HIR::TypeRef ret_ty; - + // If `link_name` is non-empty, then the function is an external struct { ::std::string link_name; @@ -25,6 +24,11 @@ struct Function } external; ::MIR::Function m_mir; }; +struct Static +{ + ::HIR::TypeRef ty; + Value val; +}; /// Container for loaded code and structures class ModuleTree @@ -34,8 +38,7 @@ class ModuleTree ::std::set<::std::string> loaded_files; ::std::map<::HIR::Path, Function> functions; - ::std::map<::HIR::Path, Value> statics; - // TODO: statics + ::std::map<::HIR::Path, Static> statics; // Hack: Tuples are stored as `::""::<A,B,C,...>` ::std::map<::HIR::GenericPath, ::std::unique_ptr<DataType>> data_types; @@ -47,8 +50,8 @@ public: ::HIR::SimplePath find_lang_item(const char* name) const; const Function& get_function(const ::HIR::Path& p) const; const Function* get_function_opt(const ::HIR::Path& p) const; - Value& get_static(const ::HIR::Path& p); - Value* get_static_opt(const ::HIR::Path& p); + Static& get_static(const ::HIR::Path& p); + Static* get_static_opt(const ::HIR::Path& p); const DataType& get_composite(const ::HIR::GenericPath& p) const { return *data_types.at(p); |