OLD | NEW |
1 //===-- InlineAsm.cpp - Implement the InlineAsm class ---------------------===// | 1 //===-- InlineAsm.cpp - Implement the InlineAsm class ---------------------===// |
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 file implements the InlineAsm class. | 10 // This file implements the InlineAsm class. |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 StructType *STy = dyn_cast<StructType>(Ty->getReturnType()); | 280 StructType *STy = dyn_cast<StructType>(Ty->getReturnType()); |
281 if (!STy || STy->getNumElements() != NumOutputs) | 281 if (!STy || STy->getNumElements() != NumOutputs) |
282 return false; | 282 return false; |
283 break; | 283 break; |
284 } | 284 } |
285 | 285 |
286 if (Ty->getNumParams() != NumInputs) return false; | 286 if (Ty->getNumParams() != NumInputs) return false; |
287 return true; | 287 return true; |
288 } | 288 } |
289 | 289 |
| 290 // @LOCALMOD-START |
| 291 bool InlineAsm::isAsmMemory() const { |
| 292 bool retVoid = getFunctionType()->getReturnType()->isVoidTy(); |
| 293 bool noArgs = getFunctionType()->getNumParams() == 0 && |
| 294 !getFunctionType()->isVarArg(); |
| 295 bool isEmptyAsm = AsmString.empty(); |
| 296 // Different triples will encode "touch everything" differently, e.g.: |
| 297 // - le32-unknown-nacl has "~{memory}". |
| 298 // - x86 "~{memory},~{dirflag},~{fpsr},~{flags}". |
| 299 // The following code therefore only searches for memory. |
| 300 bool touchesMemory = Constraints.find("~{memory}") != std::string::npos; |
| 301 |
| 302 return retVoid && noArgs && hasSideEffects() && isEmptyAsm && touchesMemory; |
| 303 } |
| 304 // @LOCALMOD-END |
OLD | NEW |