Chromium Code Reviews| Index: src/IceDefs.h |
| diff --git a/src/IceDefs.h b/src/IceDefs.h |
| index 1222424378c7ed41768ae3666128bca9a3170d25..85abb5836e47058cfb70dbcb7ccbd73b2bc15f33 100644 |
| --- a/src/IceDefs.h |
| +++ b/src/IceDefs.h |
| @@ -182,6 +182,34 @@ using SizeT = uint32_t; |
| /// used for representing Variable live ranges. |
| using InstNumberT = int32_t; |
| +/// RegNumT is for holding target-specific register numbers, plus the sentinel |
| +/// value NoRegister. |
| +class RegNumT { |
| +public: |
| + using BaseType = uint32_t; |
| + // TODO(stichnot): This ctor is explicitly not "explicit". Find a way to make |
| + // it explicit without imposing an undue burden on its users. |
| + RegNumT(BaseType Value) : Value(Value) {} |
|
Eric Holk
2016/02/08 19:37:09
Should this check that Value is a legal register v
Jim Stichnoth
2016/02/09 19:33:39
I don't really think it's possible to check for va
Eric Holk
2016/02/10 01:11:30
Hmm, good point. I guess you'd have to do somethin
|
| + RegNumT() = default; |
| + RegNumT(const RegNumT &) = default; |
| + RegNumT &operator=(const RegNumT &) = default; |
| + operator unsigned() const { return Value; } |
| + /// Marks cases that inappropriately add/subtract RegNumT values, and |
| + /// therefore need to be fixed because they make assumptions about register |
| + /// enum value ordering. |
| + static RegNumT fixme(BaseType Value) { return RegNumT(Value); } |
|
Eric Holk
2016/02/08 19:37:09
Is the idea that eventually we won't do any conver
Jim Stichnoth
2016/02/09 19:33:39
Yes - added a TODO to remove the method when all u
Eric Holk
2016/02/10 01:11:30
Sounds good.
|
| + static constexpr BaseType NoRegister = std::numeric_limits<BaseType>::max(); |
| + |
| +private: |
| + BaseType Value = NoRegister; |
| + /// Disallow operators that inappropriately make assumptions about register |
| + /// enum value ordering. |
| + bool operator<(const RegNumT &) = delete; |
| + bool operator<=(const RegNumT &) = delete; |
| + bool operator>(const RegNumT &) = delete; |
| + bool operator>=(const RegNumT &) = delete; |
| +}; |
| + |
| /// A LiveBeginEndMapEntry maps a Variable::Number value to an Inst::Number |
| /// value, giving the instruction number that begins or ends a variable's live |
| /// range. |