mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-07-26 21:30:32 +00:00
Widen the instruction encoder that TblGen emits to a 64 bits, which should accomodate every target I can think of offhand.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148833 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e983a134e7
commit
4f8dc7b17a
@ -74,7 +74,7 @@ namespace {
|
|||||||
/// getBinaryCodeForInstr - This function, generated by the
|
/// getBinaryCodeForInstr - This function, generated by the
|
||||||
/// CodeEmitterGenerator using TableGen, produces the binary encoding for
|
/// CodeEmitterGenerator using TableGen, produces the binary encoding for
|
||||||
/// machine instructions.
|
/// machine instructions.
|
||||||
unsigned getBinaryCodeForInstr(const MachineInstr &MI) const;
|
uint64_t getBinaryCodeForInstr(const MachineInstr &MI) const;
|
||||||
|
|
||||||
bool runOnMachineFunction(MachineFunction &MF);
|
bool runOnMachineFunction(MachineFunction &MF);
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ public:
|
|||||||
|
|
||||||
// getBinaryCodeForInstr - TableGen'erated function for getting the
|
// getBinaryCodeForInstr - TableGen'erated function for getting the
|
||||||
// binary encoding for an instruction.
|
// binary encoding for an instruction.
|
||||||
unsigned getBinaryCodeForInstr(const MCInst &MI,
|
uint64_t getBinaryCodeForInstr(const MCInst &MI,
|
||||||
SmallVectorImpl<MCFixup> &Fixups) const;
|
SmallVectorImpl<MCFixup> &Fixups) const;
|
||||||
|
|
||||||
/// getMachineOpValue - Return binary encoding of operand. If the machine
|
/// getMachineOpValue - Return binary encoding of operand. If the machine
|
||||||
|
@ -43,7 +43,7 @@ public:
|
|||||||
|
|
||||||
// getBinaryCodeForInstr - TableGen'erated function for getting the
|
// getBinaryCodeForInstr - TableGen'erated function for getting the
|
||||||
// binary encoding for an instruction.
|
// binary encoding for an instruction.
|
||||||
unsigned getBinaryCodeForInstr(const MCInst &MI) const;
|
uint64_t getBinaryCodeForInstr(const MCInst &MI) const;
|
||||||
|
|
||||||
/// getMachineOpValue - Return binary encoding of operand. If the machine
|
/// getMachineOpValue - Return binary encoding of operand. If the machine
|
||||||
/// operand requires relocation, record the relocation and return zero.
|
/// operand requires relocation, record the relocation and return zero.
|
||||||
|
@ -58,7 +58,7 @@ public:
|
|||||||
|
|
||||||
// getBinaryCodeForInstr - TableGen'erated function for getting the
|
// getBinaryCodeForInstr - TableGen'erated function for getting the
|
||||||
// binary encoding for an instruction.
|
// binary encoding for an instruction.
|
||||||
unsigned getBinaryCodeForInstr(const MCInst &MI,
|
uint64_t getBinaryCodeForInstr(const MCInst &MI,
|
||||||
SmallVectorImpl<MCFixup> &Fixups) const;
|
SmallVectorImpl<MCFixup> &Fixups) const;
|
||||||
|
|
||||||
// getBranchJumpOpValue - Return binary encoding of the jump
|
// getBranchJumpOpValue - Return binary encoding of the jump
|
||||||
|
@ -80,7 +80,7 @@ class MipsCodeEmitter : public MachineFunctionPass {
|
|||||||
/// getBinaryCodeForInstr - This function, generated by the
|
/// getBinaryCodeForInstr - This function, generated by the
|
||||||
/// CodeEmitterGenerator using TableGen, produces the binary encoding for
|
/// CodeEmitterGenerator using TableGen, produces the binary encoding for
|
||||||
/// machine instructions.
|
/// machine instructions.
|
||||||
unsigned getBinaryCodeForInstr(const MachineInstr &MI) const;
|
uint64_t getBinaryCodeForInstr(const MachineInstr &MI) const;
|
||||||
|
|
||||||
void emitInstruction(const MachineInstr &MI);
|
void emitInstruction(const MachineInstr &MI);
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ public:
|
|||||||
|
|
||||||
// getBinaryCodeForInstr - TableGen'erated function for getting the
|
// getBinaryCodeForInstr - TableGen'erated function for getting the
|
||||||
// binary encoding for an instruction.
|
// binary encoding for an instruction.
|
||||||
unsigned getBinaryCodeForInstr(const MCInst &MI,
|
uint64_t getBinaryCodeForInstr(const MCInst &MI,
|
||||||
SmallVectorImpl<MCFixup> &Fixups) const;
|
SmallVectorImpl<MCFixup> &Fixups) const;
|
||||||
void EncodeInstruction(const MCInst &MI, raw_ostream &OS,
|
void EncodeInstruction(const MCInst &MI, raw_ostream &OS,
|
||||||
SmallVectorImpl<MCFixup> &Fixups) const {
|
SmallVectorImpl<MCFixup> &Fixups) const {
|
||||||
|
@ -50,7 +50,7 @@ namespace {
|
|||||||
/// getBinaryCodeForInstr - This function, generated by the
|
/// getBinaryCodeForInstr - This function, generated by the
|
||||||
/// CodeEmitterGenerator using TableGen, produces the binary encoding for
|
/// CodeEmitterGenerator using TableGen, produces the binary encoding for
|
||||||
/// machine instructions.
|
/// machine instructions.
|
||||||
unsigned getBinaryCodeForInstr(const MachineInstr &MI) const;
|
uint64_t getBinaryCodeForInstr(const MachineInstr &MI) const;
|
||||||
|
|
||||||
|
|
||||||
MachineRelocation GetRelocation(const MachineOperand &MO,
|
MachineRelocation GetRelocation(const MachineOperand &MO,
|
||||||
|
@ -169,13 +169,13 @@ AddCodeToMergeInOperand(Record *R, BitsInit *BI, const std::string &VarName,
|
|||||||
opShift = beginInstBit - beginVarBit;
|
opShift = beginInstBit - beginVarBit;
|
||||||
|
|
||||||
if (opShift > 0) {
|
if (opShift > 0) {
|
||||||
Case += " Value |= (op & " + utostr(opMask) + "U) << " +
|
Case += " Value |= (op & UINT64_C(" + utostr(opMask) + ")) << " +
|
||||||
itostr(opShift) + ";\n";
|
itostr(opShift) + ";\n";
|
||||||
} else if (opShift < 0) {
|
} else if (opShift < 0) {
|
||||||
Case += " Value |= (op & " + utostr(opMask) + "U) >> " +
|
Case += " Value |= (op & UINT64_C(" + utostr(opMask) + ")) >> " +
|
||||||
itostr(-opShift) + ";\n";
|
itostr(-opShift) + ";\n";
|
||||||
} else {
|
} else {
|
||||||
Case += " Value |= op & " + utostr(opMask) + "U;\n";
|
Case += " Value |= op & UINT64_C(" + utostr(opMask) + ");\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -220,7 +220,7 @@ void CodeEmitterGen::run(raw_ostream &o) {
|
|||||||
Target.getInstructionsByEnumValue();
|
Target.getInstructionsByEnumValue();
|
||||||
|
|
||||||
// Emit function declaration
|
// Emit function declaration
|
||||||
o << "unsigned " << Target.getName();
|
o << "uint64_t " << Target.getName();
|
||||||
if (MCEmitter)
|
if (MCEmitter)
|
||||||
o << "MCCodeEmitter::getBinaryCodeForInstr(const MCInst &MI,\n"
|
o << "MCCodeEmitter::getBinaryCodeForInstr(const MCInst &MI,\n"
|
||||||
<< " SmallVectorImpl<MCFixup> &Fixups) const {\n";
|
<< " SmallVectorImpl<MCFixup> &Fixups) const {\n";
|
||||||
@ -238,7 +238,7 @@ void CodeEmitterGen::run(raw_ostream &o) {
|
|||||||
|
|
||||||
if (R->getValueAsString("Namespace") == "TargetOpcode" ||
|
if (R->getValueAsString("Namespace") == "TargetOpcode" ||
|
||||||
R->getValueAsBit("isPseudo")) {
|
R->getValueAsBit("isPseudo")) {
|
||||||
o << " 0U,\n";
|
o << " UINT64_C(0),\n";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,9 +250,9 @@ void CodeEmitterGen::run(raw_ostream &o) {
|
|||||||
if (BitInit *B = dynamic_cast<BitInit*>(BI->getBit(e-i-1)))
|
if (BitInit *B = dynamic_cast<BitInit*>(BI->getBit(e-i-1)))
|
||||||
Value |= B->getValue() << (e-i-1);
|
Value |= B->getValue() << (e-i-1);
|
||||||
}
|
}
|
||||||
o << " " << Value << "U," << '\t' << "// " << R->getName() << "\n";
|
o << " UINT64_C(" << Value << ")," << '\t' << "// " << R->getName() << "\n";
|
||||||
}
|
}
|
||||||
o << " 0U\n };\n";
|
o << " UINT64_C(0)\n };\n";
|
||||||
|
|
||||||
// Map to accumulate all the cases.
|
// Map to accumulate all the cases.
|
||||||
std::map<std::string, std::vector<std::string> > CaseMap;
|
std::map<std::string, std::vector<std::string> > CaseMap;
|
||||||
|
Loading…
Reference in New Issue
Block a user