LLVM API Documentation

AutoUpgrade.h

Go to the documentation of this file.
00001 //===-- llvm/Assembly/AutoUpgrade.h - AutoUpgrade Helpers --------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file was developed by Reid Spencer is distributed under the University 
00006 // of Illinois Open Source License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 //  These functions are implemented by the lib/VMCore/AutoUpgrade.cpp.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #ifndef LLVM_ASSEMBLY_AUTOUPGRADE_H
00015 #define LLVM_ASSEMBLY_AUTOUPGRADE_H
00016 
00017 #include <string>
00018 #include <vector>
00019 
00020 namespace llvm {
00021   class Function;
00022   class CallInst;
00023   class Instruction;
00024   class Value;
00025   class BasicBlock;
00026 
00027   /// This function inspects the Function \p F to see if it is an old overloaded
00028   /// intrinsic. If it is, the Function's name is changed to add a suffix that
00029   /// indicates the kind of arguments or result that it accepts. In LLVM release
00030   /// 1.7, the overloading of intrinsic functions was replaced with separate
00031   /// functions for each of the various argument sizes. This function implements
00032   /// the auto-upgrade feature from the old overloaded names to the new
00033   /// non-overloaded names. 
00034   /// @param F The Function to potentially auto-upgrade.
00035   /// @returns A corrected version of F, or 0 if no change necessary
00036   /// @brief Remove overloaded intrinsic function names.
00037   Function* UpgradeIntrinsicFunction(Function* F);
00038 
00039   /// In LLVM 1.7, the overloading of intrinsic functions was replaced with
00040   /// separate functions for each of the various argument sizes. This function
00041   /// implements the auto-upgrade feature from old overloaded names to the new
00042   /// non-overloaded names. This function inspects the CallInst \p CI to see 
00043   /// if it is a call to an old overloaded intrinsic. If it is, a new CallInst 
00044   /// is created that uses the correct Function and possibly casts the 
00045   /// argument and result to an unsigned type.
00046   /// @brief Get replacement instruction for overloaded intrinsic function call.
00047   void UpgradeIntrinsicCall(
00048     CallInst* CI, ///< The CallInst to potentially auto-upgrade.
00049     Function* newF = 0 ///< The new function for the call replacement.
00050   );
00051 
00052   /// Upgrade both the function and all the calls made to it, if that function
00053   /// needs to be upgraded. This is like a combination of the above two
00054   /// functions, UpgradeIntrinsicFunction and UpgradeIntrinsicCall. Note that
00055   /// the calls are replaced so this should only be used in a post-processing
00056   /// manner (i.e. after all assembly/bytecode has been read).
00057   bool UpgradeCallsToIntrinsic(Function* F);
00058 
00059 } // End llvm namespace
00060 
00061 #endif