blob: a29ef8b58e268768e4be5f0bb5499f0ad14891b9 [file] [log] [blame]
Andrea Di Biagio4704f032018-03-20 12:25:54 +00001//===--------------------- Support.h ----------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9/// \file
10///
11/// Helper functions used by various backend components.
12///
13//===----------------------------------------------------------------------===//
14
15#ifndef LLVM_TOOLS_LLVM_MCA_SUPPORT_H
16#define LLVM_TOOLS_LLVM_MCA_SUPPORT_H
17
18#include "llvm/ADT/SmallVector.h"
19#include "llvm/MC/MCSchedule.h"
20
21namespace mca {
22
23/// Populates vector Masks with processor resource masks.
24///
25/// The number of bits set in a mask depends on the processor resource type.
26/// Each processor resource mask has at least one bit set. For groups, the
27/// number of bits set in the mask is equal to the cardinality of the group plus
28/// one. Excluding the most significant bit, the remaining bits in the mask
29/// identify processor resources that are part of the group.
30///
31/// Example:
32///
33/// ResourceA -- Mask: 0b001
34/// ResourceB -- Mask: 0b010
35/// ResourceAB -- Mask: 0b100 U (ResourceA::Mask | ResourceB::Mask) == 0b111
36///
37/// ResourceAB is a processor resource group containing ResourceA and ResourceB.
38/// Each resource mask uniquely identifies a resource; both ResourceA and
39/// ResourceB only have one bit set.
40/// ResourceAB is a group; excluding the most significant bit in the mask, the
41/// remaining bits identify the composition of the group.
42///
43/// Resource masks are used by the ResourceManager to solve set membership
44/// problems with simple bit manipulation operations.
45void computeProcResourceMasks(const llvm::MCSchedModel &SM,
46 llvm::SmallVectorImpl<uint64_t> &Masks);
47} // namespace mca
48
49#endif