2012-02-18 20:03:15 +08:00
|
|
|
//===-- Hexagon.td - Describe the Hexagon Target Machine --*- tablegen -*--===//
|
2011-12-13 05:14:40 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
2012-02-18 20:03:15 +08:00
|
|
|
// This is the top level entry point for the Hexagon target.
|
2011-12-13 05:14:40 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Target-independent interfaces which we are implementing
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
include "llvm/Target/Target.td"
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Hexagon Subtarget features.
|
2012-02-18 20:03:15 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2011-12-13 05:14:40 +08:00
|
|
|
|
2015-02-10 05:56:37 +08:00
|
|
|
// Hexagon Architectures
|
|
|
|
def ArchV4: SubtargetFeature<"v4", "HexagonArchVersion", "V4", "Hexagon V4">;
|
|
|
|
def ArchV5: SubtargetFeature<"v5", "HexagonArchVersion", "V5", "Hexagon V5">;
|
2015-10-17 09:33:04 +08:00
|
|
|
def ArchV55: SubtargetFeature<"v55", "HexagonArchVersion", "V55", "Hexagon V55">;
|
|
|
|
def ArchV60: SubtargetFeature<"v60", "HexagonArchVersion", "V60", "Hexagon V60">;
|
2011-12-13 05:14:40 +08:00
|
|
|
|
2015-10-17 09:33:04 +08:00
|
|
|
// Hexagon ISA Extensions
|
|
|
|
def ExtensionHVX: SubtargetFeature<"hvx", "UseHVXOps",
|
|
|
|
"true", "Hexagon HVX instructions">;
|
2015-11-09 12:07:48 +08:00
|
|
|
def ExtensionHVXDbl: SubtargetFeature<"hvxDbl", "UseHVXDblOps",
|
|
|
|
"true", "Hexagon HVX Double instructions">;
|
|
|
|
|
2012-12-04 12:29:16 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Hexagon Instruction Predicate Definitions.
|
|
|
|
//===----------------------------------------------------------------------===//
|
2015-10-17 09:33:04 +08:00
|
|
|
def HasV5T : Predicate<"HST->hasV5TOps()">;
|
|
|
|
def NoV5T : Predicate<"!HST->hasV5TOps()">;
|
|
|
|
def HasV55T : Predicate<"HST->hasV55TOps()">,
|
|
|
|
AssemblerPredicate<"ArchV55">;
|
|
|
|
def HasV60T : Predicate<"HST->hasV60TOps()">,
|
|
|
|
AssemblerPredicate<"ArchV60">;
|
|
|
|
def UseMEMOP : Predicate<"HST->useMemOps()">;
|
|
|
|
def IEEERndNearV5T : Predicate<"HST->modeIEEERndNear()">;
|
|
|
|
def UseHVXDbl : Predicate<"HST->useHVXDblOps()">,
|
|
|
|
AssemblerPredicate<"ExtensionHVXDbl">;
|
|
|
|
def UseHVXSgl : Predicate<"HST->useHVXSglOps()">;
|
|
|
|
|
2015-11-27 00:54:33 +08:00
|
|
|
def UseHVX : Predicate<"HST->useHVXSglOps() ||HST->useHVXDblOps()">,
|
2015-10-17 09:33:04 +08:00
|
|
|
AssemblerPredicate<"ExtensionHVX">;
|
2012-12-04 12:29:16 +08:00
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Classes used for relation maps.
|
|
|
|
//===----------------------------------------------------------------------===//
|
2014-12-31 02:58:47 +08:00
|
|
|
|
|
|
|
class ImmRegShl;
|
2012-12-04 12:29:16 +08:00
|
|
|
// PredRel - Filter class used to relate non-predicated instructions with their
|
|
|
|
// predicated forms.
|
|
|
|
class PredRel;
|
|
|
|
// PredNewRel - Filter class used to relate predicated instructions with their
|
|
|
|
// predicate-new forms.
|
|
|
|
class PredNewRel: PredRel;
|
|
|
|
// ImmRegRel - Filter class used to relate instructions having reg-reg form
|
|
|
|
// with their reg-imm counterparts.
|
|
|
|
class ImmRegRel;
|
|
|
|
// NewValueRel - Filter class used to relate regular store instructions with
|
|
|
|
// their new-value store form.
|
|
|
|
class NewValueRel: PredNewRel;
|
|
|
|
// NewValueRel - Filter class used to relate load/store instructions having
|
|
|
|
// different addressing modes with each other.
|
|
|
|
class AddrModeRel: NewValueRel;
|
2015-11-24 22:55:26 +08:00
|
|
|
class IntrinsicsRel;
|
2012-12-04 12:29:16 +08:00
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Generate mapping table to relate non-predicate instructions with their
|
|
|
|
// predicated formats - true and false.
|
|
|
|
//
|
|
|
|
|
|
|
|
def getPredOpcode : InstrMapping {
|
|
|
|
let FilterClass = "PredRel";
|
|
|
|
// Instructions with the same BaseOpcode and isNVStore values form a row.
|
2015-10-17 09:33:04 +08:00
|
|
|
let RowFields = ["BaseOpcode", "isNVStore", "PNewValue", "isNT"];
|
2012-12-04 12:29:16 +08:00
|
|
|
// Instructions with the same predicate sense form a column.
|
|
|
|
let ColFields = ["PredSense"];
|
|
|
|
// The key column is the unpredicated instructions.
|
|
|
|
let KeyCol = [""];
|
|
|
|
// Value columns are PredSense=true and PredSense=false
|
|
|
|
let ValueCols = [["true"], ["false"]];
|
|
|
|
}
|
|
|
|
|
2013-05-07 02:49:23 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Generate mapping table to relate predicate-true instructions with their
|
|
|
|
// predicate-false forms
|
|
|
|
//
|
|
|
|
def getFalsePredOpcode : InstrMapping {
|
|
|
|
let FilterClass = "PredRel";
|
2015-10-17 09:33:04 +08:00
|
|
|
let RowFields = ["BaseOpcode", "PNewValue", "isNVStore", "isBrTaken", "isNT"];
|
2013-05-07 02:49:23 +08:00
|
|
|
let ColFields = ["PredSense"];
|
|
|
|
let KeyCol = ["true"];
|
|
|
|
let ValueCols = [["false"]];
|
|
|
|
}
|
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Generate mapping table to relate predicate-false instructions with their
|
|
|
|
// predicate-true forms
|
|
|
|
//
|
|
|
|
def getTruePredOpcode : InstrMapping {
|
|
|
|
let FilterClass = "PredRel";
|
2015-10-17 09:33:04 +08:00
|
|
|
let RowFields = ["BaseOpcode", "PNewValue", "isNVStore", "isBrTaken", "isNT"];
|
2013-05-07 02:49:23 +08:00
|
|
|
let ColFields = ["PredSense"];
|
|
|
|
let KeyCol = ["false"];
|
|
|
|
let ValueCols = [["true"]];
|
|
|
|
}
|
|
|
|
|
2012-12-04 12:29:16 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Generate mapping table to relate predicated instructions with their .new
|
|
|
|
// format.
|
|
|
|
//
|
|
|
|
def getPredNewOpcode : InstrMapping {
|
|
|
|
let FilterClass = "PredNewRel";
|
2013-05-02 05:37:34 +08:00
|
|
|
let RowFields = ["BaseOpcode", "PredSense", "isNVStore", "isBrTaken"];
|
2012-12-04 12:29:16 +08:00
|
|
|
let ColFields = ["PNewValue"];
|
|
|
|
let KeyCol = [""];
|
|
|
|
let ValueCols = [["new"]];
|
|
|
|
}
|
|
|
|
|
2013-05-11 04:58:11 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Generate mapping table to relate .new predicated instructions with their old
|
|
|
|
// format.
|
|
|
|
//
|
|
|
|
def getPredOldOpcode : InstrMapping {
|
|
|
|
let FilterClass = "PredNewRel";
|
|
|
|
let RowFields = ["BaseOpcode", "PredSense", "isNVStore"];
|
|
|
|
let ColFields = ["PNewValue"];
|
|
|
|
let KeyCol = ["new"];
|
|
|
|
let ValueCols = [[""]];
|
|
|
|
}
|
|
|
|
|
2012-12-04 12:29:16 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Generate mapping table to relate store instructions with their new-value
|
|
|
|
// format.
|
|
|
|
//
|
|
|
|
def getNewValueOpcode : InstrMapping {
|
|
|
|
let FilterClass = "NewValueRel";
|
2015-10-17 09:33:04 +08:00
|
|
|
let RowFields = ["BaseOpcode", "PredSense", "PNewValue", "addrMode", "isNT"];
|
2013-05-11 04:27:34 +08:00
|
|
|
let ColFields = ["NValueST"];
|
|
|
|
let KeyCol = ["false"];
|
|
|
|
let ValueCols = [["true"]];
|
2012-12-04 12:29:16 +08:00
|
|
|
}
|
|
|
|
|
2013-05-11 04:58:11 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Generate mapping table to relate new-value store instructions with their old
|
|
|
|
// format.
|
|
|
|
//
|
|
|
|
def getNonNVStore : InstrMapping {
|
|
|
|
let FilterClass = "NewValueRel";
|
2015-10-17 09:33:04 +08:00
|
|
|
let RowFields = ["BaseOpcode", "PredSense", "PNewValue", "addrMode", "isNT"];
|
2013-05-11 04:58:11 +08:00
|
|
|
let ColFields = ["NValueST"];
|
|
|
|
let KeyCol = ["true"];
|
|
|
|
let ValueCols = [["false"]];
|
|
|
|
}
|
|
|
|
|
2015-10-21 03:21:05 +08:00
|
|
|
def getBaseWithImmOffset : InstrMapping {
|
2012-12-04 12:29:16 +08:00
|
|
|
let FilterClass = "AddrModeRel";
|
|
|
|
let RowFields = ["CextOpcode", "PredSense", "PNewValue", "isNVStore",
|
2015-10-21 03:04:53 +08:00
|
|
|
"isFloat"];
|
2012-12-04 12:29:16 +08:00
|
|
|
let ColFields = ["addrMode"];
|
|
|
|
let KeyCol = ["Absolute"];
|
|
|
|
let ValueCols = [["BaseImmOffset"]];
|
|
|
|
}
|
|
|
|
|
|
|
|
def getBaseWithRegOffset : InstrMapping {
|
|
|
|
let FilterClass = "AddrModeRel";
|
|
|
|
let RowFields = ["CextOpcode", "PredSense", "PNewValue", "isNVStore"];
|
|
|
|
let ColFields = ["addrMode"];
|
|
|
|
let KeyCol = ["BaseImmOffset"];
|
|
|
|
let ValueCols = [["BaseRegOffset"]];
|
|
|
|
}
|
|
|
|
|
|
|
|
def getRegForm : InstrMapping {
|
|
|
|
let FilterClass = "ImmRegRel";
|
|
|
|
let RowFields = ["CextOpcode", "PredSense", "PNewValue"];
|
|
|
|
let ColFields = ["InputType"];
|
|
|
|
let KeyCol = ["imm"];
|
|
|
|
let ValueCols = [["reg"]];
|
|
|
|
}
|
|
|
|
|
2015-11-24 22:55:26 +08:00
|
|
|
def getRegShlForm : InstrMapping {
|
|
|
|
let FilterClass = "ImmRegShl";
|
|
|
|
let RowFields = ["CextOpcode", "PredSense", "PNewValue", "isNVStore"];
|
|
|
|
let ColFields = ["InputType"];
|
|
|
|
let KeyCol = ["imm"];
|
|
|
|
let ValueCols = [["reg"]];
|
|
|
|
}
|
|
|
|
|
|
|
|
def notTakenBranchPrediction : InstrMapping {
|
|
|
|
let FilterClass = "PredRel";
|
|
|
|
let RowFields = ["BaseOpcode", "PNewValue", "PredSense", "isBranch", "isPredicated"];
|
|
|
|
let ColFields = ["isBrTaken"];
|
|
|
|
let KeyCol = ["true"];
|
|
|
|
let ValueCols = [["false"]];
|
|
|
|
}
|
|
|
|
|
|
|
|
def takenBranchPrediction : InstrMapping {
|
|
|
|
let FilterClass = "PredRel";
|
|
|
|
let RowFields = ["BaseOpcode", "PNewValue", "PredSense", "isBranch", "isPredicated"];
|
|
|
|
let ColFields = ["isBrTaken"];
|
|
|
|
let KeyCol = ["false"];
|
|
|
|
let ValueCols = [["true"]];
|
|
|
|
}
|
|
|
|
|
|
|
|
def getRealHWInstr : InstrMapping {
|
|
|
|
let FilterClass = "IntrinsicsRel";
|
|
|
|
let RowFields = ["BaseOpcode"];
|
|
|
|
let ColFields = ["InstrType"];
|
|
|
|
let KeyCol = ["Pseudo"];
|
|
|
|
let ValueCols = [["Pseudo"], ["Real"]];
|
|
|
|
}
|
2011-12-13 05:14:40 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Register File, Calling Conv, Instruction Descriptions
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
include "HexagonSchedule.td"
|
|
|
|
include "HexagonRegisterInfo.td"
|
|
|
|
include "HexagonCallingConv.td"
|
|
|
|
include "HexagonInstrInfo.td"
|
|
|
|
include "HexagonIntrinsics.td"
|
|
|
|
include "HexagonIntrinsicsDerived.td"
|
|
|
|
|
2012-04-13 01:55:53 +08:00
|
|
|
def HexagonInstrInfo : InstrInfo;
|
2011-12-13 05:14:40 +08:00
|
|
|
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Hexagon processors supported.
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2012-07-07 12:00:00 +08:00
|
|
|
class Proc<string Name, SchedMachineModel Model,
|
2011-12-13 05:14:40 +08:00
|
|
|
list<SubtargetFeature> Features>
|
2012-07-07 12:00:00 +08:00
|
|
|
: ProcessorModel<Name, Model, Features>;
|
2011-12-13 05:14:40 +08:00
|
|
|
|
2015-02-10 05:56:37 +08:00
|
|
|
def : Proc<"hexagonv4", HexagonModelV4,
|
|
|
|
[ArchV4]>;
|
|
|
|
def : Proc<"hexagonv5", HexagonModelV4,
|
|
|
|
[ArchV4, ArchV5]>;
|
2015-11-24 22:55:26 +08:00
|
|
|
def : Proc<"hexagonv55", HexagonModelV55,
|
|
|
|
[ArchV4, ArchV5, ArchV55]>;
|
|
|
|
def : Proc<"hexagonv60", HexagonModelV60,
|
|
|
|
[ArchV4, ArchV5, ArchV55, ArchV60, ExtensionHVX]>;
|
2012-05-11 04:20:25 +08:00
|
|
|
|
2011-12-13 05:14:40 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// Declare the target which we are implementing
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2015-11-09 12:07:48 +08:00
|
|
|
def HexagonAsmParserVariant : AsmParserVariant {
|
|
|
|
int Variant = 0;
|
|
|
|
string TokenizingCharacters = "#()=:.<>!+*";
|
|
|
|
}
|
|
|
|
|
2011-12-13 05:14:40 +08:00
|
|
|
def Hexagon : Target {
|
|
|
|
// Pull in Instruction Info:
|
|
|
|
let InstructionSet = HexagonInstrInfo;
|
2015-11-09 12:07:48 +08:00
|
|
|
let AssemblyParserVariants = [HexagonAsmParserVariant];
|
2011-12-13 05:14:40 +08:00
|
|
|
}
|