mirror of
https://github.com/RPCS3/llvm.git
synced 2025-04-16 04:52:16 +00:00
Make sure the buffer, which containas an instance of APFloat, has proper alignment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170486 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5469f605fe
commit
d6b51d1dc1
@ -65,11 +65,11 @@ namespace {
|
|||||||
private:
|
private:
|
||||||
bool insaneIntVal(int V) { return V > 4 || V < -4; }
|
bool insaneIntVal(int V) { return V > 4 || V < -4; }
|
||||||
APFloat *getFpValPtr(void)
|
APFloat *getFpValPtr(void)
|
||||||
{ return reinterpret_cast<APFloat*>(&FpValBuf[0]); }
|
{ return reinterpret_cast<APFloat*>(&FpValBuf.buffer[0]); }
|
||||||
|
|
||||||
const APFloat &getFpVal(void) const {
|
const APFloat &getFpVal(void) const {
|
||||||
assert(IsFp && BufHasFpVal && "Incorret state");
|
assert(IsFp && BufHasFpVal && "Incorret state");
|
||||||
return *reinterpret_cast<const APFloat*>(&FpValBuf[0]);
|
return *reinterpret_cast<const APFloat*>(&FpValBuf.buffer[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
APFloat &getFpVal(void)
|
APFloat &getFpVal(void)
|
||||||
@ -78,6 +78,7 @@ namespace {
|
|||||||
bool isInt() const { return !IsFp; }
|
bool isInt() const { return !IsFp; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
bool IsFp;
|
bool IsFp;
|
||||||
|
|
||||||
// True iff FpValBuf contains an instance of APFloat.
|
// True iff FpValBuf contains an instance of APFloat.
|
||||||
@ -88,11 +89,8 @@ namespace {
|
|||||||
// two instructions. So the range of <IntVal> falls in [-4, 4]. APInt
|
// two instructions. So the range of <IntVal> falls in [-4, 4]. APInt
|
||||||
// is overkill of this end.
|
// is overkill of this end.
|
||||||
short IntVal;
|
short IntVal;
|
||||||
|
|
||||||
union {
|
AlignedCharArrayUnion<APFloat> FpValBuf;
|
||||||
char FpValBuf[sizeof(APFloat)];
|
|
||||||
int dummy; // So this structure has at least 4-byte alignment.
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// FAddend is used to represent floating-point addend. An addend is
|
/// FAddend is used to represent floating-point addend. An addend is
|
||||||
|
Loading…
x
Reference in New Issue
Block a user