Skip to content

Commit 5533629

Browse files
author
Dylan McKay
committed
[AVR] Update the data layout
The previous data layout caused issues when dealing with atomics. Foe example, it is illegal to load a 16-bit value with less than 16-bits of alignment. This changes the data layout so that all types are aligned by at least their own width. Interestingly, this also _slightly_ decreased register pressure in some cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@282587 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 38e3973 commit 5533629

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/Target/AVR/AVRTargetMachine.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525

2626
namespace llvm {
2727

28+
static const char *AVRDataLayout = "e-p:16:16:16-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-n8";
29+
2830
/// Processes a CPU name.
2931
static StringRef getCPU(StringRef CPU) {
3032
if (CPU.empty() || CPU == "generic") {
@@ -44,7 +46,7 @@ AVRTargetMachine::AVRTargetMachine(const Target &T, const Triple &TT,
4446
Optional<Reloc::Model> RM, CodeModel::Model CM,
4547
CodeGenOpt::Level OL)
4648
: LLVMTargetMachine(
47-
T, "e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8-i64:8:8-f32:8:8-f64:8:8-n8", TT,
49+
T, AVRDataLayout, TT,
4850
getCPU(CPU), FS, Options, getEffectiveRelocModel(RM), CM, OL),
4951
SubTarget(TT, getCPU(CPU), FS, *this) {
5052
this->TLOF = make_unique<AVRTargetObjectFile>();

0 commit comments

Comments
 (0)