IntrinsicLowering.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. #include "llvm/IR/Intrinsics.h"
  22. namespace llvm {
  23. class CallInst;
  24. class DataLayout;
  25. class IntrinsicLowering {
  26. const DataLayout &DL;
  27. bool Warned = false;
  28. public:
  29. explicit IntrinsicLowering(const DataLayout &DL) : DL(DL) {}
  30. /// Replace a call to the specified intrinsic function.
  31. /// If an intrinsic function must be implemented by the code generator
  32. /// (such as va_start), this function should print a message and abort.
  33. ///
  34. /// Otherwise, if an intrinsic function call can be lowered, the code to
  35. /// implement it (often a call to a non-intrinsic function) is inserted
  36. /// _after_ the call instruction and the call is deleted. The caller must
  37. /// be capable of handling this kind of change.
  38. void LowerIntrinsicCall(CallInst *CI);
  39. /// Try to replace a call instruction with a call to a bswap intrinsic. Return
  40. /// false if the call is not a simple integer bswap.
  41. static bool LowerToByteSwap(CallInst *CI);
  42. };
  43. }
  44. #endif
  45. #ifdef __GNUC__
  46. #pragma GCC diagnostic pop
  47. #endif