|
|
|||
File indexing completed on 2026-05-10 08:43:57
0001 //===- AutoUpgrade.h - AutoUpgrade Helpers ----------------------*- C++ -*-===// 0002 // 0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 0004 // See https://llvm.org/LICENSE.txt for license information. 0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 0006 // 0007 //===----------------------------------------------------------------------===// 0008 // 0009 // These functions are implemented by lib/IR/AutoUpgrade.cpp. 0010 // 0011 //===----------------------------------------------------------------------===// 0012 0013 #ifndef LLVM_IR_AUTOUPGRADE_H 0014 #define LLVM_IR_AUTOUPGRADE_H 0015 0016 #include "llvm/ADT/StringRef.h" 0017 #include <vector> 0018 0019 namespace llvm { 0020 class AttrBuilder; 0021 class CallBase; 0022 class Constant; 0023 class Function; 0024 class Instruction; 0025 class GlobalVariable; 0026 class MDNode; 0027 class Module; 0028 class StringRef; 0029 class Type; 0030 class Value; 0031 0032 template <typename T> class OperandBundleDefT; 0033 using OperandBundleDef = OperandBundleDefT<Value *>; 0034 0035 /// This is a more granular function that simply checks an intrinsic function 0036 /// for upgrading, and returns true if it requires upgrading. It may return 0037 /// null in NewFn if the all calls to the original intrinsic function 0038 /// should be transformed to non-function-call instructions. 0039 bool UpgradeIntrinsicFunction(Function *F, Function *&NewFn, 0040 bool CanUpgradeDebugIntrinsicsToRecords = true); 0041 0042 /// This is the complement to the above, replacing a specific call to an 0043 /// intrinsic function with a call to the specified new function. 0044 void UpgradeIntrinsicCall(CallBase *CB, Function *NewFn); 0045 0046 // This upgrades the comment for objc retain release markers in inline asm 0047 // calls 0048 void UpgradeInlineAsmString(std::string *AsmStr); 0049 0050 /// This is an auto-upgrade hook for any old intrinsic function syntaxes 0051 /// which need to have both the function updated as well as all calls updated 0052 /// to the new function. This should only be run in a post-processing fashion 0053 /// so that it can update all calls to the old function. 0054 void UpgradeCallsToIntrinsic(Function* F); 0055 0056 /// This checks for global variables which should be upgraded. If it requires 0057 /// upgrading, returns a pointer to the upgraded variable. 0058 GlobalVariable *UpgradeGlobalVariable(GlobalVariable *GV); 0059 0060 /// This checks for module flags which should be upgraded. It returns true if 0061 /// module is modified. 0062 bool UpgradeModuleFlags(Module &M); 0063 0064 /// Convert calls to ARC runtime functions to intrinsic calls and upgrade the 0065 /// old retain release marker to new module flag format. 0066 void UpgradeARCRuntime(Module &M); 0067 0068 void UpgradeSectionAttributes(Module &M); 0069 0070 /// Correct any IR that is relying on old function attribute behavior. 0071 void UpgradeFunctionAttributes(Function &F); 0072 0073 /// If the given TBAA tag uses the scalar TBAA format, create a new node 0074 /// corresponding to the upgrade to the struct-path aware TBAA format. 0075 /// Otherwise return the \p TBAANode itself. 0076 MDNode *UpgradeTBAANode(MDNode &TBAANode); 0077 0078 /// This is an auto-upgrade for bitcast between pointers with different 0079 /// address spaces: the instruction is replaced by a pair ptrtoint+inttoptr. 0080 Instruction *UpgradeBitCastInst(unsigned Opc, Value *V, Type *DestTy, 0081 Instruction *&Temp); 0082 0083 /// This is an auto-upgrade for bitcast constant expression between pointers 0084 /// with different address spaces: the instruction is replaced by a pair 0085 /// ptrtoint+inttoptr. 0086 Constant *UpgradeBitCastExpr(unsigned Opc, Constant *C, Type *DestTy); 0087 0088 /// Check the debug info version number, if it is out-dated, drop the debug 0089 /// info. Return true if module is modified. 0090 bool UpgradeDebugInfo(Module &M); 0091 0092 /// Check whether a string looks like an old loop attachment tag. 0093 inline bool mayBeOldLoopAttachmentTag(StringRef Name) { 0094 return Name.starts_with("llvm.vectorizer."); 0095 } 0096 0097 /// Upgrade the loop attachment metadata node. 0098 MDNode *upgradeInstructionLoopAttachment(MDNode &N); 0099 0100 /// Upgrade the datalayout string by adding a section for address space 0101 /// pointers. 0102 std::string UpgradeDataLayoutString(StringRef DL, StringRef Triple); 0103 0104 /// Upgrade attributes that changed format or kind. 0105 void UpgradeAttributes(AttrBuilder &B); 0106 0107 /// Upgrade operand bundles (without knowing about their user instruction). 0108 void UpgradeOperandBundles(std::vector<OperandBundleDef> &OperandBundles); 0109 0110 } // End llvm namespace 0111 0112 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|