1234353Sdim//===- MipsJITInfo.h - Mips Implementation of the JIT Interface -*- C++ -*-===// 2226584Sdim// 3226584Sdim// The LLVM Compiler Infrastructure 4226584Sdim// 5226584Sdim// This file is distributed under the University of Illinois Open Source 6226584Sdim// License. See LICENSE.TXT for details. 7226584Sdim// 8226584Sdim//===----------------------------------------------------------------------===// 9226584Sdim// 10226584Sdim// This file contains the declaration of the MipsJITInfo class. 11226584Sdim// 12226584Sdim//===----------------------------------------------------------------------===// 13226584Sdim 14226584Sdim#ifndef MIPSJITINFO_H 15226584Sdim#define MIPSJITINFO_H 16226584Sdim 17226584Sdim#include "MipsMachineFunction.h" 18226584Sdim#include "llvm/CodeGen/MachineConstantPool.h" 19226584Sdim#include "llvm/CodeGen/MachineFunction.h" 20226584Sdim#include "llvm/CodeGen/MachineJumpTableInfo.h" 21226584Sdim#include "llvm/Target/TargetJITInfo.h" 22226584Sdim 23226584Sdimnamespace llvm { 24226584Sdimclass MipsTargetMachine; 25226584Sdim 26226584Sdimclass MipsJITInfo : public TargetJITInfo { 27226584Sdim 28226584Sdim bool IsPIC; 29244628Sdim bool IsLittleEndian; 30226584Sdim 31226584Sdim public: 32226584Sdim explicit MipsJITInfo() : 33244628Sdim IsPIC(false), IsLittleEndian(true) {} 34226584Sdim 35226584Sdim /// replaceMachineCodeForFunction - Make it so that calling the function 36226584Sdim /// whose machine code is at OLD turns into a call to NEW, perhaps by 37226584Sdim /// overwriting OLD with a branch to NEW. This is used for self-modifying 38226584Sdim /// code. 39226584Sdim /// 40226584Sdim virtual void replaceMachineCodeForFunction(void *Old, void *New); 41226584Sdim 42226584Sdim // getStubLayout - Returns the size and alignment of the largest call stub 43226584Sdim // on Mips. 44226584Sdim virtual StubLayout getStubLayout(); 45226584Sdim 46226584Sdim /// emitFunctionStub - Use the specified JITCodeEmitter object to emit a 47226584Sdim /// small native function that simply calls the function at the specified 48226584Sdim /// address. 49239462Sdim virtual void *emitFunctionStub(const Function *F, void *Fn, 50239462Sdim JITCodeEmitter &JCE); 51226584Sdim 52226584Sdim /// getLazyResolverFunction - Expose the lazy resolver to the JIT. 53226584Sdim virtual LazyResolverFn getLazyResolverFunction(JITCompilerFn); 54226584Sdim 55226584Sdim /// relocate - Before the JIT can run a block of code that has been emitted, 56226584Sdim /// it must rewrite the code to contain the actual addresses of any 57226584Sdim /// referenced global symbols. 58226584Sdim virtual void relocate(void *Function, MachineRelocation *MR, 59239462Sdim unsigned NumRelocs, unsigned char *GOTBase); 60226584Sdim 61226584Sdim /// Initialize - Initialize internal stage for the function being JITted. 62244628Sdim void Initialize(const MachineFunction &MF, bool isPIC, 63244628Sdim bool isLittleEndian) { 64226584Sdim IsPIC = isPIC; 65244628Sdim IsLittleEndian = isLittleEndian; 66226584Sdim } 67226584Sdim 68226584Sdim}; 69226584Sdim} 70226584Sdim 71226584Sdim#endif 72