Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Unified Diff: src/compiler/instruction.h

Issue 2897203002: [Turbofan] Remove UnallocatedOperand::set_virtual_register. (Closed)
Patch Set: Make ctor conform to Chromium style. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/compiler/instruction-selector.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/instruction.h
diff --git a/src/compiler/instruction.h b/src/compiler/instruction.h
index 05128c6cdf42d22ab993f2f870a17890557b735b..a8e3da36ae1710bc4114328119b58db3701995b7 100644
--- a/src/compiler/instruction.h
+++ b/src/compiler/instruction.h
@@ -167,7 +167,7 @@ std::ostream& operator<<(std::ostream& os,
return *static_cast<const OperandType*>(&op); \
}
-class UnallocatedOperand : public InstructionOperand {
+class UnallocatedOperand final : public InstructionOperand {
public:
enum BasicPolicy { FIXED_SLOT, EXTENDED_POLICY };
@@ -183,15 +183,14 @@ class UnallocatedOperand : public InstructionOperand {
// Lifetime of operand inside the instruction.
enum Lifetime {
- // USED_AT_START operand is guaranteed to be live only at
- // instruction start. Register allocator is free to assign the same register
- // to some other operand used inside instruction (i.e. temporary or
- // output).
+ // USED_AT_START operand is guaranteed to be live only at instruction start.
+ // The register allocator is free to assign the same register to some other
+ // operand used inside instruction (i.e. temporary or output).
USED_AT_START,
- // USED_AT_END operand is treated as live until the end of
- // instruction. This means that register allocator will not reuse it's
- // register for any other operand inside instruction.
+ // USED_AT_END operand is treated as live until the end of instruction.
+ // This means that register allocator will not reuse its register for any
+ // other operand inside instruction.
USED_AT_END
};
@@ -233,6 +232,12 @@ class UnallocatedOperand : public InstructionOperand {
value_ |= SecondaryStorageField::encode(slot_id);
}
+ UnallocatedOperand(const UnallocatedOperand& other, int virtual_register) {
+ DCHECK_NE(kInvalidVirtualRegister, virtual_register);
+ value_ = VirtualRegisterField::update(
+ other.value_, static_cast<uint32_t>(virtual_register));
+ }
+
// Predicates for the operand policy.
bool HasAnyPolicy() const {
return basic_policy() == EXTENDED_POLICY && extended_policy() == ANY;
@@ -275,7 +280,6 @@ class UnallocatedOperand : public InstructionOperand {
// [basic_policy]: Distinguish between FIXED_SLOT and all other policies.
BasicPolicy basic_policy() const {
- DCHECK_EQ(UNALLOCATED, kind());
return BasicPolicyField::decode(value_);
}
@@ -300,16 +304,9 @@ class UnallocatedOperand : public InstructionOperand {
// [virtual_register]: The virtual register ID for this operand.
int32_t virtual_register() const {
- DCHECK_EQ(UNALLOCATED, kind());
return static_cast<int32_t>(VirtualRegisterField::decode(value_));
}
- // TODO(dcarney): remove this.
- void set_virtual_register(int32_t id) {
- DCHECK_EQ(UNALLOCATED, kind());
- value_ = VirtualRegisterField::update(value_, static_cast<uint32_t>(id));
- }
-
// [lifetime]: Only for non-FIXED_SLOT.
bool IsUsedAtStart() const {
DCHECK(basic_policy() == EXTENDED_POLICY);
« no previous file with comments | « no previous file | src/compiler/instruction-selector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698