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) {
}
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) {
if (value->EmitAtUses()) {
HInstruction* instr = HInstruction::cast(value);
......@@ -907,11 +914,7 @@ LEnvironment* LChunkBuilder::CreateEnvironment(HEnvironment* hydrogen_env) {
} else if (value->IsPushArgument()) {
op = new LArgument(argument_index++);
} else {
op = UseOrConstant(value);
if (op->IsUnallocated()) {
LUnallocated* unalloc = LUnallocated::cast(op);
unalloc->set_policy(LUnallocated::ANY);
}
op = UseAny(value);
}
result->AddValue(op, value->representation());
}
......
......@@ -1887,15 +1887,25 @@ class LChunkBuilder BASE_EMBEDDED {
LOperand* UseRegister(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);
// An input operand in a register or stack slot.
LOperand* Use(HValue* value);
LOperand* UseAtStart(HValue* value);
// An input operand in a register, stack slot or a constant operand.
LOperand* UseOrConstant(HValue* value);
LOperand* UseOrConstantAtStart(HValue* value);
// An input operand in a register or a constant operand.
LOperand* UseRegisterOrConstant(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.
// Return the same instruction that they are passed.
LInstruction* Define(LInstruction* instr, LUnallocated* result);
......
......@@ -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) {
if (value->EmitAtUses()) {
HInstruction* instr = HInstruction::cast(value);
......@@ -934,11 +941,7 @@ LEnvironment* LChunkBuilder::CreateEnvironment(HEnvironment* hydrogen_env) {
} else if (value->IsPushArgument()) {
op = new LArgument(argument_index++);
} else {
op = UseOrConstant(value);
if (op->IsUnallocated()) {
LUnallocated* unalloc = LUnallocated::cast(op);
unalloc->set_policy(LUnallocated::ANY);
}
op = UseAny(value);
}
result->AddValue(op, value->representation());
}
......
......@@ -1897,15 +1897,25 @@ class LChunkBuilder BASE_EMBEDDED {
MUST_USE_RESULT LOperand* UseRegister(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);
// An input operand in a register or stack slot.
MUST_USE_RESULT LOperand* Use(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* UseOrConstantAtStart(HValue* value);
// An input operand in a register or a constant operand.
MUST_USE_RESULT LOperand* UseRegisterOrConstant(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.
MUST_USE_RESULT LUnallocated* TempRegister();
MUST_USE_RESULT LOperand* FixedTemp(Register reg);
......
......@@ -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) {
if (value->EmitAtUses()) {
HInstruction* instr = HInstruction::cast(value);
......@@ -863,11 +870,7 @@ LEnvironment* LChunkBuilder::CreateEnvironment(HEnvironment* hydrogen_env) {
} else if (value->IsPushArgument()) {
op = new LArgument(argument_index++);
} else {
op = UseOrConstant(value);
if (op->IsUnallocated()) {
LUnallocated* unalloc = LUnallocated::cast(op);
unalloc->set_policy(LUnallocated::ANY);
}
op = UseAny(value);
}
result->AddValue(op, value->representation());
}
......
......@@ -1969,15 +1969,25 @@ class LChunkBuilder BASE_EMBEDDED {
LOperand* UseRegister(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);
// An operand value in a register or stack slot.
LOperand* Use(HValue* value);
LOperand* UseAtStart(HValue* value);
// An operand value in a register, stack slot or a constant operand.
LOperand* UseOrConstant(HValue* value);
LOperand* UseOrConstantAtStart(HValue* value);
// An operand value in a register or a constant operand.
LOperand* UseRegisterOrConstant(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.
// Return the same instruction that they are passed.
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