Skip to content

Commit 1a7ad99

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:cc763dc2573f into amd-gfx:e4eee7fc4f9b
Local branch amd-gfx e4eee7f Merged main:41cf94e6b8b4 into amd-gfx:816ba771739c Remote branch main cc763dc [Flang][OpenMP] Port openmp private clause tests to HLFIR flow (llvm#70783)
2 parents e4eee7f + cc763dc commit 1a7ad99

File tree

24 files changed

+1361
-263
lines changed

24 files changed

+1361
-263
lines changed

flang/test/Lower/OpenMP/default-clause.f90

Lines changed: 327 additions & 0 deletions
Large diffs are not rendered by default.

flang/test/Lower/OpenMP/parallel-private-clause.f90

Lines changed: 153 additions & 103 deletions
Large diffs are not rendered by default.

flang/test/Lower/OpenMP/task.f90

Lines changed: 273 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,273 @@
1+
!RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
2+
3+
!CHECK-LABEL: func @_QPomp_task_simple() {
4+
subroutine omp_task_simple
5+
!CHECK: omp.task {
6+
!$omp task
7+
!CHECK: fir.call @_QPfoo() {{.*}}: () -> ()
8+
call foo()
9+
!CHECK: omp.terminator
10+
!$omp end task
11+
end subroutine omp_task_simple
12+
13+
!===============================================================================
14+
! `if` clause
15+
!===============================================================================
16+
17+
!CHECK-LABEL: func @_QPomp_task_if(%{{.+}}) {
18+
subroutine omp_task_if(bar)
19+
logical, intent(inout) :: bar
20+
!CHECK: omp.task if(%{{.+}}) {
21+
!$omp task if(bar)
22+
!CHECK: fir.call @_QPfoo() {{.*}}: () -> ()
23+
call foo()
24+
!CHECK: omp.terminator
25+
!$omp end task
26+
end subroutine omp_task_if
27+
28+
!===============================================================================
29+
! `final` clause
30+
!===============================================================================
31+
32+
!CHECK-LABEL: func @_QPomp_task_final(%{{.+}}) {
33+
subroutine omp_task_final(bar)
34+
logical, intent(inout) :: bar
35+
!CHECK: omp.task final(%{{.+}}) {
36+
!$omp task final(bar)
37+
!CHECK: fir.call @_QPfoo() {{.*}}: () -> ()
38+
call foo()
39+
!CHECK: omp.terminator
40+
!$omp end task
41+
end subroutine omp_task_final
42+
43+
!===============================================================================
44+
! `untied` clause
45+
!===============================================================================
46+
47+
!CHECK-LABEL: func @_QPomp_task_untied() {
48+
subroutine omp_task_untied()
49+
!CHECK: omp.task untied {
50+
!$omp task untied
51+
!CHECK: fir.call @_QPfoo() {{.*}}: () -> ()
52+
call foo()
53+
!CHECK: omp.terminator
54+
!$omp end task
55+
end subroutine omp_task_untied
56+
57+
!===============================================================================
58+
! `mergeable` clause
59+
!===============================================================================
60+
61+
!CHECK-LABEL: func @_QPomp_task_mergeable() {
62+
subroutine omp_task_mergeable()
63+
!CHECK: omp.task mergeable {
64+
!$omp task mergeable
65+
!CHECK: fir.call @_QPfoo() {{.*}}: () -> ()
66+
call foo()
67+
!CHECK: omp.terminator
68+
!$omp end task
69+
end subroutine omp_task_mergeable
70+
71+
!===============================================================================
72+
! `priority` clause
73+
!===============================================================================
74+
75+
!CHECK-LABEL: func @_QPomp_task_priority(%{{.+}}) {
76+
subroutine omp_task_priority(bar)
77+
integer, intent(inout) :: bar
78+
!CHECK: omp.task priority(%{{.+}}) {
79+
!$omp task priority(bar)
80+
!CHECK: fir.call @_QPfoo() {{.*}}: () -> ()
81+
call foo()
82+
!CHECK: omp.terminator
83+
!$omp end task
84+
end subroutine omp_task_priority
85+
86+
!===============================================================================
87+
! `allocate` clause
88+
!===============================================================================
89+
90+
!CHECK-LABEL: func @_QPtask_allocate
91+
subroutine task_allocate()
92+
use omp_lib
93+
integer :: x
94+
!CHECK: omp.task allocate(%{{.+}} : i32 -> %{{.+}} : !fir.ref<i32>) {
95+
!$omp task allocate(omp_high_bw_mem_alloc: x) private(x)
96+
!CHECK: arith.addi
97+
x = x + 12
98+
!CHECK: omp.terminator
99+
!$omp end task
100+
end subroutine task_allocate
101+
102+
!===============================================================================
103+
! `depend` clause
104+
!===============================================================================
105+
106+
!CHECK-LABEL: func @_QPtask_depend
107+
subroutine task_depend()
108+
integer :: x
109+
!CHECK: omp.task depend(taskdependin -> %{{.+}} : !fir.ref<i32>) {
110+
!$omp task depend(in : x)
111+
!CHECK: arith.addi
112+
x = x + 12
113+
!CHECK: omp.terminator
114+
!$omp end task
115+
end subroutine task_depend
116+
117+
!CHECK-LABEL: func @_QPtask_depend_non_int
118+
subroutine task_depend_non_int()
119+
character(len = 15) :: x
120+
integer, allocatable :: y
121+
complex :: z
122+
!CHECK: omp.task depend(taskdependin -> %{{.+}} : !fir.ref<!fir.char<1,15>>, taskdependin -> %{{.+}} : !fir.ref<!fir.box<!fir.heap<i32>>>, taskdependin -> %{{.+}} : !fir.ref<!fir.complex<4>>) {
123+
!$omp task depend(in : x, y, z)
124+
!CHECK: omp.terminator
125+
!$omp end task
126+
end subroutine task_depend_non_int
127+
128+
!CHECK-LABEL: func @_QPtask_depend_all_kinds_one_task
129+
subroutine task_depend_all_kinds_one_task()
130+
integer :: x
131+
!CHECK: omp.task depend(taskdependin -> %{{.+}} : !fir.ref<i32>, taskdependout -> %{{.+}} : !fir.ref<i32>, taskdependinout -> %{{.+}} : !fir.ref<i32>) {
132+
!$omp task depend(in : x) depend(out : x) depend(inout : x)
133+
!CHECK: arith.addi
134+
x = x + 12
135+
!CHECK: omp.terminator
136+
!$omp end task
137+
end subroutine task_depend_all_kinds_one_task
138+
139+
!CHECK-LABEL: func @_QPtask_depend_multi_var
140+
subroutine task_depend_multi_var()
141+
integer :: x
142+
integer :: y
143+
!CHECK: omp.task depend(taskdependin -> %{{.*}} : !fir.ref<i32>, taskdependin -> %{{.+}} : !fir.ref<i32>) {
144+
!$omp task depend(in :x,y)
145+
!CHECK: arith.addi
146+
x = x + 12
147+
y = y + 12
148+
!CHECK: omp.terminator
149+
!$omp end task
150+
end subroutine task_depend_multi_var
151+
152+
!CHECK-LABEL: func @_QPtask_depend_multi_task
153+
subroutine task_depend_multi_task()
154+
integer :: x
155+
!CHECK: omp.task depend(taskdependout -> %{{.+}} : !fir.ref<i32>)
156+
!$omp task depend(out : x)
157+
!CHECK: arith.addi
158+
x = x + 12
159+
!CHECK: omp.terminator
160+
!$omp end task
161+
!CHECK: omp.task depend(taskdependinout -> %{{.+}} : !fir.ref<i32>)
162+
!$omp task depend(inout : x)
163+
!CHECK: arith.addi
164+
x = x + 12
165+
!CHECK: omp.terminator
166+
!$omp end task
167+
!CHECK: omp.task depend(taskdependin -> %{{.+}} : !fir.ref<i32>)
168+
!$omp task depend(in : x)
169+
!CHECK: arith.addi
170+
x = x + 12
171+
!CHECK: omp.terminator
172+
!$omp end task
173+
end subroutine task_depend_multi_task
174+
175+
!===============================================================================
176+
! `private` clause
177+
!===============================================================================
178+
!CHECK-LABEL: func @_QPtask_private
179+
subroutine task_private
180+
type mytype
181+
integer :: x
182+
end type mytype
183+
184+
!CHECK: %[[INT_ALLOCA:.*]] = fir.alloca i32 {bindc_name = "int_var", uniq_name = "_QFtask_privateEint_var"}
185+
!CHECK: %[[INT_VAR:.+]]:2 = hlfir.declare %[[INT_ALLOCA]] {uniq_name = "_QFtask_privateEint_var"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
186+
!CHECK: %[[MYTYPE_ALLOCA:.*]] = fir.alloca !fir.type<_QFtask_privateTmytype{x:i32}> {bindc_name = "mytype_var", uniq_name = "_QFtask_privateEmytype_var"}
187+
!CHECK: %[[MYTYPE_VAR:.+]]:2 = hlfir.declare %[[MYTYPE_ALLOCA]] {uniq_name = "_QFtask_privateEmytype_var"} : (!fir.ref<!fir.type<_QFtask_privateTmytype{x:i32}>>) -> (!fir.ref<!fir.type<_QFtask_privateTmytype{x:i32}>>, !fir.ref<!fir.type<_QFtask_privateTmytype{x:i32}>>)
188+
integer :: int_var
189+
type(mytype) :: mytype_var
190+
191+
!CHECK: fir.call @_QPbar(%[[INT_VAR]]#1, %[[MYTYPE_VAR]]#1) {{.*}}: (!fir.ref<i32>, !fir.ref<!fir.type<_QFtask_privateTmytype{x:i32}>>) -> ()
192+
call bar(int_var, mytype_var)
193+
194+
!CHECK: omp.task {
195+
!$omp task private(int_var, mytype_var)
196+
!CHECK: %[[INT_PRIVATE_ALLOCA:.+]] = fir.alloca i32 {bindc_name = "int_var", pinned, uniq_name = "_QFtask_privateEint_var"}
197+
!CHECK: %[[INT_VAR_PRIVATE:.+]]:2 = hlfir.declare %[[INT_PRIVATE_ALLOCA]] {uniq_name = "_QFtask_privateEint_var"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
198+
!CHECK: %[[MYTYPE_PRIVATE_ALLOCA:.+]] = fir.alloca !fir.type<_QFtask_privateTmytype{x:i32}> {bindc_name = "mytype_var", pinned, uniq_name = "_QFtask_privateEmytype_var"}
199+
!CHECK: %[[MYTYPE_VAR_PRIVATE:.+]]:2 = hlfir.declare %[[MYTYPE_PRIVATE_ALLOCA]] {uniq_name = "_QFtask_privateEmytype_var"} : (!fir.ref<!fir.type<_QFtask_privateTmytype{x:i32}>>) -> (!fir.ref<!fir.type<_QFtask_privateTmytype{x:i32}>>, !fir.ref<!fir.type<_QFtask_privateTmytype{x:i32}>>)
200+
!CHECK: fir.call @_QPbar(%[[INT_VAR_PRIVATE]]#1, %[[MYTYPE_VAR_PRIVATE]]#1) fastmath<contract> : (!fir.ref<i32>, !fir.ref<!fir.type<_QFtask_privateTmytype{x:i32}>>) -> ()
201+
call bar(int_var, mytype_var)
202+
!CHECK: omp.terminator
203+
!$omp end task
204+
end subroutine task_private
205+
206+
!===============================================================================
207+
! `firstprivate` clause
208+
!===============================================================================
209+
!CHECK-LABEL: func @_QPtask_firstprivate
210+
subroutine task_firstprivate
211+
type mytype
212+
integer :: x
213+
end type mytype
214+
215+
!CHECK: %[[INT_ALLOCA:.+]] = fir.alloca i32 {bindc_name = "int_var", uniq_name = "_QFtask_firstprivateEint_var"}
216+
!CHECK: %[[INT_VAR:.+]]:2 = hlfir.declare %[[INT_ALLOCA]] {uniq_name = "_QFtask_firstprivateEint_var"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
217+
!CHECK: %[[MYTYPE_ALLOCA:.+]] = fir.alloca !fir.type<_QFtask_firstprivateTmytype{x:i32}> {bindc_name = "mytype_var", uniq_name = "_QFtask_firstprivateEmytype_var"}
218+
!CHECK: %[[MYTYPE_VAR:.+]]:2 = hlfir.declare %[[MYTYPE_ALLOCA]] {uniq_name = "_QFtask_firstprivateEmytype_var"} : (!fir.ref<!fir.type<_QFtask_firstprivateTmytype{x:i32}>>) -> (!fir.ref<!fir.type<_QFtask_firstprivateTmytype{x:i32}>>, !fir.ref<!fir.type<_QFtask_firstprivateTmytype{x:i32}>>)
219+
integer :: int_var
220+
type(mytype) :: mytype_var
221+
222+
!CHECK: fir.call @_QPbaz(%[[INT_VAR]]#1, %[[MYTYPE_VAR]]#1) fastmath<contract> : (!fir.ref<i32>, !fir.ref<!fir.type<_QFtask_firstprivateTmytype{x:i32}>>) -> ()
223+
call baz(int_var, mytype_var)
224+
225+
!CHECK: omp.task {
226+
!$omp task firstprivate(int_var, mytype_var)
227+
!CHECK: %[[INT_FIRSTPRIVATE_ALLOCA:.+]] = fir.alloca i32 {bindc_name = "int_var", pinned, uniq_name = "_QFtask_firstprivateEint_var"}
228+
!CHECK: %[[INT_VAR_FIRSTPRIVATE:.+]]:2 = hlfir.declare %[[INT_FIRSTPRIVATE_ALLOCA]] {uniq_name = "_QFtask_firstprivateEint_var"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
229+
!CHECK: %[[INT_VAR_LOAD:.+]] = fir.load %[[INT_VAR]]#0 : !fir.ref<i32>
230+
!CHECK: hlfir.assign %[[INT_VAR_LOAD]] to %[[INT_VAR_FIRSTPRIVATE]]#0 temporary_lhs : i32, !fir.ref<i32>
231+
!CHECK: %[[MYTYPE_FIRSTPRIVATE_ALLOCA:.+]] = fir.alloca !fir.type<_QFtask_firstprivateTmytype{x:i32}> {bindc_name = "mytype_var", pinned, uniq_name = "_QFtask_firstprivateEmytype_var"}
232+
!CHECK: %[[MYTYPE_VAR_FIRSTPRIVATE:.+]]:2 = hlfir.declare %[[MYTYPE_FIRSTPRIVATE_ALLOCA]] {uniq_name = "_QFtask_firstprivateEmytype_var"} : (!fir.ref<!fir.type<_QFtask_firstprivateTmytype{x:i32}>>) -> (!fir.ref<!fir.type<_QFtask_firstprivateTmytype{x:i32}>>, !fir.ref<!fir.type<_QFtask_firstprivateTmytype{x:i32}>>)
233+
!CHECK: hlfir.assign %[[MYTYPE_VAR]]#0 to %[[MYTYPE_VAR_FIRSTPRIVATE]]#0 temporary_lhs : !fir.ref<!fir.type<_QFtask_firstprivateTmytype{x:i32}>>, !fir.ref<!fir.type<_QFtask_firstprivateTmytype{x:i32}>>
234+
call baz(int_var, mytype_var)
235+
!CHECK: omp.terminator
236+
!$omp end task
237+
end subroutine task_firstprivate
238+
239+
!===============================================================================
240+
! Multiple clauses
241+
!===============================================================================
242+
243+
!CHECK-LABEL: func @_QPtask_multiple_clauses
244+
subroutine task_multiple_clauses()
245+
use omp_lib
246+
247+
!CHECK: %[[X_ALLOCA:.+]] = fir.alloca i32 {bindc_name = "x", uniq_name = "_QFtask_multiple_clausesEx"}
248+
!CHECK: %[[X:.+]]:2 = hlfir.declare %[[X_ALLOCA]] {uniq_name = "_QFtask_multiple_clausesEx"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
249+
!CHECK: %[[Y_ALLOCA:.+]] = fir.alloca i32 {bindc_name = "y", uniq_name = "_QFtask_multiple_clausesEy"}
250+
!CHECK: %[[Y:.+]]:2 = hlfir.declare %[[Y_ALLOCA]] {uniq_name = "_QFtask_multiple_clausesEy"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
251+
!CHECK: %[[Z_ALLOCA:.+]] = fir.alloca i32 {bindc_name = "z", uniq_name = "_QFtask_multiple_clausesEz"}
252+
!CHECK: %[[Z:.+]]:2 = hlfir.declare %[[Z_ALLOCA]] {uniq_name = "_QFtask_multiple_clausesEz"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
253+
integer :: x, y, z
254+
logical :: buzz
255+
256+
!CHECK: omp.task if(%{{.+}}) final(%{{.+}}) untied mergeable priority(%{{.+}}) allocate(%{{.+}} : i32 -> %{{.+}} : !fir.ref<i32>) {
257+
!$omp task if(buzz) final(buzz) untied mergeable priority(z) allocate(omp_high_bw_mem_alloc: x) private(x) firstprivate(y)
258+
259+
!CHECK: %[[X_PRIV_ALLOCA:.+]] = fir.alloca i32 {bindc_name = "x", pinned, uniq_name = "_QFtask_multiple_clausesEx"}
260+
!CHECK: %[[X_PRIV:.+]]:2 = hlfir.declare %[[X_PRIV_ALLOCA]] {uniq_name = "_QFtask_multiple_clausesEx"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
261+
!CHECK: %[[Y_PRIV_ALLOCA:.+]] = fir.alloca i32 {bindc_name = "y", pinned, uniq_name = "_QFtask_multiple_clausesEy"}
262+
!CHECK: %[[Y_PRIV:.+]]:2 = hlfir.declare %[[Y_PRIV_ALLOCA]] {uniq_name = "_QFtask_multiple_clausesEy"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
263+
!CHECK: %[[Y_LOAD:.+]] = fir.load %[[Y]]#0 : !fir.ref<i32>
264+
!CHECK: hlfir.assign %[[Y_LOAD]] to %[[Y_PRIV]]#0 temporary_lhs : i32, !fir.ref<i32>
265+
266+
!CHECK: arith.addi
267+
x = x + 12
268+
!CHECK: arith.subi
269+
y = y - 12
270+
271+
!CHECK: omp.terminator
272+
!$omp end task
273+
end subroutine task_multiple_clauses

lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -434,11 +434,6 @@ bool GDBRemoteRegisterContext::WriteRegisterBytes(const RegisterInfo *reg_info,
434434
} else {
435435
// This is an actual register, write it
436436
success = SetPrimordialRegister(reg_info, gdb_comm);
437-
438-
if (success && do_reconfigure_arm64_sve) {
439-
AArch64Reconfigure();
440-
InvalidateAllRegisters();
441-
}
442437
}
443438

444439
// Check if writing this register will invalidate any other register
@@ -452,6 +447,11 @@ bool GDBRemoteRegisterContext::WriteRegisterBytes(const RegisterInfo *reg_info,
452447
false);
453448
}
454449

450+
if (success && do_reconfigure_arm64_sve) {
451+
AArch64Reconfigure();
452+
InvalidateAllRegisters();
453+
}
454+
455455
return success;
456456
}
457457
} else {
@@ -772,8 +772,6 @@ void GDBRemoteRegisterContext::AArch64Reconfigure() {
772772
std::optional<uint64_t> vg_reg_value;
773773
const RegisterInfo *vg_reg_info = m_reg_info_sp->GetRegisterInfo("vg");
774774
if (vg_reg_info) {
775-
// Make sure we get the latest value of vg from the remote.
776-
SetRegisterIsValid(vg_reg_info, false);
777775
uint32_t vg_reg_num = vg_reg_info->kinds[eRegisterKindLLDB];
778776
uint64_t reg_value = ReadRegisterAsUnsigned(vg_reg_num, fail_value);
779777
if (reg_value != fail_value && reg_value <= 32)
@@ -783,11 +781,6 @@ void GDBRemoteRegisterContext::AArch64Reconfigure() {
783781
std::optional<uint64_t> svg_reg_value;
784782
const RegisterInfo *svg_reg_info = m_reg_info_sp->GetRegisterInfo("svg");
785783
if (svg_reg_info) {
786-
// When vg is written it is automatically made invalid. Writing vg will also
787-
// change svg if we're in streaming mode but it will not be made invalid
788-
// so do this manually so the following read gets the latest svg value.
789-
SetRegisterIsValid(svg_reg_info, false);
790-
791784
uint32_t svg_reg_num = svg_reg_info->kinds[eRegisterKindLLDB];
792785
uint64_t reg_value = ReadRegisterAsUnsigned(svg_reg_num, fail_value);
793786
if (reg_value != fail_value && reg_value <= 32)

lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,6 +1612,22 @@ bool ProcessGDBRemote::CalculateThreadStopInfo(ThreadGDBRemote *thread) {
16121612
return false;
16131613
}
16141614

1615+
void ProcessGDBRemote::ParseExpeditedRegisters(
1616+
ExpeditedRegisterMap &expedited_register_map, ThreadSP thread_sp) {
1617+
ThreadGDBRemote *gdb_thread = static_cast<ThreadGDBRemote *>(thread_sp.get());
1618+
RegisterContextSP gdb_reg_ctx_sp(gdb_thread->GetRegisterContext());
1619+
1620+
for (const auto &pair : expedited_register_map) {
1621+
StringExtractor reg_value_extractor(pair.second);
1622+
WritableDataBufferSP buffer_sp(
1623+
new DataBufferHeap(reg_value_extractor.GetStringRef().size() / 2, 0));
1624+
reg_value_extractor.GetHexBytes(buffer_sp->GetData(), '\xcc');
1625+
uint32_t lldb_regnum = gdb_reg_ctx_sp->ConvertRegisterKindToRegisterNumber(
1626+
eRegisterKindProcessPlugin, pair.first);
1627+
gdb_thread->PrivateSetRegisterValue(lldb_regnum, buffer_sp->GetData());
1628+
}
1629+
}
1630+
16151631
ThreadSP ProcessGDBRemote::SetThreadStopInfo(
16161632
lldb::tid_t tid, ExpeditedRegisterMap &expedited_register_map,
16171633
uint8_t signo, const std::string &thread_name, const std::string &reason,
@@ -1646,32 +1662,35 @@ ThreadSP ProcessGDBRemote::SetThreadStopInfo(
16461662

16471663
reg_ctx_sp->InvalidateIfNeeded(true);
16481664

1665+
auto iter = std::find(m_thread_ids.begin(), m_thread_ids.end(), tid);
1666+
if (iter != m_thread_ids.end())
1667+
SetThreadPc(thread_sp, iter - m_thread_ids.begin());
1668+
1669+
ParseExpeditedRegisters(expedited_register_map, thread_sp);
1670+
16491671
// AArch64 SVE/SME specific code below updates SVE and ZA register sizes and
16501672
// offsets if value of VG or SVG registers has changed since last stop.
16511673
const ArchSpec &arch = GetTarget().GetArchitecture();
16521674
if (arch.IsValid() && arch.GetTriple().isAArch64()) {
1653-
GDBRemoteRegisterContext *gdb_remote_reg_ctx =
1654-
static_cast<GDBRemoteRegisterContext *>(reg_ctx_sp.get());
1675+
GDBRemoteRegisterContext *reg_ctx_sp =
1676+
static_cast<GDBRemoteRegisterContext *>(
1677+
gdb_thread->GetRegisterContext().get());
16551678

1656-
if (gdb_remote_reg_ctx) {
1657-
gdb_remote_reg_ctx->AArch64Reconfigure();
1658-
gdb_remote_reg_ctx->InvalidateAllRegisters();
1679+
if (reg_ctx_sp) {
1680+
reg_ctx_sp->AArch64Reconfigure();
1681+
// Now we have changed the offsets of all the registers, so the values
1682+
// will be corrupted.
1683+
reg_ctx_sp->InvalidateAllRegisters();
1684+
1685+
// Expedited registers values will never contain registers that would be
1686+
// resized by AArch64Reconfigure. So we are safe to continue using these
1687+
// values. These values include vg, svg and useful general purpose
1688+
// registers so this saves a few read packets each time we make use of
1689+
// them.
1690+
ParseExpeditedRegisters(expedited_register_map, thread_sp);
16591691
}
16601692
}
16611693

1662-
auto iter = std::find(m_thread_ids.begin(), m_thread_ids.end(), tid);
1663-
if (iter != m_thread_ids.end())
1664-
SetThreadPc(thread_sp, iter - m_thread_ids.begin());
1665-
1666-
for (const auto &pair : expedited_register_map) {
1667-
StringExtractor reg_value_extractor(pair.second);
1668-
WritableDataBufferSP buffer_sp(
1669-
new DataBufferHeap(reg_value_extractor.GetStringRef().size() / 2, 0));
1670-
reg_value_extractor.GetHexBytes(buffer_sp->GetData(), '\xcc');
1671-
uint32_t lldb_regnum = reg_ctx_sp->ConvertRegisterKindToRegisterNumber(
1672-
eRegisterKindProcessPlugin, pair.first);
1673-
gdb_thread->PrivateSetRegisterValue(lldb_regnum, buffer_sp->GetData());
1674-
}
16751694
thread_sp->SetName(thread_name.empty() ? nullptr : thread_name.c_str());
16761695

16771696
gdb_thread->SetThreadDispatchQAddr(thread_dispatch_qaddr);

0 commit comments

Comments
 (0)