| OLD | NEW |
| 1 //===- subzero/src/IceTargetLoweringX86BaseImpl.h - x86 lowering -*- C++ -*-==// | 1 //===- subzero/src/IceTargetLoweringX86BaseImpl.h - x86 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 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1336 } | 1336 } |
| 1337 if (auto *Mem = llvm::dyn_cast<X86OperandMem>(Operand)) { | 1337 if (auto *Mem = llvm::dyn_cast<X86OperandMem>(Operand)) { |
| 1338 Constant *Offset = Mem->getOffset(); | 1338 Constant *Offset = Mem->getOffset(); |
| 1339 if (Offset == nullptr) { | 1339 if (Offset == nullptr) { |
| 1340 Offset = Ctx->getConstantInt32(4); | 1340 Offset = Ctx->getConstantInt32(4); |
| 1341 } else if (auto *IntOffset = llvm::dyn_cast<ConstantInteger32>(Offset)) { | 1341 } else if (auto *IntOffset = llvm::dyn_cast<ConstantInteger32>(Offset)) { |
| 1342 Offset = Ctx->getConstantInt32(4 + IntOffset->getValue()); | 1342 Offset = Ctx->getConstantInt32(4 + IntOffset->getValue()); |
| 1343 } else if (auto *SymOffset = llvm::dyn_cast<ConstantRelocatable>(Offset)) { | 1343 } else if (auto *SymOffset = llvm::dyn_cast<ConstantRelocatable>(Offset)) { |
| 1344 assert(!Utils::WouldOverflowAdd(SymOffset->getOffset(), 4)); | 1344 assert(!Utils::WouldOverflowAdd(SymOffset->getOffset(), 4)); |
| 1345 Offset = | 1345 Offset = |
| 1346 Ctx->getConstantSym(4 + SymOffset->getOffset(), SymOffset->getName(), | 1346 Ctx->getConstantSym(4 + SymOffset->getOffset(), SymOffset->getName()); |
| 1347 SymOffset->getSuppressMangling()); | |
| 1348 } | 1347 } |
| 1349 auto *MemOperand = X86OperandMem::create( | 1348 auto *MemOperand = X86OperandMem::create( |
| 1350 Func, IceType_i32, Mem->getBase(), Offset, Mem->getIndex(), | 1349 Func, IceType_i32, Mem->getBase(), Offset, Mem->getIndex(), |
| 1351 Mem->getShift(), Mem->getSegmentRegister(), Mem->getIsRebased()); | 1350 Mem->getShift(), Mem->getSegmentRegister(), Mem->getIsRebased()); |
| 1352 // Test if the Offset is an eligible i32 constants for randomization and | 1351 // Test if the Offset is an eligible i32 constants for randomization and |
| 1353 // pooling. Blind/pool it if it is. Otherwise return as oridinary mem | 1352 // pooling. Blind/pool it if it is. Otherwise return as oridinary mem |
| 1354 // operand. | 1353 // operand. |
| 1355 return legalize(MemOperand); | 1354 return legalize(MemOperand); |
| 1356 } | 1355 } |
| 1357 llvm_unreachable("Unsupported operand type"); | 1356 llvm_unreachable("Unsupported operand type"); |
| (...skipping 4041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5399 NewAddr.Index = nullptr; | 5398 NewAddr.Index = nullptr; |
| 5400 NewAddr.Shift = 0; | 5399 NewAddr.Shift = 0; |
| 5401 } | 5400 } |
| 5402 | 5401 |
| 5403 Constant *OffsetOp = nullptr; | 5402 Constant *OffsetOp = nullptr; |
| 5404 if (NewAddr.Relocatable == nullptr) { | 5403 if (NewAddr.Relocatable == nullptr) { |
| 5405 OffsetOp = Ctx->getConstantInt32(NewAddr.Offset); | 5404 OffsetOp = Ctx->getConstantInt32(NewAddr.Offset); |
| 5406 } else { | 5405 } else { |
| 5407 OffsetOp = | 5406 OffsetOp = |
| 5408 Ctx->getConstantSym(NewAddr.Relocatable->getOffset() + NewAddr.Offset, | 5407 Ctx->getConstantSym(NewAddr.Relocatable->getOffset() + NewAddr.Offset, |
| 5409 NewAddr.Relocatable->getName(), | 5408 NewAddr.Relocatable->getName()); |
| 5410 NewAddr.Relocatable->getSuppressMangling()); | |
| 5411 } | 5409 } |
| 5412 // Vanilla ICE load instructions should not use the segment registers, and | 5410 // Vanilla ICE load instructions should not use the segment registers, and |
| 5413 // computeAddressOpt only works at the level of Variables and Constants, not | 5411 // computeAddressOpt only works at the level of Variables and Constants, not |
| 5414 // other X86OperandMem, so there should be no mention of segment | 5412 // other X86OperandMem, so there should be no mention of segment |
| 5415 // registers there either. | 5413 // registers there either. |
| 5416 static constexpr auto SegmentReg = | 5414 static constexpr auto SegmentReg = |
| 5417 X86OperandMem::SegmentRegisters::DefaultSegment; | 5415 X86OperandMem::SegmentRegisters::DefaultSegment; |
| 5418 | 5416 |
| 5419 return X86OperandMem::create(Func, MemType, NewAddr.Base, OffsetOp, | 5417 return X86OperandMem::create(Func, MemType, NewAddr.Base, OffsetOp, |
| 5420 NewAddr.Index, NewAddr.Shift, SegmentReg); | 5418 NewAddr.Index, NewAddr.Shift, SegmentReg); |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5857 assert(Traits::Is64Bit); | 5855 assert(Traits::Is64Bit); |
| 5858 _mov(Index, RangeIndex); // trunc | 5856 _mov(Index, RangeIndex); // trunc |
| 5859 } else { | 5857 } else { |
| 5860 _movzx(Index, RangeIndex); | 5858 _movzx(Index, RangeIndex); |
| 5861 } | 5859 } |
| 5862 } else { | 5860 } else { |
| 5863 Index = legalizeToReg(RangeIndex); | 5861 Index = legalizeToReg(RangeIndex); |
| 5864 } | 5862 } |
| 5865 | 5863 |
| 5866 constexpr RelocOffsetT RelocOffset = 0; | 5864 constexpr RelocOffsetT RelocOffset = 0; |
| 5867 constexpr bool SuppressMangling = true; | 5865 const IceString &FunctionName = Func->getFunctionName(); |
| 5868 IceString MangledName = Ctx->mangleName(Func->getFunctionName()); | |
| 5869 constexpr Variable *NoBase = nullptr; | 5866 constexpr Variable *NoBase = nullptr; |
| 5870 Constant *Offset = Ctx->getConstantSym( | 5867 Constant *Offset = Ctx->getConstantSym( |
| 5871 RelocOffset, InstJumpTable::makeName(MangledName, JumpTable->getId()), | 5868 RelocOffset, InstJumpTable::makeName(FunctionName, JumpTable->getId())); |
| 5872 SuppressMangling); | |
| 5873 uint16_t Shift = typeWidthInBytesLog2(PointerType); | 5869 uint16_t Shift = typeWidthInBytesLog2(PointerType); |
| 5874 constexpr auto Segment = X86OperandMem::SegmentRegisters::DefaultSegment; | 5870 constexpr auto Segment = X86OperandMem::SegmentRegisters::DefaultSegment; |
| 5875 | 5871 |
| 5876 Variable *Target = nullptr; | 5872 Variable *Target = nullptr; |
| 5877 if (Traits::Is64Bit && NeedSandboxing) { | 5873 if (Traits::Is64Bit && NeedSandboxing) { |
| 5878 assert(Index != nullptr && Index->getType() == IceType_i32); | 5874 assert(Index != nullptr && Index->getType() == IceType_i32); |
| 5879 } | 5875 } |
| 5880 auto *TargetInMemory = X86OperandMem::create(Func, PointerType, NoBase, | 5876 auto *TargetInMemory = X86OperandMem::create(Func, PointerType, NoBase, |
| 5881 Offset, Index, Shift, Segment); | 5877 Offset, Index, Shift, Segment); |
| 5882 _mov(Target, TargetInMemory); | 5878 _mov(Target, TargetInMemory); |
| (...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6804 if (auto *ConstFloat = llvm::dyn_cast<ConstantFloat>(Const)) { | 6800 if (auto *ConstFloat = llvm::dyn_cast<ConstantFloat>(Const)) { |
| 6805 if (Utils::isPositiveZero(ConstFloat->getValue())) | 6801 if (Utils::isPositiveZero(ConstFloat->getValue())) |
| 6806 return makeZeroedRegister(Ty, RegNum); | 6802 return makeZeroedRegister(Ty, RegNum); |
| 6807 } else if (auto *ConstDouble = llvm::dyn_cast<ConstantDouble>(Const)) { | 6803 } else if (auto *ConstDouble = llvm::dyn_cast<ConstantDouble>(Const)) { |
| 6808 if (Utils::isPositiveZero(ConstDouble->getValue())) | 6804 if (Utils::isPositiveZero(ConstDouble->getValue())) |
| 6809 return makeZeroedRegister(Ty, RegNum); | 6805 return makeZeroedRegister(Ty, RegNum); |
| 6810 } | 6806 } |
| 6811 | 6807 |
| 6812 std::string Buffer; | 6808 std::string Buffer; |
| 6813 llvm::raw_string_ostream StrBuf(Buffer); | 6809 llvm::raw_string_ostream StrBuf(Buffer); |
| 6814 llvm::cast<Constant>(From)->emitPoolLabel(StrBuf, Ctx); | 6810 llvm::cast<Constant>(From)->emitPoolLabel(StrBuf); |
| 6815 llvm::cast<Constant>(From)->setShouldBePooled(true); | 6811 llvm::cast<Constant>(From)->setShouldBePooled(true); |
| 6816 Constant *Offset = Ctx->getConstantSym(0, StrBuf.str(), true); | 6812 Constant *Offset = Ctx->getConstantSym(0, StrBuf.str()); |
| 6817 auto *Mem = X86OperandMem::create(Func, Ty, nullptr, Offset); | 6813 auto *Mem = X86OperandMem::create(Func, Ty, nullptr, Offset); |
| 6818 From = Mem; | 6814 From = Mem; |
| 6819 } | 6815 } |
| 6820 | 6816 |
| 6821 bool NeedsReg = false; | 6817 bool NeedsReg = false; |
| 6822 if (!(Allowed & Legal_Imm) && !isScalarFloatingType(Ty)) | 6818 if (!(Allowed & Legal_Imm) && !isScalarFloatingType(Ty)) |
| 6823 // Immediate specifically not allowed. | 6819 // Immediate specifically not allowed. |
| 6824 NeedsReg = true; | 6820 NeedsReg = true; |
| 6825 if (!(Allowed & Legal_Mem) && isScalarFloatingType(Ty)) | 6821 if (!(Allowed & Legal_Mem) && isScalarFloatingType(Ty)) |
| 6826 // On x86, FP constants are lowered to mem operands. | 6822 // On x86, FP constants are lowered to mem operands. |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7023 Ostream &Str = Ctx->getStrEmit(); | 7019 Ostream &Str = Ctx->getStrEmit(); |
| 7024 Str << "$" << C->getValue(); | 7020 Str << "$" << C->getValue(); |
| 7025 } | 7021 } |
| 7026 } | 7022 } |
| 7027 | 7023 |
| 7028 template <typename TraitsType> | 7024 template <typename TraitsType> |
| 7029 void TargetX86Base<TraitsType>::emit(const ConstantFloat *C) const { | 7025 void TargetX86Base<TraitsType>::emit(const ConstantFloat *C) const { |
| 7030 if (!BuildDefs::dump()) | 7026 if (!BuildDefs::dump()) |
| 7031 return; | 7027 return; |
| 7032 Ostream &Str = Ctx->getStrEmit(); | 7028 Ostream &Str = Ctx->getStrEmit(); |
| 7033 C->emitPoolLabel(Str, Ctx); | 7029 C->emitPoolLabel(Str); |
| 7034 } | 7030 } |
| 7035 | 7031 |
| 7036 template <typename TraitsType> | 7032 template <typename TraitsType> |
| 7037 void TargetX86Base<TraitsType>::emit(const ConstantDouble *C) const { | 7033 void TargetX86Base<TraitsType>::emit(const ConstantDouble *C) const { |
| 7038 if (!BuildDefs::dump()) | 7034 if (!BuildDefs::dump()) |
| 7039 return; | 7035 return; |
| 7040 Ostream &Str = Ctx->getStrEmit(); | 7036 Ostream &Str = Ctx->getStrEmit(); |
| 7041 C->emitPoolLabel(Str, Ctx); | 7037 C->emitPoolLabel(Str); |
| 7042 } | 7038 } |
| 7043 | 7039 |
| 7044 template <typename TraitsType> | 7040 template <typename TraitsType> |
| 7045 void TargetX86Base<TraitsType>::emit(const ConstantUndef *) const { | 7041 void TargetX86Base<TraitsType>::emit(const ConstantUndef *) const { |
| 7046 llvm::report_fatal_error("undef value encountered by emitter."); | 7042 llvm::report_fatal_error("undef value encountered by emitter."); |
| 7047 } | 7043 } |
| 7048 | 7044 |
| 7049 template <class Machine> | 7045 template <class Machine> |
| 7050 void TargetX86Base<Machine>::emit(const ConstantRelocatable *C) const { | 7046 void TargetX86Base<Machine>::emit(const ConstantRelocatable *C) const { |
| 7051 if (!BuildDefs::dump()) | 7047 if (!BuildDefs::dump()) |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7121 // => Reg | 7117 // => Reg |
| 7122 assert(Ctx->getFlags().getRandomizeAndPoolImmediatesOption() == RPI_Pool); | 7118 assert(Ctx->getFlags().getRandomizeAndPoolImmediatesOption() == RPI_Pool); |
| 7123 Immediate->setShouldBePooled(true); | 7119 Immediate->setShouldBePooled(true); |
| 7124 // if we have already assigned a phy register, we must come from | 7120 // if we have already assigned a phy register, we must come from |
| 7125 // advancedPhiLowering()=>lowerAssign(). In this case we should reuse the | 7121 // advancedPhiLowering()=>lowerAssign(). In this case we should reuse the |
| 7126 // assigned register as this assignment is that start of its use-def | 7122 // assigned register as this assignment is that start of its use-def |
| 7127 // chain. So we add RegNum argument here. | 7123 // chain. So we add RegNum argument here. |
| 7128 Variable *Reg = makeReg(Immediate->getType(), RegNum); | 7124 Variable *Reg = makeReg(Immediate->getType(), RegNum); |
| 7129 IceString Label; | 7125 IceString Label; |
| 7130 llvm::raw_string_ostream Label_stream(Label); | 7126 llvm::raw_string_ostream Label_stream(Label); |
| 7131 Immediate->emitPoolLabel(Label_stream, Ctx); | 7127 Immediate->emitPoolLabel(Label_stream); |
| 7132 constexpr RelocOffsetT Offset = 0; | 7128 constexpr RelocOffsetT Offset = 0; |
| 7133 constexpr bool SuppressMangling = true; | 7129 Constant *Symbol = Ctx->getConstantSym(Offset, Label_stream.str()); |
| 7134 Constant *Symbol = | |
| 7135 Ctx->getConstantSym(Offset, Label_stream.str(), SuppressMangling); | |
| 7136 constexpr Variable *NoBase = nullptr; | 7130 constexpr Variable *NoBase = nullptr; |
| 7137 X86OperandMem *MemOperand = | 7131 X86OperandMem *MemOperand = |
| 7138 X86OperandMem::create(Func, Immediate->getType(), NoBase, Symbol); | 7132 X86OperandMem::create(Func, Immediate->getType(), NoBase, Symbol); |
| 7139 _mov(Reg, MemOperand); | 7133 _mov(Reg, MemOperand); |
| 7140 return Reg; | 7134 return Reg; |
| 7141 } | 7135 } |
| 7142 } | 7136 } |
| 7143 } | 7137 } |
| 7144 | 7138 |
| 7145 template <typename TraitsType> | 7139 template <typename TraitsType> |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7228 // Memory operand should never exist as source operands in phi lowering | 7222 // Memory operand should never exist as source operands in phi lowering |
| 7229 // assignments, so there is no need to reuse any registers here. For | 7223 // assignments, so there is no need to reuse any registers here. For |
| 7230 // phi lowering, we should not ask for new physical registers in | 7224 // phi lowering, we should not ask for new physical registers in |
| 7231 // general. However, if we do meet Memory Operand during phi lowering, | 7225 // general. However, if we do meet Memory Operand during phi lowering, |
| 7232 // we should not blind or pool the immediates for now. | 7226 // we should not blind or pool the immediates for now. |
| 7233 if (RegNum.hasValue()) | 7227 if (RegNum.hasValue()) |
| 7234 return MemOperand; | 7228 return MemOperand; |
| 7235 Variable *RegTemp = makeReg(IceType_i32); | 7229 Variable *RegTemp = makeReg(IceType_i32); |
| 7236 IceString Label; | 7230 IceString Label; |
| 7237 llvm::raw_string_ostream Label_stream(Label); | 7231 llvm::raw_string_ostream Label_stream(Label); |
| 7238 MemOperand->getOffset()->emitPoolLabel(Label_stream, Ctx); | 7232 MemOperand->getOffset()->emitPoolLabel(Label_stream); |
| 7239 MemOperand->getOffset()->setShouldBePooled(true); | 7233 MemOperand->getOffset()->setShouldBePooled(true); |
| 7240 constexpr RelocOffsetT SymOffset = 0; | 7234 constexpr RelocOffsetT SymOffset = 0; |
| 7241 constexpr bool SuppressMangling = true; | 7235 Constant *Symbol = Ctx->getConstantSym(SymOffset, Label_stream.str()); |
| 7242 Constant *Symbol = | |
| 7243 Ctx->getConstantSym(SymOffset, Label_stream.str(), SuppressMangling); | |
| 7244 constexpr Variable *NoBase = nullptr; | 7236 constexpr Variable *NoBase = nullptr; |
| 7245 X86OperandMem *SymbolOperand = X86OperandMem::create( | 7237 X86OperandMem *SymbolOperand = X86OperandMem::create( |
| 7246 Func, MemOperand->getOffset()->getType(), NoBase, Symbol); | 7238 Func, MemOperand->getOffset()->getType(), NoBase, Symbol); |
| 7247 _mov(RegTemp, SymbolOperand); | 7239 _mov(RegTemp, SymbolOperand); |
| 7248 // If we have a base variable here, we should add the lea instruction | 7240 // If we have a base variable here, we should add the lea instruction |
| 7249 // to add the value of the base variable to RegTemp. If there is no | 7241 // to add the value of the base variable to RegTemp. If there is no |
| 7250 // base variable, we won't need this lea instruction. | 7242 // base variable, we won't need this lea instruction. |
| 7251 if (MemOperand->getBase()) { | 7243 if (MemOperand->getBase()) { |
| 7252 X86OperandMem *CalculateOperand = X86OperandMem::create( | 7244 X86OperandMem *CalculateOperand = X86OperandMem::create( |
| 7253 Func, MemOperand->getType(), MemOperand->getBase(), nullptr, RegTemp, | 7245 Func, MemOperand->getType(), MemOperand->getBase(), nullptr, RegTemp, |
| 7254 0, MemOperand->getSegmentRegister()); | 7246 0, MemOperand->getSegmentRegister()); |
| 7255 _lea(RegTemp, CalculateOperand); | 7247 _lea(RegTemp, CalculateOperand); |
| 7256 } | 7248 } |
| 7257 X86OperandMem *NewMemOperand = X86OperandMem::create( | 7249 X86OperandMem *NewMemOperand = X86OperandMem::create( |
| 7258 Func, MemOperand->getType(), RegTemp, nullptr, MemOperand->getIndex(), | 7250 Func, MemOperand->getType(), RegTemp, nullptr, MemOperand->getIndex(), |
| 7259 MemOperand->getShift(), MemOperand->getSegmentRegister()); | 7251 MemOperand->getShift(), MemOperand->getSegmentRegister()); |
| 7260 return NewMemOperand; | 7252 return NewMemOperand; |
| 7261 } | 7253 } |
| 7262 } | 7254 } |
| 7263 } | 7255 } |
| 7264 | 7256 |
| 7265 template <typename TraitsType> | 7257 template <typename TraitsType> |
| 7266 void TargetX86Base<TraitsType>::emitJumpTable( | 7258 void TargetX86Base<TraitsType>::emitJumpTable( |
| 7267 const Cfg *Func, const InstJumpTable *JumpTable) const { | 7259 const Cfg *Func, const InstJumpTable *JumpTable) const { |
| 7268 if (!BuildDefs::dump()) | 7260 if (!BuildDefs::dump()) |
| 7269 return; | 7261 return; |
| 7270 Ostream &Str = Ctx->getStrEmit(); | 7262 Ostream &Str = Ctx->getStrEmit(); |
| 7271 const bool UseNonsfi = Ctx->getFlags().getUseNonsfi(); | 7263 const bool UseNonsfi = Ctx->getFlags().getUseNonsfi(); |
| 7272 const IceString MangledName = Ctx->mangleName(Func->getFunctionName()); | 7264 const IceString &FunctionName = Func->getFunctionName(); |
| 7273 const IceString Prefix = UseNonsfi ? ".data.rel.ro." : ".rodata."; | 7265 const IceString Prefix = UseNonsfi ? ".data.rel.ro." : ".rodata."; |
| 7274 Str << "\t.section\t" << Prefix << MangledName | 7266 Str << "\t.section\t" << Prefix << FunctionName |
| 7275 << "$jumptable,\"a\",@progbits\n"; | 7267 << "$jumptable,\"a\",@progbits\n"; |
| 7276 Str << "\t.align\t" << typeWidthInBytes(getPointerType()) << "\n"; | 7268 Str << "\t.align\t" << typeWidthInBytes(getPointerType()) << "\n"; |
| 7277 Str << InstJumpTable::makeName(MangledName, JumpTable->getId()) << ":"; | 7269 Str << InstJumpTable::makeName(FunctionName, JumpTable->getId()) << ":"; |
| 7278 | 7270 |
| 7279 // On X86 ILP32 pointers are 32-bit hence the use of .long | 7271 // On X86 ILP32 pointers are 32-bit hence the use of .long |
| 7280 for (SizeT I = 0; I < JumpTable->getNumTargets(); ++I) | 7272 for (SizeT I = 0; I < JumpTable->getNumTargets(); ++I) |
| 7281 Str << "\n\t.long\t" << JumpTable->getTarget(I)->getAsmName(); | 7273 Str << "\n\t.long\t" << JumpTable->getTarget(I)->getAsmName(); |
| 7282 Str << "\n"; | 7274 Str << "\n"; |
| 7283 } | 7275 } |
| 7284 | 7276 |
| 7285 template <typename TraitsType> | 7277 template <typename TraitsType> |
| 7286 template <typename T> | 7278 template <typename T> |
| 7287 void TargetDataX86<TraitsType>::emitConstantPool(GlobalContext *Ctx) { | 7279 void TargetDataX86<TraitsType>::emitConstantPool(GlobalContext *Ctx) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 7316 // Use memcpy() to copy bits from Value into RawValue in a way that avoids | 7308 // Use memcpy() to copy bits from Value into RawValue in a way that avoids |
| 7317 // breaking strict-aliasing rules. | 7309 // breaking strict-aliasing rules. |
| 7318 typename T::PrimitiveIntType RawValue; | 7310 typename T::PrimitiveIntType RawValue; |
| 7319 memcpy(&RawValue, &Value, sizeof(Value)); | 7311 memcpy(&RawValue, &Value, sizeof(Value)); |
| 7320 char buf[30]; | 7312 char buf[30]; |
| 7321 int CharsPrinted = | 7313 int CharsPrinted = |
| 7322 snprintf(buf, llvm::array_lengthof(buf), T::PrintfString, RawValue); | 7314 snprintf(buf, llvm::array_lengthof(buf), T::PrintfString, RawValue); |
| 7323 assert(CharsPrinted >= 0); | 7315 assert(CharsPrinted >= 0); |
| 7324 assert((size_t)CharsPrinted < llvm::array_lengthof(buf)); | 7316 assert((size_t)CharsPrinted < llvm::array_lengthof(buf)); |
| 7325 (void)CharsPrinted; // avoid warnings if asserts are disabled | 7317 (void)CharsPrinted; // avoid warnings if asserts are disabled |
| 7326 Const->emitPoolLabel(Str, Ctx); | 7318 Const->emitPoolLabel(Str); |
| 7327 Str << ":\n\t" << T::AsmTag << "\t" << buf << "\t/* " << T::TypeName << " " | 7319 Str << ":\n\t" << T::AsmTag << "\t" << buf << "\t/* " << T::TypeName << " " |
| 7328 << Value << " */\n"; | 7320 << Value << " */\n"; |
| 7329 } | 7321 } |
| 7330 } | 7322 } |
| 7331 | 7323 |
| 7332 template <typename TraitsType> | 7324 template <typename TraitsType> |
| 7333 void TargetDataX86<TraitsType>::lowerConstants() { | 7325 void TargetDataX86<TraitsType>::lowerConstants() { |
| 7334 if (Ctx->getFlags().getDisableTranslation()) | 7326 if (Ctx->getFlags().getDisableTranslation()) |
| 7335 return; | 7327 return; |
| 7336 switch (Ctx->getFlags().getOutFileType()) { | 7328 switch (Ctx->getFlags().getOutFileType()) { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7408 emitGlobal(*Var, SectionSuffix); | 7400 emitGlobal(*Var, SectionSuffix); |
| 7409 } | 7401 } |
| 7410 } | 7402 } |
| 7411 } break; | 7403 } break; |
| 7412 } | 7404 } |
| 7413 } | 7405 } |
| 7414 } // end of namespace X86NAMESPACE | 7406 } // end of namespace X86NAMESPACE |
| 7415 } // end of namespace Ice | 7407 } // end of namespace Ice |
| 7416 | 7408 |
| 7417 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H | 7409 #endif // SUBZERO_SRC_ICETARGETLOWERINGX86BASEIMPL_H |
| OLD | NEW |