llvm-mc: Start MCAssembler and MCMachOStreamer.
- Together these form the (Mach-O) back end of the assembler.
- MCAssembler is the actual assembler backend, which is designed to have a
reasonable API. This will eventually grow to support multiple object file
implementations, but for now its Mach-O/i386 only.
- MCMachOStreamer adapts the MCStreamer "actions" API to the MCAssembler API,
e.g. converting the various directives into fragments, managing state like
the current section, and so on.
- llvm-mc will use the new backend via '-filetype=obj', which may eventually
be, but is not yet, since I hear that people like assemblers which actually
assemble.
- The only thing that works at the moment is changing sections. For the time
being I have a Python Mach-O dumping tool in test/scripts so this stuff can
be easily tested, eventually I expect to replace this with a real LLVM tool.
- More doxyments to come.
I assume that since this stuff doesn't touch any of the things which are part of
2.6 that it is ok to put this in not so long before the freeze, but if someone
objects let me know, I can pull it.
llvm-svn: 79612
2009-08-21 11:11:24 +02:00
|
|
|
//===- MCAssembler.h - Object File Generation -------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef LLVM_MC_MCASSEMBLER_H
|
|
|
|
#define LLVM_MC_MCASSEMBLER_H
|
|
|
|
|
2010-12-14 19:46:57 +01:00
|
|
|
#include "llvm/ADT/SmallPtrSet.h"
|
llvm-mc: Start MCAssembler and MCMachOStreamer.
- Together these form the (Mach-O) back end of the assembler.
- MCAssembler is the actual assembler backend, which is designed to have a
reasonable API. This will eventually grow to support multiple object file
implementations, but for now its Mach-O/i386 only.
- MCMachOStreamer adapts the MCStreamer "actions" API to the MCAssembler API,
e.g. converting the various directives into fragments, managing state like
the current section, and so on.
- llvm-mc will use the new backend via '-filetype=obj', which may eventually
be, but is not yet, since I hear that people like assemblers which actually
assemble.
- The only thing that works at the moment is changing sections. For the time
being I have a Python Mach-O dumping tool in test/scripts so this stuff can
be easily tested, eventually I expect to replace this with a real LLVM tool.
- More doxyments to come.
I assume that since this stuff doesn't touch any of the things which are part of
2.6 that it is ok to put this in not so long before the freeze, but if someone
objects let me know, I can pull it.
llvm-svn: 79612
2009-08-21 11:11:24 +02:00
|
|
|
#include "llvm/ADT/ilist.h"
|
|
|
|
#include "llvm/ADT/ilist_node.h"
|
2015-05-16 00:56:01 +02:00
|
|
|
#include "llvm/ADT/iterator.h"
|
2014-03-18 23:09:05 +01:00
|
|
|
#include "llvm/MC/MCDirectives.h"
|
2015-08-07 17:14:08 +02:00
|
|
|
#include "llvm/MC/MCDwarf.h"
|
2012-12-03 18:02:12 +01:00
|
|
|
#include "llvm/MC/MCFixup.h"
|
2015-12-29 10:06:16 +01:00
|
|
|
#include "llvm/MC/MCFragment.h"
|
2012-12-03 18:02:12 +01:00
|
|
|
#include "llvm/MC/MCInst.h"
|
2014-03-29 08:34:53 +01:00
|
|
|
#include "llvm/MC/MCLinkerOptimizationHint.h"
|
2014-01-29 00:12:53 +01:00
|
|
|
#include "llvm/MC/MCSubtargetInfo.h"
|
2015-12-29 10:06:21 +01:00
|
|
|
#include "llvm/MC/MCSymbol.h"
|
llvm-mc: Start MCAssembler and MCMachOStreamer.
- Together these form the (Mach-O) back end of the assembler.
- MCAssembler is the actual assembler backend, which is designed to have a
reasonable API. This will eventually grow to support multiple object file
implementations, but for now its Mach-O/i386 only.
- MCMachOStreamer adapts the MCStreamer "actions" API to the MCAssembler API,
e.g. converting the various directives into fragments, managing state like
the current section, and so on.
- llvm-mc will use the new backend via '-filetype=obj', which may eventually
be, but is not yet, since I hear that people like assemblers which actually
assemble.
- The only thing that works at the moment is changing sections. For the time
being I have a Python Mach-O dumping tool in test/scripts so this stuff can
be easily tested, eventually I expect to replace this with a real LLVM tool.
- More doxyments to come.
I assume that since this stuff doesn't touch any of the things which are part of
2.6 that it is ok to put this in not so long before the freeze, but if someone
objects let me know, I can pull it.
llvm-svn: 79612
2009-08-21 11:11:24 +02:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
class raw_ostream;
|
2010-03-12 22:00:49 +01:00
|
|
|
class MCAsmLayout;
|
llvm-mc: Start MCAssembler and MCMachOStreamer.
- Together these form the (Mach-O) back end of the assembler.
- MCAssembler is the actual assembler backend, which is designed to have a
reasonable API. This will eventually grow to support multiple object file
implementations, but for now its Mach-O/i386 only.
- MCMachOStreamer adapts the MCStreamer "actions" API to the MCAssembler API,
e.g. converting the various directives into fragments, managing state like
the current section, and so on.
- llvm-mc will use the new backend via '-filetype=obj', which may eventually
be, but is not yet, since I hear that people like assemblers which actually
assemble.
- The only thing that works at the moment is changing sections. For the time
being I have a Python Mach-O dumping tool in test/scripts so this stuff can
be easily tested, eventually I expect to replace this with a real LLVM tool.
- More doxyments to come.
I assume that since this stuff doesn't touch any of the things which are part of
2.6 that it is ok to put this in not so long before the freeze, but if someone
objects let me know, I can pull it.
llvm-svn: 79612
2009-08-21 11:11:24 +02:00
|
|
|
class MCAssembler;
|
2009-08-31 10:07:55 +02:00
|
|
|
class MCContext;
|
2010-03-19 11:43:18 +01:00
|
|
|
class MCCodeEmitter;
|
2009-10-16 03:58:03 +02:00
|
|
|
class MCExpr;
|
2010-02-11 22:29:29 +01:00
|
|
|
class MCFragment;
|
2010-03-19 10:28:59 +01:00
|
|
|
class MCObjectWriter;
|
llvm-mc: Start MCAssembler and MCMachOStreamer.
- Together these form the (Mach-O) back end of the assembler.
- MCAssembler is the actual assembler backend, which is designed to have a
reasonable API. This will eventually grow to support multiple object file
implementations, but for now its Mach-O/i386 only.
- MCMachOStreamer adapts the MCStreamer "actions" API to the MCAssembler API,
e.g. converting the various directives into fragments, managing state like
the current section, and so on.
- llvm-mc will use the new backend via '-filetype=obj', which may eventually
be, but is not yet, since I hear that people like assemblers which actually
assemble.
- The only thing that works at the moment is changing sections. For the time
being I have a Python Mach-O dumping tool in test/scripts so this stuff can
be easily tested, eventually I expect to replace this with a real LLVM tool.
- More doxyments to come.
I assume that since this stuff doesn't touch any of the things which are part of
2.6 that it is ok to put this in not so long before the freeze, but if someone
objects let me know, I can pull it.
llvm-svn: 79612
2009-08-21 11:11:24 +02:00
|
|
|
class MCSection;
|
2014-01-29 00:12:53 +01:00
|
|
|
class MCSubtargetInfo;
|
2010-03-12 22:00:49 +01:00
|
|
|
class MCValue;
|
2011-07-26 01:24:55 +02:00
|
|
|
class MCAsmBackend;
|
llvm-mc: Start MCAssembler and MCMachOStreamer.
- Together these form the (Mach-O) back end of the assembler.
- MCAssembler is the actual assembler backend, which is designed to have a
reasonable API. This will eventually grow to support multiple object file
implementations, but for now its Mach-O/i386 only.
- MCMachOStreamer adapts the MCStreamer "actions" API to the MCAssembler API,
e.g. converting the various directives into fragments, managing state like
the current section, and so on.
- llvm-mc will use the new backend via '-filetype=obj', which may eventually
be, but is not yet, since I hear that people like assemblers which actually
assemble.
- The only thing that works at the moment is changing sections. For the time
being I have a Python Mach-O dumping tool in test/scripts so this stuff can
be easily tested, eventually I expect to replace this with a real LLVM tool.
- More doxyments to come.
I assume that since this stuff doesn't touch any of the things which are part of
2.6 that it is ok to put this in not so long before the freeze, but if someone
objects let me know, I can pull it.
llvm-svn: 79612
2009-08-21 11:11:24 +02:00
|
|
|
|
2009-08-24 13:56:58 +02:00
|
|
|
// FIXME: This really doesn't belong here. See comments below.
|
|
|
|
struct IndirectSymbolData {
|
|
|
|
MCSymbol *Symbol;
|
2015-05-26 04:17:21 +02:00
|
|
|
MCSection *Section;
|
2009-08-24 13:56:58 +02:00
|
|
|
};
|
|
|
|
|
2012-05-18 21:12:01 +02:00
|
|
|
// FIXME: Ditto this. Purely so the Streamer and the ObjectWriter can talk
|
|
|
|
// to one another.
|
|
|
|
struct DataRegionData {
|
|
|
|
// This enum should be kept in sync w/ the mach-o definition in
|
|
|
|
// llvm/Object/MachOFormat.h.
|
|
|
|
enum KindTy { Data = 1, JumpTable8, JumpTable16, JumpTable32 } Kind;
|
|
|
|
MCSymbol *Start;
|
|
|
|
MCSymbol *End;
|
|
|
|
};
|
|
|
|
|
llvm-mc: Start MCAssembler and MCMachOStreamer.
- Together these form the (Mach-O) back end of the assembler.
- MCAssembler is the actual assembler backend, which is designed to have a
reasonable API. This will eventually grow to support multiple object file
implementations, but for now its Mach-O/i386 only.
- MCMachOStreamer adapts the MCStreamer "actions" API to the MCAssembler API,
e.g. converting the various directives into fragments, managing state like
the current section, and so on.
- llvm-mc will use the new backend via '-filetype=obj', which may eventually
be, but is not yet, since I hear that people like assemblers which actually
assemble.
- The only thing that works at the moment is changing sections. For the time
being I have a Python Mach-O dumping tool in test/scripts so this stuff can
be easily tested, eventually I expect to replace this with a real LLVM tool.
- More doxyments to come.
I assume that since this stuff doesn't touch any of the things which are part of
2.6 that it is ok to put this in not so long before the freeze, but if someone
objects let me know, I can pull it.
llvm-svn: 79612
2009-08-21 11:11:24 +02:00
|
|
|
class MCAssembler {
|
2010-03-25 20:35:56 +01:00
|
|
|
friend class MCAsmLayout;
|
|
|
|
|
llvm-mc: Start MCAssembler and MCMachOStreamer.
- Together these form the (Mach-O) back end of the assembler.
- MCAssembler is the actual assembler backend, which is designed to have a
reasonable API. This will eventually grow to support multiple object file
implementations, but for now its Mach-O/i386 only.
- MCMachOStreamer adapts the MCStreamer "actions" API to the MCAssembler API,
e.g. converting the various directives into fragments, managing state like
the current section, and so on.
- llvm-mc will use the new backend via '-filetype=obj', which may eventually
be, but is not yet, since I hear that people like assemblers which actually
assemble.
- The only thing that works at the moment is changing sections. For the time
being I have a Python Mach-O dumping tool in test/scripts so this stuff can
be easily tested, eventually I expect to replace this with a real LLVM tool.
- More doxyments to come.
I assume that since this stuff doesn't touch any of the things which are part of
2.6 that it is ok to put this in not so long before the freeze, but if someone
objects let me know, I can pull it.
llvm-svn: 79612
2009-08-21 11:11:24 +02:00
|
|
|
public:
|
2015-06-01 03:30:01 +02:00
|
|
|
typedef std::vector<MCSection *> SectionListType;
|
2015-05-16 02:35:24 +02:00
|
|
|
typedef std::vector<const MCSymbol *> SymbolDataListType;
|
llvm-mc: Start MCAssembler and MCMachOStreamer.
- Together these form the (Mach-O) back end of the assembler.
- MCAssembler is the actual assembler backend, which is designed to have a
reasonable API. This will eventually grow to support multiple object file
implementations, but for now its Mach-O/i386 only.
- MCMachOStreamer adapts the MCStreamer "actions" API to the MCAssembler API,
e.g. converting the various directives into fragments, managing state like
the current section, and so on.
- llvm-mc will use the new backend via '-filetype=obj', which may eventually
be, but is not yet, since I hear that people like assemblers which actually
assemble.
- The only thing that works at the moment is changing sections. For the time
being I have a Python Mach-O dumping tool in test/scripts so this stuff can
be easily tested, eventually I expect to replace this with a real LLVM tool.
- More doxyments to come.
I assume that since this stuff doesn't touch any of the things which are part of
2.6 that it is ok to put this in not so long before the freeze, but if someone
objects let me know, I can pull it.
llvm-svn: 79612
2009-08-21 11:11:24 +02:00
|
|
|
|
2015-05-26 01:14:17 +02:00
|
|
|
typedef pointee_iterator<SectionListType::const_iterator> const_iterator;
|
|
|
|
typedef pointee_iterator<SectionListType::iterator> iterator;
|
llvm-mc: Start MCAssembler and MCMachOStreamer.
- Together these form the (Mach-O) back end of the assembler.
- MCAssembler is the actual assembler backend, which is designed to have a
reasonable API. This will eventually grow to support multiple object file
implementations, but for now its Mach-O/i386 only.
- MCMachOStreamer adapts the MCStreamer "actions" API to the MCAssembler API,
e.g. converting the various directives into fragments, managing state like
the current section, and so on.
- llvm-mc will use the new backend via '-filetype=obj', which may eventually
be, but is not yet, since I hear that people like assemblers which actually
assemble.
- The only thing that works at the moment is changing sections. For the time
being I have a Python Mach-O dumping tool in test/scripts so this stuff can
be easily tested, eventually I expect to replace this with a real LLVM tool.
- More doxyments to come.
I assume that since this stuff doesn't touch any of the things which are part of
2.6 that it is ok to put this in not so long before the freeze, but if someone
objects let me know, I can pull it.
llvm-svn: 79612
2009-08-21 11:11:24 +02:00
|
|
|
|
2015-05-16 00:56:01 +02:00
|
|
|
typedef pointee_iterator<SymbolDataListType::const_iterator>
|
|
|
|
const_symbol_iterator;
|
|
|
|
typedef pointee_iterator<SymbolDataListType::iterator> symbol_iterator;
|
2009-08-22 12:13:24 +02:00
|
|
|
|
2014-04-18 20:24:25 +02:00
|
|
|
typedef iterator_range<symbol_iterator> symbol_range;
|
|
|
|
typedef iterator_range<const_symbol_iterator> const_symbol_range;
|
|
|
|
|
2010-03-19 08:09:33 +01:00
|
|
|
typedef std::vector<IndirectSymbolData>::const_iterator
|
2015-05-15 21:13:20 +02:00
|
|
|
const_indirect_symbol_iterator;
|
2009-08-24 13:56:58 +02:00
|
|
|
typedef std::vector<IndirectSymbolData>::iterator indirect_symbol_iterator;
|
|
|
|
|
2012-05-18 21:12:01 +02:00
|
|
|
typedef std::vector<DataRegionData>::const_iterator
|
2015-05-15 21:13:20 +02:00
|
|
|
const_data_region_iterator;
|
2012-05-18 21:12:01 +02:00
|
|
|
typedef std::vector<DataRegionData>::iterator data_region_iterator;
|
|
|
|
|
2014-03-18 23:09:05 +01:00
|
|
|
/// MachO specific deployment target version info.
|
|
|
|
// A Major version of 0 indicates that no version information was supplied
|
|
|
|
// and so the corresponding load command should not be emitted.
|
|
|
|
typedef struct {
|
|
|
|
MCVersionMinType Kind;
|
|
|
|
unsigned Major;
|
|
|
|
unsigned Minor;
|
|
|
|
unsigned Update;
|
|
|
|
} VersionMinInfoType;
|
2015-05-15 21:13:20 +02:00
|
|
|
|
llvm-mc: Start MCAssembler and MCMachOStreamer.
- Together these form the (Mach-O) back end of the assembler.
- MCAssembler is the actual assembler backend, which is designed to have a
reasonable API. This will eventually grow to support multiple object file
implementations, but for now its Mach-O/i386 only.
- MCMachOStreamer adapts the MCStreamer "actions" API to the MCAssembler API,
e.g. converting the various directives into fragments, managing state like
the current section, and so on.
- llvm-mc will use the new backend via '-filetype=obj', which may eventually
be, but is not yet, since I hear that people like assemblers which actually
assemble.
- The only thing that works at the moment is changing sections. For the time
being I have a Python Mach-O dumping tool in test/scripts so this stuff can
be easily tested, eventually I expect to replace this with a real LLVM tool.
- More doxyments to come.
I assume that since this stuff doesn't touch any of the things which are part of
2.6 that it is ok to put this in not so long before the freeze, but if someone
objects let me know, I can pull it.
llvm-svn: 79612
2009-08-21 11:11:24 +02:00
|
|
|
private:
|
2015-05-15 21:13:20 +02:00
|
|
|
MCAssembler(const MCAssembler &) = delete;
|
|
|
|
void operator=(const MCAssembler &) = delete;
|
llvm-mc: Start MCAssembler and MCMachOStreamer.
- Together these form the (Mach-O) back end of the assembler.
- MCAssembler is the actual assembler backend, which is designed to have a
reasonable API. This will eventually grow to support multiple object file
implementations, but for now its Mach-O/i386 only.
- MCMachOStreamer adapts the MCStreamer "actions" API to the MCAssembler API,
e.g. converting the various directives into fragments, managing state like
the current section, and so on.
- llvm-mc will use the new backend via '-filetype=obj', which may eventually
be, but is not yet, since I hear that people like assemblers which actually
assemble.
- The only thing that works at the moment is changing sections. For the time
being I have a Python Mach-O dumping tool in test/scripts so this stuff can
be easily tested, eventually I expect to replace this with a real LLVM tool.
- More doxyments to come.
I assume that since this stuff doesn't touch any of the things which are part of
2.6 that it is ok to put this in not so long before the freeze, but if someone
objects let me know, I can pull it.
llvm-svn: 79612
2009-08-21 11:11:24 +02:00
|
|
|
|
2009-08-31 10:07:55 +02:00
|
|
|
MCContext &Context;
|
|
|
|
|
2011-07-26 01:24:55 +02:00
|
|
|
MCAsmBackend &Backend;
|
2010-03-11 02:34:27 +01:00
|
|
|
|
2010-03-19 11:43:18 +01:00
|
|
|
MCCodeEmitter &Emitter;
|
|
|
|
|
2010-12-17 03:45:41 +01:00
|
|
|
MCObjectWriter &Writer;
|
|
|
|
|
2015-05-26 01:14:17 +02:00
|
|
|
SectionListType Sections;
|
llvm-mc: Start MCAssembler and MCMachOStreamer.
- Together these form the (Mach-O) back end of the assembler.
- MCAssembler is the actual assembler backend, which is designed to have a
reasonable API. This will eventually grow to support multiple object file
implementations, but for now its Mach-O/i386 only.
- MCMachOStreamer adapts the MCStreamer "actions" API to the MCAssembler API,
e.g. converting the various directives into fragments, managing state like
the current section, and so on.
- llvm-mc will use the new backend via '-filetype=obj', which may eventually
be, but is not yet, since I hear that people like assemblers which actually
assemble.
- The only thing that works at the moment is changing sections. For the time
being I have a Python Mach-O dumping tool in test/scripts so this stuff can
be easily tested, eventually I expect to replace this with a real LLVM tool.
- More doxyments to come.
I assume that since this stuff doesn't touch any of the things which are part of
2.6 that it is ok to put this in not so long before the freeze, but if someone
objects let me know, I can pull it.
llvm-svn: 79612
2009-08-21 11:11:24 +02:00
|
|
|
|
2015-05-16 00:56:01 +02:00
|
|
|
SymbolDataListType Symbols;
|
2009-08-22 12:13:24 +02:00
|
|
|
|
2009-08-24 13:56:58 +02:00
|
|
|
std::vector<IndirectSymbolData> IndirectSymbols;
|
|
|
|
|
2012-05-18 21:12:01 +02:00
|
|
|
std::vector<DataRegionData> DataRegions;
|
2013-01-18 02:26:07 +01:00
|
|
|
|
|
|
|
/// The list of linker options to propagate into the object file.
|
2015-05-15 21:13:20 +02:00
|
|
|
std::vector<std::vector<std::string>> LinkerOptions;
|
2013-01-18 02:26:07 +01:00
|
|
|
|
2013-10-29 02:06:17 +01:00
|
|
|
/// List of declared file names
|
2015-05-28 20:03:20 +02:00
|
|
|
std::vector<std::string> FileNames;
|
2013-10-29 02:06:17 +01:00
|
|
|
|
2015-08-07 17:14:08 +02:00
|
|
|
MCDwarfLineTableParams LTParams;
|
|
|
|
|
2010-12-14 19:46:57 +01:00
|
|
|
/// The set of function symbols for which a .thumb_func directive has
|
|
|
|
/// been seen.
|
|
|
|
//
|
|
|
|
// FIXME: We really would like this in target specific code rather than
|
|
|
|
// here. Maybe when the relocation stuff moves to target specific,
|
|
|
|
// this can go with it? The streamer would need some target specific
|
|
|
|
// refactoring too.
|
2016-01-30 02:24:31 +01:00
|
|
|
mutable SmallPtrSet<const MCSymbol *, 32> ThumbFuncs;
|
2010-12-14 19:46:57 +01:00
|
|
|
|
2012-12-20 20:05:53 +01:00
|
|
|
/// \brief The bundle alignment size currently set in the assembler.
|
|
|
|
///
|
|
|
|
/// By default it's 0, which means bundling is disabled.
|
|
|
|
unsigned BundleAlignSize;
|
|
|
|
|
2010-03-25 23:49:09 +01:00
|
|
|
unsigned RelaxAll : 1;
|
2009-08-26 23:22:22 +02:00
|
|
|
unsigned SubsectionsViaSymbols : 1;
|
2015-12-21 23:09:27 +01:00
|
|
|
unsigned IncrementalLinkerCompatible : 1;
|
2009-08-26 23:22:22 +02:00
|
|
|
|
2013-01-30 03:09:52 +01:00
|
|
|
/// ELF specific e_header flags
|
|
|
|
// It would be good if there were an MCELFAssembler class to hold this.
|
|
|
|
// ELF header flags are used both by the integrated and standalone assemblers.
|
|
|
|
// Access to the flags is necessary in cases where assembler directives affect
|
|
|
|
// which flags to be set.
|
|
|
|
unsigned ELFHeaderEFlags;
|
2014-03-18 23:09:05 +01:00
|
|
|
|
2014-03-29 08:34:53 +01:00
|
|
|
/// Used to communicate Linker Optimization Hint information between
|
|
|
|
/// the Streamer and the .o writer
|
|
|
|
MCLOHContainer LOHContainer;
|
|
|
|
|
2014-03-18 23:09:05 +01:00
|
|
|
VersionMinInfoType VersionMinInfo;
|
2015-05-15 21:13:20 +02:00
|
|
|
|
2009-08-21 20:29:01 +02:00
|
|
|
private:
|
2010-03-19 10:28:59 +01:00
|
|
|
/// Evaluate a fixup to a relocatable expression and the value which should be
|
|
|
|
/// placed into the fixup.
|
|
|
|
///
|
|
|
|
/// \param Layout The layout to use for evaluation.
|
|
|
|
/// \param Fixup The fixup to evaluate.
|
|
|
|
/// \param DF The fragment the fixup is inside.
|
|
|
|
/// \param Target [out] On return, the relocatable expression the fixup
|
|
|
|
/// evaluates to.
|
2011-04-15 07:18:47 +02:00
|
|
|
/// \param Value [out] On return, the value of the fixup as currently laid
|
2010-03-19 10:28:59 +01:00
|
|
|
/// out.
|
|
|
|
/// \return Whether the fixup value was fully resolved. This is true if the
|
2012-09-14 16:57:36 +02:00
|
|
|
/// \p Value result is fixed, otherwise the value may change due to
|
2010-03-19 10:28:59 +01:00
|
|
|
/// relocation.
|
2015-05-15 21:13:20 +02:00
|
|
|
bool evaluateFixup(const MCAsmLayout &Layout, const MCFixup &Fixup,
|
|
|
|
const MCFragment *DF, MCValue &Target,
|
|
|
|
uint64_t &Value) const;
|
2010-03-19 10:28:59 +01:00
|
|
|
|
2010-03-12 23:07:14 +01:00
|
|
|
/// Check whether a fixup can be satisfied, or whether it needs to be relaxed
|
|
|
|
/// (increased in size, in order to hold its value correctly).
|
2013-01-08 01:22:56 +01:00
|
|
|
bool fixupNeedsRelaxation(const MCFixup &Fixup, const MCRelaxableFragment *DF,
|
2010-03-22 21:35:35 +01:00
|
|
|
const MCAsmLayout &Layout) const;
|
2010-03-12 23:07:14 +01:00
|
|
|
|
2010-03-23 04:13:05 +01:00
|
|
|
/// Check whether the given fragment needs relaxation.
|
2013-01-08 01:22:56 +01:00
|
|
|
bool fragmentNeedsRelaxation(const MCRelaxableFragment *IF,
|
2010-03-23 04:13:05 +01:00
|
|
|
const MCAsmLayout &Layout) const;
|
|
|
|
|
2012-12-10 21:13:43 +01:00
|
|
|
/// \brief Perform one layout iteration and return true if any offsets
|
2010-03-12 23:07:14 +01:00
|
|
|
/// were adjusted.
|
2011-12-06 01:03:48 +01:00
|
|
|
bool layoutOnce(MCAsmLayout &Layout);
|
2010-03-12 23:07:14 +01:00
|
|
|
|
2012-12-10 21:13:43 +01:00
|
|
|
/// \brief Perform one layout iteration of the given section and return true
|
|
|
|
/// if any offsets were adjusted.
|
2015-05-26 04:17:21 +02:00
|
|
|
bool layoutSectionOnce(MCAsmLayout &Layout, MCSection &Sec);
|
2010-12-21 05:22:09 +01:00
|
|
|
|
2013-01-08 01:22:56 +01:00
|
|
|
bool relaxInstruction(MCAsmLayout &Layout, MCRelaxableFragment &IF);
|
2010-11-02 18:22:24 +01:00
|
|
|
|
2011-12-06 01:03:48 +01:00
|
|
|
bool relaxLEB(MCAsmLayout &Layout, MCLEBFragment &IF);
|
2010-11-02 18:22:24 +01:00
|
|
|
|
2011-12-06 01:03:48 +01:00
|
|
|
bool relaxDwarfLineAddr(MCAsmLayout &Layout, MCDwarfLineAddrFragment &DF);
|
|
|
|
bool relaxDwarfCallFrameFragment(MCAsmLayout &Layout,
|
2010-12-28 06:39:27 +01:00
|
|
|
MCDwarfCallFrameFragment &DF);
|
2016-02-02 18:41:18 +01:00
|
|
|
bool relaxCVInlineLineTable(MCAsmLayout &Layout,
|
|
|
|
MCCVInlineLineTableFragment &DF);
|
2010-11-07 03:07:12 +01:00
|
|
|
|
2011-12-06 01:03:48 +01:00
|
|
|
/// finishLayout - Finalize a layout, including fragment lowering.
|
|
|
|
void finishLayout(MCAsmLayout &Layout);
|
2010-03-23 00:16:48 +01:00
|
|
|
|
2014-03-29 07:26:49 +01:00
|
|
|
std::pair<uint64_t, bool> handleFixup(const MCAsmLayout &Layout,
|
|
|
|
MCFragment &F, const MCFixup &Fixup);
|
2010-12-06 20:08:48 +01:00
|
|
|
|
2010-03-12 22:00:49 +01:00
|
|
|
public:
|
2011-04-15 07:18:47 +02:00
|
|
|
/// Compute the effective fragment size assuming it is laid out at the given
|
2012-09-14 16:57:36 +02:00
|
|
|
/// \p SectionAddress and \p FragmentOffset.
|
2011-12-06 01:11:13 +01:00
|
|
|
uint64_t computeFragmentSize(const MCAsmLayout &Layout,
|
|
|
|
const MCFragment &F) const;
|
2010-12-15 09:45:53 +01:00
|
|
|
|
2010-03-19 04:18:15 +01:00
|
|
|
/// Find the symbol which defines the atom containing the given symbol, or
|
|
|
|
/// null if there is no such symbol.
|
2015-05-20 18:02:11 +02:00
|
|
|
const MCSymbol *getAtom(const MCSymbol &S) const;
|
2010-03-19 04:18:15 +01:00
|
|
|
|
2010-03-19 04:18:09 +01:00
|
|
|
/// Check whether a particular symbol is visible to the linker and is required
|
|
|
|
/// in the symbol table, or whether it can be discarded by the assembler. This
|
|
|
|
/// also effects whether the assembler treats the label as potentially
|
|
|
|
/// defining a separate atom.
|
2010-06-16 22:04:29 +02:00
|
|
|
bool isSymbolLinkerVisible(const MCSymbol &SD) const;
|
2010-03-19 04:18:09 +01:00
|
|
|
|
2010-03-19 10:28:59 +01:00
|
|
|
/// Emit the section contents using the given object writer.
|
2015-05-26 04:17:21 +02:00
|
|
|
void writeSectionData(const MCSection *Section,
|
2010-12-17 03:45:59 +01:00
|
|
|
const MCAsmLayout &Layout) const;
|
2010-03-12 22:00:49 +01:00
|
|
|
|
2010-12-14 19:46:57 +01:00
|
|
|
/// Check whether a given symbol has been flagged with .thumb_func.
|
2014-04-29 14:46:50 +02:00
|
|
|
bool isThumbFunc(const MCSymbol *Func) const;
|
2010-12-14 19:46:57 +01:00
|
|
|
|
|
|
|
/// Flag a function symbol as the target of a .thumb_func directive.
|
|
|
|
void setIsThumbFunc(const MCSymbol *Func) { ThumbFuncs.insert(Func); }
|
|
|
|
|
2013-01-30 03:09:52 +01:00
|
|
|
/// ELF e_header flags
|
2015-05-15 21:13:20 +02:00
|
|
|
unsigned getELFHeaderEFlags() const { return ELFHeaderEFlags; }
|
|
|
|
void setELFHeaderEFlags(unsigned Flags) { ELFHeaderEFlags = Flags; }
|
2013-01-30 03:09:52 +01:00
|
|
|
|
2014-03-18 23:09:05 +01:00
|
|
|
/// MachO deployment target version information.
|
|
|
|
const VersionMinInfoType &getVersionMinInfo() const { return VersionMinInfo; }
|
|
|
|
void setVersionMinInfo(MCVersionMinType Kind, unsigned Major, unsigned Minor,
|
|
|
|
unsigned Update) {
|
|
|
|
VersionMinInfo.Kind = Kind;
|
|
|
|
VersionMinInfo.Major = Major;
|
|
|
|
VersionMinInfo.Minor = Minor;
|
|
|
|
VersionMinInfo.Update = Update;
|
|
|
|
}
|
|
|
|
|
llvm-mc: Start MCAssembler and MCMachOStreamer.
- Together these form the (Mach-O) back end of the assembler.
- MCAssembler is the actual assembler backend, which is designed to have a
reasonable API. This will eventually grow to support multiple object file
implementations, but for now its Mach-O/i386 only.
- MCMachOStreamer adapts the MCStreamer "actions" API to the MCAssembler API,
e.g. converting the various directives into fragments, managing state like
the current section, and so on.
- llvm-mc will use the new backend via '-filetype=obj', which may eventually
be, but is not yet, since I hear that people like assemblers which actually
assemble.
- The only thing that works at the moment is changing sections. For the time
being I have a Python Mach-O dumping tool in test/scripts so this stuff can
be easily tested, eventually I expect to replace this with a real LLVM tool.
- More doxyments to come.
I assume that since this stuff doesn't touch any of the things which are part of
2.6 that it is ok to put this in not so long before the freeze, but if someone
objects let me know, I can pull it.
llvm-svn: 79612
2009-08-21 11:11:24 +02:00
|
|
|
public:
|
|
|
|
/// Construct a new assembler instance.
|
|
|
|
//
|
|
|
|
// FIXME: How are we going to parameterize this? Two obvious options are stay
|
|
|
|
// concrete and require clients to pass in a target like object. The other
|
|
|
|
// option is to make this abstract, and have targets provide concrete
|
|
|
|
// implementations as we do with AsmParser.
|
2011-07-26 01:24:55 +02:00
|
|
|
MCAssembler(MCContext &Context_, MCAsmBackend &Backend_,
|
2015-09-02 01:19:38 +02:00
|
|
|
MCCodeEmitter &Emitter_, MCObjectWriter &Writer_);
|
llvm-mc: Start MCAssembler and MCMachOStreamer.
- Together these form the (Mach-O) back end of the assembler.
- MCAssembler is the actual assembler backend, which is designed to have a
reasonable API. This will eventually grow to support multiple object file
implementations, but for now its Mach-O/i386 only.
- MCMachOStreamer adapts the MCStreamer "actions" API to the MCAssembler API,
e.g. converting the various directives into fragments, managing state like
the current section, and so on.
- llvm-mc will use the new backend via '-filetype=obj', which may eventually
be, but is not yet, since I hear that people like assemblers which actually
assemble.
- The only thing that works at the moment is changing sections. For the time
being I have a Python Mach-O dumping tool in test/scripts so this stuff can
be easily tested, eventually I expect to replace this with a real LLVM tool.
- More doxyments to come.
I assume that since this stuff doesn't touch any of the things which are part of
2.6 that it is ok to put this in not so long before the freeze, but if someone
objects let me know, I can pull it.
llvm-svn: 79612
2009-08-21 11:11:24 +02:00
|
|
|
~MCAssembler();
|
|
|
|
|
2012-12-12 23:59:46 +01:00
|
|
|
/// Reuse an assembler instance
|
|
|
|
///
|
|
|
|
void reset();
|
|
|
|
|
2009-08-31 10:07:55 +02:00
|
|
|
MCContext &getContext() const { return Context; }
|
|
|
|
|
2011-07-26 01:24:55 +02:00
|
|
|
MCAsmBackend &getBackend() const { return Backend; }
|
2010-03-11 03:28:59 +01:00
|
|
|
|
2010-03-19 11:43:18 +01:00
|
|
|
MCCodeEmitter &getEmitter() const { return Emitter; }
|
|
|
|
|
2010-12-17 03:45:41 +01:00
|
|
|
MCObjectWriter &getWriter() const { return Writer; }
|
|
|
|
|
2015-08-07 17:14:08 +02:00
|
|
|
MCDwarfLineTableParams getDWARFLinetableParams() const { return LTParams; }
|
|
|
|
void setDWARFLinetableParams(MCDwarfLineTableParams P) { LTParams = P; }
|
|
|
|
|
llvm-mc: Start MCAssembler and MCMachOStreamer.
- Together these form the (Mach-O) back end of the assembler.
- MCAssembler is the actual assembler backend, which is designed to have a
reasonable API. This will eventually grow to support multiple object file
implementations, but for now its Mach-O/i386 only.
- MCMachOStreamer adapts the MCStreamer "actions" API to the MCAssembler API,
e.g. converting the various directives into fragments, managing state like
the current section, and so on.
- llvm-mc will use the new backend via '-filetype=obj', which may eventually
be, but is not yet, since I hear that people like assemblers which actually
assemble.
- The only thing that works at the moment is changing sections. For the time
being I have a Python Mach-O dumping tool in test/scripts so this stuff can
be easily tested, eventually I expect to replace this with a real LLVM tool.
- More doxyments to come.
I assume that since this stuff doesn't touch any of the things which are part of
2.6 that it is ok to put this in not so long before the freeze, but if someone
objects let me know, I can pull it.
llvm-svn: 79612
2009-08-21 11:11:24 +02:00
|
|
|
/// Finish - Do final processing and write the object to the output stream.
|
2012-09-14 16:57:36 +02:00
|
|
|
/// \p Writer is used for custom object writer (as the MCJIT does),
|
2010-07-22 07:58:53 +02:00
|
|
|
/// if not specified it is automatically created from backend.
|
2010-12-17 03:45:41 +01:00
|
|
|
void Finish();
|
llvm-mc: Start MCAssembler and MCMachOStreamer.
- Together these form the (Mach-O) back end of the assembler.
- MCAssembler is the actual assembler backend, which is designed to have a
reasonable API. This will eventually grow to support multiple object file
implementations, but for now its Mach-O/i386 only.
- MCMachOStreamer adapts the MCStreamer "actions" API to the MCAssembler API,
e.g. converting the various directives into fragments, managing state like
the current section, and so on.
- llvm-mc will use the new backend via '-filetype=obj', which may eventually
be, but is not yet, since I hear that people like assemblers which actually
assemble.
- The only thing that works at the moment is changing sections. For the time
being I have a Python Mach-O dumping tool in test/scripts so this stuff can
be easily tested, eventually I expect to replace this with a real LLVM tool.
- More doxyments to come.
I assume that since this stuff doesn't touch any of the things which are part of
2.6 that it is ok to put this in not so long before the freeze, but if someone
objects let me know, I can pull it.
llvm-svn: 79612
2009-08-21 11:11:24 +02:00
|
|
|
|
2015-08-26 07:09:49 +02:00
|
|
|
// Layout all section and prepare them for emission.
|
|
|
|
void layout(MCAsmLayout &Layout);
|
|
|
|
|
2009-08-26 23:22:22 +02:00
|
|
|
// FIXME: This does not belong here.
|
2015-05-15 21:13:20 +02:00
|
|
|
bool getSubsectionsViaSymbols() const { return SubsectionsViaSymbols; }
|
|
|
|
void setSubsectionsViaSymbols(bool Value) { SubsectionsViaSymbols = Value; }
|
2009-08-26 23:22:22 +02:00
|
|
|
|
2015-12-21 23:09:27 +01:00
|
|
|
bool isIncrementalLinkerCompatible() const {
|
|
|
|
return IncrementalLinkerCompatible;
|
|
|
|
}
|
|
|
|
void setIncrementalLinkerCompatible(bool Value) {
|
|
|
|
IncrementalLinkerCompatible = Value;
|
|
|
|
}
|
|
|
|
|
2010-03-25 23:49:09 +01:00
|
|
|
bool getRelaxAll() const { return RelaxAll; }
|
|
|
|
void setRelaxAll(bool Value) { RelaxAll = Value; }
|
|
|
|
|
2015-05-15 21:13:20 +02:00
|
|
|
bool isBundlingEnabled() const { return BundleAlignSize != 0; }
|
2012-12-20 20:05:53 +01:00
|
|
|
|
2015-05-15 21:13:20 +02:00
|
|
|
unsigned getBundleAlignSize() const { return BundleAlignSize; }
|
2012-12-20 20:05:53 +01:00
|
|
|
|
|
|
|
void setBundleAlignSize(unsigned Size) {
|
2015-05-15 21:13:20 +02:00
|
|
|
assert((Size == 0 || !(Size & (Size - 1))) &&
|
2012-12-20 20:05:53 +01:00
|
|
|
"Expect a power-of-two bundle align size");
|
|
|
|
BundleAlignSize = Size;
|
|
|
|
}
|
|
|
|
|
2015-05-02 02:44:14 +02:00
|
|
|
/// \name Section List Access
|
llvm-mc: Start MCAssembler and MCMachOStreamer.
- Together these form the (Mach-O) back end of the assembler.
- MCAssembler is the actual assembler backend, which is designed to have a
reasonable API. This will eventually grow to support multiple object file
implementations, but for now its Mach-O/i386 only.
- MCMachOStreamer adapts the MCStreamer "actions" API to the MCAssembler API,
e.g. converting the various directives into fragments, managing state like
the current section, and so on.
- llvm-mc will use the new backend via '-filetype=obj', which may eventually
be, but is not yet, since I hear that people like assemblers which actually
assemble.
- The only thing that works at the moment is changing sections. For the time
being I have a Python Mach-O dumping tool in test/scripts so this stuff can
be easily tested, eventually I expect to replace this with a real LLVM tool.
- More doxyments to come.
I assume that since this stuff doesn't touch any of the things which are part of
2.6 that it is ok to put this in not so long before the freeze, but if someone
objects let me know, I can pull it.
llvm-svn: 79612
2009-08-21 11:11:24 +02:00
|
|
|
/// @{
|
|
|
|
|
|
|
|
iterator begin() { return Sections.begin(); }
|
|
|
|
const_iterator begin() const { return Sections.begin(); }
|
|
|
|
|
|
|
|
iterator end() { return Sections.end(); }
|
|
|
|
const_iterator end() const { return Sections.end(); }
|
|
|
|
|
|
|
|
size_t size() const { return Sections.size(); }
|
|
|
|
|
2009-08-22 12:13:24 +02:00
|
|
|
/// @}
|
2015-05-02 02:44:14 +02:00
|
|
|
/// \name Symbol List Access
|
2009-08-22 12:13:24 +02:00
|
|
|
/// @{
|
|
|
|
symbol_iterator symbol_begin() { return Symbols.begin(); }
|
|
|
|
const_symbol_iterator symbol_begin() const { return Symbols.begin(); }
|
|
|
|
|
|
|
|
symbol_iterator symbol_end() { return Symbols.end(); }
|
|
|
|
const_symbol_iterator symbol_end() const { return Symbols.end(); }
|
|
|
|
|
2014-04-18 20:24:25 +02:00
|
|
|
symbol_range symbols() { return make_range(symbol_begin(), symbol_end()); }
|
2015-05-15 21:13:20 +02:00
|
|
|
const_symbol_range symbols() const {
|
|
|
|
return make_range(symbol_begin(), symbol_end());
|
|
|
|
}
|
2014-04-18 20:24:25 +02:00
|
|
|
|
2009-08-22 12:13:24 +02:00
|
|
|
size_t symbol_size() const { return Symbols.size(); }
|
|
|
|
|
2009-08-24 13:56:58 +02:00
|
|
|
/// @}
|
2015-05-02 02:44:14 +02:00
|
|
|
/// \name Indirect Symbol List Access
|
2009-08-24 13:56:58 +02:00
|
|
|
/// @{
|
|
|
|
|
|
|
|
// FIXME: This is a total hack, this should not be here. Once things are
|
|
|
|
// factored so that the streamer has direct access to the .o writer, it can
|
|
|
|
// disappear.
|
|
|
|
std::vector<IndirectSymbolData> &getIndirectSymbols() {
|
|
|
|
return IndirectSymbols;
|
|
|
|
}
|
|
|
|
|
|
|
|
indirect_symbol_iterator indirect_symbol_begin() {
|
|
|
|
return IndirectSymbols.begin();
|
|
|
|
}
|
2010-03-19 08:09:33 +01:00
|
|
|
const_indirect_symbol_iterator indirect_symbol_begin() const {
|
|
|
|
return IndirectSymbols.begin();
|
|
|
|
}
|
2009-08-24 13:56:58 +02:00
|
|
|
|
|
|
|
indirect_symbol_iterator indirect_symbol_end() {
|
|
|
|
return IndirectSymbols.end();
|
|
|
|
}
|
2010-03-19 08:09:33 +01:00
|
|
|
const_indirect_symbol_iterator indirect_symbol_end() const {
|
|
|
|
return IndirectSymbols.end();
|
|
|
|
}
|
2009-08-24 13:56:58 +02:00
|
|
|
|
|
|
|
size_t indirect_symbol_size() const { return IndirectSymbols.size(); }
|
|
|
|
|
2013-01-18 02:26:07 +01:00
|
|
|
/// @}
|
2015-05-02 02:44:14 +02:00
|
|
|
/// \name Linker Option List Access
|
2013-01-18 02:26:07 +01:00
|
|
|
/// @{
|
|
|
|
|
2015-05-15 21:13:20 +02:00
|
|
|
std::vector<std::vector<std::string>> &getLinkerOptions() {
|
2013-01-18 02:26:07 +01:00
|
|
|
return LinkerOptions;
|
|
|
|
}
|
|
|
|
|
2012-05-18 21:12:01 +02:00
|
|
|
/// @}
|
2015-05-02 02:44:14 +02:00
|
|
|
/// \name Data Region List Access
|
2012-05-18 21:12:01 +02:00
|
|
|
/// @{
|
|
|
|
|
|
|
|
// FIXME: This is a total hack, this should not be here. Once things are
|
|
|
|
// factored so that the streamer has direct access to the .o writer, it can
|
|
|
|
// disappear.
|
2015-05-15 21:13:20 +02:00
|
|
|
std::vector<DataRegionData> &getDataRegions() { return DataRegions; }
|
2012-05-18 21:12:01 +02:00
|
|
|
|
2015-05-15 21:13:20 +02:00
|
|
|
data_region_iterator data_region_begin() { return DataRegions.begin(); }
|
2012-05-18 21:12:01 +02:00
|
|
|
const_data_region_iterator data_region_begin() const {
|
|
|
|
return DataRegions.begin();
|
|
|
|
}
|
|
|
|
|
2015-05-15 21:13:20 +02:00
|
|
|
data_region_iterator data_region_end() { return DataRegions.end(); }
|
2012-05-18 21:12:01 +02:00
|
|
|
const_data_region_iterator data_region_end() const {
|
|
|
|
return DataRegions.end();
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t data_region_size() const { return DataRegions.size(); }
|
|
|
|
|
2014-03-29 08:34:53 +01:00
|
|
|
/// @}
|
2015-05-02 02:44:14 +02:00
|
|
|
/// \name Data Region List Access
|
2014-03-29 08:34:53 +01:00
|
|
|
/// @{
|
|
|
|
|
|
|
|
// FIXME: This is a total hack, this should not be here. Once things are
|
|
|
|
// factored so that the streamer has direct access to the .o writer, it can
|
|
|
|
// disappear.
|
2015-05-15 21:13:20 +02:00
|
|
|
MCLOHContainer &getLOHContainer() { return LOHContainer; }
|
|
|
|
const MCLOHContainer &getLOHContainer() const {
|
2014-03-29 08:34:53 +01:00
|
|
|
return const_cast<MCAssembler *>(this)->getLOHContainer();
|
|
|
|
}
|
2010-03-10 21:58:29 +01:00
|
|
|
/// @}
|
2015-05-02 02:44:14 +02:00
|
|
|
/// \name Backend Data Access
|
2010-03-10 21:58:29 +01:00
|
|
|
/// @{
|
|
|
|
|
2015-10-03 20:28:40 +02:00
|
|
|
bool registerSection(MCSection &Section);
|
2010-03-10 21:58:29 +01:00
|
|
|
|
2015-06-01 16:34:40 +02:00
|
|
|
void registerSymbol(const MCSymbol &Symbol, bool *Created = nullptr);
|
2010-03-10 21:58:29 +01:00
|
|
|
|
2015-05-28 20:03:20 +02:00
|
|
|
ArrayRef<std::string> getFileNames() { return FileNames; }
|
2013-10-29 02:06:17 +01:00
|
|
|
|
|
|
|
void addFileName(StringRef FileName) {
|
2015-05-28 20:03:20 +02:00
|
|
|
if (std::find(FileNames.begin(), FileNames.end(), FileName) ==
|
|
|
|
FileNames.end())
|
2013-10-29 02:06:17 +01:00
|
|
|
FileNames.push_back(FileName);
|
|
|
|
}
|
|
|
|
|
2015-04-13 01:42:25 +02:00
|
|
|
/// \brief Write the necessary bundle padding to the given object writer.
|
|
|
|
/// Expects a fragment \p F containing instructions and its size \p FSize.
|
|
|
|
void writeFragmentPadding(const MCFragment &F, uint64_t FSize,
|
|
|
|
MCObjectWriter *OW) const;
|
|
|
|
|
llvm-mc: Start MCAssembler and MCMachOStreamer.
- Together these form the (Mach-O) back end of the assembler.
- MCAssembler is the actual assembler backend, which is designed to have a
reasonable API. This will eventually grow to support multiple object file
implementations, but for now its Mach-O/i386 only.
- MCMachOStreamer adapts the MCStreamer "actions" API to the MCAssembler API,
e.g. converting the various directives into fragments, managing state like
the current section, and so on.
- llvm-mc will use the new backend via '-filetype=obj', which may eventually
be, but is not yet, since I hear that people like assemblers which actually
assemble.
- The only thing that works at the moment is changing sections. For the time
being I have a Python Mach-O dumping tool in test/scripts so this stuff can
be easily tested, eventually I expect to replace this with a real LLVM tool.
- More doxyments to come.
I assume that since this stuff doesn't touch any of the things which are part of
2.6 that it is ok to put this in not so long before the freeze, but if someone
objects let me know, I can pull it.
llvm-svn: 79612
2009-08-21 11:11:24 +02:00
|
|
|
/// @}
|
2010-02-13 10:28:03 +01:00
|
|
|
|
|
|
|
void dump();
|
llvm-mc: Start MCAssembler and MCMachOStreamer.
- Together these form the (Mach-O) back end of the assembler.
- MCAssembler is the actual assembler backend, which is designed to have a
reasonable API. This will eventually grow to support multiple object file
implementations, but for now its Mach-O/i386 only.
- MCMachOStreamer adapts the MCStreamer "actions" API to the MCAssembler API,
e.g. converting the various directives into fragments, managing state like
the current section, and so on.
- llvm-mc will use the new backend via '-filetype=obj', which may eventually
be, but is not yet, since I hear that people like assemblers which actually
assemble.
- The only thing that works at the moment is changing sections. For the time
being I have a Python Mach-O dumping tool in test/scripts so this stuff can
be easily tested, eventually I expect to replace this with a real LLVM tool.
- More doxyments to come.
I assume that since this stuff doesn't touch any of the things which are part of
2.6 that it is ok to put this in not so long before the freeze, but if someone
objects let me know, I can pull it.
llvm-svn: 79612
2009-08-21 11:11:24 +02:00
|
|
|
};
|
|
|
|
|
2015-04-13 01:42:25 +02:00
|
|
|
/// \brief Compute the amount of padding required before the fragment \p F to
|
|
|
|
/// obey bundling restrictions, where \p FOffset is the fragment's offset in
|
|
|
|
/// its section and \p FSize is the fragment's size.
|
2015-05-15 21:13:20 +02:00
|
|
|
uint64_t computeBundlePadding(const MCAssembler &Assembler, const MCFragment *F,
|
2015-04-13 01:42:25 +02:00
|
|
|
uint64_t FOffset, uint64_t FSize);
|
|
|
|
|
llvm-mc: Start MCAssembler and MCMachOStreamer.
- Together these form the (Mach-O) back end of the assembler.
- MCAssembler is the actual assembler backend, which is designed to have a
reasonable API. This will eventually grow to support multiple object file
implementations, but for now its Mach-O/i386 only.
- MCMachOStreamer adapts the MCStreamer "actions" API to the MCAssembler API,
e.g. converting the various directives into fragments, managing state like
the current section, and so on.
- llvm-mc will use the new backend via '-filetype=obj', which may eventually
be, but is not yet, since I hear that people like assemblers which actually
assemble.
- The only thing that works at the moment is changing sections. For the time
being I have a Python Mach-O dumping tool in test/scripts so this stuff can
be easily tested, eventually I expect to replace this with a real LLVM tool.
- More doxyments to come.
I assume that since this stuff doesn't touch any of the things which are part of
2.6 that it is ok to put this in not so long before the freeze, but if someone
objects let me know, I can pull it.
llvm-svn: 79612
2009-08-21 11:11:24 +02:00
|
|
|
} // end namespace llvm
|
|
|
|
|
|
|
|
#endif
|