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 #ifndef V8_COMPILER_INSTRUCTION_CODES_H_ | 5 #ifndef V8_COMPILER_INSTRUCTION_CODES_H_ |
6 #define V8_COMPILER_INSTRUCTION_CODES_H_ | 6 #define V8_COMPILER_INSTRUCTION_CODES_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 | 9 |
10 #if V8_TARGET_ARCH_ARM | 10 #if V8_TARGET_ARCH_ARM |
(...skipping 15 matching lines...) Expand all Loading... |
26 #else | 26 #else |
27 #define TARGET_ARCH_OPCODE_LIST(V) | 27 #define TARGET_ARCH_OPCODE_LIST(V) |
28 #define TARGET_ADDRESSING_MODE_LIST(V) | 28 #define TARGET_ADDRESSING_MODE_LIST(V) |
29 #endif | 29 #endif |
30 #include "src/utils.h" | 30 #include "src/utils.h" |
31 | 31 |
32 namespace v8 { | 32 namespace v8 { |
33 namespace internal { | 33 namespace internal { |
34 namespace compiler { | 34 namespace compiler { |
35 | 35 |
| 36 // A set of flags describing some properties of the instructions. |
| 37 enum ArchOpcodeFlags { |
| 38 kNoOpcodeFlags = 0, |
| 39 kIsBlockTerminator = 1, // The instruction marks the end of a basic block |
| 40 // e.g.: jump and return instructions. |
| 41 kHasSideEffect = 2, // The instruction has some side effects (memory |
| 42 // store, function call...) |
| 43 kIsLoadOperation = 4, // The instruction is a memory load. |
| 44 }; |
| 45 |
36 // Target-specific opcodes that specify which assembly sequence to emit. | 46 // Target-specific opcodes that specify which assembly sequence to emit. |
37 // Most opcodes specify a single instruction. | 47 // Most opcodes specify a single instruction. |
38 #define ARCH_OPCODE_LIST(V) \ | 48 #define ARCH_OPCODE_LIST(V) \ |
39 V(ArchCallCodeObject) \ | 49 V(ArchCallCodeObject, kHasSideEffect) \ |
40 V(ArchTailCallCodeObject) \ | 50 V(ArchTailCallCodeObject, kHasSideEffect | kIsBlockTerminator) \ |
41 V(ArchCallJSFunction) \ | 51 V(ArchCallJSFunction, kHasSideEffect) \ |
42 V(ArchTailCallJSFunction) \ | 52 V(ArchTailCallJSFunction, kHasSideEffect | kIsBlockTerminator) \ |
43 V(ArchPrepareCallCFunction) \ | 53 V(ArchPrepareCallCFunction, kHasSideEffect) \ |
44 V(ArchCallCFunction) \ | 54 V(ArchCallCFunction, kHasSideEffect) \ |
45 V(ArchJmp) \ | 55 V(ArchJmp, kIsBlockTerminator) \ |
46 V(ArchLookupSwitch) \ | 56 V(ArchLookupSwitch, kIsBlockTerminator) \ |
47 V(ArchTableSwitch) \ | 57 V(ArchTableSwitch, kIsBlockTerminator) \ |
48 V(ArchNop) \ | 58 V(ArchNop, kNoOpcodeFlags) \ |
49 V(ArchDeoptimize) \ | 59 V(ArchDeoptimize, kNoOpcodeFlags) \ |
50 V(ArchRet) \ | 60 V(ArchRet, kIsBlockTerminator) \ |
51 V(ArchStackPointer) \ | 61 V(ArchStackPointer, kNoOpcodeFlags) \ |
52 V(ArchFramePointer) \ | 62 V(ArchFramePointer, kNoOpcodeFlags) \ |
53 V(ArchTruncateDoubleToI) \ | 63 V(ArchTruncateDoubleToI, kNoOpcodeFlags) \ |
54 V(CheckedLoadInt8) \ | 64 V(CheckedLoadInt8, kIsLoadOperation) \ |
55 V(CheckedLoadUint8) \ | 65 V(CheckedLoadUint8, kIsLoadOperation) \ |
56 V(CheckedLoadInt16) \ | 66 V(CheckedLoadInt16, kIsLoadOperation) \ |
57 V(CheckedLoadUint16) \ | 67 V(CheckedLoadUint16, kIsLoadOperation) \ |
58 V(CheckedLoadWord32) \ | 68 V(CheckedLoadWord32, kIsLoadOperation) \ |
59 V(CheckedLoadWord64) \ | 69 V(CheckedLoadWord64, kIsLoadOperation) \ |
60 V(CheckedLoadFloat32) \ | 70 V(CheckedLoadFloat32, kIsLoadOperation) \ |
61 V(CheckedLoadFloat64) \ | 71 V(CheckedLoadFloat64, kIsLoadOperation) \ |
62 V(CheckedStoreWord8) \ | 72 V(CheckedStoreWord8, kHasSideEffect) \ |
63 V(CheckedStoreWord16) \ | 73 V(CheckedStoreWord16, kHasSideEffect) \ |
64 V(CheckedStoreWord32) \ | 74 V(CheckedStoreWord32, kHasSideEffect) \ |
65 V(CheckedStoreWord64) \ | 75 V(CheckedStoreWord64, kHasSideEffect) \ |
66 V(CheckedStoreFloat32) \ | 76 V(CheckedStoreFloat32, kHasSideEffect) \ |
67 V(CheckedStoreFloat64) \ | 77 V(CheckedStoreFloat64, kHasSideEffect) \ |
68 TARGET_ARCH_OPCODE_LIST(V) | 78 TARGET_ARCH_OPCODE_LIST(V) |
69 | 79 |
70 enum ArchOpcode { | 80 enum ArchOpcode { |
71 #define DECLARE_ARCH_OPCODE(Name) k##Name, | 81 #define DECLARE_ARCH_OPCODE(Name, Flags) k##Name, |
72 ARCH_OPCODE_LIST(DECLARE_ARCH_OPCODE) | 82 ARCH_OPCODE_LIST(DECLARE_ARCH_OPCODE) |
73 #undef DECLARE_ARCH_OPCODE | 83 #undef DECLARE_ARCH_OPCODE |
74 #define COUNT_ARCH_OPCODE(Name) +1 | 84 #define COUNT_ARCH_OPCODE(Name, Flags) +1 |
75 kLastArchOpcode = -1 ARCH_OPCODE_LIST(COUNT_ARCH_OPCODE) | 85 kLastArchOpcode = -1 ARCH_OPCODE_LIST(COUNT_ARCH_OPCODE) |
76 #undef COUNT_ARCH_OPCODE | 86 #undef COUNT_ARCH_OPCODE |
77 }; | 87 }; |
78 | 88 |
79 std::ostream& operator<<(std::ostream& os, const ArchOpcode& ao); | 89 std::ostream& operator<<(std::ostream& os, const ArchOpcode& ao); |
80 | 90 |
81 // Addressing modes represent the "shape" of inputs to an instruction. | 91 // Addressing modes represent the "shape" of inputs to an instruction. |
82 // Many instructions support multiple addressing modes. Addressing modes | 92 // Many instructions support multiple addressing modes. Addressing modes |
83 // are encoded into the InstructionCode of the instruction and tell the | 93 // are encoded into the InstructionCode of the instruction and tell the |
84 // code generator after register allocation which assembler method to call. | 94 // code generator after register allocation which assembler method to call. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 typedef BitField<AddressingMode, 8, 5> AddressingModeField; | 160 typedef BitField<AddressingMode, 8, 5> AddressingModeField; |
151 typedef BitField<FlagsMode, 13, 2> FlagsModeField; | 161 typedef BitField<FlagsMode, 13, 2> FlagsModeField; |
152 typedef BitField<FlagsCondition, 15, 5> FlagsConditionField; | 162 typedef BitField<FlagsCondition, 15, 5> FlagsConditionField; |
153 typedef BitField<int, 20, 12> MiscField; | 163 typedef BitField<int, 20, 12> MiscField; |
154 | 164 |
155 } // namespace compiler | 165 } // namespace compiler |
156 } // namespace internal | 166 } // namespace internal |
157 } // namespace v8 | 167 } // namespace v8 |
158 | 168 |
159 #endif // V8_COMPILER_INSTRUCTION_CODES_H_ | 169 #endif // V8_COMPILER_INSTRUCTION_CODES_H_ |
OLD | NEW |