1//==- SparcJITInfo.h - Sparc 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 SparcJITInfo class.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef SPARCJITINFO_H
15#define SPARCJITINFO_H
16
17#include "llvm/CodeGen/MachineConstantPool.h"
18#include "llvm/CodeGen/MachineFunction.h"
19#include "llvm/Target/TargetJITInfo.h"
20
21namespace llvm {
22class SparcTargetMachine;
23
24class SparcJITInfo : public TargetJITInfo {
25
26  bool IsPIC;
27
28  public:
29  explicit SparcJITInfo()
30    :  IsPIC(false) {}
31
32  /// replaceMachineCodeForFunction - Make it so that calling the function
33  /// whose machine code is at OLD turns into a call to NEW, perhaps by
34  /// overwriting OLD with a branch to NEW.  This is used for self-modifying
35  /// code.
36  ///
37  void replaceMachineCodeForFunction(void *Old, void *New) override;
38
39  // getStubLayout - Returns the size and alignment of the largest call stub
40  // on Sparc.
41  StubLayout getStubLayout() override;
42
43
44  /// emitFunctionStub - Use the specified JITCodeEmitter object to emit a
45  /// small native function that simply calls the function at the specified
46  /// address.
47  void *emitFunctionStub(const Function *F, void *Fn,
48                         JITCodeEmitter &JCE) override;
49
50  /// getLazyResolverFunction - Expose the lazy resolver to the JIT.
51  LazyResolverFn getLazyResolverFunction(JITCompilerFn) override;
52
53  /// relocate - Before the JIT can run a block of code that has been emitted,
54  /// it must rewrite the code to contain the actual addresses of any
55  /// referenced global symbols.
56  void relocate(void *Function, MachineRelocation *MR,
57                unsigned NumRelocs, unsigned char *GOTBase) override;
58
59  /// Initialize - Initialize internal stage for the function being JITted.
60  void Initialize(const MachineFunction &MF, bool isPIC) {
61    IsPIC = isPIC;
62  }
63
64};
65}
66
67#endif
68