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
3 // found in the LICENSE file.
4 
5 #ifndef V8_COMPILER_X87_INSTRUCTION_CODES_X87_H_
6 #define V8_COMPILER_X87_INSTRUCTION_CODES_X87_H_
7 
8 #include "src/compiler/instruction.h"
9 #include "src/compiler/instruction-codes.h"
10 namespace v8 {
11 namespace internal {
12 namespace compiler {
13 
14 // X87-specific opcodes that specify which assembly sequence to emit.
15 // Most opcodes specify a single instruction.
16 #define TARGET_ARCH_OPCODE_LIST(V) \
17   V(X87Add)                        \
18   V(X87And)                        \
19   V(X87Cmp)                        \
20   V(X87Test)                       \
21   V(X87Or)                         \
22   V(X87Xor)                        \
23   V(X87Sub)                        \
24   V(X87Imul)                       \
25   V(X87ImulHigh)                   \
26   V(X87UmulHigh)                   \
27   V(X87Idiv)                       \
28   V(X87Udiv)                       \
29   V(X87Not)                        \
30   V(X87Neg)                        \
31   V(X87Shl)                        \
32   V(X87Shr)                        \
33   V(X87Sar)                        \
34   V(X87Ror)                        \
35   V(X87Lzcnt)                      \
36   V(X87Popcnt)                     \
37   V(X87Float32Cmp)                 \
38   V(X87Float32Add)                 \
39   V(X87Float32Sub)                 \
40   V(X87Float32Mul)                 \
41   V(X87Float32Div)                 \
42   V(X87Float32Max)                 \
43   V(X87Float32Min)                 \
44   V(X87Float32Abs)                 \
45   V(X87Float32Sqrt)                \
46   V(X87Float32Round)               \
47   V(X87LoadFloat64Constant)        \
48   V(X87Float64Add)                 \
49   V(X87Float64Sub)                 \
50   V(X87Float64Mul)                 \
51   V(X87Float64Div)                 \
52   V(X87Float64Mod)                 \
53   V(X87Float64Max)                 \
54   V(X87Float64Min)                 \
55   V(X87Float64Abs)                 \
56   V(X87Int32ToFloat64)             \
57   V(X87Float32ToFloat64)           \
58   V(X87Uint32ToFloat64)            \
59   V(X87Float64ToInt32)             \
60   V(X87Float64ToFloat32)           \
61   V(X87Float64ToUint32)            \
62   V(X87Float64ExtractHighWord32)   \
63   V(X87Float64ExtractLowWord32)    \
64   V(X87Float64InsertHighWord32)    \
65   V(X87Float64InsertLowWord32)     \
66   V(X87Float64Sqrt)                \
67   V(X87Float64Round)               \
68   V(X87Float64Cmp)                 \
69   V(X87Movsxbl)                    \
70   V(X87Movzxbl)                    \
71   V(X87Movb)                       \
72   V(X87Movsxwl)                    \
73   V(X87Movzxwl)                    \
74   V(X87Movw)                       \
75   V(X87Movl)                       \
76   V(X87Movss)                      \
77   V(X87Movsd)                      \
78   V(X87Lea)                        \
79   V(X87BitcastFI)                  \
80   V(X87BitcastIF)                  \
81   V(X87Push)                       \
82   V(X87PushFloat64)                \
83   V(X87PushFloat32)                \
84   V(X87Poke)                       \
85   V(X87StackCheck)
86 
87 
88 // Addressing modes represent the "shape" of inputs to an instruction.
89 // Many instructions support multiple addressing modes. Addressing modes
90 // are encoded into the InstructionCode of the instruction and tell the
91 // code generator after register allocation which assembler method to call.
92 //
93 // We use the following local notation for addressing modes:
94 //
95 // M = memory operand
96 // R = base register
97 // N = index register * N for N in {1, 2, 4, 8}
98 // I = immediate displacement (int32_t)
99 
100 #define TARGET_ADDRESSING_MODE_LIST(V) \
101   V(MR)   /* [%r1            ] */      \
102   V(MRI)  /* [%r1         + K] */      \
103   V(MR1)  /* [%r1 + %r2*1    ] */      \
104   V(MR2)  /* [%r1 + %r2*2    ] */      \
105   V(MR4)  /* [%r1 + %r2*4    ] */      \
106   V(MR8)  /* [%r1 + %r2*8    ] */      \
107   V(MR1I) /* [%r1 + %r2*1 + K] */      \
108   V(MR2I) /* [%r1 + %r2*2 + K] */      \
109   V(MR4I) /* [%r1 + %r2*3 + K] */      \
110   V(MR8I) /* [%r1 + %r2*4 + K] */      \
111   V(M1)   /* [      %r2*1    ] */      \
112   V(M2)   /* [      %r2*2    ] */      \
113   V(M4)   /* [      %r2*4    ] */      \
114   V(M8)   /* [      %r2*8    ] */      \
115   V(M1I)  /* [      %r2*1 + K] */      \
116   V(M2I)  /* [      %r2*2 + K] */      \
117   V(M4I)  /* [      %r2*4 + K] */      \
118   V(M8I)  /* [      %r2*8 + K] */      \
119   V(MI)   /* [              K] */
120 
121 }  // namespace compiler
122 }  // namespace internal
123 }  // namespace v8
124 
125 #endif  // V8_COMPILER_X87_INSTRUCTION_CODES_X87_H_
126