Path: blob/main/contrib/llvm-project/llvm/lib/Target/PowerPC/PPC.h
35294 views
//===-- PPC.h - Top-level interface for PowerPC Target ----------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//7//8// This file contains the entry points for global functions defined in the LLVM9// PowerPC back-end.10//11//===----------------------------------------------------------------------===//1213#ifndef LLVM_LIB_TARGET_POWERPC_PPC_H14#define LLVM_LIB_TARGET_POWERPC_PPC_H1516#include "llvm/Support/CodeGen.h"1718// GCC #defines PPC on Linux but we use it as our namespace name19#undef PPC2021namespace llvm {22class PPCRegisterBankInfo;23class PPCSubtarget;24class PPCTargetMachine;25class PassRegistry;26class FunctionPass;27class InstructionSelector;28class MachineInstr;29class MachineOperand;30class AsmPrinter;31class MCInst;32class MCOperand;33class ModulePass;3435#ifndef NDEBUG36FunctionPass *createPPCCTRLoopsVerify();37#endif38FunctionPass *createPPCLoopInstrFormPrepPass(PPCTargetMachine &TM);39FunctionPass *createPPCTOCRegDepsPass();40FunctionPass *createPPCEarlyReturnPass();41FunctionPass *createPPCVSXCopyPass();42FunctionPass *createPPCVSXFMAMutatePass();43FunctionPass *createPPCVSXSwapRemovalPass();44FunctionPass *createPPCReduceCRLogicalsPass();45FunctionPass *createPPCMIPeepholePass();46FunctionPass *createPPCBranchSelectionPass();47FunctionPass *createPPCBranchCoalescingPass();48FunctionPass *createPPCISelDag(PPCTargetMachine &TM, CodeGenOptLevel OL);49FunctionPass *createPPCTLSDynamicCallPass();50FunctionPass *createPPCBoolRetToIntPass();51FunctionPass *createPPCExpandISELPass();52FunctionPass *createPPCPreEmitPeepholePass();53FunctionPass *createPPCExpandAtomicPseudoPass();54FunctionPass *createPPCCTRLoopsPass();55ModulePass *createPPCMergeStringPoolPass();56void LowerPPCMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI,57AsmPrinter &AP);58bool LowerPPCMachineOperandToMCOperand(const MachineOperand &MO,59MCOperand &OutMO, AsmPrinter &AP);6061#ifndef NDEBUG62void initializePPCCTRLoopsVerifyPass(PassRegistry&);63#endif64void initializePPCLoopInstrFormPrepPass(PassRegistry&);65void initializePPCTOCRegDepsPass(PassRegistry&);66void initializePPCEarlyReturnPass(PassRegistry&);67void initializePPCVSXCopyPass(PassRegistry&);68void initializePPCVSXFMAMutatePass(PassRegistry&);69void initializePPCVSXSwapRemovalPass(PassRegistry&);70void initializePPCReduceCRLogicalsPass(PassRegistry&);71void initializePPCBSelPass(PassRegistry&);72void initializePPCBranchCoalescingPass(PassRegistry&);73void initializePPCBoolRetToIntPass(PassRegistry&);74void initializePPCExpandISELPass(PassRegistry &);75void initializePPCPreEmitPeepholePass(PassRegistry &);76void initializePPCTLSDynamicCallPass(PassRegistry &);77void initializePPCMIPeepholePass(PassRegistry&);78void initializePPCExpandAtomicPseudoPass(PassRegistry &);79void initializePPCCTRLoopsPass(PassRegistry &);80void initializePPCDAGToDAGISelLegacyPass(PassRegistry &);81void initializePPCMergeStringPoolPass(PassRegistry &);8283extern char &PPCVSXFMAMutateID;8485ModulePass *createPPCLowerMASSVEntriesPass();86void initializePPCLowerMASSVEntriesPass(PassRegistry &);87extern char &PPCLowerMASSVEntriesID;8889ModulePass *createPPCGenScalarMASSEntriesPass();90void initializePPCGenScalarMASSEntriesPass(PassRegistry &);91extern char &PPCGenScalarMASSEntriesID;9293InstructionSelector *94createPPCInstructionSelector(const PPCTargetMachine &, const PPCSubtarget &,95const PPCRegisterBankInfo &);96namespace PPCII {9798/// Target Operand Flag enum.99enum TOF {100//===------------------------------------------------------------------===//101// PPC Specific MachineOperand flags.102MO_NO_FLAG,103104/// On PPC, the 12 bits are not enough for all target operand flags.105/// Treat all PPC target flags as direct flags. To define new flag that is106/// combination of other flags, add new enum entry instead of combining107/// existing flags. See example MO_GOT_TPREL_PCREL_FLAG.108109/// On a symbol operand "FOO", this indicates that the reference is actually110/// to "FOO@plt". This is used for calls and jumps to external functions111/// and for PIC calls on 32-bit ELF systems.112MO_PLT,113114/// MO_PIC_FLAG - If this bit is set, the symbol reference is relative to115/// the function's picbase, e.g. lo16(symbol-picbase).116MO_PIC_FLAG,117118/// MO_PCREL_FLAG - If this bit is set, the symbol reference is relative to119/// the current instruction address(pc), e.g., var@pcrel. Fixup is VK_PCREL.120MO_PCREL_FLAG,121122/// MO_GOT_FLAG - If this bit is set the symbol reference is to be computed123/// via the GOT. For example when combined with the MO_PCREL_FLAG it should124/// produce the relocation @got@pcrel. Fixup is VK_PPC_GOT_PCREL.125MO_GOT_FLAG,126127/// MO_PCREL_OPT_FLAG - If this bit is set the operand is part of a128/// PC Relative linker optimization.129MO_PCREL_OPT_FLAG,130131/// MO_TLSGD_FLAG - If this bit is set the symbol reference is relative to132/// TLS General Dynamic model for Linux and the variable offset of TLS133/// General Dynamic model for AIX.134MO_TLSGD_FLAG,135136/// MO_TPREL_FLAG - If this bit is set, the symbol reference is relative to137/// the thread pointer and the symbol can be used for the TLS Initial Exec138/// and Local Exec models.139MO_TPREL_FLAG,140141/// MO_TLSLDM_FLAG - on AIX the ML relocation type is only valid for a142/// reference to a TOC symbol from the symbol itself, and right now its only143/// user is the symbol "_$TLSML". The symbol name is used to decide that144/// the R_TLSML relocation is expected.145MO_TLSLDM_FLAG,146147/// MO_TLSLD_FLAG - If this bit is set the symbol reference is relative to148/// TLS Local Dynamic model.149MO_TLSLD_FLAG,150151/// MO_TLSGDM_FLAG - If this bit is set the symbol reference is relative152/// to the region handle of TLS General Dynamic model for AIX.153MO_TLSGDM_FLAG,154155/// MO_GOT_TLSGD_PCREL_FLAG - A combintaion of flags, if these bits are set156/// they should produce the relocation @got@tlsgd@pcrel.157/// Fix up is VK_PPC_GOT_TLSGD_PCREL158/// MO_GOT_TLSGD_PCREL_FLAG = MO_PCREL_FLAG | MO_GOT_FLAG | MO_TLSGD_FLAG,159MO_GOT_TLSGD_PCREL_FLAG,160161/// MO_GOT_TLSLD_PCREL_FLAG - A combintaion of flags, if these bits are set162/// they should produce the relocation @got@tlsld@pcrel.163/// Fix up is VK_PPC_GOT_TLSLD_PCREL164/// MO_GOT_TLSLD_PCREL_FLAG = MO_PCREL_FLAG | MO_GOT_FLAG | MO_TLSLD_FLAG,165MO_GOT_TLSLD_PCREL_FLAG,166167/// MO_GOT_TPREL_PCREL_FLAG - A combintaion of flags, if these bits are set168/// they should produce the relocation @got@tprel@pcrel.169/// Fix up is VK_PPC_GOT_TPREL_PCREL170/// MO_GOT_TPREL_PCREL_FLAG = MO_GOT_FLAG | MO_TPREL_FLAG | MO_PCREL_FLAG,171MO_GOT_TPREL_PCREL_FLAG,172173/// MO_LO, MO_HA - lo16(symbol) and ha16(symbol)174MO_LO,175MO_HA,176177MO_TPREL_LO,178MO_TPREL_HA,179180/// These values identify relocations on immediates folded181/// into memory operations.182MO_DTPREL_LO,183MO_TLSLD_LO,184MO_TOC_LO,185186/// Symbol for VK_PPC_TLS fixup attached to an ADD instruction187MO_TLS,188189/// MO_PIC_HA_FLAG = MO_PIC_FLAG | MO_HA190MO_PIC_HA_FLAG,191192/// MO_PIC_LO_FLAG = MO_PIC_FLAG | MO_LO193MO_PIC_LO_FLAG,194195/// MO_TPREL_PCREL_FLAG = MO_PCREL_FLAG | MO_TPREL_FLAG196MO_TPREL_PCREL_FLAG,197198/// MO_TPREL_PCREL_FLAG = MO_PCREL_FLAG | MO_TLS199MO_TLS_PCREL_FLAG,200201/// MO_GOT_PCREL_FLAG = MO_PCREL_FLAG | MO_GOT_FLAG202MO_GOT_PCREL_FLAG,203};204} // end namespace PPCII205206} // end namespace llvm;207208#endif209210211