diff options
author | Amara Emerson <aemerson@apple.com> | 2019-06-14 17:55:48 +0000 |
---|---|---|
committer | Amara Emerson <aemerson@apple.com> | 2019-06-14 17:55:48 +0000 |
commit | f79d3bc72423176a38568d89f80d1a4577aaf3d0 (patch) | |
tree | 153f9c36d1ab18f94cbdd7d6458f94bdc5aa027d /llvm/lib/CodeGen/MachineVerifier.cpp | |
parent | ff4e0a9f3e4a30841e623c75d34b75345aac52fe (diff) | |
download | llvm-f79d3bc72423176a38568d89f80d1a4577aaf3d0.zip llvm-f79d3bc72423176a38568d89f80d1a4577aaf3d0.tar.gz llvm-f79d3bc72423176a38568d89f80d1a4577aaf3d0.tar.bz2 |
[GlobalISel] Add a G_BRJT opcode.
This is a branch opcode that takes a jump table pointer, jump table index and an
index into the table to do an indirect branch.
We pass both the table pointer and JTI to allow targets like ARM64 to more
easily use the existing jump table compression optimization without having to
walk up the block to find a paired G_JUMP_TABLE.
Differential Revision: https://reviews.llvm.org/D63159
llvm-svn: 363434
Diffstat (limited to 'llvm/lib/CodeGen/MachineVerifier.cpp')
-rw-r--r-- | llvm/lib/CodeGen/MachineVerifier.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineVerifier.cpp b/llvm/lib/CodeGen/MachineVerifier.cpp index 78072a4..698ea4c 100644 --- a/llvm/lib/CodeGen/MachineVerifier.cpp +++ b/llvm/lib/CodeGen/MachineVerifier.cpp @@ -1320,6 +1320,18 @@ void MachineVerifier::verifyPreISelGenericInstruction(const MachineInstr *MI) { report("G_JUMP_TABLE dest operand must have a pointer type", MI); break; } + case TargetOpcode::G_BRJT: { + if (!MRI->getType(MI->getOperand(0).getReg()).isPointer()) + report("G_BRJT src operand 0 must be a pointer type", MI); + + if (!MI->getOperand(1).isJTI()) + report("G_BRJT src operand 1 must be a jump table index", MI); + + const auto &IdxOp = MI->getOperand(2); + if (!IdxOp.isReg() || MRI->getType(IdxOp.getReg()).isPointer()) + report("G_BRJT src operand 2 must be a scalar reg type", MI); + break; + } default: break; } |