PPC.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  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. void LowerPPCMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI,
  51. AsmPrinter &AP);
  52. bool LowerPPCMachineOperandToMCOperand(const MachineOperand &MO,
  53. MCOperand &OutMO, AsmPrinter &AP);
  54. void initializePPCCTRLoopsPass(PassRegistry&);
  55. #ifndef NDEBUG
  56. void initializePPCCTRLoopsVerifyPass(PassRegistry&);
  57. #endif
  58. void initializePPCLoopInstrFormPrepPass(PassRegistry&);
  59. void initializePPCTOCRegDepsPass(PassRegistry&);
  60. void initializePPCEarlyReturnPass(PassRegistry&);
  61. void initializePPCVSXCopyPass(PassRegistry&);
  62. void initializePPCVSXFMAMutatePass(PassRegistry&);
  63. void initializePPCVSXSwapRemovalPass(PassRegistry&);
  64. void initializePPCReduceCRLogicalsPass(PassRegistry&);
  65. void initializePPCBSelPass(PassRegistry&);
  66. void initializePPCBranchCoalescingPass(PassRegistry&);
  67. void initializePPCBoolRetToIntPass(PassRegistry&);
  68. void initializePPCExpandISELPass(PassRegistry &);
  69. void initializePPCPreEmitPeepholePass(PassRegistry &);
  70. void initializePPCTLSDynamicCallPass(PassRegistry &);
  71. void initializePPCMIPeepholePass(PassRegistry&);
  72. extern char &PPCVSXFMAMutateID;
  73. ModulePass *createPPCLowerMASSVEntriesPass();
  74. void initializePPCLowerMASSVEntriesPass(PassRegistry &);
  75. extern char &PPCLowerMASSVEntriesID;
  76. InstructionSelector *
  77. createPPCInstructionSelector(const PPCTargetMachine &, const PPCSubtarget &,
  78. const PPCRegisterBankInfo &);
  79. namespace PPCII {
  80. /// Target Operand Flag enum.
  81. enum TOF {
  82. //===------------------------------------------------------------------===//
  83. // PPC Specific MachineOperand flags.
  84. MO_NO_FLAG,
  85. /// On a symbol operand "FOO", this indicates that the reference is actually
  86. /// to "FOO@plt". This is used for calls and jumps to external functions
  87. /// and for PIC calls on 32-bit ELF systems.
  88. MO_PLT = 1,
  89. /// MO_PIC_FLAG - If this bit is set, the symbol reference is relative to
  90. /// the function's picbase, e.g. lo16(symbol-picbase).
  91. MO_PIC_FLAG = 2,
  92. /// MO_PCREL_FLAG - If this bit is set, the symbol reference is relative to
  93. /// the current instruction address(pc), e.g., var@pcrel. Fixup is VK_PCREL.
  94. MO_PCREL_FLAG = 4,
  95. /// MO_GOT_FLAG - If this bit is set the symbol reference is to be computed
  96. /// via the GOT. For example when combined with the MO_PCREL_FLAG it should
  97. /// produce the relocation @got@pcrel. Fixup is VK_PPC_GOT_PCREL.
  98. MO_GOT_FLAG = 8,
  99. // MO_PCREL_OPT_FLAG - If this bit is set the operand is part of a
  100. // PC Relative linker optimization.
  101. MO_PCREL_OPT_FLAG = 16,
  102. /// MO_TLSGD_FLAG - If this bit is set the symbol reference is relative to
  103. /// TLS General Dynamic model.
  104. MO_TLSGD_FLAG = 32,
  105. /// MO_TPREL_FLAG - If this bit is set the symbol reference is relative to
  106. /// TLS Initial Exec model.
  107. MO_TPREL_FLAG = 64,
  108. /// MO_TLSLD_FLAG - If this bit is set the symbol reference is relative to
  109. /// TLS Local Dynamic model.
  110. MO_TLSLD_FLAG = 128,
  111. /// MO_GOT_TLSGD_PCREL_FLAG - A combintaion of flags, if these bits are set
  112. /// they should produce the relocation @got@tlsgd@pcrel.
  113. /// Fix up is VK_PPC_GOT_TLSGD_PCREL
  114. MO_GOT_TLSGD_PCREL_FLAG = MO_PCREL_FLAG | MO_GOT_FLAG | MO_TLSGD_FLAG,
  115. /// MO_GOT_TLSLD_PCREL_FLAG - A combintaion of flags, if these bits are set
  116. /// they should produce the relocation @got@tlsld@pcrel.
  117. /// Fix up is VK_PPC_GOT_TLSLD_PCREL
  118. MO_GOT_TLSLD_PCREL_FLAG = MO_PCREL_FLAG | MO_GOT_FLAG | MO_TLSLD_FLAG,
  119. /// MO_GOT_TPREL_PCREL_FLAG - A combintaion of flags, if these bits are set
  120. /// they should produce the relocation @got@tprel@pcrel.
  121. /// Fix up is VK_PPC_GOT_TPREL_PCREL
  122. MO_GOT_TPREL_PCREL_FLAG = MO_GOT_FLAG | MO_TPREL_FLAG | MO_PCREL_FLAG,
  123. /// The next are not flags but distinct values.
  124. MO_ACCESS_MASK = 0xf00,
  125. /// MO_LO, MO_HA - lo16(symbol) and ha16(symbol)
  126. MO_LO = 1 << 8,
  127. MO_HA = 2 << 8,
  128. MO_TPREL_LO = 4 << 8,
  129. MO_TPREL_HA = 3 << 8,
  130. /// These values identify relocations on immediates folded
  131. /// into memory operations.
  132. MO_DTPREL_LO = 5 << 8,
  133. MO_TLSLD_LO = 6 << 8,
  134. MO_TOC_LO = 7 << 8,
  135. // Symbol for VK_PPC_TLS fixup attached to an ADD instruction
  136. MO_TLS = 8 << 8
  137. };
  138. } // end namespace PPCII
  139. } // end namespace llvm;
  140. #endif