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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 | 227 |
228 InstCall *TargetLowering::makeHelperCall(const IceString &Name, Variable *Dest, | 228 InstCall *TargetLowering::makeHelperCall(const IceString &Name, Variable *Dest, |
229 SizeT MaxSrcs) { | 229 SizeT MaxSrcs) { |
230 const bool HasTailCall = false; | 230 const bool HasTailCall = false; |
231 Constant *CallTarget = Ctx->getConstantExternSym(Name); | 231 Constant *CallTarget = Ctx->getConstantExternSym(Name); |
232 InstCall *Call = | 232 InstCall *Call = |
233 InstCall::create(Func, MaxSrcs, Dest, CallTarget, HasTailCall); | 233 InstCall::create(Func, MaxSrcs, Dest, CallTarget, HasTailCall); |
234 return Call; | 234 return Call; |
235 } | 235 } |
236 | 236 |
| 237 void TargetLowering::emitWithoutPrefix(const ConstantRelocatable *C) const { |
| 238 if (!ALLOW_DUMP) |
| 239 return; |
| 240 Ostream &Str = Ctx->getStrEmit(); |
| 241 if (C->getSuppressMangling()) |
| 242 Str << C->getName(); |
| 243 else |
| 244 Str << Ctx->mangleName(C->getName()); |
| 245 RelocOffsetT Offset = C->getOffset(); |
| 246 if (Offset) { |
| 247 if (Offset > 0) |
| 248 Str << "+"; |
| 249 Str << Offset; |
| 250 } |
| 251 } |
| 252 |
| 253 void TargetLowering::emit(const ConstantRelocatable *C) const { |
| 254 if (!ALLOW_DUMP) |
| 255 return; |
| 256 Ostream &Str = Ctx->getStrEmit(); |
| 257 Str << getConstantPrefix(); |
| 258 emitWithoutPrefix(C); |
| 259 } |
| 260 |
237 std::unique_ptr<TargetDataLowering> | 261 std::unique_ptr<TargetDataLowering> |
238 TargetDataLowering::createLowering(GlobalContext *Ctx) { | 262 TargetDataLowering::createLowering(GlobalContext *Ctx) { |
239 TargetArch Target = Ctx->getFlags().getTargetArch(); | 263 TargetArch Target = Ctx->getFlags().getTargetArch(); |
240 #define SUBZERO_TARGET(X) \ | 264 #define SUBZERO_TARGET(X) \ |
241 if (Target == Target_##X) \ | 265 if (Target == Target_##X) \ |
242 return std::unique_ptr<TargetDataLowering>(TargetData##X::create(Ctx)); | 266 return std::unique_ptr<TargetDataLowering>(TargetData##X::create(Ctx)); |
243 #include "llvm/Config/SZTargets.def" | 267 #include "llvm/Config/SZTargets.def" |
244 | 268 |
245 llvm_unreachable("Unsupported target data lowering"); | 269 llvm_unreachable("Unsupported target data lowering"); |
246 return nullptr; | 270 return nullptr; |
247 } | 271 } |
248 | 272 |
249 TargetDataLowering::~TargetDataLowering() {} | 273 TargetDataLowering::~TargetDataLowering() {} |
250 | 274 |
251 } // end of namespace Ice | 275 } // end of namespace Ice |
OLD | NEW |