2012-02-18 13:03:15 +01:00
|
|
|
//===-- SparcSubtarget.h - Define Subtarget for the SPARC -------*- C++ -*-===//
|
2006-02-05 06:50:24 +01:00
|
|
|
//
|
2019-01-19 09:50:56 +01:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2006-02-05 06:50:24 +01:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2011-07-01 23:01:15 +02:00
|
|
|
// This file declares the SPARC specific subclass of TargetSubtargetInfo.
|
2006-02-05 06:50:24 +01:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-13 18:26:38 +02:00
|
|
|
#ifndef LLVM_LIB_TARGET_SPARC_SPARCSUBTARGET_H
|
|
|
|
#define LLVM_LIB_TARGET_SPARC_SPARCSUBTARGET_H
|
2006-02-05 06:50:24 +01:00
|
|
|
|
2014-06-27 00:33:55 +02:00
|
|
|
#include "SparcFrameLowering.h"
|
|
|
|
#include "SparcISelLowering.h"
|
2016-01-27 17:32:26 +01:00
|
|
|
#include "SparcInstrInfo.h"
|
2020-09-29 17:15:35 +02:00
|
|
|
#include "llvm/ADT/Triple.h"
|
2016-01-27 17:32:26 +01:00
|
|
|
#include "llvm/CodeGen/SelectionDAGTargetInfo.h"
|
2017-11-17 02:07:10 +01:00
|
|
|
#include "llvm/CodeGen/TargetSubtargetInfo.h"
|
|
|
|
#include "llvm/IR/DataLayout.h"
|
2006-02-05 06:50:24 +01:00
|
|
|
#include <string>
|
|
|
|
|
2011-07-01 22:45:01 +02:00
|
|
|
#define GET_SUBTARGETINFO_HEADER
|
2011-07-02 00:36:09 +02:00
|
|
|
#include "SparcGenSubtargetInfo.inc"
|
2011-07-01 22:45:01 +02:00
|
|
|
|
2006-02-05 06:50:24 +01:00
|
|
|
namespace llvm {
|
2011-07-07 09:07:08 +02:00
|
|
|
class StringRef;
|
2009-08-03 00:11:08 +02:00
|
|
|
|
2011-07-01 22:45:01 +02:00
|
|
|
class SparcSubtarget : public SparcGenSubtargetInfo {
|
2016-04-26 12:37:14 +02:00
|
|
|
Triple TargetTriple;
|
2011-12-20 03:50:00 +01:00
|
|
|
virtual void anchor();
|
2017-07-18 21:08:38 +02:00
|
|
|
bool UseSoftMulDiv;
|
2006-02-05 06:50:24 +01:00
|
|
|
bool IsV9;
|
[Sparc] This provides support for itineraries on Sparc.
Specifically, itineraries for LEON processors has been added, along with several LEON processor Subtargets. Although currently all these targets are pretty much identical, support for features that will differ among these processors will be added in the very near future.
The different Instruction Itinerary Classes (IICs) added are sufficient to differentiate between the instruction timings used by LEON and, quite probably, by generic Sparc processors too, but the focus of the exercise has been for LEON processors, as the requirement of my project. If the IICs are not sufficient for other Sparc processor types and you want to add a new itinerary for one of those, it should be relatively trivial to adapt this.
As none of the LEON processors has Quad Floats, or is a Version 9 processor, none of those instructions have itinerary classes defined and revert to the default "NoItinerary" instruction itinerary.
Phabricator Review: http://reviews.llvm.org/D19359
llvm-svn: 267121
2016-04-22 10:17:17 +02:00
|
|
|
bool IsLeon;
|
2006-02-05 06:50:24 +01:00
|
|
|
bool V8DeprecatedInsts;
|
2014-03-02 20:31:21 +01:00
|
|
|
bool IsVIS, IsVIS2, IsVIS3;
|
2010-02-04 07:34:01 +01:00
|
|
|
bool Is64Bit;
|
2013-08-25 20:30:06 +02:00
|
|
|
bool HasHardQuad;
|
2014-01-26 07:09:59 +01:00
|
|
|
bool UsePopc;
|
2016-05-18 11:14:13 +02:00
|
|
|
bool UseSoftFloat;
|
2017-07-20 22:09:11 +02:00
|
|
|
bool HasNoFSMULD;
|
|
|
|
bool HasNoFMULS;
|
2016-05-16 13:02:00 +02:00
|
|
|
|
|
|
|
// LEON features
|
|
|
|
bool HasUmacSmac;
|
|
|
|
bool HasLeonCasa;
|
2018-09-27 14:34:48 +02:00
|
|
|
bool HasPWRPSR;
|
2016-05-23 12:56:36 +02:00
|
|
|
bool InsertNOPLoad;
|
2016-06-19 13:03:28 +02:00
|
|
|
bool FixAllFDIVSQRT;
|
2016-10-19 16:01:06 +02:00
|
|
|
bool DetectRoundChange;
|
2018-08-27 13:11:47 +02:00
|
|
|
bool HasLeonCycleCounter;
|
2016-05-16 13:02:00 +02:00
|
|
|
|
2014-06-27 00:33:55 +02:00
|
|
|
SparcInstrInfo InstrInfo;
|
|
|
|
SparcTargetLowering TLInfo;
|
2016-01-27 17:32:26 +01:00
|
|
|
SelectionDAGTargetInfo TSInfo;
|
2014-06-27 00:33:55 +02:00
|
|
|
SparcFrameLowering FrameLowering;
|
2013-06-04 20:33:25 +02:00
|
|
|
|
2006-02-05 06:50:24 +01:00
|
|
|
public:
|
2015-06-10 14:11:26 +02:00
|
|
|
SparcSubtarget(const Triple &TT, const std::string &CPU,
|
2016-05-03 16:57:18 +02:00
|
|
|
const std::string &FS, const TargetMachine &TM, bool is64bit);
|
2014-06-27 00:33:55 +02:00
|
|
|
|
2014-08-04 23:25:23 +02:00
|
|
|
const SparcInstrInfo *getInstrInfo() const override { return &InstrInfo; }
|
|
|
|
const TargetFrameLowering *getFrameLowering() const override {
|
|
|
|
return &FrameLowering;
|
|
|
|
}
|
|
|
|
const SparcRegisterInfo *getRegisterInfo() const override {
|
2014-06-27 00:33:55 +02:00
|
|
|
return &InstrInfo.getRegisterInfo();
|
|
|
|
}
|
2014-08-04 23:25:23 +02:00
|
|
|
const SparcTargetLowering *getTargetLowering() const override {
|
|
|
|
return &TLInfo;
|
|
|
|
}
|
2016-01-27 17:32:26 +01:00
|
|
|
const SelectionDAGTargetInfo *getSelectionDAGInfo() const override {
|
2014-08-04 23:25:23 +02:00
|
|
|
return &TSInfo;
|
|
|
|
}
|
2006-02-05 06:50:24 +01:00
|
|
|
|
2015-09-10 23:49:06 +02:00
|
|
|
bool enableMachineScheduler() const override;
|
|
|
|
|
2017-07-18 21:08:38 +02:00
|
|
|
bool useSoftMulDiv() const { return UseSoftMulDiv; }
|
2006-02-05 06:50:24 +01:00
|
|
|
bool isV9() const { return IsV9; }
|
[Sparc] This provides support for itineraries on Sparc.
Specifically, itineraries for LEON processors has been added, along with several LEON processor Subtargets. Although currently all these targets are pretty much identical, support for features that will differ among these processors will be added in the very near future.
The different Instruction Itinerary Classes (IICs) added are sufficient to differentiate between the instruction timings used by LEON and, quite probably, by generic Sparc processors too, but the focus of the exercise has been for LEON processors, as the requirement of my project. If the IICs are not sufficient for other Sparc processor types and you want to add a new itinerary for one of those, it should be relatively trivial to adapt this.
As none of the LEON processors has Quad Floats, or is a Version 9 processor, none of those instructions have itinerary classes defined and revert to the default "NoItinerary" instruction itinerary.
Phabricator Review: http://reviews.llvm.org/D19359
llvm-svn: 267121
2016-04-22 10:17:17 +02:00
|
|
|
bool isLeon() const { return IsLeon; }
|
2006-02-05 06:50:24 +01:00
|
|
|
bool isVIS() const { return IsVIS; }
|
2014-03-02 20:31:21 +01:00
|
|
|
bool isVIS2() const { return IsVIS2; }
|
|
|
|
bool isVIS3() const { return IsVIS3; }
|
2006-02-05 06:50:24 +01:00
|
|
|
bool useDeprecatedV8Instructions() const { return V8DeprecatedInsts; }
|
2013-08-25 20:30:06 +02:00
|
|
|
bool hasHardQuad() const { return HasHardQuad; }
|
2014-01-26 07:09:59 +01:00
|
|
|
bool usePopc() const { return UsePopc; }
|
2016-05-18 11:14:13 +02:00
|
|
|
bool useSoftFloat() const { return UseSoftFloat; }
|
2017-07-20 22:09:11 +02:00
|
|
|
bool hasNoFSMULD() const { return HasNoFSMULD; }
|
|
|
|
bool hasNoFMULS() const { return HasNoFMULS; }
|
2013-06-04 20:33:25 +02:00
|
|
|
|
2016-05-16 13:02:00 +02:00
|
|
|
// Leon options
|
2016-07-08 17:33:56 +02:00
|
|
|
bool hasUmacSmac() const { return HasUmacSmac; }
|
2016-08-12 16:48:09 +02:00
|
|
|
bool hasLeonCasa() const { return HasLeonCasa; }
|
2018-09-27 14:34:48 +02:00
|
|
|
bool hasPWRPSR() const { return HasPWRPSR; }
|
2016-08-12 16:48:09 +02:00
|
|
|
bool insertNOPLoad() const { return InsertNOPLoad; }
|
2016-06-19 13:03:28 +02:00
|
|
|
bool fixAllFDIVSQRT() const { return FixAllFDIVSQRT; }
|
2016-10-19 16:01:06 +02:00
|
|
|
bool detectRoundChange() const { return DetectRoundChange; }
|
2018-08-27 13:11:47 +02:00
|
|
|
bool hasLeonCycleCounter() const { return HasLeonCycleCounter; }
|
2016-05-16 13:02:00 +02:00
|
|
|
|
2013-06-04 20:33:25 +02:00
|
|
|
/// ParseSubtargetFeatures - Parses features string setting specified
|
2006-02-05 06:50:24 +01:00
|
|
|
/// subtarget options. Definition of function is auto generated by tblgen.
|
2020-08-14 23:56:54 +02:00
|
|
|
void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS);
|
2014-06-27 00:33:55 +02:00
|
|
|
SparcSubtarget &initializeSubtargetDependencies(StringRef CPU, StringRef FS);
|
2013-06-04 20:33:25 +02:00
|
|
|
|
2010-02-04 07:34:01 +01:00
|
|
|
bool is64Bit() const { return Is64Bit; }
|
2013-04-06 23:38:57 +02:00
|
|
|
|
|
|
|
/// The 64-bit ABI uses biased stack and frame pointers, so the stack frame
|
|
|
|
/// of the current function is the area from [%sp+BIAS] to [%fp+BIAS].
|
|
|
|
int64_t getStackPointerBias() const {
|
|
|
|
return is64Bit() ? 2047 : 0;
|
|
|
|
}
|
2013-06-01 06:51:18 +02:00
|
|
|
|
|
|
|
/// Given a actual stack size as determined by FrameInfo, this function
|
|
|
|
/// returns adjusted framesize which includes space for register window
|
|
|
|
/// spills and arguments.
|
|
|
|
int getAdjustedFrameSize(int stackSize) const;
|
2016-04-26 12:37:14 +02:00
|
|
|
|
|
|
|
bool isTargetLinux() const { return TargetTriple.isOSLinux(); }
|
2006-02-05 06:50:24 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
} // end namespace llvm
|
|
|
|
|
|
|
|
#endif
|