[llvm] r320348 - [AVR] Implement some missing code paths
Dylan McKay via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 11 03:01:27 PST 2017
Author: dylanmckay
Date: Mon Dec 11 03:01:27 2017
New Revision: 320348
URL: http://llvm.org/viewvc/llvm-project?rev=320348&view=rev
Log:
[AVR] Implement some missing code paths
This has been broken since r320009.
Modified:
llvm/trunk/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp
llvm/trunk/lib/Target/AVR/MCTargetDesc/AVRMCExpr.cpp
llvm/trunk/test/MC/AVR/relocations.s
llvm/trunk/test/MC/AVR/symbol_relocation.s
Modified: llvm/trunk/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp?rev=320348&r1=320347&r2=320348&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp (original)
+++ llvm/trunk/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.cpp Mon Dec 11 03:01:27 2017
@@ -265,15 +265,19 @@ void AVRAsmBackend::adjustFixupValue(con
adjust::ldi::fixup(Size, Fixup, Value, Ctx);
break;
case AVR::fixup_lo8_ldi:
+ adjust::ldi::lo8(Size, Fixup, Value, Ctx);
+ break;
case AVR::fixup_lo8_ldi_pm:
- if (Kind == AVR::fixup_lo8_ldi_pm) adjust::pm(Value);
-
+ case AVR::fixup_lo8_ldi_gs:
+ adjust::pm(Value);
adjust::ldi::lo8(Size, Fixup, Value, Ctx);
break;
case AVR::fixup_hi8_ldi:
+ adjust::ldi::hi8(Size, Fixup, Value, Ctx);
+ break;
case AVR::fixup_hi8_ldi_pm:
- if (Kind == AVR::fixup_hi8_ldi_pm) adjust::pm(Value);
-
+ case AVR::fixup_hi8_ldi_gs:
+ adjust::pm(Value);
adjust::ldi::hi8(Size, Fixup, Value, Ctx);
break;
case AVR::fixup_hh8_ldi:
@@ -316,6 +320,13 @@ void AVRAsmBackend::adjustFixupValue(con
Value &= 0xffff;
break;
+ case AVR::fixup_16_pm:
+ Value >>= 1; // Flash addresses are always shifted.
+ adjust::unsigned_width(16, Value, std::string("port number"), Fixup, Ctx);
+
+ Value &= 0xffff;
+ break;
+
case AVR::fixup_6_adiw:
adjust::fixup_6_adiw(Fixup, Value, Ctx);
break;
@@ -329,6 +340,7 @@ void AVRAsmBackend::adjustFixupValue(con
break;
// Fixups which do not require adjustments.
+ case FK_Data_1:
case FK_Data_2:
case FK_Data_4:
case FK_Data_8:
Modified: llvm/trunk/lib/Target/AVR/MCTargetDesc/AVRMCExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AVR/MCTargetDesc/AVRMCExpr.cpp?rev=320348&r1=320347&r2=320348&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AVR/MCTargetDesc/AVRMCExpr.cpp (original)
+++ llvm/trunk/lib/Target/AVR/MCTargetDesc/AVRMCExpr.cpp Mon Dec 11 03:01:27 2017
@@ -168,6 +168,9 @@ AVR::Fixups AVRMCExpr::getFixupKind() co
case VK_AVR_PM_HH8:
Kind = isNegated() ? AVR::fixup_hh8_ldi_pm_neg : AVR::fixup_hh8_ldi_pm;
break;
+ case VK_AVR_GS:
+ Kind = AVR::fixup_16_pm;
+ break;
case VK_AVR_LO8_GS:
Kind = AVR::fixup_lo8_ldi_gs;
break;
Modified: llvm/trunk/test/MC/AVR/relocations.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AVR/relocations.s?rev=320348&r1=320347&r2=320348&view=diff
==============================================================================
--- llvm/trunk/test/MC/AVR/relocations.s (original)
+++ llvm/trunk/test/MC/AVR/relocations.s Mon Dec 11 03:01:27 2017
@@ -2,11 +2,11 @@
; CHECK: RELOCATION RECORDS FOR
-; CHECK: RELOCATION RECORDS BAR
+.global bar
bar:
jmp bar
-; CHECK-NEXT: R_AVR_LDI SYMBOL+3
+; CHECK: R_AVR_LDI SYMBOL+3
ldi r21, SYMBOL+3
; CHECK-NEXT: R_AVR_6_ADIW FOO
@@ -31,81 +31,105 @@ rjmp foo-10
brcs foo+2
; CHECK-NEXT: R_AVR_LO8_LDI bar+3
+; CHECK-NEXT: R_AVR_LO8_LDI abc
+; CHECK-NEXT: R_AVR_LO8_LDI abc
ldi r24, lo8(bar+3)
ldi r16, +lo8(abc)
ldi r16, lo8(+(abc))
; CHECK-NEXT: R_AVR_HI8_LDI abc
+; CHECK-NEXT: R_AVR_HI8_LDI abc
+; CHECK-NEXT: R_AVR_HI8_LDI abc
ldi r30, hi8(abc)
ldi r16, +hi8(abc)
ldi r16, hi8(+(abc))
; CHECK-NEXT: R_AVR_LO8_LDI_NEG abc
+; CHECK-NEXT: R_AVR_LO8_LDI_NEG abc
ldi r16, -lo8(abc)
ldi r16, lo8(-(abc))
; CHECK-NEXT: R_AVR_HI8_LDI_NEG abc
+; CHECK-NEXT: R_AVR_HI8_LDI_NEG abc
ldi r16, -hi8(abc)
ldi r16, hi8(-(abc))
; CHECK-NEXT: R_AVR_HH8_LDI foo
+; CHECK-NEXT: R_AVR_HH8_LDI foo
+; CHECK-NEXT: R_AVR_HH8_LDI foo
ldi r16, hh8(foo)
ldi r16, +hh8(foo)
ldi r16, hh8(+(foo))
; CHECK-NEXT: R_AVR_HH8_LDI_NEG foo
+; CHECK-NEXT: R_AVR_HH8_LDI_NEG foo
ldi r16, -hh8(foo)
ldi r16, hh8(-(foo))
; CHECK-NEXT: R_AVR_HH8_LDI foo
+; CHECK-NEXT: R_AVR_HH8_LDI foo
+; CHECK-NEXT: R_AVR_HH8_LDI foo
ldi r24, hlo8(foo)
ldi r24, +hlo8(foo)
ldi r24, hlo8(+(foo))
; CHECK-NEXT: R_AVR_HH8_LDI_NEG foo
+; CHECK-NEXT: R_AVR_HH8_LDI_NEG foo
ldi r24, -hlo8(foo)
ldi r24, hlo8(-(foo))
; CHECK-NEXT: R_AVR_MS8_LDI bar
+; CHECK-NEXT: R_AVR_MS8_LDI bar
+; CHECK-NEXT: R_AVR_MS8_LDI bar
ldi r24, hhi8(bar)
ldi r24, +hhi8(bar)
ldi r24, hhi8(+(bar))
; CHECK-NEXT: R_AVR_MS8_LDI_NEG bar
+; CHECK-NEXT: R_AVR_MS8_LDI_NEG bar
ldi r24, -hhi8(bar)
ldi r24, hhi8(-(bar))
; CHECK-NEXT: R_AVR_LO8_LDI_PM foo
+; CHECK-NEXT: R_AVR_LO8_LDI_PM foo
+; CHECK-NEXT: R_AVR_LO8_LDI_PM foo
ldi r17, pm_lo8(foo)
ldi r25, +pm_lo8(foo)
ldi r25, pm_lo8(+(foo))
; CHECK-NEXT: R_AVR_HI8_LDI_PM bar
+; CHECK-NEXT: R_AVR_HI8_LDI_PM foo
+; CHECK-NEXT: R_AVR_HI8_LDI_PM foo
ldi r22, pm_hi8(bar)
ldi r25, +pm_hi8(foo)
ldi r25, pm_hi8(+(foo))
; CHECK-NEXT: R_AVR_HH8_LDI_PM baz
+; CHECK-NEXT: R_AVR_HH8_LDI_PM foo
+; CHECK-NEXT: R_AVR_HH8_LDI_PM foo
ldi r25, pm_hh8(baz)
ldi r25, +pm_hh8(foo)
ldi r25, pm_hh8(+(foo))
-; CHECK-NEXT: R_AVR_LO8_LDI_PM_NEG
+; CHECK-NEXT: R_AVR_LO8_LDI_PM_NEG foo
+; CHECK-NEXT: R_AVR_LO8_LDI_PM_NEG foo
ldi r25, -pm_lo8(foo)
ldi r25, pm_lo8(-(foo))
-; CHECK-NEXT: R_AVR_HI8_LDI_PM_NEG
+; CHECK-NEXT: R_AVR_HI8_LDI_PM_NEG foo
+; CHECK-NEXT: R_AVR_HI8_LDI_PM_NEG foo
ldi r25, -pm_hi8(foo)
ldi r25, pm_hi8(-(foo))
-; CHECK-NEXT: R_AVR_HH8_LDI_PM_NEG
+; CHECK-NEXT: R_AVR_HH8_LDI_PM_NEG foo
+; CHECK-NEXT: R_AVR_HH8_LDI_PM_NEG foo
ldi r25, -pm_hh8(foo)
ldi r25, pm_hh8(-(foo))
-; CHECK-NEXT: R_AVR_LO8_LDI_GS
+; CHECK-NEXT: R_AVR_LO8_LDI_GS foo
ldi r17, lo8(gs(foo))
-; CHECK-NEXT: R_AVR_HI8_LDI_GS
+; CHECK-NEXT: R_AVR_HI8_LDI_GS foo
ldi r18, hi8(gs(foo))
; CHECK-NEXT: R_AVR_16
@@ -126,11 +150,11 @@ ldi r18, hi8(gs(foo))
; CHECK-NEXT: R_AVR_8_HLO8
.byte hlo8(foo)
-; CHECK-NEXT: R_AVR_DIFF8
+; CHECK: R_AVR_DIFF8
.byte foo - bar
-; CHECK-NEXT: R_AVR_DIFF16
+; CHECK: R_AVR_DIFF16
.short foo - bar
-; CHECK-NEXT: R_AVR_DIFF32
+; CHECK: R_AVR_DIFF32
.long foo - bar
Modified: llvm/trunk/test/MC/AVR/symbol_relocation.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AVR/symbol_relocation.s?rev=320348&r1=320347&r2=320348&view=diff
==============================================================================
--- llvm/trunk/test/MC/AVR/symbol_relocation.s (original)
+++ llvm/trunk/test/MC/AVR/symbol_relocation.s Mon Dec 11 03:01:27 2017
@@ -12,5 +12,5 @@ foo:
.globl ptr
ptr:
- .short foo
+ .short gs(foo)
More information about the llvm-commits
mailing list