Skip to content

Commit fa6707f

Browse files
committed
[llvm] IDS auto codemod for ExecutionEngine library
1 parent 764ae04 commit fa6707f

File tree

94 files changed

+619
-527
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+619
-527
lines changed

llvm/include/llvm/ExecutionEngine/ExecutionEngine.h

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#ifndef LLVM_EXECUTIONENGINE_EXECUTIONENGINE_H
1515
#define LLVM_EXECUTIONENGINE_EXECUTIONENGINE_H
1616

17+
#include "llvm/Support/Compiler.h"
1718
#include "llvm-c/ExecutionEngine.h"
1819
#include "llvm/ADT/ArrayRef.h"
1920
#include "llvm/ADT/SmallVector.h"
@@ -88,15 +89,15 @@ class ExecutionEngineState {
8889
/// Erase an entry from the mapping table.
8990
///
9091
/// \returns The address that \p ToUnmap was mapped to.
91-
uint64_t RemoveMapping(StringRef Name);
92+
LLVM_ABI uint64_t RemoveMapping(StringRef Name);
9293
};
9394

9495
using FunctionCreator = std::function<void *(const std::string &)>;
9596

9697
/// Abstract interface for implementation execution of LLVM modules,
9798
/// designed to support both interpreter and just-in-time (JIT) compiler
9899
/// implementations.
99-
class ExecutionEngine {
100+
class LLVM_ABI ExecutionEngine {
100101
/// The state object holding the global address mapping, which must be
101102
/// accessed synchronously.
102103
//
@@ -550,13 +551,13 @@ class EngineBuilder {
550551

551552
public:
552553
/// Default constructor for EngineBuilder.
553-
EngineBuilder();
554+
LLVM_ABI EngineBuilder();
554555

555556
/// Constructor for EngineBuilder.
556-
EngineBuilder(std::unique_ptr<Module> M);
557+
LLVM_ABI EngineBuilder(std::unique_ptr<Module> M);
557558

558559
// Out-of-line since we don't have the def'n of RTDyldMemoryManager here.
559-
~EngineBuilder();
560+
LLVM_ABI ~EngineBuilder();
560561

561562
/// setEngineKind - Controls whether the user wants the interpreter, the JIT,
562563
/// or whichever engine works. This option defaults to EngineKind::Either.
@@ -571,12 +572,12 @@ class EngineBuilder {
571572
/// to create anything other than MCJIT will cause a runtime error. If create()
572573
/// is called and is successful, the created engine takes ownership of the
573574
/// memory manager. This option defaults to NULL.
574-
EngineBuilder &setMCJITMemoryManager(std::unique_ptr<RTDyldMemoryManager> mcjmm);
575+
LLVM_ABI EngineBuilder &setMCJITMemoryManager(std::unique_ptr<RTDyldMemoryManager> mcjmm);
575576

576-
EngineBuilder&
577+
LLVM_ABI EngineBuilder&
577578
setMemoryManager(std::unique_ptr<MCJITMemoryManager> MM);
578579

579-
EngineBuilder &setSymbolResolver(std::unique_ptr<LegacyJITSymbolResolver> SR);
580+
LLVM_ABI EngineBuilder &setSymbolResolver(std::unique_ptr<LegacyJITSymbolResolver> SR);
580581

581582
/// setErrorStr - Set the error string to write to on error. This option
582583
/// defaults to NULL.
@@ -645,11 +646,11 @@ class EngineBuilder {
645646
this->EmulatedTLS = EmulatedTLS;
646647
}
647648

648-
TargetMachine *selectTarget();
649+
LLVM_ABI TargetMachine *selectTarget();
649650

650651
/// selectTarget - Pick a target either via -march or by guessing the native
651652
/// arch. Add any CPU features specified via -mcpu or -mattr.
652-
TargetMachine *selectTarget(const Triple &TargetTriple,
653+
LLVM_ABI TargetMachine *selectTarget(const Triple &TargetTriple,
653654
StringRef MArch,
654655
StringRef MCPU,
655656
const SmallVectorImpl<std::string>& MAttrs);
@@ -658,7 +659,7 @@ class EngineBuilder {
658659
return create(selectTarget());
659660
}
660661

661-
ExecutionEngine *create(TargetMachine *TM);
662+
LLVM_ABI ExecutionEngine *create(TargetMachine *TM);
662663
};
663664

664665
// Create wrappers for C Binding types (see CBindingWrapping.h).

llvm/include/llvm/ExecutionEngine/JITEventListener.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#ifndef LLVM_EXECUTIONENGINE_JITEVENTLISTENER_H
1515
#define LLVM_EXECUTIONENGINE_JITEVENTLISTENER_H
1616

17+
#include "llvm/Support/Compiler.h"
1718
#include "llvm-c/ExecutionEngine.h"
1819
#include "llvm/Config/llvm-config.h"
1920
#include "llvm/ExecutionEngine/RuntimeDyld.h"
@@ -37,7 +38,7 @@ class ObjectFile;
3738
/// profilers and debuggers that need to know where functions have been emitted.
3839
///
3940
/// The default implementation of each method does nothing.
40-
class JITEventListener {
41+
class LLVM_ABI JITEventListener {
4142
public:
4243
using ObjectKey = uint64_t;
4344

llvm/include/llvm/ExecutionEngine/JITLink/EHFrameSupport.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#ifndef LLVM_EXECUTIONENGINE_JITLINK_EHFRAMESUPPORT_H
1414
#define LLVM_EXECUTIONENGINE_JITLINK_EHFRAMESUPPORT_H
1515

16+
#include "llvm/Support/Compiler.h"
1617
#include "llvm/ExecutionEngine/JITLink/JITLink.h"
1718
#include "llvm/ExecutionEngine/JITSymbol.h"
1819
#include "llvm/Support/Error.h"
@@ -36,7 +37,7 @@ class EHFrameCFIBlockInspector {
3637
/// second to PC-begin, third (if present) to LSDA.
3738
///
3839
/// It is illegal to call this function on a block with four or more edges.
39-
static EHFrameCFIBlockInspector FromEdgeScan(Block &B);
40+
LLVM_ABI static EHFrameCFIBlockInspector FromEdgeScan(Block &B);
4041

4142
/// Returns true if this frame is an FDE, false for a CIE.
4243
bool isFDE() const { return CIEEdge != nullptr; }
@@ -85,7 +86,7 @@ class EHFrameCFIBlockInspector {
8586

8687
/// Returns a pointer to the DWARF eh-frame section if the graph contains a
8788
/// non-empty one, otherwise returns null.
88-
Section *getEHFrameSection(LinkGraph &G);
89+
LLVM_ABI Section *getEHFrameSection(LinkGraph &G);
8990

9091
} // end namespace jitlink
9192
} // end namespace llvm

llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#ifndef LLVM_EXECUTIONENGINE_JITLINK_JITLINK_H
1414
#define LLVM_EXECUTIONENGINE_JITLINK_JITLINK_H
1515

16+
#include "llvm/Support/Compiler.h"
1617
#include "llvm/ADT/DenseMap.h"
1718
#include "llvm/ADT/DenseSet.h"
1819
#include "llvm/ADT/FunctionExtras.h"
@@ -49,7 +50,7 @@ class Section;
4950

5051
/// Base class for errors originating in JIT linker, e.g. missing relocation
5152
/// support.
52-
class JITLinkError : public ErrorInfo<JITLinkError> {
53+
class LLVM_ABI JITLinkError : public ErrorInfo<JITLinkError> {
5354
public:
5455
static char ID;
5556

@@ -105,7 +106,7 @@ class Edge {
105106

106107
/// Returns the string name of the given generic edge kind, or "unknown"
107108
/// otherwise. Useful for debugging.
108-
const char *getGenericEdgeKindName(Edge::Kind K);
109+
LLVM_ABI const char *getGenericEdgeKindName(Edge::Kind K);
109110

110111
/// Base class for Addressable entities (externals, absolutes, blocks).
111112
class Addressable {
@@ -389,7 +390,7 @@ inline orc::ExecutorAddr alignToBlock(orc::ExecutorAddr Addr, const Block &B) {
389390
// Returns true if the given blocks contains exactly one valid c-string.
390391
// Zero-fill blocks of size 1 count as valid empty strings. Content blocks
391392
// must end with a zero, and contain no zeros before the end.
392-
bool isCStringBlock(Block &B);
393+
LLVM_ABI bool isCStringBlock(Block &B);
393394

394395
/// Describes symbol linkage. This can be used to resolve definition clashes.
395396
enum class Linkage : uint8_t {
@@ -401,7 +402,7 @@ enum class Linkage : uint8_t {
401402
using TargetFlagsType = uint8_t;
402403

403404
/// For errors and debugging output.
404-
const char *getLinkageName(Linkage L);
405+
LLVM_ABI const char *getLinkageName(Linkage L);
405406

406407
/// Defines the scope in which this symbol should be visible:
407408
/// Default -- Visible in the public interface of the linkage unit.
@@ -412,9 +413,9 @@ const char *getLinkageName(Linkage L);
412413
enum class Scope : uint8_t { Default, Hidden, SideEffectsOnly, Local };
413414

414415
/// For debugging output.
415-
const char *getScopeName(Scope S);
416+
LLVM_ABI const char *getScopeName(Scope S);
416417

417-
raw_ostream &operator<<(raw_ostream &OS, const Block &B);
418+
LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const Block &B);
418419

419420
/// Symbol representation.
420421
///
@@ -708,9 +709,9 @@ class Symbol {
708709
size_t Size = 0;
709710
};
710711

711-
raw_ostream &operator<<(raw_ostream &OS, const Symbol &A);
712+
LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const Symbol &A);
712713

713-
void printEdge(raw_ostream &OS, const Block &B, const Edge &E,
714+
LLVM_ABI void printEdge(raw_ostream &OS, const Block &B, const Edge &E,
714715
StringRef EdgeKindName);
715716

716717
/// Represents an object file section.
@@ -731,7 +732,7 @@ class Section {
731732
using block_iterator = BlockSet::iterator;
732733
using const_block_iterator = BlockSet::const_iterator;
733734

734-
~Section();
735+
LLVM_ABI ~Section();
735736

736737
// Sections are not movable or copyable.
737738
Section(const Section &) = delete;
@@ -1039,7 +1040,7 @@ class LinkGraph {
10391040
LinkGraph &operator=(const LinkGraph &) = delete;
10401041
LinkGraph(LinkGraph &&) = delete;
10411042
LinkGraph &operator=(LinkGraph &&) = delete;
1042-
~LinkGraph();
1043+
LLVM_ABI ~LinkGraph();
10431044

10441045
/// Returns the name of this graph (usually the name of the original
10451046
/// underlying MemoryBuffer).
@@ -1658,10 +1659,10 @@ class LinkGraph {
16581659
orc::shared::AllocActions &allocActions() { return AAs; }
16591660

16601661
/// Dump the graph.
1661-
void dump(raw_ostream &OS);
1662+
LLVM_ABI void dump(raw_ostream &OS);
16621663

16631664
private:
1664-
std::vector<Block *> splitBlockImpl(std::vector<Block *> Blocks,
1665+
LLVM_ABI std::vector<Block *> splitBlockImpl(std::vector<Block *> Blocks,
16651666
SplitBlockCache *Cache);
16661667

16671668
// Put the BumpPtrAllocator first so that we don't free any of the underlying
@@ -1894,15 +1895,15 @@ struct PassConfiguration {
18941895
/// the two types once we have an OrcSupport library.
18951896
enum class SymbolLookupFlags { RequiredSymbol, WeaklyReferencedSymbol };
18961897

1897-
raw_ostream &operator<<(raw_ostream &OS, const SymbolLookupFlags &LF);
1898+
LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const SymbolLookupFlags &LF);
18981899

18991900
/// A map of symbol names to resolved addresses.
19001901
using AsyncLookupResult =
19011902
DenseMap<orc::SymbolStringPtr, orc::ExecutorSymbolDef>;
19021903

19031904
/// A function object to call with a resolved symbol map (See AsyncLookupResult)
19041905
/// or an error if resolution failed.
1905-
class JITLinkAsyncLookupContinuation {
1906+
class LLVM_ABI JITLinkAsyncLookupContinuation {
19061907
public:
19071908
virtual ~JITLinkAsyncLookupContinuation() = default;
19081909
virtual void run(Expected<AsyncLookupResult> LR) = 0;
@@ -1929,7 +1930,7 @@ createLookupContinuation(Continuation Cont) {
19291930
}
19301931

19311932
/// Holds context for a single jitLink invocation.
1932-
class JITLinkContext {
1933+
class LLVM_ABI JITLinkContext {
19331934
public:
19341935
using LookupMap = DenseMap<orc::SymbolStringPtr, SymbolLookupFlags>;
19351936

@@ -1995,13 +1996,13 @@ class JITLinkContext {
19951996

19961997
/// Marks all symbols in a graph live. This can be used as a default,
19971998
/// conservative mark-live implementation.
1998-
Error markAllSymbolsLive(LinkGraph &G);
1999+
LLVM_ABI Error markAllSymbolsLive(LinkGraph &G);
19992000

20002001
/// Create an out of range error for the given edge in the given block.
2001-
Error makeTargetOutOfRangeError(const LinkGraph &G, const Block &B,
2002+
LLVM_ABI Error makeTargetOutOfRangeError(const LinkGraph &G, const Block &B,
20022003
const Edge &E);
20032004

2004-
Error makeAlignmentError(llvm::orc::ExecutorAddr Loc, uint64_t Value, int N,
2005+
LLVM_ABI Error makeAlignmentError(llvm::orc::ExecutorAddr Loc, uint64_t Value, int N,
20052006
const Edge &E);
20062007

20072008
/// Creates a new pointer block in the given section and returns an
@@ -2016,7 +2017,7 @@ using AnonymousPointerCreator =
20162017
Symbol *InitialTarget, uint64_t InitialAddend)>;
20172018

20182019
/// Get target-specific AnonymousPointerCreator
2019-
AnonymousPointerCreator getAnonymousPointerCreator(const Triple &TT);
2020+
LLVM_ABI AnonymousPointerCreator getAnonymousPointerCreator(const Triple &TT);
20202021

20212022
/// Create a jump stub that jumps via the pointer at the given symbol and
20222023
/// an anonymous symbol pointing to it. Return the anonymous symbol.
@@ -2026,7 +2027,7 @@ using PointerJumpStubCreator = unique_function<Symbol &(
20262027
LinkGraph &G, Section &StubSection, Symbol &PointerSymbol)>;
20272028

20282029
/// Get target-specific PointerJumpStubCreator
2029-
PointerJumpStubCreator getPointerJumpStubCreator(const Triple &TT);
2030+
LLVM_ABI PointerJumpStubCreator getPointerJumpStubCreator(const Triple &TT);
20302031

20312032
/// Base case for edge-visitors where the visitor-list is empty.
20322033
inline void visitEdge(LinkGraph &G, Block *B, Edge &E) {}
@@ -2063,17 +2064,17 @@ void visitExistingEdges(LinkGraph &G, VisitorTs &&...Vs) {
20632064
/// Note: The graph does not take ownership of the underlying buffer, nor copy
20642065
/// its contents. The caller is responsible for ensuring that the object buffer
20652066
/// outlives the graph.
2066-
Expected<std::unique_ptr<LinkGraph>>
2067+
LLVM_ABI Expected<std::unique_ptr<LinkGraph>>
20672068
createLinkGraphFromObject(MemoryBufferRef ObjectBuffer,
20682069
std::shared_ptr<orc::SymbolStringPool> SSP);
20692070

20702071
/// Create a \c LinkGraph defining the given absolute symbols.
2071-
std::unique_ptr<LinkGraph>
2072+
LLVM_ABI std::unique_ptr<LinkGraph>
20722073
absoluteSymbolsLinkGraph(Triple TT, std::shared_ptr<orc::SymbolStringPool> SSP,
20732074
orc::SymbolMap Symbols);
20742075

20752076
/// Link the given graph.
2076-
void link(std::unique_ptr<LinkGraph> G, std::unique_ptr<JITLinkContext> Ctx);
2077+
LLVM_ABI void link(std::unique_ptr<LinkGraph> G, std::unique_ptr<JITLinkContext> Ctx);
20772078

20782079
} // end namespace jitlink
20792080
} // end namespace llvm

0 commit comments

Comments
 (0)