SafepointIRVerifier.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- SafepointIRVerifier.h - Checks for GC relocation problems *- 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 a verifier which is useful for enforcing the relocation
  15. // properties required by a relocating GC. Specifically, it looks for uses of
  16. // the unrelocated value of pointer SSA values after a possible safepoint. It
  17. // attempts to report no false negatives, but may end up reporting false
  18. // positives in rare cases (see the note at the top of the corresponding cpp
  19. // file.)
  20. //
  21. //===----------------------------------------------------------------------===//
  22. #ifndef LLVM_IR_SAFEPOINTIRVERIFIER_H
  23. #define LLVM_IR_SAFEPOINTIRVERIFIER_H
  24. #include "llvm/IR/PassManager.h"
  25. namespace llvm {
  26. class Function;
  27. class FunctionPass;
  28. /// Run the safepoint verifier over a single function. Crashes on failure.
  29. void verifySafepointIR(Function &F);
  30. /// Create an instance of the safepoint verifier pass which can be added to
  31. /// a pass pipeline to check for relocation bugs.
  32. FunctionPass *createSafepointIRVerifierPass();
  33. /// Create an instance of the safepoint verifier pass which can be added to
  34. /// a pass pipeline to check for relocation bugs.
  35. class SafepointIRVerifierPass : public PassInfoMixin<SafepointIRVerifierPass> {
  36. public:
  37. explicit SafepointIRVerifierPass() = default;
  38. PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
  39. };
  40. }
  41. #endif // LLVM_IR_SAFEPOINTIRVERIFIER_H
  42. #ifdef __GNUC__
  43. #pragma GCC diagnostic pop
  44. #endif