X86JITInfo.h revision c4c6257c1a154279bf10e9498d46d6c1793dbaa7
11e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner//===- X86JITInfo.h - X86 implementation of the JIT interface --*- C++ -*-===// 20e0a7a45d3d0a8c865a078459d2e1c6d8967a100Misha Brukman// 31e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner// The LLVM Compiler Infrastructure 41e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner// 51e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner// This file was developed by the LLVM research group and is distributed under 61e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner// the University of Illinois Open Source License. See LICENSE.TXT for details. 70e0a7a45d3d0a8c865a078459d2e1c6d8967a100Misha Brukman// 81e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner//===----------------------------------------------------------------------===// 91e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner// 101e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner// This file contains the X86 implementation of the TargetJITInfo class. 111e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner// 121e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner//===----------------------------------------------------------------------===// 131e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner 141e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner#ifndef X86JITINFO_H 151e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner#define X86JITINFO_H 161e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner 171e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner#include "llvm/Target/TargetJITInfo.h" 181e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner 191e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattnernamespace llvm { 20c4c6257c1a154279bf10e9498d46d6c1793dbaa7Evan Cheng class X86TargetMachine; 214482715f3d1c165be82bd5aed07231f956e472efChris Lattner class IntrinsicLowering; 224482715f3d1c165be82bd5aed07231f956e472efChris Lattner 231e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner class X86JITInfo : public TargetJITInfo { 24c4c6257c1a154279bf10e9498d46d6c1793dbaa7Evan Cheng X86TargetMachine &TM; 251e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner public: 26c4c6257c1a154279bf10e9498d46d6c1793dbaa7Evan Cheng X86JITInfo(X86TargetMachine &tm) : TM(tm) {useGOT = 0;} 271e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner 281e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner /// addPassesToJITCompile - Add passes to the specified pass manager to 291e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner /// implement a fast dynamic compiler for this target. Return true if this 301e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner /// is not supported for this target. 311e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner /// 321e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner virtual void addPassesToJITCompile(FunctionPassManager &PM); 330e0a7a45d3d0a8c865a078459d2e1c6d8967a100Misha Brukman 341e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner /// replaceMachineCodeForFunction - Make it so that calling the function 351e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner /// whose machine code is at OLD turns into a call to NEW, perhaps by 361e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner /// overwriting OLD with a branch to NEW. This is used for self-modifying 371e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner /// code. 381e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner /// 39f70e0c216c074bd2ae2b08178f5512849545db4eChris Lattner virtual void replaceMachineCodeForFunction(void *Old, void *New); 400e0a7a45d3d0a8c865a078459d2e1c6d8967a100Misha Brukman 4189d64e262cb4eb075e039bcc10813f77d60f1ed8Chris Lattner /// emitFunctionStub - Use the specified MachineCodeEmitter object to emit a 4289d64e262cb4eb075e039bcc10813f77d60f1ed8Chris Lattner /// small native function that simply calls the function at the specified 4389d64e262cb4eb075e039bcc10813f77d60f1ed8Chris Lattner /// address. 4489d64e262cb4eb075e039bcc10813f77d60f1ed8Chris Lattner virtual void *emitFunctionStub(void *Fn, MachineCodeEmitter &MCE); 4589d64e262cb4eb075e039bcc10813f77d60f1ed8Chris Lattner 4689d64e262cb4eb075e039bcc10813f77d60f1ed8Chris Lattner /// getLazyResolverFunction - Expose the lazy resolver to the JIT. 4789d64e262cb4eb075e039bcc10813f77d60f1ed8Chris Lattner virtual LazyResolverFn getLazyResolverFunction(JITCompilerFn); 4889d64e262cb4eb075e039bcc10813f77d60f1ed8Chris Lattner 4989d64e262cb4eb075e039bcc10813f77d60f1ed8Chris Lattner /// relocate - Before the JIT can run a block of code that has been emitted, 5089d64e262cb4eb075e039bcc10813f77d60f1ed8Chris Lattner /// it must rewrite the code to contain the actual addresses of any 5189d64e262cb4eb075e039bcc10813f77d60f1ed8Chris Lattner /// referenced global symbols. 5289d64e262cb4eb075e039bcc10813f77d60f1ed8Chris Lattner virtual void relocate(void *Function, MachineRelocation *MR, 53908bc862d58bdb66d22a6a58bddb4e108a64e469Andrew Lenharth unsigned NumRelocs, unsigned char* GOTBase); 541e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner }; 551e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner} 561e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner 571e60a9165dc4d6ce5650dacc026f2942696af920Chris Lattner#endif 58