1 //===-- VESubtarget.h - Define Subtarget for the VE -------------*- 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 declares the VE specific subclass of TargetSubtargetInfo. 10 // 11 //===----------------------------------------------------------------------===// 12 13 #ifndef LLVM_LIB_TARGET_VE_VESUBTARGET_H 14 #define LLVM_LIB_TARGET_VE_VESUBTARGET_H 15 16 #include "VEFrameLowering.h" 17 #include "VEISelLowering.h" 18 #include "VEInstrInfo.h" 19 #include "llvm/CodeGen/SelectionDAGTargetInfo.h" 20 #include "llvm/CodeGen/TargetFrameLowering.h" 21 #include "llvm/CodeGen/TargetSubtargetInfo.h" 22 #include "llvm/IR/DataLayout.h" 23 #include <string> 24 25 #define GET_SUBTARGETINFO_HEADER 26 #include "VEGenSubtargetInfo.inc" 27 28 namespace llvm { 29 class StringRef; 30 31 class VESubtarget : public VEGenSubtargetInfo { 32 Triple TargetTriple; 33 virtual void anchor(); 34 35 /// Features { 36 37 // Emit VPU instructions 38 bool EnableVPU; 39 40 /// } Features 41 42 VEInstrInfo InstrInfo; 43 VETargetLowering TLInfo; 44 SelectionDAGTargetInfo TSInfo; 45 VEFrameLowering FrameLowering; 46 47 public: 48 VESubtarget(const Triple &TT, const std::string &CPU, const std::string &FS, 49 const TargetMachine &TM); 50 51 const VEInstrInfo *getInstrInfo() const override { return &InstrInfo; } 52 const VEFrameLowering *getFrameLowering() const override { 53 return &FrameLowering; 54 } 55 const VERegisterInfo *getRegisterInfo() const override { 56 return &InstrInfo.getRegisterInfo(); 57 } 58 const VETargetLowering *getTargetLowering() const override { return &TLInfo; } 59 const SelectionDAGTargetInfo *getSelectionDAGInfo() const override { 60 return &TSInfo; 61 } 62 63 bool enableMachineScheduler() const override; 64 65 bool enableVPU() const { return EnableVPU; } 66 67 /// ParseSubtargetFeatures - Parses features string setting specified 68 /// subtarget options. Definition of function is auto generated by tblgen. 69 void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS); 70 VESubtarget &initializeSubtargetDependencies(StringRef CPU, StringRef FS); 71 72 /// Given a actual stack size as determined by FrameInfo, this function 73 /// returns adjusted framesize which includes space for RSA, return 74 /// address, and frame poitner. 75 uint64_t getAdjustedFrameSize(uint64_t FrameSize) const; 76 77 /// Get the size of RSA, return address, and frame pointer as described 78 /// in VEFrameLowering.cpp. 79 unsigned getRsaSize() const { return 176; }; 80 81 bool isTargetLinux() const { return TargetTriple.isOSLinux(); } 82 }; 83 84 } // namespace llvm 85 86 #endif 87