diff options
author | John Hodge (bugs) <tpg@mutabah.net> | 2017-05-14 12:01:45 +0800 |
---|---|---|
committer | John Hodge (bugs) <tpg@mutabah.net> | 2017-05-14 12:01:45 +0800 |
commit | 1d2fe7681219700998c8ecbdb8ed5acab66578df (patch) | |
tree | 0d38e8ab5fd80c890d3dec67a0596abfc7a4f0cd /src/mir/mir.hpp | |
parent | c6fca061dd134068c831aefd88d9535a30f423ed (diff) | |
parent | fde22b3f03d802231985b8ded567cba16cb5aa00 (diff) | |
download | mrust-1d2fe7681219700998c8ecbdb8ed5acab66578df.tar.gz |
Merge branch 'master' of https://github.com/thepowersgang/mrustc
# Conflicts:
# src/common.hpp
# src/hir/deserialise.cpp
# src/hir_typeck/static.cpp
# src/mir/from_hir.cpp
# src/mir/from_hir.hpp
# src/mir/from_hir_match.cpp
# src/mir/helpers.hpp
# src/mir/mir_builder.cpp
Diffstat (limited to 'src/mir/mir.hpp')
-rw-r--r-- | src/mir/mir.hpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/mir/mir.hpp b/src/mir/mir.hpp index 75bb29a8..c22f8d5d 100644 --- a/src/mir/mir.hpp +++ b/src/mir/mir.hpp @@ -112,10 +112,13 @@ TAGGED_UNION_EX(Constant, (), Int, ( (ItemAddr, ::HIR::Path) // address of a value ), (), (), ( friend ::std::ostream& operator<<(::std::ostream& os, const Constant& v); - bool operator==(const Constant& b) const; - inline bool operator!=(const Constant& b) const { - return !(*this == b); - } + ::Ordering ord(const Constant& b) const; + inline bool operator==(const Constant& b) const { return ord(b) == ::OrdEqual; } + inline bool operator!=(const Constant& b) const { return ord(b) != ::OrdEqual; } + inline bool operator<(const Constant& b) const { return ord(b) == ::OrdLess; } + inline bool operator<=(const Constant& b) const { return ord(b) != ::OrdGreater; } + inline bool operator>(const Constant& b) const { return ord(b) == ::OrdGreater; } + inline bool operator>=(const Constant& b) const { return ord(b) != ::OrdLess; } Constant clone() const; ) ); @@ -269,8 +272,13 @@ TAGGED_UNION(Statement, Assign, eDropKind kind; // NOTE: For the `box` primitive LValue slot; unsigned int flag_idx; // Valid if != ~0u + }), + (ScopeEnd, struct { + ::std::vector<unsigned> vars; + ::std::vector<unsigned> tmps; }) ); +extern ::std::ostream& operator<<(::std::ostream& os, const Statement& x); struct BasicBlock { @@ -282,6 +290,7 @@ struct BasicBlock class Function { public: + // TODO: Unify Variables, Temporaries, and Arguments ::std::vector< ::HIR::TypeRef> named_variables; ::std::vector< ::HIR::TypeRef> temporaries; ::std::vector<bool> drop_flags; |