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