LowerIFunc.cpp 979 B

123456789101112131415161718192021222324252627
  1. //===- LowerIFunc.cpp -----------------------------------------------------===//
  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 implements replacing calls to ifuncs by introducing indirect calls.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. #include "llvm/Transforms/Utils/LowerIFunc.h"
  13. #include "llvm/IR/Module.h"
  14. #include "llvm/Pass.h"
  15. #include "llvm/Transforms/Utils/ModuleUtils.h"
  16. using namespace llvm;
  17. /// Replace all call users of ifuncs in the module.
  18. PreservedAnalyses LowerIFuncPass::run(Module &M, ModuleAnalysisManager &AM) {
  19. if (M.ifunc_empty())
  20. return PreservedAnalyses::all();
  21. lowerGlobalIFuncUsersAsGlobalCtor(M, {});
  22. return PreservedAnalyses::none();
  23. }