Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:44:10

0001 //===- ReplaceConstant.h - Replacing LLVM constant expressions --*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // This file declares the utility function for replacing LLVM constant
0010 // expressions by instructions.
0011 //
0012 //===----------------------------------------------------------------------===//
0013 
0014 #ifndef LLVM_IR_REPLACECONSTANT_H
0015 #define LLVM_IR_REPLACECONSTANT_H
0016 
0017 namespace llvm {
0018 
0019 template <typename T> class ArrayRef;
0020 class Constant;
0021 class Function;
0022 
0023 /// Replace constant expressions users of the given constants with
0024 /// instructions. Return whether anything was changed.
0025 ///
0026 /// Passing RestrictToFunc will restrict the constant replacement
0027 /// to the passed in functions scope, as opposed to the replacements
0028 /// occurring at module scope.
0029 ///
0030 /// RemoveDeadConstants by default will remove all dead constants as
0031 /// the final step of the function after replacement, when passed
0032 /// false it will skip this final step.
0033 ///
0034 /// If \p IncludeSelf is enabled, also convert the passed constants themselves
0035 /// to instructions, rather than only their users.
0036 bool convertUsersOfConstantsToInstructions(ArrayRef<Constant *> Consts,
0037                                            Function *RestrictToFunc = nullptr,
0038                                            bool RemoveDeadConstants = true,
0039                                            bool IncludeSelf = false);
0040 
0041 } // end namespace llvm
0042 
0043 #endif // LLVM_IR_REPLACECONSTANT_H