TargetOpcodes.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. //===-- llvm/Target/TargetOpcodes.h - Target Indep Opcodes ------*- C++ -*-===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. //
  10. // This file defines the target independent instruction opcodes.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_TARGET_TARGETOPCODES_H
  14. #define LLVM_TARGET_TARGETOPCODES_H
  15. namespace llvm {
  16. /// Invariant opcodes: All instruction sets have these as their low opcodes.
  17. ///
  18. /// Every instruction defined here must also appear in Target.td and the order
  19. /// must be the same as in CodeGenTarget.cpp.
  20. ///
  21. namespace TargetOpcode {
  22. enum {
  23. PHI = 0,
  24. INLINEASM = 1,
  25. CFI_INSTRUCTION = 2,
  26. EH_LABEL = 3,
  27. GC_LABEL = 4,
  28. /// KILL - This instruction is a noop that is used only to adjust the
  29. /// liveness of registers. This can be useful when dealing with
  30. /// sub-registers.
  31. KILL = 5,
  32. /// EXTRACT_SUBREG - This instruction takes two operands: a register
  33. /// that has subregisters, and a subregister index. It returns the
  34. /// extracted subregister value. This is commonly used to implement
  35. /// truncation operations on target architectures which support it.
  36. EXTRACT_SUBREG = 6,
  37. /// INSERT_SUBREG - This instruction takes three operands: a register that
  38. /// has subregisters, a register providing an insert value, and a
  39. /// subregister index. It returns the value of the first register with the
  40. /// value of the second register inserted. The first register is often
  41. /// defined by an IMPLICIT_DEF, because it is commonly used to implement
  42. /// anyext operations on target architectures which support it.
  43. INSERT_SUBREG = 7,
  44. /// IMPLICIT_DEF - This is the MachineInstr-level equivalent of undef.
  45. IMPLICIT_DEF = 8,
  46. /// SUBREG_TO_REG - This instruction is similar to INSERT_SUBREG except that
  47. /// the first operand is an immediate integer constant. This constant is
  48. /// often zero, because it is commonly used to assert that the instruction
  49. /// defining the register implicitly clears the high bits.
  50. SUBREG_TO_REG = 9,
  51. /// COPY_TO_REGCLASS - This instruction is a placeholder for a plain
  52. /// register-to-register copy into a specific register class. This is only
  53. /// used between instruction selection and MachineInstr creation, before
  54. /// virtual registers have been created for all the instructions, and it's
  55. /// only needed in cases where the register classes implied by the
  56. /// instructions are insufficient. It is emitted as a COPY MachineInstr.
  57. COPY_TO_REGCLASS = 10,
  58. /// DBG_VALUE - a mapping of the llvm.dbg.value intrinsic
  59. DBG_VALUE = 11,
  60. /// REG_SEQUENCE - This variadic instruction is used to form a register that
  61. /// represents a consecutive sequence of sub-registers. It's used as a
  62. /// register coalescing / allocation aid and must be eliminated before code
  63. /// emission.
  64. // In SDNode form, the first operand encodes the register class created by
  65. // the REG_SEQUENCE, while each subsequent pair names a vreg + subreg index
  66. // pair. Once it has been lowered to a MachineInstr, the regclass operand
  67. // is no longer present.
  68. /// e.g. v1027 = REG_SEQUENCE v1024, 3, v1025, 4, v1026, 5
  69. /// After register coalescing references of v1024 should be replace with
  70. /// v1027:3, v1025 with v1027:4, etc.
  71. REG_SEQUENCE = 12,
  72. /// COPY - Target-independent register copy. This instruction can also be
  73. /// used to copy between subregisters of virtual registers.
  74. COPY = 13,
  75. /// BUNDLE - This instruction represents an instruction bundle. Instructions
  76. /// which immediately follow a BUNDLE instruction which are marked with
  77. /// 'InsideBundle' flag are inside the bundle.
  78. BUNDLE = 14,
  79. /// Lifetime markers.
  80. LIFETIME_START = 15,
  81. LIFETIME_END = 16,
  82. /// A Stackmap instruction captures the location of live variables at its
  83. /// position in the instruction stream. It is followed by a shadow of bytes
  84. /// that must lie within the function and not contain another stackmap.
  85. STACKMAP = 17,
  86. /// Patchable call instruction - this instruction represents a call to a
  87. /// constant address, followed by a series of NOPs. It is intended to
  88. /// support optimizations for dynamic languages (such as javascript) that
  89. /// rewrite calls to runtimes with more efficient code sequences.
  90. /// This also implies a stack map.
  91. PATCHPOINT = 18,
  92. /// This pseudo-instruction loads the stack guard value. Targets which need
  93. /// to prevent the stack guard value or address from being spilled to the
  94. /// stack should override TargetLowering::emitLoadStackGuardNode and
  95. /// additionally expand this pseudo after register allocation.
  96. LOAD_STACK_GUARD = 19,
  97. /// Call instruction with associated vm state for deoptimization and list
  98. /// of live pointers for relocation by the garbage collector. It is
  99. /// intended to support garbage collection with fully precise relocating
  100. /// collectors and deoptimizations in either the callee or caller.
  101. STATEPOINT = 20,
  102. /// Instruction that records the offset of a local stack allocation passed to
  103. /// llvm.localescape. It has two arguments: the symbol for the label and the
  104. /// frame index of the local stack allocation.
  105. LOCAL_ESCAPE = 21,
  106. /// Loading instruction that may page fault, bundled with associated
  107. /// information on how to handle such a page fault. It is intended to support
  108. /// "zero cost" null checks in managed languages by allowing LLVM to fold
  109. /// comparisions into existing memory operations.
  110. FAULTING_LOAD_OP = 22,
  111. };
  112. } // end namespace TargetOpcode
  113. } // end namespace llvm
  114. #endif