Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Side by Side Diff: lib/Transforms/NaCl/StripAttributes.cpp

Issue 321733002: PNaCl SIMD: allow element-aligned vector load/store (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-llvm.git@master
Patch Set: s/,/./ Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/Transforms/NaCl/FixVectorLoadStoreAlignment.cpp ('k') | test/NaCl/Bitcode/vector.ll » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- StripAttributes.cpp - Remove attributes not supported by PNaCl------===// 1 //===- StripAttributes.cpp - Remove attributes not supported by PNaCl------===//
2 // 2 //
3 // The LLVM Compiler Infrastructure 3 // The LLVM Compiler Infrastructure
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 // 9 //
10 // This pass strips out attributes that are not supported by PNaCl's 10 // This pass strips out attributes that are not supported by PNaCl's
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 // "private" symbols are omitted from the nexe's symbol table, which 156 // "private" symbols are omitted from the nexe's symbol table, which
157 // would get in the way of debugging when an unstripped pexe is 157 // would get in the way of debugging when an unstripped pexe is
158 // translated offline. 158 // translated offline.
159 if (GV->getLinkage() == GlobalValue::PrivateLinkage) 159 if (GV->getLinkage() == GlobalValue::PrivateLinkage)
160 GV->setLinkage(GlobalValue::InternalLinkage); 160 GV->setLinkage(GlobalValue::InternalLinkage);
161 } 161 }
162 162
163 static unsigned normalizeAlignment(DataLayout *DL, unsigned Alignment, 163 static unsigned normalizeAlignment(DataLayout *DL, unsigned Alignment,
164 Type *Ty, bool IsAtomic) { 164 Type *Ty, bool IsAtomic) {
165 unsigned MaxAllowed = 1; 165 unsigned MaxAllowed = 1;
166 if (isa<VectorType>(Ty))
167 // Already handled properly by FixVectorLoadStoreAlignment.
168 return Alignment;
166 if (Ty->isDoubleTy() || Ty->isFloatTy() || IsAtomic) 169 if (Ty->isDoubleTy() || Ty->isFloatTy() || IsAtomic)
167 MaxAllowed = DL->getTypeAllocSize(Ty); 170 MaxAllowed = DL->getTypeAllocSize(Ty);
168 // If the alignment is set to 0, this means "use the default 171 // If the alignment is set to 0, this means "use the default
169 // alignment for the target", which we fill in explicitly. 172 // alignment for the target", which we fill in explicitly.
170 if (Alignment == 0 || Alignment >= MaxAllowed) 173 if (Alignment == 0 || Alignment >= MaxAllowed)
171 return MaxAllowed; 174 return MaxAllowed;
172 return 1; 175 return 1;
173 } 176 }
174 177
175 void stripFunctionAttrs(DataLayout *DL, Function *Func) { 178 void stripFunctionAttrs(DataLayout *DL, Function *Func) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 for (Module::global_iterator GV = M.global_begin(), E = M.global_end(); 234 for (Module::global_iterator GV = M.global_begin(), E = M.global_end();
232 GV != E; ++GV) { 235 GV != E; ++GV) {
233 stripGlobalValueAttrs(GV); 236 stripGlobalValueAttrs(GV);
234 } 237 }
235 return true; 238 return true;
236 } 239 }
237 240
238 ModulePass *llvm::createStripAttributesPass() { 241 ModulePass *llvm::createStripAttributesPass() {
239 return new StripAttributes(); 242 return new StripAttributes();
240 } 243 }
OLDNEW
« no previous file with comments | « lib/Transforms/NaCl/FixVectorLoadStoreAlignment.cpp ('k') | test/NaCl/Bitcode/vector.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698