[llvm] r252865 - Add AVR backend skeleton

Dylan McKay via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 12 01:26:46 PST 2015


Author: dylanmckay
Date: Thu Nov 12 03:26:44 2015
New Revision: 252865

URL: http://llvm.org/viewvc/llvm-project?rev=252865&view=rev
Log:
Add AVR backend skeleton

This adds part of the target info code, and adds modifications to
the build scripts so that AVR is recognized a supported, experimental
backend.

It does not include any AVR-specific code, just the bare sources required
for a backend to exist.

>From D14039.

Added:
    llvm/trunk/lib/Target/AVR/
    llvm/trunk/lib/Target/AVR/AVRTargetMachine.cpp
    llvm/trunk/lib/Target/AVR/CMakeLists.txt
    llvm/trunk/lib/Target/AVR/LLVMBuild.txt
    llvm/trunk/lib/Target/AVR/Makefile
    llvm/trunk/lib/Target/AVR/TargetInfo/
    llvm/trunk/lib/Target/AVR/TargetInfo/AVRTargetInfo.cpp
    llvm/trunk/lib/Target/AVR/TargetInfo/CMakeLists.txt
    llvm/trunk/lib/Target/AVR/TargetInfo/LLVMBuild.txt
    llvm/trunk/lib/Target/AVR/TargetInfo/Makefile
Modified:
    llvm/trunk/autoconf/configure.ac
    llvm/trunk/configure
    llvm/trunk/lib/Target/LLVMBuild.txt

Modified: llvm/trunk/autoconf/configure.ac
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/autoconf/configure.ac?rev=252865&r1=252864&r2=252865&view=diff
==============================================================================
--- llvm/trunk/autoconf/configure.ac (original)
+++ llvm/trunk/autoconf/configure.ac Thu Nov 12 03:26:44 2015
@@ -431,6 +431,7 @@ AC_CACHE_CHECK([target architecture],[ll
   arm64*-*)               llvm_cv_target_arch="AArch64" ;;
   arm*-*)                 llvm_cv_target_arch="ARM" ;;
   aarch64*-*)             llvm_cv_target_arch="AArch64" ;;
+  avr-*)                  llvm_cv_target_arch="AVR" ;;
   mips-* | mips64-*)      llvm_cv_target_arch="Mips" ;;
   mipsel-* | mips64el-*)  llvm_cv_target_arch="Mips" ;;
   xcore-*)                llvm_cv_target_arch="XCore" ;;
@@ -468,6 +469,7 @@ case $host in
   arm64*-*)               host_arch="AArch64" ;;
   arm*-*)                 host_arch="ARM" ;;
   aarch64*-*)             host_arch="AArch64" ;;
+  avr-*)                  host_arch="AVR" ;;
   mips-* | mips64-*)      host_arch="Mips" ;;
   mipsel-* | mips64el-*)  host_arch="Mips" ;;
   xcore-*)                host_arch="XCore" ;;
@@ -801,6 +803,7 @@ else
     PowerPC)     AC_SUBST(TARGET_HAS_JIT,1) ;;
     x86_64)      AC_SUBST(TARGET_HAS_JIT,1) ;;
     ARM)         AC_SUBST(TARGET_HAS_JIT,1) ;;
+    AVR)         AC_SUBST(TARGET_HAS_JIT,0) ;;
     Mips)        AC_SUBST(TARGET_HAS_JIT,1) ;;
     XCore)       AC_SUBST(TARGET_HAS_JIT,0) ;;
     MSP430)      AC_SUBST(TARGET_HAS_JIT,0) ;;

Modified: llvm/trunk/configure
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/configure?rev=252865&r1=252864&r2=252865&view=diff
==============================================================================
--- llvm/trunk/configure (original)
+++ llvm/trunk/configure Thu Nov 12 03:26:44 2015
@@ -4188,6 +4188,7 @@ else
   arm64*-*)               llvm_cv_target_arch="AArch64" ;;
   arm*-*)                 llvm_cv_target_arch="ARM" ;;
   aarch64*-*)             llvm_cv_target_arch="AArch64" ;;
+  avr-*)                  llvm_cv_target_arch="AVR" ;;
   mips-* | mips64-*)      llvm_cv_target_arch="Mips" ;;
   mipsel-* | mips64el-*)  llvm_cv_target_arch="Mips" ;;
   xcore-*)                llvm_cv_target_arch="XCore" ;;
