[llvm-commits] [llvm] r58746 - in /llvm/trunk: include/llvm/CodeGen/MachineRelocation.h include/llvm/Target/TargetJITInfo.h lib/ExecutionEngine/JIT/JITEmitter.cpp lib/Target/X86/X86CodeEmitter.cpp lib/Target/X86/X86JITInfo.cpp lib/Target/X86/X86JITInfo.h
Evan Cheng
evan.cheng at apple.com
Tue Nov 4 17:50:32 PST 2008
Author: evancheng
Date: Tue Nov 4 19:50:32 2008
New Revision: 58746
URL: http://llvm.org/viewvc/llvm-project?rev=58746&view=rev
Log:
Rename isGVLazyPtr to isGVNonLazyPtr relocation. This represents Mac OS X
indirect gv reference. Please don't call it lazy.
Modified:
llvm/trunk/include/llvm/CodeGen/MachineRelocation.h
llvm/trunk/include/llvm/Target/TargetJITInfo.h
llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp
llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp
llvm/trunk/lib/Target/X86/X86JITInfo.cpp
llvm/trunk/lib/Target/X86/X86JITInfo.h
Modified: llvm/trunk/include/llvm/CodeGen/MachineRelocation.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineRelocation.h?rev=58746&r1=58745&r2=58746&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineRelocation.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineRelocation.h Tue Nov 4 19:50:32 2008
@@ -39,7 +39,7 @@
enum AddressType {
isResult, // Relocation has be transformed into its result pointer.
isGV, // The Target.GV field is valid.
- isGVLazyPtr, // Relocation of a lazily resolved GV address.
+ isGVNonLazyPtr, // Relocation of a Mac OS X NonLazy indirect reference.
isBB, // Relocation of BB address.
isExtSym, // The Target.ExtSym field is valid.
isConstPool, // Relocation of constant pool address.
@@ -56,7 +56,7 @@
union {
void *Result; // If this has been resolved to a resolved pointer
- GlobalValue *GV; // If this is a pointer to a GV or a GV lazy ptr
+ GlobalValue *GV; // If this is a pointer to a GV or a GV nonlazy ptr
MachineBasicBlock *MBB; // If this is a pointer to a LLVM BB
const char *ExtSym; // If this is a pointer to a named symbol
unsigned Index; // Constant pool / jump table index
@@ -96,9 +96,9 @@
return Result;
}
- /// MachineRelocation::getGVLazyPtr - Return a relocation entry for a
- /// lazily resolved GlobalValue address.
- static MachineRelocation getGVLazyPtr(intptr_t offset,
+ /// MachineRelocation::getGVNonLazyPtr - Return a relocation entry for a
+ /// Mac OS X non-lazy GlobalValue indirect reference.
+ static MachineRelocation getGVNonLazyPtr(intptr_t offset,
unsigned RelocationType,
GlobalValue *GV, intptr_t cst = 0,
bool NeedStub = 0,
@@ -108,7 +108,7 @@
Result.Offset = offset;
Result.ConstantVal = cst;
Result.TargetReloType = RelocationType;
- Result.AddrType = isGVLazyPtr;
+ Result.AddrType = isGVNonLazyPtr;
Result.NeedStub = NeedStub;
Result.GOTRelative = GOTrelative;
Result.TargetResolve = false;
@@ -221,10 +221,10 @@
return AddrType == isGV;
}
- /// isGlobalValueVLazyPtr - Return true if this relocation is the address
- /// of a lazily resolved GlobalValue.
- bool isGlobalValueLazyPtr() const {
- return AddrType == isGVLazyPtr;
+ /// isGlobalValueNonLazyPtr - Return true if this relocation is the address
+ /// of a Mac OS X non-lazy indirect reference.
+ bool isGlobalValueNonLazyPtr() const {
+ return AddrType == isGVNonLazyPtr;
}
/// isBasicBlock - Return true if this relocation is a basic block reference.
@@ -274,7 +274,7 @@
/// getGlobalValue - If this is a global value reference, return the
/// referenced global.
GlobalValue *getGlobalValue() const {
- assert((isGlobalValue() || isGlobalValueLazyPtr()) &&
+ assert((isGlobalValue() || isGlobalValueNonLazyPtr()) &&
"This is not a global value reference!");
return Target.GV;
}
Modified: llvm/trunk/include/llvm/Target/TargetJITInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetJITInfo.h?rev=58746&r1=58745&r2=58746&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetJITInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetJITInfo.h Tue Nov 4 19:50:32 2008
@@ -40,11 +40,12 @@
///
virtual void replaceMachineCodeForFunction(void *Old, void *New) = 0;
- /// emitGlobalValueLazyPtr - Use the specified MachineCodeEmitter object to
- /// emit a lazy pointer which contains the address of the specified ptr.
- virtual void *emitGlobalValueLazyPtr(const GlobalValue* GV, void *ptr,
- MachineCodeEmitter &MCE) {
- assert(0 && "This target doesn't implement emitGlobalValueLazyPtr!");
+ /// emitGlobalValueNonLazyPtr - Use the specified MachineCodeEmitter object
+ /// to emit a Mac OS X non-lazy pointer which contains the address of the
+ /// specified ptr.
+ virtual void *emitGlobalValueNonLazyPtr(const GlobalValue* GV, void *ptr,
+ MachineCodeEmitter &MCE) {
+ assert(0 && "This target doesn't implement emitGlobalValueNonLazyPtr!");
return 0;
}
Modified: llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp?rev=58746&r1=58745&r2=58746&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/JIT/JITEmitter.cpp Tue Nov 4 19:50:32 2008
@@ -59,9 +59,9 @@
/// corresponds to.
std::map<void*, Function*> StubToFunctionMap;
- /// GlobalToLazyPtrMap - Keep track of the lazy pointer created for a
+ /// GlobalToNonLazyPtrMap - Keep track of the lazy pointer created for a
/// particular GlobalVariable so that we can reuse them if necessary.
- std::map<GlobalValue*, void*> GlobalToLazyPtrMap;
+ std::map<GlobalValue*, void*> GlobalToNonLazyPtrMap;
public:
std::map<Function*, void*>& getFunctionToStubMap(const MutexGuard& locked) {
@@ -75,9 +75,9 @@
}
std::map<GlobalValue*, void*>&
- getGlobalToLazyPtrMap(const MutexGuard& locked) {
+ getGlobalToNonLazyPtrMap(const MutexGuard& locked) {
assert(locked.holds(TheJIT->lock));
- return GlobalToLazyPtrMap;
+ return GlobalToNonLazyPtrMap;
}
};
@@ -120,9 +120,9 @@
/// specified address, created lazily on demand.
void *getExternalFunctionStub(void *FnAddr);
- /// getGlobalValueLazyPtr - Return a lazy pointer containing the specified
- /// GV address.
- void *getGlobalValueLazyPtr(GlobalValue *V, void *GVAddress);
+ /// getGlobalValueNonLazyPtr - Return a non-lazy pointer containing the
+ /// specified GV address.
+ void *getGlobalValueNonLazyPtr(GlobalValue *V, void *GVAddress);
/// AddCallbackAtLocation - If the target is capable of rewriting an
/// instruction without the use of a stub, record the location of the use so
@@ -184,23 +184,23 @@
return Stub;
}
-/// getGlobalValueLazyPtr - Return a lazy pointer containing the specified
+/// getGlobalValueNonLazyPtr - Return a lazy pointer containing the specified
/// GV address.
-void *JITResolver::getGlobalValueLazyPtr(GlobalValue *GV, void *GVAddress) {
+void *JITResolver::getGlobalValueNonLazyPtr(GlobalValue *GV, void *GVAddress) {
MutexGuard locked(TheJIT->lock);
// If we already have a stub for this global variable, recycle it.
- void *&LazyPtr = state.getGlobalToLazyPtrMap(locked)[GV];
- if (LazyPtr) return LazyPtr;
+ void *&NonLazyPtr = state.getGlobalToNonLazyPtrMap(locked)[GV];
+ if (NonLazyPtr) return NonLazyPtr;
// Otherwise, codegen a new lazy pointer.
- LazyPtr = TheJIT->getJITInfo().emitGlobalValueLazyPtr(GV, GVAddress,
- *TheJIT->getCodeEmitter());
+ NonLazyPtr = TheJIT->getJITInfo().emitGlobalValueNonLazyPtr(GV, GVAddress,
+ *TheJIT->getCodeEmitter());
- DOUT << "JIT: Stub emitted at [" << LazyPtr << "] for GV '"
+ DOUT << "JIT: Stub emitted at [" << NonLazyPtr << "] for GV '"
<< GV->getName() << "'\n";
- return LazyPtr;
+ return NonLazyPtr;
}
/// getExternalFunctionStub - Return a stub for the function at the
@@ -570,8 +570,8 @@
private:
void *getPointerToGlobal(GlobalValue *GV, void *Reference, bool NoNeedStub);
- void *getPointerToGVLazyPtr(GlobalValue *V, void *Reference,
- bool NoNeedStub);
+ void *getPointerToGVNonLazyPtr(GlobalValue *V, void *Reference,
+ bool NoNeedStub);
unsigned addSizeOfGlobal(const GlobalVariable *GV, unsigned Size);
unsigned addSizeOfGlobalsInConstantVal(const Constant *C, unsigned Size);
unsigned addSizeOfGlobalsInInitializer(const Constant *Init, unsigned Size);
@@ -613,13 +613,13 @@
return Resolver.getFunctionStub(F);
}
-void *JITEmitter::getPointerToGVLazyPtr(GlobalValue *V, void *Reference,
+void *JITEmitter::getPointerToGVNonLazyPtr(GlobalValue *V, void *Reference,
bool DoesntNeedStub) {
// Make sure GV is emitted first.
// FIXME: For now, if the GV is an external function we force the JIT to
- // compile it so the lazy pointer will contain the fully resolved address.
+ // compile it so the non-lazy pointer will contain the fully resolved address.
void *GVAddress = getPointerToGlobal(V, Reference, true);
- return Resolver.getGlobalValueLazyPtr(V, GVAddress);
+ return Resolver.getGlobalValueNonLazyPtr(V, GVAddress);
}
static unsigned GetConstantPoolSizeInBytes(MachineConstantPool *MCP) {
@@ -887,8 +887,8 @@
ResultPtr = getPointerToGlobal(MR.getGlobalValue(),
BufferBegin+MR.getMachineCodeOffset(),
MR.doesntNeedStub());
- } else if (MR.isGlobalValueLazyPtr()) {
- ResultPtr = getPointerToGVLazyPtr(MR.getGlobalValue(),
+ } else if (MR.isGlobalValueNonLazyPtr()) {
+ ResultPtr = getPointerToGVNonLazyPtr(MR.getGlobalValue(),
BufferBegin+MR.getMachineCodeOffset(),
MR.doesntNeedStub());
} else if (MR.isBasicBlock()) {
Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp?rev=58746&r1=58745&r2=58746&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Tue Nov 4 19:50:32 2008
@@ -73,7 +73,7 @@
void emitPCRelativeBlockAddress(MachineBasicBlock *MBB);
void emitGlobalAddress(GlobalValue *GV, unsigned Reloc,
intptr_t Disp = 0, intptr_t PCAdj = 0,
- bool NeedStub = false, bool IsLazy = false);
+ bool NeedStub = false, bool IsNonLazy = false);
void emitExternalSymbolAddress(const char *ES, unsigned Reloc);
void emitConstPoolAddress(unsigned CPI, unsigned Reloc, intptr_t Disp = 0,
intptr_t PCAdj = 0);
@@ -94,7 +94,7 @@
unsigned getX86RegNum(unsigned RegNo) const;
- bool gvNeedsLazyPtr(const GlobalValue *GV);
+ bool gvNeedsNonLazyPtr(const GlobalValue *GV);
};
char Emitter::ID = 0;
}
@@ -155,15 +155,15 @@
intptr_t Disp /* = 0 */,
intptr_t PCAdj /* = 0 */,
bool NeedStub /* = false */,
- bool isLazy /* = false */) {
+ bool isNonLazy /* = false */) {
intptr_t RelocCST = 0;
if (Reloc == X86::reloc_picrel_word)
RelocCST = PICBaseOffset;
else if (Reloc == X86::reloc_pcrel_word)
RelocCST = PCAdj;
- MachineRelocation MR = isLazy
- ? MachineRelocation::getGVLazyPtr(MCE.getCurrentPCOffset(), Reloc,
- GV, RelocCST, NeedStub)
+ MachineRelocation MR = isNonLazy
+ ? MachineRelocation::getGVNonLazyPtr(MCE.getCurrentPCOffset(), Reloc,
+ GV, RelocCST, NeedStub)
: MachineRelocation::getGV(MCE.getCurrentPCOffset(), Reloc,
GV, RelocCST, NeedStub);
MCE.addRelocation(MR);
@@ -263,8 +263,8 @@
return Value == (signed char)Value;
}
-bool Emitter::gvNeedsLazyPtr(const GlobalValue *GV) {
- // For Darwin, simulate the linktime GOT by using the same lazy-pointer
+bool Emitter::gvNeedsNonLazyPtr(const GlobalValue *GV) {
+ // For Darwin, simulate the linktime GOT by using the same non-lazy-pointer
// mechanism as 32-bit mode.
return (!Is64BitMode || TM.getSubtarget<X86Subtarget>().isTargetDarwin()) &&
TM.getSubtarget<X86Subtarget>().GVRequiresExtraLoad(GV, TM, false);
@@ -289,9 +289,9 @@
unsigned rt = Is64BitMode ? X86::reloc_pcrel_word
: (IsPIC ? X86::reloc_picrel_word : X86::reloc_absolute_word);
bool NeedStub = isa<Function>(RelocOp->getGlobal());
- bool isLazy = gvNeedsLazyPtr(RelocOp->getGlobal());
+ bool isNonLazy = gvNeedsNonLazyPtr(RelocOp->getGlobal());
emitGlobalAddress(RelocOp->getGlobal(), rt, RelocOp->getOffset(),
- PCAdj, NeedStub, isLazy);
+ PCAdj, NeedStub, isNonLazy);
} else if (RelocOp->isCPI()) {
unsigned rt = Is64BitMode ? X86::reloc_pcrel_word : X86::reloc_picrel_word;
emitConstPoolAddress(RelocOp->getIndex(), rt,
@@ -610,9 +610,9 @@
rt = X86::reloc_absolute_dword; // FIXME: add X86II flag?
if (MO1.isGlobal()) {
bool NeedStub = isa<Function>(MO1.getGlobal());
- bool isLazy = gvNeedsLazyPtr(MO1.getGlobal());
+ bool isNonLazy = gvNeedsNonLazyPtr(MO1.getGlobal());
emitGlobalAddress(MO1.getGlobal(), rt, MO1.getOffset(), 0,
- NeedStub, isLazy);
+ NeedStub, isNonLazy);
} else if (MO1.isSymbol())
emitExternalSymbolAddress(MO1.getSymbolName(), rt);
else if (MO1.isCPI())
@@ -688,9 +688,9 @@
rt = X86::reloc_absolute_word; // FIXME: add X86II flag?
if (MO1.isGlobal()) {
bool NeedStub = isa<Function>(MO1.getGlobal());
- bool isLazy = gvNeedsLazyPtr(MO1.getGlobal());
+ bool isNonLazy = gvNeedsNonLazyPtr(MO1.getGlobal());
emitGlobalAddress(MO1.getGlobal(), rt, MO1.getOffset(), 0,
- NeedStub, isLazy);
+ NeedStub, isNonLazy);
} else if (MO1.isSymbol())
emitExternalSymbolAddress(MO1.getSymbolName(), rt);
else if (MO1.isCPI())
@@ -726,9 +726,9 @@
rt = X86::reloc_absolute_word; // FIXME: add X86II flag?
if (MO.isGlobal()) {
bool NeedStub = isa<Function>(MO.getGlobal());
- bool isLazy = gvNeedsLazyPtr(MO.getGlobal());
+ bool isNonLazy = gvNeedsNonLazyPtr(MO.getGlobal());
emitGlobalAddress(MO.getGlobal(), rt, MO.getOffset(), 0,
- NeedStub, isLazy);
+ NeedStub, isNonLazy);
} else if (MO.isSymbol())
emitExternalSymbolAddress(MO.getSymbolName(), rt);
else if (MO.isCPI())
Modified: llvm/trunk/lib/Target/X86/X86JITInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86JITInfo.cpp?rev=58746&r1=58745&r2=58746&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86JITInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86JITInfo.cpp Tue Nov 4 19:50:32 2008
@@ -413,8 +413,8 @@
return X86CompilationCallback;
}
-void *X86JITInfo::emitGlobalValueLazyPtr(const GlobalValue* GV, void *ptr,
- MachineCodeEmitter &MCE) {
+void *X86JITInfo::emitGlobalValueNonLazyPtr(const GlobalValue* GV, void *ptr,
+ MachineCodeEmitter &MCE) {
#if defined (X86_64_JIT)
MCE.startFunctionStub(GV, 8, 8);
MCE.emitWordLE((unsigned)(intptr_t)ptr);
Modified: llvm/trunk/lib/Target/X86/X86JITInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86JITInfo.h?rev=58746&r1=58745&r2=58746&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86JITInfo.h (original)
+++ llvm/trunk/lib/Target/X86/X86JITInfo.h Tue Nov 4 19:50:32 2008
@@ -37,10 +37,11 @@
///
virtual void replaceMachineCodeForFunction(void *Old, void *New);
- /// emitGlobalValueLazyPtr - Use the specified MachineCodeEmitter object to
- /// emit a lazy pointer which contains the address of the specified ptr.
- virtual void *emitGlobalValueLazyPtr(const GlobalValue* GV, void *ptr,
- MachineCodeEmitter &MCE);
+ /// emitGlobalValueNonLazyPtr - Use the specified MachineCodeEmitter object
+ /// to emit a Mac OS X non-lazy pointer which contains the address of the
+ /// specified ptr.
+ virtual void *emitGlobalValueNonLazyPtr(const GlobalValue* GV, void *ptr,
+ MachineCodeEmitter &MCE);
/// emitFunctionStub - Use the specified MachineCodeEmitter object to emit a
/// small native function that simply calls the function at the specified
More information about the llvm-commits
mailing list