• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===- MipsJITInfo.h - Mips 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 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"
22 #include "llvm/ADT/DenseMap.h"
23 #include "llvm/ADT/SmallVector.h"
24 
25 namespace llvm {
26 class MipsTargetMachine;
27 
28 class MipsJITInfo : public TargetJITInfo {
29 
30   bool IsPIC;
31 
32   public:
MipsJITInfo()33     explicit MipsJITInfo() :
34       IsPIC(false) {}
35 
36     /// replaceMachineCodeForFunction - Make it so that calling the function
37     /// whose machine code is at OLD turns into a call to NEW, perhaps by
38     /// overwriting OLD with a branch to NEW.  This is used for self-modifying
39     /// code.
40     ///
41     virtual void replaceMachineCodeForFunction(void *Old, void *New);
42 
43     // getStubLayout - Returns the size and alignment of the largest call stub
44     // on Mips.
45     virtual StubLayout getStubLayout();
46 
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);
52 
53     /// getLazyResolverFunction - Expose the lazy resolver to the JIT.
54     virtual LazyResolverFn getLazyResolverFunction(JITCompilerFn);
55 
56     /// relocate - Before the JIT can run a block of code that has been emitted,
57     /// it must rewrite the code to contain the actual addresses of any
58     /// referenced global symbols.
59     virtual void relocate(void *Function, MachineRelocation *MR,
60         unsigned NumRelocs, unsigned char* GOTBase);
61 
62     /// Initialize - Initialize internal stage for the function being JITted.
Initialize(const MachineFunction & MF,bool isPIC)63     void Initialize(const MachineFunction &MF, bool isPIC) {
64       IsPIC = isPIC;
65     }
66 
67 };
68 }
69 
70 #endif
71