* Add a BoolAlignment field to TargetData, default is 1 byte

* Fix spacing


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15119 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Misha Brukman 2004-07-23 01:08:13 +00:00
parent a7bfbba856
commit e3fa53ee4d
2 changed files with 20 additions and 16 deletions

View File

@ -34,7 +34,8 @@ class StructLayout;
class TargetData : public ImmutablePass { class TargetData : public ImmutablePass {
bool LittleEndian; // Defaults to false bool LittleEndian; // Defaults to false
unsigned char ByteAlignment; // Defaults to 1 bytes unsigned char BoolAlignment; // Defaults to 1 byte
unsigned char ByteAlignment; // Defaults to 1 byte
unsigned char ShortAlignment; // Defaults to 2 bytes unsigned char ShortAlignment; // Defaults to 2 bytes
unsigned char IntAlignment; // Defaults to 4 bytes unsigned char IntAlignment; // Defaults to 4 bytes
unsigned char LongAlignment; // Defaults to 8 bytes unsigned char LongAlignment; // Defaults to 8 bytes
@ -50,20 +51,21 @@ public:
unsigned char PtrAl = 8, unsigned char DoubleAl = 8, unsigned char PtrAl = 8, unsigned char DoubleAl = 8,
unsigned char FloatAl = 4, unsigned char LongAl = 8, unsigned char FloatAl = 4, unsigned char LongAl = 8,
unsigned char IntAl = 4, unsigned char ShortAl = 2, unsigned char IntAl = 4, unsigned char ShortAl = 2,
unsigned char ByteAl = 1); unsigned char ByteAl = 1, unsigned char BoolAl = 1);
// Copy constructor // Copy constructor
TargetData (const TargetData &TD) : TargetData (const TargetData &TD) :
ImmutablePass (), ImmutablePass(),
LittleEndian (TD.isLittleEndian ()), LittleEndian(TD.isLittleEndian()),
ByteAlignment (TD.getByteAlignment ()), BoolAlignment(TD.getBoolAlignment()),
ShortAlignment (TD.getShortAlignment ()), ByteAlignment(TD.getByteAlignment()),
IntAlignment (TD.getIntAlignment ()), ShortAlignment(TD.getShortAlignment()),
LongAlignment (TD.getLongAlignment ()), IntAlignment(TD.getIntAlignment()),
FloatAlignment (TD.getFloatAlignment ()), LongAlignment(TD.getLongAlignment()),
DoubleAlignment (TD.getDoubleAlignment ()), FloatAlignment(TD.getFloatAlignment()),
PointerSize (TD.getPointerSize ()), DoubleAlignment(TD.getDoubleAlignment()),
PointerAlignment (TD.getPointerAlignment ()) { PointerSize(TD.getPointerSize()),
PointerAlignment(TD.getPointerAlignment()) {
} }
TargetData(const std::string &ToolName, const Module *M); TargetData(const std::string &ToolName, const Module *M);
@ -74,6 +76,7 @@ public:
bool isBigEndian() const { return !LittleEndian; } bool isBigEndian() const { return !LittleEndian; }
/// Target alignment constraints /// Target alignment constraints
unsigned char getBoolAlignment() const { return BoolAlignment; }
unsigned char getByteAlignment() const { return ByteAlignment; } unsigned char getByteAlignment() const { return ByteAlignment; }
unsigned char getShortAlignment() const { return ShortAlignment; } unsigned char getShortAlignment() const { return ShortAlignment; }
unsigned char getIntAlignment() const { return IntAlignment; } unsigned char getIntAlignment() const { return IntAlignment; }

View File

@ -51,7 +51,8 @@ protected: // Can only create subclasses...
unsigned char PtrSize = 8, unsigned char PtrAl = 8, unsigned char PtrSize = 8, unsigned char PtrAl = 8,
unsigned char DoubleAl = 8, unsigned char FloatAl = 4, unsigned char DoubleAl = 8, unsigned char FloatAl = 4,
unsigned char LongAl = 8, unsigned char IntAl = 4, unsigned char LongAl = 8, unsigned char IntAl = 4,
unsigned char ShortAl = 2, unsigned char ByteAl = 1); unsigned char ShortAl = 2, unsigned char ByteAl = 1,
unsigned char BoolAl = 1);
/// This constructor is used for targets that support arbitrary TargetData /// This constructor is used for targets that support arbitrary TargetData
/// layouts, like the C backend. It initializes the TargetData to match that /// layouts, like the C backend. It initializes the TargetData to match that