This is an archive of the discontinued LLVM Phabricator instance.

Add subrange debugging for languages that support native subrange types
Needs ReviewPublic

Authored by demoitem on Sep 22 2021, 5:40 PM.

Details

Reviewers
aprantl
deadalnix
Summary

This patch allows languages that support native subranges in their definition
(eg Pascal, Ada, Modula3 ...) to get debugging support for declarations of that type.
In these examples a variable can be declared as a subrange of the full integer
range or a subrange of an enumeration. Apart from runtime checks on these
declarations a suitable debugger could warn of violations of the range.

Diff Detail

Event Timeline

demoitem created this revision.Sep 22 2021, 5:40 PM
demoitem requested review of this revision.Sep 22 2021, 5:40 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 22 2021, 5:40 PM

I think this looks generally reasonable.

Is my understanding correctly that this is in support of types like Pascals type subrange : 1..10?

Can you add llvm-as/dis round-trip tests to test/Assembler?
I don't see a test for the DIExpression bounds case?

llvm/test/DebugInfo/X86/subrange.ll
6

Would you mind also including the source code in a comment? It might helps reading the testcase's metadata.

llvm/test/Verifier/subrange.ll
23

This test looks like it could be reduced quite a bit and it probably doesn't even need any code at all. You can take a look at other verifier tests for examples.

Ah, thank you for doing this. We have noticed the lack of support when porting our Pascal over to OpenVMS x86.

On our proprietary Itanium backend, we generate as a point of comparison. We also allow run-time upper/lower bounds as well.

00000780 00000100 00000003 [03] (base type) (level: 2)
00000781 00000101 name: "BIGGEST"
00000789 00000109 encoding: 05 (5) (signed)
0000078a 0000010a byte size: [04] 0000000000000004 (4)
0000078b 0000010b 00000007 [07] (subrange) (level: 2)
0000078c 0000010c name: "BIGGEST"
00000794 00000114 type: ref: 00000100 (00000100)
00000798 00000118 lower bound: [01] 0000000000000001 (1)
00000799 00000119 upper bound: [e400] 0000000000000064 (100)
0000079b 0000011b 00000008 [08] (variable) (level: 2)
0000079c 0000011c name: "BIG"
000007a0 00000120 type: ref: 0000010b (0000010b)
000007a4 00000124 location: block length: [03] 3 (3)
000007a5 00000125 7c (breg12) [a001] 00000000000000a0 (r12+160)