[AVR] Add $ separator string (like avr-gcc)
authorAyke van Laethem <aykevanlaethem@gmail.com>
Wed, 23 Nov 2022 01:10:22 +0000 (02:10 +0100)
committerAyke van Laethem <aykevanlaethem@gmail.com>
Sun, 27 Nov 2022 14:28:17 +0000 (15:28 +0100)
avr-gcc uses the $ symbol as an assembly separator instead of the more
common %% syntax. We need it in LLVM too to be compatible.

Differential Revision: https://reviews.llvm.org/D138535

llvm/lib/Target/AVR/MCTargetDesc/AVRMCAsmInfo.cpp
llvm/test/MC/AVR/separator.s [new file with mode: 0644]

index b11ee42..c377721 100644 (file)
@@ -20,6 +20,7 @@ AVRMCAsmInfo::AVRMCAsmInfo(const Triple &TT, const MCTargetOptions &Options) {
   CodePointerSize = 2;
   CalleeSaveStackSlotSize = 2;
   CommentString = ";";
+  SeparatorString = "$";
   PrivateGlobalPrefix = ".L";
   PrivateLabelPrefix = ".L";
   UsesELFSectionDirectiveForBSS = true;
diff --git a/llvm/test/MC/AVR/separator.s b/llvm/test/MC/AVR/separator.s
new file mode 100644 (file)
index 0000000..c62e01b
--- /dev/null
@@ -0,0 +1,11 @@
+; RUN: llvm-mc -filetype=obj -triple avr < %s | llvm-objdump -d - | FileCheck %s
+
+foo:
+
+  ; The $ symbol is a separator (like a newline).
+  mov r0, r1 $ mov r1, r2 $ mov r2, r3 $ mov r3, r4
+
+; CHECK: mov r0, r1
+; CHECK: mov r1, r2
+; CHECK: mov r2, r3
+; CHECK: mov r3, r4