xref: /freebsd/contrib/llvm-project/llvm/include/llvm/Support/X86FoldTablesUtils.h (revision 0fca6ea1d4eea4c934cfff25ac9ee8ad6fe95583)
1 //===-- X86FoldTablesUtils.h ------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_SUPPORT_X86FOLDTABLESUTILS_H
10 #define LLVM_SUPPORT_X86FOLDTABLESUTILS_H
11 
12 namespace llvm {
13 enum {
14   // Select which memory operand is being unfolded.
15   // (stored in bits 0 - 2)
16   TB_INDEX_0 = 0,
17   TB_INDEX_1 = 1,
18   TB_INDEX_2 = 2,
19   TB_INDEX_3 = 3,
20   TB_INDEX_4 = 4,
21   TB_INDEX_MASK = 0x7,
22 
23   // Do not insert the reverse map (MemOp -> RegOp) into the table.
24   // This may be needed because there is a many -> one mapping.
25   TB_NO_REVERSE = 1 << 3,
26 
27   // Do not insert the forward map (RegOp -> MemOp) into the table.
28   // This is needed for Native Client, which prohibits branch
29   // instructions from using a memory operand.
30   TB_NO_FORWARD = 1 << 4,
31 
32   TB_FOLDED_LOAD = 1 << 5,
33   TB_FOLDED_STORE = 1 << 6,
34 
35   // Minimum alignment required for load/store.
36   // Used for RegOp->MemOp conversion. Encoded as Log2(Align)
37   // (stored in bits 8 - 10)
38   TB_ALIGN_SHIFT = 7,
39   TB_ALIGN_1 = 0 << TB_ALIGN_SHIFT,
40   TB_ALIGN_16 = 4 << TB_ALIGN_SHIFT,
41   TB_ALIGN_32 = 5 << TB_ALIGN_SHIFT,
42   TB_ALIGN_64 = 6 << TB_ALIGN_SHIFT,
43   TB_ALIGN_MASK = 0x7 << TB_ALIGN_SHIFT,
44 
45   // Broadcast type.
46   // (stored in bits 11 - 13)
47   TB_BCAST_TYPE_SHIFT = TB_ALIGN_SHIFT + 3,
48   TB_BCAST_W = 1 << TB_BCAST_TYPE_SHIFT,
49   TB_BCAST_D = 2 << TB_BCAST_TYPE_SHIFT,
50   TB_BCAST_Q = 3 << TB_BCAST_TYPE_SHIFT,
51   TB_BCAST_SS = 4 << TB_BCAST_TYPE_SHIFT,
52   TB_BCAST_SD = 5 << TB_BCAST_TYPE_SHIFT,
53   TB_BCAST_SH = 6 << TB_BCAST_TYPE_SHIFT,
54   TB_BCAST_MASK = 0x7 << TB_BCAST_TYPE_SHIFT,
55 
56   // Unused bits 14-16
57 };
58 } // namespace llvm
59 #endif // LLVM_SUPPORT_X86FOLDTABLESUTILS_H
60