1259698Sdim//==- SparcJITInfo.h - Sparc Implementation of the JIT Interface -*- C++ -*-==//
2259698Sdim//
3259698Sdim//                     The LLVM Compiler Infrastructure
4259698Sdim//
5259698Sdim// This file is distributed under the University of Illinois Open Source
6259698Sdim// License. See LICENSE.TXT for details.
7259698Sdim//
8259698Sdim//===----------------------------------------------------------------------===//
9259698Sdim//
10259698Sdim// This file contains the declaration of the SparcJITInfo class.
11259698Sdim//
12259698Sdim//===----------------------------------------------------------------------===//
13259698Sdim
14259698Sdim#ifndef SPARCJITINFO_H
15259698Sdim#define SPARCJITINFO_H
16259698Sdim
17259698Sdim#include "llvm/CodeGen/MachineConstantPool.h"
18259698Sdim#include "llvm/CodeGen/MachineFunction.h"
19259698Sdim#include "llvm/Target/TargetJITInfo.h"
20259698Sdim
21259698Sdimnamespace llvm {
22259698Sdimclass SparcTargetMachine;
23259698Sdim
24259698Sdimclass SparcJITInfo : public TargetJITInfo {
25259698Sdim
26259698Sdim  bool IsPIC;
27259698Sdim
28259698Sdim  public:
29259698Sdim  explicit SparcJITInfo()
30259698Sdim    :  IsPIC(false) {}
31259698Sdim
32259698Sdim  /// replaceMachineCodeForFunction - Make it so that calling the function
33259698Sdim  /// whose machine code is at OLD turns into a call to NEW, perhaps by
34259698Sdim  /// overwriting OLD with a branch to NEW.  This is used for self-modifying
35259698Sdim  /// code.
36259698Sdim  ///
37259698Sdim  virtual void replaceMachineCodeForFunction(void *Old, void *New);
38259698Sdim
39259698Sdim  // getStubLayout - Returns the size and alignment of the largest call stub
40259698Sdim  // on Sparc.
41259698Sdim  virtual StubLayout getStubLayout();
42259698Sdim
43259698Sdim
44259698Sdim  /// emitFunctionStub - Use the specified JITCodeEmitter object to emit a
45259698Sdim  /// small native function that simply calls the function at the specified
46259698Sdim  /// address.
47259698Sdim  virtual void *emitFunctionStub(const Function *F, void *Fn,
48259698Sdim                                 JITCodeEmitter &JCE);
49259698Sdim
50259698Sdim  /// getLazyResolverFunction - Expose the lazy resolver to the JIT.
51259698Sdim  virtual LazyResolverFn getLazyResolverFunction(JITCompilerFn);
52259698Sdim
53259698Sdim  /// relocate - Before the JIT can run a block of code that has been emitted,
54259698Sdim  /// it must rewrite the code to contain the actual addresses of any
55259698Sdim  /// referenced global symbols.
56259698Sdim  virtual void relocate(void *Function, MachineRelocation *MR,
57259698Sdim                        unsigned NumRelocs, unsigned char *GOTBase);
58259698Sdim
59259698Sdim  /// Initialize - Initialize internal stage for the function being JITted.
60259698Sdim  void Initialize(const MachineFunction &MF, bool isPIC) {
61259698Sdim    IsPIC = isPIC;
62259698Sdim  }
63259698Sdim
64259698Sdim};
65259698Sdim}
66259698Sdim
67259698Sdim#endif
68