LLVM: lib/MCA/Support.cpp Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

17#include

18

19namespace llvm {

20namespace mca {

21

22#define DEBUG_TYPE "llvm-mca"

23

25 if (Denominator == RHS.Denominator)

26 Numerator += RHS.Numerator;

27 else {

28

29

30 unsigned GCD = std::gcd(Denominator, RHS.Denominator);

31 unsigned LCM = (Denominator * RHS.Denominator) / GCD;

32 unsigned LHSNumerator = Numerator * (LCM / Denominator);

33 unsigned RHSNumerator = RHS.Numerator * (LCM / RHS.Denominator);

34 Numerator = LHSNumerator + RHSNumerator;

35 Denominator = LCM;

36 }

37 return *this;

38}

39

42 unsigned ProcResourceID = 0;

43

45 "Invalid number of elements");

46

47 Masks[0] = 0;

48

49

52 if (Desc.SubUnitsIdxBegin)

53 continue;

54 Masks[I] = 1ULL << ProcResourceID;

55 ProcResourceID++;

56 }

57

58

61 if (Desc.SubUnitsIdxBegin)

62 continue;

63 Masks[I] = 1ULL << ProcResourceID;

64 for (unsigned U = 0; U < Desc.NumUnits; ++U) {

65 uint64_t OtherMask = Masks[Desc.SubUnitsIdxBegin[U]];

66 Masks[I] |= OtherMask;

67 }

68 ProcResourceID++;

69 }

70

71#ifndef NDEBUG

73 << "\n");

78 << Desc.Name << '\n');

79 }

80#endif

81}

82

84 unsigned NumMicroOps,

86

87

88

89 double Max = static_cast<double>(NumMicroOps) / DispatchWidth;

90

91

92

93

97 continue;

98

101 Max = std::max(Max, Throughput);

102 }

103

104

105

106

107 return Max;

108}

109

110}

111}

assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")

static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

size_t size() const

size - Get the array size.

MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...

This class represents the number of cycles per resource (fractions of cycles).

LLVM_ABI ReleaseAtCycles & operator+=(const ReleaseAtCycles &RHS)

Definition Support.cpp:24

Helper functions used by various pipeline components.

LLVM_ABI double computeBlockRThroughput(const MCSchedModel &SM, unsigned DispatchWidth, unsigned NumMicroOps, ArrayRef< unsigned > ProcResourceUsage)

Compute the reciprocal block throughput from a set of processor resource cycles.

Definition Support.cpp:83

LLVM_ABI void computeProcResourceMasks(const MCSchedModel &SM, MutableArrayRef< uint64_t > Masks)

Populates vector Masks with processor resource masks.

Definition Support.cpp:40

This is an optimization pass for GlobalISel generic memory operations.

FormattedNumber format_decimal(int64_t N, unsigned Width)

format_decimal - Output N as a right justified, fixed-width decimal.

LLVM_ABI raw_ostream & dbgs()

dbgs() - This returns a reference to a raw_ostream for debugging messages.

FormattedNumber format_hex(uint64_t N, unsigned Width, bool Upper=false)

format_hex - Output N as a fixed width hexadecimal.

Define a kind of processor resource that will be modeled by the scheduler.

Machine model for scheduling, bundling, and heuristics.

unsigned getNumProcResourceKinds() const

const MCProcResourceDesc * getProcResource(unsigned ProcResourceIdx) const