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 VEInstrInfo InstrInfo; 36 VETargetLowering TLInfo; 37 SelectionDAGTargetInfo TSInfo; 38 VEFrameLowering FrameLowering; 39 40 public: 41 VESubtarget(const Triple &TT, const std::string &CPU, const std::string &FS, 42 const TargetMachine &TM); 43 44 const VEInstrInfo *getInstrInfo() const override { return &InstrInfo; } 45 const VEFrameLowering *getFrameLowering() const override { 46 return &FrameLowering; 47 } 48 const VERegisterInfo *getRegisterInfo() const override { 49 return &InstrInfo.getRegisterInfo(); 50 } 51 const VETargetLowering *getTargetLowering() const override { return &TLInfo; } 52 const SelectionDAGTargetInfo *getSelectionDAGInfo() const override { 53 return &TSInfo; 54 } 55 56 bool enableMachineScheduler() const override; 57 58 /// ParseSubtargetFeatures - Parses features string setting specified 59 /// subtarget options. Definition of function is auto generated by tblgen. 60 void ParseSubtargetFeatures(StringRef CPU, StringRef FS); 61 VESubtarget &initializeSubtargetDependencies(StringRef CPU, StringRef FS); 62 63 /// Given a actual stack size as determined by FrameInfo, this function 64 /// returns adjusted framesize which includes space for register window 65 /// spills and arguments. 66 int getAdjustedFrameSize(int stackSize) const; 67 68 bool isTargetLinux() const { return TargetTriple.isOSLinux(); } 69 }; 70 71 } // namespace llvm 72 73 #endif 74