87 lines · c
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-exception6//7//===----------------------------------------------------------------------===//8//9// This file declares the VE specific subclass of TargetSubtargetInfo.10//11//===----------------------------------------------------------------------===//12 13#ifndef LLVM_LIB_TARGET_VE_VESUBTARGET_H14#define LLVM_LIB_TARGET_VE_VESUBTARGET_H15 16#include "VEFrameLowering.h"17#include "VEISelLowering.h"18#include "VEInstrInfo.h"19#include "llvm/CodeGen/TargetFrameLowering.h"20#include "llvm/CodeGen/TargetSubtargetInfo.h"21#include "llvm/IR/DataLayout.h"22#include <string>23 24#define GET_SUBTARGETINFO_HEADER25#include "VEGenSubtargetInfo.inc"26 27namespace llvm {28class StringRef;29 30class VESubtarget : public VEGenSubtargetInfo {31 Triple TargetTriple;32 virtual void anchor();33 34 /// Features {35 36 // Emit VPU instructions37 bool EnableVPU;38 39 /// } Features40 41 VEInstrInfo InstrInfo;42 VETargetLowering TLInfo;43 std::unique_ptr<const SelectionDAGTargetInfo> TSInfo;44 VEFrameLowering FrameLowering;45 46public:47 VESubtarget(const Triple &TT, const std::string &CPU, const std::string &FS,48 const TargetMachine &TM);49 50 ~VESubtarget() override;51 52 const VEInstrInfo *getInstrInfo() const override { return &InstrInfo; }53 const VEFrameLowering *getFrameLowering() const override {54 return &FrameLowering;55 }56 const VERegisterInfo *getRegisterInfo() const override {57 return &InstrInfo.getRegisterInfo();58 }59 const VETargetLowering *getTargetLowering() const override { return &TLInfo; }60 61 const SelectionDAGTargetInfo *getSelectionDAGInfo() const override;62 63 bool enableMachineScheduler() const override;64 65 bool enableVPU() const { return EnableVPU; }66 67 /// ParseSubtargetFeatures - Parses features string setting specified68 /// 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 function73 /// returns adjusted framesize which includes space for RSA, return74 /// 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 described78 /// in VEFrameLowering.cpp.79 unsigned getRsaSize() const { return 176; };80 81 bool isTargetLinux() const { return TargetTriple.isOSLinux(); }82};83 84} // namespace llvm85 86#endif87