Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Unified Diff: src/IceAssemblerARM32.h

Issue 1424863005: Handle MOV (immediate) and MOVT to load ARM global addresses. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix movw and movt Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/IceAssemblerARM32.h
diff --git a/src/IceAssemblerARM32.h b/src/IceAssemblerARM32.h
index d2523f610531529f02e6cc2c757c5020de9c1f65..f5291c1203a8ff5772b99e2656c7464ed780f52a 100644
--- a/src/IceAssemblerARM32.h
+++ b/src/IceAssemblerARM32.h
@@ -44,6 +44,16 @@ using IValueT = uint32_t;
/// An Offset value (+/-) used in an ARM 32-bit instruction.
using IOffsetT = int32_t;
+/// Handles encoding of bottom/top 16 bits of an address using movw/movt.
+class MoveRelocatableFixup : public AssemblerFixup {
+ MoveRelocatableFixup &operator=(const MoveRelocatableFixup &) = delete;
+ MoveRelocatableFixup(const MoveRelocatableFixup &) = default;
+
+public:
+ MoveRelocatableFixup() = default;
+ size_t emit(GlobalContext *Ctx, const Assembler &Asm) const override;
+};
+
class AssemblerARM32 : public Assembler {
AssemblerARM32(const AssemblerARM32 &) = delete;
AssemblerARM32 &operator=(const AssemblerARM32 &) = delete;
@@ -65,6 +75,8 @@ public:
}
}
+ MoveRelocatableFixup *createMoveFixup(bool IsMovW, const Constant *Value);
+
void alignFunction() override {
const SizeT Align = 1 << getBundleAlignLog2Bytes();
SizeT BytesNeeded = Utils::OffsetToAlignment(Buffer.getPosition(), Align);
@@ -137,6 +149,10 @@ public:
void mov(const Operand *OpRd, const Operand *OpSrc, CondARM32::Cond Cond);
+ void movw(const Operand *OpRd, const Operand *OpSrc, CondARM32::Cond Cond);
+
+ void movt(const Operand *OpRd, const Operand *OpSrc, CondARM32::Cond Cond);
+
void bx(RegARM32::GPRRegister Rm, CondARM32::Cond Cond = CondARM32::AL);
void sbc(const Operand *OpRd, const Operand *OpRn, const Operand *OpSrc1,

Powered by Google App Engine
This is Rietveld 408576698