2016-11-02 07:40:28 +08:00
|
|
|
//===-- RISCV.td - Describe the RISCV Target Machine -------*- tablegen -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
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()">,
|
2017-11-09 22:46:30 +08:00
|
|
|
AssemblerPredicate<"FeatureStdExtM">;
|
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()">,
|
|
|
|
AssemblerPredicate<"FeatureStdExtA">;
|
|
|
|
|
2017-12-07 18:26:05 +08:00
|
|
|
def FeatureStdExtF
|
|
|
|
: SubtargetFeature<"f", "HasStdExtF", "true",
|
|
|
|
"'F' (Single-Precision Floating-Point)">;
|
|
|
|
def HasStdExtF : Predicate<"Subtarget->hasStdExtF()">,
|
|
|
|
AssemblerPredicate<"FeatureStdExtF">;
|
|
|
|
|
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()">,
|
|
|
|
AssemblerPredicate<"FeatureStdExtD">;
|
|
|
|
|
2017-12-07 20:50:32 +08:00
|
|
|
def FeatureStdExtC
|
|
|
|
: SubtargetFeature<"c", "HasStdExtC", "true",
|
|
|
|
"'C' (Compressed Instructions)">;
|
|
|
|
def HasStdExtC : Predicate<"Subtarget->hasStdExtC()">,
|
|
|
|
AssemblerPredicate<"FeatureStdExtC">;
|
|
|
|
|
|
|
|
|
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()">,
|
|
|
|
AssemblerPredicate<"Feature64Bit">;
|
2017-12-12 23:46:15 +08:00
|
|
|
def IsRV32 : Predicate<"!Subtarget->is64Bit()">,
|
|
|
|
AssemblerPredicate<"!Feature64Bit">;
|
2017-11-09 22:46:30 +08:00
|
|
|
|
|
|
|
def RV64 : HwMode<"+64bit">;
|
|
|
|
def RV32 : HwMode<"-64bit">;
|
2017-10-19 22:29:03 +08:00
|
|
|
|
2018-05-15 09:28:50 +08:00
|
|
|
def FeatureRelax
|
|
|
|
: SubtargetFeature<"relax", "EnableLinkerRelax", "true",
|
|
|
|
"Enable Linker relaxation.">;
|
|
|
|
|
2017-10-19 22:29:03 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2017-10-20 05:37:38 +08:00
|
|
|
// Registers, calling conventions, instruction descriptions.
|
2017-10-19 22:29:03 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
include "RISCVRegisterInfo.td"
|
2017-10-20 05:37:38 +08:00
|
|
|
include "RISCVCallingConv.td"
|
2017-10-19 22:29:03 +08:00
|
|
|
include "RISCVInstrInfo.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
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Named operands for CSR instructions.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
include "RISCVSystemOperands.td"
|
|
|
|
|
2017-10-19 22:29:03 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// RISC-V processors supported.
|
|
|
|
//===----------------------------------------------------------------------===//
|
2016-11-02 07:40:28 +08:00
|
|
|
|
|
|
|
def : ProcessorModel<"generic-rv32", NoSchedModel, []>;
|
|
|
|
|
|
|
|
def : ProcessorModel<"generic-rv64", NoSchedModel, [Feature64Bit]>;
|
|
|
|
|
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
|
|
|
}
|