Signed-off-by: Chen Wei-Ren <chenwj@xxxxxxxxxxxxxxxxx> --- lib/Target/UniCore/LLVMBuild.txt | 34 ++++++++++++++++++++++ lib/Target/UniCore/MCTargetDesc/LLVMBuild.txt | 23 +++++++++++++++ lib/Target/UniCore/MCTargetDesc/Makefile | 16 ++++++++++ .../UniCore/MCTargetDesc/UniCoreMCTargetDesc.cpp | 20 +++++++++++++ .../UniCore/MCTargetDesc/UniCoreMCTargetDesc.h | 25 ++++++++++++++++ lib/Target/UniCore/Makefile | 18 ++++++++++++ lib/Target/UniCore/TargetInfo/LLVMBuild.txt | 23 +++++++++++++++ lib/Target/UniCore/TargetInfo/Makefile | 15 ++++++++++ .../UniCore/TargetInfo/UniCoreTargetInfo.cpp | 19 ++++++++++++ lib/Target/UniCore/UniCore.h | 25 ++++++++++++++++ lib/Target/UniCore/UniCoreTargetMachine.cpp | 31 ++++++++++++++++++++ lib/Target/UniCore/UniCoreTargetMachine.h | 33 +++++++++++++++++++++ 12 files changed, 282 insertions(+) create mode 100644 lib/Target/UniCore/LLVMBuild.txt create mode 100644 lib/Target/UniCore/MCTargetDesc/LLVMBuild.txt create mode 100644 lib/Target/UniCore/MCTargetDesc/Makefile create mode 100644 lib/Target/UniCore/MCTargetDesc/UniCoreMCTargetDesc.cpp create mode 100644 lib/Target/UniCore/MCTargetDesc/UniCoreMCTargetDesc.h create mode 100644 lib/Target/UniCore/Makefile create mode 100644 lib/Target/UniCore/TargetInfo/LLVMBuild.txt create mode 100644 lib/Target/UniCore/TargetInfo/Makefile create mode 100644 lib/Target/UniCore/TargetInfo/UniCoreTargetInfo.cpp create mode 100644 lib/Target/UniCore/UniCore.h create mode 100644 lib/Target/UniCore/UniCoreTargetMachine.cpp create mode 100644 lib/Target/UniCore/UniCoreTargetMachine.h diff --git a/lib/Target/UniCore/LLVMBuild.txt b/lib/Target/UniCore/LLVMBuild.txt new file mode 100644 index 0000000..ac7810c --- /dev/null +++ b/lib/Target/UniCore/LLVMBuild.txt @@ -0,0 +1,34 @@ +;===-- ./lib/Target/UniCore/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 = UniCore +parent = Target +has_asmparser = 0 +has_asmprinter = 0 +has_disassembler = 0 + +[component_1] +type = Library +name = UniCoreCodeGen +parent = UniCore +required_libraries = AsmPrinter CodeGen Core UniCoreDesc UniCoreInfo SelectionDAG Support Target +add_to_library_groups = UniCore diff --git a/lib/Target/UniCore/MCTargetDesc/LLVMBuild.txt b/lib/Target/UniCore/MCTargetDesc/LLVMBuild.txt new file mode 100644 index 0000000..81e546c --- /dev/null +++ b/lib/Target/UniCore/MCTargetDesc/LLVMBuild.txt @@ -0,0 +1,23 @@ +;===-- ./lib/Target/UniCore/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 = UniCoreDesc +parent = UniCore +required_libraries = Support +add_to_library_groups = UniCore diff --git a/lib/Target/UniCore/MCTargetDesc/Makefile b/lib/Target/UniCore/MCTargetDesc/Makefile new file mode 100644 index 0000000..e505150 --- /dev/null +++ b/lib/Target/UniCore/MCTargetDesc/Makefile @@ -0,0 +1,16 @@ +##===-- lib/Target/UniCore/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 = LLVMUniCoreDesc + +# 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/UniCore/MCTargetDesc/UniCoreMCTargetDesc.cpp b/lib/Target/UniCore/MCTargetDesc/UniCoreMCTargetDesc.cpp new file mode 100644 index 0000000..e77f929 --- /dev/null +++ b/lib/Target/UniCore/MCTargetDesc/UniCoreMCTargetDesc.cpp @@ -0,0 +1,20 @@ +//===-- UniCoreMCTargetDesc.cpp - UniCore 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 UniCore specific target descriptions. +// +//===----------------------------------------------------------------------===// + +#include "UniCoreMCTargetDesc.h" + +using namespace llvm; + +// Force static initialization. +extern "C" void LLVMInitializeUniCoreTargetMC() { +} diff --git a/lib/Target/UniCore/MCTargetDesc/UniCoreMCTargetDesc.h b/lib/Target/UniCore/MCTargetDesc/UniCoreMCTargetDesc.h new file mode 100644 index 0000000..cdce996 --- /dev/null +++ b/lib/Target/UniCore/MCTargetDesc/UniCoreMCTargetDesc.h @@ -0,0 +1,25 @@ +//===-- UniCoreMCTargetDesc.h - UniCore 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 UniCore specific target descriptions. +// +//===----------------------------------------------------------------------===// + +#ifndef UNICOREMCTARGETDESC_H +#define UNICOREMCTARGETDESC_H + +#include "llvm/Support/DataTypes.h" + +namespace llvm { +class Target; + +extern Target TheUniCoreTarget; +} // End llvm namespace + +#endif diff --git a/lib/Target/UniCore/Makefile b/lib/Target/UniCore/Makefile new file mode 100644 index 0000000..bcac019 --- /dev/null +++ b/lib/Target/UniCore/Makefile @@ -0,0 +1,18 @@ +##===-- lib/Target/UniCore/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 = LLVMUniCoreCodeGen +TARGET = UniCore + +# Make sure that tblgen is run, first thing. +BUILT_SOURCES = + +DIRS = TargetInfo MCTargetDesc + +include $(LEVEL)/Makefile.common diff --git a/lib/Target/UniCore/TargetInfo/LLVMBuild.txt b/lib/Target/UniCore/TargetInfo/LLVMBuild.txt new file mode 100644 index 0000000..2feb766 --- /dev/null +++ b/lib/Target/UniCore/TargetInfo/LLVMBuild.txt @@ -0,0 +1,23 @@ +;===-- ./lib/Target/UniCore/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 = UniCoreInfo +parent = UniCore +required_libraries = Support Target +add_to_library_groups = UniCore diff --git a/lib/Target/UniCore/TargetInfo/Makefile b/lib/Target/UniCore/TargetInfo/Makefile new file mode 100644 index 0000000..fd55e49 --- /dev/null +++ b/lib/Target/UniCore/TargetInfo/Makefile @@ -0,0 +1,15 @@ +##===-- lib/Target/UniCore/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 = LLVMUniCoreInfo + +# 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 diff --git a/lib/Target/UniCore/TargetInfo/UniCoreTargetInfo.cpp b/lib/Target/UniCore/TargetInfo/UniCoreTargetInfo.cpp new file mode 100644 index 0000000..c55916d --- /dev/null +++ b/lib/Target/UniCore/TargetInfo/UniCoreTargetInfo.cpp @@ -0,0 +1,19 @@ +//===-- UniCoreTargetInfo.cpp - UniCore Target Implementation -------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "UniCore.h" +#include "llvm/Module.h" +#include "llvm/Support/TargetRegistry.h" +using namespace llvm; + +Target llvm::TheUniCoreTarget; + +extern "C" void LLVMInitializeUniCoreTargetInfo() { + RegisterTarget<Triple::unicore32> X(TheUniCoreTarget, "unicore32", "UniCore"); +} diff --git a/lib/Target/UniCore/UniCore.h b/lib/Target/UniCore/UniCore.h new file mode 100644 index 0000000..833b861 --- /dev/null +++ b/lib/Target/UniCore/UniCore.h @@ -0,0 +1,25 @@ +//===-- UniCore.h - Top-level interface for UniCore -------------*- 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 UniCore back-end. +// +//===----------------------------------------------------------------------===// + +#ifndef TARGET_UNICORE_H +#define TARGET_UNICORE_H + +#include "MCTargetDesc/UniCoreMCTargetDesc.h" +#include "llvm/Target/TargetMachine.h" + +namespace llvm { + class UniCoreTargetMachine; +} // end namespace llvm; + +#endif diff --git a/lib/Target/UniCore/UniCoreTargetMachine.cpp b/lib/Target/UniCore/UniCoreTargetMachine.cpp new file mode 100644 index 0000000..beaf5d9 --- /dev/null +++ b/lib/Target/UniCore/UniCoreTargetMachine.cpp @@ -0,0 +1,31 @@ +//===-- UniCoreTargetMachine.cpp - Define TargetMachine for UniCore -------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// Implements the info about UniCore target spec. +// +//===----------------------------------------------------------------------===// + +#include "UniCoreTargetMachine.h" +#include "UniCore.h" +#include "llvm/Support/TargetRegistry.h" +using namespace llvm; + +extern "C" void LLVMInitializeUniCoreTarget() { + // Register the target. + RegisterTargetMachine<UniCoreTargetMachine> X(TheUniCoreTarget); +} + +UniCoreTargetMachine:: +UniCoreTargetMachine(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) +{ +} diff --git a/lib/Target/UniCore/UniCoreTargetMachine.h b/lib/Target/UniCore/UniCoreTargetMachine.h new file mode 100644 index 0000000..ad2aa9c --- /dev/null +++ b/lib/Target/UniCore/UniCoreTargetMachine.h @@ -0,0 +1,33 @@ +//===- UniCoreTargetMachine.h - Define TargetMachine for UniCore -*- 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 UniCore specific subclass of TargetMachine. +// +//===----------------------------------------------------------------------===// + +#ifndef UNICORE_TARGETMACHINE_H +#define UNICORE_TARGETMACHINE_H + +#include "llvm/Target/TargetMachine.h" + +namespace llvm { + class formatted_raw_ostream; + + class UniCoreTargetMachine : public LLVMTargetMachine { + + public: + UniCoreTargetMachine(const Target &T, StringRef TT, + StringRef CPU, StringRef FS, + const TargetOptions &Options, + Reloc::Model RM, CodeModel::Model CM, + CodeGenOpt::Level OL); + }; +} // End llvm namespace + +#endif -- 1.7.12.3