mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 11:02:59 +02:00
Move MaximumAlignment to be a member of the Value class.
llvm-svn: 109891
This commit is contained in:
parent
4e6f48d705
commit
230d92b375
@ -307,6 +307,10 @@ public:
|
|||||||
return const_cast<Value*>(this)->DoPHITranslation(CurBB, PredBB);
|
return const_cast<Value*>(this)->DoPHITranslation(CurBB, PredBB);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// MaximumAlignment - This is the greatest alignment value supported by
|
||||||
|
/// load, store, and alloca instructions, and global values.
|
||||||
|
static const unsigned MaximumAlignment = 1u << 29;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
unsigned short getSubclassDataFromValue() const { return SubclassData; }
|
unsigned short getSubclassDataFromValue() const { return SubclassData; }
|
||||||
void setValueSubclassData(unsigned short D) { SubclassData = D; }
|
void setValueSubclassData(unsigned short D) { SubclassData = D; }
|
||||||
@ -401,10 +405,6 @@ public:
|
|||||||
enum { NumLowBitsAvailable = 2 };
|
enum { NumLowBitsAvailable = 2 };
|
||||||
};
|
};
|
||||||
|
|
||||||
/// MaximumAlignment - This is the greatest alignment value supported by
|
|
||||||
/// load, store, and alloca instructions, and global values.
|
|
||||||
static const unsigned MaximumAlignment = 1u << 29;
|
|
||||||
|
|
||||||
} // End llvm namespace
|
} // End llvm namespace
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1154,7 +1154,7 @@ bool LLParser::ParseOptionalAlignment(unsigned &Alignment) {
|
|||||||
if (ParseUInt32(Alignment)) return true;
|
if (ParseUInt32(Alignment)) return true;
|
||||||
if (!isPowerOf2_32(Alignment))
|
if (!isPowerOf2_32(Alignment))
|
||||||
return Error(AlignLoc, "alignment is not a power of two");
|
return Error(AlignLoc, "alignment is not a power of two");
|
||||||
if (Alignment > MaximumAlignment)
|
if (Alignment > Value::MaximumAlignment)
|
||||||
return Error(AlignLoc, "huge alignments are not supported yet");
|
return Error(AlignLoc, "huge alignments are not supported yet");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -109,9 +109,10 @@ unsigned InstCombiner::GetOrEnforceKnownAlignment(Value *V,
|
|||||||
TrailZ = std::min(TrailZ, unsigned(sizeof(unsigned) * CHAR_BIT - 1));
|
TrailZ = std::min(TrailZ, unsigned(sizeof(unsigned) * CHAR_BIT - 1));
|
||||||
|
|
||||||
unsigned Align = 1u << std::min(BitWidth - 1, TrailZ);
|
unsigned Align = 1u << std::min(BitWidth - 1, TrailZ);
|
||||||
|
unsigned MaxAlign = Value::MaximumAlignment;
|
||||||
|
|
||||||
// LLVM doesn't support alignments larger than this currently.
|
// LLVM doesn't support alignments larger than this currently.
|
||||||
Align = std::min(Align, MaximumAlignment);
|
Align = std::min(Align, MaxAlign);
|
||||||
|
|
||||||
if (PrefAlign > Align)
|
if (PrefAlign > Align)
|
||||||
Align = EnforceKnownAlignment(V, Align, PrefAlign);
|
Align = EnforceKnownAlignment(V, Align, PrefAlign);
|
||||||
|
Loading…
Reference in New Issue
Block a user