aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/PowerPC/Disassembler/PPCDisassembler.cpp
diff options
context:
space:
mode:
authorStefan Pintilie <stefanp@ca.ibm.com>2021-04-15 05:30:06 -0500
committerStefan Pintilie <stefanp@ca.ibm.com>2021-04-15 11:38:38 -0500
commitf28cb01be071a52e817c8ba84a5ef503a614b86e (patch)
treedcbca7f310fd9d7af6e6e4d554c0613ae115bd45 /llvm/lib/Target/PowerPC/Disassembler/PPCDisassembler.cpp
parentccef0adc59680cf307fcb3334f15d4e2cba62de7 (diff)
downloadllvm-f28cb01be071a52e817c8ba84a5ef503a614b86e.zip
llvm-f28cb01be071a52e817c8ba84a5ef503a614b86e.tar.gz
llvm-f28cb01be071a52e817c8ba84a5ef503a614b86e.tar.bz2
[PowerPC] Add ROP Protection Instructions for PowerPC
There are four new PowerPC instructions that are introduced in Power 10. They are hashst, hashchk, hashstp, hashchkp. These instructions will be used for ROP Protection. This patch adds the four instructions. Reviewed By: nemanjai, amyk, #powerpc Differential Revision: https://reviews.llvm.org/D99375
Diffstat (limited to 'llvm/lib/Target/PowerPC/Disassembler/PPCDisassembler.cpp')
-rw-r--r--llvm/lib/Target/PowerPC/Disassembler/PPCDisassembler.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/Target/PowerPC/Disassembler/PPCDisassembler.cpp b/llvm/lib/Target/PowerPC/Disassembler/PPCDisassembler.cpp
index 3e9286f..44f9920 100644
--- a/llvm/lib/Target/PowerPC/Disassembler/PPCDisassembler.cpp
+++ b/llvm/lib/Target/PowerPC/Disassembler/PPCDisassembler.cpp
@@ -279,6 +279,23 @@ static DecodeStatus decodeMemRIXOperands(MCInst &Inst, uint64_t Imm,
return MCDisassembler::Success;
}
+static DecodeStatus decodeMemRIHashOperands(MCInst &Inst, uint64_t Imm,
+ int64_t Address,
+ const void *Decoder) {
+ // Decode the memrix field for a hash store or hash check operation.
+ // The field is composed of a register and an immediate value that is 6 bits
+ // and covers the range -8 to -512. The immediate is always negative and 2s
+ // complement which is why we sign extend a 7 bit value.
+ const uint64_t Base = Imm >> 6;
+ const int64_t Disp = SignExtend64<7>((Imm & 0x3F) + 64) * 8;
+
+ assert(Base < 32 && "Invalid base register");
+
+ Inst.addOperand(MCOperand::createImm(Disp));
+ Inst.addOperand(MCOperand::createReg(RRegs[Base]));
+ return MCDisassembler::Success;
+}
+
static DecodeStatus decodeMemRIX16Operands(MCInst &Inst, uint64_t Imm,
int64_t Address, const void *Decoder) {
// Decode the memrix16 field (imm, reg), which has the low 12-bits as the