13 #define DEBUG_TYPE "jit"
29 #if defined (__sparc__)
33 "\t.global SparcCompilationCallback\n"
34 "\t.type SparcCompilationCallback, #function\n"
35 "SparcCompilationCallback:\n"
37 "\tsave %sp, -192, %sp\n"
39 "\tcall SparcCompilationCallbackC\n"
40 "\t sub %g1, 4, %o0\n"
43 "\t restore %o0, 0, %g1\n"
47 "\t.size SparcCompilationCallback, .-SparcCompilationCallback"
53 "Cannot call SparcCompilationCallback() on a non-sparc arch!");
58 #define HI(Val) (((unsigned)(Val)) >> 10)
59 #define LO(Val) (((unsigned)(Val)) & 0x3FF)
61 #define SETHI_INST(imm, rd) (0x01000000 | ((rd) << 25) | ((imm) & 0x3FFFFF))
62 #define JMP_INST(rs1, imm, rd) (0x80000000 | ((rd) << 25) | (0x38 << 19) \
63 | ((rs1) << 14) | (1 << 13) | ((imm) & 0x1FFF))
64 #define NOP_INST SETHI_INST(0, 0)
82 return (
void*)StubAddr;
86 assert(0 &&
"FIXME: Implement SparcJITInfo::replaceMachineCodeForFunction");
137 unsigned NumRelocs,
unsigned char *GOTBase) {
138 for (
unsigned i = 0; i != NumRelocs; ++i, ++MR) {
144 ResultPtr = (ResultPtr >> 10) & 0x3fffff;
148 ResultPtr = (ResultPtr & 0x3ff);
152 ResultPtr = ((ResultPtr - (
intptr_t)RelocPos) >> 2) & 0x3fffffff;
156 ResultPtr = ((ResultPtr - (
intptr_t)RelocPos) >> 2) & 0x3fffff;
160 ResultPtr = ((ResultPtr - (
intptr_t)RelocPos) >> 2) & 0x7ffff;
163 *((
unsigned*) RelocPos) |= (
unsigned) ResultPtr;
void emitAlignment(unsigned Alignment)
unsigned getRelocationType() const
static bool setRangeWritable(const void *Addr, size_t Size)
virtual StubLayout getStubLayout()
Returns the maximum size and alignment for a call stub on this target.
#define SETHI_INST(imm, rd)
void SparcCompilationCallback()
void *(* JITCompilerFn)(void *)
static void InvalidateInstructionCache(const void *Addr, size_t Len)
#define llvm_unreachable(msg)
virtual void replaceMachineCodeForFunction(void *Old, void *New)
void emitWordBE(uint32_t W)
intptr_t getMachineCodeOffset() const
void * SparcCompilationCallbackC(intptr_t StubAddr)
static bool setRangeExecutable(const void *Addr, size_t Size)
void * getResultPointer() const
static TargetJITInfo::JITCompilerFn JITCompilerFunction
virtual uintptr_t getCurrentPCValue() const
virtual void relocate(void *Function, MachineRelocation *MR, unsigned NumRelocs, unsigned char *GOTBase)
#define JMP_INST(rs1, imm, rd)
virtual LazyResolverFn getLazyResolverFunction(JITCompilerFn)
getLazyResolverFunction - Expose the lazy resolver to the JIT.
virtual void * emitFunctionStub(const Function *F, void *Fn, JITCodeEmitter &JCE)
Records the required size and alignment for a call stub in bytes.