LLVM API Documentation
00001 //===- SparcV9JITInfo.h - SparcV9 Target JIT interface ----------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file was developed by the LLVM research group and is distributed under 00006 // the University of Illinois Open Source License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file contains the SparcV9 implementation of the TargetJITInfo class, 00011 // which makes target-specific hooks available to the target-independent 00012 // LLVM JIT compiler. 00013 // 00014 //===----------------------------------------------------------------------===// 00015 00016 #ifndef SPARCV9JITINFO_H 00017 #define SPARCV9JITINFO_H 00018 00019 #include "llvm/Target/TargetJITInfo.h" 00020 00021 namespace llvm { 00022 class TargetMachine; 00023 00024 class SparcV9JITInfo : public TargetJITInfo { 00025 TargetMachine &TM; 00026 public: 00027 SparcV9JITInfo(TargetMachine &tm) : TM(tm) {useGOT = 0;} 00028 00029 /// addPassesToJITCompile - Add passes to the specified pass manager to 00030 /// implement a fast dynamic compiler for this target. Return true if this 00031 /// is not supported for this target. 00032 /// 00033 virtual void addPassesToJITCompile(FunctionPassManager &PM); 00034 00035 /// replaceMachineCodeForFunction - Make it so that calling the function 00036 /// whose machine code is at OLD turns into a call to NEW, perhaps by 00037 /// overwriting OLD with a branch to NEW. This is used for self-modifying 00038 /// code. 00039 /// 00040 virtual void replaceMachineCodeForFunction (void *Old, void *New); 00041 00042 00043 /// emitFunctionStub - Use the specified MachineCodeEmitter object to emit a 00044 /// small native function that simply calls the function at the specified 00045 /// address. Return the address of the resultant function. 00046 virtual void *emitFunctionStub(void *Fn, MachineCodeEmitter &MCE); 00047 00048 /// getLazyResolverFunction - This method is used to initialize the JIT, 00049 /// giving the target the function that should be used to compile a 00050 /// function, and giving the JIT the target function used to do the lazy 00051 /// resolving. 00052 virtual LazyResolverFn getLazyResolverFunction(JITCompilerFn); 00053 00054 /// relocate - Before the JIT can run a block of code that has been emitted, 00055 /// it must rewrite the code to contain the actual addresses of any 00056 /// referenced global symbols. 00057 virtual void relocate(void *Function, MachineRelocation *MR, 00058 unsigned NumRelocs, unsigned char* GOTBase); 00059 }; 00060 } 00061 00062 #endif