Skip to content

Commit

Permalink
[Hexagon] Introduce Hexagon V62
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294805 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
Krzysztof Parzyszek committed Feb 10, 2017
1 parent 0d336bb commit 6eebe31
Show file tree
Hide file tree
Showing 25 changed files with 5,479 additions and 83 deletions.
837 changes: 815 additions & 22 deletions include/llvm/IR/IntrinsicsHexagon.td

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions include/llvm/Support/ELF.h
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,7 @@ enum {
EF_HEXAGON_MACH_V5 = 0x00000004, // Hexagon V5
EF_HEXAGON_MACH_V55 = 0x00000005, // Hexagon V55
EF_HEXAGON_MACH_V60 = 0x00000060, // Hexagon V60
EF_HEXAGON_MACH_V62 = 0x00000062, // Hexagon V62

// Highest ISA version flags
EF_HEXAGON_ISA_MACH = 0x00000000, // Same as specified in bits[11:0]
Expand All @@ -566,6 +567,7 @@ enum {
EF_HEXAGON_ISA_V5 = 0x00000040, // Hexagon V5 ISA
EF_HEXAGON_ISA_V55 = 0x00000050, // Hexagon V55 ISA
EF_HEXAGON_ISA_V60 = 0x00000060, // Hexagon V60 ISA
EF_HEXAGON_ISA_V62 = 0x00000062, // Hexagon V62 ISA
};

// Hexagon-specific section indexes for common small data
Expand Down
9 changes: 8 additions & 1 deletion lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,9 @@ bool HexagonAsmParser::ParseDirectiveComm(bool IsLocal, SMLoc Loc) {

// validate register against architecture
bool HexagonAsmParser::RegisterMatchesArch(unsigned MatchNum) const {
if (HexagonMCRegisterClasses[Hexagon::V62RegsRegClassID].contains(MatchNum))
if (!getSTI().getFeatureBits()[Hexagon::ArchV62])
return false;
return true;
}

Expand Down Expand Up @@ -1012,11 +1015,15 @@ bool HexagonAsmParser::parseOperand(OperandVector &Operands) {
bool HexagonAsmParser::isLabel(AsmToken &Token) {
MCAsmLexer &Lexer = getLexer();
AsmToken const &Second = Lexer.getTok();
AsmToken Third = Lexer.peekTok();
AsmToken Third = Lexer.peekTok();
StringRef String = Token.getString();
if (Token.is(AsmToken::TokenKind::LCurly) ||
Token.is(AsmToken::TokenKind::RCurly))
return false;
// special case for parsing vwhist256:sat
if (String.lower() == "vwhist256" && Second.is(AsmToken::Colon) &&
Third.getString().lower() == "sat")
return false;
if (!Token.is(AsmToken::TokenKind::Identifier))
return true;
if (!matchRegister(String.lower()))
Expand Down
36 changes: 22 additions & 14 deletions lib/Target/Hexagon/Disassembler/HexagonDisassembler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,19 +551,23 @@ static DecodeStatus DecodeVecPredRegsRegisterClass(MCInst &Inst, unsigned RegNo,
static DecodeStatus DecodeCtrRegsRegisterClass(MCInst &Inst, unsigned RegNo,
uint64_t /*Address*/,
const void *Decoder) {
using namespace Hexagon;
static const MCPhysReg CtrlRegDecoderTable[] = {
Hexagon::SA0, Hexagon::LC0, Hexagon::SA1,
Hexagon::LC1, Hexagon::P3_0, Hexagon::C5,
Hexagon::C6, Hexagon::C7, Hexagon::USR,
Hexagon::PC, Hexagon::UGP, Hexagon::GP,
Hexagon::CS0, Hexagon::CS1, Hexagon::UPCL,
Hexagon::UPC
/* 0 */ SA0, LC0, SA1, LC1,
/* 4 */ P3_0, C5, C6, C7,
/* 8 */ USR, PC, UGP, GP,
/* 12 */ CS0, CS1, UPCL, UPCH,
/* 16 */ FRAMELIMIT, FRAMEKEY, PKTCOUNTLO, PKTCOUNTHI,
/* 20 */ 0, 0, 0, 0,
/* 24 */ 0, 0, 0, 0,
/* 28 */ 0, 0, UTIMERLO, UTIMERHI
};

if (RegNo >= array_lengthof(CtrlRegDecoderTable))
return MCDisassembler::Fail;

if (CtrlRegDecoderTable[RegNo] == Hexagon::NoRegister)
static_assert(NoRegister == 0, "Expecting NoRegister to be 0");
if (CtrlRegDecoderTable[RegNo] == NoRegister)
return MCDisassembler::Fail;

unsigned Register = CtrlRegDecoderTable[RegNo];
Expand All @@ -574,19 +578,23 @@ static DecodeStatus DecodeCtrRegsRegisterClass(MCInst &Inst, unsigned RegNo,
static DecodeStatus DecodeCtrRegs64RegisterClass(MCInst &Inst, unsigned RegNo,
uint64_t /*Address*/,
const void *Decoder) {
using namespace Hexagon;
static const MCPhysReg CtrlReg64DecoderTable[] = {
Hexagon::C1_0, Hexagon::NoRegister, Hexagon::C3_2,
Hexagon::NoRegister,
Hexagon::C7_6, Hexagon::NoRegister, Hexagon::C9_8,
Hexagon::NoRegister, Hexagon::C11_10, Hexagon::NoRegister,
Hexagon::CS, Hexagon::NoRegister, Hexagon::UPC,
Hexagon::NoRegister
/* 0 */ C1_0, 0, C3_2, 0,
/* 4 */ C5_4, 0, C7_6, 0,
/* 8 */ C9_8, 0, C11_10, 0,
/* 12 */ CS, 0, UPC, 0,
/* 16 */ C17_16, 0, PKTCOUNT, 0,
/* 20 */ 0, 0, 0, 0,
/* 24 */ 0, 0, 0, 0,
/* 28 */ 0, 0, UTIMER, 0
};

if (RegNo >= array_lengthof(CtrlReg64DecoderTable))
return MCDisassembler::Fail;

if (CtrlReg64DecoderTable[RegNo] == Hexagon::NoRegister)
static_assert(NoRegister == 0, "Expecting NoRegister to be 0");
if (CtrlReg64DecoderTable[RegNo] == NoRegister)
return MCDisassembler::Fail;

unsigned Register = CtrlReg64DecoderTable[RegNo];
Expand Down
3 changes: 3 additions & 0 deletions lib/Target/Hexagon/Hexagon.td
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ include "HexagonPatterns.td"
include "HexagonDepMappings.td"
include "HexagonIntrinsics.td"
include "HexagonIntrinsicsDerived.td"
include "HexagonMapAsm2IntrinV62.gen.td"

def HexagonInstrInfo : InstrInfo;

Expand All @@ -271,6 +272,8 @@ def : Proc<"hexagonv55", HexagonModelV55,
[ArchV4, ArchV5, ArchV55]>;
def : Proc<"hexagonv60", HexagonModelV60,
[ArchV4, ArchV5, ArchV55, ArchV60, ExtensionHVX]>;
def : Proc<"hexagonv62", HexagonModelV62,
[ArchV4, ArchV5, ArchV55, ArchV60, ArchV62, ExtensionHVX]>;

//===----------------------------------------------------------------------===//
// Declare the target which we are implementing
Expand Down
2 changes: 1 addition & 1 deletion lib/Target/Hexagon/HexagonDepArch.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
//
//===----------------------------------------------------------------------===//

enum HexagonArchEnum { V4,V5,V55,V60 };
enum HexagonArchEnum { V4,V5,V55,V60,V62 };
2 changes: 2 additions & 0 deletions lib/Target/Hexagon/HexagonDepArch.td
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
//
//===----------------------------------------------------------------------===//

def ArchV62: SubtargetFeature<"v62", "HexagonArchVersion", "V62", "Enable Hexagon V62 architecture">;
def HasV62T : Predicate<"HST->hasV62TOps()">, AssemblerPredicate<"ArchV62">;
def ArchV60: SubtargetFeature<"v60", "HexagonArchVersion", "V60", "Enable Hexagon V60 architecture">;
def HasV60T : Predicate<"HST->hasV60TOps()">, AssemblerPredicate<"ArchV60">;
def ArchV55: SubtargetFeature<"v55", "HexagonArchVersion", "V55", "Enable Hexagon V55 architecture">;
Expand Down
1 change: 1 addition & 0 deletions lib/Target/Hexagon/HexagonDepITypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ enum Type {
TypeALU32_ADDI = 2,
TypeALU64 = 3,
TypeCJ = 4,
TypeCOPROC_VMEM = 5,
TypeCR = 7,
TypeCVI_HIST = 10,
TypeCVI_VA = 16,
Expand Down
1 change: 1 addition & 0 deletions lib/Target/Hexagon/HexagonDepITypes.td
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def TypeALU32_3op : IType<1>;
def TypeALU32_ADDI : IType<2>;
def TypeALU64 : IType<3>;
def TypeCJ : IType<4>;
def TypeCOPROC_VMEM : IType<5>;
def TypeCR : IType<7>;
def TypeCVI_HIST : IType<10>;
def TypeCVI_VA : IType<16>;
Expand Down
Loading

0 comments on commit 6eebe31

Please sign in to comment.