* 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 {
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 IntAlignment; // Defaults to 4 bytes
unsigned char LongAlignment; // Defaults to 8 bytes
@ -47,23 +48,24 @@ public:
TargetData(const std::string &TargetName = "",
bool LittleEndian = false,
unsigned char PtrSize = 8,
unsigned char PtrAl = 8, unsigned char DoubleAl = 8,
unsigned char FloatAl = 4, unsigned char LongAl = 8,
unsigned char IntAl = 4, unsigned char ShortAl = 2,
unsigned char ByteAl = 1);
unsigned char PtrAl = 8, unsigned char DoubleAl = 8,
unsigned char FloatAl = 4, unsigned char LongAl = 8,
unsigned char IntAl = 4, unsigned char ShortAl = 2,
unsigned char ByteAl = 1, unsigned char BoolAl = 1);
// Copy constructor
TargetData (const TargetData &TD) :
ImmutablePass (),
LittleEndian (TD.isLittleEndian ()),
ByteAlignment (TD.getByteAlignment ()),
ShortAlignment (TD.getShortAlignment ()),
IntAlignment (TD.getIntAlignment ()),
LongAlignment (TD.getLongAlignment ()),
FloatAlignment (TD.getFloatAlignment ()),
DoubleAlignment (TD.getDoubleAlignment ()),
PointerSize (TD.getPointerSize ()),
PointerAlignment (TD.getPointerAlignment ()) {
ImmutablePass(),
LittleEndian(TD.isLittleEndian()),
BoolAlignment(TD.getBoolAlignment()),
ByteAlignment(TD.getByteAlignment()),
ShortAlignment(TD.getShortAlignment()),
IntAlignment(TD.getIntAlignment()),
LongAlignment(TD.getLongAlignment()),
FloatAlignment(TD.getFloatAlignment()),
DoubleAlignment(TD.getDoubleAlignment()),
PointerSize(TD.getPointerSize()),
PointerAlignment(TD.getPointerAlignment()) {
}
TargetData(const std::string &ToolName, const Module *M);
@ -74,6 +76,7 @@ public:
bool isBigEndian() const { return !LittleEndian; }
/// Target alignment constraints
unsigned char getBoolAlignment() const { return BoolAlignment; }
unsigned char getByteAlignment() const { return ByteAlignment; }
unsigned char getShortAlignment() const { return ShortAlignment; }
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 DoubleAl = 8, unsigned char FloatAl = 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
/// layouts, like the C backend. It initializes the TargetData to match that