IntrinsicLowering.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. //===-- IntrinsicLowering.h - Intrinsic Function Lowering -------*- 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 IntrinsicLowering interface. This interface allows
  15. // addition of domain-specific or front-end specific intrinsics to LLVM without
  16. // having to modify all of the C backend or interpreter.
  17. //
  18. //===----------------------------------------------------------------------===//
  19. #ifndef LLVM_CODEGEN_INTRINSICLOWERING_H
  20. #define LLVM_CODEGEN_INTRINSICLOWERING_H
  21. namespace llvm {
  22. class CallInst;
  23. class DataLayout;
  24. class IntrinsicLowering {
  25. const DataLayout &DL;
  26. bool Warned = false;
  27. public:
  28. explicit IntrinsicLowering(const DataLayout &DL) : DL(DL) {}
  29. /// Replace a call to the specified intrinsic function.
  30. /// If an intrinsic function must be implemented by the code generator
  31. /// (such as va_start), this function should print a message and abort.
  32. ///
  33. /// Otherwise, if an intrinsic function call can be lowered, the code to
  34. /// implement it (often a call to a non-intrinsic function) is inserted
  35. /// _after_ the call instruction and the call is deleted. The caller must
  36. /// be capable of handling this kind of change.
  37. void LowerIntrinsicCall(CallInst *CI);
  38. /// Try to replace a call instruction with a call to a bswap intrinsic. Return
  39. /// false if the call is not a simple integer bswap.
  40. static bool LowerToByteSwap(CallInst *CI);
  41. };
  42. }
  43. #endif
  44. #ifdef __GNUC__
  45. #pragma GCC diagnostic pop
  46. #endif