2016-11-02 07:40:28 +08:00
|
|
|
//===-- RISCV.td - Describe the RISCV Target Machine -------*- tablegen -*-===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08: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
|
2016-11-02 07:40:28 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
include "llvm/Target/Target.td"
|
|
|
|
|
2017-10-19 22:29:03 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// RISC-V subtarget features and instruction predicates.
|
|
|
|
//===----------------------------------------------------------------------===//
|
2016-11-02 07:40:28 +08:00
|
|
|
|
2017-11-09 23:00:03 +08:00
|
|
|
def FeatureStdExtM
|
|
|
|
: SubtargetFeature<"m", "HasStdExtM", "true",
|
|
|
|
"'M' (Integer Multiplication and Division)">;
|
|
|
|
def HasStdExtM : Predicate<"Subtarget->hasStdExtM()">,
|
[TableGen] Support combining AssemblerPredicates with ORs
For context, the proposed RISC-V bit manipulation extension has a subset
of instructions which require one of two SubtargetFeatures to be
enabled, 'zbb' or 'zbp', and there is no defined feature which both of
these can imply to use as a constraint either (see comments in D65649).
AssemblerPredicates allow multiple SubtargetFeatures to be declared in
the "AssemblerCondString" field, separated by commas, and this means
that the two features must both be enabled. There is no equivalent to
say that _either_ feature X or feature Y must be enabled, short of
creating a dummy SubtargetFeature for this purpose and having features X
and Y imply the new feature.
To solve the case where X or Y is needed without adding a new feature,
and to better match a typical TableGen style, this replaces the existing
"AssemblerCondString" with a dag "AssemblerCondDag" which represents the
same information. Two operators are defined for use with
AssemblerCondDag, "all_of", which matches the current behaviour, and
"any_of", which adds the new proposed ORing features functionality.
This was originally proposed in the RFC at
http://lists.llvm.org/pipermail/llvm-dev/2020-February/139138.html
Changes to all current backends are mechanical to support the replaced
functionality, and are NFCI.
At this stage, it is illegal to combine features with ands and ors in a
single AssemblerCondDag. I suspect this case is sufficiently rare that
adding more complex changes to support it are unnecessary.
Differential Revision: https://reviews.llvm.org/D74338
2020-03-14 01:13:51 +08:00
|
|
|
AssemblerPredicate<(all_of FeatureStdExtM),
|
2019-12-11 00:44:48 +08:00
|
|
|
"'M' (Integer Multiplication and Division)">;
|
2016-11-02 07:40:28 +08:00
|
|
|
|
2017-11-09 23:00:03 +08:00
|
|
|
def FeatureStdExtA
|
|
|
|
: SubtargetFeature<"a", "HasStdExtA", "true",
|
|
|
|
"'A' (Atomic Instructions)">;
|
|
|
|
def HasStdExtA : Predicate<"Subtarget->hasStdExtA()">,
|
[TableGen] Support combining AssemblerPredicates with ORs
For context, the proposed RISC-V bit manipulation extension has a subset
of instructions which require one of two SubtargetFeatures to be
enabled, 'zbb' or 'zbp', and there is no defined feature which both of
these can imply to use as a constraint either (see comments in D65649).
AssemblerPredicates allow multiple SubtargetFeatures to be declared in
the "AssemblerCondString" field, separated by commas, and this means
that the two features must both be enabled. There is no equivalent to
say that _either_ feature X or feature Y must be enabled, short of
creating a dummy SubtargetFeature for this purpose and having features X
and Y imply the new feature.
To solve the case where X or Y is needed without adding a new feature,
and to better match a typical TableGen style, this replaces the existing
"AssemblerCondString" with a dag "AssemblerCondDag" which represents the
same information. Two operators are defined for use with
AssemblerCondDag, "all_of", which matches the current behaviour, and
"any_of", which adds the new proposed ORing features functionality.
This was originally proposed in the RFC at
http://lists.llvm.org/pipermail/llvm-dev/2020-February/139138.html
Changes to all current backends are mechanical to support the replaced
functionality, and are NFCI.
At this stage, it is illegal to combine features with ands and ors in a
single AssemblerCondDag. I suspect this case is sufficiently rare that
adding more complex changes to support it are unnecessary.
Differential Revision: https://reviews.llvm.org/D74338
2020-03-14 01:13:51 +08:00
|
|
|
AssemblerPredicate<(all_of FeatureStdExtA),
|
2019-12-11 00:44:48 +08:00
|
|
|
"'A' (Atomic Instructions)">;
|
2017-11-09 23:00:03 +08:00
|
|
|
|
2017-12-07 18:26:05 +08:00
|
|
|
def FeatureStdExtF
|
|
|
|
: SubtargetFeature<"f", "HasStdExtF", "true",
|
|
|
|
"'F' (Single-Precision Floating-Point)">;
|
|
|
|
def HasStdExtF : Predicate<"Subtarget->hasStdExtF()">,
|
[TableGen] Support combining AssemblerPredicates with ORs
For context, the proposed RISC-V bit manipulation extension has a subset
of instructions which require one of two SubtargetFeatures to be
enabled, 'zbb' or 'zbp', and there is no defined feature which both of
these can imply to use as a constraint either (see comments in D65649).
AssemblerPredicates allow multiple SubtargetFeatures to be declared in
the "AssemblerCondString" field, separated by commas, and this means
that the two features must both be enabled. There is no equivalent to
say that _either_ feature X or feature Y must be enabled, short of
creating a dummy SubtargetFeature for this purpose and having features X
and Y imply the new feature.
To solve the case where X or Y is needed without adding a new feature,
and to better match a typical TableGen style, this replaces the existing
"AssemblerCondString" with a dag "AssemblerCondDag" which represents the
same information. Two operators are defined for use with
AssemblerCondDag, "all_of", which matches the current behaviour, and
"any_of", which adds the new proposed ORing features functionality.
This was originally proposed in the RFC at
http://lists.llvm.org/pipermail/llvm-dev/2020-February/139138.html
Changes to all current backends are mechanical to support the replaced
functionality, and are NFCI.
At this stage, it is illegal to combine features with ands and ors in a
single AssemblerCondDag. I suspect this case is sufficiently rare that
adding more complex changes to support it are unnecessary.
Differential Revision: https://reviews.llvm.org/D74338
2020-03-14 01:13:51 +08:00
|
|
|
AssemblerPredicate<(all_of FeatureStdExtF),
|
2019-12-11 00:44:48 +08:00
|
|
|
"'F' (Single-Precision Floating-Point)">;
|
2017-12-07 18:26:05 +08:00
|
|
|
|
2017-12-07 18:46:23 +08:00
|
|
|
def FeatureStdExtD
|
|
|
|
: SubtargetFeature<"d", "HasStdExtD", "true",
|
|
|
|
"'D' (Double-Precision Floating-Point)",
|
|
|
|
[FeatureStdExtF]>;
|
|
|
|
def HasStdExtD : Predicate<"Subtarget->hasStdExtD()">,
|
[TableGen] Support combining AssemblerPredicates with ORs
For context, the proposed RISC-V bit manipulation extension has a subset
of instructions which require one of two SubtargetFeatures to be
enabled, 'zbb' or 'zbp', and there is no defined feature which both of
these can imply to use as a constraint either (see comments in D65649).
AssemblerPredicates allow multiple SubtargetFeatures to be declared in
the "AssemblerCondString" field, separated by commas, and this means
that the two features must both be enabled. There is no equivalent to
say that _either_ feature X or feature Y must be enabled, short of
creating a dummy SubtargetFeature for this purpose and having features X
and Y imply the new feature.
To solve the case where X or Y is needed without adding a new feature,
and to better match a typical TableGen style, this replaces the existing
"AssemblerCondString" with a dag "AssemblerCondDag" which represents the
same information. Two operators are defined for use with
AssemblerCondDag, "all_of", which matches the current behaviour, and
"any_of", which adds the new proposed ORing features functionality.
This was originally proposed in the RFC at
http://lists.llvm.org/pipermail/llvm-dev/2020-February/139138.html
Changes to all current backends are mechanical to support the replaced
functionality, and are NFCI.
At this stage, it is illegal to combine features with ands and ors in a
single AssemblerCondDag. I suspect this case is sufficiently rare that
adding more complex changes to support it are unnecessary.
Differential Revision: https://reviews.llvm.org/D74338
2020-03-14 01:13:51 +08:00
|
|
|
AssemblerPredicate<(all_of FeatureStdExtD),
|
2019-12-11 00:44:48 +08:00
|
|
|
"'D' (Double-Precision Floating-Point)">;
|
2017-12-07 18:46:23 +08:00
|
|
|
|
2017-12-07 20:50:32 +08:00
|
|
|
def FeatureStdExtC
|
|
|
|
: SubtargetFeature<"c", "HasStdExtC", "true",
|
|
|
|
"'C' (Compressed Instructions)">;
|
|
|
|
def HasStdExtC : Predicate<"Subtarget->hasStdExtC()">,
|
[TableGen] Support combining AssemblerPredicates with ORs
For context, the proposed RISC-V bit manipulation extension has a subset
of instructions which require one of two SubtargetFeatures to be
enabled, 'zbb' or 'zbp', and there is no defined feature which both of
these can imply to use as a constraint either (see comments in D65649).
AssemblerPredicates allow multiple SubtargetFeatures to be declared in
the "AssemblerCondString" field, separated by commas, and this means
that the two features must both be enabled. There is no equivalent to
say that _either_ feature X or feature Y must be enabled, short of
creating a dummy SubtargetFeature for this purpose and having features X
and Y imply the new feature.
To solve the case where X or Y is needed without adding a new feature,
and to better match a typical TableGen style, this replaces the existing
"AssemblerCondString" with a dag "AssemblerCondDag" which represents the
same information. Two operators are defined for use with
AssemblerCondDag, "all_of", which matches the current behaviour, and
"any_of", which adds the new proposed ORing features functionality.
This was originally proposed in the RFC at
http://lists.llvm.org/pipermail/llvm-dev/2020-February/139138.html
Changes to all current backends are mechanical to support the replaced
functionality, and are NFCI.
At this stage, it is illegal to combine features with ands and ors in a
single AssemblerCondDag. I suspect this case is sufficiently rare that
adding more complex changes to support it are unnecessary.
Differential Revision: https://reviews.llvm.org/D74338
2020-03-14 01:13:51 +08:00
|
|
|
AssemblerPredicate<(all_of FeatureStdExtC),
|
2019-12-11 00:44:48 +08:00
|
|
|
"'C' (Compressed Instructions)">;
|
2017-12-07 20:50:32 +08:00
|
|
|
|
2020-04-10 00:51:10 +08:00
|
|
|
def FeatureExtZbb
|
|
|
|
: SubtargetFeature<"experimental-zbb", "HasStdExtZbb", "true",
|
|
|
|
"'Zbb' (Base 'B' Instructions)">;
|
|
|
|
def HasStdExtZbb : Predicate<"Subtarget->hasStdExtZbb()">,
|
|
|
|
AssemblerPredicate<(all_of FeatureExtZbb),
|
|
|
|
"'Zbb' (Base 'B' Instructions)">;
|
|
|
|
|
|
|
|
def FeatureExtZbc
|
|
|
|
: SubtargetFeature<"experimental-zbc", "HasStdExtZbc", "true",
|
|
|
|
"'Zbc' (Carry-Less 'B' Instructions)">;
|
|
|
|
def HasStdExtZbc : Predicate<"Subtarget->hasStdExtZbc()">,
|
|
|
|
AssemblerPredicate<(all_of FeatureExtZbc),
|
|
|
|
"'Zbc' (Carry-Less 'B' Instructions)">;
|
|
|
|
|
|
|
|
def FeatureExtZbe
|
|
|
|
: SubtargetFeature<"experimental-zbe", "HasStdExtZbe", "true",
|
|
|
|
"'Zbe' (Extract-Deposit 'B' Instructions)">;
|
|
|
|
def HasStdExtZbe : Predicate<"Subtarget->hasStdExtZbe()">,
|
|
|
|
AssemblerPredicate<(all_of FeatureExtZbe),
|
|
|
|
"'Zbe' (Extract-Deposit 'B' Instructions)">;
|
|
|
|
|
|
|
|
def FeatureExtZbf
|
|
|
|
: SubtargetFeature<"experimental-zbf", "HasStdExtZbf", "true",
|
|
|
|
"'Zbf' (Bit-Field 'B' Instructions)">;
|
|
|
|
def HasStdExtZbf : Predicate<"Subtarget->hasStdExtZbf()">,
|
|
|
|
AssemblerPredicate<(all_of FeatureExtZbf),
|
|
|
|
"'Zbf' (Bit-Field 'B' Instructions)">;
|
|
|
|
|
|
|
|
def FeatureExtZbm
|
|
|
|
: SubtargetFeature<"experimental-zbm", "HasStdExtZbm", "true",
|
|
|
|
"'Zbm' (Matrix 'B' Instructions)">;
|
|
|
|
def HasStdExtZbm : Predicate<"Subtarget->hasStdExtZbm()">,
|
|
|
|
AssemblerPredicate<(all_of FeatureExtZbm),
|
|
|
|
"'Zbm' (Matrix 'B' Instructions)">;
|
|
|
|
|
|
|
|
def FeatureExtZbp
|
|
|
|
: SubtargetFeature<"experimental-zbp", "HasStdExtZbp", "true",
|
|
|
|
"'Zbp' (Permutation 'B' Instructions)">;
|
|
|
|
def HasStdExtZbp : Predicate<"Subtarget->hasStdExtZbp()">,
|
|
|
|
AssemblerPredicate<(all_of FeatureExtZbp),
|
|
|
|
"'Zbp' (Permutation 'B' Instructions)">;
|
|
|
|
|
|
|
|
def FeatureExtZbr
|
|
|
|
: SubtargetFeature<"experimental-zbr", "HasStdExtZbr", "true",
|
|
|
|
"'Zbr' (Polynomial Reduction 'B' Instructions)">;
|
|
|
|
def HasStdExtZbr : Predicate<"Subtarget->hasStdExtZbr()">,
|
|
|
|
AssemblerPredicate<(all_of FeatureExtZbr),
|
|
|
|
"'Zbr' (Polynomial Reduction 'B' Instructions)">;
|
|
|
|
|
|
|
|
def FeatureExtZbs
|
|
|
|
: SubtargetFeature<"experimental-zbs", "HasStdExtZbs", "true",
|
|
|
|
"'Zbs' (Single-Bit 'B' Instructions)">;
|
|
|
|
def HasStdExtZbs : Predicate<"Subtarget->hasStdExtZbs()">,
|
|
|
|
AssemblerPredicate<(all_of FeatureExtZbs),
|
|
|
|
"'Zbs' (Single-Bit 'B' Instructions)">;
|
|
|
|
|
|
|
|
def FeatureExtZbt
|
|
|
|
: SubtargetFeature<"experimental-zbt", "HasStdExtZbt", "true",
|
|
|
|
"'Zbt' (Ternary 'B' Instructions)">;
|
|
|
|
def HasStdExtZbt : Predicate<"Subtarget->hasStdExtZbt()">,
|
|
|
|
AssemblerPredicate<(all_of FeatureExtZbt),
|
|
|
|
"'Zbt' (Ternary 'B' Instructions)">;
|
|
|
|
|
|
|
|
// Some instructions belong to both the basic and the permutation
|
|
|
|
// subextensions. They should be enabled if either has been specified.
|
|
|
|
def HasStdExtZbbOrZbp
|
|
|
|
: Predicate<"Subtarget->hasStdExtZbb() || Subtarget->hasStdExtZbp()">,
|
|
|
|
AssemblerPredicate<(any_of FeatureExtZbb, FeatureExtZbp)>;
|
|
|
|
|
|
|
|
def FeatureExtZbproposedc
|
|
|
|
: SubtargetFeature<"experimental-zbproposedc", "HasStdExtZbproposedc", "true",
|
|
|
|
"'Zbproposedc' (Proposed Compressed 'B' Instructions)">;
|
|
|
|
def HasStdExtZbproposedc : Predicate<"Subtarget->hasStdExtZbproposedc()">,
|
|
|
|
AssemblerPredicate<(all_of FeatureExtZbproposedc),
|
|
|
|
"'Zbproposedc' (Proposed Compressed 'B' Instructions)">;
|
|
|
|
|
|
|
|
def FeatureStdExtB
|
|
|
|
: SubtargetFeature<"experimental-b", "HasStdExtB", "true",
|
|
|
|
"'B' (Bit Manipulation Instructions)",
|
|
|
|
[FeatureExtZbb,
|
|
|
|
FeatureExtZbc,
|
|
|
|
FeatureExtZbe,
|
|
|
|
FeatureExtZbf,
|
|
|
|
FeatureExtZbm,
|
|
|
|
FeatureExtZbp,
|
|
|
|
FeatureExtZbr,
|
|
|
|
FeatureExtZbs,
|
|
|
|
FeatureExtZbt]>;
|
|
|
|
def HasStdExtB : Predicate<"Subtarget->hasStdExtB()">,
|
|
|
|
AssemblerPredicate<(all_of FeatureStdExtB),
|
|
|
|
"'B' (Bit Manipulation Instructions)">;
|
|
|
|
|
2019-08-21 22:00:58 +08:00
|
|
|
def FeatureRVCHints
|
|
|
|
: SubtargetFeature<"rvc-hints", "EnableRVCHintInstrs", "true",
|
|
|
|
"Enable RVC Hint Instructions.">;
|
|
|
|
def HasRVCHints : Predicate<"Subtarget->enableRVCHintInstrs()">,
|
[TableGen] Support combining AssemblerPredicates with ORs
For context, the proposed RISC-V bit manipulation extension has a subset
of instructions which require one of two SubtargetFeatures to be
enabled, 'zbb' or 'zbp', and there is no defined feature which both of
these can imply to use as a constraint either (see comments in D65649).
AssemblerPredicates allow multiple SubtargetFeatures to be declared in
the "AssemblerCondString" field, separated by commas, and this means
that the two features must both be enabled. There is no equivalent to
say that _either_ feature X or feature Y must be enabled, short of
creating a dummy SubtargetFeature for this purpose and having features X
and Y imply the new feature.
To solve the case where X or Y is needed without adding a new feature,
and to better match a typical TableGen style, this replaces the existing
"AssemblerCondString" with a dag "AssemblerCondDag" which represents the
same information. Two operators are defined for use with
AssemblerCondDag, "all_of", which matches the current behaviour, and
"any_of", which adds the new proposed ORing features functionality.
This was originally proposed in the RFC at
http://lists.llvm.org/pipermail/llvm-dev/2020-February/139138.html
Changes to all current backends are mechanical to support the replaced
functionality, and are NFCI.
At this stage, it is illegal to combine features with ands and ors in a
single AssemblerCondDag. I suspect this case is sufficiently rare that
adding more complex changes to support it are unnecessary.
Differential Revision: https://reviews.llvm.org/D74338
2020-03-14 01:13:51 +08:00
|
|
|
AssemblerPredicate<(all_of FeatureRVCHints),
|
2019-12-11 00:44:48 +08:00
|
|
|
"RVC Hint Instructions">;
|
2017-12-07 20:50:32 +08:00
|
|
|
|
2019-10-24 12:29:28 +08:00
|
|
|
def FeatureStdExtV
|
|
|
|
: SubtargetFeature<"experimental-v", "HasStdExtV", "true",
|
|
|
|
"'V' (Vector Instructions)",
|
|
|
|
[FeatureStdExtF]>;
|
|
|
|
def HasStdExtV : Predicate<"Subtarget->hasStdExtV()">,
|
|
|
|
AssemblerPredicate<(all_of FeatureStdExtV),
|
|
|
|
"'V' (Vector Instructions)">;
|
|
|
|
|
2017-11-09 23:00:03 +08:00
|
|
|
def Feature64Bit
|
|
|
|
: SubtargetFeature<"64bit", "HasRV64", "true", "Implements RV64">;
|
2017-12-07 18:53:48 +08:00
|
|
|
def IsRV64 : Predicate<"Subtarget->is64Bit()">,
|
[TableGen] Support combining AssemblerPredicates with ORs
For context, the proposed RISC-V bit manipulation extension has a subset
of instructions which require one of two SubtargetFeatures to be
enabled, 'zbb' or 'zbp', and there is no defined feature which both of
these can imply to use as a constraint either (see comments in D65649).
AssemblerPredicates allow multiple SubtargetFeatures to be declared in
the "AssemblerCondString" field, separated by commas, and this means
that the two features must both be enabled. There is no equivalent to
say that _either_ feature X or feature Y must be enabled, short of
creating a dummy SubtargetFeature for this purpose and having features X
and Y imply the new feature.
To solve the case where X or Y is needed without adding a new feature,
and to better match a typical TableGen style, this replaces the existing
"AssemblerCondString" with a dag "AssemblerCondDag" which represents the
same information. Two operators are defined for use with
AssemblerCondDag, "all_of", which matches the current behaviour, and
"any_of", which adds the new proposed ORing features functionality.
This was originally proposed in the RFC at
http://lists.llvm.org/pipermail/llvm-dev/2020-February/139138.html
Changes to all current backends are mechanical to support the replaced
functionality, and are NFCI.
At this stage, it is illegal to combine features with ands and ors in a
single AssemblerCondDag. I suspect this case is sufficiently rare that
adding more complex changes to support it are unnecessary.
Differential Revision: https://reviews.llvm.org/D74338
2020-03-14 01:13:51 +08:00
|
|
|
AssemblerPredicate<(all_of Feature64Bit),
|
2019-12-11 00:44:48 +08:00
|
|
|
"RV64I Base Instruction Set">;
|
2017-12-12 23:46:15 +08:00
|
|
|
def IsRV32 : Predicate<"!Subtarget->is64Bit()">,
|
[TableGen] Support combining AssemblerPredicates with ORs
For context, the proposed RISC-V bit manipulation extension has a subset
of instructions which require one of two SubtargetFeatures to be
enabled, 'zbb' or 'zbp', and there is no defined feature which both of
these can imply to use as a constraint either (see comments in D65649).
AssemblerPredicates allow multiple SubtargetFeatures to be declared in
the "AssemblerCondString" field, separated by commas, and this means
that the two features must both be enabled. There is no equivalent to
say that _either_ feature X or feature Y must be enabled, short of
creating a dummy SubtargetFeature for this purpose and having features X
and Y imply the new feature.
To solve the case where X or Y is needed without adding a new feature,
and to better match a typical TableGen style, this replaces the existing
"AssemblerCondString" with a dag "AssemblerCondDag" which represents the
same information. Two operators are defined for use with
AssemblerCondDag, "all_of", which matches the current behaviour, and
"any_of", which adds the new proposed ORing features functionality.
This was originally proposed in the RFC at
http://lists.llvm.org/pipermail/llvm-dev/2020-February/139138.html
Changes to all current backends are mechanical to support the replaced
functionality, and are NFCI.
At this stage, it is illegal to combine features with ands and ors in a
single AssemblerCondDag. I suspect this case is sufficiently rare that
adding more complex changes to support it are unnecessary.
Differential Revision: https://reviews.llvm.org/D74338
2020-03-14 01:13:51 +08:00
|
|
|
AssemblerPredicate<(all_of (not Feature64Bit)),
|
2019-12-11 00:44:48 +08:00
|
|
|
"RV32I Base Instruction Set">;
|
2017-11-09 22:46:30 +08:00
|
|
|
|
|
|
|
def RV64 : HwMode<"+64bit">;
|
|
|
|
def RV32 : HwMode<"-64bit">;
|
2017-10-19 22:29:03 +08:00
|
|
|
|
2019-03-22 19:21:40 +08:00
|
|
|
def FeatureRV32E
|
|
|
|
: SubtargetFeature<"e", "IsRV32E", "true",
|
|
|
|
"Implements RV32E (provides 16 rather than 32 GPRs)">;
|
|
|
|
def IsRV32E : Predicate<"Subtarget->isRV32E()">,
|
[TableGen] Support combining AssemblerPredicates with ORs
For context, the proposed RISC-V bit manipulation extension has a subset
of instructions which require one of two SubtargetFeatures to be
enabled, 'zbb' or 'zbp', and there is no defined feature which both of
these can imply to use as a constraint either (see comments in D65649).
AssemblerPredicates allow multiple SubtargetFeatures to be declared in
the "AssemblerCondString" field, separated by commas, and this means
that the two features must both be enabled. There is no equivalent to
say that _either_ feature X or feature Y must be enabled, short of
creating a dummy SubtargetFeature for this purpose and having features X
and Y imply the new feature.
To solve the case where X or Y is needed without adding a new feature,
and to better match a typical TableGen style, this replaces the existing
"AssemblerCondString" with a dag "AssemblerCondDag" which represents the
same information. Two operators are defined for use with
AssemblerCondDag, "all_of", which matches the current behaviour, and
"any_of", which adds the new proposed ORing features functionality.
This was originally proposed in the RFC at
http://lists.llvm.org/pipermail/llvm-dev/2020-February/139138.html
Changes to all current backends are mechanical to support the replaced
functionality, and are NFCI.
At this stage, it is illegal to combine features with ands and ors in a
single AssemblerCondDag. I suspect this case is sufficiently rare that
adding more complex changes to support it are unnecessary.
Differential Revision: https://reviews.llvm.org/D74338
2020-03-14 01:13:51 +08:00
|
|
|
AssemblerPredicate<(all_of FeatureRV32E)>;
|
2019-03-22 19:21:40 +08:00
|
|
|
|
2018-05-15 09:28:50 +08:00
|
|
|
def FeatureRelax
|
|
|
|
: SubtargetFeature<"relax", "EnableLinkerRelax", "true",
|
|
|
|
"Enable Linker relaxation.">;
|
|
|
|
|
2019-10-23 04:25:01 +08:00
|
|
|
foreach i = {1-31} in
|
|
|
|
def FeatureReserveX#i :
|
|
|
|
SubtargetFeature<"reserve-x"#i, "UserReservedRegister[RISCV::X"#i#"]",
|
|
|
|
"true", "Reserve X"#i>;
|
|
|
|
|
2020-02-12 05:23:03 +08:00
|
|
|
def FeatureSaveRestore : SubtargetFeature<"save-restore", "EnableSaveRestore",
|
|
|
|
"true", "Enable save/restore.">;
|
|
|
|
|
2017-10-19 22:29:03 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
[RISCV][NFC] Replace hard-coded CSR duplication with symbolic references
Reviewers: asb, lenary
Reviewed By: asb, lenary
Subscribers: MaskRay, hiraditya, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D64139
Patch by James Clarke (jrtc27)
llvm-svn: 365195
2019-07-05 20:16:40 +08:00
|
|
|
// Named operands for CSR instructions.
|
2017-10-19 22:29:03 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
[RISCV][NFC] Replace hard-coded CSR duplication with symbolic references
Reviewers: asb, lenary
Reviewed By: asb, lenary
Subscribers: MaskRay, hiraditya, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D64139
Patch by James Clarke (jrtc27)
llvm-svn: 365195
2019-07-05 20:16:40 +08:00
|
|
|
include "RISCVSystemOperands.td"
|
2016-11-02 07:40:28 +08:00
|
|
|
|
[RISCV] Support named operands for CSR instructions.
Reviewers: asb, mgrang
Reviewed By: asb
Subscribers: jocewei, mgorny, jfb, PkmX, MartinMosbeck, brucehoult, the_o, rkruppe, rogfer01, rbar, johnrusso, simoncook, jordy.potman.lists, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones
Differential Revision: https://reviews.llvm.org/D46759
llvm-svn: 343822
2018-10-05 05:50:54 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
[RISCV][NFC] Replace hard-coded CSR duplication with symbolic references
Reviewers: asb, lenary
Reviewed By: asb, lenary
Subscribers: MaskRay, hiraditya, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D64139
Patch by James Clarke (jrtc27)
llvm-svn: 365195
2019-07-05 20:16:40 +08:00
|
|
|
// Registers, calling conventions, instruction descriptions.
|
[RISCV] Support named operands for CSR instructions.
Reviewers: asb, mgrang
Reviewed By: asb
Subscribers: jocewei, mgorny, jfb, PkmX, MartinMosbeck, brucehoult, the_o, rkruppe, rogfer01, rbar, johnrusso, simoncook, jordy.potman.lists, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones
Differential Revision: https://reviews.llvm.org/D46759
llvm-svn: 343822
2018-10-05 05:50:54 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2020-01-24 04:51:04 +08:00
|
|
|
include "RISCVSchedule.td"
|
[RISCV][NFC] Replace hard-coded CSR duplication with symbolic references
Reviewers: asb, lenary
Reviewed By: asb, lenary
Subscribers: MaskRay, hiraditya, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D64139
Patch by James Clarke (jrtc27)
llvm-svn: 365195
2019-07-05 20:16:40 +08:00
|
|
|
include "RISCVRegisterInfo.td"
|
|
|
|
include "RISCVCallingConv.td"
|
|
|
|
include "RISCVInstrInfo.td"
|
[RISCV GlobalISel] Adding initial GlobalISel infrastructure
Summary:
Add an initial GlobalISel skeleton for RISCV. It can only run ir translator for `ret void`.
Patch by Andrew Wei
Reviewers: asb, sabuasal, apazos, lenary, simoncook, lewis-revill, edward-jones, rogfer01, xiangzhai, rovka, Petar.Avramovic, mgorny, dsanders
Reviewed By: dsanders
Subscribers: pzheng, s.egerton, dsanders, hiraditya, rbar, johnrusso, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay, zzheng, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, psnobl, benna, Jim, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65219
llvm-svn: 369467
2019-08-21 06:53:24 +08:00
|
|
|
include "RISCVRegisterBanks.td"
|
2020-01-24 04:51:04 +08:00
|
|
|
include "RISCVSchedRocket32.td"
|
|
|
|
include "RISCVSchedRocket64.td"
|
[RISCV] Support named operands for CSR instructions.
Reviewers: asb, mgrang
Reviewed By: asb
Subscribers: jocewei, mgorny, jfb, PkmX, MartinMosbeck, brucehoult, the_o, rkruppe, rogfer01, rbar, johnrusso, simoncook, jordy.potman.lists, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones
Differential Revision: https://reviews.llvm.org/D46759
llvm-svn: 343822
2018-10-05 05:50:54 +08:00
|
|
|
|
2017-10-19 22:29:03 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// RISC-V processors supported.
|
|
|
|
//===----------------------------------------------------------------------===//
|
2016-11-02 07:40:28 +08:00
|
|
|
|
2019-08-21 22:00:58 +08:00
|
|
|
def : ProcessorModel<"generic-rv32", NoSchedModel, [FeatureRVCHints]>;
|
2016-11-02 07:40:28 +08:00
|
|
|
|
2019-08-21 22:00:58 +08:00
|
|
|
def : ProcessorModel<"generic-rv64", NoSchedModel, [Feature64Bit,
|
|
|
|
FeatureRVCHints]>;
|
2016-11-02 07:40:28 +08:00
|
|
|
|
2020-01-24 04:51:04 +08:00
|
|
|
def : ProcessorModel<"rocket-rv32", Rocket32Model, [FeatureRVCHints]>;
|
|
|
|
|
|
|
|
def : ProcessorModel<"rocket-rv64", Rocket64Model, [Feature64Bit,
|
|
|
|
FeatureRVCHints]>;
|
|
|
|
|
|
|
|
|
2017-10-19 22:29:03 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Define the RISC-V target.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2017-10-20 05:37:38 +08:00
|
|
|
def RISCVInstrInfo : InstrInfo {
|
2017-11-08 17:26:06 +08:00
|
|
|
let guessInstructionProperties = 0;
|
2017-10-20 05:37:38 +08:00
|
|
|
}
|
2017-10-19 22:29:03 +08:00
|
|
|
|
2017-08-08 22:32:35 +08:00
|
|
|
def RISCVAsmParser : AsmParser {
|
|
|
|
let ShouldEmitMatchRegisterAltName = 1;
|
2017-12-07 18:46:23 +08:00
|
|
|
let AllowDuplicateRegisterNames = 1;
|
2017-08-08 22:32:35 +08:00
|
|
|
}
|
|
|
|
|
2018-01-12 10:27:00 +08:00
|
|
|
def RISCVAsmWriter : AsmWriter {
|
|
|
|
int PassSubtarget = 1;
|
|
|
|
}
|
|
|
|
|
2016-11-02 07:40:28 +08:00
|
|
|
def RISCV : Target {
|
|
|
|
let InstructionSet = RISCVInstrInfo;
|
2017-08-08 22:32:35 +08:00
|
|
|
let AssemblyParsers = [RISCVAsmParser];
|
2018-01-12 10:27:00 +08:00
|
|
|
let AssemblyWriters = [RISCVAsmWriter];
|
[MachineOperand][Target] MachineOperand::isRenamable semantics changes
Summary:
Add a target option AllowRegisterRenaming that is used to opt in to
post-register-allocation renaming of registers. This is set to 0 by
default, which causes the hasExtraSrcRegAllocReq/hasExtraDstRegAllocReq
fields of all opcodes to be set to 1, causing
MachineOperand::isRenamable to always return false.
Set the AllowRegisterRenaming flag to 1 for all in-tree targets that
have lit tests that were effected by enabling COPY forwarding in
MachineCopyPropagation (AArch64, AMDGPU, ARM, Hexagon, Mips, PowerPC,
RISCV, Sparc, SystemZ and X86).
Add some more comments describing the semantics of the
MachineOperand::isRenamable function and how it is set and maintained.
Change isRenamable to check the operand's opcode
hasExtraSrcRegAllocReq/hasExtraDstRegAllocReq bit directly instead of
relying on it being consistently reflected in the IsRenamable bit
setting.
Clear the IsRenamable bit when changing an operand's register value.
Remove target code that was clearing the IsRenamable bit when changing
registers/opcodes now that this is done conservatively by default.
Change setting of hasExtraSrcRegAllocReq in AMDGPU target to be done in
one place covering all opcodes that have constant pipe read limit
restrictions.
Reviewers: qcolombet, MatzeB
Subscribers: aemerson, arsenm, jyknight, mcrosier, sdardis, nhaehnle, javed.absar, tpr, arichardson, kristof.beyls, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, jordy.potman.lists, apazos, sabuasal, niosHD, escha, nemanjai, llvm-commits
Differential Revision: https://reviews.llvm.org/D43042
llvm-svn: 325931
2018-02-24 02:25:08 +08:00
|
|
|
let AllowRegisterRenaming = 1;
|
2016-11-02 07:40:28 +08:00
|
|
|
}
|