[PATCH] D39688: [Nios2] final infrastructure addition to provide compilation of simple return from a function.

Andrei via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 21 03:05:31 PST 2017


AndreiGrischenko updated this revision to Diff 123749.
AndreiGrischenko added a comment.

Fixed a typo when assigning default CPU for Nios2.
Added a test checking for acceptance of Nios2 processors.


https://reviews.llvm.org/D39688

Files:
  lib/Target/Nios2/MCTargetDesc/Nios2MCTargetDesc.cpp
  test/CodeGen/Nios2/proc_support.ll
  test/CodeGen/Nios2/ret_generated.ll


Index: test/CodeGen/Nios2/ret_generated.ll
===================================================================
--- test/CodeGen/Nios2/ret_generated.ll
+++ test/CodeGen/Nios2/ret_generated.ll
@@ -1,4 +1,4 @@
-; This tests that llc accepts Nios2 target.
+; This tests that llc generates 'ret' instruction in assembly output.
 
 ; RUN: llc < %s -march=nios2 2>&1 | FileCheck %s --check-prefix=ARCH
 
Index: test/CodeGen/Nios2/proc_support.ll
===================================================================
--- /dev/null
+++ test/CodeGen/Nios2/proc_support.ll
@@ -0,0 +1,10 @@
+; This tests that llc accepts Nios2 processors.
+
+; RUN: not not llc < %s -asm-verbose=false -march=nios2 -mcpu=nios2r1 2>&1 | FileCheck %s --check-prefix=ARCH
+; RUN: not not llc < %s -asm-verbose=false -march=nios2 -mcpu=nios2r2 2>&1 | FileCheck %s --check-prefix=ARCH
+
+; ARCH-NOT: is not a recognized processor
+
+define i32 @f(i32 %i) {
+  ret i32 %i
+}
Index: lib/Target/Nios2/MCTargetDesc/Nios2MCTargetDesc.cpp
===================================================================
--- lib/Target/Nios2/MCTargetDesc/Nios2MCTargetDesc.cpp
+++ lib/Target/Nios2/MCTargetDesc/Nios2MCTargetDesc.cpp
@@ -46,7 +46,7 @@
 static MCSubtargetInfo *
 createNios2MCSubtargetInfo(const Triple &TT, StringRef CPU, StringRef FS) {
   if (CPU.empty() || CPU == "generic") {
-    CPU == "nios2r1";
+    CPU = "nios2r1";
   }
 
   return createNios2MCSubtargetInfoImpl(TT, CPU, FS);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39688.123749.patch
Type: text/x-patch
Size: 1448 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171121/287941fe/attachment.bin>


More information about the llvm-commits mailing list