[ARM64] Remove PrefetchOp and use ARM64PRFM instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205872 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Bradley Smith 2014-04-09 14:42:53 +00:00
parent 4be472c874
commit 84998a1fa9
3 changed files with 14 additions and 81 deletions

View File

@ -1757,14 +1757,15 @@ void ARM64Operand::print(raw_ostream &OS) const {
case k_SysCR:
OS << "c" << getSysCR();
break;
case k_Prefetch:
OS << "<prfop ";
if (ARM64_AM::isNamedPrefetchOp(getPrefetch()))
OS << ARM64_AM::getPrefetchOpName((ARM64_AM::PrefetchOp)getPrefetch());
case k_Prefetch: {
bool Valid;
StringRef Name = ARM64PRFM::PRFMMapper().toString(getPrefetch(), Valid);
if (Valid)
OS << "<prfop " << Name << ">";
else
OS << "#" << getPrefetch();
OS << ">";
OS << "<prfop invalid #" << getPrefetch() << ">";
break;
}
case k_Shifter: {
unsigned Val = getShifter();
OS << "<" << ARM64_AM::getShiftName(ARM64_AM::getShiftType(Val)) << " #"
@ -2036,21 +2037,9 @@ ARM64AsmParser::tryParsePrefetch(OperandVector &Operands) {
return MatchOperand_ParseFail;
}
unsigned prfop = StringSwitch<unsigned>(Tok.getString())
.Case("pldl1keep", ARM64_AM::PLDL1KEEP)
.Case("pldl1strm", ARM64_AM::PLDL1STRM)
.Case("pldl2keep", ARM64_AM::PLDL2KEEP)
.Case("pldl2strm", ARM64_AM::PLDL2STRM)
.Case("pldl3keep", ARM64_AM::PLDL3KEEP)
.Case("pldl3strm", ARM64_AM::PLDL3STRM)
.Case("pstl1keep", ARM64_AM::PSTL1KEEP)
.Case("pstl1strm", ARM64_AM::PSTL1STRM)
.Case("pstl2keep", ARM64_AM::PSTL2KEEP)
.Case("pstl2strm", ARM64_AM::PSTL2STRM)
.Case("pstl3keep", ARM64_AM::PSTL3KEEP)
.Case("pstl3strm", ARM64_AM::PSTL3STRM)
.Default(0xff);
if (prfop == 0xff) {
bool Valid;
unsigned prfop = ARM64PRFM::PRFMMapper().fromString(Tok.getString(), Valid);
if (!Valid) {
TokError("pre-fetch hint expected");
return MatchOperand_ParseFail;
}

View File

@ -1145,8 +1145,10 @@ void ARM64InstPrinter::printAMIndexed(const MCInst *MI, unsigned OpNum,
void ARM64InstPrinter::printPrefetchOp(const MCInst *MI, unsigned OpNum,
raw_ostream &O) {
unsigned prfop = MI->getOperand(OpNum).getImm();
if (ARM64_AM::isNamedPrefetchOp(prfop))
O << ARM64_AM::getPrefetchOpName((ARM64_AM::PrefetchOp)prfop);
bool Valid;
StringRef Name = ARM64PRFM::PRFMMapper().toString(prfop, Valid);
if (Valid)
O << Name;
else
O << '#' << prfop;
}

View File

@ -164,64 +164,6 @@ static inline unsigned getMemExtendImm(ARM64_AM::ExtendType ET, bool DoShift) {
return (unsigned(ET) << 1) | unsigned(DoShift);
}
//===----------------------------------------------------------------------===//
// Prefetch
//
/// Pre-fetch operator names.
/// The enum values match the encoding values:
/// prfop<4:3> 00=preload data, 10=prepare for store
/// prfop<2:1> 00=target L1 cache, 01=target L2 cache, 10=target L3 cache,
/// prfop<0> 0=non-streaming (temporal), 1=streaming (non-temporal)
enum PrefetchOp {
InvalidPrefetchOp = -1,
PLDL1KEEP = 0x00,
PLDL1STRM = 0x01,
PLDL2KEEP = 0x02,
PLDL2STRM = 0x03,
PLDL3KEEP = 0x04,
PLDL3STRM = 0x05,
PSTL1KEEP = 0x10,
PSTL1STRM = 0x11,
PSTL2KEEP = 0x12,
PSTL2STRM = 0x13,
PSTL3KEEP = 0x14,
PSTL3STRM = 0x15
};
/// isNamedPrefetchOp - Check if the prefetch-op 5-bit value has a name.
static inline bool isNamedPrefetchOp(unsigned prfop) {
switch (prfop) {
default: return false;
case ARM64_AM::PLDL1KEEP: case ARM64_AM::PLDL1STRM: case ARM64_AM::PLDL2KEEP:
case ARM64_AM::PLDL2STRM: case ARM64_AM::PLDL3KEEP: case ARM64_AM::PLDL3STRM:
case ARM64_AM::PSTL1KEEP: case ARM64_AM::PSTL1STRM: case ARM64_AM::PSTL2KEEP:
case ARM64_AM::PSTL2STRM: case ARM64_AM::PSTL3KEEP: case ARM64_AM::PSTL3STRM:
return true;
}
}
/// getPrefetchOpName - Get the string encoding for the prefetch operator.
static inline const char *getPrefetchOpName(ARM64_AM::PrefetchOp prfop) {
switch (prfop) {
default: assert(false && "unhandled prefetch-op type!");
case ARM64_AM::PLDL1KEEP: return "pldl1keep";
case ARM64_AM::PLDL1STRM: return "pldl1strm";
case ARM64_AM::PLDL2KEEP: return "pldl2keep";
case ARM64_AM::PLDL2STRM: return "pldl2strm";
case ARM64_AM::PLDL3KEEP: return "pldl3keep";
case ARM64_AM::PLDL3STRM: return "pldl3strm";
case ARM64_AM::PSTL1KEEP: return "pstl1keep";
case ARM64_AM::PSTL1STRM: return "pstl1strm";
case ARM64_AM::PSTL2KEEP: return "pstl2keep";
case ARM64_AM::PSTL2STRM: return "pstl2strm";
case ARM64_AM::PSTL3KEEP: return "pstl3keep";
case ARM64_AM::PSTL3STRM: return "pstl3strm";
}
return 0;
}
static inline uint64_t ror(uint64_t elt, unsigned size) {
return ((elt & 1) << (size-1)) | (elt >> 1);
}