llvm.org GIT mirror llvm / 33cc3f8
Remove the 's' DataLayout specification During the years there have been some attempts at figuring out how to align byval arguments. A look at the commit log suggests that they were * Use the ABI alignment. * When that was not sufficient for x86-64, I added the 's' specification to DataLayout. * When that was not sufficient Evan added the virtual getByValTypeAlignment. * When even that was not sufficient, we just got the FE to add the alignment to the byval. This patch is just a simple cleanup that removes my first attempt at fixing the problem. I also added an AArch64 implementation of getByValTypeAlignment to make sure this patch is a nop. I also left the 's' parsing for backward compatibility. I will send a short email to llvmdev about the change for anyone maintaining an out of tree target. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198287 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 6 years ago
9 changed file(s) with 17 addition(s) and 27 deletion(s). Raw diff Collapse all Expand all
11581158 targets.
11591159 ``a::``
11601160 This specifies the alignment for an aggregate type of a given bit
1161 ````.
1162 ``s::``
1163 This specifies the alignment for a stack object of a given bit
11641161 ````.
11651162 ``n::...``
11661163 This specifies a set of native integer widths for the target CPU in
4444 INTEGER_ALIGN = 'i', ///< Integer type alignment
4545 VECTOR_ALIGN = 'v', ///< Vector type alignment
4646 FLOAT_ALIGN = 'f', ///< Floating point type alignment
47 AGGREGATE_ALIGN = 'a', ///< Aggregate alignment
48 STACK_ALIGN = 's' ///< Stack objects alignment
47 AGGREGATE_ALIGN = 'a' ///< Aggregate alignment
4948 };
5049
5150 /// Layout alignment element.
342341 /// getABIIntegerTypeAlignment - Return the minimum ABI-required alignment for
343342 /// an integer type of the specified bitwidth.
344343 unsigned getABIIntegerTypeAlignment(unsigned BitWidth) const;
345
346 /// getCallFrameTypeAlignment - Return the minimum ABI-required alignment
347 /// for the specified type when it is part of a call frame.
348 unsigned getCallFrameTypeAlignment(Type *Ty) const;
349344
350345 /// getPrefTypeAlignment - Return the preferred stack/global alignment for
351346 /// the specified type. This is always at least as good as the ABI alignment.
12841284 /// function arguments in the caller parameter area. This is the actual
12851285 /// alignment, not its logarithm.
12861286 unsigned TargetLoweringBase::getByValTypeAlignment(Type *Ty) const {
1287 return TD->getCallFrameTypeAlignment(Ty);
1287 return TD->getABITypeAlignment(Ty);
12881288 }
12891289
12901290 //===----------------------------------------------------------------------===//
224224 Tok = Tok.substr(1);
225225
226226 switch (Specifier) {
227 case 's':
228 // Ignored for backward compatibility.
229 // FIXME: remove this on LLVM 4.0.
230 break;
227231 case 'E':
228232 LittleEndian = false;
229233 break;
258262 case 'i':
259263 case 'v':
260264 case 'f':
261 case 'a':
262 case 's': {
265 case 'a': {
263266 AlignTypeEnum AlignType;
264267 switch (Specifier) {
265268 default:
267270 case 'v': AlignType = VECTOR_ALIGN; break;
268271 case 'f': AlignType = FLOAT_ALIGN; break;
269272 case 'a': AlignType = AGGREGATE_ALIGN; break;
270 case 's': AlignType = STACK_ALIGN; break;
271273 }
272274
273275 // Bit size.
616618 return getAlignmentInfo(INTEGER_ALIGN, BitWidth, true, 0);
617619 }
618620
619 unsigned DataLayout::getCallFrameTypeAlignment(Type *Ty) const {
620 for (unsigned i = 0, e = Alignments.size(); i != e; ++i)
621 if (Alignments[i].AlignType == STACK_ALIGN)
622 return Alignments[i].ABIAlign;
623
624 return getABITypeAlignment(Ty);
625 }
626
627621 unsigned DataLayout::getPrefTypeAlignment(Type *Ty) const {
628622 return getAlignment(Ty, false);
629623 }
13451345 &RetOps[0], RetOps.size());
13461346 }
13471347
1348 unsigned AArch64TargetLowering::getByValTypeAlignment(Type *Ty) const {
1349 // This is a new backend. For anything more precise than this a FE should
1350 // set an explicit alignment.
1351 return 4;
1352 }
1353
13481354 SDValue
13491355 AArch64TargetLowering::LowerCall(CallLoweringInfo &CLI,
13501356 SmallVectorImpl &InVals) const {
219219 const SmallVectorImpl &Outs,
220220 const SmallVectorImpl &OutVals,
221221 SDLoc dl, SelectionDAG &DAG) const;
222
223 virtual unsigned getByValTypeAlignment(Type *Ty) const LLVM_OVERRIDE;
222224
223225 SDValue LowerCall(CallLoweringInfo &CLI,
224226 SmallVectorImpl &InVals) const;
3333 : LLVMTargetMachine(T, TT, CPU, FS, Options, RM, CM, OL),
3434 Subtarget(TT, CPU, FS),
3535 InstrInfo(Subtarget),
36 DL("e-i64:64-i128:128-s:32-n32:64-S128"),
36 DL("e-i64:64-i128:128-n32:64-S128"),
3737 TLInfo(*this),
3838 TSInfo(*this),
3939 FrameLowering(Subtarget) {
112112 }
113113
114114 unsigned LLVMCallFrameAlignmentOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty) {
115 return unwrap(TD)->getCallFrameTypeAlignment(unwrap(Ty));
115 return unwrap(TD)->getABITypeAlignment(unwrap(Ty));
116116 }
117117
118118 unsigned LLVMPreferredAlignmentOfType(LLVMTargetDataRef TD, LLVMTypeRef Ty) {
5151 Ret += "-f80:128";
5252 else
5353 Ret += "-f80:32";
54
55 // Objects on the stack ore aligned to 64 bits.
56 if (ST.is64Bit())
57 Ret += "-s:64";
5854
5955 // The registers can hold 8, 16, 32 or, in x86-64, 64 bits.
6056 if (ST.is64Bit())