OLD | NEW |
---|---|
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 Loading... | |
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, | |
jvoung (off chromium)
2014/06/11 16:14:17
trailing comma -> period ?
or end with "by the Fi
| |
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 Loading... | |
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 } |
OLD | NEW |