OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/base/adapters.h" | 5 #include "src/base/adapters.h" |
6 #include "src/base/bits.h" | 6 #include "src/base/bits.h" |
7 #include "src/compiler/instruction-selector-impl.h" | 7 #include "src/compiler/instruction-selector-impl.h" |
8 #include "src/compiler/node-matchers.h" | 8 #include "src/compiler/node-matchers.h" |
9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
10 | 10 |
(...skipping 1965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1976 case MachineRepresentation::kWord16: | 1976 case MachineRepresentation::kWord16: |
1977 opcode = load_rep.IsSigned() ? kAtomicLoadInt16 : kAtomicLoadUint16; | 1977 opcode = load_rep.IsSigned() ? kAtomicLoadInt16 : kAtomicLoadUint16; |
1978 break; | 1978 break; |
1979 case MachineRepresentation::kWord32: | 1979 case MachineRepresentation::kWord32: |
1980 opcode = kAtomicLoadWord32; | 1980 opcode = kAtomicLoadWord32; |
1981 break; | 1981 break; |
1982 default: | 1982 default: |
1983 UNREACHABLE(); | 1983 UNREACHABLE(); |
1984 return; | 1984 return; |
1985 } | 1985 } |
1986 Emit(opcode | AddressingModeField::encode(kMode_MRI), | 1986 if (g.CanBeImmediate(index, opcode)) { |
1987 g.DefineAsRegister(node), g.UseRegister(base), g.UseRegister(index)); | 1987 Emit(opcode | AddressingModeField::encode(kMode_MRI), |
| 1988 g.DefineAsRegister(node), g.UseRegister(base), g.UseImmediate(index)); |
| 1989 } else { |
| 1990 InstructionOperand addr_reg = g.TempRegister(); |
| 1991 Emit(kMips64Dadd | AddressingModeField::encode(kMode_None), addr_reg, |
| 1992 g.UseRegister(index), g.UseRegister(base)); |
| 1993 // Emit desired load opcode, using temp addr_reg. |
| 1994 Emit(opcode | AddressingModeField::encode(kMode_MRI), |
| 1995 g.DefineAsRegister(node), addr_reg, g.TempImmediate(0)); |
| 1996 } |
1988 } | 1997 } |
1989 | 1998 |
1990 // static | 1999 // static |
1991 MachineOperatorBuilder::Flags | 2000 MachineOperatorBuilder::Flags |
1992 InstructionSelector::SupportedMachineOperatorFlags() { | 2001 InstructionSelector::SupportedMachineOperatorFlags() { |
1993 return MachineOperatorBuilder::kWord32Ctz | | 2002 return MachineOperatorBuilder::kWord32Ctz | |
1994 MachineOperatorBuilder::kWord64Ctz | | 2003 MachineOperatorBuilder::kWord64Ctz | |
1995 MachineOperatorBuilder::kWord32Popcnt | | 2004 MachineOperatorBuilder::kWord32Popcnt | |
1996 MachineOperatorBuilder::kWord64Popcnt | | 2005 MachineOperatorBuilder::kWord64Popcnt | |
1997 MachineOperatorBuilder::kWord32ShiftIsSafe | | 2006 MachineOperatorBuilder::kWord32ShiftIsSafe | |
1998 MachineOperatorBuilder::kInt32DivIsSafe | | 2007 MachineOperatorBuilder::kInt32DivIsSafe | |
1999 MachineOperatorBuilder::kUint32DivIsSafe | | 2008 MachineOperatorBuilder::kUint32DivIsSafe | |
2000 MachineOperatorBuilder::kFloat64Min | | 2009 MachineOperatorBuilder::kFloat64Min | |
2001 MachineOperatorBuilder::kFloat64Max | | 2010 MachineOperatorBuilder::kFloat64Max | |
2002 MachineOperatorBuilder::kFloat32Min | | 2011 MachineOperatorBuilder::kFloat32Min | |
2003 MachineOperatorBuilder::kFloat32Max | | 2012 MachineOperatorBuilder::kFloat32Max | |
2004 MachineOperatorBuilder::kFloat64RoundDown | | 2013 MachineOperatorBuilder::kFloat64RoundDown | |
2005 MachineOperatorBuilder::kFloat32RoundDown | | 2014 MachineOperatorBuilder::kFloat32RoundDown | |
2006 MachineOperatorBuilder::kFloat64RoundUp | | 2015 MachineOperatorBuilder::kFloat64RoundUp | |
2007 MachineOperatorBuilder::kFloat32RoundUp | | 2016 MachineOperatorBuilder::kFloat32RoundUp | |
2008 MachineOperatorBuilder::kFloat64RoundTruncate | | 2017 MachineOperatorBuilder::kFloat64RoundTruncate | |
2009 MachineOperatorBuilder::kFloat32RoundTruncate | | 2018 MachineOperatorBuilder::kFloat32RoundTruncate | |
2010 MachineOperatorBuilder::kFloat64RoundTiesEven | | 2019 MachineOperatorBuilder::kFloat64RoundTiesEven | |
2011 MachineOperatorBuilder::kFloat32RoundTiesEven; | 2020 MachineOperatorBuilder::kFloat32RoundTiesEven; |
2012 } | 2021 } |
2013 | 2022 |
2014 } // namespace compiler | 2023 } // namespace compiler |
2015 } // namespace internal | 2024 } // namespace internal |
2016 } // namespace v8 | 2025 } // namespace v8 |
OLD | NEW |