LLVM API Documentation
00001 //===- X86JITInfo.h - X86 implementation of the JIT interface --*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file contains the X86 implementation of the TargetJITInfo class. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 #ifndef X86JITINFO_H 00015 #define X86JITINFO_H 00016 00017 #include "llvm/Function.h" 00018 #include "llvm/Target/TargetJITInfo.h" 00019 00020 namespace llvm { 00021 class X86TargetMachine; 00022 00023 class X86JITInfo : public TargetJITInfo { 00024 X86TargetMachine &TM; 00025 uintptr_t PICBase; 00026 char* TLSOffset; 00027 public: 00028 explicit X86JITInfo(X86TargetMachine &tm) : TM(tm) { 00029 useGOT = 0; 00030 TLSOffset = 0; 00031 } 00032 00033 /// replaceMachineCodeForFunction - Make it so that calling the function 00034 /// whose machine code is at OLD turns into a call to NEW, perhaps by 00035 /// overwriting OLD with a branch to NEW. This is used for self-modifying 00036 /// code. 00037 /// 00038 virtual void replaceMachineCodeForFunction(void *Old, void *New); 00039 00040 /// emitGlobalValueIndirectSym - Use the specified MachineCodeEmitter object 00041 /// to emit an indirect symbol which contains the address of the specified 00042 /// ptr. 00043 virtual void *emitGlobalValueIndirectSym(const GlobalValue* GV, void *ptr, 00044 MachineCodeEmitter &MCE); 00045 00046 /// emitFunctionStub - Use the specified MachineCodeEmitter object to emit a 00047 /// small native function that simply calls the function at the specified 00048 /// address. 00049 virtual void *emitFunctionStub(const Function* F, void *Fn, 00050 MachineCodeEmitter &MCE); 00051 00052 /// getPICJumpTableEntry - Returns the value of the jumptable entry for the 00053 /// specific basic block. 00054 virtual uintptr_t getPICJumpTableEntry(uintptr_t BB, uintptr_t JTBase); 00055 00056 /// getLazyResolverFunction - Expose the lazy resolver to the JIT. 00057 virtual LazyResolverFn getLazyResolverFunction(JITCompilerFn); 00058 00059 /// relocate - Before the JIT can run a block of code that has been emitted, 00060 /// it must rewrite the code to contain the actual addresses of any 00061 /// referenced global symbols. 00062 virtual void relocate(void *Function, MachineRelocation *MR, 00063 unsigned NumRelocs, unsigned char* GOTBase); 00064 00065 /// allocateThreadLocalMemory - Each target has its own way of 00066 /// handling thread local variables. This method returns a value only 00067 /// meaningful to the target. 00068 virtual char* allocateThreadLocalMemory(size_t size); 00069 00070 /// setPICBase / getPICBase - Getter / setter of PICBase, used to compute 00071 /// PIC jumptable entry. 00072 void setPICBase(uintptr_t Base) { PICBase = Base; } 00073 uintptr_t getPICBase() const { return PICBase; } 00074 }; 00075 } 00076 00077 #endif
This web site is hosted by the Computer Science Department at the University of Illinois at Urbana-Champaign.