Changes in directory llvm/include/llvm/CodeGen:
MachineRelocation.h updated: 1.9 -> 1.10 --- Log message: Added jump table address relocation. --- Diffs of the changes: (+35 -4) MachineRelocation.h | 39 +++++++++++++++++++++++++++++++++++---- 1 files changed, 35 insertions(+), 4 deletions(-) Index: llvm/include/llvm/CodeGen/MachineRelocation.h diff -u llvm/include/llvm/CodeGen/MachineRelocation.h:1.9 llvm/include/llvm/CodeGen/MachineRelocation.h:1.10 --- llvm/include/llvm/CodeGen/MachineRelocation.h:1.9 Wed May 3 15:30:20 2006 +++ llvm/include/llvm/CodeGen/MachineRelocation.h Thu Jun 22 20:02:37 2006 @@ -39,7 +39,8 @@ isResult, // Relocation has be transformed into its result pointer. isGV, // The Target.GV field is valid. isExtSym, // The Target.ExtSym field is valid. - isConstPool, // The Target.ConstPool field is valid. + isConstPool, // Relocation of constant pool address. + isJumpTable, // Relocation of jump table address. isGOTIndex // The Target.GOTIndex field is valid. }; @@ -54,7 +55,7 @@ void *Result; // If this has been resolved to a resolved pointer GlobalValue *GV; // If this is a pointer to an LLVM global const char *ExtSym; // If this is a pointer to a named symbol - unsigned ConstPool; // In this is a pointer to a constant pool entry + unsigned Index; // Constant pool / jump table index unsigned GOTIndex; // Index in the GOT of this symbol/global } Target; @@ -113,7 +114,24 @@ Result.AddrType = isConstPool; Result.DoesntNeedFnStub = false; Result.GOTRelative = false; - Result.Target.ConstPool = CPI; + Result.Target.Index = CPI; + return Result; + } + + /// MachineRelocation::getJumpTable - Return a relocation entry for a jump + /// table entry. + /// + static MachineRelocation getJumpTable(intptr_t offset,unsigned RelocationType, + unsigned JTI, intptr_t cst = 0) { + assert((RelocationType & ~63) == 0 && "Relocation type too large!"); + MachineRelocation Result; + Result.Offset = offset; + Result.ConstantVal = cst; + Result.TargetReloType = RelocationType; + Result.AddrType = isJumpTable; + Result.DoesntNeedFnStub = false; + Result.GOTRelative = false; + Result.Target.Index = JTI; return Result; } @@ -154,6 +172,12 @@ return AddrType == isConstPool; } + /// isJumpTableIndex - Return true if this is a jump table reference. + /// + bool isJumpTableIndex() const { + return AddrType == isJumpTable; + } + /// isGOTRelative - Return true the target wants the index into the GOT of /// the symbol rather than the address of the symbol. bool isGOTRelative() const { @@ -187,7 +211,14 @@ /// the index into the constant pool. unsigned getConstantPoolIndex() const { assert(isConstantPoolIndex() && "This is not a constant pool reference!"); - return Target.ConstPool; + return Target.Index; + } + + /// getJumpTableIndex - If this is a jump table reference, return + /// the index into the jump table. + unsigned getJumpTableIndex() const { + assert(isJumpTableIndex() && "This is not a jump table reference!"); + return Target.Index; } /// getResultPointer - Once this has been resolved to point to an actual _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits