forked from Hoernchen/Epiphany
-
Notifications
You must be signed in to change notification settings - Fork 2
/
EpiphanySubtarget.cpp
74 lines (59 loc) · 2.38 KB
/
EpiphanySubtarget.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//===-- EpiphanySubtarget.cpp - Epiphany Subtarget Information --------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file implements the Epiphany specific subclass of TargetSubtargetInfo.
//
//===----------------------------------------------------------------------===//
#include "EpiphanySubtarget.h"
#include "EpiphanyMachineFunction.h"
#include "Epiphany.h"
#include "EpiphanyRegisterInfo.h"
#include "EpiphanyTargetMachine.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/Function.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/TargetRegistry.h"
using namespace llvm;
#define DEBUG_TYPE "epiphany-subtarget"
#define GET_SUBTARGETINFO_TARGET_DESC
#define GET_SUBTARGETINFO_CTOR
#include "EpiphanyGenSubtargetInfo.inc"
/// Select the Epiphany CPU for the given triple and cpu name.
static StringRef selectEpiphanyCPU(Triple TT, StringRef CPU) {
if (CPU.empty() || CPU == "generic") {
if (TT.getArch() == Triple::epiphany)
CPU = "epiphany";
}
return CPU;
}
void EpiphanySubtarget::anchor() {}
EpiphanySubtarget::EpiphanySubtarget(const Triple &TT, const std::string &CPU,
const std::string &FS, const EpiphanyTargetMachine &_TM)
: EpiphanyGenSubtargetInfo(TT, CPU, FS),
TM(_TM), TargetTriple(TT), TSInfo(),
InstrInfo(new EpiphanyInstrInfo(initializeSubtargetDependencies(CPU, FS, TM))),
FrameLowering(new EpiphanyFrameLowering(*this)),
TLInfo(new EpiphanyTargetLowering(TM, *this)) {}
EpiphanySubtarget &
EpiphanySubtarget::initializeSubtargetDependencies(StringRef CPU, StringRef FS,
const TargetMachine &TM) {
// Get CPU name string
std::string CPUName = selectEpiphanyCPU(TargetTriple, CPU);
// Parse features string
ParseSubtargetFeatures(CPUName, FS);
// Initialize scheduling itinerary for the specified CPU.
InstrItins = getInstrItineraryForCPU(CPUName);
return *this;
}
bool EpiphanySubtarget::abiUsesSoftFloat() const {
// return TM->Options.UseSoftFloat;
return true;
}
const EpiphanyABIInfo &EpiphanySubtarget::getABI() const { return TM.getABI(); }