LLVM API Documentation
00001 //===- AutoUpgrade.h - AutoUpgrade Helpers ----------------------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // These functions are implemented by lib/IR/AutoUpgrade.cpp. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 #ifndef LLVM_IR_AUTOUPGRADE_H 00015 #define LLVM_IR_AUTOUPGRADE_H 00016 00017 #include <string> 00018 00019 namespace llvm { 00020 class CallInst; 00021 class Constant; 00022 class Function; 00023 class Instruction; 00024 class Module; 00025 class GlobalVariable; 00026 class Type; 00027 class Value; 00028 00029 /// This is a more granular function that simply checks an intrinsic function 00030 /// for upgrading, and returns true if it requires upgrading. It may return 00031 /// null in NewFn if the all calls to the original intrinsic function 00032 /// should be transformed to non-function-call instructions. 00033 bool UpgradeIntrinsicFunction(Function *F, Function *&NewFn); 00034 00035 /// This is the complement to the above, replacing a specific call to an 00036 /// intrinsic function with a call to the specified new function. 00037 void UpgradeIntrinsicCall(CallInst *CI, Function *NewFn); 00038 00039 /// This is an auto-upgrade hook for any old intrinsic function syntaxes 00040 /// which need to have both the function updated as well as all calls updated 00041 /// to the new function. This should only be run in a post-processing fashion 00042 /// so that it can update all calls to the old function. 00043 void UpgradeCallsToIntrinsic(Function* F); 00044 00045 /// This checks for global variables which should be upgraded. It returns true 00046 /// if it requires upgrading. 00047 bool UpgradeGlobalVariable(GlobalVariable *GV); 00048 00049 /// If the TBAA tag for the given instruction uses the scalar TBAA format, 00050 /// we upgrade it to the struct-path aware TBAA format. 00051 void UpgradeInstWithTBAATag(Instruction *I); 00052 00053 /// This is an auto-upgrade for bitcast between pointers with different 00054 /// address spaces: the instruction is replaced by a pair ptrtoint+inttoptr. 00055 Instruction *UpgradeBitCastInst(unsigned Opc, Value *V, Type *DestTy, 00056 Instruction *&Temp); 00057 00058 /// This is an auto-upgrade for bitcast constant expression between pointers 00059 /// with different address spaces: the instruction is replaced by a pair 00060 /// ptrtoint+inttoptr. 00061 Value *UpgradeBitCastExpr(unsigned Opc, Constant *C, Type *DestTy); 00062 00063 /// Check the debug info version number, if it is out-dated, drop the debug 00064 /// info. Return true if module is modified. 00065 bool UpgradeDebugInfo(Module &M); 00066 00067 /// Upgrade a metadata string constant in place. 00068 void UpgradeMDStringConstant(std::string &String); 00069 } // End llvm namespace 00070 00071 #endif