LLVM 17.0.0git
XtensaTargetMachine.cpp
Go to the documentation of this file.
1//===- XtensaTargetMachine.cpp - Define TargetMachine for Xtensa ----------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
6// See https://llvm.org/LICENSE.txt for license information.
7// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8//
9//===----------------------------------------------------------------------===//
10//
11// Implements the info about Xtensa target spec.
12//
13//===----------------------------------------------------------------------===//
14
15#include "XtensaTargetMachine.h"
17#include "llvm/CodeGen/Passes.h"
22#include <optional>
23
24using namespace llvm;
25
27 // Register the target.
29}
30
31static std::string computeDataLayout(const Triple &TT, StringRef CPU,
33 bool IsLittle) {
34 std::string Ret = "e-m:e-p:32:32-i8:8:32-i16:16:32-i64:64-n32";
35 return Ret;
36}
37
39 std::optional<Reloc::Model> RM) {
40 if (!RM || JIT)
41 return Reloc::Static;
42 return *RM;
43}
44
46 StringRef CPU, StringRef FS,
48 std::optional<Reloc::Model> RM,
49 std::optional<CodeModel::Model> CM,
50 CodeGenOpt::Level OL, bool JIT,
51 bool IsLittle)
52 : LLVMTargetMachine(T, computeDataLayout(TT, CPU, Options, IsLittle), TT,
53 CPU, FS, Options, getEffectiveRelocModel(JIT, RM),
54 getEffectiveCodeModel(CM, CodeModel::Small), OL),
55 TLOF(std::make_unique<TargetLoweringObjectFileELF>()) {
57}
58
60 StringRef CPU, StringRef FS,
62 std::optional<Reloc::Model> RM,
63 std::optional<CodeModel::Model> CM,
64 CodeGenOpt::Level OL, bool JIT)
65 : XtensaTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL, JIT, true) {}
66
68 return new TargetPassConfig(*this, PM);
69}
basic Basic Alias true
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
#define LLVM_EXTERNAL_VISIBILITY
Definition: Compiler.h:127
static LVOptions Options
Definition: LVOptions.cpp:25
static std::string computeDataLayout()
Target-Independent Code Generator Pass Configuration Options pass.
static Reloc::Model getEffectiveRelocModel(bool JIT, std::optional< Reloc::Model > RM)
LLVM_EXTERNAL_VISIBILITY void LLVMInitializeXtensaTarget()
This class describes a target machine that is implemented with the LLVM target-independent code gener...
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
Target-Independent Code Generator Pass Configuration Options.
Target - Wrapper for Target specific information.
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
XtensaTargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, std::optional< Reloc::Model > RM, std::optional< CodeModel::Model > CM, CodeGenOpt::Level OL, bool JIT, bool isLittle)
TargetPassConfig * createPassConfig(PassManagerBase &PM) override
Create a pass configuration object to be used by addPassToEmitX methods for generating a pipeline of ...
PassManagerBase - An abstract interface to allow code to add passes to a pass manager without having ...
Level
Code generation optimization level.
Definition: CodeGen.h:57
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
CodeModel::Model getEffectiveCodeModel(std::optional< CodeModel::Model > CM, CodeModel::Model Default)
Helper method for getting the code model, returning Default if CM does not have a value.
Target & getTheXtensaTarget()
Definition: BitVector.h:858
RegisterTargetMachine - Helper template for registering a target machine implementation,...