@@ -209,7 +209,7 @@ bool flagRequired(Vflags flags, StatusFlags flag) {
209209struct Vgen {
210210 explicit Vgen (Venv& env)
211211 : env(env)
212- , assem(*env.cb)
212+ , assem(*env.cb, &env.meta )
213213 , a(&assem)
214214 , base(a->frontier ())
215215 , current(env.current)
@@ -622,12 +622,11 @@ void Vgen::handleLiterals(Venv& env) {
622622 if (pl.width == 32 ) {
623623 cb->dword (static_cast <uint32_t >(pl.value ));
624624 } else if (pl.width == 64 ) {
625- if (pl.smashable ) {
626- // Although the region is actually dead, we mark it as live, so that
627- // the relocator can remove the padding.
628- align (*cb, &env.meta , Alignment::QuadWordSmashable, AlignContext::Live);
629- literalAddress = cb->frontier ();
630- }
625+ // Although the region is actually dead, we mark it as live, so that
626+ // the relocator can remove the padding.
627+ align (*cb, &env.meta , Alignment::QuadWordSmashable,
628+ pl.smashable ? AlignContext::Live : AlignContext::Dead);
629+ literalAddress = cb->frontier ();
631630 cb->qword (pl.value );
632631 } else {
633632 not_reached ();
@@ -799,11 +798,18 @@ void Vgen::emit(const fallthru& /*i*/) {
799798
800799#define Y (vasm_opc, simd_w, vr_w, gpr_w, imm ) \
801800void Vgen::emit (const vasm_opc& i) { \
801+ vixl::Label data; \
802802 if (i.d .isSIMD ()) { \
803803 emitSimdImmInt (a, static_cast <uint##vr_w##_t>(i.s .simd_w ()), i.d ); \
804804 } else { \
805805 Vreg##vr_w d = i.d ; \
806- a->Mov (gpr_w (d), imm); \
806+ if constexpr (vr_w > 16 ) { \
807+ poolLiteral (*env.cb , env.meta , imm, vr_w, false ); \
808+ a->bind (&data); \
809+ a->Ldr (gpr_w (d), &data); \
810+ } else { \
811+ a->Mov (gpr_w (d), imm); \
812+ } \
807813 } \
808814}
809815
@@ -857,9 +863,13 @@ void Vgen::emit(const mcprep& i) {
857863// /////////////////////////////////////////////////////////////////////////////
858864
859865void Vgen::emit (const call& i) {
866+ vixl::Label data;
860867 if (!i.stackUnaligned ) trap_unaligned_stack ();
861868 recordAddressImmediate ();
862- a->Mov (rAsm, i.target );
869+
870+ poolLiteral (*env.cb , env.meta , (uint64_t )i.target , 32 , false );
871+ a->bind (&data); // This will be remapped during the handleLiterals phase.
872+ a->Ldr (rAsm_w, &data);
863873 a->Blr (rAsm);
864874 if (i.watch ) {
865875 *i.watch = a->frontier ();
@@ -1135,7 +1145,6 @@ void Vgen::emit(const lea& i) {
11351145
11361146void Vgen::emit (const leap& i) {
11371147 vixl::Label imm_data;
1138- vixl::Label after_data;
11391148
11401149 // Cannot use simple a->Mov() since such a sequence cannot be
11411150 // adjusted while live following a relocation.
@@ -1147,8 +1156,12 @@ void Vgen::emit(const leap& i) {
11471156}
11481157
11491158void Vgen::emit (const lead& i) {
1159+ vixl::Label imm_data;
1160+
11501161 recordAddressImmediate ();
1151- a->Mov (X (i.d ), i.s .get ());
1162+ poolLiteral (*env.cb , env.meta , (uint64_t )i.s .get (), 32 , false );
1163+ a->bind (&imm_data); // This will be remapped during the handleLiterals phase.
1164+ a->Ldr (W (i.d ), &imm_data);
11521165}
11531166
11541167#define Y (vasm_opc, arm_opc, src_dst, m ) \
0 commit comments