1 //===-- llvm/Assembly/AutoUpgrade.h - AutoUpgrade Helpers --------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by Reid Spencer is distributed under the University
6 // of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // These functions are implemented by the lib/VMCore/AutoUpgrade.cpp.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_ASSEMBLY_AUTOUPGRADE_H
15 #define LLVM_ASSEMBLY_AUTOUPGRADE_H
24 /// This function determines if the \p Name provides is a name for which the
25 /// auto-upgrade to a non-overloaded name applies.
26 /// @returns True if the function name is upgradeable, false otherwise.
27 /// @brief Determine if a name is an upgradeable intrinsic name.
28 bool IsUpgradeableIntrinsicName(const std::string& Name);
30 /// This function inspects the Function \p F to see if it is an old overloaded
31 /// intrinsic. If it is, the Function's name is changed to add a suffix that
32 /// indicates the kind of arguments or result that it accepts. In LLVM release
33 /// 1.7, the overloading of intrinsic functions was replaced with separate
34 /// functions for each of the various argument sizes. This function implements
35 /// the auto-upgrade feature from the old overloaded names to the new
36 /// non-overloaded names.
37 /// @param F The Function to potentially auto-upgrade.
38 /// @returns A corrected version of F, or 0 if no change necessary
39 /// @brief Remove overloaded intrinsic function names.
40 Function* UpgradeIntrinsicFunction(Function* F);
42 /// In LLVM 1.7, the overloading of intrinsic functions was replaced with
43 /// separate functions for each of the various argument sizes. This function
44 /// implements the auto-upgrade feature from old overloaded names to the new
45 /// non-overloaded names. This function inspects the CallInst \p CI to see
46 /// if it is a call to an old overloaded intrinsic. If it is, a new CallInst
47 /// is created that uses the correct Function and possibly casts the
48 /// argument and result to an unsigned type. The caller can use the
49 /// returned Instruction to replace the existing one. Note that the
50 /// Instruction* returned could be a CallInst or a CastInst depending on
51 /// whether casting was necessary.
52 /// @param CI The CallInst to potentially auto-upgrade.
53 /// @returns An instrution to replace \p CI with.
54 /// @brief Get replacement instruction for overloaded intrinsic function call.
55 Instruction* UpgradeIntrinsicCall(CallInst* CI);
57 /// Upgrade both the function and all the calls made to it, if that function
58 /// needs to be upgraded. This is like a combination of the above two
59 /// functions, UpgradeIntrinsicFunction and UpgradeIntrinsicCall. Note that
60 /// the calls are replaced so this should only be used in a post-processing
61 /// manner (i.e. after all assembly/bytecode has been read).
62 bool UpgradeCallsToIntrinsic(Function* F);
64 } // End llvm namespace