LLVM
17.0.0git
lib
Target
PowerPC
MCTargetDesc
PPCELFStreamer.h
Go to the documentation of this file.
1
//===- PPCELFStreamer.h - ELF Object Output --------------------*- 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
// This is a custom MCELFStreamer for PowerPC.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#ifndef LLVM_LIB_TARGET_PPC_MCELFSTREAMER_PPCELFSTREAMER_H
14
#define LLVM_LIB_TARGET_PPC_MCELFSTREAMER_PPCELFSTREAMER_H
15
16
#include "
llvm/ADT/SmallVector.h
"
17
#include "
llvm/MC/MCELFStreamer.h
"
18
#include <memory>
19
20
namespace
llvm
{
21
22
class
MCAsmBackend;
23
class
MCCodeEmitter;
24
class
MCContext;
25
class
MCSubtargetInfo;
26
27
class
PPCELFStreamer
:
public
MCELFStreamer
{
28
// We need to keep track of the last label we emitted (only one) because
29
// depending on whether the label is on the same line as an aligned
30
// instruction or not, the label may refer to the instruction or the nop.
31
MCSymbol
*LastLabel;
32
SMLoc
LastLabelLoc;
33
34
public
:
35
PPCELFStreamer
(
MCContext
&
Context
, std::unique_ptr<MCAsmBackend> MAB,
36
std::unique_ptr<MCObjectWriter> OW,
37
std::unique_ptr<MCCodeEmitter>
Emitter
);
38
39
void
emitInstruction
(
const
MCInst
&Inst,
const
MCSubtargetInfo
&STI)
override
;
40
41
// EmitLabel updates LastLabel and LastLabelLoc when a new label is emitted.
42
void
emitLabel
(
MCSymbol
*Symbol,
SMLoc
Loc =
SMLoc
())
override
;
43
private
:
44
void
emitPrefixedInstruction(
const
MCInst
&Inst,
const
MCSubtargetInfo
&STI);
45
void
emitGOTToPCRelReloc(
const
MCInst
&Inst);
46
void
emitGOTToPCRelLabel(
const
MCInst
&Inst);
47
};
48
49
// Check if the instruction Inst is part of a pair of instructions that make up
50
// a link time GOT PC Rel optimization.
51
std::optional<bool>
isPartOfGOTToPCRelPair
(
const
MCInst
&Inst,
52
const
MCSubtargetInfo
&STI);
53
54
MCELFStreamer
*
createPPCELFStreamer
(
MCContext
&
Context
,
55
std::unique_ptr<MCAsmBackend> MAB,
56
std::unique_ptr<MCObjectWriter> OW,
57
std::unique_ptr<MCCodeEmitter>
Emitter
);
58
}
// end namespace llvm
59
60
#endif // LLVM_LIB_TARGET_PPC_MCELFSTREAMER_PPCELFSTREAMER_H
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:
AddressRanges.h:18
llvm::MCSymbol
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
Definition:
MCSymbol.h:41
llvm::MCContext
Context object for machine code objects.
Definition:
MCContext.h:76
llvm::PPCELFStreamer::emitInstruction
void emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) override
Emit the given Instruction into the current section.
Definition:
PPCELFStreamer.cpp:86
llvm::MCInst
Instances of this class represent a single low-level machine instruction.
Definition:
MCInst.h:184
llvm::PPCELFStreamer
Definition:
PPCELFStreamer.h:27
MCELFStreamer.h
Context
LLVMContext & Context
Definition:
NVVMIntrRange.cpp:66
Emitter
dxil DXContainer Global Emitter
Definition:
DXContainerGlobals.cpp:108
llvm::MCELFStreamer
Definition:
MCELFStreamer.h:31
llvm::SMLoc
Represents a location in source code.
Definition:
SMLoc.h:23
llvm::PPCELFStreamer::PPCELFStreamer
PPCELFStreamer(MCContext &Context, std::unique_ptr< MCAsmBackend > MAB, std::unique_ptr< MCObjectWriter > OW, std::unique_ptr< MCCodeEmitter > Emitter)
Definition:
PPCELFStreamer.cpp:39
llvm::isPartOfGOTToPCRelPair
std::optional< bool > isPartOfGOTToPCRelPair(const MCInst &Inst, const MCSubtargetInfo &STI)
Definition:
PPCELFStreamer.cpp:200
llvm::PPCELFStreamer::emitLabel
void emitLabel(MCSymbol *Symbol, SMLoc Loc=SMLoc()) override
Emit a label for Symbol into the current section.
Definition:
PPCELFStreamer.cpp:121
llvm::createPPCELFStreamer
MCELFStreamer * createPPCELFStreamer(MCContext &Context, std::unique_ptr< MCAsmBackend > MAB, std::unique_ptr< MCObjectWriter > OW, std::unique_ptr< MCCodeEmitter > Emitter)
Definition:
PPCELFStreamer.cpp:224
SmallVector.h
llvm::MCSubtargetInfo
Generic base class for all target subtargets.
Definition:
MCSubtargetInfo.h:76
Generated on Thu Jan 26 2023 22:37:16 for LLVM by
1.8.17