[PATCH] D147877: [AVR] Reject invalid LDD instruction with explicit error
Ben Shi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 9 19:34:56 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6e57f68e41c9: [AVR] Reject invalid LDD instruction with explicit error (authored by benshi001).
Changed prior to commit:
https://reviews.llvm.org/D147877?vs=511971&id=512059#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147877/new/
https://reviews.llvm.org/D147877
Files:
llvm/lib/Target/AVR/MCTargetDesc/AVRMCCodeEmitter.cpp
llvm/test/CodeGen/AVR/inline-asm/inline-asm-invalid.ll
Index: llvm/test/CodeGen/AVR/inline-asm/inline-asm-invalid.ll
===================================================================
--- llvm/test/CodeGen/AVR/inline-asm/inline-asm-invalid.ll
+++ llvm/test/CodeGen/AVR/inline-asm/inline-asm-invalid.ll
@@ -1,4 +1,5 @@
-; RUN: not llc < %s -march=avr -no-integrated-as 2>&1 | FileCheck %s
+; RUN: not llc < %s -march=avr -mcpu=avr6 -filetype=obj -no-integrated-as 2>&1 \
+; RUN: | FileCheck %s
define void @foo(i16 %a) {
; CHECK: error: invalid operand in inline asm: 'jl ${0:l}'
@@ -13,3 +14,9 @@
call i16 asm sideeffect ";; ${0:C}", "=d"()
ret void
}
+
+define void @foo2() {
+ ; CHECK: error: expected either Y or Z register
+ call void asm sideeffect "ldd r24, X+2", ""()
+ ret void
+}
Index: llvm/lib/Target/AVR/MCTargetDesc/AVRMCCodeEmitter.cpp
===================================================================
--- llvm/lib/Target/AVR/MCTargetDesc/AVRMCCodeEmitter.cpp
+++ llvm/lib/Target/AVR/MCTargetDesc/AVRMCCodeEmitter.cpp
@@ -146,7 +146,8 @@
switch (RegOp.getReg()) {
default:
- llvm_unreachable("Expected either Y or Z register");
+ Ctx.reportError(MI.getLoc(), "Expected either Y or Z register");
+ return 0;
case AVR::R31R30:
RegBit = 0;
break; // Z register
@@ -164,7 +165,7 @@
Fixups.push_back(MCFixup::create(0, OffsetOp.getExpr(),
MCFixupKind(AVR::fixup_6), MI.getLoc()));
} else {
- llvm_unreachable("invalid value for offset");
+ llvm_unreachable("Invalid value for offset");
}
return (RegBit << 6) | OffsetBits;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147877.512059.patch
Type: text/x-patch
Size: 1590 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230410/c3a48bd1/attachment.bin>
More information about the llvm-commits
mailing list