| 1 | //===-- RISCV.h - Top-level interface for RISC-V ----------------*- 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 | // RISC-V back-end. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef LLVM_LIB_TARGET_RISCV_RISCV_H |
| 15 | #define LLVM_LIB_TARGET_RISCV_RISCV_H |
| 16 | |
| 17 | #include "MCTargetDesc/RISCVBaseInfo.h" |
| 18 | #include "llvm/CodeGen/SelectionDAGISel.h" |
| 19 | #include "llvm/Target/TargetMachine.h" |
| 20 | |
| 21 | namespace llvm { |
| 22 | class FunctionPass; |
| 23 | class InstructionSelector; |
| 24 | class ModulePass; |
| 25 | class PassRegistry; |
| 26 | class RISCVRegisterBankInfo; |
| 27 | class RISCVSubtarget; |
| 28 | class RISCVTargetMachine; |
| 29 | |
| 30 | class RISCVCodeGenPreparePass |
| 31 | : public OptionalPassInfoMixin<RISCVCodeGenPreparePass> { |
| 32 | private: |
| 33 | const RISCVTargetMachine *TM; |
| 34 | |
| 35 | public: |
| 36 | RISCVCodeGenPreparePass(const RISCVTargetMachine *TM) : TM(TM) {} |
| 37 | PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM); |
| 38 | }; |
| 39 | FunctionPass *createRISCVCodeGenPrepareLegacyPass(); |
| 40 | void initializeRISCVCodeGenPrepareLegacyPass(PassRegistry &); |
| 41 | |
| 42 | FunctionPass *createRISCVDeadRegisterDefinitionsPass(); |
| 43 | void initializeRISCVDeadRegisterDefinitionsPass(PassRegistry &); |
| 44 | |
| 45 | FunctionPass *createRISCVIndirectBranchTrackingPass(); |
| 46 | void initializeRISCVIndirectBranchTrackingPass(PassRegistry &); |
| 47 | |
| 48 | FunctionPass *createRISCVLandingPadSetupPass(); |
| 49 | void initializeRISCVLandingPadSetupPass(PassRegistry &); |
| 50 | |
| 51 | FunctionPass *createRISCVISelDagLegacyPass(RISCVTargetMachine &TM, |
| 52 | CodeGenOptLevel OptLevel); |
| 53 | |
| 54 | class RISCVISelDAGToDAGPass : public SelectionDAGISelPass { |
| 55 | public: |
| 56 | RISCVISelDAGToDAGPass(RISCVTargetMachine &TM, CodeGenOptLevel OptLevel); |
| 57 | }; |
| 58 | |
| 59 | FunctionPass *createRISCVLateBranchOptPass(); |
| 60 | void initializeRISCVLateBranchOptPass(PassRegistry &); |
| 61 | |
| 62 | FunctionPass *createRISCVMakeCompressibleOptPass(); |
| 63 | void initializeRISCVMakeCompressibleOptPass(PassRegistry &); |
| 64 | |
| 65 | class RISCVGatherScatterLoweringPass |
| 66 | : public OptionalPassInfoMixin<RISCVGatherScatterLoweringPass> { |
| 67 | private: |
| 68 | const RISCVTargetMachine *TM; |
| 69 | |
| 70 | public: |
| 71 | RISCVGatherScatterLoweringPass(const RISCVTargetMachine *TM) : TM(TM) {} |
| 72 | PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM); |
| 73 | }; |
| 74 | |
| 75 | FunctionPass *createRISCVGatherScatterLoweringLegacyPass(); |
| 76 | void initializeRISCVGatherScatterLoweringLegacyPass(PassRegistry &); |
| 77 | |
| 78 | class RISCVVectorPeepholePass |
| 79 | : public OptionalPassInfoMixin<RISCVVectorPeepholePass> { |
| 80 | public: |
| 81 | PreservedAnalyses run(MachineFunction &MF, |
| 82 | MachineFunctionAnalysisManager &MFAM); |
| 83 | MachineFunctionProperties getRequiredProperties() const { |
| 84 | return MachineFunctionProperties().setIsSSA(); |
| 85 | } |
| 86 | }; |
| 87 | |
| 88 | FunctionPass *createRISCVVectorPeepholeLegacyPass(); |
| 89 | void initializeRISCVVectorPeepholeLegacyPass(PassRegistry &); |
| 90 | |
| 91 | class RISCVOptWInstrsPass : public OptionalPassInfoMixin<RISCVOptWInstrsPass> { |
| 92 | public: |
| 93 | PreservedAnalyses run(MachineFunction &MF, |
| 94 | MachineFunctionAnalysisManager &MFAM); |
| 95 | }; |
| 96 | |
| 97 | FunctionPass *createRISCVOptWInstrsLegacyPass(); |
| 98 | void initializeRISCVOptWInstrsLegacyPass(PassRegistry &); |
| 99 | |
| 100 | class RISCVFoldMemOffsetPass |
| 101 | : public OptionalPassInfoMixin<RISCVFoldMemOffsetPass> { |
| 102 | public: |
| 103 | PreservedAnalyses run(MachineFunction &MF, |
| 104 | MachineFunctionAnalysisManager &MFAM); |
| 105 | }; |
| 106 | |
| 107 | FunctionPass *createRISCVFoldMemOffsetLegacyPass(); |
| 108 | void initializeRISCVFoldMemOffsetLegacyPass(PassRegistry &); |
| 109 | |
| 110 | FunctionPass *createRISCVMergeBaseOffsetOptPass(); |
| 111 | void initializeRISCVMergeBaseOffsetOptPass(PassRegistry &); |
| 112 | |
| 113 | class RISCVExpandPseudoPreRAPass |
| 114 | : public RequiredPassInfoMixin<RISCVExpandPseudoPreRAPass> { |
| 115 | public: |
| 116 | PreservedAnalyses run(MachineFunction &MF, |
| 117 | MachineFunctionAnalysisManager &MFAM); |
| 118 | MachineFunctionProperties getRequiredProperties() const { |
| 119 | return MachineFunctionProperties().setIsSSA(); |
| 120 | } |
| 121 | }; |
| 122 | |
| 123 | FunctionPass *createRISCVExpandPseudoPreRALegacyPass(); |
| 124 | void initializeRISCVExpandPseudoPreRALegacyPass(PassRegistry &); |
| 125 | |
| 126 | class RISCVExpandPseudoPostRAPass |
| 127 | : public RequiredPassInfoMixin<RISCVExpandPseudoPostRAPass> { |
| 128 | public: |
| 129 | PreservedAnalyses run(MachineFunction &MF, |
| 130 | MachineFunctionAnalysisManager &MFAM); |
| 131 | }; |
| 132 | |
| 133 | FunctionPass *createRISCVExpandPseudoPostRALegacyPass(); |
| 134 | void initializeRISCVExpandPseudoPostRALegacyPass(PassRegistry &); |
| 135 | |
| 136 | class RISCVExpandPseudoPreEmitPass |
| 137 | : public RequiredPassInfoMixin<RISCVExpandPseudoPreEmitPass> { |
| 138 | public: |
| 139 | PreservedAnalyses run(MachineFunction &MF, |
| 140 | MachineFunctionAnalysisManager &MFAM); |
| 141 | }; |
| 142 | |
| 143 | FunctionPass *createRISCVExpandPseudoPreEmitLegacyPass(); |
| 144 | void initializeRISCVExpandPseudoPreEmitLegacyPass(PassRegistry &); |
| 145 | |
| 146 | class RISCVExpandPseudoAtomicsPass |
| 147 | : public RequiredPassInfoMixin<RISCVExpandPseudoAtomicsPass> { |
| 148 | public: |
| 149 | PreservedAnalyses run(MachineFunction &MF, |
| 150 | MachineFunctionAnalysisManager &MFAM); |
| 151 | }; |
| 152 | |
| 153 | FunctionPass *createRISCVExpandPseudoAtomicsLegacyPass(); |
| 154 | void initializeRISCVExpandPseudoAtomicsLegacyPass(PassRegistry &); |
| 155 | |
| 156 | FunctionPass *createRISCVInsertVSETVLIPass(); |
| 157 | void initializeRISCVInsertVSETVLIPass(PassRegistry &); |
| 158 | extern char &RISCVInsertVSETVLIID; |
| 159 | |
| 160 | FunctionPass *createRISCVInsertReadWriteCSRPass(); |
| 161 | void initializeRISCVInsertReadWriteCSRPass(PassRegistry &); |
| 162 | |
| 163 | FunctionPass *createRISCVInsertWriteVXRMPass(); |
| 164 | void initializeRISCVInsertWriteVXRMPass(PassRegistry &); |
| 165 | |
| 166 | FunctionPass *createRISCVRedundantCopyEliminationPass(); |
| 167 | void initializeRISCVRedundantCopyEliminationPass(PassRegistry &); |
| 168 | |
| 169 | FunctionPass *createRISCVMoveMergePass(); |
| 170 | void initializeRISCVMoveMergePass(PassRegistry &); |
| 171 | |
| 172 | FunctionPass *createRISCVPushPopOptimizationPass(); |
| 173 | void initializeRISCVPushPopOptPass(PassRegistry &); |
| 174 | FunctionPass *createRISCVLoadStoreOptPass(); |
| 175 | void initializeRISCVLoadStoreOptPass(PassRegistry &); |
| 176 | |
| 177 | FunctionPass *createRISCVPreAllocZilsdOptPass(); |
| 178 | void initializeRISCVPreAllocZilsdOptPass(PassRegistry &); |
| 179 | |
| 180 | class RISCVZacasABIFixPass |
| 181 | : public RequiredPassInfoMixin<RISCVZacasABIFixPass> { |
| 182 | private: |
| 183 | const RISCVTargetMachine *TM; |
| 184 | |
| 185 | public: |
| 186 | RISCVZacasABIFixPass(const RISCVTargetMachine *TM) : TM(TM) {} |
| 187 | PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM); |
| 188 | }; |
| 189 | FunctionPass *createRISCVZacasABIFixLegacyPass(); |
| 190 | void initializeRISCVZacasABIFixLegacyPass(PassRegistry &); |
| 191 | |
| 192 | InstructionSelector * |
| 193 | createRISCVInstructionSelector(const RISCVTargetMachine &, |
| 194 | const RISCVSubtarget &, |
| 195 | const RISCVRegisterBankInfo &); |
| 196 | void initializeRISCVDAGToDAGISelLegacyPass(PassRegistry &); |
| 197 | |
| 198 | FunctionPass *createRISCVPostLegalizerCombiner(); |
| 199 | void initializeRISCVPostLegalizerCombinerPass(PassRegistry &); |
| 200 | |
| 201 | FunctionPass *createRISCVO0PreLegalizerCombiner(); |
| 202 | void initializeRISCVO0PreLegalizerCombinerPass(PassRegistry &); |
| 203 | |
| 204 | FunctionPass *createRISCVPreLegalizerCombiner(); |
| 205 | void initializeRISCVPreLegalizerCombinerPass(PassRegistry &); |
| 206 | |
| 207 | ModulePass *createRISCVPromoteConstantPass(); |
| 208 | void initializeRISCVPromoteConstantPass(PassRegistry &); |
| 209 | |
| 210 | class RISCVVLOptimizerPass |
| 211 | : public OptionalPassInfoMixin<RISCVVLOptimizerPass> { |
| 212 | public: |
| 213 | PreservedAnalyses run(MachineFunction &MF, |
| 214 | MachineFunctionAnalysisManager &MFAM); |
| 215 | }; |
| 216 | |
| 217 | FunctionPass *createRISCVVLOptimizerLegacyPass(); |
| 218 | void initializeRISCVVLOptimizerLegacyPass(PassRegistry &); |
| 219 | |
| 220 | FunctionPass *createRISCVVMV0EliminationPass(); |
| 221 | void initializeRISCVVMV0EliminationPass(PassRegistry &); |
| 222 | |
| 223 | FunctionPass *createRISCVQCRelaxMarkingPass(); |
| 224 | void initializeRISCVQCRelaxMarkingPass(PassRegistry &); |
| 225 | |
| 226 | void initializeRISCVAsmPrinterPass(PassRegistry &); |
| 227 | } // namespace llvm |
| 228 | |
| 229 | #endif |
| 230 | |