< prev index next >
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.aarch64/src/org/graalvm/compiler/asm/aarch64/AArch64Assembler.java
Print this page
rev 49736 : 8185505: AArch64: Port AOT to AArch64
Reviewed-by: duke
*** 1,7 ****
/*
! * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,8 ----
/*
! * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
! * Copyright (c) 2018, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 24,33 ****
--- 25,35 ----
import static jdk.vm.ci.aarch64.AArch64.cpuRegisters;
import static org.graalvm.compiler.asm.aarch64.AArch64Assembler.Instruction.ADD;
import static org.graalvm.compiler.asm.aarch64.AArch64Assembler.Instruction.ADDS;
import static org.graalvm.compiler.asm.aarch64.AArch64Assembler.Instruction.ADR;
+ import static org.graalvm.compiler.asm.aarch64.AArch64Assembler.Instruction.ADRP;
import static org.graalvm.compiler.asm.aarch64.AArch64Assembler.Instruction.AND;
import static org.graalvm.compiler.asm.aarch64.AArch64Assembler.Instruction.ANDS;
import static org.graalvm.compiler.asm.aarch64.AArch64Assembler.Instruction.ASRV;
import static org.graalvm.compiler.asm.aarch64.AArch64Assembler.Instruction.BFM;
import static org.graalvm.compiler.asm.aarch64.AArch64Assembler.Instruction.BIC;
*** 1314,1332 ****
/* PC-relative Address Calculation (5.4.4) */
/**
* Address of page: sign extends 21-bit offset, shifts if left by 12 and adds it to the value of
* the PC with its bottom 12-bits cleared, writing the result to dst.
*
* @param dst general purpose register. May not be null, zero-register or stackpointer.
- * @param imm Signed 33-bit offset with lower 12bits clear.
*/
! // protected void adrp(Register dst, long imm) {
! // assert (imm & NumUtil.getNbitNumberInt(12)) == 0 : "Lower 12-bit of immediate must be zero.";
! // assert NumUtil.isSignedNbit(33, imm);
! // addressCalculationInstruction(dst, (int) (imm >>> 12), Instruction.ADRP);
! // }
/**
* Adds a 21-bit signed offset to the program counter and writes the result to dst.
*
* @param dst general purpose register. May not be null, zero-register or stackpointer.
--- 1316,1332 ----
/* PC-relative Address Calculation (5.4.4) */
/**
* Address of page: sign extends 21-bit offset, shifts if left by 12 and adds it to the value of
* the PC with its bottom 12-bits cleared, writing the result to dst.
+ * No offset is emiited; the instruction will be patched later.
*
* @param dst general purpose register. May not be null, zero-register or stackpointer.
*/
! public void adrp(Register dst) {
! emitInt(ADRP.encoding | PcRelImmOp | rd(dst) );
! }
/**
* Adds a 21-bit signed offset to the program counter and writes the result to dst.
*
* @param dst general purpose register. May not be null, zero-register or stackpointer.
*** 1338,1347 ****
--- 1338,1351 ----
public void adr(Register dst, int imm21, int pos) {
emitInt(ADR.encoding | PcRelImmOp | rd(dst) | getPcRelativeImmEncoding(imm21), pos);
}
+ public void adrp(Register dst, int pageOffset) {
+ emitInt(ADRP.encoding | PcRelImmOp | rd(dst) | getPcRelativeImmEncoding(pageOffset));
+ }
+
private static int getPcRelativeImmEncoding(int imm21) {
assert NumUtil.isSignedNbit(21, imm21);
int imm = imm21 & NumUtil.getNbitNumberInt(21);
// higher 19 bit
int immHi = (imm >> 2) << PcRelImmHiOffset;
< prev index next >