Jia Liu | 8f5e8c1 | 2012-02-17 01:23:50 +0000 | [diff] [blame] | 1 | //===- MipsJITInfo.h - Mips Implementation of the JIT Interface -*- C++ -*-===// |
Bruno Cardoso Lopes | dca6cdd | 2011-07-21 16:28:51 +0000 | [diff] [blame] | 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 MipsJITInfo class. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef MIPSJITINFO_H |
| 15 | #define MIPSJITINFO_H |
| 16 | |
| 17 | #include "MipsMachineFunction.h" |
| 18 | #include "llvm/CodeGen/MachineConstantPool.h" |
| 19 | #include "llvm/CodeGen/MachineFunction.h" |
| 20 | #include "llvm/CodeGen/MachineJumpTableInfo.h" |
| 21 | #include "llvm/Target/TargetJITInfo.h" |
Bruno Cardoso Lopes | dca6cdd | 2011-07-21 16:28:51 +0000 | [diff] [blame] | 22 | |
| 23 | namespace llvm { |
| 24 | class MipsTargetMachine; |
| 25 | |
| 26 | class MipsJITInfo : public TargetJITInfo { |
| 27 | |
| 28 | bool IsPIC; |
| 29 | |
| 30 | public: |
| 31 | explicit MipsJITInfo() : |
| 32 | IsPIC(false) {} |
| 33 | |
| 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); |
| 40 | |
| 41 | // getStubLayout - Returns the size and alignment of the largest call stub |
| 42 | // on Mips. |
| 43 | virtual StubLayout getStubLayout(); |
| 44 | |
| 45 | /// emitFunctionStub - Use the specified JITCodeEmitter object to emit a |
| 46 | /// small native function that simply calls the function at the specified |
| 47 | /// address. |
Akira Hatanaka | 864f660 | 2012-06-14 21:10:56 +0000 | [diff] [blame] | 48 | virtual void *emitFunctionStub(const Function *F, void *Fn, |
| 49 | JITCodeEmitter &JCE); |
Bruno Cardoso Lopes | dca6cdd | 2011-07-21 16:28:51 +0000 | [diff] [blame] | 50 | |
| 51 | /// getLazyResolverFunction - Expose the lazy resolver to the JIT. |
| 52 | virtual LazyResolverFn getLazyResolverFunction(JITCompilerFn); |
| 53 | |
| 54 | /// relocate - Before the JIT can run a block of code that has been emitted, |
| 55 | /// it must rewrite the code to contain the actual addresses of any |
| 56 | /// referenced global symbols. |
| 57 | virtual void relocate(void *Function, MachineRelocation *MR, |
Akira Hatanaka | 864f660 | 2012-06-14 21:10:56 +0000 | [diff] [blame] | 58 | unsigned NumRelocs, unsigned char *GOTBase); |
Bruno Cardoso Lopes | dca6cdd | 2011-07-21 16:28:51 +0000 | [diff] [blame] | 59 | |
| 60 | /// Initialize - Initialize internal stage for the function being JITted. |
| 61 | void Initialize(const MachineFunction &MF, bool isPIC) { |
| 62 | IsPIC = isPIC; |
| 63 | } |
| 64 | |
| 65 | }; |
| 66 | } |
| 67 | |
| 68 | #endif |