blob: 637a31866034a349639da5d66f2af4faab9f5071 [file] [log] [blame]
Jia Liu8f5e8c12012-02-17 01:23:50 +00001//===- MipsJITInfo.h - Mips Implementation of the JIT Interface -*- C++ -*-===//
Bruno Cardoso Lopesdca6cdd2011-07-21 16:28:51 +00002//
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 Lopesdca6cdd2011-07-21 16:28:51 +000022
23namespace llvm {
24class MipsTargetMachine;
25
26class 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 Hatanaka864f6602012-06-14 21:10:56 +000048 virtual void *emitFunctionStub(const Function *F, void *Fn,
49 JITCodeEmitter &JCE);
Bruno Cardoso Lopesdca6cdd2011-07-21 16:28:51 +000050
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 Hatanaka864f6602012-06-14 21:10:56 +000058 unsigned NumRelocs, unsigned char *GOTBase);
Bruno Cardoso Lopesdca6cdd2011-07-21 16:28:51 +000059
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