1 //===-- VESubtarget.h - Define Subtarget for the VE -------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 // This file declares the VE specific subclass of TargetSubtargetInfo.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_LIB_TARGET_VE_VESUBTARGET_H
14 #define LLVM_LIB_TARGET_VE_VESUBTARGET_H
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"
25 #define GET_SUBTARGETINFO_HEADER
26 #include "VEGenSubtargetInfo.inc"
31 class VESubtarget
: public VEGenSubtargetInfo
{
33 virtual void anchor();
37 // Emit VPU instructions
42 VEInstrInfo InstrInfo
;
43 VETargetLowering TLInfo
;
44 SelectionDAGTargetInfo TSInfo
;
45 VEFrameLowering FrameLowering
;
48 VESubtarget(const Triple
&TT
, const std::string
&CPU
, const std::string
&FS
,
49 const TargetMachine
&TM
);
51 const VEInstrInfo
*getInstrInfo() const override
{ return &InstrInfo
; }
52 const VEFrameLowering
*getFrameLowering() const override
{
53 return &FrameLowering
;
55 const VERegisterInfo
*getRegisterInfo() const override
{
56 return &InstrInfo
.getRegisterInfo();
58 const VETargetLowering
*getTargetLowering() const override
{ return &TLInfo
; }
59 const SelectionDAGTargetInfo
*getSelectionDAGInfo() const override
{
63 bool enableMachineScheduler() const override
;
65 bool enableVPU() const { return EnableVPU
; }
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
);
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;
77 /// Get the size of RSA, return address, and frame pointer as described
78 /// in VEFrameLowering.cpp.
79 unsigned getRsaSize(void) const { return 176; };
81 bool isTargetLinux() const { return TargetTriple
.isOSLinux(); }