mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-11-23 16:19:52 +00:00
[mips][microMIPS] MicroMIPS 16-bit unconditional branch instruction B
Implement microMIPS 16-bit unconditional branch instruction B. Implemented 16-bit microMIPS unconditional instruction has real name B16, and B is an alias which expands to either B16 or BEQ according to the rules: b 256 --> b16 256 # R_MICROMIPS_PC10_S1 b 12256 --> beq $zero, $zero, 12256 # R_MICROMIPS_PC16_S1 b label --> beq $zero, $zero, label # R_MICROMIPS_PC16_S1 Differential Revision: http://reviews.llvm.org/D3514 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226657 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -111,6 +111,14 @@ static unsigned adjustFixupValue(const MCFixup &Fixup, uint64_t Value,
|
||||
if (!isIntN(7, Value) && Ctx)
|
||||
Ctx->FatalError(Fixup.getLoc(), "out of range PC7 fixup");
|
||||
break;
|
||||
case Mips::fixup_MICROMIPS_PC10_S1:
|
||||
Value -= 2;
|
||||
// Forcing a signed division because Value can be negative.
|
||||
Value = (int64_t) Value / 2;
|
||||
// We now check if Value can be encoded as a 10-bit signed immediate.
|
||||
if (!isIntN(10, Value) && Ctx)
|
||||
Ctx->FatalError(Fixup.getLoc(), "out of range PC10 fixup");
|
||||
break;
|
||||
case Mips::fixup_MICROMIPS_PC16_S1:
|
||||
Value -= 4;
|
||||
// Forcing a signed division because Value can be negative.
|
||||
@@ -157,7 +165,8 @@ MCObjectWriter *MipsAsmBackend::createObjectWriter(raw_ostream &OS) const {
|
||||
// microMIPS: x | x | a | b
|
||||
|
||||
static bool needsMMLEByteOrder(unsigned Kind) {
|
||||
return Kind >= Mips::fixup_MICROMIPS_26_S1 &&
|
||||
return Kind != Mips::fixup_MICROMIPS_PC10_S1 &&
|
||||
Kind >= Mips::fixup_MICROMIPS_26_S1 &&
|
||||
Kind < Mips::LastTargetFixupKind;
|
||||
}
|
||||
|
||||
@@ -190,6 +199,7 @@ void MipsAsmBackend::applyFixup(const MCFixup &Fixup, char *Data,
|
||||
switch ((unsigned)Kind) {
|
||||
case FK_Data_2:
|
||||
case Mips::fixup_Mips_16:
|
||||
case Mips::fixup_MICROMIPS_PC10_S1:
|
||||
FullSize = 2;
|
||||
break;
|
||||
case FK_Data_8:
|
||||
@@ -280,6 +290,7 @@ getFixupKindInfo(MCFixupKind Kind) const {
|
||||
{ "fixup_MICROMIPS_LO16", 0, 16, 0 },
|
||||
{ "fixup_MICROMIPS_GOT16", 0, 16, 0 },
|
||||
{ "fixup_MICROMIPS_PC7_S1", 0, 7, MCFixupKindInfo::FKF_IsPCRel },
|
||||
{ "fixup_MICROMIPS_PC10_S1", 0, 10, MCFixupKindInfo::FKF_IsPCRel },
|
||||
{ "fixup_MICROMIPS_PC16_S1", 0, 16, MCFixupKindInfo::FKF_IsPCRel },
|
||||
{ "fixup_MICROMIPS_CALL16", 0, 16, 0 },
|
||||
{ "fixup_MICROMIPS_GOT_DISP", 0, 16, 0 },
|
||||
@@ -344,6 +355,7 @@ getFixupKindInfo(MCFixupKind Kind) const {
|
||||
{ "fixup_MICROMIPS_LO16", 16, 16, 0 },
|
||||
{ "fixup_MICROMIPS_GOT16", 16, 16, 0 },
|
||||
{ "fixup_MICROMIPS_PC7_S1", 9, 7, MCFixupKindInfo::FKF_IsPCRel },
|
||||
{ "fixup_MICROMIPS_PC10_S1", 6, 10, MCFixupKindInfo::FKF_IsPCRel },
|
||||
{ "fixup_MICROMIPS_PC16_S1",16, 16, MCFixupKindInfo::FKF_IsPCRel },
|
||||
{ "fixup_MICROMIPS_CALL16", 16, 16, 0 },
|
||||
{ "fixup_MICROMIPS_GOT_DISP", 16, 16, 0 },
|
||||
|
||||
Reference in New Issue
Block a user