LLVM  5.0.0
Nios2TargetMachine.cpp
Go to the documentation of this file.
1 //===-- Nios2TargetMachine.cpp - Define TargetMachine for Nios2 -----------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // Implements the info about Nios2 target spec.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #include "Nios2TargetMachine.h"
15 #include "Nios2.h"
16 
17 using namespace llvm;
18 
19 #define DEBUG_TYPE "nios2"
20 
21 extern "C" void LLVMInitializeNios2Target() {
22  // Register the target.
23 }
24 
25 static std::string computeDataLayout(const Triple &TT, StringRef CPU,
26  const TargetOptions &Options) {
27  return "e-p:32:32:32-i8:8:32-i16:16:32-n32";
28 }
29 
32  if (!RM.hasValue() || CM == CodeModel::JITDefault)
33  return Reloc::Static;
34  return *RM;
35 }
36 
38  StringRef CPU, StringRef FS,
39  const TargetOptions &Options,
43  : LLVMTargetMachine(T, computeDataLayout(TT, CPU, Options), TT, CPU, FS,
44  Options, getEffectiveRelocModel(CM, RM), CM, OL) {}
45 
bool hasValue() const
Definition: Optional.h:133
Nios2TargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Optional< Reloc::Model > RM, CodeModel::Model CM, CodeGenOpt::Level OL)
void LLVMInitializeNios2Target()
static std::string computeDataLayout(const Triple &TT, StringRef CPU, const TargetOptions &Options)
static Reloc::Model getEffectiveRelocModel(Optional< Reloc::Model > RM)
This class describes a target machine that is implemented with the LLVM target-independent code gener...
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
Target - Wrapper for Target specific information.
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:49