LLVM  16.0.0git
LoongArchSubtarget.cpp
Go to the documentation of this file.
1 //===-- LoongArchSubtarget.cpp - LoongArch Subtarget Information -*- C++ -*--=//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements the LoongArch specific subclass of TargetSubtargetInfo.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "LoongArchSubtarget.h"
14 #include "LoongArchFrameLowering.h"
15 
16 using namespace llvm;
17 
18 #define DEBUG_TYPE "loongarch-subtarget"
19 
20 #define GET_SUBTARGETINFO_TARGET_DESC
21 #define GET_SUBTARGETINFO_CTOR
22 #include "LoongArchGenSubtargetInfo.inc"
23 
24 void LoongArchSubtarget::anchor() {}
25 
26 LoongArchSubtarget &LoongArchSubtarget::initializeSubtargetDependencies(
27  const Triple &TT, StringRef CPU, StringRef TuneCPU, StringRef FS,
28  StringRef ABIName) {
29  bool Is64Bit = TT.isArch64Bit();
30  if (CPU.empty() || CPU == "generic")
31  CPU = Is64Bit ? "generic-la64" : "generic-la32";
32 
33  if (TuneCPU.empty())
34  TuneCPU = CPU;
35 
36  ParseSubtargetFeatures(CPU, TuneCPU, FS);
37  if (Is64Bit) {
38  GRLenVT = MVT::i64;
39  GRLen = 64;
40  }
41 
42  // TODO: ILP32{S,F} LP64{S,F}
43  TargetABI = Is64Bit ? LoongArchABI::ABI_LP64D : LoongArchABI::ABI_ILP32D;
44  return *this;
45 }
46 
48  StringRef TuneCPU, StringRef FS,
49  StringRef ABIName,
50  const TargetMachine &TM)
51  : LoongArchGenSubtargetInfo(TT, CPU, TuneCPU, FS),
52  FrameLowering(
53  initializeSubtargetDependencies(TT, CPU, TuneCPU, FS, ABIName)),
54  InstrInfo(*this), RegInfo(getHwMode()), TLInfo(TM, *this) {}
llvm::LoongArchSubtarget::ParseSubtargetFeatures
void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS)
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::ARM::PredBlockMask::TT
@ TT
llvm::LoongArchABI::ABI_ILP32D
@ ABI_ILP32D
Definition: LoongArchBaseInfo.h:44
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
llvm::X86AS::FS
@ FS
Definition: X86.h:200
LoongArchFrameLowering.h
LoongArchSubtarget.h
llvm::LoongArchSubtarget::LoongArchSubtarget
LoongArchSubtarget(const Triple &TT, StringRef CPU, StringRef TuneCPU, StringRef FS, StringRef ABIName, const TargetMachine &TM)
Definition: LoongArchSubtarget.cpp:47
InstrInfo
return InstrInfo
Definition: RISCVInsertVSETVLI.cpp:850
LoongArchGenSubtargetInfo
llvm::StringRef::empty
constexpr bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:134
llvm::LoongArchSubtarget
Definition: LoongArchSubtarget.h:32
llvm::TargetMachine
Primary interface to the complete machine description for the target machine.
Definition: TargetMachine.h:77
llvm::MVT::i64
@ i64
Definition: MachineValueType.h:49
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
this
Analysis the ScalarEvolution expression for r is this
Definition: README.txt:8
llvm::LoongArchABI::ABI_LP64D
@ ABI_LP64D
Definition: LoongArchBaseInfo.h:47
TM
const char LLVMTargetMachineRef TM
Definition: PassBuilderBindings.cpp:47