mirror of
https://github.com/RPCS3/llvm.git
synced 2024-12-16 16:37:42 +00:00
Fix infinite recursion in MCAsmStreamer::EmitValueImpl.
If a target can only emit 8-bits data, we would loop in EmitValueImpl since it will try to split a 32-bits data in 1 chunk of 32-bits. No test since all current targets can emit 32bits at a time. Patch by Alexandru Guduleasa! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@259399 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
59e213f5f1
commit
74894f721a
@ -720,17 +720,15 @@ void MCAsmStreamer::EmitValueImpl(const MCExpr *Value, unsigned Size,
|
||||
report_fatal_error("Don't know how to emit this value.");
|
||||
|
||||
// We couldn't handle the requested integer size so we fallback by breaking
|
||||
// the request down into several, smaller, integers. Since sizes greater
|
||||
// than eight are invalid and size equivalent to eight should have been
|
||||
// handled earlier, we use four bytes as our largest piece of granularity.
|
||||
// the request down into several, smaller, integers.
|
||||
// Since sizes greater or equal to "Size" are invalid, we use the greatest
|
||||
// power of 2 that is less than "Size" as our largest piece of granularity.
|
||||
bool IsLittleEndian = MAI->isLittleEndian();
|
||||
for (unsigned Emitted = 0; Emitted != Size;) {
|
||||
unsigned Remaining = Size - Emitted;
|
||||
// The size of our partial emission must be a power of two less than
|
||||
// eight.
|
||||
unsigned EmissionSize = PowerOf2Floor(Remaining);
|
||||
if (EmissionSize > 4)
|
||||
EmissionSize = 4;
|
||||
// Size.
|
||||
unsigned EmissionSize = PowerOf2Floor(std::min(Remaining, Size - 1));
|
||||
// Calculate the byte offset of our partial emission taking into account
|
||||
// the endianness of the target.
|
||||
unsigned ByteOffset =
|
||||
|
Loading…
Reference in New Issue
Block a user