[llvm] r319457 - [globalisel][tablegen] Add support for specific immediates in the match pattern
Daniel Sanders via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 30 10:48:36 PST 2017
Author: dsanders
Date: Thu Nov 30 10:48:35 2017
New Revision: 319457
URL: http://llvm.org/viewvc/llvm-project?rev=319457&view=rev
Log:
[globalisel][tablegen] Add support for specific immediates in the match pattern
This enables a few rules such as ARM's uxtb instruction.
Modified:
llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-isel.ll
llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp
Modified: llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-isel.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-isel.ll?rev=319457&r1=319456&r2=319457&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-isel.ll (original)
+++ llvm/trunk/test/CodeGen/ARM/GlobalISel/arm-isel.ll Thu Nov 30 10:48:35 2017
@@ -35,7 +35,7 @@ entry:
define zeroext i8 @test_ext_i8(i8 %x) {
; CHECK-LABEL: test_ext_i8:
-; CHECK: and r0, r0, #255
+; CHECK: uxtb r0, r0
; CHECK: bx lr
entry:
Modified: llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp?rev=319457&r1=319456&r2=319457&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp (original)
+++ llvm/trunk/utils/TableGen/GlobalISelEmitter.cpp Thu Nov 30 10:48:35 2017
@@ -2812,6 +2812,14 @@ Expected<action_iterator> GlobalISelEmit
return failedImport("Dst pattern child isn't a leaf node or an MBB" + llvm::to_string(*DstChild));
}
+ // It could be a specific immediate in which case we should just check for
+ // that immediate.
+ if (const IntInit *ChildIntInit =
+ dyn_cast<IntInit>(DstChild->getLeafValue())) {
+ DstMIBuilder.addRenderer<ImmRenderer>(ChildIntInit->getValue());
+ return InsertPt;
+ }
+
// Otherwise, we're looking for a bog-standard RegisterClass operand.
if (auto *ChildDefInit = dyn_cast<DefInit>(DstChild->getLeafValue())) {
auto *ChildRec = ChildDefInit->getDef();
More information about the llvm-commits
mailing list