diff options
| author | Owen Anderson <resistor@mac.com> | 2007-01-20 23:07:13 +0000 |
|---|---|---|
| committer | Owen Anderson <resistor@mac.com> | 2007-01-20 23:07:13 +0000 |
| commit | e52a235e992fa5f14145d5865e79cb28aa11588d (patch) | |
| tree | d800208423320811ddf1a406c61e5ff0b8beaa56 /llvm/lib/Target/TargetData.cpp | |
| parent | 6e38094235139241efca320114b47edc9e3c880b (diff) | |
| download | bcm5719-llvm-e52a235e992fa5f14145d5865e79cb28aa11588d.tar.gz bcm5719-llvm-e52a235e992fa5f14145d5865e79cb28aa11588d.zip | |
TargetData assumes (and some regression tests depend on it) that the size of
an unspecified datatype in the datalayout is capped by the size of a pointer.
llvm-svn: 33411
Diffstat (limited to 'llvm/lib/Target/TargetData.cpp')
| -rw-r--r-- | llvm/lib/Target/TargetData.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/llvm/lib/Target/TargetData.cpp b/llvm/lib/Target/TargetData.cpp index 0ae2e1a638b..3cfdd40ddd4 100644 --- a/llvm/lib/Target/TargetData.cpp +++ b/llvm/lib/Target/TargetData.cpp @@ -103,9 +103,9 @@ void TargetData::init(const std::string &TargetDescription) { LittleEndian = false; PointerMemSize = 8; PointerABIAlignment = 8; - DoubleABIAlignment = 8; + DoubleABIAlignment = 0; FloatABIAlignment = 4; - LongABIAlignment = 8; + LongABIAlignment = 0; IntABIAlignment = 4; ShortABIAlignment = 2; ByteABIAlignment = 1; @@ -114,9 +114,9 @@ void TargetData::init(const std::string &TargetDescription) { BytePrefAlignment = ByteABIAlignment; ShortPrefAlignment = ShortABIAlignment; IntPrefAlignment = IntABIAlignment; - LongPrefAlignment = LongABIAlignment; + LongPrefAlignment = 8; FloatPrefAlignment = FloatABIAlignment; - DoublePrefAlignment = DoubleABIAlignment; + DoublePrefAlignment = 8; PointerPrefAlignment = PointerABIAlignment; AggMinPrefAlignment = 0; @@ -188,6 +188,13 @@ void TargetData::init(const std::string &TargetDescription) { break; } } + + // Unless explicitly specified, the alignments for longs and doubles is capped by + // pointer size. + if (LongABIAlignment == 0) + LongABIAlignment = LongPrefAlignment = PointerMemSize; + if (DoubleABIAlignment == 0) + DoubleABIAlignment = DoublePrefAlignment = PointerMemSize; } TargetData::TargetData(const Module *M) { |

