LLVM API Documentation

X86JITInfo.h

Go to the documentation of this file.
00001 //===- X86JITInfo.h - X86 implementation of the 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 X86 implementation of the TargetJITInfo class.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef X86JITINFO_H
00015 #define X86JITINFO_H
00016 
00017 #include "llvm/Target/TargetJITInfo.h"
00018 
00019 namespace llvm {
00020   class X86TargetMachine;
00021   class IntrinsicLowering;
00022 
00023   class X86JITInfo : public TargetJITInfo {
00024     X86TargetMachine &TM;
00025   public:
00026     X86JITInfo(X86TargetMachine &tm) : TM(tm) {useGOT = 0;}
00027 
00028     /// addPassesToJITCompile - Add passes to the specified pass manager to
00029     /// implement a fast dynamic compiler for this target.  Return true if this
00030     /// is not supported for this target.
00031     ///
00032     virtual void addPassesToJITCompile(FunctionPassManager &PM);
00033 
00034     /// replaceMachineCodeForFunction - Make it so that calling the function
00035     /// whose machine code is at OLD turns into a call to NEW, perhaps by
00036     /// overwriting OLD with a branch to NEW.  This is used for self-modifying
00037     /// code.
00038     ///
00039     virtual void replaceMachineCodeForFunction(void *Old, void *New);
00040 
00041     /// emitFunctionStub - Use the specified MachineCodeEmitter object to emit a
00042     /// small native function that simply calls the function at the specified
00043     /// address.
00044     virtual void *emitFunctionStub(void *Fn, MachineCodeEmitter &MCE);
00045 
00046     /// getLazyResolverFunction - Expose the lazy resolver to the JIT.
00047     virtual LazyResolverFn getLazyResolverFunction(JITCompilerFn);
00048 
00049     /// relocate - Before the JIT can run a block of code that has been emitted,
00050     /// it must rewrite the code to contain the actual addresses of any
00051     /// referenced global symbols.
00052     virtual void relocate(void *Function, MachineRelocation *MR,
00053                           unsigned NumRelocs, unsigned char* GOTBase);
00054   };
00055 }
00056 
00057 #endif