This is an archive of the discontinued LLVM Phabricator instance.

Support StackMaps For ARM
Needs ReviewPublic

Authored by linzj on Nov 26 2018, 10:09 PM.

Details

Summary

Support StackMaps for ARM arch.

Diff Detail

Repository
rL LLVM

Event Timeline

linzj created this revision.Nov 26 2018, 10:09 PM
linzj marked an inline comment as done.EditedNov 26 2018, 10:15 PM

This patch pass the test:

; ModuleID = 'test'
source_filename = "test"
target triple = "armv7-linux-android"

define i64 @main([40 x i64]*) {
Prologue:
  br label %Body

Body:                                             ; preds = %Prologue
  %1 = getelementptr inbounds [40 x i64], [40 x i64]* %0, i32 0, i32 2
  %2 = load i64, i64* %1
  %3 = getelementptr inbounds [40 x i64], [40 x i64]* %0, i32 0, i32 0
  %4 = load i64, i64* %3
  %5 = add i64 %4, 1
  %6 = icmp ne i64 %2, 0
  %7 = select i1 %6, i64 %5, i64 %4
  %8 = getelementptr inbounds [40 x i64], [40 x i64]* %0, i32 0, i32 0
  store i64 %7, i64* %8
  br label %Patch

Patch:                                            ; preds = %Body
  %9 = getelementptr inbounds [40 x i64], [40 x i64]* %0, i32 0, i32 24
  store i64 4707696, i64* %9
  call anyregcc void (i64, i32, i8*, i32, ...) @llvm.experimental.patchpoint.void(i64 1, i32 17, i8* inttoptr (i32 17 to i8*), i32 1, i8* inttoptr (i64 4707696 to i8*))
  unreachable
}
And emit the assembly:
	.text
	.syntax unified
	.eabi_attribute	67, "2.09"	@ Tag_conformance
	.eabi_attribute	6, 10	@ Tag_CPU_arch
	.eabi_attribute	7, 65	@ Tag_CPU_arch_profile
	.eabi_attribute	8, 1	@ Tag_ARM_ISA_use
	.eabi_attribute	9, 2	@ Tag_THUMB_ISA_use
	.fpu	neon
	.eabi_attribute	34, 1	@ Tag_CPU_unaligned_access
	.eabi_attribute	17, 1	@ Tag_ABI_PCS_GOT_use
	.eabi_attribute	20, 1	@ Tag_ABI_FP_denormal
	.eabi_attribute	21, 1	@ Tag_ABI_FP_exceptions
	.eabi_attribute	23, 3	@ Tag_ABI_FP_number_model
	.eabi_attribute	24, 1	@ Tag_ABI_align_needed
	.eabi_attribute	25, 1	@ Tag_ABI_align_preserved
	.eabi_attribute	38, 1	@ Tag_ABI_FP_16bit_format
	.eabi_attribute	14, 0	@ Tag_ABI_PCS_R9_use
	.file	"test"
	.globl	main                    @ -- Begin function main
	.p2align	2
	.type	main,%function
	.code	32                      @ @main
main:
	.fnstart
@ %bb.0:                                @ %Prologue
	.save	{r4, r5, r6, r7, r8, r9, r11, lr}
	push	{r4, r5, r6, r7, r8, r9, r11, lr}
	ldrd	r4, r5, [r0]
	movw	r2, #54640
	ldrd	r6, r7, [r0, #16]
	movt	r2, #71
	adds	r8, r4, #1
	mov	r3, #0
	adc	r9, r5, #0
	orrs	r1, r6, r7
	moveq	r8, r4
	moveq	r9, r5
	strd	r2, r3, [r0, #192]
	strd	r8, r9, [r0]
.Ltmp0:
	movt	r12, #0
	movw	r12, #17
	blx	r12
	nop
.Lfunc_end0:
	.size	main, .Lfunc_end0-main
	.fnend
                                        @ -- End function

	.section	".note.GNU-stack","",%progbits
	.section	.llvm_stackmaps,"a",%progbits
__LLVM_StackMaps:
	.byte	3
	.byte	0
	.short	0
	.long	1
	.long	0
	.long	1
	.long	4294967295
	.long	4294967295
	.long	32
	.long	0
	.long	1
	.long	0
	.long	1
	.long	0
	.long	.Ltmp0-main
	.short	0
	.short	1
	.byte	1
	.byte	0
	.short	4
	.short	2
	.short	0
	.long	0
	.p2align	3
	.short	0
	.short	0
	.p2align	3
lib/MC/MCAsmStreamer.cpp
917

I make it emit invalid integer for the output of assembly file.