50#define GET_INSTRINFO_MC_DESC
51#define ENABLE_INSTR_PREDICATE_VERIFIER
52#include "PPCGenInstrInfo.inc"
54#define GET_SUBTARGETINFO_MC_DESC
55#include "PPCGenSubtargetInfo.inc"
57#define GET_REGINFO_MC_DESC
58#include "PPCGenRegisterInfo.inc"
67 InitPPCMCInstrInfo(
X);
74 unsigned Flavour = isPPC64 ? 0 : 1;
75 unsigned RA = isPPC64 ? PPC::LR8 : PPC::LR;
78 InitPPCMCRegisterInfo(
X,
RA, Flavour, Flavour);
85 std::string FullFS = std::string(FS);
89 FullFS =
"+aix," + FullFS;
94 return createPPCMCSubtargetInfoImpl(TT, CPU, CPU, FullFS);
110 unsigned Reg = isPPC64 ? PPC::X1 : PPC::R1;
120 std::unique_ptr<MCAsmBackend> &&MAB,
121 std::unique_ptr<MCObjectWriter> &&OW,
122 std::unique_ptr<MCCodeEmitter> &&
Emitter,
bool RelaxAll) {
129 std::unique_ptr<MCObjectWriter> &&OW,
130 std::unique_ptr<MCCodeEmitter> &&
Emitter,
bool RelaxAll) {
146 if (
const MCSymbolXCOFF *XSym = dyn_cast<MCSymbolXCOFF>(&S)) {
148 cast<MCSectionXCOFF>(Streamer.getCurrentSectionOnly())
149 ->getQualNameSymbol();
154 if (Kind == MCSymbolRefExpr::VariantKind::VK_PPC_AIX_TLSGD ||
155 Kind == MCSymbolRefExpr::VariantKind::VK_PPC_AIX_TLSGDM)
156 OS <<
"\t.tc " << TCSym->
getName() <<
"," << XSym->getName() <<
"@"
159 OS <<
"\t.tc " << TCSym->
getName() <<
"," << XSym->getName() <<
'\n';
169 void emitMachine(
StringRef CPU)
override {
170 OS <<
"\t.machine " << CPU <<
'\n';
173 void emitAbiVersion(
int AbiVersion)
override {
174 OS <<
"\t.abiversion " << AbiVersion <<
'\n';
178 const MCAsmInfo *MAI = Streamer.getContext().getAsmInfo();
180 OS <<
"\t.localentry\t";
200 Streamer.emitSymbolValue(&S, 8);
203 void emitMachine(
StringRef CPU)
override {
208 void emitAbiVersion(
int AbiVersion)
override {
211 Flags &= ~ELF::EF_PPC64_ABI;
221 unsigned Encoded = encodePPC64LocalEntryOffset(LocalOffset);
224 Other &= ~ELF::STO_PPC64_LOCAL_MASK;
236 auto *
Symbol = cast<MCSymbolELF>(S);
240 if (copyLocalEntry(Symbol,
Value))
241 UpdateOther.insert(Symbol);
243 UpdateOther.erase(Symbol);
246 void finish()
override {
247 for (
auto *Sym : UpdateOther)
248 if (Sym->isVariable())
249 copyLocalEntry(Sym, Sym->getVariableValue());
260 auto *
Ref = dyn_cast<const MCSymbolRefExpr>(S);
263 const auto &RhsSym = cast<MCSymbolELF>(
Ref->getSymbol());
264 unsigned Other =
D->getOther();
265 Other &= ~ELF::STO_PPC64_LOCAL_MASK;
271 unsigned encodePPC64LocalEntryOffset(
const MCExpr *LocalOffset) {
274 if (!LocalOffset->evaluateAsAbsolute(
Offset, MCA))
276 ".localentry expression must be absolute");
281 LocalOffset->
getLoc(),
".localentry expression must be a power of 2");
306 void emitMachine(
StringRef CPU)
override {
311 void emitAbiVersion(
int AbiVersion)
override {
326 const MCAsmInfo *MAI = Streamer.getContext().getAsmInfo();
328 Streamer.emitValueToAlignment(
Align(PointerSize));
333 void emitMachine(
StringRef CPU)
override {
337 void emitAbiVersion(
int AbiVersion)
override {
352 return new PPCTargetAsmStreamer(S,
OS);
362 if (TT.isOSBinFormatELF())
363 return new PPCTargetELFStreamer(S);
364 if (TT.isOSBinFormatXCOFF())
365 return new PPCTargetXCOFFStreamer(S);
366 return new PPCTargetMachOStreamer(S);
370 unsigned SyntaxVariant,
388 Info->get(Inst.
getOpcode()).operands()[NumOps - 1].OperandType !=
399 return new PPCMCInstrAnalysis(
Info);
unsigned const MachineRegisterInfo * MRI
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
Analysis containing CSE Info
#define LLVM_EXTERNAL_VISIBILITY
dxil DXContainer Global Emitter
std::optional< std::vector< StOtherPiece > > Other
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
static MCTargetStreamer * createNullTargetStreamer(MCStreamer &S)
static MCTargetStreamer * createAsmTargetStreamer(MCStreamer &S, formatted_raw_ostream &OS, MCInstPrinter *InstPrint, bool isVerboseAsm)
LLVM_EXTERNAL_VISIBILITY void LLVMInitializePowerPCTargetMC()
static MCInstPrinter * createPPCMCInstPrinter(const Triple &T, unsigned SyntaxVariant, const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
static MCTargetStreamer * createObjectTargetStreamer(MCStreamer &S, const MCSubtargetInfo &STI)
static MCInstrAnalysis * createPPCMCInstrAnalysis(const MCInstrInfo *Info)
static MCAsmInfo * createPPCMCAsmInfo(const MCRegisterInfo &MRI, const Triple &TheTriple, const MCTargetOptions &Options)
static MCSubtargetInfo * createPPCMCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS)
static MCRegisterInfo * createPPCMCRegisterInfo(const Triple &TT)
static MCInstrInfo * createPPCMCInstrInfo()
SI optimize exec mask operations pre RA
This file defines the SmallPtrSet class.
This class is intended to be used as a base class for asm properties and features specific to the tar...
void addInitialFrameState(const MCCFIInstruction &Inst)
unsigned getCodePointerSize() const
Get the code pointer size in bytes.
MCContext & getContext() const
unsigned getELFHeaderEFlags() const
ELF e_header flags.
void setELFHeaderEFlags(unsigned Flags)
static MCCFIInstruction cfiDefCfa(MCSymbol *L, unsigned Register, int Offset)
.cfi_def_cfa defines a rule for computing CFA as: take address from Register and add Offset to it.
Context object for machine code objects.
void reportError(SMLoc L, const Twine &Msg)
void emitValueToAlignment(Align, int64_t, unsigned, unsigned) override
Emit some number of copies of Value until the byte alignment ByteAlignment is reached.
Base class for the full range of assembler expressions which are needed for parsing.
void print(raw_ostream &OS, const MCAsmInfo *MAI, bool InParens=false) const
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
Instances of this class represent a single low-level machine instruction.
unsigned getNumOperands() const
unsigned getOpcode() const
const MCOperand & getOperand(unsigned i) const
Interface to description of machine instruction set.
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Streaming machine code generation interface.
Generic base class for all target subtargets.
const Triple & getTargetTriple() const
unsigned getOther() const
void setOther(unsigned Other)
static StringRef getVariantKindName(VariantKind Kind)
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
StringRef getSymbolTableName() const
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
void print(raw_ostream &OS, const MCAsmInfo *MAI) const
print - Print the value to the stream OS.
StringRef getName() const
getName - Get the symbol name.
Target specific streamer interface.
~PPCTargetStreamer() override
PPCTargetStreamer(MCStreamer &S)
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
StringRef - Represent a constant reference to a string, i.e.
Target - Wrapper for Target specific information.
Triple - Helper class for working with autoconf configuration names.
ArchType getArch() const
Get the parsed architecture type of this triple.
bool isOSBinFormatXCOFF() const
Tests whether the OS uses the XCOFF binary format.
LLVM Value Representation.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
@ C
The default llvm calling convention, compatible with C.
constexpr uint64_t PointerSize
aarch64 pointer size.
This is an optimization pass for GlobalISel generic memory operations.
Target & getThePPC64LETarget()
Target & getThePPC32Target()
MCAsmBackend * createPPCAsmBackend(const Target &T, const MCSubtargetInfo &STI, const MCRegisterInfo &MRI, const MCTargetOptions &Options)
unsigned Log2_32(uint32_t Value)
Return the floor log base 2 of the specified value, -1 if the value is zero.
MCXCOFFStreamer * createPPCXCOFFStreamer(MCContext &Context, std::unique_ptr< MCAsmBackend > MAB, std::unique_ptr< MCObjectWriter > OW, std::unique_ptr< MCCodeEmitter > Emitter)
@ Ref
The access may reference the value stored in memory.
Target & getThePPC64Target()
MCCodeEmitter * createPPCMCCodeEmitter(const MCInstrInfo &MCII, MCContext &Ctx)
Target & getThePPC32LETarget()
MCELFStreamer * createPPCELFStreamer(MCContext &Context, std::unique_ptr< MCAsmBackend > MAB, std::unique_ptr< MCObjectWriter > OW, std::unique_ptr< MCCodeEmitter > Emitter)
This struct is a compact representation of a valid (non-zero power of two) alignment.
RegisterMCAsmInfoFn - Helper template for registering a target assembly info implementation.
static void RegisterMCRegInfo(Target &T, Target::MCRegInfoCtorFnTy Fn)
RegisterMCRegInfo - Register a MCRegisterInfo implementation for the given target.
static void RegisterMCAsmBackend(Target &T, Target::MCAsmBackendCtorTy Fn)
RegisterMCAsmBackend - Register a MCAsmBackend implementation for the given target.
static void RegisterXCOFFStreamer(Target &T, Target::XCOFFStreamerCtorTy Fn)
static void RegisterMCCodeEmitter(Target &T, Target::MCCodeEmitterCtorTy Fn)
RegisterMCCodeEmitter - Register a MCCodeEmitter implementation for the given target.
static void RegisterMCSubtargetInfo(Target &T, Target::MCSubtargetInfoCtorFnTy Fn)
RegisterMCSubtargetInfo - Register a MCSubtargetInfo implementation for the given target.
static void RegisterObjectTargetStreamer(Target &T, Target::ObjectTargetStreamerCtorTy Fn)
static void RegisterMCInstrAnalysis(Target &T, Target::MCInstrAnalysisCtorFnTy Fn)
RegisterMCInstrAnalysis - Register a MCInstrAnalysis implementation for the given target.
static void RegisterELFStreamer(Target &T, Target::ELFStreamerCtorTy Fn)
static void RegisterNullTargetStreamer(Target &T, Target::NullTargetStreamerCtorTy Fn)
static void RegisterMCInstPrinter(Target &T, Target::MCInstPrinterCtorTy Fn)
RegisterMCInstPrinter - Register a MCInstPrinter implementation for the given target.
static void RegisterMCInstrInfo(Target &T, Target::MCInstrInfoCtorFnTy Fn)
RegisterMCInstrInfo - Register a MCInstrInfo implementation for the given target.
static void RegisterAsmTargetStreamer(Target &T, Target::AsmTargetStreamerCtorTy Fn)