PPC.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. //===-- PPC.h - Top-level interface for PowerPC Target ----------*- 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 contains the entry points for global functions defined in the LLVM
  10. // PowerPC back-end.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_LIB_TARGET_POWERPC_PPC_H
  14. #define LLVM_LIB_TARGET_POWERPC_PPC_H
  15. #include "llvm/Support/CodeGen.h"
  16. // GCC #defines PPC on Linux but we use it as our namespace name
  17. #undef PPC
  18. namespace llvm {
  19. class PPCRegisterBankInfo;
  20. class PPCSubtarget;
  21. class PPCTargetMachine;
  22. class PassRegistry;
  23. class FunctionPass;
  24. class InstructionSelector;
  25. class MachineInstr;
  26. class MachineOperand;
  27. class AsmPrinter;
  28. class MCInst;
  29. class MCOperand;
  30. class ModulePass;
  31. FunctionPass *createPPCCTRLoops();
  32. #ifndef NDEBUG
  33. FunctionPass *createPPCCTRLoopsVerify();
  34. #endif
  35. FunctionPass *createPPCLoopInstrFormPrepPass(PPCTargetMachine &TM);
  36. FunctionPass *createPPCTOCRegDepsPass();
  37. FunctionPass *createPPCEarlyReturnPass();
  38. FunctionPass *createPPCVSXCopyPass();
  39. FunctionPass *createPPCVSXFMAMutatePass();
  40. FunctionPass *createPPCVSXSwapRemovalPass();
  41. FunctionPass *createPPCReduceCRLogicalsPass();
  42. FunctionPass *createPPCMIPeepholePass();
  43. FunctionPass *createPPCBranchSelectionPass();
  44. FunctionPass *createPPCBranchCoalescingPass();
  45. FunctionPass *createPPCISelDag(PPCTargetMachine &TM, CodeGenOpt::Level OL);
  46. FunctionPass *createPPCTLSDynamicCallPass();
  47. FunctionPass *createPPCBoolRetToIntPass();
  48. FunctionPass *createPPCExpandISELPass();
  49. FunctionPass *createPPCPreEmitPeepholePass();
  50. FunctionPass *createPPCExpandAtomicPseudoPass();
  51. void LowerPPCMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI,
  52. AsmPrinter &AP);
  53. bool LowerPPCMachineOperandToMCOperand(const MachineOperand &MO,
  54. MCOperand &OutMO, AsmPrinter &AP);
  55. void initializePPCCTRLoopsPass(PassRegistry&);
  56. #ifndef NDEBUG
  57. void initializePPCCTRLoopsVerifyPass(PassRegistry&);
  58. #endif
  59. void initializePPCLoopInstrFormPrepPass(PassRegistry&);
  60. void initializePPCTOCRegDepsPass(PassRegistry&);
  61. void initializePPCEarlyReturnPass(PassRegistry&);
  62. void initializePPCVSXCopyPass(PassRegistry&);
  63. void initializePPCVSXFMAMutatePass(PassRegistry&);
  64. void initializePPCVSXSwapRemovalPass(PassRegistry&);
  65. void initializePPCReduceCRLogicalsPass(PassRegistry&);
  66. void initializePPCBSelPass(PassRegistry&);
  67. void initializePPCBranchCoalescingPass(PassRegistry&);
  68. void initializePPCBoolRetToIntPass(PassRegistry&);
  69. void initializePPCExpandISELPass(PassRegistry &);
  70. void initializePPCPreEmitPeepholePass(PassRegistry &);
  71. void initializePPCTLSDynamicCallPass(PassRegistry &);
  72. void initializePPCMIPeepholePass(PassRegistry&);
  73. void initializePPCExpandAtomicPseudoPass(PassRegistry &);
  74. extern char &PPCVSXFMAMutateID;
  75. ModulePass *createPPCLowerMASSVEntriesPass();
  76. void initializePPCLowerMASSVEntriesPass(PassRegistry &);
  77. extern char &PPCLowerMASSVEntriesID;
  78. InstructionSelector *
  79. createPPCInstructionSelector(const PPCTargetMachine &, const PPCSubtarget &,
  80. const PPCRegisterBankInfo &);
  81. namespace PPCII {
  82. /// Target Operand Flag enum.
  83. enum TOF {
  84. //===------------------------------------------------------------------===//
  85. // PPC Specific MachineOperand flags.
  86. MO_NO_FLAG,
  87. /// On a symbol operand "FOO", this indicates that the reference is actually
  88. /// to "FOO@plt". This is used for calls and jumps to external functions
  89. /// and for PIC calls on 32-bit ELF systems.
  90. MO_PLT = 1,
  91. /// MO_PIC_FLAG - If this bit is set, the symbol reference is relative to
  92. /// the function's picbase, e.g. lo16(symbol-picbase).
  93. MO_PIC_FLAG = 2,
  94. /// MO_PCREL_FLAG - If this bit is set, the symbol reference is relative to
  95. /// the current instruction address(pc), e.g., var@pcrel. Fixup is VK_PCREL.
  96. MO_PCREL_FLAG = 4,
  97. /// MO_GOT_FLAG - If this bit is set the symbol reference is to be computed
  98. /// via the GOT. For example when combined with the MO_PCREL_FLAG it should
  99. /// produce the relocation @got@pcrel. Fixup is VK_PPC_GOT_PCREL.
  100. MO_GOT_FLAG = 8,
  101. // MO_PCREL_OPT_FLAG - If this bit is set the operand is part of a
  102. // PC Relative linker optimization.
  103. MO_PCREL_OPT_FLAG = 16,
  104. /// MO_TLSGD_FLAG - If this bit is set the symbol reference is relative to
  105. /// TLS General Dynamic model for Linux and the variable offset of TLS
  106. /// General Dynamic model for AIX.
  107. MO_TLSGD_FLAG = 32,
  108. /// MO_TPREL_FLAG - If this bit is set the symbol reference is relative to
  109. /// TLS Initial Exec model.
  110. MO_TPREL_FLAG = 64,
  111. /// MO_TLSLD_FLAG - If this bit is set the symbol reference is relative to
  112. /// TLS Local Dynamic model.
  113. MO_TLSLD_FLAG = 128,
  114. /// MO_TLSGDM_FLAG - If this bit is set the symbol reference is relative
  115. /// to the region handle of TLS General Dynamic model for AIX.
  116. MO_TLSGDM_FLAG = 256,
  117. /// MO_GOT_TLSGD_PCREL_FLAG - A combintaion of flags, if these bits are set
  118. /// they should produce the relocation @got@tlsgd@pcrel.
  119. /// Fix up is VK_PPC_GOT_TLSGD_PCREL
  120. MO_GOT_TLSGD_PCREL_FLAG = MO_PCREL_FLAG | MO_GOT_FLAG | MO_TLSGD_FLAG,
  121. /// MO_GOT_TLSLD_PCREL_FLAG - A combintaion of flags, if these bits are set
  122. /// they should produce the relocation @got@tlsld@pcrel.
  123. /// Fix up is VK_PPC_GOT_TLSLD_PCREL
  124. MO_GOT_TLSLD_PCREL_FLAG = MO_PCREL_FLAG | MO_GOT_FLAG | MO_TLSLD_FLAG,
  125. /// MO_GOT_TPREL_PCREL_FLAG - A combintaion of flags, if these bits are set
  126. /// they should produce the relocation @got@tprel@pcrel.
  127. /// Fix up is VK_PPC_GOT_TPREL_PCREL
  128. MO_GOT_TPREL_PCREL_FLAG = MO_GOT_FLAG | MO_TPREL_FLAG | MO_PCREL_FLAG,
  129. /// The next are not flags but distinct values.
  130. MO_ACCESS_MASK = 0xf00,
  131. /// MO_LO, MO_HA - lo16(symbol) and ha16(symbol)
  132. MO_LO = 1 << 8,
  133. MO_HA = 2 << 8,
  134. MO_TPREL_LO = 4 << 8,
  135. MO_TPREL_HA = 3 << 8,
  136. /// These values identify relocations on immediates folded
  137. /// into memory operations.
  138. MO_DTPREL_LO = 5 << 8,
  139. MO_TLSLD_LO = 6 << 8,
  140. MO_TOC_LO = 7 << 8,
  141. // Symbol for VK_PPC_TLS fixup attached to an ADD instruction
  142. MO_TLS = 8 << 8
  143. };
  144. } // end namespace PPCII
  145. } // end namespace llvm;
  146. #endif