Home | History | Annotate | Download | only in IPO
      1 //===- ConstantMerge.h - Merge duplicate global constants -------*- 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 defines the interface to a pass that merges duplicate global
     11 // constants together into a single constant that is shared.  This is useful
     12 // because some passes (ie TraceValues) insert a lot of string constants into
     13 // the program, regardless of whether or not an existing string is available.
     14 //
     15 // Algorithm: ConstantMerge is designed to build up a map of available constants
     16 // and eliminate duplicates when it is initialized.
     17 //
     18 //===----------------------------------------------------------------------===//
     19 
     20 #ifndef LLVM_TRANSFORMS_IPO_CONSTANTMERGE_H
     21 #define LLVM_TRANSFORMS_IPO_CONSTANTMERGE_H
     22 
     23 #include "llvm/IR/PassManager.h"
     24 
     25 namespace llvm {
     26 
     27 class Module;
     28 
     29 /// A pass that merges duplicate global constants into a single constant.
     30 class ConstantMergePass : public PassInfoMixin<ConstantMergePass> {
     31 public:
     32   PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
     33 };
     34 
     35 } // end namespace llvm
     36 
     37 #endif // LLVM_TRANSFORMS_IPO_CONSTANTMERGE_H
     38