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

Side by Side Diff: src/IceTargetLowering.cpp

Issue 1075363002: Add a basic TargetARM32 skeleton which knows nothing. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: typos Created 5 years, 8 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
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 "assembler_arm32.h"
18 #include "assembler_ia32.h" 19 #include "assembler_ia32.h"
19 #include "IceCfg.h" // setError() 20 #include "IceCfg.h" // setError()
20 #include "IceCfgNode.h" 21 #include "IceCfgNode.h"
21 #include "IceOperand.h" 22 #include "IceOperand.h"
22 #include "IceRegAlloc.h" 23 #include "IceRegAlloc.h"
23 #include "IceTargetLowering.h" 24 #include "IceTargetLowering.h"
24 #include "IceTargetLoweringX8632.h" 25 #include "IceTargetLoweringX8632.h"
26 #include "IceTargetLoweringARM32.h"
Jim Stichnoth 2015/04/17 19:16:01 alphabetize
jvoung (off chromium) 2015/04/21 17:05:30 Done.
25 27
26 namespace Ice { 28 namespace Ice {
27 29
28 void LoweringContext::init(CfgNode *N) { 30 void LoweringContext::init(CfgNode *N) {
29 Node = N; 31 Node = N;
30 End = getNode()->getInsts().end(); 32 End = getNode()->getInsts().end();
31 rewind(); 33 rewind();
32 advanceForward(Next); 34 advanceForward(Next);
33 } 35 }
34 36
(...skipping 20 matching lines...) Expand all
55 skipDeleted(I); 57 skipDeleted(I);
56 } 58 }
57 } 59 }
58 60
59 Inst *LoweringContext::getLastInserted() const { 61 Inst *LoweringContext::getLastInserted() const {
60 assert(LastInserted); 62 assert(LastInserted);
61 return LastInserted; 63 return LastInserted;
62 } 64 }
63 65
64 TargetLowering *TargetLowering::createLowering(TargetArch Target, Cfg *Func) { 66 TargetLowering *TargetLowering::createLowering(TargetArch Target, Cfg *Func) {
65 // These statements can be #ifdef'd to specialize the code generator 67 // These statements can be #ifdef'd to specialize the code generator
Jim Stichnoth 2015/04/17 19:16:01 hmm, surprised that the comment indent changed...
jvoung (off chromium) 2015/04/21 17:05:30 Hmm some clang-format artifact? I couldn't convinc
66 // to a subset of the available targets. TODO: use CRTP. 68 // to a subset of the available targets. TODO: use CRTP.
67 if (Target == Target_X8632) 69 #define SUBZERO_TARGET(X) \
68 return TargetX8632::create(Func); 70 if (Target == Target_##X) \
69 #if 0 71 return Target##X::create(Func);
70 if (Target == Target_X8664) 72 #include "llvm/Config/SZTargets.def"
71 return IceTargetX8664::create(Func); 73
72 if (Target == Target_ARM32)
73 return IceTargetARM32::create(Func);
74 if (Target == Target_ARM64)
75 return IceTargetARM64::create(Func);
76 #endif
77 Func->setError("Unsupported target"); 74 Func->setError("Unsupported target");
78 return nullptr; 75 return nullptr;
79 } 76 }
80 77
81 TargetLowering::TargetLowering(Cfg *Func) 78 TargetLowering::TargetLowering(Cfg *Func)
82 : Func(Func), Ctx(Func->getContext()), HasComputedFrame(false), 79 : Func(Func), Ctx(Func->getContext()), HasComputedFrame(false),
83 CallsReturnsTwice(false), StackAdjustment(0), Context(), 80 CallsReturnsTwice(false), StackAdjustment(0), Context(),
84 SnapshotStackAdjustment(0) {} 81 SnapshotStackAdjustment(0) {}
85 82
86 std::unique_ptr<Assembler> TargetLowering::createAssembler(TargetArch Target, 83 std::unique_ptr<Assembler> TargetLowering::createAssembler(TargetArch Target,
87 Cfg *Func) { 84 Cfg *Func) {
88 // These statements can be #ifdef'd to specialize the assembler 85 // These statements can be #ifdef'd to specialize the assembler
89 // to a subset of the available targets. TODO: use CRTP. 86 // to a subset of the available targets. TODO: use CRTP.
87 // TODO(jvoung): use SZTargets.def (rename AssemblerX86 -> AssemblerX8632),
88 // and make the namespaces consistent.
90 if (Target == Target_X8632) 89 if (Target == Target_X8632)
91 return std::unique_ptr<Assembler>(new x86::AssemblerX86()); 90 return std::unique_ptr<Assembler>(new x86::AssemblerX86());
92 Func->setError("Unsupported target"); 91
92 if (Target == Target_ARM32)
93 return std::unique_ptr<Assembler>(new AssemblerARM32());
94
95 Func->setError("Unsupported target assembler");
93 return nullptr; 96 return nullptr;
94 } 97 }
95 98
96 void TargetLowering::doAddressOpt() { 99 void TargetLowering::doAddressOpt() {
97 if (llvm::isa<InstLoad>(*Context.getCur())) 100 if (llvm::isa<InstLoad>(*Context.getCur()))
98 doAddressOptLoad(); 101 doAddressOptLoad();
99 else if (llvm::isa<InstStore>(*Context.getCur())) 102 else if (llvm::isa<InstStore>(*Context.getCur()))
100 doAddressOptStore(); 103 doAddressOptStore();
101 Context.advanceCur(); 104 Context.advanceCur();
102 Context.advanceNext(); 105 Context.advanceNext();
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 LinearScan.init(Kind); 230 LinearScan.init(Kind);
228 llvm::SmallBitVector RegMask = getRegisterSet(RegInclude, RegExclude); 231 llvm::SmallBitVector RegMask = getRegisterSet(RegInclude, RegExclude);
229 LinearScan.scan(RegMask, Ctx->getFlags().shouldRandomizeRegAlloc()); 232 LinearScan.scan(RegMask, Ctx->getFlags().shouldRandomizeRegAlloc());
230 } 233 }
231 234
232 std::unique_ptr<TargetDataLowering> 235 std::unique_ptr<TargetDataLowering>
233 TargetDataLowering::createLowering(GlobalContext *Ctx) { 236 TargetDataLowering::createLowering(GlobalContext *Ctx) {
234 // These statements can be #ifdef'd to specialize the code generator 237 // These statements can be #ifdef'd to specialize the code generator
235 // to a subset of the available targets. TODO: use CRTP. 238 // to a subset of the available targets. TODO: use CRTP.
236 TargetArch Target = Ctx->getFlags().getTargetArch(); 239 TargetArch Target = Ctx->getFlags().getTargetArch();
237 if (Target == Target_X8632) 240 #define SUBZERO_TARGET(X) \
238 return std::unique_ptr<TargetDataLowering>(TargetDataX8632::create(Ctx)); 241 if (Target == Target_##X) \
239 #if 0 242 return std::unique_ptr<TargetDataLowering>(TargetData##X::create(Ctx));
240 if (Target == Target_X8664) 243 #include "llvm/Config/SZTargets.def"
241 return std::unique_ptr<TargetDataLowering>(TargetDataX8664::create(Ctx)); 244
242 if (Target == Target_ARM32) 245 llvm_unreachable("Unsupported target data lowering");
243 return std::unique_ptr<TargetDataLowering>(TargetDataARM32::create(Ctx));
244 if (Target == Target_ARM64)
245 return std::unique_ptr<TargetDataLowering>(TargetDataARM64::create(Ctx));
246 #endif
247 llvm_unreachable("Unsupported target");
248 return nullptr; 246 return nullptr;
249 } 247 }
250 248
251 TargetDataLowering::~TargetDataLowering() {} 249 TargetDataLowering::~TargetDataLowering() {}
252 250
253 } // end of namespace Ice 251 } // end of namespace Ice
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698