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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 InstCall *TargetLowering::makeHelperCall(const IceString &Name, Variable *Dest, | 404 InstCall *TargetLowering::makeHelperCall(const IceString &Name, Variable *Dest, |
405 SizeT MaxSrcs) { | 405 SizeT MaxSrcs) { |
406 const bool HasTailCall = false; | 406 const bool HasTailCall = false; |
407 Constant *CallTarget = Ctx->getConstantExternSym(Name); | 407 Constant *CallTarget = Ctx->getConstantExternSym(Name); |
408 InstCall *Call = | 408 InstCall *Call = |
409 InstCall::create(Func, MaxSrcs, Dest, CallTarget, HasTailCall); | 409 InstCall::create(Func, MaxSrcs, Dest, CallTarget, HasTailCall); |
410 return Call; | 410 return Call; |
411 } | 411 } |
412 | 412 |
413 void TargetLowering::emitWithoutPrefix(const ConstantRelocatable *C) const { | 413 void TargetLowering::emitWithoutPrefix(const ConstantRelocatable *C) const { |
414 if (!ALLOW_DUMP) | 414 if (!buildAllowsDump()) |
415 return; | 415 return; |
416 Ostream &Str = Ctx->getStrEmit(); | 416 Ostream &Str = Ctx->getStrEmit(); |
417 if (C->getSuppressMangling()) | 417 if (C->getSuppressMangling()) |
418 Str << C->getName(); | 418 Str << C->getName(); |
419 else | 419 else |
420 Str << Ctx->mangleName(C->getName()); | 420 Str << Ctx->mangleName(C->getName()); |
421 RelocOffsetT Offset = C->getOffset(); | 421 RelocOffsetT Offset = C->getOffset(); |
422 if (Offset) { | 422 if (Offset) { |
423 if (Offset > 0) | 423 if (Offset > 0) |
424 Str << "+"; | 424 Str << "+"; |
425 Str << Offset; | 425 Str << Offset; |
426 } | 426 } |
427 } | 427 } |
428 | 428 |
429 void TargetLowering::emit(const ConstantRelocatable *C) const { | 429 void TargetLowering::emit(const ConstantRelocatable *C) const { |
430 if (!ALLOW_DUMP) | 430 if (!buildAllowsDump()) |
431 return; | 431 return; |
432 Ostream &Str = Ctx->getStrEmit(); | 432 Ostream &Str = Ctx->getStrEmit(); |
433 Str << getConstantPrefix(); | 433 Str << getConstantPrefix(); |
434 emitWithoutPrefix(C); | 434 emitWithoutPrefix(C); |
435 } | 435 } |
436 | 436 |
437 std::unique_ptr<TargetDataLowering> | 437 std::unique_ptr<TargetDataLowering> |
438 TargetDataLowering::createLowering(GlobalContext *Ctx) { | 438 TargetDataLowering::createLowering(GlobalContext *Ctx) { |
439 TargetArch Target = Ctx->getFlags().getTargetArch(); | 439 TargetArch Target = Ctx->getFlags().getTargetArch(); |
440 #define SUBZERO_TARGET(X) \ | 440 #define SUBZERO_TARGET(X) \ |
(...skipping 24 matching lines...) Expand all Loading... |
465 } | 465 } |
466 | 466 |
467 assert(!SectionSuffix.empty()); | 467 assert(!SectionSuffix.empty()); |
468 return "." + SectionSuffix; | 468 return "." + SectionSuffix; |
469 } | 469 } |
470 | 470 |
471 } // end of anonymous namespace | 471 } // end of anonymous namespace |
472 | 472 |
473 void TargetDataLowering::emitGlobal(const VariableDeclaration &Var, | 473 void TargetDataLowering::emitGlobal(const VariableDeclaration &Var, |
474 const IceString &SectionSuffix) { | 474 const IceString &SectionSuffix) { |
475 if (!ALLOW_DUMP) | 475 if (!buildAllowsDump()) |
476 return; | 476 return; |
477 | 477 |
478 // If external and not initialized, this must be a cross test. | 478 // If external and not initialized, this must be a cross test. |
479 // Don't generate a declaration for such cases. | 479 // Don't generate a declaration for such cases. |
480 const bool IsExternal = | 480 const bool IsExternal = |
481 Var.isExternal() || Ctx->getFlags().getDisableInternal(); | 481 Var.isExternal() || Ctx->getFlags().getDisableInternal(); |
482 if (IsExternal && !Var.hasInitializer()) | 482 if (IsExternal && !Var.hasInitializer()) |
483 return; | 483 return; |
484 | 484 |
485 Ostream &Str = Ctx->getStrEmit(); | 485 Ostream &Str = Ctx->getStrEmit(); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 if (Target == Target_##X) \ | 562 if (Target == Target_##X) \ |
563 return TargetHeader##X::create(Ctx); | 563 return TargetHeader##X::create(Ctx); |
564 #include "llvm/Config/SZTargets.def" | 564 #include "llvm/Config/SZTargets.def" |
565 | 565 |
566 llvm::report_fatal_error("Unsupported target header lowering"); | 566 llvm::report_fatal_error("Unsupported target header lowering"); |
567 } | 567 } |
568 | 568 |
569 TargetHeaderLowering::~TargetHeaderLowering() = default; | 569 TargetHeaderLowering::~TargetHeaderLowering() = default; |
570 | 570 |
571 } // end of namespace Ice | 571 } // end of namespace Ice |
OLD | NEW |