Chromium Code Reviews| Index: src/IceTargetLoweringX86Base.h |
| diff --git a/src/IceTargetLoweringX86Base.h b/src/IceTargetLoweringX86Base.h |
| index dbbb747309f9acb6b7dc5c74bc38e600544bd6e1..174ef72d7aad66308e4cf9c16aca6dc2633e8072 100644 |
| --- a/src/IceTargetLoweringX86Base.h |
| +++ b/src/IceTargetLoweringX86Base.h |
| @@ -81,10 +81,10 @@ public: |
| : Traits::RegisterSet::Reg_esp; |
| } |
| size_t typeWidthInBytesOnStack(Type Ty) const override { |
| - // Round up to the next multiple of 4 bytes. In particular, i1, |
| - // i8, and i16 are rounded up to 4 bytes. |
| - // TODO(jpp): this needs to round to multiples of 8 bytes in x86-64. |
| - return (typeWidthInBytes(Ty) + 3) & ~3; |
| + // Round up to the next multiple of WordType bytes. |
| + const uint32_t WordSizeInBytes = typeWidthInBytes(Traits::WordType); |
| + return (typeWidthInBytes(Ty) + WordSizeInBytes - 1) & |
|
Jim Stichnoth
2015/08/11 16:01:37
/lazyme wonders if there's something in Ice::Utils
John
2015/08/12 19:27:55
Done.
|
| + ~(WordSizeInBytes - 1); |
| } |
| SizeT getMinJumpTableSize() const override { return 4; } |
| @@ -99,14 +99,40 @@ public: |
| void emit(const ConstantDouble *C) const final; |
| void initNodeForLowering(CfgNode *Node) override; |
| - /// Ensure that a 64-bit Variable has been split into 2 32-bit |
| + /// x86-32: Ensure that a 64-bit Variable has been split into 2 32-bit |
| /// Variables, creating them if necessary. This is needed for all |
| /// I64 operations, and it is needed for pushing F64 arguments for |
| /// function calls using the 32-bit push instruction (though the |
| /// latter could be done by directly writing to the stack). |
| - void split64(Variable *Var); |
| - Operand *loOperand(Operand *Operand); |
| - Operand *hiOperand(Operand *Operand); |
| + /// |
| + /// x86-64: Complains loudly if invoked because the cpu can handle |
| + /// 64-bit types natively. |
| + template <typename T = Traits> |
| + typename std::enable_if<!T::Is64Bit, void>::type split64(Variable *Var); |
| + template <typename T = Traits> |
| + typename std::enable_if<T::Is64Bit, void>::type split64(Variable *) { |
| + llvm::report_fatal_error( |
| + "Hey, yo! This is x86-64. Watcha doin'? (split64)"); |
| + } |
| + |
| + template <typename T = Traits> |
| + typename std::enable_if<!T::Is64Bit, Operand>::type * |
| + loOperand(Operand *Operand); |
| + template <typename T = Traits> |
| + typename std::enable_if<T::Is64Bit, Operand>::type *loOperand(Operand *) { |
| + llvm::report_fatal_error( |
| + "Hey, yo! This is x86-64. Watcha doin'? (loOperand)"); |
| + } |
| + |
| + template <typename T = Traits> |
| + typename std::enable_if<!T::Is64Bit, Operand>::type * |
| + hiOperand(Operand *Operand); |
| + template <typename T = Traits> |
| + typename std::enable_if<T::Is64Bit, Operand>::type *hiOperand(Operand *) { |
| + llvm::report_fatal_error( |
| + "Hey, yo! This is x86-64. Watcha doin'? (hiOperand)"); |
| + } |
| + |
| void finishArgumentLowering(Variable *Arg, Variable *FramePtr, |
| size_t BasicFrameOffset, size_t &InArgsSizeBytes); |
| typename Traits::Address stackVarToAsmOperand(const Variable *Var) const; |
| @@ -129,6 +155,19 @@ protected: |
| void lowerExtractElement(const InstExtractElement *Inst) override; |
| void lowerFcmp(const InstFcmp *Inst) override; |
| void lowerIcmp(const InstIcmp *Inst) override; |
| + /// Complains loudly if invoked because the cpu can handle 64-bit types |
| + /// natively. |
| + template <typename T = Traits> |
| + typename std::enable_if<T::Is64Bit, void>::type |
| + lowerIcmp64(const InstIcmp *) { |
| + llvm::report_fatal_error( |
| + "Hey, yo! This is x86-64. Watcha doin'? (lowerIcmp64)"); |
| + } |
| + /// x86lowerIcmp64 handles 64-bit icmp lowering. |
| + template <typename T = Traits> |
| + typename std::enable_if<!T::Is64Bit, void>::type |
| + lowerIcmp64(const InstIcmp *Inst); |
| + |
| void lowerIntrinsicCall(const InstIntrinsicCall *Inst) override; |
| void lowerInsertElement(const InstInsertElement *Inst) override; |
| void lowerLoad(const InstLoad *Inst) override; |