From cee55018570c0c46262c6e4ef7beaa707c93fc86 Mon Sep 17 00:00:00 2001 From: Dale Johannesen Date: Fri, 22 Oct 2010 21:07:10 +0000 Subject: [PATCH] Change handling of inline asm 'p' constraint to match llvm-gcc. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117149 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/TargetInfo.h | 3 +++ lib/Basic/Targets.cpp | 2 ++ 2 files changed, 5 insertions(+) diff --git a/include/clang/Basic/TargetInfo.h b/include/clang/Basic/TargetInfo.h index 99f5bd8628..a00cc0d07c 100644 --- a/include/clang/Basic/TargetInfo.h +++ b/include/clang/Basic/TargetInfo.h @@ -356,6 +356,9 @@ public: unsigned NumOutputs, unsigned &Index) const; virtual std::string convertConstraint(const char Constraint) const { + // 'p' defaults to 'r', but can be overridden by targets. + if (Constraint == 'p') + return std::string("r"); return std::string(1, Constraint); } diff --git a/lib/Basic/Targets.cpp b/lib/Basic/Targets.cpp index b58f067e2b..9afef32f05 100644 --- a/lib/Basic/Targets.cpp +++ b/lib/Basic/Targets.cpp @@ -1315,6 +1315,8 @@ X86TargetInfo::convertConstraint(const char Constraint) const { case 'd': return std::string("{dx}"); case 'S': return std::string("{si}"); case 'D': return std::string("{di}"); + case 'p': // address + return std::string("im"); case 't': // top of floating point stack. return std::string("{st}"); case 'u': // second from top of floating point stack. -- 2.50.1