[Support] Add LLVM_IS_UNALIGNED_ACCESS_FAST.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174271 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Michael J. Spencer
2013-02-03 10:48:31 +00:00
parent fa987f08fb
commit d9d2f18775
2 changed files with 29 additions and 4 deletions

View File

@@ -27,30 +27,42 @@ ObjectFile *ObjectFile::createELFObjectFile(MemoryBuffer *Object) {
1ULL << CountTrailingZeros_64(uintptr_t(Object->getBufferStart()));
if (Ident.first == ELF::ELFCLASS32 && Ident.second == ELF::ELFDATA2LSB)
#if !LLVM_IS_UNALIGNED_ACCESS_FAST
if (MaxAlignment >= 4)
return new ELFObjectFile<ELFType<support::little, 4, false> >(Object, ec);
else if (MaxAlignment >= 2)
else
#endif
if (MaxAlignment >= 2)
return new ELFObjectFile<ELFType<support::little, 2, false> >(Object, ec);
else
llvm_unreachable("Invalid alignment for ELF file!");
else if (Ident.first == ELF::ELFCLASS32 && Ident.second == ELF::ELFDATA2MSB)
#if !LLVM_IS_UNALIGNED_ACCESS_FAST
if (MaxAlignment >= 4)
return new ELFObjectFile<ELFType<support::big, 4, false> >(Object, ec);
else if (MaxAlignment >= 2)
else
#endif
if (MaxAlignment >= 2)
return new ELFObjectFile<ELFType<support::big, 2, false> >(Object, ec);
else
llvm_unreachable("Invalid alignment for ELF file!");
else if (Ident.first == ELF::ELFCLASS64 && Ident.second == ELF::ELFDATA2MSB)
#if !LLVM_IS_UNALIGNED_ACCESS_FAST
if (MaxAlignment >= 8)
return new ELFObjectFile<ELFType<support::big, 8, true> >(Object, ec);
else if (MaxAlignment >= 2)
else
#endif
if (MaxAlignment >= 2)
return new ELFObjectFile<ELFType<support::big, 2, true> >(Object, ec);
else
llvm_unreachable("Invalid alignment for ELF file!");
else if (Ident.first == ELF::ELFCLASS64 && Ident.second == ELF::ELFDATA2LSB) {
#if !LLVM_IS_UNALIGNED_ACCESS_FAST
if (MaxAlignment >= 8)
return new ELFObjectFile<ELFType<support::little, 8, true> >(Object, ec);
else if (MaxAlignment >= 2)
else
#endif
if (MaxAlignment >= 2)
return new ELFObjectFile<ELFType<support::little, 2, true> >(Object, ec);
else
llvm_unreachable("Invalid alignment for ELF file!");