Skip to content

Commit 4f3b07c

Browse files
committed
[llvm] manual fix-ups to IDS codemod of ExecutionEngine library
1 parent fa6707f commit 4f3b07c

File tree

9 files changed

+31
-24
lines changed

9 files changed

+31
-24
lines changed

llvm/include/llvm/ExecutionEngine/Interpreter.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
#define LLVM_EXECUTIONENGINE_INTERPRETER_H
1616

1717
#include "llvm/ExecutionEngine/ExecutionEngine.h"
18+
#include "llvm/Support/Compiler.h"
1819

19-
extern "C" void LLVMLinkInInterpreter();
20+
extern "C" LLVM_ABI void LLVMLinkInInterpreter();
2021

2122
namespace {
2223
struct ForceInterpreterLinking {

llvm/include/llvm/ExecutionEngine/MCJIT.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
#define LLVM_EXECUTIONENGINE_MCJIT_H
1616

1717
#include "llvm/ExecutionEngine/ExecutionEngine.h"
18+
#include "llvm/Support/Compiler.h"
1819
#include <cstdlib>
1920

20-
extern "C" void LLVMLinkInMCJIT();
21+
extern "C" LLVM_ABI void LLVMLinkInMCJIT();
2122

2223
namespace {
2324
struct ForceMCJITLinking {

llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class ExecutorProcessControl;
4242
class LLVM_ABI LLJIT {
4343
template <typename, typename, typename> friend class LLJITBuilderSetters;
4444

45-
friend Expected<JITDylibSP> setUpGenericLLVMIRPlatform(LLJIT &J);
45+
LLVM_ABI_FRIEND friend Expected<JITDylibSP> setUpGenericLLVMIRPlatform(LLJIT &J);
4646

4747
public:
4848
/// Initializer support for LLJIT.
@@ -290,7 +290,7 @@ class LLLazyJIT : public LLJIT {
290290
private:
291291

292292
// Create a single-threaded LLLazyJIT instance.
293-
LLLazyJIT(LLLazyJITBuilderState &S, Error &Err);
293+
LLVM_ABI LLLazyJIT(LLLazyJITBuilderState &S, Error &Err);
294294

295295
std::unique_ptr<LazyCallThroughManager> LCTMgr;
296296
std::unique_ptr<IRPartitionLayer> IPLayer;

llvm/include/llvm/ExecutionEngine/Orc/SymbolStringPool.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#include "llvm/ADT/DenseMap.h"
1717
#include "llvm/ADT/StringMap.h"
18+
#include "llvm/Support/Compiler.h"
1819
#include <atomic>
1920
#include <mutex>
2021

@@ -35,7 +36,7 @@ class SymbolStringPool {
3536
friend class SymbolStringPoolEntryUnsafe;
3637

3738
// Implemented in DebugUtils.h.
38-
friend raw_ostream &operator<<(raw_ostream &OS, const SymbolStringPool &SSP);
39+
LLVM_ABI_FRIEND friend raw_ostream &operator<<(raw_ostream &OS, const SymbolStringPool &SSP);
3940

4041
public:
4142
/// Destroy a SymbolStringPool.
@@ -92,7 +93,7 @@ class SymbolStringPtrBase {
9293
return LHS.S < RHS.S;
9394
}
9495

95-
friend raw_ostream &operator<<(raw_ostream &OS,
96+
LLVM_ABI_FRIEND friend raw_ostream &operator<<(raw_ostream &OS,
9697
const SymbolStringPtrBase &Sym);
9798

9899
#ifndef NDEBUG
@@ -313,6 +314,8 @@ SymbolStringPool::getRefCount(const SymbolStringPtrBase &S) const {
313314
return S.getRefCount();
314315
}
315316

317+
LLVM_ABI raw_ostream &operator<<(raw_ostream &OS, const SymbolStringPtrBase &Sym);
318+
316319
} // end namespace orc
317320

318321
template <>

llvm/include/llvm/ExecutionEngine/RuntimeDyld.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ class RuntimeDyld {
285285
LLVM_ABI void finalizeWithMemoryManagerLocking();
286286

287287
private:
288-
friend void jitLinkForORC(
288+
LLVM_ABI_FRIEND friend void jitLinkForORC(
289289
object::OwningBinary<object::ObjectFile> O,
290290
RuntimeDyld::MemoryManager &MemMgr, JITSymbolResolver &Resolver,
291291
bool ProcessAllSections,

llvm/lib/ExecutionEngine/JITLink/ELF_aarch32.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "llvm/ExecutionEngine/JITLink/aarch32.h"
1818
#include "llvm/Object/ELF.h"
1919
#include "llvm/Object/ELFObjectFile.h"
20+
#include "llvm/Support/Compiler.h"
2021
#include "llvm/Support/ErrorHandling.h"
2122
#include "llvm/TargetParser/ARMTargetParser.h"
2223

@@ -31,7 +32,7 @@ namespace llvm {
3132
namespace jitlink {
3233

3334
/// Translate from ELF relocation type to JITLink-internal edge kind.
34-
Expected<aarch32::EdgeKind_aarch32>
35+
LLVM_ABI Expected<aarch32::EdgeKind_aarch32>
3536
getJITLinkEdgeKind(uint32_t ELFType, const aarch32::ArmConfig &ArmCfg) {
3637
switch (ELFType) {
3738
case ELF::R_ARM_ABS32:
@@ -75,7 +76,7 @@ getJITLinkEdgeKind(uint32_t ELFType, const aarch32::ArmConfig &ArmCfg) {
7576
}
7677

7778
/// Translate from JITLink-internal edge kind back to ELF relocation type.
78-
Expected<uint32_t> getELFRelocationType(Edge::Kind Kind) {
79+
LLVM_ABI Expected<uint32_t> getELFRelocationType(Edge::Kind Kind) {
7980
switch (static_cast<aarch32::EdgeKind_aarch32>(Kind)) {
8081
case aarch32::Data_Delta32:
8182
return ELF::R_ARM_REL32;

llvm/lib/ExecutionEngine/JITLink/aarch32.cpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "llvm/ADT/StringExtras.h"
1616
#include "llvm/ExecutionEngine/JITLink/JITLink.h"
1717
#include "llvm/ExecutionEngine/Orc/Shared/MemoryFlags.h"
18+
#include "llvm/Support/Compiler.h"
1819
#include "llvm/Support/Endian.h"
1920
#include "llvm/Support/ManagedStatic.h"
2021
#include "llvm/Support/MathExtras.h"
@@ -60,7 +61,7 @@ int64_t decodeImmBT4BlT1BlxT2(uint32_t Hi, uint32_t Lo) {
6061
///
6162
/// S:I1:I2:Imm10:Imm11:0 -> [ 00000:S:Imm10, 00:J1:0:J2:Imm11 ]
6263
///
63-
HalfWords encodeImmBT4BlT1BlxT2_J1J2(int64_t Value) {
64+
LLVM_ABI HalfWords encodeImmBT4BlT1BlxT2_J1J2(int64_t Value) {
6465
uint32_t S = (Value >> 14) & 0x0400;
6566
uint32_t J1 = (((~(Value >> 10)) ^ (Value >> 11)) & 0x2000);
6667
uint32_t J2 = (((~(Value >> 11)) ^ (Value >> 13)) & 0x0800);
@@ -74,7 +75,7 @@ HalfWords encodeImmBT4BlT1BlxT2_J1J2(int64_t Value) {
7475
///
7576
/// [ 00000:S:Imm10, 00:J1:0:J2:Imm11] -> S:I1:I2:Imm10:Imm11:0
7677
///
77-
int64_t decodeImmBT4BlT1BlxT2_J1J2(uint32_t Hi, uint32_t Lo) {
78+
LLVM_ABI int64_t decodeImmBT4BlT1BlxT2_J1J2(uint32_t Hi, uint32_t Lo) {
7879
uint32_t S = Hi & 0x0400;
7980
uint32_t I1 = ~((Lo ^ (Hi << 3)) << 10) & 0x00800000;
8081
uint32_t I2 = ~((Lo ^ (Hi << 1)) << 11) & 0x00400000;
@@ -88,7 +89,7 @@ int64_t decodeImmBT4BlT1BlxT2_J1J2(uint32_t Hi, uint32_t Lo) {
8889
///
8990
/// Imm24:00 -> 00000000:Imm24
9091
///
91-
uint32_t encodeImmBA1BlA1BlxA2(int64_t Value) {
92+
LLVM_ABI uint32_t encodeImmBA1BlA1BlxA2(int64_t Value) {
9293
return (Value >> 2) & 0x00ffffff;
9394
}
9495

@@ -97,7 +98,7 @@ uint32_t encodeImmBA1BlA1BlxA2(int64_t Value) {
9798
///
9899
/// 00000000:Imm24 -> Imm24:00
99100
///
100-
int64_t decodeImmBA1BlA1BlxA2(int64_t Value) {
101+
LLVM_ABI int64_t decodeImmBA1BlA1BlxA2(int64_t Value) {
101102
return SignExtend64<26>((Value & 0x00ffffff) << 2);
102103
}
103104

@@ -106,7 +107,7 @@ int64_t decodeImmBA1BlA1BlxA2(int64_t Value) {
106107
///
107108
/// Imm4:Imm1:Imm3:Imm8 -> [ 00000:i:000000:Imm4, 0:Imm3:0000:Imm8 ]
108109
///
109-
HalfWords encodeImmMovtT1MovwT3(uint16_t Value) {
110+
LLVM_ABI HalfWords encodeImmMovtT1MovwT3(uint16_t Value) {
110111
uint32_t Imm4 = (Value >> 12) & 0x0f;
111112
uint32_t Imm1 = (Value >> 11) & 0x01;
112113
uint32_t Imm3 = (Value >> 8) & 0x07;
@@ -119,7 +120,7 @@ HalfWords encodeImmMovtT1MovwT3(uint16_t Value) {
119120
///
120121
/// [ 00000:i:000000:Imm4, 0:Imm3:0000:Imm8 ] -> Imm4:Imm1:Imm3:Imm8
121122
///
122-
uint16_t decodeImmMovtT1MovwT3(uint32_t Hi, uint32_t Lo) {
123+
LLVM_ABI uint16_t decodeImmMovtT1MovwT3(uint32_t Hi, uint32_t Lo) {
123124
uint32_t Imm4 = Hi & 0x0f;
124125
uint32_t Imm1 = (Hi >> 10) & 0x01;
125126
uint32_t Imm3 = (Lo >> 12) & 0x07;
@@ -133,7 +134,7 @@ uint16_t decodeImmMovtT1MovwT3(uint32_t Hi, uint32_t Lo) {
133134
///
134135
/// Rd4 -> [0000000000000000, 0000:Rd4:00000000]
135136
///
136-
HalfWords encodeRegMovtT1MovwT3(int64_t Value) {
137+
LLVM_ABI HalfWords encodeRegMovtT1MovwT3(int64_t Value) {
137138
uint32_t Rd4 = (Value & 0x0f) << 8;
138139
return HalfWords{0, Rd4};
139140
}
@@ -142,7 +143,7 @@ HalfWords encodeRegMovtT1MovwT3(int64_t Value) {
142143
///
143144
/// [0000000000000000, 0000:Rd4:00000000] -> Rd4
144145
///
145-
int64_t decodeRegMovtT1MovwT3(uint32_t Hi, uint32_t Lo) {
146+
LLVM_ABI int64_t decodeRegMovtT1MovwT3(uint32_t Hi, uint32_t Lo) {
146147
uint32_t Rd4 = (Lo >> 8) & 0x0f;
147148
return Rd4;
148149
}
@@ -152,7 +153,7 @@ int64_t decodeRegMovtT1MovwT3(uint32_t Hi, uint32_t Lo) {
152153
///
153154
/// Imm4:Imm12 -> 000000000000:Imm4:0000:Imm12
154155
///
155-
uint32_t encodeImmMovtA1MovwA2(uint16_t Value) {
156+
LLVM_ABI uint32_t encodeImmMovtA1MovwA2(uint16_t Value) {
156157
uint32_t Imm4 = (Value >> 12) & 0x0f;
157158
uint32_t Imm12 = Value & 0x0fff;
158159
return (Imm4 << 16) | Imm12;
@@ -163,7 +164,7 @@ uint32_t encodeImmMovtA1MovwA2(uint16_t Value) {
163164
///
164165
/// 000000000000:Imm4:0000:Imm12 -> Imm4:Imm12
165166
///
166-
uint16_t decodeImmMovtA1MovwA2(uint64_t Value) {
167+
LLVM_ABI uint16_t decodeImmMovtA1MovwA2(uint64_t Value) {
167168
uint32_t Imm4 = (Value >> 16) & 0x0f;
168169
uint32_t Imm12 = Value & 0x0fff;
169170
return (Imm4 << 12) | Imm12;
@@ -174,7 +175,7 @@ uint16_t decodeImmMovtA1MovwA2(uint64_t Value) {
174175
///
175176
/// Rd4 -> 0000000000000000:Rd4:000000000000
176177
///
177-
uint32_t encodeRegMovtA1MovwA2(int64_t Value) {
178+
LLVM_ABI uint32_t encodeRegMovtA1MovwA2(int64_t Value) {
178179
uint32_t Rd4 = (Value & 0x00000f) << 12;
179180
return Rd4;
180181
}
@@ -184,7 +185,7 @@ uint32_t encodeRegMovtA1MovwA2(int64_t Value) {
184185
///
185186
/// 0000000000000000:Rd4:000000000000 -> Rd4
186187
///
187-
int64_t decodeRegMovtA1MovwA2(uint64_t Value) {
188+
LLVM_ABI int64_t decodeRegMovtA1MovwA2(uint64_t Value) {
188189
uint32_t Rd4 = (Value >> 12) & 0x00000f;
189190
return Rd4;
190191
}

llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ extern "C" {
2424
// We put information about the JITed function in this global, which the
2525
// debugger reads. Make sure to specify the version statically, because the
2626
// debugger checks the version before we can set it during runtime.
27-
LLVM_ALWAYS_EXPORT
27+
LLVM_ABI LLVM_ALWAYS_EXPORT
2828
struct jit_descriptor __jit_debug_descriptor = {JitDescriptorVersion, 0,
2929
nullptr, nullptr};
3030

3131
// Debuggers that implement the GDB JIT interface put a special breakpoint in
3232
// this function.
33-
LLVM_ALWAYS_EXPORT
33+
LLVM_ABI LLVM_ALWAYS_EXPORT
3434
LLVM_ATTRIBUTE_NOINLINE void __jit_debug_register_code() {
3535
// The noinline and the asm prevent calls to this function from being
3636
// optimized out.

llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ TEST_F(OrcCAPITestBase, AddObjectBuffer) {
533533

534534
// JITLink debug support plugins put information about JITed code in this GDB
535535
// JIT Interface global from OrcTargetProcess.
536-
extern "C" struct jit_descriptor __jit_debug_descriptor;
536+
extern "C" LLVM_ABI struct jit_descriptor __jit_debug_descriptor;
537537

538538
static void *findLastDebugDescriptorEntryPtr() {
539539
struct jit_code_entry *Last = __jit_debug_descriptor.first_entry;

0 commit comments

Comments
 (0)