Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Side by Side Diff: src/IceTargetLoweringARM32.cpp

Issue 1581803009: Make RegARM32 a namespace rather than a class. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nits. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/IceTargetLoweringARM32.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceTargetLoweringARM32.cpp - ARM32 lowering ------------===// 1 //===- subzero/src/IceTargetLoweringARM32.cpp - ARM32 lowering ------------===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 /// 9 ///
10 /// \file 10 /// \file
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 } 46 }
47 47
48 std::unique_ptr<::Ice::TargetHeaderLowering> 48 std::unique_ptr<::Ice::TargetHeaderLowering>
49 createTargetHeaderLowering(::Ice::GlobalContext *Ctx) { 49 createTargetHeaderLowering(::Ice::GlobalContext *Ctx) {
50 return ::Ice::ARM32::TargetHeaderARM32::create(Ctx); 50 return ::Ice::ARM32::TargetHeaderARM32::create(Ctx);
51 } 51 }
52 52
53 void staticInit(const ::Ice::ClFlags &Flags) { 53 void staticInit(const ::Ice::ClFlags &Flags) {
54 ::Ice::ARM32::TargetARM32::staticInit(Flags); 54 ::Ice::ARM32::TargetARM32::staticInit(Flags);
55 } 55 }
56
56 } // end of namespace ARM32 57 } // end of namespace ARM32
57 58
58 namespace Ice { 59 namespace Ice {
59 namespace ARM32 { 60 namespace ARM32 {
60 61
62 namespace {
63
64 /// SizeOf is used to obtain the size of an initializer list as a constexpr
65 /// expression. This is only needed until our C++ library is updated to
66 /// C++ 14 -- which defines constexpr members to std::initializer_list.
67 class SizeOf {
68 SizeOf(const SizeOf &) = delete;
69 SizeOf &operator=(const SizeOf &) = delete;
70
71 public:
72 constexpr SizeOf() : Size(0) {}
73 template <typename... T>
74 explicit constexpr SizeOf(T...)
75 : Size(__length<T...>::value) {}
76 constexpr SizeT size() const { return Size; }
77
78 private:
79 template <typename T, typename... U> struct __length {
80 static constexpr std::size_t value = 1 + __length<U...>::value;
81 };
82
83 template <typename T> struct __length<T> {
84 static constexpr std::size_t value = 1;
85 };
86
87 const std::size_t Size;
88 };
89
90 } // end of anonymous namespace
91
61 // Defines the RegARM32::Table table with register information. 92 // Defines the RegARM32::Table table with register information.
62 constexpr RegARM32::TableType RegARM32::Table[]; 93 RegARM32::RegTableType RegARM32::RegTable[RegARM32::Reg_NUM] = {
94 #define X(val, encode, name, cc_arg, scratch, preserved, stackptr, frameptr, \
95 isGPR, isInt, isI64Pair, isFP32, isFP64, isVec128, alias_init) \
96 { \
97 name, encode, cc_arg, scratch, preserved, stackptr, frameptr, isGPR, \
98 isInt, isI64Pair, isFP32, isFP64, isVec128, \
99 (SizeOf alias_init).size(), alias_init \
100 } \
101 ,
102 REGARM32_TABLE
103 #undef X
104 };
63 105
64 namespace { 106 namespace {
65 107
66 // The following table summarizes the logic for lowering the icmp instruction 108 // The following table summarizes the logic for lowering the icmp instruction
67 // for i32 and narrower types. Each icmp condition has a clear mapping to an 109 // for i32 and narrower types. Each icmp condition has a clear mapping to an
68 // ARM32 conditional move instruction. 110 // ARM32 conditional move instruction.
69 111
70 const struct TableIcmp32_ { 112 const struct TableIcmp32_ {
71 CondARM32::Cond Mapping; 113 CondARM32::Cond Mapping;
72 } TableIcmp32[] = { 114 } TableIcmp32[] = {
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 (void)Flags; 281 (void)Flags;
240 // Limit this size (or do all bitsets need to be the same width)??? 282 // Limit this size (or do all bitsets need to be the same width)???
241 llvm::SmallBitVector IntegerRegisters(RegARM32::Reg_NUM); 283 llvm::SmallBitVector IntegerRegisters(RegARM32::Reg_NUM);
242 llvm::SmallBitVector I64PairRegisters(RegARM32::Reg_NUM); 284 llvm::SmallBitVector I64PairRegisters(RegARM32::Reg_NUM);
243 llvm::SmallBitVector Float32Registers(RegARM32::Reg_NUM); 285 llvm::SmallBitVector Float32Registers(RegARM32::Reg_NUM);
244 llvm::SmallBitVector Float64Registers(RegARM32::Reg_NUM); 286 llvm::SmallBitVector Float64Registers(RegARM32::Reg_NUM);
245 llvm::SmallBitVector VectorRegisters(RegARM32::Reg_NUM); 287 llvm::SmallBitVector VectorRegisters(RegARM32::Reg_NUM);
246 llvm::SmallBitVector InvalidRegisters(RegARM32::Reg_NUM); 288 llvm::SmallBitVector InvalidRegisters(RegARM32::Reg_NUM);
247 ScratchRegs.resize(RegARM32::Reg_NUM); 289 ScratchRegs.resize(RegARM32::Reg_NUM);
248 for (int i = 0; i < RegARM32::Reg_NUM; ++i) { 290 for (int i = 0; i < RegARM32::Reg_NUM; ++i) {
249 const auto &Entry = RegARM32::Table[i]; 291 const auto &Entry = RegARM32::RegTable[i];
250 IntegerRegisters[i] = Entry.IsInt; 292 IntegerRegisters[i] = Entry.IsInt;
251 I64PairRegisters[i] = Entry.IsI64Pair; 293 I64PairRegisters[i] = Entry.IsI64Pair;
252 Float32Registers[i] = Entry.IsFP32; 294 Float32Registers[i] = Entry.IsFP32;
253 Float64Registers[i] = Entry.IsFP64; 295 Float64Registers[i] = Entry.IsFP64;
254 VectorRegisters[i] = Entry.IsVec128; 296 VectorRegisters[i] = Entry.IsVec128;
255 ScratchRegs[i] = Entry.Scratch; 297 ScratchRegs[i] = Entry.Scratch;
256 RegisterAliases[i].resize(RegARM32::Reg_NUM); 298 RegisterAliases[i].resize(RegARM32::Reg_NUM);
257 for (int j = 0; j < Entry.NumAliases; ++j) { 299 for (int j = 0; j < Entry.NumAliases; ++j) {
258 assert(i == j || !RegisterAliases[i][Entry.Aliases[j]]); 300 assert(i == j || !RegisterAliases[i][Entry.Aliases[j]]);
259 RegisterAliases[i].set(Entry.Aliases[j]); 301 RegisterAliases[i].set(Entry.Aliases[j]);
(...skipping 1566 matching lines...) Expand 10 before | Expand all | Expand 10 after
1826 } 1868 }
1827 llvm::report_fatal_error("Unsupported operand type"); 1869 llvm::report_fatal_error("Unsupported operand type");
1828 return nullptr; 1870 return nullptr;
1829 } 1871 }
1830 1872
1831 llvm::SmallBitVector TargetARM32::getRegisterSet(RegSetMask Include, 1873 llvm::SmallBitVector TargetARM32::getRegisterSet(RegSetMask Include,
1832 RegSetMask Exclude) const { 1874 RegSetMask Exclude) const {
1833 llvm::SmallBitVector Registers(RegARM32::Reg_NUM); 1875 llvm::SmallBitVector Registers(RegARM32::Reg_NUM);
1834 1876
1835 for (int i = 0; i < RegARM32::Reg_NUM; ++i) { 1877 for (int i = 0; i < RegARM32::Reg_NUM; ++i) {
1836 const auto &Entry = RegARM32::Table[i]; 1878 const auto &Entry = RegARM32::RegTable[i];
1837 if (Entry.Scratch && (Include & RegSet_CallerSave)) 1879 if (Entry.Scratch && (Include & RegSet_CallerSave))
1838 Registers[i] = true; 1880 Registers[i] = true;
1839 if (Entry.Preserved && (Include & RegSet_CalleeSave)) 1881 if (Entry.Preserved && (Include & RegSet_CalleeSave))
1840 Registers[i] = true; 1882 Registers[i] = true;
1841 if (Entry.StackPtr && (Include & RegSet_StackPointer)) 1883 if (Entry.StackPtr && (Include & RegSet_StackPointer))
1842 Registers[i] = true; 1884 Registers[i] = true;
1843 if (Entry.FramePtr && (Include & RegSet_FramePointer)) 1885 if (Entry.FramePtr && (Include & RegSet_FramePointer))
1844 Registers[i] = true; 1886 Registers[i] = true;
1845 if (Entry.Scratch && (Exclude & RegSet_CallerSave)) 1887 if (Entry.Scratch && (Exclude & RegSet_CallerSave))
1846 Registers[i] = false; 1888 Registers[i] = false;
(...skipping 4602 matching lines...) Expand 10 before | Expand all | Expand 10 after
6449 // However, for compatibility with current NaCl LLVM, don't claim that. 6491 // However, for compatibility with current NaCl LLVM, don't claim that.
6450 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n"; 6492 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n";
6451 } 6493 }
6452 6494
6453 llvm::SmallBitVector TargetARM32::TypeToRegisterSet[IceType_NUM]; 6495 llvm::SmallBitVector TargetARM32::TypeToRegisterSet[IceType_NUM];
6454 llvm::SmallBitVector TargetARM32::RegisterAliases[RegARM32::Reg_NUM]; 6496 llvm::SmallBitVector TargetARM32::RegisterAliases[RegARM32::Reg_NUM];
6455 llvm::SmallBitVector TargetARM32::ScratchRegs; 6497 llvm::SmallBitVector TargetARM32::ScratchRegs;
6456 6498
6457 } // end of namespace ARM32 6499 } // end of namespace ARM32
6458 } // end of namespace Ice 6500 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceTargetLoweringARM32.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698