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

Side by Side Diff: src/IceTargetLoweringARM32.h

Issue 1127963004: Subzero ARM: lowerArguments (GPR), basic legalize(), and lowerRet(i32, i64). (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: fix warnings, etc 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
« no previous file with comments | « src/IceTargetLowering.cpp ('k') | src/IceTargetLoweringARM32.cpp » ('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/IceTargetLoweringARM32.h - ARM32 lowering ----*- C++ -*-===// 1 //===- subzero/src/IceTargetLoweringARM32.h - ARM32 lowering ----*- C++ -*-===//
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 declares the TargetLoweringARM32 class, which implements the 10 // This file declares the TargetLoweringARM32 class, which implements the
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 void emit(const ConstantUndef *C) const final; 58 void emit(const ConstantUndef *C) const final;
59 void emit(const ConstantInteger32 *C) const final; 59 void emit(const ConstantInteger32 *C) const final;
60 void emit(const ConstantInteger64 *C) const final; 60 void emit(const ConstantInteger64 *C) const final;
61 void emit(const ConstantFloat *C) const final; 61 void emit(const ConstantFloat *C) const final;
62 void emit(const ConstantDouble *C) const final; 62 void emit(const ConstantDouble *C) const final;
63 63
64 void lowerArguments() override; 64 void lowerArguments() override;
65 void addProlog(CfgNode *Node) override; 65 void addProlog(CfgNode *Node) override;
66 void addEpilog(CfgNode *Node) override; 66 void addEpilog(CfgNode *Node) override;
67 67
68 // Ensure that a 64-bit Variable has been split into 2 32-bit
69 // Variables, creating them if necessary. This is needed for all
70 // I64 operations.
71 void split64(Variable *Var);
72 Operand *loOperand(Operand *Operand);
73 Operand *hiOperand(Operand *Operand);
74
68 protected: 75 protected:
69 explicit TargetARM32(Cfg *Func); 76 explicit TargetARM32(Cfg *Func);
70 77
71 void postLower() override; 78 void postLower() override;
72 79
73 void lowerAlloca(const InstAlloca *Inst) override; 80 void lowerAlloca(const InstAlloca *Inst) override;
74 void lowerArithmetic(const InstArithmetic *Inst) override; 81 void lowerArithmetic(const InstArithmetic *Inst) override;
75 void lowerAssign(const InstAssign *Inst) override; 82 void lowerAssign(const InstAssign *Inst) override;
76 void lowerBr(const InstBr *Inst) override; 83 void lowerBr(const InstBr *Inst) override;
77 void lowerCall(const InstCall *Inst) override; 84 void lowerCall(const InstCall *Inst) override;
78 void lowerCast(const InstCast *Inst) override; 85 void lowerCast(const InstCast *Inst) override;
79 void lowerExtractElement(const InstExtractElement *Inst) override; 86 void lowerExtractElement(const InstExtractElement *Inst) override;
80 void lowerFcmp(const InstFcmp *Inst) override; 87 void lowerFcmp(const InstFcmp *Inst) override;
81 void lowerIcmp(const InstIcmp *Inst) override; 88 void lowerIcmp(const InstIcmp *Inst) override;
82 void lowerIntrinsicCall(const InstIntrinsicCall *Inst) override; 89 void lowerIntrinsicCall(const InstIntrinsicCall *Inst) override;
83 void lowerInsertElement(const InstInsertElement *Inst) override; 90 void lowerInsertElement(const InstInsertElement *Inst) override;
84 void lowerLoad(const InstLoad *Inst) override; 91 void lowerLoad(const InstLoad *Inst) override;
85 void lowerPhi(const InstPhi *Inst) override; 92 void lowerPhi(const InstPhi *Inst) override;
86 void lowerRet(const InstRet *Inst) override; 93 void lowerRet(const InstRet *Inst) override;
87 void lowerSelect(const InstSelect *Inst) override; 94 void lowerSelect(const InstSelect *Inst) override;
88 void lowerStore(const InstStore *Inst) override; 95 void lowerStore(const InstStore *Inst) override;
89 void lowerSwitch(const InstSwitch *Inst) override; 96 void lowerSwitch(const InstSwitch *Inst) override;
90 void lowerUnreachable(const InstUnreachable *Inst) override; 97 void lowerUnreachable(const InstUnreachable *Inst) override;
91 void prelowerPhis() override; 98 void prelowerPhis() override;
92 void lowerPhiAssignments(CfgNode *Node, 99 void lowerPhiAssignments(CfgNode *Node,
93 const AssignList &Assignments) override; 100 const AssignList &Assignments) override;
94 void doAddressOptLoad() override; 101 void doAddressOptLoad() override;
95 void doAddressOptStore() override; 102 void doAddressOptStore() override;
96 void randomlyInsertNop(float Probability) override; 103 void randomlyInsertNop(float Probability) override;
104
105 enum OperandLegalization {
106 Legal_None = 0,
107 Legal_Reg = 1 << 0, // physical register, not stack location
108 Legal_Flex = 1 << 1, // A flexible operand2, which can hold rotated
109 // small immediates, or shifted registers.
110 Legal_Mem = 1 << 2, // includes [r0, r1 lsl #2] as well as [sp, #12]
111 Legal_All = ~Legal_None
112 };
113 typedef uint32_t LegalMask;
114 Operand *legalize(Operand *From, LegalMask Allowed = Legal_All,
115 int32_t RegNum = Variable::NoRegister);
116 Variable *legalizeToVar(Operand *From, int32_t RegNum = Variable::NoRegister);
117
118 Variable *makeReg(Type Ty, int32_t RegNum = Variable::NoRegister);
119 static Type stackSlotType();
120 Variable *copyToReg(Operand *Src, int32_t RegNum = Variable::NoRegister);
121
122 // Returns a vector in a register with the given constant entries.
123 Variable *makeVectorOfZeros(Type Ty, int32_t RegNum = Variable::NoRegister);
124
97 void makeRandomRegisterPermutation( 125 void makeRandomRegisterPermutation(
98 llvm::SmallVectorImpl<int32_t> &Permutation, 126 llvm::SmallVectorImpl<int32_t> &Permutation,
99 const llvm::SmallBitVector &ExcludeRegisters) const override; 127 const llvm::SmallBitVector &ExcludeRegisters) const override;
100 128
101 static Type stackSlotType();
102
103 // The following are helpers that insert lowered ARM32 instructions 129 // The following are helpers that insert lowered ARM32 instructions
104 // with minimal syntactic overhead, so that the lowering code can 130 // with minimal syntactic overhead, so that the lowering code can
105 // look as close to assembly as practical. 131 // look as close to assembly as practical.
106 132
133 void _ldr(Variable *Dest, OperandARM32Mem *Addr) {
134 Context.insert(InstARM32Ldr::create(Func, Dest, Addr));
135 }
136 // If Dest=nullptr is passed in, then a new variable is created,
137 // marked as infinite register allocation weight, and returned
138 // through the in/out Dest argument.
139 void _mov(Variable *&Dest, Operand *Src0,
140 int32_t RegNum = Variable::NoRegister) {
141 if (Dest == nullptr)
142 Dest = makeReg(Src0->getType(), RegNum);
143 Context.insert(InstARM32Mov::create(Func, Dest, Src0));
144 }
145 // The Operand can only be a 16-bit immediate or a ConstantRelocatable
146 // (with an upper16 relocation).
147 void _movt(Variable *&Dest, Operand *Src0) {
148 Context.insert(InstARM32Movt::create(Func, Dest, Src0));
149 }
150 void _movw(Variable *&Dest, Operand *Src0) {
151 Context.insert(InstARM32Movw::create(Func, Dest, Src0));
152 }
153 void _mvn(Variable *&Dest, Operand *Src0) {
154 Context.insert(InstARM32Mvn::create(Func, Dest, Src0));
155 }
107 void _ret(Variable *LR, Variable *Src0 = nullptr) { 156 void _ret(Variable *LR, Variable *Src0 = nullptr) {
108 Context.insert(InstARM32Ret::create(Func, LR, Src0)); 157 Context.insert(InstARM32Ret::create(Func, LR, Src0));
109 } 158 }
110 159
111 bool UsesFramePointer; 160 bool UsesFramePointer;
112 bool NeedsStackAlignment; 161 bool NeedsStackAlignment;
113 llvm::SmallBitVector TypeToRegisterSet[IceType_NUM]; 162 llvm::SmallBitVector TypeToRegisterSet[IceType_NUM];
114 llvm::SmallBitVector ScratchRegs; 163 llvm::SmallBitVector ScratchRegs;
115 llvm::SmallBitVector RegsUsed; 164 llvm::SmallBitVector RegsUsed;
116 VarList PhysicalRegisters[IceType_NUM]; 165 VarList PhysicalRegisters[IceType_NUM];
(...skipping 21 matching lines...) Expand all
138 187
139 private: 188 private:
140 void lowerGlobal(const VariableDeclaration &Var) const; 189 void lowerGlobal(const VariableDeclaration &Var) const;
141 ~TargetDataARM32() override {} 190 ~TargetDataARM32() override {}
142 template <typename T> static void emitConstantPool(GlobalContext *Ctx); 191 template <typename T> static void emitConstantPool(GlobalContext *Ctx);
143 }; 192 };
144 193
145 } // end of namespace Ice 194 } // end of namespace Ice
146 195
147 #endif // SUBZERO_SRC_ICETARGETLOWERINGARM32_H 196 #endif // SUBZERO_SRC_ICETARGETLOWERINGARM32_H
OLDNEW
« no previous file with comments | « src/IceTargetLowering.cpp ('k') | src/IceTargetLoweringARM32.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698