• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6# http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14.record A {
15    i32 fint
16    A   fref
17}
18
19.function void ext_func(A a0) <external>
20
21#! CHECKER        Check optimized reference in statepoint
22#! RUN_LLVM       options: "--compiler-regex=_GLOBAL::foo_ref --llvm-dump-after"
23#! READ_FILE      "console.out"
24#! LLVM_METHOD    /define.*\"void _GLOBAL::foo_ref.*\d+\"/
25#! INST           /"gc-live"\(ptr addrspace\(271\) %a0[^,]*, ptr addrspace\(271\) %v4[^,]*\)/
26#! INST_NEXT      /"gc-live"\(ptr addrspace\(271\) %a0[^,]*, ptr addrspace\(271\) %v4[^,]*\)/
27#! INST_NEXT_NOT  "gc-live"
28.function void foo_ref(A a0) {
29    ldobj.obj a0, A.fref
30    sta.obj v0
31    call.short ext_func, a0
32    lda.obj v0
33    stobj.obj a0, A.fref
34    return.void
35}
36
37#! CHECKER        Check no reference in statepoint
38#! RUN_LLVM       options: "--compiler-regex=_GLOBAL::foo_int --llvm-dump-after"
39#! READ_FILE      "console.out"
40#! LLVM_METHOD    /define.*\"void _GLOBAL::foo_int.*\d+\"/
41#! INST           /"gc-live"\(ptr addrspace\(271\) %a0[^,]*\)/
42#! INST_NEXT      /"gc-live"\(ptr addrspace\(271\) %a0[^,]*\)/
43#! INST_NEXT_NOT  "gc-live"
44.function void foo_int(A a0) {
45    ldobj a0, A.fint
46    sta v0
47    call.short ext_func, a0
48    lda v0
49    stobj a0, A.fint
50    return.void
51}
52