mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
[PowerPC] Support absolute branches
There is currently only limited support for the "absolute" variants of branch instructions. This patch adds support for the absolute variants of all branches that are currently otherwise supported. This requires adding new fixup types so that the correct variant of relocation type can be selected by the object writer. While the compiler will continue to usually choose the relative branch variants, this will allow the asm parser to fully support the absolute branches, with either immediate (numerical) or symbolic target addresses. No change in code generation intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184721 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -267,6 +267,12 @@ public:
|
||||
bool isS16ImmX4() const { return Kind == Expression ||
|
||||
(Kind == Immediate && isInt<16>(getImm()) &&
|
||||
(getImm() & 3) == 0); }
|
||||
bool isDirectBr() const { return Kind == Expression ||
|
||||
(Kind == Immediate && isInt<26>(getImm()) &&
|
||||
(getImm() & 3) == 0); }
|
||||
bool isCondBr() const { return Kind == Expression ||
|
||||
(Kind == Immediate && isInt<16>(getImm()) &&
|
||||
(getImm() & 3) == 0); }
|
||||
bool isRegNumber() const { return Kind == Immediate && isUInt<5>(getImm()); }
|
||||
bool isCCRegNumber() const { return Kind == Immediate &&
|
||||
isUInt<3>(getImm()); }
|
||||
@@ -351,6 +357,14 @@ public:
|
||||
Inst.addOperand(MCOperand::CreateExpr(getExpr()));
|
||||
}
|
||||
|
||||
void addBranchTargetOperands(MCInst &Inst, unsigned N) const {
|
||||
assert(N == 1 && "Invalid number of operands!");
|
||||
if (Kind == Immediate)
|
||||
Inst.addOperand(MCOperand::CreateImm(getImm() / 4));
|
||||
else
|
||||
Inst.addOperand(MCOperand::CreateExpr(getExpr()));
|
||||
}
|
||||
|
||||
StringRef getToken() const {
|
||||
assert(Kind == Token && "Invalid access!");
|
||||
return StringRef(Tok.Data, Tok.Length);
|
||||
|
Reference in New Issue
Block a user