correct the type of two intrinsics, add int_ppc_altivec_vmladduhm
[oota-llvm.git] / include / llvm / Assembly / AutoUpgrade.h
1 //===-- llvm/Assembly/AutoUpgrade.h - AutoUpgrade Helpers --------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by Reid Spencer is distributed under the University 
6 // of Illinois Open Source License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 //  These functions are implemented by the lib/VMCore/AutoUpgrade.cpp.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_ASSEMBLY_AUTOUPGRADE_H
15 #define LLVM_ASSEMBLY_AUTOUPGRADE_H
16
17 #include <string>
18 #include <vector>
19
20 namespace llvm {
21   class Function;
22   class CallInst;
23   class Instruction;
24   class Value;
25   class BasicBlock;
26
27   /// This function inspects the Function \p F to see if it is an old overloaded
28   /// intrinsic. If it is, the Function's name is changed to add a suffix that
29   /// indicates the kind of arguments or result that it accepts. In LLVM release
30   /// 1.7, the overloading of intrinsic functions was replaced with separate
31   /// functions for each of the various argument sizes. This function implements
32   /// the auto-upgrade feature from the old overloaded names to the new
33   /// non-overloaded names. 
34   /// @param F The Function to potentially auto-upgrade.
35   /// @returns A corrected version of F, or 0 if no change necessary
36   /// @brief Remove overloaded intrinsic function names.
37   Function* UpgradeIntrinsicFunction(Function* F);
38
39   /// In LLVM 1.7, the overloading of intrinsic functions was replaced with
40   /// separate functions for each of the various argument sizes. This function
41   /// implements the auto-upgrade feature from old overloaded names to the new
42   /// non-overloaded names. This function inspects the CallInst \p CI to see 
43   /// if it is a call to an old overloaded intrinsic. If it is, a new CallInst 
44   /// is created that uses the correct Function and possibly casts the 
45   /// argument and result to an unsigned type.
46   /// @param CI The CallInst to potentially auto-upgrade.
47   /// @brief Get replacement instruction for overloaded intrinsic function call.
48   void UpgradeIntrinsicCall(CallInst* CI, Function* newF = 0);
49
50   /// Upgrade both the function and all the calls made to it, if that function
51   /// needs to be upgraded. This is like a combination of the above two
52   /// functions, UpgradeIntrinsicFunction and UpgradeIntrinsicCall. Note that
53   /// the calls are replaced so this should only be used in a post-processing
54   /// manner (i.e. after all assembly/bytecode has been read).
55   bool UpgradeCallsToIntrinsic(Function* F);
56
57 } // End llvm namespace
58
59 #endif