Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:16

0001 //===-- llvm/MC/MCXCOFFObjectWriter.h - XCOFF Object Writer ---------------===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_MC_MCXCOFFOBJECTWRITER_H
0010 #define LLVM_MC_MCXCOFFOBJECTWRITER_H
0011 
0012 #include "llvm/MC/MCObjectWriter.h"
0013 
0014 namespace llvm {
0015 
0016 class raw_pwrite_stream;
0017 
0018 class MCXCOFFObjectTargetWriter : public MCObjectTargetWriter {
0019 protected:
0020   MCXCOFFObjectTargetWriter(bool Is64Bit);
0021 
0022 public:
0023   ~MCXCOFFObjectTargetWriter() override;
0024 
0025   Triple::ObjectFormatType getFormat() const override { return Triple::XCOFF; }
0026   static bool classof(const MCObjectTargetWriter *W) {
0027     return W->getFormat() == Triple::XCOFF;
0028   }
0029   bool is64Bit() const { return Is64Bit; }
0030 
0031   // Returns relocation info such as type, sign and size.
0032   // First element of the pair contains type,
0033   // second element contains sign and size.
0034   virtual std::pair<uint8_t, uint8_t>
0035   getRelocTypeAndSignSize(const MCValue &Target, const MCFixup &Fixup,
0036                           bool IsPCRel) const = 0;
0037 
0038 private:
0039   bool Is64Bit;
0040 };
0041 
0042 class XCOFFObjectWriter : public MCObjectWriter {
0043   // AIX specific CPU type.
0044   std::string CPUType;
0045 
0046 public:
0047   virtual void addExceptionEntry(const MCSymbol *Symbol, const MCSymbol *Trap,
0048                                  unsigned LanguageCode, unsigned ReasonCode,
0049                                  unsigned FunctionSize, bool hasDebug) = 0;
0050   virtual void addCInfoSymEntry(StringRef Name, StringRef Metadata) = 0;
0051   StringRef getCPUType() const { return CPUType; }
0052   void setCPU(StringRef TargetCPU) { CPUType = TargetCPU; }
0053 };
0054 
0055 std::unique_ptr<MCObjectWriter>
0056 createXCOFFObjectWriter(std::unique_ptr<MCXCOFFObjectTargetWriter> MOTW,
0057                         raw_pwrite_stream &OS);
0058 
0059 } // end namespace llvm
0060 
0061 #endif // LLVM_MC_MCXCOFFOBJECTWRITER_H