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/Module.h"
     24 #include "llvm/IR/PassManager.h"
     25 
     26 namespace llvm {
     27 
     28 /// A pass that merges duplicate global constants into a single constant.
     29 class ConstantMergePass : public PassInfoMixin<ConstantMergePass> {
     30 public:
     31   PreservedAnalyses run(Module &M, ModuleAnalysisManager &);
     32 };
     33 }
     34 
     35 #endif // LLVM_TRANSFORMS_IPO_CONSTANTMERGE_H
     36