Go to the documentation of this file.
50 #define GET_INSTRINFO_MC_DESC
51 #include "PPCGenInstrInfo.inc"
53 #define GET_SUBTARGETINFO_MC_DESC
54 #include "PPCGenSubtargetInfo.inc"
56 #define GET_REGINFO_MC_DESC
57 #include "PPCGenRegisterInfo.inc"
66 InitPPCMCInstrInfo(
X);
73 unsigned Flavour = isPPC64 ? 0 : 1;
74 unsigned RA = isPPC64 ? PPC::LR8 : PPC::LR;
77 InitPPCMCRegisterInfo(
X,
RA, Flavour, Flavour);
84 std::string FullFS = std::string(
FS);
88 FullFS =
"+aix," + FullFS;
93 return createPPCMCSubtargetInfoImpl(TT, CPU, CPU, FullFS);
109 unsigned Reg = isPPC64 ? PPC::X1 : PPC::R1;
119 std::unique_ptr<MCAsmBackend> &&MAB,
120 std::unique_ptr<MCObjectWriter> &&OW,
121 std::unique_ptr<MCCodeEmitter> &&Emitter,
bool RelaxAll) {
128 std::unique_ptr<MCObjectWriter> &&OW,
129 std::unique_ptr<MCCodeEmitter> &&Emitter,
bool RelaxAll) {
147 cast<MCSectionXCOFF>(Streamer.getCurrentSectionOnly())
148 ->getQualNameSymbol();
153 if (
Kind == MCSymbolRefExpr::VariantKind::VK_PPC_AIX_TLSGD ||
154 Kind == MCSymbolRefExpr::VariantKind::VK_PPC_AIX_TLSGDM)
155 OS <<
"\t.tc " << TCSym->
getName() <<
"," << XSym->getName() <<
"@"
158 OS <<
"\t.tc " << TCSym->
getName() <<
"," << XSym->getName() <<
'\n';
165 OS <<
"\t.tc " <<
S.getName() <<
"[TC]," <<
S.getName() <<
'\n';
168 void emitMachine(
StringRef CPU)
override {
169 OS <<
"\t.machine " << CPU <<
'\n';
172 void emitAbiVersion(
int AbiVersion)
override {
173 OS <<
"\t.abiversion " << AbiVersion <<
'\n';
177 const MCAsmInfo *MAI = Streamer.getContext().getAsmInfo();
179 OS <<
"\t.localentry\t";
182 LocalOffset->
print(OS, MAI);
199 Streamer.emitSymbolValue(&
S, 8);
202 void emitMachine(
StringRef CPU)
override {
207 void emitAbiVersion(
int AbiVersion)
override {
220 unsigned Encoded = encodePPC64LocalEntryOffset(LocalOffset);
222 unsigned Other =
S->getOther();
235 auto *
Symbol = cast<MCSymbolELF>(
S);
240 UpdateOther.insert(
Symbol);
242 UpdateOther.erase(
Symbol);
245 void finish()
override {
246 for (
auto *Sym : UpdateOther)
247 if (Sym->isVariable())
248 copyLocalEntry(Sym, Sym->getVariableValue());
259 auto *
Ref = dyn_cast<const MCSymbolRefExpr>(
S);
262 const auto &RhsSym = cast<MCSymbolELF>(
Ref->getSymbol());
263 unsigned Other =
D->getOther();
270 unsigned encodePPC64LocalEntryOffset(
const MCExpr *LocalOffset) {
273 if (!LocalOffset->evaluateAsAbsolute(Offset, MCA))
275 ".localentry expression must be absolute");
280 LocalOffset->
getLoc(),
".localentry expression must be a power of 2");
305 void emitMachine(
StringRef CPU)
override {
310 void emitAbiVersion(
int AbiVersion)
override {
325 const MCAsmInfo *MAI = Streamer.getContext().getAsmInfo();
332 void emitMachine(
StringRef CPU)
override {
336 void emitAbiVersion(
int AbiVersion)
override {
351 return new PPCTargetAsmStreamer(
S, OS);
357 if (TT.isOSBinFormatELF())
358 return new PPCTargetELFStreamer(
S);
359 if (TT.isOSBinFormatXCOFF())
360 return new PPCTargetXCOFFStreamer(
S);
361 return new PPCTargetMachOStreamer(
S);
365 unsigned SyntaxVariant,
383 Info->get(Inst.
getOpcode()).OpInfo[NumOps - 1].OperandType !=
394 return new PPCMCInstrAnalysis(
Info);
unsigned getELFHeaderEFlags() const
ELF e_header flags.
This is an optimization pass for GlobalISel generic memory operations.
MCSymbol - Instances of this class represent a symbol name in the MC file, and MCSymbols are created ...
static MCInstrAnalysis * createPPCMCInstrAnalysis(const MCInstrInfo *Info)
Context object for machine code objects.
StringRef getSymbolTableName() const
Target - Wrapper for Target specific information.
This class is intended to be used as a base class for asm properties and features specific to the tar...
Reg
All possible values of the reg field in the ModR/M byte.
static void RegisterAsmTargetStreamer(Target &T, Target::AsmTargetStreamerCtorTy Fn)
static void RegisterMCInstrAnalysis(Target &T, Target::MCInstrAnalysisCtorFnTy Fn)
RegisterMCInstrAnalysis - Register a MCInstrAnalysis implementation for the given target.
~PPCTargetStreamer() override
Triple - Helper class for working with autoconf configuration names.
bool isOSBinFormatXCOFF() const
Tests whether the OS uses the XCOFF binary format.
unsigned getCodePointerSize() const
Get the code pointer size in bytes.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
Instances of this class represent a single low-level machine instruction.
static void RegisterMCInstPrinter(Target &T, Target::MCInstPrinterCtorTy Fn)
RegisterMCInstPrinter - Register a MCInstPrinter implementation for the given target.
unsigned getNumOperands() const
MCXCOFFStreamer * createPPCXCOFFStreamer(MCContext &Context, std::unique_ptr< MCAsmBackend > MAB, std::unique_ptr< MCObjectWriter > OW, std::unique_ptr< MCCodeEmitter > Emitter)
Target & getThePPC64LETarget()
Streaming machine code generation interface.
@ Ref
The access may reference the value stored in memory.
MCContext & getContext() const
(vector float) vec_cmpeq(*A, *B) C
static MCInstrInfo * createPPCMCInstrInfo()
unsigned Log2(Align A)
Returns the log2 of the alignment.
Clang compiles this i1 i64 store i64 i64 store i64 i64 store i64 i64 store i64 align Which gets codegen d xmm0 movaps rbp movaps rbp movaps rbp movaps rbp rbp rbp rbp rbp It would be better to have movq s of instead of the movaps s LLVM produces ret int
const Triple & getTargetTriple() const
const char LLVMTargetMachineRef LLVMPassBuilderOptionsRef Options
Target specific streamer interface.
Analysis containing CSE Info
StringRef getName() const
getName - Get the symbol name.
ArchType getArch() const
Get the parsed architecture type of this triple.
RegisterMCAsmInfoFn - Helper template for registering a target assembly info implementation.
static GCMetadataPrinterRegistry::Add< ErlangGCPrinter > X("erlang", "erlang-compatible garbage collector")
void emitValueToAlignment(unsigned, int64_t, unsigned, unsigned) override
Emit some number of copies of Value until the byte alignment ByteAlignment is reached.
static MCTargetStreamer * createObjectTargetStreamer(MCStreamer &S, const MCSubtargetInfo &STI)
static MCInstPrinter * createPPCMCInstPrinter(const Triple &T, unsigned SyntaxVariant, const MCAsmInfo &MAI, const MCInstrInfo &MII, const MCRegisterInfo &MRI)
static void RegisterMCAsmBackend(Target &T, Target::MCAsmBackendCtorTy Fn)
RegisterMCAsmBackend - Register a MCAsmBackend implementation for the given target.
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static MCSubtargetInfo * createPPCMCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS)
This is an instance of a target assembly language printer that converts an MCInst to valid target ass...
#define LLVM_EXTERNAL_VISIBILITY
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
static void RegisterObjectTargetStreamer(Target &T, Target::ObjectTargetStreamerCtorTy Fn)
void setELFHeaderEFlags(unsigned Flags)
constexpr uint64_t PointerSize
x86_64 pointer size.
void reportError(SMLoc L, const Twine &Msg)
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.
void addInitialFrameState(const MCCFIInstruction &Inst)
SI optimize exec mask operations pre RA
static void RegisterMCSubtargetInfo(Target &T, Target::MCSubtargetInfoCtorFnTy Fn)
RegisterMCSubtargetInfo - Register a MCSubtargetInfo implementation for the given target.
MCCodeEmitter * createPPCMCCodeEmitter(const MCInstrInfo &MCII, MCContext &Ctx)
MCELFStreamer * createPPCELFStreamer(MCContext &Context, std::unique_ptr< MCAsmBackend > MAB, std::unique_ptr< MCObjectWriter > OW, std::unique_ptr< MCCodeEmitter > Emitter)
StringRef - Represent a constant reference to a string, i.e.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
MCRegisterInfo base class - We assume that the target defines a static array of MCRegisterDesc object...
PPCTargetStreamer(MCStreamer &S)
unsigned const MachineRegisterInfo * MRI
Target & getThePPC64Target()
static void RegisterMCInstrInfo(Target &T, Target::MCInstrInfoCtorFnTy Fn)
RegisterMCInstrInfo - Register a MCInstrInfo implementation for the given target.
static void RegisterMCCodeEmitter(Target &T, Target::MCCodeEmitterCtorTy Fn)
RegisterMCCodeEmitter - Register a MCCodeEmitter implementation for the given target.
Interface to description of machine instruction set.
static void RegisterMCRegInfo(Target &T, Target::MCRegInfoCtorFnTy Fn)
RegisterMCRegInfo - Register a MCRegisterInfo implementation for the given target.
static void RegisterELFStreamer(Target &T, Target::ELFStreamerCtorTy Fn)
LLVM_EXTERNAL_VISIBILITY void LLVMInitializePowerPCTargetMC()
unsigned getOpcode() const
static const MCSymbolRefExpr * create(const MCSymbol *Symbol, MCContext &Ctx)
static StringRef getVariantKindName(VariantKind Kind)
static void RegisterXCOFFStreamer(Target &T, Target::XCOFFStreamerCtorTy Fn)
Target & getThePPC32LETarget()
static MCRegisterInfo * createPPCMCRegisterInfo(const Triple &TT)
static MCAsmInfo * createPPCMCAsmInfo(const MCRegisterInfo &MRI, const Triple &TheTriple, const MCTargetOptions &Options)
void print(raw_ostream &OS, const MCAsmInfo *MAI, bool InParens=false) const
MCAsmBackend * createPPCAsmBackend(const Target &T, const MCSubtargetInfo &STI, const MCRegisterInfo &MRI, const MCTargetOptions &Options)
const MCOperand & getOperand(unsigned i) const
static MCTargetStreamer * createAsmTargetStreamer(MCStreamer &S, formatted_raw_ostream &OS, MCInstPrinter *InstPrint, bool isVerboseAsm)
Generic base class for all target subtargets.
LLVM Value Representation.
Base class for the full range of assembler expressions which are needed for parsing.
Optional< std::vector< StOtherPiece > > Other
Target & getThePPC32Target()