IntrinsicLowering.h 1.7 KB

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