LLVM API Documentation
00001 //===- AlphaJITInfo.h - Alpha impl. of the JIT interface ----*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file contains the Alpha implementation of the TargetJITInfo class. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 #ifndef ALPHA_JITINFO_H 00015 #define ALPHA_JITINFO_H 00016 00017 #include "llvm/Target/TargetJITInfo.h" 00018 #include <map> 00019 00020 namespace llvm { 00021 class TargetMachine; 00022 00023 class AlphaJITInfo : public TargetJITInfo { 00024 protected: 00025 TargetMachine &TM; 00026 00027 //because gpdist are paired and relative to the pc of the first inst, 00028 //we need to have some state 00029 std::map<std::pair<void*, int>, void*> gpdistmap; 00030 public: 00031 explicit AlphaJITInfo(TargetMachine &tm) : TM(tm) 00032 { useGOT = true; } 00033 00034 virtual void *emitFunctionStub(const Function* F, void *Fn, 00035 JITCodeEmitter &JCE); 00036 virtual LazyResolverFn getLazyResolverFunction(JITCompilerFn); 00037 virtual void relocate(void *Function, MachineRelocation *MR, 00038 unsigned NumRelocs, unsigned char* GOTBase); 00039 00040 /// replaceMachineCodeForFunction - Make it so that calling the function 00041 /// whose machine code is at OLD turns into a call to NEW, perhaps by 00042 /// overwriting OLD with a branch to NEW. This is used for self-modifying 00043 /// code. 00044 /// 00045 virtual void replaceMachineCodeForFunction(void *Old, void *New); 00046 private: 00047 static const unsigned GOToffset = 4096; 00048 00049 }; 00050 } 00051 00052 #endif