mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 21:29:20 +00:00
EmitAlignment() also emits optional fill value.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40500 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d88ea4d9aa
commit
73a259a9d1
@ -251,7 +251,9 @@ namespace llvm {
|
|||||||
/// an explicit alignment requested, it will unconditionally override the
|
/// an explicit alignment requested, it will unconditionally override the
|
||||||
/// alignment request. However, if ForcedAlignBits is specified, this value
|
/// alignment request. However, if ForcedAlignBits is specified, this value
|
||||||
/// has final say: the ultimate alignment will be the max of ForcedAlignBits
|
/// has final say: the ultimate alignment will be the max of ForcedAlignBits
|
||||||
/// and the alignment computed with NumBits and the global.
|
/// and the alignment computed with NumBits and the global. If UseFillExpr
|
||||||
|
/// is true, it also emits an optional second value FillValue which the
|
||||||
|
/// assembler uses to fill gaps to match alignment.
|
||||||
///
|
///
|
||||||
/// The algorithm is:
|
/// The algorithm is:
|
||||||
/// Align = NumBits;
|
/// Align = NumBits;
|
||||||
@ -259,7 +261,8 @@ namespace llvm {
|
|||||||
/// Align = std::max(Align, ForcedAlignBits);
|
/// Align = std::max(Align, ForcedAlignBits);
|
||||||
///
|
///
|
||||||
void EmitAlignment(unsigned NumBits, const GlobalValue *GV = 0,
|
void EmitAlignment(unsigned NumBits, const GlobalValue *GV = 0,
|
||||||
unsigned ForcedAlignBits = 0) const;
|
unsigned ForcedAlignBits = 0, bool UseFillExpr = false,
|
||||||
|
unsigned FillValue = 0) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// EmitZeros - Emit a block of zeros.
|
/// EmitZeros - Emit a block of zeros.
|
||||||
|
@ -621,14 +621,17 @@ void AsmPrinter::EmitString(const std::string &String) const {
|
|||||||
// Align = std::max(Align, ForcedAlignBits);
|
// Align = std::max(Align, ForcedAlignBits);
|
||||||
//
|
//
|
||||||
void AsmPrinter::EmitAlignment(unsigned NumBits, const GlobalValue *GV,
|
void AsmPrinter::EmitAlignment(unsigned NumBits, const GlobalValue *GV,
|
||||||
unsigned ForcedAlignBits) const {
|
unsigned ForcedAlignBits, bool UseFillExpr,
|
||||||
|
unsigned FillValue) const {
|
||||||
if (GV && GV->getAlignment())
|
if (GV && GV->getAlignment())
|
||||||
NumBits = Log2_32(GV->getAlignment());
|
NumBits = Log2_32(GV->getAlignment());
|
||||||
NumBits = std::max(NumBits, ForcedAlignBits);
|
NumBits = std::max(NumBits, ForcedAlignBits);
|
||||||
|
|
||||||
if (NumBits == 0) return; // No need to emit alignment.
|
if (NumBits == 0) return; // No need to emit alignment.
|
||||||
if (TAI->getAlignmentIsInBytes()) NumBits = 1 << NumBits;
|
if (TAI->getAlignmentIsInBytes()) NumBits = 1 << NumBits;
|
||||||
O << TAI->getAlignDirective() << NumBits << "\n";
|
O << TAI->getAlignDirective() << NumBits;
|
||||||
|
if (UseFillExpr) O << ",0x" << std::hex << FillValue << std::dec;
|
||||||
|
O << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user