@@ -4226,6 +4227,7 @@ case $host in
   arm64*-*)               host_arch="AArch64" ;;
   arm*-*)                 host_arch="ARM" ;;
   aarch64*-*)             host_arch="AArch64" ;;
+  avr-*)                  host_arch="AVR" ;;
   mips-* | mips64-*)      host_arch="Mips" ;;
   mipsel-* | mips64el-*)  host_arch="Mips" ;;
   xcore-*)                host_arch="XCore" ;;
@@ -5148,6 +5150,8 @@ else
  ;;
     ARM)         TARGET_HAS_JIT=1
  ;;
+    AVR)         TARGET_HAS_JIT=0
+ ;;
     Mips)        TARGET_HAS_JIT=1
  ;;
     XCore)       TARGET_HAS_JIT=0

Added: llvm/trunk/lib/Target/AVR/AVRTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AVR/AVRTargetMachine.cpp?rev=252865&view=auto
==============================================================================
--- llvm/trunk/lib/Target/AVR/AVRTargetMachine.cpp (added)
+++ llvm/trunk/lib/Target/AVR/AVRTargetMachine.cpp Thu Nov 12 03:26:44 2015
@@ -0,0 +1,4 @@
+
+extern "C" void LLVMInitializeAVRTarget() {
+
+}

Added: llvm/trunk/lib/Target/AVR/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AVR/CMakeLists.txt?rev=252865&view=auto
==============================================================================
--- llvm/trunk/lib/Target/AVR/CMakeLists.txt (added)
+++ llvm/trunk/lib/Target/AVR/CMakeLists.txt Thu Nov 12 03:26:44 2015
@@ -0,0 +1,10 @@
+
+
+add_llvm_target(AVRCodeGen
+    AVRTargetMachine.cpp
+  )
+
+add_dependencies(LLVMAVRCodeGen intrinsics_gen)
+
+add_subdirectory(TargetInfo)
+

Added: llvm/trunk/lib/Target/AVR/LLVMBuild.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AVR/LLVMBuild.txt?rev=252865&view=auto
==============================================================================
--- llvm/trunk/lib/Target/AVR/LLVMBuild.txt (added)
+++ llvm/trunk/lib/Target/AVR/LLVMBuild.txt Thu Nov 12 03:26:44 2015
@@ -0,0 +1,33 @@
+;===- ./lib/Target/AVR/LLVMBuild.txt ---------------------------*- Conf -*--===;
+;
+;                     The LLVM Compiler Infrastructure
+;
+; This file is distributed under the University of Illinois Open Source
+; License. See LICENSE.TXT for details.
+;
+;===------------------------------------------------------------------------===;
+;
+; This is an LLVMBuild description file for the components in this subdirectory.
+;
+; For more information on the LLVMBuild system, please see:
+;
+;   http://llvm.org/docs/LLVMBuild.html
+;
+;===------------------------------------------------------------------------===;
+
+[common]
+subdirectories = TargetInfo
+
+[component_0]
+type = TargetGroup
+name = AVR
+parent = Target
+has_asmprinter = 0
+has_asmparser = 0
+
+[component_1]
+type = Library
+name = AVRCodeGen
+parent = AVR
+required_libraries = AsmPrinter CodeGen Core MC AVRInfo SelectionDAG Support Target
+add_to_library_groups = AVR

Added: llvm/trunk/lib/Target/AVR/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AVR/Makefile?rev=252865&view=auto
==============================================================================
--- llvm/trunk/lib/Target/AVR/Makefile (added)
+++ llvm/trunk/lib/Target/AVR/Makefile Thu Nov 12 03:26:44 2015
@@ -0,0 +1,19 @@
+##===- lib/Target/AVR/Makefile -----------------------------*- Makefile -*-===##
+#
+#                     The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LEVEL = ../../..
+LIBRARYNAME = LLVMAVRCodeGen
+TARGET = AVR
+
+# Make sure that tblgen is run, first thing.
+BUILT_SOURCES =
+
+DIRS = TargetInfo
+
+include $(LEVEL)/Makefile.common

