LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SimplifyLibCalls.h
Go to the documentation of this file.
1 //===- SimplifyLibCalls.h - Library call simplifier -------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file exposes an interface to build some C language libcalls for
11 // optimization passes that need to call the various functions.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #ifndef LLVM_TRANSFORMS_UTILS_SIMPLIFYLIBCALLS_H
16 #define LLVM_TRANSFORMS_UTILS_SIMPLIFYLIBCALLS_H
17 
18 namespace llvm {
19  class Value;
20  class CallInst;
21  class DataLayout;
22  class Instruction;
23  class TargetLibraryInfo;
24  class LibCallSimplifierImpl;
25 
26  /// LibCallSimplifier - This class implements a collection of optimizations
27  /// that replace well formed calls to library functions with a more optimal
28  /// form. For example, replacing 'printf("Hello!")' with 'puts("Hello!")'.
30  /// Impl - A pointer to the actual implementation of the library call
31  /// simplifier.
33  public:
35  bool UnsafeFPShrink);
36  virtual ~LibCallSimplifier();
37 
38  /// optimizeCall - Take the given call instruction and return a more
39  /// optimal value to replace the instruction with or 0 if a more
40  /// optimal form can't be found. Note that the returned value may
41  /// be equal to the instruction being optimized. In this case all
42  /// other instructions that use the given instruction were modified
43  /// and the given instruction is dead.
45 
46  /// replaceAllUsesWith - This method is used when the library call
47  /// simplifier needs to replace instructions other than the library
48  /// call being modified.
49  virtual void replaceAllUsesWith(Instruction *I, Value *With) const;
50  };
51 } // End llvm namespace
52 
53 #endif
static cl::opt< bool > UnsafeFPShrink("enable-double-float-shrink", cl::Hidden, cl::init(false), cl::desc("Enable unsafe double to float ""shrinking for math lib calls"))
LibCallSimplifier(const DataLayout *TD, const TargetLibraryInfo *TLI, bool UnsafeFPShrink)
virtual void replaceAllUsesWith(Instruction *I, Value *With) const
#define I(x, y, z)
Definition: MD5.cpp:54
Value * optimizeCall(CallInst *CI)
LLVM Value Representation.
Definition: Value.h:66
INITIALIZE_PASS(GlobalMerge,"global-merge","Global Merge", false, false) bool GlobalMerge const DataLayout * TD