OLD | NEW |
1 //===- subzero/src/IceTargetLoweringMIPS32.h - MIPS32 lowering ---*- C++-*-===// | 1 //===- subzero/src/IceTargetLoweringMIPS32.h - MIPS32 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 } | 104 } |
105 | 105 |
106 // TODO(ascull): what is the best size of MIPS? | 106 // TODO(ascull): what is the best size of MIPS? |
107 SizeT getMinJumpTableSize() const override { return 3; } | 107 SizeT getMinJumpTableSize() const override { return 3; } |
108 void emitJumpTable(const Cfg *Func, | 108 void emitJumpTable(const Cfg *Func, |
109 const InstJumpTable *JumpTable) const override; | 109 const InstJumpTable *JumpTable) const override; |
110 | 110 |
111 void emitVariable(const Variable *Var) const override; | 111 void emitVariable(const Variable *Var) const override; |
112 | 112 |
113 void emit(const ConstantInteger32 *C) const final { | 113 void emit(const ConstantInteger32 *C) const final { |
114 (void)C; | 114 if (!BuildDefs::dump()) |
115 llvm::report_fatal_error("Not yet implemented"); | 115 return; |
| 116 Ostream &Str = Ctx->getStrEmit(); |
| 117 Str << C->getValue(); |
116 } | 118 } |
117 void emit(const ConstantInteger64 *C) const final { | 119 void emit(const ConstantInteger64 *C) const final { |
118 (void)C; | 120 (void)C; |
119 llvm::report_fatal_error("Not yet implemented"); | 121 llvm::report_fatal_error("Not yet implemented"); |
120 } | 122 } |
121 void emit(const ConstantFloat *C) const final { | 123 void emit(const ConstantFloat *C) const final { |
122 (void)C; | 124 (void)C; |
123 llvm::report_fatal_error("Not yet implemented"); | 125 llvm::report_fatal_error("Not yet implemented"); |
124 } | 126 } |
125 void emit(const ConstantDouble *C) const final { | 127 void emit(const ConstantDouble *C) const final { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 } | 271 } |
270 | 272 |
271 void _sub(Variable *Dest, Variable *Src0, Variable *Src1) { | 273 void _sub(Variable *Dest, Variable *Src0, Variable *Src1) { |
272 Context.insert<InstMIPS32Sub>(Dest, Src0, Src1); | 274 Context.insert<InstMIPS32Sub>(Dest, Src0, Src1); |
273 } | 275 } |
274 | 276 |
275 void _subu(Variable *Dest, Variable *Src0, Variable *Src1) { | 277 void _subu(Variable *Dest, Variable *Src0, Variable *Src1) { |
276 Context.insert<InstMIPS32Subu>(Dest, Src0, Src1); | 278 Context.insert<InstMIPS32Subu>(Dest, Src0, Src1); |
277 } | 279 } |
278 | 280 |
| 281 void _sw(Variable *Value, OperandMIPS32Mem *Mem) { |
| 282 Context.insert<InstMIPS32Sw>(Value, Mem); |
| 283 } |
| 284 |
279 void _xor(Variable *Dest, Variable *Src0, Variable *Src1) { | 285 void _xor(Variable *Dest, Variable *Src0, Variable *Src1) { |
280 Context.insert<InstMIPS32Xor>(Dest, Src0, Src1); | 286 Context.insert<InstMIPS32Xor>(Dest, Src0, Src1); |
281 } | 287 } |
282 | 288 |
283 void _xori(Variable *Dest, Variable *Src, uint32_t Imm) { | 289 void _xori(Variable *Dest, Variable *Src, uint32_t Imm) { |
284 Context.insert<InstMIPS32Xori>(Dest, Src, Imm); | 290 Context.insert<InstMIPS32Xori>(Dest, Src, Imm); |
285 } | 291 } |
286 | 292 |
287 void lowerArguments() override; | 293 void lowerArguments() override; |
288 | 294 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 void genTargetHelperCallFor(Inst *Instr) override { (void)Instr; } | 374 void genTargetHelperCallFor(Inst *Instr) override { (void)Instr; } |
369 void doAddressOptLoad() override; | 375 void doAddressOptLoad() override; |
370 void doAddressOptStore() override; | 376 void doAddressOptStore() override; |
371 void randomlyInsertNop(float Probability, | 377 void randomlyInsertNop(float Probability, |
372 RandomNumberGenerator &RNG) override; | 378 RandomNumberGenerator &RNG) override; |
373 void | 379 void |
374 makeRandomRegisterPermutation(llvm::SmallVectorImpl<RegNumT> &Permutation, | 380 makeRandomRegisterPermutation(llvm::SmallVectorImpl<RegNumT> &Permutation, |
375 const SmallBitVector &ExcludeRegisters, | 381 const SmallBitVector &ExcludeRegisters, |
376 uint64_t Salt) const override; | 382 uint64_t Salt) const override; |
377 | 383 |
| 384 OperandMIPS32Mem *formMemoryOperand(Operand *Ptr, Type Ty); |
| 385 |
378 bool UsesFramePointer = false; | 386 bool UsesFramePointer = false; |
379 bool NeedsStackAlignment = false; | 387 bool NeedsStackAlignment = false; |
380 static SmallBitVector TypeToRegisterSet[RCMIPS32_NUM]; | 388 static SmallBitVector TypeToRegisterSet[RCMIPS32_NUM]; |
381 static SmallBitVector TypeToRegisterSetUnfiltered[RCMIPS32_NUM]; | 389 static SmallBitVector TypeToRegisterSetUnfiltered[RCMIPS32_NUM]; |
382 static SmallBitVector RegisterAliases[RegMIPS32::Reg_NUM]; | 390 static SmallBitVector RegisterAliases[RegMIPS32::Reg_NUM]; |
383 SmallBitVector RegsUsed; | 391 SmallBitVector RegsUsed; |
384 VarList PhysicalRegisters[IceType_NUM]; | 392 VarList PhysicalRegisters[IceType_NUM]; |
385 static constexpr uint32_t CHAR_BITS = 8; | 393 static constexpr uint32_t CHAR_BITS = 8; |
386 static constexpr uint32_t INT32_BITS = 32; | 394 static constexpr uint32_t INT32_BITS = 32; |
387 | 395 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 explicit TargetHeaderMIPS32(GlobalContext *Ctx); | 436 explicit TargetHeaderMIPS32(GlobalContext *Ctx); |
429 | 437 |
430 private: | 438 private: |
431 ~TargetHeaderMIPS32() = default; | 439 ~TargetHeaderMIPS32() = default; |
432 }; | 440 }; |
433 | 441 |
434 } // end of namespace MIPS32 | 442 } // end of namespace MIPS32 |
435 } // end of namespace Ice | 443 } // end of namespace Ice |
436 | 444 |
437 #endif // SUBZERO_SRC_ICETARGETLOWERINGMIPS32_H | 445 #endif // SUBZERO_SRC_ICETARGETLOWERINGMIPS32_H |
OLD | NEW |