LLVM: lib/Target/LoongArch/LoongArchSubtarget.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

17

18using namespace llvm;

19

20#define DEBUG_TYPE "loongarch-subtarget"

21

22#define GET_SUBTARGETINFO_TARGET_DESC

23#define GET_SUBTARGETINFO_CTOR

24#include "LoongArchGenSubtargetInfo.inc"

25

27 cl::desc("Enable the use of AA during codegen."));

28

29void LoongArchSubtarget::anchor() {}

30

31

32

34

35LoongArchSubtarget &LoongArchSubtarget::initializeSubtargetDependencies(

38 bool Is64Bit = TT.isArch64Bit();

39 if (CPU.empty() || CPU == "generic")

40 CPU = Is64Bit ? "generic-la64" : "generic-la32";

41

42 if (TuneCPU.empty())

43 TuneCPU = CPU;

44

46 initializeProperties(TuneCPU);

47 if (Is64Bit) {

48 GRLenVT = MVT::i64;

49 GRLen = 64;

50 }

51

52 if (HasLA32 == HasLA64)

54

55 if (Is64Bit && HasLA32)

56 report_fatal_error("Feature 32bit should be used for loongarch32 target.");

57

58 if (!Is64Bit && HasLA64)

59 report_fatal_error("Feature 64bit should be used for loongarch64 target.");

60

62

63 return *this;

64}

65

66void LoongArchSubtarget::initializeProperties(StringRef TuneCPU) {

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87 PrefFunctionAlignment = Align(32);

88 PrefLoopAlignment = Align(16);

89 MaxBytesForAlignment = 16;

90}

91

97 FrameLowering(

98 initializeSubtargetDependencies(TT, CPU, TuneCPU, FS, ABIName)),

99 InstrInfo(*this), TLInfo(TM, *this) {

100 TSInfo = std::make_unique();

101}

102

104

106 return TSInfo.get();

107}

static cl::opt< bool > UseAA("aarch64-use-aa", cl::init(true), cl::desc("Enable the use of AA during codegen."))

static cl::opt< bool > UseAA("loongarch-use-aa", cl::init(true), cl::desc("Enable the use of AA during codegen."))

const SelectionDAGTargetInfo * getSelectionDAGInfo() const override

Definition LoongArchSubtarget.cpp:105

bool useAA() const override

Definition LoongArchSubtarget.cpp:33

LoongArchSubtarget(const Triple &TT, StringRef CPU, StringRef TuneCPU, StringRef FS, StringRef ABIName, const TargetMachine &TM)

Definition LoongArchSubtarget.cpp:92

void ParseSubtargetFeatures(StringRef CPU, StringRef TuneCPU, StringRef FS)

~LoongArchSubtarget() override

Targets can subclass this to parameterize the SelectionDAG lowering and instruction selection process...

StringRef - Represent a constant reference to a string, i.e.

constexpr bool empty() const

empty - Check if the string is empty.

Primary interface to the complete machine description for the target machine.

Triple - Helper class for working with autoconf configuration names.

constexpr char Align[]

Key for Kernel::Arg::Metadata::mAlign.

ABI computeTargetABI(const Triple &TT, const FeatureBitset &FeatureBits, StringRef ABIName)

initializer< Ty > init(const Ty &Val)

This is an optimization pass for GlobalISel generic memory operations.

LLVM_ABI void report_fatal_error(Error Err, bool gen_crash_diag=true)