LLVM  14.0.0git
ArchitectureSet.cpp
Go to the documentation of this file.
1 //===- ArchitectureSet.cpp ------------------------------------------------===//
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 // Implements the architecture set.
10 //
11 //===----------------------------------------------------------------------===//
12 
15 
16 namespace llvm {
17 namespace MachO {
18 
19 ArchitectureSet::ArchitectureSet(const std::vector<Architecture> &Archs)
20  : ArchitectureSet() {
21  for (auto Arch : Archs) {
22  if (Arch == AK_unknown)
23  continue;
24  set(Arch);
25  }
26 }
27 
28 size_t ArchitectureSet::count() const {
29  // popcnt
30  size_t Cnt = 0;
31  for (unsigned i = 0; i < sizeof(ArchSetType) * 8; ++i)
32  if (ArchSet & (1U << i))
33  ++Cnt;
34  return Cnt;
35 }
36 
37 ArchitectureSet::operator std::string() const {
38  if (empty())
39  return "[(empty)]";
40 
41  std::string result;
42  auto size = count();
43  for (auto arch : *this) {
44  result.append(std::string(getArchitectureName(arch)));
45  size -= 1;
46  if (size)
47  result.append(" ");
48  }
49  return result;
50 }
51 
52 ArchitectureSet::operator std::vector<Architecture>() const {
53  std::vector<Architecture> archs;
54  for (auto arch : *this) {
55  if (arch == AK_unknown)
56  continue;
57  archs.emplace_back(arch);
58  }
59  return archs;
60 }
61 
62 void ArchitectureSet::print(raw_ostream &os) const { os << std::string(*this); }
63 
65  set.print(os);
66  return os;
67 }
68 
69 } // end namespace MachO.
70 } // end namespace llvm.
i
i
Definition: README.txt:29
set
We currently generate a but we really shouldn eax ecx xorl edx divl ecx eax divl ecx movl eax ret A similar code sequence works for division We currently compile i32 v2 eax eax jo LBB1_2 atomic and others It is also currently not done for read modify write instructions It is also current not done if the OF or CF flags are needed The shift operators have the complication that when the shift count is EFLAGS is not set
Definition: README.txt:1277
llvm
---------------------— PointerInfo ------------------------------------—
Definition: AllocatorList.h:23
llvm::MachO::AK_unknown
@ AK_unknown
Definition: Architecture.h:31
result
It looks like we only need to define PPCfmarto for these because according to these instructions perform RTO on fma s result
Definition: README_P9.txt:256
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
llvm::MachO::ArchitectureSet
Definition: ArchitectureSet.h:29
llvm::MachO::ArchitectureSet::print
void print(raw_ostream &OS) const
Definition: ArchitectureSet.cpp:62
llvm::count
auto count(R &&Range, const E &Element)
Wrapper function around std::count to count the number of times an element Element occurs in the give...
Definition: STLExtras.h:1632
llvm::MachO::operator<<
raw_ostream & operator<<(raw_ostream &OS, Architecture Arch)
Definition: Architecture.cpp:92
llvm::MachO::ArchitectureSet::ArchitectureSet
constexpr ArchitectureSet()=default
llvm::MachO::ArchitectureSet::count
size_t count() const
Definition: ArchitectureSet.cpp:28
llvm::size
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
Definition: STLExtras.h:1530
uint32_t
llvm::MachO::ArchitectureSet::set
void set(Architecture Arch)
Definition: ArchitectureSet.h:43
llvm::empty
constexpr bool empty(const T &RangeOrContainer)
Test whether RangeOrContainer is empty. Similar to C++17 std::empty.
Definition: STLExtras.h:254
ArchitectureSet.h
llvm::MachO::getArchitectureName
StringRef getArchitectureName(Architecture Arch)
Convert an architecture slice to a string.
Definition: Architecture.cpp:42
raw_ostream.h