diff options
author | Nikolai Bozhenov <nikolai.bozhenov@intel.com> | 2017-05-29 09:48:30 +0000 |
---|---|---|
committer | Nikolai Bozhenov <nikolai.bozhenov@intel.com> | 2017-05-29 09:48:30 +0000 |
commit | 82f0801c1b2baaee5479e0f8fd0840392958ef9b (patch) | |
tree | 7b0a35b4d3bd1277ccf5ca0e95dab20365b83dbb /llvm/lib/Target/Nios2/Nios2TargetMachine.cpp | |
parent | 0c05cce4e0adf46f4455409b81223808b590e6d8 (diff) | |
download | bcm5719-llvm-82f0801c1b2baaee5479e0f8fd0840392958ef9b.tar.gz bcm5719-llvm-82f0801c1b2baaee5479e0f8fd0840392958ef9b.zip |
[Nios2] Target registration
Reviewers: craig.topper, hfinkel, joerg, lattner, zvi
Reviewed By: craig.topper
Subscribers: oren_ben_simhon, igorb, belickim, tvvikram, mgorny, llvm-commits, pavel.v.chupin, DavidKreitzer
Differential Revision: https://reviews.llvm.org/D32669
Patch by AndreiGrischenko <andrei.l.grischenko@intel.com>
llvm-svn: 304144
Diffstat (limited to 'llvm/lib/Target/Nios2/Nios2TargetMachine.cpp')
-rw-r--r-- | llvm/lib/Target/Nios2/Nios2TargetMachine.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/llvm/lib/Target/Nios2/Nios2TargetMachine.cpp b/llvm/lib/Target/Nios2/Nios2TargetMachine.cpp new file mode 100644 index 00000000000..16d4eabcfaf --- /dev/null +++ b/llvm/lib/Target/Nios2/Nios2TargetMachine.cpp @@ -0,0 +1,46 @@ +//===-- Nios2TargetMachine.cpp - Define TargetMachine for Nios2 -----------===// +// +// 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 Nios2 target spec. +// +//===----------------------------------------------------------------------===// + +#include "Nios2TargetMachine.h" +#include "Nios2.h" + +using namespace llvm; + +#define DEBUG_TYPE "nios2" + +extern "C" void LLVMInitializeNios2Target() { + // Register the target. +} + +static std::string computeDataLayout(const Triple &TT, StringRef CPU, + const TargetOptions &Options) { + return "e-p:32:32:32-i8:8:32-i16:16:32-n32"; +} + +static Reloc::Model getEffectiveRelocModel(CodeModel::Model CM, + Optional<Reloc::Model> RM) { + if (!RM.hasValue() || CM == CodeModel::JITDefault) + return Reloc::Static; + return *RM; +} + +Nios2TargetMachine::Nios2TargetMachine(const Target &T, const Triple &TT, + StringRef CPU, StringRef FS, + const TargetOptions &Options, + Optional<Reloc::Model> RM, + CodeModel::Model CM, + CodeGenOpt::Level OL) + : LLVMTargetMachine(T, computeDataLayout(TT, CPU, Options), TT, CPU, FS, + Options, getEffectiveRelocModel(CM, RM), CM, OL) {} + +Nios2TargetMachine::~Nios2TargetMachine() {} |