TargetOpcodes.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===-- llvm/CodeGen/TargetOpcodes.h - Target Indep Opcodes -----*- 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 target independent instruction opcodes.
  15. //
  16. //===----------------------------------------------------------------------===//
  17. #ifndef LLVM_CODEGEN_TARGETOPCODES_H
  18. #define LLVM_CODEGEN_TARGETOPCODES_H
  19. namespace llvm {
  20. /// Invariant opcodes: All instruction sets have these as their low opcodes.
  21. ///
  22. namespace TargetOpcode {
  23. enum {
  24. #define HANDLE_TARGET_OPCODE(OPC) OPC,
  25. #define HANDLE_TARGET_OPCODE_MARKER(IDENT, OPC) IDENT = OPC,
  26. #include "llvm/Support/TargetOpcodes.def"
  27. };
  28. } // end namespace TargetOpcode
  29. /// Check whether the given Opcode is a generic opcode that is not supposed
  30. /// to appear after ISel.
  31. inline bool isPreISelGenericOpcode(unsigned Opcode) {
  32. return Opcode >= TargetOpcode::PRE_ISEL_GENERIC_OPCODE_START &&
  33. Opcode <= TargetOpcode::PRE_ISEL_GENERIC_OPCODE_END;
  34. }
  35. /// Check whether the given Opcode is a target-specific opcode.
  36. inline bool isTargetSpecificOpcode(unsigned Opcode) {
  37. return Opcode > TargetOpcode::PRE_ISEL_GENERIC_OPCODE_END;
  38. }
  39. /// \returns true if \p Opcode is an optimization hint opcode which is not
  40. /// supposed to appear after ISel.
  41. inline bool isPreISelGenericOptimizationHint(unsigned Opcode) {
  42. return Opcode >= TargetOpcode::PRE_ISEL_GENERIC_OPTIMIZATION_HINT_START &&
  43. Opcode <= TargetOpcode::PRE_ISEL_GENERIC_OPTIMIZATION_HINT_END;
  44. }
  45. } // end namespace llvm
  46. #endif
  47. #ifdef __GNUC__
  48. #pragma GCC diagnostic pop
  49. #endif