52#define GET_INSTRINFO_MC_DESC
53#define ENABLE_INSTR_PREDICATE_VERIFIER
54#include "PPCGenInstrInfo.inc"
56#define GET_SUBTARGETINFO_MC_DESC
57#include "PPCGenSubtargetInfo.inc"
59#define GET_REGINFO_MC_DESC
60#include "PPCGenRegisterInfo.inc"
124 int16_t regClass =
Desc.operands()[OpNo].RegClass;
128 case PPC::VSSRCRegClassID:
129 case PPC::VSFRCRegClassID:
131 return PPC::VSX32 + (Reg - PPC::VF0);
135 case PPC::VSRCRegClassID:
137 return PPC::VSX32 + (Reg - PPC::V0);
153 InitPPCMCInstrInfo(
X);
160 unsigned Flavour = isPPC64 ? 0 : 1;
161 unsigned RA = isPPC64 ? PPC::LR8 : PPC::LR;
164 InitPPCMCRegisterInfo(
X,
RA, Flavour, Flavour);
171 std::string FullFS = std::string(FS);
175 FullFS =
"+aix," + FullFS;
180 return createPPCMCSubtargetInfoImpl(TT, CPU, CPU, FullFS);
196 unsigned Reg = isPPC64 ? PPC::X1 : PPC::R1;
214 if (getContext().isXCOFF()) {
216 static_cast<const MCSectionXCOFF *
>(Streamer.getCurrentSectionOnly())
217 ->getQualNameSymbol();
229 << getContext().getAsmInfo()->getSpecifierName(Kind) <<
'\n';
241 void emitMachine(
StringRef CPU)
override {
242 const Triple &
TT = Streamer.getContext().getTargetTriple();
243 if (
TT.isOSBinFormatXCOFF())
244 OS <<
"\t.machine\t" <<
'\"' << CPU <<
'\"' <<
'\n';
246 OS <<
"\t.machine " << CPU <<
'\n';
249 void emitAbiVersion(
int AbiVersion)
override {
250 OS <<
"\t.abiversion " << AbiVersion <<
'\n';
254 const MCAsmInfo *MAI = Streamer.getContext().getAsmInfo();
256 OS <<
"\t.localentry\t";
275 Streamer.emitSymbolValue(&S, 8);
278 void emitMachine(
StringRef CPU)
override {
283 void emitAbiVersion(
int AbiVersion)
override {
285 unsigned Flags =
W.getELFHeaderEFlags();
286 Flags &= ~ELF::EF_PPC64_ABI;
288 W.setELFHeaderEFlags(Flags);
295 unsigned Encoded = encodePPC64LocalEntryOffset(LocalOffset);
298 Other &= ~ELF::STO_PPC64_LOCAL_MASK;
305 unsigned Flags =
W.getELFHeaderEFlags();
307 W.setELFHeaderEFlags(Flags | 2);
315 if (copyLocalEntry(Symbol,
Value))
316 UpdateOther.insert(Symbol);
318 UpdateOther.erase(Symbol);
321 void finish()
override {
322 for (
auto *
Sym : UpdateOther)
323 if (
Sym->isVariable())
324 copyLocalEntry(
Sym,
Sym->getVariableValue());
335 auto *
Ref = dyn_cast<const MCSymbolRefExpr>(S);
338 auto &RhsSym =
static_cast<const MCSymbolELF &
>(
Ref->getSymbol());
339 unsigned Other =
D->getOther();
340 Other &= ~ELF::STO_PPC64_LOCAL_MASK;
346 unsigned encodePPC64LocalEntryOffset(
const MCExpr *LocalOffset) {
349 if (!LocalOffset->evaluateAsAbsolute(
Offset, MCA))
351 ".localentry expression must be absolute");
356 LocalOffset->
getLoc(),
".localentry expression must be a power of 2");
380 void emitMachine(
StringRef CPU)
override {
385 void emitAbiVersion(
int AbiVersion)
override {
399 const MCAsmInfo *MAI = Streamer.getContext().getAsmInfo();
401 Streamer.emitValueToAlignment(
Align(PointerSize));
406 void emitMachine(
StringRef CPU)
override {
411 void emitAbiVersion(
int AbiVersion)
override {
425 return new PPCTargetAsmStreamer(S,
OS);
435 if (TT.isOSBinFormatELF())
436 return new PPCTargetELFStreamer(S);
437 if (TT.isOSBinFormatXCOFF())
438 return new PPCTargetXCOFFStreamer(S);
439 return new PPCTargetMachOStreamer(S);
443 unsigned SyntaxVariant,
461 Info->get(Inst.
getOpcode()).operands()[NumOps - 1].OperandType !=
472 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
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)
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)
LLVM_ABI LLVM_EXTERNAL_VISIBILITY void LLVMInitializePowerPCTargetMC()
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)
void printExpr(raw_ostream &, const MCExpr &) const
unsigned getCodePointerSize() const
Get the code pointer size in bytes.
MCContext & getContext() const
static MCCFIInstruction cfiDefCfa(MCSymbol *L, unsigned Register, int64_t Offset, SMLoc Loc={})
.cfi_def_cfa defines a rule for computing CFA as: take address from Register and add Offset to it.
LLVM_ABI void reportError(SMLoc L, const Twine &Msg)
Base class for the full range of assembler expressions which are needed for parsing.
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
Describe properties that are true of each instruction in the target description file.
Interface to description of machine instruction set.
void emitValueToAlignment(Align Alignment, int64_t Fill=0, uint8_t FillLen=1, unsigned MaxBytesToEmit=0) override
Emit some number of copies of Value until the byte alignment ByteAlignment is reached.
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
Wrapper class representing physical registers. Should be passed by value.
Streaming machine code generation interface.
Generic base class for all target subtargets.
const Triple & getTargetTriple() const
unsigned getOther() const
void setOther(unsigned Other)
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx, SMLoc Loc=SMLoc())
StringRef getSymbolTableName() const
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
LLVM_ABI 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.
const char * stripRegisterPrefix(const char *RegName)
stripRegisterPrefix - This method strips the character prefix from a register name so that only the n...
static bool isVRRegister(unsigned Reg)
MCRegister getRegNumForOperand(const MCInstrDesc &Desc, MCRegister Reg, unsigned OpNo)
getRegNumForOperand - some operands use different numbering schemes for the same registers.
static bool isVFRegister(unsigned Reg)
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.
MCStreamer * createPPCXCOFFStreamer(const Triple &, MCContext &, 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()
MCStreamer * createPPCELFStreamer(const Triple &, MCContext &, 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.
Description of the encoding of one expression Op.
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)