Determining the address of a fractional constant

Trying to return a floating point constant.

``````  public static double cnst() {
return 5.2;
}
``````

It turns out to generate the following ir:

``````define double @"simpleD::cnst"() {
B0:
%0 = call i8** inttoptr (i64 140288755967234 to i8** (i32)*)(i32 1)
%1 = alloca i32, i32 8
%2 = getelementptr i8*, i8** %0, i32 528
%3 = load i8*, i8** %2
%4 = getelementptr i32, i32* %1, i32 4
%5 = bitcast i32* %4 to i8**
store i8* %3, i8** %5
%6 = bitcast i8** %2 to i32**
store i32* %4, i32** %6
br label %B1

B1:                                               ; preds = %B0
br label %B2

B2:                                               ; preds = %B1
%7 = call i8* @llvm.returnaddress(i32 0)
%8 = load i32, i32* %4
%9 = bitcast i8** %2 to i32*
store i32 %8, i32* %9
ret double 5.200000e+00
}
``````

Which is then lowering like this(LCPI0_0 - my constant):

lowering
``````# *** IR Dump After Check CFA info and insert CFI instructions if needed ***:
# Machine code for function simpleD::cnst: NoPHIs, TracksLiveness, NoVRegs
Frame Objects:
fi#0: size=32, align=4, at location [SP-32]
Constant Pool:
cp#0: 5.200000e+00, align=8

bb.0.B0:
\$rsp = frame-setup SUB64ri8 \$rsp(tied-def 0), 40, implicit-def dead \$eflags
CFI_INSTRUCTION def_cfa_offset 48
renamable \$rax = MOV64ri 140288755967234
\$edi = MOV32ri 1
CALL64r killed renamable \$rax, <regmask \$bh \$bl \$bp \$bph \$bpl \$bx \$ebp \$ebx \$hbp \$hbx \$rbp \$rbx \$r12 \$r13 \$r14 \$r15 \$r12b \$r13b \$r14b \$r15b \$r12bh \$r13bh \$r14bh \$r15bh \$r12d \$r13d \$r14d \$r15d \$r12w \$r13w \$r14w \$r15w \$r12wh and 3 more...>, implicit \$rsp, implicit \$ssp, implicit killed \$edi, implicit-def \$rsp, implicit-def \$ssp, implicit-def \$rax
renamable \$rcx = MOV64rm renamable \$rax, 1, \$noreg, 4224, \$noreg :: (load 8 from %ir.2)
renamable \$rdx = LEA64r \$rsp, 1, \$noreg, 24, \$noreg
MOV64mr \$rsp, 1, \$noreg, 24, \$noreg, killed renamable \$rcx :: (store 8 into %ir.5)
MOV64mr renamable \$rax, 1, \$noreg, 4224, \$noreg, killed renamable \$rdx :: (store 8 into %ir.6)
renamable \$ecx = MOV32rm \$rsp, 1, \$noreg, 24, \$noreg :: (load 4 from %ir.9)
MOV32mr killed renamable \$rax, 1, \$noreg, 4224, \$noreg, killed renamable \$ecx :: (store 4 into %ir.12)
renamable \$rax = MOV64ri %const.0
renamable \$xmm0 = VMOVSDrm killed renamable \$rax, 1, \$noreg, 0, \$noreg :: (load 8 from constant-pool)
CFI_INSTRUCTION def_cfa_offset 8
RETQ \$xmm0

# End machine code for function simpleD::cnst.

