r233542 - [mips] Add support for 'ZC' inline assembly memory constraint.
Daniel Sanders
daniel.sanders at imgtec.com
Mon Mar 30 06:47:23 PDT 2015
Author: dsanders
Date: Mon Mar 30 08:47:23 2015
New Revision: 233542
URL: http://llvm.org/viewvc/llvm-project?rev=233542&view=rev
Log:
[mips] Add support for 'ZC' inline assembly memory constraint.
Summary: Also add tests for 'R' and 'm'.
Reviewers: atanasyan
Reviewed By: atanasyan
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D8449
Added:
cfe/trunk/test/CodeGen/mips-inline-asm.c
Modified:
cfe/trunk/lib/Basic/Targets.cpp
Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=233542&r1=233541&r2=233542&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Mon Mar 30 08:47:23 2015
@@ -5857,9 +5857,30 @@ public:
case 'R': // An address that can be used in a non-macro load or store
Info.setAllowsMemory();
return true;
+ case 'Z':
+ if (Name[1] == 'C') { // An address usable by ll, and sc.
+ Info.setAllowsMemory();
+ Name++; // Skip over 'Z'.
+ return true;
+ }
+ return false;
}
}
+ std::string convertConstraint(const char *&Constraint) const override {
+ std::string R;
+ switch (*Constraint) {
+ case 'Z': // Two-character constraint; add "^" hint for later parsing.
+ if (Constraint[1] == 'C') {
+ R = std::string("^") + std::string(Constraint, 2);
+ Constraint++;
+ return R;
+ }
+ break;
+ }
+ return TargetInfo::convertConstraint(Constraint);
+ }
+
const char *getClobbers() const override {
// In GCC, $1 is not widely used in generated code (it's used only in a few
// specific situations), so there is no real need for users to add it to
Added: cfe/trunk/test/CodeGen/mips-inline-asm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/mips-inline-asm.c?rev=233542&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/mips-inline-asm.c (added)
+++ cfe/trunk/test/CodeGen/mips-inline-asm.c Mon Mar 30 08:47:23 2015
@@ -0,0 +1,19 @@
+// REQUIRES: mips-registered-target
+// RUN: %clang_cc1 -triple mips-linux-gnu -emit-llvm -o - %s | FileCheck %s
+
+int data;
+
+void m () {
+ asm("lw $1, %0" :: "m"(data));
+ // CHECK: call void asm sideeffect "lw $$1, $0", "*m,~{$1}"(i32* @data)
+}
+
+void ZC () {
+ asm("ll $1, %0" :: "ZC"(data));
+ // CHECK: call void asm sideeffect "ll $$1, $0", "*^ZC,~{$1}"(i32* @data)
+}
+
+void R () {
+ asm("lw $1, %0" :: "R"(data));
+ // CHECK: call void asm sideeffect "lw $$1, $0", "*R,~{$1}"(i32* @data)
+}
More information about the cfe-commits
mailing list