blob: 0551c1861a581e0fe79831879d94b764d7196242 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
//===-- X86InstrRelaxTables.h - X86 Instruction Relaxation Tables -*- C++ -*-=//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file contains the interface to query the X86 instruction relaxation
// tables.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIB_TARGET_X86_X86INSTRRELAXTABLES_H
#define LLVM_LIB_TARGET_X86_X86INSTRRELAXTABLES_H
#include <cstdint>
namespace llvm {
// This struct is used for both the relaxed and short tables. The KeyOp is used
// to determine the sorting order.
struct X86InstrRelaxTableEntry {
uint16_t KeyOp;
uint16_t DstOp;
bool operator<(const X86InstrRelaxTableEntry &RHS) const {
return KeyOp < RHS.KeyOp;
}
bool operator==(const X86InstrRelaxTableEntry &RHS) const {
return KeyOp == RHS.KeyOp;
}
friend bool operator<(const X86InstrRelaxTableEntry &TE, unsigned Opcode) {
return TE.KeyOp < Opcode;
}
};
/// Look up the relaxed form table entry for a given \p ShortOp.
const X86InstrRelaxTableEntry *lookupRelaxTable(unsigned ShortOp);
/// Look up the short form table entry for a given \p RelaxOp.
const X86InstrRelaxTableEntry *lookupShortTable(unsigned RelaxOp);
namespace X86 {
/// Get the short instruction opcode for a given relaxed opcode.
unsigned getShortOpcodeArith(unsigned RelaxOp);
/// Get the relaxed instruction opcode for a given short opcode.
unsigned getRelaxedOpcodeArith(unsigned ShortOp);
} // namespace X86
} // namespace llvm
#endif
|