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

Side by Side Diff: src/IceTargetLowering.cpp

Issue 1211863004: Enables llvm dyn_cast for Assemblers. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Addresses comments. Created 5 years, 5 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/IceCfg.h ('k') | src/assembler_mips32.h » ('j') | 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/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,
11 // specifically invoking the appropriate lowering method for a given 11 // specifically invoking the appropriate lowering method for a given
12 // instruction kind and driving global register allocation. It also 12 // instruction kind and driving global register allocation. It also
13 // implements the non-deleted instruction iteration in 13 // implements the non-deleted instruction iteration in
14 // LoweringContext. 14 // LoweringContext.
15 // 15 //
16 //===----------------------------------------------------------------------===// 16 //===----------------------------------------------------------------------===//
17 17
18 #include "IceTargetLowering.h" 18 #include "IceTargetLowering.h"
19 19
20 #include "IceAssemblerARM32.h" 20 #include "IceAssemblerARM32.h"
21 #include "IceAssemblerMIPS32.h"
21 #include "IceAssemblerX8632.h" 22 #include "IceAssemblerX8632.h"
22 #include "IceAssemblerX8664.h" 23 #include "IceAssemblerX8664.h"
23 #include "assembler_mips32.h"
24 #include "IceCfg.h" // setError() 24 #include "IceCfg.h" // setError()
25 #include "IceCfgNode.h" 25 #include "IceCfgNode.h"
26 #include "IceGlobalInits.h" 26 #include "IceGlobalInits.h"
27 #include "IceOperand.h" 27 #include "IceOperand.h"
28 #include "IceRegAlloc.h" 28 #include "IceRegAlloc.h"
29 #include "IceTargetLoweringARM32.h" 29 #include "IceTargetLoweringARM32.h"
30 #include "IceTargetLoweringMIPS32.h" 30 #include "IceTargetLoweringMIPS32.h"
31 #include "IceTargetLoweringX8632.h" 31 #include "IceTargetLoweringX8632.h"
32 #include "IceTargetLoweringX8664.h" 32 #include "IceTargetLoweringX8664.h"
33 33
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 Str << "\t.p2align\t" << llvm::Log2_32(Align) << "\n"; 512 Str << "\t.p2align\t" << llvm::Log2_32(Align) << "\n";
513 } 513 }
514 514
515 Str << MangledName << ":\n"; 515 Str << MangledName << ":\n";
516 516
517 if (HasNonzeroInitializer) { 517 if (HasNonzeroInitializer) {
518 for (const std::unique_ptr<VariableDeclaration::Initializer> &Init : 518 for (const std::unique_ptr<VariableDeclaration::Initializer> &Init :
519 Var.getInitializers()) { 519 Var.getInitializers()) {
520 switch (Init->getKind()) { 520 switch (Init->getKind()) {
521 case VariableDeclaration::Initializer::DataInitializerKind: { 521 case VariableDeclaration::Initializer::DataInitializerKind: {
522 const auto &Data = 522 const auto &Data = llvm::cast<VariableDeclaration::DataInitializer>(
523 llvm::cast<VariableDeclaration::DataInitializer>(Init.get()) 523 Init.get())->getContents();
524 ->getContents();
525 for (SizeT i = 0; i < Init->getNumBytes(); ++i) { 524 for (SizeT i = 0; i < Init->getNumBytes(); ++i) {
526 Str << "\t.byte\t" << (((unsigned)Data[i]) & 0xff) << "\n"; 525 Str << "\t.byte\t" << (((unsigned)Data[i]) & 0xff) << "\n";
527 } 526 }
528 break; 527 break;
529 } 528 }
530 case VariableDeclaration::Initializer::ZeroInitializerKind: 529 case VariableDeclaration::Initializer::ZeroInitializerKind:
531 Str << "\t.zero\t" << Init->getNumBytes() << "\n"; 530 Str << "\t.zero\t" << Init->getNumBytes() << "\n";
532 break; 531 break;
533 case VariableDeclaration::Initializer::RelocInitializerKind: { 532 case VariableDeclaration::Initializer::RelocInitializerKind: {
534 const auto *Reloc = 533 const auto *Reloc =
(...skipping 29 matching lines...) Expand all
564 if (Target == Target_##X) \ 563 if (Target == Target_##X) \
565 return TargetHeader##X::create(Ctx); 564 return TargetHeader##X::create(Ctx);
566 #include "llvm/Config/SZTargets.def" 565 #include "llvm/Config/SZTargets.def"
567 566
568 llvm::report_fatal_error("Unsupported target header lowering"); 567 llvm::report_fatal_error("Unsupported target header lowering");
569 } 568 }
570 569
571 TargetHeaderLowering::~TargetHeaderLowering() = default; 570 TargetHeaderLowering::~TargetHeaderLowering() = default;
572 571
573 } // end of namespace Ice 572 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceCfg.h ('k') | src/assembler_mips32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698