llvm.org GIT mirror llvm / d054eda
Add support for -mstrict-align compiler option for ARM targets. rdar://12340498 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167620 91177308-0d34-0410-b5e6-96231b3b80d8 Chad Rosier 7 years ago
3 changed file(s) with 18 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
4747 UseSoftFloat(false), NoZerosInBSS(false), JITExceptionHandling(false),
4848 JITEmitDebugInfo(false), JITEmitDebugInfoToDisk(false),
4949 GuaranteedTailCallOpt(false), DisableTailCalls(false),
50 StackAlignmentOverride(0), RealignStack(true), EnableFastISel(false),
51 PositionIndependentExecutable(false), EnableSegmentedStacks(false),
52 UseInitArray(false), TrapFuncName(""), FloatABIType(FloatABI::Default),
53 AllowFPOpFusion(FPOpFusion::Standard)
50 StackAlignmentOverride(0), RealignStack(true), StrictAlign(false),
51 EnableFastISel(false), PositionIndependentExecutable(false),
52 EnableSegmentedStacks(false), UseInitArray(false), TrapFuncName(""),
53 FloatABIType(FloatABI::Default), AllowFPOpFusion(FPOpFusion::Standard)
5454 {}
5555
5656 /// PrintMachineCode - This flag is enabled when the -print-machineinstrs
153153 /// RealignStack - This flag indicates whether the stack should be
154154 /// automatically realigned, if needed.
155155 unsigned RealignStack : 1;
156
157 /// StrictAlign - This flag indicates that all memory accesses must be
158 /// aligned. (ARM only)
159 unsigned StrictAlign : 1;
156160
157161 /// SSPBufferSize - The minimum size of buffers that will receive stack
158162 /// smashing protection when -fstack-protection is used.
10271027 RC = &ARM::GPRRegClass;
10281028 break;
10291029 case MVT::i16:
1030 if (Alignment && Alignment < 2 && !Subtarget->allowsUnalignedMem())
1030 if (Alignment && Alignment < 2 && (!Subtarget->allowsUnalignedMem() ||
1031 TM.Options.StrictAlign))
10311032 return false;
10321033
10331034 if (isThumb2) {
10421043 RC = &ARM::GPRRegClass;
10431044 break;
10441045 case MVT::i32:
1045 if (Alignment && Alignment < 4 && !Subtarget->allowsUnalignedMem())
1046 if (Alignment && Alignment < 4 && (!Subtarget->allowsUnalignedMem() ||
1047 TM.Options.StrictAlign))
10461048 return false;
10471049
10481050 if (isThumb2) {
11511153 }
11521154 break;
11531155 case MVT::i16:
1154 if (Alignment && Alignment < 2 && !Subtarget->allowsUnalignedMem())
1156 if (Alignment && Alignment < 2 && (!Subtarget->allowsUnalignedMem() ||
1157 TM.Options.StrictAlign))
11551158 return false;
11561159
11571160 if (isThumb2) {
11651168 }
11661169 break;
11671170 case MVT::i32:
1168 if (Alignment && Alignment < 4 && !Subtarget->allowsUnalignedMem())
1171 if (Alignment && Alignment < 4 && (!Subtarget->allowsUnalignedMem() ||
1172 TM.Options.StrictAlign))
11691173 return false;
11701174
11711175 if (isThumb2) {
91189118
91199119 bool ARMTargetLowering::allowsUnalignedMemoryAccesses(EVT VT) const {
91209120 // The AllowsUnaliged flag models the SCTLR.A setting in ARM cpus
9121 bool AllowsUnaligned = Subtarget->allowsUnalignedMem();
9121 bool AllowsUnaligned = Subtarget->allowsUnalignedMem() &&
9122 !getTargetMachine().Options.StrictAlign;
91229123
91239124 switch (VT.getSimpleVT().SimpleTy) {
91249125 default: