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/IR/Intrinsics.h"
00020 
00021 namespace llvm {
00022   class CallInst;
00023   class Module;
00024   class DataLayout;
00025 
00026   class IntrinsicLowering {
00027     const DataLayout& DL;
00028 
00029     
00030     bool Warned;
00031   public:
00032     explicit IntrinsicLowering(const DataLayout &DL) :
00033       DL(DL), Warned(false) {}
00034 
00035     /// AddPrototypes - This method, if called, causes all of the prototypes
00036     /// that might be needed by an intrinsic lowering implementation to be
00037     /// inserted into the module specified.
00038     void AddPrototypes(Module &M);
00039 
00040     /// LowerIntrinsicCall - This method replaces a call with the LLVM function
00041     /// which should be used to implement the specified intrinsic function call.
00042     /// If an intrinsic function must be implemented by the code generator 
00043     /// (such as va_start), this function should print a message and abort.
00044     ///
00045     /// Otherwise, if an intrinsic function call can be lowered, the code to
00046     /// implement it (often a call to a non-intrinsic function) is inserted
00047     /// _after_ the call instruction and the call is deleted.  The caller must
00048     /// be capable of handling this kind of change.
00049     ///
00050     void LowerIntrinsicCall(CallInst *CI);
00051 
00052     /// LowerToByteSwap - Replace a call instruction into a call to bswap
00053     /// intrinsic. Return false if it has determined the call is not a
00054     /// simple integer bswap.
00055     static bool LowerToByteSwap(CallInst *CI);
00056   };
00057 }
00058 
00059 #endif