mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
don't lose tail padding on ConstantDataAggregate vec3's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149222 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1629,15 +1629,10 @@ static void EmitGlobalConstantDataSequential(const ConstantDataSequential *CDS,
|
|||||||
AP.OutStreamer.EmitIntValue(CDS->getElementAsInteger(i),
|
AP.OutStreamer.EmitIntValue(CDS->getElementAsInteger(i),
|
||||||
ElementByteSize, AddrSpace);
|
ElementByteSize, AddrSpace);
|
||||||
}
|
}
|
||||||
return;
|
} else if (ElementByteSize == 4) {
|
||||||
}
|
// FP Constants are printed as integer constants to avoid losing
|
||||||
|
// precision.
|
||||||
// FP Constants are printed as integer constants to avoid losing
|
assert(CDS->getElementType()->isFloatTy());
|
||||||
// precision.
|
|
||||||
assert(CDS->getElementType()->isFloatTy() ||
|
|
||||||
CDS->getElementType()->isDoubleTy());
|
|
||||||
|
|
||||||
if (ElementByteSize == 4) {
|
|
||||||
for (unsigned i = 0, e = CDS->getNumElements(); i != e; ++i) {
|
for (unsigned i = 0, e = CDS->getNumElements(); i != e; ++i) {
|
||||||
union {
|
union {
|
||||||
float F;
|
float F;
|
||||||
@@ -1649,20 +1644,28 @@ static void EmitGlobalConstantDataSequential(const ConstantDataSequential *CDS,
|
|||||||
AP.OutStreamer.GetCommentOS() << "float " << F << '\n';
|
AP.OutStreamer.GetCommentOS() << "float " << F << '\n';
|
||||||
AP.OutStreamer.EmitIntValue(I, 4, AddrSpace);
|
AP.OutStreamer.EmitIntValue(I, 4, AddrSpace);
|
||||||
}
|
}
|
||||||
return;
|
} else {
|
||||||
|
assert(CDS->getElementType()->isDoubleTy());
|
||||||
|
for (unsigned i = 0, e = CDS->getNumElements(); i != e; ++i) {
|
||||||
|
union {
|
||||||
|
double F;
|
||||||
|
uint64_t I;
|
||||||
|
};
|
||||||
|
|
||||||
|
F = CDS->getElementAsDouble(i);
|
||||||
|
if (AP.isVerbose())
|
||||||
|
AP.OutStreamer.GetCommentOS() << "double " << F << '\n';
|
||||||
|
AP.OutStreamer.EmitIntValue(I, 8, AddrSpace);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned i = 0, e = CDS->getNumElements(); i != e; ++i) {
|
const TargetData &TD = *AP.TM.getTargetData();
|
||||||
union {
|
unsigned Size = TD.getTypeAllocSize(CDS->getType());
|
||||||
double F;
|
unsigned EmittedSize = TD.getTypeAllocSize(CDS->getType()->getElementType()) *
|
||||||
uint64_t I;
|
CDS->getNumElements();
|
||||||
};
|
if (unsigned Padding = Size - EmittedSize)
|
||||||
|
AP.OutStreamer.EmitZeros(Padding, AddrSpace);
|
||||||
F = CDS->getElementAsDouble(i);
|
|
||||||
if (AP.isVerbose())
|
|
||||||
AP.OutStreamer.GetCommentOS() << "double " << F << '\n';
|
|
||||||
AP.OutStreamer.EmitIntValue(I, 8, AddrSpace);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void EmitGlobalConstantArray(const ConstantArray *CA, unsigned AddrSpace,
|
static void EmitGlobalConstantArray(const ConstantArray *CA, unsigned AddrSpace,
|
||||||
|
Reference in New Issue
Block a user