2017-08-01 23:20:10 +02:00
|
|
|
//===- HexagonBaseInfo.h - Top level definitions for Hexagon ----*- C++ -*-===//
|
2012-02-08 19:25:47 +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
|
2012-02-08 19:25:47 +01:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// This file contains small standalone helper functions and enum definitions for
|
|
|
|
// the Hexagon target useful for the compiler back-end and the MC libraries.
|
|
|
|
// As such, it deliberately does not include references to LLVM core
|
|
|
|
// code gen types, passes, etc..
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-13 18:26:38 +02:00
|
|
|
#ifndef LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONBASEINFO_H
|
|
|
|
#define LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONBASEINFO_H
|
2012-02-08 19:25:47 +01:00
|
|
|
|
2017-02-10 16:33:13 +01:00
|
|
|
#include "HexagonDepITypes.h"
|
2017-08-01 23:20:10 +02:00
|
|
|
#include "MCTargetDesc/HexagonMCTargetDesc.h"
|
2014-10-27 13:37:26 +01:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
|
|
|
|
/// HexagonII - This namespace holds all of the target specific flags that
|
2012-02-08 19:25:47 +01:00
|
|
|
/// instruction info tracks.
|
|
|
|
namespace HexagonII {
|
2018-06-19 20:09:54 +02:00
|
|
|
unsigned const TypeCVI_FIRST = TypeCVI_4SLOT_MPY;
|
2018-12-05 22:01:07 +01:00
|
|
|
unsigned const TypeCVI_LAST = TypeCVI_ZW;
|
2012-05-03 23:52:53 +02:00
|
|
|
|
2012-11-14 21:38:48 +01:00
|
|
|
enum AddrMode {
|
|
|
|
NoAddrMode = 0, // No addressing mode
|
|
|
|
Absolute = 1, // Absolute addressing mode
|
|
|
|
AbsoluteSet = 2, // Absolute set addressing mode
|
|
|
|
BaseImmOffset = 3, // Indirect with offset
|
|
|
|
BaseLongOffset = 4, // Indirect with long offset
|
2013-05-07 17:06:29 +02:00
|
|
|
BaseRegOffset = 5, // Indirect with register offset
|
|
|
|
PostInc = 6 // Post increment addressing mode
|
2012-11-14 21:38:48 +01:00
|
|
|
};
|
2012-05-03 23:52:53 +02:00
|
|
|
|
2017-09-14 14:06:40 +02:00
|
|
|
enum MemAccessSize {
|
|
|
|
NoMemAccess = 0,
|
|
|
|
ByteAccess,
|
|
|
|
HalfWordAccess,
|
|
|
|
WordAccess,
|
|
|
|
DoubleWordAccess,
|
2017-09-15 17:46:05 +02:00
|
|
|
HVXVectorAccess
|
2013-02-19 19:18:36 +01:00
|
|
|
};
|
|
|
|
|
2012-02-08 19:25:47 +01:00
|
|
|
// MCInstrDesc TSFlags
|
2012-05-03 23:52:53 +02:00
|
|
|
// *** Must match HexagonInstrFormat*.td ***
|
2012-02-08 19:25:47 +01:00
|
|
|
enum {
|
2018-12-03 20:34:04 +01:00
|
|
|
// This 7-bit field describes the insn type.
|
|
|
|
TypePos = 0,
|
|
|
|
TypeMask = 0x7f,
|
2012-05-03 23:52:53 +02:00
|
|
|
|
|
|
|
// Solo instructions.
|
2018-12-03 20:34:04 +01:00
|
|
|
SoloPos = 7,
|
2012-05-03 23:52:53 +02:00
|
|
|
SoloMask = 0x1,
|
2014-05-07 21:07:34 +02:00
|
|
|
// Packed only with A or X-type instructions.
|
2018-12-03 20:34:04 +01:00
|
|
|
SoloAXPos = 8,
|
2014-05-07 21:07:34 +02:00
|
|
|
SoloAXMask = 0x1,
|
|
|
|
// Only A-type instruction in first slot or nothing.
|
2018-12-03 20:34:04 +01:00
|
|
|
RestrictSlot1AOKPos = 9,
|
2017-12-11 19:57:54 +01:00
|
|
|
RestrictSlot1AOKMask = 0x1,
|
2012-02-08 19:25:47 +01:00
|
|
|
|
|
|
|
// Predicated instructions.
|
2018-12-03 20:34:04 +01:00
|
|
|
PredicatedPos = 10,
|
2012-11-14 21:38:48 +01:00
|
|
|
PredicatedMask = 0x1,
|
2018-12-03 20:34:04 +01:00
|
|
|
PredicatedFalsePos = 11,
|
2013-02-19 19:18:36 +01:00
|
|
|
PredicatedFalseMask = 0x1,
|
2018-12-03 20:34:04 +01:00
|
|
|
PredicatedNewPos = 12,
|
2012-11-14 21:38:48 +01:00
|
|
|
PredicatedNewMask = 0x1,
|
2018-12-03 20:34:04 +01:00
|
|
|
PredicateLatePos = 13,
|
2014-05-07 21:07:34 +02:00
|
|
|
PredicateLateMask = 0x1,
|
2012-11-14 21:38:48 +01:00
|
|
|
|
2013-02-19 19:18:36 +01:00
|
|
|
// New-Value consumer instructions.
|
2018-12-03 20:34:04 +01:00
|
|
|
NewValuePos = 14,
|
2013-02-19 19:18:36 +01:00
|
|
|
NewValueMask = 0x1,
|
|
|
|
// New-Value producer instructions.
|
2018-12-03 20:34:04 +01:00
|
|
|
hasNewValuePos = 15,
|
2013-02-19 19:18:36 +01:00
|
|
|
hasNewValueMask = 0x1,
|
|
|
|
// Which operand consumes or produces a new value.
|
2018-12-03 20:34:04 +01:00
|
|
|
NewValueOpPos = 16,
|
2013-02-19 19:18:36 +01:00
|
|
|
NewValueOpMask = 0x7,
|
|
|
|
// Stores that can become new-value stores.
|
2018-12-03 20:34:04 +01:00
|
|
|
mayNVStorePos = 19,
|
2012-11-14 21:38:48 +01:00
|
|
|
mayNVStoreMask = 0x1,
|
2013-02-19 19:18:36 +01:00
|
|
|
// New-value store instructions.
|
2018-12-03 20:34:04 +01:00
|
|
|
NVStorePos = 20,
|
2012-11-14 21:38:48 +01:00
|
|
|
NVStoreMask = 0x1,
|
2014-05-07 21:07:34 +02:00
|
|
|
// Loads that can become current-value loads.
|
2018-12-03 20:34:04 +01:00
|
|
|
mayCVLoadPos = 21,
|
2014-05-07 21:07:34 +02:00
|
|
|
mayCVLoadMask = 0x1,
|
|
|
|
// Current-value load instructions.
|
2018-12-03 20:34:04 +01:00
|
|
|
CVLoadPos = 22,
|
2014-05-07 21:07:34 +02:00
|
|
|
CVLoadMask = 0x1,
|
2012-11-14 21:38:48 +01:00
|
|
|
|
|
|
|
// Extendable insns.
|
2018-12-03 20:34:04 +01:00
|
|
|
ExtendablePos = 23,
|
2012-11-14 21:38:48 +01:00
|
|
|
ExtendableMask = 0x1,
|
|
|
|
// Insns must be extended.
|
2018-12-03 20:34:04 +01:00
|
|
|
ExtendedPos = 24,
|
2012-11-14 21:38:48 +01:00
|
|
|
ExtendedMask = 0x1,
|
|
|
|
// Which operand may be extended.
|
2018-12-03 20:34:04 +01:00
|
|
|
ExtendableOpPos = 25,
|
2012-11-14 21:38:48 +01:00
|
|
|
ExtendableOpMask = 0x7,
|
|
|
|
// Signed or unsigned range.
|
2018-12-03 20:34:04 +01:00
|
|
|
ExtentSignedPos = 28,
|
2012-11-14 21:38:48 +01:00
|
|
|
ExtentSignedMask = 0x1,
|
|
|
|
// Number of bits of range before extending operand.
|
2018-12-03 20:34:04 +01:00
|
|
|
ExtentBitsPos = 29,
|
2012-11-14 21:38:48 +01:00
|
|
|
ExtentBitsMask = 0x1f,
|
2014-05-07 21:07:34 +02:00
|
|
|
// Alignment power-of-two before extending operand.
|
2018-12-03 20:34:04 +01:00
|
|
|
ExtentAlignPos = 34,
|
2014-05-07 21:07:34 +02:00
|
|
|
ExtentAlignMask = 0x3,
|
2012-11-14 21:38:48 +01:00
|
|
|
|
2018-12-03 20:34:04 +01:00
|
|
|
CofMax1Pos = 36,
|
2017-12-11 19:57:54 +01:00
|
|
|
CofMax1Mask = 0x1,
|
2018-12-03 20:34:04 +01:00
|
|
|
CofRelax1Pos = 37,
|
2017-12-11 19:57:54 +01:00
|
|
|
CofRelax1Mask = 0x1,
|
2018-12-03 20:34:04 +01:00
|
|
|
CofRelax2Pos = 38,
|
2017-12-11 19:57:54 +01:00
|
|
|
CofRelax2Mask = 0x1,
|
|
|
|
|
2018-12-03 20:34:04 +01:00
|
|
|
RestrictNoSlot1StorePos = 39,
|
2017-12-11 19:57:54 +01:00
|
|
|
RestrictNoSlot1StoreMask = 0x1,
|
|
|
|
|
2013-02-19 19:18:36 +01:00
|
|
|
// Addressing mode for load/store instructions.
|
2018-12-03 20:34:04 +01:00
|
|
|
AddrModePos = 42,
|
2013-02-19 19:18:36 +01:00
|
|
|
AddrModeMask = 0x7,
|
2014-05-07 21:07:34 +02:00
|
|
|
// Access size for load/store instructions.
|
2018-12-03 20:34:04 +01:00
|
|
|
MemAccessSizePos = 45,
|
2015-12-03 16:41:33 +01:00
|
|
|
MemAccesSizeMask = 0xf,
|
2014-05-07 21:07:34 +02:00
|
|
|
|
|
|
|
// Branch predicted taken.
|
2018-12-03 20:34:04 +01:00
|
|
|
TakenPos = 49,
|
2014-05-07 21:07:34 +02:00
|
|
|
TakenMask = 0x1,
|
2012-11-14 21:38:48 +01:00
|
|
|
|
2014-05-07 21:07:34 +02:00
|
|
|
// Floating-point instructions.
|
2018-12-03 20:34:04 +01:00
|
|
|
FPPos = 50,
|
2015-11-09 05:07:48 +01:00
|
|
|
FPMask = 0x1,
|
|
|
|
|
|
|
|
// New-Value producer-2 instructions.
|
2018-12-03 20:34:04 +01:00
|
|
|
hasNewValuePos2 = 52,
|
2015-11-09 05:07:48 +01:00
|
|
|
hasNewValueMask2 = 0x1,
|
|
|
|
// Which operand consumes or produces a new value.
|
2018-12-03 20:34:04 +01:00
|
|
|
NewValueOpPos2 = 53,
|
2015-11-24 15:55:26 +01:00
|
|
|
NewValueOpMask2 = 0x7,
|
|
|
|
|
|
|
|
// Accumulator instructions.
|
2018-12-03 20:34:04 +01:00
|
|
|
AccumulatorPos = 56,
|
2015-11-24 15:55:26 +01:00
|
|
|
AccumulatorMask = 0x1,
|
|
|
|
|
2016-11-17 20:21:20 +01:00
|
|
|
// Complex XU, prevent xu competition by preferring slot3
|
2018-12-03 20:34:04 +01:00
|
|
|
PrefersSlot3Pos = 57,
|
2015-11-24 15:55:26 +01:00
|
|
|
PrefersSlot3Mask = 0x1,
|
2016-10-08 19:18:51 +02:00
|
|
|
|
2017-12-11 19:57:54 +01:00
|
|
|
// v65
|
2018-12-03 20:34:04 +01:00
|
|
|
HasTmpDstPos = 60,
|
2017-12-11 19:57:54 +01:00
|
|
|
HasTmpDstMask = 0x1,
|
2017-05-01 22:16:35 +02:00
|
|
|
|
2018-12-03 20:34:04 +01:00
|
|
|
CVINewPos = 62,
|
|
|
|
CVINewMask = 0x1,
|
2020-01-17 23:29:40 +01:00
|
|
|
|
|
|
|
isCVIPos = 63,
|
|
|
|
isCVIMask = 0x1,
|
2013-02-19 19:18:36 +01:00
|
|
|
};
|
2012-02-08 19:25:47 +01:00
|
|
|
|
2012-02-09 16:20:33 +01:00
|
|
|
// *** The code above must match HexagonInstrFormat*.td *** //
|
2012-02-08 19:25:47 +01:00
|
|
|
|
2013-03-01 18:37:13 +01:00
|
|
|
// Hexagon specific MO operand flag mask.
|
|
|
|
enum HexagonMOTargetFlagVal {
|
2017-07-10 20:31:02 +02:00
|
|
|
// Hexagon-specific MachineOperand target flags.
|
|
|
|
//
|
2018-12-03 20:34:04 +01:00
|
|
|
// When changing these, make sure to update
|
2017-07-10 20:31:02 +02:00
|
|
|
// getSerializableDirectMachineOperandTargetFlags and
|
|
|
|
// getSerializableBitmaskMachineOperandTargetFlags if needed.
|
2013-03-01 18:37:13 +01:00
|
|
|
MO_NO_FLAG,
|
|
|
|
|
|
|
|
/// MO_PCREL - On a symbol operand, indicates a PC-relative relocation
|
|
|
|
/// Used for computing a global address for PIC compilations
|
|
|
|
MO_PCREL,
|
|
|
|
|
|
|
|
/// MO_GOT - Indicates a GOT-relative relocation
|
|
|
|
MO_GOT,
|
|
|
|
|
|
|
|
// Low or high part of a symbol.
|
2018-12-03 20:34:04 +01:00
|
|
|
MO_LO16,
|
|
|
|
MO_HI16,
|
2013-03-01 18:37:13 +01:00
|
|
|
|
|
|
|
// Offset from the base of the SDA.
|
2016-02-18 16:42:57 +01:00
|
|
|
MO_GPREL,
|
|
|
|
|
|
|
|
// MO_GDGOT - indicates GOT relative relocation for TLS
|
|
|
|
// GeneralDynamic method
|
|
|
|
MO_GDGOT,
|
|
|
|
|
|
|
|
// MO_GDPLT - indicates PLT relative relocation for TLS
|
|
|
|
// GeneralDynamic method
|
|
|
|
MO_GDPLT,
|
|
|
|
|
|
|
|
// MO_IE - indicates non PIC relocation for TLS
|
|
|
|
// Initial Executable method
|
|
|
|
MO_IE,
|
|
|
|
|
|
|
|
// MO_IEGOT - indicates PIC relocation for TLS
|
|
|
|
// Initial Executable method
|
|
|
|
MO_IEGOT,
|
|
|
|
|
|
|
|
// MO_TPREL - indicates relocation for TLS
|
|
|
|
// local Executable method
|
2017-02-06 20:35:46 +01:00
|
|
|
MO_TPREL,
|
|
|
|
|
|
|
|
// HMOTF_ConstExtended
|
2017-07-10 20:31:02 +02:00
|
|
|
// Addendum to above, indicates a const extended op
|
2017-02-06 20:35:46 +01:00
|
|
|
// Can be used as a mask.
|
2017-07-10 20:31:02 +02:00
|
|
|
HMOTF_ConstExtended = 0x80,
|
2017-02-06 20:35:46 +01:00
|
|
|
|
2017-07-10 20:31:02 +02:00
|
|
|
// Union of all bitmasks (currently only HMOTF_ConstExtended).
|
|
|
|
MO_Bitmasks = HMOTF_ConstExtended
|
2014-10-27 13:37:26 +01:00
|
|
|
};
|
|
|
|
|
2015-06-05 18:00:11 +02:00
|
|
|
// Hexagon Sub-instruction classes.
|
|
|
|
enum SubInstructionGroup {
|
|
|
|
HSIG_None = 0,
|
|
|
|
HSIG_L1,
|
|
|
|
HSIG_L2,
|
|
|
|
HSIG_S1,
|
|
|
|
HSIG_S2,
|
|
|
|
HSIG_A,
|
|
|
|
HSIG_Compound
|
|
|
|
};
|
|
|
|
|
2015-06-08 18:34:47 +02:00
|
|
|
// Hexagon Compound classes.
|
|
|
|
enum CompoundGroup {
|
|
|
|
HCG_None = 0,
|
|
|
|
HCG_A,
|
|
|
|
HCG_B,
|
|
|
|
HCG_C
|
|
|
|
};
|
|
|
|
|
2015-05-29 16:44:13 +02:00
|
|
|
enum InstParseBits {
|
2014-10-27 13:37:26 +01:00
|
|
|
INST_PARSE_MASK = 0x0000c000,
|
|
|
|
INST_PARSE_PACKET_END = 0x0000c000,
|
|
|
|
INST_PARSE_LOOP_END = 0x00008000,
|
|
|
|
INST_PARSE_NOT_END = 0x00004000,
|
|
|
|
INST_PARSE_DUPLEX = 0x00000000,
|
|
|
|
INST_PARSE_EXTENDER = 0x00000000
|
|
|
|
};
|
|
|
|
|
2015-11-09 20:44:38 +01:00
|
|
|
enum InstIClassBits : unsigned {
|
2015-11-09 05:07:48 +01:00
|
|
|
INST_ICLASS_MASK = 0xf0000000,
|
|
|
|
INST_ICLASS_EXTENDER = 0x00000000,
|
|
|
|
INST_ICLASS_J_1 = 0x10000000,
|
|
|
|
INST_ICLASS_J_2 = 0x20000000,
|
|
|
|
INST_ICLASS_LD_ST_1 = 0x30000000,
|
|
|
|
INST_ICLASS_LD_ST_2 = 0x40000000,
|
|
|
|
INST_ICLASS_J_3 = 0x50000000,
|
|
|
|
INST_ICLASS_CR = 0x60000000,
|
|
|
|
INST_ICLASS_ALU32_1 = 0x70000000,
|
|
|
|
INST_ICLASS_XTYPE_1 = 0x80000000,
|
|
|
|
INST_ICLASS_LD = 0x90000000,
|
|
|
|
INST_ICLASS_ST = 0xa0000000,
|
|
|
|
INST_ICLASS_ALU32_2 = 0xb0000000,
|
|
|
|
INST_ICLASS_XTYPE_2 = 0xc0000000,
|
|
|
|
INST_ICLASS_XTYPE_3 = 0xd0000000,
|
|
|
|
INST_ICLASS_XTYPE_4 = 0xe0000000,
|
|
|
|
INST_ICLASS_ALU32_3 = 0xf0000000
|
|
|
|
};
|
|
|
|
|
2017-09-14 14:06:40 +02:00
|
|
|
LLVM_ATTRIBUTE_UNUSED
|
|
|
|
static unsigned getMemAccessSizeInBytes(MemAccessSize S) {
|
|
|
|
switch (S) {
|
|
|
|
case ByteAccess: return 1;
|
|
|
|
case HalfWordAccess: return 2;
|
|
|
|
case WordAccess: return 4;
|
|
|
|
case DoubleWordAccess: return 8;
|
|
|
|
default: return 0;
|
|
|
|
}
|
|
|
|
}
|
2017-08-01 23:20:10 +02:00
|
|
|
} // end namespace HexagonII
|
2014-10-27 13:37:26 +01:00
|
|
|
|
2017-08-01 23:20:10 +02:00
|
|
|
} // end namespace llvm
|
2012-02-08 19:25:47 +01:00
|
|
|
|
2017-08-01 23:20:10 +02:00
|
|
|
#endif // LLVM_LIB_TARGET_HEXAGON_MCTARGETDESC_HEXAGONBASEINFO_H
|