xref: /freebsd/contrib/llvm-project/llvm/lib/Target/VE/VESubtarget.h (revision 04eeddc0aa8e0a417a16eaf9d7d095207f4a8623)
1480093f4SDimitry Andric //===-- VESubtarget.h - Define Subtarget for the VE -------------*- C++ -*-===//
2480093f4SDimitry Andric //
3480093f4SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4480093f4SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5480093f4SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6480093f4SDimitry Andric //
7480093f4SDimitry Andric //===----------------------------------------------------------------------===//
8480093f4SDimitry Andric //
9480093f4SDimitry Andric // This file declares the VE specific subclass of TargetSubtargetInfo.
10480093f4SDimitry Andric //
11480093f4SDimitry Andric //===----------------------------------------------------------------------===//
12480093f4SDimitry Andric 
13480093f4SDimitry Andric #ifndef LLVM_LIB_TARGET_VE_VESUBTARGET_H
14480093f4SDimitry Andric #define LLVM_LIB_TARGET_VE_VESUBTARGET_H
15480093f4SDimitry Andric 
16480093f4SDimitry Andric #include "VEFrameLowering.h"
17480093f4SDimitry Andric #include "VEISelLowering.h"
18480093f4SDimitry Andric #include "VEInstrInfo.h"
19480093f4SDimitry Andric #include "llvm/CodeGen/SelectionDAGTargetInfo.h"
20480093f4SDimitry Andric #include "llvm/CodeGen/TargetFrameLowering.h"
21480093f4SDimitry Andric #include "llvm/CodeGen/TargetSubtargetInfo.h"
22480093f4SDimitry Andric #include "llvm/IR/DataLayout.h"
23480093f4SDimitry Andric #include <string>
24480093f4SDimitry Andric 
25480093f4SDimitry Andric #define GET_SUBTARGETINFO_HEADER
26480093f4SDimitry Andric #include "VEGenSubtargetInfo.inc"
27480093f4SDimitry Andric 
28480093f4SDimitry Andric namespace llvm {
29480093f4SDimitry Andric class StringRef;
30480093f4SDimitry Andric 
31480093f4SDimitry Andric class VESubtarget : public VEGenSubtargetInfo {
32480093f4SDimitry Andric   Triple TargetTriple;
33480093f4SDimitry Andric   virtual void anchor();
34480093f4SDimitry Andric 
35e8d8bef9SDimitry Andric   /// Features {
36e8d8bef9SDimitry Andric 
37e8d8bef9SDimitry Andric   // Emit VPU instructions
38e8d8bef9SDimitry Andric   bool EnableVPU;
39e8d8bef9SDimitry Andric 
40e8d8bef9SDimitry Andric   /// } Features
41e8d8bef9SDimitry Andric 
42480093f4SDimitry Andric   VEInstrInfo InstrInfo;
43480093f4SDimitry Andric   VETargetLowering TLInfo;
44480093f4SDimitry Andric   SelectionDAGTargetInfo TSInfo;
45480093f4SDimitry Andric   VEFrameLowering FrameLowering;
46480093f4SDimitry Andric 
47480093f4SDimitry Andric public:
48480093f4SDimitry Andric   VESubtarget(const Triple &TT, const std::string &CPU, const std::string &FS,
49480093f4SDimitry Andric               const TargetMachine &TM);
50480093f4SDimitry Andric 
getInstrInfo()51480093f4SDimitry Andric   const VEInstrInfo *getInstrInfo() const override { return &InstrInfo; }
getFrameLowering()525ffd83dbSDimitry Andric   const VEFrameLowering *getFrameLowering() const override {
53480093f4SDimitry Andric     return &FrameLowering;
54480093f4SDimitry Andric   }
getRegisterInfo()55480093f4SDimitry Andric   const VERegisterInfo *getRegisterInfo() const override {
56480093f4SDimitry Andric     return &InstrInfo.getRegisterInfo();
57480093f4SDimitry Andric   }
getTargetLowering()58480093f4SDimitry Andric   const VETargetLowering *getTargetLowering() const override { return &TLInfo; }
getSelectionDAGInfo()59480093f4SDimitry Andric   const SelectionDAGTargetInfo *getSelectionDAGInfo() const override {
60480093f4SDimitry Andric     return &TSInfo;
61480093f4SDimitry Andric   }
62480093f4SDimitry Andric 
63480093f4SDimitry Andric   bool enableMachineScheduler() const override;
64480093f4SDimitry Andric 
enableVPU()65e8d8bef9SDimitry Andric   bool enableVPU() const { return EnableVPU; }
66e8d8bef9SDimitry Andric 
67480093f4SDimitry Andric   /// ParseSubtargetFeatures - Parses features string setting specified
68480093f4SDimitry Andric   /// subtarget options.  Definition of function is auto generated by tblgen.
69e8d8bef9SDimitry Andric   void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS);
70480093f4SDimitry Andric   VESubtarget &initializeSubtargetDependencies(StringRef CPU, StringRef FS);
71480093f4SDimitry Andric 
72480093f4SDimitry Andric   /// Given a actual stack size as determined by FrameInfo, this function
73e8d8bef9SDimitry Andric   /// returns adjusted framesize which includes space for RSA, return
74e8d8bef9SDimitry Andric   /// address, and frame poitner.
75e8d8bef9SDimitry Andric   uint64_t getAdjustedFrameSize(uint64_t FrameSize) const;
76e8d8bef9SDimitry Andric 
77e8d8bef9SDimitry Andric   /// Get the size of RSA, return address, and frame pointer as described
78e8d8bef9SDimitry Andric   /// in VEFrameLowering.cpp.
getRsaSize()79*04eeddc0SDimitry Andric   unsigned getRsaSize() const { return 176; };
80480093f4SDimitry Andric 
isTargetLinux()81480093f4SDimitry Andric   bool isTargetLinux() const { return TargetTriple.isOSLinux(); }
82480093f4SDimitry Andric };
83480093f4SDimitry Andric 
84480093f4SDimitry Andric } // namespace llvm
85480093f4SDimitry Andric 
86480093f4SDimitry Andric #endif
87