aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ExecutionEngine/JIT/JITEmitter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ExecutionEngine/JIT/JITEmitter.cpp')
-rw-r--r--lib/ExecutionEngine/JIT/JITEmitter.cpp36
1 files changed, 19 insertions, 17 deletions
diff --git a/lib/ExecutionEngine/JIT/JITEmitter.cpp b/lib/ExecutionEngine/JIT/JITEmitter.cpp
index 9d215ec..cd7a500 100644
--- a/lib/ExecutionEngine/JIT/JITEmitter.cpp
+++ b/lib/ExecutionEngine/JIT/JITEmitter.cpp
@@ -12,7 +12,6 @@
//
//===----------------------------------------------------------------------===//
-#define DEBUG_TYPE "jit"
#include "JIT.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallPtrSet.h"
@@ -52,6 +51,8 @@
#endif
using namespace llvm;
+#define DEBUG_TYPE "jit"
+
STATISTIC(NumBytes, "Number of bytes of machine code compiled");
STATISTIC(NumRelos, "Number of relocations applied");
STATISTIC(NumRetries, "Number of retries with more memory");
@@ -343,7 +344,8 @@ namespace {
void *FunctionBody; // Beginning of the function's allocation.
void *Code; // The address the function's code actually starts at.
void *ExceptionTable;
- EmittedCode() : FunctionBody(0), Code(0), ExceptionTable(0) {}
+ EmittedCode() : FunctionBody(nullptr), Code(nullptr),
+ ExceptionTable(nullptr) {}
};
struct EmittedFunctionConfig : public ValueMapConfig<const Function*> {
typedef JITEmitter *ExtraData;
@@ -360,7 +362,7 @@ namespace {
public:
JITEmitter(JIT &jit, JITMemoryManager *JMM, TargetMachine &TM)
- : SizeEstimate(0), Resolver(jit, *this), MMI(0), CurFn(0),
+ : SizeEstimate(0), Resolver(jit, *this), MMI(nullptr), CurFn(nullptr),
EmittedFunctions(this), TheJIT(&jit) {
MemMgr = JMM ? JMM : JITMemoryManager::CreateDefaultMemManager();
if (jit.getJITInfo().needsGOT()) {
@@ -516,7 +518,7 @@ void *JITResolver::getLazyFunctionStub(Function *F) {
// Call the lazy resolver function if we are JIT'ing lazily. Otherwise we
// must resolve the symbol now.
void *Actual = TheJIT->isCompilingLazily()
- ? (void *)(intptr_t)LazyResolverFn : (void *)0;
+ ? (void *)(intptr_t)LazyResolverFn : (void *)nullptr;
// If this is an external declaration, attempt to resolve the address now
// to place in the stub.
@@ -525,7 +527,7 @@ void *JITResolver::getLazyFunctionStub(Function *F) {
// If we resolved the symbol to a null address (eg. a weak external)
// don't emit a stub. Return a null pointer to the application.
- if (!Actual) return 0;
+ if (!Actual) return nullptr;
}
TargetJITInfo::StubLayout SL = TheJIT->getJITInfo().getStubLayout();
@@ -592,8 +594,8 @@ void *JITResolver::getExternalFunctionStub(void *FnAddr) {
if (Stub) return Stub;
TargetJITInfo::StubLayout SL = TheJIT->getJITInfo().getStubLayout();
- JE.startGVStub(0, SL.Size, SL.Alignment);
- Stub = TheJIT->getJITInfo().emitFunctionStub(0, FnAddr, JE);
+ JE.startGVStub(nullptr, SL.Size, SL.Alignment);
+ Stub = TheJIT->getJITInfo().emitFunctionStub(nullptr, FnAddr, JE);
JE.finishGVStub();
DEBUG(dbgs() << "JIT: Stub emitted at [" << Stub
@@ -619,8 +621,8 @@ void *JITResolver::JITCompilerFn(void *Stub) {
JITResolver *JR = StubToResolverMap->getResolverFromStub(Stub);
assert(JR && "Unable to find the corresponding JITResolver to the call site");
- Function* F = 0;
- void* ActualPtr = 0;
+ Function* F = nullptr;
+ void* ActualPtr = nullptr;
{
// Only lock for getting the Function. The call getPointerToFunction made
@@ -688,7 +690,7 @@ void *JITEmitter::getPointerToGlobal(GlobalValue *V, void *Reference,
return TheJIT->getOrEmitGlobalVariable(GV);
if (GlobalAlias *GA = dyn_cast<GlobalAlias>(V))
- return TheJIT->getPointerToGlobal(GA->getAliasedGlobal());
+ return TheJIT->getPointerToGlobal(GA->getAliasee());
// If we have already compiled the function, return a pointer to its body.
Function *F = cast<Function>(V);
@@ -735,7 +737,7 @@ void JITEmitter::processDebugLoc(DebugLoc DL, bool BeforePrintingInsn) {
const LLVMContext &Context = EmissionDetails.MF->getFunction()->getContext();
- if (DL.getScope(Context) != 0 && PrevDL != DL) {
+ if (DL.getScope(Context) != nullptr && PrevDL != DL) {
JITEvent_EmittedFunctionDetails::LineStart NextLine;
NextLine.Address = getCurrentPCValue();
NextLine.Loc = DL;
@@ -824,7 +826,7 @@ bool JITEmitter::finishFunction(MachineFunction &F) {
// Resolve the relocations to concrete pointers.
for (unsigned i = 0, e = Relocations.size(); i != e; ++i) {
MachineRelocation &MR = Relocations[i];
- void *ResultPtr = 0;
+ void *ResultPtr = nullptr;
if (!MR.letTargetResolve()) {
if (MR.isExternalSymbol()) {
ResultPtr = TheJIT->getPointerToNamedFunction(MR.getExternalSymbol(),
@@ -870,7 +872,7 @@ bool JITEmitter::finishFunction(MachineFunction &F) {
}
}
- CurFn = 0;
+ CurFn = nullptr;
TheJIT->getJITInfo().relocate(BufferBegin, &Relocations[0],
Relocations.size(), MemMgr->getGOTBase());
}
@@ -899,7 +901,7 @@ bool JITEmitter::finishFunction(MachineFunction &F) {
SizeEstimate = 0;
}
- BufferBegin = CurBufferPtr = 0;
+ BufferBegin = CurBufferPtr = nullptr;
NumBytes += FnEnd-FnStart;
// Invalidate the icache if necessary.
@@ -1017,7 +1019,7 @@ void JITEmitter::emitConstantPool(MachineConstantPool *MCP) {
ConstantPoolBase = allocateSpace(Size, Align);
ConstantPool = MCP;
- if (ConstantPoolBase == 0) return; // Buffer overflow.
+ if (!ConstantPoolBase) return; // Buffer overflow.
DEBUG(dbgs() << "JIT: Emitted constant pool at [" << ConstantPoolBase
<< "] (size: " << Size << ", alignment: " << Align << ")\n");
@@ -1073,7 +1075,7 @@ void JITEmitter::emitJumpTableInfo(MachineJumpTableInfo *MJTI) {
return;
const std::vector<MachineJumpTableEntry> &JT = MJTI->getJumpTables();
- if (JT.empty() || JumpTableBase == 0) return;
+ if (JT.empty() || !JumpTableBase) return;
switch (MJTI->getEntryKind()) {
@@ -1243,7 +1245,7 @@ void JIT::updateFunctionStub(Function *F) {
void JIT::freeMachineCodeForFunction(Function *F) {
// Delete translation for this from the ExecutionEngine, so it will get
// retranslated next time it is used.
- updateGlobalMapping(F, 0);
+ updateGlobalMapping(F, nullptr);
// Free the actual memory for the function body and related stuff.
static_cast<JITEmitter*>(JCE)->deallocateMemForFunction(F);