1193323Sed//===-- llvm/AutoUpgrade.h - AutoUpgrade Helpers ----------------*- C++ -*-===// 2193323Sed// 3193323Sed// The LLVM Compiler Infrastructure 4193323Sed// 5193323Sed// This file is distributed under the University of Illinois Open Source 6193323Sed// License. See LICENSE.TXT for details. 7193323Sed// 8193323Sed//===----------------------------------------------------------------------===// 9193323Sed// 10263509Sdim// These functions are implemented by lib/IR/AutoUpgrade.cpp. 11193323Sed// 12193323Sed//===----------------------------------------------------------------------===// 13193323Sed 14193323Sed#ifndef LLVM_AUTOUPGRADE_H 15193323Sed#define LLVM_AUTOUPGRADE_H 16193323Sed 17193323Sednamespace llvm { 18263509Sdim class CallInst; 19263509Sdim class Constant; 20263509Sdim class Function; 21263509Sdim class Instruction; 22198090Srdivacky class Module; 23212904Sdim class GlobalVariable; 24263509Sdim class Type; 25263509Sdim class Value; 26193323Sed 27263509Sdim /// This is a more granular function that simply checks an intrinsic function 28193323Sed /// for upgrading, and returns true if it requires upgrading. It may return 29193323Sed /// null in NewFn if the all calls to the original intrinsic function 30193323Sed /// should be transformed to non-function-call instructions. 31193323Sed bool UpgradeIntrinsicFunction(Function *F, Function *&NewFn); 32193323Sed 33263509Sdim /// This is the complement to the above, replacing a specific call to an 34193323Sed /// intrinsic function with a call to the specified new function. 35193323Sed void UpgradeIntrinsicCall(CallInst *CI, Function *NewFn); 36263509Sdim 37263509Sdim /// This is an auto-upgrade hook for any old intrinsic function syntaxes 38263509Sdim /// which need to have both the function updated as well as all calls updated 39263509Sdim /// to the new function. This should only be run in a post-processing fashion 40193323Sed /// so that it can update all calls to the old function. 41193323Sed void UpgradeCallsToIntrinsic(Function* F); 42193323Sed 43212904Sdim /// This checks for global variables which should be upgraded. It returns true 44212904Sdim /// if it requires upgrading. 45212904Sdim bool UpgradeGlobalVariable(GlobalVariable *GV); 46263509Sdim 47263509Sdim /// If the TBAA tag for the given instruction uses the scalar TBAA format, 48263509Sdim /// we upgrade it to the struct-path aware TBAA format. 49263509Sdim void UpgradeInstWithTBAATag(Instruction *I); 50263509Sdim 51263509Sdim /// This is an auto-upgrade for bitcast between pointers with different 52263509Sdim /// address spaces: the instruction is replaced by a pair ptrtoint+inttoptr. 53263509Sdim Instruction *UpgradeBitCastInst(unsigned Opc, Value *V, Type *DestTy, 54263509Sdim Instruction *&Temp); 55263509Sdim 56263509Sdim /// This is an auto-upgrade for bitcast constant expression between pointers 57263509Sdim /// with different address spaces: the instruction is replaced by a pair 58263509Sdim /// ptrtoint+inttoptr. 59263509Sdim Value *UpgradeBitCastExpr(unsigned Opc, Constant *C, Type *DestTy); 60263509Sdim 61263509Sdim /// Check the debug info version number, if it is out-dated, drop the debug 62263509Sdim /// info. Return true if module is modified. 63263509Sdim bool UpgradeDebugInfo(Module &M); 64193323Sed} // End llvm namespace 65193323Sed 66193323Sed#endif 67