assembler backend - pre-layout
--
<MCAssembler
Sections:[
<MCSection Fragments:[
<MCDataFragment<MCFragment 0x7f972c060b10 LayoutOrder:0 Offset:18446744073709551615 HasInstructions:0 BundlePadding:0>
Contents:[] (0 bytes)>,
<MCAlignFragment<MCFragment 0x7f972c04ab00 LayoutOrder:0 Offset:18446744073709551615 HasInstructions:0> (emit nops)
Alignment:4 Value:0 ValueSize:1 MaxBytesToEmit:4>>,
<MCAlignFragment<MCFragment 0x7f972c0ddc10 LayoutOrder:0 Offset:18446744073709551615 HasInstructions:0> (emit nops)
Alignment:16 Value:0 ValueSize:1 MaxBytesToEmit:16>>,
<MCDataFragment<MCFragment 0x7f972c0ddcb0 LayoutOrder:0 Offset:18446744073709551615 HasInstructions:1 BundlePadding:0>
Contents:[48,83,EC,28,48,B8,02,25,77,85,97,7F,00,00,BF,01,00,00,00,FF,D0,48,8B,88,80,10,00,00,48,8D,54,24,18,48,89,4C,24,18,48,89,90,80,10,00,00,8B,4C,24,18,89,88,80,10,00,00,48,B8,00,00,00,00,00,00,00,00,C5,FB,10,00,48,83,C4,28,C3] (74 bytes),
Fixups:[<MCFixup Offset:57 Value:.LCPI0_0 Kind:3>]>]>,
<MCSection Fragments:[
<MCDataFragment<MCFragment 0x7f972c0614b0 LayoutOrder:0 Offset:18446744073709551615 HasInstructions:0 BundlePadding:0>
Contents:[] (0 bytes)>,
Alignment:8 Value:0 ValueSize:1 MaxBytesToEmit:8>>,
<MCDataFragment<MCFragment 0x7f972c0c0b30 LayoutOrder:0 Offset:18446744073709551615 HasInstructions:0 BundlePadding:0>
Contents:[] (0 bytes)>,
<MCFillFragment<MCFragment 0x7f972c00ed00 LayoutOrder:0 Offset:18446744073709551615 HasInstructions:0> Value:0 ValueSize:1 NumValues:0>,
<MCDataFragment<MCFragment 0x7f972c0ddb20 LayoutOrder:0 Offset:18446744073709551615 HasInstructions:0 BundlePadding:0>
Contents:[CD,CC,CC,CC,CC,CC,14,40] (8 bytes)>,
<MCFillFragment<MCFragment 0x7f972c0c96e0 LayoutOrder:0 Offset:18446744073709551615 HasInstructions:0> Value:0 ValueSize:1 NumValues:0>]>,
<MCSection Fragments:[
<MCDataFragment<MCFragment 0x7f972c0dde80 LayoutOrder:0 Offset:18446744073709551615 HasInstructions:0 BundlePadding:0>
Contents:[] (0 bytes)>]>,
<MCSection Fragments:[
<MCDataFragment<MCFragment 0x7f972c06f490 LayoutOrder:0 Offset:18446744073709551615 HasInstructions:0 BundlePadding:0>
Contents:[00,00,00,00,00,00,00,00,01,7A,52,00,01,78,10,01,1C,0C,07,08,90,01] (22 bytes),
Fixups:[<MCFixup Offset:0 Value:(.Ltmp4-.Ltmp3)-4 Kind:2>]>,
<MCAlignFragment<MCFragment 0x7f972c0ddc60 LayoutOrder:0 Offset:18446744073709551615 HasInstructions:0>
Alignment:4 Value:0 ValueSize:1 MaxBytesToEmit:4>>,
<MCDataFragment<MCFragment 0x7f972c0ddf70 LayoutOrder:0 Offset:18446744073709551615 HasInstructions:0 BundlePadding:0>
Contents:[00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00] (25 bytes),
Fixups:[<MCFixup Offset:0 Value:(.Ltmp6-.Ltmp5)-0 Kind:2>,
<MCFixup Offset:4 Value:(.Ltmp5-.Ltmp3)-0 Kind:2>,
<MCFixup Offset:8 Value:.Ltmp0-.Ltmp7 Kind:3>,
<MCFixup Offset:16 Value:(.Ltmp1-.Ltmp0)-0 Kind:3>]>,
<MCDwarfCallFrameFragment<MCFragment 0x7f972c038ab0 LayoutOrder:0 Offset:18446744073709551615 HasInstructions:0>
<MCDataFragment<MCFragment 0x7f972c0de060 LayoutOrder:0 Offset:18446744073709551615 HasInstructions:0 BundlePadding:0>
Contents:[0E,30] (2 bytes)>,
<MCDwarfCallFrameFragment<MCFragment 0x7f972c037b40 LayoutOrder:0 Offset:18446744073709551615 HasInstructions:0>
<MCDataFragment<MCFragment 0x7f972c0de150 LayoutOrder:0 Offset:18446744073709551615 HasInstructions:0 BundlePadding:0>
Contents:[0E,08] (2 bytes)>,
<MCAlignFragment<MCFragment 0x7f972c0de240 LayoutOrder:0 Offset:18446744073709551615 HasInstructions:0>
Alignment:8 Value:0 ValueSize:1 MaxBytesToEmit:8>>,
<MCDataFragment<MCFragment 0x7f972c0de290 LayoutOrder:0 Offset:18446744073709551615 HasInstructions:0 BundlePadding:0>
Contents:[] (0 bytes)>]>],
Symbols:[(.text, Index:0, ),
(.rodata.cst8, Index:0, ),
(.LCPI0_0, Index:0, ),
(simpleD::cnst, Index:0, ),
(.Ltmp0, Index:0, ),
(.Lcfi0, Index:0, ),
(.Lcfi1, Index:0, ),
(.Lfunc_end0, Index:0, ),
(.Ltmp1, Index:0, ),
(.note.GNU-stack, Index:0, ),
(.eh_frame, Index:0, ),
(.Ltmp2, Index:0, ),
(.Ltmp3, Index:0, ),
(.Ltmp4, Index:0, ),
(.Ltmp6, Index:0, ),
(.Ltmp5, Index:0, ),
(.Ltmp7, Index:0, )]>
assembler backend - post-relaxation
--
<MCAssembler
Sections:[
<MCSection Fragments:[
<MCDataFragment<MCFragment 0x7f972c060b10 LayoutOrder:0 Offset:18446744073709551615 HasInstructions:0 BundlePadding:0>
Contents:[] (0 bytes)>,
<MCAlignFragment<MCFragment 0x7f972c04ab00 LayoutOrder:1 Offset:18446744073709551615 HasInstructions:0> (emit nops)
Alignment:4 Value:0 ValueSize:1 MaxBytesToEmit:4>>,
<MCAlignFragment<MCFragment 0x7f972c0ddc10 LayoutOrder:2 Offset:18446744073709551615 HasInstructions:0> (emit nops)
Alignment:16 Value:0 ValueSize:1 MaxBytesToEmit:16>>,
<MCDataFragment<MCFragment 0x7f972c0ddcb0 LayoutOrder:3 Offset:18446744073709551615 HasInstructions:1 BundlePadding:0>
Contents:[48,83,EC,28,48,B8,02,25,77,85,97,7F,00,00,BF,01,00,00,00,FF,D0,48,8B,88,80,10,00,00,48,8D,54,24,18,48,89,4C,24,18,48,89,90,80,10,00,00,8B,4C,24,18,89,88,80,10,00,00,48,B8,00,00,00,00,00,00,00,00,C5,FB,10,00,48,83,C4,28,C3] (74 bytes),
Fixups:[<MCFixup Offset:57 Value:.LCPI0_0 Kind:3>]>]>,
<MCSection Fragments:[
<MCDataFragment<MCFragment 0x7f972c0614b0 LayoutOrder:0 Offset:18446744073709551615 HasInstructions:0 BundlePadding:0>
Contents:[] (0 bytes)>,
Alignment:8 Value:0 ValueSize:1 MaxBytesToEmit:8>>,
<MCDataFragment<MCFragment 0x7f972c0c0b30 LayoutOrder:2 Offset:18446744073709551615 HasInstructions:0 BundlePadding:0>
Contents:[] (0 bytes)>,
<MCFillFragment<MCFragment 0x7f972c00ed00 LayoutOrder:3 Offset:18446744073709551615 HasInstructions:0> Value:0 ValueSize:1 NumValues:0>,
<MCDataFragment<MCFragment 0x7f972c0ddb20 LayoutOrder:4 Offset:18446744073709551615 HasInstructions:0 BundlePadding:0>
Contents:[CD,CC,CC,CC,CC,CC,14,40] (8 bytes)>,
<MCFillFragment<MCFragment 0x7f972c0c96e0 LayoutOrder:5 Offset:18446744073709551615 HasInstructions:0> Value:0 ValueSize:1 NumValues:0>]>,
<MCSection Fragments:[
<MCDataFragment<MCFragment 0x7f972c0dde80 LayoutOrder:0 Offset:18446744073709551615 HasInstructions:0 BundlePadding:0>
Contents:[] (0 bytes)>]>,
<MCSection Fragments:[
<MCDataFragment<MCFragment 0x7f972c06f490 LayoutOrder:0 Offset:18446744073709551615 HasInstructions:0 BundlePadding:0>
Contents:[00,00,00,00,00,00,00,00,01,7A,52,00,01,78,10,01,1C,0C,07,08,90,01] (22 bytes),
Fixups:[<MCFixup Offset:0 Value:(.Ltmp4-.Ltmp3)-4 Kind:2>]>,
<MCAlignFragment<MCFragment 0x7f972c0ddc60 LayoutOrder:1 Offset:18446744073709551615 HasInstructions:0>
Alignment:4 Value:0 ValueSize:1 MaxBytesToEmit:4>>,
<MCDataFragment<MCFragment 0x7f972c0ddf70 LayoutOrder:2 Offset:18446744073709551615 HasInstructions:0 BundlePadding:0>
Contents:[00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00] (25 bytes),
Fixups:[<MCFixup Offset:0 Value:(.Ltmp6-.Ltmp5)-0 Kind:2>,
<MCFixup Offset:4 Value:(.Ltmp5-.Ltmp3)-0 Kind:2>,
<MCFixup Offset:8 Value:.Ltmp0-.Ltmp7 Kind:3>,
<MCFixup Offset:16 Value:(.Ltmp1-.Ltmp0)-0 Kind:3>]>,
<MCDwarfCallFrameFragment<MCFragment 0x7f972c038ab0 LayoutOrder:3 Offset:18446744073709551615 HasInstructions:0>
<MCDataFragment<MCFragment 0x7f972c0de060 LayoutOrder:4 Offset:18446744073709551615 HasInstructions:0 BundlePadding:0>
Contents:[0E,30] (2 bytes)>,
<MCDwarfCallFrameFragment<MCFragment 0x7f972c037b40 LayoutOrder:5 Offset:18446744073709551615 HasInstructions:0>
<MCDataFragment<MCFragment 0x7f972c0de150 LayoutOrder:6 Offset:18446744073709551615 HasInstructions:0 BundlePadding:0>
Contents:[0E,08] (2 bytes)>,
<MCAlignFragment<MCFragment 0x7f972c0de240 LayoutOrder:7 Offset:18446744073709551615 HasInstructions:0>
Alignment:8 Value:0 ValueSize:1 MaxBytesToEmit:8>>,
<MCDataFragment<MCFragment 0x7f972c0de290 LayoutOrder:8 Offset:18446744073709551615 HasInstructions:0 BundlePadding:0>
Contents:[] (0 bytes)>]>],
Symbols:[(.text, Index:0, ),
(.rodata.cst8, Index:0, ),
(.LCPI0_0, Index:0, ),
(simpleD::cnst, Index:0, ),
(.Ltmp0, Index:0, ),
(.Lcfi0, Index:0, ),
(.Lcfi1, Index:0, ),
(.Lfunc_end0, Index:0, ),
(.Ltmp1, Index:0, ),
(.note.GNU-stack, Index:0, ),
(.eh_frame, Index:0, ),
(.Ltmp2, Index:0, ),
(.Ltmp3, Index:0, ),
(.Ltmp4, Index:0, ),
(.Ltmp6, Index:0, ),
(.Ltmp5, Index:0, ),
(.Ltmp7, Index:0, )]>
assembler backend - final-layout
--
<MCAssembler
Sections:[
<MCSection Fragments:[
<MCDataFragment<MCFragment 0x7f972c060b10 LayoutOrder:0 Offset:0 HasInstructions:0 BundlePadding:0>
Contents:[] (0 bytes)>,
<MCAlignFragment<MCFragment 0x7f972c04ab00 LayoutOrder:1 Offset:0 HasInstructions:0> (emit nops)
Alignment:4 Value:0 ValueSize:1 MaxBytesToEmit:4>>,
<MCAlignFragment<MCFragment 0x7f972c0ddc10 LayoutOrder:2 Offset:0 HasInstructions:0> (emit nops)
Alignment:16 Value:0 ValueSize:1 MaxBytesToEmit:16>>,
<MCDataFragment<MCFragment 0x7f972c0ddcb0 LayoutOrder:3 Offset:0 HasInstructions:1 BundlePadding:0>
Contents:[48,83,EC,28,48,B8,02,25,77,85,97,7F,00,00,BF,01,00,00,00,FF,D0,48,8B,88,80,10,00,00,48,8D,54,24,18,48,89,4C,24,18,48,89,90,80,10,00,00,8B,4C,24,18,89,88,80,10,00,00,48,B8,00,00,00,00,00,00,00,00,C5,FB,10,00,48,83,C4,28,C3] (74 bytes),
Fixups:[<MCFixup Offset:57 Value:.LCPI0_0 Kind:3>]>]>,
<MCSection Fragments:[
<MCDataFragment<MCFragment 0x7f972c0614b0 LayoutOrder:0 Offset:0 HasInstructions:0 BundlePadding:0>
Contents:[] (0 bytes)>,
Alignment:8 Value:0 ValueSize:1 MaxBytesToEmit:8>>,
<MCDataFragment<MCFragment 0x7f972c0c0b30 LayoutOrder:2 Offset:0 HasInstructions:0 BundlePadding:0>
Contents:[] (0 bytes)>,
<MCFillFragment<MCFragment 0x7f972c00ed00 LayoutOrder:3 Offset:0 HasInstructions:0> Value:0 ValueSize:1 NumValues:0>,
<MCDataFragment<MCFragment 0x7f972c0ddb20 LayoutOrder:4 Offset:0 HasInstructions:0 BundlePadding:0>
Contents:[CD,CC,CC,CC,CC,CC,14,40] (8 bytes)>,
<MCFillFragment<MCFragment 0x7f972c0c96e0 LayoutOrder:5 Offset:8 HasInstructions:0> Value:0 ValueSize:1 NumValues:0>]>,
<MCSection Fragments:[
<MCDataFragment<MCFragment 0x7f972c0dde80 LayoutOrder:0 Offset:0 HasInstructions:0 BundlePadding:0>
Contents:[] (0 bytes)>]>,
<MCSection Fragments:[
<MCDataFragment<MCFragment 0x7f972c06f490 LayoutOrder:0 Offset:0 HasInstructions:0 BundlePadding:0>
Contents:[00,00,00,00,00,00,00,00,01,7A,52,00,01,78,10,01,1C,0C,07,08,90,01] (22 bytes),
Fixups:[<MCFixup Offset:0 Value:(.Ltmp4-.Ltmp3)-4 Kind:2>]>,
<MCAlignFragment<MCFragment 0x7f972c0ddc60 LayoutOrder:1 Offset:22 HasInstructions:0>
Alignment:4 Value:0 ValueSize:1 MaxBytesToEmit:4>>,
<MCDataFragment<MCFragment 0x7f972c0ddf70 LayoutOrder:2 Offset:24 HasInstructions:0 BundlePadding:0>
Contents:[00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00] (25 bytes),
Fixups:[<MCFixup Offset:0 Value:(.Ltmp6-.Ltmp5)-0 Kind:2>,
<MCFixup Offset:4 Value:(.Ltmp5-.Ltmp3)-0 Kind:2>,
<MCFixup Offset:8 Value:.Ltmp0-.Ltmp7 Kind:3>,
<MCFixup Offset:16 Value:(.Ltmp1-.Ltmp0)-0 Kind:3>]>,
<MCDwarfCallFrameFragment<MCFragment 0x7f972c038ab0 LayoutOrder:3 Offset:49 HasInstructions:0>
<MCDataFragment<MCFragment 0x7f972c0de060 LayoutOrder:4 Offset:50 HasInstructions:0 BundlePadding:0>
Contents:[0E,30] (2 bytes)>,
<MCDwarfCallFrameFragment<MCFragment 0x7f972c037b40 LayoutOrder:5 Offset:52 HasInstructions:0>
<MCDataFragment<MCFragment 0x7f972c0de150 LayoutOrder:6 Offset:54 HasInstructions:0 BundlePadding:0>
Contents:[0E,08] (2 bytes)>,
<MCAlignFragment<MCFragment 0x7f972c0de240 LayoutOrder:7 Offset:56 HasInstructions:0>
Alignment:8 Value:0 ValueSize:1 MaxBytesToEmit:8>>,
<MCDataFragment<MCFragment 0x7f972c0de290 LayoutOrder:8 Offset:56 HasInstructions:0 BundlePadding:0>
Contents:[] (0 bytes)>]>],
Symbols:[(.text, Index:0, ),
(.rodata.cst8, Index:0, ),
(.LCPI0_0, Index:0, ),
(simpleD::cnst, Index:0, ),
(.Ltmp0, Index:0, ),
(.Lcfi0, Index:0, ),
(.Lcfi1, Index:0, ),
(.Lfunc_end0, Index:0, ),
(.Ltmp1, Index:0, ),
(.note.GNU-stack, Index:0, ),
(.eh_frame, Index:0, ),
(.Ltmp2, Index:0, ),
(.Ltmp3, Index:0, ),
(.Ltmp4, Index:0, ),
(.Ltmp6, Index:0, ),
(.Ltmp5, Index:0, ),
(.Ltmp7, Index:0, )]>
``````

The final assembler looks like this:

``````  # {method} {0x00007f974d9409c0} 'cnst' '()D' in 'simpleD'
#           [sp+0xbeb0aa0]  (sp of caller)
0x00007f977d1d6740: sub    \$0x28,%rsp
0x00007f977d1d6744: movabs \$0x7f9785772502,%rax
0x00007f977d1d674e: mov    \$0x1,%edi
0x00007f977d1d6753: callq  *%rax
0x00007f977d1d6755: mov    0x1080(%rax),%rcx
0x00007f977d1d675c: lea    0x18(%rsp),%rdx
0x00007f977d1d6761: mov    %rcx,0x18(%rsp)
0x00007f977d1d6766: mov    %rdx,0x1080(%rax)
0x00007f977d1d676d: mov    0x18(%rsp),%ecx
0x00007f977d1d6771: mov    %ecx,0x1080(%rax)
0x00007f977d1d6777: movabs \$0x0,%rax
0x00007f977d1d6781: vmovsd (%rax),%xmm0
``````  0x00007f977d1d6777: movabs \$0x0,%rax