Added: llvm/trunk/lib/Target/AVR/TargetInfo/AVRTargetInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AVR/TargetInfo/AVRTargetInfo.cpp?rev=252865&view=auto
==============================================================================
--- llvm/trunk/lib/Target/AVR/TargetInfo/AVRTargetInfo.cpp (added)
+++ llvm/trunk/lib/Target/AVR/TargetInfo/AVRTargetInfo.cpp Thu Nov 12 03:26:44 2015
@@ -0,0 +1,25 @@
+//===-- AVRTargetInfo.cpp - AVR Target Implementation ---------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/IR/Module.h"
+#include "llvm/Support/TargetRegistry.h"
+
+namespace llvm {
+Target TheAVRTarget;
+}
+
+extern "C" void LLVMInitializeAVRTargetInfo() {
+  llvm::RegisterTarget<llvm::Triple::avr> X(
+      llvm::TheAVRTarget, "avr", "Atmel AVR Microcontroller");
+}
+
+// FIXME: Temporary stub - this function must be defined for linking
+// to succeed. Remove once this function is properly implemented.
+extern "C" void LLVMInitializeAVRTargetMC() {
+}

Added: llvm/trunk/lib/Target/AVR/TargetInfo/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AVR/TargetInfo/CMakeLists.txt?rev=252865&view=auto
==============================================================================
--- llvm/trunk/lib/Target/AVR/TargetInfo/CMakeLists.txt (added)
+++ llvm/trunk/lib/Target/AVR/TargetInfo/CMakeLists.txt Thu Nov 12 03:26:44 2015
@@ -0,0 +1,7 @@
+include_directories( ${CMAKE_CURRENT_BINARY_DIR}/..
+                     ${CMAKE_CURRENT_SOURCE_DIR}/.. )
+
+add_llvm_library(LLVMAVRInfo
+  AVRTargetInfo.cpp
+)
+

Added: llvm/trunk/lib/Target/AVR/TargetInfo/LLVMBuild.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AVR/TargetInfo/LLVMBuild.txt?rev=252865&view=auto
==============================================================================
--- llvm/trunk/lib/Target/AVR/TargetInfo/LLVMBuild.txt (added)
+++ llvm/trunk/lib/Target/AVR/TargetInfo/LLVMBuild.txt Thu Nov 12 03:26:44 2015
@@ -0,0 +1,23 @@
+;===- ./lib/Target/AVR/TargetInfo/LLVMBuild.txt ----------------*- Conf -*--===;
+;
+;                     The LLVM Compiler Infrastructure
+;
+; This file is distributed under the University of Illinois Open Source
+; License. See LICENSE.TXT for details.
+;
+;===------------------------------------------------------------------------===;
+;
+; This is an LLVMBuild description file for the components in this subdirectory.
+;
+; For more information on the LLVMBuild system, please see:
+;
+;   http://llvm.org/docs/LLVMBuild.html
+;
+;===------------------------------------------------------------------------===;
+
+[component_0]
+type = Library
+name = AVRInfo
+parent = AVR
+required_libraries = MC Support
+add_to_library_groups = AVR
\ No newline at end of file

Added: llvm/trunk/lib/Target/AVR/TargetInfo/Makefile
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AVR/TargetInfo/Makefile?rev=252865&view=auto
==============================================================================
--- llvm/trunk/lib/Target/AVR/TargetInfo/Makefile (added)
+++ llvm/trunk/lib/Target/AVR/TargetInfo/Makefile Thu Nov 12 03:26:44 2015
@@ -0,0 +1,16 @@
+##===- lib/Target/AVR/TargetInfo/Makefile ------------------*- Makefile -*-===##
+#
+#                     The LLVM Compiler Infrastructure
+#
+# This file is distributed under the University of Illinois Open Source
+# License. See LICENSE.TXT for details.
+#
+##===----------------------------------------------------------------------===##
+
+LEVEL = ../../../..
+LIBRARYNAME = LLVMAVRInfo
+
+# Hack: we need to include 'main' target directory to grab private headers
+CPP.Flags += -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
+
+include $(LEVEL)/Makefile.common

Modified: llvm/trunk/lib/Target/LLVMBuild.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/LLVMBuild.txt?rev=252865&r1=252864&r2=252865&view=diff
==============================================================================
--- llvm/trunk/lib/Target/LLVMBuild.txt (original)
+++ llvm/trunk/lib/Target/LLVMBuild.txt Thu Nov 12 03:26:44 2015
@@ -22,6 +22,7 @@ subdirectories =
  AMDGPU
  ARM
  AArch64
+ AVR
  BPF
  CppBackend
  Hexagon




More information about the llvm-commits mailing list