Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion llvm/include/llvm/MC/MCAsmBackend.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/MC/MCDirectives.h"
#include "llvm/MC/MCFixup.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Endian.h"
#include <cstdint>

Expand Down Expand Up @@ -39,7 +40,7 @@ class StringRef;
class raw_ostream;

/// Generic interface to target specific assembler backends.
class MCAsmBackend {
class LLVM_ABI MCAsmBackend {
protected: // Can only create subclasses.
MCAsmBackend(llvm::endianness Endian) : Endian(Endian) {}

Expand Down
7 changes: 6 additions & 1 deletion llvm/include/llvm/MC/MCAsmInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/MC/MCDirectives.h"
#include "llvm/MC/MCTargetOptions.h"
#include "llvm/Support/Compiler.h"
#include <vector>

namespace llvm {
Expand Down Expand Up @@ -55,7 +56,7 @@ enum LCOMMType { NoAlignment, ByteAlignment, Log2Alignment };

/// This class is intended to be used as a base class for asm
/// properties and features specific to the target.
class MCAsmInfo {
class LLVM_ABI MCAsmInfo {
public:
/// Assembly character literal syntax types.
enum AsmCharLiteralSyntax {
Expand Down Expand Up @@ -427,6 +428,10 @@ class MCAsmInfo {
explicit MCAsmInfo();
virtual ~MCAsmInfo();

// Explicitly non-copyable.
MCAsmInfo(MCAsmInfo const &) = delete;
MCAsmInfo &operator=(MCAsmInfo const &) = delete;

/// Get the code pointer size in bytes.
unsigned getCodePointerSize() const { return CodePointerSize; }

Expand Down
9 changes: 5 additions & 4 deletions llvm/include/llvm/MC/MCAsmMacro.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include "llvm/ADT/APInt.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/SMLoc.h"
#include <vector>
Expand Down Expand Up @@ -74,9 +75,9 @@ class AsmToken {
bool is(TokenKind K) const { return Kind == K; }
bool isNot(TokenKind K) const { return Kind != K; }

SMLoc getLoc() const;
SMLoc getEndLoc() const;
SMRange getLocRange() const;
LLVM_ABI SMLoc getLoc() const;
LLVM_ABI SMLoc getEndLoc() const;
LLVM_ABI SMRange getLocRange() const;

/// Get the contents of a string token (without quotes).
StringRef getStringContents() const {
Expand Down Expand Up @@ -115,7 +116,7 @@ class AsmToken {
return IntVal;
}

void dump(raw_ostream &OS) const;
LLVM_ABI void dump(raw_ostream &OS) const;
};

struct MCAsmMacroParameter {
Expand Down
50 changes: 27 additions & 23 deletions llvm/include/llvm/MC/MCAssembler.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "llvm/ADT/iterator_range.h"
#include "llvm/MC/MCDwarf.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/SMLoc.h"
#include <algorithm>
#include <cassert>
Expand Down Expand Up @@ -135,46 +136,48 @@ class MCAssembler {
// 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.
MCAssembler(MCContext &Context, std::unique_ptr<MCAsmBackend> Backend,
std::unique_ptr<MCCodeEmitter> Emitter,
std::unique_ptr<MCObjectWriter> Writer);
LLVM_ABI MCAssembler(MCContext &Context,
std::unique_ptr<MCAsmBackend> Backend,
std::unique_ptr<MCCodeEmitter> Emitter,
std::unique_ptr<MCObjectWriter> Writer);
MCAssembler(const MCAssembler &) = delete;
MCAssembler &operator=(const MCAssembler &) = delete;

/// Compute the effective fragment size.
uint64_t computeFragmentSize(const MCFragment &F) const;
LLVM_ABI uint64_t computeFragmentSize(const MCFragment &F) const;

void layoutBundle(MCFragment *Prev, MCFragment *F) const;
LLVM_ABI void layoutBundle(MCFragment *Prev, MCFragment *F) const;

// Get the offset of the given fragment inside its containing section.
uint64_t getFragmentOffset(const MCFragment &F) const { return F.Offset; }

uint64_t getSectionAddressSize(const MCSection &Sec) const;
uint64_t getSectionFileSize(const MCSection &Sec) const;
LLVM_ABI uint64_t getSectionAddressSize(const MCSection &Sec) const;
LLVM_ABI uint64_t getSectionFileSize(const MCSection &Sec) const;

// Get the offset of the given symbol, as computed in the current
// layout.
// \return True on success.
bool getSymbolOffset(const MCSymbol &S, uint64_t &Val) const;
LLVM_ABI bool getSymbolOffset(const MCSymbol &S, uint64_t &Val) const;

// Variant that reports a fatal error if the offset is not computable.
uint64_t getSymbolOffset(const MCSymbol &S) const;
LLVM_ABI uint64_t getSymbolOffset(const MCSymbol &S) const;

// If this symbol is equivalent to A + Constant, return A.
const MCSymbol *getBaseSymbol(const MCSymbol &Symbol) const;
LLVM_ABI const MCSymbol *getBaseSymbol(const MCSymbol &Symbol) const;

/// Emit the section contents to \p OS.
void writeSectionData(raw_ostream &OS, const MCSection *Section) const;
LLVM_ABI void writeSectionData(raw_ostream &OS,
const MCSection *Section) const;

/// Check whether a given symbol has been flagged with .thumb_func.
bool isThumbFunc(const MCSymbol *Func) const;
LLVM_ABI bool isThumbFunc(const MCSymbol *Func) const;

/// Flag a function symbol as the target of a .thumb_func directive.
void setIsThumbFunc(const MCSymbol *Func) { ThumbFuncs.insert(Func); }

/// Reuse an assembler instance
///
void reset();
LLVM_ABI void reset();

MCContext &getContext() const { return Context; }

Expand All @@ -193,10 +196,10 @@ class MCAssembler {
/// Finish - Do final processing and write the object to the output stream.
/// \p Writer is used for custom object writer (as the MCJIT does),
/// if not specified it is automatically created from backend.
void Finish();
LLVM_ABI void Finish();

// Layout all section and prepare them for emission.
void layout();
LLVM_ABI void layout();

bool hasLayout() const { return HasLayout; }
bool hasFinalLayout() const { return HasFinalLayout; }
Expand All @@ -223,21 +226,22 @@ class MCAssembler {
return make_pointee_range(Symbols);
}

bool registerSection(MCSection &Section);
bool registerSymbol(const MCSymbol &Symbol);
LLVM_ABI bool registerSection(MCSection &Section);
LLVM_ABI bool registerSymbol(const MCSymbol &Symbol);

/// Write the necessary bundle padding to \p OS.
/// Expects a fragment \p F containing instructions and its size \p FSize.
void writeFragmentPadding(raw_ostream &OS, const MCEncodedFragment &F,
uint64_t FSize) const;
LLVM_ABI void writeFragmentPadding(raw_ostream &OS,
const MCEncodedFragment &F,
uint64_t FSize) const;

void reportError(SMLoc L, const Twine &Msg) const;
LLVM_ABI void reportError(SMLoc L, const Twine &Msg) const;
// Record pending errors during layout iteration, as they may go away once the
// layout is finalized.
void recordError(SMLoc L, const Twine &Msg) const;
void flushPendingErrors() const;
LLVM_ABI void recordError(SMLoc L, const Twine &Msg) const;
LLVM_ABI void flushPendingErrors() const;

void dump() const;
LLVM_ABI void dump() const;
};

} // end namespace llvm
Expand Down
4 changes: 3 additions & 1 deletion llvm/include/llvm/MC/MCCodeEmitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#ifndef LLVM_MC_MCCODEEMITTER_H
#define LLVM_MC_MCCODEEMITTER_H

#include "llvm/Support/Compiler.h"

namespace llvm {

class MCFixup;
Expand All @@ -18,7 +20,7 @@ class raw_ostream;
template<typename T> class SmallVectorImpl;

/// MCCodeEmitter - Generic instruction encoding interface.
class MCCodeEmitter {
class LLVM_ABI MCCodeEmitter {
protected: // Can only create subclasses.
MCCodeEmitter();

Expand Down
Loading