LLVM
24.0.0git
lib
Target
Hexagon
MCTargetDesc
HexagonMCCodeEmitter.h
Go to the documentation of this file.
1
//===- HexagonMCCodeEmitter.h - Hexagon Target Descriptions -----*- 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
/// \file
10
/// Definition for classes that emit Hexagon machine code from MCInsts
11
///
12
//===----------------------------------------------------------------------===//
13
14
#ifndef LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONMCCODEEMITTER_H
15
#define LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONMCCODEEMITTER_H
16
17
#include "
MCTargetDesc/HexagonFixupKinds.h
"
18
#include "
MCTargetDesc/HexagonMCExpr.h
"
19
#include "
llvm/MC/MCCodeEmitter.h
"
20
#include "
llvm/MC/MCExpr.h
"
21
#include "
llvm/TargetParser/SubtargetFeature.h
"
22
#include <cstddef>
23
#include <cstdint>
24
25
namespace
llvm
{
26
27
class
MCContext
;
28
class
MCInst
;
29
class
MCInstrInfo
;
30
class
MCOperand
;
31
class
MCSubtargetInfo
;
32
33
class
HexagonMCCodeEmitter
:
public
MCCodeEmitter
{
34
MCContext
&MCT;
35
MCInstrInfo
const
&MCII;
36
37
// A mutable state of the emitter when encoding bundles and duplexes.
38
struct
EmitterState {
39
unsigned
Addend = 0;
40
bool
Extended =
false
;
41
bool
SubInst1 =
false
;
42
const
MCInst
*Bundle =
nullptr
;
43
size_t
Index = 0;
44
};
45
mutable
EmitterState State;
46
47
public
:
48
HexagonMCCodeEmitter
(
MCInstrInfo
const
&MII,
MCContext
&MCT)
49
: MCT(MCT), MCII(MII) {}
50
51
void
encodeInstruction
(
MCInst
const
&
MI
,
SmallVectorImpl<char>
&CB,
52
SmallVectorImpl<MCFixup>
&Fixups,
53
MCSubtargetInfo
const
&STI)
const override
;
54
55
void
encodeSingleInstruction
(
const
MCInst
&
MI
,
SmallVectorImpl<char>
&CB,
56
SmallVectorImpl<MCFixup>
&Fixups,
57
const
MCSubtargetInfo
&STI,
58
uint32_t
Parse)
const
;
59
60
// TableGen'erated function for getting the
61
// binary encoding for an instruction.
62
uint64_t
getBinaryCodeForInstr
(
MCInst
const
&
MI
,
63
SmallVectorImpl<MCFixup>
&Fixups,
64
MCSubtargetInfo
const
&STI)
const
;
65
66
/// Return binary encoding of operand.
67
unsigned
getMachineOpValue
(
MCInst
const
&
MI
,
MCOperand
const
&MO,
68
SmallVectorImpl<MCFixup>
&Fixups,
69
MCSubtargetInfo
const
&STI)
const
;
70
71
private
:
72
// helper routine for getMachineOpValue()
73
unsigned
getExprOpValue(
const
MCInst
&
MI
,
const
MCOperand
&MO,
74
const
MCExpr
*ME,
SmallVectorImpl<MCFixup>
&Fixups,
75
const
MCSubtargetInfo
&STI)
const
;
76
77
Hexagon::Fixups
getFixupNoBits(
MCInstrInfo
const
&MCII,
const
MCInst
&
MI
,
78
const
MCOperand
&MO,
79
HexagonMCExpr::VariantKind
Kind)
const
;
80
81
// Return parse bits for instruction `MCI' inside bundle `MCB'
82
uint32_t
parseBits(
size_t
Last
,
MCInst
const
&MCB,
MCInst
const
&MCI)
const
;
83
};
84
85
}
// end namespace llvm
86
87
#endif
// LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONMCCODEEMITTER_H
uint64_t
uint64_t uint64_t
Definition
AMDGPUDisassembler.cpp:568
HexagonFixupKinds.h
HexagonMCExpr.h
MI
IRTranslator LLVM IR MI
Definition
IRTranslator.cpp:877
MCCodeEmitter.h
MCExpr.h
SubtargetFeature.h
llvm::HexagonMCCodeEmitter::encodeSingleInstruction
void encodeSingleInstruction(const MCInst &MI, SmallVectorImpl< char > &CB, SmallVectorImpl< MCFixup > &Fixups, const MCSubtargetInfo &STI, uint32_t Parse) const
Definition
HexagonMCCodeEmitter.cpp:426
llvm::HexagonMCCodeEmitter::getMachineOpValue
unsigned getMachineOpValue(MCInst const &MI, MCOperand const &MO, SmallVectorImpl< MCFixup > &Fixups, MCSubtargetInfo const &STI) const
Return binary encoding of operand.
Definition
HexagonMCCodeEmitter.cpp:734
llvm::HexagonMCCodeEmitter::getBinaryCodeForInstr
uint64_t getBinaryCodeForInstr(MCInst const &MI, SmallVectorImpl< MCFixup > &Fixups, MCSubtargetInfo const &STI) const
llvm::HexagonMCCodeEmitter::HexagonMCCodeEmitter
HexagonMCCodeEmitter(MCInstrInfo const &MII, MCContext &MCT)
Definition
HexagonMCCodeEmitter.h:48
llvm::HexagonMCCodeEmitter::encodeInstruction
void encodeInstruction(MCInst const &MI, SmallVectorImpl< char > &CB, SmallVectorImpl< MCFixup > &Fixups, MCSubtargetInfo const &STI) const override
Emit the bundle.
Definition
HexagonMCCodeEmitter.cpp:395
llvm::HexagonMCExpr::VariantKind
VariantKind
Definition
HexagonMCExpr.h:17
llvm::MCCodeEmitter::MCCodeEmitter
MCCodeEmitter()
llvm::MCContext
Context object for machine code objects.
Definition
MCContext.h:84
llvm::MCExpr
Base class for the full range of assembler expressions which are needed for parsing.
Definition
MCExpr.h:31
llvm::MCInst
Instances of this class represent a single low-level machine instruction.
Definition
MCInst.h:187
llvm::MCInstrInfo
Interface to description of machine instruction set.
Definition
MCInstrInfo.h:27
llvm::MCOperand
Instances of this class represent operands of the MCInst class.
Definition
MCInst.h:39
llvm::MCSubtargetInfo
Generic base class for all target subtargets.
Definition
MCSubtargetInfo.h:142
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition
SmallVector.h:601
uint32_t
llvm::Hexagon::Fixups
Fixups
Definition
HexagonFixupKinds.h:16
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition
DefaultTargetInfo.h:21
llvm::PseudoProbeReservedId::Last
@ Last
Definition
PseudoProbe.h:28
Generated on
for LLVM by
1.14.0