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

Side by Side Diff: src/IceInstARM32.cpp

Issue 1136793002: Handle ARM "ret void" and function alignment with proper padding. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: rename param Created 5 years, 7 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
(Empty)
1 //===- subzero/src/IceInstARM32.cpp - ARM32 instruction implementation ----===//
2 //
3 // The Subzero Code Generator
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file implements the InstARM32 and OperandARM32 classes,
11 // primarily the constructors and the dump()/emit() methods.
12 //
13 //===----------------------------------------------------------------------===//
14
15 #include "assembler_arm32.h"
16 #include "IceCfg.h"
17 #include "IceCfgNode.h"
18 #include "IceInst.h"
19 #include "IceInstARM32.h"
20 #include "IceRegistersARM32.h"
21 #include "IceTargetLoweringARM32.h"
22 #include "IceOperand.h"
Jim Stichnoth 2015/05/11 20:12:31 sort includes
jvoung (off chromium) 2015/05/11 22:11:51 Done.
23
24 namespace Ice {
25
26 namespace {
27
28 const struct TypeARM32Attributes_ {
29 const char *WidthString; // b, h, <blank>, or d
30 } TypeARM32Attributes[] = {
31 #define X(tag, elementty, width) \
32 { width } \
33 ,
34 ICETYPEARM32_TABLE
35 #undef X
36 };
37
38 } // end of anonymous namespace
39
40 const char *InstARM32::getWidthString(Type Ty) {
41 return TypeARM32Attributes[Ty].WidthString;
42 }
43
44 InstARM32Ret::InstARM32Ret(Cfg *Func, Variable *LR, Variable *Source)
45 : InstARM32(Func, InstARM32::Ret, Source ? 2 : 1, nullptr) {
46 addSource(LR);
47 if (Source)
48 addSource(Source);
49 }
50
51 // ======================== Dump routines ======================== //
52
53 void InstARM32::dump(const Cfg *Func) const {
54 if (!ALLOW_DUMP)
55 return;
56 Ostream &Str = Func->getContext()->getStrDump();
57 Str << "[ARM32] ";
58 Inst::dump(Func);
59 }
60
61 void InstARM32Ret::emit(const Cfg *Func) const {
62 if (!ALLOW_DUMP)
63 return;
64 assert(getSrcSize() > 0);
65 Variable *LR = llvm::cast<Variable>(getSrc(0));
66 assert(LR->hasReg() && LR->getRegNum() == RegARM32::Reg_lr);
Jim Stichnoth 2015/05/11 20:12:31 Break into 2 asserts? makes it easier to debug an
jvoung (off chromium) 2015/05/11 22:11:50 Done.
67 Ostream &Str = Func->getContext()->getStrEmit();
68 Str << "\tbx\t";
Jim Stichnoth 2015/05/11 20:12:31 Just to share an idle thought -- I was thinking of
jvoung (off chromium) 2015/05/11 22:11:51 Hmm yeah that sounds good.
69 LR->emit(Func);
70 }
71
72 void InstARM32Ret::emitIAS(const Cfg *Func) const {
73 (void)Func;
74 llvm_unreachable("Not yet implemented");
75 }
76
77 void InstARM32Ret::dump(const Cfg *Func) const {
78 if (!ALLOW_DUMP)
79 return;
80 Ostream &Str = Func->getContext()->getStrDump();
81 Type Ty = (getSrcSize() == 1 ? IceType_void : getSrc(0)->getType());
82 Str << "ret." << Ty << " ";
83 dumpSources(Func);
84 }
85
86 } // end of namespace Ice
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698