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

Side by Side Diff: src/IceTargetLoweringARM32.h

Issue 1506653002: Subzero: Add Non-SFI support for x86-32. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Code review changes Created 4 years, 11 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 /// \file 10 /// \file
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 ARM32InstructionSet InstructionSet = ARM32InstructionSet::Begin; 50 ARM32InstructionSet InstructionSet = ARM32InstructionSet::Begin;
51 }; 51 };
52 52
53 // The target lowering logic for ARM32. 53 // The target lowering logic for ARM32.
54 class TargetARM32 : public TargetLowering { 54 class TargetARM32 : public TargetLowering {
55 TargetARM32() = delete; 55 TargetARM32() = delete;
56 TargetARM32(const TargetARM32 &) = delete; 56 TargetARM32(const TargetARM32 &) = delete;
57 TargetARM32 &operator=(const TargetARM32 &) = delete; 57 TargetARM32 &operator=(const TargetARM32 &) = delete;
58 58
59 public: 59 public:
60 ~TargetARM32() = default; 60 static void staticInit(const ClFlags &Flags);
61
62 static void staticInit();
63 // TODO(jvoung): return a unique_ptr. 61 // TODO(jvoung): return a unique_ptr.
64 static std::unique_ptr<::Ice::TargetLowering> create(Cfg *Func) { 62 static std::unique_ptr<::Ice::TargetLowering> create(Cfg *Func) {
65 return makeUnique<TargetARM32>(Func); 63 return makeUnique<TargetARM32>(Func);
66 } 64 }
67 65
68 std::unique_ptr<::Ice::Assembler> createAssembler() const override { 66 std::unique_ptr<::Ice::Assembler> createAssembler() const override {
69 return makeUnique<ARM32::AssemblerARM32>(); 67 return makeUnique<ARM32::AssemblerARM32>();
70 } 68 }
71 69
72 void initNodeForLowering(CfgNode *Node) override { 70 void initNodeForLowering(CfgNode *Node) override {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 return Ty == IceType_i64; 121 return Ty == IceType_i64;
124 } 122 }
125 123
126 // TODO(ascull): what size is best for ARM? 124 // TODO(ascull): what size is best for ARM?
127 SizeT getMinJumpTableSize() const override { return 3; } 125 SizeT getMinJumpTableSize() const override { return 3; }
128 void emitJumpTable(const Cfg *Func, 126 void emitJumpTable(const Cfg *Func,
129 const InstJumpTable *JumpTable) const override; 127 const InstJumpTable *JumpTable) const override;
130 128
131 void emitVariable(const Variable *Var) const override; 129 void emitVariable(const Variable *Var) const override;
132 130
133 const char *getConstantPrefix() const final { return "#"; }
134 void emit(const ConstantUndef *C) const final; 131 void emit(const ConstantUndef *C) const final;
135 void emit(const ConstantInteger32 *C) const final; 132 void emit(const ConstantInteger32 *C) const final;
136 void emit(const ConstantInteger64 *C) const final; 133 void emit(const ConstantInteger64 *C) const final;
137 void emit(const ConstantFloat *C) const final; 134 void emit(const ConstantFloat *C) const final;
138 void emit(const ConstantDouble *C) const final; 135 void emit(const ConstantDouble *C) const final;
136 void emit(const ConstantRelocatable *C) const final;
139 137
140 void lowerArguments() override; 138 void lowerArguments() override;
141 void addProlog(CfgNode *Node) override; 139 void addProlog(CfgNode *Node) override;
142 void addEpilog(CfgNode *Node) override; 140 void addEpilog(CfgNode *Node) override;
143 141
144 Operand *loOperand(Operand *Operand); 142 Operand *loOperand(Operand *Operand);
145 Operand *hiOperand(Operand *Operand); 143 Operand *hiOperand(Operand *Operand);
146 void finishArgumentLowering(Variable *Arg, Variable *FramePtr, 144 void finishArgumentLowering(Variable *Arg, Variable *FramePtr,
147 size_t BasicFrameOffset, size_t *InArgsSizeBytes); 145 size_t BasicFrameOffset, size_t *InArgsSizeBytes);
148 146
149 bool hasCPUFeature(TargetARM32Features::ARM32InstructionSet I) const { 147 bool hasCPUFeature(TargetARM32Features::ARM32InstructionSet I) const {
150 return CPUFeatures.hasFeature(I); 148 return CPUFeatures.hasFeature(I);
151 } 149 }
152 150
153 enum OperandLegalization { 151 enum OperandLegalization {
154 Legal_Reg = 1 << 0, /// physical register, not stack location 152 Legal_Reg = 1 << 0, /// physical register, not stack location
155 Legal_Flex = 1 << 1, /// A flexible operand2, which can hold rotated small 153 Legal_Flex = 1 << 1, /// A flexible operand2, which can hold rotated small
156 /// immediates, shifted registers, or modified fp imm. 154 /// immediates, shifted registers, or modified fp imm.
157 Legal_Mem = 1 << 2, /// includes [r0, r1 lsl #2] as well as [sp, #12] 155 Legal_Mem = 1 << 2, /// includes [r0, r1 lsl #2] as well as [sp, #12]
158 Legal_Rematerializable = 1 << 3, 156 Legal_Rematerializable = 1 << 3,
159 Legal_All = ~Legal_Rematerializable, 157 Legal_Default = ~Legal_Rematerializable,
160 }; 158 };
161 159
162 using LegalMask = uint32_t; 160 using LegalMask = uint32_t;
163 Operand *legalizeUndef(Operand *From, int32_t RegNum = Variable::NoRegister); 161 Operand *legalizeUndef(Operand *From, int32_t RegNum = Variable::NoRegister);
164 Operand *legalize(Operand *From, LegalMask Allowed = Legal_All, 162 Operand *legalize(Operand *From, LegalMask Allowed = Legal_Default,
165 int32_t RegNum = Variable::NoRegister); 163 int32_t RegNum = Variable::NoRegister);
166 Variable *legalizeToReg(Operand *From, int32_t RegNum = Variable::NoRegister); 164 Variable *legalizeToReg(Operand *From, int32_t RegNum = Variable::NoRegister);
167 165
168 OperandARM32ShAmtImm *shAmtImm(uint32_t ShAmtImm) const { 166 OperandARM32ShAmtImm *shAmtImm(uint32_t ShAmtImm) const {
169 assert(ShAmtImm < 32); 167 assert(ShAmtImm < 32);
170 return OperandARM32ShAmtImm::create( 168 return OperandARM32ShAmtImm::create(
171 Func, 169 Func,
172 llvm::cast<ConstantInteger32>(Ctx->getConstantInt32(ShAmtImm & 0x1F))); 170 llvm::cast<ConstantInteger32>(Ctx->getConstantInt32(ShAmtImm & 0x1F)));
173 } 171 }
174 172
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after
1204 private: 1202 private:
1205 ~TargetHeaderARM32() = default; 1203 ~TargetHeaderARM32() = default;
1206 1204
1207 TargetARM32Features CPUFeatures; 1205 TargetARM32Features CPUFeatures;
1208 }; 1206 };
1209 1207
1210 } // end of namespace ARM32 1208 } // end of namespace ARM32
1211 } // end of namespace Ice 1209 } // end of namespace Ice
1212 1210
1213 #endif // SUBZERO_SRC_ICETARGETLOWERINGARM32_H 1211 #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