Chromium Code Reviews| Index: lib/IR/InlineAsm.cpp |
| diff --git a/lib/IR/InlineAsm.cpp b/lib/IR/InlineAsm.cpp |
| index 9f2a9fea4b93b1bd6ff4f65d16f952caf4bbd5a5..121fe1528ebd604c96cecba628afdd4c5fa0eb34 100644 |
| --- a/lib/IR/InlineAsm.cpp |
| +++ b/lib/IR/InlineAsm.cpp |
| @@ -293,3 +293,18 @@ bool InlineAsm::Verify(FunctionType *Ty, StringRef ConstStr) { |
| return true; |
| } |
| +// @LOCALMOD-START |
| +bool InlineAsm::isAsmMemory() const { |
| + bool retVoid = getFunctionType()->getReturnType()->isVoidTy(); |
| + bool noArgs = getFunctionType()->getNumParams() == 0 && |
| + !getFunctionType()->isVarArg(); |
| + bool isEmptyAsm = AsmString.empty(); |
| + // Different triples will encode "touch everything" differently, e.g.: |
| + // - le32-unknown-nacl has "~{memory}". |
| + // - x86 "~{memory},~{dirflag},~{fpsr},~{flags}". |
|
jvoung (off chromium)
2013/08/07 22:32:11
Does that mean that in the backend, we need to con
JF
2013/08/07 22:47:41
Kind of. It comes from Clang's TargetInfo getClobb
|
| + // The following code therefore only searches for memory. |
| + bool touchesMemory = Constraints.find("~{memory}") != std::string::npos; |
| + |
| + return retVoid && noArgs && hasSideEffects() && isEmptyAsm && touchesMemory; |
| +} |
| +// @LOCALMOD-END |