~ubuntu-branches/ubuntu/trusty/llvm-toolchain-snapshot/trusty-201310232150

« back to all changes in this revision

Viewing changes to lib/Target/ARM/ARMSubtarget.cpp

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-05-27 15:01:57 UTC
  • mfrom: (0.10.1) (0.9.1) (0.8.1) (0.7.1) (0.6.1) (0.5.2)
  • Revision ID: package-import@ubuntu.com-20130527150157-tdkrsjpuvht7v0qx
Tags: 1:3.4~svn182733-1~exp1
* New snapshot release (3.4 release)
* Add a symlink of libLLVM-3.4.so.1 to usr/lib/llvm-3.4/lib/libLLVM-3.4.so
    to fix make the llvm-config-3.4 --libdir work (Closes: #708677)
  * Various packages rename to allow co installations:
    * libclang1 => libclang1-3.4
    * libclang1-dbg => libclang1-3.4-dbg
    * libclang-dev => libclang-3.4-dev
    * libclang-common-dev => libclang-common-3.4-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
UseFusedMulOps("arm-use-mulops",
39
39
               cl::init(true), cl::Hidden);
40
40
 
41
 
static cl::opt<bool>
42
 
StrictAlign("arm-strict-align", cl::Hidden,
43
 
            cl::desc("Disallow all unaligned memory accesses"));
 
41
enum AlignMode {
 
42
  DefaultAlign,
 
43
  StrictAlign,
 
44
  NoStrictAlign
 
45
};
 
46
 
 
47
static cl::opt<AlignMode>
 
48
Align(cl::desc("Load/store alignment support"),
 
49
      cl::Hidden, cl::init(DefaultAlign),
 
50
      cl::values(
 
51
          clEnumValN(DefaultAlign,  "arm-default-align",
 
52
                     "Generate unaligned accesses only on hardware/OS "
 
53
                     "combinations that are known to support them"),
 
54
          clEnumValN(StrictAlign,   "arm-strict-align",
 
55
                     "Disallow all unaligned memory accesses"),
 
56
          clEnumValN(NoStrictAlign, "arm-no-strict-align",
 
57
                     "Allow unaligned memory accesses"),
 
58
          clEnumValEnd));
44
59
 
45
60
ARMSubtarget::ARMSubtarget(const std::string &TT, const std::string &CPU,
46
61
                           const std::string &FS, const TargetOptions &Options)
91
106
  HasRAS = false;
92
107
  HasMPExtension = false;
93
108
  FPOnlySP = false;
 
109
  HasPerfMon = false;
94
110
  HasTrustZone = false;
95
111
  AllowsUnalignedMem = false;
96
112
  Thumb2DSP = false;
162
178
  if (!isThumb() || hasThumb2())
163
179
    PostRAScheduler = true;
164
180
 
165
 
  // v6+ may or may not support unaligned mem access depending on the system
166
 
  // configuration.
167
 
  if (!StrictAlign && hasV6Ops() && isTargetDarwin())
168
 
    AllowsUnalignedMem = true;
 
181
  switch (Align) {
 
182
    case DefaultAlign:
 
183
      // Assume pre-ARMv6 doesn't support unaligned accesses.
 
184
      //
 
185
      // ARMv6 may or may not support unaligned accesses depending on the
 
186
      // SCTLR.U bit, which is architecture-specific. We assume ARMv6
 
187
      // Darwin targets support unaligned accesses, and others don't.
 
188
      //
 
189
      // ARMv7 always has SCTLR.U set to 1, but it has a new SCTLR.A bit
 
190
      // which raises an alignment fault on unaligned accesses. Linux
 
191
      // defaults this bit to 0 and handles it as a system-wide (not
 
192
      // per-process) setting. It is therefore safe to assume that ARMv7+
 
193
      // Linux targets support unaligned accesses. The same goes for NaCl.
 
194
      //
 
195
      // The above behavior is consistent with GCC.
 
196
      AllowsUnalignedMem = (
 
197
          (hasV7Ops() && (isTargetLinux() || isTargetNaCl())) ||
 
198
          (hasV6Ops() && isTargetDarwin()));
 
199
      break;
 
200
    case StrictAlign:
 
201
      AllowsUnalignedMem = false;
 
202
      break;
 
203
    case NoStrictAlign:
 
204
      AllowsUnalignedMem = true;
 
205
      break;
 
206
  }
169
207
 
170
208
  // NEON f32 ops are non-IEEE 754 compliant. Darwin is ok with it by default.
171
209
  uint64_t Bits = getFeatureBits();