2012-02-18 12:03:15 +00:00
|
|
|
//===-- PPCSubtarget.h - Define Subtarget for the PPC ----------*- C++ -*--===//
|
2005-08-04 07:12:09 +00:00
|
|
|
//
|
2019-01-19 08:50:56 +00: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
|
2005-08-04 07:12:09 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2011-07-01 21:01:15 +00:00
|
|
|
// This file declares the PowerPC specific subclass of TargetSubtargetInfo.
|
2005-08-04 07:12:09 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-13 16:26:38 +00:00
|
|
|
#ifndef LLVM_LIB_TARGET_POWERPC_PPCSUBTARGET_H
|
|
|
|
#define LLVM_LIB_TARGET_POWERPC_PPCSUBTARGET_H
|
2005-08-04 07:12:09 +00:00
|
|
|
|
2014-06-12 20:54:11 +00:00
|
|
|
#include "PPCFrameLowering.h"
|
2014-06-12 22:50:10 +00:00
|
|
|
#include "PPCISelLowering.h"
|
2015-01-14 11:23:27 +00:00
|
|
|
#include "PPCInstrInfo.h"
|
2020-08-17 15:33:47 -05:00
|
|
|
#include "llvm/CodeGen/GlobalISel/CallLowering.h"
|
|
|
|
#include "llvm/CodeGen/GlobalISel/LegalizerInfo.h"
|
2022-02-15 11:54:38 -08:00
|
|
|
#include "llvm/CodeGen/RegisterBankInfo.h"
|
2016-01-27 16:32:26 +00:00
|
|
|
#include "llvm/CodeGen/SelectionDAGTargetInfo.h"
|
2017-11-17 01:07:10 +00:00
|
|
|
#include "llvm/CodeGen/TargetSubtargetInfo.h"
|
2014-06-12 21:08:06 +00:00
|
|
|
#include "llvm/IR/DataLayout.h"
|
2012-12-04 07:12:27 +00:00
|
|
|
#include "llvm/MC/MCInstrItineraries.h"
|
2023-02-07 12:21:51 +00:00
|
|
|
#include "llvm/TargetParser/Triple.h"
|
2005-09-01 21:38:21 +00:00
|
|
|
#include <string>
|
|
|
|
|
2011-07-01 20:45:01 +00:00
|
|
|
#define GET_SUBTARGETINFO_HEADER
|
2011-07-01 22:36:09 +00:00
|
|
|
#include "PPCGenSubtargetInfo.inc"
|
2011-07-01 20:45:01 +00:00
|
|
|
|
2007-01-19 04:36:02 +00:00
|
|
|
// GCC #defines PPC on Linux but we use it as our namespace name
|
|
|
|
#undef PPC
|
|
|
|
|
2005-08-04 07:12:09 +00:00
|
|
|
namespace llvm {
|
2011-07-07 07:07:08 +00:00
|
|
|
class StringRef;
|
2006-12-12 20:57:08 +00:00
|
|
|
|
|
|
|
namespace PPC {
|
|
|
|
// -m directive values.
|
[PowerPC] Add support for -mcpu=pwr10 in both clang and llvm
Summary:
This patch simply adds support for the new CPU in anticipation of
Power10. There isn't really any functionality added so there are no
associated test cases at this time.
Reviewers: stefanp, nemanjai, amyk, hfinkel, power-llvm-team, #powerpc
Reviewed By: stefanp, nemanjai, amyk, #powerpc
Subscribers: NeHuang, steven.zhang, hiraditya, llvm-commits, wuzish, shchenz, cfe-commits, kbarton, echristo
Tags: #clang, #powerpc, #llvm
Differential Revision: https://reviews.llvm.org/D80020
2020-05-27 09:50:14 -05:00
|
|
|
enum {
|
|
|
|
DIR_NONE,
|
|
|
|
DIR_32,
|
|
|
|
DIR_440,
|
|
|
|
DIR_601,
|
|
|
|
DIR_602,
|
|
|
|
DIR_603,
|
|
|
|
DIR_7400,
|
|
|
|
DIR_750,
|
|
|
|
DIR_970,
|
|
|
|
DIR_A2,
|
|
|
|
DIR_E500,
|
|
|
|
DIR_E500mc,
|
|
|
|
DIR_E5500,
|
|
|
|
DIR_PWR3,
|
|
|
|
DIR_PWR4,
|
|
|
|
DIR_PWR5,
|
|
|
|
DIR_PWR5X,
|
|
|
|
DIR_PWR6,
|
|
|
|
DIR_PWR6X,
|
|
|
|
DIR_PWR7,
|
|
|
|
DIR_PWR8,
|
|
|
|
DIR_PWR9,
|
|
|
|
DIR_PWR10,
|
|
|
|
DIR_PWR_FUTURE,
|
|
|
|
DIR_64
|
|
|
|
};
|
2015-06-23 09:49:53 +00:00
|
|
|
}
|
2006-12-12 20:57:08 +00:00
|
|
|
|
2006-12-11 23:22:45 +00:00
|
|
|
class GlobalValue;
|
2012-10-29 15:51:35 +00:00
|
|
|
|
2011-07-01 20:45:01 +00:00
|
|
|
class PPCSubtarget : public PPCGenSubtargetInfo {
|
2016-03-29 01:36:01 +00:00
|
|
|
public:
|
|
|
|
enum POPCNTDKind {
|
|
|
|
POPCNTD_Unavailable,
|
|
|
|
POPCNTD_Slow,
|
|
|
|
POPCNTD_Fast
|
|
|
|
};
|
|
|
|
|
2005-08-04 07:12:09 +00:00
|
|
|
protected:
|
2014-08-09 04:38:56 +00:00
|
|
|
/// TargetTriple - What processor and OS we're targeting.
|
|
|
|
Triple TargetTriple;
|
|
|
|
|
2005-08-04 07:12:09 +00:00
|
|
|
/// stackAlignment - The minimum alignment known to hold of the stack frame on
|
|
|
|
/// entry to the function and which must be maintained by every function.
|
[Alignment][NFC] Use Align for TargetFrameLowering/Subtarget
Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790
Reviewers: courbet
Subscribers: jholewinski, arsenm, dschuff, jyknight, dylanmckay, sdardis, nemanjai, jvesely, nhaehnle, sbc100, jgravelle-google, hiraditya, aheejin, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, jsji, Jim, lenary, s.egerton, pzheng, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68993
llvm-svn: 375084
2019-10-17 07:49:39 +00:00
|
|
|
Align StackAlignment;
|
2012-10-29 15:51:35 +00:00
|
|
|
|
2005-11-01 20:06:59 +00:00
|
|
|
/// Selected instruction itineraries (one entry per itinerary class.)
|
|
|
|
InstrItineraryData InstrItins;
|
2012-10-29 15:51:35 +00:00
|
|
|
|
2022-12-14 15:55:53 +00:00
|
|
|
// Bool members corresponding to the SubtargetFeatures defined in tablegen.
|
|
|
|
#define GET_SUBTARGETINFO_MACRO(ATTRIBUTE, DEFAULT, GETTER) \
|
|
|
|
bool ATTRIBUTE = DEFAULT;
|
|
|
|
#include "PPCGenSubtargetInfo.inc"
|
|
|
|
|
2006-12-12 20:57:08 +00:00
|
|
|
/// Which cpu directive was used.
|
[PowerPC] Rename DarwinDirective to CPUDirective (NFC)
Summary:
This patch renames the DarwinDirective (used to identify which CPU was defined)
to CPUDirective. It also adds the getCPUDirective() method and replaces all uses
of getDarwinDirective() with getCPUDirective().
Once this patch lands and downstream users of the getDarwinDirective() method
have switched to the getCPUDirective() method, the old getDarwinDirective()
method will be removed.
Reviewers: nemanjai, hfinkel, power-llvm-team, jsji, echristo, #powerpc, jhibbits
Reviewed By: hfinkel, jsji, jhibbits
Subscribers: hiraditya, shchenz, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70352
2019-11-15 15:48:34 -06:00
|
|
|
unsigned CPUDirective;
|
2005-08-04 07:12:09 +00:00
|
|
|
|
2006-06-16 17:50:12 +00:00
|
|
|
bool IsPPC64;
|
2013-07-26 01:35:43 +00:00
|
|
|
bool IsLittleEndian;
|
2016-03-29 01:36:01 +00:00
|
|
|
|
|
|
|
POPCNTDKind HasPOPCNTD;
|
2012-10-29 15:51:35 +00:00
|
|
|
|
2015-02-13 22:48:51 +00:00
|
|
|
const PPCTargetMachine &TM;
|
2014-06-12 22:28:06 +00:00
|
|
|
PPCFrameLowering FrameLowering;
|
2014-06-12 22:05:46 +00:00
|
|
|
PPCInstrInfo InstrInfo;
|
2014-06-12 22:50:10 +00:00
|
|
|
PPCTargetLowering TLInfo;
|
2016-01-27 16:32:26 +00:00
|
|
|
SelectionDAGTargetInfo TSInfo;
|
2014-06-12 21:08:06 +00:00
|
|
|
|
2020-08-17 15:33:47 -05:00
|
|
|
/// GlobalISel related APIs.
|
|
|
|
std::unique_ptr<CallLowering> CallLoweringInfo;
|
|
|
|
std::unique_ptr<LegalizerInfo> Legalizer;
|
|
|
|
std::unique_ptr<RegisterBankInfo> RegBankInfo;
|
|
|
|
std::unique_ptr<InstructionSelector> InstSelector;
|
|
|
|
|
2005-08-04 07:12:09 +00:00
|
|
|
public:
|
|
|
|
/// This constructor initializes the data members to match that
|
2009-08-02 22:11:08 +00:00
|
|
|
/// of the specified triple.
|
2005-08-04 07:12:09 +00:00
|
|
|
///
|
2022-11-18 19:12:01 +00:00
|
|
|
PPCSubtarget(const Triple &TT, const std::string &CPU,
|
|
|
|
const std::string &TuneCPU, const std::string &FS,
|
2015-06-10 12:11:26 +00:00
|
|
|
const PPCTargetMachine &TM);
|
2012-10-29 15:51:35 +00:00
|
|
|
|
|
|
|
/// ParseSubtargetFeatures - Parses features string setting specified
|
2005-10-26 18:07:50 +00:00
|
|
|
/// subtarget options. Definition of function is auto generated by tblgen.
|
2020-08-14 14:56:54 -07:00
|
|
|
void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS);
|
2012-10-29 15:51:35 +00:00
|
|
|
|
2005-08-04 07:12:09 +00:00
|
|
|
/// getStackAlignment - Returns the minimum alignment known to hold of the
|
|
|
|
/// stack frame on entry to the function and which must be maintained by every
|
|
|
|
/// function for this subtarget.
|
[Alignment][NFC] Use Align for TargetFrameLowering/Subtarget
Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790
Reviewers: courbet
Subscribers: jholewinski, arsenm, dschuff, jyknight, dylanmckay, sdardis, nemanjai, jvesely, nhaehnle, sbc100, jgravelle-google, hiraditya, aheejin, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, jsji, Jim, lenary, s.egerton, pzheng, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68993
llvm-svn: 375084
2019-10-17 07:49:39 +00:00
|
|
|
Align getStackAlignment() const { return StackAlignment; }
|
2012-10-29 15:51:35 +00:00
|
|
|
|
[PowerPC] Rename DarwinDirective to CPUDirective (NFC)
Summary:
This patch renames the DarwinDirective (used to identify which CPU was defined)
to CPUDirective. It also adds the getCPUDirective() method and replaces all uses
of getDarwinDirective() with getCPUDirective().
Once this patch lands and downstream users of the getDarwinDirective() method
have switched to the getCPUDirective() method, the old getDarwinDirective()
method will be removed.
Reviewers: nemanjai, hfinkel, power-llvm-team, jsji, echristo, #powerpc, jhibbits
Reviewed By: hfinkel, jsji, jhibbits
Subscribers: hiraditya, shchenz, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70352
2019-11-15 15:48:34 -06:00
|
|
|
/// getCPUDirective - Returns the -m directive specified for the cpu.
|
2006-12-12 20:57:08 +00:00
|
|
|
///
|
[PowerPC] Rename DarwinDirective to CPUDirective (NFC)
Summary:
This patch renames the DarwinDirective (used to identify which CPU was defined)
to CPUDirective. It also adds the getCPUDirective() method and replaces all uses
of getDarwinDirective() with getCPUDirective().
Once this patch lands and downstream users of the getDarwinDirective() method
have switched to the getCPUDirective() method, the old getDarwinDirective()
method will be removed.
Reviewers: nemanjai, hfinkel, power-llvm-team, jsji, echristo, #powerpc, jhibbits
Reviewed By: hfinkel, jsji, jhibbits
Subscribers: hiraditya, shchenz, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70352
2019-11-15 15:48:34 -06:00
|
|
|
unsigned getCPUDirective() const { return CPUDirective; }
|
2012-10-29 15:51:35 +00:00
|
|
|
|
2014-06-13 22:38:48 +00:00
|
|
|
/// getInstrItins - Return the instruction itineraries based on subtarget
|
2005-11-01 20:06:59 +00:00
|
|
|
/// selection.
|
2014-08-04 21:25:23 +00:00
|
|
|
const InstrItineraryData *getInstrItineraryData() const override {
|
|
|
|
return &InstrItins;
|
|
|
|
}
|
|
|
|
|
|
|
|
const PPCFrameLowering *getFrameLowering() const override {
|
|
|
|
return &FrameLowering;
|
|
|
|
}
|
|
|
|
const PPCInstrInfo *getInstrInfo() const override { return &InstrInfo; }
|
|
|
|
const PPCTargetLowering *getTargetLowering() const override {
|
|
|
|
return &TLInfo;
|
|
|
|
}
|
2016-01-27 16:32:26 +00:00
|
|
|
const SelectionDAGTargetInfo *getSelectionDAGInfo() const override {
|
2014-08-04 21:25:23 +00:00
|
|
|
return &TSInfo;
|
|
|
|
}
|
|
|
|
const PPCRegisterInfo *getRegisterInfo() const override {
|
|
|
|
return &getInstrInfo()->getRegisterInfo();
|
|
|
|
}
|
2015-02-13 22:23:04 +00:00
|
|
|
const PPCTargetMachine &getTargetMachine() const { return TM; }
|
2014-06-12 20:54:11 +00:00
|
|
|
|
2022-11-18 19:12:01 +00:00
|
|
|
/// initializeSubtargetDependencies - Initializes using a CPU, a TuneCPU, and
|
|
|
|
/// feature string so that we can use initializer lists for subtarget
|
|
|
|
/// initialization.
|
|
|
|
PPCSubtarget &initializeSubtargetDependencies(StringRef CPU,
|
|
|
|
StringRef TuneCPU,
|
|
|
|
StringRef FS);
|
2014-06-12 20:54:11 +00:00
|
|
|
|
2013-07-15 22:29:40 +00:00
|
|
|
private:
|
|
|
|
void initializeEnvironment();
|
2022-11-18 19:12:01 +00:00
|
|
|
void initSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS);
|
2013-07-15 22:29:40 +00:00
|
|
|
|
|
|
|
public:
|
2006-06-16 17:50:12 +00:00
|
|
|
/// isPPC64 - Return true if we are generating code for 64-bit pointer mode.
|
|
|
|
///
|
2015-02-17 06:45:15 +00:00
|
|
|
bool isPPC64() const;
|
2012-10-29 15:51:35 +00:00
|
|
|
|
2015-12-14 17:57:33 +00:00
|
|
|
// useSoftFloat - Return true if soft-float option is turned on.
|
2019-08-14 14:13:11 +00:00
|
|
|
bool useSoftFloat() const {
|
|
|
|
if (isAIXABI() && !HasHardFloat)
|
|
|
|
report_fatal_error("soft-float is not yet supported on AIX.");
|
|
|
|
return !HasHardFloat;
|
|
|
|
}
|
2012-10-29 15:51:35 +00:00
|
|
|
|
2013-07-26 01:35:43 +00:00
|
|
|
// isLittleEndian - True if generating little-endian code
|
|
|
|
bool isLittleEndian() const { return IsLittleEndian; }
|
|
|
|
|
2022-12-14 15:55:53 +00:00
|
|
|
// Getters for SubtargetFeatures defined in tablegen.
|
|
|
|
#define GET_SUBTARGETINFO_MACRO(ATTRIBUTE, DEFAULT, GETTER) \
|
|
|
|
bool GETTER() const { return ATTRIBUTE; }
|
|
|
|
#include "PPCGenSubtargetInfo.inc"
|
2007-01-16 09:29:17 +00:00
|
|
|
|
[Alignment][NFC] Use Align for TargetFrameLowering/Subtarget
Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790
Reviewers: courbet
Subscribers: jholewinski, arsenm, dschuff, jyknight, dylanmckay, sdardis, nemanjai, jvesely, nhaehnle, sbc100, jgravelle-google, hiraditya, aheejin, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, MaskRay, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, jsji, Jim, lenary, s.egerton, pzheng, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68993
llvm-svn: 375084
2019-10-17 07:49:39 +00:00
|
|
|
Align getPlatformStackAlignment() const {
|
|
|
|
return Align(16);
|
[PowerPC] Add support for the QPX vector instruction set
This adds support for the QPX vector instruction set, which is used by the
enhanced A2 cores on the IBM BG/Q supercomputers. QPX vectors are 256 bytes
wide, holding 4 double-precision floating-point values. Boolean values, modeled
here as <4 x i1> are actually also represented as floating-point values
(essentially { -1, 1 } for { false, true }). QPX shares many features with
Altivec and VSX, but is distinct from both of them. One major difference is
that, instead of adding completely-separate vector registers, QPX vector
registers are extensions of the scalar floating-point registers (lane 0 is the
corresponding scalar floating-point value). The operations supported on QPX
vectors mirrors that supported on the scalar floating-point values (with some
additional ones for permutations and logical/comparison operations).
I've been maintaining this support out-of-tree, as part of the bgclang project,
for several years. This is not the entire bgclang patch set, but is most of the
subset that can be cleanly integrated into LLVM proper at this time. Adding
this to the LLVM backend is part of my efforts to rebase bgclang to the current
LLVM trunk, but is independently useful (especially for codes that use LLVM as
a JIT in library form).
The assembler/disassembler test coverage is complete. The CodeGen test coverage
is not, but I've included some tests, and more will be added as follow-up work.
llvm-svn: 230413
2015-02-25 01:06:45 +00:00
|
|
|
}
|
2017-07-11 16:42:20 +00:00
|
|
|
|
2020-02-10 13:52:08 -05:00
|
|
|
unsigned getRedZoneSize() const {
|
|
|
|
if (isPPC64())
|
|
|
|
// 288 bytes = 18*8 (FPRs) + 18*8 (GPRs, GPR13 reserved)
|
|
|
|
return 288;
|
|
|
|
|
|
|
|
// AIX PPC32: 220 bytes = 18*8 (FPRs) + 19*4 (GPRs);
|
|
|
|
// PPC32 SVR4ABI has no redzone.
|
|
|
|
return isAIXABI() ? 220 : 0;
|
|
|
|
}
|
2017-07-11 16:42:20 +00:00
|
|
|
|
2016-09-22 09:52:19 +00:00
|
|
|
bool needsSwapsForVSXMemOps() const {
|
|
|
|
return hasVSX() && isLittleEndian() && !hasP9Vector();
|
|
|
|
}
|
[PowerPC] Add support for the QPX vector instruction set
This adds support for the QPX vector instruction set, which is used by the
enhanced A2 cores on the IBM BG/Q supercomputers. QPX vectors are 256 bytes
wide, holding 4 double-precision floating-point values. Boolean values, modeled
here as <4 x i1> are actually also represented as floating-point values
(essentially { -1, 1 } for { false, true }). QPX shares many features with
Altivec and VSX, but is distinct from both of them. One major difference is
that, instead of adding completely-separate vector registers, QPX vector
registers are extensions of the scalar floating-point registers (lane 0 is the
corresponding scalar floating-point value). The operations supported on QPX
vectors mirrors that supported on the scalar floating-point values (with some
additional ones for permutations and logical/comparison operations).
I've been maintaining this support out-of-tree, as part of the bgclang project,
for several years. This is not the entire bgclang patch set, but is most of the
subset that can be cleanly integrated into LLVM proper at this time. Adding
this to the LLVM backend is part of my efforts to rebase bgclang to the current
LLVM trunk, but is independently useful (especially for codes that use LLVM as
a JIT in library form).
The assembler/disassembler test coverage is complete. The CodeGen test coverage
is not, but I've included some tests, and more will be added as follow-up work.
llvm-svn: 230413
2015-02-25 01:06:45 +00:00
|
|
|
|
2016-03-29 01:36:01 +00:00
|
|
|
POPCNTDKind hasPOPCNTD() const { return HasPOPCNTD; }
|
|
|
|
|
2011-04-19 20:54:28 +00:00
|
|
|
const Triple &getTargetTriple() const { return TargetTriple; }
|
|
|
|
|
2014-07-18 23:29:49 +00:00
|
|
|
bool isTargetELF() const { return TargetTriple.isOSBinFormatELF(); }
|
|
|
|
bool isTargetMachO() const { return TargetTriple.isOSBinFormatMachO(); }
|
2016-04-19 20:14:52 +00:00
|
|
|
bool isTargetLinux() const { return TargetTriple.isOSLinux(); }
|
2014-07-18 23:29:49 +00:00
|
|
|
|
2019-05-24 20:54:35 +00:00
|
|
|
bool isAIXABI() const { return TargetTriple.isOSAIX(); }
|
2020-01-01 22:47:15 -08:00
|
|
|
bool isSVR4ABI() const { return !isAIXABI(); }
|
2015-02-17 06:45:15 +00:00
|
|
|
bool isELFv2ABI() const;
|
2009-08-15 11:54:46 +00:00
|
|
|
|
2019-08-22 15:11:28 +00:00
|
|
|
bool is64BitELFABI() const { return isSVR4ABI() && isPPC64(); }
|
|
|
|
bool is32BitELFABI() const { return isSVR4ABI() && !isPPC64(); }
|
2020-04-08 08:07:35 -05:00
|
|
|
bool isUsingPCRelativeCalls() const;
|
2019-08-22 15:11:28 +00:00
|
|
|
|
2017-01-16 20:12:26 +00:00
|
|
|
/// Originally, this function return hasISEL(). Now we always enable it,
|
|
|
|
/// but may expand the ISEL instruction later.
|
|
|
|
bool enableEarlyIfConversion() const override { return true; }
|
2014-05-21 23:40:26 +00:00
|
|
|
|
2019-06-11 17:40:39 +00:00
|
|
|
/// Scheduling customization.
|
2014-04-29 07:57:37 +00:00
|
|
|
bool enableMachineScheduler() const override;
|
2019-06-11 17:40:39 +00:00
|
|
|
/// Pipeliner customization.
|
|
|
|
bool enableMachinePipeliner() const override;
|
|
|
|
/// Machine Pipeliner customization
|
|
|
|
bool useDFAforSMS() const override;
|
|
|
|
/// This overrides the PostRAScheduler bit in the SchedModel for each CPU.
|
2015-06-13 03:42:16 +00:00
|
|
|
bool enablePostRAScheduler() const override;
|
2014-07-15 22:39:58 +00:00
|
|
|
AntiDepBreakMode getAntiDepBreakMode() const override;
|
|
|
|
void getCriticalPathRCs(RegClassVector &CriticalPathRCs) const override;
|
|
|
|
|
2013-09-11 23:05:25 +00:00
|
|
|
void overrideSchedPolicy(MachineSchedPolicy &Policy,
|
2014-04-29 07:57:37 +00:00
|
|
|
unsigned NumRegionInstrs) const override;
|
|
|
|
bool useAA() const override;
|
2015-01-09 02:03:11 +00:00
|
|
|
|
|
|
|
bool enableSubRegLiveness() const override;
|
2015-11-20 20:51:31 +00:00
|
|
|
|
2023-02-08 02:14:24 +00:00
|
|
|
bool enableSpillageCopyElimination() const override { return true; }
|
|
|
|
|
2019-09-20 18:21:07 +00:00
|
|
|
/// True if the GV will be accessed via an indirect symbol.
|
|
|
|
bool isGVIndirectSymbol(const GlobalValue *GV) const;
|
[XRay] Implement powerpc64le xray.
Summary:
powerpc64 big-endian is not supported, but I believe that most logic can
be shared, except for xray_powerpc64.cc.
Also add a function InvalidateInstructionCache to xray_util.h, which is
copied from llvm/Support/Memory.cpp. I'm not sure if I need to add a unittest,
and I don't know how.
Reviewers: dberris, echristo, iteratee, kbarton, hfinkel
Subscribers: mehdi_amini, nemanjai, mgorny, llvm-commits
Differential Revision: https://reviews.llvm.org/D29742
llvm-svn: 294781
2017-02-10 21:03:24 +00:00
|
|
|
|
2019-12-09 12:26:16 -05:00
|
|
|
/// True if the ABI is descriptor based.
|
|
|
|
bool usesFunctionDescriptors() const {
|
|
|
|
// Both 32-bit and 64-bit AIX are descriptor based. For ELF only the 64-bit
|
|
|
|
// v1 ABI uses descriptors.
|
|
|
|
return isAIXABI() || (is64BitELFABI() && !isELFv2ABI());
|
|
|
|
}
|
|
|
|
|
[PowerPC] Add Support for indirect calls on AIX.
Extends the desciptor-based indirect call support for 32-bit codegen,
and enables indirect calls for AIX.
In-depth Description:
In a function descriptor based ABI, a function pointer points at a
descriptor structure as opposed to the function's entry point. The
descriptor takes the form of 3 pointers: 1 for the function's entry
point, 1 for the TOC anchor of the module containing the function
definition, and 1 for the environment pointer:
struct FunctionDescriptor {
void *EntryPoint;
void *TOCAnchor;
void *EnvironmentPointer;
};
An indirect call has several steps of loading the the information from
the descriptor into the proper registers for setting up the call. Namely
it has to:
1) Save the caller's TOC pointer into the TOC save slot in the linkage
area, and then load the callee's TOC pointer into the TOC register
(GPR 2 on AIX).
2) Load the function descriptor's entry point into the count register.
3) Load the environment pointer into the environment pointer register
(GPR 11 on AIX).
4) Perform the call by branching on count register.
5) Restore the caller's TOC pointer after returning from the indirect call.
A couple important caveats to the above:
- There is no way to directly load a value from memory into the count register.
Instead we populate the count register by loading the entry point address into
a gpr and then moving the gpr to the count register.
- The TOC restore has to come immediately after the branch on count register
instruction (i.e., the 1st instruction executed after we return from the
call). This is an implementation limitation. We could, in theory, schedule
the restore elsewhere as long as no uses of the TOC pointer fall in between
the call and the restore; however, to keep it simple, we insert a pseudo
instruction that represents both the indirect branch instruction and the
load instruction that restores the caller's TOC from the linkage area. As
they flow through the compiler as a single pseudo instruction, nothing can be
inserted between them and the caller's TOC is then valid at any use.
Differtential Revision: https://reviews.llvm.org/D70724
2019-12-13 14:34:11 -05:00
|
|
|
unsigned descriptorTOCAnchorOffset() const {
|
|
|
|
assert(usesFunctionDescriptors() &&
|
|
|
|
"Should only be called when the target uses descriptors.");
|
|
|
|
return IsPPC64 ? 8 : 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
unsigned descriptorEnvironmentPointerOffset() const {
|
|
|
|
assert(usesFunctionDescriptors() &&
|
|
|
|
"Should only be called when the target uses descriptors.");
|
|
|
|
return IsPPC64 ? 16 : 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
MCRegister getEnvironmentPointerRegister() const {
|
|
|
|
assert(usesFunctionDescriptors() &&
|
|
|
|
"Should only be called when the target uses descriptors.");
|
|
|
|
return IsPPC64 ? PPC::X11 : PPC::R11;
|
|
|
|
}
|
|
|
|
|
|
|
|
MCRegister getTOCPointerRegister() const {
|
|
|
|
assert((is64BitELFABI() || isAIXABI()) &&
|
|
|
|
"Should only be called when the target is a TOC based ABI.");
|
|
|
|
return IsPPC64 ? PPC::X2 : PPC::R2;
|
|
|
|
}
|
|
|
|
|
|
|
|
MCRegister getStackPointerRegister() const {
|
|
|
|
return IsPPC64 ? PPC::X1 : PPC::R1;
|
|
|
|
}
|
|
|
|
|
[XRay] Implement powerpc64le xray.
Summary:
powerpc64 big-endian is not supported, but I believe that most logic can
be shared, except for xray_powerpc64.cc.
Also add a function InvalidateInstructionCache to xray_util.h, which is
copied from llvm/Support/Memory.cpp. I'm not sure if I need to add a unittest,
and I don't know how.
Reviewers: dberris, echristo, iteratee, kbarton, hfinkel
Subscribers: mehdi_amini, nemanjai, mgorny, llvm-commits
Differential Revision: https://reviews.llvm.org/D29742
llvm-svn: 294781
2017-02-10 21:03:24 +00:00
|
|
|
bool isXRaySupported() const override { return IsPPC64 && IsLittleEndian; }
|
2020-05-11 15:02:09 +00:00
|
|
|
|
|
|
|
bool isPredictableSelectIsExpensive() const {
|
|
|
|
return PredictableSelectIsExpensive;
|
|
|
|
}
|
2020-08-17 15:33:47 -05:00
|
|
|
|
2021-07-03 04:45:11 +00:00
|
|
|
// Select allocation orders of GPRC and G8RC. It should be strictly consistent
|
|
|
|
// with corresponding AltOrders in PPCRegisterInfo.td.
|
|
|
|
unsigned getGPRAllocationOrderIdx() const {
|
|
|
|
if (is64BitELFABI())
|
|
|
|
return 1;
|
|
|
|
if (isAIXABI())
|
|
|
|
return 2;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-08-17 15:33:47 -05:00
|
|
|
// GlobalISEL
|
|
|
|
const CallLowering *getCallLowering() const override;
|
|
|
|
const RegisterBankInfo *getRegBankInfo() const override;
|
|
|
|
const LegalizerInfo *getLegalizerInfo() const override;
|
|
|
|
InstructionSelector *getInstructionSelector() const override;
|
2005-08-04 07:12:09 +00:00
|
|
|
};
|
2015-06-23 09:49:53 +00:00
|
|
|
} // End llvm namespace
|
2005-08-04 07:12:09 +00:00
|
|
|
|
|
|
|
#endif
|