aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYingchi Long <i@lyc.dev>2023-12-10 18:26:22 +0800
committerYingchi Long <i@lyc.dev>2023-12-10 18:33:00 +0800
commitfeb2060cc29a44a53fb4eca1271e59d4caf9ff3f (patch)
tree4344b3f97b5cf9169130934e3913d5ae0eae69b9
parent95e500808d96bece0edfedb70d9ecdf16c375656 (diff)
downloadllvm-users/inclyc/bpf-callx-asm.zip
llvm-users/inclyc/bpf-callx-asm.tar.gz
llvm-users/inclyc/bpf-callx-asm.tar.bz2
[BPF] support indirect branch (callx) in AsmParserusers/inclyc/bpf-callx-asm
Simply mark `callx` as a valid ID, so it can be recognized. Previously this valid asm triggers an error: # clang local/callx.s -target bpf local/callx.s:8:2: error: invalid register/token name callx r1 ^
-rw-r--r--llvm/lib/Target/BPF/AsmParser/BPFAsmParser.cpp1
-rw-r--r--llvm/test/MC/BPF/callx.s4
2 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Target/BPF/AsmParser/BPFAsmParser.cpp b/llvm/lib/Target/BPF/AsmParser/BPFAsmParser.cpp
index 90697c6..0d1eef6 100644
--- a/llvm/lib/Target/BPF/AsmParser/BPFAsmParser.cpp
+++ b/llvm/lib/Target/BPF/AsmParser/BPFAsmParser.cpp
@@ -229,6 +229,7 @@ public:
return StringSwitch<bool>(Name.lower())
.Case("if", true)
.Case("call", true)
+ .Case("callx", true)
.Case("goto", true)
.Case("gotol", true)
.Case("*", true)
diff --git a/llvm/test/MC/BPF/callx.s b/llvm/test/MC/BPF/callx.s
new file mode 100644
index 0000000..1c53af9
--- /dev/null
+++ b/llvm/test/MC/BPF/callx.s
@@ -0,0 +1,4 @@
+# RUN: llvm-mc -triple bpfel -show-encoding < %s | FileCheck %s
+
+# CHECK: callx r1 # encoding: [0x8d,0x00,0x00,0x00,0x01,0x00,0x00,0x00]
+callx r1