
This switches everything to use the memory attribute proposed in https://discourse.llvm.org/t/rfc-unify-memory-effect-attributes/65579. The old argmemonly, inaccessiblememonly and inaccessiblemem_or_argmemonly attributes are dropped. The readnone, readonly and writeonly attributes are restricted to parameters only. The old attributes are auto-upgraded both in bitcode and IR. The bitcode upgrade is a policy requirement that has to be retained indefinitely. The IR upgrade is mainly there so it's not necessary to update all tests using memory attributes in this patch, which is already large enough. We could drop that part after migrating tests, or retain it longer term, to make it easier to import IR from older LLVM versions. High-level Function/CallBase APIs like doesNotAccessMemory() or setDoesNotAccessMemory() are mapped transparently to the memory attribute. Code that directly manipulates attributes (e.g. via AttributeList) on the other hand needs to switch to working with the memory attribute instead. Differential Revision: https://reviews.llvm.org/D135780
34 lines
1.2 KiB
C
34 lines
1.2 KiB
C
// RUN: %clang_cc1 -triple armv7-apple-darwin -emit-llvm %s -o - | FileCheck %s
|
|
|
|
// CHECK: call i32 asm "foo0", {{.*}} [[READNONE:#[0-9]+]]
|
|
// CHECK: call i32 asm "foo1", {{.*}} [[READNONE]]
|
|
// CHECK: call i32 asm "foo2", {{.*}} [[NOATTRS:#[0-9]+]]
|
|
// CHECK: call i32 asm sideeffect "foo3", {{.*}} [[NOATTRS]]
|
|
// CHECK: call i32 asm "foo4", {{.*}} [[READONLY:#[0-9]+]]
|
|
// CHECK: call i32 asm "foo5", {{.*}} [[READONLY]]
|
|
// CHECK: call i32 asm "foo6", {{.*}} [[NOATTRS]]
|
|
// CHECK: call void asm sideeffect "foo7", {{.*}} [[NOATTRS]]
|
|
// CHECK: call i32 asm "foo8", {{.*}} [[READNONE]]
|
|
|
|
// CHECK: attributes [[READNONE]] = { nounwind memory(none) }
|
|
// CHECK: attributes [[NOATTRS]] = { nounwind }
|
|
// CHECK: attributes [[READONLY]] = { nounwind memory(read) }
|
|
|
|
int g0, g1;
|
|
|
|
struct S {
|
|
int i;
|
|
} g2;
|
|
|
|
void test_attrs(int a) {
|
|
__asm__ ("foo0" : "=r"(g1) : "r"(a));
|
|
__asm__ ("foo1" : "=r"(g1) : "r"(a) : "cc");
|
|
__asm__ ("foo2" : "=r"(g1) : "r"(a) : "memory");
|
|
__asm__ volatile("foo3" : "=r"(g1) : "r"(a));
|
|
__asm__ ("foo4" : "=r"(g1) : "r"(a), "m"(g0));
|
|
__asm__ ("foo5" : "=r"(g1) : "r"(a), "Q"(g0));
|
|
__asm__ ("foo6" : "=r"(g1), "=m"(g0) : "r"(a));
|
|
__asm__ ("foo7" : : "r"(a));
|
|
__asm__ ("foo8" : "=r"(g2) : "r"(a));
|
|
}
|