Go to the documentation of this file.
9 #ifndef LLVM_MC_MCMACHOBJECTWRITER_H
10 #define LLVM_MC_MCMACHOBJECTWRITER_H
27 class MachObjectWriter;
30 const unsigned Is64Bit : 1;
86 struct MachSymbolData {
96 std::unique_ptr<MCMachObjectTargetWriter> TargetObjectWriter;
101 struct RelAndSymbol {
105 : Sym(Sym), MRE(MRE) {}
118 std::vector<MachSymbolData> LocalSymbolData;
119 std::vector<MachSymbolData> ExternalSymbolData;
120 std::vector<MachSymbolData> UndefinedSymbolData;
124 MachSymbolData *findSymbolData(
const MCSymbol &Sym);
131 : TargetObjectWriter(
std::
move(MOTW)),
143 void reset()
override;
155 return SectionAddress.
lookup(Sec);
171 bool is64Bit()
const {
return TargetObjectWriter->is64Bit(); }
180 unsigned LoadCommandsSize,
bool SubsectionsViaSymbols);
194 uint64_t RelocationsStart,
unsigned NumRelocations);
234 RelAndSymbol
P(RelSymbol, MRE);
235 Relocations[Sec].push_back(
P);
246 std::vector<MachSymbolData> &LocalSymbolData,
247 std::vector<MachSymbolData> &ExternalSymbolData,
248 std::vector<MachSymbolData> &UndefinedSymbolData);
259 bool InSet)
const override;
264 bool IsPCRel)
const override;
278 std::unique_ptr<MCObjectWriter>
280 raw_pwrite_stream &OS,
bool IsLittleEndian);
284 #endif // LLVM_MC_MCMACHOBJECTWRITER_H
void writeNlist(MachSymbolData &MSD, const MCAsmLayout &Layout)
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 ...
void writeLinkeditLoadCommand(uint32_t Type, uint32_t DataOffset, uint32_t DataSize)
ValueT lookup(const_arg_type_t< KeyT > Val) const
lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...
This currently compiles esp xmm0 movsd esp eax eax esp ret We should use not the dag combiner This is because dagcombine2 needs to be able to see through the X86ISD::Wrapper which DAGCombine can t really do The code for turning x load into a single vector load is target independent and should be moved to the dag combiner The code for turning x load into a vector load can only handle a direct load from a global or a direct load from the stack It should be generalized to handle any load from P
Target - Wrapper for Target specific information.
MCMachObjectTargetWriter(bool Is64Bit_, uint32_t CPUType_, uint32_t CPUSubtype_)
uint32_t getCPUType() const
The instances of the Type class are immutable: once they are created, they are never changed.
bool doesSymbolRequireExternRelocation(const MCSymbol &S)
Adapter to write values to a stream in a particular byte order.
uint64_t writeObject(MCAssembler &Asm, const MCAsmLayout &Layout) override
Write the object file and returns the number of bytes written.
void computeSectionAddresses(const MCAssembler &Asm, const MCAsmLayout &Layout)
Base class for classes that define behaviour that is specific to both the target and the object forma...
MachObjectWriter(std::unique_ptr< MCMachObjectTargetWriter > MOTW, raw_pwrite_stream &OS, bool IsLittleEndian)
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
const char LLVMTargetMachineRef LLVMPassBuilderOptionsRef Options
virtual ~MCMachObjectTargetWriter()
bool isFixupKindPCRel(const MCAssembler &Asm, unsigned Kind)
void setLocalDifferenceRelocationType(unsigned Type)
SectionAddrMap & getSectionAddressMap()
std::unique_ptr< MCObjectWriter > createMachObjectWriter(std::unique_ptr< MCMachObjectTargetWriter > MOTW, raw_pwrite_stream &OS, bool IsLittleEndian)
Construct a new Mach-O writer instance.
void executePostLayoutBinding(MCAssembler &Asm, const MCAsmLayout &Layout) override
Perform any late binding of symbols (for example, to assign symbol indices for use when generating re...
uint64_t getPaddingSize(const MCSection *SD, const MCAsmLayout &Layout) const
bool isSymbolRefDifferenceFullyResolvedImpl(const MCAssembler &Asm, const MCSymbol &A, const MCSymbol &B, bool InSet) const override
uint64_t getFragmentAddress(const MCFragment *Fragment, const MCAsmLayout &Layout) const
An abstract base class for streams implementations that also support a pwrite operation.
virtual void recordRelocation(MachObjectWriter *Writer, MCAssembler &Asm, const MCAsmLayout &Layout, const MCFragment *Fragment, const MCFixup &Fixup, MCValue Target, uint64_t &FixedValue)=0
void writeLinkerOptionsLoadCommand(const std::vector< std::string > &Options)
bool operator<(int64_t V1, const APSInt &V2)
void writeHeader(MachO::HeaderFileType Type, unsigned NumLoadCommands, unsigned LoadCommandsSize, bool SubsectionsViaSymbols)
static bool classof(const MCObjectTargetWriter *W)
void writeDysymtabLoadCommand(uint32_t FirstLocalSymbol, uint32_t NumLocalSymbols, uint32_t FirstExternalSymbol, uint32_t NumExternalSymbols, uint32_t FirstUndefinedSymbol, uint32_t NumUndefinedSymbols, uint32_t IndirectSymbolOffset, uint32_t NumIndirectSymbols)
Triple::ObjectFormatType getFormat() const override
void writeSymtabLoadCommand(uint32_t SymbolOffset, uint32_t NumSymbols, uint32_t StringTableOffset, uint32_t StringTableSize)
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
void populateAddrSigSection(MCAssembler &Asm)
StringRef - Represent a constant reference to a string, i.e.
uint32_t getCPUSubtype() const
Defines the object file and target independent interfaces used by the assembler backend to write nati...
Instances of this class represent a uniqued identifier for a section in the current translation unit.
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
uint64_t getSymbolAddress(const MCSymbol &S, const MCAsmLayout &Layout) const
unsigned LocalDifference_RIT
Encapsulates the layout of an assembly file at a particular point in time.
Utility for building string tables with deduplicated suffixes.
void reset() override
lifetime management
void addRelocation(const MCSymbol *RelSymbol, const MCSection *Sec, MachO::any_relocation_info &MRE)
support::endian::Writer W
const MCSymbol & findAliasedSymbol(const MCSymbol &Sym) const
uint64_t getSectionAddress(const MCSection *Sec) const
Reimplement select in terms of SEL *We would really like to support but we need to prove that the add doesn t need to overflow between the two bit chunks *Implement pre post increment support(e.g. PR935) *Implement smarter const ant generation for binops with large immediates. A few ARMv6T2 ops should be pattern matched
void computeSymbolTable(MCAssembler &Asm, std::vector< MachSymbolData > &LocalSymbolData, std::vector< MachSymbolData > &ExternalSymbolData, std::vector< MachSymbolData > &UndefinedSymbolData)
Compute the symbol table data.
void recordRelocation(MCAssembler &Asm, const MCAsmLayout &Layout, const MCFragment *Fragment, const MCFixup &Fixup, MCValue Target, uint64_t &FixedValue) override
Record a relocation entry.
This represents an "assembler immediate".
Encode information on a single operation to perform on a byte sequence (e.g., an encoded instruction)...
void writeSegmentLoadCommand(StringRef Name, unsigned NumSections, uint64_t VMAddr, uint64_t VMSize, uint64_t SectionDataStartOffset, uint64_t SectionDataSize, uint32_t MaxProt, uint32_t InitProt)
Write a segment load command.
void writeSection(const MCAsmLayout &Layout, const MCSection &Sec, uint64_t VMAddr, uint64_t FileOffset, unsigned Flags, uint64_t RelocationsStart, unsigned NumRelocations)
unsigned getLocalDifferenceRelocationType() const
void bindIndirectSymbols(MCAssembler &Asm)