Change allowsUnalignedMemoryAccesses to take type argument since some targets
[llvm/avr.git] / lib / Target / X86 / X86JITInfo.h
blob6a4e2148a5aacae601c2ae60d8cd16da1fb5daea
1 //===- X86JITInfo.h - X86 implementation of the JIT interface --*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains the X86 implementation of the TargetJITInfo class.
12 //===----------------------------------------------------------------------===//
14 #ifndef X86JITINFO_H
15 #define X86JITINFO_H
17 #include "llvm/Function.h"
18 #include "llvm/CodeGen/JITCodeEmitter.h"
19 #include "llvm/Target/TargetJITInfo.h"
21 namespace llvm {
22 class X86TargetMachine;
24 class X86JITInfo : public TargetJITInfo {
25 X86TargetMachine &TM;
26 uintptr_t PICBase;
27 char* TLSOffset;
28 public:
29 explicit X86JITInfo(X86TargetMachine &tm) : TM(tm) {
30 useGOT = 0;
31 TLSOffset = 0;
34 /// replaceMachineCodeForFunction - Make it so that calling the function
35 /// whose machine code is at OLD turns into a call to NEW, perhaps by
36 /// overwriting OLD with a branch to NEW. This is used for self-modifying
37 /// code.
38 ///
39 virtual void replaceMachineCodeForFunction(void *Old, void *New);
41 /// emitGlobalValueIndirectSym - Use the specified JITCodeEmitter object
42 /// to emit an indirect symbol which contains the address of the specified
43 /// ptr.
44 virtual void *emitGlobalValueIndirectSym(const GlobalValue* GV, void *ptr,
45 JITCodeEmitter &JCE);
47 /// emitFunctionStub - Use the specified JITCodeEmitter object to emit a
48 /// small native function that simply calls the function at the specified
49 /// address.
50 virtual void *emitFunctionStub(const Function* F, void *Fn,
51 JITCodeEmitter &JCE);
53 /// emitFunctionStubAtAddr - Use the specified JITCodeEmitter object to
54 /// emit a small native function that simply calls Fn. Emit the stub into
55 /// the supplied buffer.
56 virtual void emitFunctionStubAtAddr(const Function* F, void *Fn,
57 void *Buffer, JITCodeEmitter &JCE);
59 /// getPICJumpTableEntry - Returns the value of the jumptable entry for the
60 /// specific basic block.
61 virtual uintptr_t getPICJumpTableEntry(uintptr_t BB, uintptr_t JTBase);
63 /// getLazyResolverFunction - Expose the lazy resolver to the JIT.
64 virtual LazyResolverFn getLazyResolverFunction(JITCompilerFn);
66 /// relocate - Before the JIT can run a block of code that has been emitted,
67 /// it must rewrite the code to contain the actual addresses of any
68 /// referenced global symbols.
69 virtual void relocate(void *Function, MachineRelocation *MR,
70 unsigned NumRelocs, unsigned char* GOTBase);
72 /// allocateThreadLocalMemory - Each target has its own way of
73 /// handling thread local variables. This method returns a value only
74 /// meaningful to the target.
75 virtual char* allocateThreadLocalMemory(size_t size);
77 /// setPICBase / getPICBase - Getter / setter of PICBase, used to compute
78 /// PIC jumptable entry.
79 void setPICBase(uintptr_t Base) { PICBase = Base; }
80 uintptr_t getPICBase() const { return PICBase; }
84 #endif