LLVM API Documentation

IntrinsicLowering.h

Go to the documentation of this file.
00001 //===-- IntrinsicLowering.h - Intrinsic Function Lowering -------*- 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 defines the IntrinsicLowering interface.  This interface allows
00011 // addition of domain-specific or front-end specific intrinsics to LLVM without
00012 // having to modify all of the C backend or interpreter.
00013 //
00014 //===----------------------------------------------------------------------===//
00015 
00016 #ifndef LLVM_CODEGEN_INTRINSICLOWERING_H
00017 #define LLVM_CODEGEN_INTRINSICLOWERING_H
00018 
00019 #include "llvm/Intrinsics.h"
00020 
00021 namespace llvm {
00022   class CallInst;
00023   class Module;
00024   class TargetData;
00025 
00026   class IntrinsicLowering {
00027     const TargetData& TD;
00028   public:
00029     explicit IntrinsicLowering(const TargetData &td) : TD(td) {}
00030 
00031     /// AddPrototypes - This method, if called, causes all of the prototypes
00032     /// that might be needed by an intrinsic lowering implementation to be
00033     /// inserted into the module specified.
00034     void AddPrototypes(Module &M);
00035 
00036     /// LowerIntrinsicCall - This method replaces a call with the LLVM function
00037     /// which should be used to implement the specified intrinsic function call.
00038     /// If an intrinsic function must be implemented by the code generator 
00039     /// (such as va_start), this function should print a message and abort.
00040     ///
00041     /// Otherwise, if an intrinsic function call can be lowered, the code to
00042     /// implement it (often a call to a non-intrinsic function) is inserted
00043     /// _after_ the call instruction and the call is deleted.  The caller must
00044     /// be capable of handling this kind of change.
00045     ///
00046     void LowerIntrinsicCall(CallInst *CI);
00047   };
00048 }
00049 
00050 #endif