ConstantMerge.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- ConstantMerge.h - Merge duplicate global constants -------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. // This file defines the interface to a pass that merges duplicate global
  15. // constants together into a single constant that is shared. This is useful
  16. // because some passes (ie TraceValues) insert a lot of string constants into
  17. // the program, regardless of whether or not an existing string is available.
  18. //
  19. // Algorithm: ConstantMerge is designed to build up a map of available constants
  20. // and eliminate duplicates when it is initialized.
  21. //
  22. //===----------------------------------------------------------------------===//
  23. #ifndef LLVM_TRANSFORMS_IPO_CONSTANTMERGE_H
  24. #define LLVM_TRANSFORMS_IPO_CONSTANTMERGE_H
  25. #include "llvm/IR/PassManager.h"
  26. namespace llvm {
  27. class Module;
  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. } // end namespace llvm
  34. #endif // LLVM_TRANSFORMS_IPO_CONSTANTMERGE_H
  35. #ifdef __GNUC__
  36. #pragma GCC diagnostic pop
  37. #endif