mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 04:30:12 +00:00
2920a71663
This patch migrates the math library call simplifications from the simplify-libcalls pass into the instcombine library call simplifier. I have typically migrated just one simplifier at a time, but the math simplifiers are interdependent because: 1. CosOpt, PowOpt, and Exp2Opt all depend on UnaryDoubleFPOpt. 2. CosOpt, PowOpt, Exp2Opt, and UnaryDoubleFPOpt all depend on the option -enable-double-float-shrink. These two factors made migrating each of these simplifiers individually more of a pain than it would be worth. So, I migrated them all together. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167815 91177308-0d34-0410-b5e6-96231b3b80d8
54 lines
2.0 KiB
C++
54 lines
2.0 KiB
C++
//===- SimplifyLibCalls.h - Library call simplifier -------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This file exposes an interface to build some C language libcalls for
|
|
// optimization passes that need to call the various functions.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_TRANSFORMS_UTILS_SIMPLIFYLIBCALLS_H
|
|
#define LLVM_TRANSFORMS_UTILS_SIMPLIFYLIBCALLS_H
|
|
|
|
namespace llvm {
|
|
class Value;
|
|
class CallInst;
|
|
class DataLayout;
|
|
class Instruction;
|
|
class TargetLibraryInfo;
|
|
class LibCallSimplifierImpl;
|
|
|
|
/// LibCallSimplifier - This class implements a collection of optimizations
|
|
/// that replace well formed calls to library functions with a more optimal
|
|
/// form. For example, replacing 'printf("Hello!")' with 'puts("Hello!")'.
|
|
class LibCallSimplifier {
|
|
/// Impl - A pointer to the actual implementation of the library call
|
|
/// simplifier.
|
|
LibCallSimplifierImpl *Impl;
|
|
public:
|
|
LibCallSimplifier(const DataLayout *TD, const TargetLibraryInfo *TLI,
|
|
bool UnsafeFPShrink);
|
|
virtual ~LibCallSimplifier();
|
|
|
|
/// optimizeCall - Take the given call instruction and return a more
|
|
/// optimal value to replace the instruction with or 0 if a more
|
|
/// optimal form can't be found. Note that the returned value may
|
|
/// be equal to the instruction being optimized. In this case all
|
|
/// other instructions that use the given instruction were modified
|
|
/// and the given instruction is dead.
|
|
Value *optimizeCall(CallInst *CI);
|
|
|
|
/// replaceAllUsesWith - This method is used when the library call
|
|
/// simplifier needs to replace instructions other than the library
|
|
/// call being modified.
|
|
virtual void replaceAllUsesWith(Instruction *I, Value *With) const;
|
|
};
|
|
} // End llvm namespace
|
|
|
|
#endif
|