OLD | NEW |
1 //===- subzero/src/IceTargetLowering.cpp - Basic lowering implementation --===// | 1 //===- subzero/src/IceTargetLowering.cpp - Basic lowering implementation --===// |
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 // This file implements the skeleton of the TargetLowering class, | 10 // This file implements the skeleton of the TargetLowering class, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 return nullptr; | 73 return nullptr; |
74 } | 74 } |
75 | 75 |
76 TargetLowering::TargetLowering(Cfg *Func) | 76 TargetLowering::TargetLowering(Cfg *Func) |
77 : Func(Func), Ctx(Func->getContext()), HasComputedFrame(false), | 77 : Func(Func), Ctx(Func->getContext()), HasComputedFrame(false), |
78 CallsReturnsTwice(false), StackAdjustment(0), NextLabelNumber(0), | 78 CallsReturnsTwice(false), StackAdjustment(0), NextLabelNumber(0), |
79 Context(), SnapshotStackAdjustment(0) {} | 79 Context(), SnapshotStackAdjustment(0) {} |
80 | 80 |
81 std::unique_ptr<Assembler> TargetLowering::createAssembler(TargetArch Target, | 81 std::unique_ptr<Assembler> TargetLowering::createAssembler(TargetArch Target, |
82 Cfg *Func) { | 82 Cfg *Func) { |
83 // These statements can be #ifdef'd to specialize the assembler | 83 #define SUBZERO_TARGET(X) \ |
84 // to a subset of the available targets. TODO: use CRTP. | 84 if (Target == Target_##X) \ |
85 // TODO(jvoung): use SZTargets.def (rename AssemblerX86 -> AssemblerX8632), | 85 return std::unique_ptr<Assembler>(new X::Assembler##X()); |
86 // and make the namespaces consistent. | 86 #include "llvm/Config/SZTargets.def" |
87 if (Target == Target_X8632) | |
88 return std::unique_ptr<Assembler>(new x86::AssemblerX86()); | |
89 | |
90 if (Target == Target_ARM32) | |
91 return std::unique_ptr<Assembler>(new AssemblerARM32()); | |
92 | 87 |
93 Func->setError("Unsupported target assembler"); | 88 Func->setError("Unsupported target assembler"); |
94 return nullptr; | 89 return nullptr; |
95 } | 90 } |
96 | 91 |
97 void TargetLowering::doAddressOpt() { | 92 void TargetLowering::doAddressOpt() { |
98 if (llvm::isa<InstLoad>(*Context.getCur())) | 93 if (llvm::isa<InstLoad>(*Context.getCur())) |
99 doAddressOptLoad(); | 94 doAddressOptLoad(); |
100 else if (llvm::isa<InstStore>(*Context.getCur())) | 95 else if (llvm::isa<InstStore>(*Context.getCur())) |
101 doAddressOptStore(); | 96 doAddressOptStore(); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 return std::unique_ptr<TargetDataLowering>(TargetData##X::create(Ctx)); | 242 return std::unique_ptr<TargetDataLowering>(TargetData##X::create(Ctx)); |
248 #include "llvm/Config/SZTargets.def" | 243 #include "llvm/Config/SZTargets.def" |
249 | 244 |
250 llvm_unreachable("Unsupported target data lowering"); | 245 llvm_unreachable("Unsupported target data lowering"); |
251 return nullptr; | 246 return nullptr; |
252 } | 247 } |
253 | 248 |
254 TargetDataLowering::~TargetDataLowering() {} | 249 TargetDataLowering::~TargetDataLowering() {} |
255 | 250 |
256 } // end of namespace Ice | 251 } // end of namespace Ice |
OLD | NEW |