summaryrefslogtreecommitdiff
path: root/Basic
diff options
context:
space:
mode:
authorLauro Ramos Venancio <lauro.venancio@gmail.com>2008-02-26 18:33:46 +0000
committerLauro Ramos Venancio <lauro.venancio@gmail.com>2008-02-26 18:33:46 +0000
commita5694b8b0096215137bf1c273764ec93ac4898fd (patch)
tree651f4bdcdff2e98e922ae707385daf940a97df7b /Basic
parent018c15fa9805ae05c63c89532cc0a0e4f4a5584c (diff)
downloadclang-a5694b8b0096215137bf1c273764ec93ac4898fd.tar.gz
Convert x86 target specific inline asm constraints to LLVM.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47609 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Basic')
-rw-r--r--Basic/TargetInfo.cpp4
-rw-r--r--Basic/Targets.cpp35
2 files changed, 38 insertions, 1 deletions
diff --git a/Basic/TargetInfo.cpp b/Basic/TargetInfo.cpp
index 6b600a43a9..069e144a74 100644
--- a/Basic/TargetInfo.cpp
+++ b/Basic/TargetInfo.cpp
@@ -454,6 +454,10 @@ bool TargetInfo::validateInputConstraint(const char *Name,
return true;
}
+std::string TargetInfo::convertConstraint(const char Constraint) const {
+ return PrimaryTarget->convertConstraint(Constraint);
+}
+
const char *TargetInfo::getClobbers() const
{
return PrimaryTarget->getClobbers();
diff --git a/Basic/Targets.cpp b/Basic/Targets.cpp
index 6888d44f5e..ed2e0e0a44 100644
--- a/Basic/Targets.cpp
+++ b/Basic/Targets.cpp
@@ -493,6 +493,28 @@ namespace X86 {
}
}
+ static std::string convertConstraint(const char Constraint) {
+ switch (Constraint) {
+ case 'a': return std::string("{ax}");
+ case 'b': return std::string("{bx}");
+ case 'c': return std::string("{cx}");
+ case 'd': return std::string("{dx}");
+ case 'S': return std::string("{si}");
+ case 'D': return std::string("{di}");
+ case 't': // top of floating point stack.
+ return std::string("{st}");
+ case 'u': // second from top of floating point stack.
+ return std::string("{st(1)}"); // second from top of floating point stack.
+ case 'A': // edx:eax.
+ case 'q': // a, b, c, d registers or any integer register in 64-bit.
+ case 'Z': // 32-bit integer constant for used with zero-extending x86_64
+ // instructions.
+ assert(false && "Unimplemented inline asm constraint");
+ default:
+ return std::string(1, Constraint);
+ }
+ }
+
const char *getClobbers() {
return "~{dirflag},~{fpsr},~{flags}";
}
@@ -614,6 +636,11 @@ public:
TargetInfo::ConstraintInfo &info) const {
return X86::validateAsmConstraint(c, info);
}
+
+ virtual std::string convertConstraint(const char Constraint) const {
+ return X86::convertConstraint(Constraint);
+ }
+
virtual const char *getClobbers() const {
return X86::getClobbers();
}
@@ -650,7 +677,10 @@ public:
virtual bool validateAsmConstraint(char c,
TargetInfo::ConstraintInfo &info) const {
return X86::validateAsmConstraint(c, info);
- }
+ }
+ virtual std::string convertConstraint(const char Constraint) const {
+ return X86::convertConstraint(Constraint);
+ }
virtual const char *getClobbers() const {
return X86::getClobbers();
}
@@ -732,6 +762,9 @@ public:
TargetInfo::ConstraintInfo &info) const {
return X86::validateAsmConstraint(c, info);
}
+ virtual std::string convertConstraint(const char Constraint) const {
+ return X86::convertConstraint(Constraint);
+ }
virtual const char *getClobbers() const {
return X86::getClobbers();
}