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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 Func->setError("Unsupported target"); | 100 Func->setError("Unsupported target"); |
101 return nullptr; | 101 return nullptr; |
102 } | 102 } |
103 | 103 |
104 TargetLowering::TargetLowering(Cfg *Func) | 104 TargetLowering::TargetLowering(Cfg *Func) |
105 : Func(Func), Ctx(Func->getContext()), | 105 : Func(Func), Ctx(Func->getContext()), |
106 RandomizeRegisterAllocation(CLRandomizeRegisterAllocation), | 106 RandomizeRegisterAllocation(CLRandomizeRegisterAllocation), |
107 HasComputedFrame(false), CallsReturnsTwice(false), StackAdjustment(0), | 107 HasComputedFrame(false), CallsReturnsTwice(false), StackAdjustment(0), |
108 Context() {} | 108 Context() {} |
109 | 109 |
110 Assembler *TargetLowering::createAssembler(TargetArch Target, Cfg *Func) { | 110 std::unique_ptr<Assembler> TargetLowering::createAssembler(TargetArch Target, |
| 111 Cfg *Func) { |
111 // These statements can be #ifdef'd to specialize the assembler | 112 // These statements can be #ifdef'd to specialize the assembler |
112 // to a subset of the available targets. TODO: use CRTP. | 113 // to a subset of the available targets. TODO: use CRTP. |
113 if (Target == Target_X8632) | 114 if (Target == Target_X8632) |
114 return new x86::AssemblerX86(); | 115 return std::unique_ptr<Assembler>(new x86::AssemblerX86()); |
115 Func->setError("Unsupported target"); | 116 Func->setError("Unsupported target"); |
116 return nullptr; | 117 return nullptr; |
117 } | 118 } |
118 | 119 |
119 void TargetLowering::doAddressOpt() { | 120 void TargetLowering::doAddressOpt() { |
120 if (llvm::isa<InstLoad>(*Context.getCur())) | 121 if (llvm::isa<InstLoad>(*Context.getCur())) |
121 doAddressOptLoad(); | 122 doAddressOptLoad(); |
122 else if (llvm::isa<InstStore>(*Context.getCur())) | 123 else if (llvm::isa<InstStore>(*Context.getCur())) |
123 doAddressOptStore(); | 124 doAddressOptStore(); |
124 Context.advanceCur(); | 125 Context.advanceCur(); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 if (Target == Target_ARM64) | 267 if (Target == Target_ARM64) |
267 return IceTargetGlobalInitARM64::create(Ctx); | 268 return IceTargetGlobalInitARM64::create(Ctx); |
268 #endif | 269 #endif |
269 llvm_unreachable("Unsupported target"); | 270 llvm_unreachable("Unsupported target"); |
270 return nullptr; | 271 return nullptr; |
271 } | 272 } |
272 | 273 |
273 TargetGlobalInitLowering::~TargetGlobalInitLowering() {} | 274 TargetGlobalInitLowering::~TargetGlobalInitLowering() {} |
274 | 275 |
275 } // end of namespace Ice | 276 } // end of namespace Ice |
OLD | NEW |