ir/terminal: std::move constructor parameters where applicable

Allows the compiler to choose the most suitable code in this scenario,
given a Terminal isn't a trivial type.
This commit is contained in:
Lioncash 2019-05-23 21:59:10 -04:00 committed by MerryMage
parent b13b6610b5
commit 63eff4e7cc

View file

@ -94,7 +94,7 @@ using Terminal = boost::variant<
* on the run-time state of the ARM flags.
*/
struct If {
If(Cond if_, Terminal then_, Terminal else_) : if_(if_), then_(then_), else_(else_) {}
If(Cond if_, Terminal then_, Terminal else_) : if_(if_), then_(std::move(then_)), else_(std::move(else_)) {}
Cond if_;
Terminal then_;
Terminal else_;
@ -106,7 +106,7 @@ struct If {
* then_ is executed if the check bit is non-zero, otherwise else_ is executed.
*/
struct CheckBit {
CheckBit(Terminal then_, Terminal else_) : then_(then_), else_(else_) {}
CheckBit(Terminal then_, Terminal else_) : then_(std::move(then_)), else_(std::move(else_)) {}
Terminal then_;
Terminal else_;
};
@ -116,7 +116,7 @@ struct CheckBit {
* executed.
*/
struct CheckHalt {
explicit CheckHalt(Terminal else_) : else_(else_) {}
explicit CheckHalt(Terminal else_) : else_(std::move(else_)) {}
Terminal else_;
};