diff options
author | Gordon Henriksen <gordonhenriksen@mac.com> | 2007-12-10 03:18:06 +0000 |
---|---|---|
committer | Gordon Henriksen <gordonhenriksen@mac.com> | 2007-12-10 03:18:06 +0000 |
commit | 80a75bfae980df96f969f1c05b0c4a80ce975240 (patch) | |
tree | b17b6964d35ffeaa66a62793e9cb123e67b69310 /test/Bindings/Ocaml/vmcore.ml | |
parent | afba8fe662d65b25b4baf46bb26cc18e1f9cc0a5 (diff) | |
download | external_llvm-80a75bfae980df96f969f1c05b0c4a80ce975240.zip external_llvm-80a75bfae980df96f969f1c05b0c4a80ce975240.tar.gz external_llvm-80a75bfae980df96f969f1c05b0c4a80ce975240.tar.bz2 |
Adding a collector name attribute to Function in the IR. These
methods are new to Function:
bool hasCollector() const;
const std::string &getCollector() const;
void setCollector(const std::string &);
void clearCollector();
The assembly representation is as such:
define void @f() gc "shadow-stack" { ...
The implementation uses an on-the-side table to map Functions to
collector names, such that there is no overhead. A StringPool is
further used to unique collector names, which are extremely
likely to be unique per process.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44769 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Bindings/Ocaml/vmcore.ml')
-rw-r--r-- | test/Bindings/Ocaml/vmcore.ml | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/test/Bindings/Ocaml/vmcore.ml b/test/Bindings/Ocaml/vmcore.ml index 5c24992..f176932 100644 --- a/test/Bindings/Ocaml/vmcore.ml +++ b/test/Bindings/Ocaml/vmcore.ml @@ -25,7 +25,8 @@ let insist cond = exit_status := 10; " FAIL " end in - prerr_endline (msg ^ (string_of_int !case_num)) + prerr_endline (" " ^ (string_of_int !case_num) ^ if cond then "" + else " FAIL") let suite name f = prerr_endline (name ^ ":"); @@ -490,7 +491,20 @@ let test_functions () = insist (ccc = function_call_conv fn); set_function_call_conv fastcc fn; insist (fastcc = function_call_conv fn); - ignore (build_unreachable (builder_at_end (entry_block fn))) + ignore (build_unreachable (builder_at_end (entry_block fn))); + + begin group "collector"; + (* RUN: grep {Fn6.*gc.*shadowstack} < %t.ll + *) + let fn = define_function "Fn6" ty m in + insist (None = collector fn); + set_collector (Some "ocaml") fn; + insist (Some "ocaml" = collector fn); + set_collector None fn; + insist (None = collector fn); + set_collector (Some "shadowstack") fn; + ignore (build_unreachable (builder_at_end (entry_block fn))); + end (*===-- Basic Blocks ------------------------------------------------------===*) @@ -749,7 +763,6 @@ let test_builder () = let t3 = const_vector [| one; one; zero; zero |] in let vec1 = build_insertelement t1 p1 p2 "Vec1" atentry in let vec2 = build_insertelement t2 p1 p2 "Vec2" atentry in - let vec3 = build_insertelement t3 p1 p2 "Vec3" atentry in ignore (build_extractelement vec1 p2 "Inst49" atentry); ignore (build_insertelement vec1 p1 p2 "Inst50" atentry); |