LLVM 20.0.0git
ReplaceConstant.h
Go to the documentation of this file.
1//===- ReplaceConstant.h - Replacing LLVM constant expressions --*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file declares the utility function for replacing LLVM constant
10// expressions by instructions.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_IR_REPLACECONSTANT_H
15#define LLVM_IR_REPLACECONSTANT_H
16
17namespace llvm {
18
19template <typename T> class ArrayRef;
20class Constant;
21class Function;
22
23/// Replace constant expressions users of the given constants with
24/// instructions. Return whether anything was changed.
25///
26/// Passing RestrictToFunc will restrict the constant replacement
27/// to the passed in functions scope, as opposed to the replacements
28/// occurring at module scope.
29///
30/// RemoveDeadConstants by default will remove all dead constants as
31/// the final step of the function after replacement, when passed
32/// false it will skip this final step.
33///
34/// If \p IncludeSelf is enabled, also convert the passed constants themselves
35/// to instructions, rather than only their users.
36bool convertUsersOfConstantsToInstructions(ArrayRef<Constant *> Consts,
37 Function *RestrictToFunc = nullptr,
38 bool RemoveDeadConstants = true,
39 bool IncludeSelf = false);
40
41} // end namespace llvm
42
43#endif // LLVM_IR_REPLACECONSTANT_H
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
bool convertUsersOfConstantsToInstructions(ArrayRef< Constant * > Consts, Function *RestrictToFunc=nullptr, bool RemoveDeadConstants=true, bool IncludeSelf=false)
Replace constant expressions users of the given constants with instructions.
ArrayRef(const T &OneElt) -> ArrayRef< T >