summaryrefslogtreecommitdiffstats
path: root/llvm/test/Assembler/globalvariable-attributes.ll
diff options
context:
space:
mode:
authorJaved Absar <javed.absar@arm.com>2017-05-11 12:28:08 +0000
committerJaved Absar <javed.absar@arm.com>2017-05-11 12:28:08 +0000
commitf3d7904d20120fb6e4b33cd391b916ca6701e03e (patch)
tree45229dfdd32c355e31e095a197b3bb53d84f2d85 /llvm/test/Assembler/globalvariable-attributes.ll
parenta44fc83d9fa3bcbe45b1ebb2f0aca2a86dba181d (diff)
downloadbcm5719-llvm-f3d7904d20120fb6e4b33cd391b916ca6701e03e.tar.gz
bcm5719-llvm-f3d7904d20120fb6e4b33cd391b916ca6701e03e.zip
[IR] Allow attributes with global variables
This patch extends llvm-ir to allow attributes to be set on global variables. An RFC was sent out earlier by my colleague James Molloy: http://lists.llvm.org/pipermail/cfe-dev/2017-March/053100.html A key part of that proposal was to extend LLVM-IR to carry attributes on global variables. This generic feature could be useful for multiple purposes. In our present context, it would be useful to carry user specified sections for bss/rodata/data. Reviewed by: Jonathan Roelofs, Reid Kleckner Differential Revision: https://reviews.llvm.org/D32009 llvm-svn: 302794
Diffstat (limited to 'llvm/test/Assembler/globalvariable-attributes.ll')
-rw-r--r--llvm/test/Assembler/globalvariable-attributes.ll19
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/test/Assembler/globalvariable-attributes.ll b/llvm/test/Assembler/globalvariable-attributes.ll
new file mode 100644
index 00000000000..64227a451c2
--- /dev/null
+++ b/llvm/test/Assembler/globalvariable-attributes.ll
@@ -0,0 +1,19 @@
+; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s
+
+@g1 = global i32 7 "key" = "value" "key2" = "value2"
+@g2 = global i32 2, align 4 "key3" = "value3"
+@g3 = global i32 2 #0
+@g4 = global i32 2, align 4 "key5" = "value5" #0
+
+attributes #0 = { "string" = "value" nobuiltin norecurse }
+
+; CHECK: @g1 = global i32 7 #0
+; CHECK: @g2 = global i32 2, align 4 #1
+; CHECK: @g3 = global i32 2 #2
+; CHECK: @g4 = global i32 2, align 4 #3
+
+; CHECK: attributes #0 = { "key"="value" "key2"="value2" }
+; CHECK: attributes #1 = { "key3"="value3" }
+; CHECK: attributes #2 = { nobuiltin norecurse "string"="value" }
+; CHECK: attributes #3 = { nobuiltin norecurse "key5"="value5" "string"="value" }
+
OpenPOWER on IntegriCloud