avr-llvm / llvm

[MERGED UPSTREAM] AVR backend for the LLVM compiler library
220 stars 21 forks source link

Unsupported Instruction Error in MC #77

Closed dylanmckay closed 9 years ago

dylanmckay commented 9 years ago

Compiling a snippet of code succeeds when writing a textual assembly file, but fails when generating an object file.

Command line:

llc -march=avr -mcpu=avrxmega1 main.ll -filetype=obj

main.ll:

; ModuleID = '/home/dylan/Desktop/tmp.c'
target datalayout = "e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8-i64:8:8-f32:8:8-f64:8:8-n8"
target triple = "avr-none"

; Function Attrs: nounwind
define i16 @main() #0 {
entry:
  %us = alloca i16, align 2
  store volatile i16 12, i16* %us, align 2
  %0 = load volatile i16, i16* %us, align 2
  %1 = call i16 asm sideeffect "1: sbiw $0,1\0A\09brne 1b", "=w,0"(i16 %0) #1, !srcloc !1
  store volatile i16 %1, i16* %us, align 2
  ret i16 0
}

attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #1 = { nounwind }

!llvm.ident = !{!0}

!0 = !{!"clang version 3.7.0 (https://github.com/llvm-mirror/clang.git 00a0b3863ac817790d9b344da4fc499b71140a7a) (https://github.com/llvm-mirror/llvm.git 7afcd3cc7616056222ca0d887cdd12efedde48a9)"}
!1 = !{i32 76, i32 94}

Error message:

LLVM ERROR: Not supported instr: <MCInst 158 <MCOperand Reg:51> <MCOperand Imm:1> <MCOperand Reg:49>>

The MCInst has opcode 158 (presuming this is the opcode). This corresponds to STDWSPQRr.

dylanmckay commented 9 years ago

Duplicate of #115.