Add UseAny to create a LOperand without register preference.

The result can be a register, a stack slot or a constant operand.

Right now it is only used for enviroment uses.

Review URL: http://codereview.chromium.org/6348003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6349 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 7095d1ec
...@@ -576,6 +576,13 @@ LOperand* LChunkBuilder::UseRegisterOrConstantAtStart(HValue* value) { ...@@ -576,6 +576,13 @@ LOperand* LChunkBuilder::UseRegisterOrConstantAtStart(HValue* value) {
} }
LOperand* LChunkBuilder::UseAny(HValue* value) {
return value->IsConstant()
? chunk_->DefineConstantOperand(HConstant::cast(value))
: Use(value, new LUnallocated(LUnallocated::ANY));
}
LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) { LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) {
if (value->EmitAtUses()) { if (value->EmitAtUses()) {
HInstruction* instr = HInstruction::cast(value); HInstruction* instr = HInstruction::cast(value);
...@@ -907,11 +914,7 @@ LEnvironment* LChunkBuilder::CreateEnvironment(HEnvironment* hydrogen_env) { ...@@ -907,11 +914,7 @@ LEnvironment* LChunkBuilder::CreateEnvironment(HEnvironment* hydrogen_env) {
} else if (value->IsPushArgument()) { } else if (value->IsPushArgument()) {
op = new LArgument(argument_index++); op = new LArgument(argument_index++);
} else { } else {
op = UseOrConstant(value); op = UseAny(value);
if (op->IsUnallocated()) {
LUnallocated* unalloc = LUnallocated::cast(op);
unalloc->set_policy(LUnallocated::ANY);
}
} }
result->AddValue(op, value->representation()); result->AddValue(op, value->representation());
} }
......
...@@ -1887,15 +1887,25 @@ class LChunkBuilder BASE_EMBEDDED { ...@@ -1887,15 +1887,25 @@ class LChunkBuilder BASE_EMBEDDED {
LOperand* UseRegister(HValue* value); LOperand* UseRegister(HValue* value);
LOperand* UseRegisterAtStart(HValue* value); LOperand* UseRegisterAtStart(HValue* value);
// A value in a register that may be trashed. // An input operand in a register that may be trashed.
LOperand* UseTempRegister(HValue* value); LOperand* UseTempRegister(HValue* value);
// An input operand in a register or stack slot.
LOperand* Use(HValue* value); LOperand* Use(HValue* value);
LOperand* UseAtStart(HValue* value); LOperand* UseAtStart(HValue* value);
// An input operand in a register, stack slot or a constant operand.
LOperand* UseOrConstant(HValue* value); LOperand* UseOrConstant(HValue* value);
LOperand* UseOrConstantAtStart(HValue* value); LOperand* UseOrConstantAtStart(HValue* value);
// An input operand in a register or a constant operand.
LOperand* UseRegisterOrConstant(HValue* value); LOperand* UseRegisterOrConstant(HValue* value);
LOperand* UseRegisterOrConstantAtStart(HValue* value); LOperand* UseRegisterOrConstantAtStart(HValue* value);
// An input operand in register, stack slot or a constant operand.
// Will not be moved to a register even if one is freely available.
LOperand* UseAny(HValue* value);
// Methods for setting up define-use relationships. // Methods for setting up define-use relationships.
// Return the same instruction that they are passed. // Return the same instruction that they are passed.
LInstruction* Define(LInstruction* instr, LUnallocated* result); LInstruction* Define(LInstruction* instr, LUnallocated* result);
......
...@@ -574,6 +574,13 @@ LOperand* LChunkBuilder::UseRegisterOrConstantAtStart(HValue* value) { ...@@ -574,6 +574,13 @@ LOperand* LChunkBuilder::UseRegisterOrConstantAtStart(HValue* value) {
} }
LOperand* LChunkBuilder::UseAny(HValue* value) {
return value->IsConstant()
? chunk_->DefineConstantOperand(HConstant::cast(value))
: Use(value, new LUnallocated(LUnallocated::ANY));
}
LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) { LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) {
if (value->EmitAtUses()) { if (value->EmitAtUses()) {
HInstruction* instr = HInstruction::cast(value); HInstruction* instr = HInstruction::cast(value);
...@@ -934,11 +941,7 @@ LEnvironment* LChunkBuilder::CreateEnvironment(HEnvironment* hydrogen_env) { ...@@ -934,11 +941,7 @@ LEnvironment* LChunkBuilder::CreateEnvironment(HEnvironment* hydrogen_env) {
} else if (value->IsPushArgument()) { } else if (value->IsPushArgument()) {
op = new LArgument(argument_index++); op = new LArgument(argument_index++);
} else { } else {
op = UseOrConstant(value); op = UseAny(value);
if (op->IsUnallocated()) {
LUnallocated* unalloc = LUnallocated::cast(op);
unalloc->set_policy(LUnallocated::ANY);
}
} }
result->AddValue(op, value->representation()); result->AddValue(op, value->representation());
} }
......
...@@ -1897,15 +1897,25 @@ class LChunkBuilder BASE_EMBEDDED { ...@@ -1897,15 +1897,25 @@ class LChunkBuilder BASE_EMBEDDED {
MUST_USE_RESULT LOperand* UseRegister(HValue* value); MUST_USE_RESULT LOperand* UseRegister(HValue* value);
MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value); MUST_USE_RESULT LOperand* UseRegisterAtStart(HValue* value);
// A value in a register that may be trashed. // An input operand in a register that may be trashed.
MUST_USE_RESULT LOperand* UseTempRegister(HValue* value); MUST_USE_RESULT LOperand* UseTempRegister(HValue* value);
// An input operand in a register or stack slot.
MUST_USE_RESULT LOperand* Use(HValue* value); MUST_USE_RESULT LOperand* Use(HValue* value);
MUST_USE_RESULT LOperand* UseAtStart(HValue* value); MUST_USE_RESULT LOperand* UseAtStart(HValue* value);
// An input operand in a register, stack slot or a constant operand.
MUST_USE_RESULT LOperand* UseOrConstant(HValue* value); MUST_USE_RESULT LOperand* UseOrConstant(HValue* value);
MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value); MUST_USE_RESULT LOperand* UseOrConstantAtStart(HValue* value);
// An input operand in a register or a constant operand.
MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value); MUST_USE_RESULT LOperand* UseRegisterOrConstant(HValue* value);
MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value); MUST_USE_RESULT LOperand* UseRegisterOrConstantAtStart(HValue* value);
// An input operand in register, stack slot or a constant operand.
// Will not be moved to a register even if one is freely available.
MUST_USE_RESULT LOperand* UseAny(HValue* value);
// Temporary operand that must be in a register. // Temporary operand that must be in a register.
MUST_USE_RESULT LUnallocated* TempRegister(); MUST_USE_RESULT LUnallocated* TempRegister();
MUST_USE_RESULT LOperand* FixedTemp(Register reg); MUST_USE_RESULT LOperand* FixedTemp(Register reg);
......
...@@ -571,6 +571,13 @@ LOperand* LChunkBuilder::UseRegisterOrConstantAtStart(HValue* value) { ...@@ -571,6 +571,13 @@ LOperand* LChunkBuilder::UseRegisterOrConstantAtStart(HValue* value) {
} }
LOperand* LChunkBuilder::UseAny(HValue* value) {
return value->IsConstant()
? chunk_->DefineConstantOperand(HConstant::cast(value))
: Use(value, new LUnallocated(LUnallocated::ANY));
}
LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) { LOperand* LChunkBuilder::Use(HValue* value, LUnallocated* operand) {
if (value->EmitAtUses()) { if (value->EmitAtUses()) {
HInstruction* instr = HInstruction::cast(value); HInstruction* instr = HInstruction::cast(value);
...@@ -863,11 +870,7 @@ LEnvironment* LChunkBuilder::CreateEnvironment(HEnvironment* hydrogen_env) { ...@@ -863,11 +870,7 @@ LEnvironment* LChunkBuilder::CreateEnvironment(HEnvironment* hydrogen_env) {
} else if (value->IsPushArgument()) { } else if (value->IsPushArgument()) {
op = new LArgument(argument_index++); op = new LArgument(argument_index++);
} else { } else {
op = UseOrConstant(value); op = UseAny(value);
if (op->IsUnallocated()) {
LUnallocated* unalloc = LUnallocated::cast(op);
unalloc->set_policy(LUnallocated::ANY);
}
} }
result->AddValue(op, value->representation()); result->AddValue(op, value->representation());
} }
......
...@@ -1969,15 +1969,25 @@ class LChunkBuilder BASE_EMBEDDED { ...@@ -1969,15 +1969,25 @@ class LChunkBuilder BASE_EMBEDDED {
LOperand* UseRegister(HValue* value); LOperand* UseRegister(HValue* value);
LOperand* UseRegisterAtStart(HValue* value); LOperand* UseRegisterAtStart(HValue* value);
// A value in a register that may be trashed. // An operand value in a register that may be trashed.
LOperand* UseTempRegister(HValue* value); LOperand* UseTempRegister(HValue* value);
// An operand value in a register or stack slot.
LOperand* Use(HValue* value); LOperand* Use(HValue* value);
LOperand* UseAtStart(HValue* value); LOperand* UseAtStart(HValue* value);
// An operand value in a register, stack slot or a constant operand.
LOperand* UseOrConstant(HValue* value); LOperand* UseOrConstant(HValue* value);
LOperand* UseOrConstantAtStart(HValue* value); LOperand* UseOrConstantAtStart(HValue* value);
// An operand value in a register or a constant operand.
LOperand* UseRegisterOrConstant(HValue* value); LOperand* UseRegisterOrConstant(HValue* value);
LOperand* UseRegisterOrConstantAtStart(HValue* value); LOperand* UseRegisterOrConstantAtStart(HValue* value);
// An operand value in register, stack slot or a constant operand.
// Will not be moved to a register even if one is freely available.
LOperand* UseAny(HValue* value);
// Methods for setting up define-use relationships. // Methods for setting up define-use relationships.
// Return the same instruction that they are passed. // Return the same instruction that they are passed.
template<int I, int T> template<int I, int T>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment