Reviewers: Vyacheslav Egorov, Description: 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. Please review this at http://codereview.chromium.org/6348003/ SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/ Affected files: M src/arm/lithium-arm.h M src/arm/lithium-arm.cc M src/ia32/lithium-ia32.h M src/ia32/lithium-ia32.cc M src/x64/lithium-x64.h M src/x64/lithium-x64.cc Index: src/arm/lithium-arm.cc =================================================================== --- src/arm/lithium-arm.cc (revision 6346) +++ src/arm/lithium-arm.cc (working copy) @@ -576,6 +576,13 @@ } +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 @@ } 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()); } Index: src/arm/lithium-arm.h =================================================================== --- src/arm/lithium-arm.h (revision 6346) +++ src/arm/lithium-arm.h (working copy) @@ -1887,15 +1887,25 @@ 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); Index: src/ia32/lithium-ia32.cc =================================================================== --- src/ia32/lithium-ia32.cc (revision 6346) +++ src/ia32/lithium-ia32.cc (working copy) @@ -574,6 +574,13 @@ } +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 @@ } 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()); } Index: src/ia32/lithium-ia32.h =================================================================== --- src/ia32/lithium-ia32.h (revision 6346) +++ src/ia32/lithium-ia32.h (working copy) @@ -1897,15 +1897,25 @@ 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); Index: src/x64/lithium-x64.cc =================================================================== --- src/x64/lithium-x64.cc (revision 6346) +++ src/x64/lithium-x64.cc (working copy) @@ -571,6 +571,13 @@ } +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 @@ } 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()); } Index: src/x64/lithium-x64.h =================================================================== --- src/x64/lithium-x64.h (revision 6346) +++ src/x64/lithium-x64.h (working copy) @@ -1969,15 +1969,25 @@ 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> -- v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev
