summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 56058a5)
raw | patch | inline | side by side (parent: 56058a5)
author | Jon Humphreys <jon@micro.ti.com> | |
Tue, 22 Jul 2014 22:28:59 +0000 (17:28 -0500) | ||
committer | Jon Humphreys <j-humphreys@ti.com> | |
Thu, 22 Jan 2015 23:39:31 +0000 (17:39 -0600) |
15 files changed:
diff --git a/configure b/configure
index e72c11d43c06531b4b3c263783de83358bd4d89a..50b0912b43687999e3a483674a9a0decba416d78 100755 (executable)
--- a/configure
+++ b/configure
mips64) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;;
mips64el) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;;
xcore) TARGETS_TO_BUILD="XCore $TARGETS_TO_BUILD" ;;
+ c6000) TARGETS_TO_BUILD="C6000 $TARGETS_TO_BUILD" ;;
msp430) TARGETS_TO_BUILD="MSP430 $TARGETS_TO_BUILD" ;;
cpp) TARGETS_TO_BUILD="CppBackend $TARGETS_TO_BUILD" ;;
hexagon) TARGETS_TO_BUILD="Hexagon $TARGETS_TO_BUILD" ;;
ARM) TARGETS_TO_BUILD="ARM $TARGETS_TO_BUILD" ;;
Mips) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;;
XCore) TARGETS_TO_BUILD="XCore $TARGETS_TO_BUILD" ;;
+ c6000) TARGETS_TO_BUILD="C6000 $TARGETS_TO_BUILD" ;;
MSP430) TARGETS_TO_BUILD="MSP430 $TARGETS_TO_BUILD" ;;
Hexagon) TARGETS_TO_BUILD="Hexagon $TARGETS_TO_BUILD" ;;
NVPTX) TARGETS_TO_BUILD="NVPTX $TARGETS_TO_BUILD" ;;
diff --git a/lib/Target/C6000/C6000.h b/lib/Target/C6000/C6000.h
--- /dev/null
+++ b/lib/Target/C6000/C6000.h
@@ -0,0 +1,29 @@
+//==-- C6000.h - Top-level interface for MSP430 representation ---*- C++ -*-==//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file contains the entry points for global functions defined in
+// the LLVM C6000 backend.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_TARGET_C6000_H
+#define LLVM_TARGET_C6000_H
+
+#include "MCTargetDesc/C6000MCTargetDesc.h"
+#include "llvm/Target/TargetMachine.h"
+
+namespace llvm {
+
+class C6000TargetMachine;
+
+/// \brief Creates an C6000-specific Target Transformation Info pass.
+ImmutablePass *createC6000TargetTransformInfoPass(const C6000TargetMachine *TM);
+} // end namespace llvm;
+
+#endif
diff --git a/lib/Target/C6000/C6000TargetMachine.cpp b/lib/Target/C6000/C6000TargetMachine.cpp
--- /dev/null
@@ -0,0 +1,85 @@
+//===-- C6000TargetMachine.cpp - Define TargetMachine for C6000 -----------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+//
+//===----------------------------------------------------------------------===//
+
+#include "C6000.h"
+#include "C6000TargetMachine.h"
+#include "llvm/CodeGen/Passes.h"
+#include "llvm/PassManager.h"
+#include "llvm/Support/TargetRegistry.h"
+using namespace llvm;
+
+extern "C" void LLVMInitializeC6000Target() {
+ // Register the target.
+ RegisterTargetMachine<C6000TargetMachine> X(TheC6000Target);
+}
+
+static std::string computeDataLayout() {
+ // TODO: for now, assume little endian
+ std::string Ret = "e-m:e";
+
+ // 32bit pointers.
+ Ret += "-p:32:32";
+
+ // Alignments for 64 bit integers.
+ Ret += "-i64:64";
+
+ // Alignments for 128 bit and above vectors is 64
+ Ret += "-v128:64:128";
+
+ // 32 bit ints
+ // 64 bit aligned stack
+ Ret += "-n32-S64";
+
+ return Ret;
+}
+
+/// C6000TargetMachine ctor
+///
+C6000TargetMachine::C6000TargetMachine(const Target &T, StringRef TT,
+ StringRef CPU, StringRef FS,
+ const TargetOptions &Options,
+ Reloc::Model RM, CodeModel::Model CM,
+ CodeGenOpt::Level OL)
+ : LLVMTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL),
+ DL(computeDataLayout())
+{
+}
+
+//===----------------------------------------------------------------------===//
+// C6000 Analysis Pass Setup
+//===----------------------------------------------------------------------===//
+
+void C6000TargetMachine::addAnalysisPasses(PassManagerBase &PM) {
+ // Add first the target-independent BasicTTI pass, then our C6000 pass. This
+ // allows the C6000 pass to delegate to the target independent layer when
+ // appropriate.
+ PM.add(createBasicTargetTransformInfoPass(this));
+ PM.add(createC6000TargetTransformInfoPass(this));
+}
+
+namespace {
+/// C6000 Code Generator Pass Configuration Options.
+class C6000PassConfig : public TargetPassConfig {
+public:
+ C6000PassConfig(C6000TargetMachine *TM, PassManagerBase &PM)
+ : TargetPassConfig(TM, PM) {}
+
+ C6000TargetMachine &getC6000TargetMachine() const {
+ return getTM<C6000TargetMachine>();
+ }
+};
+} // namespace
+
+TargetPassConfig *C6000TargetMachine::createPassConfig(PassManagerBase &PM) {
+ return new C6000PassConfig(this, PM);
+}
+
diff --git a/lib/Target/C6000/C6000TargetMachine.h b/lib/Target/C6000/C6000TargetMachine.h
--- /dev/null
@@ -0,0 +1,42 @@
+//===-- C6000TargetMachine.h - Define TargetMachine for C6000 ---*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file declares the C6000 specific subclass of TargetMachine.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef C6000TARGETMACHINE_H
+#define C6000TARGETMACHINE_H
+
+#include "llvm/IR/DataLayout.h"
+#include "llvm/Target/TargetFrameLowering.h"
+#include "llvm/Target/TargetMachine.h"
+
+namespace llvm {
+
+class C6000TargetMachine : public LLVMTargetMachine {
+ const DataLayout DL; // Calculates type size & alignment
+public:
+ C6000TargetMachine(const Target &T, StringRef TT,
+ StringRef CPU, StringRef FS, const TargetOptions &Options,
+ Reloc::Model RM, CodeModel::Model CM,
+ CodeGenOpt::Level OL);
+
+ const DataLayout *getDataLayout() const override { return &DL; }
+
+ /// \brief Register C6000 analysis passes with a pass manager.
+ void addAnalysisPasses(PassManagerBase &PM) override;
+
+ // Pass Pipeline Configuration
+ TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
+};
+
+} // end namespace llvm
+
+#endif
diff --git a/lib/Target/C6000/C6000TargetTransformInfo.cpp b/lib/Target/C6000/C6000TargetTransformInfo.cpp
--- /dev/null
@@ -0,0 +1,91 @@
+//===-- C6000TargetTransformInfo.cpp - C6000 specific TTI pass ------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+/// \file
+/// This file implements a TargetTransformInfo analysis pass specific to the
+/// C6000 target machine. It uses the target's detailed information to provide
+/// more precise answers to certain TTI queries, while letting the target
+/// independent and default TTI implementations handle the rest.
+///
+//===----------------------------------------------------------------------===//
+
+#include "C6000.h"
+#include "llvm/Analysis/TargetTransformInfo.h"
+#include "llvm/Support/Debug.h"
+#include "llvm/Target/CostTable.h"
+#include "llvm/Target/TargetLowering.h"
+using namespace llvm;
+
+#define DEBUG_TYPE "c6000tti"
+
+// Declare the pass initialization routine locally as target-specific passes
+// don't have a target-wide initialization entry point, and so we rely on the
+// pass constructor initialization.
+namespace llvm {
+void initializeC6000TTIPass(PassRegistry &);
+}
+
+namespace {
+class C6000TTI final : public ImmutablePass, public TargetTransformInfo {
+ public:
+ C6000TTI() : ImmutablePass(ID) {
+ llvm_unreachable("This pass cannot be directly constructed");
+ }
+
+ C6000TTI(const C6000TargetMachine *TM)
+ : ImmutablePass(ID) {
+ initializeC6000TTIPass(*PassRegistry::getPassRegistry());
+ }
+
+ void initializePass() override {
+ pushTTIStack(this);
+ }
+
+ void getAnalysisUsage(AnalysisUsage &AU) const override {
+ TargetTransformInfo::getAnalysisUsage(AU);
+ }
+
+ /// Pass identification.
+ static char ID;
+
+ /// Provide necessary pointer adjustments for the two base classes.
+ void *getAdjustedAnalysisPointer(const void *ID) override {
+ if (ID == &TargetTransformInfo::ID)
+ return (TargetTransformInfo*)this;
+ return this;
+ }
+
+ /// \name Vector TTI Implementations
+ /// @{
+
+ unsigned getNumberOfRegisters(bool Vector) const override {
+ if (Vector)
+ return 16;
+
+ return 64;
+ }
+
+ unsigned getRegisterBitWidth(bool Vector) const override {
+ return 32;
+ }
+
+ unsigned getMaximumUnrollFactor() const override {
+ return 4;
+ }
+};
+
+} // end anonymous namespace
+
+INITIALIZE_AG_PASS(C6000TTI, TargetTransformInfo, "c6000tti",
+ "C6000 Target Transform Info", true, true, false)
+char C6000TTI::ID = 0;
+
+ImmutablePass *
+llvm::createC6000TargetTransformInfoPass(const C6000TargetMachine *TM) {
+ return new C6000TTI(TM);
+}
diff --git a/lib/Target/C6000/LLVMBuild.txt b/lib/Target/C6000/LLVMBuild.txt
--- /dev/null
@@ -0,0 +1,35 @@
+;===- ./lib/Target/C6000/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 = MCTargetDesc TargetInfo
+
+[component_0]
+type = TargetGroup
+name = C6000
+parent = Target
+has_asmparser = 0
+has_asmprinter = 0
+has_disassembler = 0
+has_jit = 0
+
+[component_1]
+type = Library
+name = C6000CodeGen
+parent = C6000
+required_libraries = Core Support Target C6000Desc C6000Info
+add_to_library_groups = C6000
diff --git a/lib/Target/C6000/MCTargetDesc/C6000MCTargetDesc.cpp b/lib/Target/C6000/MCTargetDesc/C6000MCTargetDesc.cpp
--- /dev/null
@@ -0,0 +1,18 @@
+//===-- C6000MCTargetDesc.cpp - C6000 Target Descriptions -----------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file provides C6000 specific target descriptions.
+//
+//===----------------------------------------------------------------------===//
+
+#include "C6000MCTargetDesc.h"
+using namespace llvm;
+
+extern "C" void LLVMInitializeC6000TargetMC() {
+}
diff --git a/lib/Target/C6000/MCTargetDesc/C6000MCTargetDesc.h b/lib/Target/C6000/MCTargetDesc/C6000MCTargetDesc.h
--- /dev/null
@@ -0,0 +1,24 @@
+//===-- C6000MCTargetDesc.h - C6000 Target Descriptions ---------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file provides C6000 specific target descriptions.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef C6000MCTARGETDESC_H
+#define C6000MCTARGETDESC_H
+
+namespace llvm {
+class Target;
+
+extern Target TheC6000Target;
+
+} // End llvm namespace
+
+#endif
diff --git a/lib/Target/C6000/MCTargetDesc/LLVMBuild.txt b/lib/Target/C6000/MCTargetDesc/LLVMBuild.txt
--- /dev/null
@@ -0,0 +1,23 @@
+;===- ./lib/Target/C6000/MCTargetDesc/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 = C6000Desc
+parent = C6000
+required_libraries = MC C6000Info
+add_to_library_groups = C6000
diff --git a/lib/Target/C6000/MCTargetDesc/Makefile b/lib/Target/C6000/MCTargetDesc/Makefile
--- /dev/null
@@ -0,0 +1,16 @@
+##===- lib/Target/C6000/TargetDesc/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 = LLVMC6000Desc
+
+# 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
diff --git a/lib/Target/C6000/Makefile b/lib/Target/C6000/Makefile
--- /dev/null
@@ -0,0 +1,18 @@
+##===- lib/Target/C6000/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 = LLVMC6000CodeGen
+TARGET = C6000
+
+# Make sure that tblgen is run, first thing.
+BUILT_SOURCES =
+DIRS = TargetInfo MCTargetDesc
+
+include $(LEVEL)/Makefile.common
diff --git a/lib/Target/C6000/TargetInfo/C6000TargetInfo.cpp b/lib/Target/C6000/TargetInfo/C6000TargetInfo.cpp
--- /dev/null
@@ -0,0 +1,20 @@
+//===-- C6000TargetInfo.cpp - C6000 Target Implementation -----------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "C6000.h"
+#include "llvm/IR/Module.h"
+#include "llvm/Support/TargetRegistry.h"
+using namespace llvm;
+
+Target llvm::TheC6000Target;
+
+extern "C" void LLVMInitializeC6000TargetInfo() {
+ RegisterTarget<Triple::c6000, /*HasJIT=*/ false>
+ X(TheC6000Target, "c6000", "C6000");
+}
diff --git a/lib/Target/C6000/TargetInfo/LLVMBuild.txt b/lib/Target/C6000/TargetInfo/LLVMBuild.txt
--- /dev/null
@@ -0,0 +1,23 @@
+;===- ./lib/Target/C6000/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 = C6000Info
+parent = C6000
+required_libraries = Support
+add_to_library_groups = C6000
diff --git a/lib/Target/C6000/TargetInfo/Makefile b/lib/Target/C6000/TargetInfo/Makefile
--- /dev/null
@@ -0,0 +1,15 @@
+##===- lib/Target/C6000/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 = LLVMC6000Info
+
+# Hack: we need to include 'main' target directory to grab private headers
+CPPFLAGS = -I$(PROJ_OBJ_DIR)/.. -I$(PROJ_SRC_DIR)/..
+
+include $(LEVEL)/Makefile.common
index 27d76bf89009274895eb8ad2bdf3f6056f928979..5a20429842eef620fb3434b786b884f927291322 100644 (file)
--- a/lib/Target/LLVMBuild.txt
+++ b/lib/Target/LLVMBuild.txt
;===------------------------------------------------------------------------===;
[common]
-subdirectories = ARM AArch64 CppBackend Hexagon MSP430 NVPTX Mips PowerPC R600 Sparc SystemZ X86 XCore
+subdirectories = ARM AArch64 CppBackend Hexagon MSP430 NVPTX Mips PowerPC R600 Sparc SystemZ X86 XCore C6000
; This is a special group whose required libraries are extended (by llvm-build)
; with the best execution engine (the native JIT, if available, or the