Venkatraman Govindaraju | 2ea4c28 | 2013-10-08 07:15:22 +0000 | [diff] [blame^] | 1 | //==- SparcJITInfo.h - Sparc 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 declaration of the SparcJITInfo class. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef SPARCJITINFO_H |
| 15 | #define SPARCJITINFO_H |
| 16 | |
| 17 | #include "llvm/CodeGen/MachineConstantPool.h" |
| 18 | #include "llvm/CodeGen/MachineFunction.h" |
| 19 | #include "llvm/Target/TargetJITInfo.h" |
| 20 | |
| 21 | namespace llvm { |
| 22 | class SparcTargetMachine; |
| 23 | |
| 24 | class SparcJITInfo : public TargetJITInfo { |
| 25 | |
| 26 | bool IsPIC; |
| 27 | |
| 28 | public: |
| 29 | explicit SparcJITInfo() |
| 30 | : IsPIC(false) {} |
| 31 | |
| 32 | /// replaceMachineCodeForFunction - Make it so that calling the function |
| 33 | /// whose machine code is at OLD turns into a call to NEW, perhaps by |
| 34 | /// overwriting OLD with a branch to NEW. This is used for self-modifying |
| 35 | /// code. |
| 36 | /// |
| 37 | virtual void replaceMachineCodeForFunction(void *Old, void *New); |
| 38 | |
| 39 | // getStubLayout - Returns the size and alignment of the largest call stub |
| 40 | // on Sparc. |
| 41 | virtual StubLayout getStubLayout(); |
| 42 | |
| 43 | |
| 44 | /// emitFunctionStub - Use the specified JITCodeEmitter object to emit a |
| 45 | /// small native function that simply calls the function at the specified |
| 46 | /// address. |
| 47 | virtual void *emitFunctionStub(const Function *F, void *Fn, |
| 48 | JITCodeEmitter &JCE); |
| 49 | |
| 50 | /// getLazyResolverFunction - Expose the lazy resolver to the JIT. |
| 51 | virtual LazyResolverFn getLazyResolverFunction(JITCompilerFn); |
| 52 | |
| 53 | /// relocate - Before the JIT can run a block of code that has been emitted, |
| 54 | /// it must rewrite the code to contain the actual addresses of any |
| 55 | /// referenced global symbols. |
| 56 | virtual void relocate(void *Function, MachineRelocation *MR, |
| 57 | unsigned NumRelocs, unsigned char *GOTBase); |
| 58 | |
| 59 | /// Initialize - Initialize internal stage for the function being JITted. |
| 60 | void Initialize(const MachineFunction &MF, bool isPIC) { |
| 61 | IsPIC = isPIC; |
| 62 | } |
| 63 | |
| 64 | }; |
| 65 | } |
| 66 | |
| 67 | #endif |