//===-------- PPCXCOFFStreamer.cpp - XCOFF Object Output ------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This is a custom MCXCOFFStreamer for PowerPC. // // The purpose of the custom XCOFF streamer is to allow us to intercept // instructions as they are being emitted and align all 8 byte instructions // to a 64 byte boundary if required (by adding a 4 byte nop). This is important // because 8 byte instructions are not allowed to cross 64 byte boundaries // and by aligning anything that is within 4 bytes of the boundary we can // guarantee that the 8 byte instructions do not cross that boundary. // //===----------------------------------------------------------------------===// #include "PPCXCOFFStreamer.h" #include "PPCMCCodeEmitter.h" #include "llvm/BinaryFormat/XCOFF.h" #include "llvm/MC/MCAsmBackend.h" #include "llvm/MC/MCAssembler.h" #include "llvm/MC/MCCodeEmitter.h" #include "llvm/MC/MCDirectives.h" #include "llvm/MC/MCObjectWriter.h" #include "llvm/MC/MCSectionXCOFF.h" #include "llvm/MC/MCSymbolXCOFF.h" #include "llvm/MC/TargetRegistry.h" usingnamespacellvm; PPCXCOFFStreamer::PPCXCOFFStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> MAB, std::unique_ptr<MCObjectWriter> OW, std::unique_ptr<MCCodeEmitter> Emitter) : … { … } void PPCXCOFFStreamer::emitPrefixedInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) { … } void PPCXCOFFStreamer::emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) { … } MCXCOFFStreamer * llvm::createPPCXCOFFStreamer(MCContext &Context, std::unique_ptr<MCAsmBackend> MAB, std::unique_ptr<MCObjectWriter> OW, std::unique_ptr<MCCodeEmitter> Emitter) { … }